opencode-codeops 1.4.0

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/LICENSE +21 -0
  3. package/README.md +171 -0
  4. package/_shared/auto-design.md +129 -0
  5. package/_shared/layout-convention.md +198 -0
  6. package/_shared/quality-profile.md +134 -0
  7. package/_shared/recommendation-hardening.md +166 -0
  8. package/_shared/scope-expansion-control.md +176 -0
  9. package/_shared/spec-first-ordering.md +79 -0
  10. package/_shared/zero-ambiguity-gate.md +311 -0
  11. package/agent-templates/codebase-scout.md +17 -0
  12. package/agent-templates/concurrency-auditor.md +5 -0
  13. package/agent-templates/design-challenger.md +26 -0
  14. package/agent-templates/financial-integrity-auditor.md +5 -0
  15. package/agent-templates/perf-auditor.md +23 -0
  16. package/agent-templates/phase-reviewer.md +54 -0
  17. package/agent-templates/plan-task-executor-opus.md +46 -0
  18. package/agent-templates/plan-task-executor.md +43 -0
  19. package/agent-templates/preflight-auditor.md +45 -0
  20. package/agent-templates/security-auditor.md +42 -0
  21. package/agent-templates/semantics-reviewer.md +5 -0
  22. package/agent-templates/spec-test-author.md +29 -0
  23. package/agents/concurrency-auditor.md +15 -0
  24. package/agents/correctness-reviewer.md +66 -0
  25. package/agents/demanding-executor.md +58 -0
  26. package/agents/design-challenger.md +38 -0
  27. package/agents/executor.md +55 -0
  28. package/agents/explorer.md +29 -0
  29. package/agents/financial-integrity-auditor.md +15 -0
  30. package/agents/performance-auditor.md +35 -0
  31. package/agents/preflight-auditor.md +57 -0
  32. package/agents/security-auditor.md +54 -0
  33. package/agents/semantics-reviewer.md +15 -0
  34. package/agents/spec-test-author.md +41 -0
  35. package/bin/codeops-worktree +244 -0
  36. package/bin/index.mjs +106 -0
  37. package/bin/install-agents.mjs +453 -0
  38. package/bin/install-skills.mjs +466 -0
  39. package/bin/lib/opencode-install.mjs +185 -0
  40. package/install.sh +55 -0
  41. package/package.json +73 -0
  42. package/plugin/index.ts +181 -0
  43. package/references/domains/compiler-and-language.md +28 -0
  44. package/references/domains/data-and-migration.md +22 -0
  45. package/references/domains/distributed-and-concurrent.md +26 -0
  46. package/references/domains/financial-system.md +28 -0
  47. package/references/domains/selection.md +19 -0
  48. package/references/domains/web-application.md +23 -0
  49. package/schemas/codeops-config.schema.json +56 -0
  50. package/scripts/check-version.mjs +163 -0
  51. package/scripts/codeops-migrate.sh +355 -0
  52. package/scripts/codeops-roadmap-compact.sh +232 -0
  53. package/scripts/codeops-roadmap-sync.sh +275 -0
  54. package/scripts/codeops_outcomes.py +155 -0
  55. package/scripts/codeops_plan.py +239 -0
  56. package/scripts/codeops_plan_migrate.py +318 -0
  57. package/scripts/codeops_worktree_snapshot.py +99 -0
  58. package/scripts/install_agents.py +288 -0
  59. package/scripts/release.mjs +533 -0
  60. package/skills/analyze-project/SKILL.md +28 -0
  61. package/skills/clean-comments/SKILL.md +22 -0
  62. package/skills/exec-plan/SKILL.md +267 -0
  63. package/skills/exec-plan/commit-modes.md +113 -0
  64. package/skills/exec-plan/execution-protocol.md +471 -0
  65. package/skills/git-commit/SKILL.md +35 -0
  66. package/skills/github-issues/SKILL.md +38 -0
  67. package/skills/grill-me/SKILL.md +342 -0
  68. package/skills/make-plan/SKILL.md +282 -0
  69. package/skills/make-plan/quality-checklist.md +96 -0
  70. package/skills/make-plan/templates.md +535 -0
  71. package/skills/make-plan/zero-ambiguity-gate.md +19 -0
  72. package/skills/make-requirements/SKILL.md +268 -0
  73. package/skills/make-requirements/discovery-phases.md +255 -0
  74. package/skills/make-requirements/review-and-add.md +73 -0
  75. package/skills/make-requirements/templates.md +296 -0
  76. package/skills/make-requirements/zero-ambiguity-gate.md +18 -0
  77. package/skills/outcome-review/SKILL.md +34 -0
  78. package/skills/preflight/SKILL.md +310 -0
  79. package/skills/preflight/dimensions.md +181 -0
  80. package/skills/preflight/report-format.md +300 -0
  81. package/skills/retro-requirements/SKILL.md +218 -0
  82. package/skills/retro-requirements/confidence-classification.md +45 -0
  83. package/skills/retro-requirements/phases.md +609 -0
  84. package/skills/retro-requirements/triage-gate.md +135 -0
  85. package/skills/roadmap/SKILL.md +381 -0
  86. package/skills/roadmap/stage-hooks.md +80 -0
  87. package/skills/roadmap/template.md +200 -0
  88. package/skills/setup-codeops/SKILL.md +94 -0
  89. package/skills/setup-codeops/migration.md +106 -0
  90. package/skills/setup-codeops/scaffold.md +99 -0
  91. package/skills/setup-routing/SKILL.md +102 -0
  92. package/skills/setup-routing/routing.md +44 -0
  93. package/skills/techdocs/SKILL.md +199 -0
  94. package/skills/techdocs/authoring-and-update.md +178 -0
  95. package/skills/techdocs/templates.md +655 -0
  96. package/skills/techdocs/vitepress-setup.md +143 -0
  97. package/skills/upgrade-plan/SKILL.md +75 -0
  98. package/skills/upgrade-plan/content-quality-gate.md +35 -0
  99. package/skills/upgrade-plan/upgrade-checklists.md +107 -0
  100. package/standards/coding-standards-full.md +124 -0
  101. package/standards/coding-standards.md +64 -0
  102. package/standards/output-style.md +17 -0
@@ -0,0 +1,135 @@
1
+ # Phase 8B: Bug-or-Feature Triage Gate — 🚨 NON-NEGOTIABLE HARD GATE 🚨
2
+
3
+ > **This gate MUST be passed before Phase 9 (Synthesis). There are NO
4
+ > exceptions.** It is the structural safeguard against the code-as-truth
5
+ > tautology — the single most dangerous pattern in reverse requirements
6
+ > engineering.
7
+
8
+ ## Why This Gate Exists
9
+
10
+ When an agent reads code and writes requirements from it, **every bug becomes a
11
+ requirement**. The agent has no way to distinguish intentional behavior from
12
+ accidental behavior — it can only observe what the code does. Without this gate,
13
+ bugs are faithfully documented as features, passed through the make-requirements
14
+ skill, planned via the make-plan skill, implemented, and tested with spec tests
15
+ that validate the buggy behavior. The entire forward pipeline passes clean, and
16
+ the bugs are reproduced with full confidence.
17
+
18
+ **This gate breaks the tautology** by forcing every uncertain or suspicious
19
+ behavior to be presented to the user — the only entity with external domain
20
+ knowledge able to distinguish bugs from features.
21
+
22
+ ---
23
+
24
+ ## 8B.1 Compile the Triage Register
25
+
26
+ After Phases 4–8 are complete, compile a **Triage Register**: a formal inventory
27
+ of ALL items that are NOT ✅ Confirmed (every 🔴 Suspicious and ⚠️ Inferred item
28
+ from the Phase 4 behavior catalog and Phase 5 business rules).
29
+
30
+ Save it to disk **before** presenting to the user (see 8B.4 Persistence).
31
+
32
+ ```markdown
33
+ # Bug-or-Feature Triage Register: [Project Name]
34
+
35
+ > Status: ❌ GATE BLOCKED — [X] items unresolved
36
+ > Last Updated: [Date]
37
+
38
+ ## 🔴 Suspicious Items (MANDATORY — must be resolved before synthesis)
39
+
40
+ | # | Source | Item | What the Code Does | Why It's Suspicious | User Decision | Status |
41
+ |---|--------|------|--------------------|---------------------|---------------|--------|
42
+ | T-001 | Phase 4: [CAT]-03 | [Feature title] | [Observed behavior] | [Why this might be a bug] | — | ❌ Open |
43
+ | T-002 | Phase 5: BR-DOM-02 | [Rule title] | [What the rule enforces] | [Why this might be wrong] | — | ❌ Open |
44
+
45
+ ## ⚠️ Inferred Items (RECOMMENDED — user should confirm or flag)
46
+
47
+ | # | Source | Item | What the Code Does | Confidence Notes | User Decision | Status |
48
+ |---|--------|------|--------------------|------------------|---------------|--------|
49
+ | T-010 | Phase 4: [CAT]-07 | [Feature title] | [Observed behavior] | [Why confidence is only Inferred] | — | ❌ Open |
50
+ ```
51
+
52
+ ---
53
+
54
+ ## 8B.2 Present to User for Triage
55
+
56
+ **🔴 Suspicious items** — present each one with:
57
+
58
+ 1. **What the code does** — a factual description of the observed behavior.
59
+ 2. **Why it's suspicious** — the standard, convention, or domain expectation it
60
+ appears to violate.
61
+ 3. **Options:**
62
+ - **(A) It's a bug** — do NOT include in the reconstruction brief; add it to
63
+ `08-gaps-and-debt.md` → "Known Bugs" instead.
64
+ - **(B) It's intentional** — include in the brief as a confirmed requirement;
65
+ record the user's explanation.
66
+ - **(C) I'm not sure** — include in the brief with a prominent ⚠️ flag AND add
67
+ it to "Open Questions for Discovery" so the make-requirements skill
68
+ re-examines it.
69
+
70
+ **⚠️ Inferred items** — present in batches (5–10 at a time) for quicker
71
+ confirmation:
72
+
73
+ - *"These behaviors appear intentional but have no test coverage or
74
+ documentation. Please scan and flag any that look wrong."*
75
+ - The user can confirm the batch ("all look fine") or flag individual items for
76
+ deeper review.
77
+
78
+ Record each decision in the register's **User Decision** column and update each
79
+ row's **Status** to ✅ Resolved.
80
+
81
+ ---
82
+
83
+ ## 8B.3 Gate Rules
84
+
85
+ **🚫 ABSOLUTELY PROHIBITED while the gate is blocked:**
86
+
87
+ - ❌ Write the reconstruction brief (`09-reconstruction-brief.md`)
88
+ - ❌ Proceed to Phase 9
89
+ - ❌ Include any 🔴 Suspicious item as a confirmed requirement
90
+ - ❌ Assume a suspicious behavior is intentional because the code is "clean"
91
+
92
+ **✅ The gate opens ONLY when ALL of these are met:**
93
+
94
+ 1. ✅ Every 🔴 Suspicious item has a user decision (A, B, or C).
95
+ 2. ✅ All ⚠️ Inferred items have been presented (batch confirmation is fine).
96
+ 3. ✅ Items decided **(A) Bug** have been moved to `08-gaps-and-debt.md` →
97
+ "Known Bugs".
98
+ 4. ✅ Items decided **(C) Unsure** are flagged in the brief AND added to Open
99
+ Questions.
100
+ 5. ✅ The register header has been updated to `✅ GATE PASSED`.
101
+
102
+ ---
103
+
104
+ ## 8B.4 Register Persistence
105
+
106
+ The Triage Register is a permanent artifact:
107
+
108
+ - **Location:** `<resolved _retro dir>/08b-triage-register.md` (resolution rule in SKILL.md)
109
+ - **Purpose:** audit trail — every behavior classification is traceable to a user
110
+ decision.
111
+ - **Survives interruptions:** written to disk before the user is asked anything,
112
+ and updated after each decision.
113
+
114
+ ---
115
+
116
+ ## 8B.5 Worked Example
117
+
118
+ ```
119
+ T-003 | Phase 6: Auth | OIDC Discovery Endpoint
120
+
121
+ What the code does:
122
+ The OIDC discovery endpoint returns { issuer: "https://example.com" }
123
+ without including the organization path segment.
124
+
125
+ Why it's suspicious:
126
+ RFC 8414 §2 requires the issuer value to exactly match the URL the client
127
+ used to retrieve the discovery document. If clients access the endpoint at
128
+ https://example.com/org-slug/.well-known/openid-configuration, the issuer
129
+ MUST be https://example.com/org-slug — not the bare base URL.
130
+
131
+ Options:
132
+ (A) Bug — omit from requirements, add to gaps
133
+ (B) Intentional — single-tenant deployment, no org path needed
134
+ (C) Unsure — flag for make-requirements discovery
135
+ ```
@@ -0,0 +1,381 @@
1
+ ---
2
+ name: roadmap
3
+ description: >-
4
+ Tracks features across their lifecycle in a live, per-repo roadmap — every RD, plan, and task and
5
+ the lifecycle stage each is in. Layout-aware: a single plans/00-roadmap.md in flat layout, or a
6
+ two-tier per-feature + portfolio roadmap under codeops/ in nested layout. Use when the user says
7
+ "roadmap", "make_roadmap", "update_roadmap", "review_roadmap", "show_roadmap", "archive_roadmap", or
8
+ "compact_roadmap". Covers six actions: make_roadmap (create + seed rows from disk),
9
+ update_roadmap (re-infer stages, sync to disk, cascade to the portfolio), review_roadmap
10
+ (read-only health check for drift/broken links), show_roadmap (read-only status overview —
11
+ progress, stages, and next steps), archive_roadmap (move a completed feature to the archive), and
12
+ compact_roadmap (slim a bloated roadmap: strip the legacy Notes log and trim fat cells). Detects
13
+ the action from the user's phrasing or arguments and branches. The roadmap is the cross-session
14
+ derived cross-session summary at the RD/plan altitude.
15
+ ---
16
+
17
+ # roadmap — Live Feature-Set Roadmap Keeper
18
+
19
+ > **CodeOps Artifact Schema**: 1
20
+
21
+ ## CodeOps derived-status rule
22
+
23
+ Execution-plan checklists and plan metadata are authoritative. Derive status without writing a
24
+ second state store. For a read-only summary, run:
25
+
26
+ ```bash
27
+ python3 "${CODEOPS_PLUGIN_ROOT}/scripts/codeops_plan.py" --root . --json
28
+ ```
29
+
30
+ The helper reads every `> **Implements**:` declaration and each `[ ]`/`[~]`/`[x]`/`[!]` task.
31
+ Its output is derived and read-only; a nonzero exit means a required plan artifact, RD mapping, or
32
+ blocked reason is missing. Updating one row must never advance its siblings. Roadmaps summarize
33
+ lifecycle, tasks, blockers, and RD delivery; they never become an independent owner of those
34
+ facts. If roadmap text conflicts with the plan, report drift and repair only the derived view.
35
+
36
+ ## Resolve paths first (layout-aware)
37
+
38
+ Before any action, determine the layout via **[../../_shared/layout-convention.md](../../_shared/layout-convention.md)**. When reading it with a tool, use the unambiguous installed path `${CODEOPS_PLUGIN_ROOT}/_shared/layout-convention.md`; do not reconstruct the Markdown link path by hand.
39
+
40
+ - **Flat layout** (no `codeops/.codeops.yml`): a single roadmap at `plans/00-roadmap.md`. Behaves
41
+ **exactly as flat layout always has** — everything below that mentions "the roadmap" means this one file, and the
42
+ portfolio tier does not exist (its cascade steps are inert).
43
+ - **Nested layout** (marker present): **two tiers** — a per-feature roadmap at
44
+ `codeops/features/<f>/00-roadmap.md` and a **portfolio roadmap** at `codeops/00-roadmap.md` (one
45
+ row per feature, auto-cascaded). In nested layout the skill asks/confirms the **target feature**
46
+ before acting on a per-feature roadmap, and creates the feature folder lazily (never guesses).
47
+
48
+ The roadmap is a living document that tracks an entire **feature** at a higher altitude than any
49
+ individual execution plan. Where `99-execution-plan.md` tracks the tasks *within one feature*, the
50
+ roadmap tracks *every requirement (RD), plan, and task* and the lifecycle stage each is in. It is
51
+ the user's cross-session lifeline: open it to see what is done, in flight, blocked, or in backlog.
52
+
53
+ It never replaces the execution plan; it indexes and summarizes across many of them.
54
+
55
+ ## Action dispatch
56
+
57
+ Detect the action from the user's phrasing or argument and branch:
58
+
59
+ | Trigger | Action |
60
+ |---------|--------|
61
+ | `make_roadmap`, "create the roadmap", "start a roadmap" | **make** — create + seed |
62
+ | `update_roadmap`, "sync the roadmap", "update the roadmap" | **update** — re-infer + sync |
63
+ | `review_roadmap`, "check the roadmap", "is the roadmap healthy" | **review** — read-only health check |
64
+ | `show_roadmap`, "show the roadmap", "roadmap status", "where do things stand", "what's the progress on <feature>" | **show** — read-only status overview |
65
+ | `archive_roadmap`, "archive the feature-set", "archive the roadmap" | **archive** — move to `_archive` |
66
+ | `compact_roadmap`, "compact the roadmap", "clean up / slim the roadmap" | **compact** — strip the legacy Notes log + trim fat cells |
67
+
68
+ ## The lifecycle state machine
69
+
70
+ ```
71
+ ⬜ Backlog — RD identified but not yet drafted
72
+ ✏️ RD Drafted — RD document written
73
+ 🔎 RD Preflighted — RD passed preflight
74
+ 📋 Plan Created — a plan was produced
75
+ 🔬 Plan Preflighted — plan passed preflight
76
+ 🔄 Executing — execution in progress
77
+ ✅ Done — plan fully executed
78
+ ⛔ Blocked — cannot proceed (waiting on a Deferred dependency)
79
+ ⏸️ Deferred — a discovered dependency pulled out as its own tracked item
80
+ ```
81
+
82
+ **Linear happy path:**
83
+ `Backlog → RD Drafted → RD Preflighted → Plan Created → Plan Preflighted → Executing → Done`.
84
+
85
+ `Blocked` and `Deferred` are **orthogonal overlays** on the linear path — a row in
86
+ any stage can become `Blocked`, and any discovered dependency can be pulled out as
87
+ a `Deferred` sub-row.
88
+
89
+ The full stage-transition map (which lifecycle events advance which rows, and which
90
+ skill fires each hook) is in [stage-hooks.md](stage-hooks.md) — read it when wiring
91
+ or reasoning about transitions.
92
+
93
+ ## Task rows (nested layout)
94
+
95
+ A feature's roadmap also tracks **lightweight tasks** (`T-NN`) beside its RD rows. A task uses the
96
+ compact lifecycle `⬜ Backlog → 🔄 Executing → ✅ Done` (with `⛔`/`⏸️` overlays) and never the
97
+ RD/Plan-Preflight stages. A trivial task is a row with no RD and no plan link; a non-trivial task
98
+ links a single mini-plan. `T-NN` and `RD-NN` are separate per-feature namespaces (no collisions).
99
+ Full task model + routing: [../../_shared/layout-convention.md](../../_shared/layout-convention.md).
100
+
101
+ ## Two governing rules (apply to every action)
102
+
103
+ **Ask-if-missing / sync-if-exists** — the roadmap is never auto-created silently:
104
+
105
+ - **When MISSING:** ask the user whether to create it. Never fabricate one without consent.
106
+ - **When it EXISTS:** always sync from disk state automatically — never ask, never prompt.
107
+ Stage hooks fire silently.
108
+
109
+ This keeps the roadmap opt-in to create, but always-fresh once it exists.
110
+
111
+ **Real-time update mandate** — the roadmap is updated **immediately** on each stage
112
+ transition, **BEFORE** verification, commit, or the next action. Update order:
113
+ `complete the stage transition → update the resolved roadmap file → proceed` (the resolved file
114
+ per the convention doc: `plans/00-roadmap.md` flat, the feature's `00-roadmap.md` nested). On each
115
+ transition update the row's `Stage`, `Status`, and `Last Updated`, plus the header
116
+ `Progress` counter and `Last Updated`. Rationale — crash resilience: a session can
117
+ crash or hit context limits at any moment; if the roadmap is stale the user loses
118
+ their cross-session view. Keep it always reflecting reality, and never end a
119
+ session/task with a stale roadmap.
120
+
121
+ **Stage-inference artifacts & the never-regress rule** — stages must be re-inferable from disk:
122
+
123
+ - `RD Drafted` ⇔ the RD file exists. `Plan Created` ⇔ a linked plan folder exists.
124
+ `Executing`/`Done` ⇔ the plan's `99-execution-plan.md` checklist state (`Done` = all `[x]`).
125
+ - `RD Preflighted` ⇔ passing evidence names that exact RD as its audit target: either
126
+ `00-preflight-report-RD-NN.md`, or the set-wide `00-preflight-report.md` whose recorded target
127
+ includes it. A narrow report never advances sibling RDs.
128
+ - `Plan Preflighted` ⇔ the plan folder has a passing set-wide `00-preflight-report.md`. A
129
+ `00-preflight-report-<document-stem>.md` proves only that document passed and does not advance the
130
+ whole plan.
131
+ (The preflight skill saves these reports — they ARE the stage's disk artifacts.)
132
+ - **Stages never regress on sync.** `update` may only advance or preserve a row's stage; if disk
133
+ suggests a LOWER stage than recorded, keep the recorded stage and report the discrepancy
134
+ (review_roadmap flags it). Regressing a row requires an explicit user instruction, recorded in
135
+ the git commit message that makes the regression (and, if it changes a dependent, noted terse in
136
+ that dependent's `Depends-on / Blocker` cell) — never in a running Notes log.
137
+
138
+ **Portfolio cascade mandate (nested layout only)** — the real-time update extends one altitude
139
+ up. After completing a per-feature stage transition, update that feature's row in
140
+ `codeops/00-roadmap.md` (re-roll Stage Summary / Progress / Status; bump the portfolio counts)
141
+ **before** verify/commit/next — **but only on the integration branch**. On a **non-integration
142
+ branch** (a parallel feature worktree) the portfolio write is **deferred**: update only the
143
+ isolated per-feature roadmap and leave `codeops/00-roadmap.md` untouched, so concurrent worktrees
144
+ never collide on it; `roadmap update` reconciles the portfolio from disk once the work lands on the
145
+ integration branch. In flat layout this step is inert. Full cascade rule, the integration-branch
146
+ deferral, and the status roll-up are in [stage-hooks.md](stage-hooks.md).
147
+
148
+ ## Deterministic linking (RD ↔ plan)
149
+
150
+ Plan folders are named by feature (e.g. `plans/billing/`) and carry **no encoded RD
151
+ id**, and the repo can hold multiple unrelated feature-sets at once, so "everything
152
+ under `plans/`" is **not** a valid membership rule. Link deterministically instead:
153
+
154
+ - Every plan declares every requirement it implements on one `> **Implements**: RD-NN, RD-NN`
155
+ line in its `00-index.md` (feature-qualified identifiers in nested layout — see the ID rules in
156
+ the convention doc). The `Plan Created` hook reads this line and links the plan to each matching
157
+ RD row in that feature's roadmap.
158
+ - A plan with **no declared RD** is linked only when the user explicitly states which
159
+ RD (or `DEF-n`) it belongs to. Unrelated plans are never silently swept in.
160
+
161
+ ## Deferred & Blocked handling
162
+
163
+ When a blocking dependency is discovered mid-preflight or mid-execution:
164
+
165
+ 1. Add a **nested `↳ DEF-n` sub-row** directly beneath the affected parent row, visually tied to it.
166
+ 2. Set the **parent row's Stage cell to `⛔ Blocked (was: <prior stage>)`** — the prior stage is
167
+ recorded IN the cell so recovery never depends on conversation memory — and name the `DEF-n`
168
+ it waits on in `Depends-on / Blocker`.
169
+ 3. Track the `DEF-n` sub-row through its own lifecycle stages like any other item.
170
+ 4. When `DEF-n` reaches `Done`, the parent **leaves `Blocked`** and resumes the stage recorded in
171
+ its `(was: …)` annotation.
172
+
173
+ Deferred work is never hidden in a separate section — it stays nested under the item
174
+ it blocks so the dependency is obvious at a glance.
175
+
176
+ ---
177
+
178
+ ## make — create the roadmap
179
+
180
+ Create the roadmap using the template in [template.md](template.md) (header, legend, tracker
181
+ columns; and the **portfolio template** for nested layout). Path per the convention doc.
182
+
183
+ **Flat layout** → create `plans/00-roadmap.md`:
184
+
185
+ 1. **Ask the user once for the feature-set name** — used in the header and as the
186
+ archive folder slug.
187
+ 2. **Auto-populate from disk (suggest, don't sweep):**
188
+ - Seed one row per `requirements/RD-*.md` found.
189
+ - For each `plans/*/99-execution-plan.md`, *suggest* a link plus an inferred stage
190
+ (from checklist completion), but only write the plan into the roadmap **after the
191
+ user confirms** it belongs to this feature-set.
192
+ 3. **If the roadmap already exists:** do NOT ask — sync it from disk state instead
193
+ (the update action).
194
+
195
+ **Nested layout** → two tiers:
196
+
197
+ 1. **Portfolio** (`codeops/00-roadmap.md`): create it if absent (a fresh-scaffolded or just-migrated
198
+ repo already has a seeded one). Seed one row per `codeops/features/<f>/` present, each row
199
+ derived from that feature's roadmap.
200
+ 2. **Per-feature roadmap** (`codeops/features/<f>/00-roadmap.md`): ask/confirm the target feature,
201
+ create the feature folder lazily if new, then seed it from that feature's `requirements/` +
202
+ `plans/` (same suggest-don't-sweep rule), and add `T-NN` task rows where tasks exist.
203
+ 3. After creating/seeding a feature roadmap, **cascade** its summary to the portfolio row.
204
+
205
+ ## update — re-infer stages and sync to disk
206
+
207
+ Advance stages and sync the roadmap to current disk state.
208
+
209
+ - Walk each row, re-infer its stage from disk per the **stage-inference artifacts** above (RD
210
+ present, preflight reports, plan present, checklist completion) and update `Stage`, `Status`,
211
+ and `Last Updated` — honoring the **never-regress rule** (advance or preserve; report
212
+ discrepancies instead of downgrading).
213
+ - **Delegate ALL counter arithmetic to the engine:** run `scripts/codeops-roadmap-sync.sh` (write
214
+ mode). It recomputes the header `Progress` counters, the portfolio `Progress`/`Status` cells,
215
+ and the `Features` count from disk — **never re-derive these numbers in prose** (the same
216
+ prose-vs-script division as the migration engine: the skill owns stage judgment, the script
217
+ owns arithmetic). Stage Summary phrasing remains yours. The engine counts only `RD-*` rows
218
+ (`T-*` tasks are excluded), is **follow-on aware** (a feature with all RDs Done but an open
219
+ `## Open follow-ons` row holds at `🔄`), and **preserves hand-maintained values** — a
220
+ non-computed `Progress` such as `n/a` and any ` · …` / ` (…)` annotation are kept verbatim, and a
221
+ held row's `Status` is not re-rolled. See [template.md](template.md) → *Open follow-ons* and the
222
+ Progress/Features field notes for the authoring contract.
223
+ - **Nested layout:** stage re-inference is per-feature (your judgment); the script performs the
224
+ numeric **cascade** into `codeops/00-roadmap.md` in the same run.
225
+ - **Recommend compaction if the roadmap is bloated:** run `scripts/codeops-roadmap-compact.sh
226
+ --check`; if it reports a legacy `## Notes` section or an oversized cell, recommend the user run
227
+ **compact**. `update` itself never strips or trims — it only re-infers stages and delegates
228
+ counters (mirrors how it delegates arithmetic to the sync engine).
229
+ - **Rows stay dependency-ordered:** keep prerequisites above the rows that depend on them (see
230
+ [template.md](template.md) → Row ordering & discipline); a planned dependency is a terse
231
+ `depends on RD-NN` in the row's `Depends-on / Blocker` cell.
232
+ - **If the roadmap is missing:** fall back to **make** — ask whether to create it, then create it.
233
+
234
+ ## review — read-only health check
235
+
236
+ Run a health check and report findings; change nothing on disk.
237
+
238
+ - **Counter/cascade drift is mechanical:** run `scripts/codeops-roadmap-sync.sh --check` — its
239
+ `DRIFT` lines and non-zero exit ARE that portion of the report (Progress counters, portfolio
240
+ Progress/Status cells, Features count). Do not re-derive the numbers in prose. Preserved
241
+ hand-maintained values are reported on informational `HELD` lines and do **not** fail the check —
242
+ an `n/a` sentinel or an annotated cell is healthy, not drift; surface `HELD` lines so a human can
243
+ eyeball the hand-maintained values.
244
+ - **Bloat is mechanical too:** run `scripts/codeops-roadmap-compact.sh --check` — a reported legacy
245
+ `## Notes` section or oversized cell is that portion of the health report; recommend **compact**
246
+ to slim it (review itself changes nothing on disk).
247
+ - Every RD row references an existing `requirements/RD-*.md` file.
248
+ - Every plan link references an existing plan folder.
249
+ - The recorded `Stage` matches on-disk reality per the stage-inference artifacts (flag drift;
250
+ remember stages never regress — a lower-than-recorded disk state is a discrepancy to report,
251
+ not a downgrade to apply).
252
+ - Every `Blocked` row has a live `DEF-n` sub-row and a `(was: <stage>)` annotation; if the
253
+ `DEF-n` is already `Done`, flag the parent as ready to unblock.
254
+ - **Nested layout (both tiers):** every portfolio row links an existing feature roadmap; Stage
255
+ Summary phrasing matches the feature's rolled-up state.
256
+ - **If the roadmap is missing:** return the error below.
257
+
258
+ ## show — present a status overview
259
+
260
+ Render a human-facing snapshot of where a feature (or the whole repo) stands: overall progress, the
261
+ per-item stage table, and the concrete next steps. **Read-only — this action never writes to disk.**
262
+ It is the presentation counterpart to `review`: `review` audits the roadmap for drift and broken
263
+ links, `show` simply *displays* it. Do not run the sync engine in write mode or edit any file here.
264
+
265
+ **Migrated artifacts are first-class inputs.** A document carrying both `CodeOps Artifact Schema: 1`
266
+ and `Migrated From Claude CodeOps Skills Version: ...` is a CodeOps artifact with retained
267
+ provenance, not an obsolete Claude-only artifact. Read its existing roadmap, requirements, and plan
268
+ links normally. Never hide or ignore a row merely because its content predates the migration.
269
+
270
+ **Resolve the target (layout-aware):**
271
+
272
+ - **Flat layout** → present the single `plans/00-roadmap.md`.
273
+ - **Nested + a feature argument** (`show_roadmap <feature>`) → present that feature's
274
+ `codeops/features/<f>/00-roadmap.md`, including its `T-NN` task rows and any `## Open follow-ons`.
275
+ - **Nested + no argument** → present the **portfolio** `codeops/00-roadmap.md` (one row per feature)
276
+ as the overview, then offer to drill into a named feature. If the target feature is ambiguous, ask
277
+ — never guess (same rule as the other actions).
278
+
279
+ **What to present** (adapt the depth to the roadmap's size; keep it scannable):
280
+
281
+ 1. **A one-line header** — which roadmap you are reading (its resolved path) and its recorded
282
+ `Last Updated`.
283
+ 2. **An overall progress line** — the header `Progress` fraction/percent (portfolio: the `Features`
284
+ count), plus a short phrase on what most recently landed and what is in flight. **Report the
285
+ recorded counters as-is; do not silently recompute or mutate them.** If a row's `Stage` or a
286
+ counter looks stale versus disk (apply the stage-inference artifacts read-only), note the
287
+ suspected drift in one line and suggest `update_roadmap` — never edit to "fix" it here.
288
+ 3. **The tracker as a table** — the roadmap's rows with their `ID`, `Title`, `Stage`, `Status`
289
+ emoji, `Plan` (✔ / —), and `Depends-on / Blocker`, in dependency order, with the legend beneath.
290
+ Preserve `↳ DEF-n` sub-rows nested under the row they block.
291
+ 4. **"Where you stand right now"** — a few grounded bullets: what just shipped, what is in flight,
292
+ anything `Blocked` (name the `DEF-n` it waits on), and how much backlog remains.
293
+ 5. **"Natural next steps"** — 1–3 concrete, state-grounded suggestions (e.g. preflight the created
294
+ plan, execute it, unblock a `DEF-n`, or draft the next backlog RD). Lead with the single most
295
+ obvious continuation; the user decides.
296
+
297
+ **If the roadmap is missing:** return the same error as `review` (below) — never fabricate one.
298
+
299
+ ## archive — archive a completed feature
300
+
301
+ **Flat layout** (membership is **explicit** — move only the rows listed in the roadmap):
302
+
303
+ 1. Read the feature-set slug from the roadmap header.
304
+ 2. Create `plans/_archive/<feature-set>/`.
305
+ 3. Move into it: the roadmap itself, plus **only** the RD documents and plan folders
306
+ that appear as rows in the roadmap.
307
+ 4. Leave all other `requirements/` and `plans/` content untouched. Never sweep every
308
+ folder under `plans/`.
309
+ 5. A fresh roadmap can then be created for the next feature-set.
310
+ 6. **If the roadmap is missing:** return the error below.
311
+
312
+ **Nested layout** (feature-level, whole-folder — FR-12 / AR #11):
313
+
314
+ 1. Confirm the feature to archive (its rolled-up Status should be ✅ Done; warn if not). Never
315
+ fragment a live feature — archive the whole folder, not individual plans.
316
+ 2. `git mv codeops/features/<f> codeops/_archive/<f>` (preserves history; intra-feature links
317
+ survive because the whole folder shifts).
318
+ 3. In `codeops/00-roadmap.md`, **move** the feature's row from `## Features` to `## Archived`
319
+ (mark 📦, update the Roadmap link to `_archive/<f>/00-roadmap.md`) — **never delete it** — and
320
+ refresh the `Features` count + `Last Updated`.
321
+ 4. **If the portfolio is missing:** return the error below.
322
+
323
+ ---
324
+
325
+ ## compact — shrink an existing roadmap (both layouts)
326
+
327
+ Slim a roadmap that has bloated over time — a legacy `## Notes` running log and/or verbose table
328
+ cells — back to a lean status table. The mechanical, safety-critical work is delegated to the
329
+ engine; the judgment (rewriting a fat cell down to a terse phrase) is yours.
330
+
331
+ 1. **Resolve layout.** compact operates on **every** roadmap in the repo — the portfolio, every
332
+ feature roadmap, and `_archive/` — not a single feature.
333
+ 2. **Require a clean git tree.** Deleting the Notes log is only reversible through git, so if the
334
+ tree is dirty, STOP and ask the user to commit or stash first (the engine also refuses — check
335
+ early so the user gets a clean message rather than a mid-run abort).
336
+ 3. **Run the engine** — `scripts/codeops-roadmap-compact.sh` (apply). It strips every `## Notes`
337
+ section in place and prints `FLAG <file>:<row>:<column> (<n> chars)` lines for oversized cells.
338
+ It never rewrites a cell.
339
+ 4. **Trim each flagged cell** to a terse status phrase, **preserving the load-bearing tokens
340
+ verbatim** — `waiting on DEF-n` and `Blocked (was: <stage>)`. The verbose original stays in git
341
+ history; never relocate it to another file on disk.
342
+ 5. **Confirm, then re-sync.** Run `scripts/codeops-roadmap-compact.sh --check` — it must report no
343
+ `## Notes` section and no oversized cell. Then run `scripts/codeops-roadmap-sync.sh` so the
344
+ counter surfaces stay consistent.
345
+ 6. **Report and stop.** List the affected files and leave the change for the user to review and
346
+ commit (`git status` / `git diff`); never auto-commit.
347
+
348
+ **If no roadmap exists:** report `no roadmap found — nothing to compact`; never create one.
349
+
350
+ ---
351
+
352
+ ## Error handling
353
+
354
+ | Error case | Handling |
355
+ |------------|----------|
356
+ | **review** / **show** / **archive** when roadmap missing | Return `**Error:** No roadmap found at <resolved roadmap path>. Run make_roadmap first.` (path per the convention doc — `plans/00-roadmap.md` flat, `codeops/00-roadmap.md` or the feature roadmap nested) |
357
+ | **update** when roadmap missing | Fall back to **make** (ask-if-missing, then create) |
358
+ | **make** when roadmap already exists | Do NOT ask; sync from disk state (the update action) |
359
+ | Nested: per-feature transition but portfolio row stale | Cascade is mandatory + immediate; `review` flags the drift (AR #8) |
360
+ | Nested: target feature ambiguous | Ask the user; never guess (AR #26) |
361
+ | **compact** on a dirty or non-git tree | STOP; ask the user to commit/stash first — the engine also refuses (exit 1) |
362
+ | **compact** when no roadmap exists | Report `no roadmap found — nothing to compact`; never create one |
363
+
364
+ ## Project conventions
365
+
366
+ For project-specific settings (build/test/verify commands, package manager,
367
+ structure, conventions), read the project's AGENTS.md (or detected project
368
+ conventions). If no AGENTS.md exists, detect settings from manifest files and use
369
+ only facts you can read — do not invent settings.
370
+
371
+ ## Pointers & related skills
372
+
373
+ - [template.md](template.md) — the `plans/00-roadmap.md` template, legend, tracker
374
+ columns, and a worked example. Read before **make**.
375
+ - [stage-hooks.md](stage-hooks.md) — the full stage-transition map, which skill fires
376
+ which hook, and the source-of-truth rule. Read when reasoning about transitions.
377
+ - `scripts/codeops-roadmap-compact.sh` — the compact engine driven by the **compact** action, and
378
+ by `update`/`review`'s `--check` bloat detection (strips the legacy Notes log, flags fat cells).
379
+ - Related skills: requirements (`RD Drafted` hook), preflight (`RD/Plan Preflighted`
380
+ hooks), make-plan (`Plan Created` hook + linking), exec-plan (`Executing` / `Done` /
381
+ `Blocked` hooks).
@@ -0,0 +1,80 @@
1
+ # Stage Transition Map & Hooks
2
+
3
+ The roadmap sits **above** the per-feature execution plan. It does not replace
4
+ the execution plan — it indexes and summarizes across many of them.
5
+
6
+ Resolve paths via **[../../_shared/layout-convention.md](../../_shared/layout-convention.md)**. In
7
+ **nested layout** there are two roadmap altitudes (per-feature + portfolio); in **flat layout**
8
+ there is a single roadmap and the portfolio cascade step below is inert.
9
+
10
+ | Altitude | Document (flat / nested) | Tracks | Produced/updated by |
11
+ |----------|--------------------------|--------|---------------------|
12
+ | Portfolio (highest, nested only) | *(n/a)* / `codeops/00-roadmap.md` | One row per feature in the repo | this skill + the **cascade hook** below |
13
+ | Feature-set / per-feature | `plans/00-roadmap.md` / `codeops/features/<f>/00-roadmap.md` | Every RD/plan/task + its lifecycle stage | this skill (`make` / `update`) + the stage hooks below |
14
+ | Single feature (low) | `plans/[feature]/99-execution-plan.md` / `codeops/features/<f>/plans/<plan>/99-execution-plan.md` | Tasks within one feature/plan | the make-plan / exec-plan skills |
15
+
16
+ ## Stage transition map
17
+
18
+ Other skills fire these transitions on the roadmap. Each hook follows the
19
+ **ask-if-missing / sync-if-exists** rule: if no roadmap exists the hook is inert
20
+ (never auto-create); if one exists the hook fires silently (never prompt).
21
+
22
+ | Lifecycle event | Roadmap effect |
23
+ |-----------------|----------------|
24
+ | RD created (the requirements skill, `make-requirements` / `add_requirement`) | Row → `RD Drafted` (✏️) |
25
+ | Preflight passes on an RD (the preflight skill) | Row → `RD Preflighted` (🔎) |
26
+ | A plan is produced (the make-plan skill) | Row → `Plan Created` (📋); link the plan |
27
+ | Preflight passes on a plan (the preflight skill) | Row → `Plan Preflighted` (🔬) |
28
+ | Execution starts (the exec-plan skill) | Row → `Executing` (🔄) |
29
+ | Execution completes (the exec-plan skill) | Row → `Done` (✅) |
30
+ | Dependency discovered mid-preflight / mid-exec | Add a nested `↳ DEF-n` sub-row; parent → `Blocked` (⛔) |
31
+ | `DEF-n` reaches `Done` | Parent leaves `Blocked`, resumes its prior stage |
32
+
33
+ ## The portfolio cascade hook (nested layout only — AR #8)
34
+
35
+ The portfolio roadmap is a derived summary, kept fresh by a cascade that extends the real-time
36
+ update mandate **one altitude up**. On **every** per-feature stage transition above:
37
+
38
+ ```
39
+ complete the per-feature roadmap transition (codeops/features/<f>/00-roadmap.md)
40
+ → on the INTEGRATION branch: immediately update that feature's row in codeops/00-roadmap.md
41
+ (re-roll Stage Summary / Progress / Status; bump the portfolio Last Updated + Features count)
42
+ → on a NON-INTEGRATION branch (a parallel feature worktree): DEFER the portfolio write —
43
+ leave codeops/00-roadmap.md untouched; `roadmap update` reconciles it from disk on landing
44
+ → THEN proceed (verify / commit / next action)
45
+ ```
46
+
47
+ - On the **integration branch** the cascade is **mandatory and immediate** — never end a
48
+ session/task there with a portfolio row that disagrees with its feature roadmap; `review` flags
49
+ any such drift.
50
+ - **Parallel worktrees — integration-branch deferral:** on a **non-integration branch** the
51
+ portfolio write is **deferred** so concurrent worktrees never collide on the shared
52
+ `codeops/00-roadmap.md`. Resolve the integration branch the way `analyze-project` does — the
53
+ `integrationBranch` marker key, else `origin/HEAD`, else `main`/`master`; if `git` is unavailable,
54
+ treat the current branch as integration (unchanged behaviour). The **per-feature** roadmap write
55
+ stays immediate — it is isolated per feature, so it never conflicts.
56
+ - **Status roll-up:** any executing row → 🔄; all rows done → ✅; any blocked row → ⛔; otherwise ⬜.
57
+ - **Cross-feature blockers** stay within the feature's roadmap, named feature-qualified in the
58
+ depending row's `Depends-on / Blocker` cell (e.g. `waiting on auth/RD-02`). The portfolio has no
59
+ Notes section — it rolls the blocked feature up to ⛔ and the detail lives in that row's cell.
60
+ - In **flat layout** there is no portfolio, so this hook is **inert** (unchanged flat-layout behaviour).
61
+
62
+ ## Which skill owns which hook
63
+
64
+ - **requirements skill** — fires the `RD Drafted` hook on RD creation.
65
+ - **preflight skill** — fires the `RD Preflighted` and `Plan Preflighted` hooks.
66
+ - **make-plan skill** — fires the `Plan Created` hook and links the plan (via the
67
+ `> **Implements**: RD-NN` line — see deterministic linking in SKILL.md).
68
+ - **exec-plan skill** — fires the `Executing`, `Done`, and `Blocked` + `DEF` hooks.
69
+
70
+ ## Source-of-truth rule (stated directly here)
71
+
72
+ The roadmap is a **cross-session derived view** at the RD/plan altitude. Requirements own agreed
73
+ behavior; plan metadata owns RD mapping; `99-execution-plan.md` owns task progress:
74
+
75
+ - **Read-if-exists** — when a roadmap exists, read it at the start of relevant work
76
+ to see what is done, in flight, blocked, or in the backlog.
77
+ - **Update-first** — apply the matching stage transition to the roadmap *before*
78
+ verification, commit, or the next action (see the real-time update mandate in SKILL.md).
79
+ - **Before ending a session/task** — make sure the roadmap reflects the latest
80
+ reality. Do not finish with a stale roadmap.