@prmichaelsen/remember-mcp 3.15.3 → 3.15.5

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 (132) hide show
  1. package/AGENT.md +363 -5
  2. package/CHANGELOG.md +7 -0
  3. package/agent/commands/acp.clarification-capture.md +386 -0
  4. package/agent/commands/acp.clarification-create.md +50 -0
  5. package/agent/commands/acp.command-create.md +60 -0
  6. package/agent/commands/acp.design-create.md +62 -0
  7. package/agent/commands/acp.design-reference.md +355 -0
  8. package/agent/commands/acp.index.md +423 -0
  9. package/agent/commands/acp.init.md +48 -0
  10. package/agent/commands/acp.package-create.md +1 -0
  11. package/agent/commands/acp.package-info.md +1 -0
  12. package/agent/commands/acp.package-install.md +19 -0
  13. package/agent/commands/acp.package-list.md +1 -0
  14. package/agent/commands/acp.package-publish.md +1 -0
  15. package/agent/commands/acp.package-remove.md +1 -0
  16. package/agent/commands/acp.package-search.md +1 -0
  17. package/agent/commands/acp.package-update.md +1 -0
  18. package/agent/commands/acp.package-validate.md +1 -0
  19. package/agent/commands/acp.pattern-create.md +60 -0
  20. package/agent/commands/acp.plan.md +25 -0
  21. package/agent/commands/acp.proceed.md +621 -75
  22. package/agent/commands/acp.project-create.md +3 -0
  23. package/agent/commands/acp.project-info.md +3 -0
  24. package/agent/commands/acp.project-list.md +3 -1
  25. package/agent/commands/acp.project-set.md +1 -0
  26. package/agent/commands/acp.project-update.md +14 -3
  27. package/agent/commands/acp.projects-restore.md +228 -0
  28. package/agent/commands/acp.projects-sync.md +347 -0
  29. package/agent/commands/acp.report.md +13 -0
  30. package/agent/commands/acp.resume.md +3 -1
  31. package/agent/commands/acp.sessions.md +301 -0
  32. package/agent/commands/acp.status.md +13 -0
  33. package/agent/commands/acp.sync.md +1 -0
  34. package/agent/commands/acp.task-create.md +105 -3
  35. package/agent/commands/acp.update.md +1 -0
  36. package/agent/commands/acp.validate.md +32 -2
  37. package/agent/commands/acp.version-check-for-updates.md +1 -0
  38. package/agent/commands/acp.version-check.md +1 -0
  39. package/agent/commands/acp.version-update.md +1 -0
  40. package/agent/commands/command.template.md +23 -0
  41. package/agent/commands/git.commit.md +1 -0
  42. package/agent/commands/git.init.md +1 -0
  43. package/agent/design/complete-tool-set.md +157 -233
  44. package/agent/design/design.template.md +18 -0
  45. package/agent/design/user-preferences.md +11 -7
  46. package/agent/milestones/milestone-19-new-search-ghost-tools.md +46 -0
  47. package/agent/package.template.yaml +50 -0
  48. package/agent/patterns/pattern.template.md +18 -0
  49. package/agent/progress.yaml +162 -6
  50. package/agent/scripts/acp.common.sh +258 -15
  51. package/agent/scripts/acp.install.sh +91 -4
  52. package/agent/scripts/acp.package-create.sh +0 -1
  53. package/agent/scripts/acp.package-info.sh +19 -1
  54. package/agent/scripts/acp.package-install-optimized.sh +1 -1
  55. package/agent/scripts/acp.package-install.sh +388 -38
  56. package/agent/scripts/acp.package-list.sh +52 -4
  57. package/agent/scripts/acp.package-remove.sh +77 -1
  58. package/agent/scripts/acp.package-search.sh +2 -2
  59. package/agent/scripts/acp.package-update.sh +91 -12
  60. package/agent/scripts/acp.package-validate.sh +136 -1
  61. package/agent/scripts/acp.project-info.sh +34 -11
  62. package/agent/scripts/acp.project-list.sh +4 -0
  63. package/agent/scripts/acp.project-update.sh +66 -19
  64. package/agent/scripts/acp.projects-restore.sh +170 -0
  65. package/agent/scripts/acp.projects-sync.sh +155 -0
  66. package/agent/scripts/acp.sessions.sh +725 -0
  67. package/agent/scripts/acp.version-update.sh +21 -3
  68. package/agent/scripts/acp.yaml-parser.sh +20 -6
  69. package/agent/tasks/milestone-19-new-search-ghost-tools/task-203-create-search-by-tool.md +143 -0
  70. package/agent/tasks/milestone-19-new-search-ghost-tools/task-204-add-new-filters-existing-tools.md +77 -0
  71. package/agent/tasks/milestone-19-new-search-ghost-tools/task-205-add-feel-fields-create-update.md +137 -0
  72. package/agent/tasks/milestone-19-new-search-ghost-tools/task-206-add-byproperty-bysignificance-modes.md +135 -0
  73. package/agent/tasks/milestone-19-new-search-ghost-tools/task-207-add-emotional-composites-search-results.md +88 -0
  74. package/agent/tasks/milestone-19-new-search-ghost-tools/task-208-add-bybroad-byrandom-modes.md +115 -0
  75. package/agent/tasks/milestone-19-new-search-ghost-tools/task-209-create-ghost-memory-tools.md +192 -0
  76. package/agent/tasks/milestone-19-new-search-ghost-tools/task-210-create-get-core-tool.md +203 -0
  77. package/agent/tasks/milestone-19-new-search-ghost-tools/task-211-create-search-space-by-tool.md +182 -0
  78. package/agent/tasks/task-1-{title}.template.md +19 -0
  79. package/agent/tasks/unassigned/bug-report-remember-core-e2e-findings.md +99 -0
  80. package/dist/e2e-helpers.d.ts +26 -0
  81. package/dist/ghost-persona.e2e.d.ts +8 -0
  82. package/dist/memory-crud.e2e.d.ts +8 -0
  83. package/dist/preferences.e2e.d.ts +8 -0
  84. package/dist/relationships.e2e.d.ts +8 -0
  85. package/dist/search-modes.e2e.d.ts +8 -0
  86. package/dist/server-factory.js +2158 -45
  87. package/dist/server.js +1403 -44
  88. package/dist/shared-spaces.e2e.d.ts +8 -0
  89. package/dist/tools/create-ghost-memory.d.ts +70 -0
  90. package/dist/tools/create-memory.d.ts +175 -0
  91. package/dist/tools/get-core.d.ts +28 -0
  92. package/dist/tools/get-core.spec.d.ts +2 -0
  93. package/dist/tools/ghost-tools.spec.d.ts +2 -0
  94. package/dist/tools/query-ghost-memory.d.ts +34 -0
  95. package/dist/tools/query-memory.d.ts +4 -0
  96. package/dist/tools/search-by.d.ts +147 -0
  97. package/dist/tools/search-by.spec.d.ts +2 -0
  98. package/dist/tools/search-ghost-memory-by.d.ts +54 -0
  99. package/dist/tools/search-ghost-memory.d.ts +53 -0
  100. package/dist/tools/search-memory.d.ts +19 -0
  101. package/dist/tools/search-space-by.d.ts +78 -0
  102. package/dist/tools/search-space-by.spec.d.ts +2 -0
  103. package/dist/tools/search-space.d.ts +2 -0
  104. package/dist/tools/update-ghost-memory.d.ts +51 -0
  105. package/dist/tools/update-memory.d.ts +175 -0
  106. package/jest.e2e.config.js +11 -0
  107. package/package.json +2 -2
  108. package/src/e2e-helpers.ts +86 -0
  109. package/src/ghost-persona.e2e.ts +215 -0
  110. package/src/memory-crud.e2e.ts +203 -0
  111. package/src/preferences.e2e.ts +88 -0
  112. package/src/relationships.e2e.ts +156 -0
  113. package/src/search-modes.e2e.ts +184 -0
  114. package/src/server-factory.ts +56 -0
  115. package/src/shared-spaces.e2e.ts +204 -0
  116. package/src/tools/create-ghost-memory.ts +103 -0
  117. package/src/tools/create-memory.ts +45 -1
  118. package/src/tools/get-core.spec.ts +223 -0
  119. package/src/tools/get-core.ts +109 -0
  120. package/src/tools/ghost-tools.spec.ts +361 -0
  121. package/src/tools/query-ghost-memory.ts +63 -0
  122. package/src/tools/query-memory.ts +4 -0
  123. package/src/tools/search-by.spec.ts +325 -0
  124. package/src/tools/search-by.ts +298 -0
  125. package/src/tools/search-ghost-memory-by.ts +80 -0
  126. package/src/tools/search-ghost-memory.ts +73 -0
  127. package/src/tools/search-memory.ts +23 -0
  128. package/src/tools/search-space-by.spec.ts +289 -0
  129. package/src/tools/search-space-by.ts +173 -0
  130. package/src/tools/search-space.ts +20 -1
  131. package/src/tools/update-ghost-memory.ts +86 -0
  132. package/src/tools/update-memory.ts +45 -1
@@ -0,0 +1,386 @@
1
+ # Directive: clarification-capture
2
+
3
+ > **🤖 Agent Directive**: This is a **SHARED DIRECTIVE**, not a user-invocable command.
4
+ > It is referenced by create commands (`design-create`, `task-create`, `pattern-create`, `command-create`) to capture clarification decisions into entity documents.
5
+ >
6
+ > **Do NOT invoke this directive directly.** It is called internally by create commands when context capture is needed.
7
+ >
8
+ > If you are a create command reading this file, follow the steps below to capture clarification context and generate a "Key Design Decisions" section for the entity being created.
9
+
10
+ **Namespace**: acp
11
+ **Version**: 1.0.0
12
+ **Created**: 2026-03-04
13
+ **Last Updated**: 2026-03-04
14
+ **Status**: Active
15
+ **Scripts**: None
16
+
17
+ ---
18
+
19
+ **Purpose**: Capture decisions from ephemeral clarification files and chat context into permanent entity documents
20
+ **Category**: Workflow (Internal Directive)
21
+ **Frequency**: Called by create commands when context is available
22
+
23
+ ---
24
+
25
+ ## Arguments
26
+
27
+ These arguments are passed through from the calling create command. The create command parses them and passes the relevant context to this directive.
28
+
29
+ **CLI-Style Arguments**:
30
+
31
+ | Argument | Alias | Behavior |
32
+ |---|---|---|
33
+ | `--from-clarification <file>` | `--from-clar` | Capture from a specific clarification file |
34
+ | `--from-clarifications` | `--from-clars` | Capture from all recent clarifications |
35
+ | `--from-chat-context` | `--from-chat` | Capture decisions from chat conversation |
36
+ | `--from-context` | (none) | Shorthand for all sources (clarifications + chat) |
37
+ | `--include-clarifications` | (none) | Alias for `--from-clars`, enforces Key Design Decisions section |
38
+
39
+ **Natural Language**:
40
+ - `@acp.design-create --from-clar` → Capture from clarifications in session
41
+ - `@acp.design-create --from-chat` → Capture from chat conversation
42
+ - `@acp.design-create --from-context` → Capture from all sources
43
+ - `@acp.design-create` (no flags) → **Auto-detect**: equivalent to implicit `--from-context`
44
+
45
+ **Default Behavior**: When no `--from-*` flags are specified, the directive auto-detects clarifications and context in the current session. This is the common case.
46
+
47
+ ---
48
+
49
+ ## What This Directive Does
50
+
51
+ This directive captures design decisions from ephemeral sources (clarifications, chat conversation) and embeds them as a "Key Design Decisions" section in the entity document being created. This prevents loss of design rationale — clarifications are workflow-only files that are never committed to version control.
52
+
53
+ The directive is called internally by create commands after context detection and key file reading, but before entity file generation. It produces a markdown section that the create command inserts into the generated entity document.
54
+
55
+ **Key behaviors**:
56
+ - Auto-detects clarifications in the session by default (no flags needed)
57
+ - Warns the user if uncaptured clarification decisions are detected
58
+ - Resolves conflicts between multiple clarifications by flagging for user
59
+ - Synthesizes decisions into category-grouped summary tables
60
+ - Updates captured clarification status to "Captured"
61
+ - Never includes clarification file references in output (clarifications are ephemeral and volatile)
62
+
63
+ ---
64
+
65
+ ## Prerequisites
66
+
67
+ - [ ] Called from within a create command (design-create, task-create, pattern-create, or command-create)
68
+ - [ ] `agent/clarifications/` directory exists (if capturing from clarifications)
69
+ - [ ] At least one clarification or chat context available
70
+
71
+ ---
72
+
73
+ ## Steps
74
+
75
+ ### 1. Detect Context Sources
76
+
77
+ Determine which sources to capture from based on arguments or auto-detection.
78
+
79
+ **Actions**:
80
+ - If `--from-clar <file>` specified: Use that specific clarification file
81
+ - If `--from-clars` specified: Use all recent clarifications
82
+ - If `--from-chat` specified: Synthesize decisions from chat conversation
83
+ - If `--from-context` specified: Use all sources (clarifications + chat)
84
+ - If **no flags** specified (default): Auto-detect — scan for clarifications in session and chat context. Equivalent to implicit `--from-context`.
85
+
86
+ **Expected Outcome**: List of context sources identified
87
+
88
+ ### 2. Read Clarification Files
89
+
90
+ If clarifications are a source, read and parse them.
91
+
92
+ **Actions**:
93
+ - List files in `agent/clarifications/` (exclude `*.template.md`)
94
+ - Filter by status: read files with status "Completed", "Awaiting Responses", or "Captured"
95
+ - If `--from-clar <file>`: Read only the specified file
96
+ - If `--from-clars` or auto-detect: Read all qualifying files
97
+ - Parse each clarification's Items, Questions, and responses (lines starting with `>`)
98
+ - Order by recency (file modification time or clarification number)
99
+
100
+ **Priority rule**: More recent clarification responses supersede older ones. Within a single clarification, all items are equal weight.
101
+
102
+ **Expected Outcome**: Clarification responses parsed and ordered
103
+
104
+ ### 3. Warn About Partial Clarifications
105
+
106
+ If any clarification has unanswered questions, warn the user.
107
+
108
+ **Actions**:
109
+ - Scan each clarification for questions with empty `>` response lines
110
+ - If unanswered questions found, display warning:
111
+
112
+ ```
113
+ ⚠️ Partial clarification detected: clarification-{N}-{title}.md
114
+ {X} of {Y} questions unanswered.
115
+
116
+ Proceed with answered portions only? (yes/no)
117
+ ```
118
+
119
+ - If user says yes: Continue with answered portions
120
+ - If user says no: Halt capture and let user complete the clarification first
121
+
122
+ **Expected Outcome**: User informed of partial clarifications, decision made
123
+
124
+ ### 4. Resolve Conflicts
125
+
126
+ If multiple clarifications contain conflicting decisions, flag for user resolution.
127
+
128
+ **Actions**:
129
+ - Compare responses across clarifications for overlapping topics
130
+ - If conflicting decisions detected:
131
+
132
+ ```
133
+ ⚠️ Conflicting decisions detected:
134
+
135
+ Topic: {topic}
136
+
137
+ Clarification {A}: "{response A}"
138
+ Clarification {B}: "{response B}"
139
+
140
+ The more recent answer is "{response B}" (clarification {B}).
141
+ Use this? (yes/no/custom)
142
+ yes → Use clarification {B}
143
+ no → Use clarification {A}
144
+ custom → Provide a different answer
145
+ ```
146
+
147
+ - Wait for user resolution
148
+ - Never silently merge conflicting decisions
149
+ - Never capture both sides of a conflict
150
+
151
+ **Expected Outcome**: All conflicts resolved
152
+
153
+ ### 5. Synthesize Chat Context
154
+
155
+ If chat context is a source (`--from-chat` or auto-detect), extract decisions from the conversation.
156
+
157
+ **Actions**:
158
+ - Review chat history for design decisions, preferences, and requirements expressed by the user
159
+ - Extract decision/choice/rationale triples from conversational context
160
+ - Merge with clarification decisions (chat context has equal weight to clarifications)
161
+
162
+ **Expected Outcome**: Chat decisions extracted and merged
163
+
164
+ ### 6. Generate Key Design Decisions Section
165
+
166
+ Create the markdown section for embedding in the entity document.
167
+
168
+ **Actions**:
169
+ - Group all captured decisions by agent-inferred category (e.g., "Architecture", "Scope", "Format", "Lifecycle")
170
+ - Categories are inferred from content — there is no predefined list
171
+ - Format as category-grouped tables:
172
+
173
+ ```markdown
174
+ ## Key Design Decisions (Optional)
175
+
176
+ ### {Category 1}
177
+
178
+ | Decision | Choice | Rationale |
179
+ |---|---|---|
180
+ | {decision} | {choice} | {rationale} |
181
+ | {decision} | {choice} | {rationale} |
182
+
183
+ ### {Category 2}
184
+
185
+ | Decision | Choice | Rationale |
186
+ |---|---|---|
187
+ | {decision} | {choice} | {rationale} |
188
+ ```
189
+
190
+ - **Do NOT include clarification file references** — clarifications are ephemeral and volatile. File numbers will not match across different developer checkouts.
191
+ - If no decisions to capture, omit the section entirely
192
+
193
+ **Expected Outcome**: Key Design Decisions markdown section generated
194
+
195
+ ### 7. Update Clarification Status
196
+
197
+ After successful capture, update the status of captured clarification files.
198
+
199
+ **Actions**:
200
+ - For each clarification file that was captured from:
201
+ - Update `**Status**:` line from current value to `Captured`
202
+ - Do NOT delete clarification files
203
+ - Do NOT prompt to delete clarification files
204
+
205
+ **Expected Outcome**: Clarification statuses updated to "Captured"
206
+
207
+ ### 8. Return Section to Calling Command
208
+
209
+ Pass the generated Key Design Decisions section back to the create command for insertion into the entity document.
210
+
211
+ **Expected Outcome**: Create command receives the section and inserts it into the generated entity file
212
+
213
+ ---
214
+
215
+ ## Warning UX: Uncaptured Decisions
216
+
217
+ When a create command detects clarifications in the session but the user hasn't explicitly included capture flags, the auto-detect behavior triggers this flow:
218
+
219
+ ```
220
+ ⚠️ Clarification decisions detected in this session that have not been captured.
221
+ Clarifications are not committed to version control.
222
+ Decisions not captured in this document will be lost.
223
+
224
+ Detected:
225
+ • clarification-{N}-{title}.md ({status}, {X} questions answered)
226
+
227
+ Include these decisions in the document? (yes/no)
228
+ ```
229
+
230
+ - If yes: Proceed with capture (equivalent to `--from-clars`)
231
+ - If no: Skip capture, create entity without Key Design Decisions section
232
+
233
+ This warning is **mandatory** when uncaptured clarifications exist. It ensures the user is aware that decisions may be lost.
234
+
235
+ ---
236
+
237
+ ## Verification
238
+
239
+ - [ ] Context sources correctly detected (flags or auto-detect)
240
+ - [ ] Clarification files read and parsed
241
+ - [ ] Partial clarifications warned about
242
+ - [ ] Conflicts flagged and resolved (never silently merged)
243
+ - [ ] Chat context synthesized (if applicable)
244
+ - [ ] Key Design Decisions section generated with category-grouped tables
245
+ - [ ] No clarification file references in output
246
+ - [ ] Clarification statuses updated to "Captured"
247
+ - [ ] Section returned to calling create command
248
+
249
+ ---
250
+
251
+ ## Expected Output
252
+
253
+ ### Generated Section (inserted into entity document)
254
+ ```markdown
255
+ ## Key Design Decisions (Optional)
256
+
257
+ ### Architecture
258
+
259
+ | Decision | Choice | Rationale |
260
+ |---|---|---|
261
+ | Implementation approach | Shared directive | Avoids duplicating capture logic across create commands |
262
+
263
+ ### Scope
264
+
265
+ | Decision | Choice | Rationale |
266
+ |---|---|---|
267
+ | Affected commands | design, task, pattern, command create | Core entity creation commands only |
268
+ ```
269
+
270
+ ### Console Output (during capture)
271
+ ```
272
+ 📋 Capturing Clarification Context...
273
+ ✓ Read clarification-6-create-command-context-capture.md (20 questions, 20 answered)
274
+ ✓ Synthesized chat context (3 additional decisions)
275
+ ✓ No conflicts detected
276
+ ✓ Generated Key Design Decisions (4 categories, 13 decisions)
277
+ ✓ Updated clarification-6 status → Captured
278
+
279
+ Key Design Decisions section ready for embedding.
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Examples
285
+
286
+ ### Example 1: Auto-detect with clarifications in session
287
+
288
+ **Context**: User created and answered a clarification, then invokes `@acp.design-create`
289
+
290
+ **Flow**: Directive auto-detects the clarification, warns user, user confirms, decisions captured into design document
291
+
292
+ ### Example 2: Explicit capture from specific file
293
+
294
+ **Context**: User invokes `@acp.task-create --from-clar clarification-6-create-command-context-capture.md`
295
+
296
+ **Flow**: Directive reads only that clarification, synthesizes decisions, generates section
297
+
298
+ ### Example 3: Chat-only capture
299
+
300
+ **Context**: User had extensive discussion about design choices, invokes `@acp.pattern-create --from-chat`
301
+
302
+ **Flow**: Directive synthesizes decisions from chat history, generates section (no clarification files involved)
303
+
304
+ ### Example 4: No context available
305
+
306
+ **Context**: User invokes `@acp.design-create` with no prior clarifications or design discussion
307
+
308
+ **Flow**: Directive finds no context sources, skips capture silently, entity created without Key Design Decisions section
309
+
310
+ ---
311
+
312
+ ## Related Commands
313
+
314
+ - [`@acp.clarification-create`](acp.clarification-create.md) - Creates clarification files that this directive captures from
315
+ - [`@acp.design-create`](acp.design-create.md) - Calls this directive during design creation
316
+ - [`@acp.task-create`](acp.task-create.md) - Calls this directive during task creation
317
+ - [`@acp.pattern-create`](acp.pattern-create.md) - Calls this directive during pattern creation
318
+ - [`@acp.command-create`](acp.command-create.md) - Calls this directive during command creation
319
+
320
+ ---
321
+
322
+ ## Troubleshooting
323
+
324
+ ### Issue 1: No clarifications found
325
+
326
+ **Symptom**: Directive reports no context sources
327
+
328
+ **Cause**: No clarification files exist or all have status "Captured"
329
+
330
+ **Solution**: This is normal. Entity will be created without Key Design Decisions section. If you expected clarifications, check `agent/clarifications/` directory.
331
+
332
+ ### Issue 2: Clarification has no answered questions
333
+
334
+ **Symptom**: Warning about fully unanswered clarification
335
+
336
+ **Cause**: Clarification was created but not yet answered
337
+
338
+ **Solution**: Answer the clarification first, then re-run the create command.
339
+
340
+ ### Issue 3: Too many conflicts
341
+
342
+ **Symptom**: Multiple conflict resolution prompts
343
+
344
+ **Cause**: Multiple clarifications with overlapping but contradictory answers
345
+
346
+ **Solution**: Consider consolidating clarifications before capture, or resolve each conflict as prompted.
347
+
348
+ ---
349
+
350
+ ## Security Considerations
351
+
352
+ ### File Access
353
+ - **Reads**: `agent/clarifications/*.md` (non-template), chat conversation context
354
+ - **Writes**: `agent/clarifications/*.md` (status update to "Captured" only)
355
+ - **Executes**: None
356
+
357
+ ### Network Access
358
+ - **APIs**: None
359
+ - **Repositories**: None
360
+
361
+ ### Sensitive Data
362
+ - **Secrets**: Never include secrets in Key Design Decisions
363
+ - **Credentials**: Never include credentials in captured output
364
+
365
+ ---
366
+
367
+ ## Notes
368
+
369
+ - This is a shared directive, not a user-invocable command
370
+ - Default behavior is auto-detect (no flags needed for common case)
371
+ - Clarifications are ephemeral — never reference their file numbers in output
372
+ - Categories in the output tables are agent-inferred, not predefined
373
+ - The directive never deletes clarification files and never prompts to delete them
374
+ - Conflict resolution always involves the user — never silently merge
375
+ - The Key Design Decisions section is optional — omit if no decisions to capture
376
+
377
+ ---
378
+
379
+ **Namespace**: acp
380
+ **Command**: clarification-capture
381
+ **Version**: 1.0.0
382
+ **Created**: 2026-03-04
383
+ **Last Updated**: 2026-03-04
384
+ **Status**: Active
385
+ **Compatibility**: ACP 5.12.0+
386
+ **Author**: ACP Project
@@ -70,6 +70,37 @@ Find the next available clarification number:
70
70
 
71
71
  **Expected Outcome**: Next clarification number determined (e.g., clarification-7)
72
72
 
73
+ ### 1.5. Check Existing Clarifications for Overlap
74
+
75
+ Before generating questions, check if existing clarifications already cover related topics.
76
+
77
+ **Actions**:
78
+ - List all files in `agent/clarifications/` (exclude `*.template.md`)
79
+ - For each file, extract the title from the filename (e.g., `clarification-5-key-file-directive.md` → "key-file-directive")
80
+ - Infer from titles which clarifications might be relevant to the current topic
81
+ - Use keyword matching between the current topic/title and existing clarification titles
82
+ - Only load clarifications that appear relevant (avoid unnecessary context token consumption)
83
+ - If relevant clarifications found:
84
+ - Read them to identify already-answered questions
85
+ - When generating questions in Step 5, cross-reference with these answered questions
86
+ - Skip or note questions that have already been answered elsewhere
87
+ - Produce visible output showing what was checked
88
+
89
+ **Display format**:
90
+ ```
91
+ 🔍 Checking existing clarifications for overlap...
92
+ ✓ clarification-5-key-file-directive.md — not relevant (skipped)
93
+ ✓ clarification-6-create-command-context-capture.md — relevant, loaded
94
+ → 20 questions already answered on context capture topic
95
+
96
+ 1 existing clarification loaded, 1 skipped
97
+ Will avoid duplicating answered questions.
98
+ ```
99
+
100
+ **Heuristic**: This is a title-based relevance check, not an exhaustive content scan. If a title doesn't seem related to the current topic, skip it entirely to conserve context tokens. When in doubt, skip — it's better to occasionally re-ask a question than to burn tokens loading irrelevant clarifications.
101
+
102
+ **Expected Outcome**: Existing relevant clarifications identified, duplicate questions will be avoided
103
+
73
104
  ### 2. Check for Source File
74
105
 
75
106
  Check if file was provided as argument:
@@ -146,6 +177,25 @@ Create structured questions organized by topic:
146
177
  - Provide context for complex questions
147
178
  - Include examples where helpful
148
179
  - Leave blank response lines (`>`) for user answers
180
+ - **Prefer Yes/No questions** over "Option A or Option B?" format — users can answer "yes/no" instead of "the former/the latter":
181
+ - **Two options, with clear recommendation**: "We recommend X. Acceptable?" (yes/no)
182
+ - **Two options, no clear recommendation**: "Do you prefer X? (yes/no)" — state the first option and let the user accept or reject. Do NOT force a recommendation when neither option is clearly better.
183
+ - **3+ options**: Use labeled choices (A, B, C, etc.)
184
+ - Recommendations are optional — only include one when the agent has enough context to genuinely justify a preference. When in doubt, omit the recommendation and just present the choice.
185
+ - **Multi-option discrete questions**: When asking about a set of properties/features/items, list each option as a separate bullet with its own `>` response line so the user can accept/reject each individually without retyping:
186
+ ```markdown
187
+ - Which properties should be included?
188
+
189
+ - name
190
+ >
191
+ - description
192
+ >
193
+ - version
194
+ >
195
+ - author
196
+ >
197
+ ```
198
+ This lets users answer "yes", "no", or add notes per item inline.
149
199
 
150
200
  **If analyzing file**:
151
201
  - Generate 10-30 questions based on gaps found
@@ -11,6 +11,7 @@
11
11
  **Created**: 2026-02-21
12
12
  **Last Updated**: 2026-02-21
13
13
  **Status**: Active
14
+ **Scripts**: None
14
15
 
15
16
  ---
16
17
 
@@ -44,6 +45,22 @@ This command creates a new command file with intelligent namespace handling, opt
44
45
 
45
46
  ---
46
47
 
48
+ ## Arguments
49
+
50
+ **Context Capture Arguments** (optional — passed to `@acp.clarification-capture` directive):
51
+
52
+ | Argument | Alias | Behavior |
53
+ |---|---|---|
54
+ | `--from-clarification <file>` | `--from-clar` | Capture decisions from a specific clarification file |
55
+ | `--from-clarifications` | `--from-clars` | Capture from all recent clarifications |
56
+ | `--from-chat-context` | `--from-chat` | Capture decisions from chat conversation |
57
+ | `--from-context` | (none) | Shorthand for all sources (clarifications + chat) |
58
+ | `--include-clarifications` | (none) | Alias for `--from-clars` |
59
+
60
+ **Default behavior** (no flags): Auto-detect clarifications and context in session.
61
+
62
+ ---
63
+
47
64
  ## Steps
48
65
 
49
66
  ### 1. Detect Context
@@ -72,6 +89,33 @@ Check if draft file was provided as argument:
72
89
 
73
90
  **Expected Outcome**: Draft file read (if provided)
74
91
 
92
+ ### 2.5. Read Contextual Key Files
93
+
94
+ Before creating content, load relevant key files from the index.
95
+
96
+ **Actions**:
97
+ - Check if `agent/index/` directory exists
98
+ - If exists, scan for all `*.yaml` files (excluding `*.template.yaml`)
99
+ - Filter entries where `applies` includes `acp.command-create`
100
+ - Sort by weight descending, read matching files
101
+ - Produce visible output
102
+
103
+ **Note**: If `agent/index/` does not exist, skip silently.
104
+
105
+ ### 2.7. Capture Clarification Context
106
+
107
+ Invoke the `@acp.clarification-capture` shared directive to capture decisions from clarifications and/or chat context.
108
+
109
+ **Actions**:
110
+ - Read and follow the directive in [`agent/commands/acp.clarification-capture.md`](acp.clarification-capture.md)
111
+ - Pass through any `--from-*` arguments from this command's invocation
112
+ - If no `--from-*` flags specified: auto-detect clarifications in session (default behavior)
113
+ - If uncaptured clarifications detected, show warning and ask user whether to include
114
+ - Directive returns a "Key Design Decisions" markdown section (or nothing if no context)
115
+ - Hold the generated section for insertion during Step 5 (Generate Command File)
116
+
117
+ **Expected Outcome**: Key Design Decisions section generated (if context available), or skipped cleanly
118
+
75
119
  ### 3. Collect Command Information
76
120
 
77
121
  Gather information from user via chat:
@@ -128,6 +172,7 @@ Create command file from template:
128
172
  - If no arguments: Remove Arguments section from template
129
173
  - If draft/clarification provided: Incorporate content
130
174
  - If no draft: Create from template with user-provided description
175
+ - If Key Design Decisions section was generated in Step 2.7: Insert it into the command document
131
176
  - Save to `agent/commands/{namespace}.{command-name}.md`
132
177
 
133
178
  **Expected Outcome**: Command file created with proper directive header
@@ -189,6 +234,21 @@ Next steps:
189
234
 
190
235
  **Expected Outcome**: User knows command was created successfully
191
236
 
237
+ ### 10. Prompt to Add to Key File Index
238
+
239
+ After successful creation, offer to add the new file to the index (if `agent/index/` exists).
240
+
241
+ **Display**:
242
+ ```
243
+ Would you like to add this to the key file index?
244
+ - Yes, add to agent/index/local.main.yaml
245
+ - No, skip
246
+ ```
247
+
248
+ If yes, prompt for weight (suggest 0.6 for commands), description, rationale, and applies values. Add entry to `agent/index/local.main.yaml`.
249
+
250
+ **Note**: Skip silently if `agent/index/` does not exist.
251
+
192
252
  ---
193
253
 
194
254
  ## Verification
@@ -11,6 +11,7 @@
11
11
  **Created**: 2026-02-21
12
12
  **Last Updated**: 2026-02-21
13
13
  **Status**: Active
14
+ **Scripts**: None
14
15
 
15
16
  ---
16
17
 
@@ -43,6 +44,22 @@ This command creates a new design document with intelligent namespace handling,
43
44
 
44
45
  ---
45
46
 
47
+ ## Arguments
48
+
49
+ **Context Capture Arguments** (optional — passed to `@acp.clarification-capture` directive):
50
+
51
+ | Argument | Alias | Behavior |
52
+ |---|---|---|
53
+ | `--from-clarification <file>` | `--from-clar` | Capture decisions from a specific clarification file |
54
+ | `--from-clarifications` | `--from-clars` | Capture from all recent clarifications |
55
+ | `--from-chat-context` | `--from-chat` | Capture decisions from chat conversation |
56
+ | `--from-context` | (none) | Shorthand for all sources (clarifications + chat) |
57
+ | `--include-clarifications` | (none) | Alias for `--from-clars` |
58
+
59
+ **Default behavior** (no flags): Auto-detect clarifications and context in session.
60
+
61
+ ---
62
+
46
63
  ## Steps
47
64
 
48
65
  ### 1. Detect Context
@@ -62,6 +79,33 @@ Check if draft file was provided as argument (same as pattern-create and command
62
79
 
63
80
  **Expected Outcome**: Draft file read (if provided)
64
81
 
82
+ ### 2.5. Read Contextual Key Files
83
+
84
+ Before creating content, load relevant key files from the index.
85
+
86
+ **Actions**:
87
+ - Check if `agent/index/` directory exists
88
+ - If exists, scan for all `*.yaml` files (excluding `*.template.yaml`)
89
+ - Filter entries where `applies` includes `acp.design-create`
90
+ - Sort by weight descending, read matching files
91
+ - Produce visible output
92
+
93
+ **Note**: If `agent/index/` does not exist, skip silently.
94
+
95
+ ### 2.7. Capture Clarification Context
96
+
97
+ Invoke the `@acp.clarification-capture` shared directive to capture decisions from clarifications and/or chat context.
98
+
99
+ **Actions**:
100
+ - Read and follow the directive in [`agent/commands/acp.clarification-capture.md`](acp.clarification-capture.md)
101
+ - Pass through any `--from-*` arguments from this command's invocation
102
+ - If no `--from-*` flags specified: auto-detect clarifications in session (default behavior)
103
+ - If uncaptured clarifications detected, show warning and ask user whether to include
104
+ - Directive returns a "Key Design Decisions" markdown section (or nothing if no context)
105
+ - Hold the generated section for insertion during Step 5 (Generate Design File)
106
+
107
+ **Expected Outcome**: Key Design Decisions section generated (if context available), or skipped cleanly
108
+
65
109
  ### 3. Collect Design Information
66
110
 
67
111
  Gather information from user via chat:
@@ -96,6 +140,7 @@ Create design file from template:
96
140
  - Fill in metadata (name, version, date, description)
97
141
  - If draft/clarification provided: Incorporate content
98
142
  - If no draft: Create from template with user-provided description
143
+ - If Key Design Decisions section was generated in Step 2.7: Insert it into the design document
99
144
  - Save to `agent/design/{namespace}.{design-name}.md`
100
145
 
101
146
  **Expected Outcome**: Design file created
@@ -124,6 +169,23 @@ Display what was created.
124
169
 
125
170
  **Expected Outcome**: User knows design was created successfully
126
171
 
172
+ ### 10. Prompt to Add to Key File Index
173
+
174
+ After successful creation, offer to add the new file to the index.
175
+
176
+ **Display**:
177
+ ```
178
+ Would you like to add this to the key file index?
179
+ - Yes, add to agent/index/local.main.yaml
180
+ - No, skip
181
+ ```
182
+
183
+ If yes:
184
+ - Prompt for weight (suggest 0.7 for designs), description, rationale, and applies values
185
+ - Add entry to `agent/index/local.main.yaml` (create file from template if it doesn't exist)
186
+
187
+ **Note**: If `agent/index/` does not exist, skip this step.
188
+
127
189
  ---
128
190
 
129
191
  ## Verification