@nklisch/pi-agile-workflow 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +10 -0
- package/.codex-plugin/plugin.json +28 -0
- package/CHANGELOG.md +591 -0
- package/README.md +107 -0
- package/docs/ARCHITECTURE.md +716 -0
- package/docs/MIGRATION.md +419 -0
- package/docs/PRINCIPLES.md +464 -0
- package/docs/ROADMAP.md +95 -0
- package/docs/SPEC.md +855 -0
- package/docs/VISION.md +106 -0
- package/extensions/agile-workflow.test.ts +419 -0
- package/extensions/agile-workflow.ts +467 -0
- package/hooks/hooks.json +52 -0
- package/hooks/scripts/prompt-context.py +628 -0
- package/hooks/scripts/substrate-maintainer.py +359 -0
- package/hooks/scripts/test_prompt_context.py +757 -0
- package/package.json +30 -0
- package/scripts/install-work-view.sh +165 -0
- package/scripts/tests/agent-metadata.test.sh +75 -0
- package/scripts/tests/bump-version.test.sh +552 -0
- package/scripts/tests/channel-parity.test.sh +117 -0
- package/scripts/tests/convert-content-integrity.test.sh +246 -0
- package/scripts/tests/convert-install-routing.test.sh +159 -0
- package/scripts/tests/install-work-view.test.sh +411 -0
- package/scripts/tests/pi-package-metadata.test.sh +119 -0
- package/scripts/tests/work-board-shim.test.sh +239 -0
- package/scripts/tests/work-view-dist-version.test.sh +105 -0
- package/scripts/work-board.sh +64 -0
- package/scripts/work-view.sh +423 -0
- package/skills/autopilot/SKILL.md +330 -0
- package/skills/autopilot/agents/openai.yaml +6 -0
- package/skills/board/SKILL.md +62 -0
- package/skills/board/agents/openai.yaml +6 -0
- package/skills/bold-refactor/SKILL.md +244 -0
- package/skills/bold-refactor/agents/openai.yaml +6 -0
- package/skills/bug-scan/SKILL.md +378 -0
- package/skills/bug-scan/agents/openai.yaml +6 -0
- package/skills/bug-scan/references/async-promises.md +119 -0
- package/skills/bug-scan/references/concurrency-races.md +148 -0
- package/skills/bug-scan/references/data-layer.md +167 -0
- package/skills/bug-scan/references/error-handling.md +197 -0
- package/skills/bug-scan/references/gate-item-template.md +94 -0
- package/skills/bug-scan/references/language-footguns.md +219 -0
- package/skills/bug-scan/references/parked-item-template.md +103 -0
- package/skills/bug-scan/references/report-template.md +115 -0
- package/skills/bug-scan/references/resource-leaks.md +199 -0
- package/skills/bug-scan/references/state-closures.md +148 -0
- package/skills/bug-scan/references/time-numbers.md +158 -0
- package/skills/convert/SKILL.md +1463 -0
- package/skills/convert/agents/openai.yaml +6 -0
- package/skills/convert/references/legacy-overlap-migration.md +179 -0
- package/skills/deep-code-scan/SKILL.md +378 -0
- package/skills/deep-code-scan/agents/openai.yaml +6 -0
- package/skills/deep-code-scan/references/artifact-ledger.md +148 -0
- package/skills/deep-code-scan/references/consolidation.md +91 -0
- package/skills/deep-code-scan/references/decomposition.md +127 -0
- package/skills/deep-code-scan/references/item-templates.md +263 -0
- package/skills/deep-code-scan/references/lane-catalog.md +129 -0
- package/skills/deep-code-scan/references/review-gauntlet.md +108 -0
- package/skills/deep-code-scan/references/scanner-brief.md +152 -0
- package/skills/e2e-test-design/SKILL.md +517 -0
- package/skills/e2e-test-design/references/anti-tautology.md +261 -0
- package/skills/e2e-test-design/references/service-mocks.md +234 -0
- package/skills/e2e-test-design/references/test-taxonomy.md +211 -0
- package/skills/epic-design/SKILL.md +476 -0
- package/skills/epicize/SKILL.md +210 -0
- package/skills/epicize/agents/openai.yaml +6 -0
- package/skills/feature-design/SKILL.md +472 -0
- package/skills/fix/SKILL.md +173 -0
- package/skills/gate-cruft/SKILL.md +258 -0
- package/skills/gate-docs/SKILL.md +278 -0
- package/skills/gate-patterns/SKILL.md +389 -0
- package/skills/gate-refactor/SKILL.md +408 -0
- package/skills/gate-security/SKILL.md +275 -0
- package/skills/gate-tests/SKILL.md +367 -0
- package/skills/groom/SKILL.md +162 -0
- package/skills/groom/agents/openai.yaml +6 -0
- package/skills/ideate/SKILL.md +185 -0
- package/skills/ideate/agents/openai.yaml +6 -0
- package/skills/implement/SKILL.md +288 -0
- package/skills/implement-orchestrator/SKILL.md +604 -0
- package/skills/park/SKILL.md +111 -0
- package/skills/perf-design/SKILL.md +427 -0
- package/skills/perf-scout/SKILL.md +404 -0
- package/skills/perf-scout/agents/openai.yaml +6 -0
- package/skills/perf-scout/references/algorithmic-and-data-structures.md +126 -0
- package/skills/perf-scout/references/approximation-and-precomputation.md +136 -0
- package/skills/perf-scout/references/caching-and-memoization.md +123 -0
- package/skills/perf-scout/references/compiler-runtime-and-language.md +136 -0
- package/skills/perf-scout/references/database-and-storage-internals.md +144 -0
- package/skills/perf-scout/references/distributed-systems.md +150 -0
- package/skills/perf-scout/references/game-engine-and-realtime.md +136 -0
- package/skills/perf-scout/references/gpu-and-accelerators.md +130 -0
- package/skills/perf-scout/references/idea-ranking.md +75 -0
- package/skills/perf-scout/references/io-and-batching.md +135 -0
- package/skills/perf-scout/references/memory-and-data-locality.md +137 -0
- package/skills/perf-scout/references/parallelism-and-vectorization.md +126 -0
- package/skills/perf-scout/references/parked-item-template.md +117 -0
- package/skills/perf-scout/references/peer-review-pass.md +150 -0
- package/skills/perf-scout/references/report-template.md +148 -0
- package/skills/principles/SKILL.md +678 -0
- package/skills/principles/references/models.md +191 -0
- package/skills/principles/references/subagents.md +158 -0
- package/skills/prose-author/SKILL.md +185 -0
- package/skills/refactor-conventions-creator/SKILL.md +359 -0
- package/skills/refactor-conventions-creator/agents/openai.yaml +6 -0
- package/skills/refactor-conventions-creator/references/common-structures.md +91 -0
- package/skills/refactor-conventions-creator/references/common-styles.md +90 -0
- package/skills/refactor-design/SKILL.md +384 -0
- package/skills/release-deploy/SKILL.md +667 -0
- package/skills/release-deploy/agents/openai.yaml +6 -0
- package/skills/research/SKILL.md +166 -0
- package/skills/research/agents/openai.yaml +6 -0
- package/skills/review/SKILL.md +267 -0
- package/skills/review/references/deep-review.md +98 -0
- package/skills/review/references/review-lenses.md +68 -0
- package/skills/review/references/substrate-side-effects.md +161 -0
- package/skills/review/references/target-resolution.md +52 -0
- package/skills/scope/SKILL.md +486 -0
- package/work-view/Cargo.lock +486 -0
- package/work-view/Cargo.toml +9 -0
- package/work-view/crates/cli/.work-view-version +1 -0
- package/work-view/crates/cli/Cargo.toml +18 -0
- package/work-view/crates/cli/src/actionable.rs +500 -0
- package/work-view/crates/cli/src/args.rs +792 -0
- package/work-view/crates/cli/src/board/assets/board.css +855 -0
- package/work-view/crates/cli/src/board/assets/board.js +259 -0
- package/work-view/crates/cli/src/board/assets/card.js +139 -0
- package/work-view/crates/cli/src/board/assets/components.css +290 -0
- package/work-view/crates/cli/src/board/assets/dependency.js +1193 -0
- package/work-view/crates/cli/src/board/assets/detail.js +256 -0
- package/work-view/crates/cli/src/board/assets/filters.js +389 -0
- package/work-view/crates/cli/src/board/assets/index.html +77 -0
- package/work-view/crates/cli/src/board/assets/kanban.js +231 -0
- package/work-view/crates/cli/src/board/assets/markdown.js +260 -0
- package/work-view/crates/cli/src/board/assets/motion.css +131 -0
- package/work-view/crates/cli/src/board/assets/state.js +245 -0
- package/work-view/crates/cli/src/board/assets/table.js +304 -0
- package/work-view/crates/cli/src/board/assets/tokens.css +602 -0
- package/work-view/crates/cli/src/board/assets/views.js +41 -0
- package/work-view/crates/cli/src/board/assets.rs +162 -0
- package/work-view/crates/cli/src/board/feed.rs +204 -0
- package/work-view/crates/cli/src/board/mod.rs +246 -0
- package/work-view/crates/cli/src/board/open.rs +144 -0
- package/work-view/crates/cli/src/board/server.rs +407 -0
- package/work-view/crates/cli/src/main.rs +195 -0
- package/work-view/crates/cli/src/render.rs +354 -0
- package/work-view/crates/cli/src/scope.rs +157 -0
- package/work-view/crates/cli/src/stale.rs +581 -0
- package/work-view/crates/cli/tests/board-js/dependency-table.test.mjs +64 -0
- package/work-view/crates/cli/tests/board-js/expanded-browsing.test.mjs +79 -0
- package/work-view/crates/cli/tests/board-js/harness-smoke.test.mjs +11 -0
- package/work-view/crates/cli/tests/board-js/harness.mjs +437 -0
- package/work-view/crates/cli/tests/board-js/kanban-detail.test.mjs +75 -0
- package/work-view/crates/cli/tests/board-js/markdown-filter.test.mjs +60 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/CONVENTIONS.md +3 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/active/epics/epic-alpha.md +16 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/active/features/feat-a.md +16 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/active/features/feat-b.md +16 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/active/stories/story-alpha-1.md +16 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/active/stories/story-research-1.md +19 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/archive/feat-done.md +16 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/archive/feat-shipped.md +18 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/backlog/idea-backlog.md +7 -0
- package/work-view/crates/cli/tests/fixtures/golden/.work/releases/v1.0/v1.0.md +16 -0
- package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/CONVENTIONS.md +6 -0
- package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-dep-done.md +17 -0
- package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-design-ready.md +17 -0
- package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-impl-ready.md +17 -0
- package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/stories/story-review-ready.md +17 -0
- package/work-view/crates/cli/tests/fixtures/with-malformed/.work/CONVENTIONS.md +4 -0
- package/work-view/crates/cli/tests/fixtures/with-malformed/.work/active/epics/malformed-no-closing-fence.md +8 -0
- package/work-view/crates/cli/tests/fixtures/with-malformed/.work/active/features/good-item.md +16 -0
- package/work-view/crates/cli/tests/integration.rs +2833 -0
- package/work-view/crates/core/Cargo.toml +13 -0
- package/work-view/crates/core/src/error.rs +61 -0
- package/work-view/crates/core/src/filter.rs +804 -0
- package/work-view/crates/core/src/graph.rs +324 -0
- package/work-view/crates/core/src/index.rs +590 -0
- package/work-view/crates/core/src/lib.rs +54 -0
- package/work-view/crates/core/src/model.rs +202 -0
- package/work-view/crates/core/src/parse.rs +494 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/CONVENTIONS.md +15 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/active/epics/epic-core.md +16 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/active/features/feat-parser.md +16 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/active/features/feat-query.md +16 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/malformed-no-id.md +15 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/story-parse-unit.md +16 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/story-security-gate.md +16 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/archive/feat-old.md +16 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/archive/feat-parser.md +17 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/backlog/idea-future-board.md +7 -0
- package/work-view/crates/core/tests/fixtures/golden/.work/releases/v1.0/v1.0.md +16 -0
- package/work-view/crates/core/tests/fixtures/precedence/.work/CONVENTIONS.md +10 -0
- package/work-view/crates/core/tests/fixtures/precedence/.work/archive/dup-item.md +18 -0
- package/work-view/crates/core/tests/fixtures/precedence/.work/releases/v2.0/dup-item.md +18 -0
- package/work-view/crates/core/tests/integration.rs +541 -0
- package/work-view/dist/.gitattributes +1 -0
- package/work-view/dist/README.md +42 -0
- package/work-view/dist/aarch64-apple-darwin/work-view +0 -0
- package/work-view/dist/aarch64-unknown-linux-musl/work-view +0 -0
- package/work-view/dist/x86_64-apple-darwin/work-view +0 -0
- package/work-view/dist/x86_64-unknown-linux-musl/work-view +0 -0
|
@@ -0,0 +1,1463 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: convert
|
|
3
|
+
description: >
|
|
4
|
+
Bootstrap or sync the agile-workflow substrate. Auto-detects repo state: bootstrap creates .work/,
|
|
5
|
+
CONVENTIONS.md, the canonical AGENTS.md section, Claude compatibility, work-view, and migrated
|
|
6
|
+
items; sync refreshes plugin-owned artifacts plus optional skill catalog mirrors while preserving
|
|
7
|
+
user-owned CONVENTIONS.md, refactor rules, and substrate state. `convert --update` performs one-pass
|
|
8
|
+
artifact alignment. Discovery-driven: sweeps both skill roots to detect bespoke DIY skills that
|
|
9
|
+
overlap plugin-owned concepts (patterns, refactor conventions, plan-doc generators) and offers to
|
|
10
|
+
converge them to the canonical layout, deferring to the owning skill for placement. Checks inbound
|
|
11
|
+
references before moving any path and rewrites or shims them. Always asks whether destructive
|
|
12
|
+
cleanup is in scope before deleting, moving, or replacing legacy artifacts; preserve-only is the
|
|
13
|
+
default.
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Convert
|
|
17
|
+
|
|
18
|
+
You bootstrap OR sync the `.work/` substrate in a target project. Plain `convert`
|
|
19
|
+
inspects the current repo and auto-routes:
|
|
20
|
+
|
|
21
|
+
- **Bootstrap** — no substrate yet. Migrate from whatever tracking shape exists
|
|
22
|
+
(or seed empty for greenfield). Full migration matrix in `docs/MIGRATION.md`.
|
|
23
|
+
- **Sync** — substrate exists. Refresh plugin-shipped artifacts so a project
|
|
24
|
+
picks up plugin upgrades. Preserves all user content.
|
|
25
|
+
|
|
26
|
+
Convert is **discovery-driven, not a fixed checklist.** It enumerates the actual
|
|
27
|
+
state of the repo — both skill roots, the rules tree, every agent entrypoint —
|
|
28
|
+
and classifies what it finds, rather than probing a hardcoded set of known
|
|
29
|
+
paths. Bespoke DIY skills and rules that mirror a plugin-owned concept
|
|
30
|
+
(patterns, refactor conventions, cleanup, plan-doc generators) are usually
|
|
31
|
+
*convergence signals* — the project hand-rolled something the plugin now owns —
|
|
32
|
+
not intentional divergence to preserve. The detection sweep, the DIY→canonical
|
|
33
|
+
mapping, the classification taxonomy, the reference-integrity rule, and the
|
|
34
|
+
single-owner deferral table live in
|
|
35
|
+
[`references/legacy-overlap-migration.md`](references/legacy-overlap-migration.md);
|
|
36
|
+
read it before any discovery, convergence, or cleanup step.
|
|
37
|
+
|
|
38
|
+
Convert distinguishes **alignment** from **cleanup**:
|
|
39
|
+
|
|
40
|
+
- **Alignment** adds or refreshes plugin-owned artifacts: `.work/bin/work-view`,
|
|
41
|
+
the marked agile-workflow AGENTS section, missing shims, and generated wrapper
|
|
42
|
+
text that can be refreshed without losing user content.
|
|
43
|
+
- **Cleanup** deletes, moves, or replaces existing legacy artifacts: old tracking
|
|
44
|
+
docs, duplicate Claude files, divergent `.claude/skills/*` copies, or legacy
|
|
45
|
+
generated plan files. Cleanup is opt-in and path-specific.
|
|
46
|
+
|
|
47
|
+
**Convert places content; the owning skill defines where it lives.** For any
|
|
48
|
+
plugin-owned concept, defer to its owner's canonical *location and format*
|
|
49
|
+
instead of carrying a divergent rule: reusable patterns live in
|
|
50
|
+
`.agents/skills/patterns/` in the `gate-patterns` file/index format; refactor
|
|
51
|
+
conventions → `refactor-conventions-creator` Phase 1/5 (AGENTS style section +
|
|
52
|
+
`.agents/skills/refactor-conventions/`). One nuance for patterns: convert
|
|
53
|
+
*imports* existing legacy patterns there **verbatim and losslessly** (Phase 7),
|
|
54
|
+
whereas `gate-patterns` *discovers* new ones with its 3+-occurrence filter — same
|
|
55
|
+
location and format, different entry path. See the single-owner deferral table in
|
|
56
|
+
the reference.
|
|
57
|
+
|
|
58
|
+
## Arguments
|
|
59
|
+
|
|
60
|
+
- `convert` — auto-detect mode (recommended). Bootstraps if no substrate is
|
|
61
|
+
present, otherwise syncs plugin artifacts and reports drift.
|
|
62
|
+
- `convert --update` — explicit sync / one-pass artifact alignment. Identical
|
|
63
|
+
to auto-sync, but useful when you want to assert intent or repair plugin
|
|
64
|
+
artifacts, AGENTS/CLAUDE compatibility, `.work/bin/work-view`, pattern-skill
|
|
65
|
+
mirrors, and refactor-conventions catalog placement in one pass.
|
|
66
|
+
- `convert --shape <shape>` — force a specific source shape for bootstrap
|
|
67
|
+
(`workflow-plugin`, `ad-hoc`, `no-tracking`, `greenfield`). Errors if the
|
|
68
|
+
substrate already exists — remove `.work/` first to force a re-bootstrap.
|
|
69
|
+
|
|
70
|
+
## Workflow
|
|
71
|
+
|
|
72
|
+
### Phase 1: Preflight
|
|
73
|
+
|
|
74
|
+
1. Verify foundation docs exist: `docs/VISION.md` OR `docs/SPEC.md`. If neither:
|
|
75
|
+
> Halt. "No foundation docs found. Run `/agile-workflow:ideate` first to produce
|
|
76
|
+
> foundation docs, then re-run `/agile-workflow:convert`."
|
|
77
|
+
2. Verify CWD is a git repo. If not, ask: "This isn't a git repo. agile-workflow's
|
|
78
|
+
substrate relies on git for the audit trail. Run `git init` first?"
|
|
79
|
+
|
|
80
|
+
### Phase 1.5: Detect run mode
|
|
81
|
+
|
|
82
|
+
Compute substrate health by checking these markers:
|
|
83
|
+
|
|
84
|
+
| Marker | What to check |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `substrate_root` | `.work/` directory exists |
|
|
87
|
+
| `conventions` | `.work/CONVENTIONS.md` exists |
|
|
88
|
+
| `managed_section` | Some root instruction file (`AGENTS.md` or `CLAUDE.md`) contains `<!-- agile-workflow:start -->`. Whichever holds it is the detected canonical instruction file for this repo — direction-agnostic, since `entrypoint_model` isn't decided until Phase 1.8 |
|
|
89
|
+
| `entrypoint_compat` | The *other* root entrypoint (the one without the managed section) is a symlink/shim to the canonical instruction file, OR itself contains the section for legacy installs |
|
|
90
|
+
| `work_view` | `.work/bin/work-view` exists, is executable, and reports the current plugin version via `--version` |
|
|
91
|
+
|
|
92
|
+
Route on the result:
|
|
93
|
+
|
|
94
|
+
| Condition | Mode | Notes |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `--shape` was passed AND `substrate_root` is false | **bootstrap** | Forced source-shape bootstrap. |
|
|
97
|
+
| `--shape` was passed AND `substrate_root` is true | halt | "Substrate already bootstrapped at `.work/`. Remove it first to force a re-bootstrap, or drop `--shape` to sync." |
|
|
98
|
+
| `--update` was passed AND `substrate_root` is false | halt | "No substrate found. Run `convert` (without `--update`) to bootstrap." |
|
|
99
|
+
| `--update` was passed AND `substrate_root` is true | **sync** | Explicit sync. |
|
|
100
|
+
| No args AND `substrate_root` is false | **bootstrap** | Standard fresh project flow. |
|
|
101
|
+
| No args AND `substrate_root` is true | **sync** | Auto-sync. Log the decision: "Substrate detected at `.work/` — running in sync mode. Use `--shape` after removing `.work/` if you want a re-bootstrap." |
|
|
102
|
+
|
|
103
|
+
When in **bootstrap mode**, continue with Phase 1.6. When in **sync mode**, skip
|
|
104
|
+
Phase 1.6, run Phase 1.7 and Phase 1.8, then jump to the Sync Workflow section
|
|
105
|
+
below.
|
|
106
|
+
|
|
107
|
+
### Phase 1.6 (bootstrap only): Check for in-flight working-tree work
|
|
108
|
+
|
|
109
|
+
Run `git status --porcelain` and note the count of changed/untracked files.
|
|
110
|
+
If > 5, this is a "dirty repo bootstrap" — uncommitted work needs to be
|
|
111
|
+
captured into the substrate alongside the migration, otherwise autopilot
|
|
112
|
+
will have nothing to drain right after bootstrap. See Phase 8.5 for
|
|
113
|
+
capture handling.
|
|
114
|
+
|
|
115
|
+
### Phase 1.7: Discover legacy, duplicate, and overlapping artifacts
|
|
116
|
+
|
|
117
|
+
Before any bootstrap or sync writes, run the **detection sweep** from
|
|
118
|
+
[`references/legacy-overlap-migration.md`](references/legacy-overlap-migration.md).
|
|
119
|
+
Do not probe a hardcoded path list — enumerate and classify:
|
|
120
|
+
|
|
121
|
+
1. **Legacy tracking docs** (fixed candidates are fine here, they're not
|
|
122
|
+
skills): `docs/designs/`, `docs/designs/completed/`, `docs/ROADMAP.md`,
|
|
123
|
+
`docs/PROGRESS.md`, `TODO.md`, `BACKLOG.md`, `NOTES.md`, `tasks/`.
|
|
124
|
+
2. **Agent entrypoints**: regular-file `CLAUDE.md`, `.claude/CLAUDE.md`,
|
|
125
|
+
`.agents/CLAUDE.md`, plus the AGENTS candidates from Phase 2.5.
|
|
126
|
+
3. **Skill-root sweep**: `ls -d .agents/skills/*/ .claude/skills/*/` and
|
|
127
|
+
`ls .claude/rules/*.md`. For each entry, read its header (name +
|
|
128
|
+
description) and classify it via the taxonomy in the reference:
|
|
129
|
+
`canonical` / `plugin-mirror-symlink` / `plugin-mirror-divergent-copy` /
|
|
130
|
+
`bespoke` / `unrelated` (project skills that mirror no plugin concept — left
|
|
131
|
+
untouched). Diff the actual contents of any `.agents` vs `.claude` pair —
|
|
132
|
+
duplicated-but-drifted copies in both roots are a real shape this repo has
|
|
133
|
+
hit, and a fixed-path check never finds them.
|
|
134
|
+
4. **Overlap flags**: mark any `bespoke` entry that mirrors a plugin-owned
|
|
135
|
+
concept, instructs writing a standalone plan doc, or is a user-invocable
|
|
136
|
+
command superseded by a plugin gate (see the reference's overlap-candidate
|
|
137
|
+
rules). These become the convergence question in Phase 1.8.
|
|
138
|
+
|
|
139
|
+
Record the classified inventory in the run notes (and `MIGRATION_REPORT.md` for
|
|
140
|
+
bootstrap). If the sweep finds nothing legacy, duplicate, or overlapping, set
|
|
141
|
+
`cleanup_scope: preserve-only`, note "no convergence candidates", and continue.
|
|
142
|
+
|
|
143
|
+
### Phase 1.8: Decisions checkpoint
|
|
144
|
+
|
|
145
|
+
Surface the real decisions the sweep uncovered. Ask only the questions that
|
|
146
|
+
apply — skip any whose trigger condition is absent.
|
|
147
|
+
|
|
148
|
+
**1. Entrypoint model (ask only when a healthy `CLAUDE.md` exists and there is
|
|
149
|
+
no `AGENTS.md` at any candidate location — i.e. a Claude-native repo).** Flipping
|
|
150
|
+
a working repo's source of truth is disruptive and must be explicit. This is a
|
|
151
|
+
dual-marketplace repo, so a root-readable `AGENTS.md` is required either way;
|
|
152
|
+
the genuine toggle is what happens to `CLAUDE.md`:
|
|
153
|
+
|
|
154
|
+
> "This is a healthy Claude-native repo with no `AGENTS.md`. Codex needs a
|
|
155
|
+
> root-readable `AGENTS.md` regardless — how should `CLAUDE.md` relate to it?"
|
|
156
|
+
|
|
157
|
+
- **Adopt AGENTS-canonical (Recommended)** — migrate `CLAUDE.md` content into a
|
|
158
|
+
new root `AGENTS.md` (the source of truth), then point `CLAUDE.md` at it via
|
|
159
|
+
symlink/shim.
|
|
160
|
+
- **Keep CLAUDE.md as the content source** — `CLAUDE.md` stays the file the team
|
|
161
|
+
edits; create a thin root `AGENTS.md` pointer/shim so Codex can read it.
|
|
162
|
+
|
|
163
|
+
Record as `entrypoint_model: agents-canonical | claude-source`.
|
|
164
|
+
|
|
165
|
+
**Deriving the model when not asking** (so it persists across reruns):
|
|
166
|
+
- **Sync / already-converted repo** — if Phase 1.5 found the managed section in
|
|
167
|
+
`CLAUDE.md`, set `entrypoint_model: claude-source`; if it's in `AGENTS.md`, set
|
|
168
|
+
`agents-canonical`. Never re-flip a converted repo by defaulting — honor the
|
|
169
|
+
shape it already has.
|
|
170
|
+
- **Bootstrap, trigger absent** (an `AGENTS.md` already exists, or there's no
|
|
171
|
+
`CLAUDE.md`) — default silently to `agents-canonical`.
|
|
172
|
+
|
|
173
|
+
**2. Per-overlap convergence (ask only when Phase 1.7 flagged ≥1 `bespoke`
|
|
174
|
+
overlap OR ≥1 `plugin-mirror-divergent-copy`).** Batch ALL such entries into a
|
|
175
|
+
**single `multiSelect` question** — do not ask one question per skill. For each
|
|
176
|
+
entry, name the artifact, what it mirrors, and the canonical destination from
|
|
177
|
+
the mapping table. Both buckets feed the same `converge` set: `bespoke` entries
|
|
178
|
+
migrate to canonical; `plugin-mirror-divergent-copy` entries get their unique
|
|
179
|
+
content reconciled into `.agents` and the mirror re-established.
|
|
180
|
+
|
|
181
|
+
> "Found artifacts that should converge to the canonical layout. Which should I
|
|
182
|
+
> converge? (Unselected stay untouched.)"
|
|
183
|
+
>
|
|
184
|
+
> Options (one per detected entry):
|
|
185
|
+
> - `structural-refactor → refactor-conventions (.agents/skills/refactor-conventions/)`
|
|
186
|
+
> - `extract-patterns → gate-patterns (.agents/skills/patterns/)` — **removes the `/extract-patterns` command**
|
|
187
|
+
> - `patterns (drifted copies in .agents + .claude) → reconcile into .agents, re-mirror`
|
|
188
|
+
> - …
|
|
189
|
+
|
|
190
|
+
Record the chosen set as `converge: [<artifact>, …]`. Converging an artifact
|
|
191
|
+
that backs a user-invocable command means that command goes away — call this out
|
|
192
|
+
explicitly in the option description so the user is opting into losing a slash
|
|
193
|
+
command they type. `canonical`, `plugin-mirror-symlink`, and `unrelated` entries
|
|
194
|
+
are never offered here — they need no convergence.
|
|
195
|
+
|
|
196
|
+
**3. Cleanup scope (always ask when any legacy/duplicate/overlap candidate
|
|
197
|
+
exists).**
|
|
198
|
+
|
|
199
|
+
> "Beyond converging the artifacts above, how much cleanup of the *old* files is
|
|
200
|
+
> in scope?"
|
|
201
|
+
|
|
202
|
+
- **Preserve all (Recommended)** — add/refresh/converge artifacts and import
|
|
203
|
+
useful legacy content, but do not delete, move, or replace existing legacy
|
|
204
|
+
files (convergence still writes the new canonical copy; the old file stays).
|
|
205
|
+
- **Generated only** — may replace known generated duplicate/shim/mirror files
|
|
206
|
+
with current symlinks or shims after preserving/importing content.
|
|
207
|
+
- **Legacy cleanup** — may also remove or move old tracking artifacts and
|
|
208
|
+
converged-away bespoke skills, but only after a second confirmation listing
|
|
209
|
+
exact paths.
|
|
210
|
+
|
|
211
|
+
Record as `cleanup_scope: preserve-only | generated-only | legacy-cleanup`
|
|
212
|
+
(`legacy-cleanup` includes generated cleanup).
|
|
213
|
+
|
|
214
|
+
**Content integrity is mandatory regardless of `cleanup_scope` — and runs
|
|
215
|
+
BEFORE reference integrity.** This is the central data-loss gate. It is
|
|
216
|
+
*distinct* from reference integrity: reference integrity preserves *pointers*
|
|
217
|
+
(no inbound link dangles); content integrity preserves *content* (no block of a
|
|
218
|
+
legacy artifact disappears without a verified home). A pointer can be cleanly
|
|
219
|
+
repointed while the content it pointed at is silently dropped — content
|
|
220
|
+
integrity closes that hole.
|
|
221
|
+
|
|
222
|
+
> **Content-integrity gate (before any destructive op).** A *destructive op* is
|
|
223
|
+
> any of: `git rm` / delete, `git mv` / move, replace-with-symlink,
|
|
224
|
+
> replace-with-shim, copy-over (overwriting a file's bytes), managed-section
|
|
225
|
+
> overwrite (rewriting content between `<!-- ...:start/end -->` markers), or
|
|
226
|
+
> mirror replacement (overwriting/symlinking a `.claude` mirror). Before
|
|
227
|
+
> performing a destructive op on a legacy artifact, build the **block-level
|
|
228
|
+
> preservation manifest** (below), then apply the rule for the op's kind:
|
|
229
|
+
> - **Source-eliminating ops** (delete, move, replace-with-shim,
|
|
230
|
+
> replace-with-symlink — anything that removes the legacy file as a place its
|
|
231
|
+
> content lives): permitted ONLY when **every** user block is `landed_existing`
|
|
232
|
+
> or `landed_this_run`. A block still `preserved_in_place` means the source file
|
|
233
|
+
> is its ONLY home, so the op **does NOT run** — leave the artifact exactly where
|
|
234
|
+
> it is. `ambiguous` likewise blocks.
|
|
235
|
+
> - **Regenerable-copy ops** (managed-section overwrite of plugin markers, or
|
|
236
|
+
> `.claude` mirror replacement where the `.agents` canonical is the home):
|
|
237
|
+
> permitted only after the manifest confirms the canonical home already holds the
|
|
238
|
+
> content — never overwrite the copy while the home is unverified.
|
|
239
|
+
>
|
|
240
|
+
> The gate is a hard precondition, not advice. `preserved_in_place` satisfies the
|
|
241
|
+
> *content-safety* check (the content still exists, in the source) but NEVER
|
|
242
|
+
> licenses removing that source. A manifest with any unaccounted-for block runs no
|
|
243
|
+
> destructive op; the artifact is reported as preserved-pending-review.
|
|
244
|
+
|
|
245
|
+
**Content inside plugin-managed markers is NEVER counted as preserved
|
|
246
|
+
user-content.** Blocks between `<!-- agile-workflow:start/end -->` or
|
|
247
|
+
`<!-- agile-workflow:rules:start/end -->` are plugin-owned and regenerated from
|
|
248
|
+
the template; they neither need preservation nor satisfy the gate for any
|
|
249
|
+
*user* block. Only user/legacy content blocks are subjects of the manifest.
|
|
250
|
+
|
|
251
|
+
#### Block-level preservation manifest
|
|
252
|
+
|
|
253
|
+
Before touching any legacy or split-destination artifact (notably a
|
|
254
|
+
`.claude/rules/*.md` that mixes structural patterns and prose), parse it into
|
|
255
|
+
**Markdown-aware blocks** and classify, route, and verify each:
|
|
256
|
+
|
|
257
|
+
1. **Block boundaries** (so a block is never split mid-thought):
|
|
258
|
+
- YAML frontmatter, if present, is one block.
|
|
259
|
+
- Each Markdown heading starts a new block; a heading section runs to the
|
|
260
|
+
next heading of the same or higher level.
|
|
261
|
+
- Fenced code blocks, tables, and lists are **atomic** — never split one
|
|
262
|
+
across blocks; keep an introductory sentence with the fence/table/list it
|
|
263
|
+
introduces.
|
|
264
|
+
- HTML marker regions (`<!-- x:start -->` … `<!-- x:end -->`) are atomic.
|
|
265
|
+
- If the file has no headings at all, group by blank-line-separated
|
|
266
|
+
paragraphs, again keeping an intro line attached to a fence it introduces.
|
|
267
|
+
2. **Classify** each block as exactly one of:
|
|
268
|
+
- `structural-pattern` — a reusable code shape with concrete examples
|
|
269
|
+
(routes to `.agents/skills/patterns/`, see Phase 7's verbatim importer).
|
|
270
|
+
- `rule-prose` — project style or agent-rule prose (routes to
|
|
271
|
+
`.agents/rules/<name>.md`, e.g. `project.md`).
|
|
272
|
+
- `ambiguous` — cannot be confidently classified, or has no trustworthy
|
|
273
|
+
destination (preserve in place; never destroy).
|
|
274
|
+
3. **Route** per classification (patterns → `.agents/skills/patterns/`;
|
|
275
|
+
rule-prose → `.agents/rules/<name>.md`; ambiguous → leave in source).
|
|
276
|
+
4. **Record a terminal state** per block, idempotently — re-running convert
|
|
277
|
+
must never duplicate a block already landed:
|
|
278
|
+
- `landed_existing` — the block's content is already present at its
|
|
279
|
+
canonical destination (a prior run, or the user, put it there). No write.
|
|
280
|
+
- `landed_this_run` — convert wrote it to the destination this run.
|
|
281
|
+
- `preserved_in_place` — intentionally kept in the source file (ambiguous
|
|
282
|
+
blocks, or blocks the user chose not to migrate). This block is content-safe
|
|
283
|
+
(it still exists in the source) but pins the source in place: it makes the
|
|
284
|
+
source NOT a candidate for any source-eliminating op (delete / move / shim /
|
|
285
|
+
symlink), which require **every** block `landed_*`.
|
|
286
|
+
- `ambiguous` — not yet resolved; blocks the destructive op until it becomes
|
|
287
|
+
`preserved_in_place` or lands.
|
|
288
|
+
5. **Provenance verification (content-equality, not weak anchors).** A digest
|
|
289
|
+
comment plus a matching heading does NOT prove the block's body landed — a
|
|
290
|
+
destination could carry the marker and the slug while dropping the rationale,
|
|
291
|
+
examples, or prose. Verification must prove the *content* is present while
|
|
292
|
+
still tolerating pure *layout* reformatting. Per source block:
|
|
293
|
+
- Compute `sha256` of the **normalized** source block (trim trailing
|
|
294
|
+
whitespace per line, collapse runs of blank lines to one, strip the trailing
|
|
295
|
+
newline). Write it into the destination region that holds the block as a
|
|
296
|
+
trailing marker, e.g. `<!-- agile-workflow:provenance src-sha256=<digest> -->`.
|
|
297
|
+
Locate that region by the block's semantic anchors (pattern name / slug, or
|
|
298
|
+
heading text + fenced payload).
|
|
299
|
+
- **Verify by recomputing**: normalize the destination region the same way
|
|
300
|
+
(excluding the provenance marker) and confirm its `sha256` **equals** the
|
|
301
|
+
recorded `src-sha256`. Presence of the marker or an anchor alone is never
|
|
302
|
+
sufficient — the recomputed destination hash must match.
|
|
303
|
+
- If the hashes cannot be made equal (the destination genuinely reworded the
|
|
304
|
+
content rather than just re-laying-it-out), or no trustworthy region can be
|
|
305
|
+
located, the block does **not** count as landed — mark it `preserved_in_place`
|
|
306
|
+
and keep the source. The convert-owned importer (Phase 7) writes blocks
|
|
307
|
+
**verbatim**, so its imports hash-match and become `landed_this_run`; only a
|
|
308
|
+
pre-existing hand-edited destination risks a mismatch, and there the safe
|
|
309
|
+
answer is to keep the source. Keeping a duplicate is always preferable to a
|
|
310
|
+
deletion you cannot prove safe.
|
|
311
|
+
|
|
312
|
+
**Reference integrity is mandatory regardless of `cleanup_scope`, and runs
|
|
313
|
+
AFTER content integrity passes.** Before any `git mv` / `git rm` /
|
|
314
|
+
replace-with-symlink / replace-with-shim, follow the
|
|
315
|
+
reference-integrity-on-move procedure in the reference: grep the repo for
|
|
316
|
+
inbound references (especially `.work/` items and `docs/`), then rewrite them or
|
|
317
|
+
leave a redirect shim, and report which. Never strand a live pointer. Every
|
|
318
|
+
destructive action still needs an exact path list in the plan; prefer `git mv`
|
|
319
|
+
to a clearly named legacy location for retention, `git rm` only for paths the
|
|
320
|
+
user explicitly chose to delete, and never broad globs.
|
|
321
|
+
|
|
322
|
+
#### Manifest edge cases
|
|
323
|
+
|
|
324
|
+
- **Empty file** — manifest state `empty`. Still run reference integrity and
|
|
325
|
+
confirm (no inbound references would dangle), but there is no content to
|
|
326
|
+
migrate; a shim/removal is safe once references are handled.
|
|
327
|
+
- **Already-shimmed file** — if the file is already a redirect shim/symlink to
|
|
328
|
+
the canonical destination, verify the target exists and is non-dangling, then
|
|
329
|
+
leave it; do NOT treat the shim's own pointer text as content to migrate.
|
|
330
|
+
- **Symlink loop / dangling symlink** — classify `unsafe` and leave it in
|
|
331
|
+
place; never follow into a loop or migrate a dangling target. Report it.
|
|
332
|
+
- **Partial prior migration** — some blocks already landed (a previous
|
|
333
|
+
interrupted run): the manifest is idempotent, so already-present blocks are
|
|
334
|
+
`landed_existing` and are not rewritten or duplicated; only unaccounted blocks
|
|
335
|
+
are routed this run.
|
|
336
|
+
|
|
337
|
+
### Phase 2: Detect project shape
|
|
338
|
+
|
|
339
|
+
Detection signals (first match wins):
|
|
340
|
+
|
|
341
|
+
| Shape | Signal |
|
|
342
|
+
|---|---|
|
|
343
|
+
| `workflow-plugin` | `docs/designs/` exists OR `docs/ROADMAP.md` exists OR `docs/PROGRESS.md` exists |
|
|
344
|
+
| `ad-hoc` | `TODO.md`, `BACKLOG.md`, `NOTES.md`, or `tasks/` exists at repo root |
|
|
345
|
+
| `no-tracking` | Source code exists (`src/`, `lib/`, `app/`, etc.) but no tracking files |
|
|
346
|
+
| `greenfield` | No source code, only README and config files |
|
|
347
|
+
|
|
348
|
+
If `--shape` was passed, use it directly.
|
|
349
|
+
|
|
350
|
+
### Phase 2.5: Resolve agent instruction files
|
|
351
|
+
|
|
352
|
+
Instruction files can appear at the repo root or under agent-specific
|
|
353
|
+
directories. Detect all of these before writing:
|
|
354
|
+
|
|
355
|
+
- AGENTS candidates: `AGENTS.md`, `.agents/AGENTS.md`, `.claude/AGENTS.md`
|
|
356
|
+
- Claude candidates: `CLAUDE.md`, `.claude/CLAUDE.md`, `.agents/CLAUDE.md`
|
|
357
|
+
- Legacy Claude rules candidates: any `.claude/rules/*.md`
|
|
358
|
+
|
|
359
|
+
**The "canonical instruction file" is set by `entrypoint_model` (Phase 1.8).**
|
|
360
|
+
Everywhere this skill says "the selected AGENTS target," read it as "the
|
|
361
|
+
canonical instruction file" resolved here. The managed agile-workflow section,
|
|
362
|
+
the conventions, and imported content go into the canonical instruction file —
|
|
363
|
+
**except** legacy rule-prose blocks, which route to `.agents/rules/<name>.md`
|
|
364
|
+
(e.g. `project.md`) per the Phase 1.8 content-integrity routing, never into the
|
|
365
|
+
canonical instruction file. The *other* entrypoint becomes a pointer to it
|
|
366
|
+
(Phase 7).
|
|
367
|
+
|
|
368
|
+
- **`entrypoint_model: agents-canonical`** (default) — the canonical instruction
|
|
369
|
+
file is an AGENTS target, chosen by this precedence:
|
|
370
|
+
1. If `AGENTS.md` exists at the repo root, use it.
|
|
371
|
+
2. Else if `.agents/AGENTS.md` exists, use it and create `AGENTS.md` as a
|
|
372
|
+
symlink to `.agents/AGENTS.md` when possible.
|
|
373
|
+
3. Else if `.claude/AGENTS.md` exists, use it and create `AGENTS.md` as a
|
|
374
|
+
symlink to `.claude/AGENTS.md` when possible.
|
|
375
|
+
4. Else create root `AGENTS.md`.
|
|
376
|
+
- **`entrypoint_model: claude-source`** — the canonical instruction file is the
|
|
377
|
+
existing root `CLAUDE.md` (the team keeps editing it). Create root `AGENTS.md`
|
|
378
|
+
as a symlink to `CLAUDE.md` so Codex reads the same content. If symlinks are
|
|
379
|
+
unavailable, write a root `AGENTS.md` shim that points readers at `CLAUDE.md`.
|
|
380
|
+
Do NOT migrate `CLAUDE.md` into an AGENTS file or replace it in this mode.
|
|
381
|
+
|
|
382
|
+
If symlinks are unavailable in `agents-canonical` mode, keep the existing nested
|
|
383
|
+
AGENTS file as the content source and write a root `AGENTS.md` shim or copy that
|
|
384
|
+
clearly points to the canonical nested file. Codex needs a root-readable
|
|
385
|
+
`AGENTS.md`; do not leave only a nested file unless the project has explicitly
|
|
386
|
+
configured that fallback.
|
|
387
|
+
|
|
388
|
+
Legacy `.claude/rules/*.md` files (e.g. `patterns.md`) are not separate
|
|
389
|
+
canonical rules targets, and `patterns.md` in particular is **not** a
|
|
390
|
+
single-destination file. When any such file exists, build the **Phase 1.8
|
|
391
|
+
block-level preservation manifest** for it and route each block to its canonical
|
|
392
|
+
owner (per the DIY→canonical mapping in the reference):
|
|
393
|
+
|
|
394
|
+
- **Structural-pattern blocks** (recurring code shapes with examples) →
|
|
395
|
+
`.agents/skills/patterns/`, via convert's **verbatim legacy-pattern importer**
|
|
396
|
+
(Phase 7) — every legacy pattern lands losslessly, with NO 3+-occurrence
|
|
397
|
+
discovery filter. `gate-patterns` Phase 4-5 defines the file/index *format*;
|
|
398
|
+
convert does the importing. Do not paste these into AGENTS.
|
|
399
|
+
- **Rule-prose blocks** (project style / agent-rule prose) →
|
|
400
|
+
`.agents/rules/<name>.md` (e.g. `project.md`), the user-owned rules file the
|
|
401
|
+
hook force-loads — NOT the AGENTS canonical file and NOT inside the plugin
|
|
402
|
+
`agile-workflow:rules` markers.
|
|
403
|
+
- **Ambiguous blocks** → preserve in place; never destroy.
|
|
404
|
+
|
|
405
|
+
Never dump a whole rules file into AGENTS under a generic heading — that
|
|
406
|
+
contradicts the canonical layout convert advertises in Phase 6, and rule prose's
|
|
407
|
+
canonical home is now `.agents/rules/<name>.md`. Preserve only non-duplicate
|
|
408
|
+
content (idempotent per the manifest). Replace any `.claude/rules/*.md` with a
|
|
409
|
+
short shim only when `cleanup_scope` allows generated cleanup or the user
|
|
410
|
+
confirms that exact path, and only after the **content-integrity gate** passes
|
|
411
|
+
(every block terminal) AND the reference-integrity check (both Phase 1.8) clears
|
|
412
|
+
the move; otherwise leave it in place and report it as legacy content that was
|
|
413
|
+
imported. Do not create `.claude/rules/*.md` files that don't already exist.
|
|
414
|
+
|
|
415
|
+
### Phase 3: Conventions interview
|
|
416
|
+
|
|
417
|
+
Run an interactive interview via structured question tool. Six questions, in order:
|
|
418
|
+
|
|
419
|
+
1. **Release mapping** — `branch-held | tag-based | release-branch | none`. Default
|
|
420
|
+
offered: `tag-based`. Always asked.
|
|
421
|
+
2. **Tag taxonomy** — propose a starter set based on detected project type
|
|
422
|
+
(e.g., for a web app: `[security, perf, refactor, content, infra]`). User can
|
|
423
|
+
confirm or edit. Each tag gets a one-line semantic.
|
|
424
|
+
3. **Slug conventions** — defaults to kebab-case with parent-prefix for children.
|
|
425
|
+
4. **Stage overrides** — none by default. Discouraged.
|
|
426
|
+
5. **Gate config** — defaults to
|
|
427
|
+
`gates_for_release: [security, tests, cruft, docs, patterns]` plus the
|
|
428
|
+
default `gate_finding_routing` map (`critical/high -> implementing`,
|
|
429
|
+
`medium -> drafting`, `low -> backlog`, `info -> skip`). User can reorder
|
|
430
|
+
or omit gates and can override finding routing for the project. `gate-refactor`
|
|
431
|
+
is an **opt-in gate** (not in the default list) — add it when the project has
|
|
432
|
+
scan-rule libraries under `gate_refactor_scan_library_roots` (default:
|
|
433
|
+
`.agents/skills`, `.claude/skills`). `binding_guard` sets the Phase 3.5
|
|
434
|
+
binding-consistency check behavior: `warn` (default — surfaces findings without
|
|
435
|
+
halting), `halt` (for projects that hold the no-cross-version-drift invariant), or
|
|
436
|
+
`off` (skip). `epic_cohesion` sets how an unbound child of a bound parent is
|
|
437
|
+
scored: `phased` (default — informational, an epic may ship across releases) or
|
|
438
|
+
`total` (treated as a mismatch, "epics ship whole").
|
|
439
|
+
6. **Terminal-tier retention** — `delete-refs | retain-bodies`. This is the ONE merged terminal
|
|
440
|
+
convention (archival + `archived_atop` late-binding + one-summary release), not just byte
|
|
441
|
+
retention. Default offered: `delete-refs` — archiving a done item leaves a **bodyless stub**
|
|
442
|
+
carrying `archived_atop` (the immutable release baseline it was done atop, kept as provenance) +
|
|
443
|
+
`git_ref`; a release **late-binds all unbound archived stubs** (re-gated during the release —
|
|
444
|
+
gates recover changed files by item id and hydrate pruned bodies from `git_ref`)
|
|
445
|
+
and **collapses** all bound items into one `.work/releases/<version>/release-<version>.md` summary (id,
|
|
446
|
+
title, kind, `archived_atop`, git ref); full bodies live in git history, so terminal prose cannot
|
|
447
|
+
leak to future agents. Offer `retain-bodies` only for projects that deliberately keep full terminal
|
|
448
|
+
bodies on disk (same `archived_atop`/late-binding semantics, bodies just not pruned).
|
|
449
|
+
|
|
450
|
+
### Phase 4: Create substrate skeleton
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
mkdir -p .work/active/epics .work/active/features .work/active/stories
|
|
454
|
+
mkdir -p .work/backlog .work/releases .work/archive .work/bin
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Install `work-view` from the plugin to the project. On supported platforms this
|
|
458
|
+
installs the version-verified prebuilt Rust binary, including `work-view board`;
|
|
459
|
+
only unsupported platforms receive the version-stamped Bash fallback:
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
bash "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/install-work-view.sh"
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
(If neither `PLUGIN_ROOT` nor `CLAUDE_PLUGIN_ROOT` is exposed in the agent's shell
|
|
466
|
+
environment, locate the plugin source via the active skill/plugin path or manifest.)
|
|
467
|
+
|
|
468
|
+
### Phase 5: Write CONVENTIONS.md
|
|
469
|
+
|
|
470
|
+
Write `.work/CONVENTIONS.md` from the interview answers, following the format in SPEC.md. The
|
|
471
|
+
`## Terminal-tier retention` section is **value-only** — write the bare `delete-refs`/`retain-bodies`
|
|
472
|
+
value the user chose, not the merged prose (the prose lives in SPEC.md, never duplicated per project).
|
|
473
|
+
This bare-value form is exactly what a later sync classifies as `match`, so a freshly bootstrapped
|
|
474
|
+
repo never self-reports terminal-retention drift.
|
|
475
|
+
|
|
476
|
+
### Phase 6: Write the canonical AGENTS.md section
|
|
477
|
+
|
|
478
|
+
The selected AGENTS target is the canonical project instruction file for
|
|
479
|
+
agile-workflow. Write or refresh the agile-workflow section between HTML
|
|
480
|
+
comment markers:
|
|
481
|
+
|
|
482
|
+
```markdown
|
|
483
|
+
<!-- agile-workflow:start -->
|
|
484
|
+
## Agile-Workflow Substrate
|
|
485
|
+
|
|
486
|
+
Work tracked in `.work/` as markdown items with YAML frontmatter
|
|
487
|
+
(`kind, stage, tags, parent, depends_on, release_binding`).
|
|
488
|
+
Layout: `.work/active/{epics,features,stories}/`, `.work/backlog/`,
|
|
489
|
+
`.work/releases/<version>/`, `.work/archive/`.
|
|
490
|
+
|
|
491
|
+
**Primary query tool:** `.work/bin/work-view` filters by stage, tag, kind,
|
|
492
|
+
parent, and dependency. Common patterns:
|
|
493
|
+
- `work-view --ready` — items ready to work (deps satisfied)
|
|
494
|
+
- `work-view --stage review` — items awaiting an agent review pass (`/agile-workflow:review`)
|
|
495
|
+
- `work-view --parent <id>` / `--blocking <id>` — hierarchy / sequencing
|
|
496
|
+
- `work-view --scope all` — include terminal tiers: `releases/` (one summary doc per version) and
|
|
497
|
+
`archive/` (bodyless ref stubs). Full bodies live in git history. By default work-view shows only
|
|
498
|
+
active + backlog; `--release` / `--gate` auto-widen to all tiers.
|
|
499
|
+
- `work-view --help` for the full flag set
|
|
500
|
+
|
|
501
|
+
Foundation docs in `docs/` describe the system's current state or intended
|
|
502
|
+
future state, never the past; git history is the audit trail. Item files are
|
|
503
|
+
the durable state: update the body with implementation discoveries, review
|
|
504
|
+
findings, blockers, and decisions instead of relying on chat history.
|
|
505
|
+
|
|
506
|
+
Reusable code patterns live in `.agents/skills/patterns/` (load the `patterns`
|
|
507
|
+
skill for detail). Project agent rules live in `.agents/rules/*.md`
|
|
508
|
+
(plugin-managed rules in `.agents/rules/agile-workflow.md`); do not maintain
|
|
509
|
+
`.claude/rules/*.md` as a source of truth.
|
|
510
|
+
|
|
511
|
+
**Before designing, implementing, or reviewing, read `.agents/rules/*.md`** —
|
|
512
|
+
the project's force-loaded agent rules (tag semantics, test integrity, review
|
|
513
|
+
policy). The agile-workflow hook auto-loads these at session start and after
|
|
514
|
+
compaction; read them directly when working without the hook. Do not rely on
|
|
515
|
+
UserPromptSubmit for rules or queue snapshots; query `work-view` when queue
|
|
516
|
+
state is needed.
|
|
517
|
+
|
|
518
|
+
Project-specific refactor style conventions belong in this file under
|
|
519
|
+
`## Refactor Style Conventions`. Detailed refactor convention references belong
|
|
520
|
+
in `.agents/skills/refactor-conventions/` and extend `refactor-design`'s
|
|
521
|
+
defaults; they do not replace the built-in scan and they do not create
|
|
522
|
+
standalone plan docs.
|
|
523
|
+
|
|
524
|
+
<!-- agile-workflow:end -->
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
Preserve all content outside the markers. If the selected AGENTS target does
|
|
528
|
+
not exist, create it with this section as the whole body. The dense behavioral
|
|
529
|
+
rules (tag semantics, test integrity, advisory review, entry points) no longer
|
|
530
|
+
live here — Phase 6.5 writes them to `.agents/rules/agile-workflow.md`, and the
|
|
531
|
+
slim section above points agents at `.agents/rules/*.md`.
|
|
532
|
+
|
|
533
|
+
**Research-substrate fields are conditional on the `agentic-research` plugin.**
|
|
534
|
+
The frontmatter field list above is agile-workflow's own. Only when the
|
|
535
|
+
`agentic-research` plugin is installed in the target project — its
|
|
536
|
+
`research-orchestrator` / `research-handoff` skills are available, or a
|
|
537
|
+
`.research/` tier already exists — extend the field list to
|
|
538
|
+
`(`kind, stage, tags, parent, depends_on, release_binding, research_refs, research_origin`)`
|
|
539
|
+
and add a one-line pointer to the `.work/` ↔ `.research/` handoff
|
|
540
|
+
(`plugins/agentic-research/docs/HANDOFF.md`). Without that plugin, omit
|
|
541
|
+
`research_refs` / `research_origin` and do not scaffold `.research/` or any
|
|
542
|
+
research docs — they are an optional agentic-research extension. (`work-view`
|
|
543
|
+
parses both fields harmlessly when unset, so an existing `.work/` substrate is
|
|
544
|
+
never broken by their absence; convert simply does not advertise them.)
|
|
545
|
+
|
|
546
|
+
**The `[research]` routing tag + `research_dials:` block are also conditional on
|
|
547
|
+
`agentic-research`.** When that plugin is present (same detection as above), two
|
|
548
|
+
more things land — both **omitted** when it is absent (agile-workflow's core stays
|
|
549
|
+
agentic-research-agnostic):
|
|
550
|
+
|
|
551
|
+
1. **Schema** — also advertise the `research_dials:` block in the field list note: a
|
|
552
|
+
`[research]` item carries the **commissioning subset** of its engagement
|
|
553
|
+
registration in a `research_dials:` nested frontmatter block (the four scoping
|
|
554
|
+
fields: `scope_authority`, `verification_rigor`, `intent`, `output_kind`) read by
|
|
555
|
+
the orchestrator at dispatch, which settles the remaining registration fields then.
|
|
556
|
+
(`work-view` parses only its own known fields and ignores the block harmlessly; it
|
|
557
|
+
is orchestrator-read, not a `work-view` filter dimension.)
|
|
558
|
+
2. **Tag semantics** — append a `[research]` entry to the Phase 6.5 `### Tag
|
|
559
|
+
semantics` section (and pluralize its intro to "A few tags carry load-bearing
|
|
560
|
+
routing semantics — get these right:"), using this block:
|
|
561
|
+
|
|
562
|
+
```markdown
|
|
563
|
+
- **`[research]`** — a grounded research engagement: an *input* that grounds
|
|
564
|
+
other work (a decision, a design, an adoption call), not a shippable
|
|
565
|
+
deliverable. Routes **cross-plugin** to `agentic-research:research-orchestrator`,
|
|
566
|
+
not a design-family skill. The work item carries the **commissioning subset** of
|
|
567
|
+
the engagement registration in a `research_dials:` block (the four scoping fields:
|
|
568
|
+
scope_authority, verification_rigor, intent, output_kind) — **scoping the item IS
|
|
569
|
+
the dispatch act**; the orchestrator reads those dials at kickoff and settles the
|
|
570
|
+
rest at dispatch. A `[research]` item **does not bind to a release** (it is
|
|
571
|
+
an input, not a bundle member) and its verification **gates run inline** in the
|
|
572
|
+
orchestrator (it never reaches `release-deploy`). Routes through `feature-design`
|
|
573
|
+
only as the inert-tag fallback.
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
Without `agentic-research`, leave the Phase 6.5 template at `[refactor]` + `[perf]`.
|
|
577
|
+
|
|
578
|
+
### Phase 6.5: Write `.agents/rules/agile-workflow.md` (rules-first, then slim)
|
|
579
|
+
|
|
580
|
+
The dense agile-workflow behavioral rules live in a plugin-managed
|
|
581
|
+
`.agents/rules/agile-workflow.md`, force-loaded into agent context by the
|
|
582
|
+
agile-workflow SessionStart/PostCompact hook path (and read directly by the
|
|
583
|
+
design/implement/review skills' grounding). **Write and verify this file BEFORE
|
|
584
|
+
writing the slim AGENTS section
|
|
585
|
+
(Phase 6).** The slim section overwrites the managed AGENTS block, so the rules
|
|
586
|
+
must already exist at their new home or the dense content is lost.
|
|
587
|
+
|
|
588
|
+
1. `mkdir -p .agents/rules` and write `.agents/rules/agile-workflow.md`. Refresh
|
|
589
|
+
only the content between the markers on sync; preserve anything outside them
|
|
590
|
+
and every other `.agents/rules/*.md` (user-owned rules):
|
|
591
|
+
|
|
592
|
+
```markdown
|
|
593
|
+
<!-- agile-workflow:rules:start -->
|
|
594
|
+
## Agile-Workflow Rules
|
|
595
|
+
|
|
596
|
+
### Tag semantics
|
|
597
|
+
|
|
598
|
+
The `tags` field on items routes them to the right design skill. One tag has
|
|
599
|
+
load-bearing semantics — get this one right:
|
|
600
|
+
|
|
601
|
+
- **`[refactor]`** — behavior-preserving structural change ONLY. Apply the
|
|
602
|
+
black-box test: would any observable behavior change for a caller of the
|
|
603
|
+
public surface? If yes, this is NOT a refactor — drop the tag and let the
|
|
604
|
+
item route through `feature-design`.
|
|
605
|
+
- Counts as refactor: extract a helper to dedupe, split a god file, rename
|
|
606
|
+
for clarity, remove dead code, inline a one-call abstraction.
|
|
607
|
+
- Does NOT count as refactor (even if it feels "structural"): change an API
|
|
608
|
+
signature, swap a storage backend with different consistency guarantees,
|
|
609
|
+
replace a silent failure with an explicit error, split a function in a
|
|
610
|
+
way that changes call-site contracts, "major rework of X."
|
|
611
|
+
- **`[perf]`** — performance work. Routes to `perf-design`.
|
|
612
|
+
|
|
613
|
+
All other tags are project-specific (see `.work/CONVENTIONS.md`) and do not
|
|
614
|
+
affect skill routing.
|
|
615
|
+
|
|
616
|
+
### Test integrity
|
|
617
|
+
|
|
618
|
+
When running, writing, or modifying tests:
|
|
619
|
+
|
|
620
|
+
- **File real production bugs as backlog items.** When a test failure
|
|
621
|
+
surfaces an actual product bug (not a stale fixture, drifted assertion,
|
|
622
|
+
or broken mock), park it via `/agile-workflow:park` instead of silently
|
|
623
|
+
fixing it inline mid-test-pass. The backlog item is the audit trail.
|
|
624
|
+
- **Fix bad tests in-session.** Stale fixtures, drifted assertions, broken
|
|
625
|
+
mocks, and outdated snapshots are test debt, not product bugs. Repair
|
|
626
|
+
them as you go so the suite stays meaningful.
|
|
627
|
+
- **Then drain small backlog bugs with a full pass.** Once tests are
|
|
628
|
+
green again, if a parked production bug is small enough for a single
|
|
629
|
+
stride, pick it up immediately as `/agile-workflow:scope` → design →
|
|
630
|
+
implement. Larger bugs stay in backlog for prioritization.
|
|
631
|
+
- **NEVER game a test to make it pass.** A failing test that documents
|
|
632
|
+
*why* it fails — an inline comment naming the bug, a `skip` linked to a
|
|
633
|
+
backlog id, an `xfail` with a reason — is more honest than a green test
|
|
634
|
+
that lies. No `expect(true).toBe(true)`, no asserting on whatever the
|
|
635
|
+
code happens to return, no deleting a test as "flaky" without
|
|
636
|
+
root-causing first.
|
|
637
|
+
|
|
638
|
+
Cross-model advisory review: explicit user/project review instructions
|
|
639
|
+
override agile-workflow defaults. When peeragent is available with a different
|
|
640
|
+
model class, large/risky autopilot design decisions may use one advisory pass;
|
|
641
|
+
small/low-risk work skips it. Autopilot also runs a final peer-review loop
|
|
642
|
+
before reporting completion and fixes or files accepted findings first.
|
|
643
|
+
Same-model peers fall back to local sub-agents instead. Claude Opus peeragent
|
|
644
|
+
calls can take 10 to 30 minutes on large reviews; no return after a few minutes
|
|
645
|
+
is not evidence that the call has hung.
|
|
646
|
+
|
|
647
|
+
Broad entry points:
|
|
648
|
+
`/agile-workflow:ideate`, `/agile-workflow:epicize`,
|
|
649
|
+
autopilot goals such as "Use agile-workflow autopilot to drain --all",
|
|
650
|
+
and `/agile-workflow:release-deploy`.
|
|
651
|
+
<!-- agile-workflow:rules:end -->
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
2. **Verify before slimming** (the content-integrity gate, Phase 1.8, applied to
|
|
655
|
+
this managed-section overwrite — content verification, NOT just a non-empty +
|
|
656
|
+
end-marker check): confirm `.agents/rules/agile-workflow.md` exists AND that the
|
|
657
|
+
dense rule content the slim removes from AGENTS actually landed there — each
|
|
658
|
+
section is present (`### Tag semantics`, `### Test integrity`, the
|
|
659
|
+
advisory-review paragraph, and Broad entry points), or recompute per the Phase
|
|
660
|
+
1.8 provenance check. Only when the content is verified present do you write or
|
|
661
|
+
refresh the slim AGENTS section (Phase 6), overwriting the managed AGENTS block.
|
|
662
|
+
If verification fails, halt without touching the AGENTS section — the project
|
|
663
|
+
keeps its current (full) section intact (no data loss).
|
|
664
|
+
|
|
665
|
+
User-owned and legacy rule prose (e.g. non-pattern `.claude/rules/*` content)
|
|
666
|
+
goes into a separate user-owned `.agents/rules/<name>.md` (e.g. `project.md`),
|
|
667
|
+
never inside the plugin `agile-workflow:rules` markers. The SessionStart and
|
|
668
|
+
host-supported PostCompact hook paths inject every `.agents/rules/*.md`, so both
|
|
669
|
+
plugin and user rules reach the agent without prompt-time fallback output.
|
|
670
|
+
|
|
671
|
+
### Phase 7: Preserve Claude Code compatibility
|
|
672
|
+
|
|
673
|
+
The canonical instruction file (Phase 2.5) is canonical. The *other* entrypoints
|
|
674
|
+
are compatibility pointers and should not become independent copies.
|
|
675
|
+
|
|
676
|
+
**`entrypoint_model: claude-source` carve-out.** When the user chose to keep
|
|
677
|
+
`CLAUDE.md` as the content source, `CLAUDE.md` IS the canonical instruction file
|
|
678
|
+
and root `AGENTS.md` is its pointer (created in Phase 2.5). In this mode, do NOT
|
|
679
|
+
migrate `CLAUDE.md` into AGENTS, do NOT replace `CLAUDE.md` with a symlink, and
|
|
680
|
+
do NOT import its content elsewhere — the managed section and conventions were
|
|
681
|
+
written into `CLAUDE.md` itself. Still normalize any *nested* Claude duplicates
|
|
682
|
+
(`.claude/CLAUDE.md`, `.agents/CLAUDE.md`) to point at `CLAUDE.md` —
|
|
683
|
+
content-integrity gate first, so a nested duplicate carrying unique content not
|
|
684
|
+
already in `CLAUDE.md` is preserved, not replaced. Skip the rest of this phase's
|
|
685
|
+
root-`CLAUDE.md` handling.
|
|
686
|
+
|
|
687
|
+
In the default `agents-canonical` mode, handle every detected Claude candidate
|
|
688
|
+
(`CLAUDE.md`, `.claude/CLAUDE.md`, `.agents/CLAUDE.md`) as follows:
|
|
689
|
+
|
|
690
|
+
1. If the file is already a symlink to the selected AGENTS target or to root
|
|
691
|
+
`AGENTS.md`, leave it alone.
|
|
692
|
+
2. If it exists as a regular file, read it before touching it.
|
|
693
|
+
- If it contains an old agile-workflow marked section, migrate that section's
|
|
694
|
+
current content into the selected AGENTS target only when it contains user
|
|
695
|
+
edits not already present there.
|
|
696
|
+
- Preserve non-agile Claude instructions by importing them into the selected
|
|
697
|
+
AGENTS target under a short `## Imported Claude Code Instructions` heading,
|
|
698
|
+
unless the same content is already present.
|
|
699
|
+
- After import, replace the Claude file with a symlink to the selected
|
|
700
|
+
AGENTS target only when `cleanup_scope` allows generated cleanup or the
|
|
701
|
+
user confirms that exact path, **and only after the content-integrity gate
|
|
702
|
+
(Phase 1.8) confirms every imported block landed** (presence + provenance +
|
|
703
|
+
anchors). Otherwise leave it in place and report the duplicate entrypoint.
|
|
704
|
+
3. If symlink creation is unavailable or unsafe in the environment, write this
|
|
705
|
+
shim instead only when the same cleanup authorization exists. Otherwise leave
|
|
706
|
+
the file in place and report it as a duplicate entrypoint:
|
|
707
|
+
|
|
708
|
+
```markdown
|
|
709
|
+
# Claude Code Instructions
|
|
710
|
+
|
|
711
|
+
Canonical agent instructions live in AGENTS.md. Read that file.
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
The sync path follows the same rule: refresh the canonical instruction file's
|
|
715
|
+
managed section in place, then keep the other entrypoint pointing at it through a
|
|
716
|
+
symlink or shim — in the direction set by `entrypoint_model` (default
|
|
717
|
+
`CLAUDE.md`→`AGENTS.md`; `claude-source` keeps `AGENTS.md`→`CLAUDE.md`). In
|
|
718
|
+
`claude-source`, refreshing `CLAUDE.md`'s managed section in place is expected;
|
|
719
|
+
what never happens is migrating its content out or replacing the file with a
|
|
720
|
+
pointer.
|
|
721
|
+
|
|
722
|
+
Handle every legacy `.claude/rules/*.md` file (not just `patterns.md`) as a
|
|
723
|
+
legacy Claude rules file, not a compatibility entrypoint. Build the **Phase 1.8
|
|
724
|
+
block-level preservation manifest** for it and route each block by classification
|
|
725
|
+
(see Phase 2.5 and the DIY→canonical mapping in the reference) — do not dump it
|
|
726
|
+
wholesale into AGENTS:
|
|
727
|
+
|
|
728
|
+
1. For each block of a regular-file rules file not already present at its
|
|
729
|
+
canonical destination (`landed_existing`):
|
|
730
|
+
- **Structural-pattern blocks** (chiefly in `patterns.md`) → import via the
|
|
731
|
+
**convert-owned verbatim legacy-pattern importer** below. State after this
|
|
732
|
+
step: `landed_this_run`.
|
|
733
|
+
- **Rule-prose blocks** (the common case for other rules files) → write to
|
|
734
|
+
`.agents/rules/<name>.md` (default `project.md`; NEVER `patterns.md`, which is
|
|
735
|
+
reserved for gate-patterns' generated digest, and NEVER `agile-workflow.md`,
|
|
736
|
+
which is plugin-managed) as user-owned rules the hook
|
|
737
|
+
force-loads — under a short `## Imported Claude Rules` heading, OUTSIDE the
|
|
738
|
+
plugin `agile-workflow:rules` markers. NOT the AGENTS canonical file.
|
|
739
|
+
- **Ambiguous blocks** → `preserved_in_place`; leave them in the source.
|
|
740
|
+
|
|
741
|
+
**Convert-owned verbatim legacy-pattern importer (NO discovery filter).**
|
|
742
|
+
`gate-patterns` is a *discovery* writer: its sub-agent only emits patterns
|
|
743
|
+
that recur 3+ times in the bundle, and it explicitly says legacy
|
|
744
|
+
`.claude/rules/patterns.md` is convert's job — so routing legacy patterns
|
|
745
|
+
"through gate-patterns Phase 1" would silently drop single-use and two-use
|
|
746
|
+
legacy patterns. Convert therefore owns the lossless *import* of existing
|
|
747
|
+
patterns, reusing only gate-patterns' file/index **format**:
|
|
748
|
+
- For each structural-pattern block, write
|
|
749
|
+
`.agents/skills/patterns/<slug>.md` verbatim in the gate-patterns
|
|
750
|
+
Phase 4 file format (the pattern body — name, rationale, examples, when to
|
|
751
|
+
use / not use, common violations — everything except the `Index entry`
|
|
752
|
+
line). Apply **no 3+-occurrence filter**: every legacy pattern is imported,
|
|
753
|
+
regardless of how many times it occurs.
|
|
754
|
+
- Append the source-block provenance comment
|
|
755
|
+
(`<!-- agile-workflow:provenance src-sha256=<digest> -->`) so the
|
|
756
|
+
content-integrity gate can verify the import landed.
|
|
757
|
+
- Update `.agents/skills/patterns/SKILL.md` (the index) per gate-patterns
|
|
758
|
+
Phase 5, merging the new entries with any existing ones; never duplicate an
|
|
759
|
+
entry already indexed.
|
|
760
|
+
- gate-patterns remains the discovery writer for NEW patterns found in
|
|
761
|
+
release bundles; convert owns lossless import of EXISTING legacy ones.
|
|
762
|
+
2. **Content-integrity gate before any shim/removal.** Replacing the rules file
|
|
763
|
+
with the shim below is a source-eliminating op, so the content-integrity gate
|
|
764
|
+
(Phase 1.8) permits it only when **every** user block is `landed_*` (any
|
|
765
|
+
`preserved_in_place` or `ambiguous` block keeps the file in place, unshimmed),
|
|
766
|
+
AND `cleanup_scope` allows generated cleanup or the user confirms that exact
|
|
767
|
+
path, AND the reference-integrity check (Phase 1.8) has rewritten or shimmed any
|
|
768
|
+
inbound references. **`patterns.md` carve-out:** `patterns.md` is NEVER
|
|
769
|
+
treated as "generated cleanup" — its content is user/legacy data, so the
|
|
770
|
+
`generated-only` shortcut does NOT authorize shimming it. Shim `patterns.md`
|
|
771
|
+
only under explicit per-path user confirmation, AFTER the content-integrity
|
|
772
|
+
gate passes. If any block is `ambiguous`/`unsafe`, leave the whole file in
|
|
773
|
+
place and report it.
|
|
774
|
+
|
|
775
|
+
```markdown
|
|
776
|
+
# Pattern Rules
|
|
777
|
+
|
|
778
|
+
Reusable code patterns now live in `.agents/skills/patterns/` (load the
|
|
779
|
+
`patterns` skill for detail). Project agent rules live in
|
|
780
|
+
`.agents/rules/*.md`. Read those.
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
3. If the file is already a symlink or shim that points to the canonical
|
|
784
|
+
destinations, verify the target exists and is non-dangling, then leave it
|
|
785
|
+
alone (do not re-migrate the shim's pointer text as content).
|
|
786
|
+
|
|
787
|
+
### Phase 8: Per-shape migration
|
|
788
|
+
|
|
789
|
+
Per the matrix in MIGRATION.md, seed initial items:
|
|
790
|
+
|
|
791
|
+
#### Path A — workflow-plugin
|
|
792
|
+
|
|
793
|
+
**Per-design stage classification** (NOT a binary "active vs completed" split).
|
|
794
|
+
For each `docs/designs/<name>.md` AND each `docs/designs/completed/<name>.md`,
|
|
795
|
+
read the design body and `git log -- <path>` to infer state, then classify it
|
|
796
|
+
into one of five buckets:
|
|
797
|
+
|
|
798
|
+
| Bucket | Substrate placement | Frontmatter |
|
|
799
|
+
|---|---|---|
|
|
800
|
+
| `done-shipped` | `.work/releases/v0/feature-<name>.md` | `kind: feature, stage: done, release_binding: v0` |
|
|
801
|
+
| `done-archived` | `.work/archive/feature-<name>.md` | `kind: feature, stage: done` |
|
|
802
|
+
| `review` | `.work/active/features/feature-<name>.md` | `kind: feature, stage: review` |
|
|
803
|
+
| `implementing` | `.work/active/features/feature-<name>.md` | `kind: feature, stage: implementing` |
|
|
804
|
+
| `drafting` | `.work/active/features/feature-<name>.md` | `kind: feature, stage: drafting` |
|
|
805
|
+
|
|
806
|
+
Heuristics for inferred default (use these to pre-fill the per-design ask):
|
|
807
|
+
- In `docs/designs/completed/`, recent git activity, no obvious uncommitted
|
|
808
|
+
follow-up → `done-shipped`
|
|
809
|
+
- In `docs/designs/completed/`, stale, no real adoption signal → `done-archived`
|
|
810
|
+
- In `docs/designs/`, code exists for it but tests/PRs pending → `review`
|
|
811
|
+
- In `docs/designs/`, code partially landed → `implementing`
|
|
812
|
+
- In `docs/designs/`, no code yet → `drafting`
|
|
813
|
+
|
|
814
|
+
Ask the user to confirm/edit the classification per design via structured question tool
|
|
815
|
+
(group designs by inferred bucket if there are many, to keep the question count
|
|
816
|
+
under 4-options-per-call). The body of each new feature item = the original
|
|
817
|
+
design content.
|
|
818
|
+
|
|
819
|
+
If the user picks any `done-shipped` items, also create
|
|
820
|
+
`.work/releases/v0/release-v0.md` at `stage: released` to bind them.
|
|
821
|
+
|
|
822
|
+
**Terminal retention applies to seeding.** When `terminal-tier retention: delete-refs` (the
|
|
823
|
+
default), seed terminal buckets as refs, not full bodies: `done-archived` → a bodyless stub
|
|
824
|
+
(frontmatter + `# Title` + `git_ref` + `archived_atop`, per the review skill's stub shape; compute
|
|
825
|
+
`archived_atop` per the SPEC "`archived_atop` computation" — latest released tag at the item's
|
|
826
|
+
archival, else `pre-release`); `done-shipped` → a row in the single `release-v0.md` summary table
|
|
827
|
+
(id, title, kind, `archived_atop`, git ref), not a per-item file. Only `retain-bodies` keeps full
|
|
828
|
+
bodies.
|
|
829
|
+
|
|
830
|
+
**Sync existing substrates to delete-refs.** When converting/syncing a repo that already uses the
|
|
831
|
+
substrate and `delete-refs` is selected, detect retained full-body terminal items — full bodies in
|
|
832
|
+
`.work/archive/*.md` and `.work/releases/<version>/<id>.md` (anything beyond the
|
|
833
|
+
`release-<version>.md` summary) — and **offer** (structured question tool; never force) to prune them to
|
|
834
|
+
current practice. The prune ALSO stamps `archived_atop`:
|
|
835
|
+
|
|
836
|
+
- archived bodies → bodyless stubs. Capture each `git_ref` from `git log -- <path>`. Stamp
|
|
837
|
+
`archived_atop` from history: the latest release that existed at the commit where the item reached
|
|
838
|
+
`done`/was archived (the newest release tag — or `.work/releases/<version>/` summary — reachable
|
|
839
|
+
from `git log -- <path>`'s last touching commit), else `pre-release`. Stamp once; if a stub already
|
|
840
|
+
carries `archived_atop`, preserve it.
|
|
841
|
+
- released bodies → folded into their `release-<version>.md` summary table (with their `archived_atop`
|
|
842
|
+
column, `—` if unknowable from history), then `git rm`.
|
|
843
|
+
|
|
844
|
+
Preserve-only stays the default per convert's posture.
|
|
845
|
+
|
|
846
|
+
**Converge a bespoke "Done-item archival" convention.** A repo may already carry a hand-rolled
|
|
847
|
+
`## Done-item archival` (or similarly named) section in `.work/CONVENTIONS.md` describing
|
|
848
|
+
`archived_atop` late-binding. Detect it; do NOT duplicate it alongside the merged
|
|
849
|
+
`Terminal-tier retention` convention. Offer (structured question tool; never force) to **converge** it: fold
|
|
850
|
+
its semantics into the one merged `Terminal-tier retention` section and remove the bespoke section,
|
|
851
|
+
preserving any project-specific rules it carried (custom in-body markers, date metadata, etc.) by
|
|
852
|
+
routing them to a user-owned `.agents/rules/<name>.md` rather than dropping them. The
|
|
853
|
+
content-integrity gate (Phase 1.8) applies before removing the bespoke section.
|
|
854
|
+
|
|
855
|
+
For `docs/ROADMAP.md` phases:
|
|
856
|
+
1. Each phase becomes an epic at `.work/active/epics/epic-phase-<n>-<slug>.md`.
|
|
857
|
+
2. Stage inference from per-design classifications: if every child design under
|
|
858
|
+
the phase is at `done-*`, the epic is at `stage: done` and goes to
|
|
859
|
+
`.work/archive/epics/`. If any child is `implementing` or `review`, epic is
|
|
860
|
+
at `stage: implementing`. Otherwise `stage: drafting`.
|
|
861
|
+
3. Phase ordering becomes `depends_on` chains (phase 2 depends on phase 1, etc.).
|
|
862
|
+
4. Confirm with the user via structured question tool before committing.
|
|
863
|
+
|
|
864
|
+
For `docs/PROGRESS.md` deviation logs: fold notes into relevant items' bodies.
|
|
865
|
+
|
|
866
|
+
By default, leave alone: `docs/designs/`, `docs/designs/completed/`,
|
|
867
|
+
`docs/ROADMAP.md`, `docs/PROGRESS.md`. They become legacy history.
|
|
868
|
+
|
|
869
|
+
If `cleanup_scope: legacy-cleanup`, build a separate cleanup plan after item
|
|
870
|
+
creation:
|
|
871
|
+
|
|
872
|
+
1. List the exact legacy paths that are fully represented in `.work/`.
|
|
873
|
+
2. Ask the user whether to keep, move, or delete them.
|
|
874
|
+
3. Apply only the confirmed path actions, and only after the content-integrity
|
|
875
|
+
gate (Phase 1.8) confirms each path's content is preserved at its destination
|
|
876
|
+
(the seeded `.work/` items here) and the reference-integrity check clears the
|
|
877
|
+
move. Prefer `git mv` when the user wants a retained legacy copy; use
|
|
878
|
+
`git rm` only for paths explicitly chosen for deletion.
|
|
879
|
+
|
|
880
|
+
#### Path B — ad-hoc
|
|
881
|
+
|
|
882
|
+
For each `- [ ]` line in `TODO.md` / `BACKLOG.md`: create
|
|
883
|
+
`.work/backlog/idea-<slug>.md` with minimal frontmatter and body = the line text.
|
|
884
|
+
|
|
885
|
+
For each section heading or file in `NOTES.md` / `tasks/`: create
|
|
886
|
+
`.work/backlog/idea-<slug>.md` with body = the section/file content.
|
|
887
|
+
|
|
888
|
+
`- [x]` lines are reported but not seeded by default (offer to user).
|
|
889
|
+
|
|
890
|
+
No epic decomposition or dependency inference. User runs `/agile-workflow:epicize`
|
|
891
|
+
afterward.
|
|
892
|
+
|
|
893
|
+
#### Path C — no-tracking
|
|
894
|
+
|
|
895
|
+
Bootstrap an empty `.work/` skeleton. Optionally seed sparse backlog from recent
|
|
896
|
+
`git log` activity if the user opts in:
|
|
897
|
+
|
|
898
|
+
> "Found 3 areas with recent commits: src/auth (12), src/payments (8), src/admin
|
|
899
|
+
> (3). Seed any as backlog ideas to revisit?"
|
|
900
|
+
|
|
901
|
+
#### Path D — greenfield
|
|
902
|
+
|
|
903
|
+
Bootstrap empty `.work/`. Suggest running `/agile-workflow:epicize` next to seed
|
|
904
|
+
epics from the foundation docs.
|
|
905
|
+
|
|
906
|
+
### Phase 8.5: Capture in-flight working-tree work
|
|
907
|
+
|
|
908
|
+
Skip if Phase 1.6's `git status --porcelain` count was ≤ 5 (small changes go
|
|
909
|
+
into the bootstrap commit itself).
|
|
910
|
+
|
|
911
|
+
Otherwise, capture the in-flight code as substrate items so autopilot has
|
|
912
|
+
something to drain after bootstrap:
|
|
913
|
+
|
|
914
|
+
1. **Cluster** the changed files. Start with path grouping plus `git diff
|
|
915
|
+
--stat`; if the changed set is still small enough to inspect directly, read
|
|
916
|
+
the relevant diffs yourself. For large or unclear sets, use a read-only
|
|
917
|
+
exploratory sub-agent: "Categorize these <N> files into 1-5 coherent feature
|
|
918
|
+
buckets by path, imports, and diff content. Report each as slug +
|
|
919
|
+
one-paragraph description + file list." Pass `git status --porcelain` and
|
|
920
|
+
`git diff --stat` as the sub-agent's context rather than dumping many full
|
|
921
|
+
diffs into the prompt.
|
|
922
|
+
2. **Confirm with the user** via structured question tool (groups of 2-4 buckets if
|
|
923
|
+
there are many). Allow merge / split / rename.
|
|
924
|
+
3. **Scope each cluster** as `.work/active/features/feature-<slug>.md` with
|
|
925
|
+
`kind: feature, stage: implementing`, body = brief + "Files in this
|
|
926
|
+
cluster" list + "Design captured retroactively from existing code". No
|
|
927
|
+
parent or deps unless obvious.
|
|
928
|
+
4. **Bootstrap commit stays substrate-only** — don't commit the working-tree
|
|
929
|
+
code yet. `implement`'s land mode (Phase 4a) handles validate-commit-advance
|
|
930
|
+
per cluster after bootstrap.
|
|
931
|
+
|
|
932
|
+
### Phase 8.6: Converge bespoke overlaps
|
|
933
|
+
|
|
934
|
+
For each artifact in the `converge` set chosen in Phase 1.8, migrate it to its
|
|
935
|
+
canonical destination (DIY→canonical mapping in the reference), deferring to the
|
|
936
|
+
owning skill for layout:
|
|
937
|
+
|
|
938
|
+
- **Pattern-mirroring skills** (`extract-patterns`, bespoke `patterns`) →
|
|
939
|
+
import their pattern definitions into `.agents/skills/patterns/` via the
|
|
940
|
+
**convert-owned verbatim legacy-pattern importer** (Phase 7) — verbatim, in
|
|
941
|
+
the gate-patterns file/index format, with NO 3+-occurrence discovery filter.
|
|
942
|
+
Do NOT route them "through gate-patterns Phase 1" (its discovery filter would
|
|
943
|
+
drop legacy single-use patterns). Keep an optional `.claude/skills/patterns/`
|
|
944
|
+
symlink mirror.
|
|
945
|
+
- **Refactor-mirroring skills** (`structural-refactor`, `stylistic-refactor`,
|
|
946
|
+
bespoke `refactor-conventions`) → split into AGENTS
|
|
947
|
+
`## Refactor Style Conventions` (style rules) and
|
|
948
|
+
`.agents/skills/refactor-conventions/` (detailed references) per
|
|
949
|
+
`refactor-conventions-creator` Phase 5; drop any standalone-plan-doc
|
|
950
|
+
instruction.
|
|
951
|
+
- **`plugin-mirror-divergent-copy` entries** → reconcile unique content into
|
|
952
|
+
the `.agents` canonical, then re-establish the `.claude` mirror as a symlink.
|
|
953
|
+
|
|
954
|
+
Removing or replacing the bespoke source path is a destructive action governed
|
|
955
|
+
by the **content-integrity gate (Phase 1.8)**: build the block-level manifest
|
|
956
|
+
for the source, import its content, then **verify the import actually landed**
|
|
957
|
+
(presence + provenance digest + semantic anchors per the block-level
|
|
958
|
+
preservation manifest) BEFORE removing the source. Only after the gate passes, apply the reference-integrity-on-move
|
|
959
|
+
procedure (grep for inbound references — especially `.work/` items and `docs/` —
|
|
960
|
+
then rewrite or shim), and only then remove the original when `cleanup_scope`
|
|
961
|
+
allows it and the exact path is confirmed. If verification fails or any block is
|
|
962
|
+
ambiguous, write the canonical copy and leave the bespoke source in place,
|
|
963
|
+
reporting the duplication. If a converged artifact backed a user-invocable
|
|
964
|
+
command, note in `MIGRATION_REPORT.md` that the command is superseded.
|
|
965
|
+
|
|
966
|
+
### Phase 9: Write MIGRATION_REPORT.md
|
|
967
|
+
|
|
968
|
+
Write `MIGRATION_REPORT.md` at the repo root (NOT in `docs/`) per the format in
|
|
969
|
+
MIGRATION.md. Include: source shape, foundation docs detected (preserved), items
|
|
970
|
+
seeded by tier, the classified artifact inventory from Phase 1.7, entrypoint
|
|
971
|
+
model chosen, bespoke overlaps converged (with their canonical destinations and
|
|
972
|
+
any superseded commands), reference-integrity actions (paths moved/removed,
|
|
973
|
+
references found, rewritten vs shimmed), cleanup scope, files left in place,
|
|
974
|
+
cleanup actions taken, conventions chosen, next steps.
|
|
975
|
+
|
|
976
|
+
### Phase 10: Commit
|
|
977
|
+
|
|
978
|
+
Single git commit:
|
|
979
|
+
|
|
980
|
+
```bash
|
|
981
|
+
git add .work/ AGENTS.md .agents/AGENTS.md .claude/AGENTS.md CLAUDE.md .claude/CLAUDE.md .agents/CLAUDE.md .agents/rules/ MIGRATION_REPORT.md
|
|
982
|
+
# If a legacy rules shim was created or updated:
|
|
983
|
+
git add .claude/rules/
|
|
984
|
+
# If Phase 8.6 converged bespoke overlaps into the canonical catalogs:
|
|
985
|
+
git add .agents/skills/patterns .claude/skills/patterns .agents/skills/refactor-conventions .claude/skills/refactor-conventions
|
|
986
|
+
# If reference-integrity rewrote inbound references in existing items/docs:
|
|
987
|
+
git add .work/ docs/
|
|
988
|
+
# If cleanup was explicitly confirmed for exact paths:
|
|
989
|
+
git add -A <confirmed-cleanup-paths>
|
|
990
|
+
git commit -m "chore: bootstrap agile-workflow substrate"
|
|
991
|
+
```
|
|
992
|
+
|
|
993
|
+
User reverts via `git revert HEAD` if anything looks wrong. Source files are
|
|
994
|
+
preserved across all paths unless the user explicitly opted into cleanup and
|
|
995
|
+
confirmed exact paths.
|
|
996
|
+
|
|
997
|
+
## Sync Workflow
|
|
998
|
+
|
|
999
|
+
Entered via auto-detection when `.work/` exists, or explicitly via `--update`.
|
|
1000
|
+
Non-destructive by default — refreshes plugin-shipped artifacts and reports
|
|
1001
|
+
drift. Sync runs the same Phase 1.7 discovery sweep and Phase 1.8 decisions
|
|
1002
|
+
checkpoint as bootstrap; convergence and cleanup run only when those steps put
|
|
1003
|
+
them in scope.
|
|
1004
|
+
|
|
1005
|
+
### Phase S1: Audit substrate health
|
|
1006
|
+
|
|
1007
|
+
Re-use the marker checks from Phase 1.5 and the **classified artifact
|
|
1008
|
+
inventory** from the Phase 1.7 discovery sweep (do not re-derive from a fixed
|
|
1009
|
+
path list), plus deeper checks:
|
|
1010
|
+
|
|
1011
|
+
- All five markers (`substrate_root`, `conventions`, `managed_section`,
|
|
1012
|
+
`entrypoint_compat`, `work_view`) — present or missing
|
|
1013
|
+
- Legacy `.claude/rules/patterns.md` — absent, shimmed to AGENTS, or containing
|
|
1014
|
+
importable legacy content (route by content type per Phase 2.5)
|
|
1015
|
+
- Every skill-root entry from the Phase 1.7 sweep, carried with its taxonomy
|
|
1016
|
+
bucket (`canonical` / `plugin-mirror-symlink` / `plugin-mirror-divergent-copy`
|
|
1017
|
+
/ `bespoke` / `unrelated`). Pay attention to `plugin-mirror-divergent-copy` —
|
|
1018
|
+
drifted duplicates in both `.agents` and `.claude` — and to `bespoke` overlaps
|
|
1019
|
+
that are convergence candidates, not just the canonical `patterns` and
|
|
1020
|
+
`refactor-conventions` catalogs. `unrelated` project skills are left untouched.
|
|
1021
|
+
- Cleanup candidates, `entrypoint_model`, `converge` set, and `cleanup_scope`
|
|
1022
|
+
from Phase 1.8
|
|
1023
|
+
- For each plugin-shipped artifact that IS present, compare its content against
|
|
1024
|
+
the version in the current plugin source:
|
|
1025
|
+
- The selected AGENTS target section between `<!-- agile-workflow:start -->` /
|
|
1026
|
+
`<!-- agile-workflow:end -->` vs the canonical (slim) template in Phase 6. If
|
|
1027
|
+
the section still carries the OLD dense prose inline (`### Tag semantics`,
|
|
1028
|
+
`### Test integrity`, the advisory-review paragraph), classify it
|
|
1029
|
+
`drift_plugin` "needs extraction" — Phase S3 migrates that prose to
|
|
1030
|
+
`.agents/rules/agile-workflow.md` (rules-first, then slim) without loss.
|
|
1031
|
+
- `.agents/rules/agile-workflow.md` between `<!-- agile-workflow:rules:start -->`
|
|
1032
|
+
/ `<!-- agile-workflow:rules:end -->` vs the Phase 6.5 template — `missing`
|
|
1033
|
+
(install), `match` (skip), or `drift_plugin` (refresh the marker block only,
|
|
1034
|
+
preserving out-of-marker and other `.agents/rules/*.md`).
|
|
1035
|
+
- `.work/bin/work-view` — check existence and executability first (the
|
|
1036
|
+
`work_view` doctor marker). If `.work/bin/work-view` is absent or not
|
|
1037
|
+
executable, classify as `missing` and re-run the installer. If it exists and
|
|
1038
|
+
is executable, run `.work/bin/work-view --version` and compare its last token
|
|
1039
|
+
to the plugin version from
|
|
1040
|
+
`${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/.claude-plugin/plugin.json`. If
|
|
1041
|
+
`--version` is unrecognized, empty, non-zero, or reports a different
|
|
1042
|
+
version, classify as `drift_plugin` and re-run the installer (this catches
|
|
1043
|
+
pre-versioning and stale plugin copies). If `--version` matches the plugin
|
|
1044
|
+
version, classify as `match`. Compare `--version`, never bytes; the
|
|
1045
|
+
source-stamped version is the freshness signal.
|
|
1046
|
+
- `CLAUDE.md` compatibility state (symlink/shim/legacy copy)
|
|
1047
|
+
- `.claude/rules/patterns.md` state (legacy content vs AGENTS shim)
|
|
1048
|
+
- `.work/CONVENTIONS.md` load-bearing tag entries (see below). The rest of
|
|
1049
|
+
CONVENTIONS is user-owned and untouched.
|
|
1050
|
+
- `.work/CONVENTIONS.md` **Terminal-tier retention** state (the merged convention — see
|
|
1051
|
+
"Terminal-tier retention drift" below). The per-project CONVENTIONS template is **value-only** (a
|
|
1052
|
+
`## Terminal-tier retention` heading + a bare `delete-refs`/`retain-bodies` value); the merged
|
|
1053
|
+
prose lives in SPEC.md, never duplicated per project. Classify it `missing` (no section/value at
|
|
1054
|
+
all — a real gap on repos converted before this convention existed), `match` (a bare
|
|
1055
|
+
`delete-refs`/`retain-bodies` value — the canonical value-only form), or `partial` only when the
|
|
1056
|
+
value is absent under the heading or contradictory/bespoke. Also detect a bespoke
|
|
1057
|
+
`## Done-item archival` (or similarly named) section that duplicates the merged model; flag it as
|
|
1058
|
+
a convergence candidate.
|
|
1059
|
+
- `.agents/skills/refactor-conventions/SKILL.md` wrapper shape when present:
|
|
1060
|
+
current catalog shape vs old generated template that writes standalone
|
|
1061
|
+
`.md` refactoring plans. Rule reference files are user-owned.
|
|
1062
|
+
- `.claude/skills/patterns/` and `.claude/skills/refactor-conventions/`
|
|
1063
|
+
mirror state: absent, symlink to `.agents`, byte-for-byte mirror, or
|
|
1064
|
+
divergent copy.
|
|
1065
|
+
|
|
1066
|
+
**Load-bearing tag drift in CONVENTIONS.md.** CONVENTIONS is user-owned, but a
|
|
1067
|
+
narrow subset of its content — the entries for routing tags (`refactor`,
|
|
1068
|
+
`perf`) — has plugin-defined semantics. When those entries match a known prior
|
|
1069
|
+
plugin default verbatim, treat them as plugin-shipped drift candidates.
|
|
1070
|
+
|
|
1071
|
+
Known prior defaults to recognize:
|
|
1072
|
+
- `refactor structural cleanup, no behavior change` (verbatim, any leading
|
|
1073
|
+
`- `)
|
|
1074
|
+
- `refactor structural cleanup` (older terser variant)
|
|
1075
|
+
- `perf throughput, latency, memory` (without the routing note)
|
|
1076
|
+
|
|
1077
|
+
Detection rule for each load-bearing tag line:
|
|
1078
|
+
- Line matches a known prior default verbatim → `drift_plugin` (offer refresh)
|
|
1079
|
+
- Line is user-customized (any divergence from known defaults) → `match`
|
|
1080
|
+
(treat as intentional; do not touch)
|
|
1081
|
+
- Line is absent entirely → `missing` (offer to add the canonical entry)
|
|
1082
|
+
|
|
1083
|
+
The current canonical entries live in `docs/SPEC.md` under
|
|
1084
|
+
"`.work/CONVENTIONS.md` → Tag taxonomy" and must be kept in sync with that
|
|
1085
|
+
template.
|
|
1086
|
+
|
|
1087
|
+
**Terminal-tier retention drift in CONVENTIONS.md.** This was a real gap: sync historically neither
|
|
1088
|
+
seeded nor offered the terminal-retention convention, so repos converted before it existed silently
|
|
1089
|
+
lack it. The per-project CONVENTIONS form is **value-only** — a `## Terminal-tier retention` heading
|
|
1090
|
+
plus a bare `delete-refs`/`retain-bodies` value. The merged prose (archival + `archived_atop`
|
|
1091
|
+
late-binding + one-summary release) lives in SPEC.md and is the single source of truth; it is NOT
|
|
1092
|
+
duplicated into each project's CONVENTIONS.md. A bare value is therefore the **canonical** form, not
|
|
1093
|
+
a partial one. Detect:
|
|
1094
|
+
|
|
1095
|
+
- **`missing`** — no `## Terminal-tier retention` section, OR a heading with no value under it. S3
|
|
1096
|
+
offers to add the heading + canonical value line (default `delete-refs`) — just the value line
|
|
1097
|
+
under the heading, not the full SPEC prose.
|
|
1098
|
+
- **`match`** — a `## Terminal-tier retention` heading with a bare `delete-refs` or `retain-bodies`
|
|
1099
|
+
value. This is the canonical value-only form (prose lives in SPEC, not per project). No-op — a repo
|
|
1100
|
+
bootstrapped by this version lands here on its next sync.
|
|
1101
|
+
- **`partial`** — the value is contradictory or bespoke: a value that is neither `delete-refs` nor
|
|
1102
|
+
`retain-bodies`, or inline prose under the heading that conflicts with the SPEC model. S3 offers to
|
|
1103
|
+
reconcile it to a canonical bare value.
|
|
1104
|
+
- **bespoke-overlap** — a hand-rolled `## Done-item archival` (or similar) section describes the same
|
|
1105
|
+
`archived_atop` late-binding model. S3 offers to **converge** it into the one merged
|
|
1106
|
+
`Terminal-tier retention` section (route any project-specific rules it carries to a user-owned
|
|
1107
|
+
`.agents/rules/<name>.md`), not duplicate it.
|
|
1108
|
+
|
|
1109
|
+
**Retained terminal bodies (for the prune offer).** Independently of the convention text, scan for
|
|
1110
|
+
full-body terminal items the merged `delete-refs` model would prune: any `.work/archive/*.md` carrying
|
|
1111
|
+
body content beyond `# Title` (or lacking `archived_atop`/`git_ref`), and any
|
|
1112
|
+
`.work/releases/<version>/<id>.md` other than the `release-<version>.md` summary. Record the count so
|
|
1113
|
+
S3 can offer the prune-to-stubs migration (which stamps `archived_atop` + `git_ref` from history).
|
|
1114
|
+
|
|
1115
|
+
Classify each artifact as one of:
|
|
1116
|
+
|
|
1117
|
+
| State | Meaning |
|
|
1118
|
+
|---|---|
|
|
1119
|
+
| `match` | Installed bytes match the plugin's current canonical version. No-op. |
|
|
1120
|
+
| `drift_plugin` | Installed version differs because the plugin moved forward. Refresh. |
|
|
1121
|
+
| `drift_user` | Installed version differs because the user edited it. Ask. |
|
|
1122
|
+
| `missing` | Marker absent. Install fresh. |
|
|
1123
|
+
|
|
1124
|
+
Heuristic for `drift_plugin` vs `drift_user` on the managed section: if the
|
|
1125
|
+
installed text matches a known prior plugin release's template (recognisable
|
|
1126
|
+
shape, just older content), assume `drift_plugin`. Otherwise treat as
|
|
1127
|
+
`drift_user` and ask. The entrypoint-compatibility heuristic follows the derived
|
|
1128
|
+
`entrypoint_model`: in `agents-canonical`, if a Claude candidate has legacy
|
|
1129
|
+
content not yet in `AGENTS.md`, import it and let the content-integrity gate
|
|
1130
|
+
(Phase 1.8) verify it landed before replacing the Claude file with a
|
|
1131
|
+
symlink/shim (S3); in `claude-source`, `CLAUDE.md` is canonical, so import
|
|
1132
|
+
nothing out of it and only verify root `AGENTS.md` points at it.
|
|
1133
|
+
|
|
1134
|
+
If `.claude/rules/patterns.md` is absent, treat the legacy-rules state as
|
|
1135
|
+
`match` and take no action. If it contains non-shim content not yet present at
|
|
1136
|
+
its canonical destination, build the **Phase 1.8 block-level preservation
|
|
1137
|
+
manifest** and route each block by classification before any shim: structural-
|
|
1138
|
+
pattern blocks → `.agents/skills/patterns/` via convert's **verbatim
|
|
1139
|
+
legacy-pattern importer** (Phase 7 — verbatim, no 3+-occurrence filter);
|
|
1140
|
+
rule-prose blocks → `.agents/rules/<name>.md` (e.g. `project.md`), NOT the AGENTS
|
|
1141
|
+
canonical file; ambiguous blocks → preserve in place. Do not import the whole
|
|
1142
|
+
file into AGENTS. Treat user-edited or ambiguous content as `drift_user` and ask
|
|
1143
|
+
before routing; treat old generated pattern-rules content as `drift_plugin`.
|
|
1144
|
+
Apply the same content-routing to any other `.claude/rules/*.md`.
|
|
1145
|
+
|
|
1146
|
+
**Refactor-conventions catalog alignment.** This catalog is optional. If absent
|
|
1147
|
+
from both `.agents` and `.claude`, treat it as `match` and do not create it.
|
|
1148
|
+
When present:
|
|
1149
|
+
|
|
1150
|
+
- `.agents/skills/refactor-conventions/` is canonical.
|
|
1151
|
+
- `.claude/skills/refactor-conventions/` is only a compatibility mirror.
|
|
1152
|
+
- If only the Claude copy exists, classify as `drift_plugin` when it matches a
|
|
1153
|
+
known generated template; otherwise classify as `drift_user` and ask before
|
|
1154
|
+
copying it into `.agents`.
|
|
1155
|
+
- If both copies exist and differ, classify as `drift_user`; ask whether to
|
|
1156
|
+
merge unique rule references into `.agents`, prefer `.agents`, or leave both.
|
|
1157
|
+
- If the `.agents` `SKILL.md` contains the old generated instruction to write a
|
|
1158
|
+
standalone `.md` refactoring plan, classify only the wrapper as
|
|
1159
|
+
`drift_plugin`. Refresh the wrapper/index shape, but preserve
|
|
1160
|
+
`references/style/` and `references/structure/` content.
|
|
1161
|
+
- If the catalog has style rule references but the selected AGENTS target lacks
|
|
1162
|
+
`## Refactor Style Conventions`, classify as `missing` and ask whether to
|
|
1163
|
+
synthesize concise AGENTS entries from the catalog. Do not invent style rules
|
|
1164
|
+
when the catalog lacks them.
|
|
1165
|
+
|
|
1166
|
+
### Phase S2: Plan the sync
|
|
1167
|
+
|
|
1168
|
+
Produce a per-artifact plan: what's `match` (skip), what's `drift_plugin`
|
|
1169
|
+
(auto-refresh), what's `drift_user` (ask before overwriting), what's `missing`
|
|
1170
|
+
(install).
|
|
1171
|
+
|
|
1172
|
+
Also produce a cleanup plan, even if the answer is "none":
|
|
1173
|
+
|
|
1174
|
+
- **Out of scope** — candidates found but preserved because
|
|
1175
|
+
`cleanup_scope: preserve-only`.
|
|
1176
|
+
- **Generated cleanup candidates** — generated duplicate files/mirrors that can
|
|
1177
|
+
be replaced by symlinks/shims if `cleanup_scope` allows it.
|
|
1178
|
+
- **Legacy cleanup candidates** — old tracking docs or task files that can be
|
|
1179
|
+
moved or removed only under `cleanup_scope: legacy-cleanup` and after exact
|
|
1180
|
+
path confirmation.
|
|
1181
|
+
|
|
1182
|
+
If every artifact is `match`, the sync is a true no-op — log "Substrate already
|
|
1183
|
+
up to date. No changes." If cleanup candidates exist but cleanup is out of
|
|
1184
|
+
scope, still report them as preserved and return without committing.
|
|
1185
|
+
|
|
1186
|
+
If anything would change, summarise the plan and (when running interactively)
|
|
1187
|
+
confirm before applying.
|
|
1188
|
+
|
|
1189
|
+
### Phase S3: Apply refreshes
|
|
1190
|
+
|
|
1191
|
+
For each artifact with a non-`match` state:
|
|
1192
|
+
|
|
1193
|
+
- `.agents/rules/agile-workflow.md` + canonical instruction section
|
|
1194
|
+
(rules-first, then slim) — FIRST write/refresh `.agents/rules/agile-workflow.md`
|
|
1195
|
+
between its `<!-- agile-workflow:rules:start/end -->` markers (Phase 6.5) and
|
|
1196
|
+
verify per the Phase 6.5 content check (the dense rule sections actually landed,
|
|
1197
|
+
not merely non-empty + end marker). THEN overwrite the
|
|
1198
|
+
AGENTS managed section with the slim Phase 6 template, in whichever file holds it
|
|
1199
|
+
per the derived `entrypoint_model` (`AGENTS.md` or, for `claude-source`,
|
|
1200
|
+
`CLAUDE.md`). If the file lacks markers, append the section; if it doesn't exist,
|
|
1201
|
+
create it. **Full-AGENTS migration:** when S1 found an AGENTS section that still
|
|
1202
|
+
carries the old dense prose (tag semantics / test integrity / advisory review
|
|
1203
|
+
inline), this IS the extraction migration — the rules-first verify guarantees
|
|
1204
|
+
the dense prose lands in `.agents/rules/agile-workflow.md` before the section is
|
|
1205
|
+
slimmed, so no rule content is lost. If the verify fails, do NOT slim — leave the
|
|
1206
|
+
existing full section intact and report it.
|
|
1207
|
+
- `.work/bin/work-view` — reinstall via
|
|
1208
|
+
`bash "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/install-work-view.sh"`
|
|
1209
|
+
(installs the version-verified prebuilt Rust binary on supported platforms,
|
|
1210
|
+
with the Bash fallback only on unsupported platforms). This replaces any
|
|
1211
|
+
pre-versioning copy in place. After
|
|
1212
|
+
reinstalling, ensure `.work/bin/work-view` is tracked and agent-visible: run
|
|
1213
|
+
`git check-ignore .work/bin/work-view`; if it reports a matching ignore rule,
|
|
1214
|
+
surface that rule for removal or a negation entry under convert's
|
|
1215
|
+
preserve-by-default cleanup policy rather than silently editing ignore files.
|
|
1216
|
+
Ensure `.work/bin/work-view` is included in the Phase S5 `git add`.
|
|
1217
|
+
- **Scan-awareness rides this reinstall.** The current `work-view` delivers the
|
|
1218
|
+
`deep-code-scan` substrate support: the `--scan-origin <slug>` filter (the
|
|
1219
|
+
`scan_origin` linkage field) and the **`[scan]`-tag exclusion from `--ready`/
|
|
1220
|
+
`--blocked`** (so engagement-owned scan scaffold is never drained by autopilot).
|
|
1221
|
+
Reinstalling the binary is what brings an existing install up to scan-awareness —
|
|
1222
|
+
no separate step. Verify post-reinstall with `.work/bin/work-view --scan-origin x`
|
|
1223
|
+
exiting cleanly.
|
|
1224
|
+
- **Scan taxonomy in CONVENTIONS (user-owned — offer, never force).** If
|
|
1225
|
+
`.work/CONVENTIONS.md` doesn't yet register the `deep-code-scan` reserved tags
|
|
1226
|
+
(`scan` + the lane/band tags) or the `scan_origin` linkage field, **offer** to add
|
|
1227
|
+
them (structured question tool), exactly like other convergence offers — preserving all user
|
|
1228
|
+
content. These are documentation/taxonomy; the behavioral guarantee lives in the
|
|
1229
|
+
reinstalled binary, so this offer is non-blocking.
|
|
1230
|
+
- Entrypoint compatibility — refresh the pointer in the direction set by
|
|
1231
|
+
`entrypoint_model`:
|
|
1232
|
+
- `agents-canonical` — import legacy generated content from any detected
|
|
1233
|
+
Claude candidate into `AGENTS.md`, then replace the Claude file with a
|
|
1234
|
+
symlink/shim to it only after the content-integrity gate (Phase 1.8)
|
|
1235
|
+
confirms every imported block landed, AND `cleanup_scope` allows generated
|
|
1236
|
+
cleanup or the user confirms that exact path.
|
|
1237
|
+
- `claude-source` — `CLAUDE.md` is the canonical instruction file: its managed
|
|
1238
|
+
section between markers IS refreshed in place (handled by the canonical-file
|
|
1239
|
+
step above), but its content is never migrated out and the file is never
|
|
1240
|
+
replaced by a pointer. Here, only ensure root `AGENTS.md` is a symlink/shim
|
|
1241
|
+
pointing at `CLAUDE.md`, and normalize nested Claude duplicates to point at
|
|
1242
|
+
`CLAUDE.md` — content-integrity gate first, so a nested duplicate with unique
|
|
1243
|
+
content not already in `CLAUDE.md` is preserved, not replaced.
|
|
1244
|
+
If symlinks are unavailable, write the Phase 7 shim under the same cleanup
|
|
1245
|
+
authorization.
|
|
1246
|
+
- Legacy `.claude/rules/*.md` — only when present, build the Phase 1.8
|
|
1247
|
+
block-level manifest and route non-duplicate blocks by classification
|
|
1248
|
+
(structural-pattern blocks → `.agents/skills/patterns/` via convert's verbatim
|
|
1249
|
+
legacy-pattern importer, NO discovery filter; rule-prose blocks →
|
|
1250
|
+
`.agents/rules/<name>.md`, NOT the AGENTS canonical file; ambiguous → preserve
|
|
1251
|
+
in place). The **`drift_user` / ambiguous atomic sequence** is
|
|
1252
|
+
**confirm → import → verify → shim** (never shim before a verified import):
|
|
1253
|
+
confirm with the user, import the blocks, run the content-integrity gate to
|
|
1254
|
+
verify they landed (presence + provenance + anchors), THEN — only when cleanup
|
|
1255
|
+
is authorized for that exact path and after the reference-integrity check —
|
|
1256
|
+
replace the file with the Phase 7 shim. `patterns.md` is never "generated
|
|
1257
|
+
cleanup"; shim it only under explicit per-path confirmation after the gate
|
|
1258
|
+
passes. Never import the whole file into AGENTS.
|
|
1259
|
+
- Optional pattern and refactor-conventions mirrors — `.claude/skills/*` mirror
|
|
1260
|
+
replacement is a destructive op, so the content-integrity gate runs first: align
|
|
1261
|
+
`.claude/skills/*` to `.agents/skills/*` only when the `.agents` catalog exists
|
|
1262
|
+
(the verified home) and the Claude copy is absent, a symlink, or a known
|
|
1263
|
+
generated mirror, and cleanup is in scope for generated mirrors. If the Claude
|
|
1264
|
+
copy contains unique user content, the gate keeps it — reconcile that content
|
|
1265
|
+
into `.agents` first, then re-mirror; never overwrite it unverified.
|
|
1266
|
+
- Refactor-conventions wrapper — when `.agents/skills/refactor-conventions/`
|
|
1267
|
+
exists and its `SKILL.md` is a known old generated template, rewrite only
|
|
1268
|
+
`SKILL.md` to the current catalog/index shape. Preserve all rule reference
|
|
1269
|
+
files and user-authored examples.
|
|
1270
|
+
- Refactor style conventions in AGENTS — if missing but derivable from
|
|
1271
|
+
`.agents/skills/refactor-conventions/references/style/`, ask before adding a
|
|
1272
|
+
concise `## Refactor Style Conventions` section. If the user declines, leave
|
|
1273
|
+
the catalog intact and report the mismatch.
|
|
1274
|
+
- Load-bearing tag entries in `.work/CONVENTIONS.md` — for each entry flagged
|
|
1275
|
+
`drift_plugin` or `missing` in Phase S1, ask the user via `structured question tool`
|
|
1276
|
+
before rewriting:
|
|
1277
|
+
> "Your `.work/CONVENTIONS.md` has the old default text for the `[refactor]`
|
|
1278
|
+
> tag. The current plugin default tightens the definition to lock the
|
|
1279
|
+
> `refactor-design` vs `feature-design` routing — refresh it?"
|
|
1280
|
+
> Options: `Refresh to current default` / `Keep my current text` /
|
|
1281
|
+
> `Show me the diff first`.
|
|
1282
|
+
|
|
1283
|
+
If the user accepts, replace just that line in CONVENTIONS.md (preserve
|
|
1284
|
+
everything else). Do NOT rewrite the whole tag taxonomy section — only the
|
|
1285
|
+
lines flagged as drift. If the entry was `missing`, append it in the Tag
|
|
1286
|
+
taxonomy section.
|
|
1287
|
+
|
|
1288
|
+
- **Terminal-tier retention convention in `.work/CONVENTIONS.md`** — for the state flagged in S1
|
|
1289
|
+
(`missing` / `partial` / bespoke-overlap), offer via `structured question tool` (never silently rewrite
|
|
1290
|
+
user-owned CONVENTIONS). A bare `delete-refs`/`retain-bodies` value is `match` and is left
|
|
1291
|
+
untouched — the merged prose lives in SPEC, not per project, so a bare value is canonical:
|
|
1292
|
+
- `missing` — "Your `.work/CONVENTIONS.md` has no `## Terminal-tier retention` value. Add it
|
|
1293
|
+
(default `delete-refs`)?" On accept, append **just the value-only form** — the
|
|
1294
|
+
`## Terminal-tier retention` heading + a bare `delete-refs` value line per the SPEC CONVENTIONS
|
|
1295
|
+
template — NOT the full SPEC prose (the prose is SPEC's, not duplicated into CONVENTIONS). A repo
|
|
1296
|
+
bootstrapped this way classifies as `match` on its next sync.
|
|
1297
|
+
- `partial` — only fires when the value is contradictory or bespoke (not a bare
|
|
1298
|
+
`delete-refs`/`retain-bodies`, or inline prose that conflicts with the SPEC model). "Your
|
|
1299
|
+
terminal-retention value is non-standard. Reconcile it to a canonical bare
|
|
1300
|
+
`delete-refs`/`retain-bodies` value?" Options: `Reconcile` / `Keep mine` / `Show diff`. On
|
|
1301
|
+
accept, replace the section with the value-only form (preserve the intended
|
|
1302
|
+
`delete-refs`/`retain-bodies` choice).
|
|
1303
|
+
- bespoke-overlap (a hand-rolled `## Done-item archival` section) — "You have a custom
|
|
1304
|
+
`## Done-item archival` section describing the same `archived_atop` model. Converge it into the
|
|
1305
|
+
one merged `Terminal-tier retention` convention (removing the duplicate, preserving any
|
|
1306
|
+
project-specific rules to `.agents/rules/<name>.md`)?" On accept, fold its semantics into the
|
|
1307
|
+
merged section, route project-specific rules to a user-owned rules file, and remove the bespoke
|
|
1308
|
+
section only after the content-integrity gate (Phase 1.8) confirms nothing is dropped.
|
|
1309
|
+
|
|
1310
|
+
- **Prune retained terminal bodies to stubs (the offer)** — when S1 found retained full-body terminal
|
|
1311
|
+
items and `delete-refs` is in effect, offer (`structured question tool`; never force, preserve-only stays the
|
|
1312
|
+
default) the prune-to-current-practice migration from Phase 8's "Sync existing substrates to
|
|
1313
|
+
delete-refs": archived bodies → bodyless stubs (capture `git_ref` from `git log -- <path>`, stamp
|
|
1314
|
+
`archived_atop` from the history at the archival/done commit, else `pre-release`); released bodies →
|
|
1315
|
+
folded into their `release-<version>.md` summary table, then `git rm`. The content- and
|
|
1316
|
+
reference-integrity gates (Phase 1.8) apply before any `git rm`.
|
|
1317
|
+
|
|
1318
|
+
For `drift_user` items, only proceed after the user confirms.
|
|
1319
|
+
|
|
1320
|
+
For bespoke overlaps in the `converge` set, run Phase 8.6's convergence
|
|
1321
|
+
(deferring to the owning skill for layout) — sync converges the same way
|
|
1322
|
+
bootstrap does.
|
|
1323
|
+
|
|
1324
|
+
For cleanup candidates, only proceed when the candidate class is inside
|
|
1325
|
+
`cleanup_scope`, the content-integrity gate (Phase 1.8) has confirmed each
|
|
1326
|
+
candidate's content is preserved at its destination, and the
|
|
1327
|
+
reference-integrity-on-move check (grep for inbound references, rewrite or shim)
|
|
1328
|
+
clears the move — then ask with exact paths before applying any `git mv` or
|
|
1329
|
+
`git rm`. If the user declines, or the content-integrity gate finds an
|
|
1330
|
+
unaccounted block, leave the files and report them as preserved.
|
|
1331
|
+
|
|
1332
|
+
### Phase S4: Preserve user state
|
|
1333
|
+
|
|
1334
|
+
These are NEVER touched in sync mode:
|
|
1335
|
+
|
|
1336
|
+
- `.work/CONVENTIONS.md` user-customized content. The exceptions, each applied in Phase S3 ONLY with
|
|
1337
|
+
user confirmation, are: (a) load-bearing tag entries (`refactor`, `perf`) when they match a known
|
|
1338
|
+
prior plugin default verbatim, and (b) the `## Terminal-tier retention` convention when it is
|
|
1339
|
+
`missing`/`partial`/a bespoke `## Done-item archival` overlap (add / reconcile / converge). A bare
|
|
1340
|
+
`delete-refs`/`retain-bodies` value is `match` and is left untouched. Everything
|
|
1341
|
+
else in CONVENTIONS — release mapping, project tags, slug conventions, gate config, any user
|
|
1342
|
+
prose — is untouched.
|
|
1343
|
+
- Everything under `.work/active/`, `.work/backlog/`, `.work/releases/`,
|
|
1344
|
+
`.work/archive/`
|
|
1345
|
+
- User-authored rule references under `.agents/skills/refactor-conventions/`.
|
|
1346
|
+
Sync may refresh the generated `SKILL.md` wrapper when it matches a known old
|
|
1347
|
+
template, but it must not rewrite rule bodies, examples, exceptions, or scope
|
|
1348
|
+
content without explicit confirmation.
|
|
1349
|
+
- `.agents/skills/patterns/` pattern bodies. Sync may align mirrors and import
|
|
1350
|
+
verbatim legacy patterns (Phase 7), but `gate-patterns` owns pattern
|
|
1351
|
+
*discovery*; sync never rewrites an existing pattern body without confirmation.
|
|
1352
|
+
- User-authored `.agents/rules/*.md` — every file other than the plugin-managed
|
|
1353
|
+
`agile-workflow.md`, and any content outside `agile-workflow.md`'s
|
|
1354
|
+
`<!-- agile-workflow:rules:start/end -->` markers. Sync refreshes only the
|
|
1355
|
+
plugin block; it never touches user rule files or out-of-marker content.
|
|
1356
|
+
- Content in the canonical instruction file (`AGENTS.md`, or `CLAUDE.md` in
|
|
1357
|
+
`claude-source`) outside the agile-workflow markers, except imported legacy
|
|
1358
|
+
Claude *entrypoint* content (under `## Imported Claude Code Instructions`) and
|
|
1359
|
+
synthesized refactor style convention summaries the user confirms should become
|
|
1360
|
+
canonical. (Legacy `.claude/rules/*.md` rule prose is NOT imported here — it
|
|
1361
|
+
goes to `.agents/rules/<name>.md`.)
|
|
1362
|
+
- `MIGRATION_REPORT.md` (a bootstrap artifact; sync never writes it)
|
|
1363
|
+
- Any cleanup candidate outside the chosen `cleanup_scope`
|
|
1364
|
+
- Any cleanup candidate not listed by exact path in the confirmed cleanup plan
|
|
1365
|
+
|
|
1366
|
+
### Phase S5: Commit
|
|
1367
|
+
|
|
1368
|
+
If any files were rewritten:
|
|
1369
|
+
|
|
1370
|
+
```bash
|
|
1371
|
+
git add AGENTS.md .agents/AGENTS.md .claude/AGENTS.md CLAUDE.md .claude/CLAUDE.md .agents/CLAUDE.md .agents/rules/ .work/bin/work-view
|
|
1372
|
+
# If any legacy rules shim was created or updated (not just patterns.md):
|
|
1373
|
+
git add .claude/rules/
|
|
1374
|
+
# If optional project skill catalogs or mirrors were aligned or converged:
|
|
1375
|
+
git add .agents/skills/patterns .claude/skills/patterns .agents/skills/refactor-conventions .claude/skills/refactor-conventions
|
|
1376
|
+
# If load-bearing CONVENTIONS tag entries OR the terminal-retention convention were
|
|
1377
|
+
# refreshed/added/converged with user confirmation:
|
|
1378
|
+
git add .work/CONVENTIONS.md
|
|
1379
|
+
# If the user accepted the prune-to-stubs migration (archived bodies → stubs, released bodies → summary):
|
|
1380
|
+
git add .work/archive/ .work/releases/
|
|
1381
|
+
# If reference-integrity rewrote inbound references in existing items/docs:
|
|
1382
|
+
git add .work/ docs/
|
|
1383
|
+
# If cleanup was explicitly confirmed for exact paths:
|
|
1384
|
+
git add -A <confirmed-cleanup-paths>
|
|
1385
|
+
git commit -m "chore: agile-workflow sync"
|
|
1386
|
+
```
|
|
1387
|
+
|
|
1388
|
+
Skip the commit entirely if Phase S3 produced no file changes.
|
|
1389
|
+
|
|
1390
|
+
## Output
|
|
1391
|
+
|
|
1392
|
+
After bootstrap:
|
|
1393
|
+
- Brief summary in conversation: shape detected, items seeded by tier, conventions
|
|
1394
|
+
chosen, entrypoint model, bespoke overlaps converged, cleanup scope, cleanup
|
|
1395
|
+
and reference-integrity actions taken or preserved, next-step recommendation.
|
|
1396
|
+
- Point at `MIGRATION_REPORT.md` for the full breakdown.
|
|
1397
|
+
|
|
1398
|
+
After sync (auto or `--update`):
|
|
1399
|
+
- Per-artifact line: `match` / `refreshed (plugin drift)` / `refreshed (user
|
|
1400
|
+
drift, confirmed)` / `installed (was missing)` / `converged (bespoke overlap)`.
|
|
1401
|
+
- Include optional artifact status for pattern-skill mirrors and
|
|
1402
|
+
refactor-conventions catalog/mirrors when present, plus any
|
|
1403
|
+
`plugin-mirror-divergent-copy` reconciliations.
|
|
1404
|
+
- Include cleanup scope plus preserved / cleaned exact paths, and any
|
|
1405
|
+
reference-integrity rewrites or shims.
|
|
1406
|
+
- If everything matched: one line — "Substrate already up to date. No changes."
|
|
1407
|
+
- If anything changed: one line summary plus the commit sha.
|
|
1408
|
+
|
|
1409
|
+
## Guardrails
|
|
1410
|
+
|
|
1411
|
+
- **Bootstrap is a single-commit migration ALWAYS.** No partial states. If
|
|
1412
|
+
anything errors mid-run, rollback (no commit). User can re-run cleanly.
|
|
1413
|
+
- Source files are preserved across all paths by default. Convert never deletes
|
|
1414
|
+
user content unless the user explicitly opted into cleanup and confirmed exact
|
|
1415
|
+
paths.
|
|
1416
|
+
- Destructive cleanup is opt-in. Default to `cleanup_scope: preserve-only`.
|
|
1417
|
+
- Never delete, move, or replace existing legacy artifacts unless cleanup is in
|
|
1418
|
+
scope and the exact path appears in the confirmed cleanup plan.
|
|
1419
|
+
- Prefer `git mv` for retained legacy artifacts. Use `git rm` only when the user
|
|
1420
|
+
explicitly chose deletion for exact paths. Never use broad cleanup globs.
|
|
1421
|
+
- **Content integrity is mandatory before every destructive op, and runs first
|
|
1422
|
+
(Phase 1.8).** Before any delete / move / symlink / shim / copy-over /
|
|
1423
|
+
managed-section overwrite / mirror replacement of a legacy artifact, build the
|
|
1424
|
+
block-level preservation manifest and confirm every block is terminal
|
|
1425
|
+
(`landed_existing` / `landed_this_run` / `preserved_in_place`) — present at its
|
|
1426
|
+
canonical destination with provenance + semantic anchors, or kept in place. If
|
|
1427
|
+
any block is unaccounted-for, do NOT perform the op; leave the artifact and
|
|
1428
|
+
report. Content inside plugin-managed markers never counts as preserved
|
|
1429
|
+
user-content. This preserves *content*; reference integrity preserves
|
|
1430
|
+
*pointers* — both are required.
|
|
1431
|
+
- **Reference integrity is mandatory before every move/remove, regardless of
|
|
1432
|
+
`cleanup_scope`, and runs after content integrity.** Grep the repo (especially
|
|
1433
|
+
`.work/` items and `docs/`) for inbound references to any path being moved,
|
|
1434
|
+
removed, or replaced; then rewrite them or leave a redirect shim, and report
|
|
1435
|
+
which. Never strand a live pointer.
|
|
1436
|
+
- **Legacy patterns are imported verbatim, never discovered.** Convert owns the
|
|
1437
|
+
lossless import of existing legacy structural patterns into
|
|
1438
|
+
`.agents/skills/patterns/` (gate-patterns file/index format, NO 3+-occurrence
|
|
1439
|
+
filter). `gate-patterns` remains the discovery writer for NEW patterns in
|
|
1440
|
+
release bundles. Never route legacy pattern content through gate-patterns'
|
|
1441
|
+
discovery filter — it would drop single-use legacy patterns.
|
|
1442
|
+
- **Discovery over checklist.** Enumerate and classify both skill roots and the
|
|
1443
|
+
rules tree; never assume the only overlaps are the canonical `patterns` and
|
|
1444
|
+
`refactor-conventions` catalogs. Bespoke skills mirroring plugin concepts,
|
|
1445
|
+
plan-doc generators, and superseded commands are convergence candidates.
|
|
1446
|
+
- **Defer to the owning skill for canonical locations.** Convert places
|
|
1447
|
+
content; `gate-patterns` and `refactor-conventions-creator` own where it
|
|
1448
|
+
lives. Do not carry a divergent end-state (e.g. never dump pattern content
|
|
1449
|
+
into AGENTS, and route legacy rule prose to `.agents/rules/<name>.md`, not
|
|
1450
|
+
AGENTS).
|
|
1451
|
+
- The conventions interview is mandatory in bootstrap mode. No silent inference
|
|
1452
|
+
of release mapping or tag taxonomy.
|
|
1453
|
+
- Foundation docs are read-only from convert. They roll forward through `scope`,
|
|
1454
|
+
`design`, `implement`, NOT through bootstrap.
|
|
1455
|
+
- **Sync mode never touches user-edited CONVENTIONS.md or substrate state.**
|
|
1456
|
+
Refresh is only for plugin-shipped artifacts.
|
|
1457
|
+
- **Sync is non-destructive on user edits.** When an installed artifact looks
|
|
1458
|
+
like a user customisation (not a known prior plugin template), confirm before
|
|
1459
|
+
overwriting. Don't silently clobber.
|
|
1460
|
+
- **Sync is idempotent.** Re-running plain `convert` on a healthy, up-to-date
|
|
1461
|
+
project is a true no-op — no commit, no edits, just a status line.
|
|
1462
|
+
- Auto-detection is the default. Treat `--update` as documentation of intent,
|
|
1463
|
+
not as a different code path — it routes through the same Sync Workflow.
|