@haposoft/cafekit 0.16.0-rc.6 → 0.16.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +21 -58
  2. package/bin/__tests__/change-firewall.semantic-firewall.test.js +4 -5
  3. package/bin/__tests__/codex-hooks.test.js +137 -0
  4. package/bin/__tests__/codex-native.test.js +130 -74
  5. package/bin/__tests__/develop-contract.test.js +155 -76
  6. package/bin/__tests__/installer-safety.test.js +19 -154
  7. package/bin/__tests__/package-inventory.test.js +10 -20
  8. package/bin/__tests__/release-preflight.semantic-firewall.test.js +2 -2
  9. package/bin/__tests__/validator-grounding.test.js +11 -11
  10. package/bin/install.js +2 -7
  11. package/bin/lib/context.js +0 -45
  12. package/bin/lib/copy-utils.js +1 -1
  13. package/bin/lib/i18n.js +0 -3
  14. package/bin/lib/manifest.js +1 -1
  15. package/bin/phases/claude-runtime.js +1 -3
  16. package/bin/phases/codex-runtime.js +4 -2
  17. package/bin/phases/copy-payload.js +3 -15
  18. package/bin/phases/post-install.js +5 -17
  19. package/bin/phases/root-config.js +2 -3
  20. package/bin/phases/select-platform.js +2 -5
  21. package/bin/phases/summary.js +0 -1
  22. package/package.json +2 -5
  23. package/src/claude/CLAUDE.md +19 -6
  24. package/src/claude/agents/project-manager.md +41 -9
  25. package/src/claude/agents/spec-maker.md +76 -155
  26. package/src/claude/gitignore +1 -1
  27. package/src/claude/hooks/__tests__/spec-gate.test.js +162 -0
  28. package/src/claude/hooks/lib/context.cjs +1 -1
  29. package/src/claude/hooks/lib/detect.cjs +1 -1
  30. package/src/claude/hooks/spec-gate.cjs +44 -9
  31. package/src/claude/hooks/spec-state.cjs +22 -11
  32. package/src/claude/hooks/task-scaffold-guard.cjs +1 -1
  33. package/src/claude/migration-manifest.json +17 -3
  34. package/src/claude/rules/manage-docs.md +43 -24
  35. package/src/claude/rules/state-sync.md +57 -62
  36. package/src/claude/rules/workflow.md +30 -13
  37. package/src/claude/scripts/change-firewall.cjs +2 -2
  38. package/src/claude/scripts/generate-skill-catalog.cjs +0 -1
  39. package/src/claude/scripts/spec-receipt.cjs +141 -1
  40. package/src/claude/scripts/spec-resolver.cjs +288 -0
  41. package/src/claude/skills/develop/SKILL.md +89 -125
  42. package/src/claude/skills/develop/references/parallel-waves.md +75 -162
  43. package/src/claude/skills/develop/references/quality-gate.md +61 -121
  44. package/src/claude/skills/develop/references/subagent-patterns.md +31 -38
  45. package/src/claude/skills/question/SKILL.md +1 -1
  46. package/src/claude/skills/specs/SKILL.md +142 -204
  47. package/src/claude/skills/specs/references/review.md +109 -243
  48. package/src/claude/skills/specs/references/templates.md +173 -0
  49. package/src/claude/skills/sync/SKILL.md +66 -90
  50. package/src/claude/skills/sync/references/sync-protocols.md +62 -83
  51. package/src/codex/AGENTS.md +20 -7
  52. package/src/codex/hooks/lib/spec-receipt.cjs +18 -0
  53. package/src/codex/hooks/lib/spec-utils.cjs +25 -0
  54. package/src/codex/hooks/spec-gate.cjs +46 -16
  55. package/src/codex/hooks/spec-state.cjs +22 -12
  56. package/src/codex/rules/state-sync.md +57 -61
  57. package/src/common/AGENTS.md +8 -1
  58. package/bin/__tests__/opencode-spec-gate.test.js +0 -799
  59. package/bin/lib/opencode-install.js +0 -899
  60. package/bin/phases/opencode-runtime.js +0 -38
  61. package/src/claude/skills/specs/references/archive-workflow.md +0 -74
  62. package/src/claude/skills/specs/references/ask-user-question-gates.md +0 -70
  63. package/src/claude/skills/specs/references/codebase-analysis.md +0 -102
  64. package/src/claude/skills/specs/references/cross-spec-dependency.md +0 -76
  65. package/src/claude/skills/specs/references/research-strategy.md +0 -107
  66. package/src/claude/skills/specs/references/scope-inquiry.md +0 -107
  67. package/src/claude/skills/specs/references/translation-mirror.md +0 -83
  68. package/src/claude/skills/specs/rules/design-discovery-full.md +0 -45
  69. package/src/claude/skills/specs/rules/design-discovery-light.md +0 -28
  70. package/src/claude/skills/specs/rules/design-principles.md +0 -138
  71. package/src/claude/skills/specs/rules/design-review.md +0 -55
  72. package/src/claude/skills/specs/rules/ears-format.md +0 -42
  73. package/src/claude/skills/specs/rules/phase-decision-matrix.md +0 -56
  74. package/src/claude/skills/specs/rules/task-scoring-rubric.md +0 -52
  75. package/src/claude/skills/specs/rules/tasks-generation.md +0 -189
  76. package/src/opencode/AGENTS.md +0 -41
  77. package/src/opencode/plugins/docs-sync.ts +0 -175
  78. package/src/opencode/plugins/inspect-block.ts +0 -164
  79. package/src/opencode/plugins/privacy-block.ts +0 -182
  80. package/src/opencode/plugins/rules.ts +0 -155
  81. package/src/opencode/plugins/session.ts +0 -179
  82. package/src/opencode/plugins/spec-gate.ts +0 -457
  83. package/src/opencode/plugins/spec-state.ts +0 -311
  84. package/src/opencode/plugins/state.ts +0 -253
  85. package/src/opencode/plugins/task-scaffold-guard.ts +0 -161
  86. package/src/opencode/plugins/usage.ts +0 -178
@@ -1,45 +0,0 @@
1
- # Full design discovery
2
-
3
- Load this rule only after the artifact router selects `Full`. Full controls
4
- design detail; it does not select research, web access, tasks, or ceremony.
5
-
6
- ## Discovery boundary
7
-
8
- Inspect only facts needed to remove an implementation-significant ambiguity:
9
-
10
- 1. map scoped requirements to existing entrypoints and behavior owners;
11
- 2. inspect reusable contracts, data flows, dependencies, and recovery paths;
12
- 3. identify decisions whose alternatives would change observable behavior;
13
- 4. ground each chosen decision to repository anchors or, when needed, a
14
- primary external source; and
15
- 5. stop when the routed design can be implemented without a product decision.
16
-
17
- Do not inventory unrelated architecture, compare fashionable patterns, or
18
- collect findings merely because they are available. Repository scouting is
19
- normal design work and does not by itself create `research.md`.
20
-
21
- ## Research gate
22
-
23
- Create `research.md` only when the router has found at least one of:
24
-
25
- - unresolved material uncertainty that can change requirements or design;
26
- - an external-current fact that must be grounded; or
27
- - an explicit user request for durable research.
28
-
29
- If none applies, research is absent: do not load the research template, invoke
30
- a researcher, search the web, or create a placeholder. When external-current
31
- facts matter, prefer primary authoritative sources and capture only evidence
32
- that resolves the named uncertainty. General best-practice browsing is not a
33
- research trigger.
34
-
35
- ## Projection
36
-
37
- Put settled behavior, contracts, invariants, negative paths, and grounded
38
- anchors in `design.md`. If research was selected, keep `research.md` minimal:
39
- named uncertainty, relevant evidence, resulting decision, and remaining gaps.
40
- Synchronize every promoted semantic decision into `spec.json`; research notes
41
- that do not affect semantics remain supporting evidence, not authority.
42
-
43
- Full may add flow, data, error/recovery, security/privacy, migration, or proof
44
- detail only when the scoped topology activates that section. Delete unused
45
- sections rather than reserving them for implementation.
@@ -1,28 +0,0 @@
1
- # Compact design discovery
2
-
3
- Load this rule only after the artifact router selects `Compact`. The goal is a
4
- bounded durable design, not a reduced version of a default research process.
5
-
6
- ## Focus
7
-
8
- 1. locate the real entrypoint and existing behavior owner;
9
- 2. inspect the smallest set of contracts and dependencies touched by scope;
10
- 3. record compatibility, negative-path, and verification constraints; and
11
- 4. ground the selected anchors and stop.
12
-
13
- Keep the result in `design.md`. File lists without behavior ownership, generic
14
- best practices, and broad architecture inventories are not useful discovery.
15
-
16
- ## Research gate
17
-
18
- Research remains absent unless there is unresolved material uncertainty, an
19
- external-current fact that must be grounded, or an explicit user request. A new
20
- library is not automatically a trigger: inspect repository declarations first;
21
- consult primary external documentation only when a current fact can change the
22
- decision. When the gate opens, create the minimal uncertainty-to-evidence-to-
23
- decision projection and retain any honest remaining gap.
24
-
25
- If discovery reveals cross-boundary behavior needing materially more design
26
- detail, reclassify planning depth before persistence. If the Compact baseline
27
- is already persisted, expand monotonically to Full; do not silently downgrade
28
- or create optional artifacts merely to resemble Full.
@@ -1,138 +0,0 @@
1
- # Adaptive design principles
2
-
3
- The design exists to remove implementation guesses. It defines behavior-owning
4
- boundaries and stable contracts without prescribing incidental code.
5
-
6
- ## Detail by planning depth
7
-
8
- ### Compact
9
-
10
- Keep only:
11
-
12
- 1. boundary and responsibilities;
13
- 2. typed source anchors;
14
- 3. decisions, named contracts, and invariants needed for consistency; and
15
- 4. verification, including relevant negative paths.
16
-
17
- Delete every unused heading. Compact is a complete durable design, not a teaser
18
- for a later Full document.
19
-
20
- ### Full
21
-
22
- Start from Compact. Add only relevant sections for:
23
-
24
- - cross-boundary contracts and flows;
25
- - data ownership, schema, consistency, and concurrency;
26
- - error classification and recovery;
27
- - security/privacy boundaries;
28
- - migration, compatibility, rollback, or deployment transition; and
29
- - proof that spans owners or runtime surfaces.
30
-
31
- Do not add a section because the template contains it. Empty tables, generic
32
- best practices, and restated requirements form a template cemetery and must be
33
- deleted.
34
-
35
- ## Boundaries and typed anchors
36
-
37
- A boundary names what owns, reads, writes, calls, registers, or exposes the
38
- behavior. “Service”, “module”, or “layer” without a grounded target is invalid.
39
-
40
- Design and task anchors use the same closed six-column machine model:
41
- `ID | Type | Target | Role | Access | Action`. Every implementation-facing
42
- anchor has:
43
-
44
- | Field | Rule |
45
- |---|---|
46
- | ID | Unique across the entire spec. Design-owned anchors use `A-D-NN`; task-owned anchors use `A-R{requirement}-{sequence}-NN`. |
47
- | Type | `file`, `symbol`, `command`, `route`, `schema`, `contract`, `artifact`, or `external`. |
48
- | Target | Exact path, identifier, command, route, schema object, contract ID, artifact path, or primary source. |
49
- | Role | Why the target matters: owner, consumer, entrypoint, proof, constraint, or reference. |
50
- | Access | `read` or `write`. |
51
- | Action | `read` for read access; `create`, `modify`, or `delete` for write access. |
52
-
53
- Files-first is canonical. List `file` anchors before symbols, routes, schemas,
54
- or contracts they contain. A symbol anchor names its file. A command anchor is
55
- an exact project command. An external anchor states which decision it grounds.
56
- Role is descriptive only and never implies Action; words such as create,
57
- planned, new, producer, or output in prose have zero machine authority. Never
58
- reuse an anchor ID, even in another task. A task that consumes a canonical
59
- design anchor references its `A-D-NN` ID and does not redefine the same target in
60
- its task-scoped namespace.
61
-
62
- ## Named contracts and invariants
63
-
64
- - Give every implementation-significant contract and invariant a stable ID,
65
- such as `C1` or `I1`.
66
- - Define the canonical body once in `design.md`.
67
- - Task files reference IDs; they do not copy contract bodies.
68
- - Name one implementation owner before any cross-task consumer. Consumers
69
- depend directly or transitively on the owner.
70
- - If implementation needs a different contract, revise and explicitly approve
71
- the design before changing consumers.
72
-
73
- Contracts are required when drift could change auth/session, transport, API or
74
- event shape, persistence/schema, deletion/retention, generated artifacts,
75
- runtime entrypoints, or recovery behavior. Do not invent contract ceremony for
76
- local details that cannot drift across a boundary.
77
-
78
- For any public, replay, or operator surface contract, specify method, route,
79
- auth, required headers, request schema, success response, error semantics, and
80
- idempotency/concurrency behavior in one place; a partial contract is not a
81
- contract.
82
-
83
- ## Decision quality
84
-
85
- Record a decision only when another reasonable implementation would behave
86
- differently. For each decision state:
87
-
88
- - chosen behavior and boundary;
89
- - relevant alternative or ambiguity rejected;
90
- - invariant or negative path that constrains implementation; and
91
- - anchor or evidence that makes it feasible.
92
-
93
- Use explicit types for public inputs, outputs, states, and errors. Avoid generic
94
- `any`, `object`, or unbounded maps unless the contract explains why they are
95
- intentional.
96
-
97
- ## Conditional detail
98
-
99
- - Flow: include only for branching, asynchronous, or multi-party behavior.
100
- - Data: include only when shape, ownership, consistency, or lifecycle changes. Any retention/lifecycle policy must state clock anchor, clock source, timezone/precision, cutoff comparator/inclusivity, enforcement boundary, and a wrong-clock/boundary counterexample; domain-generic.
101
- - Error/recovery: include concrete triggers, responses, retry/rollback, and
102
- terminal states only when relevant.
103
- - Security/privacy: include trust boundary, authorization, sensitive data, and
104
- retention decisions only when touched.
105
- - Migration: include compatibility window, ordering, rollback trigger, and
106
- verification only when existing state or public contracts change.
107
- - Diagrams: use plain Mermaid only when the relationship is materially clearer
108
- than prose; do not duplicate the diagram in text.
109
-
110
- ## Traceability and verification
111
-
112
- Every acceptance criterion has exactly one implementation owner and maps to a
113
- boundary, contract/invariant, or explicit verification definition. Keep exactly
114
- one visible `## Verification Definitions`
115
- section. The validator's canonical grammar is a single line per definition:
116
-
117
- ```markdown
118
- - **V1**: Criteria R1.1; Owner A-D-01; Decision refs D1, I1, C1; Method command `npm test`; Expected exit 0 and the persisted state; Negative/failure invalid input returns the named error; Reachability/grounding entrypoint `src/entry.js` via A-D-01.
119
- ```
120
-
121
- Do not use a V table, `### V1` heading, or prose-only “see verification” alias;
122
- the semantic-review parser recognizes the bold V-ID line above. Each line names
123
- every exact `RN.M` it covers, all applicable `D`/`I`/`C` refs, a command or anchored
124
- inspection, observable expected result, concrete negative/failure case, and
125
- runtime reachability plus grounding expectation.
126
-
127
- For a typed proof boundary, extend the same line after Owner with `Proof criteria
128
- R1.2; Proof owner A-D-02; Evidence anchor A-D-02;`. Both criteria remain
129
- single-owner; without that boundary, omit the extension.
130
-
131
- Validator success proves structure only. The author and reviewer still test the
132
- design against concrete counterexamples and check that an implementer can act
133
- without choosing unspecified product behavior.
134
-
135
- For task-bearing specs, typed `spec.json.coordination.boundaries` are the only
136
- authority for ownership, dependencies, transitions, proof separation, and
137
- parallel eligibility. Design prose explains semantics but cannot replace those
138
- typed edges.
@@ -1,55 +0,0 @@
1
- # Design review contract
2
-
3
- Review the complete routed artifact graph for implementation-blocking semantic
4
- gaps. Concise presentation is encouraged; inventory size is never capped.
5
-
6
- ## Coverage
7
-
8
- For every `RN.M` criterion:
9
-
10
- 1. trace the exact implementation owner, boundary, applicable `D`/`I`/`C`
11
- definitions, and canonical `V` definition;
12
- 2. construct a concrete counterexample or failure scenario;
13
- 3. confirm the expected result rejects or handles that scenario;
14
- 4. confirm referenced anchors are reachable and grounded; and
15
- 5. record every unresolved contradiction, ambiguity, missing owner, broken
16
- dependency, unreachable proof, or scope violation as a blocker.
17
-
18
- Also review cross-criterion contracts, state transitions, concurrency,
19
- authorization, recovery, compatibility, and rollback where scope activates
20
- them. Do not perform broad technology research during review; return an exact
21
- uncertainty to the artifact router when new material uncertainty is discovered.
22
-
23
- ## Finding shape
24
-
25
- Each blocker states:
26
-
27
- - affected criterion and design/verification refs;
28
- - concrete counterexample;
29
- - observed conflicting or missing artifact content;
30
- - impact on implementation or proof; and
31
- - smallest semantic decision or correction required.
32
-
33
- Group duplicates for readability without dropping distinct blockers. Positive
34
- observations are optional and never displace a blocker.
35
-
36
- ## Decision
37
-
38
- - `PASS`: the full routed graph is coherent, grounded, and every criterion's
39
- counterexample is resolved.
40
- - `FAIL`: at least one semantic or structural blocker is actionable now.
41
- - `BLOCKED`: required product input, trusted capability, or external evidence
42
- is unavailable.
43
-
44
- Routine and Elevated require semantic review but no reviewer ceremony. Strict
45
- requires an independent allowlisted reviewer capability observed by the host
46
- hook. An author, task marker, receipt text, or claimed role cannot self-attest
47
- that capability. Risk alone has an Elevated floor; Strict is opt-in only for an
48
- explicit user/project audit requirement or a user-confirmed, scope-specific
49
- audit decision. If the host event is unavailable, pause once rather than retry,
50
- downgrade, or simulate authority. Deterministic validation checks implemented
51
- structure and grounding; it never replaces this semantic judgment.
52
-
53
- Readiness stays false until the complete blocker inventory is resolved and all
54
- required machine gates pass. Review does not claim implementation execution,
55
- approval, closeout, or lifecycle completion.
@@ -1,42 +0,0 @@
1
- # EARS authoring rules
2
-
3
- Use EARS to make behavior testable, not to fill a template.
4
-
5
- ## Canonical IDs
6
-
7
- - Top-level headings: `Requirement N: <outcome>`.
8
- - Acceptance criteria: literal `RN.M` (`R1.1`, `R1.2`, ...).
9
- - Task mappings: numeric `N.M` only.
10
- - Do not emit `REQ-01`, `NFR-1`, alphabetic IDs, or bare numbered criteria.
11
-
12
- ## Patterns
13
-
14
- | Need | Pattern |
15
- |---|---|
16
- | Event | `When <event>, the <system> shall <observable response>.` |
17
- | State | `While <state>, the <system> shall <observable response>.` |
18
- | Negative/error | `If <invalid or failure condition>, the <system> shall <observable response or recovery>.` |
19
- | Optional scope | `Where <feature is enabled>, the <system> shall <observable response>.` |
20
- | Always true | `The <system> shall <observable property>.` |
21
-
22
- Combine conditions only when they describe one behavior. Split criteria that
23
- have independent triggers, outcomes, or proof.
24
-
25
- ## Quality gate
26
-
27
- Every criterion must be singular, unambiguous, observable, and testable. Name a
28
- concrete subject and replace words such as “fast”, “safe”, “graceful”, or “some”
29
- with an observable result or threshold. Use `shall` for mandatory behavior.
30
-
31
- Add a negative/error criterion when invalid input, missing permission,
32
- unavailable dependency, conflict, timeout, retry, rollback, or partial failure
33
- is relevant. Add a concrete example when values, ordering, boundaries, or
34
- transformation rules would otherwise admit multiple interpretations.
35
-
36
- User Story, rationale, scenario narrative, and role framing are optional. Keep
37
- them only when they explain a product decision not already clear from the
38
- outcome and criteria.
39
-
40
- Non-functional requirements are not a standard appendix. Add one only for a
41
- feature-specific measurable performance, security, privacy, accessibility,
42
- reliability, or compatibility constraint, continuing the same numeric sequence.
@@ -1,56 +0,0 @@
1
- # Task and phase decision matrix
2
-
3
- Tasks and phases are conditional structure, not mandatory planning ceremony.
4
-
5
- ## Task gate
6
-
7
- Create a task only when at least one boundary is real:
8
-
9
- | Boundary | Create a separate task when |
10
- |---|---|
11
- | Ownership | A distinct owner can change the files or contract without overlap. |
12
- | Dependency | One durable output must exist before another consumer can begin. |
13
- | Transition | Stateful, migration, async, retry, or recovery behavior needs one named owner. |
14
- | Proof | The outcome needs proof that cannot coherently live with the implementation slice. |
15
- | Parallel coordination | Independent work can proceed with disjoint ownership and no hidden shared resource. |
16
-
17
- Do not create tasks from estimated effort, requirement count, architectural
18
- layers, risk labels, or a desire for uniform files.
19
-
20
- When the gate passes, encode the real reason as one or more typed
21
- `coordination.boundaries` entries. Legacy trigger fields, priority markers,
22
- related-file lists, and free-form declarations are not authority.
23
-
24
- ## Split preference
25
-
26
- Start with one vertical outcome slice that reaches a real user or runtime
27
- entrypoint. Split horizontally only because dependency, ownership, or proof
28
- requires it.
29
-
30
- - Foundation: only when two or more consumers need the same owned prerequisite.
31
- - Spike: only for a named uncertainty with a time-box and go/no-go output.
32
- - Integration: only when earlier outputs are not already proven reachable.
33
- - Verification: only when separate ownership or evidence is genuinely required.
34
- - Release/packaging: only when explicitly in `scope_lock`.
35
-
36
- Merge slices that touch the same files, share one proof, or would otherwise
37
- produce an orphaned intermediate output.
38
-
39
- ## Owner-before-consumer
40
-
41
- Every cross-task contract, invariant, schema transition, or recovery authority
42
- has exactly one owner task. All consumers reference its stable ID and depend
43
- directly or transitively on the owner. The typed dependency boundary is machine
44
- authority; Markdown and `task_registry.dependencies` are projections that must
45
- agree with it.
46
-
47
- ## Lightweight phases
48
-
49
- Use phases only for a complex `Full` task graph where grouping materially helps
50
- navigation or sequencing. Persist them as lightweight task-ID groups in
51
- `spec.json`.
52
-
53
- - Never create `phase-*.md` files.
54
- - Never copy requirement, design, or task prose into a phase.
55
- - A phase does not replace dependency edges or ownership.
56
- - Compact specs and simple Full graphs omit phases.
@@ -1,52 +0,0 @@
1
- # Task Scoring Rubric (optional advisory)
2
-
3
- Load this rubric only when the persisted policy requires a task bundle and the
4
- decomposition has a real split/merge or dependency question. It is not a lane
5
- classifier, readiness gate, approval gate, or reason to create a task bundle.
6
-
7
- ## Candidate dimensions
8
-
9
- Score each candidate from 0–3 only when the score will change a task decision:
10
-
11
- | Dimension | 0 | 1 | 2 | 3 |
12
- |---|---|---|---|---|
13
- | Dependency criticality | standalone | one predecessor | one slice blocked | core path blocked |
14
- | Implementation risk | routine | known pattern | complex integration | unproven/security |
15
- | Blast radius | isolated | feature-local | shared contract | critical boundary |
16
- | User value | internal | enables work | visible improvement | acceptance/launch |
17
- | Evidence confidence | proven | mostly proven | partial | low/no evidence |
18
- | Test burden | unit/smoke | component/integration | workflow | security/rollback |
19
- | File conflict | none | minor | shared module | overlapping ownership |
20
- | Scope creep | none | interpretation | adjacent behavior | unapproved contract |
21
-
22
- ## Use of the result
23
-
24
- Use the result only to explain priority, split/merge, dependency order,
25
- parallel ownership, or proof depth. Prefer one task when one boundary and one
26
- proof path are enough. Split only for a real dependency, ownership boundary, or
27
- independent proof path.
28
-
29
- - Scope-creep score 3: stop and ask for scope approval.
30
- - Low evidence plus risk ≥2: consider a time-boxed spike, but do not create one
31
- solely because a Cynefin label says `Complex`.
32
- - Blast radius 3: include rollback/negative-path proof.
33
- - File conflict ≥2: parallel eligibility remains false unless a typed parallel
34
- boundary proves isolated ownership and disjoint resources.
35
- - High value plus dependency ≥2: schedule early only after real prerequisites.
36
-
37
- Cynefin is advisory discovery language. It may suggest a spike or research
38
- question; it never changes Direct/Standard/Critical, adds registry/DAG
39
- ceremony, or decides readiness.
40
-
41
- ## Compact task metadata
42
-
43
- Do not copy the raw table into task files. Record only decisions that affect
44
- execution:
45
-
46
- - why the task is split or merged;
47
- - why it is early or deferred;
48
- - why it is or is not parallel;
49
- - why a spike or deeper proof is useful;
50
- - exact dependencies and evidence.
51
-
52
- If no decision changes, omit scoring entirely and keep the task packet compact.
@@ -1,189 +0,0 @@
1
- # Task generation rules
2
-
3
- Load this file only after the task gate passes. Compact durable specs are
4
- taskless by default, but may have a task bundle and matching registry when a real
5
- ownership, dependency, durable transition, separate proof, or parallel
6
- coordination boundary activates the same gate used by Full specs. Full depth
7
- does not activate the gate by itself.
8
-
9
- ## Generation gate
10
-
11
- A task must represent at least one real boundary: distinct ownership, a durable
12
- dependency, a state transition, separate proof, or parallel coordination. If no
13
- boundary exists, keep behavior in requirements/design and generate no task.
14
-
15
- Persist the audited topology only in typed `spec.json.coordination.boundaries`:
16
-
17
- - `ownership`: disjoint task write sets;
18
- - `dependency`: producer, consumer, and exact deliverable;
19
- - `transition`: owner/consumers plus pre/post/failure/recovery semantics;
20
- - `proof`: subject, verifier, verification ref, and verifier-owned artifact anchor;
21
- - `parallel`: independent tasks and exact resources.
22
-
23
- A task bundle requires at least one complete boundary. Legacy trigger fields,
24
- coordination flags, artifact flags, priority markers, and prose labels are
25
- read compatibility inputs and forbidden in schema 2.1 authoring. Optional
26
- phases may group task IDs but must reference a typed owner boundary.
27
-
28
- Use `phase-decision-matrix.md` only when split/merge boundaries remain unclear.
29
- Use the scoring rubric only as advisory input; scores, effort estimates, risk
30
- labels, and requirement count never make a task mandatory.
31
-
32
- ## Default decomposition
33
-
34
- Prefer a vertical outcome slice that implements behavior through its real
35
- runtime entrypoint and proves the result. Split horizontally only when:
36
-
37
- - one owner must produce a contract, schema, or transition before consumers;
38
- - file or contract ownership must be disjoint;
39
- - a proof surface has a different durable owner; or
40
- - parallel work has no dependency or shared resource contention.
41
-
42
- Do not create foundation, integration, spike, testing, or release tasks by
43
- habit. A support output must be consumed by a named later task or identified as
44
- internal to the same vertical slice.
45
-
46
- ## Task shape
47
-
48
- Each task contains exactly the information an implementer needs:
49
-
50
- 1. **Outcome** — observable behavior delivered by the task.
51
- 2. **Scope** — exact in/out behavior boundary.
52
- 3. **Anchors and Ownership** — one six-column ownership projection.
53
- 4. **Changes** — behavior and code changes, including relevant negative paths.
54
- 5. **Acceptance** — measurable requirement IDs and task-local outcomes.
55
- 6. **Dependencies** — projection of typed dependency boundaries or `none`.
56
- 7. **Verification Plan** — command/inspection, expected result, negative path,
57
- runtime reachability, exact design `V` ID, and task role when applicable.
58
-
59
- Do not add estimated effort, empty risk tables, receipt fields, Base/Head,
60
- verdicts, provenance, agent chains, or generic completion ceremony.
61
-
62
- `**Status:**` is the canonical files-first lifecycle projection for each task.
63
- Its value must stay byte-for-byte equivalent in meaning to
64
- `spec.json.task_registry[path].status`; use the same exact canonical token in
65
- both places. Allowed values are `pending`, `in_progress`, `blocked`, and `done`.
66
- Authoring initializes tasks as `pending`. A later lifecycle transition updates
67
- the task Markdown and registry together. `done` proof remains owned by execution
68
- closeout; do not add receipts, Evidence sections, Base/Head bindings, verdicts,
69
- or provenance to the task plan.
70
-
71
- ## Typed anchors
72
-
73
- The task's only ownership table is `ID | Type | Target | Role | Access |
74
- Action`. IDs are unique across the spec. `Access` is `read` or `write`; read
75
- requires `Action=read`, while write requires `create`, `modify`, or `delete`.
76
- Targets are exact and grounded, never globs or parent-directory claims. Allowed
77
- types are `file`, `symbol`, `command`, `route`, `schema`, `contract`, `artifact`,
78
- and `external`.
79
-
80
- - Files-first: list exact `file` anchors before anchors contained by those files.
81
- - Task-owned anchors use `A-R{requirement}-{sequence}-NN`, populated from the
82
- canonical task ID; their counter is local to that namespace, not globally
83
- reused as an unnamespaced counter.
84
- - When the task only consumes a target already anchored by design, reference the
85
- canonical `A-D-NN` anchor instead of creating another anchor for that target.
86
- - `Modify`, `Delete`, and `Read` paths must exist when authored; `Create` paths
87
- need a grounded parent/boundary.
88
- - A symbol target names or references its containing file.
89
- - A command target is copied from real project tooling, not invented.
90
- - A contract anchor references its stable design ID; never copy the contract
91
- body into the task.
92
- - Duplicate IDs anywhere in design or tasks block readiness.
93
-
94
- ## Contracts, ownership, and dependencies
95
-
96
- Each cross-task contract, invariant, schema transition, or recovery authority
97
- has exactly one owner task. Every consumer:
98
-
99
- - references the named contract/invariant ID;
100
- - depends directly or transitively on the owner; and
101
- - does not redefine the canonical body.
102
-
103
- Each `RN.M` has exactly one implementation owner. A proof boundary means its
104
- subject implements the product criterion and its verifier verifies the referenced
105
- `V` definition through a separately owned proof criterion/artifact. The verifier
106
- must not repeat the subject's criterion in `Acceptance`; sharing a proof boundary
107
- does not create a second implementation owner. Their shared V definition names
108
- both exact criteria so subject, verifier, and proof boundary resolve to one
109
- verification contract.
110
-
111
- Task Markdown and `spec.json.task_registry[path]` must keep both `status` and
112
- `dependencies` synchronized. Derive task ID from
113
- `tasks/task-R{N}-{SEQ}-<slug>.md`; use two-digit `SEQ`. Do not create shorthand
114
- filenames.
115
-
116
- Parallel eligibility exists only when a typed `parallel` boundary proves exact
117
- disjoint resources, no dependency path, and no shared transition/proof
118
- authority. Do not author a parallel-priority marker.
119
-
120
- ## Changes and acceptance
121
-
122
- Describe product behavior and the code boundary together. Name exact validation,
123
- state, route, schema, error, and integration behavior only when relevant. Keep
124
- all work inside `scope_lock`; an expansion pauses for explicit user approval.
125
-
126
- Map acceptance to numeric `N.M` IDs from `requirements.md`. Include negative or
127
- error outcomes where invalid input, missing permission, failure, conflict,
128
- timeout, retry, rollback, or recovery is relevant. Do not add vague acceptance
129
- such as “works”, “safe”, or “performant”.
130
-
131
- ## Verification plan
132
-
133
- Choose proportional proof for the changed surface:
134
-
135
- - exact command-shaped invocation or justified `N/A`;
136
- - expected exit, output, state, artifact, or UI result;
137
- - contract-preserving negative-path check when relevant; and
138
- - real entrypoint/caller for runtime-facing work, or the exact dependent task
139
- that will establish reachability.
140
-
141
- Declare exactly `Verification ref: Vn` and `Task role: subject` or `Task role:
142
- verifier`. The V definition lives once in `design.md` using the canonical
143
- single-line bold-ID syntax. The task references it and does not copy its body.
144
-
145
- Every executable implementation task must declare concrete test ownership: at
146
- least one `file` or `artifact` anchor with `write` `create` or `modify` that is
147
- the focused test, or share proof through a typed `proof` boundary whose
148
- verifier owns the separate proof artifact. A generic `npm test` string alone
149
- is not ownership; shared proof without a typed boundary is not ownership.
150
-
151
- Access/action reachability is deterministic:
152
-
153
- | Access | Allowed Action | Grounding meaning |
154
- |---|---|---|
155
- | `read` | `read` | Exact target already exists and is inspected/consumed. |
156
- | `write` | `modify` or `delete` | Exact target already exists and is owned by this task. |
157
- | `write` | `create` | Exact target is absent and its parent/boundary is grounded. |
158
-
159
- Commands, symbols, contracts, routes, schemas, artifacts, and external targets
160
- also receive their type-specific grounding check. Grounding is mandatory before
161
- readiness; the deterministic validator/grounder recompute facts and never create
162
- an extra receipt or claim semantic judgment.
163
-
164
- Build success alone is not behavior proof. Static validation may check command
165
- shape and anchors, but execution owns actual runtime proof.
166
-
167
- `feature-receipt.md` is created only during execution closeout. Never create or
168
- reference it as a spec-ready requirement.
169
-
170
- Every physical task participates in at least one justified typed boundary.
171
- Ownership and parallel resource maps are keyed exactly by their participants,
172
- contain non-empty unique exact targets, and equal the task write anchors they
173
- claim. An ownership boundary is truthful only when at least two physical tasks
174
- have distinct, non-overlapping exact write anchors. A dependency boundary must match
175
- the registry DAG and producer-write/consumer-read anchors. Proof, transition,
176
- and parallel boundaries must satisfy their typed fields; labels never suffice.
177
-
178
- ## Task graph and phases
179
-
180
- When a task bundle exists:
181
-
182
- - cover every scoped acceptance criterion exactly where it is implemented or
183
- proven;
184
- - keep owner-before-consumer ordering explicit;
185
- - rebuild registry inventory from physical task files before readiness; and
186
- - use optional phases only as compact task-ID groups in `spec.json` for a
187
- complex Full graph.
188
-
189
- Never create phase files or repeat task prose in phase metadata.
@@ -1,41 +0,0 @@
1
- Primary operating instructions for OpenCode using the CafeKit runtime.
2
-
3
- ## OpenCode Runtime Mapping
4
-
5
- - Project instructions live in `AGENTS.md`.
6
- - CafeKit commands live in `.opencode/commands/` and use OpenCode-native slash names.
7
- - CafeKit agents live in `.opencode/agents/` using OpenCode frontmatter.
8
- - CafeKit skills live in `.opencode/skills/` and are read natively by OpenCode; edit project-local skills there.
9
- - Run Python skill scripts with the project venv:
10
- - macOS/Linux: `.opencode/skills/.venv/bin/python3 scripts/<script>.py`
11
- - Windows: `.opencode\\skills\\.venv\\Scripts\\python.exe scripts\\<script>.py`
12
- - Support files live in `.opencode/rules/`, `.opencode/scripts/`, `.opencode/references/`, and `.opencode/runtime.json`.
13
- - OpenCode config is merged into `opencode.json`; keep project model/provider choices there.
14
-
15
- ## Command surface
16
-
17
- Use these OpenCode commands without the `hapo:` prefix:
18
-
19
- - `/question <question>`: answer from repository evidence first.
20
- - `/brainstorm <idea-or-problem>`: narrow unclear ideas before specs.
21
- - `/specs <feature-or-spec-command>`: create, update, validate, or approve specs.
22
- - `/develop <feature> [task-file] [--flash]`: implement approved spec tasks.
23
- - `/test [scope|--full]`: verify implementation and collect evidence.
24
- - `/code-review [scope|--pending]`: review correctness and regressions.
25
- - `/debug <issue>` and `/hotfix <issue>`: diagnose, then apply narrow fixes.
26
-
27
- The underlying CafeKit skills are still named `hapo:*` in their documentation.
28
-
29
- ## OpenCode limits
30
-
31
- Claude Code hooks, statusline, and settings do not run in OpenCode. Map Claude-only tools to OpenCode built-ins: `TodoWrite` → `todowrite`, `AskUserQuestion` → `question`, `Task` → the agent/subtask flow. The installed plugins under `.opencode/plugins/` provide the privacy, inspect-scope, spec-state, scaffold-guard, session-state, and docs-sync gates; other Claude runtime behavior has no OpenCode equivalent.
32
-
33
- The installed `spec-gate` plugin uses the cancellable `tool.execute.before` hook to hard-block supported completion/state tools (`task`, `taskupdate`, and `todowrite`) with a controlled `CAFEKIT_SPEC_GATE_BLOCKED` result when shared policy/resolver or receipt evidence is invalid or unavailable. Receipt-repair tools remain available where the host boundary permits correction.
34
-
35
- OpenCode does not expose a cancellable `session.idle`/Stop hook or final assistant-turn cancellation boundary. Those event and prompt-injection paths are observational only; do not claim full-turn parity with Claude/Codex.
36
-
37
- ## Combined-install boundary
38
-
39
- OpenCode's native project instruction surface is root `AGENTS.md`. Combined installs keep this OpenCode block there because CafeKit has not proven a separate project instruction entrypoint for OpenCode. Other runtimes may read the same root file; this shared-root trade-off is intentional and must not be treated as filesystem isolation.
40
-
41
- **Ownership / ignore contract (fail-safe):** This OpenCode block is owned by OpenCode only. If you are Claude Code, Codex CLI, or any other runtime, ignore this entire OpenCode block and consume only CORE plus your native block. If you cannot determine which block is yours, treat the file as CORE-only. Do not treat another runtime's block as instructions.