gitmem-mcp 0.2.0 → 1.0.1

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 (249) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/CLAUDE.md.template +63 -55
  3. package/README.md +149 -120
  4. package/bin/gitmem.js +377 -25
  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/index.js +0 -0
  22. package/dist/schemas/active-sessions.d.ts +8 -8
  23. package/dist/schemas/analyze.d.ts +3 -3
  24. package/dist/schemas/common.d.ts +2 -2
  25. package/dist/schemas/common.d.ts.map +1 -1
  26. package/dist/schemas/common.js +1 -1
  27. package/dist/schemas/common.js.map +1 -1
  28. package/dist/schemas/create-decision.d.ts +3 -3
  29. package/dist/schemas/create-learning.d.ts +13 -13
  30. package/dist/schemas/log.d.ts +3 -3
  31. package/dist/schemas/prepare-context.d.ts +3 -3
  32. package/dist/schemas/recall.d.ts +3 -3
  33. package/dist/schemas/record-scar-usage-batch.d.ts +8 -3
  34. package/dist/schemas/record-scar-usage-batch.d.ts.map +1 -1
  35. package/dist/schemas/record-scar-usage.d.ts +3 -0
  36. package/dist/schemas/record-scar-usage.d.ts.map +1 -1
  37. package/dist/schemas/record-scar-usage.js +1 -0
  38. package/dist/schemas/record-scar-usage.js.map +1 -1
  39. package/dist/schemas/registry.d.ts +18 -0
  40. package/dist/schemas/registry.d.ts.map +1 -0
  41. package/dist/schemas/registry.js +158 -0
  42. package/dist/schemas/registry.js.map +1 -0
  43. package/dist/schemas/save-transcript.d.ts +3 -3
  44. package/dist/schemas/search-transcripts.d.ts +33 -0
  45. package/dist/schemas/search-transcripts.d.ts.map +1 -0
  46. package/dist/schemas/search-transcripts.js +26 -0
  47. package/dist/schemas/search-transcripts.js.map +1 -0
  48. package/dist/schemas/search.d.ts +3 -3
  49. package/dist/schemas/session-close.d.ts +43 -15
  50. package/dist/schemas/session-close.d.ts.map +1 -1
  51. package/dist/schemas/session-close.js +7 -2
  52. package/dist/schemas/session-close.js.map +1 -1
  53. package/dist/schemas/session-start.d.ts +3 -3
  54. package/dist/schemas/thread.d.ts +3 -3
  55. package/dist/server.d.ts.map +1 -1
  56. package/dist/server.js +82 -28
  57. package/dist/server.js.map +1 -1
  58. package/dist/services/active-sessions.d.ts +2 -1
  59. package/dist/services/active-sessions.d.ts.map +1 -1
  60. package/dist/services/active-sessions.js +130 -84
  61. package/dist/services/active-sessions.js.map +1 -1
  62. package/dist/services/analytics.d.ts.map +1 -1
  63. package/dist/services/analytics.js +1 -0
  64. package/dist/services/analytics.js.map +1 -1
  65. package/dist/services/behavioral-decay.d.ts +40 -0
  66. package/dist/services/behavioral-decay.d.ts.map +1 -0
  67. package/dist/services/behavioral-decay.js +110 -0
  68. package/dist/services/behavioral-decay.js.map +1 -0
  69. package/dist/services/bm25.d.ts +39 -0
  70. package/dist/services/bm25.d.ts.map +1 -0
  71. package/dist/services/bm25.js +132 -0
  72. package/dist/services/bm25.js.map +1 -0
  73. package/dist/services/cache.d.ts.map +1 -1
  74. package/dist/services/cache.js +9 -8
  75. package/dist/services/cache.js.map +1 -1
  76. package/dist/services/cache.test.js +17 -17
  77. package/dist/services/cache.test.js.map +1 -1
  78. package/dist/services/compliance-validator.d.ts.map +1 -1
  79. package/dist/services/compliance-validator.js +12 -1
  80. package/dist/services/compliance-validator.js.map +1 -1
  81. package/dist/services/display-protocol.d.ts +31 -0
  82. package/dist/services/display-protocol.d.ts.map +1 -0
  83. package/dist/services/display-protocol.js +73 -0
  84. package/dist/services/display-protocol.js.map +1 -0
  85. package/dist/services/effect-tracker.d.ts +81 -0
  86. package/dist/services/effect-tracker.d.ts.map +1 -0
  87. package/dist/services/effect-tracker.js +181 -0
  88. package/dist/services/effect-tracker.js.map +1 -0
  89. package/dist/services/file-lock.d.ts +31 -0
  90. package/dist/services/file-lock.d.ts.map +1 -0
  91. package/dist/services/file-lock.js +124 -0
  92. package/dist/services/file-lock.js.map +1 -0
  93. package/dist/services/gitmem-dir.d.ts +7 -0
  94. package/dist/services/gitmem-dir.d.ts.map +1 -1
  95. package/dist/services/gitmem-dir.js +21 -0
  96. package/dist/services/gitmem-dir.js.map +1 -1
  97. package/dist/services/local-file-storage.d.ts +3 -2
  98. package/dist/services/local-file-storage.d.ts.map +1 -1
  99. package/dist/services/local-file-storage.js +30 -43
  100. package/dist/services/local-file-storage.js.map +1 -1
  101. package/dist/services/local-vector-search.d.ts +10 -9
  102. package/dist/services/local-vector-search.d.ts.map +1 -1
  103. package/dist/services/local-vector-search.js +28 -23
  104. package/dist/services/local-vector-search.js.map +1 -1
  105. package/dist/services/metrics.d.ts +7 -2
  106. package/dist/services/metrics.d.ts.map +1 -1
  107. package/dist/services/metrics.js +41 -33
  108. package/dist/services/metrics.js.map +1 -1
  109. package/dist/services/session-state.d.ts +8 -0
  110. package/dist/services/session-state.d.ts.map +1 -1
  111. package/dist/services/session-state.js +9 -2
  112. package/dist/services/session-state.js.map +1 -1
  113. package/dist/services/startup.d.ts +12 -13
  114. package/dist/services/startup.d.ts.map +1 -1
  115. package/dist/services/startup.js +104 -57
  116. package/dist/services/startup.js.map +1 -1
  117. package/dist/services/supabase-client.d.ts +2 -1
  118. package/dist/services/supabase-client.d.ts.map +1 -1
  119. package/dist/services/supabase-client.js +22 -16
  120. package/dist/services/supabase-client.js.map +1 -1
  121. package/dist/services/thread-dedup.d.ts +9 -0
  122. package/dist/services/thread-dedup.d.ts.map +1 -1
  123. package/dist/services/thread-dedup.js +27 -0
  124. package/dist/services/thread-dedup.js.map +1 -1
  125. package/dist/services/thread-manager.d.ts.map +1 -1
  126. package/dist/services/thread-manager.js +38 -16
  127. package/dist/services/thread-manager.js.map +1 -1
  128. package/dist/services/thread-suggestions.d.ts.map +1 -1
  129. package/dist/services/thread-suggestions.js +1 -1
  130. package/dist/services/thread-suggestions.js.map +1 -1
  131. package/dist/services/thread-supabase.d.ts +0 -1
  132. package/dist/services/thread-supabase.d.ts.map +1 -1
  133. package/dist/services/thread-supabase.js +83 -54
  134. package/dist/services/thread-supabase.js.map +1 -1
  135. package/dist/services/timezone.d.ts.map +1 -1
  136. package/dist/services/timezone.js +1 -0
  137. package/dist/services/timezone.js.map +1 -1
  138. package/dist/services/transcript-chunker.d.ts.map +1 -1
  139. package/dist/services/transcript-chunker.js +18 -4
  140. package/dist/services/transcript-chunker.js.map +1 -1
  141. package/dist/services/variant-generation.d.ts +41 -0
  142. package/dist/services/variant-generation.d.ts.map +1 -0
  143. package/dist/services/variant-generation.js +263 -0
  144. package/dist/services/variant-generation.js.map +1 -0
  145. package/dist/tools/absorb-observations.d.ts.map +1 -1
  146. package/dist/tools/absorb-observations.js +9 -0
  147. package/dist/tools/absorb-observations.js.map +1 -1
  148. package/dist/tools/analyze.d.ts.map +1 -1
  149. package/dist/tools/analyze.js +13 -2
  150. package/dist/tools/analyze.js.map +1 -1
  151. package/dist/tools/archive-learning.d.ts +28 -0
  152. package/dist/tools/archive-learning.d.ts.map +1 -0
  153. package/dist/tools/archive-learning.js +81 -0
  154. package/dist/tools/archive-learning.js.map +1 -0
  155. package/dist/tools/cleanup-threads.d.ts +1 -0
  156. package/dist/tools/cleanup-threads.d.ts.map +1 -1
  157. package/dist/tools/cleanup-threads.js +111 -18
  158. package/dist/tools/cleanup-threads.js.map +1 -1
  159. package/dist/tools/confirm-scars.d.ts.map +1 -1
  160. package/dist/tools/confirm-scars.js +8 -2
  161. package/dist/tools/confirm-scars.js.map +1 -1
  162. package/dist/tools/create-decision.d.ts.map +1 -1
  163. package/dist/tools/create-decision.js +11 -8
  164. package/dist/tools/create-decision.js.map +1 -1
  165. package/dist/tools/create-learning.d.ts.map +1 -1
  166. package/dist/tools/create-learning.js +35 -11
  167. package/dist/tools/create-learning.js.map +1 -1
  168. package/dist/tools/create-linear-issue.d.ts +18 -0
  169. package/dist/tools/create-linear-issue.d.ts.map +1 -0
  170. package/dist/tools/create-linear-issue.js +197 -0
  171. package/dist/tools/create-linear-issue.js.map +1 -0
  172. package/dist/tools/create-thread.d.ts +2 -1
  173. package/dist/tools/create-thread.d.ts.map +1 -1
  174. package/dist/tools/create-thread.js +9 -4
  175. package/dist/tools/create-thread.js.map +1 -1
  176. package/dist/tools/definitions.d.ts +785 -34
  177. package/dist/tools/definitions.d.ts.map +1 -1
  178. package/dist/tools/definitions.js +239 -95
  179. package/dist/tools/definitions.js.map +1 -1
  180. package/dist/tools/dismiss-suggestion.d.ts +1 -0
  181. package/dist/tools/dismiss-suggestion.d.ts.map +1 -1
  182. package/dist/tools/dismiss-suggestion.js +4 -0
  183. package/dist/tools/dismiss-suggestion.js.map +1 -1
  184. package/dist/tools/graph-traverse.d.ts +1 -0
  185. package/dist/tools/graph-traverse.d.ts.map +1 -1
  186. package/dist/tools/graph-traverse.js +24 -9
  187. package/dist/tools/graph-traverse.js.map +1 -1
  188. package/dist/tools/list-threads.d.ts.map +1 -1
  189. package/dist/tools/list-threads.js +49 -5
  190. package/dist/tools/list-threads.js.map +1 -1
  191. package/dist/tools/log.d.ts +1 -0
  192. package/dist/tools/log.d.ts.map +1 -1
  193. package/dist/tools/log.js +84 -17
  194. package/dist/tools/log.js.map +1 -1
  195. package/dist/tools/prepare-context.d.ts +1 -0
  196. package/dist/tools/prepare-context.d.ts.map +1 -1
  197. package/dist/tools/prepare-context.js +15 -85
  198. package/dist/tools/prepare-context.js.map +1 -1
  199. package/dist/tools/promote-suggestion.d.ts +1 -0
  200. package/dist/tools/promote-suggestion.d.ts.map +1 -1
  201. package/dist/tools/promote-suggestion.js +5 -0
  202. package/dist/tools/promote-suggestion.js.map +1 -1
  203. package/dist/tools/recall.d.ts +2 -0
  204. package/dist/tools/recall.d.ts.map +1 -1
  205. package/dist/tools/recall.js +43 -10
  206. package/dist/tools/recall.js.map +1 -1
  207. package/dist/tools/recall.test.js +6 -6
  208. package/dist/tools/recall.test.js.map +1 -1
  209. package/dist/tools/record-scar-usage-batch.d.ts.map +1 -1
  210. package/dist/tools/record-scar-usage-batch.js +13 -0
  211. package/dist/tools/record-scar-usage-batch.js.map +1 -1
  212. package/dist/tools/record-scar-usage.d.ts.map +1 -1
  213. package/dist/tools/record-scar-usage.js +6 -0
  214. package/dist/tools/record-scar-usage.js.map +1 -1
  215. package/dist/tools/resolve-thread.d.ts.map +1 -1
  216. package/dist/tools/resolve-thread.js +57 -6
  217. package/dist/tools/resolve-thread.js.map +1 -1
  218. package/dist/tools/save-transcript.d.ts +1 -0
  219. package/dist/tools/save-transcript.d.ts.map +1 -1
  220. package/dist/tools/save-transcript.js +3 -1
  221. package/dist/tools/save-transcript.js.map +1 -1
  222. package/dist/tools/search-transcripts.d.ts +44 -0
  223. package/dist/tools/search-transcripts.d.ts.map +1 -0
  224. package/dist/tools/search-transcripts.js +158 -0
  225. package/dist/tools/search-transcripts.js.map +1 -0
  226. package/dist/tools/search.d.ts +1 -0
  227. package/dist/tools/search.d.ts.map +1 -1
  228. package/dist/tools/search.js +74 -3
  229. package/dist/tools/search.js.map +1 -1
  230. package/dist/tools/session-close.d.ts.map +1 -1
  231. package/dist/tools/session-close.js +563 -326
  232. package/dist/tools/session-close.js.map +1 -1
  233. package/dist/tools/session-start.d.ts +10 -6
  234. package/dist/tools/session-start.d.ts.map +1 -1
  235. package/dist/tools/session-start.js +317 -426
  236. package/dist/tools/session-start.js.map +1 -1
  237. package/dist/types/index.d.ts +37 -4
  238. package/dist/types/index.d.ts.map +1 -1
  239. package/hooks/.claude-plugin/plugin.json +8 -0
  240. package/hooks/README.md +107 -0
  241. package/hooks/hooks/hooks.json +123 -0
  242. package/hooks/scripts/auto-retrieve-hook.sh +163 -0
  243. package/hooks/scripts/post-tool-use.sh +112 -0
  244. package/hooks/scripts/recall-check.sh +213 -0
  245. package/hooks/scripts/session-close-check.sh +116 -0
  246. package/hooks/scripts/session-start.sh +233 -0
  247. package/hooks/tests/test-hooks.sh +577 -0
  248. package/package.json +4 -2
  249. package/schema/setup.sql +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.0] - 2026-02-10
11
+
12
+ ### Added
13
+ - **Hooks plugin bundled**: `gitmem install-hooks` / `uninstall-hooks` CLI commands (OD-605, OD-606)
14
+ - **CLI `check` command wired**: `gitmem check` now reachable from CLI (was defined but unreachable)
15
+ - **Fresh-install E2E tests**: 16 integration tests covering CLI commands, hooks, and MCP server lifecycle (OD-607)
16
+ - **README rewrite**: External-developer-facing docs with no internal jargon (OD-608)
17
+ - **CONTRIBUTING.md**: Dev setup, testing tiers, and PR guidelines
18
+ - **First public npm release** (OD-609)
19
+
20
+ ### Changed
21
+ - Package name standardized to `gitmem-mcp` for npm
22
+ - `gitmem configure` output uses `gitmem-mcp` (matching npm package name)
23
+ - Removed internal project defaults from CLI commands
24
+
10
25
  ## [0.2.0] - 2026-02-08
11
26
 
12
27
  ### Added
@@ -42,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
42
57
  - Cache management (status, flush, health)
43
58
  - Agent identity detection
44
59
 
45
- [Unreleased]: https://github.com/nTEG-dev/gitmem/compare/v0.2.0...HEAD
60
+ [Unreleased]: https://github.com/nTEG-dev/gitmem/compare/v1.0.0...HEAD
61
+ [1.0.0]: https://github.com/nTEG-dev/gitmem/compare/v0.2.0...v1.0.0
46
62
  [0.2.0]: https://github.com/nTEG-dev/gitmem/compare/v0.1.0...v0.2.0
47
63
  [0.1.0]: https://github.com/nTEG-dev/gitmem/releases/tag/v0.1.0
@@ -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,86 +1,121 @@
1
1
  # GitMem
2
2
 
3
- Institutional memory for AI coding agents. Never repeat the same mistake.
3
+ Institutional memory for AI coding agents. Memory that compounds.
4
4
 
5
- ## Features
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.
6
6
 
7
- - **Predict**: Check institutional memory for relevant learnings before taking action (core GitMem MVP tool)
8
- - **Session Start**: Initialize session, detect agent identity, load last session context, retrieve relevant learnings, load recent decisions
9
- - **Session Close**: Persist session with compliance validation (standard/quick/autonomous close types)
10
- - **Learning Capture**: Create scars, wins, patterns, and anti-patterns in institutional memory
11
- - **Decision Logging**: Log architectural and operational decisions
12
- - **Scar Usage Tracking**: Track scar application for effectiveness measurement
13
- - **[Threads](docs/threads.md)**: Persistent work items that carry across sessions — create, list, resolve
14
- - **[Doc-Debt Tracking](docs/doc-debt-tracking.md)**: Detect when decisions outpace documentation updates
7
+ **[Documentation](https://gitmem.dev)** · **[npm](https://www.npmjs.com/package/gitmem-mcp)** · **[GitHub](https://github.com/nTEG-dev/gitmem)**
15
8
 
16
- ### Learning Types
9
+ ## How It Works
17
10
 
18
- GitMem tracks **all learning types**:
19
- - **Scars**Failures to avoid (critical institutional memory)
20
- - **Patterns** Neutral observations and recurring patterns
21
- - **Wins** Successes to replicate
22
- - **Anti-patterns** — Known bad approaches
11
+ 1. **Before each task**, the agent calls `recall` with a plan — GitMem surfaces relevant warnings from past sessions
12
+ 2. **When mistakes happen**, the agent captures them as "scars" failures with context and counter-arguments
13
+ 3. **When things go well**, the agent captures wins and patterns to replicate
14
+ 4. **At session close**, the agent reflects on what worked, what broke, and what to do differently
23
15
 
24
- All learning types use the same vector search infrastructure and are queried together for comprehensive institutional context.
16
+ Over time, your agent builds institutional memory that prevents repeated mistakes and reinforces good patterns.
17
+
18
+ ### Two Tiers
19
+
20
+ | | Free Tier | Pro Tier |
21
+ |---|-----------|----------|
22
+ | **Storage** | Local `.gitmem/` directory | Supabase (PostgreSQL + pgvector) |
23
+ | **Search** | Keyword matching | Semantic vector search |
24
+ | **Setup** | Zero config | Supabase project + embedding API key |
25
+ | **Best for** | Solo projects | Teams, cross-project memory |
25
26
 
26
27
  ## Quick Start
27
28
 
28
- ### Free Tier (zero config)
29
+ ### One command setup
29
30
 
30
31
  ```bash
31
32
  npx gitmem init
32
- npx gitmem configure
33
33
  ```
34
34
 
35
- Copy `CLAUDE.md.template` into your project, then start coding memory is active.
35
+ The interactive wizard detects your existing config and sets up everything:
36
+
37
+ 1. Creates `.gitmem/` with 12 starter scars
38
+ 2. Adds gitmem to `.mcp.json`
39
+ 3. Adds memory instructions to `CLAUDE.md`
40
+ 4. Configures tool permissions in `.claude/settings.json`
41
+ 5. Installs lifecycle hooks
42
+ 6. Updates `.gitignore`
43
+
44
+ Already have `.mcp.json`, `CLAUDE.md`, or hooks? The wizard merges without destroying your existing config.
45
+
46
+ ```bash
47
+ # Non-interactive (accept all defaults)
48
+ npx gitmem init --yes
49
+
50
+ # Preview what would change
51
+ npx gitmem init --dry-run
52
+
53
+ # Set project name
54
+ npx gitmem init --project my-app
55
+ ```
56
+
57
+ Start Claude Code — memory is active.
36
58
 
37
59
  ### Pro Tier (with Supabase)
38
60
 
61
+ For semantic search and cloud persistence:
62
+
39
63
  1. Create a free Supabase project at [database.new](https://database.new)
40
64
  2. `npx gitmem setup` — copy the SQL output into Supabase SQL Editor
41
- 3. Get an API key for embeddings (OpenAI, OpenRouter, or Ollama)
42
- 4. `npx gitmem configure` — generates your `.mcp.json` config
43
- 5. `npx gitmem init` — loads starter scars into Supabase
44
- 6. Copy `CLAUDE.md.template` into your project
45
- 7. Start coding — memory is active!
65
+ 3. Set `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY` as environment variables
66
+ 4. `npx gitmem init` — auto-detects pro tier from env vars
46
67
 
47
- ## Installation
68
+ ### Uninstall
69
+
70
+ ```bash
71
+ npx gitmem uninstall
72
+ ```
48
73
 
49
- ### npm (recommended)
74
+ Cleanly removes gitmem from all config files. Your memory data (`.gitmem/`) is preserved by default.
50
75
 
51
76
  ```bash
52
- npm install gitmem
77
+ # Also delete .gitmem/ data
78
+ npx gitmem uninstall --all
53
79
  ```
54
80
 
55
- ### npx (no install)
81
+ ## Installation
82
+
83
+ ### npx (no install required)
56
84
 
57
85
  ```bash
58
86
  npx gitmem init
59
87
  ```
60
88
 
61
- ### MCP Registration
89
+ ### Global install
62
90
 
63
- Add to your project's `.mcp.json` (Claude Code) or IDE settings (Cursor, Windsurf):
91
+ ```bash
92
+ npm install -g gitmem-mcp
93
+ gitmem init
94
+ ```
64
95
 
96
+ ### Manual MCP Configuration
97
+
98
+ If you prefer to configure manually instead of using `npx gitmem init`:
99
+
100
+ **Free Tier:**
65
101
  ```json
66
102
  {
67
103
  "mcpServers": {
68
104
  "gitmem": {
69
105
  "command": "npx",
70
- "args": ["-y", "gitmem"]
106
+ "args": ["-y", "gitmem-mcp"]
71
107
  }
72
108
  }
73
109
  }
74
110
  ```
75
111
 
76
- For Pro tier, add environment variables:
77
-
112
+ **Pro Tier:**
78
113
  ```json
79
114
  {
80
115
  "mcpServers": {
81
116
  "gitmem": {
82
117
  "command": "npx",
83
- "args": ["-y", "gitmem"],
118
+ "args": ["-y", "gitmem-mcp"],
84
119
  "env": {
85
120
  "SUPABASE_URL": "https://your-project.supabase.co",
86
121
  "SUPABASE_SERVICE_ROLE_KEY": "eyJ...",
@@ -91,131 +126,125 @@ For Pro tier, add environment variables:
91
126
  }
92
127
  ```
93
128
 
129
+ Alternative embedding providers (set instead of `OPENAI_API_KEY`):
130
+ - `OPENROUTER_API_KEY` — OpenRouter (multiple models)
131
+ - `OLLAMA_URL` — Local Ollama instance (no API key needed)
132
+
94
133
  ### Verify
95
134
 
96
135
  ```bash
136
+ # Claude Code
97
137
  claude mcp list
98
- # Should show: gitmem: ✓ Connected
138
+ # Should show: gitmem: connected
99
139
  ```
100
140
 
101
141
  ## CLI Commands
102
142
 
103
143
  | Command | Description |
104
144
  |---------|-------------|
105
- | `gitmem init` | Initialize memory (loads starter scars) |
106
- | `gitmem setup` | Output SQL for Supabase schema setup |
107
- | `gitmem configure` | Generate `.mcp.json` config |
108
- | `gitmem server` | Start MCP server (default) |
145
+ | `gitmem init` | Interactive setup wizard detects, prompts, merges |
146
+ | `gitmem init --yes` | Non-interactive setup (accept all defaults) |
147
+ | `gitmem init --dry-run` | Preview what would be configured |
148
+ | `gitmem uninstall` | Clean removal of gitmem from project |
149
+ | `gitmem uninstall --all` | Also delete `.gitmem/` data directory |
150
+ | `gitmem setup` | Output SQL for Supabase schema setup (Pro tier) |
151
+ | `gitmem configure` | Generate MCP config for your editor |
152
+ | `gitmem check` | Run diagnostic health check |
153
+ | `gitmem check --full` | Full diagnostic with benchmarks |
154
+ | `gitmem install-hooks` | Install Claude Code hooks (standalone) |
155
+ | `gitmem uninstall-hooks` | Remove Claude Code hooks (standalone) |
156
+ | `gitmem server` | Start MCP server (default when no command given) |
109
157
  | `gitmem help` | Show help |
110
158
 
111
159
  ## MCP Tools
112
160
 
113
- ### `predict`
114
-
115
- Check institutional memory for relevant learnings before taking action.
116
-
117
- **Parameters:**
118
- - `plan` (required) - What you're about to do (e.g., "deploy to production")
119
- - `project?` - Project scope (default: "orchestra_dev")
120
- - `match_count?` - Number of learnings to return (default: 3)
121
-
122
- ### `session_start`
123
-
124
- Initialize session and load institutional context.
125
-
126
- **Parameters:**
127
- - `agent_identity?` - Override agent identity (auto-detects if not provided)
128
- - `linear_issue?` - Current Linear issue identifier
129
- - `project?` - Project scope
161
+ GitMem exposes tools via the Model Context Protocol. Your AI agent calls these automatically based on the instructions in `CLAUDE.md`.
130
162
 
131
- ### `session_close`
163
+ ### Core Tools
132
164
 
133
- Persist session with compliance validation.
165
+ | Tool | Purpose |
166
+ |------|---------|
167
+ | `recall` | Check memory for relevant warnings before taking action |
168
+ | `session_start` | Initialize session, load context from last session |
169
+ | `session_close` | Persist session with reflection |
170
+ | `create_learning` | Capture scars (failures), wins (successes), or patterns |
171
+ | `create_decision` | Log architectural/operational decisions |
172
+ | `record_scar_usage` | Track which scars were applied |
173
+ | `search` | Search institutional memory (exploration, no side effects) |
174
+ | `log` | List recent learnings chronologically |
134
175
 
135
- **Parameters:**
136
- - `session_id` (required) - From session_start
137
- - `close_type` (required) - "standard" | "quick" | "autonomous"
138
- - `closing_reflection?` - Reflection answers (required for standard)
139
- - `human_corrections?` - Human additions (required for standard)
176
+ ### Thread Tools
140
177
 
141
- ### `create_learning`
178
+ Threads are persistent work items that carry across sessions.
142
179
 
143
- Create scar, win, or pattern entry.
180
+ | Tool | Purpose |
181
+ |------|---------|
182
+ | `list_threads` | List open threads |
183
+ | `create_thread` | Create a new thread |
184
+ | `resolve_thread` | Mark a thread as resolved |
144
185
 
145
- **Parameters:**
146
- - `learning_type` (required) - "scar" | "win" | "pattern"
147
- - `title`, `description` (required)
148
- - `severity?` - For scars: "critical" | "high" | "medium" | "low"
149
- - `counter_arguments?` - For scars: min 2 required
186
+ ### Pro Tier Tools
150
187
 
151
- ### `create_decision`
188
+ Available when Supabase is configured:
152
189
 
153
- Log decision to institutional memory.
190
+ | Tool | Purpose |
191
+ |------|---------|
192
+ | `analyze` | Session analytics and pattern detection |
193
+ | `prepare_context` | Multi-agent context preparation |
194
+ | `absorb_observations` | Multi-agent observation absorption |
195
+ | Cache tools | `cache_status`, `cache_flush`, `cache_health` |
154
196
 
155
- **Parameters:**
156
- - `title`, `decision`, `rationale` (required)
157
- - `alternatives_considered?` - Rejected options
158
- - `docs_affected?` - Docs/files affected by this decision (relative paths from repo root). Used for [doc-debt tracking](docs/doc-debt-tracking.md).
159
- - `personas_involved?` - Team personas involved
160
- - `linear_issue?` - Associated issue
197
+ ## Learning Types
161
198
 
162
- ### `record_scar_usage`
199
+ GitMem tracks four types of institutional knowledge:
163
200
 
164
- Track scar application.
201
+ - **Scars** — Failures to avoid. Include severity and counter-arguments (why someone might think the mistake is OK). These are the core of GitMem.
202
+ - **Wins** — Successes to replicate. Capture what worked and why.
203
+ - **Patterns** — Neutral observations and recurring approaches.
204
+ - **Anti-patterns** — Known bad approaches to flag.
165
205
 
166
- **Parameters:**
167
- - `scar_id` (required) - Learning UUID
168
- - `reference_type` (required) - "explicit" | "implicit" | "acknowledged" | "refuted" | "none"
169
- - `reference_context` (required) - How scar was applied
206
+ All types are searched together when `recall` is called, giving the agent comprehensive context.
170
207
 
171
- ### `list_threads`
208
+ ## Lifecycle Hooks
172
209
 
173
- List open threads (persistent work items across sessions). See [threads docs](docs/threads.md).
210
+ GitMem includes Claude Code hooks that automate memory protocols. These are installed automatically by `npx gitmem init`.
174
211
 
175
- **Parameters:**
176
- - `status?` - Filter: "open" (default) or "resolved"
177
- - `include_resolved?` - Include recently resolved threads
212
+ - **SessionStart** — Automatically calls `session_start` when a session begins
213
+ - **PreToolUse** Reminds the agent to call `recall` before consequential actions
214
+ - **PostToolUse** Tracks scar acknowledgment
215
+ - **Stop** — Reminds the agent to close sessions properly
178
216
 
179
- ### `create_thread`
180
-
181
- Create a new open thread.
182
-
183
- **Parameters:**
184
- - `text` (required) - Thread description
185
-
186
- ### `resolve_thread`
187
-
188
- Mark a thread as resolved.
189
-
190
- **Parameters:**
191
- - `thread_id?` - Exact thread ID (e.g., "t-a1b2c3d4")
192
- - `text_match?` - Case-insensitive substring match
193
- - `resolution_note?` - Brief resolution explanation
217
+ To install hooks standalone (without the full wizard):
218
+ ```bash
219
+ npx gitmem install-hooks
220
+ ```
194
221
 
195
222
  ## Agent Detection
196
223
 
197
- Automatically detects agent identity based on:
198
- - `CLAUDE_CODE_ENTRYPOINT` environment variable
199
- - Docker container presence (`/.dockerenv`)
200
- - Hostname
224
+ GitMem automatically detects the AI agent identity based on environment:
201
225
 
202
- | ENTRYPOINT | Docker | Identity |
203
- |------------|--------|----------|
204
- | cli | YES | CLI |
205
- | cli | NO | CODA-1 |
206
- | claude-desktop | NO | DAC |
207
- | (empty) | (has fs) | Brain_Local |
208
- | (empty) | (no fs) | Brain_Cloud |
226
+ | Environment | Identity |
227
+ |-------------|----------|
228
+ | Claude Code in Docker | CLI |
229
+ | Claude Desktop app | DAC |
230
+ | Claude.ai with filesystem | Brain_Local |
231
+ | Claude.ai without filesystem | Brain_Cloud |
232
+
233
+ Override with `agent_identity` parameter in `session_start`.
209
234
 
210
235
  ## Development
211
236
 
212
237
  ```bash
238
+ git clone https://github.com/nTEG-dev/gitmem.git
239
+ cd gitmem
213
240
  npm install
214
- npm run build
215
- npm run dev # Watch mode
216
- npm test
241
+ npm run build # Compile TypeScript + run unit tests
242
+ npm run dev # Watch mode
243
+ npm test # Run unit tests
217
244
  ```
218
245
 
246
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing tiers, and PR guidelines.
247
+
219
248
  ## License
220
249
 
221
- MIT
250
+ MIT — see [LICENSE](LICENSE).