Skip to main content

What is the CoreStory CLI?

The CoreStory CLI is a command-line tool, corestory, that builds a map of a repository on your own machine and serves that map to your coding agent over MCP. The map covers how the code actually works: the code itself, broken into searchable pieces, and the business rules the code enforces. Each rule cites the files and lines it comes from, so your agent (or you) can check every claim against the source. What you can do with it:
  • Index a local Git repository, or a plain folder of source files, with one command
  • Ask your coding agent questions about the code and get answers grounded in cited source lines
  • Find the business rules that apply to a file or line range before you change it
  • Search the code and its rules by meaning from your terminal, without an agent
  • Keep several snapshots of the same repository and compare what changed
Supported agents: Claude Code, GitHub Copilot (VS Code and CLI), Cursor, Codex, and any other agent that can start a local (stdio) MCP server.

How the CLI differs from the CoreStory web app

CoreStory comes in two forms. They share a name, but they are set up and used differently.
The two use different commands and different MCP tools. The MCP tools described in MCP Server Setup belong to the web app. The CLI’s tools are listed in Connect Your Agent.

How it works

1

Set up once per machine

corestory setup asks you to accept the Terms of Use and Privacy Policy, choose whether to share anonymous usage data, and add a model key. The CLI uses that key for two jobs: embeddings, which make search by meaning work, and a completion model, which reads the code and writes up the rules it finds.
2

Create a corpus in your repository

corestory init creates a corpus, CoreStory’s index of one repository. The corpus lives in a .corestory/ folder at the repository root. Nothing is uploaded anywhere except the text your model provider needs to see.
3

Ingest a snapshot

corestory ingest reads the repository and builds a snapshot: the code split into searchable chunks, embeddings for search, and the business rules found in the code, each linked to its evidence. By default it reads the working tree as it is right now, including uncommitted changes. You can ingest a branch, tag, or commit instead.
4

Connect your agent

Your agent starts corestory mcp from the repository folder. The server answers questions about the selected snapshot: it searches, reads captured files, lists the rules for a file, and follows connections between rules and code.

Snapshots

Each run of corestory ingest creates a new snapshot. Earlier snapshots are kept, and corestory list shows them all. Commands and the MCP server answer from the selected snapshot, which is the newest ingest unless you choose otherwise. A snapshot records the code as it was when you ingested it. If you edit files afterward, the snapshot does not change. Run corestory ingest again when you want the map to match the current code.

What a business rule looks like

A rule is a short, plain statement of something the code enforces, together with the source lines that prove it. For example, ingesting a small pricing module produces rules like this:
Each rule has been checked to confirm that the lines it cites exist in the snapshot. That check confirms the evidence is real, not that the summary is correct. Treat rules as well-sourced leads, and read the cited lines before you rely on one.

Quickstart

Then connect your agent, or try a search from the terminal:

Install and Set Up

Requirements, installers, manual install, and model keys

Connect Your Agent

MCP configuration for Claude Code, Copilot, Cursor, and Codex

Command Reference

Every command and option