diff --git a/.agents/skills/updatefirstmate/SKILL.md b/.agents/skills/updatefirstmate/SKILL.md index 9c0c5a71f18..2ddfcb16b07 100644 --- a/.agents/skills/updatefirstmate/SKILL.md +++ b/.agents/skills/updatefirstmate/SKILL.md @@ -54,7 +54,7 @@ This touches only the firstmate repo and its own worktrees, never anything under 2. **Re-read AGENTS.md if your own instructions changed.** When the updater printed `reread-firstmate: yes`, the tracked instruction surface (`AGENTS.md`, `bin/`, or `.agents/skills/`) just advanced under you. - **Read `AGENTS.md` now** (CLAUDE.md is a real `@AGENTS.md` pointer to it) to refresh your operating instructions before doing anything else, so you are acting on the new instructions rather than the stale ones you were started with. + **Read `AGENTS.md` now** to refresh your operating instructions before doing anything else, so you are acting on the new instructions rather than the stale ones you were started with. When it printed `reread-firstmate: no`, nothing changed for you - skip the re-read. 3. **Restart every second mate the updater named.** diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8436d065119..b8ce45e6d1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -487,13 +487,6 @@ jobs: - name: Compatibility pointers must stay intact run: | set -eu - [ ! -L CLAUDE.md ] || { echo "::error::CLAUDE.md must be a real @AGENTS.md pointer file, not a symlink"; exit 1; } - tmp=$(mktemp) - trap 'rm -f "$tmp"' EXIT - printf '%s\n' \ - '' \ - '@AGENTS.md' >"$tmp" - cmp -s CLAUDE.md "$tmp" || { echo "::error::CLAUDE.md must be the canonical @AGENTS.md pointer"; exit 1; } [ "$(readlink .claude/skills)" = "../.agents/skills" ] || { echo "::error::.claude/skills must be a symlink to ../.agents/skills"; exit 1; } - name: Personal fleet paths must not be tracked run: | diff --git a/AGENTS.md b/AGENTS.md index c4f62af7dbc..918caf7bc74 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -58,7 +58,7 @@ Each secondmate has a persistent isolated `FM_HOME`, including its own state, ba Tracked files hold shared instructions and tooling; `data/` holds durable private fleet records; `state/` holds runtime records and append-only status events; `config/` holds local operating choices; and `projects/` contains clones that are read-only to firstmate except under hard rule 1's concrete captain-approved project operation exception. ``` -AGENTS.md this file (CLAUDE.md is a real @AGENTS.md pointer to it) +AGENTS.md this file CONTRIBUTING.md contributor workflow and repo conventions README.md public overview and development notes .github/workflows/ shared CI and PR enforcement, committed diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index a9d4d2694af..00000000000 --- a/CLAUDE.md +++ /dev/null @@ -1,2 +0,0 @@ - -@AGENTS.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e2fd860cafd..dd8e33d8f65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,7 +52,7 @@ Coordinate any workflow rollback with its required-check names so a retired chec ## Repo conventions - This repo is a template for running a firstmate orchestrator agent. - [`AGENTS.md`](AGENTS.md) owns the supervisor contract, role boundary, and bundled firstmate skill triggers; `CLAUDE.md` is a real `@AGENTS.md` pointer to it, and `.claude/skills` is a symlink to `.agents/skills`. + [`AGENTS.md`](AGENTS.md) owns the supervisor contract, role boundary, and bundled firstmate skill triggers, and `.claude/skills` is a symlink to `.agents/skills`. - Only shared material is tracked: `AGENTS.md`, `README.md`, `CONTRIBUTING.md`, `.tasks.toml`, `.github/workflows/`, `bin/`, `.agents/skills/`, and `skills/`. `.agents/skills/` holds agent-loaded skills that assume a live firstmate home and carry `metadata.internal: true` so installers such as [skills.sh](https://skills.sh) hide them from discovery; `skills/` holds standalone, installer-facing public skills with no firstmate dependency (see the README's "Two-tier skill layout"). `.claude/mods/` holds Claude Code mods, plugins whose behavior lives in one function-hooks module; each is reached through an `.agents/skills/` symlink because Claude Code adopts project plugins only from `.claude/skills`, carries no `SKILL.md` so every other harness's skill loader ignores that entry, and imports only files physically inside its own folder because Claude Code refuses anything else. @@ -114,10 +114,6 @@ bin/fm-test-run.sh --all # deliberate complete regression (optional local full bin/fm-test-isolation-proof.sh --list # proven portable parallel candidate set bin/fm-test-isolation-proof.sh --jobs 4 --json /tmp/fm-isolation-proof.json # re-run the portable candidate proof bin/fm-test-isolation-proof.sh --pool watcher-wake-lock --jobs 4 # re-run an admitted family proof -[ ! -L CLAUDE.md ] && cmp -s CLAUDE.md - <<'EOF' - -@AGENTS.md -EOF [ "$(readlink .claude/skills)" = "../.agents/skills" ] tmp=$(mktemp -d) && printf 'done: smoke\n' > "$tmp/smoke.status" && FM_STATE_OVERRIDE="$tmp" FM_SIGNAL_GRACE=1 FM_POLL=1 FM_HEARTBEAT=999999 bin/fm-watch-arm.sh # watcher re-arm smoke test (prints arm status, then an actionable signal) ``` diff --git a/bin/fm-brief.sh b/bin/fm-brief.sh index 264126f6d99..86e8d3f2761 100755 --- a/bin/fm-brief.sh +++ b/bin/fm-brief.sh @@ -506,7 +506,7 @@ $ASK_USER_BLOCK $INBOX_SECTION # Project memory -If \`AGENTS.md\` or \`CLAUDE.md\` already exists, or if this task produced durable project-intrinsic knowledge, run \`$FM_ROOT/bin/fm-ensure-agents-md.sh .\` in the worktree. +If \`AGENTS.md\` already exists, or if this task produced durable project-intrinsic knowledge, run \`$FM_ROOT/bin/fm-ensure-agents-md.sh .\` in the worktree. Record only project knowledge useful to almost every future session. For anything the codebase already shows, prefer a pointer to the authoritative file, command, or doc over copying the detail. If you touch a project \`AGENTS.md\`, follow \`$FM_ROOT/bin/fm-ensure-agents-md.sh\`'s self-governance contract in the same pass. diff --git a/bin/fm-dod-lib.sh b/bin/fm-dod-lib.sh index b1cf1fd80d7..d11456d0e3e 100755 --- a/bin/fm-dod-lib.sh +++ b/bin/fm-dod-lib.sh @@ -50,7 +50,7 @@ EOF printf "Your steering inbox is \`%s/%s.inbox\`; this exact path belongs to your current task even when it is outside the worktree or under the supervising firstmate home, so read and acknowledge its messages and do not reject it as another home's state.\n" "$state" "$task_id" cat <<'EOF' Never inspect or change any other home's endpoint namespace; this authorization is limited to the exact task paths named by this brief. -When this task works on Firstmate itself, the repository root `AGENTS.md` (also imported by `CLAUDE.md`) is project content and the supervisor contract for the firstmate managing you: follow this brief instead of that supervisor contract. +When this task works on Firstmate itself, the repository root `AGENTS.md` is project content and the supervisor contract for the firstmate managing you: follow this brief instead of that supervisor contract. Project instructions still govern the work wherever they do not conflict with this worker identity, including `CONTRIBUTING.md` and `firstmate-coding-guidelines` for Firstmate changes. EOF } diff --git a/bin/fm-ensure-agents-md.sh b/bin/fm-ensure-agents-md.sh index cccf9929af2..5a1d6820737 100755 --- a/bin/fm-ensure-agents-md.sh +++ b/bin/fm-ensure-agents-md.sh @@ -243,19 +243,10 @@ if [ -e "$AGENTS" ]; then fi if [ ! -e "$CLAUDE" ]; then ensure_maintenance_section - if claude_supports_native_agents_md; then - if [ "$MAINT_INJECTED" -eq 1 ]; then - echo "updated: added ## Maintaining this file to AGENTS.md in $DIR" - else - echo "unchanged: AGENTS.md in $DIR" - fi + if [ "$MAINT_INJECTED" -eq 1 ]; then + echo "updated: added ## Maintaining this file to AGENTS.md in $DIR" else - install_claude_pointer - if [ "$MAINT_INJECTED" -eq 1 ]; then - echo "updated: added ## Maintaining this file to AGENTS.md and wrote CLAUDE.md @AGENTS.md pointer in $DIR" - else - echo "wrote: CLAUDE.md @AGENTS.md pointer in $DIR" - fi + echo "unchanged: AGENTS.md in $DIR" fi exit 0 fi @@ -296,8 +287,7 @@ if [ -e "$CLAUDE" ]; then fi mv "$CLAUDE" "$AGENTS" ensure_maintenance_section - install_claude_pointer - echo "promoted: moved CLAUDE.md to AGENTS.md and wrote CLAUDE.md @AGENTS.md pointer in $DIR" + echo "promoted: moved CLAUDE.md to AGENTS.md in $DIR" exit 0 fi echo "conflict: CLAUDE.md exists in $DIR but is not a regular file or symlink" >&2 @@ -305,9 +295,4 @@ if [ -e "$CLAUDE" ]; then fi write_skeleton -if claude_supports_native_agents_md; then - echo "created: AGENTS.md in $DIR" -else - install_claude_pointer - echo "created: AGENTS.md and CLAUDE.md @AGENTS.md pointer in $DIR" -fi +echo "created: AGENTS.md in $DIR" diff --git a/bin/fm-ff-lib.sh b/bin/fm-ff-lib.sh index 52bfdc9055b..259a45a13f5 100644 --- a/bin/fm-ff-lib.sh +++ b/bin/fm-ff-lib.sh @@ -224,7 +224,7 @@ fetch_once() { # Which watched instruction paths changed between HEAD and BASE (comma list). # These are the files a running agent actually reads or runs: its instructions -# (AGENTS.md, which CLAUDE.md imports via @AGENTS.md), its agent-loaded skills +# (AGENTS.md), its agent-loaded skills # (.agents/skills/), and its tooling (bin/). Public skills/ is installer-facing # and intentionally not part of this watched instruction surface. changed_instr() { diff --git a/bin/fm-test-run.sh b/bin/fm-test-run.sh index 44e8da93bcc..8645e4c9297 100755 --- a/bin/fm-test-run.sh +++ b/bin/fm-test-run.sh @@ -1601,7 +1601,7 @@ families_for_changed_path() { docs/fm-test-isolation-proof.json) printf '%s\n' pure-contract-unit ;; - .github/*|.gitattributes|.tasks.toml|AGENTS.md|CLAUDE.md|CONTRIBUTING.md|\ + .github/*|.gitattributes|.tasks.toml|AGENTS.md|CONTRIBUTING.md|\ docs/configuration.md|docs/supervision-protocols/*) printf '%s\n' pure-contract-unit ;; diff --git a/docs/architecture.md b/docs/architecture.md index 7cdc3ff6d5e..347264b5336 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -411,10 +411,10 @@ The [Relay configuration reference](configuration.md#promised-public-replies-sta ## Project memory belongs to projects -Durable project-intrinsic agent knowledge lives in each project's committed `AGENTS.md`, with `CLAUDE.md` as a real `@AGENTS.md` import pointer. +Durable project-intrinsic agent knowledge lives in each project's committed `AGENTS.md`. Ship briefs prompt crewmates to create or update those files through the normal delivery path; `data/projects.md` stays a thin private registry. Each project `AGENTS.md` carries self-governance guidance; [`bin/fm-ensure-agents-md.sh`](../bin/fm-ensure-agents-md.sh) owns the canonical wording and idempotent insertion, while its header and help document the explicit mark for equivalent project-owned guidance. -It refuses a case-variant real memory file such as a lowercase `agents.md`, so the pointer's `@AGENTS.md` import resolves to a real `AGENTS.md` on a case-sensitive filesystem, and surfaces the mismatch for manual reconciliation. +It refuses a case-variant real memory file such as a lowercase `agents.md`, and surfaces the mismatch for manual reconciliation. The full ownership rule - what is project-intrinsic versus fleet-private, and how firstmate keeps the two apart without writing into project clones - is owned by [`AGENTS.md`](../AGENTS.md) (project and knowledge management). ## Operational memory routing diff --git a/docs/documentation-audiences.json b/docs/documentation-audiences.json index e459e95006a..28be71621bc 100644 --- a/docs/documentation-audiences.json +++ b/docs/documentation-audiences.json @@ -264,10 +264,6 @@ "path": "AGENTS.md", "audience": "agent-runtime" }, - { - "path": "CLAUDE.md", - "audience": "agent-runtime" - }, { "path": "CONTRIBUTING.md", "audience": "maintainer-architecture" diff --git a/docs/scripts.md b/docs/scripts.md index 5b8ceb56d3e..9c50c712d83 100644 --- a/docs/scripts.md +++ b/docs/scripts.md @@ -41,7 +41,7 @@ The shared no-mistakes gate refusal for fleet lifecycle entrypoints is summarize | `fm-herdr-ci-cleanup.sh` | Snapshot and tear down only job-owned `fm-lab-*` sessions in the Herdr CI lane | | `fm-test-run.sh` | Behavior-test runner: selection, portable lanes, bounded concurrency, budgets, coverage guard, timing/JSON; refuses to execute in the repository primary checkout when `FM_TASK_ID` marks a task worker | | `fm-test-isolation-proof.sh` | Concurrent isolation harness and portable candidate set owner | -| `fm-ensure-agents-md.sh` | Ensure a project's real `AGENTS.md`, its `CLAUDE.md` `@AGENTS.md` pointer, and self-governance guidance (explicit project mark documented in the helper's header and help) | +| `fm-ensure-agents-md.sh` | Ensure a project's real `AGENTS.md` and self-governance guidance (explicit project mark documented in the helper's header and help) | | `fm-guard.sh` | Warn on primary-checkout tangles, main-session pending wakes, and unhealthy supervision | | `fm-primary-scope-lib.sh` | Shared marker-or-plain-checkout primary-home predicate for tracked hooks | | `fm-session-lock-lib.sh` | Shared session-lock harness identity (ancestry walk and holder liveness) for fm-lock.sh and the Claude Stop auto-arm | diff --git a/tests/fm-ensure-agents-md.test.sh b/tests/fm-ensure-agents-md.test.sh index a2f13412ea5..2efc4da4ede 100755 --- a/tests/fm-ensure-agents-md.test.sh +++ b/tests/fm-ensure-agents-md.test.sh @@ -62,7 +62,7 @@ test_created_agents_md_includes_self_governance() { with_mock_claude "2.0.0" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" >/dev/null 2>&1 || fail "fm-ensure-agents-md.sh failed for empty project" agents="$repo/AGENTS.md" assert_present "$agents" "AGENTS.md was not created" - assert_claude_pointer "$repo/CLAUDE.md" + assert_absent "$repo/CLAUDE.md" "fresh setup created a CLAUDE.md file" assert_grep "## Maintaining this file" "$agents" "self-governance section heading missing" assert_grep "Keep this file for knowledge useful to almost every future agent session in this project." "$agents" \ "self-governance section lost the future-session bar" @@ -75,16 +75,16 @@ test_created_agents_md_includes_self_governance() { pass "fm-ensure-agents-md.sh: created AGENTS.md includes self-governance section" } -test_fresh_setup_writes_real_claude_pointer() { +test_fresh_setup_does_not_write_claude_pointer() { local repo out repo="$TMP_ROOT/fresh-pointer-project" mkdir -p "$repo" - out=$(with_mock_claude "2.0.0" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed creating a fresh pointer" + out=$("$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ + || fail "fm-ensure-agents-md.sh failed creating a fresh setup" assert_contains "$out" "created:" "fresh setup did not report created" - assert_claude_pointer "$repo/CLAUDE.md" + assert_absent "$repo/CLAUDE.md" "fresh setup created a CLAUDE.md file" [ ! -L "$repo/CLAUDE.md" ] || fail "fresh setup created a CLAUDE.md symlink" - pass "fm-ensure-agents-md.sh: fresh setup writes a real @AGENTS.md pointer" + pass "fm-ensure-agents-md.sh: fresh setup does not write a CLAUDE.md pointer" } test_promoted_claude_md_includes_self_governance() { @@ -99,7 +99,7 @@ EOF "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" >/dev/null 2>&1 || fail "fm-ensure-agents-md.sh failed for CLAUDE.md promotion" agents="$repo/AGENTS.md" assert_present "$agents" "AGENTS.md was not created during promotion" - assert_claude_pointer "$repo/CLAUDE.md" + assert_absent "$repo/CLAUDE.md" "promotion recreated a CLAUDE.md pointer" assert_grep "Run tests with \`make test\`." "$agents" \ "promotion lost existing CLAUDE.md content" count=$(grep -Fc "## Maintaining this file" "$agents") @@ -122,7 +122,7 @@ test_promoted_claude_md_without_trailing_newline_keeps_blank_separator() { "newline-less promotion did not append the self-governance section" before=$(grep -B1 -Fx '## Maintaining this file' "$agents" | head -n 1) [ -z "$before" ] || fail "self-governance heading not preceded by a blank line (got: $before)" - assert_claude_pointer "$repo/CLAUDE.md" + assert_absent "$repo/CLAUDE.md" "promotion recreated a CLAUDE.md pointer" pass "fm-ensure-agents-md.sh: newline-less promotion keeps a blank separator line" } @@ -182,7 +182,7 @@ test_correct_symlink_migrates_to_pointer_without_clobbering_agents() { pass "fm-ensure-agents-md.sh: correct symlink migrates to pointer without clobbering AGENTS.md" } -test_existing_agents_md_without_claude_gains_section_and_pointer() { +test_existing_agents_md_without_claude_gains_section() { local repo agents out count repo="$TMP_ROOT/existing-bare-project" mkdir -p "$repo" @@ -191,31 +191,29 @@ test_existing_agents_md_without_claude_gains_section_and_pointer() { out=$(with_mock_claude "2.0.0" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ || fail "fm-ensure-agents-md.sh failed for existing AGENTS.md without CLAUDE.md" assert_contains "$out" "updated:" "injection without CLAUDE.md did not report an update" - assert_claude_pointer "$repo/CLAUDE.md" + assert_absent "$repo/CLAUDE.md" "injection created a CLAUDE.md file" assert_grep "Deploy with kubectl." "$agents" "injection dropped existing AGENTS.md content" count=$(grep -Fc "## Maintaining this file" "$agents") [ "$count" -eq 1 ] || fail "injection wrote $count self-governance sections" - pass "fm-ensure-agents-md.sh: existing AGENTS.md without CLAUDE.md gains section and pointer" + pass "fm-ensure-agents-md.sh: existing AGENTS.md without CLAUDE.md gains section" } test_existing_agents_md_with_section_reports_unchanged() { local repo agents out repo="$TMP_ROOT/fully-formed-project" mkdir -p "$repo" - # Build a fully-formed project (AGENTS.md with the section + canonical pointer). - with_mock_claude "2.0.0" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" >/dev/null 2>&1 \ + # Build a fully-formed project (AGENTS.md with the section). + "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" >/dev/null 2>&1 \ || fail "fm-ensure-agents-md.sh failed building the fully-formed fixture" agents="$repo/AGENTS.md" - assert_claude_pointer "$repo/CLAUDE.md" + assert_absent "$repo/CLAUDE.md" "fixture building created CLAUDE.md" cp "$agents" "$repo/.before" - cp "$repo/CLAUDE.md" "$repo/.claude-before" - out=$(with_mock_claude "2.0.0" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ + out=$("$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ || fail "fm-ensure-agents-md.sh failed on already-formed project" assert_contains "$out" "unchanged:" "already-formed project was not reported unchanged" diff "$repo/.before" "$agents" >/dev/null \ || fail "already-formed AGENTS.md was modified" - cmp -s "$repo/.claude-before" "$repo/CLAUDE.md" \ - || fail "already-formed CLAUDE.md was modified" + assert_absent "$repo/CLAUDE.md" "re-run created CLAUDE.md" pass "fm-ensure-agents-md.sh: AGENTS.md that already has the section stays unchanged" } @@ -239,13 +237,19 @@ test_marked_project_guidance_stays_unchanged() { || fail "ensure failed for marked project ($route)" cmp -s "$repo/.before" "$repo/AGENTS.md" \ || fail "marked project guidance was modified ($route)" - assert_claude_pointer "$repo/CLAUDE.md" - out=$(with_mock_claude "2.0.0" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ + case "$route" in + pointer|symlink) assert_claude_pointer "$repo/CLAUDE.md" ;; + *) assert_absent "$repo/CLAUDE.md" ;; + esac + out=$("$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ || fail "ensure failed on marked project re-run ($route)" assert_contains "$out" "unchanged:" "marked project re-run did not report unchanged" cmp -s "$repo/.before" "$repo/AGENTS.md" \ || fail "marked project re-run modified guidance ($route)" - assert_claude_pointer "$repo/CLAUDE.md" + case "$route" in + pointer|symlink) assert_claude_pointer "$repo/CLAUDE.md" ;; + *) assert_absent "$repo/CLAUDE.md" ;; + esac done done pass "fm-ensure-agents-md.sh: marked project guidance is preserved across ensure paths and line endings" @@ -270,7 +274,7 @@ test_reworded_guidance_requires_first_line_marker() { assert_grep '## Editing these notes' "$repo/AGENTS.md" "ensure removed project guidance" count=$(grep -Fxc "## Maintaining this file${eol%$'\n'}" "$repo/AGENTS.md") [ "$count" -eq 1 ] || fail "guidance without a first-line mark did not gain the canonical section" - assert_claude_pointer "$repo/CLAUDE.md" + assert_absent "$repo/CLAUDE.md" "ensure created a CLAUDE.md file" cp "$repo/AGENTS.md" "$repo/.after-first" with_mock_claude "2.0.0" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" >/dev/null 2>&1 \ || fail "ensure failed on unmarked project re-run" @@ -444,112 +448,13 @@ test_lowercase_agents_md_refuses_case_fragile_pointer() { pass "fm-ensure-agents-md.sh: refuses a case-variant lowercase agents.md (issue #389)" } -test_fresh_setup_version_below_cutoff_writes_pointer() { - local repo out - repo="$TMP_ROOT/fresh-below-cutoff" - mkdir -p "$repo" - out=$(with_mock_claude "2.0.0" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed for version below cutoff" - assert_contains "$out" "created: AGENTS.md and CLAUDE.md @AGENTS.md pointer" "did not report created pointer" - assert_claude_pointer "$repo/CLAUDE.md" - pass "fm-ensure-agents-md.sh: version below cutoff writes pointer" -} - -test_fresh_setup_version_at_cutoff_skips_pointer() { - local repo out - repo="$TMP_ROOT/fresh-at-cutoff" - mkdir -p "$repo" - out=$(with_mock_claude "2.1.277" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed for version at cutoff" - assert_contains "$out" "created: AGENTS.md in" "did not report created AGENTS.md without pointer" - assert_absent "$repo/CLAUDE.md" "CLAUDE.md pointer was created at version cutoff" - pass "fm-ensure-agents-md.sh: version at cutoff skips pointer" -} - -test_fresh_setup_version_above_cutoff_skips_pointer() { - local repo out - repo="$TMP_ROOT/fresh-above-cutoff" - mkdir -p "$repo" - out=$(with_mock_claude "2.2.0 (Claude Code)" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed for version above cutoff" - assert_contains "$out" "created: AGENTS.md in" "did not report created AGENTS.md without pointer" - assert_absent "$repo/CLAUDE.md" "CLAUDE.md pointer was created above version cutoff" - pass "fm-ensure-agents-md.sh: version above cutoff skips pointer" -} - -test_fresh_setup_claude_missing_writes_pointer_fallback() { - local repo out - repo="$TMP_ROOT/fresh-no-claude" - mkdir -p "$repo" - out=$(with_no_claude "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed when claude is missing" - assert_contains "$out" "created: AGENTS.md and CLAUDE.md @AGENTS.md pointer" "did not write pointer as fallback" - assert_claude_pointer "$repo/CLAUDE.md" - pass "fm-ensure-agents-md.sh: missing claude falls back to writing pointer" -} - -test_fresh_setup_version_unparseable_writes_pointer_fallback() { - local repo out - repo="$TMP_ROOT/fresh-unparseable" - mkdir -p "$repo" - out=$(with_mock_claude "invalid-version-string" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed when version is unparseable" - assert_contains "$out" "created: AGENTS.md and CLAUDE.md @AGENTS.md pointer" "did not write pointer on unparseable version" - assert_claude_pointer "$repo/CLAUDE.md" - pass "fm-ensure-agents-md.sh: unparseable version falls back to writing pointer" -} - -test_fresh_setup_claude_error_writes_pointer_fallback() { - local repo out - repo="$TMP_ROOT/fresh-claude-error" - mkdir -p "$repo" - out=$(with_mock_claude "" 1 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed when claude errors" - assert_contains "$out" "created: AGENTS.md and CLAUDE.md @AGENTS.md pointer" "did not write pointer when claude errors" - assert_claude_pointer "$repo/CLAUDE.md" - pass "fm-ensure-agents-md.sh: claude command error falls back to writing pointer" -} - -test_existing_pointer_untouched_at_or_above_cutoff() { - local repo out - repo="$TMP_ROOT/existing-pointer-at-cutoff" - mkdir -p "$repo" - printf '# Project agent memory\n\n## Maintaining this file\n' > "$repo/AGENTS.md" - write_fixture_claude_pointer "$repo" - out=$(with_mock_claude "2.1.277" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed for existing pointer at cutoff" - assert_contains "$out" "unchanged:" "did not report unchanged" - assert_claude_pointer "$repo/CLAUDE.md" - pass "fm-ensure-agents-md.sh: existing pointer is untouched at cutoff" -} - -test_existing_agents_md_without_claude_at_or_above_cutoff() { - local repo out - repo="$TMP_ROOT/existing-bare-at-cutoff" - mkdir -p "$repo" - printf '# Existing agent memory\n\nDeploy with kubectl.\n' > "$repo/AGENTS.md" - out=$(with_mock_claude "2.1.277" 0 "$ROOT/bin/fm-ensure-agents-md.sh" "$repo" 2>&1) \ - || fail "fm-ensure-agents-md.sh failed for bare AGENTS.md at cutoff" - assert_contains "$out" "updated: added ## Maintaining this file to AGENTS.md in" "did not report updated AGENTS.md" - assert_absent "$repo/CLAUDE.md" "CLAUDE.md pointer was created for bare AGENTS.md at cutoff" - pass "fm-ensure-agents-md.sh: bare AGENTS.md at cutoff gains section and skips pointer" -} - test_created_agents_md_includes_self_governance -test_fresh_setup_writes_real_claude_pointer -test_fresh_setup_version_below_cutoff_writes_pointer -test_fresh_setup_version_at_cutoff_skips_pointer -test_fresh_setup_version_above_cutoff_skips_pointer -test_fresh_setup_claude_missing_writes_pointer_fallback -test_fresh_setup_version_unparseable_writes_pointer_fallback -test_fresh_setup_claude_error_writes_pointer_fallback -test_existing_pointer_untouched_at_or_above_cutoff -test_existing_agents_md_without_claude_at_or_above_cutoff +test_fresh_setup_does_not_write_claude_pointer test_promoted_claude_md_includes_self_governance test_promoted_claude_md_without_trailing_newline_keeps_blank_separator test_existing_agents_md_with_symlink_gains_self_governance test_correct_symlink_migrates_to_pointer_without_clobbering_agents -test_existing_agents_md_without_claude_gains_section_and_pointer +test_existing_agents_md_without_claude_gains_section test_existing_agents_md_with_section_reports_unchanged test_existing_crlf_agents_md_with_section_stays_unchanged test_existing_crlf_agents_md_without_section_preserves_crlf diff --git a/tests/fm-lint-workflows.test.sh b/tests/fm-lint-workflows.test.sh index 18bce373176..ab59a4d9199 100755 --- a/tests/fm-lint-workflows.test.sh +++ b/tests/fm-lint-workflows.test.sh @@ -158,9 +158,8 @@ jobs: - name: Compatibility pointers must stay intact run: | set -eu - cmp -s CLAUDE.md - <<'EOF' || exit 1 - -@AGENTS.md + cmp -s expected.txt - <<'EOF' || exit 1 +this line sits at column 0 inside a run: | block EOF echo ok YAML