universal-agent-memory 3.0.0 → 3.1.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.
- package/dist/bin/cli.js +6 -4
- package/dist/bin/cli.js.map +1 -1
- package/dist/cli/hooks.d.ts +2 -0
- package/dist/cli/hooks.d.ts.map +1 -1
- package/dist/cli/hooks.js +307 -60
- package/dist/cli/hooks.js.map +1 -1
- package/dist/cli/memory.js +79 -1
- package/dist/cli/memory.js.map +1 -1
- package/dist/coordination/service.d.ts +2 -0
- package/dist/coordination/service.d.ts.map +1 -1
- package/dist/coordination/service.js +13 -1
- package/dist/coordination/service.js.map +1 -1
- package/dist/memory/memory-maintenance.d.ts +1 -0
- package/dist/memory/memory-maintenance.d.ts.map +1 -1
- package/dist/memory/memory-maintenance.js +41 -4
- package/dist/memory/memory-maintenance.js.map +1 -1
- package/package.json +1 -1
- package/templates/CLAUDE.template.md +29 -29
- package/templates/hooks/pre-compact.sh +21 -1
- package/templates/hooks/session-start.sh +22 -1
|
@@ -740,9 +740,11 @@ uam agent status # Check other active agents
|
|
|
740
740
|
|
|
741
741
|
## MULTI-AGENT COORDINATION PROTOCOL
|
|
742
742
|
|
|
743
|
-
**
|
|
743
|
+
**Skip this section for single-agent sessions.** Only activate when multiple agents work concurrently (e.g., parallel subagents via Task tool, or multiple Claude Code sessions on same repo).
|
|
744
744
|
|
|
745
|
-
|
|
745
|
+
**Parallel-first rule**: When safe, run independent tool calls in parallel (searches, reads, status checks) and invoke multiple subagents concurrently for review.
|
|
746
|
+
|
|
747
|
+
### Before Claiming Any Work (multi-agent only)
|
|
746
748
|
|
|
747
749
|
```bash
|
|
748
750
|
uam agent overlaps --resource "<files-or-directories>"
|
|
@@ -750,13 +752,12 @@ uam agent overlaps --resource "<files-or-directories>"
|
|
|
750
752
|
|
|
751
753
|
### Overlap Response Matrix
|
|
752
754
|
|
|
753
|
-
| Risk Level | Action |
|
|
754
|
-
|
|
755
|
-
| `none` | Proceed immediately |
|
|
756
|
-
| `low` | Proceed, note merge order |
|
|
757
|
-
| `medium` | Announce, coordinate sections |
|
|
758
|
-
| `high` | Wait or split work |
|
|
759
|
-
| `critical` | STOP - request handoff | Same file, same sections |
|
|
755
|
+
| Risk Level | Action |
|
|
756
|
+
|------------|--------|
|
|
757
|
+
| `none` | Proceed immediately |
|
|
758
|
+
| `low` | Proceed, note merge order |
|
|
759
|
+
| `medium` | Announce, coordinate sections |
|
|
760
|
+
| `high`/`critical` | Wait or split work |
|
|
760
761
|
|
|
761
762
|
### Agent Capability Routing
|
|
762
763
|
|
|
@@ -786,21 +787,11 @@ uam agent overlaps --resource "<files-or-directories>"
|
|
|
786
787
|
|
|
787
788
|
## MULTI-AGENT EXECUTION (DEPENDENCY-AWARE)
|
|
788
789
|
|
|
789
|
-
**
|
|
790
|
-
|
|
791
|
-
**
|
|
792
|
-
|
|
793
|
-
**
|
|
794
|
-
1. **Decompose** the request into discrete work items with clear inputs/outputs.
|
|
795
|
-
2. **Map dependencies** (A blocks B). Only run B after A is complete.
|
|
796
|
-
3. **Parallelize** dependency-free items with separate agents and explicit file boundaries.
|
|
797
|
-
4. **Gate edits** with `uam agent overlaps --resource "<files>"` before touching any file.
|
|
798
|
-
5. **Merge in dependency order** (upstream first). Rebase or re-run dependent steps if needed.
|
|
799
|
-
|
|
800
|
-
**Conflict avoidance**:
|
|
801
|
-
- One agent per file at a time
|
|
802
|
-
- Declare file ownership in prompts
|
|
803
|
-
- If overlap risk is high, wait or split by section
|
|
790
|
+
**Skip for single-agent sessions.** When using parallel subagents:
|
|
791
|
+
1. **Decompose** into discrete work items. **Map dependencies** (A blocks B).
|
|
792
|
+
2. **Parallelize** dependency-free items with separate agents and explicit file boundaries.
|
|
793
|
+
3. **Gate edits** with `uam agent overlaps --resource "<files>"` before touching any file.
|
|
794
|
+
4. **Merge in dependency order** (upstream first).
|
|
804
795
|
|
|
805
796
|
---
|
|
806
797
|
|
|
@@ -882,13 +873,19 @@ effective_importance = importance * (0.95 ^ days_since_access)
|
|
|
882
873
|
|
|
883
874
|
## WORKTREE WORKFLOW
|
|
884
875
|
|
|
885
|
-
**
|
|
876
|
+
**Use worktrees for multi-file features/refactors. Skip for single-file fixes.**
|
|
877
|
+
|
|
878
|
+
| Change Scope | Workflow |
|
|
879
|
+
|-------------|----------|
|
|
880
|
+
| Single-file fix (<20 lines) | Direct commit to feature branch, no worktree needed |
|
|
881
|
+
| Multi-file change (2-5 files) | Worktree recommended if touching shared interfaces |
|
|
882
|
+
| Feature/refactor (3+ files, new feature) | Worktree required |
|
|
883
|
+
| CLAUDE.md or config changes | Worktree required |
|
|
886
884
|
|
|
887
885
|
```bash
|
|
888
|
-
# Create
|
|
886
|
+
# Create (when needed)
|
|
889
887
|
{{WORKTREE_CREATE_CMD}} <slug>
|
|
890
888
|
cd {{WORKTREE_DIR}}/NNN-<slug>/
|
|
891
|
-
pwd | grep -q "{{WORKTREE_DIR}}" || echo "STOP!" # Verify location
|
|
892
889
|
|
|
893
890
|
# Work
|
|
894
891
|
git add -A && git commit -m "type: description"
|
|
@@ -896,7 +893,7 @@ git add -A && git commit -m "type: description"
|
|
|
896
893
|
# PR (runs tests, triggers parallel reviewers)
|
|
897
894
|
{{WORKTREE_PR_CMD}} <id>
|
|
898
895
|
|
|
899
|
-
# Cleanup
|
|
896
|
+
# Cleanup (ALWAYS cleanup after merge)
|
|
900
897
|
{{WORKTREE_CLEANUP_CMD}} <id>
|
|
901
898
|
```
|
|
902
899
|
|
|
@@ -934,10 +931,13 @@ Task(subagent_type: "documentation-expert", prompt: "Check: <files>")
|
|
|
934
931
|
| work request (fix/add/change/update/create/implement/build) | `uam task create --type task` |
|
|
935
932
|
| bug report/error | `uam task create --type bug` |
|
|
936
933
|
| feature request | `uam task create --type feature` |
|
|
937
|
-
|
|
|
934
|
+
| single-file fix | direct commit to branch, skip worktree |
|
|
935
|
+
| multi-file feature (3+ files) | create worktree, then work |
|
|
938
936
|
| review/check/look | query memory first |
|
|
939
937
|
| ANY code change | tests required |
|
|
940
938
|
|
|
939
|
+
**Agent coordination**: Only use `uam agent` commands when multiple agents are active concurrently. For single-agent sessions (most common), skip agent registration and overlap checks.
|
|
940
|
+
|
|
941
941
|
---
|
|
942
942
|
|
|
943
943
|
## UAM VISUAL STATUS FEEDBACK (MANDATORY WHEN UAM IS ACTIVE)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# UAM Pre-Compact Hook for Claude Code
|
|
3
|
-
# Writes a timestamp marker to the daily log before context compaction
|
|
3
|
+
# 1. Writes a timestamp marker to the daily log before context compaction
|
|
4
|
+
# 2. Marks any agents registered by this session as completed
|
|
4
5
|
# Fails safely - never blocks the agent.
|
|
5
6
|
set -euo pipefail
|
|
6
7
|
|
|
7
8
|
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
8
9
|
DB_PATH="${PROJECT_DIR}/agents/data/memory/short_term.db"
|
|
10
|
+
COORD_DB="${PROJECT_DIR}/agents/data/coordination/coordination.db"
|
|
9
11
|
|
|
10
12
|
if [ ! -f "$DB_PATH" ]; then
|
|
11
13
|
exit 0
|
|
@@ -18,3 +20,21 @@ sqlite3 "$DB_PATH" "
|
|
|
18
20
|
INSERT OR IGNORE INTO memories (timestamp, type, content)
|
|
19
21
|
VALUES ('$TIMESTAMP', 'action', '[pre-compact] Context compaction at $TIMESTAMP');
|
|
20
22
|
" 2>/dev/null || true
|
|
23
|
+
|
|
24
|
+
# Clean up agents with recent heartbeats (likely from this session being compacted)
|
|
25
|
+
# Mark as completed, release their claims
|
|
26
|
+
if [ -f "$COORD_DB" ]; then
|
|
27
|
+
sqlite3 "$COORD_DB" "
|
|
28
|
+
DELETE FROM work_claims WHERE agent_id IN (
|
|
29
|
+
SELECT id FROM agent_registry
|
|
30
|
+
WHERE status='active' AND last_heartbeat >= datetime('now','-5 minutes')
|
|
31
|
+
);
|
|
32
|
+
UPDATE work_announcements SET completed_at='$TIMESTAMP'
|
|
33
|
+
WHERE completed_at IS NULL AND agent_id IN (
|
|
34
|
+
SELECT id FROM agent_registry
|
|
35
|
+
WHERE status='active' AND last_heartbeat >= datetime('now','-5 minutes')
|
|
36
|
+
);
|
|
37
|
+
UPDATE agent_registry SET status='completed'
|
|
38
|
+
WHERE status='active' AND last_heartbeat >= datetime('now','-5 minutes');
|
|
39
|
+
" 2>/dev/null || true
|
|
40
|
+
fi
|
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# UAM Session Start Hook for Claude Code
|
|
3
|
-
#
|
|
3
|
+
# 1. Cleans stale agents (heartbeat >24h old)
|
|
4
|
+
# 2. Injects open loops and recent daily context
|
|
4
5
|
# Fails safely - never blocks the agent.
|
|
5
6
|
set -euo pipefail
|
|
6
7
|
|
|
7
8
|
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
8
9
|
DB_PATH="${PROJECT_DIR}/agents/data/memory/short_term.db"
|
|
10
|
+
COORD_DB="${PROJECT_DIR}/agents/data/coordination/coordination.db"
|
|
9
11
|
|
|
10
12
|
if [ ! -f "$DB_PATH" ]; then
|
|
11
13
|
exit 0
|
|
12
14
|
fi
|
|
13
15
|
|
|
16
|
+
# Clean stale agents from coordination DB (heartbeat >24h old)
|
|
17
|
+
if [ -f "$COORD_DB" ]; then
|
|
18
|
+
sqlite3 "$COORD_DB" "
|
|
19
|
+
DELETE FROM work_claims WHERE agent_id IN (
|
|
20
|
+
SELECT id FROM agent_registry
|
|
21
|
+
WHERE status IN ('active','idle') AND last_heartbeat < datetime('now','-24 hours')
|
|
22
|
+
);
|
|
23
|
+
DELETE FROM work_announcements WHERE agent_id IN (
|
|
24
|
+
SELECT id FROM agent_registry
|
|
25
|
+
WHERE status IN ('active','idle') AND last_heartbeat < datetime('now','-24 hours')
|
|
26
|
+
) AND completed_at IS NULL;
|
|
27
|
+
UPDATE agent_registry SET status='failed'
|
|
28
|
+
WHERE status IN ('active','idle') AND last_heartbeat < datetime('now','-24 hours');
|
|
29
|
+
DELETE FROM agent_registry
|
|
30
|
+
WHERE status IN ('completed','failed') AND started_at < datetime('now','-7 days');
|
|
31
|
+
DELETE FROM agent_messages WHERE created_at < datetime('now','-24 hours');
|
|
32
|
+
" 2>/dev/null || true
|
|
33
|
+
fi
|
|
34
|
+
|
|
14
35
|
output=""
|
|
15
36
|
|
|
16
37
|
# Recent memories (last 24h, high importance)
|