git-memory 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +661 -0
  2. package/config/mcp_config_example.json +16 -0
  3. package/dist/chroma-index.d.ts +63 -0
  4. package/dist/chroma-index.d.ts.map +1 -0
  5. package/dist/chroma-index.js +166 -0
  6. package/dist/chroma-index.js.map +1 -0
  7. package/dist/cli.d.ts +3 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +311 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/context-store.d.ts +54 -0
  12. package/dist/context-store.d.ts.map +1 -0
  13. package/dist/context-store.js +187 -0
  14. package/dist/context-store.js.map +1 -0
  15. package/dist/embeddings.d.ts +10 -0
  16. package/dist/embeddings.d.ts.map +1 -0
  17. package/dist/embeddings.js +42 -0
  18. package/dist/embeddings.js.map +1 -0
  19. package/dist/filters.d.ts +70 -0
  20. package/dist/filters.d.ts.map +1 -0
  21. package/dist/filters.js +131 -0
  22. package/dist/filters.js.map +1 -0
  23. package/dist/index.d.ts +14 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +14 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/indexer.d.ts +45 -0
  28. package/dist/indexer.d.ts.map +1 -0
  29. package/dist/indexer.js +242 -0
  30. package/dist/indexer.js.map +1 -0
  31. package/dist/mcp-server.d.ts +8 -0
  32. package/dist/mcp-server.d.ts.map +1 -0
  33. package/dist/mcp-server.js +373 -0
  34. package/dist/mcp-server.js.map +1 -0
  35. package/dist/store.d.ts +17 -0
  36. package/dist/store.d.ts.map +1 -0
  37. package/dist/store.js +47 -0
  38. package/dist/store.js.map +1 -0
  39. package/dist/types.d.ts +59 -0
  40. package/dist/types.d.ts.map +1 -0
  41. package/dist/types.js +25 -0
  42. package/dist/types.js.map +1 -0
  43. package/dist/vector-store.d.ts +65 -0
  44. package/dist/vector-store.d.ts.map +1 -0
  45. package/dist/vector-store.js +152 -0
  46. package/dist/vector-store.js.map +1 -0
  47. package/package.json +52 -0
  48. package/skills/git-memory-debug/SKILL.md +99 -0
  49. package/skills/git-memory-index/SKILL.md +88 -0
  50. package/skills/git-memory-search/SKILL.md +92 -0
  51. package/skills/git-memory-status/SKILL.md +69 -0
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: git-memory-index
3
+ description: "Use when the user wants to index a repository into git-memory, start using git-memory on a new project, or re-index after significant history. Examples: \"index the lokumcu repo\", \"set up git memory for this project\", \"re-index everything\""
4
+ ---
5
+
6
+ # Index a Repository with git-memory
7
+
8
+ ## When to Use
9
+
10
+ - Starting git-memory on a new repository for the first time
11
+ - After a major history rewrite or large batch of commits
12
+ - User explicitly asks to (re-)index a project
13
+ - Setting up git-memory for a team member's repo
14
+
15
+ ## Workflow
16
+
17
+ ```
18
+ 1. Confirm the repo path with the user (default: current directory)
19
+ 2. Run a dry-run first to show what will be indexed
20
+ 3. Ask if the user wants to limit commit count (useful for very large repos)
21
+ 4. Run the real index
22
+ 5. Run git-memory install to register the MCP server
23
+ ```
24
+
25
+ ## Checklist
26
+
27
+ ```
28
+ - [ ] Confirmed repo path
29
+ - [ ] Ran dry-run to preview commit count and filter results
30
+ - [ ] Agreed on --limit if repo has >1000 commits
31
+ - [ ] Completed indexing with 0 errors
32
+ - [ ] MCP server registered in .claude.json
33
+ - [ ] Reminded user to restart Claude Code
34
+ ```
35
+
36
+ ## Commands
37
+
38
+ ### Dry run (preview what will be indexed)
39
+ ```bash
40
+ git-memory index \
41
+ --repo-path /path/to/repo \
42
+ --user-id my-repo-name \
43
+ --dry-run
44
+ ```
45
+
46
+ ### Full index
47
+ ```bash
48
+ git-memory index \
49
+ --repo-path /path/to/repo \
50
+ --user-id my-repo-name
51
+ # Add --limit 500 for large repos (indexes 500 newest commits)
52
+ ```
53
+
54
+ ### Install Claude Code plugin
55
+ ```bash
56
+ git-memory install \
57
+ --repo-path /path/to/repo \
58
+ --user-id my-repo-name
59
+ ```
60
+
61
+ ### Or from within the repo directory
62
+ ```bash
63
+ cd /path/to/repo
64
+ git-memory index --user-id my-repo-name
65
+ git-memory install --user-id my-repo-name
66
+ ```
67
+
68
+ ## Expected Output
69
+
70
+ ```
71
+ Found 42 commits to evaluate
72
+ Done. {"total_evaluated":42,"stored":39,"skipped_irrelevant":3,"skipped_duplicate":0,"errors":0}
73
+
74
+ ── Indexing Summary ─────────────────────────────
75
+ total_evaluated 42
76
+ stored 39
77
+ skipped_irrelevant 3
78
+ skipped_duplicate 0
79
+ errors 0
80
+ ```
81
+
82
+ ## Notes
83
+
84
+ - **Skipped irrelevant**: Commits with no signal keywords (e.g. "k", "wip", "merge") are skipped by design. This keeps the index signal-rich.
85
+ - **Deduplication**: Safe to run multiple times — ChromaDB deduplicates by commit hash.
86
+ - **Large repos**: For repos with >10k commits, use `--limit 1000` to index the most recent 1000.
87
+ - **user-id**: Use a distinct ID per repo so multiple repos can coexist in the same index.
88
+ - **Embed providers**: Defaults to Ollama (nomic-embed-text). Set GIT_MEMORY_EMBED_PROVIDER=openai for OpenAI or =fastembed for fully local (no Ollama needed).
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: git-memory-search
3
+ description: "Use when the user asks about why code was written a certain way, wants to find commits related to a bug, feature or module, or needs historical context before editing. Examples: \"why does the payment module use a state machine?\", \"what commits touched auth?\", \"find all discount-related bug fixes\""
4
+ ---
5
+
6
+ # Search Git History with git-memory
7
+
8
+ ## When to Use
9
+
10
+ - User asks *why* something was built a certain way
11
+ - User is about to edit a module and needs context
12
+ - User reports a bug that may have been fixed before
13
+ - User asks about a past decision, refactor, or migration
14
+ - You need to understand the evolution of a component
15
+
16
+ ## Workflow
17
+
18
+ ```
19
+ 1. Identify the topic/component from the user's question
20
+ 2. Call search_git_history(query, limit=8)
21
+ 3. If results are few, also call bug_fix_history(component)
22
+ 4. If the user mentions a specific file, call commits_touching_file(filename)
23
+ 5. Synthesise results into a clear narrative for the user
24
+ ```
25
+
26
+ ## Checklist
27
+
28
+ ```
29
+ - [ ] Called search_git_history with a descriptive query
30
+ - [ ] Applied category filter if user is looking for a specific type (fix, feat, security)
31
+ - [ ] Checked commits_touching_file if a specific file is involved
32
+ - [ ] Included commit hashes in the answer so user can run git show
33
+ - [ ] Noted the date range of relevant commits
34
+ ```
35
+
36
+ ## Tool Details
37
+
38
+ ### search_git_history
39
+ ```
40
+ search_git_history(
41
+ query="payment state machine race condition",
42
+ limit=8,
43
+ category="fix" // optional: fix | feat | security | refactor | migration | arch | perf
44
+ )
45
+ ```
46
+ Returns commits ranked by cosine similarity (0–1 score). Score > 0.7 = highly relevant.
47
+
48
+ ### commits_touching_file
49
+ ```
50
+ commits_touching_file(
51
+ filename="PaymentService.ts", // partial match supported
52
+ limit=10
53
+ )
54
+ ```
55
+ Returns all commits that modified the file, newest first, enriched with ChromaDB category.
56
+
57
+ ### bug_fix_history
58
+ ```
59
+ bug_fix_history(
60
+ component="payments",
61
+ limit=8,
62
+ include_security=true
63
+ )
64
+ ```
65
+ Returns fix/bug/hotfix/security commits for the component, ranked by relevance.
66
+
67
+ ### architecture_decisions
68
+ ```
69
+ architecture_decisions(
70
+ topic="state machine order transitions",
71
+ limit=5
72
+ )
73
+ ```
74
+ Returns refactor/migration/arch commits. Useful for "why is this designed this way?" questions.
75
+
76
+ ## Example
77
+
78
+ **User:** "Why does the payment flow go through a state machine?"
79
+
80
+ ```
81
+ 1. search_git_history("payment state machine order transitions", limit=5)
82
+ → [32c3389f] fix(payments): route 3DS callback through transitionStatus
83
+ score=0.633 — "Replace direct repository updates with transitionStatus
84
+ calls to enforce the allowed-transitions guard"
85
+
86
+ 2. commits_touching_file("PaymentService.ts", limit=5)
87
+ → [32c3389f] fix(payments): route 3DS callback...
88
+ → [599d531b] feat: add Garanti 3DS payments...
89
+
90
+ 3. Answer: "The state machine was introduced in commit 32c3389f to prevent
91
+ race conditions on 3DS callbacks."
92
+ ```
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: git-memory-status
3
+ description: "Use when the user wants to check what is indexed, how many commits are in memory, or whether git-memory is set up correctly. Examples: \"is git memory set up?\", \"how many commits are indexed?\", \"check git memory status\""
4
+ ---
5
+
6
+ # Check git-memory Status
7
+
8
+ ## When to Use
9
+
10
+ - User asks if git-memory is configured
11
+ - Before using search tools to confirm the index has data
12
+ - Troubleshooting empty search results
13
+ - After indexing to confirm it completed correctly
14
+
15
+ ## Workflow
16
+
17
+ ```
18
+ 1. Run status command to check ChromaDB commit count
19
+ 2. Check if MCP server is configured in .claude.json
20
+ 3. Check embed provider availability
21
+ 4. Report findings and any gaps
22
+ ```
23
+
24
+ ## Checklist
25
+
26
+ ```
27
+ - [ ] ChromaDB has > 0 commits indexed
28
+ - [ ] git-memory MCP server is in .claude.json
29
+ - [ ] user-id matches between index and MCP server config
30
+ - [ ] Embed provider is available (Ollama running / OPENAI_API_KEY set)
31
+ ```
32
+
33
+ ## Commands
34
+
35
+ ### Check index size
36
+ ```bash
37
+ git-memory status --repo-path /path/to/repo
38
+ ```
39
+
40
+ ### Check MCP config
41
+ ```bash
42
+ cat .claude.json | python3 -m json.tool | grep -A8 "git-memory"
43
+ ```
44
+
45
+ ### Check Ollama is running (required for default mode)
46
+ ```bash
47
+ curl -s http://localhost:11434/api/tags
48
+ ```
49
+
50
+ ## Healthy Status Example
51
+
52
+ ```
53
+ ── git-memory status ──────────────────────────
54
+ Repo : myproject
55
+ Chroma docs : 39 (this repo) / 39 (all repos)
56
+ Total commits : 42
57
+ Coverage : 93%
58
+ Embed provider: ollama
59
+ ```
60
+
61
+ ## Common Issues
62
+
63
+ | Symptom | Fix |
64
+ |---------|-----|
65
+ | `0 commits indexed` | Run `git-memory index --repo-path .` |
66
+ | MCP tools return errors | Check Ollama is running: `ollama serve` |
67
+ | Wrong user-id | Must match `GIT_MEMORY_USER_ID` in MCP config |
68
+ | Chroma path conflict | Ensure `GIT_MEMORY_CHROMA_DIR` points to `chroma_commits/` |
69
+ | No LLM context (Layer 2) | Normal without Ollama — Layer 1 (ChromaDB) still works |