@synth-coder/memhub 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.eslintrc.cjs +45 -45
  2. package/.factory/commands/opsx-apply.md +150 -150
  3. package/.factory/commands/opsx-archive.md +155 -155
  4. package/.factory/commands/opsx-explore.md +171 -171
  5. package/.factory/commands/opsx-propose.md +104 -104
  6. package/.factory/skills/openspec-apply-change/SKILL.md +156 -156
  7. package/.factory/skills/openspec-archive-change/SKILL.md +114 -114
  8. package/.factory/skills/openspec-explore/SKILL.md +288 -288
  9. package/.factory/skills/openspec-propose/SKILL.md +110 -110
  10. package/.github/workflows/ci.yml +110 -110
  11. package/.iflow/commands/opsx-apply.md +152 -152
  12. package/.iflow/commands/opsx-archive.md +157 -157
  13. package/.iflow/commands/opsx-explore.md +173 -173
  14. package/.iflow/commands/opsx-propose.md +106 -106
  15. package/.iflow/skills/openspec-apply-change/SKILL.md +156 -156
  16. package/.iflow/skills/openspec-archive-change/SKILL.md +114 -114
  17. package/.iflow/skills/openspec-explore/SKILL.md +288 -288
  18. package/.iflow/skills/openspec-propose/SKILL.md +110 -110
  19. package/.prettierrc +11 -11
  20. package/AGENTS.md +167 -167
  21. package/README.md +1 -1
  22. package/README.zh-CN.md +240 -240
  23. package/dist/src/cli/agents/claude-code.js +1 -1
  24. package/dist/src/cli/agents/claude-code.js.map +1 -1
  25. package/dist/src/cli/agents/cline.js +1 -1
  26. package/dist/src/cli/agents/cline.js.map +1 -1
  27. package/dist/src/cli/agents/codex.d.ts +5 -0
  28. package/dist/src/cli/agents/codex.d.ts.map +1 -0
  29. package/dist/src/cli/agents/codex.js +14 -0
  30. package/dist/src/cli/agents/codex.js.map +1 -0
  31. package/dist/src/cli/agents/cursor.js +1 -1
  32. package/dist/src/cli/agents/cursor.js.map +1 -1
  33. package/dist/src/cli/agents/factory-droid.js +1 -1
  34. package/dist/src/cli/agents/factory-droid.js.map +1 -1
  35. package/dist/src/cli/agents/gemini-cli.js +1 -1
  36. package/dist/src/cli/agents/gemini-cli.js.map +1 -1
  37. package/dist/src/cli/agents/index.d.ts +1 -0
  38. package/dist/src/cli/agents/index.d.ts.map +1 -1
  39. package/dist/src/cli/agents/index.js +3 -0
  40. package/dist/src/cli/agents/index.js.map +1 -1
  41. package/dist/src/cli/agents/windsurf.js +1 -1
  42. package/dist/src/cli/agents/windsurf.js.map +1 -1
  43. package/dist/src/cli/index.js +0 -0
  44. package/dist/src/cli/init.d.ts.map +1 -1
  45. package/dist/src/cli/init.js +36 -15
  46. package/dist/src/cli/init.js.map +1 -1
  47. package/dist/src/cli/types.d.ts +2 -2
  48. package/dist/src/cli/types.d.ts.map +1 -1
  49. package/dist/src/cli/types.js +11 -0
  50. package/dist/src/cli/types.js.map +1 -1
  51. package/package.json +16 -16
  52. package/tsconfig.json +25 -25
  53. package/tsconfig.test.json +8 -8
  54. package/vitest.config.ts +29 -29
@@ -1,155 +1,155 @@
1
- ---
2
- description: Archive a completed change in the experimental workflow
3
- argument-hint: command arguments
4
- ---
5
-
6
- Archive a completed change in the experimental workflow.
7
-
8
- **Input**: Optionally specify a change name after `/opsx:archive` (e.g., `/opsx:archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
9
-
10
- **Steps**
11
-
12
- 1. **If no change name provided, prompt for selection**
13
-
14
- Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
15
-
16
- Show only active changes (not already archived).
17
- Include the schema used for each change if available.
18
-
19
- **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
20
-
21
- 2. **Check artifact completion status**
22
-
23
- Run `openspec status --change "<name>" --json` to check artifact completion.
24
-
25
- Parse the JSON to understand:
26
- - `schemaName`: The workflow being used
27
- - `artifacts`: List of artifacts with their status (`done` or other)
28
-
29
- **If any artifacts are not `done`:**
30
- - Display warning listing incomplete artifacts
31
- - Prompt user for confirmation to continue
32
- - Proceed if user confirms
33
-
34
- 3. **Check task completion status**
35
-
36
- Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
37
-
38
- Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
39
-
40
- **If incomplete tasks found:**
41
- - Display warning showing count of incomplete tasks
42
- - Prompt user for confirmation to continue
43
- - Proceed if user confirms
44
-
45
- **If no tasks file exists:** Proceed without task-related warning.
46
-
47
- 4. **Assess delta spec sync state**
48
-
49
- Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
50
-
51
- **If delta specs exist:**
52
- - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
53
- - Determine what changes would be applied (adds, modifications, removals, renames)
54
- - Show a combined summary before prompting
55
-
56
- **Prompt options:**
57
- - If changes needed: "Sync now (recommended)", "Archive without syncing"
58
- - If already synced: "Archive now", "Sync anyway", "Cancel"
59
-
60
- If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
61
-
62
- 5. **Perform the archive**
63
-
64
- Create the archive directory if it doesn't exist:
65
- ```bash
66
- mkdir -p openspec/changes/archive
67
- ```
68
-
69
- Generate target name using current date: `YYYY-MM-DD-<change-name>`
70
-
71
- **Check if target already exists:**
72
- - If yes: Fail with error, suggest renaming existing archive or using different date
73
- - If no: Move the change directory to archive
74
-
75
- ```bash
76
- mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
77
- ```
78
-
79
- 6. **Display summary**
80
-
81
- Show archive completion summary including:
82
- - Change name
83
- - Schema that was used
84
- - Archive location
85
- - Spec sync status (synced / sync skipped / no delta specs)
86
- - Note about any warnings (incomplete artifacts/tasks)
87
-
88
- **Output On Success**
89
-
90
- ```
91
- ## Archive Complete
92
-
93
- **Change:** <change-name>
94
- **Schema:** <schema-name>
95
- **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
96
- **Specs:** ✓ Synced to main specs
97
-
98
- All artifacts complete. All tasks complete.
99
- ```
100
-
101
- **Output On Success (No Delta Specs)**
102
-
103
- ```
104
- ## Archive Complete
105
-
106
- **Change:** <change-name>
107
- **Schema:** <schema-name>
108
- **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
109
- **Specs:** No delta specs
110
-
111
- All artifacts complete. All tasks complete.
112
- ```
113
-
114
- **Output On Success With Warnings**
115
-
116
- ```
117
- ## Archive Complete (with warnings)
118
-
119
- **Change:** <change-name>
120
- **Schema:** <schema-name>
121
- **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
122
- **Specs:** Sync skipped (user chose to skip)
123
-
124
- **Warnings:**
125
- - Archived with 2 incomplete artifacts
126
- - Archived with 3 incomplete tasks
127
- - Delta spec sync was skipped (user chose to skip)
128
-
129
- Review the archive if this was not intentional.
130
- ```
131
-
132
- **Output On Error (Archive Exists)**
133
-
134
- ```
135
- ## Archive Failed
136
-
137
- **Change:** <change-name>
138
- **Target:** openspec/changes/archive/YYYY-MM-DD-<name>/
139
-
140
- Target archive directory already exists.
141
-
142
- **Options:**
143
- 1. Rename the existing archive
144
- 2. Delete the existing archive if it's a duplicate
145
- 3. Wait until a different date to archive
146
- ```
147
-
148
- **Guardrails**
149
- - Always prompt for change selection if not provided
150
- - Use artifact graph (openspec status --json) for completion checking
151
- - Don't block archive on warnings - just inform and confirm
152
- - Preserve .openspec.yaml when moving to archive (it moves with the directory)
153
- - Show clear summary of what happened
154
- - If sync is requested, use the Skill tool to invoke `openspec-sync-specs` (agent-driven)
155
- - If delta specs exist, always run the sync assessment and show the combined summary before prompting
1
+ ---
2
+ description: Archive a completed change in the experimental workflow
3
+ argument-hint: command arguments
4
+ ---
5
+
6
+ Archive a completed change in the experimental workflow.
7
+
8
+ **Input**: Optionally specify a change name after `/opsx:archive` (e.g., `/opsx:archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
9
+
10
+ **Steps**
11
+
12
+ 1. **If no change name provided, prompt for selection**
13
+
14
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
15
+
16
+ Show only active changes (not already archived).
17
+ Include the schema used for each change if available.
18
+
19
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
20
+
21
+ 2. **Check artifact completion status**
22
+
23
+ Run `openspec status --change "<name>" --json` to check artifact completion.
24
+
25
+ Parse the JSON to understand:
26
+ - `schemaName`: The workflow being used
27
+ - `artifacts`: List of artifacts with their status (`done` or other)
28
+
29
+ **If any artifacts are not `done`:**
30
+ - Display warning listing incomplete artifacts
31
+ - Prompt user for confirmation to continue
32
+ - Proceed if user confirms
33
+
34
+ 3. **Check task completion status**
35
+
36
+ Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
37
+
38
+ Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
39
+
40
+ **If incomplete tasks found:**
41
+ - Display warning showing count of incomplete tasks
42
+ - Prompt user for confirmation to continue
43
+ - Proceed if user confirms
44
+
45
+ **If no tasks file exists:** Proceed without task-related warning.
46
+
47
+ 4. **Assess delta spec sync state**
48
+
49
+ Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
50
+
51
+ **If delta specs exist:**
52
+ - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
53
+ - Determine what changes would be applied (adds, modifications, removals, renames)
54
+ - Show a combined summary before prompting
55
+
56
+ **Prompt options:**
57
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
58
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
59
+
60
+ If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
61
+
62
+ 5. **Perform the archive**
63
+
64
+ Create the archive directory if it doesn't exist:
65
+ ```bash
66
+ mkdir -p openspec/changes/archive
67
+ ```
68
+
69
+ Generate target name using current date: `YYYY-MM-DD-<change-name>`
70
+
71
+ **Check if target already exists:**
72
+ - If yes: Fail with error, suggest renaming existing archive or using different date
73
+ - If no: Move the change directory to archive
74
+
75
+ ```bash
76
+ mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
77
+ ```
78
+
79
+ 6. **Display summary**
80
+
81
+ Show archive completion summary including:
82
+ - Change name
83
+ - Schema that was used
84
+ - Archive location
85
+ - Spec sync status (synced / sync skipped / no delta specs)
86
+ - Note about any warnings (incomplete artifacts/tasks)
87
+
88
+ **Output On Success**
89
+
90
+ ```
91
+ ## Archive Complete
92
+
93
+ **Change:** <change-name>
94
+ **Schema:** <schema-name>
95
+ **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
96
+ **Specs:** ✓ Synced to main specs
97
+
98
+ All artifacts complete. All tasks complete.
99
+ ```
100
+
101
+ **Output On Success (No Delta Specs)**
102
+
103
+ ```
104
+ ## Archive Complete
105
+
106
+ **Change:** <change-name>
107
+ **Schema:** <schema-name>
108
+ **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
109
+ **Specs:** No delta specs
110
+
111
+ All artifacts complete. All tasks complete.
112
+ ```
113
+
114
+ **Output On Success With Warnings**
115
+
116
+ ```
117
+ ## Archive Complete (with warnings)
118
+
119
+ **Change:** <change-name>
120
+ **Schema:** <schema-name>
121
+ **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
122
+ **Specs:** Sync skipped (user chose to skip)
123
+
124
+ **Warnings:**
125
+ - Archived with 2 incomplete artifacts
126
+ - Archived with 3 incomplete tasks
127
+ - Delta spec sync was skipped (user chose to skip)
128
+
129
+ Review the archive if this was not intentional.
130
+ ```
131
+
132
+ **Output On Error (Archive Exists)**
133
+
134
+ ```
135
+ ## Archive Failed
136
+
137
+ **Change:** <change-name>
138
+ **Target:** openspec/changes/archive/YYYY-MM-DD-<name>/
139
+
140
+ Target archive directory already exists.
141
+
142
+ **Options:**
143
+ 1. Rename the existing archive
144
+ 2. Delete the existing archive if it's a duplicate
145
+ 3. Wait until a different date to archive
146
+ ```
147
+
148
+ **Guardrails**
149
+ - Always prompt for change selection if not provided
150
+ - Use artifact graph (openspec status --json) for completion checking
151
+ - Don't block archive on warnings - just inform and confirm
152
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
153
+ - Show clear summary of what happened
154
+ - If sync is requested, use the Skill tool to invoke `openspec-sync-specs` (agent-driven)
155
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting
@@ -1,171 +1,171 @@
1
- ---
2
- description: Enter explore mode - think through ideas, investigate problems, clarify requirements
3
- argument-hint: command arguments
4
- ---
5
-
6
- Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
7
-
8
- **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
9
-
10
- **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
11
-
12
- **Input**: The argument after `/opsx:explore` is whatever the user wants to think about. Could be:
13
- - A vague idea: "real-time collaboration"
14
- - A specific problem: "the auth system is getting unwieldy"
15
- - A change name: "add-dark-mode" (to explore in context of that change)
16
- - A comparison: "postgres vs sqlite for this"
17
- - Nothing (just enter explore mode)
18
-
19
- ---
20
-
21
- ## The Stance
22
-
23
- - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
24
- - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
25
- - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
26
- - **Adaptive** - Follow interesting threads, pivot when new information emerges
27
- - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
28
- - **Grounded** - Explore the actual codebase when relevant, don't just theorize
29
-
30
- ---
31
-
32
- ## What You Might Do
33
-
34
- Depending on what the user brings, you might:
35
-
36
- **Explore the problem space**
37
- - Ask clarifying questions that emerge from what they said
38
- - Challenge assumptions
39
- - Reframe the problem
40
- - Find analogies
41
-
42
- **Investigate the codebase**
43
- - Map existing architecture relevant to the discussion
44
- - Find integration points
45
- - Identify patterns already in use
46
- - Surface hidden complexity
47
-
48
- **Compare options**
49
- - Brainstorm multiple approaches
50
- - Build comparison tables
51
- - Sketch tradeoffs
52
- - Recommend a path (if asked)
53
-
54
- **Visualize**
55
- ```
56
- ┌─────────────────────────────────────────┐
57
- │ Use ASCII diagrams liberally │
58
- ├─────────────────────────────────────────┤
59
- │ │
60
- │ ┌────────┐ ┌────────┐ │
61
- │ │ State │────────▶│ State │ │
62
- │ │ A │ │ B │ │
63
- │ └────────┘ └────────┘ │
64
- │ │
65
- │ System diagrams, state machines, │
66
- │ data flows, architecture sketches, │
67
- │ dependency graphs, comparison tables │
68
- │ │
69
- └─────────────────────────────────────────┘
70
- ```
71
-
72
- **Surface risks and unknowns**
73
- - Identify what could go wrong
74
- - Find gaps in understanding
75
- - Suggest spikes or investigations
76
-
77
- ---
78
-
79
- ## OpenSpec Awareness
80
-
81
- You have full context of the OpenSpec system. Use it naturally, don't force it.
82
-
83
- ### Check for context
84
-
85
- At the start, quickly check what exists:
86
- ```bash
87
- openspec list --json
88
- ```
89
-
90
- This tells you:
91
- - If there are active changes
92
- - Their names, schemas, and status
93
- - What the user might be working on
94
-
95
- If the user mentioned a specific change name, read its artifacts for context.
96
-
97
- ### When no change exists
98
-
99
- Think freely. When insights crystallize, you might offer:
100
-
101
- - "This feels solid enough to start a change. Want me to create a proposal?"
102
- - Or keep exploring - no pressure to formalize
103
-
104
- ### When a change exists
105
-
106
- If the user mentions a change or you detect one is relevant:
107
-
108
- 1. **Read existing artifacts for context**
109
- - `openspec/changes/<name>/proposal.md`
110
- - `openspec/changes/<name>/design.md`
111
- - `openspec/changes/<name>/tasks.md`
112
- - etc.
113
-
114
- 2. **Reference them naturally in conversation**
115
- - "Your design mentions using Redis, but we just realized SQLite fits better..."
116
- - "The proposal scopes this to premium users, but we're now thinking everyone..."
117
-
118
- 3. **Offer to capture when decisions are made**
119
-
120
- | Insight Type | Where to Capture |
121
- |--------------|------------------|
122
- | New requirement discovered | `specs/<capability>/spec.md` |
123
- | Requirement changed | `specs/<capability>/spec.md` |
124
- | Design decision made | `design.md` |
125
- | Scope changed | `proposal.md` |
126
- | New work identified | `tasks.md` |
127
- | Assumption invalidated | Relevant artifact |
128
-
129
- Example offers:
130
- - "That's a design decision. Capture it in design.md?"
131
- - "This is a new requirement. Add it to specs?"
132
- - "This changes scope. Update the proposal?"
133
-
134
- 4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
135
-
136
- ---
137
-
138
- ## What You Don't Have To Do
139
-
140
- - Follow a script
141
- - Ask the same questions every time
142
- - Produce a specific artifact
143
- - Reach a conclusion
144
- - Stay on topic if a tangent is valuable
145
- - Be brief (this is thinking time)
146
-
147
- ---
148
-
149
- ## Ending Discovery
150
-
151
- There's no required ending. Discovery might:
152
-
153
- - **Flow into a proposal**: "Ready to start? I can create a change proposal."
154
- - **Result in artifact updates**: "Updated design.md with these decisions"
155
- - **Just provide clarity**: User has what they need, moves on
156
- - **Continue later**: "We can pick this up anytime"
157
-
158
- When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
159
-
160
- ---
161
-
162
- ## Guardrails
163
-
164
- - **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
165
- - **Don't fake understanding** - If something is unclear, dig deeper
166
- - **Don't rush** - Discovery is thinking time, not task time
167
- - **Don't force structure** - Let patterns emerge naturally
168
- - **Don't auto-capture** - Offer to save insights, don't just do it
169
- - **Do visualize** - A good diagram is worth many paragraphs
170
- - **Do explore the codebase** - Ground discussions in reality
171
- - **Do question assumptions** - Including the user's and your own
1
+ ---
2
+ description: Enter explore mode - think through ideas, investigate problems, clarify requirements
3
+ argument-hint: command arguments
4
+ ---
5
+
6
+ Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
7
+
8
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
9
+
10
+ **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
11
+
12
+ **Input**: The argument after `/opsx:explore` is whatever the user wants to think about. Could be:
13
+ - A vague idea: "real-time collaboration"
14
+ - A specific problem: "the auth system is getting unwieldy"
15
+ - A change name: "add-dark-mode" (to explore in context of that change)
16
+ - A comparison: "postgres vs sqlite for this"
17
+ - Nothing (just enter explore mode)
18
+
19
+ ---
20
+
21
+ ## The Stance
22
+
23
+ - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
24
+ - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
25
+ - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
26
+ - **Adaptive** - Follow interesting threads, pivot when new information emerges
27
+ - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
28
+ - **Grounded** - Explore the actual codebase when relevant, don't just theorize
29
+
30
+ ---
31
+
32
+ ## What You Might Do
33
+
34
+ Depending on what the user brings, you might:
35
+
36
+ **Explore the problem space**
37
+ - Ask clarifying questions that emerge from what they said
38
+ - Challenge assumptions
39
+ - Reframe the problem
40
+ - Find analogies
41
+
42
+ **Investigate the codebase**
43
+ - Map existing architecture relevant to the discussion
44
+ - Find integration points
45
+ - Identify patterns already in use
46
+ - Surface hidden complexity
47
+
48
+ **Compare options**
49
+ - Brainstorm multiple approaches
50
+ - Build comparison tables
51
+ - Sketch tradeoffs
52
+ - Recommend a path (if asked)
53
+
54
+ **Visualize**
55
+ ```
56
+ ┌─────────────────────────────────────────┐
57
+ │ Use ASCII diagrams liberally │
58
+ ├─────────────────────────────────────────┤
59
+ │ │
60
+ │ ┌────────┐ ┌────────┐ │
61
+ │ │ State │────────▶│ State │ │
62
+ │ │ A │ │ B │ │
63
+ │ └────────┘ └────────┘ │
64
+ │ │
65
+ │ System diagrams, state machines, │
66
+ │ data flows, architecture sketches, │
67
+ │ dependency graphs, comparison tables │
68
+ │ │
69
+ └─────────────────────────────────────────┘
70
+ ```
71
+
72
+ **Surface risks and unknowns**
73
+ - Identify what could go wrong
74
+ - Find gaps in understanding
75
+ - Suggest spikes or investigations
76
+
77
+ ---
78
+
79
+ ## OpenSpec Awareness
80
+
81
+ You have full context of the OpenSpec system. Use it naturally, don't force it.
82
+
83
+ ### Check for context
84
+
85
+ At the start, quickly check what exists:
86
+ ```bash
87
+ openspec list --json
88
+ ```
89
+
90
+ This tells you:
91
+ - If there are active changes
92
+ - Their names, schemas, and status
93
+ - What the user might be working on
94
+
95
+ If the user mentioned a specific change name, read its artifacts for context.
96
+
97
+ ### When no change exists
98
+
99
+ Think freely. When insights crystallize, you might offer:
100
+
101
+ - "This feels solid enough to start a change. Want me to create a proposal?"
102
+ - Or keep exploring - no pressure to formalize
103
+
104
+ ### When a change exists
105
+
106
+ If the user mentions a change or you detect one is relevant:
107
+
108
+ 1. **Read existing artifacts for context**
109
+ - `openspec/changes/<name>/proposal.md`
110
+ - `openspec/changes/<name>/design.md`
111
+ - `openspec/changes/<name>/tasks.md`
112
+ - etc.
113
+
114
+ 2. **Reference them naturally in conversation**
115
+ - "Your design mentions using Redis, but we just realized SQLite fits better..."
116
+ - "The proposal scopes this to premium users, but we're now thinking everyone..."
117
+
118
+ 3. **Offer to capture when decisions are made**
119
+
120
+ | Insight Type | Where to Capture |
121
+ |--------------|------------------|
122
+ | New requirement discovered | `specs/<capability>/spec.md` |
123
+ | Requirement changed | `specs/<capability>/spec.md` |
124
+ | Design decision made | `design.md` |
125
+ | Scope changed | `proposal.md` |
126
+ | New work identified | `tasks.md` |
127
+ | Assumption invalidated | Relevant artifact |
128
+
129
+ Example offers:
130
+ - "That's a design decision. Capture it in design.md?"
131
+ - "This is a new requirement. Add it to specs?"
132
+ - "This changes scope. Update the proposal?"
133
+
134
+ 4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
135
+
136
+ ---
137
+
138
+ ## What You Don't Have To Do
139
+
140
+ - Follow a script
141
+ - Ask the same questions every time
142
+ - Produce a specific artifact
143
+ - Reach a conclusion
144
+ - Stay on topic if a tangent is valuable
145
+ - Be brief (this is thinking time)
146
+
147
+ ---
148
+
149
+ ## Ending Discovery
150
+
151
+ There's no required ending. Discovery might:
152
+
153
+ - **Flow into a proposal**: "Ready to start? I can create a change proposal."
154
+ - **Result in artifact updates**: "Updated design.md with these decisions"
155
+ - **Just provide clarity**: User has what they need, moves on
156
+ - **Continue later**: "We can pick this up anytime"
157
+
158
+ When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
159
+
160
+ ---
161
+
162
+ ## Guardrails
163
+
164
+ - **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
165
+ - **Don't fake understanding** - If something is unclear, dig deeper
166
+ - **Don't rush** - Discovery is thinking time, not task time
167
+ - **Don't force structure** - Let patterns emerge naturally
168
+ - **Don't auto-capture** - Offer to save insights, don't just do it
169
+ - **Do visualize** - A good diagram is worth many paragraphs
170
+ - **Do explore the codebase** - Ground discussions in reality
171
+ - **Do question assumptions** - Including the user's and your own