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,218 @@
1
+ ---
2
+ name: retro-requirements
3
+ description: >-
4
+ Reverse-engineer an existing codebase into structured requirements. Use for
5
+ "retro-requirements", "reverse requirements", "reconstruct requirements from
6
+ code", "requirements archaeology", or "reverse-engineer this codebase". Trigger
7
+ when the user wants to reconstruct requirements from an existing, undocumented,
8
+ or legacy codebase — for documentation, migration, or a from-scratch rebuild —
9
+ e.g. "document what this app does", "extract requirements from this code",
10
+ "reverse-engineer this service into a spec". Analyzes any language/framework
11
+ through a 9-phase archaeology pipeline and produces a reconstruction brief
12
+ that feeds the make-requirements skill. Extracts WHAT the system does (not HOW),
13
+ classifies every behavior by confidence (✅/⚠️/🔴), and enforces a hard
14
+ Bug-or-Feature Triage Gate so bugs are never silently documented as features.
15
+ Supports --scope PATH to analyze one module/package and --continue to resume
16
+ an interrupted session.
17
+ ---
18
+
19
+ # Reverse Requirements Engineering
20
+
21
+ > **CodeOps Artifact Schema**: 1
22
+
23
+ Analyze an existing codebase — any language, any framework — and produce a
24
+ structured **reconstruction brief** that can be fed to the make-requirements
25
+ skill to generate formal requirement documents capable of rebuilding the entire
26
+ application from scratch.
27
+
28
+ > **Resolve output paths layout-aware — ONCE, here.** Everything this skill writes lives in
29
+ > **the resolved `_retro/` dir**:
30
+ >
31
+ > - **Flat layout** (no marker): `requirements/_retro/`
32
+ > - **Nested layout** (marker present): `codeops/features/<f>/requirements/_retro/` — ask which
33
+ > feature the reconstruction targets (create it lazily); never guess.
34
+ >
35
+ > Detection per **[../../_shared/layout-convention.md](../../_shared/layout-convention.md)**.
36
+ > Every mention of the `_retro/` dir in this skill and its reference docs (`phases.md`,
37
+ > `triage-gate.md`) means THIS resolved path — including `_progress.md`, the triage register,
38
+ > and the reconstruction brief. `--continue` reads `_progress.md` from the same resolved
39
+ > location.
40
+
41
+ This skill is the **inverse** of the make-requirements skill and **upstream** of
42
+ the full forward pipeline:
43
+
44
+ ```
45
+ Existing Codebase
46
+ → retro-requirements (THIS skill — reverse-engineer the code)
47
+ → <resolved _retro dir>/09-reconstruction-brief.md
48
+ → the make-requirements skill (enrich, validate, formalize into RDs)
49
+ → the make-plan skill (implementation pipeline → rebuild)
50
+ ```
51
+
52
+ ## Core Principle: Requirements Archaeologist
53
+
54
+ You are a **systematic code archaeologist** who:
55
+
56
+ 1. **Surveys** — maps the entire codebase structure before reading any implementation
57
+ 2. **Excavates** — reads source methodically, layer by layer, extracting what the system does
58
+ 3. **Reconstructs** — transforms code-level observations into requirement-level statements
59
+ 4. **Catalogs** — organizes findings into structured documents with clear categories
60
+ 5. **Synthesizes** — produces a reconstruction brief the make-requirements skill can consume
61
+
62
+ The output is NEVER a code summary or architecture diagram. It is a
63
+ **requirements-level description** of what the system does — written as if the
64
+ code didn't exist yet and someone needed to describe what to build.
65
+
66
+ **Implementation-agnostic (WHAT, not HOW).** A developer reading the brief must
67
+ be able to rebuild the same behavior in a completely different tech stack.
68
+
69
+ ```
70
+ ✅ "Registered users can reset their password by providing their email. The
71
+ system sends a time-limited reset link (expires in 1 hour), usable once."
72
+ ❌ "The resetPassword function in auth.service.ts calls sendEmail with a JWT
73
+ token that has a 3600s expiry encoded using HS256."
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Step 0: Detect the Mode
79
+
80
+ | Signal | Action |
81
+ |--------|--------|
82
+ | `retro-requirements` (or "reverse-engineer this codebase") | Fresh start — full codebase. Begin at Phase 0. |
83
+ | `retro-requirements --scope <path>` | Fresh start, scoped to one module/package. See **Scope Control** below. |
84
+ | `retro-requirements --continue` | Resume an interrupted session. See **Session Management** below. |
85
+
86
+ At the start of any session, read the project's AGENTS.md (or detected project
87
+ conventions) for project-specific context before analyzing.
88
+
89
+ ---
90
+
91
+ ## The 9-Phase Pipeline
92
+
93
+ Full per-phase instructions and the output-document templates live in
94
+ **`phases.md`** — read it before executing each phase.
95
+
96
+ | Phase | Goal | Output file |
97
+ |-------|------|-------------|
98
+ | **0. Reconnaissance** | Establish what the project IS before reading source — manifests, deps, directory tree, project type | `00-project-profile.md` |
99
+ | **1. Structural Analysis** | Architecture — layers, modules, entry points, dependency direction, patterns | `01-architecture-analysis.md` |
100
+ | **2. Data Model** | Reconstruct entities, fields, relationships, constraints, lifecycle, enums, invariants | `02-domain-model.md` |
101
+ | **3. API Surface** | Every external interface — HTTP endpoints, CLI commands, public API, events | `03-api-surface.md` |
102
+ | **4. Behavior Catalog** | Translate code into requirement-level feature statements; classify each by confidence (✅/⚠️/🔴) | `04-behavior-catalog.md` |
103
+ | **5. Business Rules** | Extract domain/validation/authorization/lifecycle/temporal rules encoded in code | `05-business-rules.md` |
104
+ | **6. Cross-Cutting** | System-wide concerns — auth, errors, logging, caching, config, security, observability | `06-cross-cutting.md` |
105
+ | **7. Integrations** | Every external system the code talks to — DBs, APIs, queues, storage, providers | `07-integrations.md` |
106
+ | **8. Gaps & Debt** | What's missing, broken, or incomplete — TODOs, untested code, security gaps, debt | `08-gaps-and-debt.md` |
107
+ | **8B. 🚨 Triage Gate** | **HARD GATE** — resolve every non-Confirmed behavior with the user before synthesis | `08b-triage-register.md` |
108
+ | **9. Synthesis** | Combine all outputs into THE handoff file for the make-requirements skill | `09-reconstruction-brief.md` |
109
+
110
+ All output is written to the resolved `_retro/` dir. Session state lives in
111
+ `<resolved _retro dir>/_progress.md`. The **`09-reconstruction-brief.md`** is the
112
+ crown jewel — written specifically as make-requirements input; all other files
113
+ are intermediate analysis that feed it.
114
+
115
+ ### Confidence Classification (Phase 4 onward) — NON-NEGOTIABLE
116
+
117
+ Every extracted feature and rule MUST carry a confidence level. This is the
118
+ structural safeguard against the **code-as-truth tautology** (treating bugs as
119
+ intended behavior).
120
+
121
+ | Confidence | Meaning |
122
+ |------------|---------|
123
+ | ✅ **Confirmed** | Clearly intentional — tests assert it, docs/comments describe it, or it follows an obvious domain convention |
124
+ | ⚠️ **Inferred** | Plausible and well-structured, but NO supporting evidence (the default) |
125
+ | 🔴 **Suspicious** | May be a bug masquerading as a feature — gaps, nearby TODOs, inconsistency, or violates a known standard |
126
+
127
+ The default is ⚠️ Inferred. Tests promote to ✅; missing tests NEVER confirm;
128
+ domain/standard violations flag 🔴 even when the code is clean. Every 🔴 item
129
+ becomes a mandatory user question at Phase 8B. Full rules in
130
+ **`confidence-classification.md`**.
131
+
132
+ ---
133
+
134
+ ## Phase 8B: Bug-or-Feature Triage Gate (summary)
135
+
136
+ **🚨 This gate is hard and non-negotiable. It MUST be passed before Phase 9. No
137
+ exceptions.** It breaks the code-as-truth tautology: without it, every bug
138
+ becomes a requirement, flows through the forward pipeline, and is faithfully
139
+ reproduced. Only the user has the external domain knowledge to tell bugs from
140
+ features.
141
+
142
+ **The flow (full protocol, register format, and example in `triage-gate.md`):**
143
+
144
+ 1. After Phases 4–8, compile the **Triage Register** at
145
+ `<resolved _retro dir>/08b-triage-register.md` — a formal inventory of ALL
146
+ items that are NOT ✅ Confirmed (every 🔴 Suspicious and ⚠️ Inferred item),
147
+ saved to disk before presenting to the user.
148
+ 2. Present each 🔴 **Suspicious** item with *what the code does* and *why it's
149
+ suspicious*, then ask the user to decide:
150
+ - **(A) It's a bug** → exclude from the brief; move to `08-gaps-and-debt.md` "Known Bugs".
151
+ - **(B) It's intentional** → include as a confirmed requirement; record the user's explanation.
152
+ - **(C) I'm not sure** → include with a prominent ⚠️ flag AND add to "Open Questions for Discovery" so the make-requirements skill re-examines it.
153
+ 3. Present ⚠️ **Inferred** items in batches (5–10) for quick confirm-or-flag.
154
+
155
+ **The gate opens ONLY when:** every 🔴 item has a decision (A/B/C); all ⚠️ items
156
+ have been presented; (A)-Bug items are moved to gaps; (C)-Unsure items are
157
+ flagged and added to Open Questions; and the register header reads
158
+ `✅ GATE PASSED`. While blocked, you MUST NOT write the brief, proceed to Phase 9,
159
+ or assume a suspicious behavior is intentional because the code is "clean".
160
+
161
+ > **Grounded Options & Recommendations (coding standards → Working style) apply here.** Before presenting options/findings/recommendations: filter out non-viable ones (no strawmen; ≥2 only when ≥2 are genuinely viable, else present the single viable path and name what was rejected), second-guess each, verify any code-modifying option against the actual current code (cite `file:line`), and lead with a recommendation backed by grounded reasoning. Match ceremony to stakes — the user decides. Apply the recommendation-hardening protocol (`_shared/recommendation-hardening.md`) to consequential recommendations; escalate to an independent challenger only when the decision is genuinely high-stakes.
162
+
163
+ ---
164
+
165
+ ## Scope Control: `--scope <path>`
166
+
167
+ For large codebases or monorepos, analyze a specific module
168
+ (e.g. `--scope src/auth`, `--scope packages/api`):
169
+
170
+ - Phase 0 still reads the root manifests (for global context).
171
+ - Phase 1 focuses on the scoped directory's structure.
172
+ - Phases 2–8 analyze only the scoped code.
173
+ - Phase 9 produces a scoped reconstruction brief.
174
+ - Cross-references to other modules are noted but not analyzed.
175
+
176
+ ---
177
+
178
+ ## Session Management (long analyses)
179
+
180
+ Analyzing a full codebase will span multiple turns or sessions. Work
181
+ incrementally and survive interruptions:
182
+
183
+ 1. **Persist after each phase** — save the phase output to the resolved `_retro/` dir
184
+ before moving on; never hold analysis only in conversation memory.
185
+ 2. **Read selectively** — don't read every file. Read entry points, then follow
186
+ imports into key modules. Summarize as you go; extract requirements, don't
187
+ copy code.
188
+ 3. **Track progress** — maintain `<resolved _retro dir>/_progress.md` (phase status
189
+ + module coverage; template in `phases.md`).
190
+
191
+ **Save progress and resume natively:** if the session gets long or the user wants
192
+ to pause, save the current phase output (even if incomplete) plus the next-step
193
+ state to `<resolved _retro dir>/_progress.md`, note which module/file was
194
+ interrupted, and report what's done and what remains. The user resumes later with
195
+ `retro-requirements --continue`: read `_progress.md` and completed phase outputs,
196
+ summarize where you left off, then continue from the next incomplete phase.
197
+
198
+ A natural cadence: Session 1 = Phases 0–1; middle sessions = Phases 2–7 (one or
199
+ more per session by size); final session = Phases 8, 8B, 9.
200
+
201
+ ---
202
+
203
+ ## Adapting to Project Type
204
+
205
+ Tailor the analysis focus to the detected type: API/backend → Phases 2–5 heavy;
206
+ library/SDK or CLI → Phase 3 heavy (public surface, commands, exit codes); mobile
207
+ → Phase 4 heavy (navigation, offline, push); microservices → Phase 7 heavy
208
+ (boundaries, inter-service comms, data ownership); monorepo → run per-package;
209
+ data pipeline → Phases 5 & 7 heavy; infrastructure → Phases 0 & 7 heavy. The full
210
+ mapping is in **`phases.md`**.
211
+
212
+ ---
213
+
214
+ ## Related Skills
215
+
216
+ - the make-requirements skill — consumes `09-reconstruction-brief.md` to produce formal RDs (downstream; this brief is its input)
217
+ - the make-plan skill — turns RDs into implementation plans (rebuild pipeline)
218
+ - your project's coding/testing standards (AGENTS.md) — code-quality and test patterns to reference while analyzing
@@ -0,0 +1,45 @@
1
+ # Confidence Classification — NON-NEGOTIABLE
2
+
3
+ Every feature extracted in Phase 4 and every rule extracted in Phase 5 MUST be
4
+ classified with a confidence level. This is a structural safeguard against the
5
+ **code-as-truth tautology** — the risk that bugs in the original code are
6
+ documented as intended behavior and faithfully reproduced in a rebuild.
7
+
8
+ The classification produced here is what feeds the Phase 8B Bug-or-Feature Triage
9
+ Gate (`triage-gate.md`): every item that is not ✅ Confirmed becomes a triage
10
+ register entry.
11
+
12
+ ## The Three Levels
13
+
14
+ | Confidence | Icon | Meaning | Evidence Required |
15
+ |------------|------|---------|-------------------|
16
+ | **Confirmed** | ✅ | Behavior is clearly intentional | Tests assert this behavior, OR documentation/comments describe it, OR it follows an obvious domain convention |
17
+ | **Inferred** | ⚠️ | Behavior appears intentional but has no supporting evidence | No tests, no comments, no documentation — but the code is well-structured and the behavior is plausible |
18
+ | **Suspicious** | 🔴 | Behavior may be a bug masquerading as a feature | Code has error-handling gaps, TODOs near it, inconsistency with other parts, violates common patterns/standards, or produces results that seem wrong for the domain |
19
+
20
+ ## Rules for Classification
21
+
22
+ 1. **Default is ⚠️ Inferred** — a feature starts as Inferred unless evidence
23
+ promotes it to ✅ Confirmed or red flags demote it to 🔴 Suspicious.
24
+ 2. **Tests promote confidence** — if a test explicitly asserts the behavior, it
25
+ is ✅ Confirmed (the original developer intended it).
26
+ 3. **Missing tests do NOT confirm** — untested behavior is NEVER ✅ Confirmed,
27
+ no matter how clean the code looks.
28
+ 4. **Domain violations flag suspicion** — if the behavior violates a well-known
29
+ standard (RFC, industry convention, common protocol) or your project's
30
+ coding/testing standards (AGENTS.md), it is 🔴 Suspicious even if the code is
31
+ clean.
32
+ 5. **Every 🔴 Suspicious item becomes a mandatory user question** at Phase 8B.
33
+ Every ⚠️ Inferred item is presented for batch confirmation. Only ✅ Confirmed
34
+ items bypass triage.
35
+
36
+ ## How Confidence Flows Through the Pipeline
37
+
38
+ - **Phase 4 / 5:** annotate each feature and rule with `Confidence: ✅ / ⚠️ / 🔴`
39
+ plus a one-line justification (what evidence promoted it, or what red flag
40
+ demoted it).
41
+ - **Phase 8B:** all non-✅ items are compiled into the Triage Register and
42
+ resolved with the user (A = bug/exclude, B = feature/include, C = unsure/flag).
43
+ - **Phase 9:** the Feature Catalog and Business Rules tables in the reconstruction
44
+ brief MUST carry the Confidence column so the make-requirements skill inherits
45
+ the same calibration.