dev-recall 0.2.0__tar.gz

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.
Files changed (44) hide show
  1. dev_recall-0.2.0/PKG-INFO +281 -0
  2. dev_recall-0.2.0/README.md +252 -0
  3. dev_recall-0.2.0/dev_recall.egg-info/PKG-INFO +281 -0
  4. dev_recall-0.2.0/dev_recall.egg-info/SOURCES.txt +42 -0
  5. dev_recall-0.2.0/dev_recall.egg-info/dependency_links.txt +1 -0
  6. dev_recall-0.2.0/dev_recall.egg-info/entry_points.txt +2 -0
  7. dev_recall-0.2.0/dev_recall.egg-info/requires.txt +22 -0
  8. dev_recall-0.2.0/dev_recall.egg-info/top_level.txt +1 -0
  9. dev_recall-0.2.0/pyproject.toml +51 -0
  10. dev_recall-0.2.0/recall/__init__.py +3 -0
  11. dev_recall-0.2.0/recall/_hooks.py +211 -0
  12. dev_recall-0.2.0/recall/cli.py +1032 -0
  13. dev_recall-0.2.0/recall/collectors/__init__.py +1 -0
  14. dev_recall-0.2.0/recall/collectors/ai_chat.py +644 -0
  15. dev_recall-0.2.0/recall/collectors/containers.py +164 -0
  16. dev_recall-0.2.0/recall/collectors/git.py +540 -0
  17. dev_recall-0.2.0/recall/collectors/linux_process.py +230 -0
  18. dev_recall-0.2.0/recall/collectors/linux_session.py +229 -0
  19. dev_recall-0.2.0/recall/collectors/linux_window.py +199 -0
  20. dev_recall-0.2.0/recall/collectors/shell.py +300 -0
  21. dev_recall-0.2.0/recall/collectors/vscode.py +175 -0
  22. dev_recall-0.2.0/recall/config.py +257 -0
  23. dev_recall-0.2.0/recall/daemon.py +466 -0
  24. dev_recall-0.2.0/recall/daemon_main.py +25 -0
  25. dev_recall-0.2.0/recall/mcp_server.py +290 -0
  26. dev_recall-0.2.0/recall/models.py +225 -0
  27. dev_recall-0.2.0/recall/processor/__init__.py +1 -0
  28. dev_recall-0.2.0/recall/processor/embedder.py +213 -0
  29. dev_recall-0.2.0/recall/processor/enricher.py +213 -0
  30. dev_recall-0.2.0/recall/processor/session.py +142 -0
  31. dev_recall-0.2.0/recall/query/__init__.py +1 -0
  32. dev_recall-0.2.0/recall/query/context.py +130 -0
  33. dev_recall-0.2.0/recall/query/llm.py +85 -0
  34. dev_recall-0.2.0/recall/query/retriever.py +147 -0
  35. dev_recall-0.2.0/recall/query/timeparser.py +188 -0
  36. dev_recall-0.2.0/recall/storage/__init__.py +1 -0
  37. dev_recall-0.2.0/recall/storage/db.py +528 -0
  38. dev_recall-0.2.0/recall/storage/vectors.py +166 -0
  39. dev_recall-0.2.0/setup.cfg +4 -0
  40. dev_recall-0.2.0/tests/test_collectors.py +348 -0
  41. dev_recall-0.2.0/tests/test_enricher.py +96 -0
  42. dev_recall-0.2.0/tests/test_query.py +134 -0
  43. dev_recall-0.2.0/tests/test_session.py +71 -0
  44. dev_recall-0.2.0/tests/test_storage.py +243 -0
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: dev-recall
3
+ Version: 0.2.0
4
+ Summary: Local-first developer memory layer
5
+ License: MIT
6
+ Keywords: developer-tools,memory,productivity,cli
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: click>=8.1
10
+ Requires-Dist: rich>=13.0
11
+ Requires-Dist: sentence-transformers>=3.0
12
+ Requires-Dist: faiss-cpu>=1.8
13
+ Requires-Dist: watchdog>=4.0
14
+ Requires-Dist: flask>=3.0
15
+ Requires-Dist: requests>=2.31
16
+ Requires-Dist: platformdirs>=4.0
17
+ Requires-Dist: python-dateutil>=2.9
18
+ Requires-Dist: humanize>=4.0
19
+ Requires-Dist: mcp>=1.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=7.0; extra == "dev"
22
+ Requires-Dist: pytest-cov; extra == "dev"
23
+ Requires-Dist: pytest-mock; extra == "dev"
24
+ Requires-Dist: ruff; extra == "dev"
25
+ Provides-Extra: linux
26
+ Requires-Dist: psutil>=5.9; extra == "linux"
27
+ Requires-Dist: dbus-next>=0.2; extra == "linux"
28
+ Requires-Dist: docker>=7.0; extra == "linux"
29
+
30
+ # Recall
31
+
32
+ **Local-first developer memory layer.** Captures every developer activity — terminal commands, git commits, file edits, repo opens, AI chat sessions — into a structured SQLite database with a FAISS vector index. Enables natural language recall:
33
+
34
+ ```
35
+ recall ask "what did I work on last Tuesday?"
36
+ recall ask "how did I fix the auth bug?"
37
+ recall today
38
+ recall timeline
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Quick Start
44
+
45
+ ```bash
46
+ pip install dev-recall
47
+ recall init
48
+ source .zshrc # or .bashrc
49
+ ```
50
+
51
+ `recall init` will:
52
+ 1. Create `~/.local/share/recall/` and `~/.config/recall/`
53
+ 2. Initialize the SQLite database + FAISS vector index
54
+ 3. Install the zsh/bash shell hook (appends `source` line to your rc file)
55
+ 4. Set `git config --global core.hooksPath` to capture all commits
56
+ 5. Start the background daemon (via systemd user service or subprocess)
57
+
58
+ ---
59
+
60
+ ## Commands
61
+
62
+ | Command | Description |
63
+ |---------|-------------|
64
+ | `recall init` | First-time setup |
65
+ | `recall ask "<query>"` | Natural language search with LLM answer |
66
+ | `recall today` | Summary of today's activity |
67
+ | `recall week` | Summary of this week's activity |
68
+ | `recall timeline` | Chronological event list for a day |
69
+ | `recall search "<query>"` | Raw hybrid search (no LLM) |
70
+ | `recall repos` | List all tracked repos |
71
+ | `recall stats` | Capture statistics |
72
+ | `recall export` | Export events as JSON or CSV |
73
+ | `recall config` | View/edit configuration |
74
+ | `recall privacy list` | Show what's captured |
75
+ | `recall privacy delete` | Delete captured events |
76
+ | `recall privacy ignore --cmd "pattern"` | Add a privacy filter |
77
+ | `recall daemon start/stop/status/logs` | Manage the background daemon |
78
+ | `recall mcp-serve` | Start MCP server (for Claude Code / Copilot) |
79
+
80
+ ---
81
+
82
+ ## Architecture
83
+
84
+ ```
85
+ Collectors (shell hook, git hooks, VS Code ext, AI log watcher)
86
+ ↓ events (TSV files + HTTP POST)
87
+ Daemon (FileWatcher → Enricher → SessionDetector → DB insert → Embedder)
88
+
89
+ Storage (SQLite events.db + FTS5, FAISS vectors.faiss)
90
+
91
+ Query (Hybrid FAISS+FTS5 → RRF → LLM via OpenRouter)
92
+
93
+ CLI + MCP Server
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Data Sources
99
+
100
+ ### Shell commands (zsh / bash)
101
+ Add to `~/.zshrc` (done automatically by `recall init`):
102
+ ```bash
103
+ source ~/.config/dev-recall/hook.zsh
104
+ ```
105
+
106
+ ### Git commits
107
+ `recall init` sets `core.hooksPath` globally — all future commits in any repo are captured.
108
+
109
+ ### VS Code activity
110
+ Install the extension:
111
+ ```bash
112
+ code --install-extension recall.recall-vscode
113
+ ```
114
+
115
+ ### AI chat sessions
116
+ Automatically scanned from:
117
+ - **GitHub Copilot Chat**: `~/.config/Code/User/workspaceStorage/*/GitHub.copilot-chat/debug-logs/`
118
+ - **Claude Code**: `~/.claude/projects/*/sessions/`
119
+ - **Aider**: `.aider.chat.history.md` in git repos
120
+ - **Cursor**: `~/.config/Cursor/User/workspaceStorage/`
121
+
122
+ ---
123
+
124
+ ## LLM Integration
125
+
126
+ Recall uses [OpenRouter](https://openrouter.ai) for the `ask` command and daily summaries.
127
+
128
+ ```bash
129
+ export OPENROUTER_API_KEY=sk-or-...
130
+ recall ask "what was I debugging yesterday?"
131
+ ```
132
+
133
+ Without an API key, `recall ask` falls back to `--no-llm` mode (shows retrieved events directly). All other commands work fully offline.
134
+
135
+ ---
136
+
137
+ ## MCP Server
138
+
139
+ Use Recall as a context source in Claude Code or VS Code Copilot:
140
+
141
+ **Claude Code** (`~/.config/claude/mcp.json`):
142
+ ```json
143
+ {
144
+ "mcpServers": {
145
+ "dev-recall": {
146
+ "command": "dev-recall",
147
+ "args": ["mcp-serve"]
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ **VS Code / Copilot** (`.vscode/mcp.json`):
154
+ ```json
155
+ {
156
+ "servers": {
157
+ "dev-recall": {
158
+ "type": "stdio",
159
+ "command": "dev-recall",
160
+ "args": ["mcp-serve"]
161
+ }
162
+ }
163
+ }
164
+ ```
165
+
166
+ Available MCP tools: `recall`, `today_summary`, `recent_repos`, `find_command`, `timeline`
167
+
168
+ ---
169
+
170
+ ## Privacy
171
+
172
+ - Commands matching `*password*`, `*secret*`, `*token*` etc. are **dropped before storage**
173
+ - AI chat messages are truncated to 200 characters (intent only, not full content)
174
+ - File saves store only **path + language**, never file content
175
+ - All data is **local only** — LLM calls send only small event snippets, only when you run `ask`
176
+ - Default retention: **90 days** (configurable)
177
+
178
+ ```bash
179
+ recall privacy list # see what's captured
180
+ recall privacy delete --before 2026-01-01
181
+ recall privacy ignore --cmd "*mycompany*"
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Configuration
187
+
188
+ Config file: `~/.config/dev-recall/config.json`
189
+
190
+ ```bash
191
+ recall config # show all settings
192
+ recall config daemon_port 8080 # change port
193
+ recall config retention_days 30 # shorter retention
194
+ ```
195
+
196
+ Key settings:
197
+ ```json
198
+ {
199
+ "daemon_port": 27182,
200
+ "embedding_model": "all-MiniLM-L6-v2",
201
+ "llm_model": "anthropic/claude-sonnet-4",
202
+ "retention_days": 90,
203
+ "capture": { "terminal": true, "git": true, "vscode": true, "ai_chat": true }
204
+ }
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Data Storage
210
+
211
+ ```
212
+ ~/.local/share/dev-recall/
213
+ ├── events.db # SQLite (events + FTS5 + sessions + daily_summaries)
214
+ ├── vectors.faiss # FAISS vector index
215
+ ├── shell.tsv # shell hook ring buffer
216
+ ├── git.tsv # git hook ring buffer
217
+ └── daemon.pid # running daemon PID
218
+
219
+ ~/.config/dev-recall/
220
+ ├── config.json
221
+ ├── hook.zsh / hook.bash
222
+ └── git-hooks/post-commit + post-checkout
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Development
228
+
229
+ ```bash
230
+ git clone <repo>
231
+ cd dev-recall
232
+ pip install -e ".[dev]"
233
+ pytest
234
+ ```
235
+
236
+ ### Sandbox testing
237
+
238
+ `recall init` makes system-wide changes (modifies `~/.zshrc`, sets a global `git config core.hooksPath`, starts a background daemon). Use the provided Docker sandbox to test safely without touching your host environment.
239
+
240
+ **Prerequisites:** Docker
241
+
242
+ ```bash
243
+ # Interactive shell — explore freely
244
+ ./sandbox.sh
245
+
246
+ # Run the full test suite
247
+ ./sandbox.sh test
248
+
249
+ # Run `recall init` and inspect every file it creates
250
+ ./sandbox.sh init
251
+
252
+ # Run any arbitrary command
253
+ ./sandbox.sh "recall --help"
254
+ ```
255
+
256
+ What the sandbox isolates:
257
+
258
+ | Risk | Mitigation |
259
+ |------|------------|
260
+ | Modifies `~/.zshrc` | Only affects the container's home directory |
261
+ | Sets global `git config core.hooksPath` | Sandboxed git config, discarded on exit |
262
+ | Starts a background daemon | Killed automatically when the container exits |
263
+ | Network calls to OpenRouter | Blocked via `--network none` |
264
+ | Privilege escalation | `--cap-drop ALL --security-opt no-new-privileges` |
265
+
266
+ Alternatively, use a throwaway VM: `multipass launch --name dev-recall-test`
267
+
268
+ ---
269
+
270
+ ## Roadmap
271
+
272
+ - **v0.1** (current): Shell + git + daemon + CLI ask/today/timeline/stats
273
+ - **v0.2**: VS Code extension + AI chat parsers + week/repos/search/export + auto-summary
274
+ - **v0.3**: MCP server + privacy management + Aider/Cursor parsers
275
+ - **v1.0**: Cross-machine sync + web dashboard + Wakatime-compatible API
276
+
277
+ ---
278
+
279
+ ## License
280
+
281
+ MIT
@@ -0,0 +1,252 @@
1
+ # Recall
2
+
3
+ **Local-first developer memory layer.** Captures every developer activity — terminal commands, git commits, file edits, repo opens, AI chat sessions — into a structured SQLite database with a FAISS vector index. Enables natural language recall:
4
+
5
+ ```
6
+ recall ask "what did I work on last Tuesday?"
7
+ recall ask "how did I fix the auth bug?"
8
+ recall today
9
+ recall timeline
10
+ ```
11
+
12
+ ---
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ pip install dev-recall
18
+ recall init
19
+ source .zshrc # or .bashrc
20
+ ```
21
+
22
+ `recall init` will:
23
+ 1. Create `~/.local/share/recall/` and `~/.config/recall/`
24
+ 2. Initialize the SQLite database + FAISS vector index
25
+ 3. Install the zsh/bash shell hook (appends `source` line to your rc file)
26
+ 4. Set `git config --global core.hooksPath` to capture all commits
27
+ 5. Start the background daemon (via systemd user service or subprocess)
28
+
29
+ ---
30
+
31
+ ## Commands
32
+
33
+ | Command | Description |
34
+ |---------|-------------|
35
+ | `recall init` | First-time setup |
36
+ | `recall ask "<query>"` | Natural language search with LLM answer |
37
+ | `recall today` | Summary of today's activity |
38
+ | `recall week` | Summary of this week's activity |
39
+ | `recall timeline` | Chronological event list for a day |
40
+ | `recall search "<query>"` | Raw hybrid search (no LLM) |
41
+ | `recall repos` | List all tracked repos |
42
+ | `recall stats` | Capture statistics |
43
+ | `recall export` | Export events as JSON or CSV |
44
+ | `recall config` | View/edit configuration |
45
+ | `recall privacy list` | Show what's captured |
46
+ | `recall privacy delete` | Delete captured events |
47
+ | `recall privacy ignore --cmd "pattern"` | Add a privacy filter |
48
+ | `recall daemon start/stop/status/logs` | Manage the background daemon |
49
+ | `recall mcp-serve` | Start MCP server (for Claude Code / Copilot) |
50
+
51
+ ---
52
+
53
+ ## Architecture
54
+
55
+ ```
56
+ Collectors (shell hook, git hooks, VS Code ext, AI log watcher)
57
+ ↓ events (TSV files + HTTP POST)
58
+ Daemon (FileWatcher → Enricher → SessionDetector → DB insert → Embedder)
59
+
60
+ Storage (SQLite events.db + FTS5, FAISS vectors.faiss)
61
+
62
+ Query (Hybrid FAISS+FTS5 → RRF → LLM via OpenRouter)
63
+
64
+ CLI + MCP Server
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Data Sources
70
+
71
+ ### Shell commands (zsh / bash)
72
+ Add to `~/.zshrc` (done automatically by `recall init`):
73
+ ```bash
74
+ source ~/.config/dev-recall/hook.zsh
75
+ ```
76
+
77
+ ### Git commits
78
+ `recall init` sets `core.hooksPath` globally — all future commits in any repo are captured.
79
+
80
+ ### VS Code activity
81
+ Install the extension:
82
+ ```bash
83
+ code --install-extension recall.recall-vscode
84
+ ```
85
+
86
+ ### AI chat sessions
87
+ Automatically scanned from:
88
+ - **GitHub Copilot Chat**: `~/.config/Code/User/workspaceStorage/*/GitHub.copilot-chat/debug-logs/`
89
+ - **Claude Code**: `~/.claude/projects/*/sessions/`
90
+ - **Aider**: `.aider.chat.history.md` in git repos
91
+ - **Cursor**: `~/.config/Cursor/User/workspaceStorage/`
92
+
93
+ ---
94
+
95
+ ## LLM Integration
96
+
97
+ Recall uses [OpenRouter](https://openrouter.ai) for the `ask` command and daily summaries.
98
+
99
+ ```bash
100
+ export OPENROUTER_API_KEY=sk-or-...
101
+ recall ask "what was I debugging yesterday?"
102
+ ```
103
+
104
+ Without an API key, `recall ask` falls back to `--no-llm` mode (shows retrieved events directly). All other commands work fully offline.
105
+
106
+ ---
107
+
108
+ ## MCP Server
109
+
110
+ Use Recall as a context source in Claude Code or VS Code Copilot:
111
+
112
+ **Claude Code** (`~/.config/claude/mcp.json`):
113
+ ```json
114
+ {
115
+ "mcpServers": {
116
+ "dev-recall": {
117
+ "command": "dev-recall",
118
+ "args": ["mcp-serve"]
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ **VS Code / Copilot** (`.vscode/mcp.json`):
125
+ ```json
126
+ {
127
+ "servers": {
128
+ "dev-recall": {
129
+ "type": "stdio",
130
+ "command": "dev-recall",
131
+ "args": ["mcp-serve"]
132
+ }
133
+ }
134
+ }
135
+ ```
136
+
137
+ Available MCP tools: `recall`, `today_summary`, `recent_repos`, `find_command`, `timeline`
138
+
139
+ ---
140
+
141
+ ## Privacy
142
+
143
+ - Commands matching `*password*`, `*secret*`, `*token*` etc. are **dropped before storage**
144
+ - AI chat messages are truncated to 200 characters (intent only, not full content)
145
+ - File saves store only **path + language**, never file content
146
+ - All data is **local only** — LLM calls send only small event snippets, only when you run `ask`
147
+ - Default retention: **90 days** (configurable)
148
+
149
+ ```bash
150
+ recall privacy list # see what's captured
151
+ recall privacy delete --before 2026-01-01
152
+ recall privacy ignore --cmd "*mycompany*"
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Configuration
158
+
159
+ Config file: `~/.config/dev-recall/config.json`
160
+
161
+ ```bash
162
+ recall config # show all settings
163
+ recall config daemon_port 8080 # change port
164
+ recall config retention_days 30 # shorter retention
165
+ ```
166
+
167
+ Key settings:
168
+ ```json
169
+ {
170
+ "daemon_port": 27182,
171
+ "embedding_model": "all-MiniLM-L6-v2",
172
+ "llm_model": "anthropic/claude-sonnet-4",
173
+ "retention_days": 90,
174
+ "capture": { "terminal": true, "git": true, "vscode": true, "ai_chat": true }
175
+ }
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Data Storage
181
+
182
+ ```
183
+ ~/.local/share/dev-recall/
184
+ ├── events.db # SQLite (events + FTS5 + sessions + daily_summaries)
185
+ ├── vectors.faiss # FAISS vector index
186
+ ├── shell.tsv # shell hook ring buffer
187
+ ├── git.tsv # git hook ring buffer
188
+ └── daemon.pid # running daemon PID
189
+
190
+ ~/.config/dev-recall/
191
+ ├── config.json
192
+ ├── hook.zsh / hook.bash
193
+ └── git-hooks/post-commit + post-checkout
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Development
199
+
200
+ ```bash
201
+ git clone <repo>
202
+ cd dev-recall
203
+ pip install -e ".[dev]"
204
+ pytest
205
+ ```
206
+
207
+ ### Sandbox testing
208
+
209
+ `recall init` makes system-wide changes (modifies `~/.zshrc`, sets a global `git config core.hooksPath`, starts a background daemon). Use the provided Docker sandbox to test safely without touching your host environment.
210
+
211
+ **Prerequisites:** Docker
212
+
213
+ ```bash
214
+ # Interactive shell — explore freely
215
+ ./sandbox.sh
216
+
217
+ # Run the full test suite
218
+ ./sandbox.sh test
219
+
220
+ # Run `recall init` and inspect every file it creates
221
+ ./sandbox.sh init
222
+
223
+ # Run any arbitrary command
224
+ ./sandbox.sh "recall --help"
225
+ ```
226
+
227
+ What the sandbox isolates:
228
+
229
+ | Risk | Mitigation |
230
+ |------|------------|
231
+ | Modifies `~/.zshrc` | Only affects the container's home directory |
232
+ | Sets global `git config core.hooksPath` | Sandboxed git config, discarded on exit |
233
+ | Starts a background daemon | Killed automatically when the container exits |
234
+ | Network calls to OpenRouter | Blocked via `--network none` |
235
+ | Privilege escalation | `--cap-drop ALL --security-opt no-new-privileges` |
236
+
237
+ Alternatively, use a throwaway VM: `multipass launch --name dev-recall-test`
238
+
239
+ ---
240
+
241
+ ## Roadmap
242
+
243
+ - **v0.1** (current): Shell + git + daemon + CLI ask/today/timeline/stats
244
+ - **v0.2**: VS Code extension + AI chat parsers + week/repos/search/export + auto-summary
245
+ - **v0.3**: MCP server + privacy management + Aider/Cursor parsers
246
+ - **v1.0**: Cross-machine sync + web dashboard + Wakatime-compatible API
247
+
248
+ ---
249
+
250
+ ## License
251
+
252
+ MIT