@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,106 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schema_version": "2.
|
|
2
|
+
"schema_version": "2.1",
|
|
3
3
|
"feature_name": "{{FEATURE_NAME}}",
|
|
4
4
|
"created_at": "{{TIMESTAMP}}",
|
|
5
5
|
"updated_at": "{{TIMESTAMP}}",
|
|
6
6
|
"language": "en",
|
|
7
7
|
"status": "in_progress",
|
|
8
|
-
"phase": "initialized",
|
|
9
|
-
"current_phase": "init",
|
|
10
|
-
"priority": "P2",
|
|
11
|
-
"effort": null,
|
|
12
|
-
"tags": [],
|
|
13
|
-
"approvals": {
|
|
14
|
-
"requirements": {
|
|
15
|
-
"generated": false,
|
|
16
|
-
"agent_validated": false,
|
|
17
|
-
"user_approved": false
|
|
18
|
-
},
|
|
19
|
-
"design": {
|
|
20
|
-
"generated": false,
|
|
21
|
-
"agent_validated": false,
|
|
22
|
-
"user_approved": false
|
|
23
|
-
},
|
|
24
|
-
"tasks": {
|
|
25
|
-
"generated": false,
|
|
26
|
-
"agent_validated": false,
|
|
27
|
-
"user_approved": false
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
8
|
"scope_lock": {
|
|
31
9
|
"source": "{{PROJECT_DESCRIPTION}}",
|
|
32
10
|
"in_scope": [],
|
|
33
11
|
"out_of_scope": [],
|
|
34
12
|
"expansion_policy": "requires-user-approval"
|
|
35
13
|
},
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"task_registry": {},
|
|
42
|
-
"blocker": null,
|
|
43
|
-
"progress": {
|
|
44
|
-
"init": "done",
|
|
45
|
-
"requirements": "pending",
|
|
46
|
-
"research": "pending",
|
|
47
|
-
"design": "pending",
|
|
48
|
-
"tasks": "pending",
|
|
49
|
-
"code": "pending",
|
|
50
|
-
"test": "pending",
|
|
51
|
-
"review": "pending"
|
|
52
|
-
},
|
|
53
|
-
"timestamps": {
|
|
54
|
-
"init": "{{TIMESTAMP}}",
|
|
55
|
-
"requirements_done": null,
|
|
56
|
-
"research_done": null,
|
|
57
|
-
"design_done": null,
|
|
58
|
-
"tasks_done": null,
|
|
59
|
-
"code_done": null,
|
|
60
|
-
"test_done": null,
|
|
61
|
-
"review_done": null,
|
|
62
|
-
"validation_done": null
|
|
14
|
+
"authoring": {
|
|
15
|
+
"requirements": "draft",
|
|
16
|
+
"design": "draft",
|
|
17
|
+
"research": "absent",
|
|
18
|
+
"tasks": "absent"
|
|
63
19
|
},
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"discovery_reason": null,
|
|
67
|
-
"validation_recommended": false
|
|
20
|
+
"coordination": {
|
|
21
|
+
"boundaries": []
|
|
68
22
|
},
|
|
69
23
|
"validation": {
|
|
70
24
|
"status": "not-run",
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
25
|
+
"semantic_review": {
|
|
26
|
+
"status": "not-run",
|
|
27
|
+
"semantic_digest": null,
|
|
28
|
+
"verdict": null,
|
|
29
|
+
"lifecycle_disposition": null,
|
|
30
|
+
"findings": [],
|
|
31
|
+
"unresolved_decisions": [],
|
|
32
|
+
"graph_coverage": [],
|
|
33
|
+
"repair_round": 0,
|
|
34
|
+
"reviewed_criteria": [],
|
|
35
|
+
"counterexamples": [],
|
|
36
|
+
"reviewer_evidence": null
|
|
37
|
+
},
|
|
38
|
+
"semantic_review_history": {
|
|
39
|
+
"lineage_id": "{{LINEAGE_ID}}",
|
|
40
|
+
"entries": []
|
|
41
|
+
},
|
|
42
|
+
"authoring_validation": null
|
|
82
43
|
},
|
|
44
|
+
"semantic_model": null,
|
|
83
45
|
"ready_for_implementation": false,
|
|
84
46
|
"workflow_policy": {
|
|
85
|
-
"version": "1",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
],
|
|
94
|
-
"actor_needs": [
|
|
95
|
-
{
|
|
96
|
-
"capability": "inspection",
|
|
97
|
-
"independence": "same-session"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"capability": "execution-proof",
|
|
101
|
-
"independence": "same-session"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"override_receipt": null
|
|
47
|
+
"version": "2.1",
|
|
48
|
+
"planning_depth": "Compact",
|
|
49
|
+
"assurance_level": "Routine",
|
|
50
|
+
"classified_minimum": {
|
|
51
|
+
"planning_depth": "Compact",
|
|
52
|
+
"assurance_level": "Routine"
|
|
53
|
+
},
|
|
54
|
+
"risks": []
|
|
105
55
|
}
|
|
106
56
|
}
|
|
@@ -1,119 +1,47 @@
|
|
|
1
1
|
# Task R{{REQ_NUMBER}}-{{SEQ}}: {{TITLE}}
|
|
2
|
-
|
|
3
|
-
**Requirement:** R{{REQ_NUMBER}} — {{REQUIREMENT_TITLE}}
|
|
4
2
|
**Status:** pending
|
|
5
|
-
**Priority:** {{PRIORITY}}
|
|
6
|
-
**Estimated Effort:** {{EFFORT}}
|
|
7
|
-
**Dependencies:** {{DEPENDENCIES}}
|
|
8
|
-
**Spec:** specs/{{FEATURE_NAME}}/
|
|
9
|
-
|
|
10
|
-
The owning `spec.json.workflow_policy` snapshot is authoritative for this task.
|
|
11
|
-
`needsInspection` and `needsExecutionProof` are separate capabilities; Standard
|
|
12
|
-
requires both, while Direct requires execution proof. Do not encode an agent
|
|
13
|
-
chain in this task. The canonical verdicts are `PASS`, `PASS_WITH_WARNINGS`,
|
|
14
|
-
`FAIL`, and `BLOCKED`. Legacy diagnostic inputs `PARTIAL` and `NO_TESTS` are
|
|
15
|
-
normalized to unfinished `BLOCKED`; they are not canonical verdicts.
|
|
16
|
-
|
|
17
|
-
## Context
|
|
18
|
-
|
|
19
|
-
- **Why**: {{Business/user reason this task exists}}
|
|
20
|
-
- **Current state**: {{Relevant existing files, route, model, API, screen, or "greenfield"}}
|
|
21
|
-
- **Target outcome**: {{Observable behavior after this task is done}}
|
|
22
|
-
|
|
23
|
-
## Constraints
|
|
24
|
-
|
|
25
|
-
- **MUST**: {{Non-negotiable requirement or technical constraint}}
|
|
26
|
-
- **SHOULD**: {{Recommended approach or optimization}}
|
|
27
|
-
- **MUST NOT**: {{Explicitly forbidden action or approach}}
|
|
28
|
-
- **SCOPE**: Implement only the behavior mapped to R{{REQ_NUMBER}} and the approved `scope_lock`; do not add out-of-scope features or leave scoped acceptance criteria unwired.
|
|
29
|
-
|
|
30
|
-
## Steps
|
|
31
|
-
|
|
32
|
-
- [ ] 1. {{Actionable step with exact file/path/contract}}
|
|
33
|
-
- {{Business intent: what user/system behavior this enables}}
|
|
34
|
-
- {{Code detail: schema/API/component/function/route and validation rules}}
|
|
35
|
-
- _Requirements: {{REQ_NUMBER}}.{{X}}_
|
|
36
|
-
|
|
37
|
-
- [ ] 2. {{Next actionable step}}
|
|
38
|
-
- {{Business intent}}
|
|
39
|
-
- {{Code detail, edge case, or integration contract}}
|
|
40
|
-
- _Requirements: {{REQ_NUMBER}}.{{Y}}_
|
|
41
|
-
|
|
42
|
-
- [ ] 3. Verification implementation
|
|
43
|
-
- {{Unit/integration/e2e test or explicit manual verification hook}}
|
|
44
|
-
- _Requirements: {{REQ_NUMBER}}_
|
|
45
|
-
|
|
46
|
-
## Requirements
|
|
47
|
-
|
|
48
|
-
- {{REQ_NUMBER}}.{{X}} — {{Acceptance criterion or requirement covered}}
|
|
49
|
-
- {{REQ_NUMBER}}.{{Y}} — {{Acceptance criterion or requirement covered}}
|
|
50
3
|
|
|
51
|
-
##
|
|
4
|
+
## Outcome
|
|
52
5
|
|
|
53
|
-
|
|
54
|
-
|---|---|---|
|
|
55
|
-
| `{{FILE_PATH_1}}` | Create / Modify / Delete | {{DESCRIPTION_1}} |
|
|
56
|
-
| `{{FILE_PATH_2}}` | Create / Modify / Delete | {{DESCRIPTION_2}} |
|
|
6
|
+
{{Concrete observable vertical outcome, named entrypoint, and resulting state delivered by this task.}}
|
|
57
7
|
|
|
58
|
-
|
|
8
|
+
## Scope
|
|
59
9
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
strings. Omit the field when the task has no such artifact. A `Related Files`
|
|
63
|
-
row (`Create`, `Modify`, `Delete`, or `Read`) is not an artifact declaration by
|
|
64
|
-
itself. The receipt must declare each artifact path with its own `SHA-256:` value
|
|
65
|
-
containing exactly 64 hexadecimal characters.
|
|
10
|
+
- **In scope:** {{Exact behavior owned by this task}}
|
|
11
|
+
- **Out of scope:** {{Explicit exclusions or delegated behavior}}
|
|
66
12
|
|
|
67
|
-
##
|
|
13
|
+
## Anchors and Ownership
|
|
68
14
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
|
|
15
|
+
<!-- Compact core: one owned anchor is enough; proof artifact/owner exists only for a typed proof boundary (see Verification Plan). -->
|
|
16
|
+
| ID | Type | Target | Role | Access | Action |
|
|
17
|
+
|---|---|---|---|---|---|
|
|
18
|
+
| A-R{{REQ_NUMBER}}-{{SEQ}}-01 | file | `{{exact/path/to/file}}` | owner | write | modify |
|
|
19
|
+
<!-- For a typed proof boundary, add: | A-R{{REQ_NUMBER}}-{{SEQ}}-02 | file | `{{exact/path/to/test-file}}` | proof | write | create | and set Task role accordingly; otherwise omit. Every executable task must own a concrete test file/artifact anchor or share proof via that typed boundary; bare command is not ownership. -->
|
|
74
20
|
|
|
75
|
-
##
|
|
21
|
+
## Changes
|
|
76
22
|
|
|
77
|
-
|
|
78
|
-
|
|
23
|
+
<!-- Every checkbox maps exact RN.M IDs; the set must equal Acceptance below. -->
|
|
24
|
+
- [ ] {{Implement behavior at the exact owned boundary.}} _Requirements: {{REQ_NUMBER}}.{{X}}_
|
|
25
|
+
- [ ] {{Handle the concrete negative or recovery path.}} _Requirements: {{REQ_NUMBER}}.{{Y}}_
|
|
79
26
|
|
|
80
|
-
|
|
81
|
-
Canonical verdict: PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED
|
|
82
|
-
Legacy diagnostic input: PARTIAL | NO_TESTS -> unfinished BLOCKED
|
|
27
|
+
## Acceptance
|
|
83
28
|
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
- User-facing end-to-end workflow: include E2E/UI flow verification.
|
|
88
|
-
- Layout/theme/responsive task: include visual/runtime viewport checks.
|
|
89
|
-
- Interactive UI task: include accessibility checks when keyboard, focus, labels, or ARIA can regress.
|
|
90
|
-
- Scaffold/release task: include smoke build/test/dev-server checks.
|
|
91
|
-
- Performance/security checks are required only when the requirement, risk, or touched surface calls for them.
|
|
29
|
+
<!-- Declare each mapped RN.M once with a measurable output/state and negative behavior. -->
|
|
30
|
+
- **R{{REQ_NUMBER}}.{{X}}:** {{Measurable observable outcome}}
|
|
31
|
+
- **R{{REQ_NUMBER}}.{{Y}}:** {{Concrete negative or recovery outcome}}
|
|
92
32
|
|
|
93
|
-
|
|
94
|
-
- Command(s): `{{TYPECHECK / TEST / BUILD COMMANDS OR N/A}}`
|
|
95
|
-
- Expected proof: {{What output, exit code, or report proves success}}
|
|
96
|
-
- Runtime binding: `policy.createReceiptBinding({ base, head })` must be supplied to completion/flash adapters; a valid-length receipt pair without expected binding is not proof of identity.
|
|
97
|
-
- [ ] Artifact / runtime verification
|
|
98
|
-
- Inspect: `{{artifact path | route | UI state | DB object | manifest entry}}`
|
|
99
|
-
- Expect: {{Observable result that proves the task is really wired}}
|
|
100
|
-
- [ ] Runtime reachability verification
|
|
101
|
-
- Entrypoint/caller: `{{App.tsx | route file | CLI command | worker registration | manifest | API consumer}}`
|
|
102
|
-
- Expect: {{Created component/service/route/worker/loader is imported, mounted, registered, or invoked from the runtime path; if deferred, name the later integration task}}
|
|
103
|
-
- [ ] Contract / negative-path verification
|
|
104
|
-
- Check: {{Unauthorized path, validation error, permission omission, missing env behavior, deletion effect, etc.}}
|
|
105
|
-
- Expect: {{Concrete failure mode or contract-preserving behavior}}
|
|
33
|
+
## Dependencies
|
|
106
34
|
|
|
107
|
-
|
|
35
|
+
- {{DEPENDENCIES}}
|
|
108
36
|
|
|
109
|
-
|
|
110
|
-
|---|---|---|
|
|
111
|
-
| {{RISK_1}} | High/Medium/Low | {{MITIGATION_1}} |
|
|
112
|
-
| {{RISK_2}} | High/Medium/Low | {{MITIGATION_2}} |
|
|
37
|
+
## Verification Plan
|
|
113
38
|
|
|
114
|
-
|
|
39
|
+
<!-- Ownership invariant: a bare npm test command without a concrete file/artifact anchor is not ownership; shared proof must use a typed proof boundary. -->
|
|
40
|
+
- **Verification ref:** {{V reference whose structured subject/proof owner matches this task}}
|
|
41
|
+
- **Task role:** {{subject | verifier}}
|
|
42
|
+
- **Command:** `{{Exact project command}}`
|
|
43
|
+
- **Expected:** {{Exit, output, state, artifact, or UI result}}
|
|
44
|
+
- **Negative path:** {{Contract-preserving failure check}}
|
|
45
|
+
- **Reachability:** `{{Real entrypoint/caller or generated artifact}}`
|
|
115
46
|
|
|
116
|
-
|
|
117
|
-
> **Test note**: If a test coverage sub-task can be deferred post-MVP, mark it with `- [ ]*`.
|
|
118
|
-
> **Requirement mapping**: Every sub-task MUST end with `_Requirements: X.X_`. No mapping = invalid task file.
|
|
119
|
-
> **Evidence rule**: No `## Evidence` section = invalid task file. Use `## Evidence` (legacy heading aliases still parse).
|
|
47
|
+
<!-- The table above is the only task anchor/ownership table. Access read requires Action read. Access write requires create, modify, or delete. Targets are exact; globs and parent-directory claims are invalid. A verifier must not repeat the subject's Acceptance criterion. Specs-only never creates or updates docs and never fabricates execution proof; record doc impact as a brief recommendation only. -->
|
|
@@ -14,19 +14,28 @@ metadata:
|
|
|
14
14
|
|
|
15
15
|
This skill safely bridges the gap between active development state and physical documentation files (`spec.json` + `task_registry` + `tasks/task-R*.md`). Instead of relying on risky raw AI edits, this skill executes precise contextual replacements.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## v2.1 authority-aware synchronization
|
|
18
18
|
|
|
19
|
-
Read
|
|
19
|
+
Read canonical policy before mutating state. Lane is a derived view:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
node .claude/scripts/workflow-policy.cjs --classify-lane --task-json '<task JSON>' --json
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
- Direct may have no spec/state/registry; sync only concrete targeted evidence
|
|
26
|
-
|
|
25
|
+
- Direct may have no spec/state/registry; sync only concrete targeted evidence
|
|
26
|
+
and never invents proof, readiness, approval, or audit state.
|
|
27
|
+
- Standard stores one bounded spec; final integration creates one canonical
|
|
28
|
+
feature receipt. A combined closeout review is required only when the
|
|
29
|
+
persisted policy says an independent audit is needed.
|
|
27
30
|
- Critical requires strict durable evidence and the persisted capability obligations; choose available actors or the main session according to required capability and independence, never a fixed actor sequence.
|
|
28
|
-
-
|
|
29
|
-
|
|
31
|
+
- Authoring states are only `draft`, `validated`, or `absent`. Legacy approval
|
|
32
|
+
fields are readable but inert.
|
|
33
|
+
- Preserve `classified_minimum`. Reclassification happens before persistence;
|
|
34
|
+
after persistence, the same-feature baseline is monotonic and no downgrade is
|
|
35
|
+
supported until a trusted issuer exists.
|
|
36
|
+
- `spec.json` is machine authority. Task status/checkboxes, dependencies, and
|
|
37
|
+
ownership Markdown are projections. Typed `coordination.boundaries` are the
|
|
38
|
+
only topology authority.
|
|
30
39
|
|
|
31
40
|
## Supported Commands
|
|
32
41
|
### 1. Task Synchronization
|
|
@@ -52,10 +61,17 @@ Scans the `spec.json` against all physical `task-R*.md` files to detect mismatch
|
|
|
52
61
|
|
|
53
62
|
1. **Precision Edits:** Never overwrite the entire `spec.json` string blindly. Update only the required keys, while keeping JSON valid.
|
|
54
63
|
2. **Machine + Human Sync:** Every task status update MUST modify both `spec.json.task_registry[...]` and the matching markdown task file header/status section.
|
|
55
|
-
3. **Markdown Integrity:**
|
|
56
|
-
|
|
64
|
+
3. **Markdown Integrity:** Task Markdown is a plan plus `**Status:**`. Update
|
|
65
|
+
Status and `Changes` checkboxes only when their implementation is real; never
|
|
66
|
+
insert Base/Head, verdicts, command outcomes, or receipt proof into the plan.
|
|
67
|
+
4. **Verification Receipt Rule:** `done` is illegal without a valid canonical
|
|
68
|
+
`receipts/<task-basename>.md`, or a readable legacy `## Evidence` receipt.
|
|
69
|
+
Prefer the separate receipt; if both exist and proof identity conflicts,
|
|
70
|
+
refuse completion. If proof is missing, keep the task `in_progress` or
|
|
71
|
+
`blocked`.
|
|
57
72
|
5. **Task Docs Hook:** When `hapo:sync` marks a task as `done`, assess actual documentation impact and report `Docs impact: major|minor|none`; do not create a docs update request when impact is `none`.
|
|
58
|
-
6. **
|
|
73
|
+
6. **Topology Rule:** Never infer dependency or parallel state from `(P)`,
|
|
74
|
+
`task_triggers`, `Related Files`, or prose; project typed boundaries instead.
|
|
59
75
|
|
|
60
76
|
### 4. Explicit Flash Finalization
|
|
61
77
|
|
|
@@ -72,9 +88,16 @@ not authorize finalization.
|
|
|
72
88
|
|
|
73
89
|
### Flash implementation state
|
|
74
90
|
|
|
75
|
-
Executable policy source: `.claude/scripts/workflow-policy.cjs` (source: `src/claude/scripts/workflow-policy.cjs`). Trusted sync-finalize invokes `promoteFlashTask` only after exact task
|
|
91
|
+
Executable policy source: `.claude/scripts/workflow-policy.cjs` (source: `src/claude/scripts/workflow-policy.cjs`). Trusted sync-finalize invokes `promoteFlashTask` only after the exact task Verification Plan and reachability return PASS; test PASS itself only supplies canonical proof and leaves the persisted task blocked in progress. FAIL, BLOCKED, and NO_TESTS remain blocked in progress.
|
|
76
92
|
|
|
77
93
|
`FLASH_UNVERIFIED` is storage for implemented-but-unverified work, not a completion status. Store it as `status: "in_progress"` with `dependencyBlocked: true`, `unblocks: false`, a concrete blocker, and no promotion fields; do not unblock dependencies. `/hapo:test` may produce canonical proof, but the supported sync-finalize boundary must receive explicit `--verdict PASS` and `--proof`, require the runtime Base/Head binding, revalidate the receipt/artifact, derive the transition, and only then set `done`. FAIL, BLOCKED, NO_TESTS, marker-only proof, minimal state, and pre-promoted caller JSON remain `in_progress`.
|
|
78
94
|
|
|
95
|
+
After the last task is done, sync does not synthesize proof. Test/Develop must
|
|
96
|
+
run final integration and create `feature-receipt.md` once. Task-bearing
|
|
97
|
+
completion requires all task receipts plus the feature receipt. Taskless
|
|
98
|
+
Compact/Full completion requires the feature receipt only; its absence before
|
|
99
|
+
final closeout is normal. No receipt grants or infers approval, readiness, or
|
|
100
|
+
audit status.
|
|
101
|
+
|
|
79
102
|
## References
|
|
80
103
|
Read `references/sync-protocols.md` for exact Search/Replace regex patterns and JSON schema expectations before acting on the files.
|
|
@@ -4,19 +4,29 @@ The following guidelines dictate exactly how `hapo:sync` should interact with fi
|
|
|
4
4
|
|
|
5
5
|
**Flash implementation state:** `FLASH_UNVERIFIED` MUST remain the exact stored form: `status: "in_progress"`, `dependencyBlocked: true`, `unblocks: false`, a concrete blocker, and no `readyForSync`, `flashTransition`, or `promotionReceipt` fields. It never unblocks dependencies. The supported sync-finalize adapter must pass the current task, `--verdict PASS`, and canonical `--proof` to `workflow-policy.cjs`; the policy derives promotion, requires a runtime `createReceiptBinding({ base, head })` match for both receipt anchors, revalidates receipt/artifact requirements, and rejects caller-supplied promotion fields before setting `done`. FAIL, BLOCKED, NO_TESTS, marker-only proof, minimal state, and pre-promoted caller JSON stay `in_progress`.
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Policy state rule:** read the v2.1 policy input before sync. Direct/Standard/
|
|
8
|
+
Critical are derived views. Preserve `classified_minimum`, risks, and explicit
|
|
9
|
+
override receipt. Authoring states are only `draft`, `validated`, or `absent`;
|
|
10
|
+
legacy approval fields are inert.
|
|
11
|
+
|
|
12
|
+
**Authority rule:** `spec.json` is machine authority. Markdown is a projection.
|
|
13
|
+
Typed `coordination.boundaries` own dependency, ownership, transition, proof,
|
|
14
|
+
and parallel semantics; never infer them from `(P)`, `task_triggers`, `Related
|
|
15
|
+
Files`, or prose.
|
|
8
16
|
|
|
9
17
|
## 1. Updating `spec.json`
|
|
10
18
|
|
|
11
|
-
* **JSON Modification Rule:** Do not output whole files.
|
|
19
|
+
* **JSON Modification Rule:** Do not output whole files. Load the JSON,
|
|
20
|
+
update only lifecycle fields and the relevant registry entry, then write
|
|
21
|
+
valid JSON without changing semantic topology.
|
|
12
22
|
* **Task Registry Rule:** Resolve the incoming task reference to a single relative path in `task_registry`. Accept either:
|
|
13
23
|
- compact task ID like `R0-02`
|
|
14
24
|
- full filename like `task-R0-02-extension-shell.md`
|
|
15
25
|
- full relative path like `tasks/task-R0-02-extension-shell.md`
|
|
16
26
|
* **Status Update:** If a task changes to `blocked`, the matching `task_registry[path].status` must become `"blocked"`, `task_registry[path].blocker` must record the reason, and `spec.json.status` / `spec.json.blocker` must reflect the top-level block if work is globally blocked.
|
|
17
27
|
* **Timestamp Rule:** Update `task_registry[path].started_at`, `completed_at`, and `last_updated_at` consistently with the new state. Also refresh `spec.json.updated_at`.
|
|
18
|
-
* **Done-State Rule:** Never set `task_registry[path].status = "done"` unless
|
|
19
|
-
* **Receipt Integrity Rule:** A valid
|
|
28
|
+
* **Done-State Rule:** Never set `task_registry[path].status = "done"` unless `receipts/<task-basename>.md` is valid, or a legacy `## Evidence` receipt is valid. Write proof to the separate receipt first; never add execution evidence to a new-format task plan.
|
|
29
|
+
* **Receipt Integrity Rule:** A valid task receipt includes task identity/path, exact commands and outcomes, expected versus observed behavior, applicable negative/reachability/artifact proof, and Base/Head binding. If separate and legacy receipts both exist with conflicting proof identity, refuse `done`. `PRECHECK_FAIL`, `FAIL`, `UNVERIFIED`, placeholders, and contract substitutions are not eligible.
|
|
20
30
|
* **Contract Fidelity Rule:** If the task file notes or evidence show that a named framework/auth/runtime choice from the spec was silently replaced, sync MUST refuse `done` until the spec is amended or the implementation is corrected.
|
|
21
31
|
* **Task Docs Rule:** After a task is moved to `done`, assess actual documentation impact and report `Docs impact: major|minor|none`. Only affected docs receive a follow-up checkpoint.
|
|
22
32
|
|
|
@@ -27,19 +37,18 @@ The structure of `tasks/task.md` relies heavily on exact keyword markers. Follow
|
|
|
27
37
|
### A. Completing a Task
|
|
28
38
|
When `/hapo:sync <feature> <task-id> done`:
|
|
29
39
|
1. Find: `**Status:** pending` (or `in_progress` / `blocked`).
|
|
30
|
-
2.
|
|
40
|
+
2. Resolve `receipts/<task-basename>.md` first, with legacy `## Evidence` as fallback. If neither has valid proof, STOP and refuse to mark the task done.
|
|
31
41
|
3. Refuse completion if the receipt contains any non-passing marker such as `PRECHECK_FAIL`, `FAIL`, `UNVERIFIED`, or an explicit note that the implementation substituted a named contract with a placeholder/custom simplification.
|
|
32
42
|
4. Replace with: `**Status:** done`.
|
|
33
|
-
5.
|
|
34
|
-
6.
|
|
35
|
-
7. Update relevant checkboxes in `## Completion Criteria` and `## Evidence` (legacy heading aliases still parse) only when the caller provides or the file already contains real proof.
|
|
36
|
-
8. Surface `Docs impact: major|minor|none`; if impact is not `none`, name the affected docs and the follow-up checkpoint.
|
|
43
|
+
5. Update only implemented checkboxes under `## Changes`; never append receipt fields to the task plan.
|
|
44
|
+
6. Surface `Docs impact: major|minor|none`; if impact is not `none`, name the affected docs and the follow-up checkpoint.
|
|
37
45
|
|
|
38
46
|
### B. Blocking a Task
|
|
39
47
|
When `/hapo:sync <feature> <task-id> blocked "API error"`:
|
|
40
48
|
1. Find: `**Status:** <anything>`.
|
|
41
49
|
2. Replace with: `**Status:** blocked`.
|
|
42
|
-
3.
|
|
50
|
+
3. Record the reason and timestamp in `task_registry[path].blocker`; do not add
|
|
51
|
+
a non-canonical task section.
|
|
43
52
|
|
|
44
53
|
### C. Starting / Resuming a Task
|
|
45
54
|
When `/hapo:sync <feature> <task-id> in_progress`:
|
|
@@ -57,9 +66,18 @@ When `/hapo:sync audit <feature>` is activated:
|
|
|
57
66
|
4. **Reconciliation Rules:**
|
|
58
67
|
- Missing registry entry → create it
|
|
59
68
|
- Missing disk file referenced in registry → remove or flag it
|
|
60
|
-
- Markdown says `done` but registry not done → registry wins only if
|
|
61
|
-
- Registry says `done` but markdown still pending → update markdown only if
|
|
62
|
-
- Either side says `done` but
|
|
69
|
+
- Markdown says `done` but registry not done → registry wins only if a canonical separate or legacy receipt exists; otherwise downgrade markdown or flag conflict
|
|
70
|
+
- Registry says `done` but markdown still pending → update markdown only if a canonical separate or legacy receipt exists
|
|
71
|
+
- Either side says `done` but neither receipt source has concrete proof → downgrade to `in_progress` or flag conflict instead of preserving fake completion
|
|
72
|
+
- Both receipt sources exist with conflicting proof identity → fail closed and require manual reconciliation
|
|
63
73
|
- Either side says `done` but the receipt contains `PRECHECK_FAIL`, `FAIL`, `UNVERIFIED`, or explicit contract-substitution notes → downgrade to `in_progress` or flag conflict
|
|
64
74
|
5. **Correction Alert:** Output a brief markdown alert detailing mismatches fixed and any unresolved conflicts requiring manual review.
|
|
65
75
|
6. **Task Docs Alert:** If audit reveals tasks newly marked `done`, include the actual docs impact; do not emit a generic docs-sync request when no docs are affected.
|
|
76
|
+
|
|
77
|
+
## 4. Feature closeout
|
|
78
|
+
|
|
79
|
+
- Before all tasks are done, missing `feature-receipt.md` is normal.
|
|
80
|
+
- After all tasks are done, require final integration execution and one valid
|
|
81
|
+
`feature-receipt.md`; never derive it from task status alone.
|
|
82
|
+
- A taskless Compact/Full spec uses the same final feature receipt and does not
|
|
83
|
+
require a synthetic registry entry.
|
|
@@ -41,14 +41,15 @@ receipt, or claim execution proof.
|
|
|
41
41
|
- Preserve the exact command, exit result, provenance, and artifact hashes
|
|
42
42
|
required by the canonical receipt schema.
|
|
43
43
|
|
|
44
|
-
## Scope and
|
|
44
|
+
## Scope and policy
|
|
45
45
|
|
|
46
46
|
For a feature target, load `spec.json`, `requirements.md`, `design.md`, and
|
|
47
|
-
|
|
47
|
+
the active task's exact seven v2.1 sections and typed coordination boundaries
|
|
48
|
+
when that target exists. Compare actual execution against
|
|
48
49
|
`scope_lock`, contracts, completion criteria, runtime reachability, and
|
|
49
50
|
negative-path obligations.
|
|
50
51
|
|
|
51
|
-
Choose depth from
|
|
52
|
+
Choose depth from `assurance_level`, risk, and blast radius. Lane is derived:
|
|
52
53
|
|
|
53
54
|
- Direct: targeted commands and diff/runtime self-check;
|
|
54
55
|
- Standard: bounded affected suite and feature receipt;
|
|
@@ -79,8 +80,10 @@ requirements. Use UI checks only when a reachable UI surface is in scope.
|
|
|
79
80
|
performance, or security proof for the changed surface.
|
|
80
81
|
4. Inspect runtime reachability and declared artifacts when the task creates
|
|
81
82
|
runtime-facing or generated output.
|
|
82
|
-
5. Preserve raw outcomes and
|
|
83
|
-
|
|
83
|
+
5. Preserve raw outcomes and, only after real execution, write one canonical
|
|
84
|
+
receipt. For a task use `receipts/<task-basename>.md`; never append execution
|
|
85
|
+
evidence to the task plan. A receipt must not contain secrets or placeholder
|
|
86
|
+
provenance.
|
|
84
87
|
|
|
85
88
|
Required proof type follows the behavior, not ceremony:
|
|
86
89
|
|
|
@@ -98,7 +101,9 @@ Required proof type follows the behavior, not ceremony:
|
|
|
98
101
|
## Canonical receipt
|
|
99
102
|
|
|
100
103
|
The receipt is execution evidence, not a status marker. It must contain the
|
|
101
|
-
|
|
104
|
+
task identity and canonical `tasks/task-*.md` path for task receipts, the actual
|
|
105
|
+
command, a successful exit/result, expected versus observed behavior, applicable
|
|
106
|
+
negative-path and reachability proof, both provenance anchors (`Base` and
|
|
102
107
|
`Head`, or their canonical aliases), and any declared artifact SHA-256. Reject
|
|
103
108
|
`Exit: 1`, conflicting outcomes, empty commands, placeholders, missing
|
|
104
109
|
provenance, zero execution, and failure summaries. No-artifact tasks remain
|
|
@@ -112,6 +117,11 @@ pass `receipt_binding: binding` to `completionDecision` or include the binding's
|
|
|
112
117
|
compares both receipt anchors before completion or flash promotion.
|
|
113
118
|
|
|
114
119
|
For a normal closeout, emit a receipt that the shared policy validator accepts.
|
|
120
|
+
Legacy task `## Evidence` remains readable, but prefer the separate receipt. If
|
|
121
|
+
both exist and their proof identities conflict, report `FAIL` and do not choose
|
|
122
|
+
one. After all task receipts pass, execute final integration and create
|
|
123
|
+
`feature-receipt.md` exactly once. Taskless Compact/Full specs create that file
|
|
124
|
+
only at final closeout; absence before closeout is normal.
|
|
115
125
|
For `--flash`, emit proof for the current `FLASH_UNVERIFIED` task only. Only explicit trusted sync-finalize may promote it. The
|
|
116
126
|
receipt may make the task eligible for trusted sync-finalize, but it must not
|
|
117
127
|
promote the task, unblock dependents, or fabricate a done state.
|
|
@@ -161,7 +171,7 @@ security, and spec compliance against this proof.
|
|
|
161
171
|
## Flash proof
|
|
162
172
|
|
|
163
173
|
When the target contains an in-progress `FLASH_UNVERIFIED` task, test only its
|
|
164
|
-
exact
|
|
174
|
+
exact Verification Plan and reachability obligations. On pass, keep the task
|
|
165
175
|
`in_progress`, keep `FLASH_UNVERIFIED`, `dependencyBlocked: true`, and
|
|
166
176
|
`unblocks: false`; return canonical proof to trusted sync-finalize. On failure,
|
|
167
177
|
blocker, or no tests, do not promote any task.
|
package/src/codex/AGENTS.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
- CafeKit agents live in `.codex/agents/*.toml` and are auto-discovered after the repository is trusted.
|
|
9
9
|
- Runtime support lives in `.codex/rules/`, `.codex/scripts/`, `.codex/references/`, and `.codex/runtime.json`.
|
|
10
10
|
- Project hooks live in `.codex/hooks.json`; review trusted hooks with `/hooks`.
|
|
11
|
+
- 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.
|
|
12
|
+
- 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`.
|
|
13
|
+
- 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.
|
|
14
|
+
- `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.
|
|
15
|
+
- 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`.
|
|
16
|
+
- Validator exit 0 proves implemented structural checks only, not semantic quality or execution PASS.
|
|
11
17
|
|
|
12
18
|
## Codex caveats
|
|
13
19
|
|