|
1 | | -# Step 3: Interview (Interactive or Self-Interview) |
| 1 | +# Step 3: Deep Exploration (Interview or Self-Interview) |
2 | 2 |
|
3 | 3 | ## Interactive Mode (AUTO_MODE=false) |
4 | 4 |
|
5 | | -Original behavior — ask user questions via `AskUserQuestion`. |
| 5 | +Ask questions **one at a time** via `AskUserQuestion`. Wait for each answer. Apply pushback rules below. |
6 | 6 |
|
7 | | -### Phase 1: Pressure Test |
8 | | - |
9 | | -Ask exactly 3 questions, **one at a time**, using `AskUserQuestion` for each. |
| 7 | +## Auto Mode (AUTO_MODE=true) |
10 | 8 |
|
11 | | -**CRITICAL REQUIREMENT**: You MUST use the `AskUserQuestion` tool for every question. Do NOT output questions as plain text — they will be ignored. |
| 9 | +AI self-interview — no `AskUserQuestion`. All answers from codebase analysis + reasoning. |
12 | 10 |
|
13 | | -Wait for each answer before asking the next question. |
| 11 | +**Output contract (auto mode):** |
| 12 | +1. Print each Q&A pair to stdout (user sees the reasoning) |
| 13 | +2. Embed full trace in requirements doc under `## Self-Interview Trace` |
14 | 14 |
|
15 | | -#### Question 1: Who and why? |
16 | | -> Who uses this? What's the specific pain point or motivation? |
| 15 | +--- |
17 | 16 |
|
18 | | -#### Question 2: Cost of inaction? |
19 | | -> What happens if we do nothing? What's the actual cost or risk? |
| 17 | +## Phase A1: Evidence Gathering |
20 | 18 |
|
21 | | -#### Question 3: Simpler framing? |
22 | | -> Is there a simpler version that delivers 80% of the value? What's the minimum viable version? |
| 19 | +Before questioning, gather hard evidence: |
23 | 20 |
|
24 | | -After all 3 answers, summarize the key insights in 2-3 bullets before proceeding. |
| 21 | +1. **Affected surface**: `flowctl find "<key terms>" --json` → list all related files |
| 22 | +2. **Current patterns**: Read 3-5 key files. How does the codebase handle similar things? |
| 23 | +3. **Dependencies**: Check imports, configs, shared types |
| 24 | +4. **Test coverage**: Do tests exist? What kind? What's missing? |
| 25 | +5. **Recent history**: `git log --oneline -20` on affected files |
| 26 | +6. **Existing specs**: Check `.flow/specs/` and `.flow/epics/` for related work |
| 27 | +7. **Impact graph**: `flowctl graph impact <main-file> --json` → what would break? |
25 | 28 |
|
26 | 29 | --- |
27 | 30 |
|
28 | | -## Auto Mode (AUTO_MODE=true) |
| 31 | +## Phase A2: Forcing Questions (Sequential, with Pushback) |
29 | 32 |
|
30 | | -AI self-interview — no `AskUserQuestion` calls. All answers derived from codebase analysis, best practices, and reasoning. |
| 33 | +Each question has **rejection criteria** — answers that are too vague MUST be re-examined. In auto mode, if the first answer falls into a rejection category, the AI must challenge itself and provide a more specific answer. |
31 | 34 |
|
32 | | -**Output contract (auto mode):** |
33 | | -1. Print Q&A pairs to **stdout** so the user sees the reasoning in conversation |
34 | | -2. Embed Q&A pairs in the requirements doc under a `## Self-Interview Trace` section |
35 | | -3. Requirements doc written to `.flow/specs/${SLUG}-requirements.md` (same as interactive) |
| 35 | +Format each as: |
| 36 | + |
| 37 | +``` |
| 38 | +### Q1: [Question] |
| 39 | +**First answer:** [initial response] |
| 40 | +**Pushback:** [challenge the answer using rejection criteria] |
| 41 | +**Refined answer:** [specific, evidence-grounded response] |
| 42 | +``` |
| 43 | + |
| 44 | +### Q1: Demand Reality |
| 45 | +> What's the strongest evidence this change is actually needed? |
| 46 | +
|
| 47 | +- **Reject**: "It would be nice" / "best practice says" / "users might want" / "it's cleaner" |
| 48 | +- **Accept**: Specific failure observed, measured time waste, blocked workflow, real user complaint, production incident |
| 49 | +- **Pushback test**: Does the answer cite a SPECIFIC event/metric, or is it hypothetical? |
| 50 | + |
| 51 | +### Q2: Status Quo |
| 52 | +> How is this being handled RIGHT NOW without this change? |
36 | 53 |
|
37 | | -### Phase A1: Deep Code Analysis |
| 54 | +- **Reject**: "Nothing handles this" (if nothing does, pain isn't real enough) |
| 55 | +- **Accept**: Specific workaround described, manual steps counted, duct-tape solution identified |
| 56 | +- **Pushback test**: If no workaround exists, WHO is suffering and HOW? If nobody, why build it? |
38 | 57 |
|
39 | | -Before self-interview, gather evidence: |
| 58 | +### Q3: Narrowest Wedge |
| 59 | +> What's the smallest version that delivers 80% of the value? |
40 | 60 |
|
41 | | -1. **Affected surface**: Grep/Glob for all files related to the request. List them. |
42 | | -2. **Current patterns**: How does the codebase currently handle similar functionality? Read 3-5 key files. |
43 | | -3. **Dependencies**: What modules/packages/APIs are involved? Check imports, configs. |
44 | | -4. **Test coverage**: Do tests exist for the affected area? What kind? |
45 | | -5. **Recent history**: `git log --oneline -20` on affected files — who changed what, why? |
46 | | -6. **Existing specs**: Check `.flow/specs/` and `.flow/epics/` for related prior work. |
| 61 | +- **Reject**: "We need the full implementation" / "It won't work if incomplete" |
| 62 | +- **Accept**: One function, one file, one config change that unblocks the core use case |
| 63 | +- **Pushback test**: Can you ship this in < 1 day? If not, scope is too big. |
47 | 64 |
|
48 | | -### Phase A2: Self-Interview |
| 65 | +### Q4: Existing Code Audit |
| 66 | +> What already exists in the codebase that solves part of this? |
49 | 67 |
|
50 | | -Ask and answer questions in structured Q&A format. Output each as a visible block: |
| 68 | +- **Reject**: "Nothing relevant" (search harder — `flowctl find`, `graph refs`) |
| 69 | +- **Accept**: Specific functions, patterns, utilities that can be reused or extended |
| 70 | +- **Pushback test**: If >50% already exists, is this a refactor/extension rather than a new feature? |
| 71 | + |
| 72 | +### Q5: Integration & Contracts |
| 73 | +> What systems/modules will this touch? What contracts must be preserved? |
| 74 | +
|
| 75 | +- **Reject**: "It's self-contained" (almost nothing is — check imports, callers, config) |
| 76 | +- **Accept**: Listed APIs, shared types, database schemas, config files affected |
| 77 | +- **Pushback test**: Run `flowctl graph impact <file>` — is the impact bigger than expected? |
| 78 | + |
| 79 | +### Q6: Failure Pre-mortem |
| 80 | +> Assume this shipped and FAILED in production. Top 3 most likely causes? |
| 81 | +
|
| 82 | +- **Reject**: Vague categories ("security issues", "performance problems") |
| 83 | +- **Accept**: Specific scenarios ("auth token not refreshed after 1hr", "N+1 query on user list page") |
| 84 | +- **Pushback test**: For each cause, is prevention cost < fix-later cost? If not, accept the risk explicitly. |
| 85 | + |
| 86 | +### Q7: Temporal Walk-Through |
| 87 | +> Walk through implementation step by step: |
51 | 88 |
|
52 | 89 | ``` |
53 | | -### Q: <question> |
54 | | -**A:** <answer with code evidence> |
| 90 | +Hour 1 (foundations): What does the implementer need to know FIRST? |
| 91 | +Hour 2-3 (core): What ambiguities will they HIT? |
| 92 | +Hour 4-5 (integration): What will SURPRISE them? |
| 93 | +Hour 6+ (polish): What will they WISH they'd planned for? |
55 | 94 | ``` |
56 | 95 |
|
57 | | -**Core questions (always ask all):** |
| 96 | +Surface decisions that should be resolved NOW, not during implementation. |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Extended Questions (Large tier only — skip for Trivial/Medium) |
| 101 | + |
| 102 | +### Q8: Performance Impact |
| 103 | +> Will this change affect latency, memory, or throughput? |
| 104 | +- Check hot paths, data volume, caching layers in affected code. |
58 | 105 |
|
59 | | -#### 1. Problem & Users |
60 | | -> Q: Who uses this and what specific pain point does it solve? |
61 | | -> A: Derive from codebase context — who calls the affected code, what user-facing behavior it impacts. |
| 106 | +### Q9: Security Surface |
| 107 | +> Does this introduce or modify auth, data handling, or external access? |
| 108 | +- Check auth middleware, input validation, sensitive data flows. |
62 | 109 |
|
63 | | -#### 2. Cost of Inaction |
64 | | -> Q: What happens if we do nothing? What breaks or degrades? |
65 | | -> A: Check for open issues, error patterns, performance trends, tech debt signals in the code. |
| 110 | +### Q10: Migration & Compatibility |
| 111 | +> Are there breaking changes? Data migration needed? Feature flags? |
| 112 | +- Check API contracts, database schemas, config formats. |
66 | 113 |
|
67 | | -#### 3. Simpler Framing |
68 | | -> Q: Is there a simpler version that delivers 80% of the value? |
69 | | -> A: Analyze the request — what's the minimum change that solves the core problem? What can be deferred? |
| 114 | +--- |
| 115 | + |
| 116 | +## Phase A3: Structured Deepening |
70 | 117 |
|
71 | | -#### 4. Existing Patterns |
72 | | -> Q: How does the codebase currently handle similar problems? |
73 | | -> A: Cite specific files, functions, patterns found in Phase A1. Quote code if relevant. |
| 118 | +After all questions, apply ONE named reasoning method (auto-selected based on task type): |
74 | 119 |
|
75 | | -#### 5. Integration Points |
76 | | -> Q: What other systems/modules will this touch? What contracts must be preserved? |
77 | | -> A: List APIs, shared types, database schemas, config files that are affected. |
| 120 | +| Task type | Method | Prompt | |
| 121 | +|-----------|--------|--------| |
| 122 | +| New feature / spec | **Pre-mortem** | "Assume this failed 6 months later. What are the 3 most likely causes?" | |
| 123 | +| Architecture / refactor | **First Principles** | "Strip all assumptions. What's the simplest solution from ground truth?" | |
| 124 | +| Bug fix / reliability | **Inversion** | "How would you guarantee this fails? Now avoid those things." | |
| 125 | +| Security / API | **Red Team** | "You're an attacker. How do you break this?" | |
| 126 | +| Scope decision | **Constraint Removal** | "Remove all constraints (time, tech, team). What changes? What stays?" | |
78 | 127 |
|
79 | | -#### 6. Edge Cases & Failure Modes |
80 | | -> Q: What can go wrong? What are the boundary conditions? |
81 | | -> A: Analyze error handling in current code, identify missing cases, concurrency risks. |
| 128 | +Append deepening insights to the self-interview trace. |
82 | 129 |
|
83 | | -**Extended questions (Large tier only):** |
| 130 | +--- |
84 | 131 |
|
85 | | -#### 7. Performance Impact |
86 | | -> Q: Will this change affect latency, memory, or throughput? |
87 | | -> A: Analyze hot paths, data volume, caching layers in affected code. |
| 132 | +## Pushback Scoring |
88 | 133 |
|
89 | | -#### 8. Security Surface |
90 | | -> Q: Does this introduce or modify authentication, authorization, or data handling? |
91 | | -> A: Check for auth middleware, input validation, sensitive data flows. |
| 134 | +After all Q&A, rate the exploration quality: |
92 | 135 |
|
93 | | -#### 9. Migration & Compatibility |
94 | | -> Q: Are there breaking changes? Do we need data migration or feature flags? |
95 | | -> A: Check API contracts, database schemas, config formats for backwards compatibility. |
| 136 | +| Dimension | Score (1-5) | Criteria | |
| 137 | +|-----------|-------------|----------| |
| 138 | +| **Specificity** | ? | Are answers citing specific files, lines, metrics? | |
| 139 | +| **Evidence** | ? | Are claims backed by code/git/data, not assumption? | |
| 140 | +| **Challenge depth** | ? | Did pushback reveal anything the first answer missed? | |
| 141 | +| **Completeness** | ? | Are all major risk areas covered? | |
| 142 | +| **Actionability** | ? | Can a developer start implementing from these answers? | |
96 | 143 |
|
97 | | -#### 10. Testing Strategy |
98 | | -> Q: What test types are needed and what's the current coverage gap? |
99 | | -> A: Analyze existing test files for the affected area, identify missing test categories. |
| 144 | +**Total: ?/25** |
100 | 145 |
|
101 | | -**Adaptive follow-ups**: If any answer reveals unexpected complexity (e.g., a shared module with 10+ consumers, no test coverage, concurrency issues), add 1-2 follow-up Q&A pairs to drill into that specific area. Cap at 15 total Q&A pairs. |
| 146 | +- **20-25**: Excellent — proceed to approaches |
| 147 | +- **15-19**: Good — proceed but flag weak areas for plan phase |
| 148 | +- **<15**: Insufficient — add 2-3 follow-up Q&A pairs on the weakest dimensions |
102 | 149 |
|
103 | 150 | ## Next Step |
104 | 151 |
|
|
0 commit comments