memgit 0.1.4__tar.gz → 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 (28) hide show
  1. {memgit-0.1.4 → memgit-0.2.0}/PKG-INFO +61 -10
  2. {memgit-0.1.4 → memgit-0.2.0}/README.md +60 -9
  3. {memgit-0.1.4 → memgit-0.2.0}/memgit/cli.py +407 -27
  4. {memgit-0.1.4 → memgit-0.2.0}/memgit/http_server.py +16 -1
  5. {memgit-0.1.4 → memgit-0.2.0}/memgit/mcp_server.py +47 -4
  6. {memgit-0.1.4 → memgit-0.2.0}/memgit/repo.py +622 -45
  7. {memgit-0.1.4 → memgit-0.2.0}/memgit.egg-info/PKG-INFO +61 -10
  8. {memgit-0.1.4 → memgit-0.2.0}/memgit.egg-info/SOURCES.txt +3 -1
  9. {memgit-0.1.4 → memgit-0.2.0}/pyproject.toml +1 -1
  10. memgit-0.2.0/tests/test_setup.py +78 -0
  11. memgit-0.2.0/tests/test_v020.py +385 -0
  12. {memgit-0.1.4 → memgit-0.2.0}/LICENSE +0 -0
  13. {memgit-0.1.4 → memgit-0.2.0}/memgit/__init__.py +0 -0
  14. {memgit-0.1.4 → memgit-0.2.0}/memgit/graph.py +0 -0
  15. {memgit-0.1.4 → memgit-0.2.0}/memgit/importer.py +0 -0
  16. {memgit-0.1.4 → memgit-0.2.0}/memgit/models.py +0 -0
  17. {memgit-0.1.4 → memgit-0.2.0}/memgit/scorer.py +0 -0
  18. {memgit-0.1.4 → memgit-0.2.0}/memgit/store.py +0 -0
  19. {memgit-0.1.4 → memgit-0.2.0}/memgit/tokens.py +0 -0
  20. {memgit-0.1.4 → memgit-0.2.0}/memgit/toon.py +0 -0
  21. {memgit-0.1.4 → memgit-0.2.0}/memgit.egg-info/dependency_links.txt +0 -0
  22. {memgit-0.1.4 → memgit-0.2.0}/memgit.egg-info/entry_points.txt +0 -0
  23. {memgit-0.1.4 → memgit-0.2.0}/memgit.egg-info/requires.txt +0 -0
  24. {memgit-0.1.4 → memgit-0.2.0}/memgit.egg-info/top_level.txt +0 -0
  25. {memgit-0.1.4 → memgit-0.2.0}/setup.cfg +0 -0
  26. {memgit-0.1.4 → memgit-0.2.0}/tests/test_advanced.py +0 -0
  27. {memgit-0.1.4 → memgit-0.2.0}/tests/test_store_repo.py +0 -0
  28. {memgit-0.1.4 → memgit-0.2.0}/tests/test_toon.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memgit
3
- Version: 0.1.4
3
+ Version: 0.2.0
4
4
  Summary: Git for AI memory — version-controlled context persistence across Claude, GPT, Gemini, Cursor, Windsurf, and more
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://memgit.dev
@@ -182,33 +182,76 @@ Restart your AI tool — it now searches your memory store at the start of every
182
182
 
183
183
  ---
184
184
 
185
+ ## Resume where you left off
186
+
187
+ Ask an AI "can we proceed on the pending tasks?" in a fresh session and it will guess from whatever file happens to be open. `memgit resume` replaces the guess with the record:
188
+
189
+ ```bash
190
+ memgit resume # last checkpoints, work in flight, recent + critical memories
191
+ memgit resume --plain # plain text, for piping into an AI context
192
+ memgit resume --json # for tooling
193
+ ```
194
+
195
+ Wire it into Claude Code so every new session **starts** with this digest in context — no tool call, no judgment required:
196
+
197
+ ```bash
198
+ memgit setup hooks # installs a SessionStart hook (~/.claude/settings.json)
199
+ ```
200
+
201
+ The digest is deliberately bounded (~350 tokens measured on a 500-memory store): rules are clipped, the critical list is capped, and full text is one `get_memory` call away.
202
+
203
+ ---
204
+
185
205
  ## Scale to 10,000+ sessions
186
206
 
187
- After months of use, your checkpoint history grows. `memgit squash` handles it:
207
+ After months of use, your checkpoint history grows. Squash compresses it, gc reclaims the disk:
188
208
 
189
209
  ```bash
190
210
  memgit squash --keep-last 100 # keep last 100 checkpoints, squash everything older
191
211
  memgit squash --older-than 30 # squash everything older than 30 days
192
212
  memgit squash --dry-run # preview first
213
+
214
+ memgit gc # delete unreachable objects, trim reflogs
215
+ memgit gc --dry-run # preview
216
+ memgit gc --squash-keep 200 # compact history, then sweep
217
+ ```
218
+
219
+ The current memory **state is always preserved** — and squash is lossless-in-substance: every collapsed checkpoint leaves a one-line record (time, author, diff, message) in an append-only archive under `.memgit/logs/archive/` that gc never touches. Benchmark on a 2,000-checkpoint store: **94% smaller** (39.5 MB → 2.2 MB), `fsck` clean. History operations stay O(1) as the chain grows (SHA resolution and checkpoint counting measured at ~0.08 ms at 2,000 checkpoints).
220
+
221
+ ---
222
+
223
+ ## Multiple agents, one memory
224
+
225
+ All writes go through a git-style store lock (0.08 ms overhead), so concurrent agents can't corrupt the store or lose each other's updates. Two patterns:
226
+
227
+ **Shared thread** — agents write concurrently; if one commits while another has work staged, the second commit auto-merges (three-way, against the recorded base) instead of clobbering. Set `MEMGIT_AUTHOR=agent-name` so each checkpoint says who did it.
228
+
229
+ **Thread per agent** — isolate, then integrate:
230
+
231
+ ```bash
232
+ memgit thread create agent-1 # branch off for each agent
233
+ # ... agents work on their own threads ...
234
+ memgit merge agent-1 # three-way merge back (common-ancestor based)
193
235
  ```
194
236
 
195
- The current memory **state is always preserved** squash only compresses the historical chain.
237
+ Conflicts (same memory changed on both sides) resolve to the newest version; an edit always beats a delete. Both histories are preserved.
196
238
 
197
239
  ---
198
240
 
199
241
  ## What the AI sees
200
242
 
201
- Once registered via MCP, every AI tool gets 5 tools:
243
+ Once registered via MCP, every AI tool gets 6 tools:
202
244
 
203
245
  | Tool | When the AI uses it |
204
246
  |---|---|
205
- | `search_memories` | Start of every sessionloads relevant context automatically |
247
+ | `resume_session` | When the request depends on prior state "continue", "the pending tasks", session start |
248
+ | `search_memories` | Before answering anything that touches past work or preferences |
206
249
  | `get_memory` | When it needs full details of a specific memory |
207
250
  | `list_memories` | To browse or audit what's stored |
208
251
  | `save_memory` | When it learns something worth keeping for next time |
209
252
  | `get_checkpoint_log` | To check when memories were last synced |
210
253
 
211
- The tool descriptions tell the AI **when** to call each onemaking it default behavior, not opt-in.
254
+ The tool descriptions teach the AI **judgment** "does this request depend on state you don't have in context?" rather than keyword triggers. Measured cost of the whole tool surface: ~1,150 tokens once per session; a `resume_session` reply is ~335.
212
255
 
213
256
  ---
214
257
 
@@ -226,10 +269,13 @@ memgit remove <slug> # remove from active index (history preserved)
226
269
  memgit status # staged changes
227
270
  memgit search <query> # BM25 relevance search
228
271
  memgit rollback <ref> # restore state to a checkpoint (HEAD~N or SHA)
229
- memgit squash # compress old history
272
+ memgit resume # where we left off — session-start digest
273
+ memgit merge <thread> # three-way merge a thread into the current one
230
274
 
231
275
  # Scale & proof
232
- memgit stats # token savings vs alternatives
276
+ memgit squash # compress old history (archives what it collapses)
277
+ memgit gc # reclaim disk: sweep unreachable objects
278
+ memgit stats # token savings + disk usage
233
279
  memgit lint # validate all memories
234
280
  memgit fsck # verify store integrity
235
281
 
@@ -254,6 +300,8 @@ memgit setup cursor
254
300
  memgit setup windsurf
255
301
  memgit setup cline
256
302
  memgit setup continue
303
+ memgit setup gemini-cli
304
+ memgit setup hooks # Claude Code SessionStart hook → auto-inject resume digest
257
305
 
258
306
  # Server
259
307
  memgit serve # MCP stdio (Claude Code, Cursor, Windsurf, Cline)
@@ -353,11 +401,14 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
353
401
  - [x] `memgit git push/pull` — team sync via standard git
354
402
  - [x] Flat `memories/` directory — grep/diff/blame your memories
355
403
  - [x] D3.js graph visualization of memory relationships
356
- - [x] PyPI + Homebrew (tap) + npm published (v0.1.4)
404
+ - [x] `memgit resume` + SessionStart hook sessions start with "where we left off"
405
+ - [x] `memgit gc` — space reclamation (mark-and-sweep, lossless squash archive)
406
+ - [x] Multi-agent write safety — store lock, auto-merge commits, `memgit merge`
407
+ - [x] PyPI + Homebrew (tap) + npm published (v0.1.5)
357
408
  - [ ] Chocolatey (not yet live on community.chocolatey.org)
358
409
  - [x] Interactive setup wizard (`memgit setup`)
359
410
  - [x] Smart `memgit init` (auto-detects tool, no path needed)
360
- - [x] VS Code extension (v0.1.4, Marketplace: code416-memgit.memgit)
411
+ - [x] VS Code extension (v0.1.5, Marketplace: code416-memgit.memgit)
361
412
  - [ ] JetBrains plugin (Phase 3)
362
413
  - [ ] Semantic search via embeddings (Phase 4)
363
414
  - [x] memgit.dev website (live)
@@ -151,33 +151,76 @@ Restart your AI tool — it now searches your memory store at the start of every
151
151
 
152
152
  ---
153
153
 
154
+ ## Resume where you left off
155
+
156
+ Ask an AI "can we proceed on the pending tasks?" in a fresh session and it will guess from whatever file happens to be open. `memgit resume` replaces the guess with the record:
157
+
158
+ ```bash
159
+ memgit resume # last checkpoints, work in flight, recent + critical memories
160
+ memgit resume --plain # plain text, for piping into an AI context
161
+ memgit resume --json # for tooling
162
+ ```
163
+
164
+ Wire it into Claude Code so every new session **starts** with this digest in context — no tool call, no judgment required:
165
+
166
+ ```bash
167
+ memgit setup hooks # installs a SessionStart hook (~/.claude/settings.json)
168
+ ```
169
+
170
+ The digest is deliberately bounded (~350 tokens measured on a 500-memory store): rules are clipped, the critical list is capped, and full text is one `get_memory` call away.
171
+
172
+ ---
173
+
154
174
  ## Scale to 10,000+ sessions
155
175
 
156
- After months of use, your checkpoint history grows. `memgit squash` handles it:
176
+ After months of use, your checkpoint history grows. Squash compresses it, gc reclaims the disk:
157
177
 
158
178
  ```bash
159
179
  memgit squash --keep-last 100 # keep last 100 checkpoints, squash everything older
160
180
  memgit squash --older-than 30 # squash everything older than 30 days
161
181
  memgit squash --dry-run # preview first
182
+
183
+ memgit gc # delete unreachable objects, trim reflogs
184
+ memgit gc --dry-run # preview
185
+ memgit gc --squash-keep 200 # compact history, then sweep
186
+ ```
187
+
188
+ The current memory **state is always preserved** — and squash is lossless-in-substance: every collapsed checkpoint leaves a one-line record (time, author, diff, message) in an append-only archive under `.memgit/logs/archive/` that gc never touches. Benchmark on a 2,000-checkpoint store: **94% smaller** (39.5 MB → 2.2 MB), `fsck` clean. History operations stay O(1) as the chain grows (SHA resolution and checkpoint counting measured at ~0.08 ms at 2,000 checkpoints).
189
+
190
+ ---
191
+
192
+ ## Multiple agents, one memory
193
+
194
+ All writes go through a git-style store lock (0.08 ms overhead), so concurrent agents can't corrupt the store or lose each other's updates. Two patterns:
195
+
196
+ **Shared thread** — agents write concurrently; if one commits while another has work staged, the second commit auto-merges (three-way, against the recorded base) instead of clobbering. Set `MEMGIT_AUTHOR=agent-name` so each checkpoint says who did it.
197
+
198
+ **Thread per agent** — isolate, then integrate:
199
+
200
+ ```bash
201
+ memgit thread create agent-1 # branch off for each agent
202
+ # ... agents work on their own threads ...
203
+ memgit merge agent-1 # three-way merge back (common-ancestor based)
162
204
  ```
163
205
 
164
- The current memory **state is always preserved** squash only compresses the historical chain.
206
+ Conflicts (same memory changed on both sides) resolve to the newest version; an edit always beats a delete. Both histories are preserved.
165
207
 
166
208
  ---
167
209
 
168
210
  ## What the AI sees
169
211
 
170
- Once registered via MCP, every AI tool gets 5 tools:
212
+ Once registered via MCP, every AI tool gets 6 tools:
171
213
 
172
214
  | Tool | When the AI uses it |
173
215
  |---|---|
174
- | `search_memories` | Start of every sessionloads relevant context automatically |
216
+ | `resume_session` | When the request depends on prior state "continue", "the pending tasks", session start |
217
+ | `search_memories` | Before answering anything that touches past work or preferences |
175
218
  | `get_memory` | When it needs full details of a specific memory |
176
219
  | `list_memories` | To browse or audit what's stored |
177
220
  | `save_memory` | When it learns something worth keeping for next time |
178
221
  | `get_checkpoint_log` | To check when memories were last synced |
179
222
 
180
- The tool descriptions tell the AI **when** to call each onemaking it default behavior, not opt-in.
223
+ The tool descriptions teach the AI **judgment** "does this request depend on state you don't have in context?" rather than keyword triggers. Measured cost of the whole tool surface: ~1,150 tokens once per session; a `resume_session` reply is ~335.
181
224
 
182
225
  ---
183
226
 
@@ -195,10 +238,13 @@ memgit remove <slug> # remove from active index (history preserved)
195
238
  memgit status # staged changes
196
239
  memgit search <query> # BM25 relevance search
197
240
  memgit rollback <ref> # restore state to a checkpoint (HEAD~N or SHA)
198
- memgit squash # compress old history
241
+ memgit resume # where we left off — session-start digest
242
+ memgit merge <thread> # three-way merge a thread into the current one
199
243
 
200
244
  # Scale & proof
201
- memgit stats # token savings vs alternatives
245
+ memgit squash # compress old history (archives what it collapses)
246
+ memgit gc # reclaim disk: sweep unreachable objects
247
+ memgit stats # token savings + disk usage
202
248
  memgit lint # validate all memories
203
249
  memgit fsck # verify store integrity
204
250
 
@@ -223,6 +269,8 @@ memgit setup cursor
223
269
  memgit setup windsurf
224
270
  memgit setup cline
225
271
  memgit setup continue
272
+ memgit setup gemini-cli
273
+ memgit setup hooks # Claude Code SessionStart hook → auto-inject resume digest
226
274
 
227
275
  # Server
228
276
  memgit serve # MCP stdio (Claude Code, Cursor, Windsurf, Cline)
@@ -322,11 +370,14 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
322
370
  - [x] `memgit git push/pull` — team sync via standard git
323
371
  - [x] Flat `memories/` directory — grep/diff/blame your memories
324
372
  - [x] D3.js graph visualization of memory relationships
325
- - [x] PyPI + Homebrew (tap) + npm published (v0.1.4)
373
+ - [x] `memgit resume` + SessionStart hook sessions start with "where we left off"
374
+ - [x] `memgit gc` — space reclamation (mark-and-sweep, lossless squash archive)
375
+ - [x] Multi-agent write safety — store lock, auto-merge commits, `memgit merge`
376
+ - [x] PyPI + Homebrew (tap) + npm published (v0.1.5)
326
377
  - [ ] Chocolatey (not yet live on community.chocolatey.org)
327
378
  - [x] Interactive setup wizard (`memgit setup`)
328
379
  - [x] Smart `memgit init` (auto-detects tool, no path needed)
329
- - [x] VS Code extension (v0.1.4, Marketplace: code416-memgit.memgit)
380
+ - [x] VS Code extension (v0.1.5, Marketplace: code416-memgit.memgit)
330
381
  - [ ] JetBrains plugin (Phase 3)
331
382
  - [ ] Semantic search via embeddings (Phase 4)
332
383
  - [x] memgit.dev website (live)