Skip to content
37 changes: 12 additions & 25 deletions commands/adopt.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ coding, and the ship-gate engages on push.
## Run

`$ARGUMENTS` may name a target dir (default: the repo root), `--check` (status only),
`--with <a,b,c>` (seed these modules `true` in a FRESH `.kit.toml`; ignored once one exists),
`--with <a,b,c>` (seed these modules `true` in a FRESH `kit.toml` `[dev.modules]`; ignored once devkit config exists),
or `--single-source` (see below).

1. Resolve the target: default `.` (`git rev-parse --show-toplevel`).
Expand All @@ -27,24 +27,10 @@ or `--single-source` (see below).
- `AGENTS.md` -- a small pointer (about 1KB: four default rules that yield to the repo's own rules, plus where the full contract lives), not a
copy of the 18KB contract. A repo's own `AGENTS.md` is never overwritten; an unmodified old kit
copy is replaced only by `--refresh --swap-agents`, and an edited file gets a drift line.
- a `CLAUDE.md` loader pointer (Claude Code auto-loads CLAUDE.md, not AGENTS.md). Skipped when the repo sets `[adopt] agents_only = true` (see `## adopt.agents_only` below).
- a `CLAUDE.md` loader pointer (Claude Code auto-loads CLAUDE.md, not AGENTS.md). Skipped when the repo sets `[dev.adopt] agents_only = true` in `kit.toml` (or `[adopt] agents_only = true` in legacy `.kit.toml`; see `## adopt.agents_only` below).
- `WORKFLOW.md` -- a pointer to the installed kit's lane x phase matrix (not a 49KB copy).
- `docs/verification/README.md` -- the proof marker that makes the ship-gate engage.
- `.kit.toml` -- an OPT-IN starter override of the kit-root defaults. Created
only on a fresh adopt (never overwritten afterward); `--with` seeds the named modules
`true` instead of inheriting the kit-root default. `--with` names the exact set, so a core module
you leave out starts `false` (`install.sh --with` differs: it adds to the core set). Without `--with`
only `core` modules, today `board`, start `true`; every other module is opt-in. Edit `[modules]` any time and re-run
`/kit:adopt` (or `--refresh`) to re-wire. Its `[gate]` block is where the blocking quality
gates are set for this repo. A fresh seed turns `proof_of_done` and `lane_gates` ON (the kit
root keeps them off for a raw install, so a repo adopted before this change keeps whatever its
file says); an operator `kit.toml` that names either key still wins. `understanding_gate` and
`commit_format` are seeded with the values that resolved at adopt time (off by default), and
`board_row_gate`, `fixture_identities` and `review_verdict` default ON. Every key gets a comment,
and the block says how to turn each seeded gate off: set `proof_of_done = false` or
`lane_gates = false` and commit. Changes apply from the next hook fire (no re-adopt). Adopt only
seeds a fresh file: an existing `.kit.toml` is never touched, so a key the repo set or deleted
stays as it is. Safety gates have no key. Detail: `lib/gate/README.md` "Turning a gate on".
- `kit.toml` (`[dev.*]` sections) -- the unified root project config (devkit owns `[dev.*]`; repokit owns `[repo]` / `[repo.*]`). Created on a fresh adopt, or `[dev.modules]` and `[dev.gate]` are appended when `kit.toml` already exists with `[repo]` (preserving `[repo]` untouched). `--with` seeds the named modules `true` instead of inheriting the kit-root default. `--with` names the exact set, so a core module you leave out starts `false` (`install.sh --with` differs: it adds to the core set). Without `--with` only `core` modules, today `board`, start `true`; every other module is opt-in. Edit `[dev.modules]` any time and re-run `/kit:adopt` (or `--refresh`) to re-wire. Its `[dev.gate]` block is where the blocking quality gates are set for this repo. A fresh seed turns `proof_of_done` and `lane_gates` ON (the kit root keeps them off for a raw install, so a repo adopted before this change keeps whatever its file says); an operator `kit.toml` that names either key still wins. `understanding_gate` and `commit_format` are seeded with the values that resolved at adopt time (off by default), and `board_row_gate`, `fixture_identities` and `review_verdict` default ON. Every key gets a comment, and the block says how to turn each seeded gate off: set `proof_of_done = false` or `lane_gates = false` and commit. Changes apply from the next hook fire (no re-adopt). Legacy `.kit.toml` continues to work as a fallback, and `adopt.sh --refresh` migrates `.kit.toml` into `kit.toml` under `[dev.*]` (preserving `[repo]` and any existing `[dev.*]` sections) and removes `.kit.toml`. Safety gates have no key. Detail: `lib/gate/README.md` "Turning a gate on".
- A one-time move of old kit logs into the durable ledger root (`lib/telemetry/kit-migrate.sh`),
which `install.sh` also runs. It is the only place logs are copied; a hook or resolver never
copies. `--check` and `--dry-run` skip it.
Expand Down Expand Up @@ -76,14 +62,15 @@ overrides a `true` knob back off.

## `adopt.agents_only`

For a repo that wants `AGENTS.md` as its ONLY instruction file. Set `[adopt] agents_only = true`
in the repo's `.kit.toml` (or in the operator `kit.toml`). Then `adopt` and `adopt --refresh` never
create, restore or edit `CLAUDE.md`, and an existing `CLAUDE.md` is left exactly as found. The
operate-contract block lands in `AGENTS.md` (the block `--single-source` writes), `--check` no
longer needs `CLAUDE.md`, and the knob wins over `--single-source`. Default `false`: the
`CLAUDE.md` loader, as before. Needs Claude Code v2.1.277 or later, which reads `AGENTS.md`
directly when no `CLAUDE.md` exists in the working directory or above it; before v2.1.281 some
sessions (Bedrock, telemetry off) read only `CLAUDE.md`.
For a repo that wants `AGENTS.md` as its ONLY instruction file. Set `[dev.adopt] agents_only = true`
in the repo's `kit.toml` (or `[adopt] agents_only = true` in legacy `.kit.toml` or operator `kit.toml`).
Then `adopt` never creates a `CLAUDE.md` shim, and `adopt --refresh` removes an existing pure 1-line
`@AGENTS.md` `CLAUDE.md` shim (`git rm -f` if tracked, `rm -f` otherwise) while leaving any custom
`CLAUDE.md` untouched. The operate-contract block lands in `AGENTS.md` (the block `--single-source`
writes), `--check` no longer needs `CLAUDE.md`, and the knob wins over `--single-source`. Default
`false`: the `CLAUDE.md` loader, as before. Needs Claude Code v2.1.277 or later, which reads
`AGENTS.md` directly when no `CLAUDE.md` exists in the working directory or above it; before
v2.1.281 some sessions (Bedrock, telemetry off) read only `CLAUDE.md`.

## Overlays and seams

Expand Down
14 changes: 7 additions & 7 deletions docs/guides/adopt.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _Figure: adoption writes a few small pointer files. The engine stays in the kit
- `/kit:adopt` is the part that writes. It calls `lib/adopt.sh`, which only creates files and never overwrites one you wrote.
- The files are small pointers. `AGENTS.md` carries four default rules, which apply only where the repo states no rule of its own, and a link to the full contract. `WORKFLOW.md` points at the installed lane matrix.
- `CLAUDE.md` gets a loader block, because Claude Code reads `CLAUDE.md` and not `AGENTS.md`.
- The proof marker `docs/verification/README.md` is what makes the ship gate engage. A fresh `.kit.toml` turns `proof_of_done` and `lane_gates` on for the repo.
- The proof marker `docs/verification/README.md` is what makes the ship gate engage. A fresh `kit.toml` (`[dev.gate]`) turns `proof_of_done` and `lane_gates` on for the repo. If `kit.toml` already exists with `[repo]`, `[dev.modules]` and `[dev.gate]` are appended without touching `[repo]`.

## What you do

Expand All @@ -33,20 +33,20 @@ _Figure: adoption writes a few small pointer files. The engine stays in the kit
5. Commit what adoption wrote. `lib/adopt.sh` does not commit. To adopt several repos and land one PR each, use `bin/wrap adopt <repo>...`; it is a dry run until you add `--apply`.
6. Open a session in the adopted repo and say `/kit:start`.

**Refresh.** After you edit `[modules]` in `.kit.toml`, run `/kit:adopt --refresh`. It re-syncs the `WORKFLOW.md` pointer and the `CLAUDE.md` block and re-wires the project settings file to match. An existing `AGENTS.md`, `.kit.toml`, and proof marker are never touched. An old, unmodified kit `AGENTS.md` is replaced only with `--refresh --swap-agents`.
**Refresh.** After you edit `[dev.modules]` in `kit.toml`, run `/kit:adopt --refresh`. It re-syncs the `WORKFLOW.md` pointer and the `CLAUDE.md` block and re-wires the project settings file to match. If the repo still uses a legacy `.kit.toml`, `--refresh` migrates it into `kit.toml` under `[dev.*]` (preserving `[repo]` if present) and removes `.kit.toml`. The merge is per key: a key `kit.toml` already sets wins and every other legacy key is added. `extra_hard_paths` and `hard_path_canaries` are unioned, since both files were read before. Legacy entries that were not in effect (a lane `light` beside `kit.toml` `phases`, exemption tables beside `kit.toml` ones) are kept as comments. An existing `AGENTS.md` and proof marker are never touched. An old, unmodified kit `AGENTS.md` is replaced only with `--refresh --swap-agents`.

**Undo.** Nothing removes adoption for you. Delete the files it created, or revert the commit that added them. Removing `docs/verification/README.md` takes the repo out of the ship gate. Remove the `kit:adopt` block from `CLAUDE.md` by hand.

**One guide file.** `--single-source` folds `CLAUDE.md` into `AGENTS.md` and leaves `CLAUDE.md` as a one-line import. If both files exist and differ, it refuses and writes nothing.

**No CLAUDE.md at all.** A repo that wants `AGENTS.md` as its only instruction file sets one key in its `.kit.toml`:
**No CLAUDE.md at all.** A repo that wants `AGENTS.md` as its only instruction file sets one key in its `kit.toml` (or `[adopt]` in legacy `.kit.toml`):

```toml
[adopt]
[dev.adopt]
agents_only = true
```

With the key set, `adopt` and `adopt --refresh` never create or restore `CLAUDE.md`, and an existing `CLAUDE.md` is left exactly as found. The operate-contract block lands in `AGENTS.md` (the same managed block `--single-source` writes), `adopt --check` stops asking for `CLAUDE.md`, and `bin/wrap adopt` stops counting a dirty `CLAUDE.md` as a collision. The key wins over `--single-source`. The default is `false`, so no other repo changes.
With the key set, `adopt` never creates a `CLAUDE.md` shim, and `adopt --refresh` removes an existing pure 1-line `@AGENTS.md` `CLAUDE.md` shim while leaving any custom `CLAUDE.md` untouched. The operate-contract block lands in `AGENTS.md` (the same managed block `--single-source` writes), `adopt --check` stops asking for `CLAUDE.md`, and `bin/wrap adopt` stops counting a dirty `CLAUDE.md` as a collision. The key wins over `--single-source`. The default is `false`, so no other repo changes.

This needs Claude Code v2.1.277 or later. From that version Claude Code reads `AGENTS.md` directly when no `CLAUDE.md` exists in the working directory or above it ([docs](https://code.claude.com/docs/en/memory), section "AGENTS.md"). Before v2.1.281 some sessions, such as Bedrock or telemetry off, read only `CLAUDE.md`. If your team runs older builds, leave the key off. The session-start check in `hooks/context-readiness.sh` no longer warns about a missing `CLAUDE.md` when `AGENTS.md` exists. Detail: `kit.toml` `[adopt] agents_only`.

Expand Down Expand Up @@ -80,10 +80,10 @@ adopt: AGENTS.md is not a kit file, 1 lines (left alone)
| `/kit:onboard` says the kit is not installed | Install it first: `/plugin marketplace add consolelabs/devkit`, then `/plugin install kit@dwarves-marketplace`. Run `/kit:onboard` again. |
| `onboard` warns that a plugin and a bash install are both present | The hooks fire twice. Keep one path; the warning names how to remove the other. |
| `AGENTS.md is not a kit file ... (left alone)` | Expected. Your file stays. The operate-contract block lands in `CLAUDE.md`. |
| A module change had no effect | Edit `[modules]` in `.kit.toml`, then run `/kit:adopt --refresh`. On a plugin machine the plugin registers every hook, so the choice is recorded but adds no project hooks. |
| A module change had no effect | Edit `[dev.modules]` in `kit.toml` (or `[modules]` in `.kit.toml`), then run `/kit:adopt --refresh`. On a plugin machine the plugin registers every hook, so the choice is recorded but adds no project hooks. |
| The ship gate never engages | Run `--check`. If it says not adopted, check that `docs/verification/README.md` exists. |
| `--single-source` exits 1 | Both guide files exist and differ. Merge them by hand, then run it again. |
| `adopt` keeps writing `CLAUDE.md` and you want it gone | Set `[adopt] agents_only = true` in the repo's `.kit.toml`, delete the loader block from `CLAUDE.md` by hand, and re-run `/kit:adopt --refresh`. |
| `adopt` keeps writing `CLAUDE.md` and you want it gone | Set `[dev.adopt] agents_only = true` in the repo's `kit.toml` and run `/kit:adopt --refresh` (removes a pure 1-line `@AGENTS.md` shim automatically; remove custom blocks by hand). |

## Related

Expand Down
11 changes: 11 additions & 0 deletions docs/implementation-notes/unified-kit-toml-and-agents-only.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Implementation Notes: Unified project kit.toml ([dev.*]), [repo].door_paths inheritance, and agents_only shim cleanup

Spec: `docs/specs/SPEC-434-unified-kit-toml-and-agents-only.md`

## Delta from spec

- `lib/goal/mega-merge.sh` `_merge_config_guard`: emits the exact matched filename (`kit.toml` or `.kit.toml`) in its refusal message rather than a combined `kit.toml/.kit.toml` string so existing consumers and tests asserting `touches .kit.toml` stay backward-compatible while `kit.toml` PRs report `touches kit.toml`.
- `lib/adopt.sh` `_adopt_render_dev_sections`: retained the explicit `proof_of_done = false` / `lane_gates = false` turn-off comment inside the seeded `[dev.gate]` header to preserve the existing opt-out documentation contract tested by `tests/test-gate-opt-in.sh`.
- `lib/adopt.sh` migration: "insert every missing legacy key" has three exceptions, each so the migration cannot weaken a gate. `extra_hard_paths` and `hard_path_canaries` are unioned even when `kit.toml` sets them, because the readers read both files. A legacy lane `light` is left as a comment when `kit.toml` sets that lane's `phases`. Legacy `[[...]]` tables are left as comments when `kit.toml` declares its own.
- `lib/adopt.sh` migration refuses (keeps `.kit.toml`) when either `extra_hard_paths` is not a valid ERE, since joining it would disable the valid one.
- All other behavior matches `SPEC-434`.
Loading
Loading