universal-agent-memory 0.2.0 → 0.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-agent-memory",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Universal AI agent memory system - CLAUDE.md templates, memory, worktrees for Claude Code, Factory.AI, VSCode, OpenCode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -2,7 +2,7 @@
2
2
  CLAUDE.md Universal Template for AI Agent Memory System
3
3
 
4
4
  This template is the master source for generating project-specific CLAUDE.md files.
5
- It provides autonomous AI agent operation with full memory system, worktrees, and skills.
5
+ It provides autonomous AI agent operation with full memory, tasks, coordination, worktrees, and skills.
6
6
 
7
7
  All variables are populated by the UAM generator from project analysis.
8
8
 
@@ -10,6 +10,7 @@
10
10
  ==================
11
11
  Core:
12
12
  {{PROJECT_NAME}} - Name of the project (from package.json or git)
13
+ {{PROJECT_PATH}} - Absolute path to project root
13
14
  {{DEFAULT_BRANCH}} - Main branch name (main/master)
14
15
  {{STRUCTURE_DATE}} - Date of last structure update
15
16
 
@@ -43,6 +44,8 @@
43
44
 
44
45
  Commands:
45
46
  {{TEST_COMMAND}} - Command to run tests
47
+ {{LINT_COMMAND}} - Command to run linting
48
+ {{BUILD_COMMAND}} - Command to build project
46
49
  {{HOOKS_INSTALL_CMD}} - Command to install git hooks
47
50
 
48
51
  Optional Sections (Handlebars conditionals):
@@ -62,7 +65,74 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
62
65
 
63
66
  ---
64
67
 
65
- ## CRITICAL: READ THIS FIRST - EVERY SINGLE TIME
68
+ ## 🚨 SESSION START - EXECUTE IMMEDIATELY 🚨
69
+
70
+ **STOP. Before responding to ANY user message, EXECUTE these commands NOW:**
71
+
72
+ ```bash
73
+ # 1. CHECK EXISTING TASKS (run this first)
74
+ uam task ready
75
+
76
+ # 2. READ RECENT MEMORY (run this second)
77
+ sqlite3 {{MEMORY_DB_PATH}} "SELECT * FROM memories ORDER BY id DESC LIMIT 10;"
78
+ ```
79
+
80
+ **If the user requests ANY work, IMMEDIATELY run:**
81
+
82
+ ```bash
83
+ uam task create --title "User's request summary" --type task
84
+ ```
85
+
86
+ **DO NOT** proceed with any analysis, explanation, or implementation until you have:
87
+
88
+ 1. ✅ Checked `uam task ready` for existing tasks
89
+ 2. ✅ Read short-term memory
90
+ 3. ✅ Created a task (if work requested)
91
+
92
+ ---
93
+
94
+ ## AUTOMATIC TRIGGERS - NO THINKING REQUIRED
95
+
96
+ **When you see these patterns, execute the corresponding command IMMEDIATELY:**
97
+
98
+ | User Says | YOU MUST IMMEDIATELY EXECUTE |
99
+ |-----------|------------------------------|
100
+ | Any work request ("fix", "add", "change", "update", "create", "implement", "build") | `uam task create --title "..." --type task` |
101
+ | Bug report or error | `uam task create --title "..." --type bug --priority 1` |
102
+ | New feature request | `uam task create --title "..." --type feature` |
103
+ | Any code file mentioned for editing | `uam task ready` then check skills, then create worktree |
104
+ | "review", "check", "look at" | Query memory first: `sqlite3 {{MEMORY_DB_PATH}} "SELECT * FROM memories ORDER BY id DESC LIMIT 20;"` |
105
+ {{#if SKILL_TRIGGERS}}
106
+ {{{SKILL_TRIGGERS}}}
107
+ {{/if}}
108
+
109
+ **These are NOT suggestions. These are COMMANDS. Execute them before your first word of response.**
110
+
111
+ ---
112
+
113
+ ## BEFORE FIRST RESPONSE CHECKLIST
114
+
115
+ **Complete ALL items before typing ANY response:**
116
+
117
+ ```
118
+ ┌─────────────────────────────────────────────────────────────────────────────┐
119
+ │ MANDATORY PRE-RESPONSE CHECKLIST │
120
+ ├─────────────────────────────────────────────────────────────────────────────┤
121
+ │ │
122
+ │ [ ] 1. Ran `uam task ready`? │
123
+ │ [ ] 2. Queried short-term memory? │
124
+ │ [ ] 3. If work requested → Created task with `uam task create`? │
125
+ │ [ ] 4. If code work → Identified applicable skill? │
126
+ │ [ ] 5. If code work → Created worktree? │
127
+ │ │
128
+ │ ⚠️ If ANY checkbox is unchecked, STOP and complete it NOW. │
129
+ │ │
130
+ └─────────────────────────────────────────────────────────────────────────────┘
131
+ ```
132
+
133
+ ---
134
+
135
+ ## CRITICAL: MANDATORY DECISION LOOP
66
136
 
67
137
  **YOU MUST FOLLOW THE DECISION LOOP BELOW FOR EVERY ACTION. NO EXCEPTIONS.**
68
138
 
@@ -72,39 +142,47 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
72
142
  │ (Execute this for EVERY task) │
73
143
  ├─────────────────────────────────────────────────────────────────────────────┤
74
144
  │ │
75
- │ 1. READ MEMORY FIRST
145
+ │ 1. CREATE/CLAIM TASK FIRST
146
+ │ ├─ Check existing: uam task list --show-ready │
147
+ │ ├─ Create if needed: uam task create --title "..." --type task │
148
+ │ ├─ Claim it: uam task claim <id> │
149
+ │ └─ This announces work and detects overlaps automatically │
150
+ │ │
151
+ │ 2. READ MEMORY │
76
152
  │ ├─ Query short-term: sqlite3 {{MEMORY_DB_PATH}} │
77
153
  │ │ "SELECT * FROM memories ORDER BY id DESC LIMIT 20;" │
78
154
  │ └─ Query long-term for relevant context: │
79
155
  │ {{MEMORY_QUERY_CMD}} "<keywords related to current task>" │
80
156
  │ │
81
- 2. CHECK FOR APPLICABLE SKILLS │
157
+ 3. CHECK FOR APPLICABLE SKILLS │
82
158
  │ ├─ Review {{SKILLS_PATH}} for relevant skills │
83
159
  {{#if PRIMARY_SKILLS}}
84
160
  {{{PRIMARY_SKILLS}}}
85
161
  {{/if}}
86
162
  │ └─ Invoke skill BEFORE starting implementation │
87
163
  │ │
88
- 3. CREATE WORKTREE (for ANY code changes) │
164
+ 4. CREATE WORKTREE (for ANY code changes) │
89
165
  │ ├─ {{WORKTREE_CREATE_CMD}} <slug> │
90
166
  │ ├─ cd {{WORKTREE_DIR}}/NNN-<slug>/ │
91
167
  │ └─ NEVER commit directly to {{DEFAULT_BRANCH}} │
92
168
  │ │
93
- 4. CREATE TODO LIST (for 3+ step tasks) │
169
+ 5. CREATE TODO LIST (for 3+ step tasks) │
94
170
  │ ├─ Use TodoWrite tool immediately │
95
171
  │ ├─ Update status after EACH step │
96
172
  │ └─ Mark completed items immediately │
97
173
  │ │
98
- 5. DO THE WORK │
174
+ 6. DO THE WORK │
99
175
  │ ├─ Implement changes │
100
- │ ├─ Run tests
176
+ │ ├─ Run tests: {{TEST_COMMAND}}
101
177
  │ └─ Create PR via {{WORKTREE_PR_CMD}} <id> │
102
178
  │ │
103
- 6. UPDATE MEMORY (after EVERY significant action) │
179
+ 7. UPDATE MEMORY (after EVERY significant action) │
104
180
  │ ├─ Short-term: INSERT INTO memories... │
105
181
  │ └─ Long-term (for learnings): {{MEMORY_STORE_CMD}} lesson... │
106
182
  │ │
107
- 7. VERIFY BEFORE RESPONDING
183
+ 8. RELEASE TASK & VERIFY
184
+ │ ├─ Release: uam task release <id> --reason "Completed: ..." │
185
+ │ ├─ [ ] Task released? │
108
186
  │ ├─ [ ] Memory updated? │
109
187
  │ ├─ [ ] Worktree used? │
110
188
  │ ├─ [ ] PR created (not direct commit)? │
@@ -120,29 +198,117 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
120
198
 
121
199
  **FAILURE TO FOLLOW THESE RULES IS A CRITICAL ERROR. STOP AND RE-READ IF UNSURE.**
122
200
 
201
+ ### 0. TASK MANAGEMENT REQUIREMENT (USE FOR ALL WORK)
202
+
203
+ **ALL work MUST be tracked as tasks. This is not optional.**
204
+
205
+ ```
206
+ ┌─────────────────────────────────────────────────────────────────────────────┐
207
+ │ TASK ENFORCEMENT - ABSOLUTE RULE │
208
+ ├─────────────────────────────────────────────────────────────────────────────┤
209
+ │ │
210
+ │ ❌ FORBIDDEN ACTIONS: │
211
+ │ • Starting work without creating a task first │
212
+ │ • Working on multiple tasks simultaneously without tracking │
213
+ │ • Closing tasks without proper completion │
214
+ │ │
215
+ │ ✅ REQUIRED WORKFLOW (every single time): │
216
+ │ 1. Create task: uam task create --title "..." --type task │
217
+ │ 2. Check for blockers: uam task show <id> │
218
+ │ 3. Claim the task: uam task claim <id> │
219
+ │ 4. Do the work (see worktree workflow below) │
220
+ │ 5. Release when complete: uam task release <id> --reason "..." │
221
+ │ │
222
+ └─────────────────────────────────────────────────────────────────────────────┘
223
+ ```
224
+
225
+ **Task Types:**
226
+ | Type | When to Use |
227
+ |------|-------------|
228
+ | `bug` | Fixing something broken |
229
+ | `task` | General work item |
230
+ | `feature` | New functionality |
231
+ | `chore` | Maintenance, refactoring |
232
+ | `epic` | Large multi-task effort |
233
+ | `story` | User-facing feature |
234
+
235
+ **Priority Levels (P0 = highest):**
236
+ | Priority | Meaning | Response Time |
237
+ |----------|---------|---------------|
238
+ | P0 | Critical | Immediate |
239
+ | P1 | High | Same day |
240
+ | P2 | Medium | This week |
241
+ | P3 | Low | When available |
242
+ | P4 | Backlog | Future |
243
+
244
+ **Task Dependencies:**
245
+
246
+ ```bash
247
+ # Add dependency (task A blocks task B)
248
+ uam task dep --from <blocked-task> --to <blocking-task>
249
+
250
+ # View blocked tasks
251
+ uam task blocked
252
+
253
+ # View ready tasks (no blockers)
254
+ uam task ready
255
+ ```
256
+
123
257
  ### 1. WORKTREE REQUIREMENT (NO EXCEPTIONS)
124
258
 
125
259
  ```
126
- ❌ FORBIDDEN: Direct commits to {{DEFAULT_BRANCH}} branch
127
- FORBIDDEN: Making changes without creating worktree first
128
- ✅ REQUIRED: Create worktree → Make changes → Create PR → Merge via PR
260
+ ┌─────────────────────────────────────────────────────────────────────────────┐
261
+ │ WORKTREE ENFORCEMENT - ABSOLUTE RULE │
262
+ ├─────────────────────────────────────────────────────────────────────────────┤
263
+ │ │
264
+ │ ❌ FORBIDDEN ACTIONS (will corrupt {{DEFAULT_BRANCH}} branch): │
265
+ │ • Direct commits to {{DEFAULT_BRANCH}} branch │
266
+ │ • Running git commit without being in a worktree │
267
+ │ • Editing files in {{PROJECT_PATH}} directly │
268
+ │ • Using git add/commit from the main repository root │
269
+ │ │
270
+ │ ✅ REQUIRED WORKFLOW (every single time): │
271
+ │ 1. Create worktree FIRST │
272
+ │ 2. cd into the worktree directory │
273
+ │ 3. Make ALL changes inside worktree │
274
+ │ 4. Create PR from worktree │
275
+ │ 5. Merge via PR (never direct push) │
276
+ │ │
277
+ │ 🔴 SELF-CHECK: Before ANY git commit, verify: │
278
+ │ pwd | grep -q "{{WORKTREE_DIR}}" || echo "STOP! Not in worktree!" │
279
+ │ │
280
+ └─────────────────────────────────────────────────────────────────────────────┘
129
281
  ```
130
282
 
131
283
  **Before ANY code change:**
132
284
 
133
285
  ```bash
134
- # Step 1: Create worktree
286
+ # Step 1: Create worktree (from main repo)
287
+ cd {{PROJECT_PATH}}
135
288
  {{WORKTREE_CREATE_CMD}} <descriptive-slug>
136
289
 
137
- # Step 2: cd into worktree and make changes
290
+ # Step 2: MANDATORY - cd into worktree (verify you're there!)
138
291
  cd {{WORKTREE_DIR}}/NNN-<slug>/
292
+ pwd # MUST show: {{PROJECT_PATH}}/{{WORKTREE_DIR}}/NNN-<slug>
293
+
294
+ # Step 3: Make changes, commit locally
295
+ git add -A && git commit -m "feat: description"
139
296
 
140
- # Step 3: Commit and create PR
297
+ # Step 4: Create PR with automated review
141
298
  {{WORKTREE_PR_CMD}} <id>
142
299
  ```
143
300
 
144
301
  **Applies to:** {{WORKTREE_APPLIES_TO}}
145
302
 
303
+ **FAILURE SCENARIOS TO AVOID:**
304
+
305
+ | Mistake | Consequence | Prevention |
306
+ |---------|-------------|------------|
307
+ | Editing files in main repo | Changes on {{DEFAULT_BRANCH}} branch, merge conflicts | Always `cd {{WORKTREE_DIR}}/` first |
308
+ | Forgetting to create worktree | Direct commit to {{DEFAULT_BRANCH}} | Check `pwd` before any edit |
309
+ | Creating worktree but not entering it | Edits still go to {{DEFAULT_BRANCH}} | Verify path contains `{{WORKTREE_DIR}}` |
310
+ | Using `git push` without PR | Bypasses review agents | Only use `{{WORKTREE_PR_CMD}}` |
311
+
146
312
  ### 2. MEMORY REQUIREMENT (MANDATORY - NOT OPTIONAL)
147
313
 
148
314
  **You MUST update memory. This is not a suggestion.**
@@ -173,22 +339,60 @@ sqlite3 {{MEMORY_DB_PATH}} \
173
339
  - 5-6: Useful context and learnings
174
340
  - 3-4: Minor observations
175
341
 
176
- ### 3. SKILLS REQUIREMENT (CHECK BEFORE IMPLEMENTING)
342
+ ### 3. SKILLS & DROIDS REQUIREMENT (CHECK BEFORE IMPLEMENTING)
177
343
 
178
- **Before starting ANY implementation, check if a skill applies:**
344
+ **Before starting ANY implementation, check if a skill or droid applies:**
179
345
 
180
- | Task Type | Required Skill |
181
- | --------- | -------------- |
346
+ | Task Type | Required Skill/Droid |
347
+ |-----------|---------------------|
182
348
  {{#if SKILL_MAPPINGS}}
183
349
  {{{SKILL_MAPPINGS}}}
184
350
  {{/if}}
185
351
  | React/TypeScript/Frontend | `senior-frontend` |
186
352
  | Code review | `code-reviewer` |
187
353
  | Web testing | `webapp-testing` |
354
+ | CLI development | `cli-design-expert` |
355
+ | TypeScript/Node.js | `typescript-node-expert` |
188
356
 
189
357
  ```bash
190
358
  # Invoke skill FIRST, then follow its guidance
191
359
  Skill(skill: "skill-name")
360
+
361
+ # Or launch a droid for autonomous work
362
+ Task(subagent_type: "droid-name", prompt: "Task description...")
363
+ ```
364
+
365
+ #### IF NO SKILL/DROID EXISTS: Create One Using the "Top 5 Authorities" Method
366
+
367
+ **When you need domain expertise and no existing skill/droid covers it, you MUST create one.**
368
+
369
+ ```
370
+ ┌─────────────────────────────────────────────────────────────────────────────┐
371
+ │ SKILL/DROID AUTO-CREATION: TOP 5 AUTHORITIES METHOD │
372
+ ├─────────────────────────────────────────────────────────────────────────────┤
373
+ │ │
374
+ │ STEP 1: RESEARCH THE TOP 5 AUTHORITIES │
375
+ │ Use WebSearch to identify the top 5 recognized experts/authorities in │
376
+ │ the domain. Look for: │
377
+ │ • Authors of seminal books/papers in the field │
378
+ │ • Industry leaders with proven track records │
379
+ │ • Creators of widely-adopted frameworks/tools │
380
+ │ • Thought leaders frequently cited by practitioners │
381
+ │ │
382
+ │ STEP 2: EXTRACT CORE PRINCIPLES FROM EACH AUTHORITY │
383
+ │ For each authority, identify: │
384
+ │ • Their signature methodology or framework │
385
+ │ • Key principles they advocate │
386
+ │ • Anti-patterns they warn against │
387
+ │ │
388
+ │ STEP 3: SYNTHESIZE INTO A UNIFIED SKILL/DROID │
389
+ │ Create a skill/droid that embodies the collective wisdom │
390
+ │ │
391
+ │ STEP 4: SAVE THE FILE │
392
+ │ Skills: {{SKILLS_PATH}}/<name>/SKILL.md │
393
+ │ Droids: {{DROIDS_PATH}}/<name>.md │
394
+ │ │
395
+ └─────────────────────────────────────────────────────────────────────────────┘
192
396
  ```
193
397
 
194
398
  ### 4. TODO LIST REQUIREMENT
@@ -198,22 +402,64 @@ Skill(skill: "skill-name")
198
402
  - Never let todos go stale (update every 5-10 tool calls)
199
403
  - Use TodoWrite tool, not manual tracking
200
404
 
201
- ### 5. VERIFICATION BEFORE EVERY RESPONSE
405
+ ### 5. AGENT COORDINATION REQUIREMENT (MULTI-AGENT ENVIRONMENTS)
406
+
407
+ **When working in multi-agent environments, coordination is MANDATORY.**
408
+
409
+ ```bash
410
+ # Register as an agent at session start
411
+ uam agent register --name "agent-name" --capabilities "coding,review"
412
+
413
+ # Before starting work on any resource, announce your intent
414
+ uam agent announce --id <agent-id> --resource "src/path/" --intent editing \
415
+ --description "Description of planned changes"
416
+
417
+ # Check for overlapping work (merge conflict prevention)
418
+ uam agent overlaps --resource "src/path/"
419
+
420
+ # When work is complete, notify others
421
+ uam agent complete --id <agent-id> --resource "src/path/"
422
+ ```
423
+
424
+ **Overlap Detection:**
425
+ - System automatically detects when multiple agents work on overlapping files
426
+ - Conflict risk levels: `none`, `low`, `medium`, `high`, `critical`
427
+ - Suggestions provided for merge order and parallel work
428
+
429
+ **Deploy Batching (for CI/CD efficiency):**
430
+
431
+ ```bash
432
+ # Queue commits for batching (saves CI minutes)
433
+ uam deploy queue --agent-id <id> --action-type commit \
434
+ --message "feat: add feature" --files "src/feature.ts"
435
+
436
+ # View pending deploys
437
+ uam deploy status
438
+
439
+ # Batch and execute all pending deploys
440
+ uam deploy flush
441
+ ```
442
+
443
+ ### 6. VERIFICATION BEFORE EVERY RESPONSE
202
444
 
203
445
  Before sending ANY response, verify:
204
446
 
205
447
  ```
206
- ┌─────────────────────────────────────────────────────────────┐
207
- CHECKLIST - Complete before responding:
208
- ├─────────────────────────────────────────────────────────────┤
209
- [ ] Read memory at start of task?
210
- [ ] Checked for applicable skills?
211
- [ ] Used worktree for code changes?
212
- [ ] Updated short-term memory after actions?
213
- [ ] Stored learnings in long-term memory?
214
- [ ] Updated todo list status?
215
- [ ] Created PR (not direct commit)?
216
- └─────────────────────────────────────────────────────────────┘
448
+ ┌─────────────────────────────────────────────────────────────────────────────┐
449
+ CHECKLIST - Complete before responding:
450
+ ├─────────────────────────────────────────────────────────────────────────────┤
451
+ [ ] Task created/claimed for this work?
452
+ [ ] Read memory at start of task?
453
+ [ ] Checked for applicable skills?
454
+ [ ] Announced work (multi-agent)?
455
+ [ ] Checked for overlaps (multi-agent)?
456
+ [ ] Used worktree for code changes?
457
+ [ ] Updated short-term memory after actions?
458
+ │ [ ] Stored learnings in long-term memory? │
459
+ │ [ ] Updated todo list status? │
460
+ │ [ ] Created PR (not direct commit)? │
461
+ │ [ ] Released task when complete? │
462
+ └─────────────────────────────────────────────────────────────────────────────┘
217
463
  ```
218
464
 
219
465
  ---
@@ -253,25 +499,32 @@ Before sending ANY response, verify:
253
499
  └─────────────────────────────────────────────────────────────────────┘
254
500
  ```
255
501
 
256
- ### Installation & Setup
257
-
258
- ```bash
259
- # 1. Install UAM globally or in project
260
- npm install -g universal-agent-memory
261
- # or
262
- npm install --save-dev universal-agent-memory
263
-
264
- # 2. Initialize in your project
265
- uam init
266
-
267
- # 3. Start memory services (Qdrant for vector search)
268
- {{MEMORY_START_CMD}}
502
+ ### MANDATORY: Layer Selection Decision Tree
269
503
 
270
- # 4. Generate CLAUDE.md with memory integration
271
- uam generate
272
-
273
- # 5. Verify setup
274
- {{MEMORY_STATUS_CMD}}
504
+ ```
505
+ ┌─────────────────────────────────────────────────────────────────────┐
506
+ │ WHICH MEMORY LAYER? - DECISION TREE │
507
+ ├─────────────────────────────────────────────────────────────────────┤
508
+ │ │
509
+ │ Q1: Is this about WHAT I JUST DID in the last few minutes? │
510
+ │ YES → LAYER 1: Working Memory (short_term.db) │
511
+ │ NO → Continue to Q2 │
512
+ │ │
513
+ │ Q2: Is this a SESSION-SPECIFIC decision or temporary context? │
514
+ │ YES → LAYER 2: Session Memory (session_memories table) │
515
+ │ NO → Continue to Q3 │
516
+ │ │
517
+ │ Q3: Is this a REUSABLE LEARNING that future sessions need? │
518
+ │ (Bug fix, pattern, gotcha, architecture decision, optimization)│
519
+ │ YES → LAYER 3: Semantic Memory (Qdrant) - importance 7+ │
520
+ │ NO → Continue to Q4 │
521
+ │ │
522
+ │ Q4: Does this involve RELATIONSHIPS between entities? │
523
+ │ (File X depends on Y, Error A is caused by B, etc.) │
524
+ │ YES → LAYER 4: Knowledge Graph (entities/relationships tables) │
525
+ │ NO → Default to Layer 1 (Working Memory) │
526
+ │ │
527
+ └─────────────────────────────────────────────────────────────────────┘
275
528
  ```
276
529
 
277
530
  ### Layer 1: Working Memory (SQLite)
@@ -300,14 +553,6 @@ INSERT INTO memories (timestamp, type, content)
300
553
  VALUES (datetime('now'), 'action', 'Description of action and result');
301
554
  ```
302
555
 
303
- **Or use the CLI:**
304
-
305
- ```bash
306
- uam memory add --type action "Implemented user authentication with JWT"
307
- ```
308
-
309
- Maintains last {{SHORT_TERM_LIMIT}} entries - older entries auto-deleted via trigger.
310
-
311
556
  ### Layer 2: Session Memory (SQLite)
312
557
 
313
558
  **Table: `session_memories`** (in same database as working memory)
@@ -329,57 +574,22 @@ WHERE session_id = 'current_session'
329
574
  ORDER BY id DESC LIMIT 10;
330
575
  ```
331
576
 
332
- **Store session decision:**
333
-
334
- ```sql
335
- INSERT INTO session_memories (session_id, timestamp, type, content, importance)
336
- VALUES ('current_session', datetime('now'), 'decision', 'Chose approach X because...', 7);
337
- ```
338
-
339
- **Types**: summary, decision, entity, error
340
-
341
577
  ### Layer 3: Semantic Memory ({{LONG_TERM_BACKEND}})
342
578
 
343
579
  **Collection**: `{{LONG_TERM_COLLECTION}}` at `{{LONG_TERM_ENDPOINT}}`
344
580
 
345
- **Vector Schema**:
346
-
347
- | Field | Type | Description |
348
- |-------|------|-------------|
349
- | `id` | UUID | Unique identifier |
350
- | `vector` | float[384] | Embedding (all-MiniLM-L6-v2) |
351
- | `content` | string | Original memory text |
352
- | `type` | string | lesson, bug-fix, architecture, gotcha |
353
- | `tags` | string[] | Categorization tags |
354
- | `importance` | int | 1-10 importance score |
355
- | `timestamp` | string | ISO8601 creation time |
356
- | `decay_score` | float | Time-based decay factor |
357
- | `content_hash` | string | MD5 hash for deduplication |
358
-
359
581
  **Query memories** (semantic search):
360
582
 
361
583
  ```bash
362
584
  {{MEMORY_QUERY_CMD}} "<search terms>"
363
-
364
- # Examples:
365
- {{MEMORY_QUERY_CMD}} "authentication JWT token"
366
- {{MEMORY_QUERY_CMD}} "database connection pooling"
367
- {{MEMORY_QUERY_CMD}} "React state management"
368
585
  ```
369
586
 
370
587
  **Store new memory** (importance 7+ recommended):
371
588
 
372
589
  ```bash
373
590
  {{MEMORY_STORE_CMD}} lesson "What you learned" --tags tag1,tag2 --importance 8
374
-
375
- # Examples:
376
- {{MEMORY_STORE_CMD}} lesson "Always check network policies before deploying" --tags kubernetes,networking --importance 8
377
- {{MEMORY_STORE_CMD}} bug-fix "Connection timeout was caused by missing egress rule" --tags networking,debugging --importance 9
378
- {{MEMORY_STORE_CMD}} architecture "Chose Redis for caching due to sub-ms latency requirements" --tags caching,performance --importance 7
379
591
  ```
380
592
 
381
- **Decay Formula**: `effective_importance = importance * (0.95 ^ days_since_access)`
382
-
383
593
  **WHEN TO STORE IN SEMANTIC MEMORY** (importance 7+):
384
594
 
385
595
  - ✅ Bug fixes with root cause + solution
@@ -390,38 +600,10 @@ VALUES ('current_session', datetime('now'), 'decision', 'Chose approach X becaus
390
600
  - ❌ Routine actions (keep in working memory)
391
601
  - ❌ Temporary context (keep in session memory)
392
602
 
393
- **Deduplication Strategy**:
394
-
395
- 1. Compute content hash (MD5 first 16 chars)
396
- 2. If hash exists, skip (fast path)
397
- 3. If unsure, check semantic similarity (threshold 0.92)
398
- 4. Only add if truly new information
399
-
400
603
  ### Layer 4: Knowledge Graph (SQLite)
401
604
 
402
605
  **Tables**: `entities` and `relationships` (in same database)
403
606
 
404
- **Entities Table:**
405
-
406
- | Column | Type | Description |
407
- |--------|------|-------------|
408
- | `id` | INTEGER | Primary key |
409
- | `type` | TEXT | file, function, concept, error, config, service |
410
- | `name` | TEXT | Entity name/identifier |
411
- | `first_seen` | TEXT | First mention timestamp |
412
- | `last_seen` | TEXT | Last mention timestamp |
413
- | `mention_count` | INTEGER | How often referenced |
414
-
415
- **Relationships Table:**
416
-
417
- | Column | Type | Description |
418
- |--------|------|-------------|
419
- | `id` | INTEGER | Primary key |
420
- | `source_id` | INTEGER | Source entity ID |
421
- | `target_id` | INTEGER | Target entity ID |
422
- | `relation` | TEXT | depends_on, fixes, causes, related_to, contains, implements |
423
- | `timestamp` | TEXT | When relationship was established |
424
-
425
607
  **Query related entities (1-hop):**
426
608
 
427
609
  ```sql
@@ -432,26 +614,8 @@ LEFT JOIN entities e2 ON r.target_id = e2.id
432
614
  WHERE e.name LIKE '%api%';
433
615
  ```
434
616
 
435
- **Add entity:**
436
-
437
- ```sql
438
- INSERT OR REPLACE INTO entities (type, name, first_seen, last_seen, mention_count)
439
- VALUES ('file', 'auth-controller.ts', datetime('now'), datetime('now'), 1);
440
- ```
441
-
442
- **Add relationship:**
443
-
444
- ```sql
445
- INSERT INTO relationships (source_id, target_id, relation, timestamp)
446
- VALUES (1, 2, 'depends_on', datetime('now'));
447
- ```
448
-
449
- **Or use the CLI:**
450
-
451
- ```bash
452
- uam memory entity add --type file --name "auth-controller.ts"
453
- uam memory relation add --source "auth-controller.ts" --target "jwt-utils.ts" --relation depends_on
454
- ```
617
+ **Entity Types**: file, function, concept, error, config, service
618
+ **Relation Types**: depends_on, fixes, causes, related_to, contains, implements
455
619
 
456
620
  ### Memory Operations Workflow
457
621
 
@@ -473,11 +637,6 @@ uam memory relation add --source "auth-controller.ts" --target "jwt-utils.ts" --
473
637
  │ 6. Store in semantic memory (importance 7+) │
474
638
  │ 7. Update knowledge graph entities/relationships │
475
639
  │ │
476
- │ ON CONSOLIDATION TRIGGER (every 10 working memory entries): │
477
- │ 8. Summarize working memory → session memory │
478
- │ 9. Extract high-importance items → semantic memory │
479
- │ 10. Deduplicate using content hash (fast) + similarity (slow) │
480
- │ │
481
640
  └─────────────────────────────────────────────────────────────────┘
482
641
  ```
483
642
 
@@ -498,44 +657,182 @@ uam memory migrate
498
657
 
499
658
  # Backup all memories
500
659
  uam memory backup
501
-
502
- # Export memories to JSON
503
- uam memory export --format json memories-backup.json
504
660
  ```
505
661
 
506
662
  {{#if DOCKER_COMPOSE_PATH}}
507
663
  **Docker Compose**: `{{DOCKER_COMPOSE_PATH}}` defines Qdrant with persistent storage.
664
+ {{/if}}
665
+
666
+ ---
667
+
668
+ ## TASK MANAGEMENT SYSTEM
669
+
670
+ > **Superior to Beads**: Integrated task management with memory, coordination, and deploy batching.
671
+
672
+ ### Task Lifecycle
508
673
 
509
- ```yaml
510
- # Example docker-compose.yml for memory services
511
- services:
512
- qdrant:
513
- image: qdrant/qdrant:latest
514
- ports:
515
- - "6333:6333"
516
- volumes:
517
- - ./data/qdrant:/qdrant/storage
518
674
  ```
519
- {{/if}}
675
+ ┌─────────────────────────────────────────────────────────────────────────────┐
676
+ │ TASK LIFECYCLE │
677
+ ├─────────────────────────────────────────────────────────────────────────────┤
678
+ │ │
679
+ │ CREATE CLAIM WORK RELEASE │
680
+ │ ──────► ──────► ──────► ──────► │
681
+ │ │
682
+ │ uam task uam task (worktree uam task │
683
+ │ create claim <id> workflow) release <id> │
684
+ │ --title "..." │
685
+ │ - Assigns to you - Marks done │
686
+ │ - Announces work - Notifies others │
687
+ │ - Creates worktree - Stores in memory │
688
+ │ - Detects overlaps │
689
+ │ │
690
+ └─────────────────────────────────────────────────────────────────────────────┘
691
+ ```
692
+
693
+ ### Essential Commands
694
+
695
+ ```bash
696
+ # Create a new task
697
+ uam task create --title "Description" --type task --priority 2 --labels "label1,label2"
698
+
699
+ # List tasks
700
+ uam task list # All open tasks
701
+ uam task list --filter-status in_progress # In-progress only
702
+ uam task list --filter-priority 0,1 # P0 and P1 only
703
+ uam task ready # Ready to work (no blockers)
704
+ uam task blocked # Blocked tasks
705
+
706
+ # Work on a task
707
+ uam task claim <id> # Claim and start
708
+ uam task show <id> # View details
709
+ uam task update <id> --status in_progress # Update status
710
+ uam task release <id> --reason "Fixed" # Complete
711
+
712
+ # Dependencies (DAG)
713
+ uam task dep --from <child> --to <parent> # Add dependency
714
+ uam task undep --from <child> --to <parent> # Remove dependency
715
+
716
+ # Statistics and sync
717
+ uam task stats # View statistics
718
+ uam task sync # Sync with JSONL (git-tracked)
719
+ uam task compact --days 90 # Archive old tasks
720
+ ```
721
+
722
+ ### Task Hierarchy
723
+
724
+ ```
725
+ Epic (large effort)
726
+ ├── Story (user-facing feature)
727
+ │ ├── Task (implementation unit)
728
+ │ └── Task
729
+ └── Story
730
+ ├── Task
731
+ ├── Bug (defect fix)
732
+ └── Chore (maintenance)
733
+ ```
734
+
735
+ Create hierarchies with `--parent`:
736
+
737
+ ```bash
738
+ uam task create --title "Large Feature" --type epic
739
+ uam task create --title "Sub-feature" --type story --parent uam-xxxx
740
+ uam task create --title "Implementation" --type task --parent uam-yyyy
741
+ ```
742
+
743
+ ---
744
+
745
+ ## AGENT COORDINATION SYSTEM
746
+
747
+ > **For multi-agent environments**: Prevents merge conflicts and optimizes CI/CD.
748
+
749
+ ### Architecture
750
+
751
+ ```
752
+ ┌─────────────────────────────────────────────────────────────────────────────┐
753
+ │ AGENT COORDINATION SYSTEM │
754
+ ├─────────────────────────────────────────────────────────────────────────────┤
755
+ │ │
756
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
757
+ │ │ Agent A │ │ Agent B │ │ Agent C │ │
758
+ │ │ (worktree) │ │ (worktree) │ │ (worktree) │ │
759
+ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
760
+ │ │ │ │ │
761
+ │ ▼ ▼ ▼ │
762
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
763
+ │ │ COORDINATION SERVICE │ │
764
+ │ ├─────────────────────────────────────────────────────────────────────┤ │
765
+ │ │ • Agent Registry (who is active) │ │
766
+ │ │ • Work Announcements (who is working where) │ │
767
+ │ │ • Overlap Detection (conflict risk assessment) │ │
768
+ │ │ • Message Passing (inter-agent communication) │ │
769
+ │ │ • Deploy Queue (batched commits/pushes) │ │
770
+ │ └─────────────────────────────────────────────────────────────────────┘ │
771
+ │ │
772
+ └─────────────────────────────────────────────────────────────────────────────┘
773
+ ```
774
+
775
+ ### Agent Lifecycle
776
+
777
+ ```bash
778
+ # Register at session start
779
+ uam agent register --name "feature-agent" --capabilities "coding,testing" \
780
+ --worktree "feature/add-feature"
520
781
 
521
- ### Performance Benchmarks
782
+ # Send heartbeat (keeps agent active)
783
+ uam agent heartbeat --id <agent-id>
784
+
785
+ # View active agents
786
+ uam agent status
787
+
788
+ # Deregister when done
789
+ uam agent deregister --id <agent-id>
790
+ ```
522
791
 
523
- | Operation | Latency | Throughput |
524
- |-----------|---------|------------|
525
- | SQLite INSERT | ~1.1ms | 875 ops/sec |
526
- | SQLite SELECT (50 rows) | ~0.15ms | 6,680 ops/sec |
527
- | SQLite Graph Query (1-hop) | ~0.17ms | 6,035 ops/sec |
528
- | Qdrant Search (top-5) | ~1.2ms | 818 ops/sec |
529
- | Embedding Generation | ~3.3ms | 305 ops/sec |
792
+ ### Work Announcements
530
793
 
531
- ### Importance Scale Reference
794
+ ```bash
795
+ # Announce intent to work (enables overlap detection)
796
+ uam agent announce --id <agent-id> \
797
+ --resource "src/path/" \
798
+ --intent editing \
799
+ --description "Description of changes" \
800
+ --files "src/file1.ts,src/file2.ts" \
801
+ --minutes 30
802
+
803
+ # Check for overlaps before starting
804
+ uam agent overlaps --resource "src/path/"
805
+
806
+ # Mark work complete (notifies others)
807
+ uam agent complete --id <agent-id> --resource "src/path/"
808
+ ```
809
+
810
+ ### Deploy Batching
811
+
812
+ ```bash
813
+ # Queue a commit (don't push yet)
814
+ uam deploy queue --agent-id <id> \
815
+ --action-type commit \
816
+ --message "feat: add feature" \
817
+ --files "src/feature.ts"
818
+
819
+ # Queue a push
820
+ uam deploy queue --agent-id <id> \
821
+ --action-type push \
822
+ --target "feature/branch"
823
+
824
+ # View queue
825
+ uam deploy status
826
+
827
+ # Batch and execute (squashes commits, single push)
828
+ uam deploy flush
829
+ ```
532
830
 
533
- | Score | Category | Examples |
534
- |-------|----------|----------|
535
- | 9-10 | Critical system knowledge | Auth flows, data models, breaking changes |
536
- | 7-8 | Important patterns and fixes | Bug fixes, performance optimizations |
537
- | 5-6 | Useful context and learnings | Code patterns, tool configurations |
538
- | 3-4 | Minor observations | Style preferences, minor quirks |
831
+ **Benefits:**
832
+ - Reduces CI/CD runs (batch multiple commits)
833
+ - Squashes related commits for cleaner history
834
+ - Coordinates push order to prevent conflicts
835
+ - Enables atomic multi-file deployments
539
836
 
540
837
  ---
541
838
 
@@ -556,18 +853,6 @@ When using browser automation (Playwright, Puppeteer, or any browser tool):
556
853
 
557
854
  ---
558
855
 
559
- ## DECISION LOOP
560
-
561
- 1. **READ** short-term memory (recent context)
562
- 2. **QUERY** long-term memory (semantic search for relevant past learnings)
563
- 3. **THINK** about what to do next
564
- 4. **ACT** - execute your decision
565
- 5. **RECORD** - write to short-term memory
566
- 6. **IF BROWSER ACTION**: Save screenshot to `{{SCREENSHOTS_PATH}}/`
567
- 7. **OPTIONALLY** - if significant learning, add to long-term memory
568
-
569
- ---
570
-
571
856
  ## SKILLS
572
857
 
573
858
  You have access to reusable skills. Before attempting complex tasks:
@@ -782,21 +1067,6 @@ See [Git Worktree Workflow]({{WORKFLOW_DOCS_PATH}}) for complete details.
782
1067
 
783
1068
  ---
784
1069
 
785
- {{#if CHANGELOG_PATH}}
786
- ## Changelog Quick Reference
787
-
788
- **When to create**: New features, breaking changes, security updates, infrastructure changes, API modifications, database schema changes.
789
-
790
- **Location**: `{{CHANGELOG_PATH}}/YYYY-MM/YYYY-MM-DD_description.md`
791
- {{#if CHANGELOG_TEMPLATE}}
792
- **Template**: `{{CHANGELOG_TEMPLATE}}`
793
- {{/if}}
794
-
795
- **Required sections**: Metadata, Summary, Details, Technical Details, Migration Guide, Testing
796
-
797
- ---
798
- {{/if}}
799
-
800
1070
  ## Augmented Agent Capabilities
801
1071
 
802
1072
  ### Proactive Skills & Droids - INVOKE AUTOMATICALLY
@@ -835,9 +1105,9 @@ Invoke with `Skill` tool. Skills expand inline with detailed instructions.
835
1105
  {{#if DISCOVERED_SKILLS}}
836
1106
  {{{DISCOVERED_SKILLS}}}
837
1107
  {{/if}}
838
- | `senior-frontend` | React/Next.js/TypeScript/Tailwind development | Building UI features, performance optimization, state management |
839
- | `code-reviewer` | Automated code analysis, security scanning | Reviewing PRs, code quality checks, identifying issues |
840
- | `webapp-testing` | Playwright-based web testing | Verifying frontend functionality, debugging UI, browser screenshots |
1108
+ | `senior-frontend` | React/Next.js/TypeScript/Tailwind development | Building UI features, performance optimization |
1109
+ | `code-reviewer` | Automated code analysis, security scanning | Reviewing PRs, code quality checks |
1110
+ | `webapp-testing` | Playwright-based web testing | Verifying frontend functionality, debugging UI |
841
1111
 
842
1112
  ### Custom Droids (`{{DROIDS_PATH}}`)
843
1113