vectr 1.0.0__tar.gz
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.
- vectr-1.0.0/LICENSE +21 -0
- vectr-1.0.0/MANIFEST.in +4 -0
- vectr-1.0.0/PKG-INFO +37 -0
- vectr-1.0.0/README.md +328 -0
- vectr-1.0.0/agent/__init__.py +0 -0
- vectr-1.0.0/agent/cartographer.py +428 -0
- vectr-1.0.0/agent/chunk_quality.py +1119 -0
- vectr-1.0.0/agent/config.py +648 -0
- vectr-1.0.0/agent/config.yaml +1153 -0
- vectr-1.0.0/agent/eviction_advisor.py +447 -0
- vectr-1.0.0/agent/identifier_hint.py +68 -0
- vectr-1.0.0/agent/indexer/__init__.py +112 -0
- vectr-1.0.0/agent/indexer/_chunking.py +458 -0
- vectr-1.0.0/agent/indexer/_constants.py +105 -0
- vectr-1.0.0/agent/indexer/_core.py +878 -0
- vectr-1.0.0/agent/indexer/_types.py +157 -0
- vectr-1.0.0/agent/instance_registry.py +127 -0
- vectr-1.0.0/agent/llm_client.py +8 -0
- vectr-1.0.0/agent/model_cache.py +101 -0
- vectr-1.0.0/agent/prompt_templates.py +31 -0
- vectr-1.0.0/agent/searcher.py +848 -0
- vectr-1.0.0/agent/strategy_selector.py +299 -0
- vectr-1.0.0/agent/symbol_graph/__init__.py +131 -0
- vectr-1.0.0/agent/symbol_graph/_constants.py +366 -0
- vectr-1.0.0/agent/symbol_graph/_extraction.py +528 -0
- vectr-1.0.0/agent/symbol_graph/_graph.py +1878 -0
- vectr-1.0.0/agent/symbol_graph/_types.py +35 -0
- vectr-1.0.0/agent/templates/claude_md.md +65 -0
- vectr-1.0.0/agent/templates/claude_md_search_only.md +27 -0
- vectr-1.0.0/agent/templates/cursor_mcp.json.template +7 -0
- vectr-1.0.0/agent/templates/cursor_rules_header.txt +5 -0
- vectr-1.0.0/agent/templates/hook_no_double_recall.txt +1 -0
- vectr-1.0.0/agent/templates/mcp.json.template +8 -0
- vectr-1.0.0/agent/templates/session_start_guidance_default.txt +3 -0
- vectr-1.0.0/agent/templates/session_start_guidance_hooks_aware.txt +1 -0
- vectr-1.0.0/agent/templates/tool_loading_guidance_claude.txt +1 -0
- vectr-1.0.0/agent/templates/tool_loading_guidance_claude_search_only.txt +1 -0
- vectr-1.0.0/agent/templates/vscode_mcp.json.template +8 -0
- vectr-1.0.0/agent/tool_necessity_probe.py +177 -0
- vectr-1.0.0/agent/version_stamp.py +58 -0
- vectr-1.0.0/agent/watcher.py +515 -0
- vectr-1.0.0/agent/working_context_store/__init__.py +76 -0
- vectr-1.0.0/agent/working_context_store/_audit.py +46 -0
- vectr-1.0.0/agent/working_context_store/_encryption.py +75 -0
- vectr-1.0.0/agent/working_context_store/_store.py +1130 -0
- vectr-1.0.0/agent/working_context_store/_types.py +50 -0
- vectr-1.0.0/api.py +101 -0
- vectr-1.0.0/app/__init__.py +0 -0
- vectr-1.0.0/app/models.py +368 -0
- vectr-1.0.0/app/routes.py +451 -0
- vectr-1.0.0/app/service.py +1055 -0
- vectr-1.0.0/integrations/__init__.py +0 -0
- vectr-1.0.0/integrations/mcp_server/__init__.py +73 -0
- vectr-1.0.0/integrations/mcp_server/_dispatch.py +782 -0
- vectr-1.0.0/integrations/mcp_server/_schemas.py +484 -0
- vectr-1.0.0/integrations/mcp_server/_session.py +86 -0
- vectr-1.0.0/integrations/vscode_bridge.py +71 -0
- vectr-1.0.0/integrations/workspace_detect.py +259 -0
- vectr-1.0.0/main.py +2037 -0
- vectr-1.0.0/pyproject.toml +61 -0
- vectr-1.0.0/setup.cfg +4 -0
- vectr-1.0.0/tests/test_agent.py +628 -0
- vectr-1.0.0/tests/test_api.py +462 -0
- vectr-1.0.0/tests/test_api_memory.py +364 -0
- vectr-1.0.0/tests/test_cartographer.py +330 -0
- vectr-1.0.0/tests/test_chunk_quality.py +1474 -0
- vectr-1.0.0/tests/test_config_loader.py +266 -0
- vectr-1.0.0/tests/test_eviction_advisor.py +823 -0
- vectr-1.0.0/tests/test_eviction_session_scope.py +294 -0
- vectr-1.0.0/tests/test_fetch_route.py +118 -0
- vectr-1.0.0/tests/test_grammar_availability.py +678 -0
- vectr-1.0.0/tests/test_hint_language_live.py +216 -0
- vectr-1.0.0/tests/test_hook_injection_observability.py +208 -0
- vectr-1.0.0/tests/test_identifier_hint.py +107 -0
- vectr-1.0.0/tests/test_indexer_searcher.py +4129 -0
- vectr-1.0.0/tests/test_instance_registry.py +255 -0
- vectr-1.0.0/tests/test_integration.py +797 -0
- vectr-1.0.0/tests/test_main.py +2862 -0
- vectr-1.0.0/tests/test_mcp_jsonrpc.py +275 -0
- vectr-1.0.0/tests/test_mcp_server.py +1631 -0
- vectr-1.0.0/tests/test_mcp_session_handshake.py +125 -0
- vectr-1.0.0/tests/test_memory.py +1402 -0
- vectr-1.0.0/tests/test_memory_only_mode.py +558 -0
- vectr-1.0.0/tests/test_model_cache.py +214 -0
- vectr-1.0.0/tests/test_prompt_templates.py +149 -0
- vectr-1.0.0/tests/test_query_prompt.py +301 -0
- vectr-1.0.0/tests/test_ragas_eval.py +206 -0
- vectr-1.0.0/tests/test_recall_hierarchy.py +531 -0
- vectr-1.0.0/tests/test_remember_banner_fatigue.py +444 -0
- vectr-1.0.0/tests/test_search_only_mode.py +721 -0
- vectr-1.0.0/tests/test_service.py +628 -0
- vectr-1.0.0/tests/test_strategy.py +640 -0
- vectr-1.0.0/tests/test_subagent_memory.py +140 -0
- vectr-1.0.0/tests/test_symbol_graph.py +3017 -0
- vectr-1.0.0/tests/test_task_note_recency.py +204 -0
- vectr-1.0.0/tests/test_tool_necessity_probe.py +192 -0
- vectr-1.0.0/tests/test_version_stamp.py +62 -0
- vectr-1.0.0/tests/test_watcher.py +838 -0
- vectr-1.0.0/tests/test_workspace_detect.py +542 -0
- vectr-1.0.0/vectr.egg-info/PKG-INFO +37 -0
- vectr-1.0.0/vectr.egg-info/SOURCES.txt +103 -0
- vectr-1.0.0/vectr.egg-info/dependency_links.txt +1 -0
- vectr-1.0.0/vectr.egg-info/entry_points.txt +2 -0
- vectr-1.0.0/vectr.egg-info/requires.txt +34 -0
- vectr-1.0.0/vectr.egg-info/top_level.txt +5 -0
vectr-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Swapnanil Saha
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
vectr-1.0.0/MANIFEST.in
ADDED
vectr-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vectr
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Zero-config local semantic codebase indexer with MCP protocol
|
|
5
|
+
Requires-Python: >=3.14
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Dist: fastapi==0.136.3
|
|
8
|
+
Requires-Dist: uvicorn==0.47.0
|
|
9
|
+
Requires-Dist: pydantic==2.13.4
|
|
10
|
+
Requires-Dist: python-dotenv==1.2.2
|
|
11
|
+
Requires-Dist: httpx==0.28.1
|
|
12
|
+
Requires-Dist: sentence-transformers==5.5.1
|
|
13
|
+
Requires-Dist: chromadb==1.5.9
|
|
14
|
+
Requires-Dist: tree-sitter==0.25.2
|
|
15
|
+
Requires-Dist: tree-sitter-python==0.25.0
|
|
16
|
+
Requires-Dist: tree-sitter-javascript==0.25.0
|
|
17
|
+
Requires-Dist: tree-sitter-typescript==0.23.2
|
|
18
|
+
Requires-Dist: tree-sitter-go==0.25.0
|
|
19
|
+
Requires-Dist: tree-sitter-rust==0.24.2
|
|
20
|
+
Requires-Dist: tree-sitter-java==0.23.5
|
|
21
|
+
Requires-Dist: tree-sitter-zig==1.1.2
|
|
22
|
+
Requires-Dist: tree-sitter-c==0.24.2
|
|
23
|
+
Requires-Dist: tree-sitter-cpp==0.23.4
|
|
24
|
+
Requires-Dist: watchdog==6.0.0
|
|
25
|
+
Requires-Dist: rank-bm25==0.2.2
|
|
26
|
+
Requires-Dist: pyyaml==6.0.3
|
|
27
|
+
Provides-Extra: openai
|
|
28
|
+
Requires-Dist: openai==2.38.0; extra == "openai"
|
|
29
|
+
Provides-Extra: encryption
|
|
30
|
+
Requires-Dist: cryptography>=43.0; extra == "encryption"
|
|
31
|
+
Provides-Extra: ragas
|
|
32
|
+
Requires-Dist: ragas>=0.1; extra == "ragas"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest==9.0.3; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-asyncio==1.3.0; extra == "dev"
|
|
36
|
+
Requires-Dist: anyio==4.13.0; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
vectr-1.0.0/README.md
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Vectr
|
|
2
|
+
|
|
3
|
+
> **Semantic search and persistent memory for AI code editors.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/swapnanil/vectr/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.python.org/downloads/)
|
|
8
|
+
[](CHANGELOG.md)
|
|
9
|
+
[](#14-mcp-tools)
|
|
10
|
+
|
|
11
|
+
Version 1.0.0 · Last updated 2026-07-08 · [CHANGELOG](CHANGELOG.md)
|
|
12
|
+
|
|
13
|
+
Vectr gives AI code editors two things they lack: **semantic codebase search** and **persistent working memory** — both served over MCP with zero configuration.
|
|
14
|
+
|
|
15
|
+
Your AI editor forgets everything. Vectr doesn't.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## The problem
|
|
20
|
+
|
|
21
|
+
Every time an AI code editor starts a task, it re-reads the same files it read yesterday. On an unfamiliar codebase it runs ripgrep, reads entire files hunting for the right function, and fills its context window with noise. In a long session it loses findings from turn 1 by turn 40. Across sessions it starts over from zero.
|
|
22
|
+
|
|
23
|
+
Vectr breaks the re-discovery loop:
|
|
24
|
+
|
|
25
|
+
- **One index** → semantic search over your whole codebase in <20ms
|
|
26
|
+
- **One recall call** → structured notes from any prior session, verbatim, in <50ms
|
|
27
|
+
- **Survives `/compact`** → notes are persisted to disk, not stored in context
|
|
28
|
+
|
|
29
|
+
**Measured, not hypothetical:** recalling 3 stored notes with `vectr_recall` costs 360 tokens in one tool call. Re-deriving the same three facts with grep + Read costs ~2,060 tokens across six tool calls on the same 182-file Python repo — **~5.7× fewer tokens, 6× fewer tool calls**, in under 50ms (chars/4 tokenization; full breakdown in [Measured costs, honestly](#measured-costs-honestly)). Across a 6-task CPython sprint measuring real Read+Bash calls, that recall discipline cut re-discovery by **39% overall**, with per-task reductions ranging **0%–85%** depending on how unfamiliar the code was to the model (the 0% task is one the model could already navigate from training — see [When vectr can hurt](#when-vectr-can-hurt)).
|
|
30
|
+
|
|
31
|
+
Notes are persisted to disk, not held in the conversation — they survive `/compact` and a fresh session equally; the session boundary doesn't matter.
|
|
32
|
+
|
|
33
|
+
**No API key required.** The embedding model runs locally.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Benchmarks — CPython internals sprint (6 tasks, 2 agents)
|
|
38
|
+
|
|
39
|
+
The benchmark simulates a week of feature work on an unfamiliar C codebase (CPython internals). One research session stores findings with `vectr_remember`; six isolated implementation sessions each open cold and call `vectr_recall`.
|
|
40
|
+
|
|
41
|
+
**Implementation sessions only — 6 tasks combined:**
|
|
42
|
+
|
|
43
|
+
| Metric | Vanilla | Vectr | Delta |
|
|
44
|
+
|---|---|---|---|
|
|
45
|
+
| Cost | $2.50 | $1.97 | **−21%** |
|
|
46
|
+
| Wall time | 17.6 min | 13.5 min | **−24%** |
|
|
47
|
+
| Turns | 123 | 94 | **−24%** |
|
|
48
|
+
| Read + Bash calls | 102 | 62 | **−39%** |
|
|
49
|
+
|
|
50
|
+
**Per-task re-discovery (Read+Bash before first write):**
|
|
51
|
+
|
|
52
|
+
| Task | Vanilla | Vectr | Delta |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| `debug_gc_finalizer` | 16 | 6 | −62% |
|
|
55
|
+
| `feature_dict_pop_last` | 13 | 3 | −77% |
|
|
56
|
+
| `cross_session_set_cartesian` | 23 | 9 | −61% |
|
|
57
|
+
| `debug_descriptor_priority` | 6 | 6 | 0% |
|
|
58
|
+
| `cross_session_bytes_find_all` | 13 | 2 | −85% |
|
|
59
|
+
| `cross_session_list_rotate` | 21 | 16 | −24% |
|
|
60
|
+
|
|
61
|
+
**Research vs implementation cost breakdown:**
|
|
62
|
+
|
|
63
|
+
The research phase (paid once to build notes) costs more for vectr (+94%) because it stores rich code stubs and function signatures via `vectr_remember`. The implementation phases (which repeat every task) cost less because `vectr_recall` replaces file re-discovery. The research overhead breaks even after ~8 tasks of note reuse.
|
|
64
|
+
|
|
65
|
+
| Phase | Vanilla | Vectr | Why |
|
|
66
|
+
|---|---|---|---|
|
|
67
|
+
| Research (1 session, paid once) | $1.36 | $2.63 | Vectr stores notes — more output tokens |
|
|
68
|
+
| Impl (6 sessions, repeating) | $2.50 | $1.97 | Notes replace re-discovery |
|
|
69
|
+
| Total sprint | $3.86 | $4.60 | Inverts to net gain after ~8 tasks |
|
|
70
|
+
|
|
71
|
+
Earlier runs on Apache Camel (Java, 5,856 files): **−58% impl cost · −72% impl tool calls · −39% wall time.**
|
|
72
|
+
|
|
73
|
+
Full results: [`benchmarks/`](benchmarks/)
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Measured costs, honestly
|
|
78
|
+
|
|
79
|
+
Per-call token cost (median, 182-file Python repo, chars/4 tokenization):
|
|
80
|
+
|
|
81
|
+
| Tool | Median tokens | Range |
|
|
82
|
+
|---|---:|---|
|
|
83
|
+
| `vectr_search` | ~2,320 | 1,437–3,091 (n=8) |
|
|
84
|
+
| `vectr_locate` | ~192 | — |
|
|
85
|
+
| `vectr_trace` | ~720 | — |
|
|
86
|
+
| `vectr_recall` (index tier) | ~180 | — |
|
|
87
|
+
|
|
88
|
+
The trade-off, stated plainly: for a single pointed lookup on a small, already-familiar repo, grep is cheaper — vectr's median cost across 5 single-fact tasks was **+60% more tokens** — and faster, since a `vectr_search` round-trip takes 1.7–3.6s against ~28ms for grep. Vectr doesn't win on per-call cost; it wins on tool-call count (one round-trip instead of several), answer completeness (a whole symbol back, not a partial file read), and everything in working memory — the 5.7× recall refund from the opening section compounds with every task you resume.
|
|
89
|
+
|
|
90
|
+
Fine print: the automatic eviction/reminder banners riding along on tool responses cost tokens too — an always-on re-fetch footer runs ~27 tokens, a light nudge ~89 tokens, and the escalated action-required banner (fires only after both the chunk and token thresholds are crossed without a save) scales from ~480 to ~535 tokens before it plateaus.
|
|
91
|
+
|
|
92
|
+
**When it pays off:** unfamiliar or large codebases, work you resume (later this session, after `/compact`, or in a new session), and long sessions with many turns. **When it doesn't:** a one-off grep on code you already know cold — reach for grep instead.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Quick start
|
|
97
|
+
|
|
98
|
+
**Local (recommended)**
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
python3.14 -m venv ~/.vectr-env
|
|
102
|
+
source ~/.vectr-env/bin/activate # Windows: ~/.vectr-env/Scripts/activate
|
|
103
|
+
pip install git+https://github.com/swapnanil/vectr
|
|
104
|
+
cd /path/to/your/project
|
|
105
|
+
vectr start
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Requires Python 3.14+.** To install:
|
|
109
|
+
- macOS: `brew install python@3.14`
|
|
110
|
+
- Ubuntu/Debian: `sudo add-apt-repository ppa:deadsnakes/ppa && sudo apt install python3.14 python3.14-venv`
|
|
111
|
+
- Windows: [python.org/downloads](https://www.python.org/downloads/)
|
|
112
|
+
|
|
113
|
+
`vectr start` returns immediately. Indexing runs in the background — run `vectr status` to check progress. On first run the embedding model downloads once (~440 MB). Restart your AI code editor once to pick up the new MCP config.
|
|
114
|
+
|
|
115
|
+
**Docker (CI/servers)**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git clone https://github.com/swapnanil/vectr
|
|
119
|
+
cd vectr
|
|
120
|
+
docker-compose up api
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Exposes port 8765. Docker does not auto-write IDE config files — use local install for IDE integration.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Connect to your AI code editor
|
|
128
|
+
|
|
129
|
+
`vectr start` writes the MCP config for your editor automatically. Restart your editor once.
|
|
130
|
+
|
|
131
|
+
| Editor | Config | Status |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| Claude Code | Auto — `.claude/settings.json`, guidance file, and session hooks (memory auto-injected at session start, per prompt, and before file read/edit) | **Verified** |
|
|
134
|
+
| Cursor | Auto — `.cursor/mcp.json` | Experimental |
|
|
135
|
+
| VS Code / GitHub Copilot | Auto — `.vscode/mcp.json` | Experimental |
|
|
136
|
+
| Windsurf | Manual — see below | Experimental |
|
|
137
|
+
| Cline | Manual — see below | Experimental |
|
|
138
|
+
| Continue | Manual — see below | Experimental |
|
|
139
|
+
| Codex CLI | — | Planned (post-v1) |
|
|
140
|
+
|
|
141
|
+
"Verified" means the full integration (config, guidance, and hooks) has been exercised end to end. "Experimental" means the MCP config is written and works, but the integration hasn't been run through the same verification pass. "Planned" means no support yet.
|
|
142
|
+
|
|
143
|
+
<details>
|
|
144
|
+
<summary>Manual setup</summary>
|
|
145
|
+
|
|
146
|
+
**Claude Code** — `.claude/settings.json`:
|
|
147
|
+
```json
|
|
148
|
+
{ "mcpServers": { "vectr": { "type": "http", "url": "http://localhost:8765/mcp" } } }
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Cursor** — `.cursor/mcp.json`:
|
|
152
|
+
```json
|
|
153
|
+
{ "mcpServers": { "vectr": { "url": "http://localhost:8765/mcp" } } }
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**VS Code / GitHub Copilot** (1.99+) — `.vscode/mcp.json`:
|
|
157
|
+
```json
|
|
158
|
+
{ "servers": { "vectr": { "type": "http", "url": "http://localhost:8765/mcp" } } }
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Windsurf** — `~/.codeium/windsurf/mcp_settings.json`:
|
|
162
|
+
```json
|
|
163
|
+
{ "mcpServers": { "vectr": { "serverUrl": "http://localhost:8765/mcp" } } }
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Continue.dev** — `.continue/config.json`:
|
|
167
|
+
```json
|
|
168
|
+
{ "mcpServers": [{ "name": "vectr", "transport": { "type": "http", "url": "http://localhost:8765/mcp" } }] }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
</details>
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## How it works
|
|
176
|
+
|
|
177
|
+
1. **AST-aware chunking** — tree-sitter parses each file and splits at function/class/method boundaries. No chunk breaks mid-logic.
|
|
178
|
+
2. **Code embeddings** — `ibm-granite/granite-embedding-english-r2` (local, CPU-fast, overridable) maps natural-language queries to code symbols ("JWT validation" → `verify_jwt_token`). BM25 handles exact symbol names.
|
|
179
|
+
3. **Hybrid search** — vector similarity + BM25 combined, weighted by codebase characteristics (large/unfamiliar → semantic-heavy; small/well-documented → BM25-heavy).
|
|
180
|
+
4. **Symbol graph** — call edges, import chains, and HTTP routes (Flask/FastAPI/Express/Spring) are extracted and stored. `vectr_locate` uses 5 fallback strategies: exact match → suffix → same-module → unique-name → import-chain → fuzzy (edit distance ≤ 2).
|
|
181
|
+
5. **Working memory** — `vectr_remember` stores structured notes to SQLite + ChromaDB. `vectr_recall` does semantic search over notes — not SQL LIKE — so multi-word queries always find relevant context.
|
|
182
|
+
6. **MCP protocol** — 14 tools served over HTTP. Any MCP-compatible AI code editor connects without plugins.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 14 MCP tools
|
|
187
|
+
|
|
188
|
+
`vectr start` writes a `CLAUDE.md` into your workspace with this table and usage guidance — your AI code editor knows which tool to reach for without being prompted.
|
|
189
|
+
|
|
190
|
+
**Search tools** — retrieve code from the index:
|
|
191
|
+
|
|
192
|
+
| Situation | Tool |
|
|
193
|
+
|---|---|
|
|
194
|
+
| You know a concept or behaviour, not a name | `vectr_search("description")` |
|
|
195
|
+
| You know a symbol name, not its file | `vectr_locate("SymbolName")` — 5 fallback strategies, optional `caller_file` |
|
|
196
|
+
| You need callers / callees of a symbol | `vectr_trace("symbol_name")` |
|
|
197
|
+
| You need an architectural overview | `vectr_map()` |
|
|
198
|
+
| You want to save a synthesised map summary | `vectr_map_save(summary)` |
|
|
199
|
+
| You have runtime call data to inject | `vectr_ingest_traces([{caller, callee}])` |
|
|
200
|
+
| You need index health / note count | `vectr_status()` |
|
|
201
|
+
|
|
202
|
+
**Memory tools** — store and recall across sessions:
|
|
203
|
+
|
|
204
|
+
| Situation | Tool |
|
|
205
|
+
|---|---|
|
|
206
|
+
| Notes exist from a prior session | `vectr_recall(query)` — semantic vector search, not substring match; two-tier (crisp index by default, expand one note with `note_id=N` or all bodies with `detail='full'`) |
|
|
207
|
+
| You found something worth preserving | `vectr_remember(content, tags, priority, kind, title, agent)` — `kind` controls injection: `directive` fires unconditionally every session, `task` carries current-work state, `gotcha` resurfaces when its file is touched, `finding` (default) is relevance-ranked, `reference` is a pointer; `title` labels the note in index output; `agent` attributes it to a subagent/orchestrator |
|
|
208
|
+
| Context is filling up | `vectr_evict_hint()` — identifies chunks vectr can re-retrieve, with the exact re-fetch ids |
|
|
209
|
+
| A chunk shown earlier has left your context | `vectr_fetch(ids=[...])` — deterministic, byte-verbatim re-fetch by id; no re-search, no file re-read; flags a truncation warning if the index itself stored a capped chunk |
|
|
210
|
+
| End of a long session, want a checkpoint | `vectr_snapshot("label")` |
|
|
211
|
+
| Looking for a prior checkpoint | `vectr_snapshot_list()` |
|
|
212
|
+
| Notes are stale after a large refactor | `vectr_forget(note_id=N)` per note, or `vectr_forget(all=true)` to clear |
|
|
213
|
+
|
|
214
|
+
Workspace-scoped notes double as a shared bus for multi-agent workflows: an orchestrator and its subagents all read and write the same note store, so a subagent can call `vectr_remember(..., agent="coder-2")` with its findings before finishing, and the orchestrator recalls them instead of re-reading the subagent's full transcript. The `agent` param is never inferred — it's explicit attribution, and it shows up as a tag in `vectr_recall` index output.
|
|
215
|
+
|
|
216
|
+
On editors with session hooks (see the [host-support matrix](#connect-to-your-ai-code-editor) for which ones), recall is injected automatically — directives and high-priority tasks at session start, semantic recall keyed to each prompt, and file-anchored gotchas before a read or edit — with observability via a `Hook injections` line in `vectr status`.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## CLI reference
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
vectr start # index + start daemon for current dir
|
|
224
|
+
vectr start /project/api # positional workspace: a directory or .code-workspace file
|
|
225
|
+
vectr start --path /project/api # specific workspace (repeatable, multi-root)
|
|
226
|
+
vectr start --memory-only # working memory + hooks only — no code index, no watcher
|
|
227
|
+
vectr status # index health, chunk count, notes count
|
|
228
|
+
vectr status --all # all running instances
|
|
229
|
+
vectr stop /project/api # stop one instance (same positional as start)
|
|
230
|
+
vectr stop --path /project/api # stop one instance (equivalent --path form)
|
|
231
|
+
vectr stop --all # stop all instances
|
|
232
|
+
vectr index --path . # re-index without restarting daemon
|
|
233
|
+
vectr fetch src/auth.py:10-42 # re-fetch a chunk by exact id, verbatim
|
|
234
|
+
vectr init --path . # write CLAUDE.md + MCP config without starting
|
|
235
|
+
vectr init --exclude vendor # exclude directories from indexing
|
|
236
|
+
vectr forget --path . # delete all working-memory notes
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Excluding paths
|
|
242
|
+
|
|
243
|
+
Create `.vectrignore` in your project root (same syntax as `.gitignore`):
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
vendor/
|
|
247
|
+
node_modules/
|
|
248
|
+
*.pb.go
|
|
249
|
+
dist/
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Or pass `--exclude` at init time:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
vectr init --exclude vendor --exclude dist
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Exclusions apply to both the initial index walk **and** the live file watcher, so
|
|
259
|
+
adding a directory to `.vectrignore` stops a running instance from re-indexing it.
|
|
260
|
+
The next index also **prunes** any chunks already stored for now-excluded (or
|
|
261
|
+
deleted) files — you don't have to rebuild from scratch. If you ever need a clean
|
|
262
|
+
rebuild (e.g. after changing the embedding model), force one:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
vectr index --path . --force # ignore the incremental cache, re-embed everything
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Supported languages
|
|
271
|
+
|
|
272
|
+
| Language | Chunking | Symbol graph |
|
|
273
|
+
|---|---|---|
|
|
274
|
+
| Python | AST (functions, classes) | ✓ |
|
|
275
|
+
| JavaScript | AST (functions, classes, arrow fns) | ✓ |
|
|
276
|
+
| TypeScript | AST | ✓ |
|
|
277
|
+
| Go | AST | ✓ |
|
|
278
|
+
| Rust | AST | ✓ |
|
|
279
|
+
| Java | AST | ✓ |
|
|
280
|
+
| C | AST | ✓ |
|
|
281
|
+
| C++ | AST | ✓ |
|
|
282
|
+
| Zig | AST | ✓ |
|
|
283
|
+
| All others | 200-line windows, 50-line overlap | — |
|
|
284
|
+
|
|
285
|
+
HTTP routes (Flask/FastAPI decorators, Express `app.get()`, Spring `@GetMapping`) are extracted as symbols and searchable via `vectr_locate("GET /api/users")`.
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Cost
|
|
290
|
+
|
|
291
|
+
| | Cost |
|
|
292
|
+
|---|---|
|
|
293
|
+
| Embedding model | $0.00 — one-time ~440 MB download, cached at `~/.cache/vectr/` |
|
|
294
|
+
| Re-index (10k files, first run) | ~10 min on CPU; <5 sec on subsequent runs (mtime cache) |
|
|
295
|
+
| Incremental re-index per changed file | ~0.5 sec |
|
|
296
|
+
| vectr_search / vectr_recall | $0.00 — local inference only |
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Security
|
|
301
|
+
|
|
302
|
+
Vectr v1 is designed for a **solo developer on a personal machine**.
|
|
303
|
+
|
|
304
|
+
- MCP server binds to `127.0.0.1` only — not reachable from other hosts
|
|
305
|
+
- CORS restricted to localhost origins
|
|
306
|
+
- Each workspace gets its own isolated DB directory, port, and process
|
|
307
|
+
- No API key authentication in v1 — any local process can query
|
|
308
|
+
- Index and notes persist locally in `~/.cache/vectr/`
|
|
309
|
+
|
|
310
|
+
Multi-user, authentication, and encryption at rest are out of scope for v1.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## When vectr can hurt
|
|
315
|
+
|
|
316
|
+
**Stale notes after codebase churn** — notes store file paths at write time. After a large refactor, `vectr_recall` will flag changed referenced files with `[STALE]`. Re-verify before acting, delete the stale note with `vectr_forget(note_id=N)`, or clear everything with `vectr_forget(all=true)`.
|
|
317
|
+
|
|
318
|
+
**Over-retrieval on a well-known API** — if the model already knows a framework deeply from training (React hooks, Django ORM), vectr's research overhead may exceed savings. The benchmark shows 0% improvement on `debug_descriptor_priority` — a task where the model's training knowledge was sufficient to navigate without notes.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Built with
|
|
323
|
+
|
|
324
|
+
Python 3.14 · FastAPI · sentence-transformers · tree-sitter · ChromaDB · BM25 · Docker
|
|
325
|
+
|
|
326
|
+
## Author
|
|
327
|
+
|
|
328
|
+
Swapnanil Saha · [swapnanilsaha.com](https://swapnanilsaha.com)
|
|
File without changes
|