diff --git a/AGENTS.md b/AGENTS.md index 6272004f1..1d26aa26f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,10 +4,10 @@ Tool-agnostic front door (Claude Code, Codex, Gemini, human): four-zone operate- ## Enforcement boundary -**Contract, not a guardrail.** Hooks enforce; coverage varies by runtime: -- **Claude Code** enforces everything (safety-gate, push-to-main, anti-rationalization, verification). -- **Codex** enforces the five hard controls (`hooks/codex-hooks.json`; `SECURITY.md`). -- **Other runtimes** are **advisory only**. +**Contract, not a guardrail.** Hooks share one entry (`hooks/anchor-root.sh`); coverage varies by runtime: +- **Claude Code** enforces everything (all hooks in `hooks/hooks.json` / `settings.json`). +- **Codex, Antigravity (`agy`), and Devin** enforce the 12 PreToolUse/Stop guards via `hooks/anchor-root.sh --runtime ` (`hooks/codex-hooks.json` trusted in `/hooks`; `hooks/agy-hooks.json` and `hooks/devin-hooks.json` owner-registered with `DEVKIT_ROOT`; `docs/reference/agent-runtimes.md`). +- **Other runtimes** (or unregistered manifests) are **advisory only**. Layering: `docs/reference/architecture.md` ("Hook fallback layer"), `docs/reference/PHILOSOPHY.md`, `CLAUDE.md`. @@ -22,35 +22,35 @@ Layering: `docs/reference/architecture.md` ("Hook fallback layer"), `docs/refere Smallest verifiable increment, verified locally, committed. **Skill routing:** design -> `/kit:think` -> `/kit:design`; bugs -> `/kit:debug`; skip overlapping third-party skills. -0. **Take work.** Use handed task. **WAVE** (2+ items): work one at a time from chat, never mint board rows; list unfinished follow-ups in final report. New rows need operator ask or blocker (`board-row-gate`: `board-row-ok: `; opt out `[gate] board_row_gate = false`). Else pull `bash "$K/lib/board/backlog.sh" next`, claim, flip to `claimed` (`_meta` is maintainer-only). -1. **Classify, lane, grill, Done.** Run `bash "$K/lib/classify/task-type-classify.sh" classify ""`. `spec-feature` picks `tiny`/`normal`/`full`/`bug`/`backfill` (default `normal`; classifier suggests `full`; push diff floor applies full gates on hard paths); other types run their type loop + `Lane:`. Run `/kit:grill` (tiny exempt), log `bash "$K/lib/gate/gate-ledger.sh" record grill ran|skipped ""`. Phase 0: define `Done =` via `bash "$K/lib/gate/proof-gate.sh" contract ""`. +0. **Take work.** Use handed task. **WAVE** (2+ items): one at a time from chat, never mint board rows; list follow-ups at close. New rows need operator ask or blocker (`board-row-gate`: `board-row-ok: `; `[gate] board_row_gate = false` opts out). Else pull `bash "$K/lib/board/backlog.sh" next` and claim (`_meta` is maintainer-only). +1. **Classify, lane, grill, Done.** Run `bash "$K/lib/classify/task-type-classify.sh" classify ""`. `spec-feature` picks `tiny`/`normal`/`full`/`bug`/`backfill` (default `normal`; classifier suggests `full`; push floor applies full gates on hard paths); other types run their type loop + `Lane:`. Run `/kit:grill` (tiny exempt), log `bash "$K/lib/gate/gate-ledger.sh" record grill ran|skipped ""`. Phase 0: define `Done =` via `bash "$K/lib/gate/proof-gate.sh" contract ""`. 2. **Read spec:** task row, AC, `## Verification`, `## After state` (tiny: one edit). 3. **Implement** smallest verifiable increment; no speculation or premature abstraction. -4. **Verify locally:** run `## Verification` yourself (CI is a second opinion); never claim unrun checks. +4. **Verify locally:** run `## Verification` yourself (CI is second opinion); never claim unrun checks. 5. **Commit:** conventional commit, one logical change, no spec/ticket IDs in subject (`commit-format`; `ship-gate` + `push-to-main` guard push). Stuck -> zone 4; never churn. - **One rid:** `` = `bash "$K/lib/gate/gate-ledger.sh" rid` (branch slug, `type/` stripped; refuses master/main/detached). -- **Show the road, then your position on it:** print `bash "$K/lib/gate/gate-ledger.sh" plan `, `bash "$K/lib/gate/gate-ledger.sh" progress ` per phase, `bash "$K/lib/telemetry/lane-telemetry.sh" trace `. +- **Show the road, then your position on it:** `bash "$K/lib/gate/gate-ledger.sh" plan `, `bash "$K/lib/gate/gate-ledger.sh" progress ` per phase, `bash "$K/lib/telemetry/lane-telemetry.sh" trace `. - **Review & battery:** `lib/` or `hooks/` uses `/kit:review-team`; `/kit:battery` skips small diffs (`bash "$K/lib/gate/battery-gate.sh"`). -- **Gates:** `bash "$K/lib/gate/gate-ledger.sh" record ran|skipped ""` (`ship-gate` blocks missing required gates without `ran`/`override`; `bash "$K/lib/gate/gate-ledger.sh" descent ` checks order). `bash "$K/lib/gate/gate-ledger.sh" outcome` (`HOOK-ENFORCED` at ship), `bash "$K/lib/spec/spec-next.sh" reserve`, `bash "$K/lib/gate/proof-table-gen.sh" `, advisory gates, flows: `docs/WORKFLOW.md`, `docs/verification/README.md`. +- **Gates:** `bash "$K/lib/gate/gate-ledger.sh" record ran|skipped ""` (`ship-gate` blocks missing gates without `ran`/`override`; `bash "$K/lib/gate/gate-ledger.sh" descent ` checks order). `bash "$K/lib/gate/gate-ledger.sh" outcome` (`HOOK-ENFORCED` at ship), `bash "$K/lib/spec/spec-next.sh" reserve`, `bash "$K/lib/gate/proof-table-gen.sh" `: `docs/WORKFLOW.md`, `docs/verification/README.md`. ## 3. Done means -Done only when **AC are met AND the verifier ran the check** against phase-0 `Done =` (else not assignable), review recorded, report written, and final response lists what changed and what was not attempted. If you could not run a check, say so plainly. Self-reported "done" is not proof (anti-rationalization backstops Claude Code). +Done only when **AC are met AND the verifier ran the check** against phase-0 `Done =`, review recorded, report written, and final reply lists what changed and what was not attempted. Say plainly if a check could not run. Self-reported "done" is not proof. -- **Show proof:** capture `Output:` (or screenshot/GIF); `ship-gate` refuses typed words alone. Copy to final response and PR (`bash "$K/bin/wrap" land`); `[proof] visual = true` UI diffs owe `bash "$K/bin/proof-asset" put` (`docs/verification/README.md`). +- **Show proof:** capture `Output:` (or screenshot/GIF); `ship-gate` refuses typed words alone. Copy to reply and PR (`bash "$K/bin/wrap" land`); `[proof] visual = true` UI diffs owe `bash "$K/bin/proof-asset" put` (`docs/verification/README.md`). - **Fast tests:** iterate on `tests/test-.sh`; regressions once via `bash tests/run-all.sh --changed --time`. Never loop suites, clone master, or run `--all` (`docs/reference/operations.md`). -- **Deployable-done:** services, daemons, flagged features, or `stateful` diffs (`bash "$K/lib/gate/proof-ledger.sh" classify`) owe `deploy-proof` (`Command:`/`Exit:` + rollback or `[UNAVAILABLE: reason]`) + `UAT` (`ship-gate` -> `bash "$K/lib/gate/proof-ledger.sh" check` or override). Inert/library/refactor/docs work is unchanged (`docs/verification/README.md`). +- **Deployable-done:** services, daemons, flagged features, or `stateful` diffs (`bash "$K/lib/gate/proof-ledger.sh" classify`) owe `deploy-proof` (`Command:`/`Exit:` + rollback or `[UNAVAILABLE: reason]`) + `UAT` (`bash "$K/lib/gate/proof-ledger.sh" check` or override). Inert/library/refactor/docs unchanged (`docs/verification/README.md`). - **Understanding axis (ADR-0031):** design records and explainer/quiz nudges are advisory; never alter "done" or block builds (`docs/WORKFLOW.md`). ## 4. Pause if (ask a human) Stop, write a named blocker (decision + why), and ask before: - **Architecture direction** - component fit, new component, interface/data-model shape. -- **Source-of-truth hierarchy** - canonical file/section when two disagree. -- **Validation removal** - weakening, deleting, or bypassing any test, assertion, hook, or guardrail. -- **Risk-classification change** - lighter lane, dropped phase, narrower hard-path/full-lane trigger (staying on default is not a change). +- **Source-of-truth hierarchy** - canonical file when two disagree. +- **Validation removal** - weakening, deleting, or bypassing a test, hook, or guardrail. +- **Risk-classification change** - lighter lane, dropped phase, narrower full-lane trigger (keeping default is not a change). - **Privacy / security** - secrets, credentials, access scope, or data leaving the repo. ## Self-intro diff --git a/CHANGELOG.md b/CHANGELOG.md index 57ed11eba..db42ddbfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -126,7 +126,7 @@ All notable changes to dwarves-kit are documented here. ## [2.3.0] - 2026-10-09 -Release note: [docs/releases/2.3.0.md](docs/releases/2.3.0.md). +Upgrade: no migration; re-run `install.sh` to pick up the new hooks and verbs. Release artifacts and screenshots belong on the GitHub Release; `CHANGELOG.md` is the single in-repo release record. ### Highlights diff --git a/README.md b/README.md index 2b101de09..7e5a13094 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,8 @@ It is bash and markdown, with no UI and no server. It targets one engineer or on | Doc | What it holds | |---|---| | [`docs/MANUAL.md`](docs/MANUAL.md) | The command reference: every command, agent and recovery path | -| [`docs/reference/lifecycle.md`](docs/reference/lifecycle.md) | The loop, the gates and the five stages | +| [`docs/reference/workflow-paths.md`](docs/reference/workflow-paths.md) | Every entry point, the flow topology, and the five stages | +| [`docs/guides/runtimes.md`](docs/guides/runtimes.md) | Wiring Claude Code, Antigravity, Codex, and Devin | | [`docs/reference/install.md`](docs/reference/install.md) | Install layers, the module table, plugin, Codex and bash install | | [`docs/reference/skills.md`](docs/reference/skills.md) | The skills roster | | [`docs/reference/project-structure.md`](docs/reference/project-structure.md) | The directory layout | diff --git a/docs/HISTORY.md b/docs/HISTORY.md deleted file mode 100644 index 1d4d10a80..000000000 --- a/docs/HISTORY.md +++ /dev/null @@ -1,40 +0,0 @@ -# History - -The public release tree carries the kit, its design record and its living docs. The old internal history records were removed from the tree. - -## What was removed - -Dated working records that nothing reads at runtime: - -- `docs/verification/`: proof-of-done records and run logs, except the files listed below -- `docs/implementation-notes/`, `docs/retro/`, and the audit reports (the `audits/` folder under `docs/`) -- `docs/research/`: the dated scans (`research/foundations/` stays) -- `docs/briefs/`: the dated briefs (the brief template, `CONTEXT.md` and the docs rewrite ledger stay) -- `docs/absorption/`: the dated reports (the ritual README and `TEMPLATE.md` stay) -- `_meta/megagoals/_archive/`: the closed mega-goal folders (the whole `_meta/` tree has since moved to the private `dwarves-kit-internal` repo) - -## What stays - -- `docs/specs/`, `docs/decisions/`, `docs/releases/` and `CHANGELOG.md`: the design record, whole -- `docs/verification/gauntlet/`: the corpus the gauntlet-proof-audit skill checks -- Files code, tests or commands read at runtime: the task-type registry, the test-design standard, the rejected-findings ledger, `COUNTS.md`, `done-modes.md`, the lanes-as-data baseline and the ceremony-lens baseline -- Every `README.md` and `TEMPLATE.md` in these folders - -## Read an old file - -One release commit removed these files from the tree; it did not rewrite the git history. The private `dwarvesf/dwarves-kit-internal` repo keeps a copy of the pre-release history at tag `history/master-pre-squash`, with the old tags (including `history/2026-10-27`). Maintainers with access read an old file there: - -``` -git clone git@github.com:dwarvesf/dwarves-kit-internal.git -git -C dwarves-kit-internal show history/2026-10-27:docs/verification/advisor.md -``` - -Specs, decisions and the changelog still cite removed paths, and living docs and code comments cite them as `history/2026-10-27:`. Those paths resolve in the private archive. - -## New work - -Nothing changes for new work. Proof of done still goes in `docs/verification/`, implementation notes in `docs/implementation-notes/`, retros in `docs/retro/`, research in `docs/research/`, and briefs in `docs/briefs/`. The ship gate, `/kit:retro` and the other commands write there as before. - -## Restore - -To bring a removed file back, copy it from the private archive at `history/2026-10-27`. diff --git a/docs/MANUAL.md b/docs/MANUAL.md index 56053bb00..0eea2d567 100644 --- a/docs/MANUAL.md +++ b/docs/MANUAL.md @@ -42,7 +42,7 @@ For the full playbook (every scenario, the autonomy dial, the freeform front doo ## Command reference (the kit invokes these from your intent; you rarely type them) -Index by loop stage (formerly "leg"; [`reference/lifecycle.md`](reference/lifecycle.md) "The five stages" tells the full story). Front-door and meta commands sit outside the stages on purpose: +Index by loop stage (formerly "leg"; [`reference/workflow-paths.md`](reference/workflow-paths.md#the-five-stages) "The five stages" tells the full story). Front-door and meta commands sit outside the stages on purpose: | Stage | Commands | |---|---| @@ -98,15 +98,15 @@ Index by loop stage (formerly "leg"; [`reference/lifecycle.md`](reference/lifecy **Phase:** challenge an idea before writing a spec **Reads:** the idea from chat -**Writes:** `docs/briefs/DECISION-BRIEF-.md` (legacy: `docs/briefs/DECISION-BRIEF.md`) only if the verdict is BUILD +**Writes:** `docs/briefs/DECISION-BRIEF-.md` (legacy: `DECISION-BRIEF.md` in `docs/briefs/`) only if the verdict is BUILD **When to invoke:** before any non-trivial feature. Costs ~5 minutes. **Common gotcha:** the 6 forcing questions are confrontational by design. If you accept them too easily, the brief is weak. ### `/kit:design` **Phase:** opt-in interactive solution-design beat (between Think and Spec) -**Reads:** `docs/briefs/DECISION-BRIEF-.md` (legacy: `docs/briefs/DECISION-BRIEF.md`) (if present), the codebase -**Writes:** appends a `## Solution` section to `docs/briefs/DECISION-BRIEF-.md` (legacy: `docs/briefs/DECISION-BRIEF.md`) (never clobbers the brief's product framing); when the design is design-bearing, also appends a `## Design` section (diagram + ADR link(s), ADR-0031 §1 / SPEC-122) that `/kit:spec` folds into the spec +**Reads:** `docs/briefs/DECISION-BRIEF-.md` (legacy: `DECISION-BRIEF.md` in `docs/briefs/`) (if present), the codebase +**Writes:** appends a `## Solution` section to `docs/briefs/DECISION-BRIEF-.md` (legacy: `DECISION-BRIEF.md` in `docs/briefs/`) (never clobbers the brief's product framing); when the design is design-bearing, also appends a `## Design` section (diagram + ADR link(s), ADR-0031 §1 / SPEC-122) that `/kit:spec` folds into the spec **When to invoke:** when you want to shape the solution with the agent (2-3 approaches, one question at a time, approve per section) before `/kit:spec`. Opt-in; skip it and `/kit:spec` works as before. **Common gotcha:** under bypassPermissions the per-section `AskUserQuestion` prompts may auto-resolve, hollowing the feedback. Use it interactively. It does not execute and is not a gate. Realizes SPEC-008 Part C; forked from `superpowers:brainstorming`. @@ -128,7 +128,7 @@ Index by loop stage (formerly "leg"; [`reference/lifecycle.md`](reference/lifecy ### `/kit:devs-team` -Opt-in design-critique lane between `/kit:design` and `/kit:spec`. Dispatches 5 engineering lenses (simplicity, performance, boundaries, data-model, operability) in parallel against the `## Solution`, read spec-first (the active spec if one exists, else the pre-spec `docs/briefs/DECISION-BRIEF-.md` (legacy: `docs/briefs/DECISION-BRIEF.md`)), merges findings, and appends a report-only `## Design critique` (SOLID / REVISE / RECONSIDER) to that same doc. Never blocks `/kit:spec`. The design analogue of `/kit:review-team`. Placement is spec-first per SPEC-023. +Opt-in design-critique lane between `/kit:design` and `/kit:spec`. Dispatches 5 engineering lenses (simplicity, performance, boundaries, data-model, operability) in parallel against the `## Solution`, read spec-first (the active spec if one exists, else the pre-spec `docs/briefs/DECISION-BRIEF-.md` (legacy: `DECISION-BRIEF.md` in `docs/briefs/`)), merges findings, and appends a report-only `## Design critique` (SOLID / REVISE / RECONSIDER) to that same doc. Never blocks `/kit:spec`. The design analogue of `/kit:review-team`. Placement is spec-first per SPEC-023. ### `/kit:visual-team` @@ -217,7 +217,7 @@ schedules, sequences, or merges. Source: SPEC-036; ADR-0022. ### `/kit:spec` **Phase:** generate the development spec -**Reads:** `docs/briefs/DECISION-BRIEF-.md` (legacy: `docs/briefs/DECISION-BRIEF.md`) (if present), the codebase via the 4 parallel research subagents when the `Depth:` line asks for repo research, or chat (greenfield) +**Reads:** `docs/briefs/DECISION-BRIEF-.md` (legacy: `DECISION-BRIEF.md` in `docs/briefs/`) (if present), the codebase via the 4 parallel research subagents when the `Depth:` line asks for repo research, or chat (greenfield) **Writes:** `docs/specs/SPEC-NNN-.md` (Status: DRAFT), `docs/research/YYYY-MM-DD--{stack,features,architecture,pitfalls}.md` **When to invoke:** after `/think`, or directly if the work is well-scoped already **Depth:** step 1 writes a `Depth:` line under `Lane:` (`standard`, `research (repo|outside: ...)`, `blind-spot (failure: ...)`). Research runs only when the line asks for it, so a `standard` brownfield spec sends zero research agents; `bash lib/spec/spec-depth.sh check ` validates the line. @@ -536,7 +536,7 @@ Say "let's discuss the solution", "iterate on the design", or `/kit:design`. Cla the opt-in interactive design beat (and/or `/kit:devs-team`, or `superpowers:brainstorming` for open-ended exploration): it proposes 2-3 approaches, one question at a time, holds for your approval per section, and appends the agreed Solution to -`docs/briefs/DECISION-BRIEF-.md` (legacy: `docs/briefs/DECISION-BRIEF.md`). It never auto-advances; leave with "the design is good, +`docs/briefs/DECISION-BRIEF-.md` (legacy: `DECISION-BRIEF.md` in `docs/briefs/`). It never auto-advances; leave with "the design is good, write the spec." **Scenario 5 -- a vague / ambiguous goal.** Say "I have a rough idea about X", "here's a @@ -779,7 +779,8 @@ The lifecycle story, install layers, skills roster, directory layout and test no | You want | Read | |---|---| -| The loop, the closed-loop idea, the command sequence, the five stages | [`reference/lifecycle.md`](reference/lifecycle.md) | +| The loop, the entry points, and the five stages | [`reference/workflow-paths.md`](reference/workflow-paths.md) (and [`guides/spine.md`](guides/spine.md)) | +| Runtime hooks and skills across Claude Code, Antigravity, Codex, Devin | [`reference/agent-runtimes.md`](reference/agent-runtimes.md) (and [`guides/runtimes.md`](guides/runtimes.md)) | | Install layers, the module table, plugin, Codex and bash install | [`reference/install.md`](reference/install.md) | | The skills roster | [`reference/skills.md`](reference/skills.md) | | The directory layout | [`reference/project-structure.md`](reference/project-structure.md) | diff --git a/docs/README.md b/docs/README.md index aaf849c3d..8898850fc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,78 +1,103 @@ # docs/, the kit's documentation -To use the kit, read the repo [`README.md`](../README.md) and [`QUICKSTART.md`](QUICKSTART.md) first. The rest of this folder is guides, reference and the record of how the kit was built through its own workflow. Specs, ADRs and retros are history for maintainers; nobody needs them to get started. +To use the kit, start with the repo [`README.md`](../README.md) and [`QUICKSTART.md`](QUICKSTART.md). Everything in `docs/` is routed into six audience buckets below so you can jump straight to the layer you need. -Two install-time facts. `lib/adopt.sh` (`/kit:adopt`) seeds `[gate] proof_of_done = true` and `lane_gates = true` into a fresh `.kit.toml`, so an adopted repo has both gates on; a raw `install.sh` leaves every gate off. `install.sh` and `lib/adopt.sh` also run the one migration of old kit logs into the durable ledger root (`lib/telemetry/kit-migrate.sh`). +Two install-time facts. `lib/adopt.sh` (`/kit:adopt`) seeds `[gate] proof_of_done = true` and `lane_gates = true` into a fresh `.kit.toml`, so an adopted repo starts with both gates on; a raw `install.sh` leaves every gate off. `install.sh` and `lib/adopt.sh` also run the one-time migration of old kit logs into the durable ledger root (`lib/telemetry/kit-migrate.sh`). -The kit's own board, staging buffer and mega-goals live in the private `dwarves-kit-internal` repo; a maintainer links them in as a local `_meta` symlink, and a public clone has none. +The kit's own board, staging buffer, and mega-goals live in the private `dwarves-kit-internal` repo; a maintainer links them in as a local `_meta` symlink, and a public clone has none. -## Entry docs +## 1. Getting started | Path | What it is | |---|---| -| [`QUICKSTART.md`](QUICKSTART.md) | Install, adopt a repo, run your first `/kit:` cycle | -| [`MANUAL.md`](MANUAL.md) | The command reference: every command and agent, plus how to drive the kit by intent and recovery steps | -| [`WORKFLOW.md`](WORKFLOW.md) | The lifecycle contract: lanes, gates and loops (root `WORKFLOW.md` points here) | -| [`SYSTEM-DESIGN.md`](SYSTEM-DESIGN.md) | The system design model, rendered as the UML set in `design/` | +| [`../README.md`](../README.md) | 60-second overview and install one-liner | +| [`QUICKSTART.md`](QUICKSTART.md) | 5-minute install, adopt, and first `/kit:spec` to ship walkthrough | +| [`../examples/hello-spec/README.md`](../examples/hello-spec/README.md) | Worked consumer repository showing what `/kit:adopt` writes | -## Guides +## 2. User guide | Path | What it is | |---|---| -| [`guides/`](guides/README.md) | Task guides: adopt, the spine, debug, review, wrap, gates and proof, gauntlet, loops | -| [`guides/queue-run-runbook.md`](guides/queue-run-runbook.md) | Operator runbook: dispatch, monitor, review and close out an `#auto` row | +| [`guides/README.md`](guides/README.md) | Task-guide index and the 6-section guide shape | +| [`guides/adopt.md`](guides/adopt.md) | Adopting a repo onto the kit | +| [`guides/runtimes.md`](guides/runtimes.md) | Wiring Claude Code, Antigravity (`agy`), Codex, and Devin | +| [`guides/spine.md`](guides/spine.md) | The loop, risk lanes, and what happens at each step | +| [`guides/grill.md`](guides/grill.md) | Pre-work interview and phase-0 `Done =` | +| [`guides/debug.md`](guides/debug.md) | Root-cause-first debug loop | +| [`guides/review.md`](guides/review.md) | Review verdicts and `/kit:review-team` | +| [`guides/autonomy.md`](guides/autonomy.md) | Tuning check-in cadence and autonomy | +| [`guides/wrap.md`](guides/wrap.md) | Landing branches, PRs, and worktree cleanup | +| [`guides/gates-and-proof.md`](guides/gates-and-proof.md) | Proof of done and resolving blocked pushes | +| [`guides/v-model.md`](guides/v-model.md) | Testing at task, integration, and acceptance levels | +| [`guides/scenarios.md`](guides/scenarios.md) | Survival scenarios and must-not-happen rows | +| [`guides/gauntlet.md`](guides/gauntlet.md) | Cold-reader usability testing | +| [`guides/mega-goal.md`](guides/mega-goal.md) | Multi-piece roadmaps and wave dispatch | +| [`guides/queue-run-runbook.md`](guides/queue-run-runbook.md) | Operator runbook for `#auto` queue dispatch | +| [`guides/loops.md`](guides/loops.md) | Bounded revise loops, round caps, and honest halts | +| [`MANUAL.md`](MANUAL.md) | Complete `/kit:*` command, flag, agent, and recovery lookup | -## Reference +## 3. Contributor guide | Path | What it is | |---|---| -| [`reference/architecture.md`](reference/architecture.md) | Components, state model and the verification pipeline | -| [`reference/lifecycle.md`](reference/lifecycle.md) | The loop, the closed-loop idea, the command sequence and the five stages | -| [`reference/install.md`](reference/install.md) | Install layers, the module table, plugin, Codex and bash install | -| [`reference/skills.md`](reference/skills.md) | The skills roster | -| [`reference/project-structure.md`](reference/project-structure.md) | The directory layout of the kit repo | -| [`reference/operations.md`](reference/operations.md) | Testing, CI, the weekly scheduler, external tools and the codebase index | -| [`reference/roadmap.md`](reference/roadmap.md) | Work the kit defers on purpose | -| [`reference/credits.md`](reference/credits.md) | Where each pattern came from; `/kit:absorb` audits it | -| [`reference/data-flow.md`](reference/data-flow.md) | How data moves: signals, ledgers and the module map | +| [`../CONTRIBUTING.md`](../CONTRIBUTING.md) | Front door: branch setup, fast changed-tests, module rules, PR checklist | +| [`team/TEAM-WORKFLOW.md`](team/TEAM-WORKFLOW.md) | Branch naming, PR shape, review, and merge norms | +| [`team/OWNERS.md`](team/OWNERS.md) | Ownership table for `scripts/`, `.githooks/`, and `.github/workflows/` | +| [`team/release.md`](team/release.md) | Cutting releases from `CHANGELOG.md` and tagging | +| [`reference/kit-contract.md`](reference/kit-contract.md) | C1-C10 mechanical contract every module, tool, and skill must pass | +| [`verification/test-design-standard.md`](verification/test-design-standard.md) | Tiered test design, negative controls, and hermetic fixtures | + +## 4. Agent guide + +| Path | What it is | +|---|---| +| [`../AGENTS.md`](../AGENTS.md) | Four-zone tool-agnostic operating contract read by every agent | +| [`../CLAUDE.md`](../CLAUDE.md) | Claude Code layer on top of `AGENTS.md` | +| [`../WORKFLOW.md`](../WORKFLOW.md) | Compact spine summary copied into adopted repos | +| [`reference/agent-runtimes.md`](reference/agent-runtimes.md) | One runtime contract for Claude Code, Antigravity (`agy`), Codex, and Devin | +| [`reference/skills.md`](reference/skills.md) | Index of portable skills under `.agents/skills/*/SKILL.md` (`skills` symlink) | + +## 5. Reference + +| Path | What it is | +|---|---| +| [`WORKFLOW.md`](WORKFLOW.md) | Authoritative lane, gate, proof, and ceremony specification | +| [`reference/install.md`](reference/install.md) | Install layers, module table, plugin/manifest/bash install, CLI stability | +| [`reference/consumer-contract.md`](reference/consumer-contract.md) | Stable surface a consumer repo may depend on | +| [`reference/tiers.md`](reference/tiers.md) | Feature inventory by distribution tier | +| [`reference/hooks.md`](reference/hooks.md) | Every hook message, knob, module, and source file | +| [`reference/wrap.md`](reference/wrap.md) | Which `wrap` verb to run in which situation | +| [`reference/operations.md`](reference/operations.md) | Testing, CI, weekly scheduler, dependencies, codebase index, archive tags | +| [`reference/project-structure.md`](reference/project-structure.md) | Top-level directory layout of the kit repo | +| [`reference/workflow-paths.md`](reference/workflow-paths.md) | Complete path map, flow topology, and the five stages | | [`reference/execution-planes.md`](reference/execution-planes.md) | The four engines that run agents and their trust models | -| [`reference/kit-contract.md`](reference/kit-contract.md) | The rules every module, tool and skill must satisfy | -| [`reference/consumer-contract.md`](reference/consumer-contract.md) | The stable surface a consumer repo may depend on | -| [`reference/hooks.md`](reference/hooks.md) | Which hook prints which message, its knobs and source | +| [`reference/hermes-layering.md`](reference/hermes-layering.md) | How thin Hermes skills in `integrations/hermes/` layer over the kit | | [`reference/glossary.md`](reference/glossary.md) | Plain-word definitions of the kit's terms | -| [`reference/tiers.md`](reference/tiers.md) | Feature inventory by distribution tier | +| [`reference/credits.md`](reference/credits.md) | Where each pattern came from (`/kit:absorb` audits it) | +| [`reference/roadmap.md`](reference/roadmap.md) | Work the kit defers on purpose | | [`reference/FEATURES.md`](reference/FEATURES.md) | Generated one-row-per-feature registry | -| [`reference/workflow-paths.md`](reference/workflow-paths.md) | Every entry point and where each path leads | -| [`reference/hard-rules.tsv`](reference/hard-rules.tsv) | The hard-rule registry and what enforces each rule | -| [`reference/hermes-layering.md`](reference/hermes-layering.md) | How the thin Hermes skills in `integrations/hermes/` sit on top of the kit | -| [`reference/wrap.md`](reference/wrap.md) | Which `wrap` verb to use in which situation | -| [`reference/PHILOSOPHY.md`](reference/PHILOSOPHY.md) | Design principles, target user, fit check, the rejection list | -| [`../lib/config/modules.tsv`](../lib/config/modules.tsv) | The module table `install.sh` and `lib/adopt.sh` both read | -| [`impl-playbook/`](impl-playbook/) | Per-language rules the review agents cite | -| [`patterns/`](patterns/) | Reusable loop and brief patterns | +| [`reference/hard-rules.tsv`](reference/hard-rules.tsv) | Hard-rule registry and what enforces each rule | +| [`../lib/README.md`](../lib/README.md) | One-row-per-module index across `lib/` subsystems | +| [`../lib/config/modules.tsv`](../lib/config/modules.tsv) | Module table read by both `install.sh` and `lib/adopt.sh` | +| [`impl-playbook/`](impl-playbook/) | Active stack and security checklists cited by review agents | -## Design and figures +## 6. Design | Path | What it is | |---|---| -| [`design/kit-uml.html`](design/kit-uml.html) | The UML drawing set rendered from `SYSTEM-DESIGN.md` | -| [`figures/`](figures/) | Guide figures, rendered from `figures/MODEL.md` | +| [`SYSTEM-DESIGN.md`](SYSTEM-DESIGN.md) | Canonical L1-L4 UML model, rendered to [`design/kit-uml.html`](design/kit-uml.html) | +| [`figures/`](figures/) | Conceptual guide figures rendered from [`figures/MODEL.md`](figures/MODEL.md) | +| [`reference/PHILOSOPHY.md`](reference/PHILOSOPHY.md) | North Star commitments, fit check, and design rejection list | +| [`reference/architecture.md`](reference/architecture.md) | Four-plane architecture, component fit, and hook fallback layering | +| [`reference/data-flow.md`](reference/data-flow.md) | Signals, ledgers, and module call graph | +| [`product/DIRECTION.md`](product/DIRECTION.md) | Product direction and design guidelines ([`product/design/guideline.md`](product/design/guideline.md)) | +| [`decisions/`](decisions/) | Architectural Decision Records (`ADR-NNNN`), superseded in place | +| [`patterns/`](patterns/) | Reusable bounded-loop and state-machine engineering patterns | +| [`briefs/`](briefs/) | Pre-spec brief template ([`briefs/TEMPLATE.md`](briefs/TEMPLATE.md)); folded into specs once approved | +| [`specs/`](specs/) | Active and shipped feature contracts (`SPEC-NNN`), also read by hooks | -## Records +## Dated records and archive boundary -Dated records keep their paths and are never rewritten. A record that names an old path stays as it was; a path removed in the release prune resolves at the history tag (see [`HISTORY.md`](HISTORY.md)). +Release history lives in [`../CHANGELOG.md`](../CHANGELOG.md). [`verification/`](verification/) keeps its `README.md` marker (which `ship-gate` keys on), the runtime rule and baseline files (`task-types.md`, `test-design-standard.md`, `rejected-findings.md`, `COUNTS.md`, `done-modes.md`), and the [`verification/gauntlet/`](verification/gauntlet/) corpus. Per-branch working logs (`implementation-notes/`, `retro/`, `absorption/`, `research/`, and one-off `verification/*.md` proof logs) stay as dated records during a cycle and archive into a git tag `history/` in `dwarves-kit-internal` at release cuts (see [`reference/operations.md#archive-tags`](reference/operations.md#archive-tags)). -| Path | What it is | -|---|---| -| [`specs/`](specs/) | One spec per feature; also the live spec store the hooks read | -| [`decisions/`](decisions/) | Architecture decision records, superseded in place | -| [`briefs/`](briefs/) | The decision-brief template and shared context | -| [`implementation-notes/`](implementation-notes/) | Per-spec delta logs written during a build; new work adds its own | -| [`verification/`](verification/) | Proof-of-done records; `verification/README.md` is the marker the ship gate keys on, so never move it. Keeps the gauntlet corpus (`verification/gauntlet/`) and the files the gates and tests read at runtime (task-type registry, test-design standard, rejected-findings ledger, counts) | -| [`retro/`](retro/) | Per-cycle retrospectives; new work adds its own | -| [`research/`](research/) | `research/foundations/` holds the undated early notes the research agents read | -| [`absorption/`](absorption/README.md) | The upstream absorption ritual and its report template | -| [`releases/`](releases/) | Per-version release artifacts | -| [`HISTORY.md`](HISTORY.md) | What the release prune removed, and how to read an old file from the history tag | - -The release history is the root [`CHANGELOG.md`](../CHANGELOG.md). No counts live in this map on purpose; enumerate specs with `bash lib/spec/spec-index.sh`. +No counts live in this map on purpose; enumerate specs with `bash lib/spec/spec-index.sh`. diff --git a/docs/WORKFLOW.md b/docs/WORKFLOW.md index 422dd18d1..8a38e9bf1 100644 --- a/docs/WORKFLOW.md +++ b/docs/WORKFLOW.md @@ -1149,7 +1149,7 @@ fallback because it alone can run with neither a spec nor a brief. | `## Test plan` | in the active spec | per-spec | build input `/kit:execute` reads from the spec it runs | | `## Design critique` (`/kit:devs-team`) | active spec, else the pre-spec brief | spec-first | binds to the design it critiques | | `## UI design` + `## Visual critique` (`/kit:ui-design`; `/kit:visual-team`) | active spec, else the pre-spec brief (visual-team: else inline-only) | spec-first | both write `## Visual critique` to the same heading + location; replace-not-stack dedups | -| `docs/briefs/DECISION-BRIEF-.md` (legacy: `docs/briefs/DECISION-BRIEF.md`) | working-tree file | one per feature slug (pre-spec) | exists during `/think`+`/design` before a SPEC-NNN exists; `/spec` folds it into the spec's `## Solution`, after which the spec is the carrier. Slugged per feature (not just per worktree) since these files get committed and merged, so two features sharing a worktree/branch history must not collide | +| `docs/briefs/DECISION-BRIEF-.md` (legacy: `DECISION-BRIEF.md` in `docs/briefs/`) | working-tree file | one per feature slug (pre-spec) | exists during `/think`+`/design` before a SPEC-NNN exists; `/spec` folds it into the spec's `## Solution`, after which the spec is the carrier. Slugged per feature (not just per worktree) since these files get committed and merged, so two features sharing a worktree/branch history must not collide | | `## Review` (`/kit:review`, `/kit:review-team`) | in the active spec | per-spec | review verdict + findings + TODOs; replace-not-stack; inline in chat if no spec exists | | kit logs | `~/.claude/dwarves-kit/...` | namespaced by worktree id | shared-path writes isolated per worktree | diff --git a/docs/briefs/CONTEXT.md b/docs/briefs/CONTEXT.md deleted file mode 100644 index 03d469554..000000000 --- a/docs/briefs/CONTEXT.md +++ /dev/null @@ -1,42 +0,0 @@ -# Context for implementation (SPEC-249 estate seams) - -## Stack - -Bash-first kit. `bin/` is a thin shim that `exec`s `lib//.sh` (ADR-0034). Python is stdlib-only outside `lib/stats`. Tests are `tests/test-*.sh` (each defines its own `assert`/`chk` helpers, `set -uo pipefail`), run locally via `bash tests/run-all.sh` (diff-scoped + always-on lints) or `KIT_RUN_ALL=1 bash tests/run-all.sh --all` (full glob matching `.github/workflows/test.yml`, ubuntu + macos matrix). `docs/reference/FEATURES.md` is generated by `bash lib/registry/feature-registry.sh generate` and its freshness is pinned by `tests/test-meta.sh`. - -## Conventions - -- Config: `lib/config/kit-config.sh` is the ONLY TOML reader. `kit_config_get` = project > operator > kit-root > default; `kit_config_get_root` = operator > kit-root > default (security-bearing keys). Operator file: `${KIT_CONFIG_OPERATOR:-${XDG_CONFIG_HOME:-$HOME/.config}/dwarves-kit}/kit.toml`. `_kit_toml_get` unquotes but does NOT expand `~`; `lib/wrap/wrap.sh` expands by hand (`target="${HOME}/${target#\~/}"`, around line 535). New path readers replicate that. -- `lib/config/module-registry.md` holds the key rows `config list|get|explain` render (line-oriented awk over markdown tables; columns `| ENV | section.key | default | [status] | module | description |`). `[consumer]` rows currently render as "inert" in `config list`. `tests/test-config-registry.sh` lints completeness and drift. -- Staging blocks: `lib/learn/staging-format.py` (`render` reads JSON on stdin with keys title/intent/approach/u/f/home/source; `parse ` prints JSON). A block starts at `## [] `. -- DEBT marker: `lib/classify/significance-classify.sh record <rid> [--files ..] [--impl-notes ..] "<desc>"` classifies and calls `gate-ledger.sh debt`. Runs live under `$(bash lib/telemetry/kit-log-dir.sh)/runs/<rid>.log`, one `| DEBT |` line per record. -- Precedent: `bin/precedent find --surface inventory --quiet "<words>"` prints hits then one summary line. -- Command docs: `commands/<verb>.md`, numbered steps, a step that reads an empty key prints one "skipped" line and continues (Step -1 in `commands/wrap.md`). The report grammar (Step 8) already reserves the space after `FYI` for overlay sections. -- Proof of done: `docs/verification/<slug>.md` with `## Green run`, uppercase `PASS`, the exact command, a negative control, reproduce steps. -- `tests/test-no-personal-paths.sh` rejects operator paths in docs; write `~/workspace/<owner>/...` or nothing. -- No em dashes anywhere. - -## Key files - -- `kit.toml` (192 lines): `[precedent]` at ~170, `[wrap]` at ~178; the comment voice to copy. -- `lib/config/kit-config.sh` (156 lines): `kit_config_get_root` at 82-90; selftest at the bottom. -- `lib/config/config.sh` (231 lines): `_registry_rows`, `_row_get`, `_find_row`, `_resolve` (sets `EFFECTIVE`, `PROVENANCE`), `cmd_list` at 135, `usage` at 196, `main` at 209. -- `lib/config/module-registry.md` (365 lines): `### precedent` at 256, `### wrap` at 262. -- `tests/test-config-registry.sh` (158 lines), `tests/test-config.sh`. -- `lib/wrap/wrap.sh` (~600 lines): `_write_guard`, `_worktree_copy`, `cmd_log`; `bin/wrap` usage header. `tests/test-wrap.sh` (137 cases, recording `gh` stub, `--tips-file` seam). -- `commands/wrap.md` (137 lines): Step -1 at 27, Step 1 at 45, Step 6 at 77, Step 7 reflect at 81, Step 8 report at 85. -- `commands/onboard.md`, `commands/adopt.md`: module discussion at onboard 37-62, adopt 12-46. -- `lib/classify/significance-classify.sh`: `record` at ~184. -- `lib/learn/staging-format.py` (174 lines), `hooks/backlog-stage.py` (`_default_staging` at 89). -- `lib/stats/src/stats/memory_lens.py`: reads `<repo>/.claude/memory/*.md` (the repo-local default `knowledge.root` must keep). - -## External dependencies - -None new. `python3` (stdlib) for the staging renderer; `gh` untouched. - -## Pitfalls to design around - -- `tests/test-meta.sh` is 3079 lines and scans command docs; check `grep -rn "Step 7\|Step 8" tests/` before renumbering wrap steps. -- CI checkout is depth 1: no `git show <old-ref>` in tests. -- `git status` contends for `index.lock` on ubuntu; poll the lock file instead (wrap.sh already does). -- GNU `stat -f` is filesystem mode; use `stat -c` first then `stat -f`. diff --git a/docs/briefs/DECISION-BRIEF-declared-state-machines.md b/docs/briefs/DECISION-BRIEF-declared-state-machines.md deleted file mode 100644 index a960bfae9..000000000 --- a/docs/briefs/DECISION-BRIEF-declared-state-machines.md +++ /dev/null @@ -1,192 +0,0 @@ -# Decision brief: declared state machines - -**Status:** decided; phase 1 (the board row) ships with SPEC-417. -**Question:** the kit holds about 70 implicit state machines. Which one change helps the operator (UX), the kit developer (DX) and the agent (AX) at once, without breaking a caller? - -## Decision - -Every stateful entity declares its machine ONCE, in a data file owned by the entity's writer. Readers derive from it. Writers detect an undeclared move and say so; they block only where the kit already blocks (the ship boundary). - -``` - lib/<area>/states.tsv (state, class, next) - │ one declaration, owned by the writer - ┌───────────────┼──────────────────────┬─────────────────────┐ - ▼ ▼ ▼ ▼ - writer verb bash readers python readers agent / operator - (set: notice (derive sets at (load at import, (`machine` verb: - on reopen) source time) same file) where am I, where next) - ▲ - │ tests/test-<area>-states.sh fails on a re-introduced copy -``` - -| Column | Meaning | -|---|---| -| `state` | the exact stored string; file order is render order | -| `class` | `active` (open, moving), `hold` (paused on purpose), `terminal` (closed by a human decision) | -| `next` | the forward path a caller normally takes; advisory, `-` for none | - -**Why this one change serves all three:** - -| Lens | Today | After | -|---|---|---| -| UX (operator) | a wrong `shipped -> queued` flip is silent | `set` prints a reopen notice; nothing is refused | -| DX (kit developer) | a new state means hunting 6 copies in 2 languages | a one-line edit in `states.tsv`; a test fails on any new copy | -| AX (agent) | "where can I go from here" lives in prose across WORKFLOW, SYSTEM-DESIGN and command files | `backlog.sh machine` answers it in one call | - -**Rules it keeps:** -- PHILOSOPHY "Detect, don't dictate": no mid-flight transition is blocked. `attempt-state.sh` keeps refusing, because it guards a duplicate-dispatch bug, which is an irreversible cost. -- PHILOSOPHY "Bash over binaries": a TSV that `awk` and Python both read in five lines; no library, no runtime. -- CLAUDE.md "No premature abstraction": the convention is a file shape plus a test, not shared code. A shared loader waits for the third declared machine. -- SYSTEM-DESIGN's open review question ("add a guard, or keep `set` permissive for hand repairs?") resolves to: permissive, with a notice on a reopen. - -**Rejected:** -- A generic `lib/fsm/` engine with enforced transitions: it would block sync, reconcile and hand repairs that jump states legitimately, and it breaks "Detect, don't dictate". -- Docs-only declaration (the current SDLC section): it already drifted from the code, so docs alone fail the brief. -- Fixing each copy by hand: the next state added re-creates the drift. - -## Inventory - -Every row was found by four read-only scouts and spot-checked in code. "Enforced" means a code guard on the move, not a membership check. - -### Board, queue, goal, mega - -| Machine | Store | Enforced | Top drift | -|---|---|---|---| -| Board row status | `_meta/BACKLOG.md` last cell | membership only (phase 1 declares it) | vocabulary copied in 6 code files; any-to-any moves | -| Hermes mirror (row to card) | `.board-mirror-snapshot.jsonl` | `case` map | 4 states collapse to `ready`; legacy `done` read, never written | -| Hermes writeback (card to row) | same snapshot | membership + `row_hash` | a card move writes `executing -> queued` with no notice | -| Mirror cleanup classes | derived | dispatch | third copy of the row-to-card map; archives where the mirror would `block` | -| Queue eligibility | row text `#queue{}` | allow-list | a finished run leaves its row `queued` | -| Queue job verdict | `queue-journal.tsv` | none | `queue run` and the watcher disagree on which verdicts are terminal | -| Queue liveness sidecars | `queue-runs/<slug>.{beat,status,guard}` | partial | three writers; a dead beat never reaches `done` | -| Mega sub-goal box | `ROADMAP.md` `[ ]/[x]/[X]/[~]` | idempotent flip | six readers parse the box six ways | -| Mega sub-goal events | `.orchestrate/events.log` | none | `blocked`, `held`, `merged` written, never read | -| Orca backend sub-goal state | derived | ordered rule table | none (a derivation) | -| Dispatch task and attempt | `kit-attempts/<task>.task` | **full** (`attempt-state.sh`) | the yardstick | -| Goal registry claim | `kit-goals/<slug>.goal` | none on `status` | documented `blocked/ready/done` never written | -| Goal draft | `.claude/goals/*.md` frontmatter | none | rewrite only fires when a `status:` line exists | -| PR merge eligibility | GitHub PR | full, fail-closed | three meanings of "held" across files | -| Mega reconcile | derived | full | label strings re-declared in `mega-review.py` | - -### Gate, proof, spec, hooks - -| Machine | Store | Enforced | Top drift | -|---|---|---|---| -| Spec `Status:` header | `docs/specs/*.md` | none; no script writes it | 8 values in use, 62 specs with none; 5 readers disagree on "live" | -| Spec task box | `- [ ]` / `- [x]` | guard (exits 3/4/5) | none | -| Gate phase | `runs/<rid>.log` `GATE` lines | partial | `check()` passes on ANY `ran`, a later `skipped` does not undo it | -| Run lane | `START`/`START-AMEND` lines | lowering guard | three sources for the lane, two copies of the rank | -| Validate round | `ROUND` lines | real guards, hand-coded | no table; 400 lines of `case` and awk | -| Debt tap | `DEBT` lines | enum on write | `wave` is both a verdict and a response | -| Proof class | derived | pure function | two classifiers, same names, different inputs | -| Proof verdict | `docs/verification/*.md` | last line wins | `PASS` anywhere counts | -| Proof asset | `assets.json` + `.pending` | partial | reader checks `pending`, writer never writes it | -| Spec number reservation | `spec-reservations.log` + lock dir | owner token + TTL | none | -| Harvest ledger | `learned-ledger.md` | real guard | none | -| Hook session markers | `/tmp` and state files | partial | first Stop is a no-op by design | - -### Wrap, session, sync, reflect, release - -| Machine | Store | Enforced | Top drift | -|---|---|---|---| -| Wrap land outcome | shell globals, `LAND:` line | none | `ship` does not handle the `draft` kind | -| Wrap ship step | globals, `SHIP:` line | none | none | -| Branch merge proof | git + `gh` | three copies of one ladder | scan and apply label the same branch differently | -| Worktree sweep | porcelain + locks | ordered guards | none | -| PR merge gate | `gh pr view` JSON | none | callers compare a verdict sentence by string | -| Stray carry | `wrap/stray-*` branches | none | none | -| Adopt row | globals | none | rows matched by free text | -| Handoff file | dir depth | partial | closed set re-declared | -| Sync link | `~/.cache/backlog-sync/*.state.json` | caps + terminal guard | `parked` is neither active nor terminal in sync's sets (now `hold`) | -| Spoke status maps | code constants | none | `claimed` and `speccing` both map to Multica `todo` | -| Skill draft | `skill-proposals/` dirs | partial | rejected drafts can re-stage; `promote --force` can nest a draft | -| Staging block | `## [staged]` headers | partial | `expired`, `rejected`, `promoted` have no exits | -| Debt disposition | `DEBT` lines | total function | `mark-paid` skips its own "pending" guard | -| Release cut | VERSION, tag, CHANGELOG | none | commit can land with no tag; `--dry-run` discards edits | - -### Commands, skills, other lib (prose-held machines) - -| Machine | Where the state lives | Gap | -|---|---|---| -| Gauntlet run and round | `ROUNDS.md`, `round-N/` dirs, agent memory | replicate count stored nowhere | -| Test-plan critique | spec section + `[[QL-VERDICT]]` | `SOLID` never machine-read; same-day freshness passes | -| Greenlight loop | agent memory only | retry and iteration counters reset on context loss | -| Audit pass | `audit-runs.log` | no in-flight or failed state | -| Audit verdict grammar | PR body | per-skill extensions; `OK`/`DANGER` never emitted | -| Onboard wizard | nothing | restart re-detects | -| Wayfind ticket | `tickets/*.md` `Status:` | claim is a git push race | -| Bench `RunState` | memory | unknown status reads as `pass`; `run_end` always `pass` | -| Migration sentinel | `.migrated` files | a symlinked dir is never retried | - -## Rollout - -| Phase | Machine | Why this order | -|---|---|---| -| 1 (SPEC-417) | board row | the hub: 7 writers, 6 copies, both languages | -| 2 | spec `Status:` | 5 readers disagree on "live"; no writer script exists. Shipped in #1106 | -| 3 | gate phase + lane | `check()` on stale `ran`; three lane sources. Shipped in #1114, #1116, #1124 | -| 4 | queue verdict + mega box | two readers, two terminal sets; six box parsers. Shipped in #1105, #1122, #1125 | - -Each later phase reuses the phase 1 shape: a `states.tsv` beside the writer, a `machine` verb, a copy-detector test. The second and third instances decide whether a shared loader earns its place. - -## Simplification pass - -A cleanup pass followed phase 1. Each PR removed a duplicate spelling or a second source of truth, with no stored data rewritten. - -| PR | What shipped | -|---|---| -| #1104 | Audit verdict grammar cut to five words | -| #1105 | Queue terminal set unified; dead goal status fields removed | -| #1106 | Spec Status machine in `lib/spec/states.tsv` with one reader helper (rollout phase 2) | -| #1107 | skill-curator reviewer revived: `--bare` could not log in; signal gate on by default | -| #1108 | Wrap PR gate decides by code, not by sentence | -| #1109 | NEEDS-REVISION has one spelling; INCONCLUSIVE folds into FAIL; dead proof `pending` removed; bench `unknown` is never pass; one lane rank | - -**Kept on purpose.** Each is a separate concept, not a copy. -- Gate `ran` / `skipped` / `override` -- Validate round states -- Land kind -- Attempt state -- `SOLID` / `REVISE` / `RECONSIDER` -- Staging headers -- The mutation marker that `break-it` reads - -## Second pass - -The operator settled the open items, and a second batch removed the next layer of duplicates and real bugs. - -| PR | What shipped | -|---|---| -| #1112 | `spec-status.sh set`; `/kit:ship` writes `Status: SHIPPED` in the feature PR | -| #1113 | Debt verdict `wave` becomes `log`, response `wave` becomes `accept`; mega keeps `wave`; readers accept both | -| #1114 | `check()` decides on each phase's latest GATE row; NEEDS-REVISION writes `rejected` | -| #1116 | Override rows carry `via=hand\|plan\|batch\|inherit\|lane-lower`; the alert counts hand overrides on required phases only | -| #1121 | `release` dry-run keeps edits and checks the tag first; `promote --force` aborts on a failed backup; rejected drafts never re-stage; prose `PASS` no longer greens a proof | -| #1122 | ROADMAP box grammar declared once in `lib/mega/box.tsv` for every reader; `mega review` sees SG-NN roadmaps; "held" reads recorded markers only | -| #1123 | One wrap merge-proof ladder; callers branch on its code | -| #1124 | One effective-lane resolver; the ship check takes the stricter of spec header and ledger lane; plain `start` validates the lane | -| #1125 | SG-NN rows get a branch signal; a parked-only mega lists as `(parked)` | - -| #1127 | Bounded loops resume from their own records: one QL-VERDICT parser, greenlight retries counted from the run ledger | - -**Kept as is.** The validate round machine is correct but hand-coded; a declared table would cost more than it saves today. - -## Third pass - -The eleven items left open after the second pass, closed in one batch. Each landed after the changed suites passed on a fresh master. - -| # | Machine | PR | What shipped | -|---|---|---|---| -| 1 | Queue verdict to board row | #1135 | a terminal verdict moves a still-queued row: `done` to `executing`, `gated` to `parked` | -| 2 | `wrap land` kind to `wrap ship` | #1134 | ship cannot reach a draft land; an unexpected kind now reports a bug instead of a refusal | -| 3 | Hermes writeback | #1138 | a backward active move prints a notice; writeback carries it to stderr and the commit body | -| 4 | Migration sentinel | #1133 | a symlinked legacy dir writes `.migrate-refused`, never `.migrated`, and retries next run | -| 5 | Queue sidecars | #1135 | the reaper reuses the conductor delta check, so a dead run with real work records `done` | -| 6 | Mega reconcile labels | #1133 | one `lib/mega/labels.tsv` for `mega.sh` and `mega-review.py` | -| 7 | Proof class | #1140 | one `lib/gate/proof-classes.tsv`; a malformed table fails closed | -| 8 | `wrap adopt` rows | #1139 | each row carries an `ok` / `skip` / `fail` code; the summary text is free to change | -| 9 | Handoff closed set | #1134 | derived from the `terminal` class in `lib/board/states.tsv` | -| 10 | Multica status map | none | not worth it: the `board:kw` marker already keeps the original state | -| 11 | Audit pass | #1136 | `bin/audit start`; `audit due` shows `running` and `abandoned` | - -**Still open.** `stalled` and `blocked` carry several meanings across queue and mega. Renaming them touches the events log and labels readers already know, and fixes no wrong behavior today. diff --git a/docs/briefs/DECISION-BRIEF-loop-resume.md b/docs/briefs/DECISION-BRIEF-loop-resume.md deleted file mode 100644 index 03051400d..000000000 --- a/docs/briefs/DECISION-BRIEF-loop-resume.md +++ /dev/null @@ -1,37 +0,0 @@ -# Decision brief: bounded loops resume from their own records - -**Status:** decided; built in the same PR. -**Question:** several bounded loops keep their position (round number, clean streak, retry count) only in agent context. A context loss or a new session restarts them from zero. How do they resume without a new state store? - -## Decision - -A loop's position is derived from the record it already writes. No new store, no new daemon. - -``` - loop writes its record every round resume reads the same record - ───────────────────────────────── ──────────────────────────── - gauntlet ROUNDS.md [[QL-VERDICT ...]] ┐ - spec ## Test plan critique [[QL-VERDICT]] ├──▶ lib/loop/ql-verdict.sh resume <file> - ui-design / verify rounds [[QL-VERDICT]] ┘ round=<next> clean_streak=<k> last_findings=<n> - greenlight retries run ledger ACTION lines ──▶ gate-ledger.sh actions <rid> greenlight-retry sha=<head> -``` - -| Loop | Record it already writes | Resume reads | -|---|---|---| -| gauntlet | `ROUNDS.md` with one `[[QL-VERDICT round=N clean=B findings=K]]` per round | next round, consecutive clean rounds (the two-pass SOLID rule), last K | -| test-plan-review-team | the spec's `## Test plan critique` QL-VERDICT lines | next round, last K (the strictly-falling rule) | -| ui-design, verify | their QL-VERDICT lines | same | -| greenlight | nothing today | a new `ACTION` line per retry in the run ledger, counted per head sha | -| onboard | n/a | none: the wizard already re-detects every step | - -## Rules - -- **One parser for QL-VERDICT.** `lib/loop/ql-verdict.sh` owns the grammar `\[\[QL-VERDICT round=[0-9]+ clean=(true|false) findings=[0-9]+\]\]`; `lib/gauntlet/stats.sh` calls it instead of keeping its own copy. A malformed marker stays a loud error. -- **Resume is read-only.** It never edits a record. A missing record means round 1. -- **Greenlight keeps no store.** It appends `ACTION | greenlight-retry sha=<sha> n=<k>` through the existing `gate-ledger.sh action` verb, and counts those lines for the current head sha on start. A new head sha resets the budget, as today. -- **Prose calls the verb.** Each loop command runs resume at its start and continues from the printed round, instead of counting in context. - -## Rejected - -- A `kit-loops/` state store beside `kit-attempts/`: a second copy of facts the records already hold, which can drift from them. -- Persisting the onboard step: the wizard is idempotent and re-detects; a stored step could go stale. diff --git a/docs/briefs/DECISION-BRIEF-team-stamp.md b/docs/briefs/DECISION-BRIEF-team-stamp.md deleted file mode 100644 index 2a213658d..000000000 --- a/docs/briefs/DECISION-BRIEF-team-stamp.md +++ /dev/null @@ -1,87 +0,0 @@ -# Decision brief: a team stamp for repos whose team does not run the kit - -**Status:** DRAFT. Nothing is built. Three board rows cite this brief. -**Question:** one operator runs the kit. Their teammates do not, and the teammates' coding agents do most of the work. How does the repo carry the kit's discipline to agents that have no plugin? - -## Verified current state - -One private product repo was fitted by hand over two days, with three people on the team. The teammates' agents then followed the rules on their own: four pull requests arrived with a proof file, a board row and a tagged changelog line, and CI caught the one rule an agent missed. The operator's record of that work is a dated research note in their private toolkit (title "A kit-free agent harness for a team repo"). This brief holds the design that came out of it, so the rows below stand without the note. - -What the hand fit showed about the kit as it is: - -| Finding | Evidence | Row | -|---|---|---| -| The kit cannot generate this harness. Every piece was written by hand. | About twenty files: rules, two hooks, six scripts with tests, a CI job, templates. | team stamp | -| The adopt pointer puts kit-only rules at the top of `AGENTS.md`. A teammate's agent reads them as binding. | The pointer says "stop and ask a human before an architecture or interface change". The team rule asked for a second person only on a short list of irreversible changes. The clash stood for a day. | adopt pointer | -| The full lane fires on any hard-path file, whatever the size of the change. | Four small CI and config edits each owed twelve recorded phases. Most records were overrides. The repo turned the lane gate off. | lane gate sizing | - -## Design - -Enforcement moves from the plugin into the repo, in four layers. Each layer works with no kit on the machine. - -``` - agent about to act - │ - ├─ 1 AGENTS.md read at session start advice - ├─ 2 project hook blocks the wrong command Claude Code only - ├─ 3 CI job on each PR fails the wrong PR every agent, every person - └─ 4 daily digest shows what slipped through the operator -``` - -A refusal at layer 2 or 3 names the rule in one line and the fix command in the next. That is what lets an agent correct itself with no human in the loop. - -### What the stamp generates - -One command, run by the operator in the target repo, writes these files. Each script arrives with its test. - -| Piece | File | Rule it carries | -|---|---|---| -| Agent rules, self-contained | `AGENTS.md` | Commands map, playbooks, lessons, team rules. The kit marker stays on line 1. A short closing section says the kit is optional. | -| People's copy of the rules | `docs/TEAM-WORKFLOW.md` | The same rules with the why. A CI check fails a PR that changes one copy and not the other. | -| Command guard | `.claude/settings.json`, `scripts/agent-guard.sh` | Blocks a bare PR merge, a push to the default branch, a commit on the default branch. | -| Lessons at session start | `scripts/agent-lessons.sh`, `.claude/memory/MEMORY.md` | Prints the index of repo lessons. Seeded with the generic CI lessons. | -| Playbook | `.claude/skills/ship-pr/SKILL.md` | Issue to merged PR, with exact commands. Repo-specific playbooks stay hand-written. | -| PR shape check | `scripts/pr-shape.sh`, a CI job | Conventional title, a proof file for a behavior change, a board row or `Closes #n`, a tagged changelog line for product code, shell lint on changed scripts, rule parity. | -| Local check | `scripts/check.sh` | Runs the same checks before a push. | -| Owners | `OWNERS.md`, `scripts/check-owners.sh` | Every script, workflow and job has one owner: a person, or a named agent with a human sponsor. | -| Merge guard | `scripts/pr-merge.sh` | Waits for checks, refuses a draft, a red check or a conflict, and asks for a second person's approval on listed paths. | -| Negative control | `scripts/negctl.sh` | Green, break, red, restore, green, with a proof block ready to paste. | -| Work queue | an issue form, `scripts/issues-from-rows.sh`, a PR template | The board is the plan. Issues are the queue. A claim is an assignee. | -| Changelog by reader | tag list in `CHANGELOG.md`, `scripts/release-notes.sh` | Lines carry a component tag. Release notes drop the team-tooling lines. | -| Digest | `scripts/team-digest.sh` | Merged PRs, open PRs, open issues, decisions waiting. Replaces a stand-up. | -| Proof guide | `docs/verification/README.md` | How to write a proof, one file per PR. | -| Gate config | `.kit.toml` | Proof gate on, lane gate off. | - -Left to the repo: language test jobs in CI, product playbooks, the list of irreversible paths, and who posts the digest. - -### Rules for the generator - -- The generated files are plain copies the repo owns. They must run with no kit installed. No file may point at a path under the kit. -- The stamp is idempotent and never overwrites a file the repo edited. It reports drift, as `adopt` does. -- A second run after a kit upgrade offers the diff per file. The operator picks. -- The hook contract and the skill format are read from the vendor docs at build time, not from memory. - -## Build order - -1. **Adopt pointer.** Smallest change, and it removes an active contradiction in every adopted repo. The pointer block keeps its line-1 marker and its four generic rules move under a heading that says they apply only when the repo states no rules of its own. -2. **Lane gate sizing.** The hard-path rule keeps the full lane for a change that alters what a gate or a hook does. A change that only adds a workflow file, flips one config key, or edits a comment sizes by its diff. -3. **Team stamp.** A new verb next to `adopt`. Start from the hand-fitted repo's files as the templates, strip the product names, and prove the stamp on a scratch repo with a clean-room agent that has no kit. - -Rows 1 and 2 stand alone. Row 3 depends on row 1, because the stamp writes the same `AGENTS.md`. - -## Conformance - -- A team stamp is a generator, not a runtime. It adds no daemon and no service. -- It does not weaken a gate for a kit user. The operator's own session still runs the proof gate through `.kit.toml`. -- It binds Claude Code through the project hook, and every other agent through CI. A person who merges from the GitHub site passes everything on a plan without branch protection. The brief accepts that limit and says so in the generated rules. - -## Exit criteria - -- Adopt pointer: an agent in an adopted repo that states its own rules is never told to stop for a change those rules allow. Test: a fixture repo with its own rule section, checked by the adopt test suite. -- Lane gate sizing: a PR that adds one CI workflow file passes with a proof and no phase ledger. A PR that changes a hook's behavior still owes the full lane. Both pinned as classifier test rows. -- Team stamp: on a scratch repo, a clean-room agent with no kit opens a PR that passes the generated CI, and a bare merge command is blocked with the fix line. The gauntlet records the run. - -## Related - -- Parking-lot item "Team mode (attestation, not sync)" covers several engineers who all run the kit. This brief covers the opposite case: one kit user, teammates without it. -- "Portable adopt" (consumer files resolve the kit at read time) touches the same pointer file as build step 1. diff --git a/docs/briefs/DECISION-BRIEF-visual-proof-module.md b/docs/briefs/DECISION-BRIEF-visual-proof-module.md deleted file mode 100644 index 16958ef63..000000000 --- a/docs/briefs/DECISION-BRIEF-visual-proof-module.md +++ /dev/null @@ -1,89 +0,0 @@ -# Decision brief: visual proof as a standalone kit module - -**Status:** DECIDED. Nothing is built. The build spec is `docs/specs/SPEC-427-visual-proof-module.md`. -**Question:** board row ID-395 says visual proof must be kit machinery, and the pilot for standalone packaging. The brief it cites (`DECISION-BRIEF-standalone-packaging.md`) was never written, and the packaging row ID-396 was dropped. This brief replaces both pointers. What is left to build, and how does it fit the standalone doctrine? -**Doctrine:** ADR-0041 (`docs/decisions/0041-standalone-doctrine.md`). Three rules: the kit ships neutral defaults; user data lives outside the code; a module runs standalone and composes when co-installed. This module is the pilot. - -## Verified current state - -The pack's one-line target, part by part, read against this tree (master at `3eb93852`): - -| Part of the target | State | Evidence | -|---|---|---| -| `proof-capture` exists as a kit module | not shipped | no `lib/proof-capture/`, no `bin/proof-capture`, no `modules.tsv` row | -| it is standalone-capable | not shipped | nothing to be capable yet | -| the proof contract routes visual work to it | half shipped | `proof-gate.sh contract` prints a `visual:` line (the artifact owed) when `[proof] visual` is on, but names no command; `commands/verify.md` Step 7b says "capture" with no tool; `docs/verification/README.md` line 96 says "until it lands, a hand-recorded capture satisfies the contract" | -| a fixture PR shows a screenshot or GIF in its proof | not shipped as a producer proof | the gate accepts images (R3a uploaded, R3b committed, R3c local); open PR 1086 commits four PNGs by hand under `docs/verification/system-design-c4/` | - -Already shipped and reused as is (zero edits): the opt-in knob and its three image rules in `proof-ledger.sh check`; `bin/proof-asset put|flush` (convert, 300 KB cap, manifest, optional bucket); `wrap land` flush and its rewrite of a relative image link to an absolute URL in the PR body; the runs dashboard that renders captures; ADR-0026 table-first proof. `lib/system-design/shots.mjs` is a doc renderer (Node plus CDP, needs a built HTML sheet), not a proof capturer. - -The engine outside the kit: - -| Where | What it really is | -|---|---| -| operator tooling repo `experiments/proof-capture/` | a README (status parked) and one sample, `samples/web-localterm/`: a 9 KB Playwright spec, notes, and about 6 MB of recorded media. No tool. | -| operator tooling repo SPEC-126, its brief, implementation notes | the convention: the artifact class, an environment matrix, four invariants, a gotcha table. Terminal and web lanes proven, macOS GUI designed only. | -| operator skills repo `home/dot_claude/skills/proof-capture/` | the live engine: `private_SKILL.md` (248 lines of recipes) and `walk.mjs` (69 lines of Node: `playwright-core`, a personal browser path as default). | - -So the engine is prose plus one 69-line walker bound to a personal browser. There is no code to lift. The kit needs one small producer and one route, not a port. - -**The gap is small:** a producer (one bash entry, two verbs, a few hundred lines), its module docs and tests, one registry row, one shim, one added contract line, and the doc edits that say the producer now exists. Every other part of the target is already in the tree. - -## Decisions - -**D1. Boundary and name.** Module `proof_capture` (the table key), directory `lib/proof-capture/`, stable entry `lib/proof-capture/bin/proof-capture`, kit shim `bin/proof-capture`. Named for the function (kit-fold rule), no host prefix. It is separate from `lib/proof/` on purpose: `lib/proof/asset.sh` sources `kit-config.sh` and needs a git repo, so it can never be copied out alone. The two compose through the artifact (a PNG or GIF file) in `commands/verify.md` Step 7b: capture, then `bin/proof-asset put`. Neither calls the other. - -**D2. Verbs (kit contract I4, closed vocabulary).** `run page <src> <out.png>` and `run tape <file.tape> <out.gif>`. Nothing else in v1. Contract block (full text in the spec): - -| | | -|---|---| -| IN | argv only; no stdin. `<src>` is a file path or an `http(s)://` or `file://` URL. Flags `--width`, `--height`, `--wait`, `--deadline`. Env `PROOF_CAPTURE_BROWSER`, `PROOF_CAPTURE_VHS`, `PROOF_CAPTURE_DEADLINE`, and `PROOF_CAPTURE_BROWSER_CANDIDATES` (replaces the discovery list; the seam that makes "no browser" testable on a host that has one). | -| OUT | the artifact file (PNG for `page`, GIF for `tape`, checked by magic bytes, never empty) and one stdout line `proof-capture: wrote <out> (<n> bytes)`. No sidecar, no state, no config. | -| EXIT | 0 artifact written; 1 capture failed (no valid artifact before the deadline); 64 usage or bad input; 69 a required dependency is missing. | - -**D3. Dependencies and what a missing one does.** - -| Verb | Needs | If missing | -|---|---|---| -| `run page` | a Chromium-family browser | exit 69, one line: `proof-capture: no Chromium-family browser found; install Chrome, Chromium or Edge, or set PROOF_CAPTURE_BROWSER=<path>`. An explicit `PROOF_CAPTURE_BROWSER` that is not executable also exits 69 and never falls back. | -| `run tape` | `vhs` (brings `ttyd` and `ffmpeg`) | exit 69, one line naming `vhs` and `brew install vhs`. A failure inside vhs exits 1 with vhs's own last line. | - -No Node, no Python, no Playwright, no jq. Bash 3.2 and POSIX coreutils; no `pkill`, `killall` or process-table scan. Why bash and not the Node walker: Chrome's own `--headless=new --screenshot` does the job with one dependency; a page flow with clicks is out of v1 (see D8). Why `PROOF_CAPTURE_BROWSER` is honest: browsers differ in what they do headless. Probed on this host (Grounding in the spec): Edge and a third Chromium-family browser write the PNG in about 2 s and then never exit; Brave wrote nothing in 40 s. So the discovery list is Chrome, Chromium, Edge only (Edge ran here; Chrome and Chromium did not, and the spec's Depth line names that), Brave is left out, and the tool judges success by the file on disk, not by browser exit: it polls for a valid PNG, then ends the browser's own process group (the tool starts it under bash job control, so the group id is the pid it recorded; TERM, then KILL after 2 s) and removes its throwaway profile. It never kills by name, never depends on `timeout` (a `gtimeout` alias on macOS) or `setsid` (absent on macOS). - -**D4. Routing.** When `[proof] visual` is on and both the module's shim (`bin/proof-capture`) and its entry (`lib/proof-capture/bin/proof-capture`) are executable, `proof-gate.sh contract` adds one line after `visual:`: `capture: $DWARVES_KIT/bin/proof-capture run page ...` for the "ui page" row, `capture: $DWARVES_KIT/bin/proof-capture run tape ...` for the "tui" row, nothing for every other row (a bot message in a test channel is not headless-capturable; "ui flow", "report" and "generated file" have no verb yet). The `visual:` text is frozen and stays byte-identical, so the tests that pin it hold. The two guards are file tests (a shim whose module dir was deleted must not advertise a dead command), the command carries the literal `$DWARVES_KIT/bin/` prefix so it resolves from a consumer repo, and the line does not depend on the `[modules]` toggle; not a read of the `[modules]` manifest (the manifest is an install record, never read at run time).. Knob off: nothing changes, byte for byte (the existing case 22 pins it). Module deleted: the line is simply absent. No edit to `proof-ledger.sh check`, so no repo that passes the push gate today can fail it. - -**D5. Standalone proof.** The module dir is the unit: `bin/`, `README.md`, `GUIDE.md`, `SPEC.md`, `docs/proof-of-done.md`, `tests/`, `examples/`. Its own suite uses stub browsers and stub `vhs` through the same seams a user has (`PROOF_CAPTURE_BROWSER`, `PATH`), so it runs where no browser exists. Standalone check, exact: copy the dir to a temp path outside any git repo and run its suite under `env -i` (no `DWARVES_KIT`, no kit on `PATH`). A grep lint inside the suite fails on any `DWARVES_KIT`, `kit-config` or `../../` in the module's executable, with a planted violation to prove the lint can fail. The other direction: a temp kit tree without `bin/proof-capture`, knob on, `contract` still exits 0 and prints the same `visual:` line. - -**D6. Fixture and media.** Two parts. (a) A hermetic suite builds a temp repo with the knob on, captures with a stub browser, runs `bin/proof-asset put`, and asserts `proof-ledger.sh check` passes with the image and blocks with it removed. (b) The build PR's own proof, `docs/verification/visual-proof-module.md`, embeds one real PNG the build captured from `lib/proof-capture/examples/hello.html` (about 13 KB), committed at `docs/verification/visual-proof-module/page.png`. `.gitignore` has no image rule, no hook or test caps tracked images, and `wrap land` turns a relative committed image link into an absolute one pinned to the PR head, so the PR body shows it. The repo's own convention for rendered figures (`docs/figures/*.png`, and PR 1086, still open) is a small committed PNG. No bucket upload: it would reach a real service. The `tape` verb's GIF is captured and its output line quoted in the proof, but not committed (one image per PR). Captures run headless with a throwaway profile; the suite asserts `--headless=new` and a fresh `--user-data-dir` in the browser's argv. Nothing drives the live desktop. - -**D7. After the move (separate PRs, not in this build).** - -| Repo | Files | Change | -|---|---|---| -| operator tooling repo | `experiments/proof-capture/README.md` | status line and a pointer to the kit module | -| operator tooling repo | `experiments/proof-capture/MOVED.md` (new) | where the engine lives now; the web-localterm sample and its media stay as history, nothing deleted | -| operator tooling repo | `docs/specs/SPEC-126-proof-capture.md`, `docs/specs/SPEC-126-brief-proof-capture.md` | a supersession note at the top; the text stays as the record | -| operator tooling repo | `docs/implementation-notes/proof-capture.md` | one appended delta note | -| operator tooling repo | `docs/verification/README.md` (the tool-specifics bullet), `experiments/INDEX.md` | point at the kit module | -| operator skills repo | `home/dot_claude/skills/proof-capture/private_SKILL.md` | becomes a thin front door: keeps the trigger phrases and the personal lanes below, sends page and tape work to `proof-capture` | -| operator skills repo | `home/dot_claude/skills/proof-capture/walk.mjs` | stays until a flow verb exists; it is the only part of the old engine not covered | - -One engine in the kit for the lanes the kit takes (page, tape). The personal skill keeps what the kit refuses: macOS window recording, keycastr, a real Terminal window, the simulator route, the multi-step Playwright walker. Those drive a live desktop or a personal setup, so they do not belong in a neutral module. Tenant words (the herdr, one-dark, localterm, hermes-watch and personal-browser content of the old skill) are not carried into the kit: `GUIDE.md` keeps only the neutral craft (storyboard, frame check, privacy check, three gotchas). - -**D8. Files the build touches, and the collisions.** New: the module dir, `bin/proof-capture`, `tests/test-proof-capture-route.sh`, one proof file and one PNG. Edited: `lib/gate/proof-gate.sh`, `lib/config/modules.tsv`, `kit.toml`, `lib/config/module-registry.md` (a stage row and a `modules.proof_capture` key row, no rows for the tool's own env vars), `docs/reference/FEATURES.md` (regenerated, never hand edited), `commands/verify.md`, `docs/verification/README.md`, `docs/reference/tiers.md`, `docs/reference/install.md`, `docs/reference/project-structure.md`, `docs/reference/consumer-contract.md`, `lib/README.md`, `tests/test-bin-forwarders.sh`, `tests/test-install-clis.sh`, `tests/test-proof-contract-visual.sh`, `CHANGELOG.md`. None is `hooks/ship-gate.sh`, anything under `lib/classify/`, or anything named `lib/adopt*`. One behavior coupling remains: `lib/adopt.sh` reads `modules.tsv`, so the new row reaches adopt through the table; the row is `opt-in`, so a fresh adopt leaves the module off, and `tests/test-adopt.sh` is in the build's check list. The lane is `full` by the diff floor: `proof-gate.sh` and `modules.tsv` are enforcement-surface paths. - -## Rejected - -| Option | Why not | -|---|---| -| Port `walk.mjs` and Playwright into the kit | a Node plus Playwright dependency for a 69-line walker, and its default browser is personal | -| A Node CDP driver like `shots.mjs` | a second headless driver, Node in `lib/` for no gain over Chrome's own flag | -| Add `capture` to `bin/proof-asset` | `proof-asset` needs git and `kit-config.sh`; the capture must run with neither | -| A `route` verb the gate asks for the command | one more verb and one more process per contract call, to avoid a four-line case in the gate | -| Turn the knob on by default, or add a hook | a push that passes today could fail; the brief says opt-in stays | -| macOS GUI, keycastr, simulator lanes | they drive the live desktop or one platform; they stay in the personal skill | -| Upload the fixture image to the bucket | reaches a real service from a build | - -## Not built, and named - -`run flow` (a scripted multi-step page walk that ends in a GIF) is the next verb if flows matter; Chrome's `--screenshot` cannot click. The "ui flow", "report" and "generated file" rows keep their artifact text and get no `capture:` line until then. Linux and containers are not claimed: the module lists Linux browser names, nothing here ran there, and the real-browser case of the suite is opt-in (`PROOF_CAPTURE_REAL=1`) and reports SKIP (counted, not a pass) by default. diff --git a/docs/briefs/DECISION-BRIEF.md b/docs/briefs/DECISION-BRIEF.md deleted file mode 100644 index ec03d9bbb..000000000 --- a/docs/briefs/DECISION-BRIEF.md +++ /dev/null @@ -1,47 +0,0 @@ -# Decision Brief: estate seams (ID-646) - -## Verdict: BUILD (config seams + one report + two wrap steps; no new manifest format) - -## Core thesis - -The estate is three kits that each install alone: dwarves-kit is the process plane (gates, lanes, ledger, review fleets), context-kit is the data plane (the context tree and recall over it), learning-kit is a study overlay on the engine. Install dependency points at the engine (both overlays require dwarves-kit >= 2.0); data flow points the other way (every kit writes knowledge into the context tree). Those two directions must stay separate, and the only thing the engine may know about an overlay is a config key the overlay fills. - -Today three hand-offs are implicit or backwards: - -1. `/kit:wrap` runs an operator skill through `wrap.before` that writes `| DEBT |` markers into this kit's gate ledger and gates new-tool candidates through `precedent`. Both are process-plane work; they belong in the command, not in a skill outside the kit. -2. Nothing tells the engine where the context tree lives. Knowledge writers (the wrap distill step, `memory-tidy`, `stats memory-sweep`) default to whatever the model guesses. -3. No surface shows an operator which seams are filled. `plugin-check` checks the plugin; the cross-kit wiring is invisible. - -## Strongest argument for - -Every existing seam (`wrap.before`, `wrap.activity_log`, `precedent.registry`) already follows one rule: a key in the operator `kit.toml`, read with `kit_config_get_root`, never from a project `.kit.toml`. Generalising that rule to a named seam list costs one config key, one read-only report, and prose. It satisfies the standalone-first doctrine (ID-396) without a manifest format nobody maintains. - -## Strongest argument against - -A `[knowledge] root` key with no engine writer behind it is a promise. Mitigation: the wrap distill step and `memory-tidy` are the first two readers in this spec, and the report marks a filled key whose path does not exist as `unresolved`. - -## Recommended scope for v1 - -**IN:** - -- `[knowledge] root = ""` in kit-root `kit.toml`. Empty means repo-local: `<repo>/.claude/memory/` for repo memory, `docs/retro/` for retros. A filled value is the context tree root; repo knowledge then files under `<root>/projects/<repo>/`. Read with `kit_config_get_root` only. -- A seam registry: `lib/config/seams.tsv` (or an equivalent single table), one row per seam: key, kind (`skill|path|file|binary`), default, filled-by (which overlay or the operator), reader (which command reads it). Rows at v1: `wrap.before`, `wrap.activity_log`, `precedent.registry`, `knowledge.root`, `prose-rag` (binary on PATH or `PROSE_RAG_BIN`). -- `plugin-check --seams`: prints the table with the resolved value and a status per row: `default`, `filled`, `unresolved` (filled but the skill/path/binary does not resolve). Read-only, exit 0 always, no JSON needed at v1. -- `/kit:wrap` gains the process half of session distill, after the `wrap.before` seam and before step 0 or as a named step: (a) if the session was an orchestrated batch (a run id in the gate ledger with dispatched workers, a spec run, a goal run), record the `| DEBT |` marker via `lib/gate/gate-ledger.sh debt`; (b) candidates for a new tool or skill (a procedure run three or more times, a one-off script the operator called recurring) go through `precedent find --surface inventory --quiet` and land as a staging row via the existing staging writer, never a board row; (c) incidents written this session whose `## Root cause` names our own mistake become one repo memory note under the knowledge root. Everything else (til publish, concept flush, research notes) stays outside, behind `wrap.before`. -- `commands/onboard.md` and `commands/adopt.md`: one short section naming the overlays (context-kit fills `knowledge.root` and the `prose-rag` binary; learning-kit fills `wrap.before` with its concept flush), stating none is required, and pointing at `plugin-check --seams`. -- `kit.toml` comments for the new key; `docs/FEATURES.md` regenerated. - -**CUT:** - -- Retiring the vendored prose-rag crate (ID-647, separate row). -- A per-kit manifest file, a `provides`/`wants` schema, version negotiation. The seam table is the whole mechanism. -- Any engine writer for the til or memo publish leg. -- Changes to context-kit or learning-kit (they follow in their own repos once the key name is fixed). - -## Survival scenarios - -- Operator with only dwarves-kit: `plugin-check --seams` shows every row `default`; `/kit:wrap` files a memory note under `<repo>/.claude/memory/`; nothing asks for an overlay. -- Operator with context-kit: `knowledge.root` filled; the wrap note lands under `<root>/projects/<repo>/`; the report shows `filled` with the path. -- Operator sets `knowledge.root` to a path that does not exist: report says `unresolved`; `/kit:wrap` falls back to repo-local and says so in its report. -- A project `.kit.toml` sets `knowledge.root`: ignored, the report shows the operator or kit-root value; a test pins this. -- Session with no batch run and no incident: wrap's new step prints one line saying so and moves on. diff --git a/docs/briefs/DOCS-REWRITE-LEDGER.md b/docs/briefs/DOCS-REWRITE-LEDGER.md deleted file mode 100644 index 4a978d845..000000000 --- a/docs/briefs/DOCS-REWRITE-LEDGER.md +++ /dev/null @@ -1,17 +0,0 @@ -# Docs rewrite: requirements ledger - -Requirements for the README, QUICKSTART and guides rewrite. Read this file before any task in the rewrite. One entry per line: `RL-NN · type · rule · scope · status`. - -RL-01 · decision · The first reader is an outside engineer who uses Claude Code and has no Dwarves context; the Dwarves team reads second · scope: README, QUICKSTART, docs/guides · active -RL-02 · decision · Keep today's file paths; folder moves (concepts/, reference/) wait for the structure phase · scope: docs/ · superseded by RL-13 -RL-03 · decision · Figures come from one model, `docs/figures/MODEL.md`, rendered by `lib/system-design` into `docs/figures/<id>.png`; no hand-drawn SVG, no mermaid, no ASCII box diagrams in README or guides · scope: README, QUICKSTART, docs/guides · active -RL-04 · quality-gate · `docs/figures/MANIFEST.tsv` holds each sheet's model hash; a test fails when a sheet changes without a re-render · scope: docs/figures · active -RL-05 · decision · Figures render in the light theme only; a dark variant waits until GitHub picture sources are worth the second render · scope: docs/figures · active -RL-06 · decision · Every guide uses one page shape: Use this when, figure, What happens, What you do, What you will see, When it breaks, Related · scope: docs/guides · active -RL-07 · decision · Merge guide pairs: spine absorbs lanes, mega-goal absorbs dispatch-vs-mega, gauntlet absorbs gauntlet-tutorial; the absorbed files are removed and every link to them is repointed · scope: docs/guides · active -RL-08 · decision · New guides: adopt, review, wrap · scope: docs/guides · active -RL-09 · quality-gate · No spec, ADR or board IDs in prose, no hardcoded counts, no operator-private detail (hosts, personal domains, vault paths), no em or en dashes · scope: all rewritten files · active -RL-10 · quality-gate · Every command, flag and path a doc names exists today; a doc-drift Tier 1 pass on the rewritten files finds zero FIX · scope: all rewritten files · active -RL-11 · audience-test · A gauntlet onboarding run passes using only README and QUICKSTART · scope: README, QUICKSTART · active -RL-12 · decision · Voice is STE-lite with plain everyday words, second person; README at most 150 lines, QUICKSTART at most 120, each guide 80 to 160 lines · scope: README, QUICKSTART, docs/guides · active -RL-13 · decision · Layout: entry docs at docs/ top, reference docs in docs/reference/, consumer templates in templates/, Hermes adapter in integrations/hermes/, records keep their paths, root WORKFLOW.md stays for adopted repos · scope: root, docs/ · active diff --git a/docs/briefs/README.md b/docs/briefs/README.md new file mode 100644 index 000000000..626bfb6c4 --- /dev/null +++ b/docs/briefs/README.md @@ -0,0 +1,11 @@ +# Decision briefs + +Pre-spec working briefs written by `/kit:think` and `/kit:design` (`DECISION-BRIEF-<slug>.md`) and distilled repo context (`CONTEXT-<slug>.md`). + +## Lifecycle + +1. Start a brief from [`TEMPLATE.md`](TEMPLATE.md) (or let `/kit:think` create `docs/briefs/DECISION-BRIEF-<slug>.md`). +2. Append `## Solution` (and `## Design` when architecture or state machines change) during `/kit:design`. +3. Once `/kit:spec` folds the brief into `docs/specs/SPEC-NNN-<slug>.md` and the spec ships, the working brief is no longer living state. Shipped briefs archive into the next `history/<date>` tag in `dwarves-kit-internal` (see [`../reference/operations.md#archive-tags`](../reference/operations.md#archive-tags)). + +Nothing reads shipped briefs at runtime. Living code and docs cite the shipped `docs/specs/SPEC-NNN-*.md` (or `history/<date>:docs/briefs/<name>.md` for pre-spec context). diff --git a/docs/briefs/TEMPLATE.md b/docs/briefs/TEMPLATE.md new file mode 100644 index 000000000..f0fb4ad65 --- /dev/null +++ b/docs/briefs/TEMPLATE.md @@ -0,0 +1,44 @@ +# Decision brief: <title> + +**Slug:** `<kebab-case-slug>` +**Status:** DRAFT | APPROVED | FOLDED INTO SPEC-NNN + +## Problem + +One paragraph: what is broken, missing, or slow today, and who hits it. + +## Context + +- Relevant existing files, specs, or ADRs +- Constraints that cannot move + +## Non-goals + +- What this change explicitly will not do + +## Solution + +### Approaches considered + +Shape: `<problem without this system's names> -> <field> -> <standard tool>` + +| Approach | Pros | Cons | +|---|---|---| +| Option A | | | +| Option B | | | + +### Chosen approach + why + +Name the chosen option and the concrete reason it wins. + +### Extensibility & boundaries + +What stays fixed, what can change later, and where the boundary sits. + +## Failure modes + +- Failure mode -> how the design prevents or surfaces it + +## Open questions + +- [ ] Question needing an owner call before `/kit:spec` diff --git a/docs/figures/MANIFEST.tsv b/docs/figures/MANIFEST.tsv index d8bad8d01..2a85ba36d 100644 --- a/docs/figures/MANIFEST.tsv +++ b/docs/figures/MANIFEST.tsv @@ -1,5 +1,4 @@ adopt 5cac92425fc1ae68841cd8c23bb74d43e33ecea652dfe2e53a71a9b55df40949 -board-row ccd1c003f2f507bf2865db1e9b184458fbec495db84da2481fc6ad5e779947a6 debug 662899ea80762ea25d19ab5762b7ce6065447b5df10c49ffdba74963ba4e6d5e execute 101bbfdb2b4629136936c835b91e9971a7ea3bc68bd98b6e454c91f601b0fee2 gauntlet 59968ff98389edf5b6ce86296b4a787ebda3efd429eb9ece35228793e03477e2 diff --git a/docs/figures/MODEL.md b/docs/figures/MODEL.md index b11bc8950..22e060fbf 100644 --- a/docs/figures/MODEL.md +++ b/docs/figures/MODEL.md @@ -120,36 +120,6 @@ messages: - {from: Claude Code, to: agent, text: "the push runs, or the block and its fix", kind: return} ``` -## Board row states - -A row on the backlog board holds one status word. Commands flip it as the work moves. - -```uml -id: board-row -type: state -title: Board row status -level: L4 -caption: "A board row moves from queued to shipped. /kit:assign claims it, /kit:spec marks it validated, /kit:execute marks it executing when the build starts, and /kit:wrap closes it." -states: - - {name: queued, initial: true, tone: green, at: [0, 1]} - - {name: claimed, tone: green, at: [1, 1]} - - {name: speccing, tone: green, at: [2, 0]} - - {name: validated, tone: green, at: [3, 0]} - - {name: executing, tone: green, at: [3, 1]} - - {name: shipped, final: true, tone: green, at: [4, 1]} - - {name: parked, tone: green, at: [3, 2]} - - {name: dropped, final: true, tone: green, at: [1, 2]} -transitions: - - {from: queued, to: claimed, event: "/kit:assign --next", tone: green} - - {from: claimed, to: speccing, event: "/kit:assign, lane has a spec", tone: green} - - {from: claimed, to: executing, event: "/kit:assign, tiny lane", tone: green} - - {from: speccing, to: validated, event: "/kit:spec, round approved", tone: green} - - {from: validated, to: executing, event: "/kit:execute, build starts", tone: green} - - {from: executing, to: shipped, event: "/kit:wrap", tone: green} - - {from: executing, to: parked, event: "/kit:wrap", tone: green} - - {from: queued, to: dropped, event: "/kit:wrap", tone: green} -``` - ## Execute `/kit:execute` hands a whole spec to one builder, then checks the result once at the end. diff --git a/docs/figures/board-row.png b/docs/figures/board-row.png deleted file mode 100644 index a42fc3ce8..000000000 Binary files a/docs/figures/board-row.png and /dev/null differ diff --git a/docs/guides/README.md b/docs/guides/README.md index 80cadf843..a141ca3ed 100644 --- a/docs/guides/README.md +++ b/docs/guides/README.md @@ -7,6 +7,7 @@ Task guides for people who use the kit on their repos. Each one answers "what do | Guide | Read it when | |---|---| | [adopt.md](adopt.md) | you installed the kit and want a repo to use it | +| [runtimes.md](runtimes.md) | you want to wire hooks and skills in Claude Code, Antigravity (`agy`), Codex, or Devin | | [spine.md](spine.md) | you want the map: what comes after what, and how a change is sized into a lane | ## Do the work diff --git a/docs/guides/rename-to-devkit.md b/docs/guides/rename-to-devkit.md deleted file mode 100644 index b748ea3f6..000000000 --- a/docs/guides/rename-to-devkit.md +++ /dev/null @@ -1,26 +0,0 @@ -# Product name: devkit - -The product is called **devkit** (one word, lowercase, no hyphen) in reader-facing documentation. **Dwarves** (Dwarves Foundation) stays the company name. - -Everything you type is unchanged. No script, hook, test, config file, command, or path changed. - -## What uses devkit - -- Reader-facing prose in `README.md`, `CONTRIBUTING.md`, and some pages under `docs/`, `commands/`, and `skills/`. - -## What stays unchanged - -Every name a machine or a person types stays as it is. Nothing reads a setting, file, path, command, or repo under the product name. - -| Surface | Keeps using | -|---|---| -| Slash commands | `/kit:*` (for example `/kit:start`, `/kit:spec`, `/kit:ship`) | -| Plugin and marketplace | `kit`, `dwarves-marketplace`, `kit@dwarves-marketplace` | -| GitHub repository and checkout | `dwarvesf/dwarves-kit`, checkout folder `dwarves-kit/` (and private `dwarvesf/dwarves-kit-internal`) | -| Project and kit config | `.kit.toml`, `kit.toml`, `.kit/` | -| Install and runtime paths | `~/.claude/dwarves-kit`, `~/.config/dwarves-kit`, `~/.local/state/dwarves-kit`, `~/.cache/dwarves-kit`, `~/Library/Logs/dwarves-kit` | -| Environment variables | `KIT_*`, `DWARVES_*` | -| Program output | What programs print: hook banners, traces, and notices such as `[dwarves-kit]` and `[dwarves-kit:<name>]` | -| Historical records | Existing `CHANGELOG.md` entries, specs, ADRs, retros, research, release notes, implementation notes, verification records, and credits | - -Keep typing the commands, paths, and environment variables in the table above in your shell, hooks, and config files. diff --git a/docs/guides/runtimes.md b/docs/guides/runtimes.md new file mode 100644 index 000000000..2303728b3 --- /dev/null +++ b/docs/guides/runtimes.md @@ -0,0 +1,95 @@ +# Wiring agent runtimes + +Use this when you run devkit from Claude Code, Antigravity (`agy`), Codex, or Devin and want the safety and ship gates active in that runtime instead of advisory only. + +## What happens + +- Every runtime reads the same root operating contract (`AGENTS.md`) and discovers portable skills from `.agents/skills/`. +- **Claude Code** runs the full hook roster across all lifecycle events via `hooks/hooks.json` (plugin) or root `settings.json` (bash installer). +- **Codex**, **Antigravity (`agy`)**, and **Devin** run the 12 shared `PreToolUse` and `Stop` guards through one entry point: `hooks/anchor-root.sh --runtime <codex|agy|devin> --event <PreToolUse|Stop> <guard>` with `hooks/entry-normalize.jq`. +- Shipping a manifest file inside the repo does not arm hooks by itself: Codex requires trusting definitions in `/hooks`, and `agy` and Devin require the owner to export `DEVKIT_ROOT` and register the manifest in that runtime's hook config. + +## What you do + +### 1. Claude Code + +1. Install as a plugin (recommended) inside a Claude Code session: + +```text +/plugin marketplace add dwarvesf/dwarves-kit +/plugin install kit@dwarves-marketplace +``` + +2. Or install via bash (`jq` and `git` required), then open a new session: + +```bash +git clone https://github.com/dwarvesf/dwarves-kit.git ~/.claude/dwarves-kit +bash ~/.claude/dwarves-kit/install.sh +``` + +### 2. Codex + +1. Add the marketplace and plugin: + +```bash +codex plugin marketplace add dwarvesf/dwarves-kit +codex plugin add kit@dwarves-marketplace +``` + +2. Open `/hooks` inside Codex and trust the hook definitions from `hooks/codex-hooks.json`. +3. Re-open `/hooks` and re-trust whenever the kit updates (each entry pins SHA-256 hashes of `anchor-root.sh`, `entry-normalize.jq`, and its guard script). + +### 3. Antigravity (`agy`) + +1. Point `DEVKIT_ROOT` at your kit checkout (for example `export DEVKIT_ROOT="$HOME/.claude/dwarves-kit"` in your shell profile). +2. Register `$DEVKIT_ROOT/hooks/agy-hooks.json` in your Antigravity hook configuration so `PreToolUse` and `Stop` invoke the `devkit` hook block. +3. Verify `jq` is on `PATH` and skills resolve via `~/.agents/skills/` (or repo `.agents/skills/`). + +### 4. Devin + +1. Point `DEVKIT_ROOT` at your kit checkout (`export DEVKIT_ROOT="$HOME/.claude/dwarves-kit"`). +2. Register `$DEVKIT_ROOT/hooks/devin-hooks.json` in your Devin hook configuration. +3. Verify `jq` is on `PATH` and `DEVIN_PROJECT_DIR` (or tool `workdir`) points at the target repo. + +### 5. Verify any non-Claude runtime from the shell + +Run one synthetic `PreToolUse` payload through `anchor-root.sh` to confirm the guard blocks destructive commands and allows safe ones: + +```bash +printf '{"tool_name":"Bash","tool_input":{"command":"git status"}}\n' \ + | bash hooks/anchor-root.sh --runtime codex --event PreToolUse hooks/safety-gate.sh +echo "exit=$?" + +printf '{"toolCall":{"name":"run_command","args":{"CommandLine":"git push --force origin main"}}}\n' \ + | bash hooks/anchor-root.sh --runtime agy --event PreToolUse hooks/safety-gate.sh +echo "exit=$?" +``` + +## What you will see + +Safe `codex` command exits `0` with no output; blocked `agy` command returns a JSON deny object on stdout (real output from `hooks/anchor-root.sh`): + +```text +exit=0 +{"decision":"deny","reason":"BLOCKED: Force push is dangerous. Use --force-with-lease if you must overwrite remote history."} +exit=0 +``` + +In `codex` and `devin`, a `PreToolUse` block prints the reason on stderr and exits `2`. Advisory notes from non-blocking guards append tab-separated lines to `${TMPDIR:-/tmp}/devkit-entry.log`. + +## When it breaks + +| You see | Do this | +|---|---| +| `agy` or Devin never blocks a dangerous command | Confirm `DEVKIT_ROOT` is exported in the runtime's environment and that `hooks/agy-hooks.json` or `hooks/devin-hooks.json` is registered in the runtime's hook config. | +| `dwarves-kit: trusted hook content changed` (exit 2) in Codex | A pinned hook script changed without repinning, or you updated the kit. Run `bash lib/codex/repin.sh check`, update via `bash lib/codex/repin.sh` if developing locally, and re-trust the definitions in Codex `/hooks`. | +| `devkit: jq missing` | Install `jq` onto `PATH`. Blocking guards fail closed when `jq` is absent. | +| `devkit: <guard> failed closed (exit ...)` | Check `DEVKIT_ROOT`, file permissions on `hooks/*.sh`, and whether the guard hit the 28-second `DEVKIT_ENTRY_TIMEOUT` watchdog. | +| Hooks did not arm in Claude Code right after `install.sh` | Start a new Claude Code session; running sessions and single-shot headless runs do not reload newly written `settings.json` hooks. | + +## Related + +- [`../reference/agent-runtimes.md`](../reference/agent-runtimes.md): full 4-runtime contract, tool-name normalization, and decision mapping +- [`../reference/hooks.md`](../reference/hooks.md): every hook's message prefix, knobs, and module +- [`../reference/install.md`](../reference/install.md): install layers, modules, and plugin-vs-bash detection +- [`adopt.md`](adopt.md): adopting a repository after your runtime is wired diff --git a/docs/guides/spine.md b/docs/guides/spine.md index 84b19fceb..11efea175 100644 --- a/docs/guides/spine.md +++ b/docs/guides/spine.md @@ -13,6 +13,14 @@ _Figure: work moves from think to retro in one loop; only the verification pipel - The classifier never picks full from the words of a task. When the words look risky it prints one `LANE-SUGGEST` line, and you decide whether to assign full. - At push, the ship gate looks at the files you changed. A hard path (a migration, auth or secrets file, a CI workflow, kit config, or an added data-loss line) gets the full lane's gates whatever lane the spec says. This runs only where the repo turned `[gate] lane_gates` on. - Most steps advise. Only the verification pipeline, the ship gate and a few hooks block (see [gates-and-proof.md](gates-and-proof.md)). +- The kit runs as a closed loop, not an open one: you set the contract and gates up front, and agents iterate inside bounded retries until mechanical checks (bash hooks, tests, read-only verifiers) pass. Every subsystem under `bin/` also works standalone from any shell without slash commands. + +| Open loop | devkit (closed loop) | +|---|---| +| agent plans its own route | the spec is the contract, written before build | +| agent grades its own work | hard gates are mechanical: bash hooks, tests, read-only verifiers | +| loops until budget dies | bounded retries (fix-agent max 2), then escalate to a human | +| one loop size fits all | risk lanes: tiny work skips the ceremony | ## What you do diff --git a/docs/impl-playbook/dapp-frontend.md b/docs/impl-playbook/dapp-frontend.md deleted file mode 100644 index 46421a1f8..000000000 --- a/docs/impl-playbook/dapp-frontend.md +++ /dev/null @@ -1,39 +0,0 @@ -# dApp frontend integration rules - -Distills the current EVM/Solana wallet-connection stack plus wallet-vendor security guidance (MetaMask, Phantom). A dApp frontend is a major real-world phishing surface: users get tricked into signing malicious transactions because the frontend, or the wallet, shows misleading or blind data. - -## Connection stack -- EVM: `viem` (typed, tree-shakeable) plus `wagmi` (React hooks) is the current default for new work. `ethers.js` is still actively maintained (6.17.0, monthly release cadence) and remains a reasonable choice; don't treat it as legacy or displaced, just a different tradeoff. Reown's `@reown/appkit` (WalletConnect Inc. rebranded to Reown in 2024) is the standard SDK for multi-wallet connection without exposing keys to the browser; `@walletconnect/modal` is npm-deprecated, migrate any reference to it. -- Solana: for new work, prefer `@solana/kit` + `@solana/kit-plugin-wallet` (Wallet Standard discovery, no per-wallet adapter package needed) per Solana's own docs. `@solana/wallet-adapter-react` (`ConnectionProvider` -> `WalletProvider` -> `WalletModalProvider`) still works and still ships releases, now under the `anza-xyz` org rather than `solana-labs`, but it is legacy/maintenance-mode for existing apps; don't start a new dApp on it. - -## Prefer typed signing over blind signing -- Request `eth_signTypedData_v4` (EIP-712 typed structured data) over `personal_sign`/raw `eth_sign` wherever possible. Typed signing binds the signature to chain ID, contract address, and version, and lets the wallet render named fields instead of an opaque hex blob the user cannot verify. Treat a raw-hex signature request in your own flow as a design smell to fix, not accept. -- For a custom signing UI (anything beyond what the wallet renders natively), describe the request with ERC-7730 clear signing, a JSON descriptor format the Ethereum Foundation launched 2026-05-12 with MetaMask, Reown, Ledger, and others, so users see plain-language terms ("Swap 1.5 ETH for 3,200 USDC") instead of raw calldata. - -## EIP-7702 delegation phishing -- EIP-7702 lets an EOA delegate its execution to a contract. Phishing kits abuse this: a look-alike site gets the user to sign a delegation (an authorization-list transaction) pointing at a generic drainer contract, which then sweeps the wallet on the next incoming funds. Public research (Wintermute) found over 97% of mainnet EIP-7702 delegations in the sample pointed at the same reused sweeper bytecode family, and losses from this pattern have run into the millions. Treat a delegation-signing request the same as a private-key handover: never build a flow that signs one blind, and surface the delegate contract's address in your own UI so the user can verify the target before approving. - -## Approval scoping -- Request the exact token allowance needed for the immediate action. Never request `type(uint256).max` (unlimited approval) as a default; nearly every dApp does, and it is the single most-abused permission in wallet-drainer attacks. Surface the requested scope in the dApp's own UI before the wallet prompt appears; do not rely on the wallet alone to explain it. - -## Known exploit patterns to design against -- Blind-signature phishing: a look-alike site requests a signature that looks harmless and replays it elsewhere. -- Malicious `setApprovalForAll`/unlimited-approval requests disguised as routine actions. -- Address poisoning: a lookalike address seeded into the user's transaction history to bait a copy-paste mistake. -- Permit/Permit2 phishing: an EIP-712 typed signature can itself grant a token allowance gaslessly; typed signing improves legibility, it does not by itself make a signature request safe. - -## The one absolute -- Never build a UI that asks a user to paste a seed phrase or private key. No exception, no "just this once for debugging." - -## Sources -- [EIP-712 spec](https://eips.ethereum.org/EIPS/eip-712) -- [MetaMask: Sign Data guide](https://docs.metamask.io/metamask-connect/evm/guides/sign-data/) -- [MetaMask: what is a malicious token approval](https://support.metamask.io/stay-safe/safety-in-web3/what-is-a-malicious-token-approval/) -- [Phantom: security at Phantom (transaction simulation)](https://phantom.com/learn/blog/security-at-phantom) -- [Penny Wise and Pound Foolish: an empirical study of ERC-20 approvals](https://ar5iv.labs.arxiv.org/html/2207.01790) -- [Solana docs: Migrating to Kit](https://solana.com/docs/frontend/web3-compat) -- [Reown docs (WalletConnect rebrand, AppKit)](https://docs.reown.com/) -- [Ethereum Foundation: Clear Signing (ERC-7730) announcement](https://blog.ethereum.org/2026/05/12/clear-signing-announcement) -- [The CrimeEnjoyor epidemic: EIP-7702 delegation phishing](https://dev.to/ohmygod/the-crimeenjoyor-epidemic-how-eip-7702-delegation-phishing-drained-450k-wallets-and-how-to-e2g) - -Verified: 2026-08-03. diff --git a/docs/impl-playbook/elixir.md b/docs/impl-playbook/elixir.md deleted file mode 100644 index 85ce72582..000000000 --- a/docs/impl-playbook/elixir.md +++ /dev/null @@ -1,38 +0,0 @@ -# Elixir implementation rules - -Distills the community Elixir Style Guide, Credo, Dialyzer/dialyxir, and OTP's core design principles. - -## Style -- `mix format` is the formatter, non-negotiable, never hand-format. Beyond formatting: `snake_case` for functions/atoms/variables, `PascalCase` for modules, predicate functions end in `?` (not an `is_` prefix). -- Pipe operator (`|>`) for 3+ chained transformations. A single call does not need a pipe. -- Pattern matching in function heads over `if/else` chains. Use `with` to chain fallible operations that each return `{:ok, _} | {:error, _}`, instead of nested `case` statements. - -## OTP process design -- A plain module with pure functions is the default. Reach for a GenServer only when you need to hold mutable state across calls, serialize access to a shared resource, or respond asynchronously. -- "Let it crash": a process fails fast on invariant violations; a supervisor handles recovery (`:one_for_one`, `:one_for_all`, `:rest_for_one`), not defensive in-process error handling everywhere. - -## Types -- Since Elixir 1.20 (June 2026), the compiler itself does sound, gradual set-theoretic type checking, built in, not a separate tool. It infers types across patterns, function calls, protocols, and anonymous functions with no `@spec` annotations required, and reports *verified* bugs (typing violations guaranteed to fail at runtime) as compile errors. This is now the primary line of defense against type errors. -- Dialyzer/dialyxir is a separate, older, best-effort tool (unsound success typing, warnings only, no compiler integration). Keep it in CI as a complementary check for gaps the compiler's type system doesn't cover yet, it is no longer the main line of defense. -- `@spec`/`@type` still matter for public API boundaries, documenting intent for readers and feeding Dialyzer, but the compiler's own inference no longer depends on them. A wrong spec is worse than no spec, it misleads both Dialyzer and readers. - -## Testing -- ExUnit is the test runner (`mix test`), built in, no alternative needed. -- For invariant-heavy logic, `StreamData` (property-based testing, `ExUnitProperties`/`check all`) is worth the dependency. Example-based tests are the default otherwise. - -## Web (Phoenix, when applicable) -- Phoenix is the de facto default for anything web-facing in Elixir. Keep business logic in Contexts (dedicated modules like `Accounts`, `Blog`); controllers stay thin and framework-agnostic. - -## Tooling -- `mix credo` before commit, hard gate. `mix format --check-formatted` in CI. - -## Sources -- [Elixir Style Guide (community)](https://github.com/christopheradams/elixir_style_guide) -- [Credo](https://github.com/rrrene/credo) -- [Elixir GenServer / Mix-OTP guide](https://elixir.hexdocs.pm/genservers.html) -- [StreamData: property-based testing](https://elixir-lang.org/blog/2017/10/31/stream-data-property-based-testing-and-data-generation-for-elixir/) -- [Phoenix Contexts](https://phoenix.hexdocs.pm/contexts.html) -- [Elixir v1.20 released: now a gradually typed language](https://elixir-lang.org/blog/2026/06/03/elixir-v1-20-0-released/) -- [Gradual set-theoretic types (Elixir docs)](https://elixir.hexdocs.pm/gradual-set-theoretic-types.html) - -Verified: 2026-08-03. diff --git a/docs/impl-playbook/solana.md b/docs/impl-playbook/solana.md deleted file mode 100644 index 8a0bef86b..000000000 --- a/docs/impl-playbook/solana.md +++ /dev/null @@ -1,37 +0,0 @@ -# Solana implementation rules - -Distills the Anchor framework docs, Neodyme's Solana Security Workshop, and Helius's Solana program security guide. Solana's account model creates vulnerability classes that do not exist on EVM chains: an instruction operates on whatever accounts the caller supplies, so every account must be validated, not assumed. - -## Use Anchor's account constraints, not raw account handling -- `Account<'info, T>` auto-checks the account's discriminator on deserialize, blocking "type cosplay" (treating one account type as another). `Signer<'info>` enforces the signer check. Declarative constraints (`has_one`, `owner`, `seeds`/`bump`, `close`) push validation into the account struct instead of hand-written `if` checks scattered through the instruction body. Prefer these over raw `AccountInfo` handling by default. - -## The vulnerability checklist for every instruction -- Signer check: does every account that should only be actioned by its owner actually require a signature? -- Owner check: is the account's owning program verified, not just its type? -- Discriminator/type check: covered automatically by `Account<'info, T>`, but verify when dropping to `AccountInfo` for any reason. -- PDA seeds and bump: seeds must be canonical and the bump must be the canonical bump, not an attacker-supplied alternate bump that derives a different address. -- Account closing: use Anchor's `close = target` constraint rather than a hand-written close, to avoid revival attacks (the runtime only garbage-collects a zero-lamport account after the transaction completes, so a later instruction in that same transaction can refund the "closed" account and reuse it). -- Duplicate mutable accounts: Anchor 1.0+ rejects passing the same mutable account twice in one instruction by default (a real bug class: silent overwrite of the "other" account). Below 1.0, this is unenforced; check for it manually. If a program genuinely needs the same account mutable twice, it opts in explicitly with `#[account(mut, dup)]`. - -## Arithmetic -- Rust's overflow checks are not on by default in release builds; they only panic in debug mode. Use `checked_add`/`checked_sub`/`checked_mul` everywhere money or supply math is involved regardless of the flag below. -- **Anchor projects**: since Anchor 0.30.0, `anchor build` hard-errors if `overflow-checks` is unset in the workspace `Cargo.toml` at all, and `anchor init` templates set `overflow-checks = true` by default. But the check only requires the key to be *present*, not `true`; an explicit `overflow-checks = false` builds fine. Verify the generated Cargo.toml actually has `overflow-checks = true` under `[profile.release]`; do not assume the default holds just because the project builds. -- **Raw `cargo-build-sbf` and Pinocchio projects get none of this.** Anchor's build-time check is Anchor tooling, not a Rust/Solana-wide guarantee. Set `overflow-checks = true` explicitly in Cargo.toml yourself; nothing will stop a build with it missing or disabled. - -## Testing -- `anchor test` against a local validator is the non-negotiable minimum, not optional. Add a static-analysis pass (Sec3 X-ray, the closest Solana equivalent to Slither) before anything holding real value. - -## Why this matters -- Wormhole (February 2022, $320M) is the canonical case study: a forged sysvar account bypassed signature verification because an unchecked account was trusted. It maps directly to the checklist above (owner/account validation), not to a separate oracle-trust problem. - -## Sources -- [Anchor account constraints reference](https://www.anchor-lang.com/docs/references/account-constraints) -- [Anchor 0.30.0 release notes (overflow-checks requirement)](https://www.anchor-lang.com/docs/updates/release-notes/0-30-0) -- [Anchor 1.0.0 release notes (dup-account default, Solana 3.x)](https://www.anchor-lang.com/docs/updates/release-notes/1-0-0) -- [Pinocchio](https://github.com/anza-xyz/pinocchio) -- [Neodyme Solana Security Workshop](https://workshop.neodyme.io/) -- [Helius: A Hitchhiker's Guide to Solana Program Security](https://www.helius.dev/blog/a-hitchhikers-guide-to-solana-program-security) -- [Sec3 X-ray](https://github.com/sec3-product/x-ray) -- [Halborn: the Wormhole hack explained](https://www.halborn.com/blog/post/explained-the-wormhole-hack-february-2022) - -Verified: 2026-08-03. diff --git a/docs/impl-playbook/solidity.md b/docs/impl-playbook/solidity.md deleted file mode 100644 index 4f3542fdf..000000000 --- a/docs/impl-playbook/solidity.md +++ /dev/null @@ -1,45 +0,0 @@ -# Solidity implementation rules - -Distills ConsenSys Smart Contract Best Practices, OpenZeppelin Contracts, and Slither. A smart contract bug is usually unrecoverable once deployed: there is no patching a live contract without a pre-planned upgrade path, and funds lost to an exploit are typically gone for good. - -## Never hand-roll what OpenZeppelin already audited -- Use OpenZeppelin's `ERC20`/`ERC721`, `AccessControl`/`Ownable`, and a reentrancy guard instead of reimplementing token or access-control logic. Using the audited library is itself a security control, not a style preference. For chains on Cancun or later, use `ReentrancyGuardTransient` (`nonReentrant`, added v5.1, built on EIP-1153 transient storage): OpenZeppelin's own source now marks the storage-based `ReentrancyGuard` "Deprecated, will be removed in v6.0". Keep the storage-based guard only for pre-Cancun chains or upgradeable proxies (no upgradeable version of the transient variant exists yet). - -## Reentrancy -- Checks-effects-interactions: validate, then update state, then make any external call, in that order. The DAO hack (2016, roughly $60M drained) is the canonical case for what happens when a contract calls out before updating its own state. -- A transient-storage lock (`TSTORE`/`TLOAD`, EIP-1153) must be explicitly cleared at the end of the call frame. Transient storage persists for the whole transaction, not just the current call, so a lock left set silently blocks every later call in the same tx, a composability break rather than a revert you'd notice in isolation. This is also part of why the transient guard is preferred post-Cancun: `TSTORE` is usable below the 2,300 gas stipend where `SSTORE` is not. - -## Arithmetic -- Solidity 0.8+ reverts on overflow/underflow by default. Any `unchecked{}` block disables that check locally and reintroduces the pre-0.8 bug class. Treat every `unchecked{}` block as a flagged, individually justified exception, never a default reached for gas savings alone. - -## Access control -- Every state-changing function has an explicit role or owner gate. Maintain a checklist mapping each state-changing function to its intended caller; a missing gate is a top real-world loss category. - -## External calls and known attack classes -- Check the return value of every external call. An unchecked failed `send`/`call` is treated as success by default. -- `.transfer()`/`.send()`: solc 0.8.31+ emits a deprecation warning on both, ahead of removal in the 0.9.0 breaking release (their fixed 2,300 gas stipend no longer reliably prevents reentrancy at current gas costs anyway). Use `.call{value: ...}("")` with an explicit success check, backed by checks-effects-interactions or a reentrancy guard, instead. -- Front-running/MEV: assume transaction ordering is visible and can be front-run. Do not rely on submission order for correctness. -- Oracle manipulation: a price read from a single on-chain source, especially via flash loan, is a manipulable input, not ground truth. - -## Upgradeability -- A proxy pattern (transparent or UUPS) introduces a storage-layout-collision risk between proxy and implementation. Use OpenZeppelin's Upgrades tooling to validate storage layout compatibility on every upgrade; a silent layout mismatch corrupts state permanently, no attacker required. - -## Tooling -- Slither clean, or every finding explicitly triaged with a written reason, before any deploy. This is a mandatory gate, not optional linting. -- Foundry (`forge`) is the default test framework: native Solidity tests, fast fuzzing, the tool most security researchers and major DeFi protocols actually use. Hardhat is the fallback when the project needs deep JS/TS tooling integration; Hardhat 3's Rust-based execution engine (EDR) narrowed most of the historical speed gap (no official head-to-head benchmark exists, but the older "Foundry is 5-10x faster" reports predate this rewrite), so pick Hardhat for ecosystem fit, not because Foundry has a large performance edge left to justify it. -- A contract holding real value beyond personal-project scale is the point to consider Certora or an external audit, not before. - -## Sources -- [ConsenSys Smart Contract Best Practices](https://consensysdiligence.github.io/smart-contract-best-practices/) (archived, no longer actively maintained) -- [Smart Contract Security Field Guide](https://scsfg.io/) (successor, curated by the same Diligence engineer) -- [OpenZeppelin Contracts](https://docs.openzeppelin.com/contracts) -- [OpenZeppelin ReentrancyGuard.sol source (deprecation notice)](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol) -- [OpenZeppelin ReentrancyGuardTransient.sol source](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuardTransient.sol) -- [Slither (Trail of Bits)](https://github.com/crytic/slither) -- [Solidity 0.8.0 Breaking Changes](https://docs.soliditylang.org/en/latest/080-breaking-changes.html) -- [Solidity 0.8.31 Release Announcement](https://soliditylang.org/blog/2025/12/03/solidity-0.8.31-release-announcement/) -- [OpenZeppelin Proxy Upgrade Pattern](https://docs.openzeppelin.com/upgrades-plugins/proxies) -- [Foundry](https://book.getfoundry.sh/) -- [Nomic Foundation: Rust-powered Hardhat](https://blog.nomic.foundation/rust-powered-hardhat-present-future/) - -Verified: 2026-08-03. diff --git a/docs/impl-playbook/tool-picks.md b/docs/impl-playbook/tool-picks.md deleted file mode 100644 index 34543238b..000000000 --- a/docs/impl-playbook/tool-picks.md +++ /dev/null @@ -1,20 +0,0 @@ -# Tool and framework picks by category - -Extends a tech-stack-preferences table with a status column, borrowed loosely from the ThoughtWorks Radar (Adopt/Trial/Assess/Hold), for categories not already pinned elsewhere. Do not duplicate rows already pinned in your own stack preferences (Python tooling, versions, Node, containers, IaC, secrets); this file is the overflow. - -| Category | Pick | Status | Why | Reconsider when | -|---|---|---|---|---| -| Static web | Astro + Cloudflare Pages | Adopt | Ships fast, zero JS by default, matches existing sites | The project needs heavy client interactivity as its core feature; also: Cloudflare is now steering new full-stack projects toward Workers static assets over Pages (Durable Objects, Workers Logs, Logpush, Cron Triggers are Workers-only), Pages still fine for a pure static site | -| Dynamic/edge backend | Hono on Cloudflare Workers | Adopt | Thin, fast, matches the edge-first default | Needs long-lived connections or state a Worker cannot hold | -| Local ETL transform | DuckDB SQL | Adopt | Fast, no server, matches the quick-glue default | Data outgrows single-machine memory or disk | -| CLI framework (Go) | stdlib `flag`, `cobra` once subcommands appear | Adopt | Boring, well understood | Rarely; this is the stable default | -| State management (frontend) | React state/context first, a library only once state genuinely outgrows it | Adopt | Avoids a dependency for a problem that does not exist yet | Cross-component state sharing becomes the actual bottleneck | -| UI components | shadcn free blocks first, Tremor as fallback | Adopt | Matches the existing default-prototype-UI preference | A paid/Pro block is the only option that fits; note Tremor now ships a copy-paste blocks distribution (blocks.tremor.so, shadcn-style) alongside the npm package, not npm-only | - -Add a row here the next time a category comes up with no existing default. Do not leave the same decision ad hoc twice. - -## Sources -- [ThoughtWorks Technology Radar](https://www.thoughtworks.com/en-us/radar) -- [Choose Boring Technology (Dan McKinley)](https://mcfunley.com/choose-boring-technology) - -Verified: 2026-08-03. diff --git a/docs/reference/FEATURES.md b/docs/reference/FEATURES.md index 066a24efd..2c30f9d8a 100644 --- a/docs/reference/FEATURES.md +++ b/docs/reference/FEATURES.md @@ -13,25 +13,25 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh | Command | Trigger | Description | Specs | Tests | |---|---|---|---|---| | `/kit:absorb` | `[H/I]` | Maintainer-only: audit the kit's upstream sources (Credits drift + seed-rescan) and draft a dated, proposal-only absorption report. Does no… | SPEC-004, SPEC-007, SPEC-009 +7 | test-command-emit-sweep.sh, test-hooks.sh, test-meta-spec-depth.sh +1 | -| `/kit:adopt` | `[H/I]` | Adopt the current (or a target) repo into the dwarves-kit operate-contract: write a small AGENTS.md pointer (never over a repo's own file) … | SPEC-004, SPEC-013, SPEC-014 +44 | proof-loop-09-scenario-b.sh, test-adopt.sh, test-clean-room.sh +25 | +| `/kit:adopt` | `[H/I]` | Adopt the current (or a target) repo into the dwarves-kit operate-contract: write a small AGENTS.md pointer (never over a repo's own file) … | SPEC-004, SPEC-013, SPEC-014 +44 | test-adopt.sh, test-clean-room.sh, test-command-emit-sweep.sh +24 | | `/kit:assign` | `[H/I]` | Turn a backlog item (ID-NNN) into a scoped goal draft and route it into the right WORKFLOW lane. Writes .claude/goals/, never executes. | SPEC-006, SPEC-007, SPEC-024 +35 | test-context-note-shape.sh, test-hooks.sh, test-meta-contract.sh +5 | -| `/kit:battery` | `[H/I]` | The full independent-verification battery for a finished branch: a fresh-context acceptance verifier that RE-EXECUTES the verification comm… | SPEC-239, SPEC-244, SPEC-245 +11 | run-workflow.sh, test-battery-gate.sh, test-board-work.sh +13 | +| `/kit:battery` | `[H/I]` | The full independent-verification battery for a finished branch: a fresh-context acceptance verifier that RE-EXECUTES the verification comm… | SPEC-239, SPEC-244, SPEC-245 +11 | test-battery-gate.sh, test-board-work.sh, test-boundary-lint.sh +12 | | `/kit:debug` | `[H/I]` | Systematic debug loop: root cause before any fix. Four phases, an evidence ledger, the 3-fix architecture wall. Use for any bug, defect, re… | SPEC-006, SPEC-013, SPEC-014 +19 | test-command-triggers.sh, test-config-registry.sh, test-doc-figures.sh +8 | | `/kit:design` | `[H/I]` | Opt-in interactive solution-design beat between /think and /spec. Use when the operator wants to shape HOW to build after the idea passed /… | SPEC-003, SPEC-004, SPEC-005 +162 | test-anomalies-advisor.sh, test-board-mirror-cleanup.sh, test-ceremony-fits-diff.sh +40 | | `/kit:devs-team` | `[H/I]` | Parallel multi-lens critique of a solution design (the active spec if present, else the decision brief). Dispatches 5 engineering lenses, m… | SPEC-016, SPEC-018, SPEC-019 +14 | test-gate-vocab-recording.sh, test-meta-review-verifiers.sh, test-meta-spec-depth.sh +1 | | `/kit:dispatch` | `[H/I]` | Fire several disjoint VALIDATED specs concurrently, each in its own worktree, then converge. Cross-goal fan-out behind a disjointness gate … | SPEC-002, SPEC-016, SPEC-017 +114 | test-advisor.sh, test-agent-effectiveness.sh, test-attempt-state-race.sh +52 | -| `/kit:docs` | `[H/I]` | Update all project documentation to match the current codebase. Cross-references the diff against every doc file and fixes drift. | SPEC-001, SPEC-002, SPEC-003 +292 | conform.sh, proof-loop-09-scenario-b.sh, run-workflow.sh +163 | +| `/kit:docs` | `[H/I]` | Update all project documentation to match the current codebase. Cross-references the diff against every doc file and fixes drift. | SPEC-001, SPEC-002, SPEC-003 +292 | conform.sh, test-active-spec-pick.sh, test-adapters.sh +161 | | `/kit:draft-agent` | `[H/I]` | Meta-agent agent-builder. From a one-line description, generates a new subagent definition OR a mega-goal sub-goal file and (by default) in… | SPEC-089, SPEC-108, SPEC-139 +1 | test-agent-effectiveness.sh, test-command-emit-sweep.sh, test-meta-agent.sh +1 | | `/kit:execute` | `[H/I]` | Whole-spec execution with verification. Dispatches one builder for the whole spec, verifies every task's criteria once at the end, retries … | SPEC-001, SPEC-003, SPEC-004 +82 | test-board-work.sh, test-break-it.sh, test-config-registry.sh +29 | -| `/kit:explain` | `[H/I]` | Turn a merged change into a literate-diff explainer a human READS to understand: background -> goal + intuition -> a prose-ordered diff -> … | SPEC-050, SPEC-060, SPEC-094 +25 | proof-loop-09-scenario-b.sh, test-boundary-lint.sh, test-clean-room.sh +14 | +| `/kit:explain` | `[H/I]` | Turn a merged change into a literate-diff explainer a human READS to understand: background -> goal + intuition -> a prose-ordered diff -> … | SPEC-050, SPEC-060, SPEC-094 +25 | test-boundary-lint.sh, test-clean-room.sh, test-command-emit-sweep.sh +13 | | `/kit:feature-map` | `[H/I]` | Build or refresh a source-cited, agent-checkable feature inventory for ANY target project you point it at: per-module spec + a top-level ch… | SPEC-218, SPEC-219, SPEC-220 +2 | test-command-emit-sweep.sh | | `/kit:gauntlet` | `[H/I]` | Probe-convergence engine: a bounded-revise loop that converges an ARTIFACT (docs, a runbook, a spec, an API surface) toward a FIXED OUTCOME… | SPEC-226, SPEC-227, SPEC-228 +10 | test-config-registry.sh, test-doc-figures.sh, test-gauntlet-consumer.sh +6 | | `/kit:greenlight` | `[H/I]` | Post-push CI-green lane: snapshots an open PR's checks via gh, classifies each failure real vs flaky, fixes real ones via the kit:fix-agent… | SPEC-019, SPEC-217, SPEC-369 | test-audit-verdict-grammar.sh, test-gate-ledger-actions.sh, test-ql-verdict.sh | | `/kit:grill` | `[H/I]` | Universal intake interview: one type-shaped question at a time, each with a recommended answer, until the task is actually understood. Answ… | SPEC-058, SPEC-059, SPEC-063 +27 | test-anomalies-advisor.sh, test-ceremony-lens.sh, test-config-stamp.sh +17 | | `/kit:kit-health` | `[H/I]` | Run a self-assessment of the kit against its own philosophy. Checks file count, hook performance, source citations, and structural health. | SPEC-001, SPEC-002, SPEC-004 +18 | test-command-emit-sweep.sh, test-meta-docs-registry.sh, test-meta-goal-ledger.sh +4 | -| `/kit:mega` | `[H/I]` | Turn a multi-objective destination into a sequenced roadmap of dependent sub-goals: decompose, front-load every clarification once, set the… | SPEC-034, SPEC-036, SPEC-088 +53 | proof-loop-09-scenario-b.sh, test-adapters.sh, test-advisor.sh +45 | +| `/kit:mega` | `[H/I]` | Turn a multi-objective destination into a sequenced roadmap of dependent sub-goals: decompose, front-load every clarification once, set the… | SPEC-034, SPEC-036, SPEC-088 +53 | test-adapters.sh, test-advisor.sh, test-bin-forwarders.sh +44 | | `/kit:next` | `[H/I]` | Pick up the next undone task from the spec. Loads context, shows acceptance criteria, lets you drive the implementation. | SPEC-001, SPEC-002, SPEC-003 +146 | smoke.sh, test-active-spec-pick.sh, test-adapters.sh +95 | -| `/kit:onboard` | `[H/I]` | Guided first-run: detect the install mode, offer /kit:adopt for this repo, pick modules, capture the consumer knobs that make them work, di… | SPEC-199, SPEC-213, SPEC-232 +3 | proof-loop-09-scenario-b.sh, test-clean-room.sh, test-command-emit-sweep.sh +1 | +| `/kit:onboard` | `[H/I]` | Guided first-run: detect the install mode, offer /kit:adopt for this repo, pick modules, capture the consumer knobs that make them work, di… | SPEC-199, SPEC-213, SPEC-232 +3 | test-clean-room.sh, test-command-emit-sweep.sh, test-onboard-detect.sh | | `/kit:pitch` | `[H/I]` | Assemble an outward buy-in doc from what a gated run already produced: the spec, the proof-of-done, the implementation-notes, and the gate … | SPEC-140, SPEC-141, SPEC-193 +7 | test-gate-validate-round.sh, test-outcome-emit-sweep.sh, test-pitch.sh +2 | | `/kit:prototype` | `[H/I]` | Opt-in throwaway-spike beat beside /kit:design. Builds throwaway code that answers ONE design question: a logic/state model driven by hand … | SPEC-075, SPEC-206, SPEC-207 +3 | test-picture-section.sh | | `/kit:quiz-gate` | `[H/I]` | The ★-tap NUDGE before merging a significant+worthy gate PR: a 5-question quiz built from the ACTUAL diff+tests, handed to the operator's… | SPEC-125, SPEC-127, SPEC-136 +3 | test-boundary-lint.sh, test-install-modules.sh, test-kit-contract.sh +3 | @@ -57,7 +57,7 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh | Agent | Trigger | Dispatched by | Description | Specs | Tests | |---|---|---|---|---|---| | `acceptance-verifier` | `[D]` | battery, execute, verify | Dynamically executes the active spec's acceptance criteria via its `## Verification` section and reports whether the build actually satisfi… | SPEC-035, SPEC-090, SPEC-092 +7 | test-every-step-review.sh, test-kit-contract.sh, test-meta-review-verifiers.sh +2 | -| `advisor` | `[D]` | battery, mega, review-team +2 | The single cross-cutting generic review lens. Runs in TWO modes at the final integration/UAT boundary -- critique (an extra uniform lens ON… | SPEC-090, SPEC-091, SPEC-092 +32 | proof-loop-09-scenario-b.sh, test-adopt.sh, test-advisor.sh +17 | +| `advisor` | `[D]` | battery, mega, review-team +2 | The single cross-cutting generic review lens. Runs in TWO modes at the final integration/UAT boundary -- critique (an extra uniform lens ON… | SPEC-090, SPEC-091, SPEC-092 +32 | test-adopt.sh, test-advisor.sh, test-config-registry.sh +16 | | `agent-effectiveness` | `[D]` | draft-agent, loop-engineering (skill) | Validates an agent definition's EFFECTIVENESS (not just its structure) across four lenses -- tools minimal-yet-sufficient, description trig… | SPEC-088, SPEC-090, SPEC-091 +4 | test-advisor.sh, test-agent-effectiveness.sh, test-break-it.sh +2 | | `api-reviewer` | `[D]` | battery, review-team | Reviews a diff through the API-CONTRACT lens only (breaking changes, versioning, request/response schema, error codes, backward compat, ide… | SPEC-111 | test-meta-review-verifiers.sh | | `audit-scanner` | `[D]` | backlog-reconcile (skill), ci-drift (skill), doc-drift (skill) +4 | Shared read-only Tier-2 evidence scanner for audit-loop instances (doc-drift, topology-drift, ci-drift, backlog-reconcile, web-drift, repo-… | SPEC-220, SPEC-222, SPEC-225 +3 | test-audit-scanner-contract.sh, test-audit-verdict-grammar.sh, test-meta-docs-registry.sh +2 | @@ -75,7 +75,7 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh | `integration-verifier` | `[D]` | execute, verify | Verifies that the tasks of a completed build actually wire together. Dispatched once at /execute Step 4 for multi-task specs. Read-only -- … | SPEC-090, SPEC-092, SPEC-115 +2 | test-agent-effectiveness.sh, test-every-step-review.sh, test-meta-goal-ledger.sh +3 | | `meta-agent` | `[D]` | draft-agent | The agent that drafts agents. From a one-line description, drafts a new subagent definition OR a new mega-goal sub-goal file, matching the … | SPEC-088, SPEC-089, SPEC-090 +6 | test-meta-agent.sh, test-meta-review-verifiers.sh, test-meta.sh +2 | | `performance-reviewer` | `[D]` | battery, review-team | Reviews a diff through the PERFORMANCE lens only (hot paths, N+1, allocations, caching, latency, complexity). Read-only. Dispatched by /kit… | SPEC-111 | test-meta-review-verifiers.sh | -| `recheck-verifier` | `[D]` | execute | Fresh-context re-audit of a right-arm verifier's PASS (kit:task-verifier / kit:integration-verifier / kit:acceptance-verifier / kit:system-… | SPEC-090, SPEC-092, SPEC-107 +8 | proof-loop-09-scenario-b.sh, test-every-step-review.sh, test-known-failures.sh +2 | +| `recheck-verifier` | `[D]` | execute | Fresh-context re-audit of a right-arm verifier's PASS (kit:task-verifier / kit:integration-verifier / kit:acceptance-verifier / kit:system-… | SPEC-090, SPEC-092, SPEC-107 +8 | test-every-step-review.sh, test-known-failures.sh, test-meta-review-verifiers.sh +1 | | `research-architecture` | `[D]` | spec | Maps architecture patterns and conventions in an existing codebase. Dispatched by /spec for brownfield projects. Read-only. | SPEC-210, SPEC-211 | test-research-arch-contract.sh | | `research-context` | `[D]` | spec, test-plan | Quick brownfield orientation for a target area (endpoints, data models, UI, test coverage, recent history) -- capped at 80 lines, throwaway… | - | - | | `research-features` | `[D]` | feature-map | Deep, uncapped, source-cited feature inventory for one module of a target project -- every entry point gets a file:line citation and a beha… | SPEC-203, SPEC-208, SPEC-209 | - | @@ -103,7 +103,7 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh | `observe` | `[I]` | Query and render the kit's control plane (fleet runs, spend, debt; backed by lib/bench) from an agent session. NOT for your own Claude Code… | SPEC-033, SPEC-052, SPEC-128 +17 | smoke.sh, test-bin-forwarders.sh, test-kit-contract.sh +4 | | `repo-hygiene` | `[I]` | Use for the whole-repo decay audit, "run the repo-hygiene loop", "what has rotted in this repo", "is anything mis-shelved", "dọn repo", o… | SPEC-256 | test-audit-cadence.sh, test-audit-verdict-grammar.sh, test-repohygiene.sh | | `skill-review` | `[I]` | Review and promote skill drafts that skill-curator staged from past sessions. Use when the user runs /skill-review, says "review my skill d… | SPEC-218, SPEC-285 | test-async.sh, test-bin-forwarders.sh, test-egress-visible.sh +7 | -| `stats` | `[I]` | Query or render ledger state and propose backlog rows off anomalies. Use when asked to SEE it -- "show me the ledger state", "my waived gat… | SPEC-001, SPEC-182, SPEC-192 +24 | proof-loop-09-scenario-b.sh, test-anomalies-advisor.sh, test-bin-forwarders.sh +39 | +| `stats` | `[I]` | Query or render ledger state and propose backlog rows off anomalies. Use when asked to SEE it -- "show me the ledger state", "my waived gat… | SPEC-001, SPEC-182, SPEC-192 +24 | test-anomalies-advisor.sh, test-bin-forwarders.sh, test-board-brief.sh +38 | | `system-design` | `[I]` | Own the repo's system design document at docs/SYSTEM-DESIGN.md: its format, its updates per feature, and rendering it as a UML drawing set … | SPEC-292, SPEC-426, SPEC-427 | test-doc-figures.sh, test-system-design.sh | | `topology-drift` | `[I]` | Maintainer-only. Use to audit THIS KIT's OWN feature estate against its path map, "run the topology-drift loop", "feature inventory drift".… | SPEC-225, SPEC-235, SPEC-237 | test-audit-cadence.sh, test-audit-scanner-contract.sh, test-audit-verdict-grammar.sh +1 | | `web-drift` | `[I]` | Use for the live-website agent-readiness audit, "run the web-drift loop", "web drift sweep", "check the public sites", or a scheduled caden… | SPEC-232, SPEC-256, SPEC-298 | test-audit-cadence.sh, test-audit-verdict-grammar.sh, test-web-drift-refusal-guard.sh | @@ -112,7 +112,7 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh | Hook | Trigger | Event | Description | Specs | Tests | |---|---|---|---|---|---| -| `anchor-root.sh` | `[E]` | - | cd to the repo (or worktree) root, then run the given hook command, unless the hook's module is off. | SPEC-334, SPEC-340, SPEC-355 +3 | test-adopt.sh, test-anchor-module-gate.sh, test-codex-hooks.sh +8 | +| `anchor-root.sh` | `[E]` | - | cd to the repo (or worktree) root, then run the given hook command, unless the hook's module is off. | SPEC-334, SPEC-340, SPEC-355 +3 | test-adopt.sh, test-anchor-module-gate.sh, test-codex-hooks.sh +9 | | `anti-rationalization.sh` | `[E]` | Stop | Stop hook that blocks Claude from declaring work done while rationalizing incomplete work or guess-fixes. | SPEC-003, SPEC-006, SPEC-008 +10 | test-codex-hooks.sh, test-entry.sh, test-gate-opt-in.sh +7 | | `auto-format.sh` | `[E]` | PostToolUse | PostToolUse hook that runs the matching formatter after every file write or edit, idempotent and never blocking. | SPEC-003, SPEC-084, SPEC-334 | test-adopt.sh, test-hooks.sh, test-install-modules.sh | | `backlog-stage.sh` | `[E]` | SessionEnd+SessionStart | SessionEnd hook that stages work-items from the session into a staging file, never onto the board. | SPEC-192, SPEC-194, SPEC-195 +12 | test-adopt.sh, test-backlog-stage-parity.sh, test-data-root.sh +7 | @@ -134,7 +134,7 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh | `post-compact-reinject.sh` | `[E]` | SessionStart | SessionStart hook (matcher compact) that re-injects the critical project rules compaction strips from context. | SPEC-003, SPEC-010, SPEC-034 +5 | test-active-spec-pick.sh, test-hooks.sh, test-install-modules.sh +2 | | `pre-compact-backup.sh` | `[E]` | PreCompact | PreCompact hook that saves a structured snapshot of the session before auto-compaction. | SPEC-010, SPEC-084, SPEC-334 +3 | test-active-spec-pick.sh, test-hooks.sh, test-install-modules.sh +3 | | `prose-rag.sh` | `[E]` | UserPromptSubmit | UserPromptSubmit shim that injects prior-note recall when PROSE_RAG_INJECT=1; dormant otherwise. | SPEC-194, SPEC-204, SPEC-249 +6 | smoke.sh, test-adopt.sh, test-bin-forwarders.sh +8 | -| `safety-gate.sh` | `[E]` | PreToolUse | PreToolUse hook that blocks destructive deletes, direct pushes to main or master, and force-pushes. | SPEC-003, SPEC-014, SPEC-019 +15 | proof-loop-09-scenario-b.sh, test-anchor-module-gate.sh, test-codex-hooks.sh +13 | +| `safety-gate.sh` | `[E]` | PreToolUse | PreToolUse hook that blocks destructive deletes, direct pushes to main or master, and force-pushes. | SPEC-003, SPEC-014, SPEC-019 +15 | test-anchor-module-gate.sh, test-codex-hooks.sh, test-codex-manifest.sh +12 | | `secrets-guard.sh` | `[E]` | PreToolUse | PreToolUse hook that blocks the agent from reading secret files, with the path canonicalized first. | SPEC-014, SPEC-084, SPEC-288 +4 | test-codex-hooks.sh, test-codex-manifest.sh, test-entry.sh +6 | | `ship-gate.sh` | `[E]` | PreToolUse | PreToolUse hook that refuses a push onto a default branch, or a push or PR when the spec lane has a required gate with no ran or override e… | SPEC-006, SPEC-042, SPEC-044 +88 | test-active-spec-pick.sh, test-anchor-module-gate.sh, test-ceremony-fits-diff.sh +52 | | `slop-cleaner.sh` | `[E]` | Stop | Stop hook that nudges, never blocks, on bloat signals in recently modified source files after long sessions. | SPEC-013, SPEC-014, SPEC-084 +4 | test-anchor-module-gate.sh, test-codex-hooks.sh, test-egress-visible.sh +3 | @@ -146,7 +146,7 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh | Verb | Trigger | Source | Description | Specs | Tests | |---|---|---|---|---|---| -| `adopt pointer` | `[V]` | `lib/adopt.sh` | inject the small AGENTS.md pointer, proof marker and CLAUDE.md loader into a target repo, hash-safe and idempotent | SPEC-047, SPEC-048, SPEC-049 +14 | proof-loop-09-scenario-b.sh, test-adopt.sh, test-clean-room.sh +13 | +| `adopt pointer` | `[V]` | `lib/adopt.sh` | inject the small AGENTS.md pointer, proof marker and CLAUDE.md loader into a target repo, hash-safe and idempotent | SPEC-047, SPEC-048, SPEC-049 +14 | test-adopt.sh, test-clean-room.sh, test-gate-opt-in.sh +12 | | `board state-check` | `[V]` | `lib/board/state_check.py` | validate the stored state values of a repo's own registry file; block new drift at commit, report existing drift | SPEC-428 | test-state-check.sh | | `board work` | `[V]` | `lib/board/work.sh` | one table of who is on what, how far along and who is stuck, joined at call time from board, git, Orca and the run ledger; read-only | SPEC-366, SPEC-370, SPEC-430 | test-board-work.sh, test-mega-box.sh, test-orchestrate-orca.sh | | `check-edit` | `[V]` | `lib/gate/check-edit.sh` | check-edit signal for execute: did the build weaken the checks the spec names, from a base ref diff | SPEC-369 | test-whole-spec-dispatch.sh | diff --git a/docs/reference/agent-runtimes.md b/docs/reference/agent-runtimes.md new file mode 100644 index 000000000..ef0974861 --- /dev/null +++ b/docs/reference/agent-runtimes.md @@ -0,0 +1,84 @@ +# Agent runtimes: one contract for four runtimes + +Canonical integration specification for running devkit across **Claude Code**, **Antigravity (`agy`)**, **Codex**, and **Devin**. For the step-by-step setup guide, see [`../guides/runtimes.md`](../guides/runtimes.md). For per-hook messages and knobs, see [`hooks.md`](hooks.md). + +## Runtime matrix + +| Runtime | Operating contract | Portable skills | Hook manifest | How hooks run | What the owner must register | +|---|---|---|---|---|---| +| **Claude Code** | `AGENTS.md` + `CLAUDE.md` | `.agents/skills/` (symlinked as `skills/` and `~/.claude/skills/`) | `hooks/hooks.json` (plugin) or root `settings.json` (bash install) | Full hook set across SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, Stop, SessionEnd, Notification, PermissionRequest, StatusLine; every hook except `secrets-guard.sh` runs via `hooks/anchor-root.sh <hook>` | Install plugin (`/plugin marketplace add dwarvesf/dwarves-kit`, `/plugin install kit@dwarves-marketplace`) or run `bash install.sh`, then start a new session | +| **Codex** | `AGENTS.md` | `.agents/skills/` | `hooks/codex-hooks.json` (via `.codex-plugin/plugin.json`) | 12 shared PreToolUse and Stop guards via `hooks/anchor-root.sh --runtime codex --event <PreToolUse\|Stop> <guard>` with inline SHA-256 verification | Add plugin (`codex plugin marketplace add dwarvesf/dwarves-kit`, `codex plugin add kit@dwarves-marketplace`), then trust definitions in `/hooks` and re-trust after every kit update | +| **Antigravity (`agy`)** | `AGENTS.md` | `.agents/skills/` | `hooks/agy-hooks.json` | 12 shared PreToolUse and Stop guards via `hooks/anchor-root.sh --runtime agy --event <PreToolUse\|Stop> <guard>` | Set `DEVKIT_ROOT` to the kit checkout path and register `hooks/agy-hooks.json` in your `agy` hook configuration (inert until registered) | +| **Devin** | `AGENTS.md` | `.agents/skills/` | `hooks/devin-hooks.json` | 12 shared PreToolUse and Stop guards via `hooks/anchor-root.sh --runtime devin --event <PreToolUse\|Stop> <guard>` | Set `DEVKIT_ROOT` to the kit checkout path and register `hooks/devin-hooks.json` in your Devin hook configuration (inert until registered) | +| **Other runtimes** | `AGENTS.md` | `.agents/skills/` (if supported) | None | Standalone `bin/<subsystem>` CLI works from any shell; hooks are advisory only | None | + +## Shared hook entry (`hooks/anchor-root.sh --runtime`) + +```text + Claude Code ──────────────────────> anchor-root.sh <guard> ───────────────────> guard.sh + (cd repo root, check [modules]) + + Codex (hooks/codex-hooks.json) ─┐ + agy (hooks/agy-hooks.json) ─┼─> anchor-root.sh --runtime <rt> --event <ev> <guard> + Devin (hooks/devin-hooks.json) ─┘ | + +-> jq -f hooks/entry-normalize.jq (normal form) + +-> check [modules] (spine always runs) + +-> watchdog (DEVKIT_ENTRY_TIMEOUT, default 28s) + +-> guard.sh (plus shell/patch path scan for secrets-guard) + `-> runtime-specific deny / ask / continue output +``` + +### The 12 shared guards + +`codex-hooks.json`, `agy-hooks.json`, and `devin-hooks.json` wire the same 12 guards across two events: + +- **PreToolUse (9 guards):** `safety-gate.sh`, `ship-gate.sh`, `commit-format.sh`, `board-row-gate.sh`, `batch-debt-warn.sh`, `secrets-guard.sh`, `spec-drift-guard.sh`, `money-gate.sh`, `tool-policy-guard.sh`. +- **Stop (3 guards):** `anti-rationalization.sh`, `slop-cleaner.sh`, `citation-guard.sh`. + +Spine guards (`safety-gate.sh`, `secrets-guard.sh`, `ship-gate.sh`, `spec-drift-guard.sh`, `commit-format.sh`, `anti-rationalization.sh`) run unconditionally. Module-gated guards check `lib/config/hook-module.sh` against `lib/config/modules.tsv` and exit 0 when their module is off. + +### Tool-name and payload normalization (`hooks/entry-normalize.jq`) + +`entry-normalize.jq` translates runtime stdin JSON into Claude Code normal form before invoking the guard: + +| Normal tool | Codex | Antigravity (`agy`) | Devin | +|---|---|---|---| +| `Bash` | `Bash` | `run_command` | `exec` | +| `Read` | (via `Bash`) | `read_file`, `view_file` | `read` | +| `Write` | (via `apply_patch`) | `write_file` | `write` | +| `Edit` | `apply_patch` | `edit_file`, `replace_file_content`, `multi_replace_file_content` | `edit`, `apply_patch` | +| `Grep` | `Grep` | `grep_search` | `grep` | +| `Glob` | `Glob` | `find_by_name` | `glob` | + +Working directory resolution: +- **Codex:** `.cwd`, else `$PWD`. +- **Antigravity (`agy`):** `.cwd`, else `.workspacePaths[0]`, else `$PWD`. +- **Devin:** `.tool_input.workdir`, else `$DEVIN_PROJECT_DIR`, else `.cwd`, else `$PWD`. + +For `secrets-guard.sh` on `PreToolUse`, `anchor-root.sh` also extracts candidate file paths from `Bash` commands (resolving relative paths after `cd`) and `apply_patch` headers (`*** Add/Update/Delete File:` and `Move to/from:`) and runs `secrets-guard.sh` against each path. + +### Decision mapping, redaction, and failure posture + +`anchor-root.sh --runtime` redacts token-shaped strings (`ghp_*`, `sk-*`, `xox*-*`, `AKIA*`, 32+ hex strings) before emitting any reason text. + +| Guard outcome | Codex | Antigravity (`agy`) | Devin | +|---|---|---|---| +| Block (`exit 2`) on PreToolUse | Reason on stderr, `exit 2` | `{"decision":"deny","reason":...}`, `exit 0` | Reason on stderr, `exit 2` | +| Block (`exit 2`) on Stop | Reason on stderr, `exit 2` | `{"decision":"continue","reason":...}`, `exit 0` | `{"decision":"block","reason":...}`, `exit 0` | +| Ask (`permissionDecision: "ask"`) | Treated as deny (`confirm by hand: ...`), `exit 2` | `{"decision":"ask","reason":...}`, `exit 0` | Treated as deny (`confirm by hand: ...`), `exit 2` | +| Advisory note (`additionalContext` / `systemMessage`) | Appended to `${TMPDIR:-/tmp}/devkit-entry.log`, `exit 0` | Appended to `${TMPDIR:-/tmp}/devkit-entry.log`, `exit 0` | Appended to `${TMPDIR:-/tmp}/devkit-entry.log`, `exit 0` | +| Internal error / timeout / missing `jq` | Blocking guards **fail closed**; note-only guards (`batch-debt-warn`, `spec-drift-guard`, `slop-cleaner`) **fail open** and log to `${TMPDIR:-/tmp}/devkit-entry.log` | Same fail-closed / fail-open split | Same fail-closed / fail-open split | + +### Codex SHA-256 trust pinning (`lib/codex/repin.sh`) + +Every command in `hooks/codex-hooks.json` verifies the SHA-256 digests of `hooks/anchor-root.sh`, `hooks/entry-normalize.jq`, and its target guard script before calling `exec`. Modified hook code exits `2` (`dwarves-kit: trusted hook content changed`) until a maintainer runs `bash lib/codex/repin.sh` and the owner re-trusts the updated command strings in Codex `/hooks`. `bash lib/codex/repin.sh check` verifies pin freshness in tests. + +## Portable skills (`.agents/skills/`) + +All portable `SKILL.md` playbooks live in `.agents/skills/<name>/SKILL.md` (with root `skills` symlinked to `.agents/skills` for Claude Code compatibility). `install.sh` symlinks every skill into both `~/.agents/skills/` and `~/.claude/skills/`, so Claude Code, Antigravity, Codex, and Devin discover the same skill set without duplicate copies. See [`skills.md`](skills.md) for the roster. + +## Authoring surfaces and CLI fallback + +- **Slash commands (`commands/*.md`) and subagent prompts (`agents/*.md`)** are Claude Code authoring surfaces. +- **Standalone CLI (`bin/<subsystem>`)** works identically in every runtime and bare terminal without slash commands (for example `bin/board`, `bin/classify`, `bin/gate`, `bin/spec`, `bin/stats`, `bin/wrap`, `bin/precedent`). +- **Session lifecycle hooks** (`SessionStart`, `UserPromptSubmit`, `PostToolUse`, `PreCompact`, `SessionEnd`, `Notification`, `PermissionRequest`, `StatusLine`) run only in Claude Code today; `codex-hooks.json`, `agy-hooks.json`, and `devin-hooks.json` cover `PreToolUse` and `Stop`. diff --git a/docs/reference/architecture.md b/docs/reference/architecture.md index 70f51e37d..86e6300d2 100644 --- a/docs/reference/architecture.md +++ b/docs/reference/architecture.md @@ -1,6 +1,6 @@ # Architecture -How devkit fits together. Read PHILOSOPHY.md first for the WHY; this file is the WHAT and HOW. The harness-level loop story (the five stages, formerly "legs": Shape → Build → Watch → Check → Reflect, and which module serves which) lives in [`lifecycle.md`](lifecycle.md) "The five stages", backed by ADR-0034/ADR-0036 and the machine registry `lib/config/module-registry.md`; this file does not restate it. +How devkit fits together. Read PHILOSOPHY.md first for the WHY; this file is the WHAT and HOW. The harness-level loop story (the five stages, formerly "legs": Shape → Build → Watch → Check → Reflect, and which module serves which) lives in [`workflow-paths.md`](workflow-paths.md#the-five-stages) "The five stages", backed by ADR-0034/ADR-0036 and the machine registry `lib/config/module-registry.md`; this file does not restate it. ## Component layout diff --git a/docs/reference/data-flow.md b/docs/reference/data-flow.md index fd21626a9..2de17b18f 100644 --- a/docs/reference/data-flow.md +++ b/docs/reference/data-flow.md @@ -243,7 +243,7 @@ claim against the command that supposedly does it. ## Reading order -- New to the kit: `docs/reference/lifecycle.md` (the five stages) -> `docs/WORKFLOW.md` (how a run moves) -> this +- New to the kit: `docs/reference/workflow-paths.md` (the five stages) -> `docs/WORKFLOW.md` (how a run moves) -> this page (how data moves). - Adding a signal pipeline: `docs/reference/kit-contract.md` (the rules) -> flow 1 above (where your output has to land) -> `docs/specs/SPEC-200-signal-pipelines.md` (why). diff --git a/docs/reference/install.md b/docs/reference/install.md index 3fbab821a..6443d91b6 100644 --- a/docs/reference/install.md +++ b/docs/reference/install.md @@ -96,4 +96,17 @@ The two paths no longer collide. If the plugin is already installed, `install.sh **Invocation differs by path:** installed as the plugin, commands are namespaced `/kit:<name>` (e.g. `/kit:spec`); via the bash installer they resolve bare `/<name>` (e.g. `/spec`). The manual uses the plugin form. +## Product name and CLI stability + +Reader-facing docs refer to the product as **devkit** (one word, lowercase) alongside the existing `dwarves-kit` package name. Machine-typed names stay stable so existing shell scripts, hooks, and project configs keep working without edits: + +| Surface | Stable spelling | +|---|---| +| Slash commands | `/kit:*` (for example `/kit:start`, `/kit:spec`, `/kit:ship`) | +| Project and kit config | `.kit.toml`, `kit.toml`, `.kit/` | +| Install and runtime paths | `~/.claude/dwarves-kit`, `~/.config/dwarves-kit`, `~/.local/state/dwarves-kit`, `~/.cache/dwarves-kit`, `~/Library/Logs/dwarves-kit` | +| Environment variables | `KIT_*`, `DWARVES_*`, `DEVKIT_ROOT` | +| Hook banners and traces | `[dwarves-kit]` and `[dwarves-kit:<name>]` | +| Historical records | Existing `CHANGELOG.md` entries, specs, ADRs, retros, research, and verification records | + <!-- provenance: ADR-0024 --> diff --git a/docs/reference/lifecycle.md b/docs/reference/lifecycle.md deleted file mode 100644 index 66b18b055..000000000 --- a/docs/reference/lifecycle.md +++ /dev/null @@ -1,154 +0,0 @@ -# Lifecycle: the loop, the gates and the five stages - -The long-form picture of how one change moves through the kit and how the kit is organized across runs. The per-command detail is [`../MANUAL.md`](../MANUAL.md). The phase contract, lanes and gates are [`../WORKFLOW.md`](../WORKFLOW.md). Component fit is [`architecture.md`](architecture.md). How data moves is [`data-flow.md`](data-flow.md). - -## The loop and the toolbox - -Agent workflows are shifting from `prompt -> output` to `goal -> loop -> evaluate -> improve -> result`. devkit is the **closed** kind of that loop: you set the goal and the gates up front, and agents iterate inside them until a read-only verifier passes, never grading their own homework. - -It ships as a **toolbox, not an appliance.** Every subsystem is a standalone shell command that already works on its own, `bash lib/board/board.sh --help`, and the same for `gate`/`stats`/`classify`/`spec`/`goal`/`session`/`precedent`/`intake`/`wrap` (for example `bin/precedent find "<query>"`). There is no `kit` uber-binary and no install step to just poke at it, and the same bash reads under pi, opencode, Claude Code, or a bare terminal. Wiring it into Claude Code (`bash install.sh`) adds an always-on safety spine and lets you `--with` exactly the modules you want and nothing else; [`install.md`](install.md) has the layers. - -The loop itself is one spec-driven lifecycle, **think → spec → execute → review → ship → wrap → retro**, with a gate at every phase boundary: - -```text -+-------------------+ +-----------------------+ +---------------------+ -| goal + gates | --> | think | --> | spec | -| set up front | | (forcing questions) | | (the contract) | -+-------------------+ +-----------------------+ +---------------------+ - ^ advisory | spec-drift guard - | v - | +-----------------------------+ - | feeds the next cycle | execute | - | | builder -> end verifiers | - | | -> fix-agent | - | +-----------------------------+ - | | BLOCKING: verification - | v pipeline - +-------+ +------------+ +-----------------------------+ - | retro | <-- | ship |<-| review | - +-------+ | version+PR | | (verdict recorded) | - +------------+ +-----------------------------+ - BLOCKING: advisory - ship-gate + - push-to-main -``` - -That lifecycle is the middle of a longer arc. A board row becomes a landed PR like this: - -``` - _meta/BACKLOG.md /kit:assign lane-classify.sh - +----------------+ pull +----------------+ size +--------------------+ - | ID-NNN, queued | -----> | goal draft, | ------> | tiny | normal | | - | | | scope fence | | full | bug | | - +----------------+ +----------------+ | backfill | - +--------------------+ - | - +----------------------------------------------------------+ - v - think --> spec --> execute --> review --> docs --> ship - | | | | | | - advisory spec- verification advisory advisory ship-gate + - drift pipeline push-to-main - guard | - v - PR open --> /kit:wrap - board flip, merge own PR, - deploy check, tidy, activity line - | - v - ID-NNN row --> shipped -``` - -Two gate classes sit on those boundaries. **Blocking** gates are mechanical: the verification pipeline, the ship-gate and the push-to-main blocker stop a bad outcome. **Advisory** gates (think, review) surface findings and never block. The autonomous-loop hardening adds a fresh-context re-audit of every done-claim, a kit-default cross-cutting advisor lens on top of the specialized reviewers, and a deployable-done proof gate, so a closed loop can run long without drifting into self-graded slop. - -One builder implements the whole spec, then every task runs through one end verification pipeline (verifiers → fix-agent retry), and hooks enforce safety automatically (`rm -rf`, push-to-main, force-push, and secret-file reads are blocked). The builder is a domain specialist when one exists (a migration or data-pipeline worker, picked by a deterministic lookup), and `/kit:draft-agent` installs a reusable named agent. - -**You drive it by intent, not by memorizing commands.** Say what you want; the kit reads your intent, runs the right step, and stops only at the real decisions: - -``` -You: "add a --version flag to the CLI" -Kit: scopes it -> writes the spec -> builds + verifies -> ships, - pausing only where it needs your call. -``` - -The `/kit:*` commands in the command reference are those same actions named explicitly, for when you prefer to type them. You rarely need to. - -It is bash-first (every hook readable in 30 seconds), and every component traces to a proven pattern, no novel inventions. The point of the kit is the handoff: a solo technical lead writes the spec, a contractor runs `/kit:execute` against the *same* spec. - -New here? Start with [`../QUICKSTART.md`](../QUICKSTART.md). - -## Why a closed loop - -An open loop (the agent roams free and judges its own output) is a fast slop machine unless your standard is airtight and your budget is unlimited. The kit takes the closed shape instead: a human designs the path once, agents iterate inside it. What makes the loop trustworthy is that the gates that block are mechanical (bash hooks, tests, read-only verifiers), never the agent grading its own homework. The remaining phase gates advise and route rather than block: detect, don't dictate. - -| Open loop | devkit (closed) | -|-----------|----------------------| -| agent plans its own route | the spec is the contract, written before any build (validated on the full lane) | -| agent grades its own work | hard gates are mechanical: bash hooks, tests, read-only verifiers | -| loops until the budget dies | bounded: fix-agent retries max 2, then escalates to a human | -| one loop size fits all | risk lanes: tiny work skips the ceremony entirely | - -## Command sequence at a glance - -``` -/kit:start Detect state, suggest next command (entry point) -/kit:onboard Guided first-run: install mode, adopt, module picker, two-idea tour -/kit:think Challenge the idea (5 min) -/kit:design Opt-in: shape the solution with you before /spec -/kit:spec Generate the spec + parallel researchers (15-30 min) -/kit:spec-validate Stress-test the spec (10 min) - [hand off to contractor] -/kit:execute Autonomous: builder > end verifiers > fix-agent retry loop - or -/kit:next Manual: pick next task, load context, you drive - [hooks enforce during build] - [statusline shows context budget] - [slop-cleaner flags bloat at stop points] -/kit:review Single-pass review (10 min) -/kit:review-team Parallel multi-lens review, confidence-gated + validated findings -/kit:verify Re-run tests read-only; PASS / FAIL / INCONCLUSIVE -/kit:docs Update all docs to match code (5 min) -/kit:explain Literate-diff explainer: understand a change, not click-to-merge it -/kit:quiz-gate ★-tap nudge: a quiz built from the diff before merging a significant PR -/kit:pitch Outward buy-in doc from the spec + proof + impl-notes + grill record; ends in an ask, never fabricates -/kit:ship Review gate, version bump, changelog, commit, PR -/kit:retro Retrospective (10 min, after shipping) -``` - -Work is sized by risk lane before it starts (tiny / normal / full / bug, plus a `backfill` lane for reviewing an existing codebase and writing the operating-layer docs without changing behavior). The default is `normal`, and the words of a task never pick `full`: the classifier only suggests it, and the diff floor at push gives any hard-path change the full lane's gates. Each lane's phases are data in `kit.toml` (`[lane.<name>]`), which a repo can override in its own `.kit.toml`. The lanes, the gate at each phase boundary, and the operate-contract the agent follows live in [`../../AGENTS.md`](../../AGENTS.md) and [`../WORKFLOW.md`](../WORKFLOW.md). - -## The five stages - -The lifecycle above is what one run looks like. Across runs, the kit is organized as five stages (formerly called "legs"; the fifth was renamed from Learn to Reflect): **Shape** turns work into contracts, **Build** builds inside them, **Watch** records what happened, **Check** gates every boundary, and **Reflect** distills the record into proposals for the next cycle. - -```text - +-------+ +-------+ +-------+ +---------+ - | Shape | --> | Build | --> | Watch | --> | Reflect | - +-------+ +-------+ +-------+ +---------+ - ^ : | - | : gates every phase boundary | - | v | - | +-------+ | - | | Check | | - | +-------+ | - +------- cited proposals, human promotes --+ -``` - -This diagram is the stages. For how DATA actually moves through them (telemetry -> proposal -> board -> ship, the ledger write/read paths, and the module map of who calls whom), see [`data-flow.md`](data-flow.md). - -Stages are metadata, not directories: each module keeps its name and install unit, and declares a primary stage. The authoritative assignment (machine copy in [`../../lib/config/module-registry.md`](../../lib/config/module-registry.md), rendered by `config list`): - -| Stage | Modules / subsystems | -|---|---| -| Shape (Specify) | `spec`, `classify`, `precedent`, `intake`, `goal`, `board` (input side), `sync` (spoke intake; outward mirror is its Watch side) | -| Build (Execute) | `queue`, `mega`, `worktree`, `quiz_gate`, `proof_capture` | -| Watch (Observe) | `stats`, `session` (capture side), `telemetry`, `sync` (outward mirror side; absorbed the bridge cockpit mirror) | -| Check (Govern) | `gate`, `money_gate`, `advisor`, `gauntlet`, `wrap` | -| Reflect | `reflect` (was `learn`), `weekend_batch`, `session` (harvest), `board` (staging/promote), `skill-curator`, `prose_rag` (registry assignment, pending an amendment of the stage taxonomy decision) | -| (no stage) | `cosmetic` (statusline; orthogonal to the loop), `update_check` (newer-release notice; orthogonal to the loop) | - -Two modules honestly span stages: **board** (Shape's intake on one side, Reflect's staging/promote on the other) and **session** (Watch's capture, Reflect's harvest). - -**What happens to a run's data after it ships:** every gate decision and run outcome appends to the ledgers (append-only, never rewritten). `stats` projects them read-only; `session intel` writes the weekly digest, harness scorecard included; `reflect propose` distills cross-run evidence into cited proposals in a staging file; `reflect drain` renders that staging for review; `board promote` is the human gate that turns a proposal into a backlog row feeding the next Shape stage. Every automated stage ends at a staging file or a rendered surface, never a direct write to a board or ledger: propose, never dispose. - -<!-- provenance: ADR-0034, ADR-0036, SPEC-089 --> diff --git a/docs/reference/operations.md b/docs/reference/operations.md index 168045b0d..9c7ce27d7 100644 --- a/docs/reference/operations.md +++ b/docs/reference/operations.md @@ -56,3 +56,31 @@ the tool absent the hook no-ops and the kit greps exactly as before, nothing to configure and nothing breaks. Enable: put the binary on `PATH`, run `claude mcp add --scope user codebase-memory -- codebase-memory-mcp`, then re-run `install.sh`. + +## Archive tags + +The public release tree carries the kit, its design record, and its living docs. Dated working history is pruned at minor release cuts into an archive tag so the working tree stays small without losing provenance. + +**What a release prune removes** (dated working records nothing reads at runtime): + +- `docs/verification/`: one-off proof-of-done records and run logs (except the runtime files and `gauntlet/` listed below) +- `docs/implementation-notes/`, `docs/retro/`, and `lib/*/docs/implementation-notes/`: per-spec delta logs and cycle retros +- `docs/research/`: dated scans (`research/foundations/` stays) +- `docs/briefs/`: shipped working briefs (`README.md` and `TEMPLATE.md` stay) +- `docs/absorption/`: dated reports (`README.md` and `TEMPLATE.md` stay) + +**What always stays in the public tree:** + +- `docs/specs/`, `docs/decisions/`, and `CHANGELOG.md`: the design record and release history +- `docs/verification/gauntlet/`: the corpus the `gauntlet-proof-audit` skill checks +- Files code, tests, or commands read at runtime: `docs/verification/README.md`, `task-types.md`, `test-design-standard.md`, `rejected-findings.md`, `COUNTS.md`, `done-modes.md`, the lanes-as-data baseline, and the ceremony-lens baseline +- Every `README.md` and `TEMPLATE.md` in the pruned folders + +**Read or restore an archived file:** a prune removes files in a single commit without rewriting git history. The private `dwarvesf/dwarves-kit-internal` repo keeps the pre-release history at `history/master-pre-squash` and release archive tags (starting with `history/2026-10-27`). Maintainers with access inspect or restore an archived file there: + +```bash +git clone git@github.com:dwarvesf/dwarves-kit-internal.git +git -C dwarves-kit-internal show history/2026-10-27:docs/verification/advisor.md +``` + +Specs, decisions, and `CHANGELOG.md` keep their historical paths as written; living docs and code comments cite archived files as `history/<date>:<path>`. Nothing changes for new work: proof of done still goes in `docs/verification/`, implementation notes in `docs/implementation-notes/`, retros in `docs/retro/`, research in `docs/research/`, and working briefs in `docs/briefs/`. diff --git a/docs/reference/project-structure.md b/docs/reference/project-structure.md index a9ee3fcf0..11b1726bc 100644 --- a/docs/reference/project-structure.md +++ b/docs/reference/project-structure.md @@ -1,70 +1,60 @@ # Project structure -The directory layout of the kit repo. The map of `docs/` itself is [`../README.md`](../README.md). Component fit is [`architecture.md`](architecture.md). +Top-level directory layout of the kit repository. The `docs/` map lives in [`../README.md`](../README.md), per-module CLI contracts in [`../../lib/README.md`](../../lib/README.md), generated feature rows in [`FEATURES.md`](FEATURES.md), and component fit in [`architecture.md`](architecture.md). -``` +```text dwarves-kit/ - tool.toml Kit metadata (name, version, language=bash, deps) - AGENTS.md Tool-agnostic operate-contract front door (any runtime reads it first) - WORKFLOW.md Pointer stub; the cycle, lanes, gates, and flow/loop reference live in docs/WORKFLOW.md - CHANGELOG.md Release history - README.md / CONTRIBUTING.md / VERSION / LICENSE - CLAUDE.md Project template; the Claude-Code layer on top of AGENTS.md - install.sh / settings.json Bash install path - .claude-plugin/ Plugin install path (plugin.json, marketplace.json) - .github/workflows/test.yml CI: macOS + Ubuntu test matrix, on workflow_dispatch and v* tags only - bin/ STABLE consumer entrypoints (one `<subsystem> <verb>` grammar): `audit`/`board`/`classify`/`gate`/`goal`/`reflect`/`mega`/`precedent`/`intake`/`queue`/`session`/`spec`/`stats`/`config`/`plugin-check` thin forwarders to `lib/<subsystem>/`, plus the module CLIs (`prose-rag`, `worktree-provision`, `proof-capture`, `skill-improve`, `skill-review`) that keep their own names, and three standalone maintainer tools outside the forwarder pattern (`activate`, `release`, licensing and release cutting; `test-affected`, diff-scoped test runner with a pass cache). `learn` stays for one release as a deprecation forwarder to `reflect`. A consumer (an adopted repo's board shim, the adopt-injected CLAUDE.md block) references `$DWARVES_KIT/bin/<name>`, NEVER a deep lib path, so an internal lib reorg cannot silently break it (the board-shim class of bug). Deployed by install.sh next to lib/. - agents/ Subagents dispatched by commands - commands/ Markdown command prompts - hooks/ Hook scripts + hooks.json plugin manifest - lib/gate/dispatch-gate.sh Disjointness gate + drift guard for /kit:dispatch (pure-bash concurrency moat) - lib/classify/lane-classify.sh Deterministic task-type -> risk-lane classifier + advisory floor check (used by /kit:assign + /kit:dispatch); optional `--files "<paths>"` on classify/explain/check escalates the kit-machinery gate on an actual EDIT to lib/ or hooks/, not a mere textual mention (edit vs mention) - lib/goal/goal-registry.sh Cross-session running-goal registry: claim/list/log/release (multi-session moat + monitor) - lib/goal/goal-drafts.sh Goal-draft lifecycle: archive shipped drafts to .claude/goals/done/ - lib/telemetry/lane-telemetry.sh Read-side lane-effectiveness aggregator over the run ledgers: report + misfires (reviewed at /kit:retro) - lib/system-design/build UML drawing-set engine behind `skills/system-design`: renders `docs/SYSTEM-DESIGN.md` to one HTML page with the delta against a base ref marked (bash + git; node optional, only for `--shots` and the engine's `test.mjs`) - lib/queue/orchestrate.sh Non-LLM mega-goal driver: one fresh `claude -p` session per sub-goal so no session marathons; session-per-sub-goal, NOT the GSD-v2 engine (no priority/cross-machine/state-store). `run <dir>` flags: `--dry-run` (plan only), `--step` (pause for the operator between sub-goals), `--stream` (live stream-json tee'd to `.orchestrate/<id>.stream.jsonl`), `--board=roadmap|kanban|both` (event-sourced per-mega-goal kanban derived to `<dir>/BOARD.md` via `lib/board/backlog.sh`; default detects, ROADMAP stays canonical). `flip <dir> <id>` box-flip subcommand (mkdir-lock guarded, atomic). Opt-in trial `--backend orca` (or `MEGA_BACKEND=orca`, the flag wins) runs the ROADMAP through Orca Tasks and supervised Claude workers instead of one `claude -p` per sub-goal (`lib/queue/orca-backend.sh`, sourced only then); `status <dir>` prints each sub-goal's derived state and `orca-reset <dir>` rolls a run back; the ROADMAP box stays the only proof of done and the default path is unchanged. DAG-wavefront ON by default: at the default `WAVE_CAP=2` it runs dep-independent, `## Touches`-disjoint sub-goals concurrently (one worktree per session); a mega-goal whose sub-goals declare no `## Touches` still serializes (no-op), and `WAVE_CAP=1` forces the always-serial loop. `commands/mega.md` emits a `## Touches` per generated sub-goal so new mega-goals are wave-eligible. A `gate` sub-goal holds only its dependent chain; `gate!` halts the whole loop for a human. Robustness env (advisory): `WATCHDOG_STALL_SECS>0` backgrounds each session + flags it `stalled` after that long with no output (never kills); a dead/incomplete session never advances its box. Emits a `gate-ledger start` per dispatched sub-goal (rid from the goal file's `**Branch:**`) so mega-dispatched runs are tracked in `lane-telemetry`, not `?`. Multiplexer panes (opt-in `MULTIPLEXER=1`): each wave session runs in its own tmux window (`TMUX_CMD`/`TMUX_SESSION` seams) for capture-pane/send-keys watch + intervene. Viewer push (`PANE_VIEWER=auto` DEFAULT): on wave spawn one viewer tab auto-opens attached to the wave's tmux session (cmux/kitty/wezterm/ghostty/iterm/terminal auto-detected); `none` = pull only; headless degrades silently; unknown values rejected at pre-flight. Subagent panes: `panes <megadir> <target>...` grows one READ-ONLY tmux window per resolved transcript (a jsonl path, a directory of them, or `--latest` to derive the conductor's own `~/.claude/projects/<slug>/*/subagents` dir) for the DEFAULT background-subagent run mode, which has no wave to attach a pane to otherwise; each window runs `tail -F | jq` via the hidden `_pane-tail` re-entry (no shell in the pane -- steering stays with the conductor). `PANE_TAIL_JQ` overrides the formatter (default `lib/queue/pane-tail.jq`, a control-byte-stripping, length-capped line formatter for the subagent transcript schema). Always rc 0; skips warn on stderr and land in a `[panes] spawned N, skipped M` summary. Gitignore `.orchestrate/` + `BOARD.md` + `HANDOFF*.md` (derived/runtime) - lib/queue/queue.sh Overnight queue LAUNCHER: drives REAL interactive Claude Code `/goal` sessions via `tmux` send-keys (NOT headless `claude -p`, to sidestep the AUTH/KILL-CLASS risk; cmux was tried and dropped, no CLI-verified argv-safe launch primitive). `run <src.tsv>` (rows `slug<TAB>repo<TAB>pointer`) opens a fresh window per queued mega, types `/goal <pointer>` + Enter, polls `capture-pane` for the completion marker (`RUNNER_DONE`/`RUNNER_GATED`, line-anchored AND blank-line-guarded so a soft-wrapped echo of the typed prompt cannot false-trigger), journals each verdict to `queue-journal.tsv`, and stops the night after two consecutive `error`-or-`stalled` megas. `--from-boards` rows get a `realpath`-resolved allow-list confinement (`QUEUE_ALLOWED_POINTER_GLOB`, defense-in-depth on top of sub-goal 04's own; a hand-authored tsv is exempt). Flags: `--dry-run`, `--max-megas N`, `--from-boards`. CONSUMER config: `TERMINAL_MUX`(tmux only)/`MUX_CMD`/`QUEUE_CLAUDE_*`/`QUEUE_JOURNAL`/`QUEUE_*_SECS`/`QUEUE_ALLOWED_POINTER_GLOB`. Aliased as `orchestrate.sh queue <src>`. Idempotent (a `done` slug is skipped on re-run) - lib/goal/mega-merge.sh Ship-layer auto-merge ENFORCEMENT for /kit:mega: `gate <rid> <lane>` (decision, reuses `lib/gate/gate-ledger.sh check`) + `merge <pr> <rid> <lane> [--execute] [--posture=<val>]` (action; refuses unconditionally on a failing/missing gate, dry-run by default, `MEGA_MERGE_POSTURE` team-review opt-out) + `mark <pr> [repo]`(the mark half: opens a gate/gated-final PR as draft + `do-not-merge` so the `_merge_exclusion` guard always has a mark to catch; idempotent, gh via `MEGA_MERGE_GH`) - lib/board/board.sh The cockpit board command: `board|next|set|states|priority [mode]|work` on one repo's BACKLOG.md (`--backlog-file`; `work` is the read-only who-is-on-what table, see `lib/board/work.sh`), `all <cmd>` for a cross-repo registry render (`--repo-root`/`REPO_ROOT`, `boards.txt`), `queue [--dry-run]` -- walks the registry, parses every repo's board via `lib/board/parse-board.sh`, and emits an allow-listed `slug<TAB>repo-path<TAB>pointer-path` feed for an overnight runner -- `mirror`/`status`: a one-way git -> Hermes kanban bridge over opt-in (`bridge=on` in `boards.txt`) repos + active mega-goals, `hermes kanban` CLI only (native-first, no SQLite ATTACH), idempotent (a second run on an unchanged board is a zero-op no-op), incremental snapshot persistence -- and `writeback [--dry-run]`: the reverse leg, a Hermes-side card status move flows back into a repo's BACKLOG.md as a reviewable, HELD `chore/board-sync` PR (never auto-merged), gated by the mirror snapshot's `row_hash` conflict rule (git wins, always; a missing/corrupt snapshot refuses ALL edits rather than silently applying everything). Substantial mirror logic lives in `lib/adapters/hermes/board-mirror.sh`; substantial writeback logic lives in `lib/adapters/hermes/board-writeback.sh`; `board.sh` stays the thin dispatcher. Base kanban render still delegates to `lib/board/backlog.sh`; the `priority` quadrant awk + cross-repo `priority matrix` pivot are migrated in verbatim (byte-identical output is a pinned non-regression, see `history/2026-10-27:docs/verification/board-tool/`). `run <ID>` is the single-row dispatch path: scaffolds a minimal mega-goal dir for one board row and prints the `orchestrate.sh run <dir>` command (`--exec` composes the launch; logic in `lib/board/board-run.sh`). No personal data in the kit: the registry + repo paths + Hermes target are consumer config read at runtime. - lib/board/parse-board.sh The one structured BACKLOG.md parser other tools reuse: `rows <file>` (id/status/full-line) and `queue-rows <file> <repo-name> <repo-root>` (allow-listed `#queue{repo=...,pointer=...}` token extraction -- charset gate, repo self-consistency, `../` traversal hardening, existence check; every failure is a skip with a stderr reason, never a hard error) - lib/adapters/hermes/board-mirror.sh The git<->Hermes kanban bridge engine, backing `board.sh mirror`/`status`: extracts opted-in BACKLOG.md rows (reusing `lib/board/parse-board.sh`) + active mega-goal roadmaps into normalized rows, diffs them (bash + `jq`/awk keyed comparison, no DuckDB) against an incremental NDJSON snapshot, and loads via `hermes kanban` CLI verbs only. Reachable native states are `{triage, ready, blocked, done}` only -- `todo`/`running` were probed live and found to have no durable CLI-only path (auto-promote back to `ready` within seconds); `_target_native`/`_create_flags_for`/`_followup_for` document the full state-mapping + Hermes-CLI-reality findings. `apply-plan` decodes each op's argv over NUL-delimited jq output (never a templated shell string), so a multi-line card body is preserved as one opaque argv element end to end -- the fix for a real bug this build's own live dev-home E2E caught (a newline-delimited decode silently split a multi-line body into extra positional args, rejected by the real CLI, masked by a naive stub). `HERMES_BIN` overrides the binary for tests (a stub logs argv; no real Hermes calls in the automated suite). - lib/adapters/hermes/board-writeback.sh The git<->Hermes kanban bridge WRITEBACK leg, backing `board.sh writeback`: sources `lib/adapters/hermes/board-mirror.sh` (not re-forked) for extract/hash/native-state machinery. `diff` reads each opted-in repo's live board (`hermes kanban --board <b> list --json`, one batched call per board) + the mirror snapshot, and builds a validated changeset of rows whose Hermes status moved -- validating opted-in repo (defense in depth on top of the mirror's own filter), the CREATE-STATE RULE (a card still sitting in the column the mirror created it in never moved, so it is skipped: the snapshot records the column the mirror INTENDED, not one a human chose), the BLOCKED RULE (a card a human moved to `blocked` has NO git counterpart and is skipped, never written back as `parked`: `blocked` means someone cannot proceed right now, `parked` means deferred until a trigger and drops the row out of `board next` with no record of the blocker), the MIRROR-TERMINAL RULE (a `done` card whose completion result carries the mirror's own `board-mirror:` marker is the disappeared-row path reporting back, not a human finishing work, and is skipped rather than written back as `shipped` onto a row still live in git), a legal `backlog.sh` reverse-mapped target status, and the row_hash CONFLICT RULE (a Hermes-side edit applies only if the row's current git-side hash still equals the snapshot's recorded value; git wins, always). A missing or corrupt snapshot REFUSES ALL edits (explicit error, nonzero exit) rather than degrading to "no conflicts, apply everything". `apply` builds the `chore/board-sync` branch in an ISOLATED `git worktree` off the CURRENT HEAD (never the caller's own checkout, never a stale ref -- this is what keeps a concurrent append-only writer's row safe), edits ONLY the Status column of matched rows (reusing `lib/board/backlog.sh`'s own `set`), commits with `actor=hermes` in the body, pushes, and opens a HELD PR via `gh pr create` (argv-only, never a templated shell string; never auto-merged). Snapshot refresh updates ONLY `hermes_status` (to stop re-diffing the same not-yet-merged move); `row_hash` passes through UNCHANGED (the git SoT hasn't actually changed until the PR merges) -- `mirror`'s own idempotence self-heals the row once it does. `GH_BIN` (mirrors `HERMES_BIN`) overrides the `gh` binary for tests; no real Hermes write call or `gh` API call happens in the automated suite. - lib/adapters/<name>/ One connector behind the adapter interface (`reminders`, `github`, `multica`, `notion`, `hermes`): a manifest `adapter.tsv` (apps, flags, secrets, verbs, sweep legs, constants, hooks), an entry module `adapter.py`, its own code and a README. Core `lib/board` and `lib/sync` name no app: they read the manifests (`lib/sync/adapters.py`, `lib/sync/adapters.sh`) and call the adapters through the contract in `lib/adapters/README.md`. `KIT_ADAPTERS_DIR` replaces the scanned directory for tests and extensions. Tests in `lib/adapters/tests/` (module suite `test-adapters.sh`); dated specs and proof records in `lib/adapters/docs/`. - lib/board/work.sh `board work`: one read-only table of who is on what, how far along, and who is stuck. Joins the board rows, mega sub-goals, git branches and worktrees, `orca worktree ps` and the run ledger at call time and stores nothing; agent state is working, idle or unknown (file activity stands in for a worktree Orca does not list, marked `(files)`; with Orca itself missing it reads unknown); `--json` is the schema-1 form, `--idle-min N` sets the PARKED threshold - lib/board/state_check.py `board state-check`: the generic state-check engine. Reads a repo's OWN registry file (default `_meta/states.toml`, TOML) and checks the state values stored in that repo's files: `--all [--strict]` reports, `--staged` blocks new drift at commit, `--fix` repairs projection rows. Python 3.9 safe (built-in TOML reader when `tomllib` is absent); the kit ships no registry - lib/board/board-run.sh The single-board-row dispatch path, backing `board.sh run <ID>`: reads the row's Item + Notes through `backlog.sh row` (the board's own parser; same no-row / duplicate-id refusals as `get`), scaffolds the MINIMAL mega-goal dir `lib/queue/orchestrate.sh` expects (one `- [ ] SG-NN <item> , auto` ROADMAP line, POINTER_PROMPT.md seeded from the row, a `goals/01-*.md` contract with `Model:`/`**Branch:**` headers, HANDOFF.md + DECISIONS.md stubs) under the repo's megagoals convention (`--dir` > `megagoal_root:` CLAUDE.md hint > first in-use root in canonical order > `_meta/megagoals/<id-slug>/` default), then prints the exact `orchestrate.sh run <dir>` command. It never launches a session itself; `--exec` composes the launch and forwards args after `--` (e.g. `-- --dry-run`). Idempotent: an existing file is reported `kept`, never overwritten (the `board init` created/kept convention). - skills/ Claude-triggered skills (one folder per skill; roster in `docs/reference/skills.md`) - templates/rules/ Path-scoped coding-standard templates (`templates/` also holds the guide template) - integrations/ Tool adapters (claude-code, hermes) - output-styles/ Kit-shipped Claude Code output styles - deploy/macos/ The weekly scheduler LaunchAgent and its runbook - .codex-plugin/ Codex plugin manifest - kit.toml / .kit.toml Harness config: the shipped defaults, and this repo's own project overrides - examples/hello-spec/ Illustration of a repo after the kit is adopted: example AGENTS.md, CLAUDE.md and WORKFLOW.md pointers plus one small spec (the onboarding path is /kit:adopt) - tests/test-hooks.sh Hook behavior assertions - tests/test-meta.sh Structural integrity (manifests, frontmatter, cross-links) - docs/specs/SPEC-NNN-<slug>.md Specs, tracked in place via Status header (DRAFT/VALIDATED/SHIPPED); hooks pick the active one by git branch - docs/ The kit's documentation and design record (not needed to USE the kit; map in docs/README.md) - README.md Map of docs/: what each file is, and that you can skip it to use the kit - QUICKSTART.md / MANUAL.md First run, and the per-command operator reference - WORKFLOW.md The lifecycle contract: lanes, gates, loops - guides/ Task guides - reference/ Reference docs, among them: - PHILOSOPHY.md Design principles, target user, rejection list - architecture.md Components, data flow, the SDLC state machine, Collaborative Design Protocol, deps - execution-planes.md The four ways the kit runs agents, how they hand off, their trust models - decisions/ One ADR per file (NNNN-<slug>.md); supersession recorded in the Status line - specs/ Specs (SPEC-NNN-<slug>.md); also the live spec store the hooks detect - retro/ Per-cycle retrospectives (output of /kit:retro); new work adds its own - implementation-notes/ Per-spec delta logs written during a build; new work adds its own - verification/ Proof-of-done records, the gauntlet corpus, and the runtime files the gates and tests read - research/ foundations/ (the undated early notes the research agents read); dated deep-scans are added as new work needs them - briefs/ / absorption/ The decision-brief template and shared context; the absorption ritual and its report template - HISTORY.md What the release prune removed, and how to read an old file from the history tag - _meta -> dwarves-kit-internal Not in this repo: the kit's own board lives in the private dwarves-kit-internal repo; a maintainer links it as a local `_meta` symlink (gitignored) + AGENTS.md Tool-agnostic operate-contract front door (any runtime reads it first) + CLAUDE.md Claude Code layer on top of AGENTS.md + WORKFLOW.md Compact spine summary copied into adopted repos (full spec in docs/WORKFLOW.md) + README.md Public overview and quickstart pointer + CONTRIBUTING.md Contributor guide: local checks, PR shape, module contract + CODE_OF_CONDUCT.md Community conduct standards + SECURITY.md Vulnerability reporting, trust model, and hook safety scope + CHANGELOG.md Single in-repo release history (Keep a Changelog) + LICENSE / VERSION MIT license and current release version + tool.toml Kit metadata (name, version, language=bash, deps) + kit.toml / .kit.toml Shipped harness defaults and this repo's project overrides + repokit.toml Multi-contributor harness config (owners, PR shape, release notes) + install.sh / settings.json Bash installer and root Claude Code hook settings + skills -> .agents/skills Compatibility symlink to the portable skills root + .agents/skills/ Portable SKILL.md playbooks (Claude Code, Antigravity, Codex, Devin) + .claude/memory/ Tracked maintainer repo-memory notes + .claude-plugin/ Claude Code marketplace and plugin manifests + .codex-plugin/ Codex plugin manifest + .githooks/ Opt-in local pre-commit and pre-push git hooks + .github/ Issue forms, PR template, repokit PR workflow, sharded test.yml matrix + agents/ Subagent prompts dispatched by commands (roster in docs/MANUAL.md) + bin/ Stable `<subsystem> <verb>` consumer entrypoints forwarding to lib/<subsystem>/ + commands/ Markdown `/kit:*` slash-command prompts (roster in docs/MANUAL.md) + deploy/macos/ Optional macOS LaunchAgent dispatcher and runbook + docs/ Living documentation in 6 audience buckets (map in docs/README.md) + examples/hello-spec/ Worked consumer repo illustrating `/kit:adopt` output + hooks/ Runtime hook manifests (`hooks.json`, `codex-hooks.json`, `agy-hooks.json`, `devin-hooks.json`), shared entry (`anchor-root.sh`, `entry-normalize.jq`), and hook scripts + integrations/ Optional external surface add-ons (`claude-code/`, `hermes/`) + lib/ Standalone implementation modules (full module index in lib/README.md) + output-styles/ Optional agent communication style presets + scripts/ Multi-contributor harness scripts (`check.sh`, `doctor.sh`, `pr-shape.sh`, `check-owners.sh`, `secret-scan.sh`, `pr-merge.sh`, `release-notes.sh`) + templates/ Consumer starter guide (`GUIDE.template.md`) and path-scoped `rules/` + tests/ Hermetic bash test suites, fixtures, sharded `run-all.sh`, and `gauntlet/` + _meta -> dwarves-kit-internal Maintainer-only gitignored symlink to the private board repo (absent in public clones) ``` -For the full file listing including individual agent, hook and command names, run `git ls-files` or browse the repo on GitHub. +## Key `lib/` entrypoints + +Every `lib/<subsystem>/` module carries its own `README.md` and is indexed in [`../../lib/README.md`](../../lib/README.md) and [`FEATURES.md`](FEATURES.md). Consumer scripts always call `bin/<subsystem>`, never a deep `lib/` path. A few core engines cited directly by architecture and dispatch contracts: + +| Path | Role | +|---|---| +| `lib/board/board.sh` | Cockpit board dispatcher (`board`, `next`, `set`, `work`, `queue`, `run`, `state-check`, plus adapter verbs) | +| `lib/board/parse-board.sh` | Structured `BACKLOG.md` parser reused by `queue` and board adapters | +| `lib/adapters/hermes/board-mirror.sh` | One-way git to Hermes kanban bridge engine (`board mirror` / `board status`) | +| `lib/adapters/hermes/board-writeback.sh` | Reverse Hermes to git `chore/board-sync` PR leg (`board writeback`) | +| `lib/gate/` | Deterministic gate ledger, proof ledger, dispatch disjointness, and ship checks | +| `lib/classify/` | Task-type and risk-lane classifiers plus diff-floor checks | +| `lib/queue/` | Mega-goal runner (`orchestrate.sh`), Orca backend, and overnight queue launcher (`queue.sh`) | +| `lib/system-design/build` | UML drawing-set engine behind `skills/system-design` and `docs/figures/` | + +For the full tracked file listing, run `git ls-files`. <!-- provenance: SPEC-184, ADR-0034, ADR-0036, ADR-0028, ADR-0001, SPEC-105, SPEC-119, SPEC-120, SPEC-146, SPEC-147, SPEC-149 --> diff --git a/docs/reference/workflow-paths.md b/docs/reference/workflow-paths.md index 611bf0ade..15d790d07 100644 --- a/docs/reference/workflow-paths.md +++ b/docs/reference/workflow-paths.md @@ -21,7 +21,39 @@ GENERATED projection. This file enumerates every entry point and where each path Enforcement marks: `HARD` = a rule that code really blocks on (a hook or lib exits 2), listed in `docs/reference/hard-rules.tsv` and pinned by `tests/test-meta-hard-claims.sh`; a gate that is off by default says so in that registry's `gate` column; `adv` = advisory (warns, logs, never blocks); `conv` = convenience (never blocks, no verdict). The four hard stops are where autonomous runs stop for a human: safety-gate, the push-to-main blocker (inside safety-gate + ship-gate), anti-rationalization, and the execute verification pipeline. The pipeline is run by the command text, so `ship-gate` checks only that its gate was recorded. Other hooks block too (see the registry); everything else advises. -Stage grouping (Shape / Build / Watch / Check / Reflect) follows the five stages in `docs/reference/lifecycle.md`. Stages are metadata: a feature sits where its work happens, and Check gates every boundary rather than owning a segment. +Stage grouping (Shape / Build / Watch / Check / Reflect) follows `## The five stages` below. Stages are metadata: a feature sits where its work happens, and Check gates every boundary rather than owning a segment. + +## The five stages + +Across runs, the kit is organized as five stages (formerly called "legs"; the fifth was renamed from Learn to Reflect): **Shape** turns work into contracts, **Build** builds inside them, **Watch** records what happened, **Check** gates every boundary, and **Reflect** distills the record into proposals for the next cycle. + +```text + +-------+ +-------+ +-------+ +---------+ + | Shape | --> | Build | --> | Watch | --> | Reflect | + +-------+ +-------+ +-------+ +---------+ + ^ : | + | : gates every phase boundary | + | v | + | +-------+ | + | | Check | | + | +-------+ | + +------- cited proposals, human promotes --+ +``` + +This diagram is the stages. For how data moves through them (telemetry -> proposal -> board -> ship, the ledger write/read paths, and the module map of who calls whom), see [`data-flow.md`](data-flow.md). + +Stages are metadata, not directories: each module keeps its name and install unit, and declares a primary stage. The authoritative assignment (machine copy in [`../../lib/config/module-registry.md`](../../lib/config/module-registry.md), rendered by `config list`): + +| Stage | Modules / subsystems | +|---|---| +| Shape (Specify) | `spec`, `classify`, `precedent`, `intake`, `goal`, `board` (input side), `sync` (spoke intake; outward mirror is its Watch side) | +| Build (Execute) | `queue`, `mega`, `worktree`, `quiz_gate`, `proof_capture` | +| Watch (Observe) | `stats`, `session` (capture side), `telemetry`, `sync` (outward mirror side; absorbed the bridge cockpit mirror) | +| Check (Govern) | `gate`, `money_gate`, `advisor`, `gauntlet`, `wrap` | +| Reflect | `reflect` (was `learn`), `weekend_batch`, `session` (harvest), `board` (staging/promote), `skill-curator`, `prose_rag` (registry assignment, pending an amendment of the stage taxonomy decision) | +| (no stage) | `cosmetic` (statusline; orthogonal to the loop), `update_check` (newer-release notice; orthogonal to the loop) | + +Two modules span stages: **board** (Shape intake and Reflect staging/promote) and **session** (Watch capture and Reflect harvest). Every automated stage ends at a staging file or a rendered surface, never a direct write to a board or ledger: propose, never dispose. ## 2 · Flow topology (the one big picture) @@ -341,8 +373,7 @@ Off-ramp entries that also land in Shape: `[H/I] /kit:onboard` (first run, orche [E] PermissionRequest > permission-auto-approve (read-only ops) [conv] [E] StatusLine ──────> statusline (HUD render) [conv] [E] UserPromptSubmit > context-budget (warn once per context threshold) [adv] - [E] every wired event > anchor-root (cd to repo root, then run the hook) [conv] - [E] Codex runtime ───> codex-hook-adapter (normalize input, not in hooks.json) [conv] + [E] every wired event > anchor-root (cd to repo root, then run the hook; --runtime codex|agy|devin normalizes via entry-normalize.jq) [conv] [I] observe skill ───> control-plane dashboards via lib/bench read-only [I] stats skill ─────> ledger queries (kit/tide/learned/debt) read-only + one staging write Every automated Watch path ends at a staging file or a render, never a direct board/ledger write. @@ -512,8 +543,7 @@ One line per live feature: `entry -> ... -> terminal`. Grouped by kind; every fe | `[E] Notification -> notification -> desktop notify, async (conv, terminal)` | | `[E] PermissionRequest -> permission-auto-approve -> auto-approve read-only ops (conv, terminal)` | | `[E] StatusLine -> statusline -> HUD render (conv, terminal)` | -| `[E] every wired event, wrapper -> anchor-root -> cd to repo or worktree root, then run the named hook (conv, terminal)` | -| `[E] Codex runtime hooks, not wired in hooks.json -> codex-hook-adapter -> normalize Codex hook input, invoke shared policies (conv)` | +| `[E] every wired event, wrapper -> anchor-root -> cd to repo or worktree root, then run the named hook; --runtime codex\|agy\|devin normalizes input via entry-normalize.jq and invokes the 12 shared guards (conv, terminal)` | ### Verbs @@ -536,7 +566,7 @@ One line per live feature: `entry -> ... -> terminal`. Grouped by kind; every fe ## 6 · How to regenerate 1. Re-derive the backbone from the live tree: enumerate `commands/`, `agents/`, `skills/*/SKILL.md`, `hooks/*.sh` by `ls`, never trust a doc's count). -2. Take stage grouping from `docs/reference/lifecycle.md` "The five stages"; take flow shapes from `docs/WORKFLOW.md` "Flow and loop reference"; take rules and precedence from `docs/WORKFLOW.md` (canonical; it wins on any disagreement). +2. Take stage grouping from `## The five stages` above (derived from `lib/config/module-registry.md`); take flow shapes from `docs/WORKFLOW.md` "Flow and loop reference"; take rules and precedence from `docs/WORKFLOW.md` (canonical; it wins on any disagreement). 3. Take hook events from `hooks/hooks.json` and root `settings.json` (same wiring, two install paths; `statusline` rides the `statusLine` key, not a hook event). Live wiring wins over any doc claim: this pass found `tool-policy-guard` wired at PreToolUse `*` in both files although the trigger map called it unwired; it stays inert until a `tool-policy.json` exists. 4. Every live feature gets exactly one line in section 5; verify with `ls commands/*.md agents/*.md skills/*/SKILL.md hooks/*.sh | wc -l` against the index line count (derive the number, never hardcode it here). 5. Re-derive the System topology (section 3) from the finished path index: the `[H]`/`[I]`/`[E]`/`[D]` marks give the actor and dispatch edges; the store hand-offs come from each path's write target and the command that reads it next. Invent no edge the index does not show. diff --git a/docs/releases/2.3.0.md b/docs/releases/2.3.0.md deleted file mode 100644 index b76aedd9a..000000000 --- a/docs/releases/2.3.0.md +++ /dev/null @@ -1,82 +0,0 @@ -## dwarves-kit v2.3.0: design review as a diagram delta - -Minor release. New commands and behaviour, no breaking change to a public surface. Full entry list: [CHANGELOG.md](../../CHANGELOG.md) under `[2.3.0]`. - -### Highlights - -- **Design review as a diagram delta.** `/kit:design` now reviews a feature as a delta against `docs/SYSTEM-DESIGN.md`, rendered as a UML drawing set with new, changed and removed elements marked. `/kit:spec` stops on an unapproved L1 or L2 change and keeps terms and quality requirements as living docs. (#961, #962) -- **Lighter, data-driven lanes.** Lanes are data in `kit.toml`, the default lane is light, and a fail-closed diff floor applies full-lane gates to hard paths. Small specs skip the 7-reviewer round, and `/kit:execute` uses one builder per spec. (#840, #849, #860, #847, #843) -- **Safer gates and hooks.** A hardened `safety-gate` normalizer and `permission-auto-approve`, every hook anchored to the repo root, a board-row gate, and the hard-path exemptions listed under Security-relevant config. (#804, #801, #802, #703) -- **Wrap and landing grow up.** `wrap land`, `start`, `rebase`, `adopt` and `deploy-wait` land hand-made worktrees end to end, with merge proofs that cannot delete unlanded work, conflict recovery, CI-label waits, and a linted report. (#674, #718, #954, #947, #861, #794, #817) -- **Board and fleet visibility.** `board work` shows who is on what, `board brief` and `board health` post a daily digest per cluster, `board hermes` links kit skills into Hermes, and a Board pane mod brings it into Claude Code. (#834, #944, #941, #945, #874) -- **Scheduled harvest and the decision API.** The harvest sweep stages learnings from transcripts on a schedule, and `bin/flick` answers "pick one of N" through a decision API behind an egress guard. (#814, #829, #864, #895) -- **Cost and context observability.** `session observe entry-fee`, `burn` and `timing`, `session recall --tail`, and a percent-of-window `context-budget` warning show where tokens and time go. (#657, #563, #880, #753, #759) -- **Faster tests.** `bin/test-affected` and `run-all.sh --changed` run only what a diff touches, suites run in parallel, and `negctl --parallel` runs controls side by side. (#815, #664, #916, #930) - -### Headline: system design review (#961, #962) - -`/kit:design` now reviews a feature design as a delta against the repo's `docs/SYSTEM-DESIGN.md`. The `system-design` skill renders the model as a UML drawing set and marks every element `new`, `changed` or `removed` against a base ref. The reviewer reads sheets, not prose. The approved delta then feeds two downstream steps: a draft test plan (E1, `commands/design.md` Step 5b) and a stop in `/kit:spec` when a feature touches L1 or L2 without an approved design (E5, `commands/spec.md` Step 3). - -The sheets below come from the installed skill, `bash ~/.claude/skills/system-design/build`, on the marketplace example (with its base file) and on the design-process model. Screenshots are real renders, one element per sheet. - -**Delta sheet (marketplace).** 14 new, 2 changed, 5 removed against `SYSTEM-DESIGN.base.md`. - -![Delta sheet, marketplace](assets/2.3.0/marketplace-delta.png) - -**Order state machine with new and changed marks (marketplace).** `cancelling` and `refunding` are new states, the old direct `paid -> cancelled` and `refund` edges are shown dashed as removed. - -![Order states, marketplace](assets/2.3.0/marketplace-order-state.png) - -**Architecture components (marketplace).** The L1 sheet that E5 guards. - -![Architecture, marketplace](assets/2.3.0/marketplace-architecture.png) - -**Component sheet (design-process).** The same renderer on a second, unrelated model, no base file. - -![Component design, design-process](assets/2.3.0/design-process-comp-design.png) - -#### E1: test plan drafted from the delta - -After the user approves the diagram delta, Step 5b appends this section to the brief. One row per changed element, mapped by element kind, proof left `TBD`. - -```markdown -## Test plan (draft from design) - -| # | Changed element | Diagram id | Element key | Test kind | Proof | -|---|---|---|---|---|---| -| 1 | State transition | sm-order | transition paid -> cancelling (cancel, before shipping) | Transition case, plus one illegal sample for `cancelling` | TBD | -| 2 | State transition | sm-order | transition cancelling -> cancelled (charge.refunded) | Transition case | TBD | -| 3 | State transition | sm-quote | transition sent -> paying (owner pays) | Transition case, plus one illegal sample for `paying` | TBD | -| 4 | ERD constraint or key | schema | table variants (+col stock_on_hand, +col stock_reserved) | Constraint-violation case: reserved stock above on-hand stock is rejected | TBD | -| 5 | Component edge | architecture | edge core -> stripe (PaymentGateway) | Contract test | TBD | -``` - -Row 4 cites the changed columns because the example model declares no named constraint. Row 5 cites an edge that exists in both the base and the current model, so the delta sheet does not list it; it is a contract row on the new `paying` path, shown for the component-edge kind. - -#### E5: the L1/L2 stop in `/kit:spec` - -When the feature adds or changes an L1 or L2 element and the brief has no approved design for it, `/kit:spec` stops before it writes anything and routes back. The rule is in `commands/spec.md` Step 3. The message below shows its shape with an illustrative element. - -```text -STOP: L1/L2 change without an approved design. -Feature: refund worker -Changes: architecture (L1/L2): new component `refund-worker`, new edge core -> refund-worker -Brief: docs/briefs/DECISION-BRIEF-refund-worker.md has no approved design for it. -Next: run /kit:design to record an ADR and the L1/L2 delta, then re-run /kit:spec. -Specs may add L3/L4 detail on their own; this change is above that line. -``` - -### Also in this release - -- `wrap land --no-pull` never writes the main checkout; `wrap land` holds up to 300 s for late `pull_request` checks (#954, #947). -- `wrap` refuses to remove a worktree a live process still holds (#948). -- `board health`, `board brief`, `board hermes link|check`: a periodic board digest per cluster and a Hermes skill link with a stale-skill check (#941, #945, #946). -- `tests/run-all.sh --failed` and a no-weaken rule for the fix agent (#959). - -### Deprecated - -`bin/learn` forwards to `bin/reflect` for this one release (ADR-0036) and is removed from 2.4.0. Repoint any external caller to `bin/reflect` now. - -### Upgrade - -No migration. Re-run `install.sh` to pick up the new hooks and verbs. The release is not tagged yet: the tag push is the operator's step, as for 2.1.0 and 2.2.0. diff --git a/docs/releases/assets/2.3.0/design-process-comp-design.png b/docs/releases/assets/2.3.0/design-process-comp-design.png deleted file mode 100644 index cd15b1c6d..000000000 Binary files a/docs/releases/assets/2.3.0/design-process-comp-design.png and /dev/null differ diff --git a/docs/releases/assets/2.3.0/marketplace-architecture.png b/docs/releases/assets/2.3.0/marketplace-architecture.png deleted file mode 100644 index efaf3ca95..000000000 Binary files a/docs/releases/assets/2.3.0/marketplace-architecture.png and /dev/null differ diff --git a/docs/releases/assets/2.3.0/marketplace-delta.png b/docs/releases/assets/2.3.0/marketplace-delta.png deleted file mode 100644 index 93671a436..000000000 Binary files a/docs/releases/assets/2.3.0/marketplace-delta.png and /dev/null differ diff --git a/docs/releases/assets/2.3.0/marketplace-order-state.png b/docs/releases/assets/2.3.0/marketplace-order-state.png deleted file mode 100644 index cb42260b3..000000000 Binary files a/docs/releases/assets/2.3.0/marketplace-order-state.png and /dev/null differ diff --git a/docs/releases/v2.0.0/held-review.md b/docs/releases/v2.0.0/held-review.md deleted file mode 100644 index d1306743a..000000000 --- a/docs/releases/v2.0.0/held-review.md +++ /dev/null @@ -1,28 +0,0 @@ -# v2.0.0 HELD-pair review , #117 + #124 (release-blessing re-review) - -Fresh-context re-review of the two PRs merged "[HELD for Han]" that this tag blesses. Both re-run -green on the release branch. **Neither blocks the v2.0.0 tag.** - -## PR #117 , mega-merge code-level gate/held-final exclusion (SPEC-100) , SHIP-AS-IS -- `_merge_exclusion` runs BEFORE the gate; a held PR is refused even with passing gates; malformed - state fails closed (refuse). Hold-label parsing uses quoted `read -ra` (the glob-injection BLOCKER - is fixed); bracketed-title marker via pure-bash `case`-glob (macOS-CI-safe). -- The bundled gate-ledger `check()` fail-closed fix verified: a valid zero-gate lane (`tiny`) still - passes; an unknown lane fails closed. No regression (`test-mega-merge` 30/30, `test-mega-reconcile` - 35/35). -- Informational (non-blocking): the guard defends a MARKED PR; it cannot synthesize a mark (B1, - filed ID-089). The held PRs in this wave ARE marked, so the guard protects them. A non-canonical - hold label (`gated final` with a space) normalizes to `gatedfinal` and would not block , an - under-block edge; not practical since `mark` applies the canonical `do-not-merge` exactly. - -## PR #124 , lane-classify edit-vs-mention `--files` signal (SPEC-105) , SHIP-AS-IS -- `--files` escalates the `kit-machinery` gate only on an actual `lib/`/`hooks/` edit; without - `--files` the text-only path is byte-unchanged. Both directions pinned (`test-lane-classify` - 23/23). bash-3.2 empty-array + word-split footguns handled. -- Informational (non-blocking): the capability ships INERT , grep of `commands/`/`lib/`/`hooks/` - confirms ZERO live callers wire `--files`. The one hazard (under-gating if a future caller sources - `--files` from model free-text instead of `git diff --name-only`) is documented in-code + SPEC-105 - + flagged by TIER-4 security; watch it when the ID-088 wiring lands. - -## Verdict -Both clean, fail-safe, well-pinned, green on the release branch. Nothing blocks the tag. diff --git a/docs/releases/v2.0.0/release-body.md b/docs/releases/v2.0.0/release-body.md deleted file mode 100644 index 2492b7da1..000000000 --- a/docs/releases/v2.0.0/release-body.md +++ /dev/null @@ -1,27 +0,0 @@ -## dwarves-kit v2.0.0 , production-facing + cost-measured - -The release hold lifts: **kit-hardening** (the hold's condition) is complete and the **kit-face** -megagoal ships on top of it. This is a major bump , three agent renames are breaking, and the kit -now measures its own token cost. - -### ⚠️ BREAKING , agent renames (ADR-0029) -| old | new | -|---|---| -| `integration-checker` | `integration-verifier` | -| `reviewer` | `code-reviewer` | -| `security-auditor` | `security-reviewer` | - -Update any `subagent_type:` dispatch or invocation-template in a consuming repo. A grep of the -sibling consumer repos found the old names only in historical research/notes/templates , no live -dispatch wiring. - -### ✨ kit-face megagoal (8 sub-goals) -- **Cheap-first tier default** across execute workers, meta-agent Mode B, and the subgoal-template , sonnet by default, opus the explicit escape hatch (SPEC-107). -- **Meta-agent provenance** (`generated-by:`) + **runtime efficacy metric 11** (generated-agent catch count) (SPEC-108). -- **Capture-gated token accounting** , a `gate-ledger tokens` ledger line, `sum-usage` parser, `lane-telemetry` token section + `render --mermaid`; honest `usage=?`, default `claude -p` path byte-unchanged (SPEC-110). -- **Operator-persona design lens** , an inline 6th `/kit:visual-team` lens (SPEC-109). -- **UI done-modes + bounded quiescence loop** (proof | over-test | quiescence; two-sided stop, cap 3) (SPEC-112). -- **Starter role-specialized agent roster** , 2 workers + 4 reviewers, two live dispatch paths, reconciling SPEC-089 (SPEC-111). -- **README mermaid hero** + test-pinned layout counts (SPEC-113); **navigable docs map** (SPEC-114). - -Three version surfaces aligned at 2.0.0 and pinned together. See `CHANGELOG.md` for the full per-spec detail (this release also folds in the kit-hardening + kit-telemetry waves accumulated under `[Unreleased]`). diff --git a/docs/releases/v2.0.0/tag-message.txt b/docs/releases/v2.0.0/tag-message.txt deleted file mode 100644 index 8ddf9b28f..000000000 --- a/docs/releases/v2.0.0/tag-message.txt +++ /dev/null @@ -1,23 +0,0 @@ -v2.0.0 , production-facing + cost-measured - -The kit-hardening megagoal (the release-hold's condition) is complete, and the kit-face megagoal -ships on top of it: dwarves-kit now presents production-ready and measures its own token cost. - -BREAKING , three agents renamed to the -reviewer/-verifier convention (ADR-0029): - integration-checker -> integration-verifier - reviewer -> code-reviewer - security-auditor -> security-reviewer -Update any subagent_type dispatch or invocation-template in a consuming repo. (A grep of the -sibling consumer repos found only historical/prose references, no live dispatch wiring.) - -kit-face highlights: - - cheap-first sonnet tier default across three surfaces (SPEC-107) - - meta-agent provenance (generated-by) + runtime efficacy metric 11 (SPEC-108) - - capture-gated token accounting: TOKENS ledger + lane-telemetry token section + mermaid (SPEC-110) - - operator-persona 6th visual-team lens (SPEC-109) - - UI done-modes + a bounded quiescence loop (SPEC-112) - - a starter role-specialized agent roster + deterministic 2b-0 worker lookup (SPEC-111) - - README mermaid lifecycle hero + test-pinned counts (SPEC-113); navigable docs map (SPEC-114) - -Three version surfaces (VERSION, .claude-plugin/plugin.json, tool.toml) are aligned at 2.0.0 and -pinned together by test-meta. Full detail: CHANGELOG.md [2.0.0]. diff --git a/docs/team/release.md b/docs/team/release.md index 02932f799..718727668 100644 --- a/docs/team/release.md +++ b/docs/team/release.md @@ -6,5 +6,5 @@ Channel: GitHub Releases (dwarvesf/dwarves-kit) and Claude Code plugin marketpla 1. Confirm `bash tests/run-all.sh --all` is green via `.github/workflows/test.yml` (`gh workflow run test`) and run `/kit:kit-health` against `docs/reference/PHILOSOPHY.md`. 2. Bump `VERSION` and `.claude-plugin/plugin.json`, and move entries under `## [Unreleased]` in `CHANGELOG.md` into `## [<version>]`. -3. Generate or review release notes (for tagged changelog sections, `bash scripts/release-notes.sh <version>` per REL-02) and publish a release note under `docs/releases/<version>.md` when appropriate. +3. Generate or review release notes from `CHANGELOG.md` (for tagged changelog sections, `bash scripts/release-notes.sh <version>` per REL-02) and publish them on the GitHub Release (attaching any screenshots there rather than committing them under `docs/`). 4. Push the `v<version>` tag on `master` (triggers `.github/workflows/test.yml`) and publish the GitHub Release so `kit@dwarves-marketplace` serves the new version. diff --git a/docs/verification/gauntlet/2026-09-01-stats.md b/docs/verification/gauntlet/2026-09-01-stats.md deleted file mode 100644 index c6b45dd4c..000000000 --- a/docs/verification/gauntlet/2026-09-01-stats.md +++ /dev/null @@ -1,17 +0,0 @@ -# Gauntlet run-record stats (2026-09-01) - -| Run | Date | Rounds | Findings | Clean at | Rows GREEN | Probe tokens | Probe cost | Probe | -|---|---|---|---|---|---|---|---|---| -| 2026-08-06-kit-user | 2026-08-06 | 3 | 3->1->0 | 3 | - | 69703 | 7.2991 | - | -| 2026-08-06-kit-user/J3 | 2026-08-06 | 2 | 0->0 | 1 | - | 76794 | 10.9239 | - | -| 2026-08-31-onboarding-j1-revised | 2026-08-31 | 2 | 0->0 | 1 | - | 172199 | 0.0392 | - | -| 2026-08-31-user-J1 | 2026-08-31 | 1 | 4 | - | - | 13117 | 1.0144 | claude-sonnet-5, headless `claude -p`, one spend | -| 2026-08-31-user-J1-nw | 2026-08-31 | 1 | 4 | - | - | 165557 | 0.0332 | - | -| 2026-09-01-onboarding-campaign | 2026-09-01 | 1 | 2 | - | 10/11 | 1014128 | 0.2214 | omp + deepseek-v4-flash throughout | - -## Probe-model deltas (same card) - -| Card | Run | Rounds | Findings | Probe tokens | Probe cost | Probe | -|---|---|---|---|---|---|---| -| 2026-08-31-user-J1 | 2026-08-31-user-J1 | 1 | 4 | 13117 | 1.0144 | claude-sonnet-5, headless `claude -p`, one spend | -| 2026-08-31-user-J1 | 2026-08-31-user-J1-nw | 1 | 4 | 165557 | 0.0332 | - | diff --git a/docs/verification/repo-outline.md b/docs/verification/repo-outline.md new file mode 100644 index 000000000..da2dc08f9 --- /dev/null +++ b/docs/verification/repo-outline.md @@ -0,0 +1,255 @@ +# Verification: repo outline (`chore/repo-outline`) + +Before/after proof for the repository outline cleanup on `chore/repo-outline` rebased cleanly onto `origin/master` (`de38da2f`, before baseline measured on `05221e85`). Scope: table 3.5 folds (`docs/releases/`, `docs/HISTORY.md`, `docs/reference/lifecycle.md`, `docs/reference/project-structure.md` slim, `docs/guides/rename-to-devkit.md`, `lib/skill-curator/MANUAL.md`, `docs/briefs/` to `README.md` + `TEMPLATE.md`), table 3.6 deletes (keeping `bin/learn` and `lib/skill-curator/bin/cc-improve` until `2.4.0`), 6-bucket `docs/README.md` router, `docs/guides/runtimes.md` + `docs/reference/agent-runtimes.md`, `AGENTS.md` 4-runtime hook-entry update (< 7 KB) plus its `lib/adopt/agents-known.sha256` entry, and `docs/reference/FEATURES.md` regeneration. `install.sh`, `lib/adopt.sh`, `hooks/`, and `lib/gate/` were not modified. + +## Summary (Before on `origin/master` vs After on `chore/repo-outline`) + +| Check | Before (`05221e85`) | After (`chore/repo-outline`) | +|---|---|---| +| Runnable `tests/test-*.sh` count | `332` | `332` (`0` dropped) | +| `feature-registry.sh check docs/reference/FEATURES.md` | `EXIT=0` (fresh) | `EXIT=0` (fresh; only removed `proof-loop-09-scenario-b.sh`, `run-workflow.sh`, plus `+1` `anchor-root.sh` ref in `test-meta-contract.sh`) | +| `doc-projection-check.sh .` | `EXIT=0` | `EXIT=0` | +| `refcheck.sh scan --repo .` | `53 docs, 903 refs, 0 dead` | `52 docs, 987 refs, 0 dead` | +| Living Markdown relative link check | `broken_living_links=0` (`EXIT=0`) | `broken_living_links=0` (`EXIT=0`) | +| `tests/test-doc-figures.sh` | `54 passed, 0 failed` (`EXIT=0`) | `54 passed, 0 failed` (`EXIT=0`, 11 manifest ids) | +| `tests/test-meta-vmodel-dispatch.sh` | `75 / 75` (`EXIT=0`) | `75 / 75` (`EXIT=0`) | +| `tests/test-meta.sh` | `945 / 945` (`EXIT=0`) | `945 / 945` (`EXIT=0`) | +| `tests/test-kit-contract.sh` | `33 / 33` (`EXIT=0`; 12 allowlist rows) | `33 / 33` (`EXIT=0`; 9 allowlist rows) | +| `tests/test-no-personal-paths.sh` | `3 / 3` (`EXIT=0`) | `3 / 3` (`EXIT=0`) | +| `tests/test-no-scattered-ids.sh` | `9 / 9` (`EXIT=0`) | `9 / 9` (`EXIT=0`) | +| `tests/test-kri-wiring.sh` | `31 / 31` (`EXIT=0`) | `31 / 31` (`EXIT=0`) | +| `AGENTS.md` size and `$K` paths | `6948` bytes | `6993` bytes (< 7 KB); all 12 `$K` paths exist and are executable | +| `tests/test-adopt.sh` | `88 / 88` (`de38da2f`) | `88 / 88` (`EXIT=0`, after recording new `AGENTS.md` sha256 in `lib/adopt/agents-known.sha256`) | +| Throwaway `HOME` install + adopt + uninstall | `install=0`, `8752 KB`, `adopt=0`, `check=0`, `uninstall=0`, `dangling=0` | `install=0`, `8728 KB`, `has_settings_json=yes`, `repo_has_settings=yes`, `adopt=0`, `check=0`, `idempotent=0`, `uninstall=0`, `dangling=0` | + +## Green runs (After on `chore/repo-outline`) + +### 1. Suite count, registry freshness, and doc projection + +Command: +```bash +find tests -maxdepth 1 -name "test-*.sh" | sort | wc -l && \ +bash lib/registry/feature-registry.sh check docs/reference/FEATURES.md && \ +bash lib/gate/doc-projection-check.sh . +``` +Exit: `0` +Verdict: PASS +Output: +```text + 332 +feature-registry: docs/reference/FEATURES.md is fresh +``` + +### 2. Reference check and living relative links + +Command: +```bash +bash lib/docdrift/refcheck.sh scan --repo . && \ +python3 -c ' +import os, re, subprocess +files = [f for f in subprocess.check_output(["git","ls-files","-z"]).decode().split("\0") + if f.endswith(".md") and not f.startswith(("tests/","docs/specs/","docs/verification/","docs/implementation-notes/","docs/retro/","docs/absorption/","docs/research/"))] +link_re = re.compile(r"\[[^\]]*\]\((?!https?:|mailto:|#)([^)\s#]+)(?:#[^)]*)?\)") +bad = [] +for f in files: + txt = re.sub(r"```.*?```", "", open(f, errors="replace").read(), flags=re.S) + txt = re.sub(r"`[^`\n]+`", "", txt) + for m in link_re.finditer(txt): + rel = m.group(1) + target = os.path.normpath(os.path.join(os.path.dirname(f), rel)) + if not os.path.exists(target): + bad.append(f"{f} -> {rel}") +print(f"broken_living_links={len(bad)}") +raise SystemExit(1 if bad else 0) +' +``` +Exit: `0` +Verdict: PASS +Output: +```text +SUMMARY 52 docs 987 refs checked 0 dead +broken_living_links=0 +``` + +### 3. Figures, kit contract, registry verbs, and meta suites + +Command: +```bash +bash tests/test-doc-figures.sh +``` +Exit: `0` +Output: +```text + PASS check passes straight after an SVG render + PASS front matter fz: 1.5 scales the SVG to 1.5 times its viewBox + PASS the --fz flag wins over the front matter + PASS front matter fz scales the PNG too (2344 px for a 780-unit drawing) + +doc-figures: 54 passed, 0 failed (54 checks) +``` + +Command: +```bash +bash tests/test-kit-contract.sh +``` +Exit: `0` +Output: +```text + DEBT 8 known doc gaps (see tests/kit-contract-known-gaps.txt) + DEBT 1 known test gaps (see tests/kit-contract-known-gaps.txt) +=== kit-contract: 33 passed, 0 failed === +``` + +Command: +```bash +bash tests/test-meta-vmodel-dispatch.sh +``` +Exit: `0` +Output: +```text + PASS precedent lookup wired into intake (SPEC-068) + PASS retro follow-ups wired: escalation + advisory + grill + colors + detectors (SPEC-069) + +=== Results === +Passed: 75 / 75 +All meta tests passed. +``` + +Command: +```bash +bash tests/test-meta.sh +``` +Exit: `0` +Verdict: PASS +Output: +```text +=== Results === +Passed: 25 / 25 +All hard-claim tests passed. + +=== Results === +Passed: 945 / 945 +All meta tests passed. +``` + +Command: +```bash +bash tests/test-no-personal-paths.sh && bash tests/test-no-scattered-ids.sh && bash tests/test-registry-verbs.sh +``` +Exit: `0` +Output: +```text +Passed: 3 / 3 +All no-personal-paths tests passed. +test-no-scattered-ids: all 9 passed +PASS=11 FAIL=0 +``` + +### 4. Throwaway `HOME` install and throwaway repo adopt + +Command: +```bash +TMP="$(mktemp -d)" && trap 'rm -rf "$TMP"' EXIT && \ +env -u XDG_CONFIG_HOME -u XDG_STATE_HOME -u XDG_CACHE_HOME \ + -u KIT_DATA_ROOT -u KIT_CONFIG_OPERATOR -u CLAUDE_PLUGIN_ROOT \ + HOME="$TMP/home" CLAUDE_DIR="$TMP/home/.claude" \ + bash install.sh && \ +REPO="$TMP/consumer" && mkdir -p "$REPO" && git -C "$REPO" init -q && \ +git -C "$REPO" config user.email "test@example.com" && git -C "$REPO" config user.name "Test" && \ +printf '# Demo\n' > "$REPO/README.md" && git -C "$REPO" add README.md && git -C "$REPO" commit -qm "chore: init" && \ +KIT_BIN="$TMP/home/.claude/dwarves-kit" && \ +env -u XDG_CONFIG_HOME -u XDG_STATE_HOME -u XDG_CACHE_HOME \ + -u KIT_DATA_ROOT -u KIT_CONFIG_OPERATOR -u CLAUDE_PLUGIN_ROOT \ + HOME="$TMP/home" CLAUDE_DIR="$TMP/home/.claude" \ + bash "$KIT_BIN/lib/adopt.sh" "$REPO" && \ +env -u XDG_CONFIG_HOME -u XDG_STATE_HOME -u XDG_CACHE_HOME \ + -u KIT_DATA_ROOT -u KIT_CONFIG_OPERATOR -u CLAUDE_PLUGIN_ROOT \ + HOME="$TMP/home" CLAUDE_DIR="$TMP/home/.claude" \ + bash "$KIT_BIN/lib/adopt.sh" --check "$REPO" && \ +env -u XDG_CONFIG_HOME -u XDG_STATE_HOME -u XDG_CACHE_HOME \ + -u KIT_DATA_ROOT -u KIT_CONFIG_OPERATOR -u CLAUDE_PLUGIN_ROOT \ + HOME="$TMP/home" CLAUDE_DIR="$TMP/home/.claude" \ + bash install.sh --uninstall +``` +Exit: `0` +Verdict: PASS +Output: +```text +install_exit=0 +installed_kb=8728 +has_settings_json=yes +skills_count=14 +has_board_shim=yes +deleted_playbooks_absent=yes +adopt_exit=0 +repo_has_settings=yes +adopt_check_exit=0 +adopt_second_exit=0 +uninstall_exit=0 +dangling_links=0 +``` + +Command: +```bash +bash tests/test-adopt.sh +``` +Exit: `0` +Verdict: PASS +Output: +```text +PASS=88 FAIL=0 +``` + +## Negative controls + +### NC-1. Stale `origin/master` `FEATURES.md` fails registry freshness check + +Command: +```bash +TMP="$(mktemp -d)" && trap 'rm -rf "$TMP"' EXIT && \ +git show origin/master:docs/reference/FEATURES.md > "$TMP/FEATURES.before.md" && \ +bash lib/registry/feature-registry.sh check "$TMP/FEATURES.before.md" +``` +Exit: `1` +Verdict: RED +Output: +```text +feature-registry: .../FEATURES.before.md has DRIFTED; regenerate with 'feature-registry.sh check --fix' +``` + +### NC-2. Broken reference to removed `docs/HISTORY.md` is caught by `refcheck.sh` + +Command: +```bash +TMP="$(mktemp -d)" && trap 'rm -rf "$TMP"' EXIT && \ +git -C "$TMP" init -q && \ +printf '# Test\nSee `docs/HISTORY.md`.\n' > "$TMP/README.md" && \ +mkdir -p "$TMP/docs" && printf '# Docs\n' > "$TMP/docs/README.md" && \ +git -C "$TMP" add README.md docs/README.md && \ +bash lib/docdrift/refcheck.sh scan --repo "$TMP" +``` +Exit: `0` (scanner reports dead refs on stdout) +Verdict: RED +Output: +```text +README.md 2 tick docs/HISTORY.md +SUMMARY 2 docs 1 refs checked 1 dead +``` + +## Final verification (post-review fix round) + +Command: +```bash +bash tests/test-kri-wiring.sh && bash lib/registry/feature-registry.sh check docs/reference/FEATURES.md +``` +Exit: `0` +Verdict: PASS +Output: +```text +=== 31/31 passed === +feature-registry: docs/reference/FEATURES.md is fresh +``` + +## Rollback + +Revert the single `chore/repo-outline` commit with `git revert <sha>` to restore all folded/deleted files and prior doc layout cleanly; no external state, hook, installer, or tag was mutated by this branch. diff --git a/lib/adopt/agents-known.sha256 b/lib/adopt/agents-known.sha256 index c9ad1bea3..2b70b5727 100644 --- a/lib/adopt/agents-known.sha256 +++ b/lib/adopt/agents-known.sha256 @@ -1,12 +1,14 @@ 02f5a71dd298daa358716bd3760fbe82ac7b78e5cc224f14a631ab8e2532281d agents:71bf692da769 0730cda472fbae6b0350654430df19296055794b257d387b1d3fb06a6c093f41 agents:1b449c068821 0b8b15e85dc1f7d803a2e144f0ec6a84c4196a07e46ad3429cad0b307d3ddf58 agents:27c9182e565d -1568740a2ff3836a85005276137f58574c490afaf33a8fdbb7257f4492197045 agents:9e1baf124945 +1568740a2ff3836a85005276137f58574c490afaf33a8fdbb7257f4492197045 agents:ff1a5d05be3c 15744d73916c58bbd58793b196730f74bb00e7e82c7bf1f97fbc0be932d250e8 agents:d493a65dd94a 15838f17a3f2ce149429171f8c2e573adb8249d28f9caf62a8e9fed7a676b50d agents:8475acef6dac +2407f60bd1aa3d8cf25f0138b4f529348bc851e06766ff4d65866c96b7e0b8eb agents:23088a9e31d7 24a985738dfaf2a4491a2b00e68693ea2879d6bddae6a727efe67c8f737cfcd5 agents:190f75042a08 2798922c9023e33869b9454b39f1fc0fbb7351c7f64673613fb71bd2aea7076c agents:8c29019644dc 2d4220889441256b8713200ae1c3ec54fe9b42ce86f7540a7e4cdf949c98ad8a agents:7d3c12fad6f6 +30e0ba4e87de3f8fbee5a9cc8e912353a29d4ae7692dade1e7bb71d3c3f34e8a agents:eec27c2b17f3 41fba1ebf7648ba39075b2a1481c62efad85afab3bfc5dd3cfead020d1d1cda0 agents:e2d9133927bc 4225a23898ef9d5fd6428a4b678011efa6ee19629dfd4f21eff193ac47850ca5 pointer:549c2e181288 445eeb95f194a628611519dee153d32b4aa4ff0c71c422ab0cdabb0542f8dcaa agents:9d37a2d17db3 @@ -23,7 +25,6 @@ 9107c375edbd2386a99ede39aa1a86a246a0adfe66014bd55e73374339ea79d7 agents:d9190b246c38 a342a4d33112b3032aa05e6bb5c348787b04c4cd2fba6b92ce74a39bc7d730c0 agents:dc1ae28d8294 ae44306253c4d4ff8a87f1db26a7a41dea123cfcd72ad155f75a38b4631a0bfd agents:0b502cfbc3d0 -ba0e68b6ad6afacd5405597edf45a1b760a5c71ffb55efe9ce7515232a01990a agents:6d0a29413bb8 bd0fb2fafef5f5d6417d49281e6830f39c76cde4e09b8abdcc246e8e1e0cd1ce agents:15e72e33b76c bddfff9cf39e9c35f5c810a2f0e94f0c3486297831acd6dea285897b68a4ea84 agents:b7374e3504bc c12621bf93061520276f5e0891a0e91066f342569b69711b52c502329fb56591 agents:604b0ea38de3 diff --git a/lib/board/README.md b/lib/board/README.md index 45c614091..ff8cab887 100644 --- a/lib/board/README.md +++ b/lib/board/README.md @@ -23,7 +23,7 @@ The cockpit board: a kanban over each repo's `_meta/BACKLOG.md`. The markdown fi **State check** -`board state-check` is a generic engine: the kit holds no registry, a consumer repo keeps its own TOML file and calls the engine. It never touches the board's own `states.tsv` (the board stays permissive by design, see `docs/briefs/DECISION-BRIEF-declared-state-machines.md`); a repo opts in by writing a registry and wiring the call. +`board state-check` is a generic engine: the kit holds no registry, a consumer repo keeps its own TOML file and calls the engine. It never touches the board's own `states.tsv` (the board stays permissive by design, see `docs/specs/SPEC-417-declared-board-states.md` and `de38da2f:docs/briefs/DECISION-BRIEF-declared-state-machines.md`); a repo opts in by writing a registry and wiring the call. ```bash bin/board state-check --all [--strict] # report every checked machine; --strict exits 1 on undeclared values or drift diff --git a/lib/board/states.tsv b/lib/board/states.tsv index aa4dd58a7..c43af2534 100644 --- a/lib/board/states.tsv +++ b/lib/board/states.tsv @@ -1,4 +1,4 @@ -# Board row status: the one declaration of the machine (docs/briefs/DECISION-BRIEF-declared-state-machines.md). +# Board row status: the one declaration of the machine (docs/specs/SPEC-417-declared-board-states.md; archive de38da2f:docs/briefs/DECISION-BRIEF-declared-state-machines.md). # Every reader derives its state set from this file: backlog.sh (`states`, `machine`), board-writeback.sh, # lib/sync/sync_core.py (and the sync sources through it), lib/sync/sweep/board-health. # tests/test-board-states.sh fails when a script hardcodes the vocabulary again. diff --git a/lib/loop/README.md b/lib/loop/README.md index 81c757a7e..f08230c79 100644 --- a/lib/loop/README.md +++ b/lib/loop/README.md @@ -10,4 +10,4 @@ Position of a bounded loop, derived from the record the loop already writes. No **Callers**: `lib/gauntlet/stats.sh` (marker grammar), and the round loops in `commands/gauntlet.md`, `commands/test-plan-review-team.md`, `commands/ui-design.md`, `commands/verify.md`. -**Tests**: `bash tests/test-ql-verdict.sh`. **Design**: `docs/briefs/DECISION-BRIEF-loop-resume.md`. +**Tests**: `bash tests/test-ql-verdict.sh`. **Design**: `de38da2f:docs/briefs/DECISION-BRIEF-loop-resume.md`. diff --git a/lib/proof-capture/SPEC.md b/lib/proof-capture/SPEC.md index 2ff33ea05..32db286ab 100644 --- a/lib/proof-capture/SPEC.md +++ b/lib/proof-capture/SPEC.md @@ -1,6 +1,6 @@ # proof-capture: interface and invariants -One page. The build story, the options that were rejected and the validation record are in `docs/specs/SPEC-427-visual-proof-module.md` (and its brief, `docs/briefs/DECISION-BRIEF-visual-proof-module.md`). The full contract with the exact messages is in `README.md`. +One page. The build story, the options that were rejected and the validation record are in `docs/specs/SPEC-427-visual-proof-module.md` (archived brief: `de38da2f:docs/briefs/DECISION-BRIEF-visual-proof-module.md`). The full contract with the exact messages is in `README.md`. ## Interface diff --git a/lib/skill-curator/MANUAL.md b/lib/skill-curator/MANUAL.md deleted file mode 100644 index de4db36c5..000000000 --- a/lib/skill-curator/MANUAL.md +++ /dev/null @@ -1,128 +0,0 @@ -# skill-curator MANUAL - -Daily-use guide. What it is + the design: [README.md](./README.md) and -[docs/architecture.md](./docs/architecture.md). When something breaks: [RUNBOOK.md](./docs/RUNBOOK.md). - -| Task | Section | -|---|---| -| Install + verify | [1](#1-install-and-verify) | -| See what the loop staged | [2](#2-see-what-the-loop-staged) | -| Promote or reject a draft | [3](#3-promote-or-reject-a-draft) | -| Curate the skill library | [4](#4-curate-the-skill-library) | -| Tune cost + cadence | [5](#5-tune-cost-and-cadence) | -| Turn it off | [6](#6-turn-it-off) | - -## 1. Install and verify - -**What this does:** wires three hooks (async) into `~/.claude/settings.json` (skill-review on -PreCompact + SessionEnd, surfacing on SessionStart), backs the file up first, seeds the config. - -```bash -cd lib/skill-curator # from your consumer repo's dwarves-kit checkout -bash deploy/install.sh -../../bin/skill-improve status # should print state dir, 0 drafts, 0 spend -``` - -**Gotcha:** install is idempotent (re-run adds no duplicate entries) and aborts if `settings.json` -is not valid JSON, after backing it up to `settings.json.bak-<ts>`. The reviewer only fires on a -real session end / compaction, so `status` stays empty until you have finished a substantial session. - -## 2. See what the loop staged - -**What this does:** shows the staged drafts and the 7-day reviewer spend. - -```bash -bin/skill-improve status # staged-draft count + reviewer runs + loop spend (7d) -bin/skill-review list # one line per draft: <slug>\t<description> -``` - -`bin/skill-improve status` reads `~/.claude/skill-curator/ledger.jsonl`; `bin/skill-review list` reads -the proposals dir (`config data path state skill-proposals`). SessionStart also surfaces a one-line summary at the top of each new -session. - -**Gotcha:** the "staged memory" count in the SessionStart line comes from cc-harvest's ledger, not -this tool. If it reads 0 unexpectedly, see RUNBOOK incident 9 (the cc-harvest path coupling). - -## 3. Promote or reject a draft - -**What this does:** `skill-review` is the only writer of `~/.claude/skills/`. Promote moves a vetted -draft into the live library; reject sets it aside (recoverable). - -```bash -skill-review list # pick a slug -# read <proposals dir>/<slug>/SKILL.md and vet it against the skill-review quality bar -skill-review promote <slug> # mv into ~/.claude/skills/<slug>/ -skill-review promote <slug> --force # only if a live skill of that name already exists -skill-review reject <slug> # mv to skill-proposals/_rejected/<slug>/ (recoverable, not deleted) -``` - -Or run the `/skill-review` skill for the guided, vet-each-draft flow (it runs the quality-bar -checklist for you, then calls these commands). - -**Gotcha:** exit codes tell you why a promote refused: `2` no such draft, `3` the draft still -contains a secret-shaped string (scrub it), `4` a live skill exists (re-run with `--force`, which -backs the old one up to `_replaced/` first), `5` a move/mkdir failure. Never `--force` without -reading the live skill you are about to replace. - -## 4. Curate the skill library - -**What this does:** consolidates narrow skills into umbrellas and archives stale/superseded ones. -Propose-only by default; nothing changes without `--apply`. Never deletes. - -```bash -bin/skill-improve curate # writes a report; changes NOTHING. Read the report it prints the path to. -bin/skill-improve curate --apply # execute the proposed archives: git mv to skills/_archive/ -bin/skill-improve restore <name> # bring an archived skill back -``` - -You can schedule a weekly report-only run of `bin/skill-improve curate` via launchd or cron, then read its report and run `--apply` by hand; see [deploy/macos/README.md](../../deploy/macos/README.md) for the kit's LaunchAgent pattern. - -**Gotcha:** the curator NEVER archives a skill whose frontmatter has `pinned: true` (or -`cc-si-protected: true`), even if its plan names it. Pin anything you never want consolidated. Unlike -the reviewer, `curate` does not log a cost row to the ledger, so its spend is not in the 7-day line. - -## 5. Tune cost and cadence - -**What this does:** config lives at `~/.claude/skill-curator/config.toml` (copy of -`config/config.example.toml`). Every key is also overridable by a `SKILL_CURATOR_<KEY>` env var, and **env -wins** over the file. Tests use the env path; you will normally edit the file. - -| Key / env | Default | Effect | -|---|---|---| -| `enabled` / `SKILL_CURATOR_ENABLED` | `true` | master switch for the skill-review hook + surfacing | -| `model` / `SKILL_CURATOR_MODEL` | `haiku` | reviewer model (`claude -p --model`) | -| `curator_model` / `SKILL_CURATOR_CURATOR_MODEL` | (= `model`) | curator model | -| `max_turns` / `SKILL_CURATOR_MAX_TURNS` | `2` | `claude -p --max-turns` for both calls | -| `transcript_k` / `SKILL_CURATOR_TRANSCRIPT_K` | `40` | last-K turns fed to the reviewer (smaller = cheaper) | -| `auto_promote` / `SKILL_CURATOR_AUTO_PROMOTE` | `false` | enable `skill-review auto` (references-add to an existing umbrella only) | -| `signal_gate` / `SKILL_CURATOR_SIGNAL_GATE` | `true` | skip the model call for a summary with zero signal markers (default-on cost gate; set `false` to opt out; ADR-0010) | -| `signal_markers` / `SKILL_CURATOR_SIGNAL_MARKERS` | (built-in regex) | override the marker pattern the gate matches on | -| `SKILL_CURATOR_STATE_DIR` | `~/.claude/skill-curator` | ledger + lock + config + reports | -| `SKILL_CURATOR_PROPOSALS_DIR` | `config data path state skill-proposals` | the staging gate | -| `SKILL_CURATOR_SKILLS_DIR` | `~/.claude/skills` | the live library + `_archive/` | -| `SKILL_CURATOR_MEMORY_LEDGER` | (unset; required) | the harvest ledger the surface line counts | -| `SKILL_CURATOR_SETTINGS` | `~/.claude/settings.json` | install/uninstall target (point elsewhere for a dry run) | -| `SKILL_CURATOR_REVIEWER_CMD` / `SKILL_CURATOR_CURATOR_CMD` | (unset) | test seam: replace the `claude -p` call with a mock | - -To spend less: raise `transcript_k` only if drafts are missing context (smaller is cheaper), keep -`model = haiku`, or set `enabled = false`. The per-session trigger + single-flight lock already bound -cost to roughly one Haiku call per substantial session. `signal_gate` is on by default: it skips the -model entirely on sessions with no signal markers (skips are ledgered as `skip-no-signal` so you can -audit what it dropped; set `signal_gate = false` to review every session , see ADR-0010). - -**Gotcha:** the reviewer always runs `--allowedTools ""` (the model can write nothing); that is not -configurable by design. - -## 6. Turn it off - -```bash -bash deploy/uninstall.sh # removes ONLY this tool's hook entries from settings.json -# or, leave it installed but inert: -# set enabled = false in ~/.claude/skill-curator/config.toml -``` - -`uninstall.sh` backs up `settings.json` first and removes only entries whose command path matches -`skill-curator` (your other hooks survive). It leaves the ledger and any staged drafts in place, -those are yours, not the installer's, to delete. - -**Gotcha:** uninstall does not remove any separate weekly curator LaunchAgent or cron job you configured yourself. Unload that scheduled job directly if you installed one. diff --git a/lib/skill-curator/README.md b/lib/skill-curator/README.md index 710ed0f24..1b5d71362 100644 --- a/lib/skill-curator/README.md +++ b/lib/skill-curator/README.md @@ -9,7 +9,7 @@ read-only, propose-and-stage, background, non-blocking. Master spec: `docs/specs/SPEC-103-cc-self-improve.md` (VALIDATED, historical, written under the tool's original name). Suite parity was asserted at the originating cc-elevation-r4 mega-goal. -> Daily use: [MANUAL.md](./MANUAL.md). Diagrams + trust boundary: [docs/architecture.md](./docs/architecture.md). +> Diagrams + trust boundary: [docs/architecture.md](./docs/architecture.md). > Incident recovery: [RUNBOOK.md](./docs/RUNBOOK.md). Doc index: [SPEC.md](./SPEC.md). Why it is built this > way: [docs/decisions/](./docs/decisions/). Proof: [docs/proof-of-done.md](./docs/proof-of-done.md). @@ -64,16 +64,26 @@ re-run (no duplicate entries). `deploy/uninstall.sh` removes only this tool's en staged drafts are kept). Tune via the config; `SKILL_CURATOR_SETTINGS` lets you target a non-default settings.json. -After a session stages drafts, review them: +After a session stages drafts, inspect status and review them: ```bash -skill-review list # what the loop proposed -skill-review promote <slug> # vet (writing-skills) then move into ~/.claude/skills/ -skill-review reject <slug> # move to _rejected/ (recoverable) +bin/skill-improve status # staged-draft count + reviewer runs + 7-day loop spend +bin/skill-review list # one line per draft: <slug>\t<description> +bin/skill-review promote <slug> # vet (writing-skills) then move into ~/.claude/skills/<slug>/ +bin/skill-review promote <slug> --force # replace an existing live skill (backs old copy to _replaced/) +bin/skill-review reject <slug> # move to skill-proposals/_rejected/<slug>/ (recoverable) ``` Or run `/skill-review` (the skill) for the guided, vet-each-draft flow. +Promote exit codes: `2` no such draft, `3` secret-shaped string found (scrub it first), `4` live skill already exists (re-run with `--force` after reading the live skill), `5` move/mkdir failure. + +**Gotchas:** +- `deploy/install.sh` aborts if `settings.json` is invalid JSON, after backing it up to `settings.json.bak-<ts>`. The reviewer only fires on a real session end or compaction, so `status` stays empty until a substantial session finishes. +- The "staged memory" count in the SessionStart summary comes from cc-harvest's ledger, not this tool (see `docs/RUNBOOK.md` incident 9 if it reads 0 unexpectedly). +- `bin/skill-improve curate` never archives a skill whose frontmatter sets `pinned: true` or `cc-si-protected: true`, and `curate` does not log a cost row to the 7-day ledger line. +- `deploy/uninstall.sh` removes only entries matching `skill-curator` from `settings.json` and leaves the ledger, staged drafts, and any scheduled cron/LaunchAgent job intact. To leave it installed but inert, set `enabled = false` in `~/.claude/skill-curator/config.toml`. + Periodically consolidate the library (propose-only; nothing changes without `--apply`): ```bash @@ -86,21 +96,26 @@ A weekly report-only curator job can be scheduled via cron or launchd; see [depl ## Knobs -Config: `~/.claude/skill-curator/config.toml` (copy `config/config.example.toml`). Every key is -also overridable by `SKILL_CURATOR_<KEY>` (env wins; tests use this). - -- `enabled` (default on), `model` (default `haiku`), `max_turns` (2), `transcript_k` (40). -- Paths: `SKILL_CURATOR_STATE_DIR` (`~/.claude/skill-curator`), `SKILL_CURATOR_PROPOSALS_DIR` - (`config data path state skill-proposals`), `SKILL_CURATOR_SKILLS_DIR` (`~/.claude/skills`). -- Cost: every reviewer run appends `total_cost_usd` to `ledger.jsonl`; `bin/skill-improve status` shows - 7-day loop spend and the staged-draft count. Dial back by raising `transcript_k` cost via a bigger - `model` only if needed, or disable via `enabled = false`. - -- `auto_promote` (default OFF): closer Hermes parity; auto-passes only the lowest-risk class (a - `references/` add to an existing umbrella) via `skill-review auto`. Everything else stays manual. -- `signal_gate` (default ON; set `false` to opt out): a deterministic pre-gate that skips the reviewer model call for a - session summary with zero signal markers, preserving quota. Broad, keep-biased pattern - (overridable via `signal_markers`); skips are ledgered as `skip-no-signal` for audit. See ADR-0010. +Config lives at `~/.claude/skill-curator/config.toml` (copy of `config/config.example.toml`). Every key is also overridable by a `SKILL_CURATOR_<KEY>` env var, and **env wins** over the file (tests use the env path). + +| Key / env | Default | Effect | +|---|---|---| +| `enabled` / `SKILL_CURATOR_ENABLED` | `true` | master switch for the skill-review hook + surfacing | +| `model` / `SKILL_CURATOR_MODEL` | `haiku` | reviewer model (`claude -p --model`) | +| `curator_model` / `SKILL_CURATOR_CURATOR_MODEL` | (`= model`) | curator model | +| `max_turns` / `SKILL_CURATOR_MAX_TURNS` | `2` | `claude -p --max-turns` for both calls | +| `transcript_k` / `SKILL_CURATOR_TRANSCRIPT_K` | `40` | last-K turns fed to the reviewer (smaller = cheaper) | +| `auto_promote` / `SKILL_CURATOR_AUTO_PROMOTE` | `false` | enable `skill-review auto` (`references/` add to an existing umbrella only) | +| `signal_gate` / `SKILL_CURATOR_SIGNAL_GATE` | `true` | skip the model call for a summary with zero signal markers (`skip-no-signal` in ledger; ADR-0010) | +| `signal_markers` / `SKILL_CURATOR_SIGNAL_MARKERS` | (built-in regex) | override the marker pattern the gate matches on | +| `SKILL_CURATOR_STATE_DIR` | `~/.claude/skill-curator` | ledger + lock + config + reports | +| `SKILL_CURATOR_PROPOSALS_DIR` | `config data path state skill-proposals` | the staging gate | +| `SKILL_CURATOR_SKILLS_DIR` | `~/.claude/skills` | the live library + `_archive/` | +| `SKILL_CURATOR_MEMORY_LEDGER` | (unset; required) | the harvest ledger the surface line counts | +| `SKILL_CURATOR_SETTINGS` | `~/.claude/settings.json` | install/uninstall target (point elsewhere for a dry run) | +| `SKILL_CURATOR_REVIEWER_CMD` / `SKILL_CURATOR_CURATOR_CMD` | (unset) | test seam: replace the `claude -p` call with a mock | + +Every reviewer run appends `total_cost_usd` to `ledger.jsonl`. The reviewer always runs `--allowedTools ""` (no model filesystem write); that is not configurable by design. ## Test diff --git a/lib/skill-curator/SPEC.md b/lib/skill-curator/SPEC.md index 13bef3e31..c8fc62571 100644 --- a/lib/skill-curator/SPEC.md +++ b/lib/skill-curator/SPEC.md @@ -7,8 +7,7 @@ behaviour contract lives in `docs/specs/`, the why in `docs/decisions/`. | Doc | Purpose | |---|---| -| [README.md](./README.md) | What it is + install + quick reference | -| [MANUAL.md](./MANUAL.md) | Daily-use guide (CLI surfaces, config knobs, operator flow) | +| [README.md](./README.md) | What it is, daily use, CLI surfaces, config knobs, and install | | [RUNBOOK.md](./docs/RUNBOOK.md) | Incident triage (cost, runaway, stuck lock, settings.json, promote refusals, curator) | | [docs/architecture.md](./docs/architecture.md) | Topology, trust boundary, data flow, component + state map | | [docs/specs/SPEC-103-cc-self-improve.md](./docs/specs/SPEC-103-cc-self-improve.md) | The umbrella behaviour contract (Phases A/B/C, DEC-001..008) | diff --git a/lib/skill-curator/docs/RUNBOOK.md b/lib/skill-curator/docs/RUNBOOK.md index 9fd764cc1..11a6bdbe8 100644 --- a/lib/skill-curator/docs/RUNBOOK.md +++ b/lib/skill-curator/docs/RUNBOOK.md @@ -1,6 +1,6 @@ # skill-curator RUNBOOK -Operator-mid-incident guide. Symptom, diagnosis, fix. For daily use see [MANUAL.md](../MANUAL.md); +Operator-mid-incident guide. Symptom, diagnosis, fix. For daily use see [README.md](../README.md); for the design see [architecture.md](./architecture.md). The standing safety net: every reviewer/curate path **logs and exits 0** on any failure (a diff --git a/lib/skill-curator/lib/surface.sh b/lib/skill-curator/lib/surface.sh index 2267acbda..edb806d99 100755 --- a/lib/skill-curator/lib/surface.sh +++ b/lib/skill-curator/lib/surface.sh @@ -18,7 +18,7 @@ SKILL_CURATOR_MEMORY_LEDGER="$(_expand "${SKILL_CURATOR_MEMORY_LEDGER:-}")" # both read as a plain 0 with no way to tell them apart). memory_ledger_count() { if [ -z "$SKILL_CURATOR_MEMORY_LEDGER" ]; then - echo "skill-curator: SKILL_CURATOR_MEMORY_LEDGER is not set -- set it to your knowledge/learning ledger path to surface staged-memory counts (see MANUAL.md)" >&2 + echo "skill-curator: SKILL_CURATOR_MEMORY_LEDGER is not set -- set it to your knowledge/learning ledger path to surface staged-memory counts (see README.md)" >&2 return 1 fi if [ -f "$SKILL_CURATOR_MEMORY_LEDGER" ]; then diff --git a/lib/spec/spec-status.sh b/lib/spec/spec-status.sh index 46f8c9d1c..e94cb66d7 100755 --- a/lib/spec/spec-status.sh +++ b/lib/spec/spec-status.sh @@ -3,7 +3,7 @@ # # The machine is declared once, in states.tsv (state, class, next, aliases). Every reader of a spec's # status goes through here, so `**Status:**`, `status:` and `Status: VALIDATED (round 4 ...)` mean -# the same thing everywhere (docs/briefs/DECISION-BRIEF-declared-state-machines.md). +# the same thing everywhere (archive de38da2f:docs/briefs/DECISION-BRIEF-declared-state-machines.md). # # The one writer is `set`; every other script that changes a spec's status calls it, never sed. # diff --git a/lib/spec/states.tsv b/lib/spec/states.tsv index 8ca26df3f..fc6c12d83 100644 --- a/lib/spec/states.tsv +++ b/lib/spec/states.tsv @@ -1,4 +1,4 @@ -# Spec `Status:` header: the one declaration of the machine (docs/briefs/DECISION-BRIEF-declared-state-machines.md). +# Spec `Status:` header: the one declaration of the machine (docs/specs/SPEC-417-declared-board-states.md; archive de38da2f:docs/briefs/DECISION-BRIEF-declared-state-machines.md). # Every reader goes through lib/spec/spec-status.sh: hooks/context-readiness.sh, hooks/spec-drift-guard.sh, # hooks/pre-compact-backup.sh, hooks/post-compact-reinject.sh, lib/spec/spec-index.sh, lib/goal/goal-drafts.sh. # tests/test-spec-states.sh fails when a script hardcodes the vocabulary again. diff --git a/tests/kit-contract-known-gaps.txt b/tests/kit-contract-known-gaps.txt index 4fbd9b520..3e92d2d11 100644 --- a/tests/kit-contract-known-gaps.txt +++ b/tests/kit-contract-known-gaps.txt @@ -37,16 +37,11 @@ lib/reflect/SPEC # worktree-provision: has README + SPEC; its proof lives at repo docs/verification/ (the fold PR). lib/worktree-provision/docs/proof-of-done.md -# cosmetic: its assertions live inside the shared tests/test-hooks.sh, which C4 cannot see. -lib/cosmetic/tests - -# board: SPEC-147/149 live at repo docs/specs/; the module has no front door or proof of its own. -lib/board/README.md +# board: SPEC-147/149 live at repo docs/specs/; has README.md now, still missing module-local SPEC and proof. lib/board/SPEC lib/board/docs/proof-of-done.md -# queue: SPEC-148 lives at repo docs/specs/; its tests are repo-root tests/test-queue.sh (C4 ok). -lib/queue/README.md +# queue: SPEC-148 lives at repo docs/specs/; has README.md now, tests are repo-root tests/test-queue.sh (C4 ok). lib/queue/SPEC lib/queue/docs/proof-of-done.md diff --git a/tests/proof-loop-09-scenario-b.sh b/tests/proof-loop-09-scenario-b.sh deleted file mode 100644 index d6e4d9a13..000000000 --- a/tests/proof-loop-09-scenario-b.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash -# proof-loop-09-scenario-b.sh -- SPEC-199 rung-3 re-execution harness (NOT a CI suite; the -# `proof-` prefix keeps it out of the test-* conventions on purpose). -# -# RE-EXECUTES scenario (b) of history/2026-10-27:docs/verification/loop-09-onboard-wizard/b-bash-unadopted-repo.md LIVE: -# builds the same temp-HOME fixture (bash-install machine + fresh unadopted repo), runs the exact -# command sequence /kit:onboard drives, and ASSERTS the outputs the committed transcript claims. -# Also re-executes the decline-NC (decline-nc.md): the pre-adopt reads leave the repo -# byte-identical. A fresh-context recheck-verifier runs this file to re-judge the transcript -# against reality instead of reading it back (the kit-foldin rung-3 precedent for interactive -# surfaces: a hand-crafted transcript is this mega's most fake-able artifact). -# -# Run: bash tests/proof-loop-09-scenario-b.sh (exit 0 = every transcript claim reproduced) -set -uo pipefail -KIT_DIR="$(cd "$(dirname "$0")/.." && pwd)" - -PASS=0; FAIL=0; TOTAL=0 -RED='\033[0;31m'; GREEN='\033[0;32m'; NC='\033[0m' -assert_eq() { TOTAL=$((TOTAL+1)); if [ "$2" = "$3" ]; then echo -e " ${GREEN}PASS${NC} $1"; PASS=$((PASS+1)); else echo -e " ${RED}FAIL${NC} $1 (expected '$3', got '$2')"; FAIL=$((FAIL+1)); fi; } -assert_contains() { TOTAL=$((TOTAL+1)); if { trap '' PIPE; printf '%s' "$2" 2>/dev/null || :; } | grep -qF "$3"; then echo -e " ${GREEN}PASS${NC} $1"; PASS=$((PASS+1)); else echo -e " ${RED}FAIL${NC} $1 (missing '$3')"; FAIL=$((FAIL+1)); fi; } - -ROOT="$(mktemp -d "${TMPDIR:-/tmp}/sp199-recheck.XXXXXX")" || exit 1 -trap 'rm -rf "$ROOT"' EXIT - -# --- the scenario-(b) fixture: bash-install machine + fresh unadopted repo ------------------- -CD_BASH="$ROOT/home/.claude"; mkdir -p "$CD_BASH/dwarves-kit" -cat > "$CD_BASH/settings.json" <<'EOF' -{ "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "$HOME/.claude/dwarves-kit/hooks/safety-gate.sh" } ] } ] } } -EOF -REPO="$ROOT/repo-b"; mkdir -p "$REPO" -git -C "$REPO" init -q -git -C "$REPO" config user.email t@t; git -C "$REPO" config user.name t -printf '# demo project\n' > "$REPO/README.md"; printf '{"name":"demo"}\n' > "$REPO/package.json" -git -C "$REPO" add -A; git -C "$REPO" commit -qm init - -CFG() { env -u PROSE_RAG_INJECT -u MONEY_GATE_REPOS KIT_CONFIG_ROOT="$KIT_DIR" KIT_PROJECT_ROOT="$REPO" bash "$KIT_DIR/bin/config" "$@"; } - -echo "=== Transcript claim 1: detect -> bash ===" -MODE="$(CLAUDE_DIR="$CD_BASH" bash "$KIT_DIR/lib/onboard-detect.sh" mode)" -assert_eq "onboard-detect on the bash fixture reads 'bash'" "$MODE" "bash" - -echo "" -echo "=== Transcript claim 2: adopt --check -> not adopted ===" -CHECK_OUT="$(bash "$KIT_DIR/lib/adopt.sh" --check "$REPO" 2>&1)"; CHECK_RC=$? -assert_eq "--check exits 1 (not adopted)" "$CHECK_RC" "1" -assert_contains "--check says 'not adopted'" "$CHECK_OUT" "not adopted" - -echo "" -echo "=== Transcript claim 3: the --dry-run preview names the 4 contract files + .kit.toml seed, writes nothing ===" -DRY_OUT="$(bash "$KIT_DIR/lib/adopt.sh" --dry-run "$REPO" 2>&1)" -for claim in "would create AGENTS.md" "would write WORKFLOW.md pointer" "would append the CLAUDE.md" "would create docs/verification/README.md" "would seed a starter .kit.toml"; do - assert_contains "dry-run previews: $claim" "$DRY_OUT" "$claim" -done -assert_eq "dry-run wrote no .kit.toml" "$([ -f "$REPO/.kit.toml" ] && echo yes || echo no)" "no" - -echo "" -echo "=== Decline-NC re-execution: after detect + check + dry-run (all a declining user sees), tree is byte-identical ===" -PORC="$(cd "$REPO" && git status --porcelain | wc -l | tr -d ' ')" -assert_eq "porcelain is 0 lines after the read-only steps (decline = no-op)" "$PORC" "0" - -echo "" -echo "=== Transcript claim 4: module roster is generated from the registry (12 modules.* rows) ===" -ROSTER="$(CFG list | grep -c '^modules\.')" -assert_eq "config list yields 12 modules.* rows" "$ROSTER" "12" - -echo "" -echo "=== Transcript claim 5: ONE adopt --with call seeds the toggled module (bridge=true) ===" -ADOPT_OUT="$(bash "$KIT_DIR/lib/adopt.sh" --with "board,session,advisor,queue,stats,bridge" "$REPO" 2>&1)" -assert_contains "adopt reports the repo updated" "$ADOPT_OUT" "(updated)" -assert_eq ".kit.toml now exists" "$([ -f "$REPO/.kit.toml" ] && echo yes || echo no)" "yes" -BRIDGE_LINE="$(grep -E '^bridge *= *' "$REPO/.kit.toml" | tr -d ' ')" -assert_eq ".kit.toml seeds bridge = true (the --with bridge worked)" "$BRIDGE_LINE" "bridge=true" -COSMETIC_LINE="$(grep -E '^cosmetic *= *' "$REPO/.kit.toml" | tr -d ' ')" -assert_eq ".kit.toml keeps cosmetic = false (unpicked module stays off)" "$COSMETIC_LINE" "cosmetic=false" - -echo "" -echo "=== Transcript claim 6: the honest caveat is real -- --with can NOT seed prose_rag (adopt.sh's stale set) ===" -grep -qE '^prose_rag *= *' "$REPO/.kit.toml" && HAS_PR=yes || HAS_PR=no -assert_eq "prose_rag is absent from the seeded .kit.toml (the wizard's hand-edit disclosure is honest)" "$HAS_PR" "no" - -echo "" -echo "=== Transcript claim 7: the consumer knob comes from the registry, and is honestly inert by default ===" -KNOB_ROW="$(CFG list | awk '$NF=="prose_rag" && $1=="PROSE_RAG_INJECT"')" -assert_contains "PROSE_RAG_INJECT row exists with MODULE=prose_rag" "$KNOB_ROW" "PROSE_RAG_INJECT" -EXPL="$(CFG explain PROSE_RAG_INJECT)" -assert_contains "explain shows env-only (no kit.toml backing)" "$EXPL" "no kit.toml backing" -assert_contains "explain shows the inert default" "$EXPL" "unset (hook inert)" - -echo "" -echo "=== Results ===" -echo -e "Passed: ${GREEN}${PASS}${NC} / ${TOTAL}" -if [ "$FAIL" -gt 0 ]; then - echo -e "Failed: ${RED}${FAIL}${NC}" - exit 1 -else - echo -e "${GREEN}Scenario (b) re-executed live: every transcript claim reproduced.${NC}" - exit 0 -fi diff --git a/tests/run-workflow.sh b/tests/run-workflow.sh deleted file mode 100755 index 79bc06d6f..000000000 --- a/tests/run-workflow.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# run-workflow.sh -- run every `run: bash tests/...` step of .github/workflows/test.yml locally, -# in the workflow's order, and print only the red ones. The 2026-09-05 repair of that workflow -# (three weeks hand-disabled, seven suites red) scripted this loop four times before it lived -# here; the battery verifier is its other caller. Exit 1 when any step is red, 0 when clean. -# -# bash tests/run-workflow.sh # failures only, then a one-line summary -# bash tests/run-workflow.sh -v # every step with its exit code -# bash tests/run-workflow.sh -j 4 # four suites at a time (they each build their own -# # temp dirs; measured 2026-09-06: macOS CI leg 417s -# # serial, the top four suites alone 226s of it) -# -# A few suites rewrite their sample docs under docs/verification as a side effect; any tracked -# file that was clean before the run and dirty after it is restored, so a local run leaves the -# tree as it found it. Nothing else is touched. -set -uo pipefail -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd "$HERE/.." || exit 1 -WF="${RUN_WORKFLOW_FILE:-.github/workflows/test.yml}" -verbose=0; jobs=1 -while [ $# -gt 0 ]; do - case "$1" in - -v) verbose=1 ;; - -j) jobs="${2:-4}"; shift ;; - *) echo "usage: run-workflow.sh [-v] [-j N]" >&2; exit 2 ;; - esac - shift -done - -before=$(git status --porcelain 2>/dev/null | awk '$1=="M"||$1==" M"{print $2}' | sort) -# one step: run it, print RED (or ok under -v) as a single block, leave a marker on failure -run_step() { - local cmd="$1" out rc - out=$($cmd 2>&1); rc=$? - if [ "$rc" -ne 0 ]; then - { echo "RED $cmd (rc=$rc)"; printf '%s\n' "$out" | grep -E 'FAIL|ORPHAN|offend|Error' | grep -v PASS | head -4 | sed 's/^/ /'; } - : > "$RW_MARKS/$(printf '%s' "$cmd" | tr -c 'A-Za-z0-9' '_')" - elif [ "$RW_VERBOSE" = 1 ]; then - echo "ok $cmd" - fi -} -export -f run_step -RW_MARKS=$(mktemp -d "${TMPDIR:-/tmp}/kit.XXXXXX") || exit 1; export RW_MARKS RW_VERBOSE="$verbose" -steps=$(grep -E '^\s+(- )?run: bash tests/' "$WF" | sed 's/.*run: //') -total=$(printf '%s\n' "$steps" | grep -c .) -# -P keeps the order of START only; each step's block prints whole, so red lines never interleave -printf '%s\n' "$steps" | xargs -P "$jobs" -I{} bash -c 'run_step "$1"' _ {} -red=$(ls "$RW_MARKS" | wc -l | tr -d ' ') -rm -rf "$RW_MARKS" - -# restore side-effect files: tracked, clean before, modified by the run -after=$(git status --porcelain 2>/dev/null | awk '$1=="M"||$1==" M"{print $2}' | sort) -touched=$(comm -13 <(printf '%s\n' "$before") <(printf '%s\n' "$after") | grep . || true) -if [ -n "$touched" ]; then - # shellcheck disable=SC2086 - git checkout -q -- $touched && echo "restored $(printf '%s\n' "$touched" | wc -l | tr -d ' ') side-effect file(s)" -fi - -echo "run-workflow: $red red of $total steps" -[ "$red" -eq 0 ] diff --git a/tests/test-board-states.sh b/tests/test-board-states.sh index 83d994409..ac0beb021 100755 --- a/tests/test-board-states.sh +++ b/tests/test-board-states.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # always: scans lib, hooks and bin for a hand-copied board vocabulary, so any diff can break it # The board row machine is declared once, in lib/board/states.tsv, and every reader derives -# from it (docs/briefs/DECISION-BRIEF-declared-state-machines.md). +# from it (de38da2f:docs/briefs/DECISION-BRIEF-declared-state-machines.md). # # Why this suite exists: the vocabulary used to be hand-copied into six files across bash and # Python with nothing checking they agreed. This suite pins the table's shape, proves every diff --git a/tests/test-doc-figures.sh b/tests/test-doc-figures.sh index ee8639d19..c46ad0f0b 100644 --- a/tests/test-doc-figures.sh +++ b/tests/test-doc-figures.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=SC2319 # chk reads the status of the [ ] test on the line before # test-doc-figures.sh -- lib/system-design/doc-figures keeps docs/figures honest: check passes on the # committed state, and fails on an edited sheet with no re-render, a missing PNG, a manifest entry # with no sheet, and a doc reference to an unknown figure id. Every mutation runs on a temp copy. @@ -45,10 +46,10 @@ echo "== committed state ==" chk "docs/figures holds MODEL.md and MANIFEST.tsv" "$?" OUT=$(bash "$DF" check 2>&1); RC=$? chk "check passes on the committed repo" "$RC" -[ "$(cut -f1 "$FIG/MANIFEST.tsv" | tr '\n' ' ')" = "adopt board-row debug execute gauntlet lanes loop push-gate review several-pieces v-model wrap " ] -chk "the manifest holds exactly the twelve agreed ids, sorted" "$?" +[ "$(cut -f1 "$FIG/MANIFEST.tsv" | tr '\n' ' ')" = "adopt debug execute gauntlet lanes loop push-gate review several-pieces v-model wrap " ] +chk "the manifest holds exactly the eleven agreed ids, sorted" "$?" n=0; for id in $(cut -f1 "$FIG/MANIFEST.tsv"); do [ -s "$FIG/$id.png" ] && n=$((n+1)); done -chk "every manifest id has a non-empty PNG" "$([ "$n" -eq 12 ]; echo $?)" +chk "every manifest id has a non-empty PNG" "$([ "$n" -eq 11 ]; echo $?)" echo "== a clean copy passes ==" R=$(fresh clean); run "$R" diff --git a/tests/test-meta-contract.sh b/tests/test-meta-contract.sh index 10137bbdd..3526f18c5 100755 --- a/tests/test-meta-contract.sh +++ b/tests/test-meta-contract.sh @@ -51,13 +51,17 @@ else fi # The enforcement-boundary statement (PHILOSOPHY honesty rule: never over-claim -# portable enforcement). Claude Code enforces everything, Codex only the five hard -# controls, any other runtime is advisory. A drift to "enforcement is portable" would be a lie. +# portable enforcement). Claude Code enforces everything; Codex, Antigravity (agy), +# and Devin route the 12 shared PreToolUse and Stop guards through hooks/anchor-root.sh --runtime +# (with explicit owner trust/registration); any other runtime is advisory. A drift to +# "enforcement is portable" would be a lie. TOTAL=$((TOTAL + 1)) if grep -qF '**Claude Code** enforces everything' "$AGENTS_MD" 2>/dev/null \ - && grep -qF 'five hard controls' "$AGENTS_MD" 2>/dev/null \ + && grep -qF 'hooks/anchor-root.sh --runtime' "$AGENTS_MD" 2>/dev/null \ + && grep -qF 'Codex, Antigravity' "$AGENTS_MD" 2>/dev/null \ + && grep -qF 'Devin' "$AGENTS_MD" 2>/dev/null \ && grep -qF 'advisory only' "$AGENTS_MD" 2>/dev/null; then - echo -e " ${GREEN}PASS${NC} AGENTS.md states the enforcement boundary (Claude Code all, Codex five hard controls, others advisory)" + echo -e " ${GREEN}PASS${NC} AGENTS.md states the enforcement boundary (Claude Code all, Codex/agy/Devin shared entry, others advisory)" PASS=$((PASS + 1)) else echo -e " ${RED}FAIL${NC} AGENTS.md lost the enforcement-boundary statement" diff --git a/tests/test-meta-vmodel-dispatch.sh b/tests/test-meta-vmodel-dispatch.sh index 0feac827e..f4bb506e8 100755 --- a/tests/test-meta-vmodel-dispatch.sh +++ b/tests/test-meta-vmodel-dispatch.sh @@ -149,6 +149,7 @@ assert_eq "architecture.md inventory table rows == live file count ($ARCH_TABLE_ # every addition and cost more to maintain than they informed; the operator retired them). # Completeness is still pinned below by the ROW checks, live tree vs table rows, both sides # computed, no hand-maintained number anywhere. +# shellcheck disable=SC2034 # retained hook-count helper in meta suite HOOK_COUNT=$(ls "$KIT_DIR/hooks/"*.sh 2>/dev/null | wc -l | tr -d ' ') # SG-10 (harness-loop): the roster inventories stay pinned to live counts , the agents table sat @@ -183,10 +184,10 @@ assert_eq "docs/reference/hooks.md names every hook file (missing:${HOOKS_MISSIN assert_eq "architecture.md carries no headline roster tally" "0" \ "$(grep -cE '^Total: [0-9]+ commands' "$KIT_DIR/docs/reference/architecture.md" | tr -d ' ')" -# The lifecycle reference five-stage table (moved out of the README) covers every module the registry assigns a +# The five-stage table (folded into docs/reference/workflow-paths.md) covers every module the registry assigns a # stage (ADR-0034 decision 3 rendered without omissions; the two tables share one truth). "leg" # renamed to "stage" by the 2026-07-18 amendment (ID-292). -FIVE_LEG_BLOCK=$(sed -n '/^## The five stages/,/^## /p' "$KIT_DIR/docs/reference/lifecycle.md") +FIVE_LEG_BLOCK=$(sed -n '/^## The five stages/,/^## /p' "$KIT_DIR/docs/reference/workflow-paths.md") REGISTRY_MODULES=$(sed -n '/^## Module stages/,/^## /p' "$KIT_DIR/lib/config/module-registry.md" \ | grep '^| ' | grep -v '^| Module\|^|---' | awk -F'|' '{gsub(/ /,"",$2); print $2}') TOTAL=$((TOTAL + 1)) diff --git a/tests/test-ql-verdict.sh b/tests/test-ql-verdict.sh index cc51ec700..816a84cec 100644 --- a/tests/test-ql-verdict.sh +++ b/tests/test-ql-verdict.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # lib/loop/ql-verdict.sh is the one parser for QL-VERDICT round markers, and `resume` derives a -# bounded loop's position from its own record (docs/briefs/DECISION-BRIEF-loop-resume.md). +# bounded loop's position from its own record (de38da2f:docs/briefs/DECISION-BRIEF-loop-resume.md). # # Run: bash tests/test-ql-verdict.sh (exit 0 = all green) set -uo pipefail diff --git a/tests/test-spec-states.sh b/tests/test-spec-states.sh index 15471dad5..040350d83 100755 --- a/tests/test-spec-states.sh +++ b/tests/test-spec-states.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # The spec `Status:` header is declared once, in lib/spec/states.tsv, and read once, by -# lib/spec/spec-status.sh (docs/briefs/DECISION-BRIEF-declared-state-machines.md). +# lib/spec/spec-status.sh (de38da2f:docs/briefs/DECISION-BRIEF-declared-state-machines.md). # # Why this suite exists: six readers (context-readiness, spec-drift-guard, pre-compact-backup, # post-compact-reinject, spec-index, goal-drafts) each parsed the header with their own regex and @@ -331,7 +331,7 @@ set_rc "$f" SHIPPED f="$(wf w-mode $'# T\nStatus: VALIDATED')"; chmod 640 "$f" set_rc "$f" SHIPPED mode="$(ls -l "$f" | cut -c1-10)" -leftover="$(ls "$TMP" | grep -c 'w-mode.md\.' || true)" +leftover="$(find "$TMP" -maxdepth 1 -name 'w-mode.md.*' | wc -l | tr -d ' ')" [ "$mode" = "-rw-r-----" ] && [ "$leftover" = 0 ] && pass "set: mode kept, no temp file left" || fail "set: mode=$mode leftover=$leftover" [ "$FAILED" -eq 0 ] && { echo "All spec-states tests passed."; exit 0; }