universal-agent-memory 0.3.0 → 0.4.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.
@@ -1,15 +1,35 @@
1
1
  <!--
2
- CLAUDE.md Universal Template - Optimized v3.0
2
+ CLAUDE.md Universal Template - v4.0
3
3
 
4
- Single-source-of-truth workflow engine with zero duplication.
4
+ Complete autonomous agent operating system with zero duplication.
5
5
  All variables populated by UAM generator from project analysis.
6
6
 
7
- Template Variables: {{PROJECT_NAME}}, {{PROJECT_PATH}}, {{DEFAULT_BRANCH}},
8
- {{MEMORY_DB_PATH}}, {{MEMORY_QUERY_CMD}}, {{MEMORY_STORE_CMD}}, {{MEMORY_START_CMD}},
9
- {{LONG_TERM_BACKEND}}, {{LONG_TERM_ENDPOINT}}, {{LONG_TERM_COLLECTION}}, {{SHORT_TERM_LIMIT}},
10
- {{WORKTREE_CREATE_CMD}}, {{WORKTREE_PR_CMD}}, {{WORKTREE_CLEANUP_CMD}}, {{WORKTREE_DIR}},
11
- {{BRANCH_PREFIX}}, {{SKILLS_PATH}}, {{DROIDS_PATH}}, {{COMMANDS_PATH}}, {{DOCS_PATH}},
12
- {{SCREENSHOTS_PATH}}, {{TEST_COMMAND}}, {{STRUCTURE_DATE}}
7
+ Core Variables:
8
+ {{PROJECT_NAME}}, {{PROJECT_PATH}}, {{DEFAULT_BRANCH}}, {{STRUCTURE_DATE}}
9
+
10
+ Memory System:
11
+ {{MEMORY_DB_PATH}}, {{MEMORY_QUERY_CMD}}, {{MEMORY_STORE_CMD}}, {{MEMORY_START_CMD}},
12
+ {{MEMORY_STATUS_CMD}}, {{MEMORY_STOP_CMD}}, {{LONG_TERM_BACKEND}}, {{LONG_TERM_ENDPOINT}},
13
+ {{LONG_TERM_COLLECTION}}, {{SHORT_TERM_LIMIT}}
14
+
15
+ Worktree:
16
+ {{WORKTREE_CREATE_CMD}}, {{WORKTREE_PR_CMD}}, {{WORKTREE_CLEANUP_CMD}},
17
+ {{WORKTREE_DIR}}, {{BRANCH_PREFIX}}
18
+
19
+ Paths:
20
+ {{SKILLS_PATH}}, {{DROIDS_PATH}}, {{COMMANDS_PATH}}, {{DOCS_PATH}}, {{SCREENSHOTS_PATH}}
21
+
22
+ Commands:
23
+ {{TEST_COMMAND}}, {{BUILD_COMMAND}}, {{LINT_COMMAND}}
24
+
25
+ Conditional Sections (auto-populated from analysis):
26
+ REPOSITORY_STRUCTURE, ARCHITECTURE_OVERVIEW, DATABASE_ARCHITECTURE,
27
+ CORE_COMPONENTS, CLUSTER_CONTEXTS, PROJECT_URLS, KEY_WORKFLOWS,
28
+ ESSENTIAL_COMMANDS, INFRA_WORKFLOW, HEALTH_CHECKS, ROLLBACK_PROCEDURES,
29
+ INCIDENT_RESPONSE, TROUBLESHOOTING, KEY_CONFIG_FILES, DISCOVERED_SKILLS,
30
+ LANGUAGE_DROIDS, FILE_TYPE_ROUTING, SKILL_TRIGGERS, SKILL_MAPPINGS,
31
+ RECENT_ACTIVITY, LEARNED_LESSONS, KNOWN_GOTCHAS, HOT_SPOTS, AUTH_FLOW,
32
+ MCP_PLUGINS, PATH_MIGRATIONS
13
33
  -->
14
34
 
15
35
  <coding_guidelines>
@@ -18,6 +38,10 @@
18
38
 
19
39
  You are an autonomous AI agent. Follow the WORKFLOW ENGINE below for EVERY action. No exceptions.
20
40
 
41
+ {{#if ISSUE_TRACKER}}
42
+ **Note**: {{{ISSUE_TRACKER}}}
43
+ {{/if}}
44
+
21
45
  ---
22
46
 
23
47
  ## WORKFLOW ENGINE (Execute Every Time)
@@ -31,10 +55,10 @@ You are an autonomous AI agent. Follow the WORKFLOW ENGINE below for EVERY actio
31
55
  │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
32
56
  │ │ │ │ │ │ │
33
57
  │ ▼ ▼ ▼ ▼ ▼ │
34
- ┌─────────────────────────────────────────────────────────────────────┐
58
+ ┌─────────────────────────────────────────────────────────────────────────┐
35
59
  │ │ CHECK TASKS │ CREATE/CLAIM │ MEMORY+SKILL │ WORKTREE+DO │ VERIFY │ │
36
60
  │ │ READ MEMORY │ TASK │ CHECK │ TEST+PR │ RELEASE │ │
37
- └─────────────────────────────────────────────────────────────────────┘
61
+ └─────────────────────────────────────────────────────────────────────────┘
38
62
  │ │
39
63
  │ GATES: Each phase MUST complete before advancing. No skipping. │
40
64
  │ │
@@ -113,6 +137,54 @@ uam task release <id> --reason "Completed: summary"
113
137
 
114
138
  ---
115
139
 
140
+ ## AUTOMATIC TRIGGERS
141
+
142
+ | Pattern Detected | Immediate Action |
143
+ |-----------------|------------------|
144
+ | Work request (fix/add/change/create/build) | `uam task create --title "..." --type task` |
145
+ | Bug report or error | `uam task create --title "..." --type bug --priority 1` |
146
+ | Feature request | `uam task create --title "..." --type feature` |
147
+ | Code file editing | Check skills → Create worktree → Edit |
148
+ | Review/check request | Query memory first |
149
+ {{#if SKILL_TRIGGERS}}
150
+ {{{SKILL_TRIGGERS}}}
151
+ {{/if}}
152
+
153
+ ---
154
+
155
+ ## TASK ROUTING
156
+
157
+ ### By Request Type
158
+ | Keywords | Task Type | Workflow | Droids |
159
+ |----------|-----------|----------|--------|
160
+ | "fix", "bug", "error", "broken" | Bug | Reproduce → Test → Fix | `code-quality-guardian` |
161
+ | "add", "implement", "build", "feature" | Feature | Design → Implement → Test | Language specialist |
162
+ | "slow", "optimize", "performance" | Performance | Profile → Identify → Optimize | `performance-optimizer` |
163
+ | "security", "vulnerability", "audit" | Security | Scan → Assess → Remediate | `security-auditor` |
164
+ | "test", "coverage", "spec" | Testing | Write → Run → Report | `code-quality-guardian` |
165
+ | "docs", "README", "document" | Docs | Check → Update → Verify | `documentation-expert` |
166
+ | "refactor", "clean up" | Refactoring | Scope → Test → Refactor | `code-quality-guardian` |
167
+ {{#if HAS_INFRA}}
168
+ | "terraform", "infra", "k8s", "cluster" | Infrastructure | Plan → Apply → Verify → Document | Direct handling |
169
+ {{/if}}
170
+
171
+ ### By File Type
172
+ | Extension | Language | Droid |
173
+ |-----------|----------|-------|
174
+ {{#if FILE_TYPE_ROUTING}}
175
+ {{{FILE_TYPE_ROUTING}}}
176
+ {{else}}
177
+ | `.ts`, `.tsx`, `.js`, `.jsx` | TypeScript/JavaScript | `typescript-node-expert` |
178
+ | `.py` | Python | Language specialist |
179
+ | `.go` | Go | Language specialist |
180
+ | `.rs` | Rust | Language specialist |
181
+ | `.cpp`, `.h`, `.hpp` | C++ | Language specialist |
182
+ | `.tf` | Terraform | Direct handling |
183
+ | `.yaml`, `.yml` | Kubernetes/Config | Direct handling |
184
+ {{/if}}
185
+
186
+ ---
187
+
116
188
  ## QUICK REFERENCE
117
189
 
118
190
  ### Task Commands
@@ -164,19 +236,53 @@ Task(subagent_type: "code-quality-guardian", prompt: "Review...")
164
236
  Task(subagent_type: "security-auditor", prompt: "Audit...")
165
237
  ```
166
238
 
239
+ ### Skill vs Droid: When to Use Which
240
+ | Use a **Skill** when | Use a **Droid** when |
241
+ |---------------------|---------------------|
242
+ | Inline guidance needed | Autonomous agent work needed |
243
+ | Human follows instructions | Agent executes independently |
244
+ | Interactive decision-making | Batch processing of tasks |
245
+ | Design/review work | Code generation/refactoring |
246
+ | Expands into current context | Runs in parallel as subagent |
247
+
167
248
  ---
168
249
 
169
- ## AUTOMATIC TRIGGERS
250
+ ## RULES (Zero Tolerance)
170
251
 
171
- | Pattern Detected | Immediate Action |
172
- |-----------------|------------------|
173
- | Work request (fix/add/change/create/build) | `uam task create --title "..." --type task` |
174
- | Bug report or error | `uam task create --title "..." --type bug --priority 1` |
175
- | Feature request | `uam task create --title "..." --type feature` |
176
- | Code file editing | Check skills Create worktree → Edit |
177
- | Review/check request | Query memory first |
178
- {{#if SKILL_TRIGGERS}}
179
- {{{SKILL_TRIGGERS}}}
252
+ ### 1. Worktrees
253
+ ```
254
+ ┌─────────────────────────────────────────────────────────────────────────────┐
255
+ │ WORKTREE ENFORCEMENT - ABSOLUTE RULE │
256
+ ├─────────────────────────────────────────────────────────────────────────────┤
257
+ │ ❌ FORBIDDEN: Direct commits to {{DEFAULT_BRANCH}}, editing main repo │
258
+ │ ✅ REQUIRED: Create worktree cd into it → make changes → PR │
259
+ │ 🔴 SELF-CHECK: pwd | grep -q "{{WORKTREE_DIR}}" || echo "STOP!" │
260
+ └─────────────────────────────────────────────────────────────────────────────┘
261
+ ```
262
+
263
+ **Applies to:** {{WORKTREE_APPLIES_TO}}
264
+
265
+ ### 2. Tasks
266
+ - **ALWAYS** create task before work
267
+ - **ALWAYS** claim before starting
268
+ - **ALWAYS** release when complete
269
+ - **NEVER** work without task tracking
270
+
271
+ ### 3. Memory
272
+ - **ALWAYS** query memory at task start
273
+ - **ALWAYS** update short-term after actions
274
+ - **ALWAYS** store learnings (importance 7+) in long-term
275
+ - **NEVER** complete task without memory update
276
+
277
+ ### 4. Skills
278
+ - **ALWAYS** check for applicable skills before implementing
279
+ - **ALWAYS** invoke proactively for specialized work
280
+ - **NEVER** implement without consulting relevant skill/droid
281
+
282
+ {{#if SKILL_MAPPINGS}}
283
+ | Task Type | Required Skill/Droid |
284
+ |-----------|---------------------|
285
+ {{{SKILL_MAPPINGS}}}
180
286
  {{/if}}
181
287
 
182
288
  ---
@@ -185,23 +291,21 @@ Task(subagent_type: "security-auditor", prompt: "Audit...")
185
291
 
186
292
  ### Forgot to create task?
187
293
  ```bash
188
- # Create task now, link existing work
189
294
  uam task create --title "Retroactive: what you did" --type task
190
295
  uam task update <id> --status in_progress
191
- # Continue with workflow, release when done
192
296
  ```
193
297
 
194
298
  ### Forgot worktree? Edited main repo directly?
195
299
  ```bash
196
- # If not committed yet: stash and move to worktree
300
+ # If not committed: stash and move
197
301
  git stash
198
302
  {{WORKTREE_CREATE_CMD}} <slug>
199
303
  cd {{WORKTREE_DIR}}/NNN-<slug>/
200
304
  git stash pop
201
305
 
202
- # If already committed: cherry-pick to worktree, reset main
203
- git log -1 --format="%H" # Note commit hash
204
- git reset --hard HEAD~1 # Remove from main
306
+ # If committed: cherry-pick to worktree, reset main
307
+ git log -1 --format="%H"
308
+ git reset --hard HEAD~1
205
309
  {{WORKTREE_CREATE_CMD}} <slug>
206
310
  cd {{WORKTREE_DIR}}/NNN-<slug>/
207
311
  git cherry-pick <hash>
@@ -209,45 +313,36 @@ git cherry-pick <hash>
209
313
 
210
314
  ### Command failed?
211
315
  ```bash
212
- # Check service status
213
316
  {{MEMORY_START_CMD}}
214
317
  uam coord status
215
-
216
- # Verify database exists
217
318
  ls -la {{MEMORY_DB_PATH}}
218
319
  ```
219
320
 
220
321
  ---
221
322
 
222
- ## RULES (Zero Tolerance)
223
-
224
- ### 1. Tasks
225
- - **ALWAYS** create task before work
226
- - **ALWAYS** claim before starting
227
- - **ALWAYS** release when complete
228
- - **NEVER** work without task tracking
229
-
230
- ### 2. Worktrees
231
- - **ALWAYS** create worktree for code changes
232
- - **ALWAYS** verify `pwd` contains `{{WORKTREE_DIR}}`
233
- - **ALWAYS** use PR, never direct push
234
- - **NEVER** commit directly to {{DEFAULT_BRANCH}}
235
-
236
- ### 3. Memory
237
- - **ALWAYS** query memory at task start
238
- - **ALWAYS** update short-term after actions
239
- - **ALWAYS** store learnings (importance 7+) in long-term
240
- - **NEVER** complete task without memory update
241
-
242
- ### 4. Skills
243
- - **ALWAYS** check for applicable skills before implementing
244
- - **ALWAYS** invoke proactively for: TypeScript, CLI, Frontend, Security, Performance
245
- - **NEVER** implement without consulting relevant skill/droid
246
-
247
- ---
248
-
249
323
  ## MEMORY SYSTEM
250
324
 
325
+ ### 4-Layer Architecture
326
+ ```
327
+ ┌─────────────────────────────────────────────────────────────────────┐
328
+ │ LAYER 1: WORKING MEMORY (SQLite) ~0.15ms access │
329
+ │ ├─ {{SHORT_TERM_LIMIT}} entries max, FIFO eviction │
330
+ │ └─ Path: {{MEMORY_DB_PATH}} │
331
+ │ │
332
+ │ LAYER 2: SESSION MEMORY (SQLite) ~0.2ms access │
333
+ │ ├─ Session-scoped summaries and decisions │
334
+ │ └─ Cleaned on session end │
335
+ │ │
336
+ │ LAYER 3: SEMANTIC MEMORY ({{LONG_TERM_BACKEND}}) ~1-2ms search │
337
+ │ ├─ Vector embeddings for semantic search │
338
+ │ └─ Endpoint: {{LONG_TERM_ENDPOINT}} │
339
+ │ │
340
+ │ LAYER 4: KNOWLEDGE GRAPH (SQLite) ~0.17ms query │
341
+ │ ├─ Entities: files, functions, concepts, errors │
342
+ │ └─ Relationships: depends_on, fixes, causes, related_to │
343
+ └─────────────────────────────────────────────────────────────────────┘
344
+ ```
345
+
251
346
  ### Layer Selection
252
347
  | Question | If YES → Layer |
253
348
  |----------|---------------|
@@ -263,9 +358,9 @@ ls -la {{MEMORY_DB_PATH}}
263
358
  - Gotchas and workarounds
264
359
  - API behaviors that aren't obvious
265
360
 
266
- ### Services
361
+ ### Memory Services
267
362
  ```bash
268
- {{MEMORY_START_CMD}} # Start Qdrant
363
+ {{MEMORY_START_CMD}} # Start services
269
364
  {{MEMORY_STATUS_CMD}} # Check status
270
365
  {{MEMORY_STOP_CMD}} # Stop services
271
366
  uam memory migrate # Upgrade schema
@@ -282,6 +377,13 @@ uam memory migrate # Upgrade schema
282
377
  | `performance-optimizer` | Performance-critical | Algorithms, memory, caching |
283
378
  | `documentation-expert` | New features/APIs | JSDoc, README, accuracy |
284
379
 
380
+ {{#if LANGUAGE_DROIDS}}
381
+ ### Language Specialists
382
+ | Droid | Expertise |
383
+ |-------|-----------|
384
+ {{{LANGUAGE_DROIDS}}}
385
+ {{/if}}
386
+
285
387
  ---
286
388
 
287
389
  ## BROWSER AUTOMATION
@@ -301,22 +403,10 @@ After EVERY browser action:
301
403
  ```
302
404
  {{/if}}
303
405
 
304
- {{#if ARCHITECTURE_OVERVIEW}}
305
- ## Architecture
406
+ {{#if PATH_MIGRATIONS}}
407
+ ### Path Migration Reference
306
408
 
307
- {{{ARCHITECTURE_OVERVIEW}}}
308
- {{/if}}
309
-
310
- {{#if DATABASE_ARCHITECTURE}}
311
- ### Database
312
-
313
- {{{DATABASE_ARCHITECTURE}}}
314
- {{/if}}
315
-
316
- {{#if CORE_COMPONENTS}}
317
- ## Core Components
318
-
319
- {{{CORE_COMPONENTS}}}
409
+ {{{PATH_MIGRATIONS}}}
320
410
  {{/if}}
321
411
 
322
412
  {{#if CLUSTER_CONTEXTS}}
@@ -349,12 +439,54 @@ After EVERY browser action:
349
439
  ```
350
440
  {{/if}}
351
441
 
442
+ {{#if ARCHITECTURE_OVERVIEW}}
443
+ ## Architecture
444
+
445
+ {{{ARCHITECTURE_OVERVIEW}}}
446
+ {{/if}}
447
+
448
+ {{#if DATABASE_ARCHITECTURE}}
449
+ ### Database
450
+
451
+ {{{DATABASE_ARCHITECTURE}}}
452
+ {{/if}}
453
+
454
+ {{#if CORE_COMPONENTS}}
455
+ ## Core Components
456
+
457
+ {{{CORE_COMPONENTS}}}
458
+ {{/if}}
459
+
460
+ {{#if AUTH_FLOW}}
461
+ ## Authentication Flow
462
+
463
+ {{{AUTH_FLOW}}}
464
+ {{/if}}
465
+
352
466
  {{#if INFRA_WORKFLOW}}
353
467
  ## Infrastructure Workflow
354
468
 
355
469
  {{{INFRA_WORKFLOW}}}
356
470
  {{/if}}
357
471
 
472
+ {{#if HEALTH_CHECKS}}
473
+ ## Health Checks
474
+
475
+ {{{HEALTH_CHECKS}}}
476
+ {{/if}}
477
+
478
+ {{#if ROLLBACK_PROCEDURES}}
479
+ ## Emergency Rollback
480
+
481
+ {{{ROLLBACK_PROCEDURES}}}
482
+ {{/if}}
483
+
484
+ {{#if INCIDENT_RESPONSE}}
485
+ ## Incident Response
486
+
487
+ {{{INCIDENT_RESPONSE}}}
488
+ {{/if}}
489
+
358
490
  {{#if TROUBLESHOOTING}}
359
491
  ## Troubleshooting
360
492
 
@@ -372,30 +504,40 @@ After EVERY browser action:
372
504
  {{#if DISCOVERED_SKILLS}}
373
505
  ## Project Skills
374
506
 
507
+ | Skill | Purpose | Use When |
508
+ |-------|---------|----------|
375
509
  {{{DISCOVERED_SKILLS}}}
376
510
  {{/if}}
377
511
 
378
- {{#if LANGUAGE_DROIDS}}
379
- ## Language Specialists
512
+ {{#if MCP_PLUGINS}}
513
+ ## MCP Plugins
380
514
 
381
- {{{LANGUAGE_DROIDS}}}
515
+ | Plugin | Purpose |
516
+ |--------|---------|
517
+ {{{MCP_PLUGINS}}}
382
518
  {{/if}}
383
519
 
384
- {{#if PREPOPULATED_KNOWLEDGE}}
520
+ {{#if RECENT_ACTIVITY}}
385
521
  ## Project Knowledge
386
522
 
387
523
  ### Recent Activity
388
524
  {{{RECENT_ACTIVITY}}}
389
525
 
526
+ {{#if LEARNED_LESSONS}}
390
527
  ### Learned Lessons
391
528
  {{{LEARNED_LESSONS}}}
529
+ {{/if}}
392
530
 
531
+ {{#if KNOWN_GOTCHAS}}
393
532
  ### Known Gotchas
394
533
  {{{KNOWN_GOTCHAS}}}
534
+ {{/if}}
395
535
 
536
+ {{#if HOT_SPOTS}}
396
537
  ### Hot Spots
397
538
  {{{HOT_SPOTS}}}
398
539
  {{/if}}
540
+ {{/if}}
399
541
 
400
542
  ---
401
543
 
@@ -409,6 +551,9 @@ After EVERY browser action:
409
551
  [ ] Memory updated (short + long term)
410
552
  [ ] Skills consulted
411
553
  [ ] No secrets in code
554
+ {{#if HAS_INFRA}}
555
+ [ ] Infrastructure changes documented
556
+ {{/if}}
412
557
  ```
413
558
 
414
559
  </coding_guidelines>