universal-agent-memory 0.2.1 → 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 +1 -1
- package/templates/CLAUDE.template.md +232 -325
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "universal-agent-memory",
|
|
3
|
-
"version": "0.2.
|
|
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
|
|
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
|
-
##
|
|
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
|
|
|
@@ -103,7 +173,7 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
|
|
|
103
173
|
│ │
|
|
104
174
|
│ 6. DO THE WORK │
|
|
105
175
|
│ ├─ Implement changes │
|
|
106
|
-
│ ├─ Run tests
|
|
176
|
+
│ ├─ Run tests: {{TEST_COMMAND}} │
|
|
107
177
|
│ └─ Create PR via {{WORKTREE_PR_CMD}} <id> │
|
|
108
178
|
│ │
|
|
109
179
|
│ 7. UPDATE MEMORY (after EVERY significant action) │
|
|
@@ -133,29 +203,23 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
|
|
|
133
203
|
**ALL work MUST be tracked as tasks. This is not optional.**
|
|
134
204
|
|
|
135
205
|
```
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
uam task create --title "
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
uam task claim <id>
|
|
154
|
-
|
|
155
|
-
# Step 4: Do the work (see worktree workflow below)
|
|
156
|
-
|
|
157
|
-
# Step 5: Release the task when complete
|
|
158
|
-
uam task release <id> --reason "Completed: description of what was done"
|
|
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
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
159
223
|
```
|
|
160
224
|
|
|
161
225
|
**Task Types:**
|
|
@@ -193,26 +257,58 @@ uam task ready
|
|
|
193
257
|
### 1. WORKTREE REQUIREMENT (NO EXCEPTIONS)
|
|
194
258
|
|
|
195
259
|
```
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
199
281
|
```
|
|
200
282
|
|
|
201
283
|
**Before ANY code change:**
|
|
202
284
|
|
|
203
285
|
```bash
|
|
204
|
-
# Step 1: Create worktree
|
|
286
|
+
# Step 1: Create worktree (from main repo)
|
|
287
|
+
cd {{PROJECT_PATH}}
|
|
205
288
|
{{WORKTREE_CREATE_CMD}} <descriptive-slug>
|
|
206
289
|
|
|
207
|
-
# Step 2: cd into worktree
|
|
290
|
+
# Step 2: MANDATORY - cd into worktree (verify you're there!)
|
|
208
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"
|
|
209
296
|
|
|
210
|
-
# Step
|
|
297
|
+
# Step 4: Create PR with automated review
|
|
211
298
|
{{WORKTREE_PR_CMD}} <id>
|
|
212
299
|
```
|
|
213
300
|
|
|
214
301
|
**Applies to:** {{WORKTREE_APPLIES_TO}}
|
|
215
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
|
+
|
|
216
312
|
### 2. MEMORY REQUIREMENT (MANDATORY - NOT OPTIONAL)
|
|
217
313
|
|
|
218
314
|
**You MUST update memory. This is not a suggestion.**
|
|
@@ -243,22 +339,60 @@ sqlite3 {{MEMORY_DB_PATH}} \
|
|
|
243
339
|
- 5-6: Useful context and learnings
|
|
244
340
|
- 3-4: Minor observations
|
|
245
341
|
|
|
246
|
-
### 3. SKILLS REQUIREMENT (CHECK BEFORE IMPLEMENTING)
|
|
342
|
+
### 3. SKILLS & DROIDS REQUIREMENT (CHECK BEFORE IMPLEMENTING)
|
|
247
343
|
|
|
248
|
-
**Before starting ANY implementation, check if a skill applies:**
|
|
344
|
+
**Before starting ANY implementation, check if a skill or droid applies:**
|
|
249
345
|
|
|
250
|
-
| Task Type | Required Skill |
|
|
251
|
-
|
|
346
|
+
| Task Type | Required Skill/Droid |
|
|
347
|
+
|-----------|---------------------|
|
|
252
348
|
{{#if SKILL_MAPPINGS}}
|
|
253
349
|
{{{SKILL_MAPPINGS}}}
|
|
254
350
|
{{/if}}
|
|
255
351
|
| React/TypeScript/Frontend | `senior-frontend` |
|
|
256
352
|
| Code review | `code-reviewer` |
|
|
257
353
|
| Web testing | `webapp-testing` |
|
|
354
|
+
| CLI development | `cli-design-expert` |
|
|
355
|
+
| TypeScript/Node.js | `typescript-node-expert` |
|
|
258
356
|
|
|
259
357
|
```bash
|
|
260
358
|
# Invoke skill FIRST, then follow its guidance
|
|
261
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
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
262
396
|
```
|
|
263
397
|
|
|
264
398
|
### 4. TODO LIST REQUIREMENT
|
|
@@ -277,14 +411,14 @@ Skill(skill: "skill-name")
|
|
|
277
411
|
uam agent register --name "agent-name" --capabilities "coding,review"
|
|
278
412
|
|
|
279
413
|
# Before starting work on any resource, announce your intent
|
|
280
|
-
uam agent announce --id <agent-id> --resource "src/
|
|
281
|
-
--description "
|
|
414
|
+
uam agent announce --id <agent-id> --resource "src/path/" --intent editing \
|
|
415
|
+
--description "Description of planned changes"
|
|
282
416
|
|
|
283
417
|
# Check for overlapping work (merge conflict prevention)
|
|
284
|
-
uam agent overlaps --resource "src/
|
|
418
|
+
uam agent overlaps --resource "src/path/"
|
|
285
419
|
|
|
286
420
|
# When work is complete, notify others
|
|
287
|
-
uam agent complete --id <agent-id> --resource "src/
|
|
421
|
+
uam agent complete --id <agent-id> --resource "src/path/"
|
|
288
422
|
```
|
|
289
423
|
|
|
290
424
|
**Overlap Detection:**
|
|
@@ -311,21 +445,21 @@ uam deploy flush
|
|
|
311
445
|
Before sending ANY response, verify:
|
|
312
446
|
|
|
313
447
|
```
|
|
314
|
-
|
|
315
|
-
│
|
|
316
|
-
|
|
317
|
-
│
|
|
318
|
-
│
|
|
319
|
-
│
|
|
320
|
-
│
|
|
321
|
-
│
|
|
322
|
-
│
|
|
323
|
-
│
|
|
324
|
-
│
|
|
325
|
-
│
|
|
326
|
-
│
|
|
327
|
-
│
|
|
328
|
-
|
|
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
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
329
463
|
```
|
|
330
464
|
|
|
331
465
|
---
|
|
@@ -365,25 +499,32 @@ Before sending ANY response, verify:
|
|
|
365
499
|
└─────────────────────────────────────────────────────────────────────┘
|
|
366
500
|
```
|
|
367
501
|
|
|
368
|
-
###
|
|
502
|
+
### MANDATORY: Layer Selection Decision Tree
|
|
369
503
|
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
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
|
+
└─────────────────────────────────────────────────────────────────────┘
|
|
387
528
|
```
|
|
388
529
|
|
|
389
530
|
### Layer 1: Working Memory (SQLite)
|
|
@@ -412,14 +553,6 @@ INSERT INTO memories (timestamp, type, content)
|
|
|
412
553
|
VALUES (datetime('now'), 'action', 'Description of action and result');
|
|
413
554
|
```
|
|
414
555
|
|
|
415
|
-
**Or use the CLI:**
|
|
416
|
-
|
|
417
|
-
```bash
|
|
418
|
-
uam memory add --type action "Implemented user authentication with JWT"
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
Maintains last {{SHORT_TERM_LIMIT}} entries - older entries auto-deleted via trigger.
|
|
422
|
-
|
|
423
556
|
### Layer 2: Session Memory (SQLite)
|
|
424
557
|
|
|
425
558
|
**Table: `session_memories`** (in same database as working memory)
|
|
@@ -441,57 +574,22 @@ WHERE session_id = 'current_session'
|
|
|
441
574
|
ORDER BY id DESC LIMIT 10;
|
|
442
575
|
```
|
|
443
576
|
|
|
444
|
-
**Store session decision:**
|
|
445
|
-
|
|
446
|
-
```sql
|
|
447
|
-
INSERT INTO session_memories (session_id, timestamp, type, content, importance)
|
|
448
|
-
VALUES ('current_session', datetime('now'), 'decision', 'Chose approach X because...', 7);
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
**Types**: summary, decision, entity, error
|
|
452
|
-
|
|
453
577
|
### Layer 3: Semantic Memory ({{LONG_TERM_BACKEND}})
|
|
454
578
|
|
|
455
579
|
**Collection**: `{{LONG_TERM_COLLECTION}}` at `{{LONG_TERM_ENDPOINT}}`
|
|
456
580
|
|
|
457
|
-
**Vector Schema**:
|
|
458
|
-
|
|
459
|
-
| Field | Type | Description |
|
|
460
|
-
|-------|------|-------------|
|
|
461
|
-
| `id` | UUID | Unique identifier |
|
|
462
|
-
| `vector` | float[384] | Embedding (all-MiniLM-L6-v2) |
|
|
463
|
-
| `content` | string | Original memory text |
|
|
464
|
-
| `type` | string | lesson, bug-fix, architecture, gotcha |
|
|
465
|
-
| `tags` | string[] | Categorization tags |
|
|
466
|
-
| `importance` | int | 1-10 importance score |
|
|
467
|
-
| `timestamp` | string | ISO8601 creation time |
|
|
468
|
-
| `decay_score` | float | Time-based decay factor |
|
|
469
|
-
| `content_hash` | string | MD5 hash for deduplication |
|
|
470
|
-
|
|
471
581
|
**Query memories** (semantic search):
|
|
472
582
|
|
|
473
583
|
```bash
|
|
474
584
|
{{MEMORY_QUERY_CMD}} "<search terms>"
|
|
475
|
-
|
|
476
|
-
# Examples:
|
|
477
|
-
{{MEMORY_QUERY_CMD}} "authentication JWT token"
|
|
478
|
-
{{MEMORY_QUERY_CMD}} "database connection pooling"
|
|
479
|
-
{{MEMORY_QUERY_CMD}} "React state management"
|
|
480
585
|
```
|
|
481
586
|
|
|
482
587
|
**Store new memory** (importance 7+ recommended):
|
|
483
588
|
|
|
484
589
|
```bash
|
|
485
590
|
{{MEMORY_STORE_CMD}} lesson "What you learned" --tags tag1,tag2 --importance 8
|
|
486
|
-
|
|
487
|
-
# Examples:
|
|
488
|
-
{{MEMORY_STORE_CMD}} lesson "Always check network policies before deploying" --tags kubernetes,networking --importance 8
|
|
489
|
-
{{MEMORY_STORE_CMD}} bug-fix "Connection timeout was caused by missing egress rule" --tags networking,debugging --importance 9
|
|
490
|
-
{{MEMORY_STORE_CMD}} architecture "Chose Redis for caching due to sub-ms latency requirements" --tags caching,performance --importance 7
|
|
491
591
|
```
|
|
492
592
|
|
|
493
|
-
**Decay Formula**: `effective_importance = importance * (0.95 ^ days_since_access)`
|
|
494
|
-
|
|
495
593
|
**WHEN TO STORE IN SEMANTIC MEMORY** (importance 7+):
|
|
496
594
|
|
|
497
595
|
- ✅ Bug fixes with root cause + solution
|
|
@@ -502,38 +600,10 @@ VALUES ('current_session', datetime('now'), 'decision', 'Chose approach X becaus
|
|
|
502
600
|
- ❌ Routine actions (keep in working memory)
|
|
503
601
|
- ❌ Temporary context (keep in session memory)
|
|
504
602
|
|
|
505
|
-
**Deduplication Strategy**:
|
|
506
|
-
|
|
507
|
-
1. Compute content hash (MD5 first 16 chars)
|
|
508
|
-
2. If hash exists, skip (fast path)
|
|
509
|
-
3. If unsure, check semantic similarity (threshold 0.92)
|
|
510
|
-
4. Only add if truly new information
|
|
511
|
-
|
|
512
603
|
### Layer 4: Knowledge Graph (SQLite)
|
|
513
604
|
|
|
514
605
|
**Tables**: `entities` and `relationships` (in same database)
|
|
515
606
|
|
|
516
|
-
**Entities Table:**
|
|
517
|
-
|
|
518
|
-
| Column | Type | Description |
|
|
519
|
-
|--------|------|-------------|
|
|
520
|
-
| `id` | INTEGER | Primary key |
|
|
521
|
-
| `type` | TEXT | file, function, concept, error, config, service |
|
|
522
|
-
| `name` | TEXT | Entity name/identifier |
|
|
523
|
-
| `first_seen` | TEXT | First mention timestamp |
|
|
524
|
-
| `last_seen` | TEXT | Last mention timestamp |
|
|
525
|
-
| `mention_count` | INTEGER | How often referenced |
|
|
526
|
-
|
|
527
|
-
**Relationships Table:**
|
|
528
|
-
|
|
529
|
-
| Column | Type | Description |
|
|
530
|
-
|--------|------|-------------|
|
|
531
|
-
| `id` | INTEGER | Primary key |
|
|
532
|
-
| `source_id` | INTEGER | Source entity ID |
|
|
533
|
-
| `target_id` | INTEGER | Target entity ID |
|
|
534
|
-
| `relation` | TEXT | depends_on, fixes, causes, related_to, contains, implements |
|
|
535
|
-
| `timestamp` | TEXT | When relationship was established |
|
|
536
|
-
|
|
537
607
|
**Query related entities (1-hop):**
|
|
538
608
|
|
|
539
609
|
```sql
|
|
@@ -544,26 +614,8 @@ LEFT JOIN entities e2 ON r.target_id = e2.id
|
|
|
544
614
|
WHERE e.name LIKE '%api%';
|
|
545
615
|
```
|
|
546
616
|
|
|
547
|
-
**
|
|
548
|
-
|
|
549
|
-
```sql
|
|
550
|
-
INSERT OR REPLACE INTO entities (type, name, first_seen, last_seen, mention_count)
|
|
551
|
-
VALUES ('file', 'auth-controller.ts', datetime('now'), datetime('now'), 1);
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
**Add relationship:**
|
|
555
|
-
|
|
556
|
-
```sql
|
|
557
|
-
INSERT INTO relationships (source_id, target_id, relation, timestamp)
|
|
558
|
-
VALUES (1, 2, 'depends_on', datetime('now'));
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
**Or use the CLI:**
|
|
562
|
-
|
|
563
|
-
```bash
|
|
564
|
-
uam memory entity add --type file --name "auth-controller.ts"
|
|
565
|
-
uam memory relation add --source "auth-controller.ts" --target "jwt-utils.ts" --relation depends_on
|
|
566
|
-
```
|
|
617
|
+
**Entity Types**: file, function, concept, error, config, service
|
|
618
|
+
**Relation Types**: depends_on, fixes, causes, related_to, contains, implements
|
|
567
619
|
|
|
568
620
|
### Memory Operations Workflow
|
|
569
621
|
|
|
@@ -585,11 +637,6 @@ uam memory relation add --source "auth-controller.ts" --target "jwt-utils.ts" --
|
|
|
585
637
|
│ 6. Store in semantic memory (importance 7+) │
|
|
586
638
|
│ 7. Update knowledge graph entities/relationships │
|
|
587
639
|
│ │
|
|
588
|
-
│ ON CONSOLIDATION TRIGGER (every 10 working memory entries): │
|
|
589
|
-
│ 8. Summarize working memory → session memory │
|
|
590
|
-
│ 9. Extract high-importance items → semantic memory │
|
|
591
|
-
│ 10. Deduplicate using content hash (fast) + similarity (slow) │
|
|
592
|
-
│ │
|
|
593
640
|
└─────────────────────────────────────────────────────────────────┘
|
|
594
641
|
```
|
|
595
642
|
|
|
@@ -610,45 +657,12 @@ uam memory migrate
|
|
|
610
657
|
|
|
611
658
|
# Backup all memories
|
|
612
659
|
uam memory backup
|
|
613
|
-
|
|
614
|
-
# Export memories to JSON
|
|
615
|
-
uam memory export --format json memories-backup.json
|
|
616
660
|
```
|
|
617
661
|
|
|
618
662
|
{{#if DOCKER_COMPOSE_PATH}}
|
|
619
663
|
**Docker Compose**: `{{DOCKER_COMPOSE_PATH}}` defines Qdrant with persistent storage.
|
|
620
|
-
|
|
621
|
-
```yaml
|
|
622
|
-
# Example docker-compose.yml for memory services
|
|
623
|
-
services:
|
|
624
|
-
qdrant:
|
|
625
|
-
image: qdrant/qdrant:latest
|
|
626
|
-
ports:
|
|
627
|
-
- "6333:6333"
|
|
628
|
-
volumes:
|
|
629
|
-
- ./data/qdrant:/qdrant/storage
|
|
630
|
-
```
|
|
631
664
|
{{/if}}
|
|
632
665
|
|
|
633
|
-
### Performance Benchmarks
|
|
634
|
-
|
|
635
|
-
| Operation | Latency | Throughput |
|
|
636
|
-
|-----------|---------|------------|
|
|
637
|
-
| SQLite INSERT | ~1.1ms | 875 ops/sec |
|
|
638
|
-
| SQLite SELECT (50 rows) | ~0.15ms | 6,680 ops/sec |
|
|
639
|
-
| SQLite Graph Query (1-hop) | ~0.17ms | 6,035 ops/sec |
|
|
640
|
-
| Qdrant Search (top-5) | ~1.2ms | 818 ops/sec |
|
|
641
|
-
| Embedding Generation | ~3.3ms | 305 ops/sec |
|
|
642
|
-
|
|
643
|
-
### Importance Scale Reference
|
|
644
|
-
|
|
645
|
-
| Score | Category | Examples |
|
|
646
|
-
|-------|----------|----------|
|
|
647
|
-
| 9-10 | Critical system knowledge | Auth flows, data models, breaking changes |
|
|
648
|
-
| 7-8 | Important patterns and fixes | Bug fixes, performance optimizations |
|
|
649
|
-
| 5-6 | Useful context and learnings | Code patterns, tool configurations |
|
|
650
|
-
| 3-4 | Minor observations | Style preferences, minor quirks |
|
|
651
|
-
|
|
652
666
|
---
|
|
653
667
|
|
|
654
668
|
## TASK MANAGEMENT SYSTEM
|
|
@@ -680,7 +694,7 @@ services:
|
|
|
680
694
|
|
|
681
695
|
```bash
|
|
682
696
|
# Create a new task
|
|
683
|
-
uam task create --title "
|
|
697
|
+
uam task create --title "Description" --type task --priority 2 --labels "label1,label2"
|
|
684
698
|
|
|
685
699
|
# List tasks
|
|
686
700
|
uam task list # All open tasks
|
|
@@ -721,50 +735,11 @@ Epic (large effort)
|
|
|
721
735
|
Create hierarchies with `--parent`:
|
|
722
736
|
|
|
723
737
|
```bash
|
|
724
|
-
uam task create --title "
|
|
725
|
-
uam task create --title "
|
|
726
|
-
uam task create --title "
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
### Integration with Coordination
|
|
730
|
-
|
|
731
|
-
When you claim a task, the system automatically:
|
|
732
|
-
1. Assigns the task to your agent ID
|
|
733
|
-
2. Announces work to coordination system
|
|
734
|
-
3. Detects overlapping work from other agents
|
|
735
|
-
4. Creates/associates a worktree branch
|
|
736
|
-
5. Returns conflict warnings if detected
|
|
737
|
-
|
|
738
|
-
```bash
|
|
739
|
-
# Claim with overlap detection
|
|
740
|
-
$ uam task claim uam-a1b2
|
|
741
|
-
✔ Task claimed: uam-a1b2
|
|
742
|
-
◐ Refactor authentication module
|
|
743
|
-
Worktree: feature/task-uam-a1b2
|
|
744
|
-
|
|
745
|
-
⚠️ Overlapping work detected:
|
|
746
|
-
medium: agent-007 is editing src/auth/jwt.ts - coordinate merge order
|
|
747
|
-
```
|
|
748
|
-
|
|
749
|
-
### JSONL Git Sync
|
|
750
|
-
|
|
751
|
-
Tasks are stored in SQLite but can be synced to JSONL for git versioning:
|
|
752
|
-
|
|
753
|
-
```bash
|
|
754
|
-
# Export current tasks to JSONL
|
|
755
|
-
uam task sync
|
|
756
|
-
|
|
757
|
-
# File: .uam/tasks/tasks.jsonl
|
|
758
|
-
{"id":"uam-a1b2","title":"Fix auth","type":"bug","status":"open",...}
|
|
759
|
-
{"id":"uam-c3d4","title":"Add feature","type":"feature","status":"done",...}
|
|
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
|
|
760
741
|
```
|
|
761
742
|
|
|
762
|
-
This allows:
|
|
763
|
-
- Version control of task history
|
|
764
|
-
- Conflict resolution via git
|
|
765
|
-
- Sharing tasks across branches/forks
|
|
766
|
-
- Audit trail of task changes
|
|
767
|
-
|
|
768
743
|
---
|
|
769
744
|
|
|
770
745
|
## AGENT COORDINATION SYSTEM
|
|
@@ -802,7 +777,7 @@ This allows:
|
|
|
802
777
|
```bash
|
|
803
778
|
# Register at session start
|
|
804
779
|
uam agent register --name "feature-agent" --capabilities "coding,testing" \
|
|
805
|
-
--worktree "feature/add-
|
|
780
|
+
--worktree "feature/add-feature"
|
|
806
781
|
|
|
807
782
|
# Send heartbeat (keeps agent active)
|
|
808
783
|
uam agent heartbeat --id <agent-id>
|
|
@@ -819,54 +794,17 @@ uam agent deregister --id <agent-id>
|
|
|
819
794
|
```bash
|
|
820
795
|
# Announce intent to work (enables overlap detection)
|
|
821
796
|
uam agent announce --id <agent-id> \
|
|
822
|
-
--resource "src/
|
|
797
|
+
--resource "src/path/" \
|
|
823
798
|
--intent editing \
|
|
824
|
-
--description "
|
|
825
|
-
--files "src/
|
|
799
|
+
--description "Description of changes" \
|
|
800
|
+
--files "src/file1.ts,src/file2.ts" \
|
|
826
801
|
--minutes 30
|
|
827
802
|
|
|
828
803
|
# Check for overlaps before starting
|
|
829
|
-
uam agent overlaps --resource "src/
|
|
804
|
+
uam agent overlaps --resource "src/path/"
|
|
830
805
|
|
|
831
806
|
# Mark work complete (notifies others)
|
|
832
|
-
uam agent complete --id <agent-id> --resource "src/
|
|
833
|
-
```
|
|
834
|
-
|
|
835
|
-
### Overlap Detection & Conflict Risk
|
|
836
|
-
|
|
837
|
-
```bash
|
|
838
|
-
$ uam agent overlaps --resource "src/components/Button.tsx"
|
|
839
|
-
|
|
840
|
-
Overlapping Work Detected:
|
|
841
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
842
|
-
│ Resource: src/components/Button.tsx │
|
|
843
|
-
├──────────────┬────────────┬────────────────────────────────────┤
|
|
844
|
-
│ Agent │ Risk │ Suggestion │
|
|
845
|
-
├──────────────┼────────────┼────────────────────────────────────┤
|
|
846
|
-
│ agent-ui-001 │ HIGH │ Coordinate: both editing same file │
|
|
847
|
-
│ agent-test │ LOW │ Safe: only reading for tests │
|
|
848
|
-
└──────────────┴────────────┴────────────────────────────────────┘
|
|
849
|
-
|
|
850
|
-
Recommendations:
|
|
851
|
-
1. agent-ui-001 should merge first (started earlier)
|
|
852
|
-
2. Wait for agent-ui-001 to complete before pushing
|
|
853
|
-
```
|
|
854
|
-
|
|
855
|
-
### Inter-Agent Messaging
|
|
856
|
-
|
|
857
|
-
```bash
|
|
858
|
-
# Broadcast to all agents
|
|
859
|
-
uam agent broadcast --id <agent-id> \
|
|
860
|
-
--channel coordination \
|
|
861
|
-
--message '{"action":"merge_ready","branch":"feature/auth"}'
|
|
862
|
-
|
|
863
|
-
# Send direct message
|
|
864
|
-
uam agent send --id <agent-id> \
|
|
865
|
-
--to <other-agent-id> \
|
|
866
|
-
--message "Ready for code review"
|
|
867
|
-
|
|
868
|
-
# Receive messages
|
|
869
|
-
uam agent receive --id <agent-id>
|
|
807
|
+
uam agent complete --id <agent-id> --resource "src/path/"
|
|
870
808
|
```
|
|
871
809
|
|
|
872
810
|
### Deploy Batching
|
|
@@ -875,23 +813,19 @@ uam agent receive --id <agent-id>
|
|
|
875
813
|
# Queue a commit (don't push yet)
|
|
876
814
|
uam deploy queue --agent-id <id> \
|
|
877
815
|
--action-type commit \
|
|
878
|
-
--message "feat: add
|
|
879
|
-
--files "src/
|
|
816
|
+
--message "feat: add feature" \
|
|
817
|
+
--files "src/feature.ts"
|
|
880
818
|
|
|
881
819
|
# Queue a push
|
|
882
820
|
uam deploy queue --agent-id <id> \
|
|
883
821
|
--action-type push \
|
|
884
|
-
--target "feature/
|
|
822
|
+
--target "feature/branch"
|
|
885
823
|
|
|
886
824
|
# View queue
|
|
887
825
|
uam deploy status
|
|
888
826
|
|
|
889
827
|
# Batch and execute (squashes commits, single push)
|
|
890
828
|
uam deploy flush
|
|
891
|
-
|
|
892
|
-
# Or execute specific batch
|
|
893
|
-
uam deploy batch
|
|
894
|
-
uam deploy execute --batch-id <id>
|
|
895
829
|
```
|
|
896
830
|
|
|
897
831
|
**Benefits:**
|
|
@@ -919,18 +853,6 @@ When using browser automation (Playwright, Puppeteer, or any browser tool):
|
|
|
919
853
|
|
|
920
854
|
---
|
|
921
855
|
|
|
922
|
-
## DECISION LOOP
|
|
923
|
-
|
|
924
|
-
1. **READ** short-term memory (recent context)
|
|
925
|
-
2. **QUERY** long-term memory (semantic search for relevant past learnings)
|
|
926
|
-
3. **THINK** about what to do next
|
|
927
|
-
4. **ACT** - execute your decision
|
|
928
|
-
5. **RECORD** - write to short-term memory
|
|
929
|
-
6. **IF BROWSER ACTION**: Save screenshot to `{{SCREENSHOTS_PATH}}/`
|
|
930
|
-
7. **OPTIONALLY** - if significant learning, add to long-term memory
|
|
931
|
-
|
|
932
|
-
---
|
|
933
|
-
|
|
934
856
|
## SKILLS
|
|
935
857
|
|
|
936
858
|
You have access to reusable skills. Before attempting complex tasks:
|
|
@@ -1145,21 +1067,6 @@ See [Git Worktree Workflow]({{WORKFLOW_DOCS_PATH}}) for complete details.
|
|
|
1145
1067
|
|
|
1146
1068
|
---
|
|
1147
1069
|
|
|
1148
|
-
{{#if CHANGELOG_PATH}}
|
|
1149
|
-
## Changelog Quick Reference
|
|
1150
|
-
|
|
1151
|
-
**When to create**: New features, breaking changes, security updates, infrastructure changes, API modifications, database schema changes.
|
|
1152
|
-
|
|
1153
|
-
**Location**: `{{CHANGELOG_PATH}}/YYYY-MM/YYYY-MM-DD_description.md`
|
|
1154
|
-
{{#if CHANGELOG_TEMPLATE}}
|
|
1155
|
-
**Template**: `{{CHANGELOG_TEMPLATE}}`
|
|
1156
|
-
{{/if}}
|
|
1157
|
-
|
|
1158
|
-
**Required sections**: Metadata, Summary, Details, Technical Details, Migration Guide, Testing
|
|
1159
|
-
|
|
1160
|
-
---
|
|
1161
|
-
{{/if}}
|
|
1162
|
-
|
|
1163
1070
|
## Augmented Agent Capabilities
|
|
1164
1071
|
|
|
1165
1072
|
### Proactive Skills & Droids - INVOKE AUTOMATICALLY
|
|
@@ -1198,9 +1105,9 @@ Invoke with `Skill` tool. Skills expand inline with detailed instructions.
|
|
|
1198
1105
|
{{#if DISCOVERED_SKILLS}}
|
|
1199
1106
|
{{{DISCOVERED_SKILLS}}}
|
|
1200
1107
|
{{/if}}
|
|
1201
|
-
| `senior-frontend` | React/Next.js/TypeScript/Tailwind development | Building UI features, performance optimization
|
|
1202
|
-
| `code-reviewer` | Automated code analysis, security scanning | Reviewing PRs, code quality checks
|
|
1203
|
-
| `webapp-testing` | Playwright-based web testing | Verifying frontend functionality, debugging UI
|
|
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 |
|
|
1204
1111
|
|
|
1205
1112
|
### Custom Droids (`{{DROIDS_PATH}}`)
|
|
1206
1113
|
|