@haposoft/cafekit 0.9.0 → 0.9.2

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 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
- [![Version](https://img.shields.io/badge/version-0.9.0-blue.svg)](https://github.com/haposoft/cafekit)
5
+ [![Version](https://img.shields.io/badge/version-0.9.2-blue.svg)](https://github.com/haposoft/cafekit)
6
6
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
  [![Claude%20Code](https://img.shields.io/badge/Claude%20Code-Primary-orange.svg)](https://claude.ai/code)
8
8
 
@@ -11,7 +11,7 @@
11
11
  CafeKit installs a structured workflow so an AI coding agent can move cleanly from:
12
12
 
13
13
  ```text
14
- Idea -> QS when unclear -> Brainstorm -> Spec -> Design -> Task Files -> Implementation -> Test -> Review
14
+ Question -> Question answer -> Brainstorm -> Spec -> Design -> Task Files -> Implementation -> Test -> Review
15
15
  ```
16
16
 
17
17
  Claude Code install support:
@@ -102,7 +102,7 @@ cat .opencode/cafekit.json
102
102
 
103
103
  CafeKit ships many skills, but the main release surface is:
104
104
 
105
- - `/hapo:qs <request-or-context> [--batch|--spec-ready|--stakeholder]`: clarify missing decisions, acceptance criteria, scope, constraints, and next workflow readiness
105
+ - `/hapo:question <question> [--repo|--web|--both|--brief|--deep]`: answer questions using repo evidence first, then external/current sources when local evidence is insufficient
106
106
  - `/hapo:brainstorm <idea-or-problem>`: scout the repo, clarify exact requirements, compare approaches, and hand off to specs
107
107
  - `/hapo:specs <feature-description>`: create or resume a structured spec workflow
108
108
  - `/hapo:develop <feature-name>`: implement from approved spec artifacts
@@ -126,7 +126,7 @@ node .claude/scripts/generate-skill-catalog.cjs --skills
126
126
  Claude Code:
127
127
 
128
128
  ```bash
129
- /hapo:qs "What is still unclear before the Google Meet transcript extension spec?" --spec-ready
129
+ /hapo:question "Which files define the current CafeKit install/runtime behavior?" --repo
130
130
  /hapo:brainstorm Explore approaches for a Google Meet transcript extension
131
131
  /hapo:specs Build a Google Meet transcript extension with AI summaries
132
132
  /hapo:develop meet-transcript-mvp
@@ -137,7 +137,7 @@ Claude Code:
137
137
  OpenCode uses the generated command names without the Claude `hapo:` prefix:
138
138
 
139
139
  ```bash
140
- /qs "What is still unclear before the Google Meet transcript extension spec?" --spec-ready
140
+ /question "Which files define the current CafeKit install/runtime behavior?" --repo
141
141
  /brainstorm Explore approaches for a Google Meet transcript extension
142
142
  /specs Build a Google Meet transcript extension with AI summaries
143
143
  /develop meet-transcript-mvp
@@ -32,11 +32,11 @@ const OPENCODE_COMMAND_TEMPLATES = [
32
32
  description: 'Explore and narrow an idea before writing a CafeKit spec.'
33
33
  },
34
34
  {
35
- fileName: 'qs.md',
36
- skillName: 'qs',
37
- agent: 'brainstormer',
35
+ fileName: 'question.md',
36
+ skillName: 'question',
37
+ agent: 'inspector',
38
38
  subtask: true,
39
- description: 'Clarify requirements, scope, acceptance criteria, and workflow readiness.'
39
+ description: 'Answer questions using repo evidence first, then external sources when needed.'
40
40
  },
41
41
  {
42
42
  fileName: 'specs.md',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haposoft/cafekit",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
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",
@@ -15,7 +15,7 @@ These rules reduce common agent coding failures: hidden assumptions, overbuilt s
15
15
  - Do not assume silently. State assumptions when they affect the work.
16
16
  - If multiple interpretations are plausible, surface them before implementation.
17
17
  - If the simpler option is likely better, say so and push back.
18
- - If the task/spec is too vague to verify, use `/hapo:qs` or ask one grounded clarification before planning.
18
+ - If the user asks a question about the project, use `/hapo:question` to answer from source evidence before planning.
19
19
  - Before feature planning or coding, read `./README.md` for project context.
20
20
 
21
21
  ### 2. Simplicity First
@@ -46,7 +46,7 @@ These rules reduce common agent coding failures: hidden assumptions, overbuilt s
46
46
  Use this loop for non-trivial work:
47
47
 
48
48
  1. **Understand** — read README, relevant docs, active spec/task, and existing code.
49
- 2. **Plan** — choose the smallest coherent path; use `/hapo:qs` when requirements are unclear and `/hapo:specs` for feature specs when ready.
49
+ 2. **Plan** — choose the smallest coherent path; use `/hapo:question` for evidence-backed project questions and `/hapo:specs` for feature specs when ready.
50
50
  3. **Execute** — implement only the active task/scope; no placeholder completion.
51
51
  4. **Verify** — run exact task commands first, then repo-level lint/test/build as needed.
52
52
  5. **Sync** — mark task state only after proof exists.
@@ -26,6 +26,8 @@ try {
26
26
 
27
27
  const EXPIRY_DAYS = 7;
28
28
  const MAX_ARCHIVES = 5;
29
+ const MAX_AGENT_SECTIONS = 3;
30
+ const MAX_MODIFIED_FILES_DISPLAY = 5;
29
31
  const TRACKED_POST_TOOL_EVENTS = new Set(['Task', 'TaskCreate', 'TaskUpdate', 'TodoWrite']);
30
32
 
31
33
  function stateDir(cwd) {
@@ -126,7 +128,7 @@ try {
126
128
  }).trim();
127
129
 
128
130
  if (diff) {
129
- data.modifiedFiles = diff.split('\n').slice(0, 20);
131
+ data.modifiedFiles = diff.split('\n').slice(0, MAX_MODIFIED_FILES_DISPLAY);
130
132
  }
131
133
  } catch {
132
134
  // fail-open
@@ -157,27 +159,40 @@ try {
157
159
  }
158
160
 
159
161
  function buildAgentSection(data) {
160
- const agentType = data.agent_type || 'unknown';
162
+ const agentType = data.agent_type || '';
163
+ if (!agentType || agentType === 'unknown') return '';
161
164
  const time = new Date().toISOString().slice(11, 19);
162
165
  return `\n## Agent Result: ${agentType} (${time})\n- Completed at ${time}\n`;
163
166
  }
164
167
 
168
+ function takeRecentAgentSections(sections) {
169
+ if (!Array.isArray(sections) || sections.length <= MAX_AGENT_SECTIONS) return sections || [];
170
+ return sections.slice(-MAX_AGENT_SECTIONS);
171
+ }
172
+
165
173
  function mergeAgentSections(existing, content) {
166
174
  if (!existing) return content;
167
175
 
168
176
  const agentSections = existing.match(/## Agent Result:.+?(?=\n## |$)/gs);
169
177
  if (!agentSections) return content;
170
178
 
179
+ const kept = takeRecentAgentSections(agentSections);
171
180
  const marker = '\n## Key Files Modified';
172
181
  if (content.includes(marker)) {
173
- return content.replace(marker, `\n${agentSections.join('\n')}${marker}`);
182
+ return content.replace(marker, `\n${kept.join('\n')}${marker}`);
174
183
  }
175
184
 
176
- return `${content.trimEnd()}\n\n${agentSections.join('\n')}\n`;
185
+ return `${content.trimEnd()}\n\n${kept.join('\n')}\n`;
177
186
  }
178
187
 
179
188
  function appendAgentSection(existing, agentSection) {
180
189
  if (!existing) return agentSection.trimStart();
190
+ if (!agentSection) {
191
+ const sections = existing.match(/## Agent Result:.+?(?=\n## |$)/gs) || [];
192
+ if (sections.length <= MAX_AGENT_SECTIONS) return existing;
193
+ const kept = takeRecentAgentSections(sections);
194
+ return existing.replace(/(## Agent Result:.+?(?=\n## |$))+/gs, kept.join('\n'));
195
+ }
181
196
 
182
197
  const marker = '\n## Key Files Modified';
183
198
  if (existing.includes(marker)) {
@@ -226,8 +241,10 @@ try {
226
241
  }
227
242
 
228
243
  if (event === 'SubagentStop') {
229
- const file = path.join(dir, 'latest.md');
230
244
  const agentSection = buildAgentSection(data);
245
+ if (!agentSection) process.exit(0);
246
+
247
+ const file = path.join(dir, 'latest.md');
231
248
  const existing = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : '';
232
249
  const updated = existing
233
250
  ? appendAgentSection(existing, agentSection)
@@ -27,7 +27,7 @@
27
27
  "mobile-development",
28
28
  "pdf",
29
29
  "pptx",
30
- "qs",
30
+ "question",
31
31
  "react-best-practices",
32
32
  "research",
33
33
  "specs",
@@ -29,7 +29,7 @@ User wants to...
29
29
 
30
30
  ```text
31
31
  User wants to...
32
- ├── clarify missing requirements or acceptance criteria -> /hapo:qs
32
+ ├── answer questions from source code/docs/specs/config -> /hapo:question
33
33
  ├── find files, locate code, scan project structure -> /hapo:inspect
34
34
  ├── diagnose an error or failing check -> /hapo:debug
35
35
  ├── understand possible side effects -> /hapo:impact-analysis
@@ -42,7 +42,7 @@ Local source truth comes from `/hapo:inspect`; external/current knowledge comes
42
42
 
43
43
  ```text
44
44
  User wants to...
45
- ├── prepare stakeholder/customer questions before docs -> /hapo:qs --batch
45
+ ├── ask/answer documentation questions from source -> /hapo:question
46
46
  ├── create missing project docs -> /hapo:docs --init
47
47
  ├── update docs after source changes -> /hapo:docs --update
48
48
  ├── summarize codebase quickly -> /hapo:docs --summarize
@@ -7,12 +7,13 @@ Do not inject or force a skill when the user explicitly asks for a direct answer
7
7
  ## Core Specification Workflow
8
8
 
9
9
  ```text
10
- /hapo:qs -> /hapo:brainstorm -> /hapo:specs -> /hapo:develop -> /hapo:test -> /hapo:code-review -> /hapo:git
10
+ /hapo:question -> /hapo:brainstorm -> /hapo:specs -> /hapo:develop -> /hapo:test -> /hapo:code-review -> /hapo:git
11
11
  ```
12
12
 
13
13
  | User intent | Suggested start |
14
14
  |---|---|
15
- | vague request, missing acceptance criteria, unclear scope, stakeholder questions | `/hapo:qs` |
15
+ | ask about source code, docs, specs, config, dependencies, or external/current technical facts | `/hapo:question` |
16
+ | vague request, missing acceptance criteria, unclear scope, stakeholder questions | ask one clarification or use `/hapo:brainstorm` |
16
17
  | unclear idea, possible approaches, scope tradeoffs | `/hapo:brainstorm` |
17
18
  | create requirements, design, task breakdown, validate spec | `/hapo:specs` |
18
19
  | implement an approved spec or a specific task file | `/hapo:develop` |
@@ -82,5 +83,6 @@ Use `/hapo:research` for external knowledge. Use `/hapo:inspect` for local sourc
82
83
  - Add a secondary skill only when it materially changes execution.
83
84
  - Prefer explicit user commands over this table.
84
85
  - If two workflows conflict, ask one concise clarification.
85
- - If missing information blocks workflow selection, use `/hapo:qs` before choosing brainstorm/specs/develop.
86
+ - If the user asks a factual or project question before workflow selection, use `/hapo:question`.
87
+ - If missing information blocks workflow selection, ask one concise clarification or use `/hapo:brainstorm`.
86
88
  - If the user asks to "fix" and root cause is unknown, start with `/hapo:debug` unless the issue is trivial and local.
@@ -69,17 +69,30 @@ Leverage these specific tools or sub-agents to execute the workflow effectively:
69
69
  - `brainstormer`: Call only for medium/high-complexity architecture trade-offs.
70
70
  - **Ecosystem Swarm (`SendMessage`):** Call `researcher` (validation), `docs-keeper` (architecture boundaries), or `project-manager` (scope warnings) for deeply complex specs.
71
71
 
72
+ ## Discovery Question Framework
73
+
74
+ Load and follow `references/question-framework.md` before the first user-facing discovery question.
75
+
76
+ Use it to:
77
+ - Generate questions from scout evidence, user intent, exact requirement gaps, matching domain matrices, and risk surfaces.
78
+ - Avoid asking the user to answer technical facts that should be verified from code, docs, or current provider/browser documentation.
79
+ - Prioritize only questions that can materially change architecture, MVP scope, UX, cost/privacy/security, acceptance criteria, or delivery format.
80
+ - Record every user-confirmed decision in a decision register in the final report.
81
+
82
+ If the framework conflicts with the general "one question at a time" rule, prefer the framework's question budget and batching limits: one high-impact question by default, up to 3 independent questions in one `AskUserQuestion` call only when batching reduces friction without mixing unrelated decisions.
83
+
72
84
  ## Authoritative Workflow
73
85
 
74
86
  ```mermaid
75
87
  flowchart TD
76
88
  A["Run /hapo:inspect or narrow scout"] --> B["Summarize codebase findings"]
77
- B --> C["Ask one grounded clarifying question"]
78
- C --> D{"Exact requirements captured?"}
79
- D -->|No| C
89
+ B --> C["Load question framework"]
90
+ C --> DQ["Ask highest-impact grounded question"]
91
+ DQ --> D{"Exact requirements captured?"}
92
+ D -->|No| DQ
80
93
  D -->|Yes| E{"Multiple independent subsystems?"}
81
94
  E -->|Yes| F["Decompose into sub-projects"]
82
- F --> C
95
+ F --> DQ
83
96
  E -->|No| G{"Medium/high complexity?"}
84
97
  G -->|Yes| H["Call brainstormer/researcher/docs-keeper as needed"]
85
98
  G -->|No| I["Propose 2-3 approaches"]
@@ -107,10 +120,14 @@ flowchart TD
107
120
 
108
121
  ### 2. Discovery Phase
109
122
 
110
- - Ask exactly **one question at a time**. Do not stack multiple unrelated questions.
123
+ - Load `references/question-framework.md`.
124
+ - Ask exactly **one high-impact question at a time** by default. Do not stack unrelated questions.
125
+ - You may batch up to 3 independent questions only when each question maps to a different required decision surface and none requires explanation before the user can answer.
111
126
  - Prefer multiple-choice options grounded in scout findings.
112
127
  - Push vague intent into concrete examples, sample inputs/outputs, or acceptance criteria.
113
128
  - Challenge the first proposed solution when the underlying goal suggests a simpler path.
129
+ - Do not ask users to decide technical facts. Research browser/runtime/provider/package facts first; then ask only the product or trade-off decision.
130
+ - Track decisions as you go so the final report can distinguish `User Decision`, `Assumption`, and `Open Question`.
114
131
 
115
132
  ### 3. Scope Guard
116
133
 
@@ -154,7 +171,7 @@ Before passing the completed design to the user for final review, you must inter
154
171
  ### 8. Final Handoff & Documentation
155
172
  Upon the user's explicit final approval of the sanitized design document:
156
173
  1. Generate the final **Design Doc / Summary Report**.
157
- 2. Include: problem statement, exact requirements, evaluated approaches, recommended solution, risks, validation criteria, and next steps.
174
+ 2. Include: problem statement, exact requirements, evaluated approaches, recommended solution, risks, validation criteria, decision register, open questions, and next steps.
158
175
  3. Invoke `/hapo:specs` with the report context to hand off into CafeKit's structured specification phase.
159
176
  4. Optionally update an existing project notes, docs, or report file if the approved design context should be persisted for future work.
160
177
 
@@ -0,0 +1,232 @@
1
+ # Brainstorm Question Framework
2
+
3
+ Use this reference to decide **what to ask**, **what not to ask**, and **how to record decisions** during `hapo:brainstorm`.
4
+
5
+ The goal is not to ask many questions. The goal is to ask the smallest set of questions that can materially change the design.
6
+
7
+ ## Source Hierarchy
8
+
9
+ Generate questions from this hierarchy, in order:
10
+
11
+ 1. **Scout evidence** — repo type, framework, existing modules, docs, specs, plans, runtime config, and constraints.
12
+ 2. **User intent** — nouns, verbs, success language, target users, examples, and implied deliverables in the prompt.
13
+ 3. **Exact requirement gaps** — expected output, acceptance criteria, scope boundary, non-negotiable constraints, touchpoints.
14
+ 4. **Domain matrix** — only domains that actually apply to the request.
15
+ 5. **Risk matrix** — security, privacy, cost, runtime limits, provider failure, migration, compliance, maintainability.
16
+
17
+ Never ask a question that the repository, docs, or trusted technical research can answer directly.
18
+
19
+ ## Ask / Do Not Ask
20
+
21
+ Ask the user when the answer changes:
22
+
23
+ - product scope or MVP boundaries
24
+ - target user workflow or UX surface
25
+ - expected output artifact or delivery format
26
+ - acceptance criteria
27
+ - business priority, timeline, or rollout
28
+ - cost, privacy, API-key ownership, external provider choice
29
+ - irreversible workspace action such as renaming/moving/deleting
30
+ - whether to accept a trade-off after you explain it
31
+
32
+ Do **not** ask the user when the answer is a technical fact you should verify:
33
+
34
+ - browser or runtime limits
35
+ - package/API compatibility
36
+ - dependency maintenance state
37
+ - security best practice
38
+ - exact syntax for framework config
39
+ - existing code location, schema, endpoint, or convention
40
+
41
+ If a topic mixes user preference and technical fact, verify the technical facts first, then ask the preference question with those facts included.
42
+
43
+ ## Prioritization
44
+
45
+ Before asking, score each candidate question:
46
+
47
+ | Signal | Score |
48
+ |---|---:|
49
+ | Could change architecture, data model, or platform | +3 |
50
+ | Could change MVP scope or exclude a feature | +3 |
51
+ | Could affect cost, privacy, security, or compliance | +3 |
52
+ | Defines observable acceptance criteria | +2 |
53
+ | Defines UX flow or primary user surface | +2 |
54
+ | Can be answered from repo/docs/research | -4 |
55
+ | Merely names an implementation detail with a safe default | -2 |
56
+
57
+ Ask only the highest-impact question. If several are tied and independent, ask at most 3 in one `AskUserQuestion` batch; otherwise ask one at a time.
58
+
59
+ ## Required Decision Surfaces
60
+
61
+ Every brainstorm must eventually resolve these surfaces:
62
+
63
+ | Surface | Question Intent |
64
+ |---|---|
65
+ | Outcome | What does the user expect to exist or happen after the work? |
66
+ | Done | How will the user verify it works? |
67
+ | Scope | What is explicitly not included now? |
68
+ | Constraints | What cannot change: stack, platform, naming, runtime, compatibility, deadline? |
69
+ | Touchpoints | Which existing files/modules/contracts will this affect? |
70
+
71
+ If any surface is missing, ask a grounded question before proposing architecture.
72
+
73
+ ## Domain Matrix
74
+
75
+ Use only the domains that match the request.
76
+
77
+ ### Product / UX
78
+
79
+ Ask when the prompt includes UI, workflow, dashboard, extension, app, or user-facing behavior.
80
+
81
+ - Primary user: who uses this first?
82
+ - Primary flow: what is the shortest successful path?
83
+ - Surface: page, overlay, sidebar, modal, command, background task?
84
+ - State: loading, empty, error, partial result, retry?
85
+ - Accessibility or localization expectations?
86
+
87
+ ### Browser Extension
88
+
89
+ Ask when the work involves Chrome, Edge, Firefox, YouTube, DOM injection, content scripts, popup, options page, or browser APIs.
90
+
91
+ - Target browser/runtime and manifest version?
92
+ - UI surface: content overlay, sidebar, popup, options page, or all?
93
+ - Permissions posture: minimal host permissions or broader convenience?
94
+ - Storage: browser storage, IndexedDB, sync storage, or no persistence?
95
+ - Publishing target: dev-only, Chrome Web Store, enterprise install?
96
+
97
+ Verify instead of asking:
98
+
99
+ - Manifest V3 service worker lifetime.
100
+ - Browser-reserved shortcut conflicts.
101
+ - Content script isolated-world vs main-world behavior.
102
+ - Current Chrome API compatibility.
103
+
104
+ ### AI / LLM
105
+
106
+ Ask when the work involves translation, summarization, agents, prompt output, generation, or provider choice.
107
+
108
+ - Provider ownership: user API key, app-owned key, proxy, or local model?
109
+ - Provider shape: fixed provider, multi-provider, or custom base URL?
110
+ - Output contract: prose, JSON, markdown, SRT, code, patch?
111
+ - Failure behavior: retry, fallback, partial result, ask user, or stop?
112
+ - Cache policy: never, per session, persistent, or shared?
113
+ - Privacy boundary: what content may leave the browser/server?
114
+
115
+ Verify instead of asking:
116
+
117
+ - Whether a provider is Anthropic-compatible vs OpenAI-compatible.
118
+ - Whether a provider supports tool use / JSON schema / streaming.
119
+ - Current API endpoint paths and auth header format.
120
+
121
+ ### Data / Transcript / Documents
122
+
123
+ Ask when the work transforms documents, captions, data, logs, OCR, audio, video, or legacy code into another artifact.
124
+
125
+ - Source priority and fallback order?
126
+ - Output format and fidelity level?
127
+ - Confidence / evidence tracking requirement?
128
+ - Missing/unknown handling?
129
+ - Export/import requirements?
130
+
131
+ ### Backend / API / Database
132
+
133
+ Ask when the work includes server endpoints, persistence, auth, jobs, integrations, or migrations.
134
+
135
+ - API contract: endpoint, method, request/response shape?
136
+ - Persistence: new table, existing table, no DB?
137
+ - Auth/permission model?
138
+ - Idempotency, retries, and background job behavior?
139
+ - Migration and rollback constraints?
140
+
141
+ ### Docs / Legacy Reconstruction
142
+
143
+ Ask when the work is documentation, legacy analysis, or requirement reconstruction.
144
+
145
+ - Scope path/module to reconstruct?
146
+ - Output docs required: overview, requirements, architecture, evidence map, unknowns?
147
+ - Evidence level: observed-only or inferred allowed with confidence?
148
+ - Review gate: who approves the reconstructed docs?
149
+ - Change request follows reconstruction or is separate?
150
+
151
+ ### Release / Packaging
152
+
153
+ Ask when the work includes publish, store listing, npm release, versioning, or deployment.
154
+
155
+ - Target release channel?
156
+ - Version bump type?
157
+ - Required checks before publish?
158
+ - Store/listing metadata ownership?
159
+ - Rollback or deprecation plan?
160
+
161
+ ## Question Format
162
+
163
+ Use `AskUserQuestion` when available.
164
+
165
+ - Use 2-4 concrete options.
166
+ - Put the recommended option first and label it `(Recommended)`.
167
+ - Include a one-sentence impact description per option.
168
+ - Do not add an explicit "Other" option; the tool supplies it.
169
+ - Avoid abstract labels like "Option A" unless paired with concrete meaning.
170
+
171
+ Good:
172
+
173
+ > "Where should transcript fallback live?"
174
+ > - "Defer STT for MVP (Recommended)" — Ships faster; no fragile audio extraction now.
175
+ > - "Browser-only STT" — No backend, but fragile and heavy.
176
+ > - "Companion backend" — More robust, but requires hosting and ops.
177
+
178
+ Bad:
179
+
180
+ > "What architecture do you want?"
181
+
182
+ ## Explain Before Asking
183
+
184
+ When the user cannot reasonably know the answer, first explain the trade-off briefly, then ask.
185
+
186
+ Use this pattern:
187
+
188
+ 1. State why the decision matters.
189
+ 2. Give 2-3 viable options with consequences.
190
+ 3. Recommend one.
191
+ 4. Ask the user to confirm or override.
192
+
193
+ Do not force a choice before explaining hidden technical risk.
194
+
195
+ ## Decision Register
196
+
197
+ Every final brainstorm report must include a decision register.
198
+
199
+ ```markdown
200
+ ## Decision Register
201
+
202
+ | ID | Question | Options Presented | User Decision | Rationale | Impact |
203
+ |---|---|---|---|---|---|
204
+ | D-001 | Where does transcript fallback live? | Defer STT / Browser-only / Backend | Defer STT | Ships MVP safely | Phase 7 becomes graceful fallback |
205
+ ```
206
+
207
+ Rules:
208
+
209
+ - Record only decisions actually made by the user or explicitly accepted in chat.
210
+ - Do not write "user selected" unless `AskUserQuestion` or direct user text confirms it.
211
+ - If you infer a default, label it as `Assumption`, not `User Decision`.
212
+ - Carry unresolved decisions into `Open Questions`.
213
+
214
+ ## Maximum Question Budget
215
+
216
+ Default budget:
217
+
218
+ - Small change: 1-2 questions.
219
+ - Medium feature: 3-6 questions.
220
+ - Large/greenfield/architecture-heavy: 6-10 questions across multiple rounds.
221
+
222
+ Stop asking when the next question would only refine an implementation detail with a safe default. Propose the design and list remaining assumptions instead.
223
+
224
+ ## Final Self-Check
225
+
226
+ Before presenting design:
227
+
228
+ - Did each asked question map to one of the required decision surfaces or domain risks?
229
+ - Did any question ask the user to answer a technical fact that should have been researched?
230
+ - Are all user decisions captured in the decision register?
231
+ - Are assumptions clearly separated from user decisions?
232
+ - Are open questions truly blocking, or can they be deferred?
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: hapo:question
3
+ description: "Answer questions with evidence. Use when the user asks about project behavior, source code, specs, docs, configuration, dependencies, or external technical information; inspect the repo first, use internet/current docs when repo evidence is insufficient, and ask back only when the question cannot be answered safely."
4
+ argument-hint: "<question> [--repo|--web|--both|--brief|--deep]"
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # Question Skill
9
+
10
+ `hapo:question` is an evidence-backed question-answering skill. It answers user questions by checking the local project first, then external/current sources when the repository cannot answer the question.
11
+
12
+ ## Core Stance
13
+
14
+ - Answer the question; do not turn every question into a spec or planning session.
15
+ - Source-first: prefer README, docs, specs, code, config, tests, logs, and package metadata before assumptions.
16
+ - Use external/current sources when the local repo is missing the answer, the topic is version-sensitive, or the user asks about outside tools, libraries, APIs, laws, pricing, or best practices.
17
+ - Ask back only when the question is too broad, has no target, needs credentials/private context, or any answer would be misleading.
18
+ - Do not edit files, implement code, create specs, or change project state.
19
+
20
+ <ANSWER-ONLY-GATE>
21
+ Do NOT implement, scaffold, refactor, modify files, generate full specs, or make final architecture decisions.
22
+ The output is an answer, evidence, confidence, and a follow-up only when needed.
23
+ </ANSWER-ONLY-GATE>
24
+
25
+ ## When To Use
26
+
27
+ Use `hapo:question` when the user asks:
28
+ - "Trong hệ thống này X làm gì?"
29
+ - "Luồng này đang xử lý ở đâu?"
30
+ - "Config/version/package hiện tại là gì?"
31
+ - "Có dùng thư viện/công nghệ/cách làm nào không?"
32
+ - "Requirement/spec này có khớp code không?"
33
+ - "Tool/library/framework này nên dùng thế nào?"
34
+ - "Theo best practice/current docs thì sao?"
35
+ - "Tôi nên hiểu phần này như thế nào?"
36
+
37
+ Do not use it when:
38
+ - The user asks to implement, fix, debug, test, commit, or publish.
39
+ - The user wants ideation/tradeoff exploration; use `hapo:brainstorm`.
40
+ - The user wants a formal spec; use `hapo:specs`.
41
+ - The user wants full legacy documentation reconstruction; use `hapo:docs --reconstruct`.
42
+ - The user wants root-cause diagnosis for a failure; use `hapo:debug`.
43
+
44
+ ## Modes
45
+
46
+ - Default: repo-first answer. Use external sources only if local evidence is insufficient.
47
+ - `--repo`: answer from local source only. If not enough evidence, say so and do not use web.
48
+ - `--web`: answer from external/current sources. Still read local context if the question mentions this project.
49
+ - `--both`: explicitly combine local source evidence and external/current evidence.
50
+ - `--brief`: short answer, minimal evidence.
51
+ - `--deep`: broader evidence scan, include trace and tradeoffs.
52
+
53
+ If modes conflict, prefer the most explicit source mode in this order: `--both`, `--repo`, `--web`, then default. Apply `--brief` or `--deep` as output depth modifiers.
54
+
55
+ ## Workflow
56
+
57
+ ### 1. Classify The Question
58
+
59
+ Pick one primary answer type:
60
+
61
+ ```text
62
+ source-code behavior | config/version | spec/docs consistency | dependency/library | workflow/process | external/current knowledge | unclear
63
+ ```
64
+
65
+ If `unclear`, ask one focused follow-up with the minimum choices needed.
66
+
67
+ ### 2. Gather Evidence
68
+
69
+ Repo evidence priority:
70
+ 1. `README.md`, `AGENTS.md`, `CLAUDE.md`
71
+ 2. relevant `docs/`, `specs/`, `.claude/`, `.opencode/`
72
+ 3. source files, tests, scripts, package manifests, config files
73
+ 4. git history only when the question asks about changes or provenance
74
+
75
+ Use focused search (`rg`, targeted file reads) instead of broad scans. Use `hapo:inspect` when the user asks where something lives or the source surface is unclear.
76
+
77
+ External evidence:
78
+ - Use external/current docs when repo evidence is absent, stale, or not authoritative.
79
+ - Prefer official docs, standards, source repositories, or primary vendor docs.
80
+ - State clearly when an answer is inferred from external docs rather than confirmed in the repo.
81
+
82
+ ### 3. Decide Whether To Answer Or Ask Back
83
+
84
+ Answer directly when at least one of these is true:
85
+ - repo evidence answers the question,
86
+ - external/current evidence answers the non-project part,
87
+ - a cautious answer can separate known facts from inference.
88
+
89
+ Ask back when:
90
+ - the target system/module is not named and multiple targets are plausible,
91
+ - the needed file/source is blocked or private,
92
+ - the question requires business/domain judgment not present in source,
93
+ - the answer would require guessing customer intent,
94
+ - the question bundles multiple unrelated topics.
95
+
96
+ Ask only one follow-up question. Include 2-3 concrete options if helpful.
97
+
98
+ ### 4. Output Contract
99
+
100
+ Default output:
101
+
102
+ ```markdown
103
+ **Answer**
104
+ ...
105
+
106
+ **Evidence**
107
+ - `path/to/file`: what it proves
108
+ - External: source name/link, what it proves
109
+
110
+ **Confidence**
111
+ high | medium | low
112
+
113
+ **Gaps**
114
+ - ...
115
+
116
+ **Next**
117
+ ...
118
+ ```
119
+
120
+ Use `templates/question.md` when the user asks to save or document the answer.
121
+
122
+ ## Answer Style
123
+
124
+ - Lead with the answer, not the research process.
125
+ - Use file paths and line references when local evidence is used.
126
+ - Separate "confirmed by source" from "inferred".
127
+ - Keep the answer proportional: concise for simple questions, structured for complex ones.
128
+ - If external sources were used, include source links or names.
129
+ - If no evidence exists, say "không thấy bằng chứng trong source hiện tại" and explain what was checked.
130
+
131
+ ## Examples
132
+
133
+ ### Source Question
134
+
135
+ ```text
136
+ /hapo:question "Trong hệ thống này cafekit dùng file nào để bật/tắt skill routing?"
137
+ ```
138
+
139
+ Expected behavior:
140
+ - read runtime/config/install files,
141
+ - answer with exact config file and relevant keys,
142
+ - say whether it is runtime-driven or hard-coded.
143
+
144
+ ### Mixed Source + Web Question
145
+
146
+ ```text
147
+ /hapo:question "Dự án này đang dùng React version nào, và version đó có còn phù hợp theo best practice hiện tại không?" --both
148
+ ```
149
+
150
+ Expected behavior:
151
+ - read `package.json` or lockfile,
152
+ - check current React docs/release info if needed,
153
+ - separate local version from external recommendation.
154
+
155
+ ### Ask Back
156
+
157
+ ```text
158
+ /hapo:question "Hệ thống này có ổn không?"
159
+ ```
160
+
161
+ Expected behavior:
162
+ - ask one narrowing question because "ổn" could mean architecture, security, performance, UX, tests, or deploy readiness.
@@ -0,0 +1,32 @@
1
+ # Question Answer: {{TITLE}}
2
+
3
+ ## Question
4
+ {{QUESTION}}
5
+
6
+ ## Answer
7
+ {{ANSWER}}
8
+
9
+ ## Evidence
10
+ | Source | Finding | Confidence |
11
+ |---|---|---|
12
+ | {{SOURCE}} | {{FINDING}} | {{CONFIDENCE}} |
13
+
14
+ ## Source Trace
15
+ - Repo files checked: {{REPO_FILES}}
16
+ - External/current sources checked: {{EXTERNAL_SOURCES}}
17
+ - Search terms or commands: {{SEARCH_TRACE}}
18
+
19
+ ## Confirmed Facts
20
+ - {{FACT}}
21
+
22
+ ## Inferences
23
+ - {{INFERENCE}}
24
+
25
+ ## Gaps / Unknowns
26
+ - {{GAP}}
27
+
28
+ ## Follow-up Question
29
+ {{FOLLOW_UP_OR_NONE}}
30
+
31
+ ## Next
32
+ {{NEXT_STEP}}
@@ -16,7 +16,7 @@ Primary operating instructions for OpenCode using the CafeKit runtime.
16
16
  Use these OpenCode commands:
17
17
 
18
18
  - `/brainstorm <idea-or-problem>`: scout and narrow an unclear idea before specs.
19
- - `/qs <request-or-context> [--batch|--spec-ready|--stakeholder]`: clarify requirements, missing decisions, and next workflow readiness.
19
+ - `/question <question> [--repo|--web|--both|--brief|--deep]`: answer questions using repo evidence first, then external/current sources when needed.
20
20
  - `/specs <feature-or-spec-command>`: create, update, validate, or approve specs.
21
21
  - `/develop <feature> [task-file] [--flash]`: implement approved spec tasks.
22
22
  - `/test [scope|--full]`: verify implementation and collect evidence.
@@ -42,7 +42,7 @@ These rules reduce common agent coding failures: hidden assumptions, overbuilt s
42
42
  - Do not assume silently. State assumptions when they affect the work.
43
43
  - If multiple interpretations are plausible, surface them before implementation.
44
44
  - If the simpler option is likely better, say so and push back.
45
- - If the task/spec is too vague to verify, use `/qs` or ask one grounded clarification before planning.
45
+ - If the user asks a question about the project, use `/question` to answer from source evidence before planning.
46
46
  - Before feature planning or coding, read `./README.md` for project context.
47
47
 
48
48
  ### 2. Simplicity First
@@ -73,7 +73,7 @@ These rules reduce common agent coding failures: hidden assumptions, overbuilt s
73
73
  Use this loop for non-trivial work:
74
74
 
75
75
  1. Understand: read README, relevant docs, active spec/task, and existing code.
76
- 2. Plan: choose the smallest coherent path; use `/qs` when requirements are unclear and `/specs` for feature specs when ready.
76
+ 2. Plan: choose the smallest coherent path; use `/question` for evidence-backed project questions and `/specs` for feature specs when ready.
77
77
  3. Execute: implement only the active task/scope; no placeholder completion.
78
78
  4. Verify: run exact task commands first, then repo-level lint/test/build as needed.
79
79
  5. Sync: mark task state only after proof exists.
@@ -1,177 +0,0 @@
1
- ---
2
- name: hapo:qs
3
- description: "Clarify vague requests before planning or implementation. Use when requirements, acceptance criteria, scope, constraints, stakeholder decisions, or next workflow readiness are unclear."
4
- argument-hint: "<request_or_context> [--batch|--spec-ready|--stakeholder]"
5
- version: 1.0.0
6
- ---
7
-
8
- # QS Skill
9
-
10
- `hapo:qs` turns unclear intent into answerable questions and a readiness verdict. It is a clarification gate before `hapo:brainstorm`, `hapo:specs`, `hapo:docs --reconstruct`, `hapo:debug`, or `hapo:develop`.
11
-
12
- ## Core Stance
13
-
14
- - Context before questions. Read the useful project/spec/docs/source context before asking.
15
- - Questions are work products. Make them specific, prioritized, and easy to answer.
16
- - One thing at a time in interactive mode.
17
- - Prefer multiple-choice options with a recommended default when the context supports it.
18
- - Do not design the solution unless the user explicitly moves to `hapo:brainstorm`.
19
- - Do not create specs or write code from this skill.
20
-
21
- <CLARIFICATION-ONLY-GATE>
22
- Do NOT implement, scaffold, edit product code, generate full specs, or make architecture decisions as final.
23
- The output is questions, assumptions, readiness, and next-step guidance.
24
- </CLARIFICATION-ONLY-GATE>
25
-
26
- ## When To Use
27
-
28
- Use `hapo:qs` when:
29
- - The request is too vague to verify.
30
- - Acceptance criteria are missing.
31
- - Scope boundary is unclear.
32
- - Stakeholder/customer input is needed before specs.
33
- - The user asks "what should I ask?", "what is missing?", "can this go to specs?", or "is this clear enough?"
34
- - A spec/task has ambiguity that would make `hapo:develop` risky.
35
- - A legacy reconstruction or bug report lacks enough scope to start the correct workflow.
36
-
37
- Do not use it when:
38
- - The user asks for a direct factual answer that can be answered safely.
39
- - The user already gave exact output, acceptance criteria, scope, constraints, and target files.
40
- - The right action is clearly `hapo:debug`, `hapo:inspect`, `hapo:research`, or `hapo:docs --reconstruct`.
41
-
42
- ## Modes
43
-
44
- - Default interactive mode: ask one highest-value question, then wait.
45
- - `--batch`: produce a grouped question list for a stakeholder/customer/team.
46
- - `--spec-ready`: audit whether the request can move to `hapo:specs`.
47
- - `--stakeholder`: write business-friendly questions with minimal implementation jargon.
48
-
49
- If multiple modes appear, use the most restrictive mode in this order: `--spec-ready`, `--batch`, `--stakeholder`, default.
50
-
51
- ## Workflow
52
-
53
- ### 1. Context Scout
54
-
55
- Read only enough context to make the questions concrete:
56
- - `README.md`
57
- - relevant `docs/`
58
- - relevant `specs/`
59
- - relevant source files when the request names a feature, module, API, UI, or bug
60
-
61
- Use `hapo:inspect` or focused search when the location is unclear. Do not scan the whole repo unless the question is about the whole repo.
62
-
63
- ### 2. Build The Clarification Map
64
-
65
- Create a private map with these fields:
66
-
67
- ```text
68
- Known facts:
69
- Assumptions:
70
- Missing decisions:
71
- Blocking unknowns:
72
- Non-blocking unknowns:
73
- Possible next workflow:
74
- ```
75
-
76
- Classify each unknown:
77
- - `P0`: blocks correct next action.
78
- - `P1`: high-risk ambiguity; should answer before implementation.
79
- - `P2`: useful detail; can defer.
80
-
81
- ### 3. Ask Or Report
82
-
83
- Default interactive mode:
84
- - Ask exactly one `P0` question.
85
- - Make it concrete and grounded in observed context.
86
- - If possible, provide 2-3 options.
87
- - Put the recommended option first and explain the tradeoff in one sentence.
88
-
89
- `--batch` or `--stakeholder`:
90
- - Produce grouped questions by priority.
91
- - Keep each question answerable.
92
- - Include recommended options only when they are justified by context.
93
-
94
- `--spec-ready`:
95
- - Return a readiness checklist and verdict.
96
- - Do not ask a long question list unless verdict is `not-ready`.
97
-
98
- ### 4. Readiness Verdict
99
-
100
- End with one of:
101
- - `not-ready`: missing P0 decisions.
102
- - `brainstorm-ready`: enough to explore solution options, but not enough for specs.
103
- - `specs-ready`: enough to run `/hapo:specs <request>`.
104
- - `develop-ready`: an approved spec/task exists and no blocking ambiguity remains.
105
-
106
- ### 5. Next Step
107
-
108
- Suggest exactly one next command:
109
- - `/hapo:qs ...` when another clarification round is required.
110
- - `/hapo:brainstorm ...` when design/options are still open.
111
- - `/hapo:specs ...` when requirements are clear enough.
112
- - `/hapo:debug ...` when the issue is a bug with unknown root cause.
113
- - `/hapo:docs --reconstruct <scope>` when the task is legacy/as-is docs.
114
- - `/hapo:develop <feature>` only when an approved spec/task is already clear.
115
-
116
- ## Output Formats
117
-
118
- ### Default Interactive Output
119
-
120
- ```markdown
121
- **Context Read**
122
- - ...
123
-
124
- **Known**
125
- - ...
126
-
127
- **Blocking Unknown**
128
- - P0: ...
129
-
130
- **Question**
131
- ...
132
-
133
- **Options**
134
- - A. ... (Recommended) - ...
135
- - B. ... - ...
136
- - C. ... - ...
137
-
138
- **Readiness**
139
- not-ready | brainstorm-ready | specs-ready | develop-ready
140
-
141
- **Next**
142
- /hapo:qs ...
143
- ```
144
-
145
- ### Batch Output
146
-
147
- Use `templates/qs.md` when the user asks to save or document the question set.
148
-
149
- ```markdown
150
- **Question Set**
151
-
152
- **P0 - Must Answer**
153
- 1. ...
154
-
155
- **P1 - Should Answer**
156
- 1. ...
157
-
158
- **P2 - Can Defer**
159
- 1. ...
160
-
161
- **Assumptions To Confirm**
162
- - ...
163
-
164
- **Readiness**
165
- ...
166
-
167
- **Next**
168
- ...
169
- ```
170
-
171
- ## Quality Bar
172
-
173
- - Every P0 question must explain what decision it unlocks.
174
- - No generic "please clarify" questions.
175
- - No more than one interactive question per response.
176
- - No implementation plan unless the next command is `hapo:brainstorm` or `hapo:specs`.
177
- - If no P0/P1 unknown exists, do not invent questions. Say it is ready and name the next command.
@@ -1,30 +0,0 @@
1
- # Question Set: {{TITLE}}
2
-
3
- ## Context Read
4
- - {{CONTEXT_ITEM}}
5
-
6
- ## Known Facts
7
- - {{KNOWN_FACT}}
8
-
9
- ## Assumptions
10
- - {{ASSUMPTION}}
11
-
12
- ## P0 - Must Answer
13
- 1. **Question:** {{P0_QUESTION}}
14
- - **Why it matters:** {{WHY_IT_MATTERS}}
15
- - **Recommended answer:** {{RECOMMENDED_ANSWER}}
16
- - **Other options:** {{OTHER_OPTIONS}}
17
-
18
- ## P1 - Should Answer
19
- 1. **Question:** {{P1_QUESTION}}
20
- - **Risk if unanswered:** {{RISK}}
21
-
22
- ## P2 - Can Defer
23
- 1. **Question:** {{P2_QUESTION}}
24
- - **Can defer until:** {{DEFER_POINT}}
25
-
26
- ## Readiness Verdict
27
- `not-ready | brainstorm-ready | specs-ready | develop-ready`
28
-
29
- ## Next Command
30
- `/hapo:qs ... | /hapo:brainstorm ... | /hapo:specs ... | /hapo:debug ... | /hapo:docs --reconstruct ... | /hapo:develop ...`