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,181 @@
1
+ # Preflight — The 13-Dimension Scan (detail)
2
+
3
+ > **CodeOps Artifact Schema**: 1
4
+
5
+ Read this file before executing Step 3 of the protocol — and especially before auditing a plan,
6
+ where Dimension 13 (Codebase Alignment) carries the most weight. Steps 1 and 2 set up the scan;
7
+ this file covers reconnaissance detail and the full dimension definitions.
8
+
9
+ ## Step 1: Load and understand the artifact
10
+
11
+ Before scanning, you MUST:
12
+
13
+ 1. **Read the complete artifact** — every document, section, and line.
14
+ 2. **Identify the artifact type** — requirements set, implementation plan, or ad-hoc document.
15
+ 3. **Load context** — read the project's AGENTS.md (or detected project conventions); understand
16
+ the tech stack, conventions, and constraints.
17
+ 4. **Read the Ambiguity Register** (if one exists) — `requirements/00-ambiguity-register.md` or
18
+ `plans/<name>/00-ambiguity-register.md`. Understand what decisions were already made and why.
19
+ 5. **Freeze the scope** — record the exact audit target, context documents, and authorized
20
+ modification set. Reading a related document does not add it to the target.
21
+ 6. **Resolve artifact identity** — use the exact user-selected file or directory as the audit
22
+ target. Related artifacts are context; findings do not silently expand the modification set.
23
+ 7. **Freeze product scope** — load
24
+ [../../_shared/scope-expansion-control.md](../../_shared/scope-expansion-control.md), record
25
+ strict or exploration mode, and separate defects in the authorized target from optional new
26
+ functionality suggested by the reviewer.
27
+ 8. **Load the minimum-sufficient baseline** — use `requirements/README.md` for a requirements set
28
+ or `00-index.md` for a full plan. For a legacy artifact without that section, derive the
29
+ original goal and smallest viable design only from explicit artifact statements and repository
30
+ evidence. If either is unclear, record a blocking ambiguity or finding; do not infer it.
31
+
32
+ ## Step 2: Codebase Reconnaissance — 🚨 NON-NEGOTIABLE
33
+
34
+ This step is what separates a real preflight from a document-correction exercise. Without it, every
35
+ dimension scan is blind. Build a thorough understanding of the actual codebase the artifact targets.
36
+
37
+ ### What to examine
38
+
39
+ | What to examine | Why | How |
40
+ |---|---|---|
41
+ | **Project structure** | Understand what exists, how code is organized | List files on the project root recursively; read the directory layout |
42
+ | **Entry points & main modules** | Understand architecture and flow | Read main/index files, server bootstrap, CLI entry points |
43
+ | **Type definitions & interfaces** | Understand the data model and contracts | Read type files, interface definitions, shared types |
44
+ | **Key source files** | Understand implementation patterns and conventions | Read files directly relevant to the artifact's scope |
45
+ | **Existing tests** | Understand test patterns, what's already covered | Read test dirs, test helpers, test config |
46
+ | **Package manifest & dependencies** | Understand available libraries | Read `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, etc. |
47
+ | **Configuration files** | Understand build, deploy, runtime setup | Read tsconfig, webpack, docker-compose, CI/CD configs |
48
+ | **Existing documentation** | Understand what's already documented | Read README, CHANGELOG, architecture docs |
49
+
50
+ ### Depth of reconnaissance by artifact type
51
+
52
+ | Artifact type | Reconnaissance depth |
53
+ |---|---|
54
+ | **Requirements** | Moderate — understand architecture, patterns, and existing capabilities to assess feasibility and non-redundancy |
55
+ | **Implementation Plan** | Deep — read every file the plan proposes to modify or depend on; verify every component/API/pattern reference; understand the dependency graph around the affected area |
56
+ | **Ad-hoc Document** | Targeted — focus on the specific area the document addresses |
57
+
58
+ > Reconnaissance is proportional, not exhaustive. For a plan that modifies 3 files, read those 3
59
+ > files deeply plus their direct dependents — do not read the entire codebase for a small artifact.
60
+ > For a single-RD or single-plan-document audit, related artifacts are context only. Use them to
61
+ > prove or refute claims in the target; do not turn defects located solely in those documents into
62
+ > findings against the selected artifact.
63
+
64
+ ### Mapping document references to code
65
+
66
+ Systematically map every reference in the artifact to actual code:
67
+
68
+ - Every **component, module, or service** → Does it exist? Where? What does it actually do?
69
+ - Every **file or directory path** → Does it exist? Is the path correct?
70
+ - Every **API, function, or class** → Does it exist? Does its signature match what's assumed?
71
+ - Every **pattern or convention** assumed → Is it actually used in the codebase?
72
+ - Every **dependency or library** referenced → Is it in the manifest? Right version?
73
+ - Every **existing behavior** described → Is that actually how the code works?
74
+
75
+ Any reference that cannot be verified against the code is a potential finding for the scan.
76
+
77
+ ### Present the Codebase Context Summary
78
+
79
+ After reconnaissance, present:
80
+
81
+ ```markdown
82
+ ## Preflight: [Artifact Name]
83
+
84
+ **Artifact Type:** [Requirements Set / Implementation Plan / Ad-hoc Document]
85
+ **Documents:** [X] files, [Y] total sections
86
+ **Ambiguity Register:** [Found — X items resolved / Not found]
87
+ **Scope:** [Full scan / Targeted: specific document]
88
+
89
+ ### Codebase Context
90
+
91
+ **Repository:** [project name]
92
+ **Tech Stack:** [language, framework, key libraries — from actual package manifest]
93
+ **Architecture:** [brief description of actual architecture observed]
94
+ **Files Examined:** [N] source files, [M] test files, [K] config files
95
+ **Key Observations:**
96
+ - [Notable architectural pattern or convention observed]
97
+ - [Key existing component relevant to the artifact]
98
+ - [Important constraint or limitation found in the code]
99
+
100
+ **Reference Verification:** [X] references mapped to code — [Y] verified, [Z] unverifiable
101
+
102
+ Beginning 13-dimension scan...
103
+ ```
104
+
105
+ ## Step 3: The 13 dimensions
106
+
107
+ Scan all 13 every time, with adversarial intent. Every check must be informed by Step 2.
108
+
109
+ The dimensions test whether the requested artifact is sound; they are not permission to invent a
110
+ larger product. Apply the necessary-correction burden of proof to every newly suggested behavior.
111
+ In strict scope, omit optional additions completely. With active exploration, move them to the
112
+ Scope Expansion Register without counting them as findings.
113
+
114
+ | # | Dimension | What to hunt for |
115
+ |---|---|---|
116
+ | 1 | **Ambiguities** | Vague language, undefined terms, weasel words ("appropriate", "as needed", "etc."), statements with multiple interpretations, undefined behaviors |
117
+ | 2 | **Implicit Assumptions** | Things taken for granted without stating, assumed capabilities/knowledge/environment. **Codebase check:** verify every assumption about the code — assumed APIs, data models, patterns, capabilities that may not exist or behave differently |
118
+ | 3 | **Logical Contradictions** | Statements that conflict — across documents, sections, or within a paragraph. Inconsistent decisions, conflicting constraints |
119
+ | 4 | **Completeness Gaps** | Missing requirements, journeys, error handling, edge cases, or acceptance criteria needed by the authorized behavior; do not treat adjacent optional functionality as missing. **Codebase check:** existing code/tests/functionality affected by the requested changes but not mentioned — missing impact analysis |
120
+ | 5 | **Dependency Issues** | Circular/missing dependencies, dependencies on undefined components, tasks referencing not-yet-created entities, broken chains. **Codebase check:** verify referenced dependencies against the actual manifest and import graph — exist? right versions? undeclared deps relied on? |
121
+ | 6 | **Feasibility Concerns** | Tasks possibly impossible/unrealistic, underestimated complexity, approaches incompatible with the stated stack, tasks too large to do atomically, or support machinery whose cost is disproportionate to the requested result. **Codebase check:** verify approaches against the actual architecture — will it work with how the code is structured? Do estimates match the real code? Does evidence show why the smallest direct solution fails? |
122
+ | 7 | **Testability** | Requirements/tasks with no clear way to verify success, vague criteria ("should work well"), missing test specs, untestable acceptance criteria |
123
+ | 8 | **Security Blind Spots** | Security defects that make the authorized behavior unsafe; distinguish a necessary correction from optional defense-in-depth functionality using grounded causal evidence |
124
+ | 9 | **Edge Cases** | Boundary conditions and failure modes of the authorized behavior; do not invent adjacent journeys merely to fill the checklist |
125
+ | 10 | **Scope Creep Indicators** | Existing artifact content that exceeds the confirmed baseline, unbounded tasks ("support all formats"), gold-plating, premature optimization, or a material new layer/dependency/harness/infrastructure surface without explicit complexity approval; newly imagined optional additions are silent or `SE-*` proposals, not findings |
126
+ | 11 | **Ordering & Sequencing** | Tasks in wrong order, phases that should swap, work planned before its dependencies exist, missing foundation work. **Codebase check:** verify order against the actual dependency graph — real module boundaries, import chains, build dependencies |
127
+ | 12 | **Consistency** | Naming inconsistencies across documents, conflicting conventions, terminology drift (same thing, different names), formatting that obscures meaning |
128
+ | 13 | **Codebase Alignment** | **The master reality check.** Entirely codebase-grounded — see below |
129
+
130
+ For Dimensions 6 and 10, apply the **Complexity Escalation Gate** in
131
+ [../../_shared/zero-ambiguity-gate.md](../../_shared/zero-ambiguity-gate.md). An unapproved
132
+ escalation is at least a 🟠 MAJOR finding and blocks a pass. Identify the smallest viable solution
133
+ and the extra build and maintenance surface; do not treat sophistication as evidence of need.
134
+
135
+ ### Dimension 13: Codebase Alignment — detailed sub-checks
136
+
137
+ Every sub-check requires completed Step 2 reconnaissance and must reference specific files/code.
138
+
139
+ | Sub-check | What to hunt for | Example finding |
140
+ |---|---|---|
141
+ | **Phantom References** | Components/files/APIs/modules/classes/functions mentioned that do not exist | "Plan references `UserAuthService` in phase 3, but no such class exists. The actual auth logic is in `middleware/auth.ts` as a function chain." |
142
+ | **Stale Assumptions** | Incorrect claims about how existing code works — wrong signatures, data flows, behavior | "RD-05 states 'the cache layer supports TTL per key' but `CacheManager.set()` has no TTL param — it uses a global TTL from config." |
143
+ | **Architecture Mismatch** | Proposed patterns/structures that conflict with the established architecture | "Plan proposes a class-based service layer, but the codebase uses a pure-function pattern — every existing 'service' is an exported function." |
144
+ | **Impact Blindness** | Existing code affected by the changes but not acknowledged | "Plan modifies the `User` interface in `types/index.ts` but doesn't mention the 14 files that import it, 6 of which would break." |
145
+ | **Redundancy** | Things the document proposes to build that already exist | "RD-12 calls for 'a utility to parse env vars with defaults' — this already exists as `resolveConfig()` in `src/config.ts`." |
146
+ | **Test Impact** | Existing tests that would break/become invalid, or test patterns the doc doesn't follow | "The plan adds a new tool but ignores the existing pattern in `tools-setup.ts` where all tools share a lazy-loaded store fixture." |
147
+ | **Dependency Reality** | Assumed-available libs that aren't installed, or installed libs the doc ignores that could solve its problem | "Phase 2 proposes adding `lodash` for deep merge, but it isn't in dependencies. The project already has a custom `deepMerge` in `utils/`." |
148
+ | **Convention Violations** | Proposed naming/organization/patterns that violate actual conventions | "Plan names the new file `getUserData.ts` but the project uses kebab-case: `get-rule.ts`, `search-rules.ts`." |
149
+ | **Scope vs. Reality** | Complexity/effort estimates unrealistic given the actual code | "Plan estimates phase 4 (refactor caching) as 'straightforward, ~100 lines' but the cache spans 3 files, 450 lines, with 40 dependent tests." |
150
+ | **Migration & Compatibility** | Missing data migration plans, backwards-compat concerns, or rollback strategies | "Plan changes the config file format but doesn't address migration for existing users on the old format." |
151
+
152
+ **Rules for Dimension 13 findings:**
153
+
154
+ - Cite the **specific file(s) and line(s)** that contradict or invalidate the artifact's claims.
155
+ - Explain the **actual state** of the code, not just that it's "different".
156
+ - Phantom-reference findings MUST suggest what the document **probably meant** if there's a close match.
157
+ - Impact-blindness findings MUST list the **affected files** and how they'd be impacted.
158
+
159
+ ### Dimension depth by artifact type
160
+
161
+ Scan all 13 every time; depth of analysis adapts:
162
+
163
+ | Dimension | Requirements | Plans | Ad-hoc |
164
+ |---|---|---|---|
165
+ | Ambiguities | 🔥 Deep | 🔥 Deep | 🔥 Deep |
166
+ | Implicit Assumptions | 🔥 Deep | 🔥 Deep | Standard |
167
+ | Logical Contradictions | 🔥 Deep | 🔥 Deep | Standard |
168
+ | Completeness Gaps | 🔥 Deep | 🔥 Deep | Standard |
169
+ | Dependency Issues | Standard | 🔥 Deep | Light |
170
+ | Feasibility Concerns | Standard | 🔥 Deep | Standard |
171
+ | Testability | 🔥 Deep | Standard | Light |
172
+ | Security Blind Spots | 🔥 Deep | Standard | Light |
173
+ | Edge Cases | 🔥 Deep | Standard | Light |
174
+ | Scope Creep Indicators | 🔥 Deep | 🔥 Deep | Standard |
175
+ | Ordering & Sequencing | Light | 🔥 Deep | Light |
176
+ | Consistency | Standard | Standard | Standard |
177
+ | Codebase Alignment | 🔥 Deep | 🔥 Deep | Standard |
178
+
179
+ - **🔥 Deep** — exhaustive analysis, actively hunt for issues.
180
+ - **Standard** — thorough review, flag anything found.
181
+ - **Light** — quick check, flag only obvious issues.
@@ -0,0 +1,300 @@
1
+ # Preflight — Report Format, Presentation & Persistence (detail)
2
+
3
+ > **CodeOps Artifact Schema**: 1
4
+
5
+ Covers Steps 4-8 of the protocol: compiling the report, presenting findings and collecting
6
+ decisions, pass/fail determination, applying fixes, and roadmap sync — plus iterative re-scan
7
+ numbering, report persistence, and same-agent-bias safeguards.
8
+
9
+ ## Step 4: Compile the Preflight Report
10
+
11
+ Every finding gets a numbered, structured entry.
12
+
13
+ ### Finding template
14
+
15
+ ```markdown
16
+ ### PF-[NNN]: [Finding Title] [severity-icon] [SEVERITY]
17
+
18
+ **Dimension:** [Which of the 13 dimensions]
19
+ **Location:** [File path + section/line reference in the artifact]
20
+ **Codebase Evidence:** [File path + line reference in the actual code, if applicable]
21
+ **The Problem:** [Clear, specific description of what's wrong and WHY it matters]
22
+
23
+ **Options:**
24
+
25
+ | Option | Description | Pros | Cons |
26
+ |--------|-------------|------|------|
27
+ | A | [Description] | [Pros] | [Cons] |
28
+ | B | [Description] | [Pros] | [Cons] |
29
+ | C | [Description] | [Pros] | [Cons] |
30
+
31
+ **Recommendation:** Option [X] — [concise rationale]
32
+
33
+ **User Decision:** Pending
34
+ ```
35
+
36
+ **Rules for findings:**
37
+
38
+ - **Options must be genuinely viable, never strawmen** — present ≥2 options only when ≥2 are
39
+ genuinely viable. When one resolution clearly dominates, present it alone, state it is the only
40
+ viable one, and name what you considered and dropped and why. Never pad to a count to manufacture
41
+ a choice.
42
+ - **Every finding MUST have a recommendation, with rationale** — never just "Option B is better".
43
+ - **High-stakes findings (CRITICAL/MAJOR) get the hardening challenger — ONE per preflight scan,
44
+ not one per finding.** Per `_shared/recommendation-hardening.md` (challenger budget): spawn a
45
+ single challenger that receives the whole CRITICAL/MAJOR finding batch (statement + surviving
46
+ options per finding, without your picks) PLUS the scan's Codebase Context summary, and returns
47
+ per-finding verdicts to reconcile *before* recording recommendations. Hard cap: 2 challenger
48
+ spawns per scan. Close findings with the `Confidence:` / `Hardening:` disclosure where that
49
+ protocol requires it (Med/Low confidence, changed pick, or high stakes — presentation-only,
50
+ not a required saved field).
51
+ - **Complexity escalations use the shared visible stop packet, not the ordinary compact finding
52
+ presentation.** Include and persist every approval-evidence field from the shared gate: original
53
+ goal, named extra system or support code, why it may be needed, codebase evidence, smallest
54
+ solution that still works, extra cost, independent verdict, and direct user decision. The larger
55
+ option remains blocked until the user explicitly chooses to approve that named machinery.
56
+ Generic finding acceptance does not approve it. The `PF-*` finding is the durable owner at
57
+ preflight.
58
+ - **Findings are numbered sequentially by root cause** — `PF-001`, `PF-002`, ... A reopened root
59
+ cause retains its identifier across iterations; a new root cause gets the next unused number.
60
+ - **Location must be specific** — "plans/my-feature/03-api-design.md, section 'Error Handling'", not
61
+ "somewhere in the plan".
62
+ - **Codebase Evidence is required** for findings in dimensions 2, 4, 5, 6, 11, and 13 — cite the
63
+ actual file and code. For other dimensions, include it when relevant. If you can't verify a claim
64
+ against the code, say so: "Unable to verify against the codebase; this finding is based on the
65
+ document alone."
66
+
67
+ ### Report header template
68
+
69
+ ```markdown
70
+ ## Preflight Report: [Artifact Name]
71
+
72
+ > **Status**: REVIEW IN PROGRESS — [X] findings ([C] critical, [M] major, [m] minor, [O] observation)
73
+ > **Iteration**: [N] (first scan / re-scan after fixes)
74
+ > **Artifact**: [type] at [path]
75
+ > **Codebase Grounded**: [N] source files examined, [M] references verified
76
+ > **Last Updated**: [Date]
77
+
78
+ ### Codebase Context Summary
79
+
80
+ **Tech Stack:** [actual stack from manifest]
81
+ **Architecture:** [brief architecture description from code examination]
82
+ **Key Files Examined:** [list of most relevant files read during reconnaissance]
83
+
84
+ ### Summary by Dimension
85
+
86
+ | # | Dimension | Findings | Highest Severity |
87
+ |---|-----------|----------|-----------------|
88
+ | 1 | Ambiguities | [count] | [icon] |
89
+ | 2 | Implicit Assumptions | [count] | [icon] |
90
+ | ... | ... | ... | ... |
91
+ | 13 | Codebase Alignment | [count] | [icon] |
92
+
93
+ ### Summary by Severity
94
+
95
+ | Severity | Count | Status |
96
+ |----------|-------|--------|
97
+ | CRITICAL | [N] | [all resolved? / X pending] |
98
+ | MAJOR | [N] | [all resolved? / X pending] |
99
+ | MINOR | [N] | [all resolved? / X pending] |
100
+ | OBSERVATION | [N] | [all resolved? / X pending] |
101
+
102
+ ---
103
+
104
+ [Individual findings follow]
105
+ ```
106
+
107
+ Use the severity icons from SKILL.md (red/orange/yellow/blue circles) in the actual report.
108
+
109
+ ## Step 5: Present findings and collect decisions
110
+
111
+ 1. **Present grouped by severity** — CRITICAL first, then MAJOR, MINOR, OBSERVATION.
112
+ 2. **Present per the batch rules below** (they are authoritative for pacing) — each finding shown
113
+ with problem, options, recommendation.
114
+ 3. **Collect and record authority for every finding** before the report is final. In normal mode
115
+ use `**User Decision:** [their choice]`. With active auto-design, an eligible technical
116
+ resolution uses the canonical delegated marker and complete provenance from
117
+ `_shared/auto-design.md`; reserved decisions still use `**User Decision:**`. A delegated
118
+ resolution does not authorize applying the fix or waiving a finding.
119
+ 4. **Keep scope authority separate.** Finding resolution and expansion authorization are separate.
120
+ If an explored remediation exceeds the confirmed product scope, link the finding to its `SE-*`
121
+ proposal and collect a distinct `Keep`, `Defer`, or `Discard` ruling. In strict scope, optional
122
+ remediations are not reported.
123
+
124
+ ### Batch presentation rules
125
+
126
+ - **<= 5 findings** — present all at once, let the user respond to each.
127
+ - **6-15 findings** — present by severity group (all criticals, then all majors, etc.).
128
+ - **> 15 findings** — present in batches of 5-8, grouped by severity, wait for confirmation between batches.
129
+
130
+ **Previous decisions are respected (hard rule).** A finding that duplicates a decision already
131
+ recorded in the artifact's Ambiguity Register — including a named `⏸ Deferred` row — is NOT
132
+ re-presented for decision: record it as `Accepted Risk — deferred per AR #N` (or cross-reference
133
+ the resolving AR #) and move on. Re-litigating decisions the user already made is a protocol
134
+ violation, not thoroughness.
135
+
136
+ **Complexity exception:** a deferred complexity decision is accepted risk only when the larger
137
+ machinery is absent from the audited executable artifact. If it remains present, keep the finding
138
+ open at 🟠 MAJOR until the artifact is changed and rechecked. Do not ask the user to decide the
139
+ same deferral again.
140
+
141
+ ### Agent behavior during resolution
142
+
143
+ | User says | Agent response |
144
+ |---|---|
145
+ | "Fix it per your recommendation" | Record `Resolved — User accepted recommendation: [Option X]`. Valid. |
146
+ | "Go with Option A" | Record `Resolved — User chose Option A`. |
147
+ | "This isn't actually an issue" | Record `Dismissed — User: "[reasoning]"`. Valid — only the user can dismiss. |
148
+ | "I'll fix this later" | Ask to record as a known accepted risk (won't block the pass but noted). If yes: `Accepted Risk — User deferred: "[reason]"` — the preflight face of the shared `⏸ Deferred` status (`_shared/zero-ambiguity-gate.md`); name the decision, owner, and revisit-trigger in the reason. For extra complexity, this applies only after the machinery is removed from the executable artifact and rechecked. |
149
+ | "You decide" | "I've given my recommendation above. Confirm you'd like Option [X]?" — user MUST explicitly confirm. |
150
+
151
+ For a complexity escalation, explicit approval of the named larger machinery resolves the finding
152
+ without an artifact edit. Choosing the smaller solution, revising, or deferring the larger
153
+ machinery keeps the finding blocked until the artifact is changed and rechecked. If the required
154
+ challenger is unavailable, the finding stays blocked.
155
+
156
+ ## Step 6: Determine pass/fail
157
+
158
+ See the Pass tiers table in SKILL.md. A clean first-scan pass is a valid outcome — never invent
159
+ findings to justify the review.
160
+
161
+ ## Step 7: Apply fixes (only if requested)
162
+
163
+ The user may ask the agent to apply fixes:
164
+
165
+ - **"Apply all fixes"** — modify the artifact documents per the resolved in-scope findings and
166
+ any linked proposals already ruled `Keep`; this does not authorize undecided, deferred, or
167
+ discarded `SE-*` entries.
168
+ - **"Apply fixes for PF-003 and PF-007"** — apply specific fixes only.
169
+ - **"I'll fix them myself"** — do nothing; the report is a checklist.
170
+ - **"Apply fixes and re-scan"** — apply, then immediately run another iteration.
171
+
172
+ > The agent MUST NOT apply fixes without explicit instruction. Preflight is a **review** protocol,
173
+ > not a **modification** protocol. Finding issues and fixing issues are separate steps.
174
+ > A fix instruction is also not scope-expansion authority; apply
175
+ > `_shared/scope-expansion-control.md` before editing.
176
+
177
+ ## Step 8: Roadmap sync
178
+
179
+ After a preflight **pass**, sync the roadmap via the roadmap skill if one is in play:
180
+
181
+ - **If `plans/00-roadmap.md` exists:** advance the audited target's row —
182
+ - an **RD** that passed → stage `RD Preflighted`
183
+ - a **plan** that passed → stage `Plan Preflighted`
184
+
185
+ Update the row's `Stage`, `Status`, and `Last Updated` (update-first mandate).
186
+ - **If `plans/00-roadmap.md` does NOT exist:** these hooks are inert — no error, no auto-creation.
187
+
188
+ A BLOCKED outcome does NOT advance the roadmap. See the roadmap skill for the full protocol.
189
+
190
+ ## Iterative re-scanning
191
+
192
+ ### How iterations work
193
+
194
+ 1. **Iteration 1** — full 13-dimension scan of the original artifact (with full reconnaissance).
195
+ 2. **Fixes applied** — user resolves findings (manually or via "apply fixes").
196
+ 3. **Iteration 2** — re-scan focusing on: **verify fixes** (each resolved finding actually fixed),
197
+ **regression check** (fixes introduced no new issues), **bounded fresh scan** (re-examine all 13
198
+ within the unchanged audit target), and **codebase re-check** (re-verify changed references).
199
+ 4. **Iteration 3, only when blocking defects remain** — inspect the unresolved 🔴/🟠 fixes and their
200
+ direct dependency surface. Do not restart broad discovery.
201
+ 5. **Iteration 4+** — never automatic. Recommend a fresh-session audit to counter accumulated
202
+ framing bias, or obtain an explicit user decision to continue the current session.
203
+
204
+ ### Re-scan numbering
205
+
206
+ Finding identifiers name root causes, not scan appearances:
207
+
208
+ - a verified fix closes its existing `PF-NNN`;
209
+ - a partial fix, residual contradiction, or regression with the same root cause reopens that
210
+ `PF-NNN` and adds an `Iteration N evidence` note;
211
+ - a genuinely independent root cause receives the next unused number; and
212
+ - merged or split symptoms retain a `Related findings` link so the audit trail stays navigable.
213
+
214
+ Do not relabel a residual form of an old defect as a new finding merely to keep numbering
215
+ continuous.
216
+
217
+ ### Re-scan report header
218
+
219
+ ```markdown
220
+ ## Preflight Report: [Artifact Name] — Iteration [N]
221
+
222
+ > **Status**: [status]
223
+ > **Previous Iteration**: [X] findings — [all resolved / Y carried forward]
224
+ > **This Iteration**: [Z] new findings
225
+ > **Carried Forward**: [list of PF-### still open from previous iterations]
226
+ ```
227
+
228
+ ### Convergence
229
+
230
+ Use severity and decision state, not the desire for a zero-finding scan:
231
+
232
+ | State after verification | Result |
233
+ |---|---|
234
+ | Any unresolved 🔴/🟠 | **Blocked**; a bounded corrective rescan is allowed |
235
+ | No unresolved 🔴/🟠; one or more 🟡 pending | Collect decisions; do not rescan yet |
236
+ | No unresolved 🔴/🟠; all remaining 🟡 explicitly accepted | **Passed With Notes**; stop |
237
+ | Only 🔵 observations remain | **Passed With Notes**; stop unless the user requests fixes |
238
+ | No findings remain | **Passed — Clean**; stop |
239
+ | User stops with unresolved 🔴/🟠 | **Blocked**; record the stop without advancing the roadmap |
240
+
241
+ Applying an accepted minor or observation does not by itself justify another full scan. Verify that
242
+ edit directly; run another bounded scan only when the edit changes behavior, ownership, dependency
243
+ ordering, security, compatibility, or another consequential contract.
244
+
245
+ Before plan creation or execution consumes a passed artifact, compare its current git blob (or
246
+ content hash when it is uncommitted) with the revision recorded by preflight. A mismatch makes the
247
+ pass stale and requires a targeted re-check of the changed sections; it does not silently trigger a
248
+ set-wide audit.
249
+
250
+ ## Report persistence
251
+
252
+ Save the report alongside the artifact (locations in SKILL.md). It is a permanent audit trail.
253
+
254
+ ### Relationship to the Ambiguity Register
255
+
256
+ Separate documents with different purposes:
257
+
258
+ | Document | Created by | Purpose | Contains |
259
+ |---|---|---|---|
260
+ | **Ambiguity Register** (`00-ambiguity-register.md`) | make-plan / make-requirements skills | Track decisions made DURING creation | User decisions on design choices |
261
+ | **Preflight Report** (`00-preflight-report.md`) | preflight | Track issues found DURING review | Post-creation defects, gaps, codebase misalignments, and resolutions |
262
+
263
+ When a finding relates to an existing Ambiguity Register entry, cross-reference it:
264
+
265
+ ```markdown
266
+ **Related:** AR #7 decided on JWT auth, but this finding identifies a gap
267
+ in the token refresh flow that AR #7 didn't cover.
268
+ ```
269
+
270
+ Do not re-litigate an Ambiguity Register decision unless new information invalidates it — reference
271
+ the AR entry and explain what changed.
272
+
273
+ ## Same-agent bias awareness — NON-NEGOTIABLE
274
+
275
+ When the same model created the artifact and reviews it, systematic blind spots are likely — shared
276
+ training biases, knowledge gaps, and reasoning patterns. A bug missed during creation is exactly
277
+ the kind of bug that will be missed during review. Structural safeguards:
278
+
279
+ 1. **Fresh context required** — if the artifact was created in the CURRENT session, note it at the
280
+ top of the report:
281
+ ```
282
+ SAME-SESSION REVIEW: This artifact was created in the current session.
283
+ Same-agent bias risk is elevated. Consider running preflight in a new session
284
+ for maximum review independence.
285
+ ```
286
+ 2. **Standard-first checking** — for any behavior that must conform to an external standard (RFC,
287
+ protocol, spec, regulation), verify by **citing the specific standard text**, not from memory.
288
+ If you can't cite it, flag the limitation:
289
+ ```
290
+ Unable to verify conformance with [standard] — agent does not have
291
+ access to the full standard text. Flag for human review.
292
+ ```
293
+ 3. **Adversarial question checklist** — before concluding the scan, ask yourself:
294
+ - "What assumption did I make during creation that I might be unconsciously confirming now?"
295
+ - "What external standard or convention might this violate that I'm not aware of?"
296
+ - "What would a domain expert who disagrees with my approach flag as wrong?"
297
+ If any surface concerns, add them as observation findings.
298
+ 4. **User recommendation** — if the artifact is high-stakes (security/compliance/architecturally
299
+ foundational), recommend: "Consider having a human domain expert review this in addition to
300
+ the automated preflight."