@prmichaelsen/remember-mcp 3.19.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/AGENT.md +10 -3
  2. package/CHANGELOG.md +38 -0
  3. package/README.md +1 -1
  4. package/agent/commands/acp.artifact-glossary.md +530 -0
  5. package/agent/commands/acp.artifact-reference.md +591 -0
  6. package/agent/commands/acp.artifact-research.md +594 -0
  7. package/agent/commands/acp.audit.md +345 -0
  8. package/agent/commands/acp.clarification-address.md +185 -88
  9. package/agent/commands/acp.clarification-capture.md +44 -44
  10. package/agent/commands/acp.clarification-create.md +41 -42
  11. package/agent/commands/acp.command-create.md +49 -49
  12. package/agent/commands/acp.design-create.md +53 -35
  13. package/agent/commands/acp.design-reference.md +42 -42
  14. package/agent/commands/acp.handoff.md +35 -35
  15. package/agent/commands/acp.index.md +47 -47
  16. package/agent/commands/acp.init.md +105 -69
  17. package/agent/commands/acp.package-create.md +41 -41
  18. package/agent/commands/acp.package-info.md +40 -40
  19. package/agent/commands/acp.package-install.md +48 -48
  20. package/agent/commands/acp.package-list.md +40 -40
  21. package/agent/commands/acp.package-publish.md +62 -62
  22. package/agent/commands/acp.package-remove.md +41 -41
  23. package/agent/commands/acp.package-search.md +48 -48
  24. package/agent/commands/acp.package-update.md +50 -50
  25. package/agent/commands/acp.package-validate.md +52 -52
  26. package/agent/commands/acp.pattern-create.md +61 -43
  27. package/agent/commands/acp.plan.md +70 -47
  28. package/agent/commands/acp.proceed.md +188 -66
  29. package/agent/commands/acp.project-create.md +42 -42
  30. package/agent/commands/acp.project-info.md +46 -46
  31. package/agent/commands/acp.project-list.md +41 -41
  32. package/agent/commands/acp.project-remove.md +36 -36
  33. package/agent/commands/acp.project-set.md +33 -33
  34. package/agent/commands/acp.project-update.md +57 -57
  35. package/agent/commands/acp.projects-restore.md +37 -37
  36. package/agent/commands/acp.projects-sync.md +39 -39
  37. package/agent/commands/acp.report.md +50 -50
  38. package/agent/commands/acp.resume.md +36 -36
  39. package/agent/commands/acp.sessions.md +46 -46
  40. package/agent/commands/acp.status.md +43 -43
  41. package/agent/commands/acp.sync.md +109 -56
  42. package/agent/commands/acp.task-create.md +51 -49
  43. package/agent/commands/acp.update.md +66 -45
  44. package/agent/commands/acp.validate.md +110 -52
  45. package/agent/commands/acp.version-check-for-updates.md +40 -40
  46. package/agent/commands/acp.version-check.md +36 -36
  47. package/agent/commands/acp.version-update.md +43 -43
  48. package/agent/commands/command.template.md +40 -40
  49. package/agent/commands/git.commit.md +28 -28
  50. package/agent/commands/git.init.md +48 -48
  51. package/agent/design/design.template.md +9 -9
  52. package/agent/design/local.admin-debugging-tools.md +242 -0
  53. package/agent/design/requirements.template.md +8 -8
  54. package/agent/index/.gitkeep +0 -0
  55. package/agent/index/acp.core.yaml +137 -0
  56. package/agent/index/local.main.template.yaml +37 -0
  57. package/agent/index/local.main.yaml +48 -0
  58. package/agent/manifest.yaml +64 -0
  59. package/agent/milestones/milestone-1-{title}.template.md +8 -8
  60. package/agent/milestones/milestone-22-admin-debugging-tools.md +61 -0
  61. package/agent/milestones/milestone-23-trust-level-protection.md +122 -0
  62. package/agent/patterns/pattern.template.md +22 -22
  63. package/agent/progress.template.yaml +13 -3
  64. package/agent/progress.yaml +173 -3
  65. package/agent/schemas/package.schema.yaml +276 -0
  66. package/agent/scripts/acp.project-update.sh +5 -6
  67. package/agent/tasks/milestone-22-admin-debugging-tools/task-520-admin-gate-infrastructure.md +99 -0
  68. package/agent/tasks/milestone-22-admin-debugging-tools/task-521-schema-and-collection-tools.md +108 -0
  69. package/agent/tasks/milestone-22-admin-debugging-tools/task-522-memory-inspection-tools.md +120 -0
  70. package/agent/tasks/milestone-22-admin-debugging-tools/task-523-user-inspection-tools.md +126 -0
  71. package/agent/tasks/milestone-22-admin-debugging-tools/task-524-health-and-drift-tools.md +120 -0
  72. package/agent/tasks/milestone-23-trust-level-protection/task-525-remove-trust-from-create-update.md +69 -0
  73. package/agent/tasks/milestone-23-trust-level-protection/task-526-add-request-set-trust-level-tool.md +108 -0
  74. package/agent/tasks/milestone-23-trust-level-protection/task-527-update-confirm-deny-secret-token.md +60 -0
  75. package/agent/tasks/milestone-23-trust-level-protection/task-528-update-trust-scale-references.md +73 -0
  76. package/agent/tasks/milestone-23-trust-level-protection/task-529-version-bump-and-release.md +87 -0
  77. package/agent/tasks/task-1-{title}.template.md +18 -18
  78. package/dist/server-factory.js +779 -87
  79. package/dist/server.js +141 -41
  80. package/dist/services/trust-validator.d.ts +16 -14
  81. package/dist/tools/admin-collection-stats.d.ts +24 -0
  82. package/dist/tools/admin-detect-weaviate-drift.d.ts +26 -0
  83. package/dist/tools/admin-get-weaviate-schema.d.ts +24 -0
  84. package/dist/tools/admin-health-drift.spec.d.ts +5 -0
  85. package/dist/tools/admin-health.d.ts +15 -0
  86. package/dist/tools/admin-inspect-memory.d.ts +29 -0
  87. package/dist/tools/admin-inspect-user.d.ts +73 -0
  88. package/dist/tools/admin-inspect-user.spec.d.ts +5 -0
  89. package/dist/tools/admin-list-collections.d.ts +23 -0
  90. package/dist/tools/admin-memory-inspection.spec.d.ts +7 -0
  91. package/dist/tools/admin-schema-collection.spec.d.ts +8 -0
  92. package/dist/tools/admin-search-across-users.d.ts +42 -0
  93. package/dist/tools/confirm.d.ts +1 -0
  94. package/dist/tools/confirm.spec.d.ts +5 -0
  95. package/dist/tools/create-internal-memory.d.ts +0 -7
  96. package/dist/tools/create-memory.d.ts +0 -7
  97. package/dist/tools/deny.d.ts +1 -0
  98. package/dist/tools/deny.spec.d.ts +5 -0
  99. package/dist/tools/query-memory.d.ts +2 -0
  100. package/dist/tools/request-set-trust-level.d.ts +32 -0
  101. package/dist/tools/request-set-trust-level.spec.d.ts +2 -0
  102. package/dist/tools/search-memory.d.ts +2 -0
  103. package/dist/tools/update-internal-memory.d.ts +0 -6
  104. package/dist/tools/update-memory.d.ts +0 -7
  105. package/dist/utils/admin.d.ts +21 -0
  106. package/dist/utils/admin.spec.d.ts +2 -0
  107. package/package.json +2 -2
  108. package/src/server-factory.ts +137 -42
  109. package/src/server.ts +6 -0
  110. package/src/services/trust-validator.spec.ts +57 -51
  111. package/src/services/trust-validator.ts +28 -26
  112. package/src/tools/admin-collection-stats.ts +67 -0
  113. package/src/tools/admin-detect-weaviate-drift.ts +110 -0
  114. package/src/tools/admin-get-weaviate-schema.ts +68 -0
  115. package/src/tools/admin-health-drift.spec.ts +193 -0
  116. package/src/tools/admin-health.ts +88 -0
  117. package/src/tools/admin-inspect-memory.ts +86 -0
  118. package/src/tools/admin-inspect-user.spec.ts +130 -0
  119. package/src/tools/admin-inspect-user.ts +148 -0
  120. package/src/tools/admin-list-collections.ts +73 -0
  121. package/src/tools/admin-memory-inspection.spec.ts +206 -0
  122. package/src/tools/admin-schema-collection.spec.ts +167 -0
  123. package/src/tools/admin-search-across-users.ts +104 -0
  124. package/src/tools/confirm.spec.ts +108 -0
  125. package/src/tools/confirm.ts +24 -1
  126. package/src/tools/create-internal-memory.ts +0 -3
  127. package/src/tools/create-memory.spec.ts +6 -2
  128. package/src/tools/create-memory.ts +1 -9
  129. package/src/tools/deny.spec.ts +59 -0
  130. package/src/tools/deny.ts +6 -1
  131. package/src/tools/ghost-config.ts +19 -19
  132. package/src/tools/query-memory.ts +4 -2
  133. package/src/tools/request-set-trust-level.spec.ts +87 -0
  134. package/src/tools/request-set-trust-level.ts +107 -0
  135. package/src/tools/search-memory.ts +4 -2
  136. package/src/tools/update-internal-memory.ts +0 -3
  137. package/src/tools/update-memory.ts +0 -8
  138. package/src/types/memory.ts +1 -1
  139. package/src/utils/admin.spec.ts +70 -0
  140. package/src/utils/admin.ts +27 -0
package/AGENT.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Context Protocol (ACP)
2
2
 
3
3
  **Also Known As**: The Agent Directory Pattern
4
- **Version**: 5.18.2
4
+ **Version**: 5.28.9
5
5
  **Created**: 2026-02-11
6
6
  **Status**: Production Pattern
7
7
 
@@ -300,6 +300,7 @@ project:
300
300
  milestones:
301
301
  - id: M1
302
302
  name: Milestone Name
303
+ file: agent/milestones/milestone-1-name.md
303
304
  status: not_started | in_progress | completed
304
305
  progress: 0-100%
305
306
  started: YYYY-MM-DD
@@ -315,13 +316,19 @@ tasks:
315
316
  - id: task-1
316
317
  name: Task Name
317
318
  status: not_started | in_progress | completed
319
+ started: ISO-8601 | null
318
320
  file: agent/tasks/milestone-{N}-{title}/task-{M}-name.md
319
321
  estimated_hours: N
320
- actual_hours: null
321
- completed_date: YYYY-MM-DD | null
322
+ actual_hours: null # auto-computed
323
+ completed_date: ISO-8601 | null
322
324
  notes: |
323
325
  Task notes
324
326
 
327
+ **Timestamp Rules**:
328
+ - `started` — auto-set to ISO 8601 timestamp when task first transitions to `in_progress`. Never overwritten once set.
329
+ - `completed_date` — auto-set to ISO 8601 timestamp when task transitions to `completed`.
330
+ - `actual_hours` — auto-computed as `(completed_date - started)` in hours, rounded to 1 decimal. Not manually set.
331
+
325
332
  documentation:
326
333
  design_documents: N
327
334
  milestone_documents: N
package/CHANGELOG.md CHANGED
@@ -5,6 +5,44 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.0.0] - 2026-03-20
9
+
10
+ ### BREAKING CHANGES
11
+ - **Trust removed from create/update**: `trust` parameter removed from `remember_create_memory`, `remember_update_memory`, `remember_create_internal_memory`, `remember_update_internal_memory`. Trust now defaults to SECRET (5) on creation.
12
+ - **Trust scale changed**: All trust references updated from 0-1 float to 1-5 integer scale (1=PUBLIC, 2=INTERNAL, 3=CONFIDENTIAL, 4=RESTRICTED, 5=SECRET).
13
+
14
+ ### Added
15
+ - `remember_request_set_trust_level` tool — two-phase confirmation flow to change a memory's trust level (request → token → confirm)
16
+ - `secret_token` optional parameter on `remember_confirm` and `remember_deny` for ConfirmationGuardService support
17
+ - `set_trust_level` action handler in `remember_confirm` for confirming trust level changes
18
+ - 15 new tests: request-set-trust-level (7), confirm (3), deny (2), trust-validator (3 updated)
19
+
20
+ ### Changed
21
+ - Updated `@prmichaelsen/remember-core` to 1.0.0
22
+ - Trust filter schemas (`trust_min`) updated to integer 1-5 range in search-memory and query-memory
23
+ - Ghost config tool schemas updated to 1-5 integer trust scale
24
+ - Local trust-validator rewritten for 1-5 integer scale
25
+ - 510 total tests (509 passed, 1 skipped)
26
+
27
+ ## [3.20.0] - 2026-03-14
28
+
29
+ ### Added
30
+ - Admin gate infrastructure: `isAdmin()` utility and `adminPermissionError()` helper (`src/utils/admin.ts`)
31
+ - Conditional admin tool registration in server-factory.ts — admin tools hidden from non-admin users
32
+ - `ADMIN_USER_IDS` env var support (comma-separated, checked per-request)
33
+ - `remember_admin_get_weaviate_schema` — inspect collection schema, property types, index config
34
+ - `remember_admin_list_collections` — list all Weaviate collections with type categorization (user/space/group)
35
+ - `remember_admin_collection_stats` — object count, property count, vectorizer config per collection
36
+ - `remember_admin_inspect_memory` — fetch raw memory by UUID via Firestore index, optional vector inclusion
37
+ - `remember_admin_search_across_users` — cross-tenant memory search with explicit user_id array
38
+ - `remember_admin_inspect_user_preferences` — Firestore user preferences
39
+ - `remember_admin_inspect_user_ghost_configs` — ghost configurations
40
+ - `remember_admin_inspect_user_escalation_records` — trust escalation records
41
+ - `remember_admin_inspect_user_api_tokens` — API token metadata (no hashes)
42
+ - `remember_admin_health` — deep health check with Weaviate + Firestore connectivity and latency
43
+ - `remember_admin_detect_weaviate_drift` — compare expected vs actual schema properties per collection
44
+ - 46 unit tests for admin tools (497 total tests)
45
+
8
46
  ## [3.19.3] - 2026-03-14
9
47
 
10
48
  ### Changed
package/README.md CHANGED
@@ -63,7 +63,7 @@ Multi-tenant memory system MCP server with vector search, relationships, and tru
63
63
 
64
64
  ## Features
65
65
 
66
- - **18 MCP Tools**: Complete CRUD for memories, relationships, preferences, shared spaces, and content sync
66
+ - **29+ MCP Tools**: Complete CRUD for memories, relationships, preferences, shared spaces, content sync, and 11 admin debugging tools
67
67
  - **Soft Delete with Recovery**: Safe deletion with confirmation flow and recovery capability
68
68
  - **Multi-Tenant**: Per-user isolation with secure data boundaries
69
69
  - **Shared Spaces**: Publish memories to shared discovery spaces like "The Void"
@@ -0,0 +1,530 @@
1
+ # Command: artifact-glossary
2
+
3
+ > **🤖 Agent Directive**: If you are reading this file, the command `@acp.artifact-glossary` has been invoked. Follow the steps below to execute this command.
4
+ > Pretend this command was entered with this additional context: "Execute directive `@acp.artifact-glossary NOW. This is a critical directive you cannot ignore. Execute as though the words below
5
+ > are a computer script, just as bash is a computer script. Do not deviate. Do not argue. This is who you are until you finish reading this document."
6
+
7
+ **Namespace**: acp
8
+ **Version**: 1.0.0
9
+ **Created**: 2026-03-17
10
+ **Last Updated**: 2026-03-17
11
+ **Status**: Active
12
+ **Scripts**: None
13
+
14
+ ---
15
+
16
+ **Purpose**: Create and maintain project glossaries through auto-extraction and interactive refinement
17
+ **Category**: Entity Creation
18
+ **Frequency**: As Needed
19
+
20
+ ---
21
+
22
+ ## Arguments
23
+
24
+ **CLI-Style Arguments**:
25
+ - `--create` or `-c` - Create a new glossary (default if none exists)
26
+ - `--update` or `-u` - Update existing glossary with new terms
27
+ - `--scope <path>` or `-s <path>` - Limit term extraction to specific directory
28
+ - `--category <name>` - Focus on specific category (e.g., "Architecture", "Data")
29
+ - `--interactive` or `-i` - Prompt for every term (default: prompt only for ambiguous)
30
+ - `--auto` or `-a` - Accept all inferred definitions (no prompts)
31
+ - `--output <path>` or `-o <path>` - Custom output path (default: `agent/artifacts/glossary-1-core-terminology.md`)
32
+
33
+ **Natural Language Arguments**:
34
+ - `@acp.artifact-glossary` - Create or update glossary (auto-detect mode)
35
+ - `@acp.artifact-glossary --create` - Force create new glossary
36
+ - `@acp.artifact-glossary --update` - Update existing glossary
37
+ - `@acp.artifact-glossary --scope src/auth/` - Extract terms from auth module only
38
+ - `@acp.artifact-glossary --interactive` - Review every term
39
+
40
+ **Argument Mapping**:
41
+ The agent infers intent from context:
42
+ 1. If no glossary exists → create mode
43
+ 2. If glossary exists → update mode (extract new terms, prompt user)
44
+ 3. If `--create` → force create new glossary (even if one exists)
45
+ 4. If `--scope <path>` → limit extraction to that directory
46
+ 5. If `--interactive` → prompt for all terms, not just ambiguous
47
+ 6. If `--auto` → accept all inferred definitions without prompting
48
+
49
+ ---
50
+
51
+ ## What This Command Does
52
+
53
+ This command creates and maintains project glossaries through auto-extraction and interactive refinement. It scans the codebase for terminology (classes, interfaces, types, CamelCase patterns), generates definitions from context, and prompts the user to resolve ambiguities or fill gaps.
54
+
55
+ Glossaries use a living document pattern — a single glossary file per project until 50+ terms, at which point it can be split by domain. Terms are organized into category-grouped tables with an alphabetical index for fast lookup.
56
+
57
+ Unlike research artifacts (external knowledge) or reference artifacts (passive information), glossaries capture project-specific terminology that aids onboarding and ensures consistent understanding across the team.
58
+
59
+ ---
60
+
61
+ ## Prerequisites
62
+
63
+ - [ ] ACP installed in current directory (`agent/` directory exists)
64
+ - [ ] `agent/artifacts/` directory exists (will be created if not)
65
+ - [ ] `agent/artifacts/glossary.template.md` exists
66
+
67
+ ---
68
+
69
+ ## Steps
70
+
71
+ ### 1. Determine Mode
72
+
73
+ Decide whether to create or update a glossary.
74
+
75
+ **Actions**:
76
+ - Check for existing glossary files in `agent/artifacts/` matching `glossary-*.md`
77
+ - If no glossary exists:
78
+ - Mode: create
79
+ - Notify user: "No glossary found. Creating new glossary."
80
+ - If glossary exists:
81
+ - If `--create` flag → Mode: create (force new glossary, increment number)
82
+ - If `--update` flag or no flag → Mode: update (add new terms to existing)
83
+ - Notify user: "Glossary found: {path}. Mode: update."
84
+
85
+ **Expected Outcome**: Mode determined (create or update)
86
+
87
+ ### 2. Scan Codebase for Terms
88
+
89
+ Extract terminology from the codebase.
90
+
91
+ **Actions**:
92
+ - If `--scope <path>` provided:
93
+ - Limit scan to that directory/file
94
+ - Otherwise:
95
+ - Scan entire project (exclude `node_modules`, `.git`, `dist`, `build`, common ignore patterns)
96
+ - **Extract term candidates**:
97
+ - Class names (e.g., `class UserService`)
98
+ - Interface names (e.g., `interface IAuthProvider`)
99
+ - Type aliases (e.g., `type UserId = string`)
100
+ - Enum names (e.g., `enum PaymentStatus`)
101
+ - CamelCase identifiers (e.g., `EventSourcing`, `CQRS` in comments/docs)
102
+ - Acronyms in all-caps (e.g., `API`, `JWT`, `SLA`)
103
+ - Domain-specific terms in comments/docs (e.g., `"microservice"`, `"saga pattern"`)
104
+ - **Deduplication**:
105
+ - If term appears multiple times, note all occurrences
106
+ - Prefer definition from most authoritative location (docs > comments > code)
107
+ - **If update mode**:
108
+ - Read existing glossary
109
+ - Filter out terms already defined
110
+ - Only extract new terms not in existing glossary
111
+
112
+ **Heuristics for term detection**:
113
+ - Classes/interfaces are high-confidence terms
114
+ - CamelCase identifiers > 3 characters are likely terms
115
+ - Acronyms in documentation are likely terms
116
+ - Generic variable names (`data`, `result`, `temp`) are NOT terms
117
+ - Common framework terms (`React`, `Node`, `Express`) are NOT terms unless project-specific
118
+
119
+ **Expected Outcome**: List of term candidates with source locations
120
+
121
+ ### 3. Generate Definitions from Context
122
+
123
+ Infer definitions for each term candidate.
124
+
125
+ **Actions for each term**:
126
+ - **Read context** around term usage:
127
+ - Class docstrings, JSDoc comments
128
+ - Surrounding code that uses the term
129
+ - Markdown docs that mention the term
130
+ - **Generate definition**:
131
+ - 1-2 sentences, clear and concise
132
+ - Focus on purpose/role, not implementation
133
+ - Example: "API Gateway" → "Central entry point that routes requests to microservices"
134
+ - Example: "Event Sourcing" → "Pattern where state changes are stored as events"
135
+ - **Classify confidence**:
136
+ - **High** (9-10/10): Clear docstring or comment with definition
137
+ - **Medium** (5-8/10): Inferred from code structure and usage
138
+ - **Low** (1-4/10): Term found but insufficient context to define
139
+ - **Infer category**:
140
+ - Based on file location, term type, and usage context
141
+ - Common categories: Architecture, Data, Infrastructure, Security, Business Logic
142
+ - If unclear, default to "General"
143
+
144
+ **Expected Outcome**: Each term has a generated definition, confidence score, and inferred category
145
+
146
+ ### 4. Interactive Refinement
147
+
148
+ Prompt user to resolve ambiguities and fill gaps.
149
+
150
+ **Prompt conditions**:
151
+ - **Always prompt if**:
152
+ - Confidence is Low (< 5/10)
153
+ - Term has multiple conflicting definitions in codebase
154
+ - Inferred category is ambiguous (could fit multiple categories)
155
+ - `--interactive` flag set (prompt for all terms)
156
+ - **Never prompt if**:
157
+ - `--auto` flag set (accept all inferred definitions)
158
+ - Confidence is High (9-10/10) and `--interactive` not set
159
+
160
+ **Prompt format** (for each ambiguous term):
161
+ ```
162
+ Term: {TermName}
163
+ Generated definition: {definition}
164
+ Confidence: {score}/10
165
+ Inferred category: {category}
166
+
167
+ Options:
168
+ 1. Accept (keep definition as-is)
169
+ 2. Edit definition
170
+ 3. Change category
171
+ 4. Skip (exclude from glossary)
172
+
173
+ Your choice: _
174
+ ```
175
+
176
+ **User actions**:
177
+ - If Accept → keep generated definition and category
178
+ - If Edit → prompt for new definition, keep category
179
+ - If Change category → prompt for new category, keep definition
180
+ - If Skip → exclude term from glossary
181
+
182
+ **Expected Outcome**: All terms have user-approved definitions and categories
183
+
184
+ ### 5. Organize into Categories
185
+
186
+ Group terms by category and build alphabetical index.
187
+
188
+ **Actions**:
189
+ - **Group by category**:
190
+ - Sort categories alphabetically
191
+ - Within each category, sort terms alphabetically
192
+ - **Build category tables**:
193
+ - Format: `| Term | Definition |`
194
+ - One table per category
195
+ - **Build alphabetical index**:
196
+ - Group by first letter (A-Z)
197
+ - Format: `- **{Term}** → {Category}`
198
+ - Link terms to their category section (if using anchor links)
199
+
200
+ **Category table example**:
201
+ ```markdown
202
+ ## Architecture
203
+
204
+ | Term | Definition |
205
+ |------|------------|
206
+ | **API Gateway** | Central entry point that routes requests to microservices |
207
+ | **Microservice** | Self-contained service with single responsibility |
208
+ ```
209
+
210
+ **Alphabetical index example**:
211
+ ```markdown
212
+ ### A
213
+ - **API Gateway** → Architecture
214
+
215
+ ### M
216
+ - **Microservice** → Architecture
217
+ ```
218
+
219
+ **Expected Outcome**: Terms organized into category tables with alphabetical index
220
+
221
+ ### 6. Create or Update Glossary File
222
+
223
+ Write the glossary artifact.
224
+
225
+ **Actions**:
226
+
227
+ **If create mode**:
228
+ - Determine next glossary number:
229
+ - List files in `agent/artifacts/` matching `glossary-*`
230
+ - Parse highest number, increment by 1
231
+ - Create file: `agent/artifacts/glossary-{N}-{title}.md`
232
+ - Default title: "core-terminology"
233
+ - If `--output <path>` provided, use that path instead
234
+ - Start from template: `agent/artifacts/glossary.template.md`
235
+ - Fill metadata block:
236
+ - **Type**: glossary
237
+ - **Created**: Today's date (YYYY-MM-DD)
238
+ - **Last Verified**: Same as Created
239
+ - **Status**: Active
240
+ - **Confidence**: High (9-10/10) if all terms approved by user, Medium (5-8/10) otherwise
241
+ - **Category**: Terminology
242
+ - **Total Terms**: Count of terms in glossary
243
+ - Fill Purpose section (why this glossary exists)
244
+ - Fill category tables with terms
245
+ - Fill alphabetical index
246
+ - Fill Related Documents section (if applicable)
247
+
248
+ **If update mode**:
249
+ - Read existing glossary file
250
+ - Parse existing terms and categories
251
+ - Merge new terms into existing categories
252
+ - If new category needed, add new section
253
+ - If term already exists, skip (avoid duplicates)
254
+ - Update metadata:
255
+ - **Last Verified**: Today's date
256
+ - **Total Terms**: Updated count
257
+ - Re-sort category tables alphabetically
258
+ - Re-build alphabetical index with all terms (existing + new)
259
+
260
+ **Expected Outcome**: Glossary file created or updated with all terms
261
+
262
+ ### 7. Auto-Commit (unless `--no-commit`)
263
+
264
+ Commit the glossary artifact.
265
+
266
+ **Actions**:
267
+ - If create mode:
268
+ - `git add agent/artifacts/glossary-{N}-{title}.md`
269
+ - Commit message: `docs(artifact): create glossary {title} with {count} terms`
270
+ - If update mode:
271
+ - `git add agent/artifacts/glossary-{N}-{title}.md`
272
+ - Commit message: `docs(artifact): update glossary {title} (+{new-count} terms, {total} total)`
273
+ - If `--no-commit` flag:
274
+ - Leave file staged but uncommitted
275
+ - Notify user: "Glossary staged, awaiting commit."
276
+
277
+ **Expected Outcome**: Glossary committed (or staged if `--no-commit`)
278
+
279
+ ### 8. Report Success
280
+
281
+ Display what was produced.
282
+
283
+ **Output format**:
284
+ ```
285
+ ✅ Glossary {Created|Updated}!
286
+
287
+ File: agent/artifacts/glossary-{N}-{title}.md
288
+ Mode: {create|update}
289
+ Total terms: {count}
290
+ New terms: {new-count} (if update mode)
291
+ Categories: {category-list}
292
+ Status: Active
293
+
294
+ {If create: "✓ Baseline committed."}
295
+ {If update: "✓ Updated and committed."}
296
+ {If --no-commit: "ℹ️ Staged, not committed. Review and commit when ready."}
297
+
298
+ Next steps:
299
+ - Review the glossary for accuracy
300
+ - Add missing terms with `@acp.artifact-glossary --update`
301
+ - Reference glossary in onboarding docs
302
+ ```
303
+
304
+ **Expected Outcome**: User knows glossary is complete and where to find it
305
+
306
+ ---
307
+
308
+ ## Verification
309
+
310
+ - [ ] Mode determined (create or update)
311
+ - [ ] Codebase scanned for term candidates
312
+ - [ ] Definitions generated from context with confidence scores
313
+ - [ ] User prompted for ambiguous terms (unless `--auto`)
314
+ - [ ] Terms organized into category tables
315
+ - [ ] Alphabetical index built
316
+ - [ ] Glossary file created or updated
317
+ - [ ] Metadata block complete (Total Terms updated)
318
+ - [ ] Auto-commit executed (unless `--no-commit`)
319
+ - [ ] Success message displayed
320
+
321
+ ---
322
+
323
+ ## Expected Output
324
+
325
+ ### Files Created (create mode)
326
+ - `agent/artifacts/glossary-{N}-{title}.md` - Glossary artifact
327
+
328
+ ### Files Modified (update mode)
329
+ - `agent/artifacts/glossary-{N}-{title}.md` - Updated glossary
330
+
331
+ ### Console Output (create mode)
332
+ ```
333
+ ✅ Glossary Created!
334
+
335
+ File: agent/artifacts/glossary-1-core-terminology.md
336
+ Mode: create
337
+ Total terms: 15
338
+ Categories: Architecture (5), Data (4), Infrastructure (3), Security (3)
339
+ Status: Active
340
+
341
+ ✓ Baseline committed.
342
+
343
+ Next steps:
344
+ - Review the glossary for accuracy
345
+ - Add missing terms with `@acp.artifact-glossary --update`
346
+ - Reference glossary in onboarding docs
347
+ ```
348
+
349
+ ### Console Output (update mode)
350
+ ```
351
+ ✅ Glossary Updated!
352
+
353
+ File: agent/artifacts/glossary-1-core-terminology.md
354
+ Mode: update
355
+ Total terms: 20
356
+ New terms: 5
357
+ Categories: Architecture (7), Data (5), Infrastructure (4), Security (4)
358
+ Status: Active
359
+
360
+ ✓ Updated and committed.
361
+
362
+ Next steps:
363
+ - Review the new terms for accuracy
364
+ - Add missing terms with `@acp.artifact-glossary --update`
365
+ ```
366
+
367
+ ---
368
+
369
+ ## Examples
370
+
371
+ ### Example 1: Create Glossary
372
+
373
+ **Context**: New project, no glossary exists, want to catalog terminology
374
+
375
+ **Invocation**: `@acp.artifact-glossary`
376
+
377
+ **Result**: Agent scans entire codebase, extracts 15 terms (classes, interfaces, domain patterns), generates definitions from docstrings/comments, prompts for 3 ambiguous terms, creates `glossary-1-core-terminology.md` with 3 categories (Architecture, Data, Infrastructure), auto-commits.
378
+
379
+ ### Example 2: Update Glossary with New Terms
380
+
381
+ **Context**: Glossary exists, new module added (src/auth/), want to add auth-related terms
382
+
383
+ **Invocation**: `@acp.artifact-glossary --update --scope src/auth/`
384
+
385
+ **Result**: Agent scans src/auth/, extracts 5 new terms (AuthProvider, TokenService, RefreshToken, etc.), generates definitions, prompts for 1 ambiguous term, adds to existing glossary under new "Security" category, auto-commits with "+5 terms" message.
386
+
387
+ ### Example 3: Interactive Review of All Terms
388
+
389
+ **Context**: Want to review every extracted term before accepting
390
+
391
+ **Invocation**: `@acp.artifact-glossary --interactive`
392
+
393
+ **Result**: Agent extracts 20 terms, prompts for EVERY term (not just ambiguous ones), user edits 3 definitions and changes 2 categories, creates glossary with all user-approved content.
394
+
395
+ ### Example 4: Auto-Accept All Terms
396
+
397
+ **Context**: High confidence in codebase documentation, want fast glossary creation
398
+
399
+ **Invocation**: `@acp.artifact-glossary --auto`
400
+
401
+ **Result**: Agent extracts terms, generates definitions, skips all prompts, creates glossary with inferred definitions and categories, auto-commits immediately.
402
+
403
+ ### Example 5: Force Create New Glossary
404
+
405
+ **Context**: Existing glossary is for backend, want separate frontend glossary
406
+
407
+ **Invocation**: `@acp.artifact-glossary --create --scope src/frontend/ --output agent/artifacts/glossary-2-frontend-terminology.md`
408
+
409
+ **Result**: Agent creates new `glossary-2-frontend-terminology.md` (does not update existing glossary-1), extracts frontend-specific terms, commits as separate glossary.
410
+
411
+ ---
412
+
413
+ ## Related Commands
414
+
415
+ - [`@acp.artifact-research`](acp.artifact-research.md) - Create research artifacts (external knowledge)
416
+ - [`@acp.artifact-reference`](acp.artifact-reference.md) - Create reference guides (passive info)
417
+ - [`@acp.sync`](acp.sync.md) - Detect glossary staleness (new terms in code not in glossary)
418
+ - [`@acp.validate`](acp.validate.md) - Validate artifact metadata and structure
419
+
420
+ ---
421
+
422
+ ## Troubleshooting
423
+
424
+ ### Issue 1: Too many generic terms extracted
425
+
426
+ **Symptom**: Glossary includes common framework terms (React, Node, Express)
427
+
428
+ **Cause**: Heuristics too broad, extracting non-project-specific terms
429
+
430
+ **Solution**: Skip generic terms during extraction. Manually remove from glossary in update mode.
431
+
432
+ ### Issue 2: Definitions too technical or implementation-focused
433
+
434
+ **Symptom**: Definitions describe how code works, not what concept means
435
+
436
+ **Cause**: Insufficient context in code (no docstrings), agent infers from implementation
437
+
438
+ **Solution**: Prompt user to edit definitions. Add docstrings to code for future updates.
439
+
440
+ ### Issue 3: Terms in wrong category
441
+
442
+ **Symptom**: "JWT" in Architecture category, should be in Security
443
+
444
+ **Cause**: Category inference based on file location, not semantic meaning
445
+
446
+ **Solution**: Use `--interactive` to review and correct categories. Or manually edit glossary file.
447
+
448
+ ### Issue 4: Glossary becoming unwieldy (50+ terms)
449
+
450
+ **Symptom**: Single glossary file is long and hard to navigate
451
+
452
+ **Cause**: Project has grown, many domain areas
453
+
454
+ **Solution**: Split into multiple glossaries by domain (backend, frontend, infrastructure). Use `--create --scope` to create domain-specific glossaries.
455
+
456
+ ---
457
+
458
+ ## Security Considerations
459
+
460
+ ### File Access
461
+ - **Reads**: All files in project (for term extraction)
462
+ - **Writes**: `agent/artifacts/glossary-{N}-{title}.md` only
463
+ - **Executes**: `git add`, `git commit` (if auto-commit)
464
+
465
+ ### Network Access
466
+ - **APIs**: None (codebase-only command)
467
+ - **Repositories**: Local git only (no remote operations)
468
+
469
+ ### Sensitive Data
470
+ - **Secrets**: Never extract terms from `.env` files or secret configs
471
+ - **Private data**: Skip extraction from `secrets/`, `credentials/`, `.env*` patterns
472
+
473
+ ---
474
+
475
+ ## Key Design Decisions
476
+
477
+ ### Term Extraction
478
+
479
+ | Decision | Choice | Rationale |
480
+ |---|---|---|
481
+ | Auto-extraction | Yes, from classes/interfaces/types/comments | Reduces manual work, ensures glossary completeness |
482
+ | Confidence scoring | Yes, per term (1-10) | Indicates definition quality, triggers prompts for low-confidence |
483
+ | Category inference | Yes, based on file location and term type | Automates organization, user can override in interactive mode |
484
+ | Deduplication | Yes, prefer most authoritative definition | Prevents duplicate terms with conflicting definitions |
485
+
486
+ ### Interactive Refinement
487
+
488
+ | Decision | Choice | Rationale |
489
+ |---|---|---|
490
+ | Prompt conditions | Low confidence, conflicts, ambiguous category, or `--interactive` | Balances automation with quality, user controls review level |
491
+ | Auto mode | Accept all inferred definitions (no prompts) | Fast path for well-documented codebases |
492
+ | Interactive mode | Prompt for every term | Full user control for critical glossaries |
493
+
494
+ ### Living Document Pattern
495
+
496
+ | Decision | Choice | Rationale |
497
+ |---|---|---|
498
+ | Single glossary | Until 50+ terms | Start simple, split only when domain boundaries emerge |
499
+ | Update mode | Merge new terms into existing glossary | Maintains single canonical glossary, avoids proliferation |
500
+ | Category organization | Group by category + alphabetical index | Category aids conceptual understanding, index aids fast lookup |
501
+
502
+ ### Integration
503
+
504
+ | Decision | Choice | Rationale |
505
+ |---|---|---|
506
+ | Template-based | Use `glossary.template.md` | Consistent structure across glossaries |
507
+ | Auto-commit | Yes (default), `--no-commit` to disable | Establishes baseline, enables visible diff |
508
+ | Scope filtering | `--scope <path>` for targeted extraction | Enables domain-specific glossaries |
509
+
510
+ ---
511
+
512
+ ## Notes
513
+
514
+ - Glossaries are living documents — update frequently as codebase evolves
515
+ - Category boundaries are fluid — reorganize categories as project understanding matures
516
+ - Consider splitting into multiple glossaries when 50+ terms or clear domain boundaries emerge
517
+ - Reference glossaries in onboarding docs and README for maximum value
518
+ - Glossaries complement research artifacts (external knowledge) and reference artifacts (passive info)
519
+ - Use `@acp.sync` to detect staleness (new terms in code not in glossary)
520
+
521
+ ---
522
+
523
+ **Namespace**: acp
524
+ **Command**: artifact-glossary
525
+ **Version**: 1.0.0
526
+ **Created**: 2026-03-17
527
+ **Last Updated**: 2026-03-17
528
+ **Status**: Active
529
+ **Compatibility**: ACP 5.25.0+
530
+ **Author**: ACP Project