kontxt is the open source, local-first memory layer that powers 4StaX. It ships as an MIT licensed npm package with a CLI and an MCP server. No account required. No telemetry by default.Documentation Index
Fetch the complete documentation index at: https://docs.4stax.com/llms.txt
Use this file to discover all available pages before exploring further.
4stax-hq/kontxt
View the source on GitHub
What it is
kontxt implements cross-session AI memory via the Model Context Protocol. It stores conversation-derived entries in a local SQLite vault, ranks them for relevance, and serves them to MCP-compatible clients like Cursor and Claude Desktop.Who it is for
kontxt is built for developers who want the following properties:- Persistent context across sessions without vendor lock in.
- Local first storage where you can inspect and delete everything.
- A standard integration surface that works across MCP hosts.
What it is not
kontxt is not a hosted service. It runs on your machine. Your data stays on your machine. The 4StaX cloud (on the waitlist) will add sync and policy on top, but the core MCP tool surface remains identical.Mental model
Think of kontxt as two things:- A local database that stores durable memories.
- An MCP server that lets your AI host read and write those memories using tools.
Repo layout
Local vault layout
On first run, kontxt creates a local working directory under your home folder:What is inside vault.db
kontxt stores short, structured entries. It does not store full transcripts by default.
A memory has:
- Content, the text you want to preserve.
- Type, which controls how it is grouped and how it is retrieved.
- Optional project label, which makes it easy to filter and segment.
- Metadata for retrieval, such as timestamps and access counts.
- Optional embeddings and an embedding tier, which power semantic search.
Tech stack
| Layer | Technology |
|---|---|
| Runtime | Node.js 18+ |
| Storage | SQLite via better-sqlite3 |
| Protocol | Model Context Protocol (MCP) |
| Embeddings | OpenAI (optional), offline Transformers.js, Ollama (if available), or keyword fallback |
| Package manager | pnpm |
Embeddings and tiering
kontxt supports multiple embedding backends. Each stored embedding is tagged with anembedding_tier.
Similarity search only compares vectors within the same tier. This prevents two common failure modes:
- Switching providers and getting meaningless similarity scores.
- Mixing offline and online embedding spaces in one query.
Relevance ranking
kontxt returns a small set of the most relevant memories rather than dumping your entire vault. The score blends semantic similarity, recency, access frequency, and importance. The details are covered in the Memory section of the docs.Open core model
Install
The fastest way to get running is:~/.kontxt/vault.db and can configure supported MCP hosts.
Running the MCP server
Most hosts will run kontxt using:Operational notes
Backups
The simplest backup is copying~/.kontxt/vault.db while kontxt is not running.
If you are actively using kontxt, stop the daemon first to avoid copying during a write.
Security
The vault is a local file. Treat it like any sensitive local data store. If you set API keys in~/.kontxt/config.json, secure your user account and do not commit that file to git.
Contributing
The repo is open for issues, bug reports, and pull requests. SeeCONTRIBUTING.md in the repository for guidelines.
