Skip to main content

mentat-wiki

Coding agents forget where you left off when a session ends. mentat-wiki keeps each project's status, next step, decisions, open threads and experiment notes in a local Markdown wiki. The next session starts with the status, open threads and recent notes loaded (decisions stay one file away), and /wrap updates them before you stop.

The vault is plain Markdown, best read in Obsidian. Claude Code first; any shell-capable agent through AGENTS.md. Python 3.10+, standard library only, no services, no network calls, no telemetry. MIT. Early release (alpha). Built on Andrej Karpathy's LLM Wiki pattern.

What a session looks like

A fictional project from the demo vault; real command output, shortened.

Session start. The SessionStart hook runs mentat-wiki context, and the agent sees:

# trailmap: status
## Where we left off
Parser and text profile work end to end. Five-point smoothing runs with a 3 m climb threshold;
the coastal test track reports 640 m of gain.
## Next step
- Add --json output for plotting.

# trailmap: open threads
- [ ] Write a regression test that pins the coastal track at 640 m of gain.
- [ ] Try a nine-point window on the coastal track and compare total gain.

Recent experiment notes:
- 2026-11-20 16:40 [failed] five-point window without edge padding -> first and last elevations dropped 14 m
- 2026-11-21 11:05 [worked] 3 m climb threshold -> 640 m gain, within 20 m of the sum from the route map

During the session. The agent logs what you decide and every attempt, failures included:

$ mentat-wiki decide --decision "Pad the edges before smoothing" --why "keeps the first and last points" --rejected "nine-point window"
decision recorded
$ mentat-wiki note --result worked "edge padding -> first and last elevations within 1 m"
noted in wiki/projects/trailmap/experiments.md

The Claude Code status line shows the project, what was kept today, proposals waiting for your answer, and the short session id (🔑):

🧠 trailmap · kept 3 today · ❓1 to confirm · 🔑 5f2c9a1e

Session end. You type /wrap. The agent rewrites the status and open threads, so the next session starts from here:

$ mentat-wiki wrap --where "Smoothing pads the edges now; the coastal track keeps 640 m of gain." --next "Add --json output for plotting." --thread "Pin the coastal track at 640 m in a regression test."
status updated

Next session. It starts from what you wrapped; the nine-point thread you dropped is gone:

# trailmap: status
## Where we left off
Smoothing pads the edges now; the coastal track keeps 640 m of gain.
## Next step
- Add --json output for plotting.

# trailmap: open threads
- [ ] Pin the coastal track at 640 m in a regression test.

Recent experiment notes:
- 2026-11-24 18:57 [worked] edge padding -> first and last elevations within 1 m

Quickstart

pipx install git+https://github.com/serhat-10/mentat-wiki    # or: pip install git+https://...
mentat-wiki init ~/vault          # creates the vault and remembers its path
mentat-wiki install claude        # shows a diff and asks first; --dry-run only previews
cd ~/code/my-app                  # any existing project folder
mentat-wiki project register      # name defaults to the folder: my-app
mentat-wiki doctor                # checks the vault and the Claude Code setup

It is not on PyPI yet, so install from GitHub (this needs git). If mentat-wiki is not found after a pip install, use python -m mentat_wiki in its place; the installer does the same.

Then start Claude Code in ~/code/my-app. The first session says there is nothing recorded yet; from the first /wrap on, every session starts where the last one stopped.

What install claude changes

In ~/.claude/settings.json (backed up first as settings.json.bak-<time>; your existing hooks, permissions and status line stay; an older mentat entry is upgraded):

  • a SessionStart hook, mentat-wiki context: loads your vault's core/ rules plus this project's status, open threads and recent experiment notes;
  • a UserPromptSubmit hook, mentat-wiki hook: writes a local session checkpoint (session id, time, prompt count and transcript path, never prompt text) and, only in registered folders and the vault, may add a short hint naming related pages;
  • a status line, only if you have none (--force-statusline replaces yours);
  • the permission Bash(mentat-wiki *), so the agent can run the CLI without a prompt each time.

It also writes the /idea, /keep and /wrap skills to ~/.claude/skills/, skipping any you already have with that name. If mentat-wiki is not on PATH for this Python, every entry uses <python> -m mentat_wiki instead; mentat-wiki config --command overrides the choice. A manifest in ~/.mentat/install-claude.json records each entry; mentat-wiki uninstall claude removes only those.

Your repositories are never written to. project register maps the folder to a project in ~/.mentat/config.json; all pages live in the vault. The vault's own CLAUDE.md and AGENTS.md are for sessions inside the vault, not for your repos.

Daily use

You:

  • /wrap before you stop.
  • /keep or /idea to file something right now.
  • mentat-wiki resume: how the last session in this folder ended, and how to reopen it.
  • mentat-wiki handover: a paste-ready prompt to continue in another tool.
  • mentat-wiki find "smoothing" and mentat-wiki digest to look things up.

The agent:

  • reads status, open threads and recent notes at session start;
  • logs the decisions you make or approve (decide) and each experiment attempt (note);
  • checks for an existing page before writing a new one;
  • asks once before saving anything else (next section).

Better with Obsidian

mentat-wiki does not need Obsidian, but the two work best together: mentat-wiki writes the vault, Obsidian shows it. Choose "Open folder as vault", pick the folder you gave to mentat-wiki init, and leave it open next to your agent. There is no plugin and nothing to sync; the CLI writes plain Markdown into that folder, so every save shows up there:

When What changes in Obsidian
/wrap the project's status and open-threads pages, and a line in wiki/log
a decision (decide) a row in the project's decisions page
an experiment (note) a line in the project's experiments page
/keep, /idea a new page, listed in wiki/index
inbox a line in inbox/inbox

What you get from it:

  • You see what the agent saved while you work, and can correct a page by hand. status and open-threads are the exception: the next /wrap rewrites them.
  • Pages link with [[wikilinks]], starting from wiki/index, so backlinks and the graph view work without setup.
  • Frontmatter such as type, domain and status appears as properties you can search on.

To see it filled in, open examples/demo-vault in Obsidian.

Ask-first capture (early)

When something worth keeping comes up mid-session (an idea, reusable knowledge, a decision the agent would log on its own), the agent registers a proposal, the status line shows it, and it asks one line:

Keep as idea "Export the profile as SVG"? y
kept wiki/ideas/export-the-profile-as-svg.md

/wrap also offers up to three unfiled items this way. Each answer (kept, edited, rejected, or ignored after 24 h) goes to a local ledger. mentat-wiki policy shows acceptance per category, and after 10 or more proposals with at least 90% accepted it suggests letting that category save without asking. It never changes anything itself: you edit core/capture-policy.md.

This part is new. Expect a few weeks of normal use before it has enough answers to suggest anything. Details: docs/capture-policy.md.

Why not CLAUDE.md or built-in memory?

CLAUDE.md holds the instructions you write, and Claude Code's auto memory keeps facts the model picks. Both help, and mentat-wiki runs next to them. It adds:

  • a fixed project-state shape: where we left off, next step and open threads, which /wrap rewrites, plus decisions with the alternatives you rejected and experiment notes, appended as you go;
  • one vault for all your projects, with idea, knowledge and source pages linked across them;
  • plain files that any agent or editor can read, and handover to continue in another tool.

Other tools in this space:

  • claude-mem handles automatic session-wide capture and compression for Claude Code. Use it for hands-off cross-session memory.
  • basic-memory serves local Markdown notes over MCP. Use it for cross-client MCP access to a knowledge graph.
  • claude-obsidian centers on an Obsidian vault driven by Claude Code. Use it if Obsidian is your workflow hub.

Choose mentat-wiki for explicit project continuity, a wiki you curate, and zero services: one stdlib-only CLI, plain Markdown, and a local SQLite FTS5 index.

Privacy and safety

  • Capture commands scan the text they are about to write and refuse common secrets (OpenAI, Anthropic, Google, AWS and Stripe keys, GitHub and Slack tokens, JWTs, private keys, password=...), home-folder paths and real email addresses. Version strings, example.com and git@host:path pass. It is pattern matching, not a guarantee; review what you keep.
  • mentat-wiki does not store chat transcripts: hooks record no prompt text, and capture commands write only the text they are given. Captured pages record origin and auto: true|false.
  • Session-start context is bounded: the body is capped at 6,000 characters (--max-chars), and doctor warns when core/ grows past 2,200 characters (about 550 tokens).
  • ~/.mentat/config.json stores local paths on purpose (vault path, folder-to-project map); it stays on your machine.
  • The installer backs up settings.json, and uninstall reverts only the entries its manifest recorded. Without a manifest it changes nothing unless you pass --legacy.

See SECURITY.md.

Other agents

Point any shell-capable agent at your vault's AGENTS.md, or tell it to run mentat-wiki context --always at session start and write through the CLI. Only Claude Code gets hooks, the status line and the /idea, /keep, /wrap skills today.

Commands

All commands
Command Purpose
mentat-wiki init ~/vault Create a vault with the schema and templates.
mentat-wiki install claude Wire hooks, status line, permission and skills (--dry-run previews).
mentat-wiki uninstall claude Revert installer changes (--legacy also removes hand-written mentat hooks).
mentat-wiki project register my-app Register this folder (project list lists).
mentat-wiki context Print the session-start context (--always in unregistered folders).
mentat-wiki keep --type idea --title "Retry queue" --summary "Queue uploads" --value 4 --effort 2 File an idea, thought, concept or output.
mentat-wiki inbox "Check backups" Park a one-line item.
mentat-wiki decide --decision "Use SQLite" --why "Zero deps" --rejected "External index" Append a project decision.
mentat-wiki wrap --where "Cache done" --next "Add queue" --thread "Check timeouts" Rewrite status and open threads.
mentat-wiki note --result worked "1k pages in 12 ms" Log an experiment attempt.
mentat-wiki propose --type idea --title "Retry queue" Register a pending proposal.
mentat-wiki feedback --type idea --title "Retry queue" --outcome rejected Record a rejected or edited proposal.
mentat-wiki find "retry" Search pages (--ideas ranks parked ideas).
mentat-wiki policy Acceptance per category (--json supported).
mentat-wiki digest Recent ideas, top parked ideas, policy summary.
mentat-wiki resume How the last session in this folder ended.
mentat-wiki handover Paste-ready prompt for another tool.
mentat-wiki doctor Check schema, links, index, size, privacy, install.
mentat-wiki config --vault ~/vault Set the vault (--command sets the CLI string).
mentat-wiki --version Print the version.

FAQ

Do I need Obsidian? No, any editor works. It is the recommended way to read the vault, though: see "Better with Obsidian" above.

Why mentat-wiki and not mentat? An unrelated, older PyPI package already installs a mentat command. A unique name avoids colliding with it.

What if mentat-wiki is not on PATH? install claude falls back to <python> -m mentat_wiki. Override with mentat-wiki config --command "python -m mentat_wiki".

Two repos have the same folder name. project register refuses a folder-derived name already used by another folder on this machine; pass a name (mentat-wiki project register api-billing). Passing an existing name on purpose shares it, for example across worktrees of one repo.

Can I change domains or the schema? Yes. Edit the vault's CLAUDE.md (## Domains; projects and other are always valid).

When does the agent save without asking? Project log updates (/wrap, decisions you made or approved, experiment notes) and any category you set to auto in core/capture-policy.md. Everything else asks once (chatter is never).

Uninstall

mentat-wiki uninstall claude, then pipx uninstall mentat-wiki or pip uninstall mentat-wiki. Your vault stays plain Markdown.

Documentation

Demo vault · Architecture · Capture policy · Contributing · Security · Changelog

License

MIT. See LICENSE.

Metadata

Release files for mentat-wiki 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mentat-wiki 0.1.1
File Size Uploaded Provenance Actions
mentat_wiki-0.1.1.tar.gz 112.0 kB Without provenance Details for mentat_wiki-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mentat-wiki 0.1.1
File Interpreter ABI Platform Actions
mentat_wiki-0.1.1-py3-none-any.whl Python 3 none any Details for mentat_wiki-0.1.1-py3-none-any.whl

Total release size: 181.3 kB

Release files / mentat_wiki-0.1.1.tar.gz

Download URL mentat_wiki-0.1.1.tar.gz
Size 112.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f51847657538398e4fa92dd693333c57d6c089c03ae0feee471f68aa2462df88
BLAKE2b-256 checksum
How to use checksums
234e012b846086914a3ddca6fede680a8d7b0f6d938c3274aee2a6d53d03c76f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / mentat_wiki-0.1.1-py3-none-any.whl

Download URL mentat_wiki-0.1.1-py3-none-any.whl
Size 69.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
814d8abcb0536cf70ce460039035807e684b43f7dbbd9d0e285fa0c0724f64c8
BLAKE2b-256 checksum
How to use checksums
177b26ac0cc5948c4548a7fdd7667e7ade1ca785c66452fd9168dfaf57e6d97d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for mentat-wiki 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page