eagle-mem 3.2.0 → 4.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.
@@ -1,131 +0,0 @@
1
- ---
2
- name: eagle-mem-prune
3
- description: >
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
- ---
8
-
9
- # Eagle Mem — Prune
10
-
11
- ## Purpose
12
-
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
-
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
-
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
41
-
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
51
-
52
- ```bash
53
- eagle-mem search --stats
54
- ```
55
-
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
59
-
60
- ```bash
61
- eagle-mem prune --dry-run
62
- ```
63
-
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
76
-
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
88
- eagle-mem prune --project my-app
89
- ```
90
-
91
- ### 4. Verify — confirm the result
92
-
93
- The prune output shows before/after counts:
94
- ```
95
- Observations: 342 (was 891)
96
- Code chunks: 45 (was 72)
97
- ```
98
-
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.
100
-
101
- ## When aggressive cleanup is safe
102
-
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.
106
-
107
- ## What makes a good prune decision
108
-
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."
111
-
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,116 +0,0 @@
1
- ---
2
- name: eagle-mem-scan
3
- description: >
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.
8
- ---
9
-
10
- # Eagle Mem — Scan
11
-
12
- ## Purpose
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.
15
-
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.
17
-
18
- ## Judgment
19
-
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
25
-
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
58
-
59
- ```bash
60
- eagle-mem scan . # current directory
61
- eagle-mem scan /path/to/project # specific path
62
- ```
63
-
64
- ### 2. Read the output
65
-
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
76
- ```
77
-
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.
89
-
90
- ## What makes a good scan decision
91
-
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.
94
-
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
- ```
109
-
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 |