archivist
by sonixz
README.md
# AIrchivist
*The repository, the package and the command are named `archivist`; the documents say Archivist.*
A knowledge store for coding agents, with an archivist. Agents connect over the Model Context
Protocol (MCP), read what the store holds and **propose** items; they never write directly: the
archivist files each proposal (a place, themes, links) and answers with a receipt. You run it
from a control panel in the terminal, where you can also fill it yourself. Everything lives in
one folder on your machine, in SQLite.

[Site](https://sonixz.github.io/archivist/) · [Front page](index.html) · [Devlog](devlog/index.html) · [Status](STATUS.md) ·
[Documents](docs/README.md)
Archivist is the engine of Second Brain GD, a desktop app, extracted into a repository of its
own: the same code and the same data model, without the desktop interface.
## Does it work today?
Yes, locally, on Linux. [STATUS.md](STATUS.md) is the full account; in short:
- **What works:** the store, the MCP server (twelve tools that read, two that propose, one token
and one level per client), the archivist filing with one model call, the control panel and the
same actions as plain commands, several Brains on one machine, capture of a note, a file, a
folder or a web address, backups with verify and restore.
- **How it was checked:** 398 tests run offline, without a model key, on Python 3.12 and
3.13. Two coding agents, Claude Code and Codex, were connected for real
([the trial](docs/agents-trial.md)); the filing was tried with a real model on 26 cases
([results](quality/results.md)).
- **What was not tried:** the panel's key dialog and capture dialog with the real provider (the
commands were); any terminal other than tmux on Linux under WSL; Windows and macOS; a Brain
made by the desktop app; search at 10,000 items with real vectors.
- **What it is not yet:** safe on a network (below); isolated (Brains on one machine are
separate folders and processes of the same user); able to file with more than one model
provider, OpenAI's API. The archivist's prompt and receipts are in French for now.
## Local only: do not expose it
**The engine is local only. It is not safe to expose on a network, and it refuses to try:** it
binds 127.0.0.1 (any other kind of address stops the start), speaks plain HTTP, and answers
`POST /mcp` to this computer only. Do not put it behind a reverse proxy or a tunnel: a proxy on
the same machine makes every caller look local. [SECURITY.md](SECURITY.md) lists what is known
to be weak.
## Quick start
You need Linux, Python 3.12 or 3.13, [uv](https://docs.astral.sh/uv/) and `git`.
```bash
git clone https://github.com/sonixz/archivist.git
cd archivist
uv sync --locked
uv run archivist
```
`uv sync --locked` installs the pinned packages into `.venv`. `uv run archivist` opens the
control panel (a terminal of 80 x 24 at least). It is keyboard only: every screen lists its
keys on its last line, `?` lists them all, Escape goes back and changes nothing, `q` quits.
No model key at hand? `export ARCHIVIST_ASSISTANT_PROVIDER=fake` first: the archivist then files
with the stand-in model the tests use, with no key and no outside call.
From the empty panel to a connected agent:
1. `n`, a name, Enter: a **project** is created. A project is a Brain, with its own folder
(under `~/.local/share/archivist/brains/`), its own engine and its own port on 127.0.0.1.
2. Enter opens the Brain. `2` then `k` asks for its **model key** (an OpenAI API key; how to make
one, with which permissions and models: [docs/model-key.md](docs/model-key.md)): it shows
as dots, the provider checks it, and it is never shown again. Without a key nothing is lost:
what comes in waits in the Inbox.
3. `4` then `n` creates a **user**: one agent, one token, one level. The token is shown once,
with the line to paste in a shell for Claude Code (`claude mcp add …`) or Codex, and the block for
any other agent's MCP configuration.
4. `a` **captures** something yourself: a note, a file, a folder or a web address. The next
window says where the archivist filed it and why.
The same without the panel, as plain commands:
```bash
uv run archivist projects create "Research"
uv run archivist key set research
uv run archivist users add research "my agent"
uv run archivist capture note research --title "Garden compost" --text "Compost needs air and water."
uv run archivist status
```
`key set` asks for the key at a prompt that does not show it (skip it with the stand-in model).
`users add` prints the token once, with the configuration block. `capture` answers:
```text
Filed: « Garden compost » in Resources › Garden (a new place) · themes: garden
Receipt: « Garden compost » classé dans Ressources › Garden. Nouvelle place créée.
Journal: created by owner; filed by the archivist
```
(The stand-in model's answer; a real model writes its own receipt.)
Engines keep running when the panel closes, so that agents still reach their Brains.
`uv run archivist projects stop research` stops one; its data stays.
## Connect an agent
A coding agent connects as an MCP client with the Brain's address and **its own token**. The
panel and `archivist users add` print this block with both already in it:
```json
{
"mcpServers": {
"archivist-research": {
"type": "http",
"url": "http://127.0.0.1:8765/mcp",
"headers": { "Authorization": "Bearer <token>" }
}
}
}
```
The key names and the file this block goes in differ from one agent to another: check the
agent's own documentation. A file that holds a token is a secret: keep it out of a repository.
The agent then sees twelve tools that read and, by its level, `propose_item` and
`propose_change`. What it proposes waits for your approval (`p` in the panel, or
`archivist proposals list`), unless you marked that user as trusted.
[docs/mcp.md](docs/mcp.md) has the tools, the levels, the relay for agents that can only start
a command, and a way to check a token by hand.
## Read more
| | |
|---|---|
| [docs/README.md](docs/README.md) | every document, one line each |
| [docs/commands.md](docs/commands.md) | every `archivist` command, its options and exit codes |
| [docs/panel.md](docs/panel.md) | the screens, the tabs, the keys |
| [docs/capture.md](docs/capture.md) | what a capture does, and its limits |
| [docs/mcp.md](docs/mcp.md) | the MCP tools, the levels, the relay |
| [docs/configuration.md](docs/configuration.md) | environment variables, the home folder, the model |
| [docs/engine-api.md](docs/engine-api.md) | one engine by hand, and its HTTP routes |
| [STATUS.md](STATUS.md) | what is verified, loop by loop, and what is not |
| [PRODUCT.md](PRODUCT.md), [VISION.md](VISION.md) | what it is for, and what it will never be |
| [ARCHITECTURE.md](ARCHITECTURE.md) | the parts, with diagrams, and the known weaknesses |
| [BACKLOG.md](BACKLOG.md) | what is left, in order |
| [devlog](devlog/index.html) | one page per loop, with pictures of the real panel |
The devlog and the [front page](index.html) are HTML: GitHub shows their source, so open them
from a clone, or on the project's site: <https://sonixz.github.io/archivist/>.
## Contributing and security
[CONTRIBUTING.md](CONTRIBUTING.md) says how to set up, test and propose a change.
[SECURITY.md](SECURITY.md) says what is known to be weak and how to report a fault privately.
```bash
uv run ruff check archivist tests tools quality
uv run python -m unittest discover -s tests/python -t . -v
```
The tests need no key and no network once the packages are installed; they take about ten
minutes.
## Licence
MIT, see [LICENSE](LICENSE). Third-party packages and their licences:
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues