universal-agent-memory 0.2.0 → 0.2.1

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.1",
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",
@@ -72,39 +72,47 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
72
72
  │ (Execute this for EVERY task) │
73
73
  ├─────────────────────────────────────────────────────────────────────────────┤
74
74
  │ │
75
- │ 1. READ MEMORY FIRST
75
+ │ 1. CREATE/CLAIM TASK FIRST
76
+ │ ├─ Check existing: uam task list --show-ready │
77
+ │ ├─ Create if needed: uam task create --title "..." --type task │
78
+ │ ├─ Claim it: uam task claim <id> │
79
+ │ └─ This announces work and detects overlaps automatically │
80
+ │ │
81
+ │ 2. READ MEMORY │
76
82
  │ ├─ Query short-term: sqlite3 {{MEMORY_DB_PATH}} │
77
83
  │ │ "SELECT * FROM memories ORDER BY id DESC LIMIT 20;" │
78
84
  │ └─ Query long-term for relevant context: │
79
85
  │ {{MEMORY_QUERY_CMD}} "<keywords related to current task>" │
80
86
  │ │
81
- 2. CHECK FOR APPLICABLE SKILLS │
87
+ 3. CHECK FOR APPLICABLE SKILLS │
82
88
  │ ├─ Review {{SKILLS_PATH}} for relevant skills │
83
89
  {{#if PRIMARY_SKILLS}}
84
90
  {{{PRIMARY_SKILLS}}}
85
91
  {{/if}}
86
92
  │ └─ Invoke skill BEFORE starting implementation │
87
93
  │ │
88
- 3. CREATE WORKTREE (for ANY code changes) │
94
+ 4. CREATE WORKTREE (for ANY code changes) │
89
95
  │ ├─ {{WORKTREE_CREATE_CMD}} <slug> │
90
96
  │ ├─ cd {{WORKTREE_DIR}}/NNN-<slug>/ │
91
97
  │ └─ NEVER commit directly to {{DEFAULT_BRANCH}} │
92
98
  │ │
93
- 4. CREATE TODO LIST (for 3+ step tasks) │
99
+ 5. CREATE TODO LIST (for 3+ step tasks) │
94
100
  │ ├─ Use TodoWrite tool immediately │
95
101
  │ ├─ Update status after EACH step │
96
102
  │ └─ Mark completed items immediately │
97
103
  │ │
98
- 5. DO THE WORK │
104
+ 6. DO THE WORK │
99
105
  │ ├─ Implement changes │
100
106
  │ ├─ Run tests │
101
107
  │ └─ Create PR via {{WORKTREE_PR_CMD}} <id> │
102
108
  │ │
103
- 6. UPDATE MEMORY (after EVERY significant action) │
109
+ 7. UPDATE MEMORY (after EVERY significant action) │
104
110
  │ ├─ Short-term: INSERT INTO memories... │
105
111
  │ └─ Long-term (for learnings): {{MEMORY_STORE_CMD}} lesson... │
106
112
  │ │
107
- 7. VERIFY BEFORE RESPONDING
113
+ 8. RELEASE TASK & VERIFY
114
+ │ ├─ Release: uam task release <id> --reason "Completed: ..." │
115
+ │ ├─ [ ] Task released? │
108
116
  │ ├─ [ ] Memory updated? │
109
117
  │ ├─ [ ] Worktree used? │
110
118
  │ ├─ [ ] PR created (not direct commit)? │
@@ -120,6 +128,68 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
120
128
 
121
129
  **FAILURE TO FOLLOW THESE RULES IS A CRITICAL ERROR. STOP AND RE-READ IF UNSURE.**
122
130
 
131
+ ### 0. TASK MANAGEMENT REQUIREMENT (USE FOR ALL WORK)
132
+
133
+ **ALL work MUST be tracked as tasks. This is not optional.**
134
+
135
+ ```
136
+ ❌ FORBIDDEN: Starting work without creating a task first
137
+ ❌ FORBIDDEN: Working on multiple tasks simultaneously without tracking
138
+ ❌ FORBIDDEN: Closing tasks without proper completion
139
+ ✅ REQUIRED: Create task → Claim task → Do work → Release task
140
+ ```
141
+
142
+ **Before ANY work:**
143
+
144
+ ```bash
145
+ # Step 1: Create a task (or find existing one)
146
+ uam task create --title "Description of work" --type task --priority 2
147
+
148
+ # Step 2: Check for blockers
149
+ uam task show <id> # View task details
150
+ uam task ready # List tasks ready to work on
151
+
152
+ # Step 3: Claim the task (assigns, announces, detects overlaps)
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"
159
+ ```
160
+
161
+ **Task Types:**
162
+ | Type | When to Use |
163
+ |------|-------------|
164
+ | `bug` | Fixing something broken |
165
+ | `task` | General work item |
166
+ | `feature` | New functionality |
167
+ | `chore` | Maintenance, refactoring |
168
+ | `epic` | Large multi-task effort |
169
+ | `story` | User-facing feature |
170
+
171
+ **Priority Levels (P0 = highest):**
172
+ | Priority | Meaning | Response Time |
173
+ |----------|---------|---------------|
174
+ | P0 | Critical | Immediate |
175
+ | P1 | High | Same day |
176
+ | P2 | Medium | This week |
177
+ | P3 | Low | When available |
178
+ | P4 | Backlog | Future |
179
+
180
+ **Task Dependencies:**
181
+
182
+ ```bash
183
+ # Add dependency (task A blocks task B)
184
+ uam task dep --from <blocked-task> --to <blocking-task>
185
+
186
+ # View blocked tasks
187
+ uam task blocked
188
+
189
+ # View ready tasks (no blockers)
190
+ uam task ready
191
+ ```
192
+
123
193
  ### 1. WORKTREE REQUIREMENT (NO EXCEPTIONS)
124
194
 
125
195
  ```
@@ -198,7 +268,45 @@ Skill(skill: "skill-name")
198
268
  - Never let todos go stale (update every 5-10 tool calls)
199
269
  - Use TodoWrite tool, not manual tracking
200
270
 
201
- ### 5. VERIFICATION BEFORE EVERY RESPONSE
271
+ ### 5. AGENT COORDINATION REQUIREMENT (MULTI-AGENT ENVIRONMENTS)
272
+
273
+ **When working in multi-agent environments, coordination is MANDATORY.**
274
+
275
+ ```bash
276
+ # Register as an agent at session start
277
+ uam agent register --name "agent-name" --capabilities "coding,review"
278
+
279
+ # Before starting work on any resource, announce your intent
280
+ uam agent announce --id <agent-id> --resource "src/auth/" --intent editing \
281
+ --description "Refactoring authentication module"
282
+
283
+ # Check for overlapping work (merge conflict prevention)
284
+ uam agent overlaps --resource "src/auth/"
285
+
286
+ # When work is complete, notify others
287
+ uam agent complete --id <agent-id> --resource "src/auth/"
288
+ ```
289
+
290
+ **Overlap Detection:**
291
+ - System automatically detects when multiple agents work on overlapping files
292
+ - Conflict risk levels: `none`, `low`, `medium`, `high`, `critical`
293
+ - Suggestions provided for merge order and parallel work
294
+
295
+ **Deploy Batching (for CI/CD efficiency):**
296
+
297
+ ```bash
298
+ # Queue commits for batching (saves CI minutes)
299
+ uam deploy queue --agent-id <id> --action-type commit \
300
+ --message "feat: add feature" --files "src/feature.ts"
301
+
302
+ # View pending deploys
303
+ uam deploy status
304
+
305
+ # Batch and execute all pending deploys
306
+ uam deploy flush
307
+ ```
308
+
309
+ ### 6. VERIFICATION BEFORE EVERY RESPONSE
202
310
 
203
311
  Before sending ANY response, verify:
204
312
 
@@ -206,13 +314,17 @@ Before sending ANY response, verify:
206
314
  ┌─────────────────────────────────────────────────────────────┐
207
315
  │ CHECKLIST - Complete before responding: │
208
316
  ├─────────────────────────────────────────────────────────────┤
317
+ │ [ ] Task created/claimed for this work? │
209
318
  │ [ ] Read memory at start of task? │
210
319
  │ [ ] Checked for applicable skills? │
320
+ │ [ ] Announced work (multi-agent)? │
321
+ │ [ ] Checked for overlaps (multi-agent)? │
211
322
  │ [ ] Used worktree for code changes? │
212
323
  │ [ ] Updated short-term memory after actions? │
213
324
  │ [ ] Stored learnings in long-term memory? │
214
325
  │ [ ] Updated todo list status? │
215
326
  │ [ ] Created PR (not direct commit)? │
327
+ │ [ ] Released task when complete? │
216
328
  └─────────────────────────────────────────────────────────────┘
217
329
  ```
218
330
 
@@ -539,6 +651,257 @@ services:
539
651
 
540
652
  ---
541
653
 
654
+ ## TASK MANAGEMENT SYSTEM
655
+
656
+ > **Superior to Beads**: Integrated task management with memory, coordination, and deploy batching.
657
+
658
+ ### Task Lifecycle
659
+
660
+ ```
661
+ ┌─────────────────────────────────────────────────────────────────────────────┐
662
+ │ TASK LIFECYCLE │
663
+ ├─────────────────────────────────────────────────────────────────────────────┤
664
+ │ │
665
+ │ CREATE CLAIM WORK RELEASE │
666
+ │ ──────► ──────► ──────► ──────► │
667
+ │ │
668
+ │ uam task uam task (worktree uam task │
669
+ │ create claim <id> workflow) release <id> │
670
+ │ --title "..." │
671
+ │ - Assigns to you - Marks done │
672
+ │ - Announces work - Notifies others │
673
+ │ - Creates worktree - Stores in memory │
674
+ │ - Detects overlaps │
675
+ │ │
676
+ └─────────────────────────────────────────────────────────────────────────────┘
677
+ ```
678
+
679
+ ### Essential Commands
680
+
681
+ ```bash
682
+ # Create a new task
683
+ uam task create --title "Fix auth bug" --type bug --priority 0 --labels "security,auth"
684
+
685
+ # List tasks
686
+ uam task list # All open tasks
687
+ uam task list --filter-status in_progress # In-progress only
688
+ uam task list --filter-priority 0,1 # P0 and P1 only
689
+ uam task ready # Ready to work (no blockers)
690
+ uam task blocked # Blocked tasks
691
+
692
+ # Work on a task
693
+ uam task claim <id> # Claim and start
694
+ uam task show <id> # View details
695
+ uam task update <id> --status in_progress # Update status
696
+ uam task release <id> --reason "Fixed" # Complete
697
+
698
+ # Dependencies (DAG)
699
+ uam task dep --from <child> --to <parent> # Add dependency
700
+ uam task undep --from <child> --to <parent> # Remove dependency
701
+
702
+ # Statistics and sync
703
+ uam task stats # View statistics
704
+ uam task sync # Sync with JSONL (git-tracked)
705
+ uam task compact --days 90 # Archive old tasks
706
+ ```
707
+
708
+ ### Task Hierarchy
709
+
710
+ ```
711
+ Epic (large effort)
712
+ ├── Story (user-facing feature)
713
+ │ ├── Task (implementation unit)
714
+ │ └── Task
715
+ └── Story
716
+ ├── Task
717
+ ├── Bug (defect fix)
718
+ └── Chore (maintenance)
719
+ ```
720
+
721
+ Create hierarchies with `--parent`:
722
+
723
+ ```bash
724
+ uam task create --title "Authentication System" --type epic
725
+ uam task create --title "Login Flow" --type story --parent uam-xxxx
726
+ uam task create --title "Implement JWT validation" --type task --parent uam-yyyy
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",...}
760
+ ```
761
+
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
+ ---
769
+
770
+ ## AGENT COORDINATION SYSTEM
771
+
772
+ > **For multi-agent environments**: Prevents merge conflicts and optimizes CI/CD.
773
+
774
+ ### Architecture
775
+
776
+ ```
777
+ ┌─────────────────────────────────────────────────────────────────────────────┐
778
+ │ AGENT COORDINATION SYSTEM │
779
+ ├─────────────────────────────────────────────────────────────────────────────┤
780
+ │ │
781
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
782
+ │ │ Agent A │ │ Agent B │ │ Agent C │ │
783
+ │ │ (worktree) │ │ (worktree) │ │ (worktree) │ │
784
+ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
785
+ │ │ │ │ │
786
+ │ ▼ ▼ ▼ │
787
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
788
+ │ │ COORDINATION SERVICE │ │
789
+ │ ├─────────────────────────────────────────────────────────────────────┤ │
790
+ │ │ • Agent Registry (who is active) │ │
791
+ │ │ • Work Announcements (who is working where) │ │
792
+ │ │ • Overlap Detection (conflict risk assessment) │ │
793
+ │ │ • Message Passing (inter-agent communication) │ │
794
+ │ │ • Deploy Queue (batched commits/pushes) │ │
795
+ │ └─────────────────────────────────────────────────────────────────────┘ │
796
+ │ │
797
+ └─────────────────────────────────────────────────────────────────────────────┘
798
+ ```
799
+
800
+ ### Agent Lifecycle
801
+
802
+ ```bash
803
+ # Register at session start
804
+ uam agent register --name "feature-agent" --capabilities "coding,testing" \
805
+ --worktree "feature/add-auth"
806
+
807
+ # Send heartbeat (keeps agent active)
808
+ uam agent heartbeat --id <agent-id>
809
+
810
+ # View active agents
811
+ uam agent status
812
+
813
+ # Deregister when done
814
+ uam agent deregister --id <agent-id>
815
+ ```
816
+
817
+ ### Work Announcements
818
+
819
+ ```bash
820
+ # Announce intent to work (enables overlap detection)
821
+ uam agent announce --id <agent-id> \
822
+ --resource "src/auth/" \
823
+ --intent editing \
824
+ --description "Refactoring JWT handling" \
825
+ --files "src/auth/jwt.ts,src/auth/validate.ts" \
826
+ --minutes 30
827
+
828
+ # Check for overlaps before starting
829
+ uam agent overlaps --resource "src/auth/"
830
+
831
+ # Mark work complete (notifies others)
832
+ uam agent complete --id <agent-id> --resource "src/auth/"
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>
870
+ ```
871
+
872
+ ### Deploy Batching
873
+
874
+ ```bash
875
+ # Queue a commit (don't push yet)
876
+ uam deploy queue --agent-id <id> \
877
+ --action-type commit \
878
+ --message "feat: add auth" \
879
+ --files "src/auth.ts,src/auth.test.ts"
880
+
881
+ # Queue a push
882
+ uam deploy queue --agent-id <id> \
883
+ --action-type push \
884
+ --target "feature/auth"
885
+
886
+ # View queue
887
+ uam deploy status
888
+
889
+ # Batch and execute (squashes commits, single push)
890
+ uam deploy flush
891
+
892
+ # Or execute specific batch
893
+ uam deploy batch
894
+ uam deploy execute --batch-id <id>
895
+ ```
896
+
897
+ **Benefits:**
898
+ - Reduces CI/CD runs (batch multiple commits)
899
+ - Squashes related commits for cleaner history
900
+ - Coordinates push order to prevent conflicts
901
+ - Enables atomic multi-file deployments
902
+
903
+ ---
904
+
542
905
  ## BROWSER USAGE
543
906
 
544
907
  When using browser automation (Playwright, Puppeteer, or any browser tool):