eagle-mem 1.6.2 → 2.0.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/README.md +68 -199
- package/bin/eagle-mem +1 -0
- package/db/010_session_activity.sql +15 -0
- package/db/011_overview_source.sql +10 -0
- package/hooks/post-tool-use.sh +0 -6
- package/hooks/session-start.sh +13 -7
- package/lib/db.sh +55 -37
- package/package.json +2 -2
- package/scripts/help.sh +23 -44
- package/scripts/overview.sh +1 -1
- package/scripts/refresh.sh +82 -0
- package/scripts/scan.sh +23 -2
- package/scripts/update.sh +10 -0
- package/skills/eagle-mem-index/SKILL.md +95 -24
- package/skills/eagle-mem-memories/SKILL.md +109 -38
- package/skills/eagle-mem-overview/SKILL.md +62 -48
- package/skills/eagle-mem-prune/SKILL.md +99 -31
- package/skills/eagle-mem-scan/SKILL.md +93 -25
- package/skills/eagle-mem-search/SKILL.md +87 -47
- package/skills/eagle-mem-tasks/SKILL.md +105 -58
|
@@ -1,83 +1,97 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: eagle-mem-overview
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
'project overview', 'summarize this project', '
|
|
6
|
-
|
|
4
|
+
Build or update a structured project overview for Eagle Mem. Use when: 'eagle overview',
|
|
5
|
+
'project overview', 'summarize this project', 'what is this project', 'update overview',
|
|
6
|
+
or when SessionStart says no overview exists. Produces a multi-paragraph briefing.
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Eagle Mem — Project Overview
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Purpose
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**For the user:** Every new Claude Code session starts cold. The overview eliminates the "explain what this project is" tax — Claude already knows what it's working on, how the project is structured, and what's been happening.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
2. Synthesize into a concise overview (2-4 sentences)
|
|
17
|
-
3. Save via the CLI — one overview per project, updated in place
|
|
15
|
+
**For you (Claude Code):** The overview is your orientation document. It's injected at SessionStart before the user says anything. A good overview lets you give informed answers from message one. A shallow one ("42 files, Node.js") gives you nothing — you'll spend the first 3 exchanges just figuring out what the project does.
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
## Judgment
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
**Build an overview when:**
|
|
20
|
+
- SessionStart says "No overview exists" — build on the user's first prompt
|
|
21
|
+
- The current overview reads like scan metadata (file counts, directory listings) — upgrade it
|
|
22
|
+
- The user asks: "update overview", "summarize this project", "what is this project"
|
|
23
|
+
- The project has changed significantly since the last overview (new major feature, architecture shift)
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
**Don't rebuild when:**
|
|
26
|
+
- The overview is already rich and current — just use it
|
|
27
|
+
- The user needs help with a specific task — do the task first, update overview after if needed
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
eagle-mem overview
|
|
27
|
-
```
|
|
29
|
+
## Steps
|
|
28
30
|
|
|
29
|
-
###
|
|
31
|
+
### 1. Read the project (skip files that don't exist)
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
**Identity:** README.md, package.json / go.mod / pyproject.toml / Cargo.toml
|
|
34
|
+
**Architecture:** Main entry point (bin/*, src/index.*, main.*, app.*), key config (tsconfig.json, Dockerfile, etc.)
|
|
35
|
+
**Activity:** `git log --oneline -20` for recent direction
|
|
36
|
+
**Structure:** `ls` the top-level directories to understand the layout
|
|
37
|
+
|
|
38
|
+
Read these files yourself — don't run `eagle-mem scan`. Scan produces structural metadata (file counts, language breakdown). You need to understand intent, not count files.
|
|
39
|
+
|
|
40
|
+
### 2. Synthesize a structured briefing
|
|
41
|
+
|
|
42
|
+
Write 4-6 paragraphs covering these layers:
|
|
34
43
|
|
|
35
|
-
|
|
44
|
+
**What and why** — What does this project do? Who is it for? What problem does it solve? Lead with the purpose, not the tech stack.
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
**How it's built** — Architecture, key abstractions, data flow. What are the main modules/packages and how do they connect? What tech choices matter (framework, database, deployment target)?
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
**Where to start** — Entry points, key files a new contributor would need to read first. The files that, if you understand them, you understand the project.
|
|
49
|
+
|
|
50
|
+
**Current state** — What version is it at? What's the recent direction from git log? Is it actively developed, stable, or in a transition? What was the most recent significant change?
|
|
51
|
+
|
|
52
|
+
### 3. Save and verify
|
|
40
53
|
|
|
41
|
-
1. First, gather recent context:
|
|
42
54
|
```bash
|
|
43
|
-
eagle-mem
|
|
44
|
-
eagle-mem search --files
|
|
55
|
+
eagle-mem overview set "<your structured overview>"
|
|
45
56
|
```
|
|
46
57
|
|
|
47
|
-
|
|
48
|
-
- **What** the project is (one sentence)
|
|
49
|
-
- **Current state** — what's been worked on recently
|
|
50
|
-
- **Key patterns** — tech stack, architecture decisions
|
|
51
|
-
|
|
52
|
-
3. Save it:
|
|
58
|
+
Then verify it actually saved:
|
|
53
59
|
```bash
|
|
54
|
-
eagle-mem overview
|
|
60
|
+
eagle-mem overview
|
|
55
61
|
```
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
If the output is empty or doesn't match what you wrote, the save failed. Retry once. If it fails again, tell the user.
|
|
58
64
|
|
|
59
|
-
###
|
|
65
|
+
### 4. Fallback for empty repos
|
|
60
66
|
|
|
67
|
+
If no readable source files exist (fresh repo, no README), run a structural scan as a starting point:
|
|
61
68
|
```bash
|
|
62
|
-
eagle-mem
|
|
69
|
+
eagle-mem scan .
|
|
63
70
|
```
|
|
71
|
+
Then tell the user: "I've generated a structural overview from scan. Once you add a README or source code, re-run `/eagle-mem-overview` for a richer briefing."
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
## What makes a good overview
|
|
66
74
|
|
|
67
|
-
|
|
68
|
-
eagle-mem overview delete
|
|
69
|
-
```
|
|
75
|
+
A good overview lets a fresh Claude Code context window give useful answers without reading any files first.
|
|
70
76
|
|
|
71
|
-
|
|
77
|
+
**Good:**
|
|
78
|
+
> eagle-mem is a persistent memory system for Claude Code that solves the context-loss problem across sessions. It hooks into Claude Code's lifecycle (SessionStart, Stop, PostToolUse, SessionEnd, UserPromptSubmit) to automatically capture session summaries, observations, and code context into a single SQLite database with FTS5 full-text search.
|
|
79
|
+
>
|
|
80
|
+
> The architecture is pure bash scripts and sqlite3 — no daemon, no vector DB, no MCP server. Hooks in hooks/ fire during Claude Code events and call into lib/ (common.sh, db.sh) for database operations. The db/ directory holds the schema and numbered migration files. CLI commands in scripts/ expose search, overview management, code indexing, and database maintenance.
|
|
81
|
+
>
|
|
82
|
+
> Key entry point is bin/eagle-mem, which dispatches to scripts/. Skills in skills/ are symlinked into ~/.claude/skills/ and teach Claude Code how to use each capability. The database lives at ~/.eagle-mem/memory.db.
|
|
83
|
+
>
|
|
84
|
+
> Currently at v2.0.0. Recent work focused on memory mirroring (Claude Code's auto-memories, plans, and tasks into FTS5), task-aware compact loops, and skill quality improvements.
|
|
72
85
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
| `-p, --project <name>` | Target a specific project (default: current directory) |
|
|
76
|
-
| `-j, --json` | Output as JSON |
|
|
86
|
+
**Bad:**
|
|
87
|
+
> eagle-mem: Node.js project (42 files, ~5k lines). Structure: bin/ (1), db/ (10), hooks/ (5), lib/ (3), scripts/ (13), skills/ (7). Entry: bin/eagle-mem. No tests detected.
|
|
77
88
|
|
|
78
|
-
##
|
|
89
|
+
## Reference
|
|
79
90
|
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
91
|
+
```bash
|
|
92
|
+
eagle-mem overview # view current overview
|
|
93
|
+
eagle-mem overview set "..." # save new overview
|
|
94
|
+
eagle-mem overview list # all projects with overviews
|
|
95
|
+
eagle-mem overview delete # remove current project's overview
|
|
96
|
+
eagle-mem scan . # structural scan (fallback only)
|
|
97
|
+
```
|
|
@@ -1,63 +1,131 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: eagle-mem-prune
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
'eagle prune', 'clean up memory', 'prune database', '
|
|
6
|
-
'remove old data'
|
|
4
|
+
Database hygiene — remove stale observations and orphaned code chunks. Use when:
|
|
5
|
+
'eagle prune', 'clean up memory', 'prune database', 'database too large',
|
|
6
|
+
'remove old data', 'memory maintenance', search feels slow.
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Eagle Mem — Prune
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Purpose
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**For the user:** Keep Eagle Mem fast and focused. A database that accumulates months of observations without cleanup gets noisy — search results surface stale context, and queries slow down as row counts grow.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**For you (Claude Code):** Understand what data matters most and what's safe to remove. Pruning is a graduated operation — you're trimming low-value data, never touching the high-value records that give sessions continuity.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
## Judgment
|
|
18
|
+
|
|
19
|
+
**Prune when:**
|
|
20
|
+
- `eagle-mem search --stats` shows high observation counts (1000+ for a single project is worth checking)
|
|
21
|
+
- The user says search feels slow or results are stale
|
|
22
|
+
- After removing a project directory or completing a major refactor that invalidated old code paths
|
|
23
|
+
- Periodic maintenance — monthly is enough for most projects
|
|
24
|
+
|
|
25
|
+
**Don't prune when:**
|
|
26
|
+
- The database is small and search is fast — pruning a clean database is pointless
|
|
27
|
+
- You're unsure what the observations contain — run `--dry-run` first
|
|
28
|
+
- The user is mid-task — prune between work sessions, not during
|
|
29
|
+
|
|
30
|
+
**Start conservative.** Default 90 days is right for routine cleanup. Only go aggressive (30 days) when there's a clear reason: project was deleted, architecture was overhauled, or the user explicitly asks for it.
|
|
31
|
+
|
|
32
|
+
## Data hierarchy — what's protected, what's pruned
|
|
33
|
+
|
|
34
|
+
**Never pruned (high-value):**
|
|
35
|
+
- `sessions` — your session history, parent rows for everything else
|
|
36
|
+
- `summaries` + `summaries_fts` — what was accomplished each session
|
|
37
|
+
- `claude_tasks` — task state that survives compaction
|
|
38
|
+
- `claude_memories` — mirrored auto-memories
|
|
39
|
+
- `claude_plans` — mirrored plans
|
|
40
|
+
- `overviews` — project overviews injected at SessionStart
|
|
20
41
|
|
|
21
|
-
|
|
42
|
+
**Pruned by age (medium-value):**
|
|
43
|
+
- `observations` — per-tool-use records (which files were read/written). Useful for recent context, but stale observations from 3 months ago rarely help. Default threshold: 90 days.
|
|
44
|
+
|
|
45
|
+
**Pruned by orphan check (low-value when stale):**
|
|
46
|
+
- `code_chunks` — indexed source code. Chunks for files that no longer exist on disk are orphaned and safe to remove. The prune script checks each file path against the project directory.
|
|
47
|
+
|
|
48
|
+
## Steps
|
|
49
|
+
|
|
50
|
+
### 1. Assess — understand the current state
|
|
22
51
|
|
|
23
52
|
```bash
|
|
24
|
-
eagle-mem
|
|
53
|
+
eagle-mem search --stats
|
|
25
54
|
```
|
|
26
55
|
|
|
27
|
-
|
|
56
|
+
Look at: total observations, total code chunks, project breakdown. This tells you whether pruning is even needed.
|
|
57
|
+
|
|
58
|
+
### 2. Preview — always dry-run first
|
|
28
59
|
|
|
29
60
|
```bash
|
|
30
61
|
eagle-mem prune --dry-run
|
|
31
62
|
```
|
|
32
63
|
|
|
33
|
-
|
|
64
|
+
The output shows:
|
|
65
|
+
- Current counts: "Database: N observations, N chunks"
|
|
66
|
+
- What would be removed: "Would prune N observations older than 90 days"
|
|
67
|
+
- Orphaned chunks: "Would prune N orphaned files from 'project-name'"
|
|
68
|
+
|
|
69
|
+
**What the numbers mean:**
|
|
70
|
+
- 0 observations to prune: database is already clean, nothing to do
|
|
71
|
+
- 50-200 observations: normal cleanup, proceed
|
|
72
|
+
- 500+ observations: significant cleanup — review the project name to make sure it's correct
|
|
73
|
+
- Orphaned chunks: always safe to remove (the source files don't exist anymore)
|
|
74
|
+
|
|
75
|
+
### 3. Execute — prune with the right threshold
|
|
34
76
|
|
|
35
77
|
```bash
|
|
78
|
+
# Standard cleanup (90 days)
|
|
79
|
+
eagle-mem prune
|
|
80
|
+
|
|
81
|
+
# Conservative (only very old data)
|
|
82
|
+
eagle-mem prune --days 180
|
|
83
|
+
|
|
84
|
+
# Aggressive (use only with good reason)
|
|
85
|
+
eagle-mem prune --days 30
|
|
86
|
+
|
|
87
|
+
# Target one project
|
|
36
88
|
eagle-mem prune --project my-app
|
|
37
89
|
```
|
|
38
90
|
|
|
39
|
-
|
|
91
|
+
### 4. Verify — confirm the result
|
|
40
92
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
93
|
+
The prune output shows before/after counts:
|
|
94
|
+
```
|
|
95
|
+
Observations: 342 (was 891)
|
|
96
|
+
Code chunks: 45 (was 72)
|
|
97
|
+
```
|
|
46
98
|
|
|
47
|
-
|
|
99
|
+
If the numbers look wrong (pruned too much or too little), there's no undo — but sessions, summaries, tasks, and memories are intact. Observations will rebuild naturally as you keep working.
|
|
48
100
|
|
|
49
|
-
|
|
50
|
-
- **Orphaned code chunks** — chunks for files that no longer exist
|
|
101
|
+
## When aggressive cleanup is safe
|
|
51
102
|
|
|
52
|
-
|
|
103
|
+
- **Project removed entirely:** The directory is gone, all observations and chunks for it are orphaned. Use `--project <name>` to target just that project.
|
|
104
|
+
- **Major refactor:** You renamed half the files, restructured directories. Old observations reference paths that no longer exist. Prune orphaned chunks, then re-index with `eagle-mem index`.
|
|
105
|
+
- **Fresh start:** The user explicitly wants to clear old noise. `--days 30` removes everything except the last month.
|
|
53
106
|
|
|
54
|
-
|
|
55
|
-
- All summaries
|
|
56
|
-
- Claude Code mirrored memories and plans
|
|
57
|
-
- Task records
|
|
107
|
+
## What makes a good prune decision
|
|
58
108
|
|
|
59
|
-
|
|
109
|
+
**Good:**
|
|
110
|
+
> "eagle-mem search --stats shows 2,400 observations for this project, most from 4 months ago when the architecture was different. I'll dry-run first, then prune with default 90 days."
|
|
60
111
|
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
112
|
+
**Bad:**
|
|
113
|
+
> "Let me clean up the database" [runs `eagle-mem prune --days 7` without checking stats or dry-running first]
|
|
114
|
+
|
|
115
|
+
The good version assesses before acting. The bad version risks removing recent, useful observations with no preview.
|
|
116
|
+
|
|
117
|
+
## Reference
|
|
118
|
+
|
|
119
|
+
| Flag | What it does |
|
|
120
|
+
|------|-------------|
|
|
121
|
+
| `--dry-run`, `-n` | Preview what would be removed, no changes |
|
|
122
|
+
| `--days N`, `-d N` | Age threshold in days (default: 90) |
|
|
123
|
+
| `--project <name>`, `-p` | Target a single project |
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
eagle-mem prune --dry-run # always start here
|
|
127
|
+
eagle-mem prune # standard 90-day cleanup
|
|
128
|
+
eagle-mem prune --days 30 # aggressive (with good reason)
|
|
129
|
+
eagle-mem prune -p my-app -n # dry-run for one project
|
|
130
|
+
eagle-mem search --stats # check database health first
|
|
131
|
+
```
|
|
@@ -1,48 +1,116 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: eagle-mem-scan
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
'what
|
|
4
|
+
Structural codebase analysis — language breakdown, framework detection, entry
|
|
5
|
+
points, tests, dependencies. Use when: 'eagle scan', 'scan this project',
|
|
6
|
+
'analyze codebase structure', 'what is this project made of', bootstrapping
|
|
7
|
+
a new project's overview, empty repo with no README.
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
# Eagle Mem — Scan
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
## Purpose
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
**For the user:** Machine-readable project analysis. Answers "what is this project made of?" with hard numbers — languages, line counts, frameworks, entry points, test presence, monorepo structure. No interpretation, just structure.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
- File count, directory structure, languages used
|
|
17
|
-
- Entry points, config files, test presence
|
|
18
|
-
- Framework/library detection from package.json, go.mod, etc.
|
|
16
|
+
**For you (Claude Code):** Scan is the structural foundation that overview builds on. It tells you what languages and frameworks are present, how the project is organized, and whether tests exist — all without reading any source files. Use it when you need facts about project composition, not understanding of project purpose.
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
## Judgment
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
**Scan when:**
|
|
21
|
+
- No overview exists and the project has no README (scan is the best starting point)
|
|
22
|
+
- You need structural facts: "how many TypeScript files?", "is this a monorepo?", "what test framework?"
|
|
23
|
+
- Bootstrapping a brand-new project in Eagle Mem for the first time
|
|
24
|
+
- After major restructuring — added new packages, new languages, reorganized directories
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
**Don't scan when:**
|
|
27
|
+
- A rich overview already exists -- scan auto-skips when the overview exceeds 300 chars (use `--force` to override)
|
|
28
|
+
- You need to understand what the project does or why it's built a certain way -- that's overview's job
|
|
29
|
+
- You just want to look at the project -- use `ls` and `Read` instead
|
|
30
|
+
|
|
31
|
+
**Scan vs overview -- they complement each other:**
|
|
32
|
+
- `eagle-mem scan .` = machine analysis. Counts files, detects frameworks, finds entry points. Fast, no model reasoning. Produces a factual one-liner stored as the overview. Auto-skips if a rich overview exists.
|
|
33
|
+
- `/eagle-mem-overview` = model-driven analysis. You read source files, understand architecture, write a multi-paragraph briefing. Slower, much richer.
|
|
34
|
+
|
|
35
|
+
The typical flow for a new project: scan first (get the structural snapshot), then build a proper overview on top of it (which replaces the scan output with something richer).
|
|
36
|
+
|
|
37
|
+
## What scan detects
|
|
38
|
+
|
|
39
|
+
**Language breakdown:** Top 5 languages by line count. Maps file extensions to language names (`.ts`/`.tsx` = TypeScript, `.py` = Python, etc.). Reports file counts and line counts per language.
|
|
40
|
+
|
|
41
|
+
**Framework detection:** Checks `package.json` dependencies (React, Next.js, Express, Hono, Prisma, Tailwind, etc.), Python markers (Django, Flask, FastAPI), and ecosystem files (Cargo.toml, go.mod, Gemfile, pubspec.yaml, mix.exs, etc.).
|
|
42
|
+
|
|
43
|
+
**Structure:** Top-level directories with file counts. Uses `git ls-files` in git repos, falls back to `find` otherwise.
|
|
44
|
+
|
|
45
|
+
**Entry points:** Looks for `bin/*`, `src/index.*`, `src/main.*`, `src/app.*`, `index.*`, `main.*`, `app.*`, `server.*`, `cli.*`.
|
|
46
|
+
|
|
47
|
+
**Tests:** Counts files matching test patterns (`test/`, `tests/`, `__tests__/`, `.test.`, `.spec.`, `_test.`). Detects test frameworks (Jest, Vitest, Mocha, pytest).
|
|
48
|
+
|
|
49
|
+
**Config files:** Finds Dockerfile, docker-compose, tsconfig, ESLint, Biome, Tailwind config, Vite/Next/Webpack config, railway.json, CLAUDE.md, and others.
|
|
50
|
+
|
|
51
|
+
**Dependencies:** Counts npm deps/devDeps from package.json, Go modules from go.mod.
|
|
52
|
+
|
|
53
|
+
**Monorepo:** Detects npm workspaces, pnpm-workspace.yaml, Lerna, Turborepo.
|
|
54
|
+
|
|
55
|
+
## Steps
|
|
56
|
+
|
|
57
|
+
### 1. Run the scan
|
|
25
58
|
|
|
26
59
|
```bash
|
|
27
|
-
eagle-mem scan .
|
|
60
|
+
eagle-mem scan . # current directory
|
|
61
|
+
eagle-mem scan /path/to/project # specific path
|
|
28
62
|
```
|
|
29
63
|
|
|
30
|
-
###
|
|
64
|
+
### 2. Read the output
|
|
31
65
|
|
|
32
|
-
|
|
33
|
-
|
|
66
|
+
Scan prints each detection as it goes:
|
|
67
|
+
```
|
|
68
|
+
+ 47 files found
|
|
69
|
+
+ Languages: TypeScript (12k lines, 35 files), Bash (2k lines, 8 files)
|
|
70
|
+
+ Frameworks: Hono, Prisma, Tailwind
|
|
71
|
+
+ Structure: src/ (28), db/ (10), scripts/ (8), hooks/ (5)
|
|
72
|
+
+ Entry points: bin/eagle-mem, src/index.ts
|
|
73
|
+
+ Tests: 6 test files (Vitest)
|
|
74
|
+
+ Config: tsconfig.json, CLAUDE.md, railway.json
|
|
75
|
+
+ Dependencies: npm: 12 deps, 8 devDeps
|
|
34
76
|
```
|
|
35
77
|
|
|
36
|
-
|
|
78
|
+
**What to look for:**
|
|
79
|
+
- "No tests detected" — notable, worth mentioning to the user
|
|
80
|
+
- 0 entry points — unusual, might mean non-standard project structure
|
|
81
|
+
- Missing framework detection — scan only checks known patterns; niche frameworks won't appear
|
|
82
|
+
- Very high file counts with few lines — lots of config/generated files
|
|
83
|
+
|
|
84
|
+
### 3. Decide what's next
|
|
85
|
+
|
|
86
|
+
**If this is a new project with no overview:** The scan output is now stored as the overview. Tell the user: "Structural overview saved. Run `/eagle-mem-overview` for a richer briefing once you're ready."
|
|
87
|
+
|
|
88
|
+
**If a rich overview already existed:** You just overwrote it. Re-run `/eagle-mem-overview` immediately to rebuild the semantic understanding on top of the new structural data.
|
|
37
89
|
|
|
38
|
-
|
|
39
|
-
- After major restructuring (new packages, renamed dirs)
|
|
40
|
-
- When the current overview feels stale or wrong
|
|
90
|
+
## What makes a good scan decision
|
|
41
91
|
|
|
42
|
-
|
|
92
|
+
**Good:**
|
|
93
|
+
> Fresh repo, no README, no overview in Eagle Mem. Running `eagle-mem scan .` to get a structural baseline, then building a proper overview from the source code.
|
|
43
94
|
|
|
44
|
-
|
|
95
|
+
**Bad:**
|
|
96
|
+
> The project already has a detailed 4-paragraph overview from last session. Running `eagle-mem scan --force .` to "refresh the data." [This replaces the rich overview with a one-liner.]
|
|
97
|
+
|
|
98
|
+
The scan is a starting point, not a maintenance tool. Once a proper overview exists, update it with `/eagle-mem-overview` -- don't overwrite it with scan.
|
|
99
|
+
|
|
100
|
+
## Reference
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
eagle-mem scan . # scan current directory (skips if rich overview exists)
|
|
104
|
+
eagle-mem scan --force . # scan and overwrite even if rich overview exists
|
|
105
|
+
eagle-mem scan /path/to/project # scan specific path
|
|
106
|
+
eagle-mem overview # view the current overview
|
|
107
|
+
eagle-mem overview set "..." # manually set overview (what /eagle-mem-overview does)
|
|
108
|
+
```
|
|
45
109
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
110
|
+
| Detail | Notes |
|
|
111
|
+
|--------|-------|
|
|
112
|
+
| Output stored in | `overviews` table (same as `overview set`) |
|
|
113
|
+
| Overwrites existing overview | Only with `--force` -- auto-skips if overview > 300 chars |
|
|
114
|
+
| Respects .gitignore | Yes, uses `git ls-files` in git repos |
|
|
115
|
+
| Requires model reasoning | No -- pure bash + awk analysis |
|
|
116
|
+
| Typical runtime | Under 2 seconds for most projects |
|
|
@@ -1,78 +1,118 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: eagle-mem-search
|
|
3
3
|
description: >
|
|
4
|
-
Search Eagle Mem's persistent memory
|
|
5
|
-
'what did I do', '
|
|
6
|
-
'search my history'
|
|
4
|
+
Search Eagle Mem's persistent memory. Use when: 'eagle search', 'search memory',
|
|
5
|
+
'what did I do', 'find in memory', 'past sessions', 'what happened with',
|
|
6
|
+
'search my history', 'what do you remember about', 'show recent sessions',
|
|
7
|
+
'what files changed', 'memory stats'. Uses the eagle-mem CLI.
|
|
7
8
|
---
|
|
8
9
|
|
|
9
|
-
# Eagle Mem —
|
|
10
|
+
# Eagle Mem — Search
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
## Purpose
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
**For the user:** Never repeat yourself. Every decision, every debug session, every architectural choice is searchable across months and projects. "What did we do with auth?" gets a real answer, not a guess.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
**For you (Claude Code):** Access to the past. When the user references prior work, you can find it instead of fabricating it. Search gives you summaries, observations, file history, and cross-project patterns -- all FTS5-indexed.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
## Judgment
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
**Search when:**
|
|
21
|
+
- The user asks about past work ("what did we do with X?", "when did we change Y?")
|
|
22
|
+
- You need context before making a decision (was this pattern tried before? what broke last time?)
|
|
23
|
+
- The user references something from a prior session and you have no context
|
|
24
|
+
- You want to understand the trajectory of a project (timeline mode)
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
**Don't search when:**
|
|
27
|
+
- The answer is in the current codebase -- read the code instead
|
|
28
|
+
- The user is asking you to do something, not recall something
|
|
29
|
+
- You already have the answer from SessionStart context injection
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
**Decision rule:** If the question is about *what happened* or *why we decided*, search memory. If the question is about *what the code does now*, read the code.
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
## Steps
|
|
31
34
|
|
|
35
|
+
### 1. Start specific, then broaden (3-layer recall)
|
|
36
|
+
|
|
37
|
+
**Layer 1 -- Keyword search.** Start with the most specific terms.
|
|
32
38
|
```bash
|
|
33
|
-
eagle-mem search
|
|
34
|
-
eagle-mem search --timeline --limit 20
|
|
39
|
+
eagle-mem search "webhook retry logic"
|
|
35
40
|
```
|
|
41
|
+
This searches summaries (session request, completed, learned fields). Look at session IDs in results -- you'll need them for Layer 2.
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
View all tool observations (files read/written, commands run) for a specific session.
|
|
40
|
-
|
|
43
|
+
**Layer 2 -- Session drill-down.** When a summary looks relevant, expand it to see every tool call in that session.
|
|
41
44
|
```bash
|
|
42
|
-
eagle-mem search --session <
|
|
45
|
+
eagle-mem search --session <id>
|
|
43
46
|
```
|
|
47
|
+
This shows the full observation trail: what files were read, written, what bash commands ran. This is where you find the actual sequence of work.
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Show which files are touched most often in this project.
|
|
48
|
-
|
|
49
|
+
**Layer 3 -- Correlate across sessions.** If you see a pattern in one session, broaden to find related work.
|
|
49
50
|
```bash
|
|
50
|
-
eagle-mem search --
|
|
51
|
+
eagle-mem search "webhook" --all # cross-project
|
|
52
|
+
eagle-mem search "retry" --limit 20 # more results
|
|
53
|
+
eagle-mem search --timeline # recent work chronology
|
|
51
54
|
```
|
|
52
55
|
|
|
53
|
-
###
|
|
56
|
+
### 2. Use FTS5 syntax effectively
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
The query goes through FTS5 with light sanitization. What works:
|
|
59
|
+
- `word1 word2` -- implicit AND (both must appear)
|
|
60
|
+
- `word1 OR word2` -- either term matches
|
|
61
|
+
- Single words -- broadest match
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
What does NOT work (stripped by sanitizer):
|
|
64
|
+
- `"exact phrase"` -- quotes are removed, words match independently
|
|
65
|
+
- `prefix*` -- asterisks are stripped
|
|
66
|
+
- Parenthesized groups -- stripped
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
**Practical tip:** If `webhook retry` returns nothing, try `webhook OR retry` to loosen the match. If results are noisy, add more specific terms to narrow.
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|------|-------------|
|
|
65
|
-
| `-p, --project <name>` | Target a specific project (default: current directory) |
|
|
66
|
-
| `-n, --limit <N>` | Max results (default: 10) |
|
|
67
|
-
| `-a, --all` | Search across all projects |
|
|
68
|
-
| `-j, --json` | Output as JSON (for programmatic use) |
|
|
70
|
+
### 3. Use the right mode for the question
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
| Question type | Command | What you get |
|
|
73
|
+
|---|---|---|
|
|
74
|
+
| "What did we do with X?" | `search "X"` | Matching summaries with request/completed/learned |
|
|
75
|
+
| "What happened recently?" | `search --timeline` | Last N sessions in date order |
|
|
76
|
+
| "Show me that session" | `search --session <id>` | Every observation in the session |
|
|
77
|
+
| "What are the hot files?" | `search --files` | Files ranked by modification frequency |
|
|
78
|
+
| "How much is stored?" | `search --stats` | Session, summary, observation, chunk counts |
|
|
71
79
|
|
|
72
|
-
|
|
80
|
+
### 4. Synthesize — don't dump
|
|
73
81
|
|
|
74
|
-
|
|
82
|
+
Raw search output is not an answer. After searching:
|
|
83
|
+
- **Summarize patterns.** "You worked on auth across 4 sessions over the past 2 weeks. The main change was moving from JWT to session cookies, driven by mobile client limitations."
|
|
84
|
+
- **Cite session IDs.** "Session #42 is where the retry logic was added" -- lets the user drill down if they want.
|
|
85
|
+
- **Flag gaps.** If the topic predates Eagle Mem's install or the results are thin, say so. Don't fill gaps with guesses.
|
|
75
86
|
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
### 5. Cross-project search
|
|
88
|
+
|
|
89
|
+
When the user works on multiple projects, patterns may span them.
|
|
90
|
+
```bash
|
|
91
|
+
eagle-mem search "rate limiting" --all
|
|
92
|
+
```
|
|
93
|
+
This drops the project filter and searches everything. Useful for: "Have I implemented rate limiting before?", "What projects used Redis?", finding reusable patterns.
|
|
94
|
+
|
|
95
|
+
## What makes a good search response
|
|
96
|
+
|
|
97
|
+
**Good:**
|
|
98
|
+
> Eagle Mem found 3 sessions related to webhook retry logic. The pattern evolved across sessions: #31 added basic retries with exponential backoff, #35 fixed a bug where retries weren't respecting the max-attempts config, and #38 added dead-letter queue support after retries exhaust. The key decision (session #35) was to cap retries at 5 with a 30-second max delay -- you noted this was to avoid overwhelming the target service.
|
|
99
|
+
|
|
100
|
+
**Bad:**
|
|
101
|
+
> Here are the search results:
|
|
102
|
+
> #31 2024-03-01 Request: add webhook retries Completed: added retry logic
|
|
103
|
+
> #35 2024-03-05 Request: fix retry bug Completed: fixed retry config
|
|
104
|
+
> #38 2024-03-10 Request: webhook improvements Completed: added DLQ
|
|
105
|
+
|
|
106
|
+
## Reference
|
|
107
|
+
|
|
108
|
+
| Flag | What it does |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `"query"` | FTS5 keyword search across summaries |
|
|
111
|
+
| `--timeline` `-t` | Recent sessions in chronological order |
|
|
112
|
+
| `--session <id>` `-s` | Full observations for one session |
|
|
113
|
+
| `--files` `-f` | Most frequently modified files |
|
|
114
|
+
| `--stats` | Database counts (sessions, summaries, observations, code chunks) |
|
|
115
|
+
| `--all` `-a` | Cross-project search (drops project filter) |
|
|
116
|
+
| `--limit N` `-n` | Max results (default: 10) |
|
|
117
|
+
| `--project <name>` `-p` | Override project (default: current directory) |
|
|
118
|
+
| `--json` `-j` | Machine-readable JSON output |
|