@haposoft/cafekit 0.16.0-rc.3 → 0.16.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/__tests__/change-firewall.semantic-firewall.test.js +2134 -0
- package/bin/__tests__/codex-hooks.test.js +531 -29
- package/bin/__tests__/codex-native.test.js +228 -7
- package/bin/__tests__/develop-contract.test.js +653 -185
- package/bin/__tests__/finalizer-pass-gate.semantic-firewall.test.js +342 -0
- package/bin/__tests__/installer-safety.test.js +39 -0
- package/bin/__tests__/opencode-spec-gate.test.js +24 -16
- package/bin/__tests__/package-inventory.test.js +705 -13
- package/bin/__tests__/release-preflight.semantic-firewall.test.js +578 -0
- package/bin/__tests__/review-receipt-c2.semantic-firewall.test.js +378 -0
- package/bin/__tests__/specs-v2-execution-closeout.test.js +468 -0
- package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +665 -0
- package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +1132 -0
- package/bin/__tests__/test-runtime-dependency-closure.cjs +182 -0
- package/bin/__tests__/validator-grounding.test.js +2013 -221
- package/bin/lib/managed-writer.js +12 -3
- package/bin/phases/codex-runtime.js +17 -1
- package/package.json +5 -2
- package/src/claude/CLAUDE.md +6 -0
- package/src/claude/agents/code-auditor.md +20 -0
- package/src/claude/agents/spec-maker.md +143 -99
- package/src/claude/hooks/__tests__/completion-authority.test.js +321 -58
- package/src/claude/hooks/__tests__/privacy-block.test.js +254 -0
- package/src/claude/hooks/__tests__/semantic-review-authority.test.js +257 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +115 -40
- package/src/claude/hooks/completion-authority-check.cjs +37 -288
- package/src/claude/hooks/completion-authority-state.cjs +10 -8
- package/src/claude/hooks/completion-authority.cjs +13 -7
- package/src/claude/hooks/docs-sync.cjs +5 -2
- package/src/claude/hooks/lib/privacy-command-analysis.cjs +393 -0
- package/src/claude/hooks/lib/runtime-path-safety.cjs +119 -0
- package/src/claude/hooks/privacy-block.cjs +99 -28
- package/src/claude/hooks/semantic-review-authority.cjs +152 -0
- package/src/claude/hooks/spec-gate.cjs +47 -117
- package/src/claude/hooks/spec-state.cjs +8 -2
- package/src/claude/migration-manifest.json +9 -1
- package/src/claude/rules/state-sync.md +52 -21
- package/src/claude/rules/workflow.md +17 -9
- package/src/claude/scripts/change-firewall.cjs +1748 -0
- package/src/claude/scripts/spec-authoring-digest.cjs +151 -0
- package/src/claude/scripts/spec-authoring-validation.cjs +126 -0
- package/src/claude/scripts/spec-final-state.cjs +290 -0
- package/src/claude/scripts/spec-ground.cjs +571 -173
- package/src/claude/scripts/spec-readiness.cjs +425 -0
- package/src/claude/scripts/spec-receipt.cjs +162 -0
- package/src/claude/scripts/spec-resolver.cjs +67 -16
- package/src/claude/scripts/spec-scaffold.cjs +1594 -139
- package/src/claude/scripts/spec-semantic-model.cjs +396 -0
- package/src/claude/scripts/validate-spec-output.cjs +3110 -218
- package/src/claude/scripts/workflow-policy.cjs +501 -183
- package/src/claude/settings/settings.json +4 -0
- package/src/claude/skills/code-review/SKILL.md +12 -3
- package/src/claude/skills/code-review/references/spec-compliance-review.md +10 -2
- package/src/claude/skills/code-review/references/verification-gate.md +13 -0
- package/src/claude/skills/develop/SKILL.md +47 -60
- package/src/claude/skills/develop/references/parallel-waves.md +9 -6
- package/src/claude/skills/develop/references/quality-gate.md +19 -12
- package/src/claude/skills/specs/SKILL.md +183 -177
- package/src/claude/skills/specs/references/ask-user-question-gates.md +27 -18
- package/src/claude/skills/specs/references/cross-spec-dependency.md +8 -4
- package/src/claude/skills/specs/references/research-strategy.md +4 -1
- package/src/claude/skills/specs/references/review.md +214 -262
- package/src/claude/skills/specs/references/scope-inquiry.md +18 -5
- package/src/claude/skills/specs/rules/design-discovery-full.md +33 -81
- package/src/claude/skills/specs/rules/design-discovery-light.md +21 -42
- package/src/claude/skills/specs/rules/design-principles.md +136 -180
- package/src/claude/skills/specs/rules/design-review.md +42 -97
- package/src/claude/skills/specs/rules/ears-format.md +42 -50
- package/src/claude/skills/specs/rules/phase-decision-matrix.md +42 -41
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +2 -1
- package/src/claude/skills/specs/rules/tasks-generation.md +189 -300
- package/src/claude/skills/specs/templates/design.md +49 -263
- package/src/claude/skills/specs/templates/requirements.md +26 -36
- package/src/claude/skills/specs/templates/research.md +9 -98
- package/src/claude/skills/specs/templates/spec-state.json +35 -85
- package/src/claude/skills/specs/templates/task.md +30 -102
- package/src/claude/skills/sync/SKILL.md +33 -10
- package/src/claude/skills/sync/references/sync-protocols.md +31 -13
- package/src/claude/skills/test/SKILL.md +17 -7
- package/src/codex/AGENTS.md +6 -0
- package/src/codex/hooks/completion-authority-check.cjs +43 -240
- package/src/codex/hooks/completion-authority-state.cjs +10 -8
- package/src/codex/hooks/completion-authority.cjs +13 -7
- package/src/codex/hooks/lib/hook-context.cjs +16 -2
- package/src/codex/hooks/lib/privacy-command-analysis.cjs +3 -0
- package/src/codex/hooks/lib/privacy-state.cjs +61 -38
- package/src/codex/hooks/lib/runtime-path-safety.cjs +3 -0
- package/src/codex/hooks/lib/spec-receipt.cjs +72 -134
- package/src/codex/hooks/lib/spec-utils.cjs +56 -5
- package/src/codex/hooks/privacy-approval.cjs +6 -2
- package/src/codex/hooks/privacy-block.cjs +94 -15
- package/src/codex/hooks/semantic-review-authority.cjs +130 -0
- package/src/codex/hooks/spec-gate.cjs +49 -34
- package/src/codex/hooks/spec-state.cjs +10 -3
- package/src/codex/hooks/state.cjs +2 -0
- package/src/codex/hooks.json +6 -1
- package/src/codex/rules/state-sync.md +47 -27
- package/src/common/AGENTS.md +1 -1
|
@@ -1,216 +1,222 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hapo:specs
|
|
3
|
-
description: "
|
|
3
|
+
description: "Author the smallest durable, grounded specification that removes product decisions from implementation."
|
|
4
4
|
user-invocable: true
|
|
5
|
-
when_to_use: "Use when a
|
|
5
|
+
when_to_use: "Use when a change needs durable requirements or design before implementation."
|
|
6
6
|
category: utilities
|
|
7
7
|
keywords: [specs, requirements, design, tasks]
|
|
8
8
|
argument-hint: "[<feature-description>] [--auto] | --status | --validate <feature> | --archive"
|
|
9
9
|
metadata:
|
|
10
10
|
author: haposoft
|
|
11
|
-
version: "2.
|
|
11
|
+
version: "2.1.0"
|
|
12
12
|
---
|
|
13
|
-
# Specs —
|
|
13
|
+
# Specs — semantic kernel v2.1
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
phase boundaries, stop conditions, lane obligations, and the implementation
|
|
17
|
-
handoff. Load the detailed rules only when the selected phase needs them; do
|
|
18
|
-
not preload every template, rubric, diagram rule, or discovery manual.
|
|
15
|
+
## Canonical authoring contract
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
`spec.json` is machine semantic authority. `requirements.md`, `design.md`,
|
|
18
|
+
conditional `research.md`, and conditional task Markdown are human projections.
|
|
19
|
+
Host state records authority/integrity only; it never supplies product semantics.
|
|
20
|
+
Markdown edits that affect semantics must be synchronized back into `spec.json`
|
|
21
|
+
and pass the same round-trip validation before readiness.
|
|
22
|
+
Promote `semantic_model`, semantic review, and readiness together only through
|
|
23
|
+
the explicit installed machine semantic-sync step, `spec-readiness.cjs`. Authors
|
|
24
|
+
and reviewers never directly write or promote those authority fields; any later
|
|
25
|
+
semantic Markdown edit invalidates the bound round-trip result.
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
```bash
|
|
28
|
+
# Claude Code
|
|
29
|
+
node .claude/scripts/spec-readiness.cjs specs/<feature> --review-result <review.json>
|
|
30
|
+
# Codex
|
|
31
|
+
node .codex/scripts/spec-readiness.cjs specs/<feature> --review-result <review.json>
|
|
32
|
+
```
|
|
23
33
|
|
|
24
|
-
`
|
|
34
|
+
`review.json` has exactly `reviewed_criteria` and `counterexamples`. The command
|
|
35
|
+
projects current Markdown, validates structure, grounding, round-trip, and
|
|
36
|
+
Strict authority, then writes atomically; failure preserves exact original bytes.
|
|
37
|
+
|
|
38
|
+
Persist `planning_depth`, `assurance_level`, `classified_minimum`, normalized
|
|
39
|
+
`risks`, and contract `version`. Planning and assurance are independent:
|
|
40
|
+
|
|
41
|
+
| Axis | Values | Decides |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `planning_depth` | `None`, `Compact`, `Full` | Durable artifact/detail topology. |
|
|
44
|
+
| `assurance_level` | `Routine`, `Elevated`, `Strict` | Review and verification depth. |
|
|
45
|
+
|
|
46
|
+
`Direct`, `Standard`, and `Critical` are derived compatibility views. Risk may
|
|
47
|
+
raise assurance without creating artifacts; decomposition may raise planning
|
|
48
|
+
depth without inventing risk. Reclassify before persistence. A persisted
|
|
49
|
+
same-feature baseline is monotonic and never contaminates another feature.
|
|
50
|
+
|
|
51
|
+
Any non-empty normalized risk raises the automatic assurance floor from Routine
|
|
52
|
+
to Elevated. Strict is opt-in: select it only when the user or project policy
|
|
53
|
+
explicitly requires independent audit, or after the user confirms a concrete,
|
|
54
|
+
scope-specific audit need. A keyword, risk severity, Full depth, or model
|
|
55
|
+
preference never selects Strict by itself.
|
|
56
|
+
|
|
57
|
+
Canonical lifecycle is exactly `in_progress`, `paused`, `blocked`, `done`.
|
|
58
|
+
Legacy aliases are read compatibility only. `ready_for_implementation` means
|
|
59
|
+
technical authoring readiness; it is not lifecycle completion, implementation
|
|
60
|
+
permission, execution proof, or closeout. `done` belongs to final-state
|
|
61
|
+
authority after execution closeout.
|
|
62
|
+
|
|
63
|
+
## Artifact router
|
|
64
|
+
|
|
65
|
+
Decide this table before loading discovery rules or creating files:
|
|
66
|
+
|
|
67
|
+
| Depth | Durable core | Research route | Task route | Design expansion |
|
|
68
|
+
|---|---|---|---|---|
|
|
69
|
+
| `None` | none | absent | absent | none |
|
|
70
|
+
| `Compact` | `spec.json`, `requirements.md`, `design.md` | only on a research trigger | only on a typed topology trigger | bounded core sections |
|
|
71
|
+
| `Full` | `spec.json`, `requirements.md`, `design.md` | only on a research trigger | only on a typed topology trigger | only sections activated by scoped behavior |
|
|
72
|
+
|
|
73
|
+
Research triggers are: unresolved material uncertainty that can change
|
|
74
|
+
requirements/design; an external-current fact that must be grounded; or an
|
|
75
|
+
explicit user request. Otherwise `authoring.research=absent`, omit the pointer,
|
|
76
|
+
and create no file or placeholder. Repository scouting may inform requirements
|
|
77
|
+
or design without producing `research.md`.
|
|
78
|
+
|
|
79
|
+
Task triggers are typed ownership, dependency, transition, proof, or parallel
|
|
80
|
+
boundaries that require separate execution packets. Requirement count, size,
|
|
81
|
+
planning depth, assurance level, risk label, architectural layers, and habit do
|
|
82
|
+
not trigger tasks. `coordination.boundaries` is machine authority.
|
|
83
|
+
|
|
84
|
+
Full selects potential detail, never automatic discovery ceremony. It does not
|
|
85
|
+
automatically search the web, invoke a researcher, dump discovery results, create
|
|
86
|
+
research, create tasks, or retain unused template sections.
|
|
87
|
+
|
|
88
|
+
## Artifact profiles
|
|
89
|
+
|
|
90
|
+
- `None`: create no spec directory, registry, research, task, phase, report, or
|
|
91
|
+
receipt artifact.
|
|
92
|
+
- `Compact` and `Full`: create the routed core and only optional artifacts whose
|
|
93
|
+
trigger is present.
|
|
94
|
+
- Research, task, and phase metadata must disappear when their trigger is absent.
|
|
95
|
+
- `feature-receipt.md` and task execution receipts belong to execution closeout,
|
|
96
|
+
not authoring or readiness.
|
|
97
|
+
|
|
98
|
+
Forbidden authoring artifacts include `init.json`, `spec-state.json`,
|
|
99
|
+
`hydration.md`, `phase-*.md`, and shorthand task filenames.
|
|
100
|
+
|
|
101
|
+
## Route
|
|
102
|
+
|
|
103
|
+
1. Resolve the request and active feature; ambiguity fails closed.
|
|
104
|
+
Ambiguous active candidates fail closed: multiple active specs require an
|
|
105
|
+
explicit target. Do not rely on first-directory selection or guess from the
|
|
106
|
+
first active directory.
|
|
107
|
+
2. Classify both axes and run the artifact router before loading discovery.
|
|
108
|
+
3. Establish `scope_lock` with source, in/out scope, and
|
|
109
|
+
`expansion_policy=requires-user-approval`.
|
|
110
|
+
4. Author requirements, then design, then conditional research/tasks as their
|
|
111
|
+
actual dependency requires; do not create empty artifacts to reserve them.
|
|
112
|
+
5. Review the final graph, synchronize machine and Markdown projections, then
|
|
113
|
+
run deterministic gates.
|
|
114
|
+
6. Pause for unresolved product/scope decisions instead of inventing semantics.
|
|
115
|
+
|
|
116
|
+
Investigate a `repository_fact` and record grounding. Choose the simplest
|
|
117
|
+
`reversible_assumption` and record its bounded reversal boundary. Ask the user
|
|
118
|
+
for a `user_owned` product, scope, security, data, or irreversible decision.
|
|
119
|
+
Persist only actual items in optional `spec.json.decisions`; omit it when none
|
|
120
|
+
exist. Unresolved `user_owned` entries block readiness.
|
|
25
121
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
never a stop point. Never implement code from this skill.
|
|
122
|
+
Supported flags are `--auto`, `--validate`, `--status`, and `--archive`; bare
|
|
123
|
+
`status`, `archive`, and `resume` are compatibility aliases.
|
|
29
124
|
|
|
30
|
-
|
|
125
|
+
## Requirements
|
|
31
126
|
|
|
32
|
-
-
|
|
33
|
-
- Do NOT create `specs/<feature>/hydration.md`.
|
|
34
|
-
- Task filenames are never shorthand such as `tasks/task-R0-1.md`.
|
|
127
|
+
Load `rules/ears-format.md` and `templates/requirements.md`.
|
|
35
128
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
129
|
+
- Use `Requirement N` and literal `RN.M`; task mappings use numeric `N.M`.
|
|
130
|
+
- State scoped outcomes and non-goals before detailed criteria.
|
|
131
|
+
- Every behavior has measurable acceptance and relevant negative/error cases.
|
|
132
|
+
- Add only feature-specific measurable non-functional constraints.
|
|
133
|
+
- User story, rationale, and scenarios are conditional, not ceremony.
|
|
41
134
|
|
|
42
|
-
##
|
|
135
|
+
## Design and discovery
|
|
43
136
|
|
|
44
|
-
|
|
45
|
-
|
|
137
|
+
Load `rules/design-principles.md` plus the routed light/full discovery rule.
|
|
138
|
+
Load research guidance only when the artifact router selected research.
|
|
46
139
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
140
|
+
- Compact keeps boundary, six-column typed anchors, decisions/invariants, and
|
|
141
|
+
verification. Full adds only triggered contract/flow/data/error/security/
|
|
142
|
+
migration sections.
|
|
143
|
+
- Define each implementation-significant contract once and reference its stable
|
|
144
|
+
`D`/`I`/`C` ID.
|
|
145
|
+
- For retention/lifecycle and API contracts, follow `rules/design-principles.md` (clock anchor/source/timezone/precision/comparator/inclusivity/boundary + wrong-clock/boundary counterexample; method/route/auth/headers/schema/response/error/idempotency).
|
|
146
|
+
- Keep exactly one parser-visible `## Verification Definitions` section. Each
|
|
147
|
+
single-line V definition starts with `Criteria ...; Owner ...;` and traces
|
|
148
|
+
exact decision refs, method,
|
|
149
|
+
expected result, negative/failure case, and reachability/grounding.
|
|
150
|
+
- Add `Proof criteria ...; Proof owner ...; Evidence anchor ...;` only for a
|
|
151
|
+
typed proof boundary; ordinary verification stays in the owner boundary.
|
|
152
|
+
- Delete unused optional sections. Ground repository facts to exact anchors;
|
|
153
|
+
ground external-current decisions to primary sources.
|
|
60
154
|
|
|
61
|
-
|
|
62
|
-
trusted runtime-issued receipt is blocked; boolean approval fields are not
|
|
63
|
-
authorization. `--auto` never writes `user_approved: true`.
|
|
155
|
+
## Tasks and lightweight phases
|
|
64
156
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
157
|
+
Load `rules/tasks-generation.md` and `templates/task.md` only when at least one
|
|
158
|
+
typed topology trigger exists. Size, risk labels, and tradition alone do not
|
|
159
|
+
create tasks. Keep `Direct`/`Compact` light: do not coerce a task when no typed
|
|
160
|
+
boundary exists, and never invent a task to justify structure.
|
|
69
161
|
|
|
70
|
-
|
|
162
|
+
Each task has exactly seven H2 sections: Outcome, Scope, Anchors and Ownership, Changes, Acceptance, Dependencies, and Verification Plan. The only ownership table is `ID | Type | Target | Role | Access | Action`. Planned verification is not execution evidence. Every executable task must own a concrete test file/artifact anchor (write create/modify) or share proof via a typed proof boundary; bare npm test is not ownership.
|
|
71
163
|
|
|
72
|
-
|
|
73
|
-
`
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
2. `--validate <feature>` jumps to validation and stops on any validator error.
|
|
77
|
-
3. `--archive` runs archival rules and stops.
|
|
78
|
-
4. `--auto` generates lane-required artifacts, validates them, then pauses for
|
|
79
|
-
explicit user approval; it is always `paused` and `not-ready` at that point.
|
|
80
|
-
5. A description enters the lane-appropriate route. If no description exists,
|
|
81
|
-
ask only the minimum user-owned question needed to continue.
|
|
82
|
-
|
|
83
|
-
Before selecting a new Standard/Critical spec, inspect only the relevant active
|
|
84
|
-
state and branch match. Multiple active candidates are an ambiguity stop, not a
|
|
85
|
-
reason to pick the first directory. Direct work does not perform registry
|
|
86
|
-
discovery as ceremony.
|
|
87
|
-
|
|
88
|
-
## Phase contract
|
|
89
|
-
|
|
90
|
-
### Route and scope
|
|
91
|
-
|
|
92
|
-
Use repository evidence for facts. Ask the user only for scope, architecture,
|
|
93
|
-
acceptance, or risk decisions that evidence cannot settle. If the idea is
|
|
94
|
-
unclear or competing designs remain, stop and route to `hapo:brainstorm`.
|
|
95
|
-
Load `references/ask-user-question-gates.md` only when a user-owned decision is
|
|
96
|
-
actually needed. Multimodal/document references load their domain reference
|
|
97
|
-
only when the request contains that input.
|
|
98
|
-
|
|
99
|
-
### Requirements
|
|
100
|
-
|
|
101
|
-
Create numeric, testable requirements only for Standard/Critical work. Load
|
|
102
|
-
`rules/ears-format.md` when writing EARS acceptance criteria; it is not part of
|
|
103
|
-
the routing context. Run targeted codebase discovery when behavior, contracts,
|
|
104
|
-
paths, tests, package boundaries, or runtime surfaces are uncertain.
|
|
105
|
-
|
|
106
|
-
External research is required only when `needsResearchGrounding` or an
|
|
107
|
-
applicable persisted risk obligation says so. Otherwise record the bounded skip
|
|
108
|
-
implicitly through the selected artifact profile and do not create `research.md`.
|
|
109
|
-
|
|
110
|
-
### Design
|
|
111
|
-
|
|
112
|
-
Write `design.md` only after requirements are sufficient. Load the design
|
|
113
|
-
template/principles and `rules/phase-decision-matrix.md`. For discovery, load
|
|
114
|
-
`rules/design-discovery-light.md` for bounded work or
|
|
115
|
-
`rules/design-discovery-full.md` for complex, security-sensitive, or externally
|
|
116
|
-
uncertain work; load only the selected mode.
|
|
117
|
-
Use diagrams only for multi-step or cross-boundary
|
|
118
|
-
flows. Auth, transport, persistence, generated artifacts, runtime boundaries,
|
|
119
|
-
and deletion policy require canonical contracts and invariants.
|
|
120
|
-
|
|
121
|
-
### Task bundle (conditional)
|
|
122
|
-
|
|
123
|
-
Create tasks only when the persisted lane obligations require durable task
|
|
124
|
-
execution, traceability, or a separate task proof path. When tasks are needed,
|
|
125
|
-
load `rules/tasks-generation.md`. Load `rules/task-scoring-rubric.md` only if
|
|
126
|
-
scoring helps resolve a real split/merge or dependency question. The task
|
|
127
|
-
template and filename/registry rules are lazy inputs, not core ceremony.
|
|
128
|
-
|
|
129
|
-
Every generated task still needs exact scope, requirement mapping, completion
|
|
130
|
-
criteria, executable evidence, and runtime reachability where applicable.
|
|
131
|
-
Do not add an R0 task, integration task, spike, `(P)` marker, or DAG edge unless
|
|
132
|
-
there is a real dependency or proof boundary. Cynefin may explain a spike
|
|
133
|
-
recommendation but does not mandate one.
|
|
134
|
-
|
|
135
|
-
### Validation and finalization
|
|
136
|
-
|
|
137
|
-
Load `references/review.md` and detailed design/task rules only for an explicit
|
|
138
|
-
validation request or when the persisted policy marks validation required.
|
|
139
|
-
Always run the deterministic validator before readiness:
|
|
164
|
+
Typed `coordination.boundaries` entries (`ownership`, `dependency`,
|
|
165
|
+
`transition`, `proof`, `parallel`) are the sole topology authority. Legacy
|
|
166
|
+
priority markers, trigger fields, related-file lists, and prose labels are inert
|
|
167
|
+
read compatibility, never canonical authoring.
|
|
140
168
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
169
|
+
Each `RN.M` has exactly one implementation owner. A proof subject implements
|
|
170
|
+
its criterion; its verifier owns a separate proof criterion/artifact, references
|
|
171
|
+
the same V definition, and never duplicates the subject acceptance claim.
|
|
144
172
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
`ready_for_implementation = false`. For a task-bearing policy, also rebuild the
|
|
148
|
-
real task inventory/registry and run grounding when that validator requires it.
|
|
173
|
+
Phases are optional task-ID groups only for a complex Full task graph. They do
|
|
174
|
+
not create files, repeat prose, or replace typed edges.
|
|
149
175
|
|
|
150
|
-
##
|
|
176
|
+
## Review and readiness
|
|
151
177
|
|
|
152
|
-
|
|
178
|
+
Load `references/review.md`. Review the whole graph and inventory every blocker; presentation may be concise, but finding count is never capped. Each `RN.M` receives a concrete counterexample mapped to real `D`/`I`/`C` and `V` refs. For any retention/lifecycle rule, include a counterexample where the wrong clock (for example creation time instead of terminal/state-transition) would violate the policy.
|
|
153
179
|
|
|
154
|
-
-
|
|
155
|
-
- scope/architecture/acceptance is unresolved and needs the user;
|
|
156
|
-
- an active-spec choice is ambiguous;
|
|
157
|
-
- a required artifact, approval, task mapping, contract, or evidence is missing;
|
|
158
|
-
- a validator, grounding check, or required research obligation fails;
|
|
159
|
-
- a path, dependency, or runtime entrypoint cannot be grounded;
|
|
160
|
-
- execution is blocked by permissions or environment.
|
|
180
|
+
Routine and Elevated have no reviewer ceremony. Strict requires an independent, allowlisted reviewer capability observed by the host hook. The author cannot self-attest Strict. If that host event is unavailable, pause once with the exact capability blocker; do not retry reviewer loops, self-attest, downgrade, or simulate the event. This is an honest-agent guardrail, not host-attested evidence or a security boundary. Two-review target is advisory: after two failed semantic rounds, pause for unresolved product/security/architecture uncertainty or repeated non-convergence; one bounded mechanical correction without weakening gates is allowed; budgets never override correctness.
|
|
161
181
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
For Strict, the reviewer binds its host-observed event to the read-only candidate
|
|
183
|
+
digest from `node .claude/scripts/validate-spec-output.cjs specs/<feature> --semantic-digest` (Claude Code) or `node .codex/scripts/validate-spec-output.cjs specs/<feature> --semantic-digest` (Codex);
|
|
184
|
+
finalization then verifies that current observation.
|
|
165
185
|
|
|
166
|
-
|
|
186
|
+
Run final-byte validation and grounding for every durable spec:
|
|
167
187
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
188
|
+
```bash
|
|
189
|
+
# Claude Code
|
|
190
|
+
node .claude/scripts/validate-spec-output.cjs specs/<feature>
|
|
191
|
+
# Codex
|
|
192
|
+
node .codex/scripts/validate-spec-output.cjs specs/<feature>
|
|
193
|
+
```
|
|
173
194
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
Critical work requires a real independent audit when `needsIndependentAudit` is
|
|
177
|
-
persisted. Review consumes proof and never creates or claims it; `Audit: PASS` is
|
|
178
|
-
not evidence.
|
|
195
|
+
Exit 0 proves only implemented structural/grounding checks. It does not prove
|
|
196
|
+
semantic quality, product correctness, execution PASS, or closeout.
|
|
179
197
|
|
|
180
|
-
The
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
198
|
+
The installed atomic finalizer may set `ready_for_implementation = true`
|
|
199
|
+
only after routed artifacts match policy, all projections round-trip, the full
|
|
200
|
+
blocker inventory is resolved, every required authoring state is `validated`,
|
|
201
|
+
semantic review coverage is exact, and every deterministic gate passes. The
|
|
202
|
+
author must not write this authority conclusion directly. This flag is technical
|
|
203
|
+
artifact readiness only.
|
|
204
|
+
Specs never invokes or auto-chains into Develop; only a fresh explicit user
|
|
205
|
+
invocation of Develop starts implementation. Specs-only never creates or
|
|
206
|
+
updates docs; record doc impact as a brief recommendation and leave creation or
|
|
207
|
+
update to the docs workflow. Never fabricate execution proof. On failure, keep lifecycle state unfinished and report the exact blocker.
|
|
184
208
|
|
|
185
|
-
|
|
209
|
+
## Platform acceptance and handoff
|
|
186
210
|
|
|
187
|
-
|
|
188
|
-
|
|
211
|
+
Semantic acceptance covers Claude Code and Codex. Validate both installed
|
|
212
|
+
instruction projections and use native vocabulary for each runtime.
|
|
189
213
|
|
|
190
|
-
|
|
191
|
-
✅ Spec complete: specs/<feature>/
|
|
192
|
-
📌 Next step — run:
|
|
193
|
-
/hapo:develop <feature>
|
|
214
|
+
After readiness, report the optional handoff without invoking it:
|
|
194
215
|
|
|
195
|
-
|
|
196
|
-
|
|
216
|
+
- Claude Code: `/hapo:develop <feature>`
|
|
217
|
+
- Codex: `$hapo-develop <feature>`
|
|
197
218
|
|
|
198
|
-
For
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
## Lazy references
|
|
203
|
-
|
|
204
|
-
| Need | Load only then |
|
|
205
|
-
|---|---|
|
|
206
|
-
| user-owned questions | `references/ask-user-question-gates.md` |
|
|
207
|
-
| EARS syntax | `rules/ears-format.md` |
|
|
208
|
-
| design choices | `rules/design-principles.md`, phase matrix, selected discovery rule |
|
|
209
|
-
| task decomposition | `rules/tasks-generation.md`, optional scoring rubric, task template |
|
|
210
|
-
| validation | `references/review.md`, design review rules, validators |
|
|
211
|
-
| archive/translation/research | the matching reference only when enabled by scope/policy |
|
|
212
|
-
|
|
213
|
-
`spec.json` remains the source of truth for status, timestamps, approvals,
|
|
214
|
-
`scope_lock`, and the single `workflow_policy` snapshot. Do not emit
|
|
215
|
-
`init.json`, `spec-state.json`, `hydration.md`, shorthand task filenames, or
|
|
216
|
-
unregistered artifacts.
|
|
219
|
+
For an early stop, keep readiness false and explain how to resume. `--auto` may
|
|
220
|
+
set technical readiness after every gate passes, but must stop in Specs. Never
|
|
221
|
+
claim proof, authority, approval, readiness, or closeout from placeholders,
|
|
222
|
+
self-authored receipts, chat state, or stale validation.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# AskUserQuestion Gate Matrix
|
|
2
2
|
|
|
3
|
-
Use this matrix to
|
|
3
|
+
Use this matrix to classify authority before pausing for user input. A workflow
|
|
4
|
+
event, uncertainty, or architecture choice does not by itself justify a question.
|
|
4
5
|
|
|
5
6
|
## Source Priority
|
|
6
7
|
|
|
@@ -12,25 +13,30 @@ Resolve uncertainty in this order:
|
|
|
12
13
|
4. Reasonable default from CafeKit rules.
|
|
13
14
|
5. `AskUserQuestion` only when the remaining decision is user-owned.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Classify first:
|
|
17
|
+
|
|
18
|
+
- `repository_fact`: investigate and ground it from repository or required
|
|
19
|
+
current evidence. Do not ask the user to supply a discoverable fact.
|
|
20
|
+
- `reversible_assumption`: choose the simplest engineering option and record its
|
|
21
|
+
bounded reversal boundary. Do not ask unless the user explicitly requested
|
|
22
|
+
control of that choice.
|
|
23
|
+
- `user_owned`: HOLD and ASK for a product, scope, security, data, or
|
|
24
|
+
irreversible decision. Never infer or self-approve it.
|
|
25
|
+
|
|
26
|
+
Store only actual items in optional `spec.json.decisions`; omit it when absent.
|
|
27
|
+
Every unresolved `user_owned` entry blocks readiness; facts and reversible
|
|
28
|
+
assumptions do not become user questions merely because they are unresolved.
|
|
16
29
|
|
|
17
30
|
## Gate Matrix
|
|
18
31
|
|
|
19
|
-
|
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
| Architecture tie | Two approaches are materially similar after evidence | Yes | Pick approach with recommended option first | `design.md` |
|
|
28
|
-
| Contract change | Auth, persistence, provider, API, CLI, schema, permissions, or runtime contract changes | Yes if user intent not explicit | Confirm contract and rollback expectations | `design.md` canonical contracts |
|
|
29
|
-
| Scope expansion | A task candidate adds work not in `scope_lock` | Yes | Approve expansion / defer / reject | `spec.json.scope_lock` + affected docs |
|
|
30
|
-
| High-risk spike | Risk = Complex and spike may change deliverables | Yes if cost/scope impact > 4h | Spike now / reduce / defer | `research.md` + task file |
|
|
31
|
-
| Task conflict | Parallel candidate shares files/contracts with another task | No by default | Resolve sequentially unless business deadline requires parallelization | task dependencies |
|
|
32
|
-
| Validation findings | Red-team/validate findings modify approved scope/design/tasks | Yes | Apply accepted / review each / reject all | `reports/red-team-report.md` or validation log |
|
|
33
|
-
| Final contradiction | Whole-spec sweep finds unresolved contradiction | Yes | Choose authoritative source/decision | affected docs + `spec.json` |
|
|
32
|
+
| Class | Example trigger | Action | Record in |
|
|
33
|
+
|---|---|---|---|
|
|
34
|
+
| Repository fact | Existing behavior, path, dependency, API shape, or current constraint | Investigate and ground; if evidence remains unavailable, report the exact grounding blocker without asking the user to guess | design/research anchor |
|
|
35
|
+
| Reversible assumption | Two technically valid internal approaches with bounded rollback | Select the simplest compatible option and record the reversal trigger/boundary | `spec.json.decisions` when material, otherwise design |
|
|
36
|
+
| User-owned decision | Product behavior, scope expansion/reduction, security posture, data handling, or irreversible migration | HOLD and ASK; keep the exact decision unresolved until the user answers | `spec.json.decisions` and affected artifact |
|
|
37
|
+
| Active-target ambiguity | Multiple plausible feature/spec targets | HOLD and ASK because target selection changes scope | `scope_lock` |
|
|
38
|
+
| Validation finding | A factual defect or reversible repair | Ground and repair without approval; ASK only if resolution changes a user-owned decision | affected canonical artifact |
|
|
39
|
+
| Task conflict | Shared files/contracts between parallel candidates | Serialize or merge using the simplest reversible topology | task boundaries |
|
|
34
40
|
|
|
35
41
|
## Question Format
|
|
36
42
|
|
|
@@ -50,6 +56,8 @@ Do not ask when:
|
|
|
50
56
|
- The choice is pure implementation detail with no scope/user impact.
|
|
51
57
|
- The task can safely use an existing codebase convention.
|
|
52
58
|
- The question exists only to avoid making a normal engineering judgment.
|
|
59
|
+
- Evidence is missing for a `repository_fact`; report the grounding blocker
|
|
60
|
+
instead of asking the user to guess.
|
|
53
61
|
|
|
54
62
|
## Recording Rules
|
|
55
63
|
|
|
@@ -58,4 +66,5 @@ After a user answer:
|
|
|
58
66
|
- Update the artifact that drives implementation, not only a report.
|
|
59
67
|
- Keep exact selected option and custom free text when provided.
|
|
60
68
|
- Add unresolved questions at the end of the affected document.
|
|
61
|
-
-
|
|
69
|
+
- HOLD while any `user_owned` decision is unresolved. Do not mark
|
|
70
|
+
`ready_for_implementation = true` until the user resolves it.
|
|
@@ -50,10 +50,14 @@ When a relationship is detected, update `spec.json` of **BOTH** specs:
|
|
|
50
50
|
|
|
51
51
|
### Step 5: Handle Ambiguity
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
Treat dependency direction as a `repository_fact`: inspect owned outputs,
|
|
54
|
+
consumers, typed boundaries, and current lifecycle, then ground the edge. Do not
|
|
55
|
+
ask the user to guess a factual graph relationship. If no direction can be
|
|
56
|
+
grounded, leave the edge absent and report the exact grounding blocker.
|
|
57
|
+
|
|
58
|
+
If choosing which deliverable proceeds first changes user-owned scope, release
|
|
59
|
+
ordering, data handling, or an irreversible commitment, HOLD and ASK for that
|
|
60
|
+
decision; unresolved `user_owned` ordering blocks readiness.
|
|
57
61
|
|
|
58
62
|
## Blocked State
|
|
59
63
|
|
|
@@ -86,7 +86,10 @@ Before detailing requirements, list unanswered questions:
|
|
|
86
86
|
- codebase fit
|
|
87
87
|
- external/current constraints
|
|
88
88
|
- downstream task and test implications
|
|
89
|
-
- If evidence leaves multiple viable choices
|
|
89
|
+
- If evidence leaves multiple viable choices, classify authority: choose the
|
|
90
|
+
simplest reversible engineering option and record its bounded reversal;
|
|
91
|
+
HOLD/ASK only for a user-owned product, scope, security, data, or irreversible
|
|
92
|
+
decision. Missing repository facts remain grounding blockers, not questions.
|
|
90
93
|
|
|
91
94
|
### 7. Record Findings
|
|
92
95
|
- Write to `research.md` using template `templates/research.md`
|