A second brain for humans and their agents — MCP server backed by SQLite FTS5.
Project description
KraangA second brain for you and your agents. |
Kraang is an MCP (Model Context Protocol) server that gives AI assistants persistent memory and session indexing, backed by SQLite with FTS5 full-text search. It stores knowledge notes, indexes conversation transcripts, and surfaces what matters via search.
Why?
AI assistants forget everything between sessions. Kraang gives them persistent memory — decisions, debugging breakthroughs, patterns — so your next conversation picks up where the last one left off.
Quick Start
The fastest way to get started is with kraang init:
uvx kraang init # ephemeral — downloads on each run
uv tool install kraang # persistent — install once, use everywhere
kraang init
This creates a .kraang/ directory, initializes the database, configures .mcp.json, sets up a SessionEnd hook for automatic session indexing, creates .claude/rules/kraang.md for proactive agent behavior, and indexes any existing sessions.
Manual Configuration
Add to your MCP client configuration (e.g. Claude Code, Claude Desktop):
{
"mcpServers": {
"kraang": {
"command": "uvx",
"args": ["kraang", "serve"],
"env": { "KRAANG_DB_PATH": ".kraang/kraang.db" }
}
}
}
MCP Tools
| Tool | Description |
|---|---|
remember |
Save knowledge to the brain. If a note with the same title exists, it updates in place. |
recall |
Search notes and indexed sessions. Supports scoping to "notes", "sessions", or "all". |
read_session |
Load a full conversation transcript by session ID (use recall to find sessions first). |
forget |
Downweight or hide a note by adjusting its relevance score (0.0 = hidden, 1.0 = full). |
status |
Get a knowledge base overview: note/session counts, recent activity, top tags. |
CLI Commands
| Command | Description |
|---|---|
kraang init |
Set up kraang for the current project (database, config, hooks, initial index). |
kraang serve |
Run the MCP server over stdio (invoked by Claude Code). |
kraang index |
Index or re-index conversation sessions for the project. |
kraang sessions |
List recent conversation sessions. |
kraang session <id> |
View a session transcript in detail. |
kraang search <query> |
Search notes and sessions from the terminal. |
kraang notes |
List notes in the knowledge base. |
kraang status |
Show knowledge base health and statistics. |
Architecture
Kraang uses a layered architecture:
- Models (
models.py) -- Pydantic schemas for notes, sessions, and search results. - Store (
store.py) -- SQLite backend with FTS5 full-text search and BM25 ranking. - Search (
search.py) -- Query parsing and FTS5 expression building. - Indexer (
indexer.py) -- Reads Claude Code JSONL transcripts and indexes sessions. - Server (
server.py) -- MCP server exposing 5 tools over stdio. - CLI (
cli.py) -- Typer CLI for init, serve, index, and local queries. - Formatter (
formatter.py) -- Markdown formatting for tool and CLI output. - Display (
display.py) -- Rich console rendering for CLI commands. - Config (
config.py) -- Project root detection and database path resolution.
Development
git clone https://github.com/johnnygreco/kraang.git && cd kraang
uv sync --extra dev
make install-hooks # install pre-commit hooks (run once)
make test
make lint
Pre-commit hooks run automatically before each commit (ruff format, ruff check --fix, ty). Run manually:
uv run pre-commit run --all-files
Run the full check suite:
make coverage # tests + coverage report
make format # auto-format with ruff
Troubleshooting
| Problem | Fix |
|---|---|
| Kraang tools not showing up in Claude Code | Restart Claude Code after running kraang init |
| Sessions not being indexed automatically | Check that .claude/settings.json has the SessionEnd hook |
| Search returns nothing | Run kraang status to check counts, then kraang index to re-index |
| Need a fresh start | Delete .kraang/ and re-run kraang init |
License
Apache 2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kraang-0.2.1.tar.gz.
File metadata
- Download URL: kraang-0.2.1.tar.gz
- Upload date:
- Size: 148.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc2137c83c6fee616c10aab3b312777e6f27d44e6e662d0d9bebcaaca39008a2
|
|
| MD5 |
85a9a51702c91456a0994cd5fbbbf68e
|
|
| BLAKE2b-256 |
6747e72d2078e64e3a02fee47024008a82c83ac14256d0fb08fc935ad89a8e8f
|
File details
Details for the file kraang-0.2.1-py3-none-any.whl.
File metadata
- Download URL: kraang-0.2.1-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c57174494bef38ea0443f5bf2d0a5dd2f5a5c7a7c577cfcd4344e7be41b46fd9
|
|
| MD5 |
69c4582961ec81879a245d8db35a5d1b
|
|
| BLAKE2b-256 |
25dfe1e2a487af6292d9d2f23447b886f50a5cd507842316b9e5c6b10495109e
|