# Codebase snapshot and LLM context glossary

The words this project uses, defined plainly. Where a term has a narrower meaning in the code, the
narrower meaning is the one that applies.

### Codebase snapshot

A bounded, indexed copy of a repository prepared for a language model: Markdown parts containing
the source, plus a manifest that records every included file, every skipped path, and every file
whose body was shortened. A snapshot is not a git commit and not a backup; it is context with an
audit trail.

### Context window

The maximum number of tokens a model can read and generate in one request. A 128k context window
does not mean 128,000 tokens of source code: the system prompt, the question, the snapshot and the
reply all share the same budget.

### Token

A unit of text a model processes. Tokens are not words or characters. English prose is often around
four characters per token; source code is denser because identifiers, punctuation and indentation
tokenise less efficiently. A token count is therefore model-specific, which is why this tool
reports an estimate and enforces a byte ceiling rather than pretending to know a tokenizer's exact
answer.

### Token budget

The amount of context a run is allowed to produce. codebase-snapshot expresses it as maxPartBytes
because the partitioner writes bytes, and reports the estimated tokens beside it. The budget is a
ceiling, not a target.

### Part

One Markdown file written by the partitioner. A part contains a fixed header, a file listing and
one or more file sections, and never exceeds its byte budget. Parts are the unit a chat destination
attaches, which is why the prompt does delivery arithmetic instead of asking a model to read a
single enormous file.

### Manifest

The JSON index at the root of a snapshot. It records the configuration digest, file entries with
layer, kind, language, part and hash, skipped paths with reasons, part hashes, artifact hashes, git
state and counts. The manifest is the contract every reader trusts; validate compares it with the
tree.

### Drift

The difference between what a snapshot records and what the repository contains now. Drift includes
changed bytes, added and deleted files, changed ignore or configuration rules, damaged parts and
stale reports. validate reports drift and exits non-zero.

### Fingerprint

A hash of the snapshot's content and configuration, recorded in the manifest and printed by the
CLI. Two runs over unchanged input produce the same fingerprint. It is a summary, not a signature;
signing is a separate operation.

### MCP

Model Context Protocol: a standard way for an AI client to discover and call tools and read
resources exposed by a local or remote server. codebase-snapshot serves seven tools; six are
read-only and one writes a snapshot. See [MCP server for a codebase](mcp-server-for-codebase.md).

### Tool

A callable operation with a JSON Schema input and structured output. Tools are listed by the MCP
server, have a cost class, and are the unit an agent decides to call. Resources are the other half
of the protocol: URI-addressed content such as snapshot://manifest.

### Resource

A URI-addressed, read-only document exposed over MCP. This server publishes the manifest, the
prompt, the parts, reports, the contract and the skill. Resources are listed before they are read,
so a missing artifact is not advertised as if it existed.

### LLM context

The information a model is given before it answers. Good context is relevant, bounded, attributable
and current. More context is not automatically better: a 1M-token dump can bury the one file that
matters and leave no room for the answer.

### Repository packing

Collecting a repository into one document or a small set of documents for a model. Packing is a
transport decision; it says nothing about whether the content is current, complete or safe to
share. Those properties have to be added deliberately.

### Retrieval-augmented generation (RAG)

A pattern where a system retrieves relevant passages from an index and puts them in the model's
context at question time. Repository packing is the opposite trade-off: it prepares a stable,
inspectable artefact ahead of time. The two can be combined; codebase-snapshot's MCP tools are
closer to bounded retrieval over a local index.

### Agent experience (AX)

Whether an agent can fetch, read and act on a site or tool without a human translating for it.
Static HTML, stable URLs, a machine-readable contract, bounded responses and explicit errors are
AX. The [AX is the New AEO](https://arxiv.org/abs/2609.34951) study finds that agent-ready sites are
recommended more often and answered from their own pages more often.

### Generative engine optimization (GEO) and answer engine optimization (AEO)

The practice of making content discoverable, citable and useful in AI-generated answers. The
credible parts are the old parts: unique first-hand content, clear structure, verifiable facts and
a readable site. The unreliable parts are paid placements, synthetic listicles and claims that a
special file guarantees inclusion.

### llms.txt

A proposed Markdown index for language models, with a short summary and links to the pages an agent
should read. It is useful as an agent-facing table of contents. Google has said that special AI
text files are not required for its AI features, so this project treats llms.txt as documentation
infrastructure, not as a ranking switch.

### Secret redaction

Replacing a matched credential-shaped value with a marker before it reaches an artifact. Redaction
is span-based: the surrounding line and the file's structure stay readable, while the value does
not. It is defence in depth, not a guarantee that every possible secret shape is known.

### Byte budget

A hard ceiling on the bytes a part or artifact may contain. Bytes are what the writer controls, so
the budget is enforceable without a tokenizer. The tool estimates tokens from bytes for planning,
but the ceiling that can fail a run is the byte ceiling.

### Preview and omission

A preview is a bounded head and tail of a file that did not fit. An omission range records the
lines that were not emitted. The rule is that nothing disappears without a reason: a shortened file
is listed in incomplete[], with its reason and ranges, and verifyInMemory fails the run if the
accounting does not add up.

### Symbol-pruned impact

A reverse-import analysis that follows the exported symbol a change actually touches, rather than
every file that imports the module. It is conservative where the symbol cannot be determined and
reports the limits of its answer. See [impact reports](impact.md).

### Workspace

A repository whose packages are snapshotted separately but recorded in one WORKSPACE.json index.
A workspace run preserves each member's real path and local budget, and reports a missing member
rather than silently skipping it.

## Related

- [All documentation](contents.md)
- [FAQ](faq.md)
- [How many tokens is a codebase?](codebase-token-budget.md)
