Skip to main content
This page documents the kontxt CLI as it ships from npm. Every example uses npx -y @4stax/kontxt so you do not need a global install. If you prefer a global command, you can install the package globally and run kontxt directly. The flags and subcommands are the same.

Setup and initialization

init creates the local directory at ~/.kontxt/ and the SQLite vault at ~/.kontxt/vault.db. It also tries to configure supported MCP hosts.

Writing memories

add

Use add when you want to explicitly store a durable memory.
Tips:
  1. Use short, declarative sentences.
  2. Attach a project label with -p when it belongs to a specific repo or product.
  3. Use decision for irreversible choices so they are always easy to retrieve later.

Reading and searching

Use search to retrieve relevant memories. Search quality depends on your embedding backend.

list

Use list to browse what is stored.

Editing and deleting

edit

Use edit when a memory is mostly correct but needs updating.

delete

Use delete to remove a memory by id. Partial id matches are supported.

Capture from transcripts

capture

Use capture to extract durable context from a text file or stdin.

extract

extract is an alias for capture:

Scanning a codebase

scan

Use scan when you want kontxt to ingest stable facts about a repo or directory.
What to scan:
  1. Project name and purpose
  2. Tech stack
  3. Repo structure
  4. Commands you run often
What not to scan:
  1. Secrets
  2. Large logs
  3. Files you would not want summarized into memory

MCP server commands

serve

Run the MCP server in the foreground. This is what most MCP hosts run.

start and stop

Use these when you want kontxt running as a background daemon.

Maintenance

status

Use status to see vault stats and embedding mode.

vacuum and decay

Use these when you want to remove superseded and low signal memories.
For the most up-to-date flags and examples, see the GitHub repo.