gitmem-mcp 1.0.0 → 1.0.2

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 (242) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/CLAUDE.md.template +63 -55
  3. package/README.md +79 -163
  4. package/bin/gitmem.js +233 -109
  5. package/bin/init-wizard.js +642 -0
  6. package/bin/uninstall.js +288 -0
  7. package/dist/commands/check.js +20 -20
  8. package/dist/commands/check.js.map +1 -1
  9. package/dist/constants/closing-questions.d.ts +6 -0
  10. package/dist/constants/closing-questions.d.ts.map +1 -1
  11. package/dist/constants/closing-questions.js +65 -0
  12. package/dist/constants/closing-questions.js.map +1 -1
  13. package/dist/hooks/format-utils.d.ts +52 -0
  14. package/dist/hooks/format-utils.d.ts.map +1 -0
  15. package/dist/hooks/format-utils.js +89 -0
  16. package/dist/hooks/format-utils.js.map +1 -0
  17. package/dist/hooks/quick-retrieve.d.ts +30 -0
  18. package/dist/hooks/quick-retrieve.d.ts.map +1 -0
  19. package/dist/hooks/quick-retrieve.js +149 -0
  20. package/dist/hooks/quick-retrieve.js.map +1 -0
  21. package/dist/schemas/active-sessions.d.ts +8 -8
  22. package/dist/schemas/analyze.d.ts +3 -3
  23. package/dist/schemas/common.d.ts +2 -2
  24. package/dist/schemas/common.d.ts.map +1 -1
  25. package/dist/schemas/common.js +1 -1
  26. package/dist/schemas/common.js.map +1 -1
  27. package/dist/schemas/create-decision.d.ts +3 -3
  28. package/dist/schemas/create-learning.d.ts +13 -13
  29. package/dist/schemas/log.d.ts +3 -3
  30. package/dist/schemas/prepare-context.d.ts +3 -3
  31. package/dist/schemas/recall.d.ts +3 -3
  32. package/dist/schemas/record-scar-usage-batch.d.ts +8 -3
  33. package/dist/schemas/record-scar-usage-batch.d.ts.map +1 -1
  34. package/dist/schemas/record-scar-usage.d.ts +3 -0
  35. package/dist/schemas/record-scar-usage.d.ts.map +1 -1
  36. package/dist/schemas/record-scar-usage.js +1 -0
  37. package/dist/schemas/record-scar-usage.js.map +1 -1
  38. package/dist/schemas/registry.d.ts +18 -0
  39. package/dist/schemas/registry.d.ts.map +1 -0
  40. package/dist/schemas/registry.js +158 -0
  41. package/dist/schemas/registry.js.map +1 -0
  42. package/dist/schemas/save-transcript.d.ts +3 -3
  43. package/dist/schemas/search-transcripts.d.ts +33 -0
  44. package/dist/schemas/search-transcripts.d.ts.map +1 -0
  45. package/dist/schemas/search-transcripts.js +26 -0
  46. package/dist/schemas/search-transcripts.js.map +1 -0
  47. package/dist/schemas/search.d.ts +3 -3
  48. package/dist/schemas/session-close.d.ts +43 -15
  49. package/dist/schemas/session-close.d.ts.map +1 -1
  50. package/dist/schemas/session-close.js +7 -2
  51. package/dist/schemas/session-close.js.map +1 -1
  52. package/dist/schemas/session-start.d.ts +3 -3
  53. package/dist/schemas/thread.d.ts +3 -3
  54. package/dist/server.d.ts.map +1 -1
  55. package/dist/server.js +82 -28
  56. package/dist/server.js.map +1 -1
  57. package/dist/services/active-sessions.d.ts +2 -1
  58. package/dist/services/active-sessions.d.ts.map +1 -1
  59. package/dist/services/active-sessions.js +130 -84
  60. package/dist/services/active-sessions.js.map +1 -1
  61. package/dist/services/analytics.d.ts.map +1 -1
  62. package/dist/services/analytics.js +1 -0
  63. package/dist/services/analytics.js.map +1 -1
  64. package/dist/services/behavioral-decay.d.ts +40 -0
  65. package/dist/services/behavioral-decay.d.ts.map +1 -0
  66. package/dist/services/behavioral-decay.js +110 -0
  67. package/dist/services/behavioral-decay.js.map +1 -0
  68. package/dist/services/bm25.d.ts +39 -0
  69. package/dist/services/bm25.d.ts.map +1 -0
  70. package/dist/services/bm25.js +132 -0
  71. package/dist/services/bm25.js.map +1 -0
  72. package/dist/services/cache.d.ts.map +1 -1
  73. package/dist/services/cache.js +9 -8
  74. package/dist/services/cache.js.map +1 -1
  75. package/dist/services/cache.test.js +17 -17
  76. package/dist/services/cache.test.js.map +1 -1
  77. package/dist/services/compliance-validator.d.ts.map +1 -1
  78. package/dist/services/compliance-validator.js +12 -1
  79. package/dist/services/compliance-validator.js.map +1 -1
  80. package/dist/services/display-protocol.d.ts +31 -0
  81. package/dist/services/display-protocol.d.ts.map +1 -0
  82. package/dist/services/display-protocol.js +73 -0
  83. package/dist/services/display-protocol.js.map +1 -0
  84. package/dist/services/effect-tracker.d.ts +81 -0
  85. package/dist/services/effect-tracker.d.ts.map +1 -0
  86. package/dist/services/effect-tracker.js +181 -0
  87. package/dist/services/effect-tracker.js.map +1 -0
  88. package/dist/services/file-lock.d.ts +31 -0
  89. package/dist/services/file-lock.d.ts.map +1 -0
  90. package/dist/services/file-lock.js +124 -0
  91. package/dist/services/file-lock.js.map +1 -0
  92. package/dist/services/gitmem-dir.d.ts +7 -0
  93. package/dist/services/gitmem-dir.d.ts.map +1 -1
  94. package/dist/services/gitmem-dir.js +21 -0
  95. package/dist/services/gitmem-dir.js.map +1 -1
  96. package/dist/services/local-file-storage.d.ts +3 -2
  97. package/dist/services/local-file-storage.d.ts.map +1 -1
  98. package/dist/services/local-file-storage.js +30 -43
  99. package/dist/services/local-file-storage.js.map +1 -1
  100. package/dist/services/local-vector-search.d.ts +10 -9
  101. package/dist/services/local-vector-search.d.ts.map +1 -1
  102. package/dist/services/local-vector-search.js +28 -23
  103. package/dist/services/local-vector-search.js.map +1 -1
  104. package/dist/services/metrics.d.ts +7 -2
  105. package/dist/services/metrics.d.ts.map +1 -1
  106. package/dist/services/metrics.js +41 -33
  107. package/dist/services/metrics.js.map +1 -1
  108. package/dist/services/session-state.d.ts +8 -0
  109. package/dist/services/session-state.d.ts.map +1 -1
  110. package/dist/services/session-state.js +9 -2
  111. package/dist/services/session-state.js.map +1 -1
  112. package/dist/services/startup.d.ts +12 -13
  113. package/dist/services/startup.d.ts.map +1 -1
  114. package/dist/services/startup.js +104 -57
  115. package/dist/services/startup.js.map +1 -1
  116. package/dist/services/supabase-client.d.ts +2 -1
  117. package/dist/services/supabase-client.d.ts.map +1 -1
  118. package/dist/services/supabase-client.js +22 -16
  119. package/dist/services/supabase-client.js.map +1 -1
  120. package/dist/services/thread-dedup.d.ts +9 -0
  121. package/dist/services/thread-dedup.d.ts.map +1 -1
  122. package/dist/services/thread-dedup.js +27 -0
  123. package/dist/services/thread-dedup.js.map +1 -1
  124. package/dist/services/thread-manager.d.ts.map +1 -1
  125. package/dist/services/thread-manager.js +38 -16
  126. package/dist/services/thread-manager.js.map +1 -1
  127. package/dist/services/thread-suggestions.d.ts.map +1 -1
  128. package/dist/services/thread-suggestions.js +1 -1
  129. package/dist/services/thread-suggestions.js.map +1 -1
  130. package/dist/services/thread-supabase.d.ts +0 -1
  131. package/dist/services/thread-supabase.d.ts.map +1 -1
  132. package/dist/services/thread-supabase.js +83 -54
  133. package/dist/services/thread-supabase.js.map +1 -1
  134. package/dist/services/timezone.d.ts.map +1 -1
  135. package/dist/services/timezone.js +1 -0
  136. package/dist/services/timezone.js.map +1 -1
  137. package/dist/services/transcript-chunker.d.ts.map +1 -1
  138. package/dist/services/transcript-chunker.js +18 -4
  139. package/dist/services/transcript-chunker.js.map +1 -1
  140. package/dist/services/variant-generation.d.ts +41 -0
  141. package/dist/services/variant-generation.d.ts.map +1 -0
  142. package/dist/services/variant-generation.js +263 -0
  143. package/dist/services/variant-generation.js.map +1 -0
  144. package/dist/tools/absorb-observations.d.ts.map +1 -1
  145. package/dist/tools/absorb-observations.js +9 -0
  146. package/dist/tools/absorb-observations.js.map +1 -1
  147. package/dist/tools/analyze.d.ts.map +1 -1
  148. package/dist/tools/analyze.js +13 -2
  149. package/dist/tools/analyze.js.map +1 -1
  150. package/dist/tools/archive-learning.d.ts +28 -0
  151. package/dist/tools/archive-learning.d.ts.map +1 -0
  152. package/dist/tools/archive-learning.js +81 -0
  153. package/dist/tools/archive-learning.js.map +1 -0
  154. package/dist/tools/cleanup-threads.d.ts +1 -0
  155. package/dist/tools/cleanup-threads.d.ts.map +1 -1
  156. package/dist/tools/cleanup-threads.js +111 -18
  157. package/dist/tools/cleanup-threads.js.map +1 -1
  158. package/dist/tools/confirm-scars.d.ts.map +1 -1
  159. package/dist/tools/confirm-scars.js +8 -2
  160. package/dist/tools/confirm-scars.js.map +1 -1
  161. package/dist/tools/create-decision.d.ts.map +1 -1
  162. package/dist/tools/create-decision.js +11 -8
  163. package/dist/tools/create-decision.js.map +1 -1
  164. package/dist/tools/create-learning.d.ts.map +1 -1
  165. package/dist/tools/create-learning.js +35 -11
  166. package/dist/tools/create-learning.js.map +1 -1
  167. package/dist/tools/create-thread.d.ts +2 -1
  168. package/dist/tools/create-thread.d.ts.map +1 -1
  169. package/dist/tools/create-thread.js +9 -4
  170. package/dist/tools/create-thread.js.map +1 -1
  171. package/dist/tools/definitions.d.ts +785 -34
  172. package/dist/tools/definitions.d.ts.map +1 -1
  173. package/dist/tools/definitions.js +239 -95
  174. package/dist/tools/definitions.js.map +1 -1
  175. package/dist/tools/dismiss-suggestion.d.ts +1 -0
  176. package/dist/tools/dismiss-suggestion.d.ts.map +1 -1
  177. package/dist/tools/dismiss-suggestion.js +4 -0
  178. package/dist/tools/dismiss-suggestion.js.map +1 -1
  179. package/dist/tools/graph-traverse.d.ts +1 -0
  180. package/dist/tools/graph-traverse.d.ts.map +1 -1
  181. package/dist/tools/graph-traverse.js +24 -9
  182. package/dist/tools/graph-traverse.js.map +1 -1
  183. package/dist/tools/list-threads.d.ts.map +1 -1
  184. package/dist/tools/list-threads.js +49 -5
  185. package/dist/tools/list-threads.js.map +1 -1
  186. package/dist/tools/log.d.ts +1 -0
  187. package/dist/tools/log.d.ts.map +1 -1
  188. package/dist/tools/log.js +84 -17
  189. package/dist/tools/log.js.map +1 -1
  190. package/dist/tools/prepare-context.d.ts +1 -0
  191. package/dist/tools/prepare-context.d.ts.map +1 -1
  192. package/dist/tools/prepare-context.js +15 -85
  193. package/dist/tools/prepare-context.js.map +1 -1
  194. package/dist/tools/promote-suggestion.d.ts +1 -0
  195. package/dist/tools/promote-suggestion.d.ts.map +1 -1
  196. package/dist/tools/promote-suggestion.js +5 -0
  197. package/dist/tools/promote-suggestion.js.map +1 -1
  198. package/dist/tools/recall.d.ts +2 -0
  199. package/dist/tools/recall.d.ts.map +1 -1
  200. package/dist/tools/recall.js +43 -10
  201. package/dist/tools/recall.js.map +1 -1
  202. package/dist/tools/recall.test.js +6 -6
  203. package/dist/tools/recall.test.js.map +1 -1
  204. package/dist/tools/record-scar-usage-batch.d.ts.map +1 -1
  205. package/dist/tools/record-scar-usage-batch.js +13 -0
  206. package/dist/tools/record-scar-usage-batch.js.map +1 -1
  207. package/dist/tools/record-scar-usage.d.ts.map +1 -1
  208. package/dist/tools/record-scar-usage.js +6 -0
  209. package/dist/tools/record-scar-usage.js.map +1 -1
  210. package/dist/tools/resolve-thread.d.ts.map +1 -1
  211. package/dist/tools/resolve-thread.js +57 -6
  212. package/dist/tools/resolve-thread.js.map +1 -1
  213. package/dist/tools/save-transcript.d.ts +1 -0
  214. package/dist/tools/save-transcript.d.ts.map +1 -1
  215. package/dist/tools/save-transcript.js +3 -1
  216. package/dist/tools/save-transcript.js.map +1 -1
  217. package/dist/tools/search-transcripts.d.ts +44 -0
  218. package/dist/tools/search-transcripts.d.ts.map +1 -0
  219. package/dist/tools/search-transcripts.js +158 -0
  220. package/dist/tools/search-transcripts.js.map +1 -0
  221. package/dist/tools/search.d.ts +1 -0
  222. package/dist/tools/search.d.ts.map +1 -1
  223. package/dist/tools/search.js +74 -3
  224. package/dist/tools/search.js.map +1 -1
  225. package/dist/tools/session-close.d.ts.map +1 -1
  226. package/dist/tools/session-close.js +563 -326
  227. package/dist/tools/session-close.js.map +1 -1
  228. package/dist/tools/session-start.d.ts +10 -6
  229. package/dist/tools/session-start.d.ts.map +1 -1
  230. package/dist/tools/session-start.js +319 -426
  231. package/dist/tools/session-start.js.map +1 -1
  232. package/dist/types/index.d.ts +37 -4
  233. package/dist/types/index.d.ts.map +1 -1
  234. package/hooks/hooks/hooks.json +8 -37
  235. package/hooks/scripts/auto-retrieve-hook.sh +163 -0
  236. package/hooks/scripts/post-tool-use.sh +0 -16
  237. package/hooks/scripts/recall-check.sh +0 -11
  238. package/hooks/scripts/session-close-check.sh +1 -1
  239. package/hooks/scripts/session-start.sh +89 -13
  240. package/hooks/tests/test-hooks.sh +3 -49
  241. package/package.json +3 -2
  242. package/schema/setup.sql +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.2] - 2026-02-15
11
+
12
+ ### Fixed
13
+ - **Free tier crash**: `markSessionSuperseded` called Supabase without `hasSupabase()` guard
14
+ - **Session close UX**: Write health block only shown when failures exist (was always visible)
15
+ - **E2E test suite**: Updated for display protocol changes (session_id extraction, display format assertions, recall display text, CLAUDE.md template wording)
16
+
10
17
  ## [1.0.0] - 2026-02-10
11
18
 
12
19
  ### Added
@@ -1,65 +1,73 @@
1
- # GitMem — Institutional Memory
1
+ <!-- gitmem:start -->
2
+ # GitMem — Persistent Memory
2
3
 
3
- ## What is this?
4
- GitMem gives your AI coding agent persistent memory across sessions. It remembers mistakes (scars), successes (wins), and decisions — so you never repeat the same mistake twice.
4
+ You have a persistent memory layer called gitmem. Every session starts from
5
+ zero but gitmem carries forward lessons, mistakes, wins, decisions, and
6
+ open threads across sessions and projects. Search it. Test it. You might be
7
+ amazed at what's already there. If convinced, make it your own — update your
8
+ MEMORY.md with how you want to use it.
5
9
 
6
- ## Automatic behaviors
10
+ ## Tools
7
11
 
8
- When working on this project, follow these memory protocols:
12
+ | Tool | When to use |
13
+ |------|-------------|
14
+ | `recall` | Before any task — surfaces relevant warnings from past experience |
15
+ | `confirm_scars` | After recall — acknowledge each scar as APPLYING, N_A, or REFUTED |
16
+ | `search` | Explore institutional knowledge by topic |
17
+ | `log` | Browse recent learnings chronologically |
18
+ | `session_start` | Beginning of session — loads last session context and open threads |
19
+ | `session_close` | End of session — persists what you learned |
20
+ | `create_learning` | Capture a mistake (scar), success (win), or pattern |
21
+ | `create_decision` | Log an architectural or operational decision with rationale |
22
+ | `list_threads` | See unresolved work carrying over between sessions |
23
+ | `create_thread` | Track something that needs follow-up in a future session |
24
+ | `help` | Show all available commands |
9
25
 
10
- ### Before any task
11
- - Call `recall` with a brief description of what you're about to do
12
- - Review any scars that surface — they're warnings from past experience
13
- - Acknowledge relevant scars before proceeding
26
+ ## Session end
14
27
 
15
- ### At session start
16
- - Call `session_start` to load context from the last session
17
- - Review open threads from the previous session
28
+ On "closing", "done for now", or "wrapping up":
18
29
 
19
- ### When mistakes happen
20
- - If something breaks unexpectedly, suggest creating a scar with `create_learning`
21
- - Include counter-arguments (why someone might think the mistake is OK)
22
- - Scars need: title, description, severity, and at least 2 counter_arguments
30
+ 1. **Answer these reflection questions** and display to the human:
31
+ - What broke that you didn't expect?
32
+ - What took longer than it should have?
33
+ - What would you do differently next time?
34
+ - What pattern or approach worked well?
35
+ - What assumption was wrong?
36
+ - Which scars did you apply?
37
+ - What should be captured as institutional memory?
23
38
 
24
- ### When things go well
25
- - If a pattern or approach works particularly well, capture it as a win
26
- - Wins help replicate success across sessions
39
+ 2. **Ask the human**: "Any corrections or additions?" Wait for their response.
27
40
 
28
- ### When making decisions
29
- - For architectural or significant operational decisions, log them with `create_decision`
30
- - Include what alternatives were considered and why they were rejected
41
+ 3. **Write payload** to `.gitmem/closing-payload.json`:
42
+ ```json
43
+ {
44
+ "closing_reflection": {
45
+ "what_broke": "...",
46
+ "what_took_longer": "...",
47
+ "do_differently": "...",
48
+ "what_worked": "...",
49
+ "wrong_assumption": "...",
50
+ "scars_applied": "...",
51
+ "institutional_memory": "..."
52
+ },
53
+ "task_completion": {
54
+ "started_at": "ISO timestamp",
55
+ "completed_at": "ISO timestamp",
56
+ "questions_displayed_at": "ISO timestamp",
57
+ "reflection_completed_at": "ISO timestamp",
58
+ "human_asked_at": "ISO timestamp",
59
+ "human_response_at": "ISO timestamp",
60
+ "human_response": "human's correction text or empty"
61
+ },
62
+ "human_corrections": "",
63
+ "scars_to_record": [],
64
+ "learnings_created": [],
65
+ "open_threads": [],
66
+ "decisions": []
67
+ }
68
+ ```
31
69
 
32
- ### At session end
33
- - On "closing", "done for now", or "wrapping up", call `session_close`
34
- - Reflect on what worked, what broke, and what to do differently
35
- - Record which scars you applied during the session
36
- - **Run tests before pushing** — `npm run test:unit` at minimum
70
+ 4. **Call `session_close`** with `session_id` and `close_type: "standard"`
37
71
 
38
- ## Tool quick reference
39
-
40
- | Tool | Alias | When to use |
41
- |------|-------|-------------|
42
- | `recall` | `gitmem-r` | Before any task — check for relevant warnings |
43
- | `session_start` | `gitmem-ss` | Beginning of session — load context |
44
- | `session_close` | `gitmem-sc` | End of session — persist learnings |
45
- | `create_learning` | `gitmem-cl` | After mistakes or successes — capture knowledge |
46
- | `create_decision` | `gitmem-cd` | When making choices — log the reasoning |
47
- | `record_scar_usage` | `gitmem-rs` | Track which scars helped |
48
- | `help` | `gitmem-help` | Show all commands |
49
-
50
- ## Development Commands
51
-
52
- When contributing to GitMem itself:
53
-
54
- | Command | Purpose |
55
- |---------|---------|
56
- | `npm run build` | Build + run unit tests (fails if tests fail) |
57
- | `npm run test:unit` | Run Tier 1 unit tests (~2s) |
58
- | `npm run test:integration` | Run Tier 2 integration tests (requires Docker) |
59
- | `npm run test:perf` | Run Tier 3 performance benchmarks |
60
- | `npm run test:e2e` | Run Tier 4 E2E smoke tests (requires Docker) |
61
- | `npm run test:all` | Run all test tiers |
62
- | `npx gitmem check` | Quick health check (~5s) |
63
- | `npx gitmem check --full` | Full diagnostic with benchmarks (~30s) |
64
-
65
- **Before pushing:** Always run `npm run test:unit` at minimum.
72
+ For short exploratory sessions (< 30 min, no real work), use `close_type: "quick"` — no questions needed.
73
+ <!-- gitmem:end -->
package/README.md CHANGED
@@ -1,71 +1,93 @@
1
- # GitMem
1
+ <p align="center">
2
+ <img src="assets/banner.svg" alt="GitMem — Institutional memory for AI coding agents" width="700" />
3
+ </p>
2
4
 
3
- Institutional memory for AI coding agents. Never repeat the same mistake.
5
+ <p align="center">
6
+ <a href="https://www.npmjs.com/package/gitmem-mcp"><img src="https://img.shields.io/npm/v/gitmem-mcp?style=flat-square&color=ed1e25&label=npm" alt="npm version" /></a>
7
+ <a href="https://www.npmjs.com/package/gitmem-mcp"><img src="https://img.shields.io/npm/dm/gitmem-mcp?style=flat-square&color=333333&label=downloads" alt="npm downloads" /></a>
8
+ <a href="https://github.com/nTEG-dev/gitmem/blob/main/LICENSE"><img src="https://img.shields.io/github/license/nTEG-dev/gitmem?style=flat-square&color=ed1e25" alt="MIT License" /></a>
9
+ <a href="https://github.com/nTEG-dev/gitmem/actions"><img src="https://img.shields.io/github/actions/workflow/status/nTEG-dev/gitmem/deploy-docs.yml?style=flat-square&color=333333&label=build" alt="Build" /></a>
10
+ <img src="https://img.shields.io/badge/node-%3E%3D22-ed1e25?style=flat-square" alt="Node.js >= 22" />
11
+ </p>
4
12
 
5
- GitMem is an [MCP server](https://modelcontextprotocol.io/) that gives your AI coding agent persistent memory across sessions. It remembers mistakes (scars), successes (wins), and architectural decisions — so your agent learns from experience instead of starting from scratch every time.
13
+ <p align="center">
14
+ <a href="https://gitmem.dev/docs"><strong>Documentation</strong></a> &middot;
15
+ <a href="https://www.npmjs.com/package/gitmem-mcp"><strong>npm</strong></a> &middot;
16
+ <a href="https://gitmem.dev/docs/getting-started"><strong>Getting Started</strong></a> &middot;
17
+ <a href="https://gitmem.dev/docs/tools"><strong>Tool Reference</strong></a>
18
+ </p>
6
19
 
7
- ## How It Works
20
+ ---
8
21
 
9
- 1. **Before each task**, the agent calls `recall` with a planGitMem surfaces relevant warnings from past sessions
10
- 2. **When mistakes happen**, the agent captures them as "scars" — failures with context and counter-arguments
11
- 3. **When things go well**, the agent captures wins and patterns to replicate
12
- 4. **At session close**, the agent reflects on what worked, what broke, and what to do differently
22
+ GitMem is an [MCP server](https://modelcontextprotocol.io/) that gives your AI coding agent **persistent memory across sessions**. It remembers mistakes (scars), successes (wins), and decisions so your agent learns from experience instead of starting from scratch every time.
13
23
 
14
- Over time, your agent builds institutional memory that prevents repeated mistakes and reinforces good patterns.
24
+ Works with **Claude Code**, **Claude Desktop**, **Cursor**, and any MCP-compatible client.
15
25
 
16
- ### Two Tiers
26
+ ## Quick Start
17
27
 
18
- | | Free Tier | Pro Tier |
19
- |---|-----------|----------|
20
- | **Storage** | Local `.gitmem/` directory | Supabase (PostgreSQL + pgvector) |
21
- | **Search** | Keyword matching | Semantic vector search |
22
- | **Setup** | Zero config | Supabase project + embedding API key |
23
- | **Best for** | Solo projects | Teams, cross-project memory |
28
+ ```bash
29
+ npx gitmem init
30
+ ```
24
31
 
25
- ## Quick Start
32
+ One command. The wizard sets up everything:
33
+ - `.gitmem/` directory with 12 starter scars
34
+ - `.mcp.json` with gitmem server entry
35
+ - `CLAUDE.md` with memory protocol instructions
36
+ - `.claude/settings.json` with tool permissions
37
+ - Lifecycle hooks for automatic session management
38
+ - `.gitignore` updated
26
39
 
27
- ### Free Tier (zero config)
40
+ Already have existing config? The wizard merges without destroying anything. Re-running is safe.
28
41
 
29
42
  ```bash
30
- npx gitmem-mcp init
31
- npx gitmem-mcp configure
43
+ npx gitmem init --yes # Non-interactive
44
+ npx gitmem init --dry-run # Preview changes
32
45
  ```
33
46
 
34
- This creates a `.gitmem/` directory with starter scars and prints the MCP config to add to your editor.
47
+ ## How It Works
35
48
 
36
- Add the config to your project's `.mcp.json` (Claude Code) or IDE settings (Cursor, Windsurf), then copy `CLAUDE.md.template` into your project root. Start coding — memory is active.
49
+ ```
50
+ recall --> work --> learn --> close --> recall --> ...
51
+ ```
37
52
 
38
- ### Pro Tier (with Supabase)
53
+ 1. **Recall** Before acting, the agent checks memory for relevant lessons from past sessions
54
+ 2. **Work** — The agent does the task, applying past lessons automatically
55
+ 3. **Learn** — Mistakes become **scars**, successes become **wins**, strategies become **patterns**
56
+ 4. **Close** — Session reflection persists context for next time
39
57
 
40
- 1. Create a free Supabase project at [database.new](https://database.new)
41
- 2. `npx gitmem-mcp setup` — copy the SQL output into Supabase SQL Editor
42
- 3. Get an API key for embeddings (OpenAI, OpenRouter, or Ollama)
43
- 4. Set `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY` as environment variables
44
- 5. `npx gitmem-mcp configure` — generates your MCP config with env vars
45
- 6. `npx gitmem-mcp init` — loads starter scars into Supabase
46
- 7. Copy `CLAUDE.md.template` into your project
47
- 8. Start coding — memory is active!
58
+ Every scar includes **counter-arguments** — reasons why someone might reasonably ignore it. This prevents memory from becoming a pile of rigid rules.
48
59
 
49
- ## Installation
60
+ ## What Gets Remembered
50
61
 
51
- ### npx (no install required)
62
+ | Type | Purpose | Example |
63
+ |------|---------|---------|
64
+ | **Scars** | Mistakes to avoid | "Always validate UUID format before DB lookup" |
65
+ | **Wins** | Approaches that worked | "Parallel agent spawning cut review time by 60%" |
66
+ | **Patterns** | Reusable strategies | "5-tier test pyramid for MCP servers" |
67
+ | **Decisions** | Architectural choices with rationale | "Chose JWT over session cookies for stateless auth" |
68
+ | **Threads** | Unfinished work that carries across sessions | "Rate limiting still needs implementation" |
52
69
 
53
- ```bash
54
- npx gitmem-mcp init
55
- ```
70
+ ## Key Features
56
71
 
57
- ### Global install
72
+ - **Automatic Recall** — Scars surface before the agent takes similar actions
73
+ - **Session Continuity** — Context, threads, and rapport carry across sessions
74
+ - **Closing Ceremony** — Structured reflection captures what broke, what worked, and what to do differently
75
+ - **23 MCP Tools** — Full toolkit for memory management, search, threads, and multi-agent coordination
76
+ - **Zero Config** — `npx gitmem init` and you're running
77
+ - **Non-Destructive** — Merges with your existing `.mcp.json`, `CLAUDE.md`, and hooks
58
78
 
59
- ```bash
60
- npm install -g gitmem-mcp
61
- gitmem init
62
- ```
79
+ ## Supported Clients
63
80
 
64
- ### MCP Configuration
81
+ | Client | Setup |
82
+ |--------|-------|
83
+ | **Claude Code** | `npx gitmem init` (auto-detected) |
84
+ | **Claude Desktop** | `npx gitmem init` or add to `claude_desktop_config.json` |
85
+ | **Cursor** | `npx gitmem init` or add to `.cursor/mcp.json` |
86
+ | **Any MCP client** | Add `npx -y gitmem-mcp` as an MCP server |
65
87
 
66
- Add to your project's `.mcp.json` (Claude Code) or IDE MCP settings (Cursor, Windsurf):
88
+ <details>
89
+ <summary><strong>Manual MCP configuration</strong></summary>
67
90
 
68
- **Free Tier:**
69
91
  ```json
70
92
  {
71
93
  "mcpServers": {
@@ -77,129 +99,24 @@ Add to your project's `.mcp.json` (Claude Code) or IDE MCP settings (Cursor, Win
77
99
  }
78
100
  ```
79
101
 
80
- **Pro Tier:**
81
- ```json
82
- {
83
- "mcpServers": {
84
- "gitmem": {
85
- "command": "npx",
86
- "args": ["-y", "gitmem-mcp"],
87
- "env": {
88
- "SUPABASE_URL": "https://your-project.supabase.co",
89
- "SUPABASE_SERVICE_ROLE_KEY": "eyJ...",
90
- "OPENAI_API_KEY": "sk-..."
91
- }
92
- }
93
- }
94
- }
95
- ```
96
-
97
- Alternative embedding providers (set instead of `OPENAI_API_KEY`):
98
- - `OPENROUTER_API_KEY` — OpenRouter (multiple models)
99
- - `OLLAMA_URL` — Local Ollama instance (no API key needed)
100
-
101
- ### Verify
102
-
103
- ```bash
104
- # Claude Code
105
- claude mcp list
106
- # Should show: gitmem: connected
107
- ```
102
+ </details>
108
103
 
109
104
  ## CLI Commands
110
105
 
111
106
  | Command | Description |
112
107
  |---------|-------------|
113
- | `gitmem init` | Initialize memory loads starter scars (auto-detects tier) |
114
- | `gitmem setup` | Output SQL for Supabase schema setup (Pro tier) |
115
- | `gitmem configure` | Generate MCP config for your editor |
116
- | `gitmem check` | Run diagnostic health check |
117
- | `gitmem check --full` | Full diagnostic with benchmarks |
118
- | `gitmem install-hooks` | Install Claude Code hooks plugin |
119
- | `gitmem uninstall-hooks` | Remove Claude Code hooks plugin |
120
- | `gitmem server` | Start MCP server (default when no command given) |
121
- | `gitmem help` | Show help |
122
-
123
- ## MCP Tools
124
-
125
- GitMem exposes tools via the Model Context Protocol. Your AI agent calls these automatically based on the instructions in `CLAUDE.md.template`.
126
-
127
- ### Core Tools
128
-
129
- | Tool | Purpose |
130
- |------|---------|
131
- | `recall` | Check memory for relevant warnings before taking action |
132
- | `session_start` | Initialize session, load context from last session |
133
- | `session_close` | Persist session with reflection |
134
- | `create_learning` | Capture scars (failures), wins (successes), or patterns |
135
- | `create_decision` | Log architectural/operational decisions |
136
- | `record_scar_usage` | Track which scars were applied |
137
- | `search` | Search institutional memory (exploration, no side effects) |
138
- | `log` | List recent learnings chronologically |
139
-
140
- ### Thread Tools
141
-
142
- Threads are persistent work items that carry across sessions.
143
-
144
- | Tool | Purpose |
145
- |------|---------|
146
- | `list_threads` | List open threads |
147
- | `create_thread` | Create a new thread |
148
- | `resolve_thread` | Mark a thread as resolved |
149
-
150
- ### Pro Tier Tools
151
-
152
- Available when Supabase is configured:
153
-
154
- | Tool | Purpose |
155
- |------|---------|
156
- | `analyze` | Session analytics and pattern detection |
157
- | `prepare_context` | Multi-agent context preparation |
158
- | `absorb_observations` | Multi-agent observation absorption |
159
- | Cache tools | `cache_status`, `cache_flush`, `cache_health` |
160
-
161
- ## Learning Types
162
-
163
- GitMem tracks four types of institutional knowledge:
164
-
165
- - **Scars** — Failures to avoid. Include severity and counter-arguments (why someone might think the mistake is OK). These are the core of GitMem.
166
- - **Wins** — Successes to replicate. Capture what worked and why.
167
- - **Patterns** — Neutral observations and recurring approaches.
168
- - **Anti-patterns** — Known bad approaches to flag.
169
-
170
- All types are searched together when `recall` is called, giving the agent comprehensive context.
171
-
172
- ## Hooks Plugin
173
-
174
- GitMem includes a Claude Code hooks plugin that automates memory protocols:
175
-
176
- - **SessionStart** — Automatically calls `session_start` when a session begins
177
- - **PreToolUse** — Reminds the agent to call `recall` before consequential actions
178
- - **PostToolUse** — Tracks scar acknowledgment
179
- - **Stop** — Reminds the agent to close sessions properly
180
-
181
- Install:
182
- ```bash
183
- npx gitmem-mcp install-hooks
184
- ```
185
-
186
- Uninstall:
187
- ```bash
188
- npx gitmem-mcp uninstall-hooks
189
- ```
190
-
191
- ## Agent Detection
108
+ | `npx gitmem init` | Interactive setup wizard |
109
+ | `npx gitmem init --yes` | Non-interactive setup |
110
+ | `npx gitmem init --dry-run` | Preview changes |
111
+ | `npx gitmem uninstall` | Clean removal (preserves `.gitmem/` data) |
112
+ | `npx gitmem uninstall --all` | Full removal including data |
113
+ | `npx gitmem check` | Diagnostic health check |
192
114
 
193
- GitMem automatically detects the AI agent identity based on environment:
115
+ ## Pro Tier Coming Soon
194
116
 
195
- | Environment | Identity |
196
- |-------------|----------|
197
- | Claude Code in Docker | CLI |
198
- | Claude Desktop app | DAC |
199
- | Claude.ai with filesystem | Brain_Local |
200
- | Claude.ai without filesystem | Brain_Cloud |
117
+ The free tier gives you everything you need for solo projects. **Pro** will add cloud storage (Supabase), semantic vector search, cross-machine sync, team shared memory, and session transcripts.
201
118
 
202
- Override with `agent_identity` parameter in `session_start`.
119
+ [Join the mailing list](https://gitmem.dev) to get notified when Pro launches.
203
120
 
204
121
  ## Development
205
122
 
@@ -207,12 +124,11 @@ Override with `agent_identity` parameter in `session_start`.
207
124
  git clone https://github.com/nTEG-dev/gitmem.git
208
125
  cd gitmem
209
126
  npm install
210
- npm run build # Compile TypeScript + run unit tests
211
- npm run dev # Watch mode
212
- npm test # Run unit tests
127
+ npm run build
128
+ npm test
213
129
  ```
214
130
 
215
- See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing tiers, and PR guidelines.
131
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for full development setup.
216
132
 
217
133
  ## License
218
134