eagle-mem 1.0.3 → 1.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/bin/eagle-mem CHANGED
@@ -21,6 +21,9 @@ case "$command" in
21
21
  update) bash "$SCRIPTS_DIR/update.sh" "$PACKAGE_DIR" "$@" ;;
22
22
  scan) bash "$SCRIPTS_DIR/scan.sh" "$@" ;;
23
23
  index) bash "$SCRIPTS_DIR/index.sh" "$@" ;;
24
+ search) bash "$SCRIPTS_DIR/search.sh" "$@" ;;
25
+ tasks) bash "$SCRIPTS_DIR/tasks.sh" "$@" ;;
26
+ overview) bash "$SCRIPTS_DIR/overview.sh" "$@" ;;
24
27
  help|--help|-h)
25
28
  bash "$SCRIPTS_DIR/help.sh" ;;
26
29
  version|--version|-v|-V)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eagle-mem",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Lightweight persistent memory for Claude Code — SQLite + FTS5, no daemon, no bloat",
5
5
  "bin": {
6
6
  "eagle-mem": "bin/eagle-mem"
package/scripts/help.sh CHANGED
@@ -19,20 +19,26 @@ echo -e " ${BOLD}Usage:${RESET}"
19
19
  echo -e " eagle-mem ${CYAN}<command>${RESET}"
20
20
  echo ""
21
21
  echo -e " ${BOLD}Commands:${RESET}"
22
+ echo -e " ${CYAN}search${RESET} Search past sessions, files, and observations"
23
+ echo -e " ${CYAN}tasks${RESET} Manage tracked tasks (add, done, block, list)"
24
+ echo -e " ${CYAN}overview${RESET} View or set project overview"
25
+ echo -e " ${CYAN}scan${RESET} Analyze a project and generate an overview"
26
+ echo -e " ${CYAN}index${RESET} Index source files for code-level search"
22
27
  echo -e " ${CYAN}install${RESET} Set up hooks, database, and skills"
23
28
  echo -e " ${CYAN}uninstall${RESET} Remove hooks and optionally delete data"
24
29
  echo -e " ${CYAN}update${RESET} Re-deploy hooks and run new migrations"
25
- echo -e " ${CYAN}scan${RESET} Analyze a project and generate an overview"
26
- echo -e " ${CYAN}index${RESET} Index source files for code-level search"
27
30
  echo -e " ${CYAN}help${RESET} Show this help message"
28
31
  echo -e " ${CYAN}version${RESET} Show version number"
29
32
  echo ""
30
33
  echo -e " ${BOLD}Examples:${RESET}"
31
- echo -e " ${DIM}\$${RESET} eagle-mem install ${DIM}# First-time setup${RESET}"
32
- echo -e " ${DIM}\$${RESET} eagle-mem update ${DIM}# After npm update${RESET}"
33
- echo -e " ${DIM}\$${RESET} eagle-mem scan . ${DIM}# Scan current project${RESET}"
34
- echo -e " ${DIM}\$${RESET} eagle-mem index . ${DIM}# Index source files${RESET}"
35
- echo -e " ${DIM}\$${RESET} eagle-mem uninstall ${DIM}# Clean removal${RESET}"
34
+ echo -e " ${DIM}\$${RESET} eagle-mem search \"auth bug\" ${DIM}# Search memory${RESET}"
35
+ echo -e " ${DIM}\$${RESET} eagle-mem search --timeline ${DIM}# Recent sessions${RESET}"
36
+ echo -e " ${DIM}\$${RESET} eagle-mem tasks ${DIM}# List tasks${RESET}"
37
+ echo -e " ${DIM}\$${RESET} eagle-mem tasks add \"Fix X\" ${DIM}# Add a task${RESET}"
38
+ echo -e " ${DIM}\$${RESET} eagle-mem overview ${DIM}# View overview${RESET}"
39
+ echo -e " ${DIM}\$${RESET} eagle-mem scan . ${DIM}# Scan current project${RESET}"
40
+ echo -e " ${DIM}\$${RESET} eagle-mem index . ${DIM}# Index source files${RESET}"
41
+ echo -e " ${DIM}\$${RESET} eagle-mem install ${DIM}# First-time setup${RESET}"
36
42
  echo ""
37
43
  echo -e " ${BOLD}What it does:${RESET}"
38
44
  echo -e " ${DOT} Saves session summaries to a shared SQLite database"
@@ -46,5 +52,7 @@ echo -e " ${CYAN}/eagle-mem-search${RESET} Search past sessions and observ
46
52
  echo -e " ${CYAN}/eagle-mem-tasks${RESET} Break work into tracked subtasks"
47
53
  echo -e " ${CYAN}/eagle-mem-overview${RESET} Generate a persistent project summary"
48
54
  echo ""
55
+ echo -e " ${DIM}Skills use these CLI commands under the hood — no raw SQL.${RESET}"
56
+ echo ""
49
57
  echo -e " ${DIM}https://github.com/eagleisbatman/eagle-mem${RESET}"
50
58
  echo ""
@@ -0,0 +1,156 @@
1
+ #!/usr/bin/env bash
2
+ # ═══════════════════════════════════════════════════════════
3
+ # Eagle Mem — Overview
4
+ # CLI wrapper for project overview management
5
+ # ═══════════════════════════════════════════════════════════
6
+ set -euo pipefail
7
+
8
+ SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd)"
9
+ LIB_DIR="$SCRIPTS_DIR/../lib"
10
+
11
+ . "$SCRIPTS_DIR/style.sh"
12
+ . "$LIB_DIR/common.sh"
13
+ . "$LIB_DIR/db.sh"
14
+
15
+ eagle_ensure_db
16
+
17
+ # ─── Parse arguments ──────────────────────────────────────
18
+
19
+ action="${1:-show}"
20
+ shift 2>/dev/null || true
21
+
22
+ project=""
23
+ json_output=false
24
+ args=()
25
+
26
+ while [ $# -gt 0 ]; do
27
+ case "$1" in
28
+ --project|-p) project="$2"; shift 2 ;;
29
+ --json|-j) json_output=true; shift ;;
30
+ --help|-h)
31
+ echo -e " ${BOLD}eagle-mem overview${RESET} — Manage project overviews"
32
+ echo ""
33
+ echo -e " ${BOLD}Usage:${RESET}"
34
+ echo -e " eagle-mem overview ${DIM}# show current overview${RESET}"
35
+ echo -e " eagle-mem overview ${CYAN}set${RESET} <text> ${DIM}# set/update overview${RESET}"
36
+ echo -e " eagle-mem overview ${CYAN}delete${RESET} ${DIM}# delete overview${RESET}"
37
+ echo -e " eagle-mem overview ${CYAN}list${RESET} ${DIM}# list all overviews${RESET}"
38
+ echo ""
39
+ echo -e " ${BOLD}Options:${RESET}"
40
+ echo -e " ${CYAN}-p, --project${RESET} <name> Project name (default: current dir)"
41
+ echo -e " ${CYAN}-j, --json${RESET} Output as JSON"
42
+ echo ""
43
+ echo -e " ${BOLD}Tip:${RESET} Use ${CYAN}eagle-mem scan${RESET} to auto-generate an overview from code."
44
+ echo ""
45
+ exit 0
46
+ ;;
47
+ *) args+=("$1"); shift ;;
48
+ esac
49
+ done
50
+
51
+ [ -z "$project" ] && project=$(eagle_project_from_cwd "$(pwd)")
52
+ project_sql=$(eagle_sql_escape "$project")
53
+
54
+ # ─── Show overview ────────────────────────────────────────
55
+
56
+ overview_show() {
57
+ if [ "$json_output" = true ]; then
58
+ eagle_db_json "SELECT project, content, updated_at FROM overviews WHERE project = '$project_sql';"
59
+ return
60
+ fi
61
+
62
+ local content
63
+ content=$(eagle_get_overview "$project")
64
+
65
+ if [ -z "$content" ]; then
66
+ eagle_dim "No overview for project '$project'"
67
+ eagle_dim "Run 'eagle-mem scan' or 'eagle-mem overview set <text>' to create one"
68
+ return
69
+ fi
70
+
71
+ echo ""
72
+ echo -e " ${BOLD}Overview${RESET} ${DIM}($project)${RESET}"
73
+ echo -e " ${DIM}─────────────────────────────────────${RESET}"
74
+ echo ""
75
+ echo -e " $content"
76
+ echo ""
77
+ }
78
+
79
+ # ─── Set overview ─────────────────────────────────────────
80
+
81
+ overview_set() {
82
+ local content="${args[*]:-}"
83
+
84
+ if [ -z "$content" ]; then
85
+ eagle_err "Usage: eagle-mem overview set <text>"
86
+ exit 1
87
+ fi
88
+
89
+ eagle_upsert_overview "$project" "$content"
90
+
91
+ if [ "$json_output" = true ]; then
92
+ printf '{"project":"%s","updated":true}\n' "$project"
93
+ return
94
+ fi
95
+
96
+ eagle_ok "Overview saved for '$project'"
97
+ }
98
+
99
+ # ─── Delete overview ──────────────────────────────────────
100
+
101
+ overview_delete() {
102
+ eagle_db "DELETE FROM overviews WHERE project = '$project_sql';"
103
+
104
+ if [ "$json_output" = true ]; then
105
+ printf '{"project":"%s","deleted":true}\n' "$project"
106
+ return
107
+ fi
108
+
109
+ eagle_ok "Overview deleted for '$project'"
110
+ }
111
+
112
+ # ─── List all overviews ──────────────────────────────────
113
+
114
+ overview_list() {
115
+ if [ "$json_output" = true ]; then
116
+ eagle_db_json "SELECT project, content, updated_at FROM overviews ORDER BY updated_at DESC;"
117
+ return
118
+ fi
119
+
120
+ local results
121
+ results=$(eagle_db "SELECT project, substr(content, 1, 80), updated_at FROM overviews ORDER BY updated_at DESC;")
122
+
123
+ if [ -z "$results" ]; then
124
+ eagle_dim "No overviews stored"
125
+ return
126
+ fi
127
+
128
+ echo ""
129
+ echo -e " ${BOLD}All project overviews${RESET}"
130
+ echo -e " ${DIM}─────────────────────────────────────${RESET}"
131
+ echo ""
132
+
133
+ while IFS='|' read -r proj snippet updated_at; do
134
+ [ -z "$proj" ] && continue
135
+ echo -e " ${BOLD}$proj${RESET} ${DIM}$updated_at${RESET}"
136
+ echo -e " ${DIM}$snippet...${RESET}"
137
+ echo ""
138
+ done <<< "$results"
139
+ }
140
+
141
+ # ─── Dispatch ─────────────────────────────────────────────
142
+
143
+ case "$action" in
144
+ show|view) overview_show ;;
145
+ set|update) overview_set ;;
146
+ delete|rm) overview_delete ;;
147
+ list|ls) overview_list ;;
148
+ --help|-h)
149
+ echo -e " Run ${CYAN}eagle-mem overview --help${RESET} for usage"
150
+ ;;
151
+ *)
152
+ eagle_err "Unknown action: $action"
153
+ eagle_dim " Run 'eagle-mem overview --help' for options"
154
+ exit 1
155
+ ;;
156
+ esac
@@ -0,0 +1,285 @@
1
+ #!/usr/bin/env bash
2
+ # ═══════════════════════════════════════════════════════════
3
+ # Eagle Mem — Search
4
+ # CLI wrapper for memory search (replaces raw SQL in skills)
5
+ # ═══════════════════════════════════════════════════════════
6
+ set -euo pipefail
7
+
8
+ SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd)"
9
+ LIB_DIR="$SCRIPTS_DIR/../lib"
10
+
11
+ . "$SCRIPTS_DIR/style.sh"
12
+ . "$LIB_DIR/common.sh"
13
+ . "$LIB_DIR/db.sh"
14
+
15
+ eagle_ensure_db
16
+
17
+ # ─── Parse arguments ──────────────────────────────────────
18
+
19
+ mode="keyword"
20
+ project=""
21
+ limit=10
22
+ session_id=""
23
+ json_output=false
24
+ query=""
25
+ cross_project=false
26
+
27
+ while [ $# -gt 0 ]; do
28
+ case "$1" in
29
+ --timeline|-t) mode="timeline"; shift ;;
30
+ --session|-s) mode="session"; session_id="$2"; shift 2 ;;
31
+ --files|-f) mode="files"; shift ;;
32
+ --stats) mode="stats"; shift ;;
33
+ --project|-p) project="$2"; shift 2 ;;
34
+ --limit|-n) limit="$2"; shift 2 ;;
35
+ --all|-a) cross_project=true; shift ;;
36
+ --json|-j) json_output=true; shift ;;
37
+ --help|-h)
38
+ echo -e " ${BOLD}eagle-mem search${RESET} — Search persistent memory"
39
+ echo ""
40
+ echo -e " ${BOLD}Usage:${RESET}"
41
+ echo -e " eagle-mem search ${CYAN}<query>${RESET} ${DIM}# keyword search${RESET}"
42
+ echo -e " eagle-mem search ${CYAN}--timeline${RESET} ${DIM}# recent sessions${RESET}"
43
+ echo -e " eagle-mem search ${CYAN}--session <id>${RESET} ${DIM}# session details${RESET}"
44
+ echo -e " eagle-mem search ${CYAN}--files${RESET} ${DIM}# frequently modified files${RESET}"
45
+ echo -e " eagle-mem search ${CYAN}--stats${RESET} ${DIM}# project statistics${RESET}"
46
+ echo ""
47
+ echo -e " ${BOLD}Options:${RESET}"
48
+ echo -e " ${CYAN}-p, --project${RESET} <name> Project name (default: current dir)"
49
+ echo -e " ${CYAN}-n, --limit${RESET} <N> Max results (default: 10)"
50
+ echo -e " ${CYAN}-a, --all${RESET} Search across all projects"
51
+ echo -e " ${CYAN}-j, --json${RESET} Output as JSON"
52
+ echo ""
53
+ exit 0
54
+ ;;
55
+ -*)
56
+ eagle_err "Unknown option: $1"
57
+ exit 1
58
+ ;;
59
+ *)
60
+ query="$1"; shift ;;
61
+ esac
62
+ done
63
+
64
+ [ -z "$project" ] && project=$(eagle_project_from_cwd "$(pwd)")
65
+
66
+ # ─── Keyword search ──────────────────────────────────────
67
+
68
+ search_keyword() {
69
+ local q; q=$(eagle_sql_escape "$query")
70
+ local p; p=$(eagle_sql_escape "$project")
71
+
72
+ local where_project=""
73
+ if [ "$cross_project" = false ]; then
74
+ where_project="AND s.project = '$p'"
75
+ fi
76
+
77
+ if [ "$json_output" = true ]; then
78
+ eagle_db_json "SELECT s.id, s.project, s.request, s.completed, s.learned, s.created_at
79
+ FROM summaries s
80
+ JOIN summaries_fts f ON f.rowid = s.id
81
+ WHERE summaries_fts MATCH '$q'
82
+ $where_project
83
+ ORDER BY rank
84
+ LIMIT $limit;"
85
+ return
86
+ fi
87
+
88
+ local results
89
+ results=$(eagle_db "SELECT s.id, s.project, s.request, s.completed, s.learned, s.created_at
90
+ FROM summaries s
91
+ JOIN summaries_fts f ON f.rowid = s.id
92
+ WHERE summaries_fts MATCH '$q'
93
+ $where_project
94
+ ORDER BY rank
95
+ LIMIT $limit;")
96
+
97
+ if [ -z "$results" ]; then
98
+ eagle_dim "No results for '$query'"
99
+ return
100
+ fi
101
+
102
+ echo ""
103
+ while IFS='|' read -r sid sproj req completed learned created_at; do
104
+ [ -z "$sid" ] && continue
105
+ echo -e " ${BOLD}#$sid${RESET} ${DIM}$created_at${RESET}"
106
+ if [ "$cross_project" = true ]; then
107
+ echo -e " ${DIM}project:${RESET} $sproj"
108
+ fi
109
+ [ -n "$req" ] && echo -e " ${CYAN}Request:${RESET} $req"
110
+ [ -n "$completed" ] && echo -e " ${GREEN}Done:${RESET} $completed"
111
+ [ -n "$learned" ] && echo -e " ${YELLOW}Learned:${RESET} $learned"
112
+ echo ""
113
+ done <<< "$results"
114
+ }
115
+
116
+ # ─── Timeline ────────────────────────────────────────────
117
+
118
+ search_timeline() {
119
+ local p; p=$(eagle_sql_escape "$project")
120
+
121
+ if [ "$json_output" = true ]; then
122
+ eagle_db_json "SELECT s.id, s.request, s.completed, s.learned, s.next_steps, s.created_at
123
+ FROM summaries s
124
+ WHERE s.project = '$p'
125
+ ORDER BY s.created_at DESC
126
+ LIMIT $limit;"
127
+ return
128
+ fi
129
+
130
+ local results
131
+ results=$(eagle_db "SELECT s.id, s.request, s.completed, s.learned, s.next_steps, s.created_at
132
+ FROM summaries s
133
+ WHERE s.project = '$p'
134
+ ORDER BY s.created_at DESC
135
+ LIMIT $limit;")
136
+
137
+ if [ -z "$results" ]; then
138
+ eagle_dim "No sessions found for project '$project'"
139
+ return
140
+ fi
141
+
142
+ echo ""
143
+ echo -e " ${BOLD}Recent sessions${RESET} ${DIM}($project)${RESET}"
144
+ echo -e " ${DIM}─────────────────────────────────────${RESET}"
145
+ echo ""
146
+
147
+ while IFS='|' read -r sid req completed learned next_steps created_at; do
148
+ [ -z "$sid" ] && continue
149
+ echo -e " ${BOLD}#$sid${RESET} ${DIM}$created_at${RESET}"
150
+ [ -n "$req" ] && echo -e " ${CYAN}Request:${RESET} $req"
151
+ [ -n "$completed" ] && echo -e " ${GREEN}Done:${RESET} $completed"
152
+ [ -n "$learned" ] && echo -e " ${YELLOW}Learned:${RESET} $learned"
153
+ [ -n "$next_steps" ] && echo -e " ${DIM}Next:${RESET} $next_steps"
154
+ echo ""
155
+ done <<< "$results"
156
+ }
157
+
158
+ # ─── Session details ──────────────────────────────────────
159
+
160
+ search_session() {
161
+ if [ "$json_output" = true ]; then
162
+ eagle_db_json "SELECT o.tool_name, o.tool_input_summary, o.files_read, o.files_modified, o.created_at
163
+ FROM observations o
164
+ WHERE o.session_id = '$session_id'
165
+ ORDER BY o.created_at ASC;"
166
+ return
167
+ fi
168
+
169
+ local results
170
+ results=$(eagle_db "SELECT o.tool_name, o.tool_input_summary, o.files_read, o.files_modified, o.created_at
171
+ FROM observations o
172
+ WHERE o.session_id = '$session_id'
173
+ ORDER BY o.created_at ASC;")
174
+
175
+ if [ -z "$results" ]; then
176
+ eagle_dim "No observations found for session '$session_id'"
177
+ return
178
+ fi
179
+
180
+ echo ""
181
+ echo -e " ${BOLD}Session${RESET} ${DIM}$session_id${RESET}"
182
+ echo -e " ${DIM}─────────────────────────────────────${RESET}"
183
+ echo ""
184
+
185
+ while IFS='|' read -r tool_name summary files_r files_m created_at; do
186
+ [ -z "$tool_name" ] && continue
187
+ local icon="$DOT"
188
+ case "$tool_name" in
189
+ Read) icon="${CYAN}R${RESET}" ;;
190
+ Write) icon="${GREEN}W${RESET}" ;;
191
+ Edit) icon="${YELLOW}E${RESET}" ;;
192
+ Bash) icon="${BLUE}\$${RESET}" ;;
193
+ esac
194
+ echo -e " ${icon} ${DIM}$created_at${RESET} $summary"
195
+ done <<< "$results"
196
+ echo ""
197
+ }
198
+
199
+ # ─── Frequently modified files ────────────────────────────
200
+
201
+ search_files() {
202
+ local p; p=$(eagle_sql_escape "$project")
203
+
204
+ if [ "$json_output" = true ]; then
205
+ eagle_db_json "SELECT json_each.value as file, COUNT(*) as times
206
+ FROM observations, json_each(observations.files_modified)
207
+ WHERE observations.project = '$p'
208
+ GROUP BY json_each.value
209
+ ORDER BY times DESC
210
+ LIMIT $limit;"
211
+ return
212
+ fi
213
+
214
+ local results
215
+ results=$(eagle_db "SELECT json_each.value as file, COUNT(*) as times
216
+ FROM observations, json_each(observations.files_modified)
217
+ WHERE observations.project = '$p'
218
+ GROUP BY json_each.value
219
+ ORDER BY times DESC
220
+ LIMIT $limit;")
221
+
222
+ if [ -z "$results" ]; then
223
+ eagle_dim "No file history for project '$project'"
224
+ return
225
+ fi
226
+
227
+ echo ""
228
+ echo -e " ${BOLD}Frequently modified files${RESET} ${DIM}($project)${RESET}"
229
+ echo -e " ${DIM}─────────────────────────────────────${RESET}"
230
+ echo ""
231
+
232
+ while IFS='|' read -r filepath count; do
233
+ [ -z "$filepath" ] && continue
234
+ printf " ${GREEN}%3s×${RESET} %s\n" "$count" "$filepath"
235
+ done <<< "$results"
236
+ echo ""
237
+ }
238
+
239
+ # ─── Stats ────────────────────────────────────────────────
240
+
241
+ search_stats() {
242
+ local p; p=$(eagle_sql_escape "$project")
243
+
244
+ local sessions summaries observations tasks
245
+ sessions=$(eagle_db "SELECT COUNT(*) FROM sessions WHERE project = '$p';")
246
+ summaries=$(eagle_db "SELECT COUNT(*) FROM summaries WHERE project = '$p';")
247
+ observations=$(eagle_db "SELECT COUNT(*) FROM observations o JOIN sessions s ON s.id = o.session_id WHERE s.project = '$p';")
248
+ tasks=$(eagle_db "SELECT COUNT(*) FROM tasks WHERE project = '$p';")
249
+ local chunks
250
+ chunks=$(eagle_db "SELECT COUNT(*) FROM code_chunks WHERE project = '$p';")
251
+
252
+ if [ "$json_output" = true ]; then
253
+ printf '{"project":"%s","sessions":%s,"summaries":%s,"observations":%s,"tasks":%s,"code_chunks":%s}\n' \
254
+ "$project" "${sessions:-0}" "${summaries:-0}" "${observations:-0}" "${tasks:-0}" "${chunks:-0}"
255
+ return
256
+ fi
257
+
258
+ echo ""
259
+ echo -e " ${BOLD}Stats${RESET} ${DIM}($project)${RESET}"
260
+ echo -e " ${DIM}─────────────────────────────────────${RESET}"
261
+ echo ""
262
+ eagle_kv "Sessions:" "${sessions:-0}"
263
+ eagle_kv "Summaries:" "${summaries:-0}"
264
+ eagle_kv "Observations:" "${observations:-0}"
265
+ eagle_kv "Tasks:" "${tasks:-0}"
266
+ eagle_kv "Code chunks:" "${chunks:-0}"
267
+ echo ""
268
+ }
269
+
270
+ # ─── Dispatch ─────────────────────────────────────────────
271
+
272
+ case "$mode" in
273
+ keyword)
274
+ if [ -z "$query" ]; then
275
+ eagle_err "Usage: eagle-mem search <query>"
276
+ eagle_dim " Run 'eagle-mem search --help' for options"
277
+ exit 1
278
+ fi
279
+ search_keyword
280
+ ;;
281
+ timeline) search_timeline ;;
282
+ session) search_session ;;
283
+ files) search_files ;;
284
+ stats) search_stats ;;
285
+ esac
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env bash
2
+ # ═══════════════════════════════════════════════════════════
3
+ # Eagle Mem — Tasks
4
+ # CLI wrapper for task management (replaces raw SQL in skills)
5
+ # ═══════════════════════════════════════════════════════════
6
+ set -euo pipefail
7
+
8
+ SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd)"
9
+ LIB_DIR="$SCRIPTS_DIR/../lib"
10
+
11
+ . "$SCRIPTS_DIR/style.sh"
12
+ . "$LIB_DIR/common.sh"
13
+ . "$LIB_DIR/db.sh"
14
+
15
+ eagle_ensure_db
16
+
17
+ # ─── Parse arguments ──────────────────────────────────────
18
+
19
+ action="${1:-list}"
20
+ shift 2>/dev/null || true
21
+
22
+ project=""
23
+ json_output=false
24
+
25
+ # Extract global options from remaining args
26
+ args=()
27
+ while [ $# -gt 0 ]; do
28
+ case "$1" in
29
+ --project|-p) project="$2"; shift 2 ;;
30
+ --json|-j) json_output=true; shift ;;
31
+ --help|-h)
32
+ echo -e " ${BOLD}eagle-mem tasks${RESET} — Manage tracked tasks"
33
+ echo ""
34
+ echo -e " ${BOLD}Usage:${RESET}"
35
+ echo -e " eagle-mem tasks ${DIM}# list pending tasks${RESET}"
36
+ echo -e " eagle-mem tasks ${CYAN}list${RESET} ${DIM}# list all tasks${RESET}"
37
+ echo -e " eagle-mem tasks ${CYAN}add${RESET} <title> [instructions] ${DIM}# add a task${RESET}"
38
+ echo -e " eagle-mem tasks ${CYAN}done${RESET} <id> ${DIM}# mark task complete${RESET}"
39
+ echo -e " eagle-mem tasks ${CYAN}block${RESET} <id> ${DIM}# mark task blocked${RESET}"
40
+ echo -e " eagle-mem tasks ${CYAN}context${RESET} <id> <snapshot> ${DIM}# set task context${RESET}"
41
+ echo -e " eagle-mem tasks ${CYAN}clear${RESET} ${DIM}# remove all done tasks${RESET}"
42
+ echo ""
43
+ echo -e " ${BOLD}Options:${RESET}"
44
+ echo -e " ${CYAN}-p, --project${RESET} <name> Project name (default: current dir)"
45
+ echo -e " ${CYAN}-j, --json${RESET} Output as JSON"
46
+ echo ""
47
+ exit 0
48
+ ;;
49
+ *) args+=("$1"); shift ;;
50
+ esac
51
+ done
52
+
53
+ [ -z "$project" ] && project=$(eagle_project_from_cwd "$(pwd)")
54
+ project_sql=$(eagle_sql_escape "$project")
55
+
56
+ # ─── List tasks ───────────────────────────────────────────
57
+
58
+ tasks_list() {
59
+ local filter="${1:-all}"
60
+
61
+ local where_status=""
62
+ case "$filter" in
63
+ pending) where_status="AND status IN ('pending', 'active')" ;;
64
+ done) where_status="AND status = 'done'" ;;
65
+ all) where_status="" ;;
66
+ esac
67
+
68
+ if [ "$json_output" = true ]; then
69
+ eagle_db_json "SELECT id, title, instructions, status, ordinal, context_snapshot, completed_at, created_at
70
+ FROM tasks
71
+ WHERE project = '$project_sql' $where_status
72
+ ORDER BY ordinal ASC, id ASC;"
73
+ return
74
+ fi
75
+
76
+ local results
77
+ results=$(eagle_db "SELECT id, title, status, ordinal, instructions
78
+ FROM tasks
79
+ WHERE project = '$project_sql' $where_status
80
+ ORDER BY ordinal ASC, id ASC;")
81
+
82
+ if [ -z "$results" ]; then
83
+ eagle_dim "No tasks for project '$project'"
84
+ return
85
+ fi
86
+
87
+ echo ""
88
+ echo -e " ${BOLD}Tasks${RESET} ${DIM}($project)${RESET}"
89
+ echo -e " ${DIM}─────────────────────────────────────${RESET}"
90
+ echo ""
91
+
92
+ while IFS='|' read -r tid title status ordinal instructions; do
93
+ [ -z "$tid" ] && continue
94
+ local icon marker
95
+ case "$status" in
96
+ active) icon="${CYAN}▶${RESET}"; marker=" ${CYAN}[ACTIVE]${RESET}" ;;
97
+ pending) icon="${DIM}○${RESET}"; marker="" ;;
98
+ done) icon="${GREEN}✓${RESET}"; marker=" ${DIM}[DONE]${RESET}" ;;
99
+ blocked) icon="${RED}✗${RESET}"; marker=" ${RED}[BLOCKED]${RESET}" ;;
100
+ *) icon="$DOT"; marker="" ;;
101
+ esac
102
+ echo -e " ${icon} ${BOLD}#$tid${RESET} $title$marker"
103
+ [ -n "$instructions" ] && echo -e " ${DIM}$instructions${RESET}"
104
+ done <<< "$results"
105
+ echo ""
106
+ }
107
+
108
+ # ─── Add task ─────────────────────────────────────────────
109
+
110
+ tasks_add() {
111
+ local title="${args[0]:-}"
112
+ local instructions="${args[1]:-}"
113
+
114
+ if [ -z "$title" ]; then
115
+ eagle_err "Usage: eagle-mem tasks add <title> [instructions]"
116
+ exit 1
117
+ fi
118
+
119
+ local title_sql; title_sql=$(eagle_sql_escape "$title")
120
+ local instr_sql; instr_sql=$(eagle_sql_escape "$instructions")
121
+
122
+ local max_ord
123
+ max_ord=$(eagle_db "SELECT COALESCE(MAX(ordinal), 0) FROM tasks WHERE project = '$project_sql';")
124
+ local next_ord=$((max_ord + 1))
125
+
126
+ eagle_db "INSERT INTO tasks (project, title, instructions, ordinal)
127
+ VALUES ('$project_sql', '$title_sql', '$instr_sql', $next_ord);"
128
+
129
+ local new_id
130
+ new_id=$(eagle_db "SELECT last_insert_rowid();")
131
+
132
+ if [ "$json_output" = true ]; then
133
+ printf '{"id":%s,"title":"%s","ordinal":%s}\n' "$new_id" "$title" "$next_ord"
134
+ return
135
+ fi
136
+
137
+ eagle_ok "Task #$new_id added: $title"
138
+ }
139
+
140
+ # ─── Done ─────────────────────────────────────────────────
141
+
142
+ tasks_done() {
143
+ local task_id="${args[0]:-}"
144
+
145
+ if [ -z "$task_id" ]; then
146
+ eagle_err "Usage: eagle-mem tasks done <id>"
147
+ exit 1
148
+ fi
149
+
150
+ eagle_db "UPDATE tasks SET status = 'done', completed_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
151
+ WHERE id = $task_id AND project = '$project_sql';"
152
+
153
+ local title
154
+ title=$(eagle_db "SELECT title FROM tasks WHERE id = $task_id;")
155
+
156
+ if [ "$json_output" = true ]; then
157
+ printf '{"id":%s,"status":"done"}\n' "$task_id"
158
+ return
159
+ fi
160
+
161
+ eagle_ok "Task #$task_id done: $title"
162
+ }
163
+
164
+ # ─── Block ────────────────────────────────────────────────
165
+
166
+ tasks_block() {
167
+ local task_id="${args[0]:-}"
168
+
169
+ if [ -z "$task_id" ]; then
170
+ eagle_err "Usage: eagle-mem tasks block <id>"
171
+ exit 1
172
+ fi
173
+
174
+ eagle_db "UPDATE tasks SET status = 'blocked' WHERE id = $task_id AND project = '$project_sql';"
175
+
176
+ if [ "$json_output" = true ]; then
177
+ printf '{"id":%s,"status":"blocked"}\n' "$task_id"
178
+ return
179
+ fi
180
+
181
+ eagle_ok "Task #$task_id blocked"
182
+ }
183
+
184
+ # ─── Context snapshot ─────────────────────────────────────
185
+
186
+ tasks_context() {
187
+ local task_id="${args[0]:-}"
188
+ local snapshot="${args[1]:-}"
189
+
190
+ if [ -z "$task_id" ] || [ -z "$snapshot" ]; then
191
+ eagle_err "Usage: eagle-mem tasks context <id> <snapshot>"
192
+ exit 1
193
+ fi
194
+
195
+ local snap_sql; snap_sql=$(eagle_sql_escape "$snapshot")
196
+ eagle_db "UPDATE tasks SET context_snapshot = '$snap_sql' WHERE id = $task_id AND project = '$project_sql';"
197
+
198
+ if [ "$json_output" = true ]; then
199
+ printf '{"id":%s,"context_snapshot":true}\n' "$task_id"
200
+ return
201
+ fi
202
+
203
+ eagle_ok "Context saved for task #$task_id"
204
+ }
205
+
206
+ # ─── Clear done tasks ────────────────────────────────────
207
+
208
+ tasks_clear() {
209
+ local count
210
+ count=$(eagle_db "SELECT COUNT(*) FROM tasks WHERE project = '$project_sql' AND status = 'done';")
211
+
212
+ eagle_db "DELETE FROM tasks WHERE project = '$project_sql' AND status = 'done';"
213
+
214
+ if [ "$json_output" = true ]; then
215
+ printf '{"cleared":%s}\n' "${count:-0}"
216
+ return
217
+ fi
218
+
219
+ eagle_ok "Cleared ${count:-0} completed tasks"
220
+ }
221
+
222
+ # ─── Dispatch ─────────────────────────────────────────────
223
+
224
+ case "$action" in
225
+ list) tasks_list "all" ;;
226
+ pending) tasks_list "pending" ;;
227
+ add) tasks_add ;;
228
+ done) tasks_done ;;
229
+ block) tasks_block ;;
230
+ context) tasks_context ;;
231
+ clear) tasks_clear ;;
232
+ --help|-h)
233
+ echo -e " Run ${CYAN}eagle-mem tasks --help${RESET} for usage"
234
+ ;;
235
+ *)
236
+ eagle_err "Unknown action: $action"
237
+ eagle_dim " Run 'eagle-mem tasks --help' for options"
238
+ exit 1
239
+ ;;
240
+ esac
@@ -3,98 +3,78 @@ name: eagle-mem-overview
3
3
  description: >
4
4
  Generate or update a project overview for Eagle Mem. Use when: 'eagle overview',
5
5
  'project overview', 'summarize this project', 'eagle mem overview', 'what is this project',
6
- 'update overview'. Creates a persistent one-paragraph project summary injected at session start.
6
+ 'update overview'. Uses the eagle-mem CLI never run raw sqlite3 queries.
7
7
  ---
8
8
 
9
9
  # Eagle Mem — Project Overview
10
10
 
11
- Generate a concise project overview that Eagle Mem injects at the start of every session. This gives fresh context windows an instant understanding of what the project is and what's been happening.
11
+ Generate a concise project overview that Eagle Mem injects at the start of every session. This gives fresh context windows an instant understanding of what the project is.
12
12
 
13
13
  ## How it works
14
14
 
15
- 1. Query recent summaries and observations for the current project
16
- 2. Synthesize them into a concise overview (2-4 sentences)
17
- 3. Save to the `overviews` table — one row per project, updated in place
15
+ 1. Gather context about the project (recent sessions, file activity)
16
+ 2. Synthesize into a concise overview (2-4 sentences)
17
+ 3. Save via the CLI — one overview per project, updated in place
18
18
 
19
19
  The overview is automatically injected by the SessionStart hook.
20
20
 
21
- ## Generating an overview
21
+ ## Commands
22
22
 
23
- ### Step 1: Gather context
23
+ ### View current overview
24
24
 
25
25
  ```bash
26
- sqlite3 ~/.eagle-mem/memory.db "
27
- SELECT request, completed, learned, next_steps, created_at
28
- FROM summaries
29
- WHERE project = '<project>'
30
- ORDER BY created_at DESC
31
- LIMIT 10;
32
- "
26
+ eagle-mem overview
33
27
  ```
34
28
 
35
- Also check frequently modified files:
29
+ ### Auto-generate from code analysis
36
30
 
37
31
  ```bash
38
- sqlite3 ~/.eagle-mem/memory.db "
39
- PRAGMA trusted_schema=ON;
40
- SELECT json_each.value as file, COUNT(*) as times
41
- FROM observations, json_each(observations.files_modified)
42
- WHERE observations.project = '<project>'
43
- GROUP BY json_each.value
44
- ORDER BY times DESC
45
- LIMIT 10;
46
- "
32
+ eagle-mem scan .
47
33
  ```
48
34
 
49
- ### Step 2: Write the overview
35
+ This scans the project structure (files, languages, frameworks, entry points, tests) and saves an overview automatically.
50
36
 
51
- Synthesize the data into a concise overview covering:
52
- - **What** the project is (one sentence)
53
- - **Current state** — what's been worked on recently
54
- - **Key patterns** — tech stack, architecture decisions, active conventions
37
+ ### Set overview manually
55
38
 
56
- Keep it under 500 characters. This gets injected into every session start, so brevity matters.
57
-
58
- ### Step 3: Save to database
39
+ When you want to write a custom overview based on session history:
59
40
 
41
+ 1. First, gather recent context:
60
42
  ```bash
61
- sqlite3 ~/.eagle-mem/memory.db "
62
- PRAGMA trusted_schema=ON;
63
- INSERT INTO overviews (project, content, updated_at)
64
- VALUES ('<project>', '<overview text>', strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
65
- ON CONFLICT(project) DO UPDATE SET
66
- content = excluded.content,
67
- updated_at = excluded.updated_at;
68
- "
43
+ eagle-mem search --timeline --limit 10
44
+ eagle-mem search --files
69
45
  ```
70
46
 
71
- ## Viewing the current overview
47
+ 2. Synthesize the data into a concise overview covering:
48
+ - **What** the project is (one sentence)
49
+ - **Current state** — what's been worked on recently
50
+ - **Key patterns** — tech stack, architecture decisions
72
51
 
52
+ 3. Save it:
73
53
  ```bash
74
- sqlite3 ~/.eagle-mem/memory.db "
75
- SELECT project, content, updated_at FROM overviews
76
- WHERE project = '<project>';
77
- "
54
+ eagle-mem overview set "eagle-mem: Node.js CLI tool providing persistent memory for Claude Code via SQLite + FTS5. Currently at v1.0.3 with 5 hooks, 3 skills, and CLI subcommands for search/tasks/overview."
78
55
  ```
79
56
 
80
- ## Listing all project overviews
57
+ Keep it under 500 characters — this gets injected into every session start.
58
+
59
+ ### List all project overviews
81
60
 
82
61
  ```bash
83
- sqlite3 ~/.eagle-mem/memory.db "
84
- SELECT project, substr(content, 1, 80) || '...', updated_at
85
- FROM overviews
86
- ORDER BY updated_at DESC;
87
- "
62
+ eagle-mem overview list
88
63
  ```
89
64
 
90
- ## Deleting an overview
65
+ ### Delete an overview
91
66
 
92
67
  ```bash
93
- sqlite3 ~/.eagle-mem/memory.db "
94
- DELETE FROM overviews WHERE project = '<project>';
95
- "
68
+ eagle-mem overview delete
96
69
  ```
97
70
 
71
+ ## Options
72
+
73
+ | Flag | Description |
74
+ |------|-------------|
75
+ | `-p, --project <name>` | Target a specific project (default: current directory) |
76
+ | `-j, --json` | Output as JSON |
77
+
98
78
  ## Guidelines
99
79
 
100
80
  - Update the overview when the project direction changes significantly
@@ -3,124 +3,76 @@ name: eagle-mem-search
3
3
  description: >
4
4
  Search Eagle Mem's persistent memory database. Use when: 'eagle search', 'search memory',
5
5
  'what did I do', 'eagle mem search', 'find in memory', 'past sessions', 'what happened with',
6
- 'search my history'. Three-layer search: compact index (fast) timeline (chronological) →
7
- full details (complete observations).
6
+ 'search my history'. Uses the eagle-mem CLI never run raw sqlite3 queries.
8
7
  ---
9
8
 
10
9
  # Eagle Mem — Memory Search
11
10
 
12
- Search the Eagle Mem database for past session summaries, observations, and task history.
11
+ Search the Eagle Mem database for past session summaries, observations, and task history using the `eagle-mem` CLI.
13
12
 
14
- ## Three-layer search pattern
13
+ ## Search commands
15
14
 
16
- ### Layer 1: Compact search (default)
15
+ ### Keyword search (default)
17
16
 
18
- Fast keyword search across session summaries. Returns ~50-100 tokens per result.
17
+ Search past sessions by keyword. Returns matching summaries ranked by relevance.
19
18
 
20
19
  ```bash
21
- sqlite3 ~/.eagle-mem/memory.db "
22
- PRAGMA trusted_schema=ON;
23
- SELECT s.id, s.request, s.completed, s.created_at, s.project
24
- FROM summaries s
25
- JOIN summaries_fts f ON f.rowid = s.id
26
- WHERE summaries_fts MATCH '<query>'
27
- ORDER BY rank
28
- LIMIT 10;
29
- "
20
+ eagle-mem search "auth middleware"
30
21
  ```
31
22
 
32
- Use this first. If the user needs more detail, go to Layer 2 or 3.
23
+ Cross-project search:
24
+ ```bash
25
+ eagle-mem search "deploy issue" --all
26
+ ```
33
27
 
34
- ### Layer 2: Timeline (chronological context)
28
+ ### Timeline (chronological)
35
29
 
36
- Show recent sessions for a project in time order. Good for "what have I been working on?"
30
+ Show recent sessions for the current project in time order.
37
31
 
38
32
  ```bash
39
- sqlite3 ~/.eagle-mem/memory.db "
40
- SELECT s.request, s.completed, s.learned, s.next_steps, s.created_at
41
- FROM summaries s
42
- WHERE s.project = '<project>'
43
- ORDER BY s.created_at DESC
44
- LIMIT <N>;
45
- "
33
+ eagle-mem search --timeline
34
+ eagle-mem search --timeline --limit 20
46
35
  ```
47
36
 
48
- ### Layer 3: Full details (observations)
37
+ ### Session details
49
38
 
50
- When the user needs to know exactly what files were touched or what tools were used:
39
+ View all tool observations (files read/written, commands run) for a specific session.
51
40
 
52
41
  ```bash
53
- sqlite3 ~/.eagle-mem/memory.db "
54
- PRAGMA trusted_schema=ON;
55
- SELECT o.tool_name, o.tool_input_summary, o.files_read, o.files_modified, o.created_at
56
- FROM observations o
57
- WHERE o.session_id = '<session_id>'
58
- ORDER BY o.created_at ASC;
59
- "
42
+ eagle-mem search --session <session_id>
60
43
  ```
61
44
 
62
- ## Additional queries
45
+ ### Frequently modified files
63
46
 
64
- ### Cross-project search
47
+ Show which files are touched most often in this project.
65
48
 
66
49
  ```bash
67
- sqlite3 ~/.eagle-mem/memory.db "
68
- PRAGMA trusted_schema=ON;
69
- SELECT s.project, s.request, s.completed, s.created_at
70
- FROM summaries s
71
- JOIN summaries_fts f ON f.rowid = s.id
72
- WHERE summaries_fts MATCH '<query>'
73
- ORDER BY rank
74
- LIMIT 10;
75
- "
50
+ eagle-mem search --files
76
51
  ```
77
52
 
78
- ### Files frequently modified
53
+ ### Project stats
54
+
55
+ Get counts of sessions, summaries, observations, tasks, and code chunks.
79
56
 
80
57
  ```bash
81
- sqlite3 ~/.eagle-mem/memory.db "
82
- PRAGMA trusted_schema=ON;
83
- SELECT json_each.value as file, COUNT(*) as times
84
- FROM observations, json_each(observations.files_modified)
85
- WHERE observations.project = '<project>'
86
- GROUP BY json_each.value
87
- ORDER BY times DESC
88
- LIMIT 20;
89
- "
58
+ eagle-mem search --stats
90
59
  ```
91
60
 
92
- ### Task history
61
+ ## Options
93
62
 
94
- ```bash
95
- sqlite3 ~/.eagle-mem/memory.db "
96
- SELECT id, title, status, completed_at
97
- FROM tasks
98
- WHERE project = '<project>'
99
- ORDER BY ordinal ASC, id ASC;
100
- "
101
- ```
63
+ | Flag | Description |
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) |
102
69
 
103
- ### Session count and stats
70
+ ## Three-layer pattern
104
71
 
105
- ```bash
106
- sqlite3 ~/.eagle-mem/memory.db "
107
- SELECT
108
- COUNT(DISTINCT s.id) as sessions,
109
- COUNT(DISTINCT su.id) as summaries,
110
- COUNT(DISTINCT o.id) as observations,
111
- COUNT(DISTINCT t.id) as tasks
112
- FROM sessions s
113
- LEFT JOIN summaries su ON su.project = s.project
114
- LEFT JOIN observations o ON o.session_id = s.id
115
- LEFT JOIN tasks t ON t.project = s.project
116
- WHERE s.project = '<project>';
117
- "
118
- ```
72
+ Start with **keyword search** — it's fast and usually sufficient. If the user needs chronological context, use **--timeline**. If they need exact file-level detail, use **--session** with a specific session ID from a previous search result.
119
73
 
120
74
  ## Usage tips
121
75
 
122
- - Start with Layer 1 (compact search) it's fast and usually sufficient
123
- - Use FTS5 query syntax: `word1 AND word2`, `"exact phrase"`, `word1 OR word2`, `word1 NOT word2`
124
- - The `project` column maps to the directory name (basename of cwd)
125
- - Cross-project search omits the WHERE project clause
126
- - Observations are high-volume — query by session_id, not full table scans
76
+ - Keyword search supports FTS5 syntax: `word1 AND word2`, `"exact phrase"`, `word1 OR word2`
77
+ - The `--json` flag is useful when you need to parse results programmatically
78
+ - Project name defaults to the basename of the current working directory
@@ -3,8 +3,7 @@ name: eagle-mem-tasks
3
3
  description: >
4
4
  TaskAware Compact Loop — break complex work into database-tracked subtasks with compaction
5
5
  between each. Use when: 'eagle tasks', 'break this into tasks', 'create task plan',
6
- 'task loop', 'compact loop', 'eagle mem tasks'. Prevents context bloat and hallucination
7
- by executing one task at a time with memory re-injection after each /compact.
6
+ 'task loop', 'compact loop', 'eagle mem tasks'. Uses the eagle-mem CLI — never run raw sqlite3 queries.
8
7
  ---
9
8
 
10
9
  # Eagle Mem — TaskAware Compact Loop
@@ -14,7 +13,7 @@ Break complex work into subtasks stored in Eagle Mem's database. Execute one tas
14
13
  ## How it works
15
14
 
16
15
  1. **Plan**: Break the user's request into ordered subtasks
17
- 2. **Store**: Write each subtask to the Eagle Mem database
16
+ 2. **Store**: Add each subtask via the CLI
18
17
  3. **Execute**: Work on the current task (marked `[ACTIVE]`)
19
18
  4. **Compact**: When done, tell the user to run `/compact`
20
19
  5. **Resume**: After compact, SessionStart re-injects memory + loads the next task
@@ -22,78 +21,72 @@ Break complex work into subtasks stored in Eagle Mem's database. Execute one tas
22
21
 
23
22
  ## Commands
24
23
 
25
- ### Creating tasks
26
-
27
- When the user invokes `/eagle-mem-tasks` or asks to break work into tasks:
28
-
29
- 1. Analyze the request and break it into 3-8 focused subtasks
30
- 2. Each task should be completable in one context window (~50-100K tokens of work)
31
- 3. Write tasks to the database using this pattern:
24
+ ### List tasks
32
25
 
33
26
  ```bash
34
- ~/.eagle-mem/db/task-ops.sh add "<project>" "<title>" "<instructions>" <ordinal>
27
+ eagle-mem tasks
28
+ eagle-mem tasks list
35
29
  ```
36
30
 
37
- If `task-ops.sh` doesn't exist yet, write directly:
31
+ ### Add tasks
32
+
33
+ When the user invokes `/eagle-mem-tasks` or asks to break work into tasks:
34
+
35
+ 1. Analyze the request and break it into 3-8 focused subtasks
36
+ 2. Each task should be completable in one context window
37
+ 3. Add tasks using the CLI:
38
38
 
39
39
  ```bash
40
- sqlite3 ~/.eagle-mem/memory.db "
41
- PRAGMA trusted_schema=ON;
42
- INSERT INTO tasks (project, title, instructions, ordinal)
43
- VALUES ('<project>', '<title>', '<instructions>', <ordinal>);
44
- "
40
+ eagle-mem tasks add "Set up project structure" "Install deps, create folders, init config"
41
+ eagle-mem tasks add "Implement auth middleware" "JWT validation, role checks, error responses"
42
+ eagle-mem tasks add "Build CRUD endpoints" "Users and posts REST API with validation"
45
43
  ```
46
44
 
47
45
  4. Show the task plan to the user for confirmation
48
46
  5. After confirmation, start working on task #1
49
47
 
50
- ### Viewing tasks
48
+ ### Complete a task
51
49
 
52
50
  ```bash
53
- sqlite3 ~/.eagle-mem/memory.db "
54
- SELECT id, title, status, ordinal FROM tasks
55
- WHERE project = '<project>'
56
- ORDER BY ordinal ASC, id ASC;
57
- "
51
+ eagle-mem tasks done <id>
58
52
  ```
59
53
 
60
- ### Completing a task
54
+ After marking done:
55
+ 1. Emit your `<eagle-summary>` block
56
+ 2. Tell the user: **"Task #N complete. Run `/compact` to save progress and load the next task."**
61
57
 
62
- When the current task is done:
58
+ ### Block a task
63
59
 
64
- 1. Mark it complete:
65
60
  ```bash
66
- sqlite3 ~/.eagle-mem/memory.db "
67
- PRAGMA trusted_schema=ON;
68
- UPDATE tasks SET status = 'done', completed_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
69
- WHERE id = <task_id>;
70
- "
61
+ eagle-mem tasks block <id>
71
62
  ```
72
63
 
73
- 2. Emit your `<eagle-summary>` block
74
- 3. Tell the user: **"Task #N complete. Run `/compact` to save progress and load the next task."**
64
+ ### Set context snapshot
75
65
 
76
- ### Skipping/blocking a task
66
+ For tasks that depend on decisions from earlier tasks:
77
67
 
78
68
  ```bash
79
- sqlite3 ~/.eagle-mem/memory.db "
80
- UPDATE tasks SET status = 'blocked'
81
- WHERE id = <task_id>;
82
- "
69
+ eagle-mem tasks context <id> "Using JWT with RS256, sessions stored in Redis"
83
70
  ```
84
71
 
85
- ## Task design guidelines
72
+ ### Clear completed tasks
86
73
 
87
- - Each task should be **self-contained** — completable without needing context from mid-execution of a previous task
88
- - Include `instructions` with enough detail that a fresh context window can pick it up
89
- - Include a `context_snapshot` for tasks that depend on decisions from earlier tasks:
90
74
  ```bash
91
- sqlite3 ~/.eagle-mem/memory.db "
92
- PRAGMA trusted_schema=ON;
93
- UPDATE tasks SET context_snapshot = '<key decisions and state>'
94
- WHERE id = <task_id>;
95
- "
75
+ eagle-mem tasks clear
96
76
  ```
77
+
78
+ ## Options
79
+
80
+ | Flag | Description |
81
+ |------|-------------|
82
+ | `-p, --project <name>` | Target a specific project (default: current directory) |
83
+ | `-j, --json` | Output as JSON |
84
+
85
+ ## Task design guidelines
86
+
87
+ - Each task should be **self-contained** — completable without mid-execution context from a previous task
88
+ - Include instructions with enough detail that a fresh context window can pick it up
89
+ - Use context snapshots for tasks that depend on decisions from earlier tasks
97
90
  - Order tasks so that foundational work comes first (schema before API, API before UI)
98
91
 
99
92
  ## The compact cycle
@@ -105,19 +98,3 @@ User request → Plan tasks → Execute task 1 → /compact
105
98
  → ... repeat until all tasks done ...
106
99
  → Final summary: "All N tasks complete."
107
100
  ```
108
-
109
- This prevents context window bloat. Each task gets a fresh window with only relevant memory injected.
110
-
111
- ## Example
112
-
113
- User: "Build a REST API with auth, CRUD endpoints, and tests"
114
-
115
- Tasks created:
116
- 1. Set up project structure and dependencies
117
- 2. Implement auth middleware (JWT)
118
- 3. Build CRUD endpoints for users
119
- 4. Build CRUD endpoints for posts
120
- 5. Write integration tests
121
- 6. Add error handling and validation
122
-
123
- Each task executes in its own compact cycle with full memory of what came before.