repomemory 0.1.0 → 0.2.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 (62) hide show
  1. package/README.md +151 -104
  2. package/dist/commands/analyze.d.ts +2 -0
  3. package/dist/commands/analyze.d.ts.map +1 -1
  4. package/dist/commands/analyze.js +162 -188
  5. package/dist/commands/analyze.js.map +1 -1
  6. package/dist/commands/dashboard.d.ts +5 -0
  7. package/dist/commands/dashboard.d.ts.map +1 -0
  8. package/dist/commands/dashboard.js +520 -0
  9. package/dist/commands/dashboard.js.map +1 -0
  10. package/dist/commands/init.d.ts.map +1 -1
  11. package/dist/commands/init.js +33 -34
  12. package/dist/commands/init.js.map +1 -1
  13. package/dist/commands/serve.d.ts.map +1 -1
  14. package/dist/commands/serve.js +2 -1
  15. package/dist/commands/serve.js.map +1 -1
  16. package/dist/commands/setup.d.ts.map +1 -1
  17. package/dist/commands/setup.js +151 -35
  18. package/dist/commands/setup.js.map +1 -1
  19. package/dist/commands/status.d.ts +4 -0
  20. package/dist/commands/status.d.ts.map +1 -0
  21. package/dist/commands/status.js +87 -0
  22. package/dist/commands/status.js.map +1 -0
  23. package/dist/commands/sync.d.ts.map +1 -1
  24. package/dist/commands/sync.js +57 -27
  25. package/dist/commands/sync.js.map +1 -1
  26. package/dist/commands/wizard.d.ts +4 -0
  27. package/dist/commands/wizard.d.ts.map +1 -0
  28. package/dist/commands/wizard.js +184 -0
  29. package/dist/commands/wizard.js.map +1 -0
  30. package/dist/index.js +37 -42
  31. package/dist/index.js.map +1 -1
  32. package/dist/lib/ai-provider.d.ts +11 -0
  33. package/dist/lib/ai-provider.d.ts.map +1 -1
  34. package/dist/lib/ai-provider.js +138 -69
  35. package/dist/lib/ai-provider.js.map +1 -1
  36. package/dist/lib/config.d.ts +11 -15
  37. package/dist/lib/config.d.ts.map +1 -1
  38. package/dist/lib/config.js +33 -21
  39. package/dist/lib/config.js.map +1 -1
  40. package/dist/lib/context-store.d.ts +11 -0
  41. package/dist/lib/context-store.d.ts.map +1 -1
  42. package/dist/lib/context-store.js +51 -18
  43. package/dist/lib/context-store.js.map +1 -1
  44. package/dist/lib/git.d.ts +1 -0
  45. package/dist/lib/git.d.ts.map +1 -1
  46. package/dist/lib/git.js +34 -20
  47. package/dist/lib/git.js.map +1 -1
  48. package/dist/lib/json-repair.d.ts +24 -0
  49. package/dist/lib/json-repair.d.ts.map +1 -0
  50. package/dist/lib/json-repair.js +140 -0
  51. package/dist/lib/json-repair.js.map +1 -0
  52. package/dist/lib/repo-scanner.d.ts.map +1 -1
  53. package/dist/lib/repo-scanner.js +103 -26
  54. package/dist/lib/repo-scanner.js.map +1 -1
  55. package/dist/lib/search.d.ts +10 -4
  56. package/dist/lib/search.d.ts.map +1 -1
  57. package/dist/lib/search.js +136 -51
  58. package/dist/lib/search.js.map +1 -1
  59. package/dist/mcp/server.d.ts.map +1 -1
  60. package/dist/mcp/server.js +128 -54
  61. package/dist/mcp/server.js.map +1 -1
  62. package/package.json +20 -8
package/README.md CHANGED
@@ -1,14 +1,21 @@
1
+ <div align="center">
2
+
1
3
  # repomemory
2
4
 
3
- **Your repo remembers what every AI session learned.**
5
+ **Your codebase never forgets.**
4
6
 
5
- Persistent, structured memory for AI coding agents. Stop wasting the first 10 minutes of every session re-discovering your architecture.
7
+ AI agents lose context every session. repomemory fixes that.
8
+ One command analyzes your repo and creates a persistent knowledge base that any AI tool can search, read, and write to.
6
9
 
7
- ```
8
- npx repomemory init && npx repomemory analyze
10
+ [![npm version](https://img.shields.io/npm/v/repomemory.svg)](https://www.npmjs.com/package/repomemory)
11
+ [![license](https://img.shields.io/npm/l/repomemory.svg)](https://github.com/DanielGuru/repomemory/blob/main/LICENSE)
12
+ [![CI](https://github.com/DanielGuru/repomemory/actions/workflows/ci.yml/badge.svg)](https://github.com/DanielGuru/repomemory/actions)
13
+
14
+ ```bash
15
+ npx repomemory wizard
9
16
  ```
10
17
 
11
- That's it. Your repo now has a `.context/` directory with AI-generated knowledge that persists across sessions.
18
+ </div>
12
19
 
13
20
  ---
14
21
 
@@ -21,11 +28,11 @@ Every time you open a project with Claude Code, Cursor, Copilot, or any AI codin
21
28
  - It proposes changes that were already debated and rejected
22
29
  - It re-introduces bugs that were already fixed
23
30
 
24
- Your CLAUDE.md / .cursorrules helps, but it's a static file you manually maintain. It gets stale. It loads everything whether relevant or not.
31
+ Your CLAUDE.md / .cursorrules helps, but it's static and manually maintained. It gets stale.
25
32
 
26
33
  ## The Solution
27
34
 
28
- `repomemory` creates a structured knowledge base that AI agents can search, read, and **write to** during sessions:
35
+ repomemory creates a structured, searchable knowledge base that AI agents can **search, read, and write to** during sessions:
29
36
 
30
37
  ```
31
38
  .context/
@@ -48,70 +55,58 @@ Your CLAUDE.md / .cursorrules helps, but it's a static file you manually maintai
48
55
 
49
56
  ## Quick Start
50
57
 
51
- ### 1. Install and Initialize
52
-
53
- ```bash
54
- npx repomemory init
55
- ```
56
-
57
- ### 2. Set Your API Key
58
-
59
- ```bash
60
- # Pick one:
61
- export ANTHROPIC_API_KEY=sk-ant-... # Claude (recommended)
62
- export OPENAI_API_KEY=sk-... # GPT-4o
63
- export GEMINI_API_KEY=... # Gemini
64
- export GROK_API_KEY=... # Grok
65
- ```
66
-
67
- ### 3. Analyze Your Repo
58
+ ### Interactive Setup (Recommended)
68
59
 
69
60
  ```bash
70
- npx repomemory analyze
61
+ npx repomemory wizard
71
62
  ```
72
63
 
73
- This scans your entire codebase file structure, key configs, database schemas, git history and uses AI to generate structured knowledge files. Takes 2-5 minutes depending on repo size.
64
+ The wizard walks you through provider selection, tool integration, and first analysisall in one beautiful flow.
74
65
 
75
- ### 4. Connect to Your AI Tool
66
+ ### Manual Setup
76
67
 
77
68
  ```bash
78
- # Claude Code
79
- npx repomemory setup claude
80
-
81
- # Cursor
82
- npx repomemory setup cursor
69
+ # 1. Initialize
70
+ npx repomemory init
83
71
 
84
- # GitHub Copilot
85
- npx repomemory setup copilot
86
- ```
72
+ # 2. Set your API key
73
+ export ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY, GEMINI_API_KEY, GROK_API_KEY
87
74
 
88
- ### 5. Commit to Git
75
+ # 3. Analyze your repo (2-5 min, uses AI)
76
+ npx repomemory analyze
89
77
 
90
- ```bash
91
- git add .context/
92
- git commit -m "Add repomemory knowledge base"
78
+ # 4. Connect to your AI tool
79
+ npx repomemory setup claude # Claude Code (MCP server auto-starts)
80
+ npx repomemory setup cursor # Cursor
81
+ npx repomemory setup copilot # GitHub Copilot
82
+ npx repomemory setup windsurf # Windsurf
83
+ npx repomemory setup cline # Cline
84
+ npx repomemory setup aider # Aider
85
+ npx repomemory setup continue # Continue
86
+
87
+ # 5. Commit to git — your team shares the knowledge
88
+ git add .context/ && git commit -m "Add repomemory knowledge base"
93
89
  ```
94
90
 
95
- Your entire team now shares the knowledge.
91
+ ## Features
96
92
 
97
- ## MCP Server
93
+ ### MCP Server — AI Agents With Memory
98
94
 
99
- The real power is the MCP server, which gives AI agents tools to **search and write** context:
95
+ The real power is the MCP server. It gives AI agents tools to search, read, write, and delete context:
100
96
 
101
97
  ```bash
102
98
  npx repomemory serve
103
99
  ```
104
100
 
105
- ### Tools Exposed
106
-
107
101
  | Tool | What It Does |
108
102
  |------|-------------|
109
- | `context_search` | Search the knowledge base by natural language query |
110
- | `context_write` | Write new knowledge (facts, decisions, regressions, session notes) |
111
- | `context_list` | Browse all entries by category |
103
+ | `context_search` | Full-text search across all knowledge |
104
+ | `context_write` | Write new facts, decisions, regressions, session notes |
112
105
  | `context_read` | Read a specific context file |
106
+ | `context_list` | Browse all entries by category |
107
+ | `context_delete` | Remove stale or incorrect knowledge |
113
108
 
114
- When configured via `repomemory setup claude`, the MCP server auto-starts with Claude Code. Your agent can:
109
+ When configured via `repomemory setup claude`, the MCP server auto-starts with Claude Code:
115
110
 
116
111
  ```
117
112
  Agent: "Let me search for context about the authentication flow..."
@@ -123,81 +118,128 @@ Agent: "I discovered a race condition in token refresh. Let me record this."
123
118
  → Persisted. Next session will find it.
124
119
  ```
125
120
 
126
- ## Configuration
121
+ ### Web Dashboard
127
122
 
128
- Create `.repomemory.json` in your repo root:
123
+ Browse and search your context files in a beautiful local web UI:
129
124
 
130
- ```json
131
- {
132
- "provider": "anthropic",
133
- "model": "claude-sonnet-4-5-20250929",
134
- "contextDir": ".context",
135
- "maxFilesForAnalysis": 80,
136
- "maxGitCommits": 100,
137
- "autoIndex": true,
138
- "ignorePatterns": [],
139
- "keyFilePatterns": []
140
- }
125
+ ```bash
126
+ npx repomemory dashboard
127
+ ```
128
+
129
+ Opens `http://localhost:3333` with category filtering, full-text search, and file previews.
130
+
131
+ ### Smart Analysis
132
+
133
+ ```bash
134
+ # Full analysis
135
+ npx repomemory analyze
136
+
137
+ # Preview what would happen (no API call)
138
+ npx repomemory analyze --dry-run
139
+
140
+ # Update without overwriting your manual edits
141
+ npx repomemory analyze --merge
142
+
143
+ # Use a different provider or model
144
+ npx repomemory analyze --provider openai --model gpt-4o
145
+ ```
146
+
147
+ Features:
148
+ - Cost estimation before running
149
+ - API key validation before expensive calls
150
+ - Retry with exponential backoff on failures
151
+ - Coverage report showing facts/decisions/regressions
152
+ - Merge mode that preserves manual edits
153
+
154
+ ### Git Sync
155
+
156
+ ```bash
157
+ npx repomemory sync
158
+ ```
159
+
160
+ Syncs recent git commits to `changelog/YYYY-MM.md` with smart deduplication.
161
+
162
+ ### Status & Coverage
163
+
164
+ ```bash
165
+ npx repomemory status
141
166
  ```
142
167
 
143
- ### Supported Providers
168
+ Shows coverage bars, freshness indicators, stale file warnings, and suggestions.
169
+
170
+ ## Supported Providers
144
171
 
145
172
  | Provider | Models | Env Variable |
146
173
  |----------|--------|-------------|
147
- | `anthropic` | claude-sonnet-4-5-20250929, claude-opus-4-6 | `ANTHROPIC_API_KEY` |
174
+ | `anthropic` | claude-sonnet-4-5, claude-opus-4-6 | `ANTHROPIC_API_KEY` |
148
175
  | `openai` | gpt-4o, o3-mini | `OPENAI_API_KEY` |
149
- | `gemini` | gemini-2.0-flash, gemini-2.5-pro | `GEMINI_API_KEY` |
150
- | `grok` | grok-3, grok-3-mini | `GROK_API_KEY` |
176
+ | `gemini` | gemini-2.0-flash, gemini-2.5-pro | `GEMINI_API_KEY` / `GOOGLE_API_KEY` |
177
+ | `grok` | grok-3, grok-3-mini | `GROK_API_KEY` / `XAI_API_KEY` |
151
178
 
152
- ## Commands
179
+ ## Supported AI Tools
180
+
181
+ | Tool | Integration | Command |
182
+ |------|------------|---------|
183
+ | **Claude Code** | MCP server (auto-starts) | `repomemory setup claude` |
184
+ | **Cursor** | .cursor/rules/ | `repomemory setup cursor` |
185
+ | **GitHub Copilot** | copilot-instructions.md | `repomemory setup copilot` |
186
+ | **Windsurf** | .windsurfrules | `repomemory setup windsurf` |
187
+ | **Cline** | .clinerules | `repomemory setup cline` |
188
+ | **Aider** | .aider.conf.yml | `repomemory setup aider` |
189
+ | **Continue** | .continue/rules/ | `repomemory setup continue` |
190
+
191
+ ## All Commands
153
192
 
154
193
  | Command | Description |
155
194
  |---------|-------------|
195
+ | `repomemory wizard` | Interactive guided setup (recommended for first use) |
156
196
  | `repomemory init` | Scaffold `.context/` directory |
157
- | `repomemory analyze` | AI-powered repo analysis (generates all context files) |
158
- | `repomemory sync` | Sync recent git history to `changelog/` |
159
- | `repomemory serve` | Start MCP server for AI agent integration |
160
- | `repomemory setup <tool>` | Configure Claude Code, Cursor, or Copilot |
161
- | `repomemory status` | Show current context state |
162
-
163
- ### Options
197
+ | `repomemory analyze` | AI-powered repo analysis |
198
+ | `repomemory analyze --dry-run` | Preview analysis without API call |
199
+ | `repomemory analyze --merge` | Update without overwriting edits |
200
+ | `repomemory sync` | Sync git history to changelog |
201
+ | `repomemory serve` | Start MCP server |
202
+ | `repomemory setup <tool>` | Configure AI tool integration |
203
+ | `repomemory status` | Show context coverage and freshness |
204
+ | `repomemory dashboard` | Open web dashboard |
164
205
 
165
- ```bash
166
- # Use a specific provider
167
- repomemory analyze --provider openai --model gpt-4o
206
+ ## Configuration
168
207
 
169
- # Analyze a different directory
170
- repomemory analyze --dir /path/to/repo
208
+ Create `.repomemory.json` in your repo root:
171
209
 
172
- # Verbose output
173
- repomemory analyze --verbose
210
+ ```json
211
+ {
212
+ "provider": "anthropic",
213
+ "model": "claude-sonnet-4-5-20250929",
214
+ "contextDir": ".context",
215
+ "maxFilesForAnalysis": 80,
216
+ "maxGitCommits": 100,
217
+ "ignorePatterns": [],
218
+ "keyFilePatterns": []
219
+ }
174
220
  ```
175
221
 
222
+ Custom `ignorePatterns` and `keyFilePatterns` are **additive** — they extend the built-in defaults, not replace them.
223
+
176
224
  ## How It Works
177
225
 
178
- ### Initial Analysis (`analyze`)
226
+ ### Initial Analysis
179
227
 
180
- 1. **Scans** your repo structure — files, directories, languages, frameworks
181
- 2. **Reads** key files — package.json, configs, schemas, READMEs, existing CLAUDE.md
182
- 3. **Mines** git history — commits, contributors, change patterns, activity
183
- 4. **Sends** everything to your chosen AI model with a structured analysis prompt
184
- 5. **Writes** organized knowledge to `.context/` facts, decisions, regressions
185
- 6. **Indexes** all files for full-text search via the MCP server
228
+ 1. **Scans** your repo — files, directories, languages, frameworks
229
+ 2. **Reads** key files — package.json, configs, schemas, READMEs, CLAUDE.md
230
+ 3. **Mines** git history — commits, contributors, change patterns
231
+ 4. **Respects** .gitignore won't scan ignored files
232
+ 5. **Sends** everything to your AI model with a structured analysis prompt
233
+ 6. **Writes** organized knowledge to `.context/`
234
+ 7. **Indexes** all files for FTS5 full-text search
186
235
 
187
236
  ### During Sessions (MCP Server)
188
237
 
189
238
  - Agent searches for relevant context at task start
190
239
  - Agent writes discoveries, decisions, and gotchas during work
240
+ - Agent can delete stale or incorrect knowledge
191
241
  - Knowledge accumulates session over session
192
- - Next agent session has access to everything previous sessions learned
193
-
194
- ### Git Sync (`sync`)
195
-
196
- ```bash
197
- repomemory sync
198
- ```
199
-
200
- Reads recent git commits and writes them to `changelog/YYYY-MM.md`. Run periodically or as a post-merge hook.
242
+ - Next session starts with everything previous sessions learned
201
243
 
202
244
  ## Why Not Just Use CLAUDE.md?
203
245
 
@@ -205,18 +247,17 @@ Reads recent git commits and writes them to `changelog/YYYY-MM.md`. Run periodic
205
247
  |--|-----------|-------------|
206
248
  | **Maintenance** | Manual | AI-generated + agent-maintained |
207
249
  | **Search** | Load everything | FTS5 search, return only relevant |
208
- | **Cross-tool** | Claude Code only | Claude, Cursor, Copilot, any MCP client |
250
+ | **Cross-tool** | Claude Code only | 7 AI tools supported |
209
251
  | **Team knowledge** | One person writes | Every AI session contributes |
210
- | **Decisions** | Mixed in with instructions | Structured, searchable, prevents re-debating |
211
- | **Regressions** | Not tracked | Explicit files preventing repeat bugs |
252
+ | **Decisions** | Mixed in with instructions | Structured, searchable |
253
+ | **Regressions** | Not tracked | Prevents repeat bugs |
254
+ | **Freshness** | Unknown | Staleness detection + warnings |
212
255
 
213
- `repomemory` doesn't replace CLAUDE.md — it complements it. Your CLAUDE.md stays for instructions and rules. `.context/` holds the knowledge that grows over time.
256
+ repomemory doesn't replace CLAUDE.md — it complements it. Your CLAUDE.md stays for instructions and rules. `.context/` holds the knowledge that grows over time.
214
257
 
215
- ## Inspired By
258
+ ## Contributing
216
259
 
217
- - **[OpenClaw](https://github.com/openclaw/openclaw)** The memory architecture (tiers, temporal decay, hybrid search) inspired this project. OpenClaw remembers *you*. repomemory remembers *your codebase*.
218
- - **[Aider](https://aider.chat/)** — Repo maps and convention files showed the value of structured context.
219
- - **Context Engineering** — The emerging discipline of curating what AI models see for better outcomes.
260
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for development setup, testing, and contribution guidelines.
220
261
 
221
262
  ## License
222
263
 
@@ -224,4 +265,10 @@ MIT
224
265
 
225
266
  ---
226
267
 
268
+ <div align="center">
269
+
227
270
  **Built for developers who are tired of AI agents forgetting everything between sessions.**
271
+
272
+ [Report Bug](https://github.com/DanielGuru/repomemory/issues) · [Request Feature](https://github.com/DanielGuru/repomemory/issues) · [npm](https://www.npmjs.com/package/repomemory)
273
+
274
+ </div>
@@ -3,5 +3,7 @@ export declare function analyzeCommand(options: {
3
3
  provider?: string;
4
4
  model?: string;
5
5
  verbose?: boolean;
6
+ dryRun?: boolean;
7
+ merge?: boolean;
6
8
  }): Promise<void>;
7
9
  //# sourceMappingURL=analyze.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AAyOA,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,iBAiJA"}
1
+ {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AA2EA,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,iBAuPA"}