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,200 @@
1
+ # Roadmap Template & Tracker Reference
2
+
3
+ Resolve where the roadmap lives via **[../../_shared/layout-convention.md](../../_shared/layout-convention.md)**:
4
+
5
+ - **Flat layout** (no marker): a single roadmap at `plans/00-roadmap.md` — exactly as before.
6
+ - **Nested layout** (marker present): a **per-feature roadmap** at
7
+ `codeops/features/<f>/00-roadmap.md` (the template below, scoped to one feature, **plus task
8
+ rows**) and a **portfolio roadmap** at `codeops/00-roadmap.md` (one row per feature — see
9
+ [The portfolio roadmap template](#the-portfolio-roadmap-template)).
10
+
11
+ The per-feature roadmap and the flat roadmap share the same template, columns, and legend; use it
12
+ verbatim when creating either. The portfolio is a separate, higher-altitude template.
13
+
14
+ ## The single / per-feature roadmap template
15
+
16
+ ````markdown
17
+ # Roadmap: [Feature-Set Name]
18
+
19
+ > **Feature-Set**: [Feature-Set Name]
20
+ > **Status**: In Progress
21
+ > **Created**: [YYYY-MM-DD]
22
+ > **Last Updated**: [YYYY-MM-DD HH:MM]
23
+ > **Progress**: [Done RDs] / [Total RDs] ([Z]%)
24
+ > **CodeOps Artifact Schema**: 1
25
+
26
+ ## Legend
27
+
28
+ ⬜ Backlog · ✏️ RD Drafted · 🔎 RD Preflighted · 📋 Plan Created · 🔬 Plan Preflighted · 🔄 Executing · ✅ Done · ⛔ Blocked · ⏸️ Deferred
29
+
30
+ ## Tracker
31
+
32
+ | ID | Title | RD | Plan | Stage | Status | Last Updated | Depends-on / Blocker |
33
+ |----|-------|----|------|-------|--------|--------------|----------------------|
34
+ | RD-01 | [Title] | [link] | [link] | Done | ✅ | [date] | — |
35
+ | RD-02 | [Title] | [link] | [link] | Executing | 🔄 | [date] | — |
36
+ | RD-03 | [Title] | [link] | — | Blocked (was: RD Preflighted) | ⛔ | [date] | waiting on DEF-1 |
37
+ | ↳ DEF-1 | [Discovered dependency] | — | [link] | Plan Created | 📋 | [date] | blocks RD-03 |
38
+ | RD-04 | [Title] | — | — | Backlog | ⬜ | [date] | — |
39
+ ````
40
+
41
+ ## Header fields
42
+
43
+ - **Feature-Set** — display name; the slug form is the `plans/_archive/<slug>/` folder name on archive.
44
+ - **Status** — `In Progress` while active; `Archived` once `archive_roadmap` runs.
45
+ - **Created** / **Last Updated** — `Last Updated` bumps on every transition.
46
+ - **Progress** — `[Done RDs] / [Total RDs] ([Z]%)`; counts only top-level `RD-*` rows that reached
47
+ `Done`. `T-*` task rows and `↳ DEF-n` sub-rows never count toward the fraction. A Progress value
48
+ that is **not** this computed shape (e.g. `n/a`, or `history archived (no active RD tracker)`) is
49
+ treated as hand-maintained: the sync engine preserves it verbatim and does not touch it. A
50
+ computed value may carry a trailing ` · <note>` annotation (e.g. `2 / 2 (100%) · hardening done`);
51
+ the engine refreshes the count and keeps the ` · …` suffix.
52
+ - **CodeOps Artifact Schema** — the artifact-schema stamp (currently `1`).
53
+
54
+ ## Tracker columns
55
+
56
+ | Column | Meaning |
57
+ |--------|---------|
58
+ | ID | `RD-NN` for a top-level requirement; `T-NN` for a lightweight task (nested layout — separate per-feature namespace, see the task-lane spec); `↳ DEF-n` for a nested discovered dependency. |
59
+ | Title | Short human label. |
60
+ | RD | Relative link to `requirements/RD-*.md`, or `—` if not yet drafted. |
61
+ | Plan | Relative link to the plan folder's `00-index.md`, or `—` if no plan yet. |
62
+ | Stage | One of the 9 lifecycle states (text form). A `Blocked` row records its prior stage in-cell — `Blocked (was: <stage>)` — so unblocking never depends on memory. |
63
+ | Status | The matching emoji for the stage (see legend). |
64
+ | Last Updated | Date (or date + time) of the last change to this row. |
65
+ | Depends-on / Blocker | Terse. Name a planned prerequisite (`depends on RD-03`) or, for a `Blocked` row, the `DEF-n` being waited on — a short phrase, never a paragraph. |
66
+
67
+ Links are relative to the roadmap file itself. Flat layout (`plans/00-roadmap.md`): RDs are
68
+ `../requirements/RD-NN-*.md`, plans are `<plan>/00-index.md`. Nested layout
69
+ (`codeops/features/<f>/00-roadmap.md`): RDs are `requirements/RD-NN-*.md`, plans are
70
+ `plans/<plan>/00-index.md`.
71
+
72
+ ## Row ordering & discipline
73
+
74
+ - **Order rows by dependency** — put prerequisites above the rows that depend on them, so the list
75
+ is worked top-to-bottom, one row at a time, until the roadmap is done. Capture a *planned*
76
+ dependency terse in the `Depends-on / Blocker` cell (e.g. `depends on RD-01`); a *discovered*
77
+ blocker becomes a `↳ DEF-n` sub-row with `waiting on DEF-n` in the cell.
78
+ - **Keep it a table.** A roadmap is only its table (the per-feature/flat roadmap is header + Legend
79
+ + Tracker; the portfolio adds Features + Archived). A row's cells are short status phrases, never
80
+ narrative — per-item history and rationale live in the plan folder and git, not here. There is no
81
+ running-notes log; a stage regression is explained in the git commit that makes it.
82
+
83
+ ## Worked example
84
+
85
+ ```markdown
86
+ # Roadmap: Billing Platform
87
+
88
+ > **Feature-Set**: Billing Platform
89
+ > **Status**: In Progress
90
+ > **Created**: 2026-05-01
91
+ > **Last Updated**: 2026-05-14 16:20
92
+ > **Progress**: 1 / 4 (25%)
93
+ > **CodeOps Artifact Schema**: 1
94
+
95
+ ## Legend
96
+
97
+ ⬜ Backlog · ✏️ RD Drafted · 🔎 RD Preflighted · 📋 Plan Created · 🔬 Plan Preflighted · 🔄 Executing · ✅ Done · ⛔ Blocked · ⏸️ Deferred
98
+
99
+ ## Tracker
100
+
101
+ | ID | Title | RD | Plan | Stage | Status | Last Updated | Depends-on / Blocker |
102
+ |----|-------|----|------|-------|--------|--------------|----------------------|
103
+ | RD-01 | Invoicing core | [RD-01](../requirements/RD-01-invoicing.md) | [invoicing](invoicing/00-index.md) | Done | ✅ | 2026-05-10 | — |
104
+ | RD-02 | Payment gateway | [RD-02](../requirements/RD-02-payments.md) | — | Blocked (was: RD Drafted) | ⛔ | 2026-05-14 | waiting on DEF-1 |
105
+ | ↳ DEF-1 | Secrets vault integration | — | [vault](vault/00-index.md) | Executing | 🔄 | 2026-05-14 | blocks RD-02 |
106
+ | RD-03 | Dunning emails | [RD-03](../requirements/RD-03-dunning.md) | — | RD Preflighted | 🔎 | 2026-05-12 | — |
107
+ | RD-04 | Usage metering | — | — | Backlog | ⬜ | 2026-05-01 | — |
108
+ ```
109
+
110
+ Here RD-02 is `Blocked` by the nested `DEF-1` sub-row; once DEF-1 reaches `Done`,
111
+ RD-02 resumes from its prior stage.
112
+
113
+ In a **nested-layout** repo this same roadmap lives at `codeops/features/<f>/00-roadmap.md` and
114
+ may also carry `T-NN` **task rows** beside its RD rows (a trivial task is just a row; a non-trivial
115
+ one links a single mini-plan). RD and `T` ids are separate per-feature namespaces and never collide.
116
+
117
+ ## Open follow-ons (optional)
118
+
119
+ When every `RD-*` row is `Done` but post-completion work is still outstanding, record it in an
120
+ optional `## Open follow-ons` section **below the Tracker** — so the feature reads as "shipped, with
121
+ tail work" rather than either fully done or artificially incomplete:
122
+
123
+ ```markdown
124
+ ## Open follow-ons
125
+
126
+ | Item | Scope | Stage | Status |
127
+ |------|-------|-------|--------|
128
+ | `usage-export` | Production usage export, deferred post-launch | Backlog | ⬜ no plan yet |
129
+ ```
130
+
131
+ The table's **last column must be `Status`**. A follow-on is *open* when its Status cell contains no
132
+ ✅. While any follow-on is open, the sync engine rolls the feature up to `🔄` (not `✅`) and excludes
133
+ it from the portfolio `Features` done count — but follow-on rows **never** count toward the RD
134
+ fraction (a feature with 2/2 RDs Done and an open follow-on still reads `2/2 RDs`). A section whose
135
+ table is not `Status`-last is ignored. Once every follow-on row is ✅ (or the section is removed),
136
+ the feature rolls up `✅` normally.
137
+
138
+ ---
139
+
140
+ ## The portfolio roadmap template
141
+
142
+ > **Nested layout only.** Lives at `codeops/00-roadmap.md`. One row per feature in the repo; it is
143
+ > a *derived summary* of the per-feature roadmaps, never the detailed record. Each feature's Stage
144
+ > Summary, Progress, and Status roll up from that feature's own roadmap. Roll-up precedence: any
145
+ > blocked → ⛔; all RDs Done with an open follow-on → 🔄; all RDs Done and none open → ✅; any
146
+ > executing → 🔄; else ⬜. The portfolio **auto-cascades**: every per-feature stage transition
147
+ > immediately updates that feature's portfolio row (see [stage-hooks.md](stage-hooks.md)).
148
+
149
+ ````markdown
150
+ # Portfolio Roadmap: [Repo / Product Name]
151
+
152
+ > **Status**: Active
153
+ > **Last Updated**: [YYYY-MM-DD HH:MM]
154
+ > **Features**: [Done] / [Total] done
155
+ > **CodeOps Artifact Schema**: 1
156
+
157
+ ## Legend
158
+
159
+ ⬜ Backlog · 🔄 In progress · ✅ Done · ⛔ Blocked · ⏸️ Deferred · 📦 Archived
160
+
161
+ ## Features
162
+
163
+ | Feature | Roadmap | Stage Summary | Progress | Status | Last Updated |
164
+ |---------|---------|---------------|----------|--------|--------------|
165
+ | billing | [→](features/billing/00-roadmap.md) | 2 RDs · 1 plan executing | 1/2 RDs | 🔄 | 2026-06-29 |
166
+ | auth | [→](features/auth/00-roadmap.md) | backlog | 0/3 RDs | ⬜ | 2026-06-20 |
167
+
168
+ ## Archived
169
+
170
+ | Feature | Roadmap | Completed | Last Updated |
171
+ |---------|---------|-----------|--------------|
172
+ | onboarding | [→](_archive/onboarding/00-roadmap.md) | 4/4 RDs | 2026-05-30 |
173
+ ````
174
+
175
+ ### Portfolio header fields
176
+
177
+ - **Status** — `Active` while the repo has live features; informational.
178
+ - **Last Updated** — bumps on every cascade.
179
+ - **Features** — `[Done] / [Total] done`, counting feature rows whose rolled-up Status is ✅. Rows
180
+ whose `Progress` is hand-maintained (e.g. `n/a`) are not engine-computed and are excluded from
181
+ both totals. A trailing ` (…)` annotation on this value is preserved when the count is refreshed.
182
+
183
+ ### Portfolio columns
184
+
185
+ | Column | Meaning |
186
+ |--------|---------|
187
+ | Feature | The feature folder name under `codeops/features/`. |
188
+ | Roadmap | Relative link to that feature's `00-roadmap.md`. |
189
+ | Stage Summary | Short derived phrase (e.g. "2 RDs · 1 plan executing"). |
190
+ | Progress | Derived count of `RD-*` rows (e.g. "1/2 RDs"), optionally with a ` · …` annotation. A hand-maintained value such as `n/a` is preserved by the engine, which then leaves this row's Status untouched. |
191
+ | Status | Rolled-up emoji (🔄 / ✅ / ⛔ / ⬜ / ⏸️); not re-rolled for a row whose Progress is hand-maintained. |
192
+ | Last Updated | Date of the last cascade to this row. |
193
+
194
+ ### Archived section
195
+
196
+ Archiving a feature **moves** its row here (📦) — never deletes it (AR #11). The feature folder is
197
+ `git mv`d to `codeops/_archive/<f>/`, so the Roadmap link points under `_archive/`.
198
+
199
+ A fresh-scaffolded or just-migrated repo seeds this portfolio automatically (the `setup-codeops`
200
+ migration writes a one-feature portfolio; refine it with `update`).
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: setup-codeops
3
+ description: >-
4
+ Sets up or upgrades CodeOps in the current git repo. It scaffolds a fresh nested codeops/ layout, auto-migrates a flat requirements/ + plans/ layout, and detects obsolete traceability.json workflow-state graphs in an existing nested project. Use when the user says "setup-codeops", "/setup-codeops", "set up codeops", "initialize codeops", "upgrade existing codeops", "migrate to the nested layout", or "scaffold the codeops structure". Supports --dry-run and unattended --yes. Every migration previews deterministically, refuses unsafe or ambiguous apply, requires clean Git state for writes, and is idempotent. setup-codeops is the SOLE writer of the layout marker.
5
+ ---
6
+
7
+ # CodeOps Layout Setup (`setup-codeops`)
8
+
9
+ > **CodeOps Artifact Schema**: 1
10
+
11
+ Set up the CodeOps **nested `codeops/` layout** for the git repo the user is currently in. Run as
12
+ `/codeops:setup-codeops` or the typeable alias `/setup-codeops`. This is the one skill that
13
+ **creates and owns the layout marker** `codeops/.codeops.yml`; every other skill only reads it.
14
+
15
+ Resolve all paths and the marker schema via **[_shared/layout-convention.md](../../_shared/layout-convention.md)** —
16
+ it is the single source of truth for the layout. Do not re-encode paths here.
17
+
18
+ ## Scope
19
+
20
+ - **Per-repo only.** One git repo at a time; no cross-repo or portfolio-of-projects work.
21
+ - This skill sets up the *structure*. It never authors requirements, plans, or roadmaps — that is
22
+ `make-requirements` / `make-plan` / `roadmap`, which then resolve paths via the convention doc.
23
+
24
+ ## Dispatch — detect repo state, then branch
25
+
26
+ Run inside the repo and detect, in this order:
27
+
28
+ ```
29
+ 1. Any codeops/features/*/traceability.json or codeops/_archive/*/traceability.json present
30
+ → LEGACY WORKFLOW-STATE UPGRADE, even when the layout marker is already present. Follow the
31
+ nested-project flow in migration.md. Preview with codeops_plan_migrate.py; with --yes,
32
+ apply only when the preview has no BLOCKED entry, then verify with codeops_plan.py.
33
+ This check intentionally precedes the marker no-op so re-running setup upgrades an
34
+ existing project without requiring a separate upgrade prompt.
35
+ 2. codeops/.codeops.yml present
36
+ → already set up. NO-OP for the layout: print a short status report (layout = nested, where
37
+ things live). BUT if the marker is **missing `integrationBranch`**, BACKFILL it — add that
38
+ one line (resolved to the repo's integration branch: `origin/HEAD`, else the current branch,
39
+ else `main`/`master`) without touching any other key; if it is already present, leave it.
40
+ Never re-scaffold or re-migrate. (Idempotent — a marker that is present and complete → no
41
+ change; this is the existing-project entry point for parallel-agents support.)
42
+ 3. Flat layout detected (requirements/ OR plans/00-roadmap.md OR any plans/<dir>/)
43
+ → MIGRATE. Follow migration.md: run the engine --dry-run, render the preview, take ONE
44
+ confirmation, then apply. The engine (scripts/codeops-migrate.sh) owns the algorithm.
45
+ 4. Neither
46
+ → fresh SCAFFOLD. Follow scaffold.md: create the minimal codeops/ skeleton.
47
+ ```
48
+
49
+ If the repo is **not a git repo**, refuse with a clear message (migration needs `git mv`; even a
50
+ fresh scaffold should live in version control) and suggest `git init` first.
51
+
52
+ ## Flags
53
+
54
+ | Flag | Effect |
55
+ |------|--------|
56
+ | *(none)* | Interactive: scaffold creates the skeleton; either migration previews then asks for one confirmation before applying. |
57
+ | `--dry-run` | Preview only — compute and show what would happen; change **nothing**. |
58
+ | `--yes` | Apply an unblocked migration without confirmation, then verify it. Safety refusals still apply. |
59
+
60
+ ## Migration engines (delegation — do not re-implement)
61
+
62
+ Flat-to-nested path arithmetic, slug derivation, hazard scanning, dirty-tree refusal,
63
+ path-traversal protection, idempotency, and `git mv` apply live in
64
+ **`scripts/codeops-migrate.sh`** (see [migration.md](migration.md)):
65
+
66
+ - Preview: `scripts/codeops-migrate.sh --dry-run`
67
+ - Apply: `scripts/codeops-migrate.sh --yes`
68
+
69
+ Never re-derive the move map in prose — read it from the engine's output and present it.
70
+
71
+ Existing nested-project graph removal and Markdown ownership inference live in
72
+ **`scripts/codeops_plan_migrate.py`**. Do not inspect or rewrite graph semantics in the skill:
73
+
74
+ - Preview: `python3 "${CODEOPS_PLUGIN_ROOT}/scripts/codeops_plan_migrate.py" ./codeops`
75
+ - Apply: `python3 "${CODEOPS_PLUGIN_ROOT}/scripts/codeops_plan_migrate.py" ./codeops --apply`
76
+ - Verify: `python3 "${CODEOPS_PLUGIN_ROOT}/scripts/codeops_plan.py" --root . --json`
77
+
78
+ On `--yes`, run preview first. Apply only when it exits successfully with no `BLOCKED` entry, then
79
+ run verification. The migrator itself owns clean-tree refusal, all-or-nothing writes, graph
80
+ deletion, and idempotency.
81
+
82
+ ## Reference files
83
+
84
+ - [scaffold.md](scaffold.md) — the minimal fresh-repo skeleton.
85
+ - [migration.md](migration.md) — flat-layout and legacy workflow-state migration UX.
86
+ - [_shared/layout-convention.md](../../_shared/layout-convention.md) — the layout/path/ID/marker source of truth.
87
+
88
+ ## Grounded Options & Recommendations
89
+
90
+ When a migration surfaces choices (e.g. an ambiguous slug source, or warnings the user must act
91
+ on), present only **genuinely viable** options, second-guessed and grounded in what the engine
92
+ actually reported, and lead with a recommendation. The user decides; never apply a migration
93
+ without an explicit confirmation (or `--yes`). For consequential choices, apply the
94
+ recommendation-hardening protocol (`_shared/recommendation-hardening.md`).
@@ -0,0 +1,106 @@
1
+ # CodeOps Migration UX
2
+
3
+ ## Existing nested project: remove legacy workflow state
4
+
5
+ Read this section when `setup-codeops` finds `traceability.json` in an active or archived feature,
6
+ including when `codeops/.codeops.yml` already exists. This detection precedes the normal
7
+ already-configured no-op.
8
+
9
+ 1. Preview with:
10
+
11
+ ```text
12
+ python3 "${CODEOPS_PLUGIN_ROOT}/scripts/codeops_plan_migrate.py" ./codeops
13
+ ```
14
+
15
+ 2. Render every `UPDATE`, `KEEP`, `DELETE`, and `BLOCKED` line. A non-zero preview or any
16
+ `BLOCKED` entry stops the migration without asking to apply.
17
+ 3. Unless `--yes` was passed, ask once whether to apply the displayed Markdown updates and graph
18
+ deletions.
19
+ 4. Apply with `codeops_plan_migrate.py ./codeops --apply`. The engine refuses dirty Git state and
20
+ performs no writes unless every mapping is unambiguous.
21
+ 5. Verify with:
22
+
23
+ ```text
24
+ python3 "${CODEOPS_PLUGIN_ROOT}/scripts/codeops_plan.py" --root . --json
25
+ ```
26
+
27
+ Then run the repository's normal verification command. Report plan coverage, preserved task
28
+ progress, deleted graphs, and any residual risk. Do not advance roadmap lifecycle state.
29
+
30
+ Re-running after success must report no graph migration and continue to the normal configured
31
+ project status. `--yes` skips only the confirmation; it never bypasses ambiguity or Git-safety
32
+ checks.
33
+
34
+ ## Flat → nested layout
35
+
36
+ > Read this when `setup-codeops` detects an existing **flat layout** (a `requirements/` dir, a
37
+ > `plans/00-roadmap.md`, or any `plans/<dir>/`). Resolve paths via
38
+ > [_shared/layout-convention.md](../../_shared/layout-convention.md).
39
+
40
+ ## Division of labour (PF-003 — do not blur this)
41
+
42
+ - **`scripts/codeops-migrate.sh`** owns the *algorithm*: slug derivation + sanitization, the move
43
+ map, the hazard scan, the dirty-tree refusal, the path-traversal slug guard, idempotency, and
44
+ the `git mv` apply. It is deterministic and unit-tested (`scripts/migration-check.sh`).
45
+ - **This skill** owns the *UX*: run the engine in dry-run, render its preview, take **one**
46
+ confirmation, then invoke the engine to apply, and report the result. **Never re-implement the
47
+ path arithmetic in prose** — read the move map from the engine and present it.
48
+
49
+ ## Flow
50
+
51
+ 1. **Preview.** Run:
52
+ ```
53
+ scripts/codeops-migrate.sh --dry-run
54
+ ```
55
+ The engine prints the `SLUG:` line (with its source), the `MOVE`/`CREATE` map, and any `WARN`
56
+ lines. If it exits non-zero, surface its message and stop:
57
+ - *not a git repo* → suggest `git init`.
58
+ - *dirty working tree* → ask the user to commit or stash first, then re-run.
59
+ - *already migrated* (marker present) → report the no-op; nothing to do.
60
+
61
+ 2. **Render the preview** to the user, faithfully reflecting the engine output: the feature slug
62
+ and where it came from (roadmap header vs. repo/dir name), a count and summary of the moves,
63
+ the created control files (`codeops/codeops.json`, `codeops/.codeops.yml`, and
64
+ `codeops/00-roadmap.md`), and every warning.
65
+
66
+ 3. **Confirm (once).** Ask a single yes/no: apply this migration with `git mv`? Skip this prompt
67
+ only when the user passed `--yes`.
68
+
69
+ 4. **Apply.** On confirmation, run:
70
+ ```
71
+ scripts/codeops-migrate.sh --yes
72
+ ```
73
+ The engine `git mv`s every mapping (history preserved; intra-`codeops` relative links stay
74
+ valid because the whole tree shifts by one prefix) and writes the marker + seeded portfolio
75
+ roadmap **last**.
76
+
77
+ 5. **Report.** Summarize what moved and restate the warnings as **manual follow-ups** — most
78
+ importantly any **source-relative links** (e.g. a plan doc linking into `src/`), which the
79
+ engine surfaces but never rewrites. Remind the user to review `git status` / `git diff
80
+ --staged` and commit (the migration is staged as one reviewable change).
81
+
82
+ ## Preview shape (illustrative)
83
+
84
+ ```
85
+ setup-codeops — migration preview (flat → nested)
86
+ Feature slug: billing-platform (source: roadmap header "Billing Platform")
87
+ Move: requirements/, plans/invoicing/, plans/legacy/, plans/00-roadmap.md,
88
+ plans/_archive/billing-v1/
89
+ Create: codeops/.codeops.yml, codeops/00-roadmap.md (portfolio, 1 feature)
90
+ ⚠ Warnings:
91
+ - plans/legacy/ is on disk but not in the roadmap (still migrated)
92
+ - plans/legacy/03-old.md links ../../src/pay.ts (source-relative; verify after move)
93
+ Apply with git mv? [y/N]
94
+ ```
95
+
96
+ ## Edge cases (all handled by the engine — surface, don't re-derive)
97
+
98
+ | Case | Engine behaviour | What you tell the user |
99
+ |------|------------------|------------------------|
100
+ | No roadmap to read the slug from | Falls back to the repo/dir name, states the source | "Slug taken from the directory name; rename later if you want a different feature name." |
101
+ | Plans on disk not in the roadmap | Migrated under the feature **and** listed as a warning | List them so the user knows they were included. |
102
+ | Loose file directly under `plans/` (not `00-roadmap.md`, not in a plan dir) | Left in place **and** warned (`loose-file-not-migrated`) — no feature target to guess | Tell the user to move it by hand; it is not auto-relocated. |
103
+ | Relative link into source | Surfaced as a warning, never rewritten | Flag each for manual fixing after the move. |
104
+ | Dirty working tree | Refuses (non-zero), no changes | Ask to commit/stash, then re-run. |
105
+ | Re-run after migration | No-op (marker present) | Report "already migrated". |
106
+ | Hostile/odd Feature-Set header | Slug sanitized to a safe path component | Show the resulting slug; it can never escape `codeops/features/`. |
@@ -0,0 +1,99 @@
1
+ # Fresh Scaffold
2
+
3
+ > Read this when `setup-codeops` detects **neither** a marker nor a flat layout — a repo with no
4
+ > CodeOps artifacts yet. Resolve paths via [_shared/layout-convention.md](../../_shared/layout-convention.md).
5
+
6
+ ## What to create
7
+
8
+ Create **exactly** this minimal skeleton — nothing more (FR-6, AR #12):
9
+
10
+ ```
11
+ codeops/
12
+ ├── .codeops.yml # the layout marker (schema below)
13
+ ├── codeops.json # structured quality/routing/metrics policy
14
+ ├── 00-roadmap.md # empty portfolio roadmap (0 features)
15
+ └── features/ # empty; per-feature dirs are created LAZILY on first RD/plan/task
16
+ ```
17
+
18
+ Do **not** create `_maintenance/`, any `features/<name>/`, or any requirements/plans dirs up
19
+ front. Those appear lazily when the first RD, plan, or task is authored (AR #5).
20
+
21
+ ## Steps
22
+
23
+ 1. Confirm the repo is a git repo (suggest `git init` if not).
24
+ 2. Create `codeops/features/` (the empty features dir).
25
+ 3. Write `codeops/.codeops.yml` (the marker — `setup-codeops` is its sole writer).
26
+ 4. Write `codeops/codeops.json` with the strict defaults below.
27
+ 5. Write `codeops/00-roadmap.md` (empty portfolio — see the portfolio template in the `roadmap`
28
+ skill; seed it with zero features and an empty Archived section).
29
+ 6. Confirm the marker, policy, portfolio, and empty feature directory exist; report setup state
30
+ rather than claiming project readiness.
31
+ 7. Report what was created and what to do next (`make-requirements` / `make-plan` for the first
32
+ feature; the feature folder is created lazily then).
33
+
34
+ ## `codeops/codeops.json` (write verbatim)
35
+
36
+ ```json
37
+ {
38
+ "schema": 1,
39
+ "mode": "strict",
40
+ "artifacts": {"layout": "nested", "root": "codeops"},
41
+ "quality": {
42
+ "independentReview": true,
43
+ "minimumReviewers": 1,
44
+ "stopOnMajorFinding": true
45
+ },
46
+ "metrics": {"enabled": false}
47
+ }
48
+ ```
49
+
50
+ ## `codeops/.codeops.yml` (write verbatim)
51
+
52
+ ```yaml
53
+ # CodeOps layout marker. Presence of this file opts the repo into the nested layout.
54
+ # Sole writer: the setup-codeops skill. Schema: _shared/layout-convention.md
55
+ codeopsLayout: nested
56
+ layoutVersion: "3.0.0"
57
+ integrationBranch: <the repo's integration branch — resolve; see the note below>
58
+ conventions:
59
+ rdIdScope: per-feature
60
+ taskIdPrefix: "T"
61
+ maintenanceFeature: _maintenance
62
+ archiveDir: codeops/_archive
63
+ ```
64
+
65
+ Resolve `integrationBranch` to the repo's default branch — `git symbolic-ref refs/remotes/origin/HEAD`
66
+ (strip `origin/`), else the current branch, else `main`/`master`. It names the branch where features
67
+ integrate and derived files (the portfolio roadmap, `AGENTS.md`) are regenerated, so parallel feature
68
+ worktrees don't collide on them. The key is **optional** — every consumer auto-detects the same
69
+ default when it is absent — so this line is a convenience/pin, not a requirement.
70
+
71
+ ## Notes
72
+
73
+ - The marker is what flips the repo into nested layout — write it **last** after the structured
74
+ config and roadmap, so a half-finished
75
+ scaffold never looks "set up".
76
+ - Scaffolding is intentionally simple, so it lives in skill prose; only the *migration* path
77
+ needs the deterministic engine. For migration, see [migration.md](migration.md).
78
+
79
+ ## Agent file installation
80
+
81
+ After scaffolding, install the CodeOps OpenCode agent definitions into the project. Prefer the
82
+ installer bundled with the running plugin, so the agent version always matches the plugin version:
83
+
84
+ ```bash
85
+ node "${CODEOPS_PLUGIN_ROOT}/bin/install-agents.mjs" --project
86
+ ```
87
+
88
+ When the plugin is not active, the published installer does the same thing:
89
+
90
+ ```bash
91
+ npx -y opencode-codeops@latest install-agents --project
92
+ ```
93
+
94
+ This installs the 12 CodeOps subagent definitions (`executor`, `explorer`, `correctness-reviewer`,
95
+ etc.) into `.opencode/agents/` where OpenCode will discover and load them automatically. These files
96
+ are safe to commit to git. Files the installer owns are replaced on upgrade; same-named files it
97
+ does not own are left untouched (pass `--force` to replace them). Users can override individual
98
+ agent models in `opencode.json` under the `agent` key.
99
+
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: setup-routing
3
+ description: Configure risk- and capability-based OpenCode subagent routing for a project. Use when the user asks to set up CodeOps routing, specialist reviewers, model or reasoning policy, or project-local agents. Analyzes the system's domains and risks, proposes roles and review requirements, records structured CodeOps policy, and optionally generates project-local OpenCode agent files. Never weakens CodeOps gates when agents are unavailable.
4
+ ---
5
+
6
+ # Configure CodeOps routing for OpenCode
7
+
8
+ Routing is an optimization and isolation mechanism, not a source of correctness. Requirements,
9
+ ambiguity, direct artifact checks, verification, and review gates remain identical whether work
10
+ runs inline, through a named custom agent, or through a dynamically prompted generic subagent.
11
+
12
+ ## Inputs
13
+
14
+ Read, in order:
15
+
16
+ 1. `AGENTS.md` and nested guidance;
17
+ 2. `codeops/codeops.json`, if present;
18
+ 3. project manifests, languages, frameworks, and verification commands;
19
+ 4. requirement/specification tags and system invariants;
20
+ 5. active security, financial, concurrency, performance, and compatibility risks; and
21
+ 6. current `.opencode/agents/*.md`, preserving all hand-authored files.
22
+
23
+ ## Classify the project
24
+
25
+ Assign one or more domain capabilities:
26
+
27
+ - compiler/language semantics;
28
+ - financial integrity;
29
+ - authentication and authorization;
30
+ - tenant isolation;
31
+ - distributed systems and concurrency;
32
+ - performance critical;
33
+ - persistence and migration;
34
+ - public API/protocol compatibility;
35
+ - web/application behavior; or
36
+ - standard product engineering.
37
+
38
+ Then classify each planned phase:
39
+
40
+ | Risk | Meaning | Minimum routing |
41
+ |---|---|---|
42
+ | Critical | A defect can corrupt money/data, break security/isolation, or establish incompatible semantics/contracts | demanding executor where useful plus at least two independent relevant reviewers |
43
+ | High | Cross-cutting, difficult to reverse, concurrency-sensitive, migration-heavy, or public-contract work | demanding reasoning plus one independent reviewer |
44
+ | Standard | Normal feature work with bounded impact | inline or balanced executor plus one review pass |
45
+ | Mechanical | Fully specified, locally reversible transformation | fast executor or inline; deterministic verification still required |
46
+
47
+ ## Propose before writing
48
+
49
+ Present:
50
+
51
+ - detected domains and concrete evidence;
52
+ - phase tag → capability/effort policy;
53
+ - required specialist reviewers;
54
+ - proposed concurrency limit;
55
+ - whether custom TOML agents add value over dynamic packets; and
56
+ - exact files that would change.
57
+
58
+ Model names are implementation choices, not policy names. Default to the current OpenCode model guidance and environment availability. A project override may pin a model, but every role must remain operable without the pin.
59
+
60
+ ## Structured policy
61
+
62
+ Store CodeOps policy in `codeops/codeops.json`, not in `AGENTS.md`. `AGENTS.md` receives only a concise instruction that CodeOps routing is configured and that material ambiguity and verification gates may not be bypassed.
63
+
64
+ Example policy fields are documented in [routing.md](routing.md).
65
+
66
+ ## Optional project-local agents
67
+
68
+ Only after confirmation, generate selected `.opencode/agents/*.md` files with:
69
+
70
+ ```bash
71
+ python3 "${CODEOPS_PLUGIN_ROOT}/scripts/install_agents.py" --project . --roles ROLE[,ROLE...]
72
+ ```
73
+
74
+ The installer:
75
+
76
+ - creates only generated files carrying the CodeOps marker;
77
+ - never overwrites a hand-authored agent;
78
+ - supports `--dry-run` and `--check`;
79
+ - uses read-only sandboxing for auditors and challengers;
80
+ - writes complete developer instructions; and
81
+ - never modifies global OpenCode configuration.
82
+
83
+ ## Runtime dispatch rule
84
+
85
+ For every dispatch, send a bounded packet containing scope, authoritative excerpts, relevant decisions, target paths, verification command, forbidden actions, and required output schema. Do not assume a custom agent inherits the conversation's system model.
86
+
87
+ When a requested role is unavailable:
88
+
89
+ 1. use a generic subagent with the complete role packet when isolation or independence matters;
90
+ 2. otherwise run inline;
91
+ 3. report the fallback; and
92
+ 4. preserve every gate and required reviewer count.
93
+
94
+ ## Verification
95
+
96
+ After setup:
97
+
98
+ ```bash
99
+ python3 "${CODEOPS_PLUGIN_ROOT}/scripts/install_agents.py" --project . --check
100
+ ```
101
+
102
+ Report configured roles, model pins if any, read-only roles, fallbacks, and unresolved capability gaps.
@@ -0,0 +1,44 @@
1
+ # Routing policy
2
+
3
+ CodeOps routing lives under the optional `routing` and `quality` fields in `codeops/codeops.json`.
4
+
5
+ ```json
6
+ {
7
+ "schema": 1,
8
+ "mode": "strict",
9
+ "artifacts": {"layout": "nested", "root": "codeops"},
10
+ "quality": {
11
+ "independentReview": true,
12
+ "minimumReviewers": 1,
13
+ "stopOnMajorFinding": true
14
+ },
15
+ "routing": {
16
+ "maxConcurrentAgents": 4,
17
+ "roles": {
18
+ "explorer": {"effort": "medium"},
19
+ "executor": {"effort": "high"},
20
+ "correctness-reviewer": {"effort": "high", "sandbox": "read-only"},
21
+ "security-auditor": {"effort": "high", "sandbox": "read-only"}
22
+ }
23
+ },
24
+ "metrics": {"enabled": false}
25
+ }
26
+ ```
27
+
28
+ Allowed effort values follow the active OpenCode release. Prefer `medium` for bounded reconnaissance, `high` for correctness/security review, and higher supported levels only for genuinely demanding semantic or architectural work.
29
+
30
+ Model pins are optional per role. When omitted, OpenCode resolves the model from the explicit spawn, project defaults, and parent session. A missing pin must never block the workflow.
31
+
32
+ Reviewer selection is driven by risk tags:
33
+
34
+ | Tag | Required role |
35
+ |---|---|
36
+ | `security` | security auditor |
37
+ | `financial-integrity` | financial-integrity auditor |
38
+ | `concurrency` | concurrency auditor |
39
+ | `performance-critical` | performance auditor |
40
+ | `compiler-semantics` | semantics reviewer |
41
+ | `migration` | migration/data-integrity reviewer |
42
+ | all non-trivial phases | correctness reviewer |
43
+
44
+ Multiple applicable tags produce a review team. Combine closely related lenses into one agent only when independence is not lost and the packet remains bounded.