mindtrail 0.1.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.
- mindtrail-0.1.0/.gitignore +17 -0
- mindtrail-0.1.0/CHANGELOG.md +51 -0
- mindtrail-0.1.0/LICENSE +21 -0
- mindtrail-0.1.0/PKG-INFO +233 -0
- mindtrail-0.1.0/README.md +198 -0
- mindtrail-0.1.0/benchmarks/README.md +184 -0
- mindtrail-0.1.0/pyproject.toml +73 -0
- mindtrail-0.1.0/server.json +22 -0
- mindtrail-0.1.0/src/mindtrail/__init__.py +17 -0
- mindtrail-0.1.0/src/mindtrail/__main__.py +3 -0
- mindtrail-0.1.0/src/mindtrail/cli/__init__.py +0 -0
- mindtrail-0.1.0/src/mindtrail/cli/main.py +425 -0
- mindtrail-0.1.0/src/mindtrail/core/__init__.py +0 -0
- mindtrail-0.1.0/src/mindtrail/core/config.py +46 -0
- mindtrail-0.1.0/src/mindtrail/core/exceptions.py +27 -0
- mindtrail-0.1.0/src/mindtrail/core/models.py +127 -0
- mindtrail-0.1.0/src/mindtrail/core/project.py +84 -0
- mindtrail-0.1.0/src/mindtrail/core/text.py +52 -0
- mindtrail-0.1.0/src/mindtrail/embeddings/__init__.py +33 -0
- mindtrail-0.1.0/src/mindtrail/embeddings/base.py +38 -0
- mindtrail-0.1.0/src/mindtrail/embeddings/fastembed_provider.py +112 -0
- mindtrail-0.1.0/src/mindtrail/embeddings/hashing.py +67 -0
- mindtrail-0.1.0/src/mindtrail/embeddings/rerankers.py +92 -0
- mindtrail-0.1.0/src/mindtrail/evaluation/__init__.py +6 -0
- mindtrail-0.1.0/src/mindtrail/evaluation/data/retrieval_holdout_v1.json +85 -0
- mindtrail-0.1.0/src/mindtrail/evaluation/data/retrieval_holdout_v2.json +92 -0
- mindtrail-0.1.0/src/mindtrail/evaluation/data/retrieval_v1.json +165 -0
- mindtrail-0.1.0/src/mindtrail/evaluation/dataset.py +80 -0
- mindtrail-0.1.0/src/mindtrail/evaluation/locomo.py +235 -0
- mindtrail-0.1.0/src/mindtrail/evaluation/metrics.py +57 -0
- mindtrail-0.1.0/src/mindtrail/evaluation/runner.py +225 -0
- mindtrail-0.1.0/src/mindtrail/mcp/__init__.py +3 -0
- mindtrail-0.1.0/src/mindtrail/mcp/server.py +259 -0
- mindtrail-0.1.0/src/mindtrail/memory/__init__.py +0 -0
- mindtrail-0.1.0/src/mindtrail/memory/context.py +59 -0
- mindtrail-0.1.0/src/mindtrail/memory/retrieval.py +88 -0
- mindtrail-0.1.0/src/mindtrail/memory/safety.py +25 -0
- mindtrail-0.1.0/src/mindtrail/memory/service.py +493 -0
- mindtrail-0.1.0/src/mindtrail/py.typed +0 -0
- mindtrail-0.1.0/src/mindtrail/storage/__init__.py +0 -0
- mindtrail-0.1.0/src/mindtrail/storage/interfaces.py +68 -0
- mindtrail-0.1.0/src/mindtrail/storage/sqlite.py +348 -0
- mindtrail-0.1.0/tests/conftest.py +45 -0
- mindtrail-0.1.0/tests/evaluation/test_retrieval_benchmark.py +96 -0
- mindtrail-0.1.0/tests/integration/test_mcp_server.py +122 -0
- mindtrail-0.1.0/tests/integration/test_stdio_cross_session.py +55 -0
- mindtrail-0.1.0/tests/unit/test_cli.py +59 -0
- mindtrail-0.1.0/tests/unit/test_context.py +39 -0
- mindtrail-0.1.0/tests/unit/test_models_and_text.py +100 -0
- mindtrail-0.1.0/tests/unit/test_project.py +61 -0
- mindtrail-0.1.0/tests/unit/test_rerank_and_import.py +137 -0
- mindtrail-0.1.0/tests/unit/test_service.py +290 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-10-09
|
|
10
|
+
|
|
11
|
+
First public release on PyPI and the MCP Registry.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- `mindtrail[semantic]` now uses `BAAI/bge-base-en-v1.5` (210 MB) by default. It is ahead on
|
|
15
|
+
every bundled set (holdout v2: 94% recall@5, 100% abstention). Choose another model with
|
|
16
|
+
`MINDTRAIL_EMBEDDING_MODEL`, for example `BAAI/bge-small-en-v1.5` (67 MB). Existing memories
|
|
17
|
+
are re-embedded automatically when the server starts.
|
|
18
|
+
- Cross-encoder reranking is off by default; enable it with `MINDTRAIL_RERANKER=<model id>`.
|
|
19
|
+
- Server instructions now tell agents to call `recall` before any project-specific answer,
|
|
20
|
+
even a one-line one. In the agent evaluation this fixed the cases where the agent answered
|
|
21
|
+
from habit (`npm install`, `str | None` on a Python 3.9 project) instead of checking memory.
|
|
22
|
+
- Renamed the project from CogMem to **Mindtrail** (package, CLI, `MINDTRAIL_*` variables,
|
|
23
|
+
`~/.mindtrail`).
|
|
24
|
+
- The `local-embeddings` extra is now `semantic`. Neural models are stored in
|
|
25
|
+
`~/.mindtrail/models`, and `mindtrail init` pre-downloads them.
|
|
26
|
+
- Retrieval now drops weak keyword matches (below 40% of the best BM25 score, or without vector
|
|
27
|
+
support) and uses calibrated similarity floors per embedder, so a query with no stored answer
|
|
28
|
+
is far more likely to return nothing.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- Clones of the same repository in differently named folders now share one project space.
|
|
32
|
+
The space name came from the folder instead of the git remote. In a repository whose folder
|
|
33
|
+
name differs from its remote's repo name, memories stored before this fix stay under the
|
|
34
|
+
old space id.
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- Agent-in-the-loop evaluation (`benchmarks/agent_eval.py`): real Claude Code sessions,
|
|
38
|
+
with and without Mindtrail.
|
|
39
|
+
- `holdout-v2` retrieval set and LoCoMo (`mindtrail bench --dataset locomo:test`), with
|
|
40
|
+
bootstrap confidence intervals in every report.
|
|
41
|
+
- Retrieval benchmark (`mindtrail bench`) with bundled dev and held-out datasets: recall@k,
|
|
42
|
+
MRR, nDCG, abstention, stale/foreign leak rate and latency. CI gates on the results.
|
|
43
|
+
- Core memory engine: validated immutable memory records, SQLite storage with FTS5, hybrid
|
|
44
|
+
keyword + vector retrieval, token-budgeted context, versioned updates, supersession,
|
|
45
|
+
validity windows, hard/soft deletion and secret filtering on write.
|
|
46
|
+
- Offline hashing embedder (default) and optional local neural embeddings via fastembed.
|
|
47
|
+
- MCP server over stdio with a three-tool core profile (`remember`, `recall`, `forget`) and a
|
|
48
|
+
`full` profile that adds `search_memory`, `get_context`, `update_memory` and `get_memory`.
|
|
49
|
+
- Automatic project scoping from the git remote, shared across tools working in the same repo.
|
|
50
|
+
- `mindtrail` CLI: `serve`, `init`, `doctor`, `remember`, `recall`, `forget`, `list`, `stats`,
|
|
51
|
+
`export` and `reindex`.
|
mindtrail-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mindtrail contributors
|
|
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.
|
mindtrail-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mindtrail
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Persistent, local-first memory for AI coding agents over MCP.
|
|
5
|
+
Project-URL: Homepage, https://github.com/RohitDeshmukh-1/Mindtrail-MCP
|
|
6
|
+
Project-URL: Documentation, https://github.com/RohitDeshmukh-1/Mindtrail-MCP/tree/main/docs
|
|
7
|
+
Project-URL: Issues, https://github.com/RohitDeshmukh-1/Mindtrail-MCP/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/RohitDeshmukh-1/Mindtrail-MCP/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Mindtrail contributors
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai-agents,claude-code,cursor,llm,mcp,memory,rag
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: mcp<3,>=2.2
|
|
25
|
+
Requires-Dist: numpy>=1.26
|
|
26
|
+
Requires-Dist: pydantic<3,>=2.7
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
29
|
+
Requires-Dist: pre-commit>=3.7; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
32
|
+
Provides-Extra: semantic
|
|
33
|
+
Requires-Dist: fastembed>=0.4; extra == 'semantic'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
<div align="center">
|
|
37
|
+
|
|
38
|
+
# 🧭 Mindtrail
|
|
39
|
+
|
|
40
|
+
**Leave a trail your AI agents can follow.**
|
|
41
|
+
|
|
42
|
+
Persistent, local-first memory for coding agents over MCP. Tell your agent something once,
|
|
43
|
+
and every future session remembers it.
|
|
44
|
+
|
|
45
|
+
[](https://github.com/RohitDeshmukh-1/Mindtrail-MCP/actions/workflows/ci.yml)
|
|
46
|
+
[](https://www.python.org/)
|
|
47
|
+
[](https://modelcontextprotocol.io)
|
|
48
|
+
[](LICENSE)
|
|
49
|
+
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
Every new agent session starts from zero. You explain your conventions again, re-state your
|
|
55
|
+
preferences, and re-describe decisions you made last week. **Mindtrail gives your agents a shared,
|
|
56
|
+
long-term memory** through the [Model Context Protocol](https://modelcontextprotocol.io), so
|
|
57
|
+
what one session learns, every later session (in any tool) can recall.
|
|
58
|
+
|
|
59
|
+
- 🔌 **Works with any MCP client.** One memory shared by Claude Code, Cursor, VS Code, Codex
|
|
60
|
+
and your own agents.
|
|
61
|
+
- 🏠 **Local-first and private.** One SQLite file on your machine. No account, no API key, no
|
|
62
|
+
telemetry.
|
|
63
|
+
- ⚡ **Installs in seconds.** No model download is required; add neural embeddings later with
|
|
64
|
+
one extra.
|
|
65
|
+
- 🗂️ **Scoped automatically.** Repo facts stay with the repo (detected from the git remote) and
|
|
66
|
+
personal preferences follow you everywhere.
|
|
67
|
+
- 🔎 **Hybrid retrieval.** Keyword (BM25) and vector search, fused and ranked, with the ranking
|
|
68
|
+
signals shown for every result.
|
|
69
|
+
- 🛡️ **Safe by default.** Refuses to store credentials, marks recalled memory as untrusted data,
|
|
70
|
+
and deletes for real.
|
|
71
|
+
|
|
72
|
+
## Does it actually help?
|
|
73
|
+
|
|
74
|
+
We tested it with real Claude Code sessions. In one session the user mentions a project fact
|
|
75
|
+
in passing ("FYI, this project uses pnpm"). A fresh session later gets a task that depends on
|
|
76
|
+
it ("how do I add lodash?"). The agent is never told to use Mindtrail.
|
|
77
|
+
|
|
78
|
+
| | stored the fact on its own | applied it in a later session |
|
|
79
|
+
|---|---:|---:|
|
|
80
|
+
| Claude Code without Mindtrail | – | 0/12 |
|
|
81
|
+
| Claude Code with `mindtrail[semantic]` | **36/36** | **36/36** |
|
|
82
|
+
|
|
83
|
+
Without memory, the agent answers from habit every time: `npm install lodash`, a commit
|
|
84
|
+
message in the wrong format, port 5432 instead of your 5433. With Mindtrail it checks first
|
|
85
|
+
and gets your project's answer. This is a small test (12 facts run three times, one model,
|
|
86
|
+
an empty repository), not a measure of task success on large codebases.
|
|
87
|
+
[Method, raw results and how to reproduce](benchmarks/README.md#agent-evaluation).
|
|
88
|
+
|
|
89
|
+
## Quickstart
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pipx install "mindtrail[semantic]" # or: uv tool install "mindtrail[semantic]"
|
|
93
|
+
mindtrail init # downloads the embedding model once (~210 MB)
|
|
94
|
+
claude mcp add mindtrail --scope user -- mindtrail serve # Claude Code
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Have [uv](https://docs.astral.sh/uv/)? Skip the install step; `uvx` fetches Mindtrail on first
|
|
98
|
+
run (the embedding model downloads in the background the first time the server starts):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
claude mcp add mindtrail --scope user -- uvx --from "mindtrail[semantic]" mindtrail serve
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Cursor, VS Code, Codex and custom clients are covered in
|
|
105
|
+
**[docs/integrations.md](docs/integrations.md)**, and `mindtrail init` prints each config.
|
|
106
|
+
Want the smallest install? `pipx install mindtrail` skips the model download and matches on
|
|
107
|
+
words instead of meaning (see [Better semantic recall](#better-semantic-recall)).
|
|
108
|
+
|
|
109
|
+
Then try it:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
Session 1 › FYI, this project uses conventional commits and squash merges.
|
|
113
|
+
Session 2 › Write a commit message for these changes.
|
|
114
|
+
→ the agent recalls the convention and writes "feat(api): add pagination to /orders"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Using it day to day
|
|
118
|
+
|
|
119
|
+
You don't need special commands. Work as usual and the agent decides what to keep:
|
|
120
|
+
|
|
121
|
+
- **Mention things once.** "We deploy from the `release` branch", "I prefer pytest over
|
|
122
|
+
unittest", "the flaky test was a timezone bug, fixed by pinning TZ=UTC". The agent stores
|
|
123
|
+
facts like these on its own. Say "remember that…" when you want to be sure.
|
|
124
|
+
- **Project vs. personal.** Facts about the repository go to a project space, shared by every
|
|
125
|
+
clone of the same git remote. Facts about you ("I like short answers") go to your personal
|
|
126
|
+
space and apply in every project.
|
|
127
|
+
- **Things change.** Say "we moved from npm to pnpm" and the agent replaces the old memory
|
|
128
|
+
instead of keeping both. The old one is kept as history but no longer recalled.
|
|
129
|
+
- **Ask what it knows.** "What do you remember about this project?" or, from the terminal,
|
|
130
|
+
`mindtrail list` and `mindtrail recall "<question>"`.
|
|
131
|
+
- **Forget anything.** "Forget the staging URL" in chat, or `mindtrail forget <id>`. Deletes
|
|
132
|
+
are permanent.
|
|
133
|
+
- **Switch tools freely.** Claude Code, Cursor and Codex pointed at the same Mindtrail share
|
|
134
|
+
one memory, so a convention taught in one tool is known in all of them.
|
|
135
|
+
|
|
136
|
+
Good things to store: conventions, commands, ownership, where config lives, decisions and why
|
|
137
|
+
they were made, root causes of tricky bugs. Don't bother with what the code or git history
|
|
138
|
+
already says. Secrets are refused automatically.
|
|
139
|
+
|
|
140
|
+
## How it works
|
|
141
|
+
|
|
142
|
+
Your agent gets three tools, and Mindtrail's server instructions tell it when to use them:
|
|
143
|
+
|
|
144
|
+
| Tool | What it does |
|
|
145
|
+
|---|---|
|
|
146
|
+
| `remember` | Store one fact, preference, decision or event, scoped to the **project** or **personal** space. Pass `replaces` to supersede an outdated memory. |
|
|
147
|
+
| `recall` | Find relevant memories from the current project plus your personal space. Returns nothing when nothing relevant exists. |
|
|
148
|
+
| `forget` | Permanently delete a memory. |
|
|
149
|
+
|
|
150
|
+
Set `MINDTRAIL_TOOLS=full` for four more: `search_memory` (filters by space, type and validity),
|
|
151
|
+
`get_context` (a prompt-ready block within a token budget), `update_memory` (edits with
|
|
152
|
+
version history) and `get_memory`.
|
|
153
|
+
|
|
154
|
+
Behind the tools is a small, well-tested engine: duplicate merging, supersession, validity
|
|
155
|
+
windows, version history and hybrid ranking. See **[docs/architecture.md](docs/architecture.md)**.
|
|
156
|
+
|
|
157
|
+
## Manage memory from the terminal
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
mindtrail recall "how do we deploy?" # search project + personal memory
|
|
161
|
+
mindtrail remember "Staging is at staging.example.com" --scope project
|
|
162
|
+
mindtrail list # newest first
|
|
163
|
+
mindtrail forget <id> # permanent delete
|
|
164
|
+
mindtrail export -o memories.jsonl # everything you've stored, as JSON Lines
|
|
165
|
+
mindtrail doctor # diagnose the install
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Better semantic recall
|
|
169
|
+
|
|
170
|
+
The default embedder matches on words and word fragments. For recall by meaning ("how do we
|
|
171
|
+
deploy?" → "deploys go through GitHub Actions"), install the local neural model. It runs on CPU
|
|
172
|
+
and needs no API key:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
pipx install "mindtrail[semantic]"
|
|
176
|
+
mindtrail init # downloads the model once (~210 MB) and re-indexes existing memories
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
For a smaller download (67 MB, somewhat lower recall), set
|
|
180
|
+
`MINDTRAIL_EMBEDDING_MODEL=BAAI/bge-small-en-v1.5`. Memories stored under another model are
|
|
181
|
+
re-embedded automatically the next time the server starts.
|
|
182
|
+
|
|
183
|
+
## Retrieval benchmark
|
|
184
|
+
|
|
185
|
+
The agent test above is in [Does it actually help?](#does-it-actually-help). On two held-out sets of developer-memory questions (82 in total) that were never used for
|
|
186
|
+
tuning ([methodology](benchmarks/README.md)):
|
|
187
|
+
|
|
188
|
+
| | recall@1 | recall@5 | paraphrase recall@5 | correctly says "nothing stored" | stale/foreign leaks |
|
|
189
|
+
|---|---:|---:|---:|---:|---:|
|
|
190
|
+
| default install | 58–64% | 68–75% | 44–46% | 82–100% | **0%** |
|
|
191
|
+
| `mindtrail[semantic]` | **82–90%** | **93–94%** | **85–89%** | **100%** | **0%** |
|
|
192
|
+
|
|
193
|
+
This is a small, synthetic retrieval benchmark written by us. Run `mindtrail bench` to
|
|
194
|
+
reproduce it, or add your own dataset.
|
|
195
|
+
|
|
196
|
+
## Use it from Python
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
from mindtrail import MemoryService
|
|
200
|
+
|
|
201
|
+
memory = MemoryService.from_config()
|
|
202
|
+
memory.remember("The API uses FastAPI and PostgreSQL", space_id="project:shop")
|
|
203
|
+
print(memory.get_context("add a new endpoint", space_ids=["project:shop"]).text)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Privacy and security
|
|
207
|
+
|
|
208
|
+
Everything stays in `~/.mindtrail/mindtrail.db` on your machine. Mindtrail refuses writes that
|
|
209
|
+
look like API keys, tokens or private keys. `forget` overwrites deleted data on disk, and recalled memories
|
|
210
|
+
are marked as untrusted reference data so agents don't follow instructions stored inside them.
|
|
211
|
+
See [SECURITY.md](SECURITY.md) to report issues.
|
|
212
|
+
|
|
213
|
+
## Roadmap
|
|
214
|
+
|
|
215
|
+
- [x] Core engine: hybrid retrieval, dedup, supersession, validity windows, history
|
|
216
|
+
- [x] MCP server and CLI, with automatic project scoping
|
|
217
|
+
- [ ] PostgreSQL + pgvector backend with multi-tenant isolation
|
|
218
|
+
- [x] Retrieval benchmark suite in CI (recall@k, MRR, abstention, leak rate)
|
|
219
|
+
- [ ] Hosted remote MCP with one-click OAuth connectors
|
|
220
|
+
- [ ] Web memory viewer (browse, edit, delete, export)
|
|
221
|
+
- [ ] Entity graph, contradiction detection and memory consolidation
|
|
222
|
+
|
|
223
|
+
## Contributing
|
|
224
|
+
|
|
225
|
+
Issues and PRs are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) to get set up; the whole
|
|
226
|
+
suite runs in about 15 seconds. If Mindtrail saves you from re-explaining your codebase, a ⭐
|
|
227
|
+
helps others find it.
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
[MIT](LICENSE)
|
|
232
|
+
|
|
233
|
+
<!-- mcp-name: io.github.rohitdeshmukh-1/mindtrail -->
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🧭 Mindtrail
|
|
4
|
+
|
|
5
|
+
**Leave a trail your AI agents can follow.**
|
|
6
|
+
|
|
7
|
+
Persistent, local-first memory for coding agents over MCP. Tell your agent something once,
|
|
8
|
+
and every future session remembers it.
|
|
9
|
+
|
|
10
|
+
[](https://github.com/RohitDeshmukh-1/Mindtrail-MCP/actions/workflows/ci.yml)
|
|
11
|
+
[](https://www.python.org/)
|
|
12
|
+
[](https://modelcontextprotocol.io)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
Every new agent session starts from zero. You explain your conventions again, re-state your
|
|
20
|
+
preferences, and re-describe decisions you made last week. **Mindtrail gives your agents a shared,
|
|
21
|
+
long-term memory** through the [Model Context Protocol](https://modelcontextprotocol.io), so
|
|
22
|
+
what one session learns, every later session (in any tool) can recall.
|
|
23
|
+
|
|
24
|
+
- 🔌 **Works with any MCP client.** One memory shared by Claude Code, Cursor, VS Code, Codex
|
|
25
|
+
and your own agents.
|
|
26
|
+
- 🏠 **Local-first and private.** One SQLite file on your machine. No account, no API key, no
|
|
27
|
+
telemetry.
|
|
28
|
+
- ⚡ **Installs in seconds.** No model download is required; add neural embeddings later with
|
|
29
|
+
one extra.
|
|
30
|
+
- 🗂️ **Scoped automatically.** Repo facts stay with the repo (detected from the git remote) and
|
|
31
|
+
personal preferences follow you everywhere.
|
|
32
|
+
- 🔎 **Hybrid retrieval.** Keyword (BM25) and vector search, fused and ranked, with the ranking
|
|
33
|
+
signals shown for every result.
|
|
34
|
+
- 🛡️ **Safe by default.** Refuses to store credentials, marks recalled memory as untrusted data,
|
|
35
|
+
and deletes for real.
|
|
36
|
+
|
|
37
|
+
## Does it actually help?
|
|
38
|
+
|
|
39
|
+
We tested it with real Claude Code sessions. In one session the user mentions a project fact
|
|
40
|
+
in passing ("FYI, this project uses pnpm"). A fresh session later gets a task that depends on
|
|
41
|
+
it ("how do I add lodash?"). The agent is never told to use Mindtrail.
|
|
42
|
+
|
|
43
|
+
| | stored the fact on its own | applied it in a later session |
|
|
44
|
+
|---|---:|---:|
|
|
45
|
+
| Claude Code without Mindtrail | – | 0/12 |
|
|
46
|
+
| Claude Code with `mindtrail[semantic]` | **36/36** | **36/36** |
|
|
47
|
+
|
|
48
|
+
Without memory, the agent answers from habit every time: `npm install lodash`, a commit
|
|
49
|
+
message in the wrong format, port 5432 instead of your 5433. With Mindtrail it checks first
|
|
50
|
+
and gets your project's answer. This is a small test (12 facts run three times, one model,
|
|
51
|
+
an empty repository), not a measure of task success on large codebases.
|
|
52
|
+
[Method, raw results and how to reproduce](benchmarks/README.md#agent-evaluation).
|
|
53
|
+
|
|
54
|
+
## Quickstart
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pipx install "mindtrail[semantic]" # or: uv tool install "mindtrail[semantic]"
|
|
58
|
+
mindtrail init # downloads the embedding model once (~210 MB)
|
|
59
|
+
claude mcp add mindtrail --scope user -- mindtrail serve # Claude Code
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Have [uv](https://docs.astral.sh/uv/)? Skip the install step; `uvx` fetches Mindtrail on first
|
|
63
|
+
run (the embedding model downloads in the background the first time the server starts):
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
claude mcp add mindtrail --scope user -- uvx --from "mindtrail[semantic]" mindtrail serve
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Cursor, VS Code, Codex and custom clients are covered in
|
|
70
|
+
**[docs/integrations.md](docs/integrations.md)**, and `mindtrail init` prints each config.
|
|
71
|
+
Want the smallest install? `pipx install mindtrail` skips the model download and matches on
|
|
72
|
+
words instead of meaning (see [Better semantic recall](#better-semantic-recall)).
|
|
73
|
+
|
|
74
|
+
Then try it:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
Session 1 › FYI, this project uses conventional commits and squash merges.
|
|
78
|
+
Session 2 › Write a commit message for these changes.
|
|
79
|
+
→ the agent recalls the convention and writes "feat(api): add pagination to /orders"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Using it day to day
|
|
83
|
+
|
|
84
|
+
You don't need special commands. Work as usual and the agent decides what to keep:
|
|
85
|
+
|
|
86
|
+
- **Mention things once.** "We deploy from the `release` branch", "I prefer pytest over
|
|
87
|
+
unittest", "the flaky test was a timezone bug, fixed by pinning TZ=UTC". The agent stores
|
|
88
|
+
facts like these on its own. Say "remember that…" when you want to be sure.
|
|
89
|
+
- **Project vs. personal.** Facts about the repository go to a project space, shared by every
|
|
90
|
+
clone of the same git remote. Facts about you ("I like short answers") go to your personal
|
|
91
|
+
space and apply in every project.
|
|
92
|
+
- **Things change.** Say "we moved from npm to pnpm" and the agent replaces the old memory
|
|
93
|
+
instead of keeping both. The old one is kept as history but no longer recalled.
|
|
94
|
+
- **Ask what it knows.** "What do you remember about this project?" or, from the terminal,
|
|
95
|
+
`mindtrail list` and `mindtrail recall "<question>"`.
|
|
96
|
+
- **Forget anything.** "Forget the staging URL" in chat, or `mindtrail forget <id>`. Deletes
|
|
97
|
+
are permanent.
|
|
98
|
+
- **Switch tools freely.** Claude Code, Cursor and Codex pointed at the same Mindtrail share
|
|
99
|
+
one memory, so a convention taught in one tool is known in all of them.
|
|
100
|
+
|
|
101
|
+
Good things to store: conventions, commands, ownership, where config lives, decisions and why
|
|
102
|
+
they were made, root causes of tricky bugs. Don't bother with what the code or git history
|
|
103
|
+
already says. Secrets are refused automatically.
|
|
104
|
+
|
|
105
|
+
## How it works
|
|
106
|
+
|
|
107
|
+
Your agent gets three tools, and Mindtrail's server instructions tell it when to use them:
|
|
108
|
+
|
|
109
|
+
| Tool | What it does |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `remember` | Store one fact, preference, decision or event, scoped to the **project** or **personal** space. Pass `replaces` to supersede an outdated memory. |
|
|
112
|
+
| `recall` | Find relevant memories from the current project plus your personal space. Returns nothing when nothing relevant exists. |
|
|
113
|
+
| `forget` | Permanently delete a memory. |
|
|
114
|
+
|
|
115
|
+
Set `MINDTRAIL_TOOLS=full` for four more: `search_memory` (filters by space, type and validity),
|
|
116
|
+
`get_context` (a prompt-ready block within a token budget), `update_memory` (edits with
|
|
117
|
+
version history) and `get_memory`.
|
|
118
|
+
|
|
119
|
+
Behind the tools is a small, well-tested engine: duplicate merging, supersession, validity
|
|
120
|
+
windows, version history and hybrid ranking. See **[docs/architecture.md](docs/architecture.md)**.
|
|
121
|
+
|
|
122
|
+
## Manage memory from the terminal
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
mindtrail recall "how do we deploy?" # search project + personal memory
|
|
126
|
+
mindtrail remember "Staging is at staging.example.com" --scope project
|
|
127
|
+
mindtrail list # newest first
|
|
128
|
+
mindtrail forget <id> # permanent delete
|
|
129
|
+
mindtrail export -o memories.jsonl # everything you've stored, as JSON Lines
|
|
130
|
+
mindtrail doctor # diagnose the install
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Better semantic recall
|
|
134
|
+
|
|
135
|
+
The default embedder matches on words and word fragments. For recall by meaning ("how do we
|
|
136
|
+
deploy?" → "deploys go through GitHub Actions"), install the local neural model. It runs on CPU
|
|
137
|
+
and needs no API key:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pipx install "mindtrail[semantic]"
|
|
141
|
+
mindtrail init # downloads the model once (~210 MB) and re-indexes existing memories
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For a smaller download (67 MB, somewhat lower recall), set
|
|
145
|
+
`MINDTRAIL_EMBEDDING_MODEL=BAAI/bge-small-en-v1.5`. Memories stored under another model are
|
|
146
|
+
re-embedded automatically the next time the server starts.
|
|
147
|
+
|
|
148
|
+
## Retrieval benchmark
|
|
149
|
+
|
|
150
|
+
The agent test above is in [Does it actually help?](#does-it-actually-help). On two held-out sets of developer-memory questions (82 in total) that were never used for
|
|
151
|
+
tuning ([methodology](benchmarks/README.md)):
|
|
152
|
+
|
|
153
|
+
| | recall@1 | recall@5 | paraphrase recall@5 | correctly says "nothing stored" | stale/foreign leaks |
|
|
154
|
+
|---|---:|---:|---:|---:|---:|
|
|
155
|
+
| default install | 58–64% | 68–75% | 44–46% | 82–100% | **0%** |
|
|
156
|
+
| `mindtrail[semantic]` | **82–90%** | **93–94%** | **85–89%** | **100%** | **0%** |
|
|
157
|
+
|
|
158
|
+
This is a small, synthetic retrieval benchmark written by us. Run `mindtrail bench` to
|
|
159
|
+
reproduce it, or add your own dataset.
|
|
160
|
+
|
|
161
|
+
## Use it from Python
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from mindtrail import MemoryService
|
|
165
|
+
|
|
166
|
+
memory = MemoryService.from_config()
|
|
167
|
+
memory.remember("The API uses FastAPI and PostgreSQL", space_id="project:shop")
|
|
168
|
+
print(memory.get_context("add a new endpoint", space_ids=["project:shop"]).text)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Privacy and security
|
|
172
|
+
|
|
173
|
+
Everything stays in `~/.mindtrail/mindtrail.db` on your machine. Mindtrail refuses writes that
|
|
174
|
+
look like API keys, tokens or private keys. `forget` overwrites deleted data on disk, and recalled memories
|
|
175
|
+
are marked as untrusted reference data so agents don't follow instructions stored inside them.
|
|
176
|
+
See [SECURITY.md](SECURITY.md) to report issues.
|
|
177
|
+
|
|
178
|
+
## Roadmap
|
|
179
|
+
|
|
180
|
+
- [x] Core engine: hybrid retrieval, dedup, supersession, validity windows, history
|
|
181
|
+
- [x] MCP server and CLI, with automatic project scoping
|
|
182
|
+
- [ ] PostgreSQL + pgvector backend with multi-tenant isolation
|
|
183
|
+
- [x] Retrieval benchmark suite in CI (recall@k, MRR, abstention, leak rate)
|
|
184
|
+
- [ ] Hosted remote MCP with one-click OAuth connectors
|
|
185
|
+
- [ ] Web memory viewer (browse, edit, delete, export)
|
|
186
|
+
- [ ] Entity graph, contradiction detection and memory consolidation
|
|
187
|
+
|
|
188
|
+
## Contributing
|
|
189
|
+
|
|
190
|
+
Issues and PRs are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) to get set up; the whole
|
|
191
|
+
suite runs in about 15 seconds. If Mindtrail saves you from re-explaining your codebase, a ⭐
|
|
192
|
+
helps others find it.
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
[MIT](LICENSE)
|
|
197
|
+
|
|
198
|
+
<!-- mcp-name: io.github.rohitdeshmukh-1/mindtrail -->
|