# Migration 1.2.0-agent-attribution

**From:** versions < 1.2.0   **To:** 1.2.0

## Why

1.2.0 makes **agent attribution opt-in**. The agent may attribute work to itself / AI —
`Co-Authored-By` trailers, "Generated with …" footers, AI/agent/model mentions in code,
comments, commit messages, PR titles/bodies, branch names, or docs — **only if the user
allows it**. Default is `off`. The choice is recorded in an *Attribution* block in the
project's `AGENTS.md`; pre-1.2.0 deployments have no such block.

A single `Co-Authored-By` trailer is enough to list an AI as a repo contributor, and GitHub
keeps it permanently via PR refs — so the safe default is "no mention anywhere".

## Steps

1. Open the project's entry point `AGENTS.md` (the real file; `CLAUDE.md` is a symlink to it).
2. **Idempotency check** — if it already contains a `## ✍️ Attribution` heading, skip to Verification.
3. **Ask the user**: may the agent attribute work to itself / AI anywhere (commits, PRs, code,
   comments, docs)? **Default to `off`** unless they opt in.
4. Insert this block immediately **after the *Communication language* block** (or, if that is
   absent, after the opening blockquote — before `## 🧭 Memory Map`), replacing `<off|on>` with
   the answer from step 3:

   ```markdown
   ---

   ## ✍️ Attribution

   > **Agent attribution: <off|on>** (chosen at setup).
   > **off** → never attribute work to the agent, AI, or the model: no `Co-Authored-By` trailers, no "Generated with …" footers, no AI/agent/model mentions in code, comments, commit messages, PR titles/bodies, branch names, or docs. Author everything as the human.
   > **on** → the agent may add its standard `Co-Authored-By` trailer / footer per your tooling defaults.
   > Claude Code also honours `includeCoAuthoredBy` in `.claude/settings.json`; this block binds every agent for everything written by hand.
   ```

5. **If the answer is `off` and the project uses Claude Code**, also set the harness flag so the
   automatic trailer stops (a doc directive cannot stop a harness-added trailer):
   - Ensure `.claude/settings.json` exists in the project root; create it as `{}` if absent.
   - Set `"includeCoAuthoredBy": false` (merge into the existing JSON; do not clobber other keys).
   - For other tools, disable their equivalent co-author / footer setting if present.
6. Keep `AGENTS.md` within its ≤100-line budget (the block is ~7 lines; it fits). Do **not**
   retroactively rewrite existing git history here — that is a separate, deliberate operation.

## Verification

- `AGENTS.md` has exactly one `## ✍️ Attribution` block, with `off` or `on` (no leftover
  `{{AGENT_ATTRIBUTION}}` placeholder).
- If `off` + Claude Code: `.claude/settings.json` contains `"includeCoAuthoredBy": false`, and
  the file is valid JSON (`node -e "JSON.parse(require('fs').readFileSync('.claude/settings.json'))"`).
- The docs cap-validator is still green (`node scripts/check-docs-size.mjs` for Node projects).

## Rollback

Delete the inserted `## ✍️ Attribution` block (and its trailing `---`) from `AGENTS.md`, and
remove the `includeCoAuthoredBy` key from `.claude/settings.json` if you added it. No other
files were changed.
