Palimpsest Memory
by starhound
README.md
# Palimpsest Memory

**Persistent, scoped memory and grounded code context for AI agents — with evidence you can inspect.**
Palimpsest is a memory engine for agents that work across conversations and
clients. It retains what was recorded, where it came from, who may use it, and
how it changed; nothing becomes durable context merely because it was said. It
also indexes authorized Git repositories so an agent can request current code
evidence with file, line, revision and hash citations.
Use it from Python, a local CLI, authenticated HTTP or MCP, with supported
installers for Claude Code, Codex, OpenCode and Hermes. The deterministic core
in local SQLite mode runs without a model or embedding API. The project is pre-1.0; treat
every capability claim as tied to a specific revision.
[Product tour](docs/site/product-tour.md) ·
[Getting started](docs/site/getting-started.md) ·
[Task guides](docs/site/guides.md) ·
[Operation catalog](docs/site/reference/operations.md) ·
[Evidence and limits](docs/site/evidence.md)
## What you can do
| Task | Where to go |
| --- | --- |
| Capture a conversation turn, inspect the proposed candidate, approve or reject it | [Capture and review](docs/site/memory.md#reviewed-local-cli-capture-and-later-process-recall) |
| Correct or forget a durable record and inspect its revision history | [Memory lifecycle](docs/site/memory.md) |
| Search memories and understand why something was — or was not — returned | [Retrieval](docs/site/retrieval.md) |
| Recall explicitly recorded subject/relation/value associations and position-bound episode steps | [Techniques](docs/site/engine-techniques.md) |
| Keep bounded task context, export a handoff, resume in a later session | [Sessions and handoffs](docs/site/sessions.md) |
| Index an authorized repository and ground a coding task in cited evidence | [Code intelligence](docs/site/coding.md) |
| Connect documents and Git sources with freshness checks | [Connected sources](docs/site/sources.md) |
| Attach Claude Code, Codex, OpenCode or Hermes over MCP | [Agent setup](docs/site/agents.md) |
| Browse inventory, search, proposals and the memory sphere in a local viewer | [Local viewer](docs/site/local-ui.md) · [Brain map](docs/site/brain-map.md) |
| Deploy, secure and recover an authenticated service | [Operations](docs/site/operations.md) · [Deployment](docs/site/deployment.md) |
| Judge claims: implemented, fixture-verified or deployment-verified | [Evidence](docs/site/evidence.md) · [Acceptance matrix](docs/site/feature-acceptance.md) |
These are different kinds of state. A captured source turn is evidence; a
candidate is a proposal; a durable fact is a reviewed or explicitly sourced
assertion; a working-session item is temporary task context. Saving any of them
does not by itself make it eligible for every query. For example, an agent can
capture an explicit project preference, leave it pending for review, recall the
approved claim in a later conversation, cite it in a decision, and supersede it
when the preference changes — the prior claim and its correction lineage stay
inspectable. Repository evidence follows a separate path: changed source hashes
cause stale snippets to be withheld until an explicit refresh.
## Quickstart
This walkthrough uses **local SQLite**. It requires Git and **Python 3.10+**
with `venv`, and installs the current source checkout. For a pinned source
install, check out a published release tag before installing and use its
matching documentation.
If the version you want has been published, see [release assets and install
commands](RELEASE.md#release-assets) for the Python wheel, source distribution,
and Linux `amd64` Docker image (GHCR or offline archive). Palimpsest itself is
not published to PyPI for this release. The source commands below do not
require a release or registry image.
```bash
git clone https://github.com/starhound/palimpsest-memory.git
cd palimpsest-memory
python3 -m venv .venv
. .venv/bin/activate
python -m pip install '.[mcp,code,audit]'
DEMO_DIR="$(mktemp -d "${TMPDIR:-/tmp}/palimpsest-demo.XXXXXX")"
export DEMO_DB="$DEMO_DIR/memory.sqlite3"
palimpsest-cli --db "$DEMO_DB" health
palimpsest-cli --db "$DEMO_DB" ingest-turn demo-conversation session-A turn-1 \
'Remember that Cedar | step:0 | Verify backup' --request-id demo-capture-1 \
> "$DEMO_DIR/capture.json"
cat "$DEMO_DIR/capture.json"
palimpsest-cli --db "$DEMO_DB" candidate-list --status pending --limit 5
```
Capture writes immutable source evidence and a **pending candidate** — not a
durable fact. Inspect it before deciding:
```bash
CANDIDATE_ID="$(python -c 'import json, sys; print(json.load(sys.stdin)["candidate_id"])' < "$DEMO_DIR/capture.json")"
palimpsest-cli --db "$DEMO_DB" candidate-inspect "$CANDIDATE_ID"
palimpsest-cli --db "$DEMO_DB" candidate-explain "$CANDIDATE_ID"
palimpsest-cli --db "$DEMO_DB" bsc-sequence-recall Cedar # abstains before review
```
Approve only after checking that the candidate contains the synthetic statement
above. If you decline it, use `candidate-reject` instead; rejection writes no
durable fact.
```bash
palimpsest-cli --db "$DEMO_DB" candidate-approve "$CANDIDATE_ID" --request-id demo-review-1
```
Then recall it in a fresh process, with an unrelated negative control:
```bash
palimpsest-cli --db "$DEMO_DB" bsc-sequence-recall Cedar # the reviewed step, with its citation
palimpsest-cli --db "$DEMO_DB" bsc-sequence-recall Unknown # abstains
```
Use a disposable database while learning — never an existing production
database. The
[review walkthrough](docs/site/memory.md#reviewed-local-cli-capture-and-later-process-recall)
covers the full lifecycle, and [getting started](docs/site/getting-started.md)
separates a new local engine, attaching an agent to an existing service, and
dashboard setup.
### Connect an agent
```bash
palimpsest install codex --db /absolute/local/memory.sqlite3 \
--namespace team/default --workspace project
palimpsest doctor --client codex --probe --timeout 15
```
Use `claude` for Claude Code or `opencode` for OpenCode. Installation preserves
unrelated configuration and supports uninstall. This configures local stdio;
remote authenticated HTTP/MCP and Hermes have their own
[setup instructions](docs/site/agents.md). A successful probe establishes
connectivity, tool discovery and health — confirm actual recall with a known
reviewed fixture in the intended client and scope.
### Ground a coding task
```bash
palimpsest-cli --db "$DEMO_DIR/code.sqlite3" code_index_repository /absolute/git/repository
palimpsest-cli --db "$DEMO_DIR/code.sqlite3" \
code_task_context /absolute/git/repository 'Registry.rotate' --max-bytes 7000
palimpsest-cli --db "$DEMO_DIR/code.sqlite3" \
code_project_overview /absolute/git/repository --max-bytes 6000
```
The server must be able to read the authorized repository. Context returns
revision/path/line/hash evidence; freshness detects drift; refresh updates the
index. Suggested tests describe structural relationships and are not executed
coverage. See the [coding workflow](docs/site/coding.md).
### Browse the dashboard
With an existing authenticated JSON HTTP engine, on its host:
```bash
palimpsest-ui --backend http://127.0.0.1:15400 --port 17840
```
Open `http://127.0.0.1:17840` and enter the viewer's private one-time code. The
backend credential stays server-side; the normal viewer session is read-only.
[Viewer setup](docs/site/local-ui.md) · [Brain-map controls and bounds](docs/site/brain-map.md).
## How retrieval works
In **SQLite mode**, `search_hybrid` uses native holographic/BSC scoring by default;
the HTTP/MCP path and the direct Store path share the native scorer, and no
provider, vector server or rebuild step is needed to compute request-local BSC
scores.
1. SQLite selects query-supported evidence and enforces scope, visibility,
provenance, lifecycle, time and conflict rules.
2. The bounded native scorer encodes the query and eligible text into 8,192-bit
Binary Spatter Codes and measures Hamming similarity.
3. Hybrid ranking combines lexical, BSC and entity signals, with bounded
rehearsal contribution.
4. Consumers receive cited evidence or an explicit insufficient-evidence result.
Plain `search` (including CLI `search`) and `search_page` stay lexical. Explicit
policy paths follow their declared contracts. BSC work-budget or scoring
failures retain lexical order and report their status. Optional embedding
reranking is a separate server configuration; it does not replace evidence
admission. BSC represents deterministic token patterns and explicit structure —
it is not a trained semantic model or a guarantee of paraphrase understanding.
See [routing, bounds and a runnable verification](docs/site/retrieval.md#verify-default-native-bsc-scoring),
[diagnosing missing recall](docs/site/retrieval.md#diagnosing-missing-recall) and
[the technique reference](docs/site/engine-techniques.md).
In **OpenSearch authority mode**, MCP `memory_search_hybrid` combines lexical,
vector and entity candidates, reads back the current scoped records, and ranks
them with those signals plus native BSC similarity. This mode requires an
embedding endpoint and does not fall back to SQLite.
## One authoritative backend per deployment
Choose **SQLite** for the default local deployment or **OpenSearch** for the
experimental MCP authority. Each mode owns its own durable records; OpenSearch
authority stores the record and its embedding together in one document.
The following diagram shows the SQLite path:
```mermaid
flowchart LR
C[Agents / CLI / viewer] --> A[Python / authenticated HTTP / MCP]
A --> S[Service: contracts and authorization]
S --> D[Local SQLite: evidence and lifecycle]
D --> R[Eligible retrieval candidates]
R --> B[Default hybrid: lexical + native BSC + entity]
R -. optional .-> E[Configured embedding reranking]
S --> I[Derived repository index]
B --> P[Cited results / bounded context]
E --> P
```
In SQLite mode, SQLite owns facts, source/review evidence, revisions and lifecycle. Code and
vector projections are derived. Similarity cannot widen permissions or revive
forgotten, expired or unsupported evidence. Keep SQLite on local storage —
never NFS or a shared NAS mount — and back it up.
[Architecture](docs/site/architecture.md) explains the request and transaction
boundaries.
## Storage: an honest matrix
| Storage | Role | Status | Limits you should know |
| --- | --- | --- | --- |
| SQLite (default) | Authoritative in SQLite mode: facts, sources, review evidence, revisions, consent, audit, lifecycle | Current core | Local filesystem only, never NFS or a shared NAS mount; back it up |
| Elasticsearch / OpenSearch / MongoDB / Weaviate vector adapters | Optional derived candidate projections | Protocol fixtures verify the derived adapter contracts | Similarity never authorizes recall — SQLite eligibility still applies; switching is restart-scoped, with no backfill |
| Remote embedding provider | Optional vector enrichment for derived indexes | Separate configuration | Provider failure falls back to deterministic retrieval; model or dimension changes need validation |
| OpenSearch memory authority (`--storage-backend opensearch`) | A separate authority mode that opens no SQLite database | **Experimental — not full parity** | No retained revision history, evidence attribution, source connectors, document sync, candidate review, SQLite migrations or bundled automatic Hermes memory capture; ranking weights provisional; unsupported operations are refused, not delegated; needs a dedicated index, explicit initialization and a configured embedding endpoint |
**The OpenSearch authority mode is experimental and is not feature parity with
SQLite.** It is guarded on purpose — compare-and-swap corrections, payload-free
tombstone forgets that are not proof of erasure, and refused unsupported
operations. Validate the requirements and migration plan before moving a live service. Read
[OpenSearch as the authoritative memory backend](docs/site/opensearch-memory-authority.md)
first, and [backend switching](docs/site/backend-switching.md) for the
restart-scoped rules that govern every projection change. The
[adapter overview](docs/site/backends.md) covers the derived clients.
## What a graph or a test result proves
The brain map is an orbitable 3D atlas of authorized active inventory. It is a
view: returned-evidence receipts describe recorded selection and citation
events, not a neural network or an internal ranking traversal. Code on
`main`, a published package and an active deployment can differ. These
docs describe source behavior; check the exact installed version before relying
on a feature, and use the [acceptance matrix](docs/site/feature-acceptance.md)
and [evaluation evidence](docs/site/evidence.md) to distinguish implementation,
synthetic verification, client-task results and deployment.
| It provides | Do not infer |
| --- | --- |
| Scoped records, source linkage and revision history | Every stored claim is true or current |
| Deterministic retrieval and optional configured ranking | General semantic recall or a learned memory model |
| Bounded context and citations | Proof that using memory improves every task |
| Tests, evaluation reports and recovery checks | Every vendor or boot scenario has passed live acceptance |
Benefit over a good summary or ordinary file tools remains task-dependent.
[Graph activity](docs/site/graph-activity.md) documents observation scope and
gaps.
## Documentation, development and security
Read the [product tour](docs/site/product-tour.md) for the complete workflow,
then choose a [task guide](docs/site/guides.md). Exact fields and replay
semantics live in the [operation catalog](docs/site/reference/operations.md);
the [HTTP and Python API](docs/site/api.md) and
[optional backends](docs/site/backends.md) have their own reference pages.
```bash
python -m unittest discover -s tests -p 'test_*.py' -q
mkdocs build --strict
python scripts/check_docs.py
git diff --check
```
See [development prerequisites](docs/site/development.md),
[CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md) and the
[MIT LICENSE](LICENSE). Public release review is tracked in the
[disclosure checklist](docs/public-release-checklist.md).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues