vemora 0.1.0-alpha.8

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/README.md +716 -0
  2. package/dist/cli.d.ts +16 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +589 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/ask.d.ts +14 -0
  7. package/dist/commands/ask.d.ts.map +1 -0
  8. package/dist/commands/ask.js +136 -0
  9. package/dist/commands/ask.js.map +1 -0
  10. package/dist/commands/audit.d.ts +17 -0
  11. package/dist/commands/audit.d.ts.map +1 -0
  12. package/dist/commands/audit.js +408 -0
  13. package/dist/commands/audit.js.map +1 -0
  14. package/dist/commands/brief.d.ts +14 -0
  15. package/dist/commands/brief.d.ts.map +1 -0
  16. package/dist/commands/brief.js +73 -0
  17. package/dist/commands/brief.js.map +1 -0
  18. package/dist/commands/chat.d.ts +7 -0
  19. package/dist/commands/chat.d.ts.map +1 -0
  20. package/dist/commands/chat.js +161 -0
  21. package/dist/commands/chat.js.map +1 -0
  22. package/dist/commands/context.d.ts +61 -0
  23. package/dist/commands/context.d.ts.map +1 -0
  24. package/dist/commands/context.js +778 -0
  25. package/dist/commands/context.js.map +1 -0
  26. package/dist/commands/deps.d.ts +20 -0
  27. package/dist/commands/deps.d.ts.map +1 -0
  28. package/dist/commands/deps.js +138 -0
  29. package/dist/commands/deps.js.map +1 -0
  30. package/dist/commands/focus.d.ts +6 -0
  31. package/dist/commands/focus.d.ts.map +1 -0
  32. package/dist/commands/focus.js +302 -0
  33. package/dist/commands/focus.js.map +1 -0
  34. package/dist/commands/index.d.ts +10 -0
  35. package/dist/commands/index.d.ts.map +1 -0
  36. package/dist/commands/index.js +366 -0
  37. package/dist/commands/index.js.map +1 -0
  38. package/dist/commands/init-agent.d.ts +23 -0
  39. package/dist/commands/init-agent.d.ts.map +1 -0
  40. package/dist/commands/init-agent.js +447 -0
  41. package/dist/commands/init-agent.js.map +1 -0
  42. package/dist/commands/init.d.ts +2 -0
  43. package/dist/commands/init.d.ts.map +1 -0
  44. package/dist/commands/init.js +122 -0
  45. package/dist/commands/init.js.map +1 -0
  46. package/dist/commands/knowledge.d.ts +8 -0
  47. package/dist/commands/knowledge.d.ts.map +1 -0
  48. package/dist/commands/knowledge.js +98 -0
  49. package/dist/commands/knowledge.js.map +1 -0
  50. package/dist/commands/plan.d.ts +16 -0
  51. package/dist/commands/plan.d.ts.map +1 -0
  52. package/dist/commands/plan.js +535 -0
  53. package/dist/commands/plan.js.map +1 -0
  54. package/dist/commands/query.d.ts +39 -0
  55. package/dist/commands/query.d.ts.map +1 -0
  56. package/dist/commands/query.js +389 -0
  57. package/dist/commands/query.js.map +1 -0
  58. package/dist/commands/remember.d.ts +11 -0
  59. package/dist/commands/remember.d.ts.map +1 -0
  60. package/dist/commands/remember.js +174 -0
  61. package/dist/commands/remember.js.map +1 -0
  62. package/dist/commands/report.d.ts +10 -0
  63. package/dist/commands/report.d.ts.map +1 -0
  64. package/dist/commands/report.js +180 -0
  65. package/dist/commands/report.js.map +1 -0
  66. package/dist/commands/status.d.ts +2 -0
  67. package/dist/commands/status.d.ts.map +1 -0
  68. package/dist/commands/status.js +127 -0
  69. package/dist/commands/status.js.map +1 -0
  70. package/dist/commands/summarize.d.ts +14 -0
  71. package/dist/commands/summarize.d.ts.map +1 -0
  72. package/dist/commands/summarize.js +205 -0
  73. package/dist/commands/summarize.js.map +1 -0
  74. package/dist/commands/triage.d.ts +33 -0
  75. package/dist/commands/triage.d.ts.map +1 -0
  76. package/dist/commands/triage.js +419 -0
  77. package/dist/commands/triage.js.map +1 -0
  78. package/dist/commands/usages.d.ts +14 -0
  79. package/dist/commands/usages.d.ts.map +1 -0
  80. package/dist/commands/usages.js +236 -0
  81. package/dist/commands/usages.js.map +1 -0
  82. package/dist/core/config.d.ts +35 -0
  83. package/dist/core/config.d.ts.map +1 -0
  84. package/dist/core/config.js +140 -0
  85. package/dist/core/config.js.map +1 -0
  86. package/dist/core/types.d.ts +251 -0
  87. package/dist/core/types.d.ts.map +1 -0
  88. package/dist/core/types.js +4 -0
  89. package/dist/core/types.js.map +1 -0
  90. package/dist/embeddings/factory.d.ts +9 -0
  91. package/dist/embeddings/factory.d.ts.map +1 -0
  92. package/dist/embeddings/factory.js +26 -0
  93. package/dist/embeddings/factory.js.map +1 -0
  94. package/dist/embeddings/noop.d.ts +17 -0
  95. package/dist/embeddings/noop.d.ts.map +1 -0
  96. package/dist/embeddings/noop.js +22 -0
  97. package/dist/embeddings/noop.js.map +1 -0
  98. package/dist/embeddings/ollama.d.ts +16 -0
  99. package/dist/embeddings/ollama.d.ts.map +1 -0
  100. package/dist/embeddings/ollama.js +41 -0
  101. package/dist/embeddings/ollama.js.map +1 -0
  102. package/dist/embeddings/openai.d.ts +10 -0
  103. package/dist/embeddings/openai.d.ts.map +1 -0
  104. package/dist/embeddings/openai.js +67 -0
  105. package/dist/embeddings/openai.js.map +1 -0
  106. package/dist/embeddings/provider.d.ts +19 -0
  107. package/dist/embeddings/provider.d.ts.map +1 -0
  108. package/dist/embeddings/provider.js +3 -0
  109. package/dist/embeddings/provider.js.map +1 -0
  110. package/dist/indexer/callgraph.d.ts +16 -0
  111. package/dist/indexer/callgraph.d.ts.map +1 -0
  112. package/dist/indexer/callgraph.js +154 -0
  113. package/dist/indexer/callgraph.js.map +1 -0
  114. package/dist/indexer/chunkBySlidingWindow.d.ts +6 -0
  115. package/dist/indexer/chunkBySlidingWindow.d.ts.map +1 -0
  116. package/dist/indexer/chunkBySlidingWindow.js +30 -0
  117. package/dist/indexer/chunkBySlidingWindow.js.map +1 -0
  118. package/dist/indexer/chunkBySymbols.d.ts +7 -0
  119. package/dist/indexer/chunkBySymbols.d.ts.map +1 -0
  120. package/dist/indexer/chunkBySymbols.js +57 -0
  121. package/dist/indexer/chunkBySymbols.js.map +1 -0
  122. package/dist/indexer/chunker.d.ts +15 -0
  123. package/dist/indexer/chunker.d.ts.map +1 -0
  124. package/dist/indexer/chunker.js +26 -0
  125. package/dist/indexer/chunker.js.map +1 -0
  126. package/dist/indexer/classHeader.d.ts +7 -0
  127. package/dist/indexer/classHeader.d.ts.map +1 -0
  128. package/dist/indexer/classHeader.js +37 -0
  129. package/dist/indexer/classHeader.js.map +1 -0
  130. package/dist/indexer/deps.d.ts +66 -0
  131. package/dist/indexer/deps.d.ts.map +1 -0
  132. package/dist/indexer/deps.js +409 -0
  133. package/dist/indexer/deps.js.map +1 -0
  134. package/dist/indexer/hasher.d.ts +17 -0
  135. package/dist/indexer/hasher.d.ts.map +1 -0
  136. package/dist/indexer/hasher.js +38 -0
  137. package/dist/indexer/hasher.js.map +1 -0
  138. package/dist/indexer/parser.d.ts +18 -0
  139. package/dist/indexer/parser.d.ts.map +1 -0
  140. package/dist/indexer/parser.js +355 -0
  141. package/dist/indexer/parser.js.map +1 -0
  142. package/dist/indexer/scanner.d.ts +18 -0
  143. package/dist/indexer/scanner.d.ts.map +1 -0
  144. package/dist/indexer/scanner.js +37 -0
  145. package/dist/indexer/scanner.js.map +1 -0
  146. package/dist/indexer/strategy.d.ts +11 -0
  147. package/dist/indexer/strategy.d.ts.map +1 -0
  148. package/dist/indexer/strategy.js +15 -0
  149. package/dist/indexer/strategy.js.map +1 -0
  150. package/dist/indexer/tests.d.ts +15 -0
  151. package/dist/indexer/tests.d.ts.map +1 -0
  152. package/dist/indexer/tests.js +68 -0
  153. package/dist/indexer/tests.js.map +1 -0
  154. package/dist/indexer/todos.d.ts +9 -0
  155. package/dist/indexer/todos.d.ts.map +1 -0
  156. package/dist/indexer/todos.js +29 -0
  157. package/dist/indexer/todos.js.map +1 -0
  158. package/dist/llm/anthropic.d.ts +8 -0
  159. package/dist/llm/anthropic.d.ts.map +1 -0
  160. package/dist/llm/anthropic.js +76 -0
  161. package/dist/llm/anthropic.js.map +1 -0
  162. package/dist/llm/factory.d.ts +7 -0
  163. package/dist/llm/factory.d.ts.map +1 -0
  164. package/dist/llm/factory.js +39 -0
  165. package/dist/llm/factory.js.map +1 -0
  166. package/dist/llm/ollama.d.ts +8 -0
  167. package/dist/llm/ollama.d.ts.map +1 -0
  168. package/dist/llm/ollama.js +83 -0
  169. package/dist/llm/ollama.js.map +1 -0
  170. package/dist/llm/openai.d.ts +8 -0
  171. package/dist/llm/openai.d.ts.map +1 -0
  172. package/dist/llm/openai.js +68 -0
  173. package/dist/llm/openai.js.map +1 -0
  174. package/dist/llm/provider.d.ts +29 -0
  175. package/dist/llm/provider.d.ts.map +1 -0
  176. package/dist/llm/provider.js +3 -0
  177. package/dist/llm/provider.js.map +1 -0
  178. package/dist/search/bm25.d.ts +3 -0
  179. package/dist/search/bm25.d.ts.map +1 -0
  180. package/dist/search/bm25.js +102 -0
  181. package/dist/search/bm25.js.map +1 -0
  182. package/dist/search/formatter.d.ts +43 -0
  183. package/dist/search/formatter.d.ts.map +1 -0
  184. package/dist/search/formatter.js +208 -0
  185. package/dist/search/formatter.js.map +1 -0
  186. package/dist/search/hybrid.d.ts +10 -0
  187. package/dist/search/hybrid.d.ts.map +1 -0
  188. package/dist/search/hybrid.js +53 -0
  189. package/dist/search/hybrid.js.map +1 -0
  190. package/dist/search/merge.d.ts +33 -0
  191. package/dist/search/merge.d.ts.map +1 -0
  192. package/dist/search/merge.js +158 -0
  193. package/dist/search/merge.js.map +1 -0
  194. package/dist/search/mmr.d.ts +23 -0
  195. package/dist/search/mmr.d.ts.map +1 -0
  196. package/dist/search/mmr.js +95 -0
  197. package/dist/search/mmr.js.map +1 -0
  198. package/dist/search/rerank.d.ts +15 -0
  199. package/dist/search/rerank.d.ts.map +1 -0
  200. package/dist/search/rerank.js +76 -0
  201. package/dist/search/rerank.js.map +1 -0
  202. package/dist/search/signature.d.ts +42 -0
  203. package/dist/search/signature.d.ts.map +1 -0
  204. package/dist/search/signature.js +112 -0
  205. package/dist/search/signature.js.map +1 -0
  206. package/dist/search/vector.d.ts +41 -0
  207. package/dist/search/vector.d.ts.map +1 -0
  208. package/dist/search/vector.js +185 -0
  209. package/dist/search/vector.js.map +1 -0
  210. package/dist/storage/cache.d.ts +30 -0
  211. package/dist/storage/cache.d.ts.map +1 -0
  212. package/dist/storage/cache.js +160 -0
  213. package/dist/storage/cache.js.map +1 -0
  214. package/dist/storage/knowledge.d.ts +17 -0
  215. package/dist/storage/knowledge.d.ts.map +1 -0
  216. package/dist/storage/knowledge.js +58 -0
  217. package/dist/storage/knowledge.js.map +1 -0
  218. package/dist/storage/repository.d.ts +27 -0
  219. package/dist/storage/repository.d.ts.map +1 -0
  220. package/dist/storage/repository.js +95 -0
  221. package/dist/storage/repository.js.map +1 -0
  222. package/dist/storage/session.d.ts +38 -0
  223. package/dist/storage/session.d.ts.map +1 -0
  224. package/dist/storage/session.js +100 -0
  225. package/dist/storage/session.js.map +1 -0
  226. package/dist/storage/summaries.d.ts +19 -0
  227. package/dist/storage/summaries.d.ts.map +1 -0
  228. package/dist/storage/summaries.js +66 -0
  229. package/dist/storage/summaries.js.map +1 -0
  230. package/dist/storage/usage.d.ts +35 -0
  231. package/dist/storage/usage.d.ts.map +1 -0
  232. package/dist/storage/usage.js +55 -0
  233. package/dist/storage/usage.js.map +1 -0
  234. package/dist/utils/git.d.ts +15 -0
  235. package/dist/utils/git.d.ts.map +1 -0
  236. package/dist/utils/git.js +38 -0
  237. package/dist/utils/git.js.map +1 -0
  238. package/dist/utils/tokenizer.d.ts +24 -0
  239. package/dist/utils/tokenizer.d.ts.map +1 -0
  240. package/dist/utils/tokenizer.js +52 -0
  241. package/dist/utils/tokenizer.js.map +1 -0
  242. package/package.json +71 -0
package/README.md ADDED
@@ -0,0 +1,716 @@
1
+ # vemora
2
+
3
+ [![npm version](https://img.shields.io/npm/v/vemora?label=npm)](https://www.npmjs.com/package/vemora)
4
+ [![npm alpha](https://img.shields.io/npm/v/vemora/alpha?label=alpha)](https://www.npmjs.com/package/vemora?activeTab=versions)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+
7
+ Repository-local memory system for LLM-assisted development.
8
+
9
+ Builds a structured, versioned index of your codebase — code chunks, symbols, dependency graph, and LLM-generated summaries — and enables semantic or keyword search over it. The result is a **RAG (Retrieval-Augmented Generation) layer** that lets you give an LLM only the code it actually needs, instead of entire files.
10
+
11
+ ## Why
12
+
13
+ When working on a large codebase with Claude Code or similar LLM tools, you face two problems:
14
+
15
+ 1. **Context cost** — dropping 50 files into the context wastes tokens on irrelevant code
16
+ 2. **Discovery** — you don't always know *which* files are relevant to a given task
17
+
18
+ `vemora` solves both by pre-indexing the repo and making it queryable. It also provides higher-level commands that go beyond retrieval:
19
+
20
+ - **`vemora plan`** — a pro LLM (planner) decomposes a complex task into concrete steps; a smaller/free LLM (executor) carries out each step against targeted code context. Cuts costs by using expensive models only where they matter.
21
+ - **`vemora audit`** — systematic, checklist-driven analysis of your codebase for security vulnerabilities, performance issues, and bugs. Covers every file, produces structured findings with severity levels.
22
+ - **`vemora triage`** — zero-LLM static heuristic scan for bugs, security issues, and performance problems. Instant results with no API calls, useful as a first pass before a deeper audit.
23
+ - **`vemora focus`** — aggregates all structural context about a file or symbol in one shot: implementation, exports, dependency graph, callers, test files, and saved knowledge.
24
+
25
+ ## Architecture in three layers
26
+
27
+ ```
28
+ .vemora/ ← versioned in git, shared across the team
29
+ config.json
30
+ metadata.json
31
+ index/
32
+ files.json ← file hashes for incremental indexing
33
+ chunks.json ← code chunks (function/class/window slices)
34
+ symbols.json ← extracted symbol map
35
+ deps.json ← intra-project dependency graph
36
+ callgraph.json ← function-level call relationships
37
+ todos.json ← TODO/FIXME/HACK/XXX annotations extracted from source
38
+ summaries/
39
+ file-summaries.json ← LLM-generated 2-3 line description per file
40
+ project-summary.json ← LLM-generated ~500 word project overview
41
+ knowledge/
42
+ entries.json ← human/LLM-authored notes: decisions, gotchas, patterns
43
+
44
+ ~/.vemora-cache/<projectId>/ ← local to each developer, NOT in git
45
+ embeddings.json ← metadata (model, dimensions, chunk mapping)
46
+ embeddings.bin ← binary buffer of vectors (Float32Array)
47
+ embeddings.hnsw.json ← serialized HNSW index for ultra-fast search
48
+ ```
49
+
50
+ The index, summaries, and knowledge entries are committed to git so teammates share them. Embeddings are generated locally by each developer from the shared index.
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ # Inside the vemora/ directory
56
+ pnpm install
57
+ pnpm build
58
+
59
+ # Link globally (optional)
60
+ pnpm link
61
+ ```
62
+
63
+ Or run directly with `node vemora/dist/cli.js` from the project root.
64
+
65
+ ### Installing the alpha version from npm
66
+
67
+ ```bash
68
+ pnpm install vemora@alpha # local
69
+ pnpm install -g vemora@alpha # global
70
+
71
+ # or with npm:
72
+ npm install -g vemora@alpha
73
+ ```
74
+
75
+ ## The Core Workflow
76
+
77
+ ### 1. Setup (first time only)
78
+
79
+ ```bash
80
+ vemora init # create .vemora/ and config.json
81
+ vemora index --no-embed # build index without embeddings (fast)
82
+ vemora index # or: build index + generate embeddings
83
+ vemora summarize # recommended: generate LLM descriptions per file
84
+ vemora init-agent # generate instruction files for AI agents
85
+ vemora init-agent --hooks # also write Claude Code auto-save hooks
86
+ ```
87
+
88
+ ### 1b. Start of each session
89
+
90
+ ```bash
91
+ vemora brief --root . # compact primer: project overview + critical knowledge
92
+ ```
93
+
94
+ ### 2. Query during development
95
+
96
+ ```bash
97
+ # Search for relevant code
98
+ vemora query "how does IMAP reconnect work?"
99
+
100
+ # Full context block ready to paste into any LLM
101
+ vemora context --query "email retry logic" > context.md
102
+
103
+ # One-shot answer from the configured LLM
104
+ vemora ask "why does the sync queue stall?"
105
+
106
+ # All context about a file or symbol in one call (no LLM needed)
107
+ vemora focus src/core/email/services/email.service.ts
108
+ vemora focus EmailService.send
109
+
110
+ # Static scan for bugs/perf/security (no API key required)
111
+ vemora triage --type bugs,performance
112
+
113
+ # Save a finding for future sessions
114
+ vemora remember "EmailService.send queues if SMTP is offline — see OutboxRepository"
115
+ ```
116
+
117
+ ### 3. Complex tasks with the planner-executor pattern
118
+
119
+ ```bash
120
+ # Pro LLM plans, small/free LLM executes each step
121
+ vemora plan "add rate limiting to the API layer" --confirm --synthesize
122
+
123
+ # Audit the codebase for issues
124
+ vemora audit --type security --root .
125
+ vemora audit --since HEAD~1 # only changed files (great for CI)
126
+ ```
127
+
128
+ ### 4. Keep the index fresh
129
+
130
+ ```bash
131
+ vemora index --watch # incremental re-index on file save
132
+ vemora index --no-embed # after code changes, update structure only
133
+ ```
134
+
135
+ ## Commands
136
+
137
+ ### `vemora init`
138
+
139
+ Creates the `.vemora/` folder structure and adds `.vemora-cache/` to `.gitignore`.
140
+
141
+ ```
142
+ Options:
143
+ --root <dir> project root (default: cwd)
144
+ ```
145
+
146
+ ### `vemora index`
147
+
148
+ Scans the repo, parses symbols, builds the dependency graph, extracts TODO/FIXME/HACK/XXX annotations, and generates embeddings. **Incremental** — only re-processes files whose SHA-256 hash has changed.
149
+
150
+ ```
151
+ Options:
152
+ --root <dir> project root (default: cwd)
153
+ --force re-index all files, ignoring hashes
154
+ --no-embed skip embedding generation (index structure only)
155
+ -w, --watch watch for changes and re-index automatically
156
+ ```
157
+
158
+ ### `vemora query "<question>"`
159
+
160
+ Searches the index using vector similarity (or keyword fallback). Results use a **three-tier display** that compresses output by relevance rank.
161
+
162
+ ```
163
+ Options:
164
+ --root <dir> project root (default: cwd)
165
+ -k, --top-k <n> number of results (default: 10)
166
+ -c, --show-code show full code for all results (overrides tier system)
167
+ --keyword force keyword/BM25 search (no API call needed)
168
+ --format <fmt> output format: terminal (default) | json | markdown | terse
169
+ --rerank re-score results with a cross-encoder model
170
+ --hybrid use hybrid search (vector + BM25)
171
+ --alpha <n> hybrid weight for vector search (0-1, default 0.7)
172
+ --budget <n> max tokens to include across results
173
+ --mmr apply Maximal Marginal Relevance to diversify results
174
+ --merge merge adjacent chunks from the same file
175
+ ```
176
+
177
+ #### Output formats
178
+
179
+ | Format | Use case |
180
+ |---|---|
181
+ | `terminal` | Default coloured output for interactive use |
182
+ | `json` | Machine-readable — for piping to scripts |
183
+ | `markdown` | Paste-ready Markdown with code blocks |
184
+ | `terse` | One line per result — recommended for small/local models |
185
+
186
+ #### Output tiers (terminal/markdown)
187
+
188
+ | Rank | Tier | Content shown |
189
+ |------|------|--------------|
190
+ | 1–3 | high | Full code block (capped at 30 lines) |
191
+ | 4–7 | med | Declaration signature only |
192
+ | 8+ | low | File path + symbol + score + AI summary |
193
+
194
+ ### `vemora context`
195
+
196
+ Generates an **optimized LLM context block** combining project overview, a specific file, and relevant code chunks. Designed to be piped to a file or clipboard.
197
+
198
+ ```
199
+ Options:
200
+ --root <dir> project root (default: cwd)
201
+ -q, --query <text> natural-language query to find relevant code
202
+ -f, --file <path> include a specific file in full with its dependency graph
203
+ -k, --top-k <n> number of search results to include (default: 5)
204
+ --keyword use keyword search instead of semantic search
205
+ --show-code show full code without line cap
206
+ --format <fmt> output format: markdown (default) | plain | terse
207
+ --rerank re-score results with a cross-encoder model
208
+ --hybrid use hybrid search (vector + BM25)
209
+ --budget <n> max tokens to include across retrieved chunks
210
+ --structured emit a structured block (Entry Point / Dependencies / Types / Patterns)
211
+ ```
212
+
213
+ At least one of `--query` or `--file` is required.
214
+
215
+ When `--file` is used, the context block also includes:
216
+ - **Recent git commits** that touched the file (last 5, via `git log --follow`)
217
+ - **TODO/FIXME/HACK/XXX annotations** present in the file
218
+ - **Test files** linked to the file — convention-based and import-based discovery
219
+ - **Symbol callers** — for each symbol defined in the file, which other project symbols call it
220
+
221
+ ### `vemora ask "<question>"`
222
+
223
+ One-shot Q&A: retrieves relevant context and calls the configured LLM to answer directly.
224
+
225
+ ```
226
+ Options:
227
+ --root <dir> project root (default: cwd)
228
+ -k, --top-k <n> chunks to retrieve (default: 5)
229
+ --keyword use keyword search (no embeddings needed)
230
+ --hybrid use hybrid vector+BM25 search
231
+ --budget <n> max context tokens to send to LLM (default: 6000)
232
+ --show-context print the retrieved context before the answer
233
+ ```
234
+
235
+ ```bash
236
+ vemora ask "how does the IMAP reconnect logic work?" --root .
237
+ vemora ask "what does EmailService.send do?" --root . --keyword
238
+ ```
239
+
240
+ ### `vemora plan "<task>"`
241
+
242
+ **Planner-executor pattern**: a capable LLM decomposes the task into a structured plan; a smaller/cheaper LLM executes each step against targeted code context.
243
+
244
+ The planner works from **file summaries and the symbol list** — not raw code — so its token cost stays low regardless of codebase size. The executor receives only the chunks relevant to its specific step (targeted by file/symbol, not just search).
245
+
246
+ ```
247
+ Options:
248
+ --root <dir> project root (default: cwd)
249
+ -k, --top-k <n> chunks to retrieve per step when falling back to search (default: 5)
250
+ --keyword use keyword search (no embeddings required)
251
+ --budget <n> max context tokens per step (default: 4000)
252
+ --confirm show the plan and ask for confirmation before executing
253
+ --synthesize call the planner again after all steps to produce a single final answer
254
+ --show-context print retrieved context for each step
255
+ ```
256
+
257
+ #### Step action types
258
+
259
+ | Action | Behaviour |
260
+ |---|---|
261
+ | `read` | Pull code into context — no LLM call, zero executor tokens |
262
+ | `analyze` | Executor answers a question in prose |
263
+ | `write` | Executor produces a unified diff ready to apply |
264
+ | `test` | Run a shell command; capture stdout/stderr as step result |
265
+
266
+ #### Key features
267
+
268
+ - **Parallel execution** — steps without dependencies run concurrently
269
+ - **Step dependencies** (`dependsOn`) — later steps receive prior results as context
270
+ - **Context deduplication** — the same file/symbol combination is retrieved only once per session
271
+ - **Adaptive re-planning** — if an executor step reports insufficient context (`INSUFFICIENT:`), the planner adds remediation steps automatically
272
+ - **Save synthesis** — after `--synthesize`, optionally save the result as a knowledge entry
273
+
274
+ ```bash
275
+ # Plan, preview, and execute with final synthesis
276
+ vemora plan "add batch() method to OpenAIEmbeddingProvider" --confirm --synthesize
277
+
278
+ # Analysis only (no code changes)
279
+ vemora plan "explain how the hybrid search pipeline works" --keyword
280
+
281
+ # With explicit executor diff output
282
+ vemora plan "fix the N+1 query in UserRepository.findAll"
283
+ ```
284
+
285
+ #### Configuration
286
+
287
+ ```json
288
+ {
289
+ "planner": { "provider": "anthropic", "model": "claude-opus-4-6" },
290
+ "summarization": { "provider": "gemini", "model": "gemini-2.0-flash", "apiKey": "..." }
291
+ }
292
+ ```
293
+
294
+ `summarization` acts as the executor. If `planner` is omitted, both roles use the same model.
295
+
296
+ ### `vemora audit`
297
+
298
+ Systematic, checklist-driven code audit for **security vulnerabilities**, **performance issues**, and **bugs**. Covers every file in the codebase (or only changed files with `--since`).
299
+
300
+ ```
301
+ Options:
302
+ --root <dir> project root (default: cwd)
303
+ --type <types> comma-separated: security, performance, bugs (default: all three)
304
+ --since <ref> only audit files changed since this git ref (e.g. HEAD~5, main)
305
+ --budget <n> max context tokens per step (default: 5000)
306
+ --keyword use keyword search (no embeddings required)
307
+ --output <fmt> terminal (default) | json | markdown
308
+ --save save critical/high findings as knowledge entries
309
+ ```
310
+
311
+ #### Built-in checklists
312
+
313
+ | Type | Examples |
314
+ |---|---|
315
+ | `security` | SQL/command/path injection, hardcoded secrets, weak crypto, missing auth/authz, XSS, CSRF, prototype pollution |
316
+ | `performance` | N+1 queries, sync I/O in async context, unbounded data loading, memory accumulation, blocking event loop |
317
+ | `bugs` | Null dereference, unhandled promise rejections, race conditions, resource leaks, swallowed errors, off-by-one |
318
+
319
+ #### How it works
320
+
321
+ 1. The **planner** receives the file list + summaries and generates a systematic audit plan, grouping 2-5 related files per step with specific checklist items.
322
+ 2. Steps execute in **parallel waves of 3** — the executor returns structured JSON findings for each group.
323
+ 3. Findings are **deduplicated, sorted by severity**, and displayed as a report.
324
+ 4. `--save` persists critical/high findings to the knowledge store for future sessions.
325
+
326
+ ```bash
327
+ # Full audit
328
+ vemora audit --root .
329
+
330
+ # Security only
331
+ vemora audit --type security --root .
332
+
333
+ # Audit only what changed in the last commit (ideal for CI/CD)
334
+ vemora audit --since HEAD~1 --root .
335
+
336
+ # Audit changes vs main branch, save findings
337
+ vemora audit --since main --type security,bugs --save --root .
338
+
339
+ # Export for a PR review
340
+ vemora audit --since main --output markdown --root . > audit-report.md
341
+ ```
342
+
343
+ #### Example output
344
+
345
+ ```
346
+ ── Audit Report [security] ─────────────────────────────
347
+ 12 file(s) analysed · 3 finding(s)
348
+
349
+ [CRITICAL] Injection src/api/users.ts:89
350
+ User input concatenated directly into SQL query without parameterization.
351
+ → Use parameterized queries or a query builder.
352
+
353
+ [HIGH] Hardcoded Secret src/config.ts:12
354
+ API key hardcoded in source — will be exposed in version control.
355
+ → Move to environment variables and rotate the key.
356
+
357
+ [MEDIUM] Missing Authorization src/api/admin.ts:34
358
+ Admin endpoint does not verify that the caller has the admin role.
359
+ → Add role check before processing the request.
360
+
361
+ ─────────────────────────────────────────────────────────
362
+ 1 critical · 1 high · 1 medium
363
+ ```
364
+
365
+ ### `vemora remember "<text>"`
366
+
367
+ Saves a persistent knowledge entry to `.vemora/knowledge/entries.json`. The entry is committed to git and included automatically in future `context` and `ask` results when relevant.
368
+
369
+ When `--category` is omitted, the configured LLM classifies the entry automatically into one of the four categories. Falls back to `pattern` if no LLM is available.
370
+
371
+ ```
372
+ Options:
373
+ --root <dir> project root (default: cwd)
374
+ --category <cat> decision | pattern | gotcha | glossary (auto-classified if omitted)
375
+ --files <paths> comma-separated related file paths
376
+ --symbols <names> comma-separated related symbol names
377
+ --confidence <level> high | medium | low (default: medium)
378
+ ```
379
+
380
+ ```bash
381
+ # Category auto-classified by the LLM
382
+ vemora remember "EmailService.send queues if SMTP offline — see OutboxRepository"
383
+
384
+ # Or specify explicitly
385
+ vemora remember "EmailService.send queues if SMTP offline — see OutboxRepository" \
386
+ --category gotcha \
387
+ --files src/core/email/services/email.service.ts \
388
+ --symbols EmailService.send
389
+ ```
390
+
391
+ ### `vemora brief`
392
+
393
+ Prints a compact session primer — project overview and high-confidence knowledge entries — designed to be run at the start of each LLM session to re-establish context with minimal tokens.
394
+
395
+ ```
396
+ Options:
397
+ --root <dir> project root (default: cwd)
398
+ --all include all knowledge entries, not only high-confidence ones
399
+ ```
400
+
401
+ ```bash
402
+ vemora brief --root . # overview + high-confidence entries only (~170 tokens)
403
+ vemora brief --root . --all # include all entries
404
+ ```
405
+
406
+ ### `vemora knowledge`
407
+
408
+ Manages saved knowledge entries.
409
+
410
+ ```bash
411
+ vemora knowledge list --root . # list all entries grouped by category
412
+ vemora knowledge forget <id> --root . # remove an entry by ID (prefix match)
413
+ ```
414
+
415
+ ### `vemora init-agent`
416
+
417
+ Generates AI agent instruction files from the existing index. Supports Claude Code, Gemini, GitHub Copilot, Cursor, and Windsurf.
418
+
419
+ ```
420
+ Options:
421
+ --root <dir> project root (default: cwd)
422
+ --agent <name> target a single agent: claude, gemini, copilot, cursor, windsurf (default: all)
423
+ --force overwrite existing files that have no vemora markers
424
+ --hooks write Claude Code hooks to .claude/settings.json (claude target only)
425
+ ```
426
+
427
+ Use `--hooks` to register a `PreCompact` hook that reminds Claude Code to persist key decisions before context is compressed:
428
+
429
+ ```bash
430
+ vemora init-agent --agent claude --hooks --root .
431
+ ```
432
+
433
+ | Agent | Output file |
434
+ |---|---|
435
+ | `claude` | `CLAUDE.md` |
436
+ | `gemini` | `GEMINI.md` |
437
+ | `copilot` | `.github/copilot-instructions.md` |
438
+ | `cursor` | `.cursor/rules/vemora.mdc` (with `alwaysApply: true`) |
439
+ | `windsurf` | `.windsurfrules` |
440
+
441
+ Re-running `init-agent` only updates the auto-generated block between `<!-- vemora:generated:start/end -->` markers. Custom content outside the markers is preserved.
442
+
443
+ ### `vemora summarize`
444
+
445
+ Generates LLM-powered summaries for every indexed file and a high-level project overview. **Incremental** — only re-generates summaries for files whose content has changed.
446
+
447
+ Summaries are used by `vemora plan` and `vemora audit` as cheap planner context (instead of raw code chunks).
448
+
449
+ ```
450
+ Options:
451
+ --root <dir> project root (default: cwd)
452
+ --force re-generate all summaries
453
+ --model <name> override LLM model (default: gpt-4o-mini)
454
+ --files-only only generate per-file summaries
455
+ --project-only (re)generate project overview from existing file summaries
456
+ --show print the existing project overview without regenerating
457
+ ```
458
+
459
+ ```bash
460
+ vemora summarize --show --root . # print overview without regenerating
461
+ ```
462
+
463
+ ### `vemora status`
464
+
465
+ Prints index stats, embedding cache info, knowledge store summary, and a count of TODO/FIXME/HACK/XXX annotations by type.
466
+
467
+ ### `vemora deps <file>`
468
+
469
+ Shows the full dependency context for a file: what it imports, what imports it.
470
+
471
+ ```
472
+ Options:
473
+ --root <dir> project root (default: cwd)
474
+ -d, --depth <n> transitive depth for outgoing imports (default: 1)
475
+ -r, --reverse-depth <n> transitive depth for incoming importers (default: 1)
476
+ ```
477
+
478
+ ```bash
479
+ # All files that depend on SyncOrchestrator, up to 3 hops
480
+ vemora deps src/core/sync/SyncOrchestrator.ts --root . --reverse-depth 3
481
+ ```
482
+
483
+ ### `vemora usages <SymbolName>`
484
+
485
+ Finds all files that use a named symbol, following re-export chains.
486
+
487
+ ```
488
+ Options:
489
+ --root <dir> project root (default: cwd)
490
+ -d, --depth <n> max re-export chain depth to follow (default: 10)
491
+ --callers-only show only files with call graph data
492
+ ```
493
+
494
+ ### `vemora chat`
495
+
496
+ Interactive chat session with the codebase. Supports OpenAI, Anthropic, Gemini, and Ollama.
497
+
498
+ ```bash
499
+ vemora chat --provider anthropic --model claude-opus-4-6
500
+ vemora chat --provider ollama --model qwen2.5-coder:14b
501
+ ```
502
+
503
+ ### `vemora report`
504
+
505
+ Shows a usage statistics report: commands breakdown, token savings, and most frequent query terms.
506
+
507
+ ```
508
+ Options:
509
+ --root <dir> project root (default: cwd)
510
+ --days <n> limit report to events from the last N days
511
+ -v, --verbose show per-query breakdown (last 20 queries)
512
+ --clear clear all recorded usage data
513
+ ```
514
+
515
+ ### `vemora triage`
516
+
517
+ Zero-LLM static heuristic scan for bugs, security issues, and performance problems. Works entirely from the existing index — no API key or network access required.
518
+
519
+ ```
520
+ Options:
521
+ --root <dir> project root (default: cwd)
522
+ --type <types> comma-separated: bugs, security, performance (default: all)
523
+ -k, --top-k <n> max findings to return, ranked by score (default: 30)
524
+ --min-score <n> skip findings below this threshold (default: 1)
525
+ --file <path> restrict scan to files matching this substring
526
+ --output <fmt> terminal (default) | json | markdown
527
+ ```
528
+
529
+ Each finding includes a severity (high/medium/low), a reason, and the exact code location.
530
+
531
+ ```bash
532
+ # Full scan
533
+ vemora triage --root .
534
+
535
+ # Bugs only, top 10, export to Markdown
536
+ vemora triage --type bugs -k 10 --output markdown --root .
537
+
538
+ # Security scan limited to the API layer
539
+ vemora triage --type security --file src/api --root .
540
+ ```
541
+
542
+ Heuristics cover: empty catch blocks, unguarded `JSON.parse`, sync I/O in loops, `any` casts, hardcoded secrets, dangerous `eval`/`exec`, prototype pollution, SQL/command injection patterns, and more.
543
+
544
+ ### `vemora focus <target>`
545
+
546
+ Aggregates all structural context about a file or symbol in one call — replaces the need to run `context`, `deps`, `usages`, and `knowledge` separately.
547
+
548
+ ```
549
+ Options:
550
+ --root <dir> project root (default: cwd)
551
+ --format <fmt> markdown (default) | plain
552
+ ```
553
+
554
+ `<target>` can be a file path (full or partial) or a symbol name:
555
+
556
+ ```bash
557
+ # File focus — exports, chunks, imports, importers, call graph, tests, knowledge
558
+ vemora focus src/core/email/services/email.service.ts --root .
559
+ vemora focus email.service --root . # partial path match
560
+
561
+ # Symbol focus — implementation, callers, callees, sibling members, tests
562
+ vemora focus EmailService.send --root .
563
+
564
+ # Pipe into a context block for any LLM
565
+ vemora focus src/search/hybrid.ts --root . --format plain > context.md
566
+ ```
567
+
568
+ ---
569
+
570
+ ## Configuration
571
+
572
+ Edit `.vemora/config.json` after `init`:
573
+
574
+ ```json
575
+ {
576
+ "projectId": "b88eb8199f78331e",
577
+ "projectName": "my-app",
578
+ "version": "1.0.0",
579
+ "include": ["**/*.ts", "**/*.tsx"],
580
+ "exclude": ["**/node_modules/**", "**/dist/**"],
581
+ "maxChunkLines": 80,
582
+ "maxChunkChars": 3000,
583
+ "embedding": {
584
+ "provider": "openai",
585
+ "model": "text-embedding-3-small",
586
+ "dimensions": 1536
587
+ },
588
+ "summarization": {
589
+ "provider": "openai",
590
+ "model": "gpt-4o-mini"
591
+ },
592
+ "display": {
593
+ "format": "terse"
594
+ }
595
+ }
596
+ ```
597
+
598
+ ### Planner-executor configuration
599
+
600
+ Add a `planner` block to use a more capable model for planning while a smaller model handles execution:
601
+
602
+ ```json
603
+ {
604
+ "planner": {
605
+ "provider": "anthropic",
606
+ "model": "claude-opus-4-6"
607
+ },
608
+ "summarization": {
609
+ "provider": "gemini",
610
+ "model": "gemini-2.0-flash",
611
+ "apiKey": "your-google-ai-studio-key"
612
+ }
613
+ }
614
+ ```
615
+
616
+ `planner` is used by `vemora plan` and `vemora audit`. `summarization` acts as the executor. If `planner` is omitted, both roles use `summarization`.
617
+
618
+ ### `display.format`
619
+
620
+ Sets the default output format for `query`, `context`, and `ask`. Set to `"terse"` for small/local models with limited context windows.
621
+
622
+ ### Embedding providers
623
+
624
+ | Provider | Config | Notes |
625
+ |---|---|---|
626
+ | `openai` | `OPENAI_API_KEY` env or `apiKey` in config | Best quality. Requires `npm install openai`. |
627
+ | `ollama` | `baseUrl` (default: `http://localhost:11434`) | Local, no cost. |
628
+ | `none` | — | Keyword search only, no embeddings. |
629
+
630
+ ### LLM providers
631
+
632
+ Used by `ask`, `chat`, `summarize`, `plan`, and `audit`.
633
+
634
+ | Provider | Config | Notes |
635
+ |---|---|---|
636
+ | `openai` | `OPENAI_API_KEY` env or `apiKey` in config | Also works with any OpenAI-compatible endpoint via `baseUrl`. |
637
+ | `anthropic` | `ANTHROPIC_API_KEY` env or `apiKey` in config | Requires `npm install @anthropic-ai/sdk`. |
638
+ | `gemini` | `GEMINI_API_KEY` or `GOOGLE_API_KEY` env or `apiKey` in config | Uses Google's OpenAI-compatible endpoint. Free tier available via Google AI Studio. |
639
+ | `ollama` | `baseUrl` (default: `http://localhost:11434`) | Local, no cost. |
640
+
641
+ #### OpenAI-compatible endpoints
642
+
643
+ The `openai` provider accepts a `baseUrl` field, enabling any compatible API:
644
+
645
+ ```json
646
+ { "provider": "openai", "model": "llama-3.3-70b-versatile", "baseUrl": "https://api.groq.com/openai/v1", "apiKey": "..." }
647
+ ```
648
+
649
+ | Service | `baseUrl` | Free tier |
650
+ |---|---|---|
651
+ | Groq | `https://api.groq.com/openai/v1` | Yes (rate limited) |
652
+ | OpenRouter | `https://openrouter.ai/api/v1` | Some free models |
653
+ | Gemini (compat) | `https://generativelanguage.googleapis.com/v1beta/openai/` | Yes |
654
+
655
+ ### Recommended configurations
656
+
657
+ **Maximum quality (cloud)**
658
+ ```json
659
+ {
660
+ "planner": { "provider": "anthropic", "model": "claude-opus-4-6" },
661
+ "summarization": { "provider": "openai", "model": "gpt-4o-mini" }
662
+ }
663
+ ```
664
+
665
+ **Pro planner + free executor**
666
+ ```json
667
+ {
668
+ "planner": { "provider": "anthropic", "model": "claude-opus-4-6" },
669
+ "summarization": { "provider": "gemini", "model": "gemini-2.0-flash", "apiKey": "..." }
670
+ }
671
+ ```
672
+
673
+ **Fully local (no API keys)**
674
+ ```json
675
+ {
676
+ "embedding": { "provider": "ollama", "model": "nomic-embed-text", "dimensions": 768 },
677
+ "summarization": { "provider": "ollama", "model": "qwen2.5-coder:14b" },
678
+ "display": { "format": "terse" }
679
+ }
680
+ ```
681
+
682
+ ---
683
+
684
+ ## What goes in git
685
+
686
+ ```
687
+ ✓ .vemora/config.json
688
+ ✓ .vemora/metadata.json
689
+ ✓ .vemora/index/files.json
690
+ ✓ .vemora/index/chunks.json
691
+ ✓ .vemora/index/symbols.json
692
+ ✓ .vemora/index/deps.json
693
+ ✓ .vemora/index/callgraph.json
694
+ ✓ .vemora/summaries/file-summaries.json
695
+ ✓ .vemora/summaries/project-summary.json
696
+ ✓ .vemora/knowledge/entries.json ← shared knowledge store
697
+
698
+ ✗ .vemora-cache/ ← local embedding vectors (gitignored)
699
+ ```
700
+
701
+ ## Incremental indexing
702
+
703
+ Chunk IDs are derived from `sha256(filePath + content)`. If a function's code doesn't change, its chunk ID is stable across branches — embeddings are reused without any API call.
704
+
705
+ ## Tech stack
706
+
707
+ - **TypeScript + Node.js** (CommonJS, ES2022 target)
708
+ - **commander** — CLI framework
709
+ - **fast-glob** — repository scanning
710
+ - **tree-sitter** (optional) — AST-based symbol extraction for TS/JS
711
+ - **openai** SDK _(optional)_ — embedding generation, OpenAI and Gemini LLM provider; `npm install openai`
712
+ - **@anthropic-ai/sdk** _(optional)_ — Anthropic/Claude LLM provider; `npm install @anthropic-ai/sdk`
713
+ - **@xenova/transformers** — local cross-encoder model for `--rerank`
714
+ - **hnsw** — HNSW index for sub-millisecond vector search
715
+ - **chokidar** — file watching for `--watch` mode
716
+ - **chalk + ora** — terminal output