@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
|
@@ -43,11 +43,16 @@ function readPayload(src, transform) {
|
|
|
43
43
|
* action: 'created' | 'updated' | 'unchanged' | 'preserved' | 'missing'
|
|
44
44
|
*/
|
|
45
45
|
function writeManagedFile(opts) {
|
|
46
|
-
const { src, dest, platformFolder, ctx, tracker, transform } = opts;
|
|
46
|
+
const { src, dest, platformFolder, ctx, tracker, transform, sourceRoot } = opts;
|
|
47
47
|
|
|
48
48
|
if (!fs.existsSync(src)) {
|
|
49
49
|
return { action: 'missing', state: 'absent' };
|
|
50
50
|
}
|
|
51
|
+
const sourceStat = fs.lstatSync(src);
|
|
52
|
+
if (sourceStat.isSymbolicLink() || !sourceStat.isFile()) {
|
|
53
|
+
throw new Error(`Managed source must be a non-symlink regular file: ${src}`);
|
|
54
|
+
}
|
|
55
|
+
if (sourceRoot) assertNoSymlinkPath(src, sourceRoot);
|
|
51
56
|
assertNoSymlinkPath(dest);
|
|
52
57
|
|
|
53
58
|
const { data, utf8 } = readPayload(src, transform);
|
|
@@ -141,6 +146,7 @@ function writeManagedFile(opts) {
|
|
|
141
146
|
*/
|
|
142
147
|
function copyManagedTree(opts) {
|
|
143
148
|
const { src, dest, platformFolder, ctx, tracker, transform } = opts;
|
|
149
|
+
const sourceRoot = opts.sourceRoot || path.resolve(src);
|
|
144
150
|
const agg = { created: 0, updated: 0, unchanged: 0, preserved: 0, missing: 0 };
|
|
145
151
|
|
|
146
152
|
if (!fs.existsSync(src)) {
|
|
@@ -148,7 +154,9 @@ function copyManagedTree(opts) {
|
|
|
148
154
|
return agg;
|
|
149
155
|
}
|
|
150
156
|
|
|
151
|
-
const stats = fs.
|
|
157
|
+
const stats = fs.lstatSync(src);
|
|
158
|
+
if (stats.isSymbolicLink()) throw new Error(`Managed source tree cannot contain symlinks: ${src}`);
|
|
159
|
+
if (path.resolve(src) !== path.resolve(sourceRoot)) assertNoSymlinkPath(src, sourceRoot);
|
|
152
160
|
if (stats.isDirectory()) {
|
|
153
161
|
for (const childName of fs.readdirSync(src)) {
|
|
154
162
|
// Generated artifacts (coverage, Python bytecode) are not runtime
|
|
@@ -157,6 +165,7 @@ function copyManagedTree(opts) {
|
|
|
157
165
|
const destName = childName === 'gitignore' ? '.gitignore' : childName;
|
|
158
166
|
const childAgg = copyManagedTree({
|
|
159
167
|
...opts,
|
|
168
|
+
sourceRoot,
|
|
160
169
|
src: path.join(src, childName),
|
|
161
170
|
dest: path.join(dest, destName)
|
|
162
171
|
});
|
|
@@ -165,7 +174,7 @@ function copyManagedTree(opts) {
|
|
|
165
174
|
return agg;
|
|
166
175
|
}
|
|
167
176
|
|
|
168
|
-
const { action } = writeManagedFile({ src, dest, platformFolder, ctx, tracker, transform });
|
|
177
|
+
const { action } = writeManagedFile({ src, dest, platformFolder, ctx, tracker, transform, sourceRoot });
|
|
169
178
|
if (agg[action] !== undefined) agg[action]++;
|
|
170
179
|
return agg;
|
|
171
180
|
}
|
|
@@ -38,7 +38,7 @@ function materializeWindowsHookCommands(content, projectRoot = process.cwd()) {
|
|
|
38
38
|
const hookPath = path.join(canonicalRoot, '.codex', 'hooks', match[1]);
|
|
39
39
|
const encodedPath = Buffer.from(hookPath, 'utf8').toString('base64url');
|
|
40
40
|
handler.commandWindows = (
|
|
41
|
-
'node -e "
|
|
41
|
+
'node -e "process.argv[1]=Buffer.from(process.argv[1],\'base64url\').toString(\'utf8\');require(\'module\').runMain()" ' +
|
|
42
42
|
encodedPath
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -91,6 +91,22 @@ function installRuntimeFiles(ctx, platformKey) {
|
|
|
91
91
|
tracker: ctx.trackers[platformKey]
|
|
92
92
|
});
|
|
93
93
|
report(ctx, treeAction(agg), 'Codex native hooks');
|
|
94
|
+
// Keep one canonical command analyzer in the Claude source tree, then
|
|
95
|
+
// materialize the same bytes into the installed Codex runtime.
|
|
96
|
+
writeSourceFile(
|
|
97
|
+
ctx,
|
|
98
|
+
platformKey,
|
|
99
|
+
path.join(SRC, 'claude', 'hooks', 'lib', 'privacy-command-analysis.cjs'),
|
|
100
|
+
path.join(platform.folder, 'hooks', 'lib', 'privacy-command-analysis.cjs'),
|
|
101
|
+
'Codex privacy command analyzer'
|
|
102
|
+
);
|
|
103
|
+
writeSourceFile(
|
|
104
|
+
ctx,
|
|
105
|
+
platformKey,
|
|
106
|
+
path.join(SRC, 'claude', 'hooks', 'lib', 'runtime-path-safety.cjs'),
|
|
107
|
+
path.join(platform.folder, 'hooks', 'lib', 'runtime-path-safety.cjs'),
|
|
108
|
+
'Codex runtime path safety'
|
|
109
|
+
);
|
|
94
110
|
}
|
|
95
111
|
|
|
96
112
|
function installNativeRuleOverrides(ctx, platformKey) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haposoft/cafekit",
|
|
3
|
-
"version": "0.16.0-rc.
|
|
3
|
+
"version": "0.16.0-rc.5",
|
|
4
4
|
"description": "Native spec-driven workflows for Claude Code, Codex CLI, and OpenCode. Bundles CafeKit skills, runtime hooks, agents, and installer scaffolding.",
|
|
5
5
|
"author": "Haposoft <nghialt@haposoft.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
"test": "node scripts/run-skill-self-tests.mjs",
|
|
13
13
|
"test:package": "node --test bin/__tests__/package-inventory.test.js",
|
|
14
14
|
"test:secrets": "node --test bin/__tests__/secret-scanner.test.js",
|
|
15
|
-
"test:policy": "node --test bin/__tests__/develop-contract.test.js"
|
|
15
|
+
"test:policy": "node --test bin/__tests__/develop-contract.test.js",
|
|
16
|
+
"release:freeze": "node scripts/benchmark-workflow.mjs freeze",
|
|
17
|
+
"prepack": "node scripts/release-preflight.mjs",
|
|
18
|
+
"prepublishOnly": "node scripts/release-preflight.mjs"
|
|
16
19
|
},
|
|
17
20
|
"files": [
|
|
18
21
|
"bin",
|
package/src/claude/CLAUDE.md
CHANGED
|
@@ -12,3 +12,9 @@
|
|
|
12
12
|
- macOS/Linux: `.claude/skills/.venv/bin/python3 scripts/<script>.py`
|
|
13
13
|
- Windows: `.claude\skills\.venv\Scripts\python.exe scripts\<script>.py`
|
|
14
14
|
- Consult `.claude/rules/state-sync.md`, `.claude/rules/hook-protocols.md`, and `.claude/rules/skill-workflow-routing.md` when their topics apply.
|
|
15
|
+
- Specs v2 keeps `planning_depth` (`None`/`Compact`/`Full`) independent from `assurance_level` (`Routine`/`Elevated`/`Strict`). Any risk has an Elevated automatic floor; Strict is opt-in only for an explicit user/project independent-audit requirement or a user-confirmed scope-specific audit decision, never a keyword or severity label. Run the artifact router before discovery: None has no durable spec; Compact/Full share the bounded `spec.json` + `requirements.md` + `design.md` core. Research requires material unresolved uncertainty, an external-current fact, or an explicit request; tasks require typed coordination topology. Full/Strict never create either automatically.
|
|
16
|
+
- In v2.1, `spec.json` is machine authority and Markdown is a human projection. Task plans have exactly seven sections: `Outcome`, `Scope`, `Anchors and Ownership`, `Changes`, `Acceptance`, `Dependencies`, `Verification Plan`; the only ownership table is `ID | Type | Target | Role | Access | Action`.
|
|
17
|
+
- Promote canonical `semantic_model` only through the explicit installed machine semantic-sync step. A semantic Markdown edit requires resynchronization and round-trip validation; never hand-author the machine shape.
|
|
18
|
+
- `coordination.boundaries` typed as ownership/dependency/transition/proof/parallel is topology authority. Legacy trigger fields, priority markers, related-file lists, approval fields, and prose are inert compatibility inputs, never canonical authoring.
|
|
19
|
+
- Canonical lifecycle is exactly `in_progress`, `paused`, `blocked`, or `done`. Technical readiness differs from closeout; authors cannot self-declare readiness, review authority, execution proof, or final `done`.
|
|
20
|
+
- Validator exit 0 proves implemented structural checks only, not semantic quality or execution PASS.
|
|
@@ -160,3 +160,23 @@ When called from `develop` Step 4 (Quality Gate Auto-Fix):
|
|
|
160
160
|
- Respect project conventions if `docs/code-standards.md` exists.
|
|
161
161
|
- DO NOT modify any files. Read and report only.
|
|
162
162
|
- Integrate with `code-review` skill for full protocol.
|
|
163
|
+
|
|
164
|
+
## Strict Semantic Review Attestation (Honest-Agent Guardrail)
|
|
165
|
+
|
|
166
|
+
This section is an honest-agent integrity guardrail, not a security boundary against same-account process tampering. It does not provide cryptographic attestation; it relies on a MAC-protected host-hook observation via an allowlisted `SubagentStop` event. Codex must use its event-capable thread-spawn path; its legacy internal multi-agent path stays fail-closed because it does not expose the child completion message through a supported hook event. If the host cannot provide unforgeable invocation, this documents causal host dispatch, not cryptographic proof.
|
|
167
|
+
|
|
168
|
+
When the review request explicitly includes `assurance_level: Strict` with a `semantic_digest` and asks for an attestation marker, and you have verified that `verdict` is `PASS` and the `semantic_digest` exactly matches the current artifacts (recompute via `node .claude/scripts/validate-spec-output.cjs <specDir> --semantic-digest` or `node .codex/scripts/validate-spec-output.cjs <specDir> --semantic-digest`), emit exactly one line at the very end of your final assistant message:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
CAFEKIT_SEMANTIC_REVIEW_ATTESTATION {"feature_name":"<feature>","spec_file":"specs/<feature>/spec.json","semantic_digest":"sha256:<64 hex>","verdict":"PASS"}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Requirements:
|
|
175
|
+
- Emit only for `Strict` with an explicit digest; never for `Routine`/`Elevated`, never without a digest, never with `FAIL` or stale digest.
|
|
176
|
+
- `spec_file` must be exactly `specs/<feature>/spec.json` relative to project root; never `scratch/spec.json` or absolute path.
|
|
177
|
+
- `feature_name` must match `spec.json:feature_name` and directory name.
|
|
178
|
+
- `semantic_digest` must be the literal `sha256:` plus 64 lowercase hex from the validator; do not fabricate.
|
|
179
|
+
- Emit exactly one marker line, no extra markers, no surrounding prose on that line.
|
|
180
|
+
- The host hook (`SubagentStop` with `agent_type` `code-auditor`/`code_auditor`) observes this marker and, if the digest matches current artifacts, persists a MAC-protected observation; only that host observation satisfies `Strict` readiness. Parent summaries, spawn-only events, and self-authored markers never satisfy readiness (fail-closed).
|
|
181
|
+
|
|
182
|
+
If `Strict` is not requested, or the digest is missing/stale, or verdict is not `PASS`, do not emit any attestation marker.
|
|
@@ -1,131 +1,175 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spec-maker
|
|
3
|
-
description: "Specification architect
|
|
3
|
+
description: "Specification architect for the smallest routed Specs v2.1 artifact graph."
|
|
4
4
|
model: opus
|
|
5
5
|
tools: Glob, Grep, Read, Edit, Write, Bash, WebFetch, WebSearch, TaskCreate, TaskGet, TaskUpdate, TaskList, SendMessage
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# Spec Maker —
|
|
8
|
+
# Spec Maker — semantic kernel v2.1 author
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
`.claude/skills/specs/SKILL.md` first; it is the routing
|
|
12
|
-
This file supplies the artifact handoff and lazy-load rules without copying the
|
|
13
|
-
full requirements, design, or task manuals into every run.
|
|
10
|
+
Produce specification artifacts, never implementation. Read
|
|
11
|
+
`.claude/skills/specs/SKILL.md` first; it is the canonical routing contract.
|
|
14
12
|
|
|
15
13
|
## Artifact Contract (MANDATORY)
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- Direct: no spec/state/registry/task/research artifact.
|
|
25
|
-
- Standard bounded: exactly `spec.json`, `requirements.md`, `design.md`, and
|
|
26
|
-
one `feature-receipt.md`; no research, tasks, registry, or reports unless the
|
|
27
|
-
persisted obligations explicitly add one.
|
|
28
|
-
- Critical or obligation-bearing: add only the required research, durable task
|
|
29
|
-
state, task registry/DAG, reports, or independent-evidence fields.
|
|
30
|
-
|
|
31
|
-
never write `init.json` or `spec-state.json` into a feature directory. Do NOT write `hydration.md`.
|
|
32
|
-
Task files, when required, use
|
|
33
|
-
`tasks/task-R{N}-{SEQ}-<slug>.md`; declarations for hashable generated output
|
|
34
|
-
are optional and must be safe relative paths.
|
|
35
|
-
|
|
36
|
-
Before `ready_for_implementation = true`, run:
|
|
15
|
+
`spec.json` is machine semantic authority. Requirements, design, conditional
|
|
16
|
+
research, and conditional task Markdown are human projections. Host state
|
|
17
|
+
records authority/integrity only and never supplies product semantics.
|
|
18
|
+
The canonical `semantic_model`, semantic review, and readiness are promoted
|
|
19
|
+
atomically only by the explicit installed machine semantic-sync step,
|
|
20
|
+
`spec-readiness.cjs`. Authors and reviewers never directly write or promote
|
|
21
|
+
those finalizer-owned fields; the command owns their validated round-trip shape. Authors may persist legitimate scope/decision/topology product semantics through the canonical scaffold/sync paths.
|
|
37
22
|
|
|
38
23
|
```bash
|
|
39
|
-
|
|
24
|
+
# Claude Code
|
|
25
|
+
node .claude/scripts/spec-readiness.cjs specs/<feature> --review-result <review.json>
|
|
26
|
+
# Codex
|
|
27
|
+
node .codex/scripts/spec-readiness.cjs specs/<feature> --review-result <review.json>
|
|
40
28
|
```
|
|
41
29
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## Phase gates
|
|
45
|
-
|
|
46
|
-
The minimum contract is:
|
|
47
|
-
|
|
48
|
-
```text
|
|
49
|
-
Route → Requirements → Design → [Tasks if required] → Validate → Handoff
|
|
50
|
-
```
|
|
30
|
+
Run it only after Markdown and the semantic review result are final. Any failure
|
|
31
|
+
leaves the exact original `spec.json` bytes unchanged.
|
|
51
32
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- Design records decisions, contracts, and invariants. Load the selected design
|
|
57
|
-
template/discovery rule only when design work needs it.
|
|
58
|
-
- Tasks are generated only when `proof_obligations` require a bundle. Load
|
|
59
|
-
`rules/tasks-generation.md` then; load `task-scoring-rubric.md` only for a
|
|
60
|
-
real decomposition question. Scoring is optional, and Cynefin is advisory.
|
|
61
|
-
- Validation loads review/grounding details only when requested or required by
|
|
62
|
-
risk. Any validator failure leaves `ready_for_implementation=false`.
|
|
33
|
+
Persist the canonical 2.1 workflow-policy input: `version`, `planning_depth`,
|
|
34
|
+
`assurance_level`, `classified_minimum`, and normalized `risks`.
|
|
35
|
+
`planning_depth` and `assurance_level` are independent. Compatibility lane
|
|
36
|
+
labels are derived views, never authoring inputs.
|
|
63
37
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
or
|
|
38
|
+
Any normalized risk makes the automatic assurance minimum Elevated. Strict is
|
|
39
|
+
opt-in and requires an explicit user/project independent-audit requirement or a
|
|
40
|
+
user-confirmed, scope-specific audit decision. Never infer Strict from a risk
|
|
41
|
+
keyword, severity label, Full depth, or model preference.
|
|
68
42
|
|
|
69
|
-
|
|
43
|
+
Run the artifact router before loading discovery guidance or creating files:
|
|
70
44
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
45
|
+
| Depth | Durable output |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `None` | no durable spec artifact |
|
|
48
|
+
| `Compact` | bounded `spec.json`, `requirements.md`, and `design.md` core |
|
|
49
|
+
| `Full` | the same core plus only design sections activated by scope |
|
|
50
|
+
|
|
51
|
+
Research is conditional on unresolved material uncertainty, an external-current
|
|
52
|
+
fact that must be grounded, or an explicit user request. Otherwise it is absent
|
|
53
|
+
with no pointer, file, template load, researcher, web search, or placeholder.
|
|
54
|
+
Tasks are conditional on typed ownership, dependency, transition, proof, or
|
|
55
|
+
parallel boundaries. Full and Strict do not trigger either artifact.
|
|
56
|
+
|
|
57
|
+
Never write `init.json`, `spec-state.json`, `hydration.md`, phase files, or
|
|
58
|
+
shorthand task filenames into a feature directory.
|
|
59
|
+
|
|
60
|
+
## Authoring route
|
|
61
|
+
|
|
62
|
+
1. Resolve the active feature and scope; ambiguity fails closed.
|
|
63
|
+
2. Classify planning and assurance independently, then route artifacts.
|
|
64
|
+
3. Establish `scope_lock` before semantic authoring.
|
|
65
|
+
4. Author requirements and design; load discovery only after routing.
|
|
66
|
+
5. Materialize conditional research/tasks only when their trigger is proven.
|
|
67
|
+
6. Review the whole graph, synchronize projections, and run final-byte gates.
|
|
68
|
+
7. Ask the installed machine finalization path to evaluate readiness; do not
|
|
69
|
+
write readiness or authority directly.
|
|
70
|
+
|
|
71
|
+
Investigate and ground repository facts. Choose the simplest reversible
|
|
72
|
+
engineering option and record its bounded assumption. Ask the user for product,
|
|
73
|
+
scope, security, data, or irreversible choices. Persist only actual items in
|
|
74
|
+
`spec.json.decisions`; unresolved `user_owned` items block readiness.
|
|
75
|
+
|
|
76
|
+
Reclassify before persistence. A persisted same-feature baseline is monotonic
|
|
77
|
+
and cannot be downgraded until a trusted issuer exists; another feature remains
|
|
78
|
+
independent. Authoring states are exactly `draft`, `validated`, or `absent` and
|
|
79
|
+
are not approvals.
|
|
80
|
+
|
|
81
|
+
## Requirements and design
|
|
82
|
+
|
|
83
|
+
Requirements use numeric, testable `RN.M` criteria. Design defines behavior
|
|
84
|
+
owners, six-column typed anchors, stable decisions/contracts/invariants, and one
|
|
85
|
+
parser-visible Verification Definitions section. Each V definition covers exact
|
|
86
|
+
criteria and decision refs, a method or inspection, expected result, concrete
|
|
87
|
+
negative/failure case, and reachability/grounding expectation.
|
|
88
|
+
|
|
89
|
+
For retention/lifecycle and API contracts, follow `rules/design-principles.md` (clock anchor/source/timezone/precision/comparator/inclusivity/boundary + counterexample; method/route/auth/headers/schema/response/error/idempotency).
|
|
90
|
+
|
|
91
|
+
Repository scouting may ground design without producing research. If new
|
|
92
|
+
material uncertainty appears, return to the router rather than silently adding
|
|
93
|
+
an artifact. Never invent a product decision, source, anchor, or command.
|
|
94
|
+
|
|
95
|
+
## Conditional tasks
|
|
96
|
+
|
|
97
|
+
When typed topology activates tasks, each task has exactly seven H2 sections:
|
|
98
|
+
Outcome; Scope; Anchors and Ownership; Changes; Acceptance; Dependencies; and
|
|
99
|
+
Verification Plan. The only ownership table is
|
|
100
|
+
`ID | Type | Target | Role | Access | Action`.
|
|
101
|
+
|
|
102
|
+
Typed `coordination.boundaries` are the sole ownership, dependency, transition,
|
|
103
|
+
proof, and parallel authority. Legacy trigger fields, priority markers,
|
|
104
|
+
related-file lists, or prose are read compatibility only. Each `RN.M` has one
|
|
105
|
+
implementation owner. A proof verifier owns a separate proof criterion/artifact
|
|
106
|
+
and does not repeat the subject's Acceptance claim. Planned verification is not
|
|
107
|
+
execution evidence. Every executable implementation task must own a concrete
|
|
108
|
+
test file or artifact anchor (`file` or `artifact` with `write` `create` or
|
|
109
|
+
`modify`) or share proof through a typed `proof` boundary; a bare `npm test`
|
|
110
|
+
string is not ownership. Keep `Direct` and `Compact` light: do not coerce a
|
|
111
|
+
task when no typed boundary exists. `spec.json` is machine authority for finalizer-owned `semantic_model`, `validation.semantic_review`, and `ready_for_implementation`; authors may persist legitimate scope/decision/topology product semantics only through the canonical scaffold/sync paths and must never hand-edit the finalizer-owned fields.
|
|
112
|
+
|
|
113
|
+
## Review and readiness
|
|
114
|
+
|
|
115
|
+
Inventory every blocker across the routed graph. For every `RN.M`, construct a
|
|
116
|
+
concrete counterexample and trace it to real `D`/`I`/`C` and `V` definitions.
|
|
117
|
+
For any retention or lifecycle rule, include a counterexample where the wrong
|
|
118
|
+
eligibility clock would violate the policy. Keep presentation concise without
|
|
119
|
+
limiting finding count. 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. Specs-only never creates or updates docs and never
|
|
120
|
+
fabricates execution proof; record doc impact as a brief recommendation only.
|
|
121
|
+
|
|
122
|
+
Routine and Elevated have no reviewer ceremony. Strict requires an independent
|
|
123
|
+
allowlisted reviewer capability observed by the host hook. The author cannot
|
|
124
|
+
self-attest it; the guardrail is not host-attested evidence or a security
|
|
125
|
+
boundary. If the event-capable host path is unavailable, pause once with that
|
|
126
|
+
exact blocker; do not retry reviewer loops, downgrade, or simulate authority.
|
|
127
|
+
|
|
128
|
+
For every durable spec, run final-byte validation and grounding through the
|
|
129
|
+
installed commands, including:
|
|
91
130
|
|
|
92
|
-
|
|
131
|
+
```bash
|
|
132
|
+
# Claude Code
|
|
133
|
+
node .claude/scripts/validate-spec-output.cjs specs/<feature>
|
|
134
|
+
# Codex
|
|
135
|
+
node .codex/scripts/validate-spec-output.cjs specs/<feature>
|
|
136
|
+
```
|
|
93
137
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
complete; no placeholders or phantom paths remain;
|
|
100
|
-
5. deterministic spec validation (and any required grounding check) passes;
|
|
101
|
-
6. `--auto` remains paused/not-ready until explicit user approval.
|
|
138
|
+
Exit 0 proves only implemented deterministic checks. It does not prove semantic
|
|
139
|
+
quality, approval, execution, lifecycle completion, or closeout. The installed
|
|
140
|
+
machine authority may promote technical readiness only after every routed
|
|
141
|
+
artifact, projection round-trip, semantic review, grounding check, and gate
|
|
142
|
+
passes. The author never fabricates or directly writes that conclusion.
|
|
102
143
|
|
|
103
|
-
|
|
144
|
+
## Lifecycle and handoff
|
|
104
145
|
|
|
105
|
-
|
|
146
|
+
Canonical feature lifecycle is exactly `in_progress`, `paused`, `blocked`, or
|
|
147
|
+
`done`. Technical readiness differs from closeout. Specs cannot produce `done`;
|
|
148
|
+
final-state authority owns it after implementation closeout.
|
|
106
149
|
|
|
107
|
-
|
|
108
|
-
spec
|
|
150
|
+
Specs never invokes Develop. After machine-promoted readiness, report only the
|
|
151
|
+
spec path and optional separate user invocation:
|
|
109
152
|
|
|
110
153
|
```text
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/hapo:develop <feature>
|
|
154
|
+
Claude Code: /hapo:develop <feature>
|
|
155
|
+
Codex: $hapo-develop <feature>
|
|
114
156
|
```
|
|
115
157
|
|
|
116
|
-
Never suggest `/work`, `/code`, or an unnamed dispatch alias.
|
|
117
|
-
|
|
118
|
-
|
|
158
|
+
Never suggest `/work`, `/code`, or an unnamed dispatch alias. `--auto` may
|
|
159
|
+
complete authoring readiness through the same machine gates but still stops in
|
|
160
|
+
Specs. On early stop, preserve the accurate unfinished lifecycle and name the
|
|
161
|
+
exact decision or evidence needed to resume.
|
|
119
162
|
|
|
120
163
|
## Lazy references
|
|
121
164
|
|
|
122
|
-
|
|
|
165
|
+
| Need | Load only then |
|
|
123
166
|
|---|---|
|
|
124
167
|
| acceptance syntax | `rules/ears-format.md` |
|
|
125
|
-
| design
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
168
|
+
| routed design | `rules/design-principles.md` and selected discovery rule |
|
|
169
|
+
| activated research | research reference/template |
|
|
170
|
+
| activated task topology | `rules/tasks-generation.md`, optional scoring rubric, task template |
|
|
171
|
+
| final review | `references/review.md`, review and grounding rules |
|
|
172
|
+
|
|
173
|
+
Claude Code and Codex are the acceptance runtimes. Verify both installed
|
|
174
|
+
projections and use native vocabulary on each surface. Report unresolved
|
|
175
|
+
questions last.
|