@synth-coder/memhub 0.2.3 → 0.2.4
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/.eslintrc.cjs +45 -45
- package/.factory/commands/opsx-apply.md +150 -150
- package/.factory/commands/opsx-archive.md +155 -155
- package/.factory/commands/opsx-explore.md +171 -171
- package/.factory/commands/opsx-propose.md +104 -104
- package/.factory/skills/openspec-apply-change/SKILL.md +156 -156
- package/.factory/skills/openspec-archive-change/SKILL.md +114 -114
- package/.factory/skills/openspec-explore/SKILL.md +288 -288
- package/.factory/skills/openspec-propose/SKILL.md +110 -110
- package/.github/workflows/ci.yml +110 -74
- package/.github/workflows/release.yml +67 -0
- package/.iflow/commands/opsx-apply.md +152 -152
- package/.iflow/commands/opsx-archive.md +157 -157
- package/.iflow/commands/opsx-explore.md +173 -173
- package/.iflow/commands/opsx-propose.md +106 -106
- package/.iflow/skills/openspec-apply-change/SKILL.md +156 -156
- package/.iflow/skills/openspec-archive-change/SKILL.md +114 -114
- package/.iflow/skills/openspec-explore/SKILL.md +288 -288
- package/.iflow/skills/openspec-propose/SKILL.md +110 -110
- package/.prettierrc +11 -11
- package/AGENTS.md +167 -169
- package/README.md +276 -195
- package/README.zh-CN.md +245 -193
- package/dist/src/cli/agents/claude-code.d.ts +5 -0
- package/dist/src/cli/agents/claude-code.d.ts.map +1 -0
- package/dist/src/cli/agents/claude-code.js +14 -0
- package/dist/src/cli/agents/claude-code.js.map +1 -0
- package/dist/src/cli/agents/cline.d.ts +5 -0
- package/dist/src/cli/agents/cline.d.ts.map +1 -0
- package/dist/src/cli/agents/cline.js +14 -0
- package/dist/src/cli/agents/cline.js.map +1 -0
- package/dist/src/cli/agents/codex.d.ts +5 -0
- package/dist/src/cli/agents/codex.d.ts.map +1 -0
- package/dist/src/cli/agents/codex.js +14 -0
- package/dist/src/cli/agents/codex.js.map +1 -0
- package/dist/src/cli/agents/cursor.d.ts +5 -0
- package/dist/src/cli/agents/cursor.d.ts.map +1 -0
- package/dist/src/cli/agents/cursor.js +14 -0
- package/dist/src/cli/agents/cursor.js.map +1 -0
- package/dist/src/cli/agents/factory-droid.d.ts +5 -0
- package/dist/src/cli/agents/factory-droid.d.ts.map +1 -0
- package/dist/src/cli/agents/factory-droid.js +14 -0
- package/dist/src/cli/agents/factory-droid.js.map +1 -0
- package/dist/src/cli/agents/gemini-cli.d.ts +5 -0
- package/dist/src/cli/agents/gemini-cli.d.ts.map +1 -0
- package/dist/src/cli/agents/gemini-cli.js +14 -0
- package/dist/src/cli/agents/gemini-cli.js.map +1 -0
- package/dist/src/cli/agents/index.d.ts +14 -0
- package/dist/src/cli/agents/index.d.ts.map +1 -0
- package/dist/src/cli/agents/index.js +30 -0
- package/dist/src/cli/agents/index.js.map +1 -0
- package/dist/src/cli/agents/windsurf.d.ts +5 -0
- package/dist/src/cli/agents/windsurf.d.ts.map +1 -0
- package/dist/src/cli/agents/windsurf.js +14 -0
- package/dist/src/cli/agents/windsurf.js.map +1 -0
- package/dist/src/cli/index.d.ts +8 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +168 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/init.d.ts +34 -0
- package/dist/src/cli/init.d.ts.map +1 -0
- package/dist/src/cli/init.js +160 -0
- package/dist/src/cli/init.js.map +1 -0
- package/dist/src/cli/instructions.d.ts +29 -0
- package/dist/src/cli/instructions.d.ts.map +1 -0
- package/dist/src/cli/instructions.js +141 -0
- package/dist/src/cli/instructions.js.map +1 -0
- package/dist/src/cli/types.d.ts +22 -0
- package/dist/src/cli/types.d.ts.map +1 -0
- package/dist/src/cli/types.js +86 -0
- package/dist/src/cli/types.js.map +1 -0
- package/dist/src/contracts/mcp.js +34 -34
- package/dist/src/contracts/schemas.js.map +1 -1
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/server/mcp-server.js +7 -14
- package/dist/src/server/mcp-server.js.map +1 -1
- package/dist/src/services/embedding-service.d.ts.map +1 -1
- package/dist/src/services/embedding-service.js +1 -1
- package/dist/src/services/embedding-service.js.map +1 -1
- package/dist/src/services/memory-service.d.ts.map +1 -1
- package/dist/src/services/memory-service.js.map +1 -1
- package/dist/src/storage/markdown-storage.d.ts.map +1 -1
- package/dist/src/storage/markdown-storage.js +1 -1
- package/dist/src/storage/markdown-storage.js.map +1 -1
- package/dist/src/storage/vector-index.d.ts.map +1 -1
- package/dist/src/storage/vector-index.js +4 -5
- package/dist/src/storage/vector-index.js.map +1 -1
- package/docs/README.md +21 -0
- package/docs/mcp-tools.md +136 -0
- package/docs/user-guide.md +182 -0
- package/package.json +61 -59
- package/src/cli/agents/claude-code.ts +14 -0
- package/src/cli/agents/cline.ts +14 -0
- package/src/cli/agents/codex.ts +14 -0
- package/src/cli/agents/cursor.ts +14 -0
- package/src/cli/agents/factory-droid.ts +14 -0
- package/src/cli/agents/gemini-cli.ts +14 -0
- package/src/cli/agents/index.ts +36 -0
- package/src/cli/agents/windsurf.ts +14 -0
- package/src/cli/index.ts +192 -0
- package/src/cli/init.ts +218 -0
- package/src/cli/instructions.ts +156 -0
- package/src/cli/types.ts +112 -0
- package/src/contracts/index.ts +12 -12
- package/src/contracts/mcp.ts +223 -223
- package/src/contracts/schemas.ts +307 -307
- package/src/contracts/types.ts +410 -410
- package/src/index.ts +8 -8
- package/src/server/index.ts +5 -5
- package/src/server/mcp-server.ts +169 -186
- package/src/services/embedding-service.ts +114 -114
- package/src/services/index.ts +5 -5
- package/src/services/memory-service.ts +656 -663
- package/src/storage/frontmatter-parser.ts +243 -243
- package/src/storage/index.ts +6 -6
- package/src/storage/markdown-storage.ts +228 -236
- package/src/storage/vector-index.ts +159 -160
- package/src/utils/index.ts +5 -5
- package/src/utils/slugify.ts +63 -63
- package/test/cli/init.test.ts +380 -0
- package/test/contracts/schemas.test.ts +313 -313
- package/test/contracts/types.test.ts +21 -21
- package/test/frontmatter-parser-more.test.ts +94 -94
- package/test/server/mcp-server.test.ts +211 -210
- package/test/services/memory-service-edge.test.ts +248 -248
- package/test/services/memory-service.test.ts +291 -279
- package/test/storage/frontmatter-parser.test.ts +223 -223
- package/test/storage/markdown-storage.test.ts +226 -217
- package/test/storage/storage-edge.test.ts +238 -238
- package/test/storage/vector-index.test.ts +149 -153
- package/test/utils/slugify-edge.test.ts +94 -94
- package/test/utils/slugify.test.ts +72 -68
- package/tsconfig.json +25 -25
- package/tsconfig.test.json +8 -8
- package/vitest.config.ts +29 -29
- package/docs/architecture-diagrams.md +0 -368
- package/docs/architecture.md +0 -381
- package/docs/contracts.md +0 -190
- package/docs/prompt-template.md +0 -33
- package/docs/proposals/mcp-typescript-sdk-refactor.md +0 -568
- package/docs/proposals/proposal-close-gates.md +0 -58
- package/docs/tool-calling-policy.md +0 -101
- package/docs/vector-search.md +0 -306
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: openspec-apply-change
|
|
3
|
-
description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
|
|
4
|
-
license: MIT
|
|
5
|
-
compatibility: Requires openspec CLI.
|
|
6
|
-
metadata:
|
|
7
|
-
author: openspec
|
|
8
|
-
version: "1.0"
|
|
9
|
-
generatedBy: "1.2.0"
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
Implement tasks from an OpenSpec change.
|
|
13
|
-
|
|
14
|
-
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
15
|
-
|
|
16
|
-
**Steps**
|
|
17
|
-
|
|
18
|
-
1. **Select the change**
|
|
19
|
-
|
|
20
|
-
If a name is provided, use it. Otherwise:
|
|
21
|
-
- Infer from conversation context if the user mentioned a change
|
|
22
|
-
- Auto-select if only one active change exists
|
|
23
|
-
- If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
|
|
24
|
-
|
|
25
|
-
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
|
|
26
|
-
|
|
27
|
-
2. **Check status to understand the schema**
|
|
28
|
-
```bash
|
|
29
|
-
openspec status --change "<name>" --json
|
|
30
|
-
```
|
|
31
|
-
Parse the JSON to understand:
|
|
32
|
-
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
|
33
|
-
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
|
34
|
-
|
|
35
|
-
3. **Get apply instructions**
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
openspec instructions apply --change "<name>" --json
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
This returns:
|
|
42
|
-
- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
|
43
|
-
- Progress (total, complete, remaining)
|
|
44
|
-
- Task list with status
|
|
45
|
-
- Dynamic instruction based on current state
|
|
46
|
-
|
|
47
|
-
**Handle states:**
|
|
48
|
-
- If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
|
|
49
|
-
- If `state: "all_done"`: congratulate, suggest archive
|
|
50
|
-
- Otherwise: proceed to implementation
|
|
51
|
-
|
|
52
|
-
4. **Read context files**
|
|
53
|
-
|
|
54
|
-
Read the files listed in `contextFiles` from the apply instructions output.
|
|
55
|
-
The files depend on the schema being used:
|
|
56
|
-
- **spec-driven**: proposal, specs, design, tasks
|
|
57
|
-
- Other schemas: follow the contextFiles from CLI output
|
|
58
|
-
|
|
59
|
-
5. **Show current progress**
|
|
60
|
-
|
|
61
|
-
Display:
|
|
62
|
-
- Schema being used
|
|
63
|
-
- Progress: "N/M tasks complete"
|
|
64
|
-
- Remaining tasks overview
|
|
65
|
-
- Dynamic instruction from CLI
|
|
66
|
-
|
|
67
|
-
6. **Implement tasks (loop until done or blocked)**
|
|
68
|
-
|
|
69
|
-
For each pending task:
|
|
70
|
-
- Show which task is being worked on
|
|
71
|
-
- Make the code changes required
|
|
72
|
-
- Keep changes minimal and focused
|
|
73
|
-
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
|
74
|
-
- Continue to next task
|
|
75
|
-
|
|
76
|
-
**Pause if:**
|
|
77
|
-
- Task is unclear → ask for clarification
|
|
78
|
-
- Implementation reveals a design issue → suggest updating artifacts
|
|
79
|
-
- Error or blocker encountered → report and wait for guidance
|
|
80
|
-
- User interrupts
|
|
81
|
-
|
|
82
|
-
7. **On completion or pause, show status**
|
|
83
|
-
|
|
84
|
-
Display:
|
|
85
|
-
- Tasks completed this session
|
|
86
|
-
- Overall progress: "N/M tasks complete"
|
|
87
|
-
- If all done: suggest archive
|
|
88
|
-
- If paused: explain why and wait for guidance
|
|
89
|
-
|
|
90
|
-
**Output During Implementation**
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
## Implementing: <change-name> (schema: <schema-name>)
|
|
94
|
-
|
|
95
|
-
Working on task 3/7: <task description>
|
|
96
|
-
[...implementation happening...]
|
|
97
|
-
✓ Task complete
|
|
98
|
-
|
|
99
|
-
Working on task 4/7: <task description>
|
|
100
|
-
[...implementation happening...]
|
|
101
|
-
✓ Task complete
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Output On Completion**
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
## Implementation Complete
|
|
108
|
-
|
|
109
|
-
**Change:** <change-name>
|
|
110
|
-
**Schema:** <schema-name>
|
|
111
|
-
**Progress:** 7/7 tasks complete ✓
|
|
112
|
-
|
|
113
|
-
### Completed This Session
|
|
114
|
-
- [x] Task 1
|
|
115
|
-
- [x] Task 2
|
|
116
|
-
...
|
|
117
|
-
|
|
118
|
-
All tasks complete! Ready to archive this change.
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**Output On Pause (Issue Encountered)**
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
## Implementation Paused
|
|
125
|
-
|
|
126
|
-
**Change:** <change-name>
|
|
127
|
-
**Schema:** <schema-name>
|
|
128
|
-
**Progress:** 4/7 tasks complete
|
|
129
|
-
|
|
130
|
-
### Issue Encountered
|
|
131
|
-
<description of the issue>
|
|
132
|
-
|
|
133
|
-
**Options:**
|
|
134
|
-
1. <option 1>
|
|
135
|
-
2. <option 2>
|
|
136
|
-
3. Other approach
|
|
137
|
-
|
|
138
|
-
What would you like to do?
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Guardrails**
|
|
142
|
-
- Keep going through tasks until done or blocked
|
|
143
|
-
- Always read context files before starting (from the apply instructions output)
|
|
144
|
-
- If task is ambiguous, pause and ask before implementing
|
|
145
|
-
- If implementation reveals issues, pause and suggest artifact updates
|
|
146
|
-
- Keep code changes minimal and scoped to each task
|
|
147
|
-
- Update task checkbox immediately after completing each task
|
|
148
|
-
- Pause on errors, blockers, or unclear requirements - don't guess
|
|
149
|
-
- Use contextFiles from CLI output, don't assume specific file names
|
|
150
|
-
|
|
151
|
-
**Fluid Workflow Integration**
|
|
152
|
-
|
|
153
|
-
This skill supports the "actions on a change" model:
|
|
154
|
-
|
|
155
|
-
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
|
156
|
-
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
|
1
|
+
---
|
|
2
|
+
name: openspec-apply-change
|
|
3
|
+
description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires openspec CLI.
|
|
6
|
+
metadata:
|
|
7
|
+
author: openspec
|
|
8
|
+
version: "1.0"
|
|
9
|
+
generatedBy: "1.2.0"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Implement tasks from an OpenSpec change.
|
|
13
|
+
|
|
14
|
+
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
|
|
18
|
+
1. **Select the change**
|
|
19
|
+
|
|
20
|
+
If a name is provided, use it. Otherwise:
|
|
21
|
+
- Infer from conversation context if the user mentioned a change
|
|
22
|
+
- Auto-select if only one active change exists
|
|
23
|
+
- If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
|
|
24
|
+
|
|
25
|
+
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
|
|
26
|
+
|
|
27
|
+
2. **Check status to understand the schema**
|
|
28
|
+
```bash
|
|
29
|
+
openspec status --change "<name>" --json
|
|
30
|
+
```
|
|
31
|
+
Parse the JSON to understand:
|
|
32
|
+
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
|
33
|
+
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
|
34
|
+
|
|
35
|
+
3. **Get apply instructions**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
openspec instructions apply --change "<name>" --json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This returns:
|
|
42
|
+
- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
|
43
|
+
- Progress (total, complete, remaining)
|
|
44
|
+
- Task list with status
|
|
45
|
+
- Dynamic instruction based on current state
|
|
46
|
+
|
|
47
|
+
**Handle states:**
|
|
48
|
+
- If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
|
|
49
|
+
- If `state: "all_done"`: congratulate, suggest archive
|
|
50
|
+
- Otherwise: proceed to implementation
|
|
51
|
+
|
|
52
|
+
4. **Read context files**
|
|
53
|
+
|
|
54
|
+
Read the files listed in `contextFiles` from the apply instructions output.
|
|
55
|
+
The files depend on the schema being used:
|
|
56
|
+
- **spec-driven**: proposal, specs, design, tasks
|
|
57
|
+
- Other schemas: follow the contextFiles from CLI output
|
|
58
|
+
|
|
59
|
+
5. **Show current progress**
|
|
60
|
+
|
|
61
|
+
Display:
|
|
62
|
+
- Schema being used
|
|
63
|
+
- Progress: "N/M tasks complete"
|
|
64
|
+
- Remaining tasks overview
|
|
65
|
+
- Dynamic instruction from CLI
|
|
66
|
+
|
|
67
|
+
6. **Implement tasks (loop until done or blocked)**
|
|
68
|
+
|
|
69
|
+
For each pending task:
|
|
70
|
+
- Show which task is being worked on
|
|
71
|
+
- Make the code changes required
|
|
72
|
+
- Keep changes minimal and focused
|
|
73
|
+
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
|
74
|
+
- Continue to next task
|
|
75
|
+
|
|
76
|
+
**Pause if:**
|
|
77
|
+
- Task is unclear → ask for clarification
|
|
78
|
+
- Implementation reveals a design issue → suggest updating artifacts
|
|
79
|
+
- Error or blocker encountered → report and wait for guidance
|
|
80
|
+
- User interrupts
|
|
81
|
+
|
|
82
|
+
7. **On completion or pause, show status**
|
|
83
|
+
|
|
84
|
+
Display:
|
|
85
|
+
- Tasks completed this session
|
|
86
|
+
- Overall progress: "N/M tasks complete"
|
|
87
|
+
- If all done: suggest archive
|
|
88
|
+
- If paused: explain why and wait for guidance
|
|
89
|
+
|
|
90
|
+
**Output During Implementation**
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
## Implementing: <change-name> (schema: <schema-name>)
|
|
94
|
+
|
|
95
|
+
Working on task 3/7: <task description>
|
|
96
|
+
[...implementation happening...]
|
|
97
|
+
✓ Task complete
|
|
98
|
+
|
|
99
|
+
Working on task 4/7: <task description>
|
|
100
|
+
[...implementation happening...]
|
|
101
|
+
✓ Task complete
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Output On Completion**
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
## Implementation Complete
|
|
108
|
+
|
|
109
|
+
**Change:** <change-name>
|
|
110
|
+
**Schema:** <schema-name>
|
|
111
|
+
**Progress:** 7/7 tasks complete ✓
|
|
112
|
+
|
|
113
|
+
### Completed This Session
|
|
114
|
+
- [x] Task 1
|
|
115
|
+
- [x] Task 2
|
|
116
|
+
...
|
|
117
|
+
|
|
118
|
+
All tasks complete! Ready to archive this change.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Output On Pause (Issue Encountered)**
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
## Implementation Paused
|
|
125
|
+
|
|
126
|
+
**Change:** <change-name>
|
|
127
|
+
**Schema:** <schema-name>
|
|
128
|
+
**Progress:** 4/7 tasks complete
|
|
129
|
+
|
|
130
|
+
### Issue Encountered
|
|
131
|
+
<description of the issue>
|
|
132
|
+
|
|
133
|
+
**Options:**
|
|
134
|
+
1. <option 1>
|
|
135
|
+
2. <option 2>
|
|
136
|
+
3. Other approach
|
|
137
|
+
|
|
138
|
+
What would you like to do?
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Guardrails**
|
|
142
|
+
- Keep going through tasks until done or blocked
|
|
143
|
+
- Always read context files before starting (from the apply instructions output)
|
|
144
|
+
- If task is ambiguous, pause and ask before implementing
|
|
145
|
+
- If implementation reveals issues, pause and suggest artifact updates
|
|
146
|
+
- Keep code changes minimal and scoped to each task
|
|
147
|
+
- Update task checkbox immediately after completing each task
|
|
148
|
+
- Pause on errors, blockers, or unclear requirements - don't guess
|
|
149
|
+
- Use contextFiles from CLI output, don't assume specific file names
|
|
150
|
+
|
|
151
|
+
**Fluid Workflow Integration**
|
|
152
|
+
|
|
153
|
+
This skill supports the "actions on a change" model:
|
|
154
|
+
|
|
155
|
+
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
|
156
|
+
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: openspec-archive-change
|
|
3
|
-
description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
|
|
4
|
-
license: MIT
|
|
5
|
-
compatibility: Requires openspec CLI.
|
|
6
|
-
metadata:
|
|
7
|
-
author: openspec
|
|
8
|
-
version: "1.0"
|
|
9
|
-
generatedBy: "1.2.0"
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
Archive a completed change in the experimental workflow.
|
|
13
|
-
|
|
14
|
-
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
15
|
-
|
|
16
|
-
**Steps**
|
|
17
|
-
|
|
18
|
-
1. **If no change name provided, prompt for selection**
|
|
19
|
-
|
|
20
|
-
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
21
|
-
|
|
22
|
-
Show only active changes (not already archived).
|
|
23
|
-
Include the schema used for each change if available.
|
|
24
|
-
|
|
25
|
-
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
26
|
-
|
|
27
|
-
2. **Check artifact completion status**
|
|
28
|
-
|
|
29
|
-
Run `openspec status --change "<name>" --json` to check artifact completion.
|
|
30
|
-
|
|
31
|
-
Parse the JSON to understand:
|
|
32
|
-
- `schemaName`: The workflow being used
|
|
33
|
-
- `artifacts`: List of artifacts with their status (`done` or other)
|
|
34
|
-
|
|
35
|
-
**If any artifacts are not `done`:**
|
|
36
|
-
- Display warning listing incomplete artifacts
|
|
37
|
-
- Use **AskUserQuestion tool** to confirm user wants to proceed
|
|
38
|
-
- Proceed if user confirms
|
|
39
|
-
|
|
40
|
-
3. **Check task completion status**
|
|
41
|
-
|
|
42
|
-
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
|
|
43
|
-
|
|
44
|
-
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
|
|
45
|
-
|
|
46
|
-
**If incomplete tasks found:**
|
|
47
|
-
- Display warning showing count of incomplete tasks
|
|
48
|
-
- Use **AskUserQuestion tool** to confirm user wants to proceed
|
|
49
|
-
- Proceed if user confirms
|
|
50
|
-
|
|
51
|
-
**If no tasks file exists:** Proceed without task-related warning.
|
|
52
|
-
|
|
53
|
-
4. **Assess delta spec sync state**
|
|
54
|
-
|
|
55
|
-
Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
|
|
56
|
-
|
|
57
|
-
**If delta specs exist:**
|
|
58
|
-
- Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
|
|
59
|
-
- Determine what changes would be applied (adds, modifications, removals, renames)
|
|
60
|
-
- Show a combined summary before prompting
|
|
61
|
-
|
|
62
|
-
**Prompt options:**
|
|
63
|
-
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
|
64
|
-
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
|
65
|
-
|
|
66
|
-
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.
|
|
67
|
-
|
|
68
|
-
5. **Perform the archive**
|
|
69
|
-
|
|
70
|
-
Create the archive directory if it doesn't exist:
|
|
71
|
-
```bash
|
|
72
|
-
mkdir -p openspec/changes/archive
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Generate target name using current date: `YYYY-MM-DD-<change-name>`
|
|
76
|
-
|
|
77
|
-
**Check if target already exists:**
|
|
78
|
-
- If yes: Fail with error, suggest renaming existing archive or using different date
|
|
79
|
-
- If no: Move the change directory to archive
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
6. **Display summary**
|
|
86
|
-
|
|
87
|
-
Show archive completion summary including:
|
|
88
|
-
- Change name
|
|
89
|
-
- Schema that was used
|
|
90
|
-
- Archive location
|
|
91
|
-
- Whether specs were synced (if applicable)
|
|
92
|
-
- Note about any warnings (incomplete artifacts/tasks)
|
|
93
|
-
|
|
94
|
-
**Output On Success**
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
## Archive Complete
|
|
98
|
-
|
|
99
|
-
**Change:** <change-name>
|
|
100
|
-
**Schema:** <schema-name>
|
|
101
|
-
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
|
102
|
-
**Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
|
|
103
|
-
|
|
104
|
-
All artifacts complete. All tasks complete.
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Guardrails**
|
|
108
|
-
- Always prompt for change selection if not provided
|
|
109
|
-
- Use artifact graph (openspec status --json) for completion checking
|
|
110
|
-
- Don't block archive on warnings - just inform and confirm
|
|
111
|
-
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
|
112
|
-
- Show clear summary of what happened
|
|
113
|
-
- If sync is requested, use openspec-sync-specs approach (agent-driven)
|
|
114
|
-
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
|
1
|
+
---
|
|
2
|
+
name: openspec-archive-change
|
|
3
|
+
description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires openspec CLI.
|
|
6
|
+
metadata:
|
|
7
|
+
author: openspec
|
|
8
|
+
version: "1.0"
|
|
9
|
+
generatedBy: "1.2.0"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Archive a completed change in the experimental workflow.
|
|
13
|
+
|
|
14
|
+
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
|
|
18
|
+
1. **If no change name provided, prompt for selection**
|
|
19
|
+
|
|
20
|
+
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
21
|
+
|
|
22
|
+
Show only active changes (not already archived).
|
|
23
|
+
Include the schema used for each change if available.
|
|
24
|
+
|
|
25
|
+
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
26
|
+
|
|
27
|
+
2. **Check artifact completion status**
|
|
28
|
+
|
|
29
|
+
Run `openspec status --change "<name>" --json` to check artifact completion.
|
|
30
|
+
|
|
31
|
+
Parse the JSON to understand:
|
|
32
|
+
- `schemaName`: The workflow being used
|
|
33
|
+
- `artifacts`: List of artifacts with their status (`done` or other)
|
|
34
|
+
|
|
35
|
+
**If any artifacts are not `done`:**
|
|
36
|
+
- Display warning listing incomplete artifacts
|
|
37
|
+
- Use **AskUserQuestion tool** to confirm user wants to proceed
|
|
38
|
+
- Proceed if user confirms
|
|
39
|
+
|
|
40
|
+
3. **Check task completion status**
|
|
41
|
+
|
|
42
|
+
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
|
|
43
|
+
|
|
44
|
+
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
|
|
45
|
+
|
|
46
|
+
**If incomplete tasks found:**
|
|
47
|
+
- Display warning showing count of incomplete tasks
|
|
48
|
+
- Use **AskUserQuestion tool** to confirm user wants to proceed
|
|
49
|
+
- Proceed if user confirms
|
|
50
|
+
|
|
51
|
+
**If no tasks file exists:** Proceed without task-related warning.
|
|
52
|
+
|
|
53
|
+
4. **Assess delta spec sync state**
|
|
54
|
+
|
|
55
|
+
Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
|
|
56
|
+
|
|
57
|
+
**If delta specs exist:**
|
|
58
|
+
- Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
|
|
59
|
+
- Determine what changes would be applied (adds, modifications, removals, renames)
|
|
60
|
+
- Show a combined summary before prompting
|
|
61
|
+
|
|
62
|
+
**Prompt options:**
|
|
63
|
+
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
|
64
|
+
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
|
65
|
+
|
|
66
|
+
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.
|
|
67
|
+
|
|
68
|
+
5. **Perform the archive**
|
|
69
|
+
|
|
70
|
+
Create the archive directory if it doesn't exist:
|
|
71
|
+
```bash
|
|
72
|
+
mkdir -p openspec/changes/archive
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Generate target name using current date: `YYYY-MM-DD-<change-name>`
|
|
76
|
+
|
|
77
|
+
**Check if target already exists:**
|
|
78
|
+
- If yes: Fail with error, suggest renaming existing archive or using different date
|
|
79
|
+
- If no: Move the change directory to archive
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
6. **Display summary**
|
|
86
|
+
|
|
87
|
+
Show archive completion summary including:
|
|
88
|
+
- Change name
|
|
89
|
+
- Schema that was used
|
|
90
|
+
- Archive location
|
|
91
|
+
- Whether specs were synced (if applicable)
|
|
92
|
+
- Note about any warnings (incomplete artifacts/tasks)
|
|
93
|
+
|
|
94
|
+
**Output On Success**
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
## Archive Complete
|
|
98
|
+
|
|
99
|
+
**Change:** <change-name>
|
|
100
|
+
**Schema:** <schema-name>
|
|
101
|
+
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
|
102
|
+
**Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
|
|
103
|
+
|
|
104
|
+
All artifacts complete. All tasks complete.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Guardrails**
|
|
108
|
+
- Always prompt for change selection if not provided
|
|
109
|
+
- Use artifact graph (openspec status --json) for completion checking
|
|
110
|
+
- Don't block archive on warnings - just inform and confirm
|
|
111
|
+
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
|
112
|
+
- Show clear summary of what happened
|
|
113
|
+
- If sync is requested, use openspec-sync-specs approach (agent-driven)
|
|
114
|
+
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|