Skip to main content

kvault

Persistent, structured memory for AI agents — plain Markdown, a CLI, zero services.

pip install knowledgevault

Your agent creates nodes (people, projects, notes), keeps every parent summary a rollup of what's below, and orients itself with one cheap command:

$ kvault tree
. « Knowledge Base » [3 children, 11 total] ~2026-06-07
  notes [1 children, 1 total] ~2026-04-11
    reading_list ~2026-04-11
  people [2 children, 5 total] ~2026-06-02
    contacts [2 children, 2 total] ~2026-06-02
      mike_torres ~2026-01-20
      sarah_chen ~2026-06-02
    friends [1 children, 1 total] ~2026-03-14
      alex_rivera ~2026-03-14
  projects [2 children, 2 total] ~2026-06-07
    launch_plan « Launch Plan — v2 » ~2026-06-07
    website_redesign ~2026-05-28

One outline line per node: title, size, and most-recent activity — about 15 tokens each, so a several-hundred-node KB orients an agent for a few thousand tokens. Anything pruned by --depth or --max-children is called out in place (…74 nodes below), so a partial view can never silently hide content.

Built for developers using AI coding tools who want their agent to remember things between sessions — contacts, projects, meeting notes, research — in a structured, navigable format. kvault needs no API keys, no hosted service, no database: any agent that can run shell commands can use it.

How it works

  • A node is a directory containing a single _summary.md — YAML frontmatter plus Markdown. Leaf nodes are entities (a person, a project); parent nodes summarize their descendants.
  • Parent summaries are the index. Every level is a comprehensive rollup of the subtree below it, written by the agent itself. Navigation is top-down reading, not blind grepping.
  • Writes propagate. kvault write returns the full ancestor chain so the agent rewrites those summaries in one follow-up call — the "2-call write workflow."
  • The KB instructs the agent. kvault init generates an AGENTS.md with the workflow, the rules (search before create, never fabricate, propagate everything), and a periodic maintenance playbook.

Quickstart (30 seconds)

pip install knowledgevault
kvault init ./my_kb --name "Your Name"

Then tell your agent:

"Use kvault CLI commands to manage my knowledge base at ./my_kb"

The agent reads the generated AGENTS.md and starts working.

Tool Setup
Project-instruction agents Keep AGENTS.md in the KB root so the agent reads the workflow automatically
Terminal agents Tell the agent: "Read AGENTS.md for the kvault workflow, then use shell commands to manage ./my_kb"
Custom-instruction agents Paste the generated AGENTS.md workflow into the workspace or system instructions

Agent skill included. skills/kvault/SKILL.md carries the full workflow in the portable SKILL.md agent-skills format, so the agent loads it on demand from any directory — no per-KB setup. Install it wherever your tool discovers skills:

# Claude Code
cp -r skills/kvault ~/.claude/skills/kvault

# OpenClaw (per workspace)
cp -r skills/kvault ~/.openclaw/workspace/skills/kvault

# Other agents: copy into your tool's skills directory, or paste the
# SKILL.md body into its custom instructions

Already have data? Point your agent at an export from a chat, email, or notes tool — see docs/importing-data.md.

The 2-call write workflow

# Call 1: write the node (stdin = frontmatter + markdown body)
kvault write people/contacts/sarah_chen --create --reasoning "Met at NeurIPS" --json --kb-root ./my_kb <<'EOF'
---
source: manual
aliases: [Sarah Chen, sarah@example.com]
---
# Sarah Chen
Research scientist at Acme AI...
EOF
# → {"success": true, "ancestors": [{path, current_content}, ...], "journal_logged": true}

# Call 2: the agent rewrites the returned ancestors, including root
kvault update-summaries --json --kb-root ./my_kb <<'EOF'
[
  {"path": "people/contacts", "content": "# Contacts\n...updated..."},
  {"path": "people", "content": "# People\n...updated..."},
  {"path": ".", "content": "# Knowledge Base\n...updated..."}
]
EOF

Required frontmatter: source, aliases — kvault stamps created/updated automatically (and preserves them on no-op rewrites, so the recency signal in the tree stays honest).

The maintenance loop

KBs rot without pruning. The tree annotations make refactor triggers deterministic instead of aspirational — agents read them off the orientation pass:

Signal Action
Branch with >10 children ([N children, ...]) Split into subgroups; kvault move entities; re-propagate
Branch ~updated_max older than ~6 months Review for stale or dead content
SUMMARY: warnings from kvault check Rewrite flagged parents as comprehensive rollups
Near-duplicate titles or aliases Verify identifiers, merge, delete the duplicate

kvault check also catches stale propagation, and works as a pre-prompt hook:

{
  "hooks": {
    "UserPromptSubmit": [
      {"type": "command", "command": "kvault check --kb-root /absolute/path/to/my_kb"}
    ]
  }
}

CLI reference

Category Commands
Orient & discover kvault tree [path] [--depth N] [--max-children N] [--gist], kvault search "<query>"
Nodes kvault read, kvault write (stdin), kvault list, kvault delete, kvault move
Summaries kvault read-summary, kvault write-summary (stdin), kvault update-summaries (stdin JSON), kvault ancestors
Quality kvault validate, kvault check
Journal & artifacts kvault journal, kvault artifact daily, kvault log summary
Lifecycle kvault init, kvault status

Agent-facing commands accept --json for machine-readable output and --kb-root (auto-detected from cwd by default), before or after the subcommand.

MCP server (optional)

The CLI is the primary interface. For MCP-native clients, a stdio compatibility server ships with the [mcp] extra (Python 3.10+), bound to one KB root per process:

pip install "knowledgevault[mcp]"
kvault-mcp --kb-root /absolute/path/to/my_kb
{
  "mcpServers": {
    "kvault": {
      "command": "kvault-mcp",
      "args": ["--kb-root", "/absolute/path/to/my_kb"]
    }
  }
}

It exposes the same operations as the CLI (kvault_tree, kvault_search, kvault_read_node, kvault_write_node, summary/journal/validation tools), plus a strict parent-summary workflow with stale-write detection. Set KVAULT_ALLOWED_ROOTS to pin allowed roots on shared runtimes. Protocol details: ARCHITECTURE.md.

It's just files

kvault produces Markdown with YAML frontmatter in a plain directory. No proprietary format, no database to export from. Your existing tools work out of the box:

Want to... Use
Semantic search Embed the .md files with any vector tool
Exact text search rg -n "phrase" ./my_kb
Visual browsing Open the KB directory in Obsidian or Logseq
Publish as a site Point Hugo, Jekyll, or Astro at the directory
CI validation Run kvault validate or kvault check in a GitHub Action
Bulk export find . -name _summary.md + yq over the frontmatter

Python API

from pathlib import Path
from kvault.core import operations as ops

kg_root = Path("my_kb")
outline = ops.build_outline(kg_root, depth=2)          # annotated tree as nested dict
node = ops.read_node(kg_root, "people/contacts/sarah_chen")
result = ops.write_node(kg_root, "people/contacts/new_person", "# Content", create=True)
matches = ops.search_nodes(kg_root, "sarah follow up")

Development

pip install -e ".[dev,mcp]"
pytest -q
ruff check .
black --check kvault/ tests/
mypy kvault/ --ignore-missing-imports

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

knowledgevault-0.12.0.tar.gz (92.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

knowledgevault-0.12.0-py3-none-any.whl (76.7 kB view details)

Uploaded Python 3

File details

Details for the file knowledgevault-0.12.0.tar.gz.

File metadata

  • Download URL: knowledgevault-0.12.0.tar.gz
  • Upload date:
  • Size: 92.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for knowledgevault-0.12.0.tar.gz
Algorithm Hash digest
SHA256 bbb0326eb88093f3421abcd34cfa319417d697987a13cdb985085099aa5eb0ca
MD5 6ff9dc6e60bd92978cd5fb66af569933
BLAKE2b-256 99481f6144b4a4dc4c3f96b231a1b1a9a0ca63b7dd955799a07d99e33ed6db54

See more details on using hashes here.

Provenance

The following attestation bundles were made for knowledgevault-0.12.0.tar.gz:

Publisher: publish.yml on cimo-labs/kvault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file knowledgevault-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: knowledgevault-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 76.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for knowledgevault-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39b3e8e466bf205a5747d1fb9eaf456f3ca8807e53a7781f92b1c047848b49c9
MD5 a0919d012dc3eb047d8a8d3533f94faa
BLAKE2b-256 37324f400af60f4987746911efe3ab373e775374b32b6cdad426a2d6ab833d2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for knowledgevault-0.12.0-py3-none-any.whl:

Publisher: publish.yml on cimo-labs/kvault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.13.0

2 files

0.12.1

2 files

This release

0.12.0 This release

2 files

0.11.3

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.2

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page