eagle-mem 4.6.2 → 4.7.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/README.md +49 -15
- package/db/023_guardrails.sql +3 -2
- package/db/024_guardrails_unique.sql +46 -0
- package/db/025_pending_feature_verifications.sql +30 -0
- package/db/026_agent_source.sql +18 -0
- package/db/027_feature_verification_fingerprints.sql +9 -0
- package/db/028_agent_artifact_tables.sql +124 -0
- package/hooks/post-tool-use.sh +42 -13
- package/hooks/pre-tool-use.sh +107 -14
- package/hooks/session-end.sh +3 -1
- package/hooks/session-start.sh +64 -15
- package/hooks/stop.sh +115 -21
- package/hooks/user-prompt-submit.sh +14 -5
- package/lib/codex-hooks.sh +194 -0
- package/lib/common.sh +345 -0
- package/lib/db-backfill.sh +3 -3
- package/lib/db-features.sh +222 -0
- package/lib/db-guardrails.sh +2 -1
- package/lib/db-mirrors.sh +79 -43
- package/lib/db-observations.sh +3 -2
- package/lib/db-sessions.sh +11 -7
- package/lib/db-summaries.sh +9 -6
- package/lib/hooks-posttool.sh +8 -6
- package/lib/provider.sh +190 -4
- package/package.json +7 -3
- package/scripts/config.sh +2 -0
- package/scripts/feature.sh +70 -2
- package/scripts/guard.sh +4 -1
- package/scripts/health.sh +5 -1
- package/scripts/help.sh +13 -8
- package/scripts/install.sh +130 -76
- package/scripts/memories.sh +71 -45
- package/scripts/refresh.sh +3 -3
- package/scripts/search.sh +57 -47
- package/scripts/statusline-em.sh +1 -1
- package/scripts/tasks.sh +186 -15
- package/scripts/uninstall.sh +7 -0
- package/scripts/update.sh +51 -7
- package/skills/eagle-mem-memories/SKILL.md +13 -13
- package/skills/eagle-mem-tasks/SKILL.md +21 -15
package/scripts/update.sh
CHANGED
|
@@ -13,8 +13,11 @@ LIB_DIR="$SCRIPTS_DIR/../lib"
|
|
|
13
13
|
. "$LIB_DIR/common.sh"
|
|
14
14
|
. "$LIB_DIR/db.sh"
|
|
15
15
|
. "$LIB_DIR/hooks.sh"
|
|
16
|
+
. "$LIB_DIR/codex-hooks.sh"
|
|
16
17
|
|
|
17
18
|
SETTINGS="$EAGLE_SETTINGS"
|
|
19
|
+
claude_found=false
|
|
20
|
+
codex_found=false
|
|
18
21
|
|
|
19
22
|
eagle_header "Update"
|
|
20
23
|
|
|
@@ -30,6 +33,11 @@ if [ ! -f "$EAGLE_MEM_DIR/memory.db" ]; then
|
|
|
30
33
|
eagle_warn "Database not found — will be created"
|
|
31
34
|
fi
|
|
32
35
|
|
|
36
|
+
[ -d "$HOME/.claude" ] && claude_found=true
|
|
37
|
+
if [ -d "$EAGLE_CODEX_DIR" ] || command -v codex &>/dev/null; then
|
|
38
|
+
codex_found=true
|
|
39
|
+
fi
|
|
40
|
+
|
|
33
41
|
# ─── Update files ──────────────────────────────────────────
|
|
34
42
|
|
|
35
43
|
mkdir -p "$EAGLE_MEM_DIR"/{hooks,lib,db,scripts}
|
|
@@ -63,7 +71,7 @@ fi
|
|
|
63
71
|
|
|
64
72
|
# ─── Re-register hooks (idempotent) ───────────────────────
|
|
65
73
|
|
|
66
|
-
if [ -f "$SETTINGS" ] && command -v jq &>/dev/null; then
|
|
74
|
+
if [ "$claude_found" = true ] && [ -f "$SETTINGS" ] && command -v jq &>/dev/null; then
|
|
67
75
|
# Update PostToolUse matcher if it has the old value (pre-v1.3.0)
|
|
68
76
|
if jq -e '.hooks.PostToolUse[]? | select(.matcher == "Read|Write|Edit|Bash")' "$SETTINGS" &>/dev/null; then
|
|
69
77
|
_tmp=$(mktemp)
|
|
@@ -85,9 +93,16 @@ if [ -f "$SETTINGS" ] && command -v jq &>/dev/null; then
|
|
|
85
93
|
eagle_ok "Hooks registered"
|
|
86
94
|
fi
|
|
87
95
|
|
|
96
|
+
if [ "$codex_found" = true ] && command -v jq &>/dev/null; then
|
|
97
|
+
eagle_register_codex_hooks
|
|
98
|
+
eagle_ok "Codex hooks registered"
|
|
99
|
+
elif [ "$codex_found" = false ]; then
|
|
100
|
+
eagle_info "Codex hooks skipped ${DIM}(Codex not detected)${RESET}"
|
|
101
|
+
fi
|
|
102
|
+
|
|
88
103
|
# ─── Update skill symlinks ────────────────────────────────
|
|
89
104
|
|
|
90
|
-
if [ -d "$PACKAGE_DIR/skills" ]; then
|
|
105
|
+
if [ "$claude_found" = true ] && [ -d "$PACKAGE_DIR/skills" ]; then
|
|
91
106
|
mkdir -p "$EAGLE_SKILLS_DIR"
|
|
92
107
|
# Remove stale symlinks for deleted skills (find catches broken symlinks; glob doesn't)
|
|
93
108
|
find "$EAGLE_SKILLS_DIR" -maxdepth 1 -name "eagle-mem-*" -type l 2>/dev/null | while read -r existing; do
|
|
@@ -104,7 +119,26 @@ if [ -d "$PACKAGE_DIR/skills" ]; then
|
|
|
104
119
|
[ -L "$dst" ] && rm "$dst"
|
|
105
120
|
ln -sf "$skill_dir" "$dst"
|
|
106
121
|
done
|
|
107
|
-
eagle_ok "
|
|
122
|
+
eagle_ok "Claude skills updated"
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
if [ "$codex_found" = true ] && [ -d "$PACKAGE_DIR/skills" ]; then
|
|
126
|
+
mkdir -p "$EAGLE_CODEX_SKILLS_DIR"
|
|
127
|
+
find "$EAGLE_CODEX_SKILLS_DIR" -maxdepth 1 -name "eagle-mem-*" -type l 2>/dev/null | while read -r existing; do
|
|
128
|
+
skill_name=$(basename "$existing")
|
|
129
|
+
if [ ! -d "$PACKAGE_DIR/skills/$skill_name" ]; then
|
|
130
|
+
rm "$existing"
|
|
131
|
+
eagle_ok "Removed stale Codex skill: $skill_name"
|
|
132
|
+
fi
|
|
133
|
+
done
|
|
134
|
+
for skill_dir in "$PACKAGE_DIR"/skills/*/; do
|
|
135
|
+
[ ! -d "$skill_dir" ] && continue
|
|
136
|
+
skill_name=$(basename "$skill_dir")
|
|
137
|
+
dst="$EAGLE_CODEX_SKILLS_DIR/$skill_name"
|
|
138
|
+
[ -L "$dst" ] && rm "$dst"
|
|
139
|
+
ln -sf "$skill_dir" "$dst"
|
|
140
|
+
done
|
|
141
|
+
eagle_ok "Codex skills updated"
|
|
108
142
|
fi
|
|
109
143
|
|
|
110
144
|
# ─── Backfill project names ───────────────────────────────
|
|
@@ -118,10 +152,20 @@ fi
|
|
|
118
152
|
|
|
119
153
|
# ─── Patch CLAUDE.md with Eagle Mem instructions ─────────
|
|
120
154
|
|
|
121
|
-
if
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
155
|
+
if [ "$claude_found" = true ]; then
|
|
156
|
+
if eagle_patch_claude_md; then
|
|
157
|
+
eagle_ok "CLAUDE.md updated ${DIM}(eagle-summary instructions added)${RESET}"
|
|
158
|
+
else
|
|
159
|
+
eagle_ok "CLAUDE.md up to date"
|
|
160
|
+
fi
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
if [ "$codex_found" = true ]; then
|
|
164
|
+
if eagle_patch_codex_agents_md; then
|
|
165
|
+
eagle_ok "AGENTS.md updated ${DIM}(Codex eagle-summary instructions added)${RESET}"
|
|
166
|
+
else
|
|
167
|
+
eagle_ok "AGENTS.md up to date"
|
|
168
|
+
fi
|
|
125
169
|
fi
|
|
126
170
|
|
|
127
171
|
# ─── Save installed version ───────────────────────────────
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: eagle-mem-memories
|
|
3
3
|
description: >
|
|
4
|
-
View and sync Claude Code
|
|
5
|
-
'eagle memories', 'show memories', 'sync memories', 'what does
|
|
4
|
+
View and sync Claude Code and Codex memories, plans, and tasks mirrored in Eagle Mem. Use when:
|
|
5
|
+
'eagle memories', 'show memories', 'sync memories', 'what does the agent remember',
|
|
6
6
|
'show plans', 'show tasks', 'mirror memories', 'onboard project',
|
|
7
7
|
'what did past sessions learn'. Uses the eagle-mem CLI.
|
|
8
8
|
---
|
|
@@ -11,9 +11,9 @@ description: >
|
|
|
11
11
|
|
|
12
12
|
## Purpose
|
|
13
13
|
|
|
14
|
-
**For the user:** Claude Code
|
|
14
|
+
**For the user:** Claude Code and Codex remember across sessions. Decisions, preferences, project context, and architectural plans survive session boundaries. The user never has to re-explain "we chose Postgres because..." or "don't use semicolons in this project."
|
|
15
15
|
|
|
16
|
-
**For you
|
|
16
|
+
**For you:** Access to what past Claude Code and Codex sessions learned about this project. Memories tell you *why* decisions were made. Plans tell you *what's coming*. Tasks tell you *what's in flight*. Together they're the knowledge bridge that makes you effective from message one.
|
|
17
17
|
|
|
18
18
|
## Judgment
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ description: >
|
|
|
21
21
|
- The user references a past decision ("remember when we decided to...", "what's our convention for...")
|
|
22
22
|
- You're about to make an architectural or style choice -- memories may record the user's preference
|
|
23
23
|
- You need project context that isn't in CLAUDE.md or README (relationships between services, deployment quirks, naming conventions)
|
|
24
|
-
- The user asks "what does Claude remember about X?"
|
|
24
|
+
- The user asks "what does Claude/Codex/Eagle Mem remember about X?"
|
|
25
25
|
|
|
26
26
|
**Check plans when:**
|
|
27
27
|
- The user asks about upcoming work or roadmap
|
|
@@ -43,21 +43,21 @@ description: >
|
|
|
43
43
|
|
|
44
44
|
### 1. Know the three data types
|
|
45
45
|
|
|
46
|
-
**Memories** -- Claude Code
|
|
46
|
+
**Memories** -- Claude Code auto-memory files (`~/.claude/projects/*/memory/*.md`) plus top-level Codex memory files (`~/.codex/memories/MEMORY.md`, `memory_summary.md`). These contain user preferences, project conventions, and feedback. Each mirrored row is source-attributed.
|
|
47
47
|
```bash
|
|
48
48
|
eagle-mem memories list # all memories
|
|
49
49
|
eagle-mem memories search "typescript" # FTS5 search
|
|
50
50
|
eagle-mem memories show <file_path> # full content
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
**Plans** -- Claude Code
|
|
53
|
+
**Plans** -- Claude Code plan files (`~/.claude/plans/*.md`) and future agent plan files as support is added. Multi-step strategies for complex work. Each has a title, optional project tag, and markdown content.
|
|
54
54
|
```bash
|
|
55
55
|
eagle-mem memories plans # all plans
|
|
56
56
|
eagle-mem memories plans search "migration"
|
|
57
57
|
eagle-mem memories plans show <file_path>
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
**Tasks** -- Claude Code
|
|
60
|
+
**Tasks** -- Claude Code task JSON (`~/.claude/tasks/<session>/*.json`) and Eagle Mem task records created directly by agents such as Codex. Individual units of work with status tracking (pending/in_progress/completed).
|
|
61
61
|
```bash
|
|
62
62
|
eagle-mem memories tasks # all tasks
|
|
63
63
|
eagle-mem memories tasks search "refactor"
|
|
@@ -68,13 +68,13 @@ eagle-mem memories tasks show <file_path>
|
|
|
68
68
|
|
|
69
69
|
Two paths feed the mirror:
|
|
70
70
|
|
|
71
|
-
**Real-time
|
|
71
|
+
**Real-time hooks.** Claude Code memory/plan/task files are mirrored when written. Codex sessions are captured through SessionStart/UserPromptSubmit/PostToolUse/Stop hooks, and important durable facts should be placed in `<eagle-summary>` so they become shared recall.
|
|
72
72
|
|
|
73
|
-
**Backfill (sync command).** For memories, plans, and tasks that existed before Eagle Mem was installed, or that were written outside a
|
|
73
|
+
**Backfill (sync command).** For memories, plans, and tasks that existed before Eagle Mem was installed, or that were written outside a hooked session:
|
|
74
74
|
```bash
|
|
75
75
|
eagle-mem memories sync
|
|
76
76
|
```
|
|
77
|
-
This scans
|
|
77
|
+
This scans known Claude Code and Codex memory/task locations, hashes each file, skips unchanged ones, and mirrors anything new or modified. It also backfills project names from transcripts. Safe to run repeatedly -- content-hash dedup prevents double-insertion.
|
|
78
78
|
|
|
79
79
|
### 3. Search effectively
|
|
80
80
|
|
|
@@ -104,7 +104,7 @@ This asymmetry is intentional but easy to forget. If you're getting too many irr
|
|
|
104
104
|
|
|
105
105
|
### 5. Onboard an existing project
|
|
106
106
|
|
|
107
|
-
When Eagle Mem is installed on a project that already has Claude Code history:
|
|
107
|
+
When Eagle Mem is installed on a project that already has Claude Code or Codex history:
|
|
108
108
|
```bash
|
|
109
109
|
eagle-mem memories sync
|
|
110
110
|
```
|
|
@@ -117,7 +117,7 @@ After sync or after expecting the hook to fire:
|
|
|
117
117
|
eagle-mem memories list # should show recent memories
|
|
118
118
|
eagle-mem search --stats # check counts are non-zero
|
|
119
119
|
```
|
|
120
|
-
If memories list is empty after sync, check that `~/.claude/projects/` contains memory files
|
|
120
|
+
If memories list is empty after sync, check that `~/.claude/projects/` or `~/.codex/memories/` contains memory files. If the hook isn't capturing new writes, check Claude Code `settings.json` or Codex `hooks.json`.
|
|
121
121
|
|
|
122
122
|
## What makes a good memory lookup
|
|
123
123
|
|
|
@@ -10,9 +10,9 @@ description: >
|
|
|
10
10
|
|
|
11
11
|
## Purpose
|
|
12
12
|
|
|
13
|
-
**For the user:** Multi-step work doesn't get lost when Claude Code compacts. A 6-task implementation plan survives intact across compactions — no re-explaining what was decided, no drift from the original direction.
|
|
13
|
+
**For the user:** Multi-step work doesn't get lost when Claude Code or Codex compacts. A 6-task implementation plan survives intact across compactions — no re-explaining what was decided, no drift from the original direction.
|
|
14
14
|
|
|
15
|
-
**For you
|
|
15
|
+
**For you:** Each task description is a message to a future context window with ZERO memory of what happened before. After compaction, SessionStart re-injects pending/in-progress tasks from Eagle Mem's `agent_tasks` table. That re-injected text is all the next context window gets. If the description says "implement auth middleware," the next window has nothing to work with. If it says "implement auth middleware — JWT with RS256, sessions in Redis, errors use RFC 7807 format (decided in task 1)," the next window can execute immediately.
|
|
16
16
|
|
|
17
17
|
## Judgment
|
|
18
18
|
|
|
@@ -42,12 +42,12 @@ Break the request into tasks that are each completable in one context window. Th
|
|
|
42
42
|
|
|
43
43
|
### 2. Create — write self-contained descriptions
|
|
44
44
|
|
|
45
|
-
Use `TaskCreate` for
|
|
45
|
+
Use the agent-native task mechanism when available. In Claude Code, use `TaskCreate`. In Codex, use `update_plan` for the live UI and `eagle-mem tasks add --agent codex` for durable cross-session task records. The description is the most important field — it must carry forward every decision from the planning conversation.
|
|
46
46
|
|
|
47
47
|
**Context transfer pattern:** For each task, ask: "If I read only this description with zero prior context, can I execute it?" If not, add what's missing.
|
|
48
48
|
|
|
49
49
|
```
|
|
50
|
-
TaskCreate:
|
|
50
|
+
TaskCreate / eagle-mem tasks add:
|
|
51
51
|
subject: "Add JWT auth middleware"
|
|
52
52
|
description: "Add Express middleware that validates JWT tokens on protected
|
|
53
53
|
routes. Decisions: RS256 algorithm, public key from env JWT_PUBLIC_KEY,
|
|
@@ -60,15 +60,15 @@ TaskCreate:
|
|
|
60
60
|
|
|
61
61
|
### 3. Execute — one task at a time
|
|
62
62
|
|
|
63
|
-
`TaskUpdate(in_progress)`
|
|
63
|
+
Mark the current task in progress (`TaskUpdate(in_progress)` in Claude Code, or `eagle-mem tasks start <id> --agent codex` in Codex). Do the work. Stay focused on that task — don't drift into adjacent tasks.
|
|
64
64
|
|
|
65
65
|
### 4. Complete — record what happened
|
|
66
66
|
|
|
67
|
-
`TaskUpdate(completed)
|
|
67
|
+
Mark the task completed (`TaskUpdate(completed)` in Claude Code, or `eagle-mem tasks complete <id> --agent codex` in Codex). Emit `<eagle-summary>` so Eagle Mem captures what was accomplished.
|
|
68
68
|
|
|
69
69
|
If the task produced decisions that downstream tasks need, update those task descriptions now:
|
|
70
70
|
```
|
|
71
|
-
TaskUpdate:
|
|
71
|
+
TaskUpdate / update durable task description:
|
|
72
72
|
taskId: "3"
|
|
73
73
|
description: "...original description... Note from task 2: the user table
|
|
74
74
|
uses UUID primary keys, not auto-increment. Auth tokens table FKs to
|
|
@@ -90,7 +90,7 @@ After compaction, SessionStart re-injects all pending/in-progress tasks. Pick th
|
|
|
90
90
|
**A task fails or produces unexpected results:** Update the task description with what was learned and what went wrong. Don't just retry blindly — the description should carry the failure context so the next attempt (or the next context window) doesn't repeat the same mistake.
|
|
91
91
|
|
|
92
92
|
```
|
|
93
|
-
TaskUpdate:
|
|
93
|
+
TaskUpdate / task record update:
|
|
94
94
|
taskId: "4"
|
|
95
95
|
description: "...original description... FAILED ATTEMPT: Prisma migrate
|
|
96
96
|
errored because the users table already has a conflicting unique
|
|
@@ -102,11 +102,11 @@ TaskUpdate:
|
|
|
102
102
|
|
|
103
103
|
## The compact cycle — how task state survives
|
|
104
104
|
|
|
105
|
-
1.
|
|
106
|
-
2.
|
|
107
|
-
3. Eagle Mem
|
|
108
|
-
4. SessionEnd
|
|
109
|
-
5. On compaction (or new session), SessionStart queries `
|
|
105
|
+
1. Claude Code path: you call `TaskCreate`/`TaskUpdate`; Claude Code writes task JSON to `~/.claude/tasks/$session_id/*.json`; Eagle Mem mirrors it.
|
|
106
|
+
2. Codex path: you call `update_plan` for live progress and `eagle-mem tasks add/start/complete --agent codex` for durable records.
|
|
107
|
+
3. Eagle Mem stores both paths in the shared `agent_tasks` FTS5 table with `origin_agent`.
|
|
108
|
+
4. SessionEnd does a final Claude Code task sweep where native task files exist.
|
|
109
|
+
5. On compaction (or new session), SessionStart queries `agent_tasks` for pending/in-progress tasks from the last 7 days and injects them into context.
|
|
110
110
|
|
|
111
111
|
The task descriptions you write ARE the context that survives. Everything else — your reasoning, the conversation, the files you read — gets compacted away.
|
|
112
112
|
|
|
@@ -126,14 +126,20 @@ The bad version forces the next context window to re-discover every decision. Th
|
|
|
126
126
|
## Reference
|
|
127
127
|
|
|
128
128
|
```bash
|
|
129
|
-
# Viewing tasks
|
|
129
|
+
# Viewing tasks
|
|
130
130
|
eagle-mem tasks # pending/in-progress for current project
|
|
131
131
|
eagle-mem tasks list # all tasks (including completed)
|
|
132
132
|
eagle-mem tasks completed # completed tasks only
|
|
133
133
|
eagle-mem tasks search <q> # FTS5 search across task history
|
|
134
134
|
eagle-mem tasks --json # JSON output for scripting
|
|
135
135
|
|
|
136
|
-
#
|
|
136
|
+
# Codex durable task records
|
|
137
|
+
eagle-mem tasks add "Implement auth middleware" --agent codex --desc "Use RS256, Redis sessions, RFC 7807 errors"
|
|
138
|
+
eagle-mem tasks update <id> --agent codex --desc "New context or failure details"
|
|
139
|
+
eagle-mem tasks start <id> --agent codex
|
|
140
|
+
eagle-mem tasks complete <id> --agent codex
|
|
141
|
+
|
|
142
|
+
# Claude Code task tools
|
|
137
143
|
TaskCreate # create a new task
|
|
138
144
|
TaskUpdate # update status, description, dependencies
|
|
139
145
|
```
|