@haposoft/cafekit 0.9.2 → 0.9.3
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/README.md +1 -1
- package/package.json +1 -1
- package/src/claude/skills/specs/SKILL.md +11 -0
- package/src/claude/skills/specs/references/ask-user-question-gates.md +61 -0
- package/src/claude/skills/specs/rules/phase-decision-matrix.md +55 -0
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +52 -0
- package/src/claude/skills/specs/rules/tasks-generation.md +13 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Claude Code-first spec-driven workflow and runtime bundle for AI coding assistants.
|
|
4
4
|
|
|
5
|
-
[](https://github.com/haposoft/cafekit)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://claude.ai/code)
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haposoft/cafekit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "Claude Code-first spec-driven workflow for AI coding assistants. Bundles CafeKit hapo: skills, runtime hooks, agents, and installer scaffolding.",
|
|
5
5
|
"author": "Haposoft <nghialt@haposoft.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -184,6 +184,7 @@ flowchart TD
|
|
|
184
184
|
## Detailed Workflow
|
|
185
185
|
|
|
186
186
|
### Step 1: Analyze Description
|
|
187
|
+
- Load `references/ask-user-question-gates.md` before asking user questions. Ask only at documented gates; do not ask questions that repo evidence or official/current docs can answer.
|
|
187
188
|
- Assess clarity and complexity of the description
|
|
188
189
|
- Route to `hapo:brainstorm` before creating files when:
|
|
189
190
|
- the expected output or acceptance criteria are not concrete
|
|
@@ -209,6 +210,7 @@ Load: `references/cross-spec-dependency.md`
|
|
|
209
210
|
|
|
210
211
|
### Step 3: Complexity Assessment & Scope Inquiry
|
|
211
212
|
Load: `references/scope-inquiry.md`
|
|
213
|
+
- Also load `references/ask-user-question-gates.md` when scope, evidence, contract, or architecture decisions require user input.
|
|
212
214
|
- Evaluate the request across **5 dimensions**: Semantic Intent, Implementation Hypothesis, Gap Sizing, Risk/Uncertainty (Cynefin), and Blast Radius
|
|
213
215
|
- If Risk = **Chaotic** → exit spec workflow, redirect to `hapo:hotfix`
|
|
214
216
|
- If Risk = **Complex** → include spike/prototype tasks in the spec
|
|
@@ -252,6 +254,8 @@ Load: `references/scope-inquiry.md`
|
|
|
252
254
|
- Read `spec.json` — stop if requirements haven't completed
|
|
253
255
|
- Pick discovery mode: `minimal` / `light` / `full` based on complexity. **Default: `light`** unless certain it is simple UI (minimal) or complex integration (full).
|
|
254
256
|
- Load `rules/design-principles.md`
|
|
257
|
+
- Load `rules/phase-decision-matrix.md` to define implementation slices, task clusters, foundation boundaries, spike needs, integration gates, and verification gates before task generation.
|
|
258
|
+
- Load `references/ask-user-question-gates.md` if a design decision would change scope, contract, provider/platform, or implementation safety.
|
|
255
259
|
- Load `rules/design-discovery-[mode].md`:
|
|
256
260
|
- **minimal**: UI-only or simple CRUD
|
|
257
261
|
- **light**: extending existing system
|
|
@@ -267,6 +271,9 @@ Load: `references/scope-inquiry.md`
|
|
|
267
271
|
- Read `spec.json` — stop if `requirements.md` or `design.md` missing
|
|
268
272
|
- Respect `scope_lock` — only use valid requirement IDs within `in_scope`
|
|
269
273
|
- Load `rules/tasks-generation.md` for core principles
|
|
274
|
+
- Load `rules/phase-decision-matrix.md` before generating task files. Treat "phase" as an implementation slice/task cluster, not a `phase-XX.md` artifact.
|
|
275
|
+
- Load `rules/task-scoring-rubric.md` for every candidate task to decide priority, split/merge, spike needs, dependencies, parallel eligibility, and evidence depth.
|
|
276
|
+
- Load `references/ask-user-question-gates.md`; if scoring reveals unapproved scope expansion or an unresolved user-owned choice, pause before writing task files.
|
|
270
277
|
- Load `rules/tasks-parallel-analysis.md` for parallel markers (default: enabled)
|
|
271
278
|
- Each task file follows template `templates/task.md`
|
|
272
279
|
- `Related Files` and test plans must inherit paths, contracts, and test targets from the codebase scout. If exact files/tests cannot be named for an enhancement, run targeted inspect before generating tasks.
|
|
@@ -345,6 +352,7 @@ Load: `references/task-hydration.md`
|
|
|
345
352
|
|
|
346
353
|
### Step 9: Validation Review (Optional)
|
|
347
354
|
Load: `references/review.md` + `rules/design-review.md`
|
|
355
|
+
- Load `references/ask-user-question-gates.md` before applying validation or red-team changes. User approval is required when findings modify approved scope, requirements, canonical contracts, design decisions, or task behavior.
|
|
348
356
|
- System auto-evaluates spec complexity and decides review depth:
|
|
349
357
|
- **< 3 task files, no security concerns** → Validate only (lightweight interview)
|
|
350
358
|
- **>= 5 task files OR security/migration keywords** → Red Team first, then Validate
|
|
@@ -551,10 +559,13 @@ Before finalizing any specification, assert all the following:
|
|
|
551
559
|
- `design-discovery-full.md` — Full research workflow
|
|
552
560
|
- `design-discovery-light.md` — Lightweight research workflow
|
|
553
561
|
- `design-review.md` — Design review GO/NO-GO process
|
|
562
|
+
- `phase-decision-matrix.md` — Implementation slice/task-cluster boundary rules
|
|
554
563
|
- `tasks-generation.md` — Task generation rules (includes spike task rules)
|
|
555
564
|
- `tasks-parallel-analysis.md` — Parallel task analysis
|
|
565
|
+
- `task-scoring-rubric.md` — Task priority, split/merge, spike, dependency, and evidence-depth scoring
|
|
556
566
|
|
|
557
567
|
### References (`references/`)
|
|
568
|
+
- `ask-user-question-gates.md` — AskUserQuestion gate matrix for user-owned decisions
|
|
558
569
|
- `cross-spec-dependency.md` — Cross-spec dependency detection
|
|
559
570
|
- `scope-inquiry.md` — 5-Dimension Complexity Assessment (Semantic, Hypothesis, Gap, Risk/Cynefin, Blast Radius)
|
|
560
571
|
- `research-strategy.md` — Research strategy (7 tools)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# AskUserQuestion Gate Matrix
|
|
2
|
+
|
|
3
|
+
Use this matrix to decide when `hapo:specs` must pause for user input. Ask only when the answer changes scope, architecture, requirements, task shape, validation disposition, or implementation safety.
|
|
4
|
+
|
|
5
|
+
## Source Priority
|
|
6
|
+
|
|
7
|
+
Resolve uncertainty in this order:
|
|
8
|
+
|
|
9
|
+
1. Existing `spec.json`, `requirements.md`, `research.md`, `design.md`, and task files.
|
|
10
|
+
2. Codebase evidence from targeted scout/inspect.
|
|
11
|
+
3. Official/current external docs when platform/provider behavior matters.
|
|
12
|
+
4. Reasonable default from CafeKit rules.
|
|
13
|
+
5. `AskUserQuestion` only when the remaining decision is user-owned.
|
|
14
|
+
|
|
15
|
+
Do not ask about facts that codebase or official docs can answer.
|
|
16
|
+
|
|
17
|
+
## Gate Matrix
|
|
18
|
+
|
|
19
|
+
| Gate | Trigger | Ask? | Question shape | Record in |
|
|
20
|
+
|---|---|---:|---|---|
|
|
21
|
+
| Operation | `/hapo:specs` called without args | Yes | Choose create/status/resume/validate/archive | none |
|
|
22
|
+
| Active spec | In-progress or branch-matched spec exists | Yes | Continue existing vs create new | `spec.json` if changed |
|
|
23
|
+
| Pre-spec clarity | Description lacks concrete output, actor, or acceptance signal | Yes | 1-2 clarifying questions | `spec.json.scope_lock` |
|
|
24
|
+
| Brainstorm routing | 2+ plausible architectures and no approved direction | Yes | Route to brainstorm vs continue minimal spec | final response / `research.md` |
|
|
25
|
+
| Scope inquiry | Non-trivial task after 5D assessment | Yes | Expand / Hold / Reduce | `spec.json.scope_lock` |
|
|
26
|
+
| Evidence gap | Required evidence is unavailable after targeted research | Yes | Continue with explicit risk / run more scout / narrow scope | `research.md` |
|
|
27
|
+
| Architecture tie | Two approaches are materially similar after evidence | Yes | Pick approach with recommended option first | `design.md` |
|
|
28
|
+
| Contract change | Auth, persistence, provider, API, CLI, schema, permissions, or runtime contract changes | Yes if user intent not explicit | Confirm contract and rollback expectations | `design.md` canonical contracts |
|
|
29
|
+
| Scope expansion | A task candidate adds work not in `scope_lock` | Yes | Approve expansion / defer / reject | `spec.json.scope_lock` + affected docs |
|
|
30
|
+
| High-risk spike | Risk = Complex and spike may change deliverables | Yes if cost/scope impact > 4h | Spike now / reduce / defer | `research.md` + task file |
|
|
31
|
+
| Task conflict | Parallel candidate shares files/contracts with another task | No by default | Resolve sequentially unless business deadline requires parallelization | task dependencies |
|
|
32
|
+
| Validation findings | Red-team/validate findings modify approved scope/design/tasks | Yes | Apply accepted / review each / reject all | `reports/red-team-report.md` or validation log |
|
|
33
|
+
| Final contradiction | Whole-spec sweep finds unresolved contradiction | Yes | Choose authoritative source/decision | affected docs + `spec.json` |
|
|
34
|
+
|
|
35
|
+
## Question Format
|
|
36
|
+
|
|
37
|
+
Every `AskUserQuestion` must:
|
|
38
|
+
|
|
39
|
+
- Ask 1-3 questions max per pause.
|
|
40
|
+
- Provide 2-3 concrete options.
|
|
41
|
+
- Put recommended option first and suffix label with `(Recommended)`.
|
|
42
|
+
- Explain the tradeoff in one sentence per option.
|
|
43
|
+
- Include an implicit free-form "Other" option when the tool supports it.
|
|
44
|
+
|
|
45
|
+
## Do Not Ask
|
|
46
|
+
|
|
47
|
+
Do not ask when:
|
|
48
|
+
|
|
49
|
+
- The answer is discoverable via repo files, tests, docs, or official/current docs.
|
|
50
|
+
- The choice is pure implementation detail with no scope/user impact.
|
|
51
|
+
- The task can safely use an existing codebase convention.
|
|
52
|
+
- The question exists only to avoid making a normal engineering judgment.
|
|
53
|
+
|
|
54
|
+
## Recording Rules
|
|
55
|
+
|
|
56
|
+
After a user answer:
|
|
57
|
+
|
|
58
|
+
- Update the artifact that drives implementation, not only a report.
|
|
59
|
+
- Keep exact selected option and custom free text when provided.
|
|
60
|
+
- Add unresolved questions at the end of the affected document.
|
|
61
|
+
- Do not mark `ready_for_implementation = true` while a blocking question remains unresolved.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Phase Decision Matrix
|
|
2
|
+
|
|
3
|
+
CafeKit does not create `phase-XX.md` files. In `hapo:specs`, "phase" means an implementation slice or task cluster that becomes one or more `tasks/task-R*.md` files.
|
|
4
|
+
|
|
5
|
+
Use this matrix after `requirements.md` and `design.md` exist, before generating task files.
|
|
6
|
+
|
|
7
|
+
## Slice Types
|
|
8
|
+
|
|
9
|
+
| Slice | Use when | Output pattern | Must prove |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| R0 Foundation | Shared setup, contracts, schema, config, base runtime, permissions, package wiring | `task-R0-01-<slug>.md` | Later tasks depend on it or explicitly consume it |
|
|
12
|
+
| Risk Spike | Risk = Complex, API/platform behavior uncertain, or feasibility not proven by evidence | `task-R{N}-00-spike-<slug>.md` | Go/no-go, findings, time-box <= 4h |
|
|
13
|
+
| Vertical Slice | User-visible behavior crosses multiple layers but can be delivered end-to-end | `task-R{N}-01-<feature-slice>.md` | Runtime entrypoint reaches the behavior |
|
|
14
|
+
| Layer Slice | Work naturally splits by layer and dependencies are clear | `task-R{N}-01-api.md`, `task-R{N}-02-ui.md` | Contract handoff between layers |
|
|
15
|
+
| Cross-Cutting Slice | One concern affects many requirements, e.g. language handling, privacy, error policy | One primary task plus secondary requirement refs in related tasks | No duplicated implementation across tasks |
|
|
16
|
+
| Integration Gate | Prior outputs must be wired into a route, app, command, worker, extension manifest, or runtime surface | Final task in dependency chain | No orphaned services/components/files |
|
|
17
|
+
| Verification Gate | Security/performance/migration/critical path needs dedicated proof | Dedicated task only when proof cannot live inside related task | Exact command/artifact/negative-path evidence |
|
|
18
|
+
| Release/Packaging | Store/package/release behavior is explicitly in scope | Last task | Build artifact and release-specific checks |
|
|
19
|
+
|
|
20
|
+
## Selection Rules
|
|
21
|
+
|
|
22
|
+
1. Start with requirement IDs and design contracts.
|
|
23
|
+
2. Extract shared infrastructure into R0 only when 2+ later tasks consume it or a contract must exist first.
|
|
24
|
+
3. Prefer vertical slices for user-facing workflows because they prove reachability early.
|
|
25
|
+
4. Use layer slices when one layer blocks another or file ownership would conflict.
|
|
26
|
+
5. Add a spike before implementation when evidence says the outcome is uncertain.
|
|
27
|
+
6. Add an integration gate for every feature with runtime-facing outputs.
|
|
28
|
+
7. Add a verification gate only when the required proof is too broad for a single implementation task.
|
|
29
|
+
8. Do not create a slice just because the plan "feels large"; every slice needs a deliverable boundary.
|
|
30
|
+
|
|
31
|
+
## Split / Merge Signals
|
|
32
|
+
|
|
33
|
+
Split into separate task files when:
|
|
34
|
+
|
|
35
|
+
- Acceptance criteria span multiple architectural layers.
|
|
36
|
+
- Effort exceeds 4 hours.
|
|
37
|
+
- A task would modify unrelated files or contracts.
|
|
38
|
+
- One part can be verified independently before the next part starts.
|
|
39
|
+
- Different agents could own the work without touching the same files.
|
|
40
|
+
|
|
41
|
+
Merge when:
|
|
42
|
+
|
|
43
|
+
- Work touches the same files and cannot be verified separately.
|
|
44
|
+
- A task would only wrap another task with no independent deliverable.
|
|
45
|
+
- Splitting would create orphaned support code before integration.
|
|
46
|
+
|
|
47
|
+
## Output Requirements
|
|
48
|
+
|
|
49
|
+
Before writing task files, capture the chosen slices in working notes and ensure:
|
|
50
|
+
|
|
51
|
+
- Every slice maps to at least one requirement ID or R0 foundation rationale.
|
|
52
|
+
- Every runtime-facing slice names its entrypoint or later integration task.
|
|
53
|
+
- Every dependency is explicit.
|
|
54
|
+
- Every parallel-capable slice has no shared file ownership with sibling tasks.
|
|
55
|
+
- Scope additions route through `references/ask-user-question-gates.md`.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Task Scoring Rubric
|
|
2
|
+
|
|
3
|
+
Use this rubric after applying the Phase Decision Matrix and before writing each task file. The score determines priority, split/merge, spike needs, dependency shape, and evidence depth.
|
|
4
|
+
|
|
5
|
+
## Score Each Candidate Task
|
|
6
|
+
|
|
7
|
+
Score each dimension 0-3.
|
|
8
|
+
|
|
9
|
+
| Dimension | 0 | 1 | 2 | 3 |
|
|
10
|
+
|---|---|---|---|---|
|
|
11
|
+
| Dependency criticality | Standalone | Depends on one task | Blocks one feature slice | Blocks many tasks or core runtime |
|
|
12
|
+
| Implementation risk | Routine | Known pattern, minor edge cases | Complex logic or integration | Unproven behavior, migration, security, provider/platform uncertainty |
|
|
13
|
+
| Blast radius | Isolated file | Feature-local files | Shared component/API/config | Auth, data layer, routing, permissions, package export, or critical path |
|
|
14
|
+
| User value | Internal cleanup | Enables later work | User-visible improvement | Core acceptance criterion or launch blocker |
|
|
15
|
+
| Evidence confidence | Proven by code/tests/docs | Mostly proven | Partial evidence | Low/no evidence |
|
|
16
|
+
| Testability burden | Simple unit/smoke | Component/integration | Multi-step workflow | E2E/security/performance/rollback proof required |
|
|
17
|
+
| File conflict risk | No overlap | Minor shared utility | Shared module with consumers | Same files as another task or cross-agent conflict likely |
|
|
18
|
+
| Scope creep risk | Fully in scope | Small interpretation | Adds adjacent behavior | Adds unapproved feature/contract |
|
|
19
|
+
|
|
20
|
+
## Interpret Score
|
|
21
|
+
|
|
22
|
+
| Total | Priority | Action |
|
|
23
|
+
|---:|---|---|
|
|
24
|
+
| 0-6 | P3 | Keep compact. Merge if no independent proof exists. |
|
|
25
|
+
| 7-12 | P2 | Normal task. Include explicit dependencies and evidence. |
|
|
26
|
+
| 13-18 | P1 | High attention. Consider split, stronger evidence, and validation note. |
|
|
27
|
+
| 19+ | P1 critical | Split or add spike. Do not mark parallel unless file ownership is isolated. |
|
|
28
|
+
|
|
29
|
+
## Mandatory Overrides
|
|
30
|
+
|
|
31
|
+
- If Scope creep risk = 3, stop and use `AskUserQuestion` before generating the task.
|
|
32
|
+
- If Evidence confidence = 3 and Implementation risk >= 2, create a spike task first.
|
|
33
|
+
- If Blast radius = 3, include rollback/negative-path proof in `Evidence`.
|
|
34
|
+
- If File conflict risk >= 2, remove `(P)` unless ownership is explicitly separated.
|
|
35
|
+
- If User value = 3 and Dependency criticality >= 2, schedule early unless blocked by foundation work.
|
|
36
|
+
|
|
37
|
+
## Task Metadata Decisions
|
|
38
|
+
|
|
39
|
+
- `priority`: from total score plus overrides.
|
|
40
|
+
- `dependencies`: list every required predecessor task file.
|
|
41
|
+
- `(P)` marker: allowed only when dependency and file conflict scores are <= 1 and design boundaries do not overlap.
|
|
42
|
+
- `Evidence`: choose proof type from `tasks-generation.md` Test Type Selection table; increase proof depth for high scores.
|
|
43
|
+
- `Risk Assessment`: include all dimensions scored 2-3 as risks or constraints.
|
|
44
|
+
|
|
45
|
+
## Compact Output
|
|
46
|
+
|
|
47
|
+
Do not write the raw score table into every task file. Use the rubric to shape task content. Surface only decisions that affect implementation:
|
|
48
|
+
|
|
49
|
+
- why task is P1/P2/P3
|
|
50
|
+
- why it is split/merged
|
|
51
|
+
- why it is or is not parallel
|
|
52
|
+
- why a spike or extra proof is required
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Core Principles
|
|
4
4
|
|
|
5
|
+
### 0. Pre-Generation Decision Gates
|
|
6
|
+
|
|
7
|
+
Before writing any `tasks/task-R*.md` file:
|
|
8
|
+
|
|
9
|
+
1. Load `phase-decision-matrix.md` and identify implementation slices/task clusters: R0 foundation, risk spikes, vertical slices, layer slices, cross-cutting slices, integration gates, verification gates, and release/packaging slices when in scope.
|
|
10
|
+
2. Load `task-scoring-rubric.md` and score each candidate task. Use the result to choose priority, split/merge, spike needs, dependencies, parallel eligibility, and evidence depth.
|
|
11
|
+
3. Load `../references/ask-user-question-gates.md` if scoring or slicing detects unapproved scope expansion, unresolved architecture tie, missing evidence, contract ambiguity, or final contradiction.
|
|
12
|
+
4. Do not ask about facts that targeted scout, repo files, tests, or official/current docs can answer.
|
|
13
|
+
|
|
14
|
+
The raw score table does not need to appear in each task file. The task file must reflect the decisions: why the task exists, what it depends on, why it is split/merged, whether it can be parallel, and what proof is required.
|
|
15
|
+
|
|
5
16
|
### 1. Natural Language Descriptions
|
|
6
17
|
Focus on capabilities and outcomes, not code structure.
|
|
7
18
|
|
|
@@ -71,6 +82,7 @@ When splitting a requirement into multiple tasks:
|
|
|
71
82
|
2. **Split by concern** — e.g., R3-01 for consent onboarding UI, R3-02 for consent version re-check logic
|
|
72
83
|
3. **Split by dependency chain** — if acceptance criteria A must finish before B can start, they belong in separate task files with explicit `Dependencies:`
|
|
73
84
|
4. **Never split by arbitrary size** — don't create 3 task files just because "3 feels right"
|
|
85
|
+
5. **Use the Phase Decision Matrix** — only split when the implementation slice has an independent deliverable boundary or proof path.
|
|
74
86
|
|
|
75
87
|
#### Cross-cutting requirements
|
|
76
88
|
Some requirements (e.g., "language handling", "error handling") naturally touch code in many other requirements' tasks. For these:
|
|
@@ -86,6 +98,7 @@ Grouping tasks vertically by requirement carries the risk of "siloed" or fragmen
|
|
|
86
98
|
2. **Shared Interfaces (Horizontal Contracts)**: Sub-tasks that touch shared cross-requirement architecture (like registering a new page in a global `router.ts` or adding a column to a shared table) MUST explicitly reference the shared contract defined in `design.md`.
|
|
87
99
|
3. **Integration Enforcers**: If R1 and R2 interact (e.g., R2 UI displays data fetched by R1 backend), the later task MUST have a sub-task explicitly dedicated to "Wiring/Integrating with [Previous Feature] output".
|
|
88
100
|
4. **Final Runtime Integration**: For any feature that has a user-facing screen, public route, CLI command, background worker, browser extension surface, or API flow, create a final integration task (or a final integration section in the last dependent task) that proves the whole scoped feature works from its runtime entrypoint. This task MUST fail if prior-task outputs exist but are not imported, mounted, registered, or invoked.
|
|
101
|
+
5. **Scored Sequencing**: Use `task-scoring-rubric.md` to schedule high-value/high-dependency tasks early, but only after required foundation/spike work. High file-conflict or high blast-radius tasks must not be marked `(P)` without isolated ownership.
|
|
89
102
|
|
|
90
103
|
### 3d. Spike Tasks for Complex/Uncertain Areas (MANDATORY)
|
|
91
104
|
|