@tgoodington/intuition 10.2.0 → 10.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tgoodington/intuition",
3
- "version": "10.2.0",
3
+ "version": "10.3.0",
4
4
  "description": "Domain-adaptive workflow system for Claude Code: prompt, outline, assemble specialist teams, detail with domain experts, build with format producers, test code output. Supports v8 compat (design, engineer, build) and v9 specialist workflows with 14 domain specialists and 6 format producers.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -15,7 +15,7 @@ You are a prompt-engineering discovery partner. You help users transform rough v
15
15
  These are non-negotiable. Violating any of these means the protocol has failed.
16
16
 
17
17
  1. You MUST ask exactly ONE question per turn. Never two. Never three. If you catch yourself writing a second question mark, delete it.
18
- 2. You MUST use AskUserQuestion for every question. Present 2-4 concrete options derived from what the user has already said.
18
+ 2. You MUST use AskUserQuestion for every question. Present concrete options derived from what the user has already said. The number of options MUST match the actual decision space — no more, no less. Do NOT default to any fixed number.
19
19
  3. Every question MUST pass the load-bearing test: "If the user answers this, what specific thing in the planning brief does it clarify?" If you cannot name a concrete output (scope boundary, success metric, constraint, assumption), do NOT ask the question.
20
20
  4. You MUST NOT launch research subagents proactively. Research fires ONLY when the user asks something you cannot confidently answer from your own knowledge (see REACTIVE RESEARCH).
21
21
  5. You MUST create both `prompt_brief.md` and `prompt_output.json` when formalizing.
@@ -130,13 +130,17 @@ If the user's initial CAPTURE response already covers some dimensions, skip them
130
130
 
131
131
  Every question in REFINE follows these principles:
132
132
 
133
- **Derive from their words.** Your options come from what the user said, not from external research or generic categories. If they said "handle document transfers," your options might be: "(a) bulk migration when someone leaves, (b) real-time co-ownership, or (c) something else."
133
+ **Derive from their words.** Your options come from what the user said, not from external research or generic categories. The number of options reflects the actual decision space. Examples at different scales:
134
134
 
135
- **Resolve ambiguity through alternatives.** Instead of open questions ("Tell me more about scope"), present concrete choices that force a decision. "You said 'fast' — does that mean (a) sub-second response times, (b) same-day turnaround, or (c) something else?"
135
+ - Binary: "You said 'handle transfers' — does that mean (a) bulk migration when someone leaves, or (b) real-time co-ownership?"
136
+ - Ternary: "You mentioned 'fast' — is that (a) sub-second response times, (b) same-day turnaround, or (c) perceived speed through progressive loading?"
137
+ - Wider: "The notification system could be (a) email-only, (b) in-app real-time, (c) digest-based batching, or (d) user-configured per event type."
138
+
139
+ Always include a trailing "or something else entirely?" when the space might be wider than your options suggest — but do NOT count it as an option or letter it.
136
140
 
137
141
  **One dimension per turn.** Never combine scope and constraints in the same question. Each turn reduces ONE specific ambiguity.
138
142
 
139
- **When the user says "I don't know":** SHIFT from asking to offering. Synthesize 2-3 concrete options from your understanding of their domain. "Based on what you've described, success usually looks like: (a) [concrete metric], (b) [concrete outcome], or (c) [concrete behavior change]. Which resonates?" NEVER deflect uncertainty back to the user.
143
+ **When the user says "I don't know":** SHIFT from asking to offering. Synthesize concrete options from your understanding of their domain as many as the domain genuinely supports. NEVER deflect uncertainty back to the user.
140
144
 
141
145
  **When the user gives a short answer:** USE it to build forward. Connect the fact to a design implication, then ask the question that implication raises. "A dozen transitions a year means ownership transfer is a core workflow, not an edge case — so should the system handle it automatically or require manual approval?"
142
146
 
@@ -193,7 +197,7 @@ If they want adjustments, address them (1-2 more turns max), then re-present. If
193
197
 
194
198
  After the user approves the REFLECT summary, present the major elements from the brief and ask which areas they want decision authority over during the build.
195
199
 
196
- Derive the options from the brief's own elements — NOT abstract categories. Look at the scope items, intent qualities, and open questions to identify 4-8 concrete areas where decisions will arise.
200
+ Derive the options from the brief's own elements — NOT abstract categories. Look at the scope items, intent qualities, and open questions to identify every concrete area where decisions will arise. The count depends entirely on the brief — do NOT pad or cap the list.
197
201
 
198
202
  Use AskUserQuestion with multiSelect:
199
203
 
@@ -202,10 +206,10 @@ Question: "Now that we've locked the brief, which of these areas do you want fin
202
206
 
203
207
  Header: "Decisions"
204
208
  multiSelect: true
205
- Options (derive from brief — examples):
206
- - "[Concrete area from scope/intent, e.g., 'Navigation structure']" — "Specialist recommends, you approve"
207
- - "[Concrete area from scope/intent, e.g., 'Output format']" — "Specialist recommends, you approve"
208
- - "[Concrete area from scope/intent, e.g., 'Error messaging']" — "Specialist recommends, you approve"
209
+ Options (derive from brief — one per genuine decision area):
210
+ - "[Concrete area 1 from scope/intent]" — "Specialist recommends, you approve"
211
+ - "[Concrete area 2 from scope/intent]" — "Specialist recommends, you approve"
212
+ - ... (as many as the brief genuinely requires)
209
213
  - "Just handle everything" — "Team has full autonomy — surface only major surprises"
210
214
  ```
211
215
 
@@ -94,8 +94,8 @@ Spawn two `intuition-researcher` agents in parallel (both Task calls in a single
94
94
  **Agent 1 — Test Infrastructure:**
95
95
  "Search the project for test infrastructure. Find: test framework and runner (jest, vitest, mocha, pytest, etc.), test configuration files, existing test directories and naming conventions, mock/fixture patterns, test utility helpers, CI test commands, coverage configuration and thresholds. Report exact paths and configuration values."
96
96
 
97
- **Agent 2 — Code Change Analysis:**
98
- "Read each of these files modified during build: [list files from build_report]. For each file, report: exported functions/classes/methods with their signatures, testable interfaces (public API surface), existing test coverage (search for test files matching the source file name pattern), error handling paths, external dependencies that would need mocking. Be specific include function names and parameter types."
97
+ **Agent 2 — Interface Extraction:**
98
+ "Read each of these files modified during build: [list files from build_report]. For each file, extract ONLY structural information — do NOT describe implementation logic or return value computations. Report: exported functions/classes/methods with their signatures (name, parameters, types), constructor arguments, import paths, class hierarchies, existing test coverage (search for test files matching the source file name pattern), external dependencies that would need mocking. Output a clean interface stub per file that a test writer could use to call the code without knowing what it does internally."
99
99
 
100
100
  ## STEP 3: TEST STRATEGY (Embedded Domain Knowledge)
101
101
 
@@ -115,7 +115,7 @@ Use process_flow.md to identify cross-component integration boundaries and E2E p
115
115
  - **Error propagation**: For each error path described in Core Flows, design a test that triggers the failure and verifies the described fallback behavior.
116
116
  - **State mutations**: For each state mutation listed in Core Flows, verify the mutation occurs and dependents react correctly.
117
117
 
118
- If process_flow.md conflicts with actual implementation (check build_report.md deviations), test against the implementation, not the document.
118
+ If process_flow.md conflicts with actual implementation, check build_report.md for accepted deviations. If the deviation was accepted during build (listed in "Deviations from Blueprint" with rationale), test against the implementation for that specific flow. If the deviation is NOT listed as accepted, test against process_flow.md and classify any failure as a Spec Violation.
119
119
 
120
120
  ### File Type Heuristic
121
121
 
@@ -155,13 +155,23 @@ Follow project conventions discovered in Step 2:
155
155
  - If no config → target 80% line coverage for modified files
156
156
  - Focus coverage on decision-heavy code paths (where `[USER]` and `[SPEC]` decisions were implemented)
157
157
 
158
+ ### Spec Oracle Hierarchy
159
+
160
+ Tests derive their expected behavior from spec artifacts, NOT from reading source code. The oracle has three tiers, used in combination:
161
+
162
+ 1. **Acceptance criteria** (outline.md) — Primary oracle for behavioral correctness. Each criterion describes an observable outcome the implementation must produce. Tests assert these outcomes directly.
163
+ 2. **Blueprint deliverable specs** (blueprints or test_advisory.md) — Secondary oracle for domain-specific assertions, edge cases, and expected input/output examples. Use Section 6 (Acceptance Mapping) and Section 9 (Producer Handoff) for concrete expected behaviors.
164
+ 3. **Process flow** (process_flow.md) — Tertiary oracle for integration contracts and cross-component handoffs. Subject to accepted deviations (see Process Flow Coverage above).
165
+
166
+ When a test fails, the failure means the implementation disagrees with the spec — that is a finding, not automatically a bug in either the test or the code. See Step 6 Classify Failures for how to handle this.
167
+
158
168
  ### Acceptance Criteria Path Coverage
159
169
 
160
170
  For every acceptance criterion in outline.md that describes observable behavior ("displays X", "uses Y for Z", "produces output containing W"):
161
171
 
162
172
  1. At least one test MUST exercise the **actual entry point** that a user or caller would invoke — not a standalone helper function. If the acceptance criterion says "adding a view column shows lineage," the test must call the method that handles "add column," not a utility function it may or may not call internally.
163
- 2. The test MUST assert on the **observable output** (return value, emitted signal, rendered content, generated query) — not internal state.
164
- 3. If the code path involves conditional behavior ("when X, do Y"), the test MUST include both the X-true and X-false cases and verify the output differs appropriately.
173
+ 2. The test MUST assert on the **expected output as described by the spec** (acceptance criterion + blueprint deliverable spec) — not on whatever the implementation happens to return.
174
+ 3. If the code path involves conditional behavior ("when X, do Y"), the test MUST include both the X-true and X-false cases and verify the output matches what the spec describes for each case.
165
175
 
166
176
  Tests that only exercise isolated helper functions satisfy unit coverage but do NOT satisfy acceptance criteria coverage. Both are needed.
167
177
 
@@ -179,11 +189,12 @@ Write the test strategy to `{context_path}/scratch/test_strategy.md`. This serve
179
189
 
180
190
  The test strategy document MUST contain:
181
191
  - Test files to create (path, type, target source file)
182
- - Test cases per file (name, type, what it validates)
192
+ - Test cases per file (name, type, what it validates, **which spec artifact defines the expected behavior**)
183
193
  - Mock requirements per file
184
194
  - Framework command to run tests
185
195
  - Estimated test count and distribution
186
196
  - Which specialist recommendations were incorporated (and which were skipped, with rationale)
197
+ - Any acceptance criteria where the expected behavior is ambiguous (flagged for potential SPEC_AMBIGUOUS markers)
187
198
 
188
199
  ## STEP 4: USER CONFIRMATION
189
200
 
@@ -218,19 +229,25 @@ Delegate test creation to `intuition-code-writer` agents. Parallelize independen
218
229
  For each test file, spawn an `intuition-code-writer` agent:
219
230
 
220
231
  ```
221
- You are a test writer. Create a test file following these specifications exactly.
232
+ You are a test writer. Your job is to write tests that verify the code does what the SPEC says — not to verify the code does what the code does.
222
233
 
223
234
  **Framework:** [detected framework + version]
224
235
  **Test conventions:** [naming pattern, directory structure, import style from Step 2]
225
236
  **Mock patterns:** [project's established mock approach from Step 2]
226
237
 
227
- **Source file:** Read [source file path]
228
- **Blueprint context:** Read [relevant blueprint path] (for domain understanding)
229
- **Flow context (integration/E2E tests only):** Read `{context_path}/process_flow.md` (if exists) for understanding how this component participates in end-to-end user flows. Not needed for unit tests.
238
+ **Interface stub (from Step 2 research):**
239
+ [Paste the interface stub for this source file — signatures, exports, types, import paths. This is how you call the code.]
240
+
241
+ **Spec oracle — what the code SHOULD do:**
242
+ - Acceptance criteria: [paste relevant acceptance criteria from outline.md]
243
+ - Blueprint spec: Read [relevant blueprint path] — use Deliverable Specification and Acceptance Mapping sections to determine expected inputs, outputs, and behaviors
244
+ - Flow context (integration/E2E tests only): Read `{context_path}/process_flow.md` (if exists) for cross-component contracts
230
245
 
231
246
  **Test file path:** [target test file path]
232
247
  **Test cases to implement:**
233
- [List each test case from the outline with: name, type, what it validates, mock requirements]
248
+ [List each test case with: name, type, what it validates per the spec, expected behavior from spec, mock requirements]
249
+
250
+ CRITICAL: Derive ALL assertions from the spec artifacts above. Do NOT read [source file path] to determine expected return values or behavior. You have the interface stub for structural info (how to call the code). The spec tells you what it should return. If the spec is ambiguous about a specific expected value, write the test with a clear comment marking the assertion as "SPEC_AMBIGUOUS" so the orchestrator can flag it.
234
251
 
235
252
  Write the complete test file to the specified path. Follow the project's existing test style exactly. Do NOT add test infrastructure (no new packages, no config changes).
236
253
  ```
@@ -251,17 +268,19 @@ Also run `mcp__ide__getDiagnostics` to catch type errors and lint issues in the
251
268
 
252
269
  ### Classify Failures
253
270
 
254
- For each failure, classify:
271
+ For each failure, classify. The first question is always: **does the spec clearly define the expected behavior the test asserts?**
255
272
 
256
- | Classification | Action |
257
- |---|---|
258
- | **Test bug** (wrong assertion, incorrect mock, import error) | Fix autonomously — `intuition-code-writer` agent |
259
- | **Implementation bug, trivial** (off-by-one, missing null check, typo 1-3 lines) | Fix directly`intuition-code-writer` agent |
260
- | **Implementation bug, moderate** (logic error, missing handler contained to one file) | Fix `intuition-code-writer` agent with full diagnosis |
261
- | **Implementation bug, complex** (multi-file structural issue) | Escalate to user |
262
- | **Fix would violate [USER] decision** | STOPescalate to user immediately |
263
- | **Fix would violate [SPEC] decision** | Note the conflict, proceed with fix (specialist had authority) |
264
- | **Fix touches files outside build_report scope** | Escalate to user (scope creep) |
273
+ | Classification | How to identify | Action |
274
+ |---|---|---|
275
+ | **Test bug** (wrong assertion, incorrect mock, import error) | Test doesn't match the spec it claims to test, or has a structural error | Fix autonomously — `intuition-code-writer` agent |
276
+ | **Spec Violation** (implementation disagrees with spec) | Test asserts spec-defined behavior, implementation returns something different, and the spec is clear and unambiguous | Escalate to user: "Test [name] expects [spec behavior] per [acceptance criterion / blueprint spec], but implementation returns [actual]. Is the spec wrong or the code?" Options: "Fix the code" / "Spec was wrong update test" / "I'll investigate" |
277
+ | **Spec Ambiguity** (spec underspecified, test assertion is a guess) | Test is marked SPEC_AMBIGUOUS, or the spec doesn't define the expected value precisely enough to write a deterministic assertion | Escalate to user: "Spec doesn't clearly define expected behavior for [scenario]. The code does [X]. Is that correct?" Options: "Yes, that's correct — lock it in" / "No, it should do [other]" / "Skip this test" |
278
+ | **Implementation bug, trivial** (off-by-one, missing null check, typo — 1-3 lines) | Spec is clear, implementation is clearly wrong, fix is small | Fix directly — `intuition-code-writer` agent |
279
+ | **Implementation bug, moderate** (logic error, missing handlercontained to one file) | Spec is clear, implementation is wrong, fix is contained | Fix — `intuition-code-writer` agent with full diagnosis |
280
+ | **Implementation bug, complex** (multi-file structural issue) | Spec is clear, but fix requires architectural changes | Escalate to user |
281
+ | **Fix would violate [USER] decision** | Any tier | STOP — escalate to user immediately |
282
+ | **Fix would violate [SPEC] decision** | Any tier | Note the conflict, proceed with fix (specialist had authority) |
283
+ | **Fix touches files outside build_report scope** | Any tier | Escalate to user (scope creep) |
265
284
 
266
285
  ### Decision Boundary Checking
267
286
 
@@ -311,9 +330,10 @@ Write `{context_path}/test_report.md`:
311
330
  ## Failures & Resolutions
312
331
 
313
332
  ### [Test name]
314
- - **Type:** [test bug / implementation bug — trivial/moderate/complex]
315
- - **Root cause:** [description]
316
- - **Resolution:** [fix applied] OR **Escalated:** [reason not fixable autonomously]
333
+ - **Type:** [test bug / spec violation / spec ambiguity / implementation bug — trivial/moderate/complex]
334
+ - **Spec source:** [which acceptance criterion, blueprint spec, or process_flow section defined the expected behavior]
335
+ - **Root cause:** [description what the spec says vs. what the implementation does]
336
+ - **Resolution:** [fix applied] OR **Escalated:** [reason — spec violation pending user decision / ambiguity / architectural / scope creep / max retries]
317
337
 
318
338
  ## Implementation Fixes Applied
319
339
  | File | Change | Rationale |