eagle-mem 4.8.0 → 4.8.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/README.md CHANGED
@@ -1,16 +1,29 @@
1
1
  ```
2
2
  ======================================
3
3
  Eagle Mem
4
- context that survives /compact
4
+ shared memory | guardrails | lanes
5
5
  ======================================
6
6
  ```
7
7
 
8
8
  # Eagle Mem
9
9
 
10
- **Context that survives `/compact`.**
10
+ **Shared memory, release guardrails, and worker lanes for Claude Code and Codex.**
11
11
 
12
- **v4.8.0 ships first-class cross-agent orchestration, compact Codex hook recall, enforced anti-regression checks, and configurable RTK token guardrails.**
13
- Claude Code and Codex can now share the same local Eagle Mem database, while every captured row records which agent created it.
12
+ Eagle Mem turns AI coding sessions into compounding project knowledge. It gives Claude Code and Codex the same local memory, labels which agent created each memory, blocks risky release commands until affected features are verified, and lets broad work split into durable worker lanes.
13
+
14
+ **v4.8.2 ships Codex output polish:** Codex final replies now stay clean by default instead of printing large `<eagle-summary>` capture blocks. Eagle Mem still captures summaries from the Stop transcript, while Claude Code can keep using the richer explicit summary path where it behaves cleanly.
15
+
16
+ **Website:** [Product](https://eagleisbatman.github.io/eagle-mem/) |
17
+ [Architecture](https://eagleisbatman.github.io/eagle-mem/architecture.html) |
18
+ [About](https://eagleisbatman.github.io/eagle-mem/about.html)
19
+
20
+ ## Why People Install It
21
+
22
+ - **Start warmer** - every new session can recall project overviews, decisions, gotchas, summaries, hot files, mirrored memories, plans, and tasks.
23
+ - **Ship safer** - feature-mapped changes create pending verification records, and release-boundary commands stay blocked until the current diff is verified or waived.
24
+ - **Waste fewer tokens** - Eagle Mem injects compact context, nudges duplicate reads, and can route noisy shell output through RTK.
25
+ - **Coordinate agents** - Codex and Claude Code can share one project memory while worker lanes record owner, model, effort, worktree, logs, validation, and handoff.
26
+ - **Stay local** - no daemon, no hosted memory service, no vector database. The core is hooks plus SQLite/FTS5.
14
27
 
15
28
  ## The Problem
16
29
 
@@ -18,9 +31,17 @@ Claude Code and Codex start every session with amnesia. They don't remember what
18
31
 
19
32
  The longer you work with Claude Code, the worse this gets. Projects accumulate history — decisions, gotchas, architectural patterns, feature dependencies — and none of it survives across sessions.
20
33
 
21
- ## The Solution
34
+ ## The Product
35
+
36
+ Eagle Mem is a local runtime layer for AI coding agents. It adds three things that ordinary agent sessions do not have by default:
22
37
 
23
- Eagle Mem is a recall and regression-control layer for Claude Code and Codex. Every session starts with context from previous sessions — summaries, decisions, memories, tasks, project overviews, and relevant code — injected automatically via hooks. Both agents share the same SQLite database at `~/.eagle-mem/memory.db`, and captured rows are source-attributed as `Claude Code` or `Codex`.
38
+ | Layer | What users feel | What Eagle Mem does |
39
+ |-------|-----------------|---------------------|
40
+ | **Recall** | "The agent remembers this repo." | Loads project overviews, summaries, decisions, memories, tasks, plans, and relevant indexed code. |
41
+ | **Guardrails** | "The agent cannot casually undo known decisions or push unverified feature changes." | Surfaces decisions before edits and enforces feature verification on push, PR, and publish boundaries. |
42
+ | **Lanes** | "A big task can survive compaction and split across agents." | Persists orchestrations, worker lanes, worktrees, logs, validation commands, and handoffs. |
43
+
44
+ Both agents share the same SQLite database at `~/.eagle-mem/memory.db`, and captured rows are source-attributed as `Claude Code` or `Codex`.
24
45
 
25
46
  **Zero per-instance overhead.** No daemon, no vector DB, no MCP server. Just bash scripts, sqlite3 (WAL mode, FTS5 full-text search), and jq.
26
47
 
@@ -128,6 +149,14 @@ Eagle Mem prevents Claude from repeating past mistakes:
128
149
  | `eagle-mem scan` | Scan codebase and generate overview |
129
150
  | `eagle-mem index` | Index source files for FTS5 code search |
130
151
 
152
+ ### v4.8.2 Patch
153
+
154
+ Codex no longer gets instructed to print large user-visible `<eagle-summary>` XML blocks. The installer/update path rewrites existing `~/.codex/AGENTS.md` Eagle Mem instructions to the clean-output contract, context-pressure nudges use normal prose, and Codex-oriented skills/worker prompts avoid raw capture templates.
155
+
156
+ ### v4.8.1 Patch
157
+
158
+ `eagle-mem memories sync` is now safe on large Claude Code/Codex memory files. The memory mirror parser no longer uses early-exit pipelines under `pipefail`, avoiding exit `141` during sync.
159
+
131
160
  ### Search Modes
132
161
 
133
162
  ```bash
@@ -171,7 +171,7 @@ fi
171
171
  if [ "$agent" = "codex" ] && [ "${stat_with_summaries:-0}" -eq 0 ] 2>/dev/null; then
172
172
  context+="
173
173
  === Eagle Mem: Codex Capture Warming Up ===
174
- Codex hooks are active. End important turns with an <eagle-summary> block so future Claude Code and Codex sessions can recall decisions, gotchas, key files, and next steps from this project.
174
+ Codex hooks are active. Keep final replies clean; Eagle Mem will capture decisions, gotchas, key files, and next steps from the transcript automatically.
175
175
  "
176
176
  fi
177
177
 
@@ -439,7 +439,7 @@ fi
439
439
  if [ "$agent" = "codex" ]; then
440
440
  context+="
441
441
  === Eagle Mem: Active ===
442
- Memory active for '$project'. Emit <eagle-summary> in final responses with request, completed, learned, decisions, gotchas, next_steps, key_files, files_read, files_modified, affected_features, verified_features, and regression_risks.
442
+ Memory active for '$project'. Keep user-facing Codex replies clean: do not print Eagle Mem summary capture blocks, XML, JSON hook payloads, or internal templates unless the user explicitly asks. The Stop hook captures summaries from the transcript automatically.
443
443
  "
444
444
  elif [ "$source_type" = "compact" ] || [ "$source_type" = "clear" ]; then
445
445
  context+="
package/hooks/stop.sh CHANGED
@@ -238,7 +238,7 @@ if [ "$needs_enrichment" -eq 1 ]; then
238
238
  if [ "$provider" != "none" ] && [ -n "$text_content" ]; then
239
239
  excerpt=$(echo "$text_content" | tail -c 3000)
240
240
 
241
- enrich_prompt="Extract facts from this Claude Code session. Only include items with clear evidence in the session text. Do NOT invent or repeat example content.
241
+ enrich_prompt="Extract facts from this AI coding session. Only include items with clear evidence in the session text. Do NOT invent or repeat example content.
242
242
 
243
243
  Respond with EXACTLY these sections (omit sections with no evidence):
244
244
 
@@ -263,7 +263,7 @@ Each as: <filepath>
263
263
  SESSION TEXT:
264
264
  $excerpt"
265
265
 
266
- enrich_system="You extract structured facts from development sessions. Output format for decisions: '- Did X — why: Y'. Output format for gotchas: '- Gotcha description'. Be concise. Only include items with clear evidence in the session text. Never fabricate content."
266
+ enrich_system="You extract structured facts from Claude Code and Codex development sessions. Output format for decisions: '- Did X — why: Y'. Output format for gotchas: '- Gotcha description'. Be concise. Only include items with clear evidence in the session text. Never fabricate content."
267
267
  enrich_result=$(eagle_llm_call "$enrich_prompt" "$enrich_system" 768 2>/dev/null)
268
268
  llm_rc=$?
269
269
 
@@ -44,18 +44,32 @@ if [ -n "$session_id" ] && eagle_validate_session_id "$session_id"; then
44
44
  eagle_log "INFO" "UserPromptSubmit: turn=$turn_count session=$session_id"
45
45
 
46
46
  if [ "$turn_count" -ge 30 ]; then
47
- context+="
47
+ if [ "$codex_compact" -eq 1 ]; then
48
+ context+="
49
+ === Eagle Mem: Context Pressure Critical ($turn_count turns since compact) ===
50
+ Keep the next Codex reply user-clean. Do not print Eagle Mem summary capture blocks or other internals. Include a short normal handoff note if useful, then ask the user to run /compact.
51
+ "
52
+ else
53
+ context+="
48
54
  === Eagle Mem: Context Pressure Critical ($turn_count turns since compact) ===
49
55
  IMMEDIATELY emit a detailed <eagle-summary> covering ALL work this session.
50
56
  Tell the user to run /compact NOW to avoid losing context.
51
57
  "
58
+ fi
52
59
  echo "$turn_count" > "$EAGLE_MEM_DIR/.context-pressure"
53
60
  elif [ "$turn_count" -ge 20 ]; then
54
- context+="
61
+ if [ "$codex_compact" -eq 1 ]; then
62
+ context+="
63
+ === Eagle Mem: Context Pressure High ($turn_count turns since compact) ===
64
+ Keep the next Codex reply clean. Do not print Eagle Mem summary capture blocks or other internals. Summarize any durable decisions in normal prose only.
65
+ "
66
+ else
67
+ context+="
55
68
  === Eagle Mem: Context Pressure High ($turn_count turns since compact) ===
56
69
  Include a thorough <eagle-summary> in your next response — capture all decisions, gotchas, and learned context before compaction.
57
70
  Suggest the user run /compact to free context for continued work.
58
71
  "
72
+ fi
59
73
  echo "$turn_count" > "$EAGLE_MEM_DIR/.context-pressure"
60
74
  else
61
75
  rm -f "$EAGLE_MEM_DIR/.context-pressure" 2>/dev/null
package/lib/common.sh CHANGED
@@ -659,10 +659,7 @@ eagle_patch_claude_md() {
659
659
  skip && /^## / { skip=0 }
660
660
  !skip { print }
661
661
  ' "$claude_md" > "$tmp_md"
662
- # Remove trailing blank lines left by section removal
663
- sed -e :a -e '/^[[:space:]]*$/{ $d; N; ba; }' "$tmp_md" > "${tmp_md}.clean"
664
- mv "${tmp_md}.clean" "$claude_md"
665
- rm -f "$tmp_md"
662
+ mv "$tmp_md" "$claude_md"
666
663
  _eagle_claude_md_section >> "$claude_md"
667
664
  return 0
668
665
  fi
@@ -692,30 +689,13 @@ _eagle_codex_agents_section() {
692
689
 
693
690
  Eagle Mem hooks are active for Codex in this project. SessionStart and UserPromptSubmit inject project recall from the shared Eagle Mem database at `~/.eagle-mem/memory.db`. PostToolUse records observations and marks affected features for verification.
694
691
 
695
- **Rule:** Before your final response in every session, emit an `<eagle-summary>` block so the Stop hook can capture a rich summary.
696
-
697
- ```
698
- <eagle-summary>
699
- request: [what user asked]
700
- completed: [what shipped]
701
- learned: [non-obvious discoveries]
702
- decisions: [choice — why]
703
- gotchas: [what surprised]
704
- next_steps: [concrete actions]
705
- key_files: [path — role]
706
- files_read: [path, ...]
707
- files_modified: [path, ...]
708
- affected_features: [feature, ...]
709
- verified_features: [feature, ...]
710
- regression_risks: [risk, ...]
711
- </eagle-summary>
712
- ```
692
+ **User-visible output rule:** Keep Codex final answers clean. Do not print Eagle Mem summary capture blocks, XML, JSON hook payloads, or internal templates to the user unless the user explicitly asks for raw Eagle Mem internals. The Stop hook captures Codex summaries from the transcript automatically.
713
693
 
714
694
  **How to apply:**
715
695
  - Attribute recalled context as "Eagle Mem recalls:" when it is injected
716
696
  - Use the Eagle Mem skills when relevant: `eagle-mem-search`, `eagle-mem-overview`, `eagle-mem-memories`, `eagle-mem-tasks`, and `eagle-mem-orchestrate`
717
697
  - For broad multi-agent work, YOU run `eagle-mem orchestrate`; do not ask the user to run these commands
718
- - For important decisions, preferences, gotchas, or durable project facts, explicitly include them in the `<eagle-summary>` block so Codex-originated memories become available to future Claude Code and Codex sessions
698
+ - For important decisions, preferences, gotchas, or durable project facts, include them briefly in normal prose. Eagle Mem will extract them from the transcript.
719
699
  - Do not revert Eagle Mem-surfaced decisions without asking the user
720
700
  - If Eagle Mem reports pending feature verification, verify or waive it before push/PR/publish
721
701
  - Never put raw secrets in summaries
@@ -729,6 +709,23 @@ eagle_patch_codex_agents_md() {
729
709
  mkdir -p "$(dirname "$agents_md")"
730
710
 
731
711
  if [ -f "$agents_md" ] && grep -qF "$marker" "$agents_md" 2>/dev/null; then
712
+ if grep -qF 'emit an `<eagle-summary>` block' "$agents_md" 2>/dev/null \
713
+ || grep -qF 'emit an <eagle-summary> block' "$agents_md" 2>/dev/null \
714
+ || grep -qF 'explicitly include them in the `<eagle-summary>` block' "$agents_md" 2>/dev/null \
715
+ || grep -qF 'explicitly include them in the <eagle-summary> block' "$agents_md" 2>/dev/null \
716
+ || ! grep -qF 'Keep Codex final answers clean' "$agents_md" 2>/dev/null; then
717
+ local tmp_md
718
+ tmp_md=$(mktemp)
719
+ awk -v marker="$marker" '
720
+ $0 ~ marker { skip=1; next }
721
+ skip && /^---$/ { skip=0; next }
722
+ skip && /^## / { skip=0 }
723
+ !skip { print }
724
+ ' "$agents_md" > "$tmp_md"
725
+ mv "$tmp_md" "$agents_md"
726
+ _eagle_codex_agents_section >> "$agents_md"
727
+ return 0
728
+ fi
732
729
  if ! grep -qF 'eagle-mem orchestrate' "$agents_md" 2>/dev/null; then
733
730
  local tmp_md
734
731
  tmp_md=$(mktemp)
package/lib/db-mirrors.sh CHANGED
@@ -23,7 +23,7 @@ eagle_capture_agent_memory() {
23
23
  body=$(cat "$file_path")
24
24
  fi
25
25
 
26
- _fm_field() { printf '%s\n' "$fm" | awk -F': *' -v k="$1" '$1==k{sub(/^[^:]+: */,""); gsub(/^"|"$/,""); print; exit}'; }
26
+ _fm_field() { awk -F': *' -v k="$1" '$1==k{sub(/^[^:]+: */,""); gsub(/^"|"$/,""); print; exit}' <<< "$fm"; }
27
27
 
28
28
  local mname mdesc mtype morigin
29
29
  mname=$(_fm_field "name")
@@ -41,7 +41,14 @@ eagle_capture_agent_memory() {
41
41
  fi
42
42
  [ -z "$mtype" ] && mtype="$agent"
43
43
  if [ -z "$mdesc" ]; then
44
- mdesc=$(printf '%s\n' "$body" | sed '/^[[:space:]]*$/d' | head -1 | cut -c1-200)
44
+ mdesc=$(awk '
45
+ /^[[:space:]]*$/ { next }
46
+ {
47
+ line = substr($0, 1, 200)
48
+ print line
49
+ exit
50
+ }
51
+ ' <<< "$body")
45
52
  fi
46
53
 
47
54
  local fp_sql proj_sql name_sql desc_sql type_sql content_sql hash_sql origin_sql agent_sql
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eagle-mem",
3
- "version": "4.8.0",
4
- "description": "Context that survives /compact for Claude Code and Codex SQLite + FTS5, no daemon, no bloat",
3
+ "version": "4.8.2",
4
+ "description": "Shared memory, release guardrails, RTK token protection, and worker lanes for Claude Code and Codex",
5
5
  "bin": {
6
6
  "eagle-mem": "bin/eagle-mem"
7
7
  },
package/scripts/help.sh CHANGED
@@ -13,24 +13,35 @@ version=$(jq -r .version "$PACKAGE_DIR/package.json" 2>/dev/null || echo "unknow
13
13
  eagle_banner
14
14
 
15
15
  echo -e " ${BOLD}Eagle Mem${RESET} ${DIM}v${version}${RESET}"
16
- echo -e " ${DIM}Context that survives /compact for Claude Code and Codex${RESET}"
16
+ echo -e " ${DIM}Shared memory, release guardrails, RTK token protection, and worker lanes${RESET}"
17
+ echo -e " ${DIM}for Claude Code and Codex.${RESET}"
17
18
  echo ""
18
- echo -e " ${BOLD}Commands:${RESET}"
19
+ echo -e " ${BOLD}Core commands:${RESET}"
19
20
  echo -e " ${CYAN}install${RESET} First-time setup: hooks, database, skills"
20
21
  echo -e " ${CYAN}update${RESET} Re-deploy hooks and run migrations"
21
22
  echo -e " ${CYAN}uninstall${RESET} Remove hooks and optionally delete data"
22
23
  echo -e " ${CYAN}search${RESET} Search past sessions, memories, and code"
23
24
  echo -e " ${CYAN}health${RESET} Diagnose pipeline health and background automation"
24
- echo -e " ${CYAN}config${RESET} View or change provider and token-guard settings"
25
- echo -e " ${CYAN}guard${RESET} Manage regression guardrails for files"
26
25
  echo -e " ${CYAN}overview${RESET} Build or view project overview"
27
26
  echo -e " ${CYAN}memories${RESET} View/sync agent memories"
28
27
  echo -e " ${CYAN}tasks${RESET} View mirrored tasks"
29
- echo -e " ${CYAN}orchestrate${RESET} Durable worker-lane coordination"
28
+ echo ""
29
+ echo -e " ${BOLD}Safety and token controls:${RESET}"
30
+ echo -e " ${CYAN}feature${RESET} Track, verify, and unblock feature changes"
31
+ echo -e " ${CYAN}guard${RESET} Manage regression guardrails for files"
32
+ echo -e " ${CYAN}config${RESET} View/change providers, RTK, and token guard settings"
33
+ echo ""
34
+ echo -e " ${BOLD}Automation and coordination:${RESET}"
30
35
  echo -e " ${CYAN}curate${RESET} Run curator (co-edits, hot files, guardrails)"
31
- echo -e " ${CYAN}feature${RESET} Track, verify, and unblock features"
36
+ echo -e " ${CYAN}orchestrate${RESET} Durable worker-lane coordination"
32
37
  echo -e " ${CYAN}prune${RESET} Clean old sessions and stale data"
33
38
  echo ""
39
+ echo -e " ${BOLD}What it protects:${RESET}"
40
+ echo -e " ${DIM}Recall${RESET} Project overview, summaries, memories, plans, tasks, code index"
41
+ echo -e " ${DIM}Guardrails${RESET} Decisions, gotchas, feature verification, stale memory warnings"
42
+ echo -e " ${DIM}Tokens${RESET} Compact hook recall and optional RTK shell-output routing"
43
+ echo -e " ${DIM}Lanes${RESET} Cross-agent worker status, worktrees, logs, validation, handoffs"
44
+ echo ""
34
45
  echo -e " ${BOLD}Search modes:${RESET}"
35
46
  echo -e " ${DIM}\$${RESET} eagle-mem search \"auth bug\" ${DIM}# keyword search${RESET}"
36
47
  echo -e " ${DIM}\$${RESET} eagle-mem search --timeline ${DIM}# recent sessions${RESET}"
@@ -301,7 +301,7 @@ Rules:
301
301
  - If blocked, run: eagle-mem orchestrate lane --project "$project" --name "$name" block "$lane_key" --notes "<concrete blocker>"
302
302
  - If you finish manually before the wrapper updates status, run: eagle-mem orchestrate lane --project "$project" --name "$name" complete "$lane_key" --notes "<validation result>"
303
303
  - Run the validation command when one is provided and it is safe for the lane.
304
- - Before final response, emit an <eagle-summary> with request, completed, learned, decisions, gotchas, next_steps, key_files, files_read, files_modified, affected_features, verified_features, and regression_risks.
304
+ - Keep user-facing final responses clean. Claude Code workers may emit an Eagle Mem summary block when their UI handles it cleanly; Codex workers should not print XML, JSON, or internal capture blocks unless the user explicitly asks. Eagle Mem Stop hooks capture Codex summaries from the transcript automatically.
305
305
  PROMPT
306
306
  }
307
307
 
package/scripts/style.sh CHANGED
@@ -18,7 +18,7 @@ CROSS="${RED}✗${RESET}"
18
18
  ARROW="${CYAN}→${RESET}"
19
19
  DOT="${DIM}·${RESET}"
20
20
  EAGLE_RULE="======================================"
21
- EAGLE_TAGLINE="context that survives /compact"
21
+ EAGLE_TAGLINE="shared memory | guardrails | lanes"
22
22
 
23
23
  eagle_header() {
24
24
  echo ""
@@ -68,7 +68,7 @@ eagle-mem memories tasks show <file_path>
68
68
 
69
69
  Two paths feed the mirror:
70
70
 
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.
71
+ **Real-time hooks.** Claude Code memory/plan/task files are mirrored when written. Codex sessions are captured through SessionStart/UserPromptSubmit/PostToolUse/Stop hooks. In Codex, keep user-facing replies clean and put important durable facts in normal prose; Eagle Mem extracts them from the transcript.
72
72
 
73
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
@@ -129,8 +129,10 @@ ending a broad session.
129
129
  - Every lane should have a validation command when one is obvious.
130
130
  - If a lane is blocked, update the lane with a concrete note rather than
131
131
  silently stopping.
132
- - After completing a lane, emit an `<eagle-summary>` so Eagle Mem captures the
133
- decision and files touched.
132
+ - After completing a lane, keep the user-facing final response clean. Claude Code
133
+ may use the Eagle Mem summary block when that UI handles it cleanly; Codex
134
+ should record durable decisions in normal prose and let the Stop hook capture
135
+ the transcript.
134
136
 
135
137
  ## Reference
136
138
 
@@ -66,7 +66,7 @@ Mark the current task in progress (`TaskUpdate(in_progress)` in Claude Code, or
66
66
 
67
67
  ### 4. Complete — record what happened
68
68
 
69
- 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.
69
+ Mark the task completed (`TaskUpdate(completed)` in Claude Code, or `eagle-mem tasks complete <id> --agent codex` in Codex). In Claude Code, use the Eagle Mem summary block when that UI handles it cleanly. In Codex, keep the final reply clean and record durable decisions in normal prose; Eagle Mem captures the transcript automatically.
70
70
 
71
71
  If the task produced decisions that downstream tasks need, update those task descriptions now:
72
72
  ```