# Context
---
## What is Context
# What is Context
Context is a knowledge workflow for engineering teams and their AI agents. It turns code repositories, documents, notes and conversations into reviewed, versioned knowledge in which every claim leads back to its source, then builds that knowledge into Agent knowledge packages, documentation sites and LLM documents. Agents read the knowledge first and follow its evidence chain to the original only when they need exact detail.
You describe what knowledge you need and where the material lives. Your Agent reads the evidence, proposes a structure and explains its decisions. Context keeps the process legal and repeatable: it records source boundaries, checks evidence coverage, stages reviewable candidates, preserves provenance, verifies the approved result and builds the output you chose.
## How it fits together
The diagram shows the path from material to the people and Agents who ask questions.
```mermaid
flowchart TB
subgraph produce["Produce"]
direction LR
src["Code, documents, notes, sessions"] -->|registered and captured| agent["Your Agent with Context skills"]
end
subgraph approve["Review"]
direction LR
review["Human review"] -->|approves| kb["Approved knowledge"]
end
subgraph use["Use"]
direction LR
out["Package, site, LLM Docs"] -->|answers with sources| users["Agents, Bots, developers"]
end
produce -->|writes candidates| approve
approve -->|builds| use
```
Context is not a one-shot summarizer. Source snapshots, review state, approved knowledge and package inventories stay in a local Context knowledge workspace, so the result can be inspected, versioned and refreshed when sources change.
## What makes it different
- **An index with evidence chains, not copied prose.** Indexers keep only what answers a reader's questions and record where each statement came from. In one large production monorepo, about 202 MB of code and documents became about 1.75 MB of reviewed knowledge, roughly 1/115 of the source volume. See [Knowledge for Agents]() and [Evidence Chains and Index First]().
- **Skills and a CLI inside the Agents you already use.** Context does not call an LLM and is not a hosted platform. Its skills run in Claude Code, Codex, Cursor or a managed Agent, and the local CLI performs the deterministic work. See [Why a Workflow]().
- **Review before anything is published.** People own the goal, source permission, structure and review decisions; drafts become approved Markdown only after review. See [Knowledge Lifecycle]().
- **Knowledge that follows its sources.** Sources are pinned, and a later change reopens only the affected pages. See [Keeping Knowledge Current]().
- **One body of knowledge, several outputs.** The same approved pages build an Agent knowledge package, a documentation site and LLM Docs, each mapped back to the knowledge workspace through a build inventory. See [Packages and Sites]().
## Who it is for
Context helps when knowledge exists but is not yet ready for an Agent to use. Typical requests:
- turn product, architecture, operations or FAQ documents into a navigable knowledge base;
- connect code structure with explanatory documents while keeping exact source evidence;
- combine several repositories and document sets into one reviewed knowledge package;
- update an existing knowledge workspace when its sources change, without rebuilding everything.
In a measured comparison on real developer questions, Agents answering from Context knowledge fully solved more questions with far fewer tool calls than with an LLM Wiki; see [Knowledge Retrieval benchmark]().
## Source Graph and Agent Graph
Two companion projects carry parts of the workflow:
- **Source Graph** searches and reads repositories at a pinned commit over the web, MCP, HTTP and a CLI. Context ships an optional evidence plugin so that an Agent reading code through Source Graph also receives the knowledge sections that cite it, without cloning the repository. See the [Source Graph overview]().
- **Agent Graph** is the work-contract layer under the Context workflow. Context observes knowledge workspace facts and executes actions; Agent Graph evaluates those facts and selects the next legal step, which keeps a long workflow resumable and testable. See [Why Graph Engineering]() and [Workflow Execution]().
## How you get it
Context is delivered as an npm CLI plus an Agent plugin. Install both once, restart the Agent session, then describe the knowledge goal to the `/c4a:context` entry in plain language. Continue with [Installation]() and [Quick Start]().
---
## Sources
- [context/README.md L8–L13 · 3b0ce0a]()
- [context/README.md L101–L104 · 3b0ce0a]()
- [context/README.md L106–L114 · 3b0ce0a]()
- [context/README.md L80–L92 · 3b0ce0a]()
- [context/README.md L29–L31 · 3b0ce0a]()
- note:20261012/compression.md · compression.md L15–L22
- [context/README.md L22–L35 · 3b0ce0a]()
- note:20261012/benchmark-summary.md · benchmark-summary.md L40–L49
- [context/packages/context-cli/README.md L3–L18 · 3b0ce0a]()
- [context/docs/en/case-studies/agent-graph-workflow.md L5–L7 · 3b0ce0a]()
- [context/README.md L43–L58 · 3b0ce0a]()
---
## Installation
# Installation
## Before you start
You need:
- Node.js 20 or later with npm;
- at least one Agent host: Claude Code, Codex or Cursor;
- read access to the repositories and documents you plan to turn into knowledge.
Context runs on your machine. The CLI never calls an LLM itself: the Agent in your host does the reading and writing, and the CLI performs deterministic work such as observing the Context knowledge workspace, capturing sources, indexing code, validating evidence, applying reviews and building packages.
## Install the CLI and the plugin
```bash
npm install -g @c4a/context-cli@latest
context plugin install
```
The first command installs the `context` runtime. The second installs the Agent integration into every supported host it finds. Restart or refresh your Agent host afterwards so it loads the new entries.
```mermaid
flowchart LR
npm["npm install -g @c4a/context-cli"] --> cli["context runtime"]
cli -->|context plugin install| hosts["Claude Code / Codex / Cursor"]
hosts --> entries["/c4a:context and other entries"]
hosts --> providers["Indexer Provider skills"]
```
A global installation creates the namespaced Context entries and also projects the four Indexer Provider skills — `context-code-indexer`, `context-markdown-indexer`, `context-note-indexer` and `context-sessions-indexer` — without a namespace, so every host can find them. Installing a Provider only makes it discoverable; the workflow selects Providers per task.
## What you get
| Entry | Use it to |
| --- | --- |
| `/c4a:context` | Create a knowledge workspace, continue one, and run production, review, update and build |
| `/c4a:context-plan` | Plan a large project in stages before production |
| `/c4a:context-inspect-search` | Ask questions against knowledge packages or approved knowledge in a knowledge workspace, with sources |
| `/c4a:context-repo-content` | Register or edit same-repository docs and authored Skills without starting production |
`/c4a:context` is the production entry for both new and existing knowledge workspaces; the other three entries plan, answer or register content and hand production back to it. You do not need to learn lifecycle commands; describe the knowledge goal in normal language. Ordinary coding or design conversations do not start Context on their own — invoke it explicitly or continue an active Context conversation. [Commands and Skills]() lists every entry, how each host spells it, and the Skills that run without being invoked.
## Install into one repository only
If you prefer not to change global configuration, install the entries into a single repository:
```bash
context plugin install --local /path/to/repo --agent auto-detect
```
`--local` needs an explicit `--agent`:
- `claude`, `cursor` or `codex` install into that repository's `.claude`, `.cursor` or `.agents` directory;
- `all` installs all three layouts;
- `auto-detect` uses whichever of those directories already exist and falls back to `.agents/skills`;
- `standalone` writes all skills directly to `/skills`, without commands.
Every mode supports `--dry-run`. A refresh replaces only unmodified managed files; customized entries are kept and reported as conflicts. Local entries have no plugin namespace.
## Check the installation
```bash
context --version
context plugin status
```
`context plugin status` inspects the global hosts. Then open your Agent and invoke `/c4a:context`. If the entry is present but the `context` executable is missing, the entry reports the exact installation step and stops rather than partially initializing a knowledge workspace.
Next: [Quick Start]().
---
## Sources
- [context/README.md L5–L5 · 3b0ce0a]()
- [context/packages/context-cli/README.md L28–L32 · 3b0ce0a]()
- [context/packages/context-cli/README.md L34–L41 · 3b0ce0a]()
- [context/packages/context-cli/README.md L55–L59 · 3b0ce0a]()
- [context/plugins/context/README.md L13–L22 · 3b0ce0a]()
- [context/packages/context-cli/README.md L61–L68 · 3b0ce0a]()
- [context/plugins/context/skills/context-repo-content/SKILL.md L1–L3 · 3b0ce0a]()
- [context/ARCHITECTURE.md L358–L366 · 3b0ce0a]()
- [context/packages/context-cli/README.md L43–L53 · 3b0ce0a]()
- [context/packages/context-cli/README.md L53–L53 · 3b0ce0a]()
- [context/packages/context-cli/README.md L73–L76 · 3b0ce0a]()
---
## Quick Start
# Quick Start
This walkthrough turns one code module and one local documentation folder into a reviewed knowledge package with a browsable site. You give instructions in plain language; the Agent runs the commands the workflow returns. The commands shown below are what the Agent runs on your behalf, so you can recognize them in its progress messages.
Make sure [Installation]() is done and you have restarted the Agent session so the plugin is loaded.
## 1. Create the knowledge workspace
Tell the Agent where the Context knowledge workspace should live and what it is for:
```text
/c4a:context Create a Context knowledge workspace in ./context for our component library
and its product docs. Readers are frontend developers new to the library.
```
The Agent initializes the directory and installs its dependencies:
```bash
context init ./context
cd ./context
bun install
context status --format json
```
You get this layout:
```text
context/
├── AGENTS.md # guidance for the Agent
├── src/ # source, phase and package declarations
├── sources/ # registered sources and captured evidence
├── knowledge/ # approved knowledge (empty for now)
├── dist/ # built packages (ignored by Git)
└── .tmp/ # runtime state and reports (ignored by Git)
```
## 2. Point it at your sources
Name the material and anything the Agent should skip:
```text
Use ../component-lib for code and ../docs for product documents.
Skip the deprecated v1 folder.
```
The Agent registers each boundary. Registration records what is in scope; it does not decide what to write.
```bash
context source add repo 20260901 --module component-lib --local ../component-lib --configure
context source add file 20260901 --module product-docs --local ../docs --configure
```
For a monorepo, pick the package or service your readers need. Unneeded material costs reading time and tokens, but do not exclude something just because its filename looks old.
## 3. Confirm the work-start report
The Agent reads representative material, asks about anything that would change the scope, records the reader purpose in `src/indexers.yaml`, and presents a **work-start report** with:
- the confirmed sources and scope;
- the Indexer skills it will use;
- the first pages you should expect and where they will sit in the site.
Nothing is written until you approve the report. If the plan is off, say what to change — for example "merge the two API pages" or "add a troubleshooting page" — and the Agent revises it.
## 4. Let it write, then review
After approval, the Agent writes each page with references to exact source lines and submits them for checks on coverage and stale inputs.
When writing finishes, you receive a review report showing each page's title, path, summary and content. Approve it, reject pages, or ask for revisions. Approved pages land in `knowledge/` as Markdown; rejected or revised pages go back to writing.
```mermaid
flowchart LR
write["Agent writes pages"] --> review["You review"]
review -->|revise| write
review -->|approve| kn["knowledge/"]
kn --> build["context build"]
build --> kb["dist/component-kb/"]
build --> site["dist/component-site/"]
```
## 5. Build the package and site
For a new knowledge workspace, the Agent proposes a knowledge package plus a website by default. The package declaration in `src/index.ts` looks like this:
```ts
kbPackage({
name: "component-kb",
template: "src/package-templates/kb",
site: { title: "Component knowledge", lang: "en-US", base: "/" },
});
```
`context build` then produces `dist/component-kb/` for Agents and `dist/component-site/` — a static site with article pages and local search — for people. Commit the knowledge workspace to Git so the result can be inspected, versioned and refreshed later.
## Next steps
- Ask a question against the new package with `/c4a:context-inspect-search`.
- When the code or docs change, tell `/c4a:context` what changed; it reopens only the affected pages.
- For larger scopes, read [Large Projects]().
- See every entry you can invoke, and the Skills that run on their own, in [Commands and Skills]().
---
## Sources
- [context/packages/context/docs/getting-started.md L47–L50 · 3b0ce0a]()
- [context/README.md L45–L53 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L29–L45 · 3b0ce0a]()
- [context/packages/context-cli/docs/quickstart.md L67–L72 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L47–L60 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L105–L118 · 3b0ce0a]()
- [context/README.md L87–L88 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L120–L136 · 3b0ce0a]()
- [context/README.md L29–L31 · 3b0ce0a]()
- [context/packages/context/docs/guides/package-outputs.md L33–L54 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L76–L98 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L155–L157 · 3b0ce0a]()
- [context/plugins/context/skills/context-inspect-search/SKILL.md L1–L3 · 3b0ce0a]()
---
## The Context Knowledge Workspace
# The Context Knowledge Workspace
A **Context knowledge workspace** is the directory where Context keeps one body of knowledge: its declarations, its registered sources, the approved pages and the outputs built from them. `context init` creates it, and its `package.json` marks it as a Context project. It is usually a Git repository of its own, or a directory inside a project repository.
Everything about the knowledge lives here, not in the conversation. Run Context commands from this directory: Route paths and `.tmp/` belong to this knowledge workspace, not to the surrounding repository or a parent directory.
```mermaid
flowchart LR
subgraph you["You and the Agent declare"]
src["src/
project, requirements, map, templates"]
end
subgraph cli["Context CLI maintains"]
sources["sources/
registered evidence"] --> knowledge["knowledge/
approved pages"]
knowledge --> tr["translations/"]
end
src --> sources
knowledge --> dist["dist/
packages and sites"]
tr --> dist
```
## The layout
Right after `context init`, and after the first deliveries, a knowledge workspace looks like this:
```text
my-knowledge/
├── package.json # version and context.project marker
├── AGENTS.md # rules for Agents working here
├── README.md
├── .gitignore
├── src/
│ ├── index.ts # sources, capture phases and packages
│ ├── indexers.yaml # reader purpose and authorized sources
│ ├── knowledge-map.yaml # navigation for sites and LLM Docs
│ ├── package-templates/ # templates for each package kind
│ └── site/ # optional website customization
├── sources/
│ ├── repo/index.yaml # repository sources: remote, commit, modules
│ ├── file/ # local document sources and snapshots
│ ├── lark/ # Lark document sources and snapshots
│ ├── note/YYYYMMDD/ # saved notes
│ └── sessions/YYYYMMDD/ # saved conversation summaries
├── knowledge/
│ ├── /… # approved Markdown pages
│ └── structure.yaml # page identities, sections and source references
├── translations// # translated pages and navigation titles
├── changelog.yaml # knowledge version history
├── CHANGELOG.md # generated from changelog.yaml
├── dist/ # built packages and sites
└── .tmp/ # runtime state, reports, Agent scratch
```
Some files appear only when you use the feature they belong to: `imports.yaml`, `repo-content.yaml` with its `repo-content/` view, `context-evidence.sourcegraph.wasm`, and a `PLAN-*.md` during a planned project. They are described below.
## Who writes what, and what Git keeps
| Path | Written by | In Git |
| --- | --- | --- |
| `package.json`, `AGENTS.md`, `README.md` | Created by `context init`; the version is updated by the CLI | Yes |
| `src/index.ts`, `src/indexers.yaml`, `src/package-templates/`, `src/site/` | You or the Agent, only when the current Route asks for a configuration change | Yes |
| `src/knowledge-map.yaml` | The CLI, through navigation adjustments the Agent submits | Yes |
| `sources/` registries, snapshots, notes and summaries | The CLI | Yes — except repository checkouts under `sources/repo/`, which are recovered from `index.yaml` |
| `knowledge/` | The CLI, when you approve a Review | Yes |
| `translations/`, `changelog.yaml`, `CHANGELOG.md` | The CLI, from Agent-written translations and change notes | Yes |
| `dist/` | `context build` | No — reproducible |
| `.tmp/` | The CLI and the Agent | No — runtime only |
`sources/` and `knowledge/` are the durable state of the knowledge; `dist/` can always be rebuilt from them. Commit the knowledge workspace only when Git operations are authorized for your task.
## Files that appear as the knowledge grows
- **`src/knowledge-map.yaml`** is the persistent knowledge map. It organizes website navigation and LLM Docs without changing page identities, and stays after each delivery. See [Reorganizing at Scale]().
- **`translations//`** holds one translated file per approved page plus a `knowledge-map.yaml` of translated navigation titles. Translations are formal content: they count toward versions and are packaged with the site.
- **`changelog.yaml` and `CHANGELOG.md`** are updated together with `package.json.version` each time a delivery records a version. See [Versions and Changelog]().
## Files for linked content
- **`imports.yaml`** at the root declares external entrances — content elsewhere that pages may link to — without downloading or capturing it. See [External Entrances]().
- **`repo-content.yaml`** registers documentation and authored Skills that live in the same repository; **`repo-content/`** is a symlink view of them, and the originals stay where they are. See [Same-Repository Docs]().
- **`context-evidence.sourcegraph.wasm`** is an optional plugin for reading code evidence remotely. `context evidence install` maintains it; queries never install it on their own. See [Reading Code Evidence Remotely]().
## Runtime and scratch space
| Path | Holds |
| --- | --- |
| `.tmp/context-runtime/` | Unfinished workflow state: production stages, candidates, review reports, routes |
| `.tmp/agent-payloads/` | Command inputs the Agent prepares, such as translations |
| `.tmp/install/` | Temporary files used while installing dependencies |
| `.tmp/context-plans//` | Research for a planned project: `repos/`, `documents/`, `research/`, `stage-inputs/` |
`.tmp/context-runtime/` is not the only record of progress. After a successful delivery the CLI removes completed task state, and approved knowledge with `structure.yaml` keeps what later updates need. Its absence never means accepted work may be replayed. A planned project also keeps `PLAN-YYYYMMDD-slug.md` at the Git root, committed so work can resume; see [Planning a Large Project]().
## Rules that keep it healthy
- **Do not edit CLI-owned state by hand.** `sources/`, `knowledge/`, `dist/` and `.tmp/context-runtime/` change only through Context commands. To change a page, ask for a [revision]().
- **One knowledge workspace per directory.** Do not create a hidden second workspace, and do not mix revisions, tasks or `.tmp/` files with a parent directory that is also a knowledge workspace.
- **Repair through the Route.** When something looks broken, follow the recovery action the current Route returns instead of deleting runtime files.
Next: [Commands and Skills]() lists what you can invoke in this knowledge workspace, and [Core Concepts]() explains how its parts relate.
---
## Sources
- [context/packages/context-cli/src/project/workspaceGuidanceTemplates.ts L104–L108 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L38–L45 · 3b0ce0a]()
- [context/packages/context-cli/src/project/workspace.ts L22–L25 · 3b0ce0a]()
- [context/packages/context-cli/src/project/workspace.ts L467–L537 · 3b0ce0a]()
- [context/packages/context-cli/src/project/workspaceGuidanceTemplates.ts L119–L131 · 3b0ce0a]()
- [context/packages/context/src/managedSources.ts L18–L21 · 3b0ce0a]()
- [context/packages/context-cli/src/project/workspace.ts L454–L465 · 3b0ce0a]()
- [context/packages/context/docs/reference/project-api.md L217–L222 · 3b0ce0a]()
- [context/packages/context-cli/README.md L159–L178 · 3b0ce0a]()
- [context/packages/context/docs/guides/package-outputs.md L500–L505 · 3b0ce0a]()
- [context/packages/context/docs/guides/site-translation.md L8–L16 · 3b0ce0a]()
- [context/packages/context/docs/guides/knowledge-updates.md L169–L169 · 3b0ce0a]()
- [context/packages/context/docs/guides/imports.md L1–L7 · 3b0ce0a]()
- [context/packages/context/docs/guides/repo-content.md L1–L20 · 3b0ce0a]()
- [context/packages/context-cli/src/project/workspaceGuidanceTemplates.ts L125–L126 · 3b0ce0a]()
- [context/packages/context-cli/src/project/workspaceGuidanceTemplates.ts L128–L130 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L150–L153 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L10–L28 · 3b0ce0a]()
- [context/packages/context-cli/src/project/workspaceGuidanceTemplates.ts L132–L132 · 3b0ce0a]()
- [context/packages/context-cli/src/project/workspaceGuidanceTemplates.ts L154–L158 · 3b0ce0a]()
- [context/packages/context-cli/README.md L173–L178 · 3b0ce0a]()
---
## Commands and Skills
# Commands and Skills
You work with Context through a handful of conversational entries. Everything else — the lifecycle CLI commands, the Indexers and the workflow's own step Skills — runs behind them, chosen by the current Route rather than typed by you.
```mermaid
flowchart LR
you["You, in plain language"] --> entry["Entry Skill
/c4a:context and others"]
entry --> cli["context CLI
current Route"]
cli --> step["Workflow step Skills"]
cli --> idx["Indexer Skills"]
step --> cli
idx --> cli
```
## Entries you invoke
| Entry | Use it to | Example |
| --- | --- | --- |
| `/c4a:context` | Create a Context knowledge workspace, continue one, and run production, review, update and build | *"Build reviewed knowledge for ../billing-service for on-call engineers."* |
| `/c4a:context-plan` | Plan a large project or a broad update in stages before production | *"Plan knowledge for these three repositories and the design folder."* |
| `/c4a:context-inspect-search` | Ask questions against knowledge packages or approved knowledge, with sources | *"How are refunds retried? Cite the code."* |
| `/c4a:context-repo-content` | Register or edit documentation and authored Skills in the same repository, without starting production | *"Register docs/ and .agents/skills as repository content."* |
`/c4a:context` is the production entry for new and existing knowledge workspaces. The other three entries do not drive production themselves: a plan, an answer that points to a gap, or registered repository content is handed back to `/c4a:context` when knowledge should be produced. A conversation where Context is already active continues without invoking it again; ordinary coding or design conversations never start it on their own.
To create a new Indexer, ask in plain language — *"Create an Indexer Skill for our RPC framework in ./skills"*. The `context-indexer-create` Skill picks this up; it is not a menu command.
## How each host spells them
| Host | How entries appear |
| --- | --- |
| Claude Code | Plugin commands `/c4a:context`, `/c4a:context-plan`, `/c4a:context-inspect-search`, `/c4a:context-repo-content` |
| Cursor | Commands `/c4a-context`, `/c4a-context-plan`, `/c4a-context-inspect-search`, `/c4a-context-repo-content` |
| Codex | Skills invoked by name: `context`, `context-plan`, `context-inspect-search`, `context-repo-content` |
| Local install into one repository (`context plugin install --local`) | The same entries without the `c4a` plugin namespace |
Restart or refresh the host after installing or updating the plugin so it loads the current entries. See [Installation]().
## Skills that run on their own
| Skill | When it runs |
| --- | --- |
| `context-code-indexer`, `context-markdown-indexer`, `context-note-indexer`, `context-sessions-indexer` | The Agent selects them for the current sources and requirements during planning and writing. Installing one makes it available; it is not enabled for every knowledge workspace. See [Community Indexers](). |
| `context-inspect-search` | Also when a host or Bot configuration routes knowledge questions to it. |
| Workflow step Skills: `work-production-stage`, `translate-site-locales`, `record-workspace-version`, the Indexer lifecycle steps, and `recover-workspace` | Each runs when the current Route selects its step — writing a production stage, translating the site, recording a version, or recovering a stuck task. |
Indexer Skills are installed without a plugin namespace, so they keep the same names in every host.
Every Skill in the Agent plugin, with its trigger and hand-off, is listed in the [Skills reference]().
## What you never need to type
The lifecycle commands — `context source add`, `context review …`, `context build` and the rest — are run by the Agent with the exact revision the Route returns. You will see them in progress messages, but you describe goals instead. There is no `context continue` command: when the Agent starts, `context entry` and `context status` observe the knowledge workspace and return the next step. The full command list is in the [CLI Commands reference]().
## Requests you will use often
| You want to | Say something like | Read more |
| --- | --- | --- |
| Start | *"Create a Context knowledge workspace in ./kb for …; readers are …"* | [Quick Start]() |
| Add material | *"Add ../docs/refunds to the sources and re-plan the affected part."* | [Working with Agents]() |
| Fix a page | *"Revise the retry page: the limit is five, not three."* | [Revising a Page]() |
| Follow a change | *"The billing repository moved to a new release; update the affected pages."* | [Updating Knowledge]() |
| Hand off review | Add a `CONTEXT_RUN_POLICY` block to the task | [Managed Mode and Review Policy]() |
---
## Sources
- [context/plugins/context/README.md L19–L26 · 3b0ce0a]()
- [context/packages/context-cli/README.md L78–L111 · 3b0ce0a]()
- [context/packages/context-cli/README.md L61–L73 · 3b0ce0a]()
- [context/ARCHITECTURE.md L358–L366 · 3b0ce0a]()
- [context/plugins/context/skills/context-indexer-create/SKILL.md L1–L16 · 3b0ce0a]()
- [context/packages/context-cli/README.md L43–L59 · 3b0ce0a]()
- [context/plugins/context/README.md L72–L74 · 3b0ce0a]()
- [context/plugins/context/README.md L10–L17 · 3b0ce0a]()
- [context/plugins/context/README.md L14–L26 · 3b0ce0a]()
- [context/plugins/context/README.md L74–L81 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/graphs/workspace.yaml L331–L350 · 3b0ce0a]()
- [context/packages/context-cli/README.md L94–L107 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L155–L157 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-guide.md L17–L42 · 3b0ce0a]()
---
## The Workflow at a Glance
# The Workflow at a Glance
## Six steps
A Context task follows the same six steps whether it covers one document set or several repositories. You talk to the Agent; the Agent follows the workflow the CLI returns.
```mermaid
flowchart LR
s1["1 Install"] --> s2["2 Initialize"]
s2 --> s3["3 Research and plan"]
s3 -->|work-start report| s4["4 Produce"]
s4 --> s5["5 Review and preview"]
s5 -->|revise| s4
s5 -->|approve| s6["6 Build and commit"]
```
| Step | What you do | What happens |
| --- | --- | --- |
| 1 Install | Install the CLI and plugin once | Entries appear in your Agent host; see [Installation]() |
| 2 Initialize | Ask `/c4a:context` to create a Context knowledge workspace in a directory | The CLI creates `src/`, `sources/`, `knowledge/` and the guidance in `AGENTS.md` |
| 3 Research and plan | Describe the knowledge, its sources and its intended form, then answer the Agent's questions | The Agent registers sources, investigates them and presents a **work-start report**: confirmed configuration and scope, the planned content, and the expected package or site layout |
| 4 Produce | Wait, or ask for a local preview at any time | The Agent writes articles bound to source evidence and reports progress against the task count |
| 5 Review and preview | Read the review report and approve, reject or ask for revisions | Approved candidates become durable Markdown under `knowledge/` |
| 6 Build and commit | Confirm the package and other outputs | Context verifies and builds; the Agent commits the knowledge workspace to Git |
## What to expect
Production is the longest step: on average each writing task takes about a minute. Ask for a preview whenever you want to see pages in a browser. The work-start report and the review report are the two moments where your judgment shapes the result most; the Guides section on review explains what to look for.
## Production, updates and questions
The six steps describe a first production round. Two other paths reuse the same knowledge workspace:
- **Updates.** Building completes the currently approved state; it does not freeze the knowledge workspace. When sources change, a new round reopens only the affected knowledge. See [Keeping Knowledge Current]().
- **Questions.** `/c4a:context-inspect-search` answers questions from knowledge packages or approved knowledge in the knowledge workspace and traces each answer back to its sources.
## Why you can stop and resume
Each step is chosen from the knowledge workspace's actual state, not from the conversation. After every action the CLI observes the knowledge workspace again and returns the current step, its required reading and the exact commands. If you close the conversation and invoke `/c4a:context` later, it resumes where the work actually is. See [Workflow Execution]().
---
## Sources
- note:20261012/usage-practices.md · usage-practices.md L5–L9
- [context/README.md L80–L92 · 3b0ce0a]()
- [context/packages/context-cli/docs/quickstart.md L67–L72 · 3b0ce0a]()
- note:20261012/usage-practices.md · usage-practices.md L8–L8
- note:20261012/usage-practices.md · usage-practices.md L16–L22
- [context/packages/context-cli/README.md L123–L124 · 3b0ce0a]()
- [context/plugins/context/skills/context-inspect-search/SKILL.md L1–L3 · 3b0ce0a]()
- [context/packages/context-cli/README.md L80–L111 · 3b0ce0a]()
- [context/README.md L94–L97 · 3b0ce0a]()
---
## Large Projects
# Large Projects
## When a task is large
Plan a task in stages when its scope has **more than 30 source documents, or at least two repositories that need real investigation**. Use `/c4a:context-plan` explicitly, or let the `/c4a:context` entry hand over to it when an authorized task crosses that threshold. Starting a new knowledge project whose scope still needs research is also a good reason to plan first.
A very large multi-domain monorepo may be better served by one Context knowledge workspace per direction than by a single knowledge workspace.
## The PLAN report
Planning produces a `PLAN-YYYYMMDD-slug.md` report at the project's Git root. It inventories sources, maps overlaps with knowledge you already have, and divides the work into stages. You review the first report before any production starts.
```mermaid
flowchart LR
research["Research"] --> plan["PLAN report"]
plan -->|you approve| stage["Run one stage"]
stage -->|record in PLAN, next stage| stage
stage -->|all delivered| done["Remove PLAN"]
```
Approving the PLAN does not approve any article. Each stage still runs the normal workflow with its own work-start report and content review. [Planning a Large Project]() walks through every part of the report, its review and how to resume.
## Stage size
| Boundary | Recommendation |
| --- | --- |
| Source documents per stage | 30, at most 50 (groups above 30 are explained in the PLAN) |
| New repositories investigated per stage | 1 |
| Target articles in a revision stage | 30 |
| Scope above 100 documents | The Agent checks with you whether bounded research gives a useful scope |
| Scope above 500 documents | The whole task pauses until a person confirms the scope |
These are planning boundaries, not CLI gates. After each stage the Agent records the actual research, production, review and delivery results in the PLAN and commits it before the next stage begins.
## Steer early
On a large task, preview the work-start report and the first changed pages as soon as they exist. If the wording, examples or style are off, say so with counter-examples. Corrections made in the first stage carry into every later stage; the earlier you correct, the higher the final quality.
If a session is interrupted, the PLAN records the exact position and next action, so a new conversation can continue the same stage.
---
## Sources
- [context/plugins/context/skills/context-plan/SKILL.md L15–L20 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L29–L31 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L36–L60 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L123–L128 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L106–L118 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L44–L48 · 3b0ce0a]()
- note:20261012/usage-practices.md · usage-practices.md L13–L13
- note:20261012/usage-practices.md · usage-practices.md L14–L14
- [context/plugins/context/skills/context-plan/SKILL.md L123–L125 · 3b0ce0a]()
---
## Core Concepts
# Core Concepts
## How the concepts relate
```mermaid
flowchart LR
subgraph ws["Context knowledge workspace"]
direction LR
src["Sources"] --> idx["Indexers"]
req["Requirements"] --> idx
idx --> cand["Candidates"]
cand -->|Review| kn["Approved knowledge"]
end
kn --> pkg["Packages and sites"]
facts["Facts"] -.-> route["Route and Gate"]
route -.->|next action| idx
```
Everything lives in one **Context knowledge workspace**. **Sources** and **requirements** go in; **Indexers** turn them into **Candidates**; **Review** admits Candidates into **approved knowledge**; builds turn that knowledge into **packages and sites**. Throughout, the workflow reads **Facts** about the knowledge workspace and selects the next **Route**, pausing at **Gates** for human decisions.
## Context knowledge workspace
A local directory, usually committed to Git, that holds everything about one body of knowledge:
| Directory | Holds |
| --- | --- |
| `src/` | Source, phase and package declarations, plus `indexers.yaml` requirements |
| `sources/` | Registered sources and captured evidence |
| `knowledge/` | Approved knowledge and durable decisions |
| `dist/` | Built packages (reproducible, ignored by Git) |
| `.tmp/` | Disposable runtime state and reports (ignored) |
The CLI owns writes under `sources/`, `knowledge/`, `dist/` and the runtime state; the Agent edits project configuration only when the current Route asks for it. Every directory and file is described in [The Context Knowledge Workspace]().
## Sources, capture, notes and sessions
A **source** is a registered boundary: a repository module, a local document directory or an online document. Registering a source records its identity and permission boundary; it does not decide what knowledge to write and does not grant permission to read beyond it. **Capture** preserves document bodies and resources as auditable snapshots; repositories are read at a pinned commit and need no capture.
**Notes** are curated excerpts and observations; **sessions** are saved conversation summaries. Both are imported directly with `context source import` and become evidence like any other source.
## Requirements and Indexers
**Requirements** in `src/indexers.yaml` record who the knowledge is for, the questions it must answer and which sources are authorized. **Indexers** are Agent skills that read one kind of source and write source-grounded articles: Code, Markdown, Note and Sessions Indexers are built in, and teams can create their own. The Agent picks the relevant Indexers for each task during planning. See [Community Indexers]() and [The Indexer System]().
## Candidates, Review and approved knowledge
Articles the Agent writes are submitted as **Candidates**: drafts bound to source evidence and checked for coverage and stale inputs. **Review** shows readable titles, paths, summaries and content; approval applies the pages to `knowledge/` as durable Markdown, while rejection sends them back to writing. A rejected Candidate's status lives only in the temporary lifecycle ledger; `knowledge/` holds approved pages alone.
Each section of approved knowledge keeps its **evidence**: references to exact source locations. Together they form the [evidence chain]() that lets readers and Agents verify a statement. The **knowledge map** (`knowledge/structure.yaml`) is the closed projection of collections, articles and sections that sites and packages navigate by.
## Packages and sites
A **build** turns approved knowledge into an output: an Agent knowledge package, a documentation site or LLM documents. Every build emits an inventory that maps distributed files back to the knowledge workspace. See [Packages and Sites]().
## Route, Gate and Facts
**Facts** are what the CLI observes in the knowledge workspace and records as outcomes; conversation claims are not completion evidence. From the Facts, the workflow selects one **Route**: the current action, the resources to read for it and its completion contract. A **Gate** pauses a Route for a decision that needs a person or additional authority, such as approving the work-start report or the review. See [Workflow Execution]().
---
## Sources
- [context/README.md L80–L92 · 3b0ce0a]()
- [context/packages/context-cli/docs/quickstart.md L67–L75 · 3b0ce0a]()
- [context/packages/context-cli/README.md L159–L178 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L47–L74 · 3b0ce0a]()
- [context/packages/context-cli/README.md L115–L118 · 3b0ce0a]()
- [context/packages/context-cli/README.md L182–L184 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L114–L118 · 3b0ce0a]()
- [context/plugins/context/README.md L5–L7 · 3b0ce0a]()
- [context/README.md L87–L90 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L133–L136 · 3b0ce0a]()
- [context/ARCHITECTURE.md L158–L158 · 3b0ce0a]()
- [context/README.md L106–L114 · 3b0ce0a]()
- [context/docs/en/case-studies/agent-graph-workflow.md L44–L53 · 3b0ce0a]()
- [context/packages/context-cli/README.md L99–L107 · 3b0ce0a]()
---
## FAQ
# FAQ
## Does a small module need a central knowledge base?
Not necessarily. A central knowledge base suits knowledge that many people share and use remotely: the team registers its repositories, documents and meeting notes once, and its Bot, documentation site and each member's coding Agent all read the same reviewed knowledge.
Content for a small module or a single maintainer can stay in the repository's `docs/`. Context can register same-repository documents as repository content without copying them into knowledge.
## Knowledge is written by AI. How is quality kept, and does it bloat?
People decide the direction; the Agent handles the detail.
- In the review report, a person judges whether the categories, update scope and granularity are right. Nothing is published before its Diff report is approved.
- Every conclusion records its source (file, line and version), and citations are checked before anything is written into knowledge.
- During production and updates the Agent cross-checks sources. It often finds upstream documents that lag behind the code, corrects the knowledge from the code, and can also write the correction back upstream when asked.
- Knowledge compresses sources around questions and keeps only what answers them. When a knowledge base grows, ask the Agent to reorganize its directories and titles.
See [Evidence Chains and Index First]() and [Knowledge for Agents]().
## How is a knowledge package different from an LLM Wiki?
A knowledge package is a container; it does not prescribe how content is written. Context ships default Indexers and writing patterns, and a team can customize its own production skills and the skills a package hands to Agents.
Compared with an LLM Wiki that has only pages, a package also carries an index, evidence chains and an Agent-facing query entry. Iterations of the knowledge base maintain these directories, so nobody syncs them by hand. See [Packages and Sites]().
## The update process looks long. What does a maintainer actually handle?
Only review. Committing the Context knowledge workspace, building the package and publishing the site run quietly by default; the maintainer is interrupted only for the Diff review, a permission problem, or an objection. Once the Diff report is reviewed on the website, the process continues on its own.
---
## Sources
- note:20261012/faq.md · faq.md L5–L7
- note:20261012/faq.md · faq.md L9–L16
- note:20261012/faq.md · faq.md L18–L20
- note:20261012/faq.md · faq.md L22–L24
---
## Code Repositories
# Code Repositories
A registered repository is a **source boundary**: the code the Agent may read and cite while writing knowledge. Registration pins the repository to one commit, so every citation points at code that will not shift underneath it. It does not decide what to write; that comes later, in the work-start report.
```mermaid
flowchart LR
you["You name a local checkout"] --> agent["Agent resolves the path"]
agent --> cli["CLI reads origin and HEAD"]
cli --> reg["Registered source
date/module @ commit"]
reg --> plan["Planning and writing
read this commit only"]
```
## Ask the Agent
Name the checkout and the part of it the readers need. Plain language is enough:
```text
Use ../payments-service as a code source. Readers need the refund flow;
skip the legacy admin module.
```
When your request already names exact local modules, the Agent does not ask you to repeat them or to supply remote URLs: it resolves each name to one local directory and lets the CLI read that checkout's Git root, `origin` and current commit. It asks only when a name is ambiguous, nothing matches, or picking a match would widen the scope you gave.
## What gets recorded
The Agent registers the module with a command like this:
```bash
context source add repo 20261012 --module payments-service --local ../payments-service --configure
```
| Option | Meaning |
| --- | --- |
| `20261012` | The capture batch date. Several repositories and documents can share one date. |
| `--module` | Required. The concrete repository or package name. |
| `--local` | Local checkout path; may point at a monorepo subdirectory. |
| `--remote` / `--ref` | Remote URL and pinned commit. Inferred from the local `origin` and `HEAD` when omitted. |
| `--configure` | Also selects the source in a simple `src/index.ts`. It never captures anything. |
The source is addressed as `date/module`, for example `20261012/payments-service`. That name appears in source references; stable code knowledge paths use the module name without the date. Code sources need no capture phase: the Agent reads the checkout at the pinned commit.
## Monorepos: pick packages, not the whole tree
Context never widens a boundary from the current directory, package names or Git remotes. When a monorepo has several package boundaries, the Agent shows their paths and asks which ones should become sources. Point `--local` at each chosen package.
Filtering files inside a source cannot select a monorepo package, so choose the packages explicitly. Discuss obsolete or unrelated areas before indexing them — unnecessary code costs reading time and tokens — but do not drop a directory merely because its name looks old.
## How the code is read
Parsing is a detail of the selected Indexer, not something you configure per repository. The Indexer inspects languages, manifests, entries, routes and contracts, then uses the smallest parser set that answers the reader's questions. Community parsers cover TypeScript/JavaScript, Go, Rush monorepos, Thrift, Protobuf, Markdown/MDX, API contracts, stylesheets and SQL schemas. See [Code Extraction]() for how parser facts become pages.
## Checkouts on another machine
Git stores only the recovery recipe for a repository source: remote, pinned commit and module paths. It does not store the checkout. When a Context knowledge workspace is opened elsewhere and a task needs that code, the Agent offers three choices:
1. point it at an existing local checkout;
2. name a bounded directory it may scan for a matching checkout; or
3. allow Context to clone the registered repository into `.tmp/repo/`.
A recovery clone always uses the registered commit, so existing knowledge stays reproducible. In ordinary mode the Agent asks before cloning; it never scans an unspecified disk root or substitutes another branch or nearby repository.
## When the code moves on
Registration keeps its commit until you decide otherwise. To bring knowledge up to a newer commit, ask for an update: the Agent prepares the new version, compares it with what existing pages cite, and asks which pages need changes. The processed baseline advances only after the selected revisions are approved and built. See [Updating Knowledge]().
---
## Sources
- [context/packages/context-cli/context-workflow/resources/procedures/source-boundary.md L15–L17 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L56–L58 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/dialogue/source-boundary.md L31–L39 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-boundary.md L39–L43 · 3b0ce0a]()
- [context/packages/context-cli/src/project/sourceCommands.ts L362–L369 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/dialogue/source-boundary.md L20–L29 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L100–L103 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-boundary.md L28–L37 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/dialogue/source-boundary.md L41–L45 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L57–L60 · 3b0ce0a]()
- [context/packages/context/docs/reference/code-extractors.md L3–L29 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/repository-source-recovery.md L9–L34 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-boundary.md L85–L89 · 3b0ce0a]()
- [context/packages/context-cli/README.md L322–L340 · 3b0ce0a]()
---
## Document Directories
# Document Directories
Use a file source when the material is local Markdown: one file, several files, or a documentation folder. Unlike a code repository, a document source is **captured**: Context takes a reproducible snapshot under `sources/file/`, and pages cite that snapshot rather than the live folder.
```mermaid
flowchart LR
reg["Register
date/module + include"] --> decl["Declare captureFile
in src/index.ts"]
decl --> cap["Capture
snapshot under sources/"]
cap --> write["Plan and write
cite the snapshot"]
```
## Ask the Agent
Say which documents to ingest, not just which folder you happen to be in:
```text
Ingest ../docs/user-guide as product documentation. Only the getting-started
and billing chapters.
```
Run instructions, handbooks, plans or batch lists you hand the Agent are treated as task guidance, not as sources, unless you explicitly ask to ingest them. If the documents to capture are unclear, the Agent asks once instead of capturing the instructions themselves.
## Register and declare capture
```bash
context source add file 20261012 --module user-guide --local ../docs/user-guide \
--include "getting-started/**" --include "billing/**" --configure
```
| Option | Meaning |
| --- | --- |
| `--local` | Required. A local Markdown directory or file, used as the refresh location. |
| `--module` | Document module name; derived from `--local` when omitted. |
| `--include` | Markdown include glob relative to `--local`; repeat it for several patterns. |
| `--include-list` | A file of include globs, one per line; blank lines and `#` comments are ignored. |
| `--configure` | Also declares the source and a default capture phase in a simple `src/index.ts`. It does not capture. |
Registration reads no content. With `--configure`, the project gains a declaration like:
```ts
const docs = source("20261012/user-guide", { type: "file" });
export default defineProject({
sources: [docs],
phases: [captureFile({ source: docs })],
});
```
If `src/index.ts` already has custom entries, the configuration result is `manual` and the Agent makes a focused edit instead of retrying.
## Capture
Capture is an external read, so it needs your permission in the current conversation. Asking to capture, ingest or read the named documents grants it; merely mentioning them or asking to register does not. The Agent then runs the capture command returned by the workflow, reports the outcome and continues until every document in the batch is done.
Capture creates the snapshot; it does not classify, summarize or approve anything. The CLI owns normalization, hashes and manifests, and the Agent never edits a captured snapshot by hand.
## Documentation sites (MDX)
Default capture handles `.md`. If the folder turns out to be a documentation site — `.mdx` pages, `_meta.json`, sidebars or a docs config — the Agent stops and confirms before changing the configuration. For MDX sites that use `_meta.json`, the capture phase gains the MDX processor:
```ts
captureFile({ source: docs, processor: mdxJsonDocs() });
```
The processor keeps route metadata and static component text as evidence. If a page is only a shell that mounts runtime-rendered content, the Agent tells you and asks for the rendered site or its data source instead of inventing the body.
## When the documents change
Pages keep citing the snapshot they were written from. When the folder changes, ask for an update: the Agent captures the new version and asks which pages need changes. See [Updating Knowledge]().
---
## Sources
- [context/packages/context-cli/context-workflow/resources/procedures/document-capture.md L9–L10 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-capture-detailed.md L159–L162 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-capture-detailed.md L157–L157 · 3b0ce0a]()
- [context/packages/context-cli/src/project/sourceCommands.ts L397–L404 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L68–L98 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-capture-detailed.md L149–L155 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/document-capture.md L18–L28 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/document-capture.md L45–L61 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-capture-detailed.md L165–L179 · 3b0ce0a]()
- [context/packages/context/docs/reference/project-api.md L73–L77 · 3b0ce0a]()
- [context/packages/context-cli/README.md L322–L324 · 3b0ce0a]()
---
## Lark Documents
# Lark Documents
A Lark source is a remote document that Context captures into a local snapshot, together with the evidence embedded in it: images, attachments, sheets, Base tables, whiteboards and synced blocks. Pages then cite the snapshot. The Agent never reconstructs resource bytes or substitutes a summary for them; capture handles resources mechanically.
```mermaid
flowchart LR
url["Document or Wiki URL"] --> reg["Register
date/module"]
reg --> cap["Capture body and resources
one read identity"]
cap --> snap["Snapshot
sources/lark/date/"]
snap --> pages["Approved pages
knowledge/assets/"]
pages --> pkg["Package
others/assets/"]
```
## Register a document
Pass the document or Wiki URL directly; capture fetches the title with the body, so no separate lookup is needed:
```bash
context source add lark 20261012 --module handbook \
--url https://example.larkoffice.com/wiki/example-token --configure
```
`--doc-token` and `--wiki-token` accept an identity token instead of a URL, and `--title` records a title you already know. Register every requested document under the same date. For several documents with the same settings, the Agent declares capture once from the source registry instead of repeating a phase per document; independent documents do not mean independent articles.
For a whole Wiki subtree, the Agent can first run `context source discover lark ` to save the directory tree and page identities without reading bodies, so you can choose which pages to register.
## Read identity
Capture reads the body and every resource under **one** identity. `CONTEXT_LARK_IDENTITY=user|bot` selects it, and the default is `user`. Export it in every shell that runs Context commands; a setting in a Bot prompt is not an environment variable.
- **User** reads only as the current user.
- **Bot** may fall back once to the current user when reading the body fails on credentials, scope or access. The fallback restarts the whole body, so pages from two identities are never combined.
Once the body is read, all resources use that identity. A resource failure never asks for another identity's credentials, and network, rate-limit and format errors do not switch identity.
## What happens to embedded resources
| Resource | Captured as |
| --- | --- |
| Image | The original; if download is denied, one same-identity preview, marked as a preview |
| Attachment | The original file, linked from the Markdown |
| Sheet | A Markdown table plus a CSV snapshot |
| Base | The selected table or view as a Markdown table plus a JSON snapshot |
| Whiteboard, diagram | A readable preview plus the raw structured export |
| Synced block | The source block's body plus a Markdown evidence snapshot |
| Bookmark, sub-document, chat, embed | A stable navigation reference |
| Video | A reference; downloaded only with `resources.videos: "bundle"` |
A required resource that cannot be obtained stops capture. Two cases are recorded and continue with a warning: a whiteboard or diagram the API confirms was deleted, and an explicit permission denial for one embedded resource. Both leave a visible "unavailable resource" notice; neither is reported as downloaded.
## Image choices for large tasks
Image handling for a task is decided once, not per document. The task instruction `DOCUMENT_IMAGE_CAPTURE` accepts `ON` (include images), `OFF` (references only) or a document-count threshold, default `10`: above it, bodies are captured with image references only. When a task would acquire more than 30 distinct images without a policy, the work-start report asks you to choose between intelligent conversion and inclusion (recommended), including all images, or placeholders only.
To fix the choice in the project instead:
```ts
captureLark({ source: handbook, resources: { images: "reference-only" } });
captureLark({ source: handbook, resources: { gifs: "reference-only" } });
```
## Where the files live
```text
sources/lark//
├── .md # captured body
├── manifest.json # compact inventory with hashes
└── assets//
├── source.xml # structured source
├── capture-report.json # fidelity and resource handling
└── materialized/** # downloaded files and exports
knowledge/assets//. # only resources approved pages use
```
Source assets are part of the evidence snapshot, so keep them in Git; repositories with many binaries can store `materialized/` in Git LFS. Keep the Context knowledge workspace private when the documents or screenshots are access-controlled.
## Reusing a fetch you already have
If research already fetched a document, `context source fetch lark --output ` saves a portable snapshot before any knowledge workspace exists. After registering the matching source, `context source import` with `snapshot_dir` imports it without reading the document again. Import checks integrity and keeps the original capture time; it does not make the snapshot any fresher.
---
## Sources
- [context/packages/context/docs/guides/lark-resources.md L3–L9 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L122–L153 · 3b0ce0a]()
- [context/packages/context-cli/src/project/sourceCommands.ts L433–L441 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-capture-detailed.md L180–L196 · 3b0ce0a]()
- [context/packages/context/docs/guides/source-batches.md L49–L64 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/document-capture.md L66–L75 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L98–L103 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L61–L73 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L75–L90 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L201–L222 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L225–L237 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L120–L144 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L159–L163 · 3b0ce0a]()
- [context/packages/context/docs/guides/lark-resources.md L11–L50 · 3b0ce0a]()
---
## Notes
# Notes
A note is Markdown you supply directly: an excerpt from a document Context cannot read, a summary of a decision, a field observation, a checklist from experience. Context saves it as a source under `sources/note/YYYYMMDD/topic.md`. There is no registry and no capture phase — the saved file *is* the evidence that pages cite.
Use a note when the material is text you already hold. Use a [session summary]() when it comes from an Agent conversation, and a [document source]() or [Lark source]() when Context can capture the original itself.
## Prepare the content
A note may hold original text, selected verbatim excerpts, a summary, or a mix. No fixed template is required, but when both originals and a summary are present, separate them with headings or prose, and label any summary as a summary rather than a transcript.
- Keep qualifications, exceptions, disagreements and open questions that affect the conclusion.
- State where the material came from and what was left out, when the omission matters.
- Quote only actual input; do not invent links, speakers, dates or confirmations.
- A link in a note does not mean its target was read.
Pages cite the note as saved, so leave out anything the eventual readers must not see before you save it.
## Save and select it
Ask the Agent in plain language:
```text
Save these release-process notes as a Context note, then use them for a
page on hotfix releases.
```
The Agent saves the body with `context source import`. Saving alone starts no knowledge work. To use the note in a production task, the Agent adds its typed reference to `src/index.ts`, keeping existing sources and phases:
```ts
source("20261012/release-process.md", { type: "note" });
```
A note that only supports an existing page does not need this: it joins that page's reading scope during a revision.
## How notes become knowledge
The Agent integrates what is useful into explanations, rules or steps for the reader; it does not copy the note wholesale or turn proposals into facts. A short exact passage is quoted only when its wording matters. Citations point at the stored note, never at an original the Agent could not read.
## Correcting a note
Two different problems, two different fixes:
| Problem | Fix |
| --- | --- |
| The note misrepresents the material | Correct the note itself through `source import`, passing its current `base_digest`. |
| The note is right but a page is misleading | Revise only that page and send it through Review. |
Approving knowledge never changes or removes the note. To rename one, `context source rename [ --name ` previews the change and then updates existing references safely.
---
## Sources
- [context/packages/context/docs/guides/note.md L19–L21 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L71–L74 · 3b0ce0a]()
- [context/packages/context/docs/guides/note.md L6–L17 · 3b0ce0a]()
- [context/packages/context/docs/guides/note.md L29–L30 · 3b0ce0a]()
- [context/packages/context/docs/guides/note.md L19–L25 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-boundary.md L49–L59 · 3b0ce0a]()
- [context/packages/context/docs/guides/note.md L27–L30 · 3b0ce0a]()
- [context/packages/context/docs/guides/note.md L32–L37 · 3b0ce0a]()
- [context/packages/context-cli/README.md L331–L332 · 3b0ce0a]()
---
## Session Summaries
# Session Summaries
Design discussions, troubleshooting sessions and requirement conversations with an Agent often settle things that no document records. A **sessions** source keeps a bounded summary of such a conversation so that pages can cite it. It is a summary, never the transcript: Context does not scan your Agent's history or ingest a whole conversation.
## What to keep
The Agent (or whoever supplies the summary) prepares it before import:
| Keep | Drop |
| --- | --- |
| The problem, confirmed decisions and the reasons that matter | Repetitive turns |
| Constraints and open questions | Tool logs |
| Whether each statement was proposed, agreed, implemented or verified | Abandoned attempts, unless they explain a current limit |
If only a supplied summary exists, the source says so. Speakers, dates and approvals are never made up, and a conversation with nothing reusable can stay out of the Context knowledge workspace.
## Save it
Ask at the end of the conversation:
```text
Summarize what we decided about retry limits and save it as a Context
session summary, linked to the merge request we just opened.
```
The Agent imports a payload like this with `context source import --input `:
```yaml
type: sessions
name: 20261012/retry-limits.md
markdown: |
# Retry limits for payment callbacks
...
changes:
- mr: https://git.example.org/team/payments/merge_requests/42
```
Use the actual conversation date, or the collection date if unknown, and keep the same name for later corrections. The optional `changes` field links one or more code changes: each row takes a full `commit` SHA, an `mr` URL, or both, plus an optional `repository`. Omit it for a discussion with no code. A link records an association; it does not prove the change was merged or tested, and it does not authorize fetching the code.
## How it is used
Saving starts no knowledge work. A summary that opens a new reader topic goes through the normal structure review and writing; one that only supports an existing page joins that page's reading scope while the page keeps its primary source. Either way, knowledge turns the conclusions into answers, explanations and procedures — not a meeting recap — and `knowledge/structure.yaml` records which sections cite the summary.
See [Capturing from Conversations]() for the end-to-end flow after a Q&A.
## Corrections
Correct a faulty summary by importing it again with its current `base_digest`; existing `changes` are kept unless you remove them, and `changes: []` clears them. If the summary is accurate but a page is wrong, revise the page instead. Neither saving a summary nor approving knowledge approves the upstream code change it mentions.
---
## Sources
- [context/packages/context/docs/guides/sessions.md L3–L8 · 3b0ce0a]()
- [context/packages/context/docs/guides/sessions.md L10–L15 · 3b0ce0a]()
- [context/packages/context/docs/guides/sessions.md L17–L20 · 3b0ce0a]()
- [context/packages/context/docs/guides/sessions.md L22–L31 · 3b0ce0a]()
- [context/packages/context/docs/guides/sessions.md L38–L44 · 3b0ce0a]()
- [context/packages/context/docs/guides/sessions.md L48–L49 · 3b0ce0a]()
- [context/packages/context/docs/guides/sessions.md L32–L36 · 3b0ce0a]()
- [context/packages/context/docs/guides/sessions.md L46–L50 · 3b0ce0a]()
---
## Source Batches
# Source Batches
When a task involves many sources — a dozen services, a folder of handbooks, a Wiki section — register them as one batch rather than one command at a time. A batch is one serial registry write under one date, so sources do not race each other, and with checkpoints a long registration survives interruption.
Registering many sources is not the same as producing a large knowledge base. For work spanning more than 30 documents or substantive investigation of two or more repositories, the Agent first plans the project in stages; see [Large Projects]().
## The payload
```yaml
sources:
- type: repo
module: billing-service
local: ../billing-service
- type: file
local: ../docs/user-guide.md
- type: lark
url: https://example.larkoffice.com/wiki/example-token
```
```bash
context source add batch 20261012 --input .tmp/sources.yaml --configure --format json
```
- `repo.module` is required; `file` and `lark` modules are derived from the path or URL when omitted, and duplicates in the batch are rejected.
- `repo.local` is resolved from the Context project root. A valid checkout supplies its remote and commit, so `remote`/`ref` are needed only when they cannot be read.
- `--configure` also declares the sources and default capture phases in a simple `src/index.ts`. Without it, the batch only registers.
## Long batches: checkpoints and resume
```mermaid
flowchart LR
start["add batch]
--checkpoint --progress"] --> run["Register in chunks"]
run -->|interrupted| status["batch-status job-id"]
status --> resume["add batch --resume job-id"]
resume -->|revalidate every item| run
run --> receipt["Final receipt
registered / total"]
```
```bash
context source add batch 20261012 --input .tmp/sources.yaml --checkpoint --progress --format json
context source batch-status --format json
context source add batch --resume --progress --format json
```
The saved input stays under `.tmp/context-runtime/source-batches/`, so resuming does not need the original file. Resume replays and revalidates every item against the current registry; the saved cursor is only a hint. Do not combine `--resume` with a date or a new input. Progress goes to stderr as bounded JSON; stdout keeps the final receipt.
## Partial failure and locks
A batch keeps what succeeded: entries before a failed item stay registered, and the error names the completed entries and the failed position. Lark entries are validated in memory and committed in bounded atomic chunks.
Only one writer runs in a Context knowledge workspace at a time. Wait for an active command rather than starting another or deleting its lock. If a forced stop leaves a stale lock, run `context task recover --format json` before resuming.
---
## Sources
- [context/packages/context-cli/context-workflow/resources/procedures/source-boundary.md L67–L70 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L1–L4 · 3b0ce0a]()
- [context/packages/context-cli/src/project/sourceCommands.ts L292–L320 · 3b0ce0a]()
- [context/packages/context/docs/guides/source-batches.md L7–L29 · 3b0ce0a]()
- [context/packages/context/docs/guides/source-batches.md L31–L34 · 3b0ce0a]()
- [context/packages/context/docs/guides/source-batches.md L42–L47 · 3b0ce0a]()
---
## External Entrances
# External Entrances
Some content belongs next to your knowledge without becoming part of it: a team's engineering handbook on another site, a Skill published in another repository. `imports.yaml` at the root of the Context knowledge workspace declares such **entrances**. Context never downloads, installs or captures them; it only knows where they are so pages and packages can link to them.
| You need | Use |
| --- | --- |
| A link readers can follow | An import in `imports.yaml` |
| A conclusion that must be traceable and tracked for change | A registered, captured source |
| Docs or Skills in this same repository | [Same-Repository Docs]() |
## Declare an entrance
Ask the Agent to keep a lasting association; quick lookups during a question do not register anything.
```yaml
protocol: context.imports/v1
imports:
engineering-guide:
kind: knowledge
url: https://docs.example.org/engineering/
description: Engineering conventions
release-check:
kind: skill
url: https://github.com/example/skills/tree/v1/skills/release-check
path: skills/release-check
version: v1
```
The stable ID and `url` are required; `kind`, `format`, `title`, `description`, `path` and `version` are optional free-form hints. URLs must be HTTP(S) without credentials — never put access tokens in query strings. Use a new ID when the target's identity changes.
## Link to it from a page
```markdown
See the [Engineering guide](context:import/engineering-guide).
```
Build turns this into the declared URL as-is; it never guesses provider URLs, appends `path` or rewrites the version. An unknown ID keeps the label as plain text and produces a build warning.
To give readers a directory of all entrances, enable the imports page on the package; `importsPage: { site: true }` also adds it to the website navigation:
```ts
kbPackage({ name: "handbook", template: { path: "src/package-templates/kb" }, importsPage: true });
```
The page lists declared metadata only. Check that every entrance suits the audience before exposing private ones.
## Entrances are not evidence
An import adds nothing to `knowledge/structure.yaml` references and has no citation format. When asked to check imports, the Agent compares current versions with `version` using its own authorized tools; a target it cannot reach is reported as "version unknown", never as a change. The CLI itself never contacts providers.
---
## Sources
- [context/packages/context/docs/guides/imports.md L3–L7 · 3b0ce0a]()
- [context/packages/context/docs/guides/imports.md L39–L43 · 3b0ce0a]()
- [context/packages/context/docs/guides/imports.md L3–L31 · 3b0ce0a]()
- [context/packages/context/docs/guides/imports.md L52–L59 · 3b0ce0a]()
- [context/packages/context/docs/guides/imports.md L61–L80 · 3b0ce0a]()
- [context/packages/context/docs/guides/imports.md L39–L48 · 3b0ce0a]()
---
## Same-Repository Docs
# Same-Repository Docs
When the Context knowledge workspace sits inside a project repository, that repository usually already has documentation and Agent Skills. They should stay where they are and keep being edited there. `repo-content.yaml` registers them as **same-repository content**: Context links to the originals instead of copying their bodies into knowledge or source snapshots.
```mermaid
flowchart LR
orig["docs/ and .agents/skills/
the only originals"] --> links["repo-content/
relative symlinks"]
orig --> ev["Evidence
repo-content:docs@commit"]
links --> pages["Pages link with
context:repo/..."]
pages --> pkg["Optional entrance page
in the package or site"]
```
Use the `context-repo-content` Skill to choose and edit these entries; it does not start knowledge production.
## Register
At the knowledge workspace root:
```yaml
protocol: context.repo-content/v1
entries:
docs:
kind: docs
path: docs
tools:
kind: skills
path: .agents/skills
```
Paths are relative to the Git root, not the knowledge workspace. Kinds are `docs`, `document`, `skills` and `skill`. Optional `group` adds one module level, `mount` overrides the default mount name, and `exclude` globs skip files inside an entry (they are not access control). Overlapping entries, targets outside the repository, nested repositories and cycles are rejected.
`context source ensure repo-content --format json` maintains the relative symlinks under `repo-content/`; `context status` reports problems without repairing them. Ordinary files are never overwritten, and no Git configuration or index changes.
## Link and cite
A page links to an original with `[Guide](context:repo/docs/guide.md)`; build turns it into an upstream link when one is available, otherwise a plain location. Evidence records `repo-content:docs@` with the real path, line range and digest; uncommitted text is recorded as `+worktree`.
## Optional entrance page
```ts
kbPackage({ name: "project-kb", template: { path: "src/package-templates/kb" }, repoContentPage: true });
```
This projects each group's README and the Skill names and descriptions into `wikis/repo-content.md`; it does not copy all docs or Skill scripts. `{ site: true }` adds the entrance to a configured website. Review README sensitivity before exposing it.
## When something is wrong
- An invalid `repo-content.yaml` is reported by `status`, and `context build` stops before replacing existing outputs. Correct the file rather than rerunning `ensure`.
- `ensure` is suggested only for missing or misdirected symlinks.
- Other repositories and externally installed Skills are not same-repository content; declare them as [External Entrances]().
Registering an entrance does not authorize installing, running or publishing anything.
---
## Sources
- [context/packages/context/docs/guides/repo-content.md L3–L5 · 3b0ce0a]()
- [context/plugins/context/skills/context-repo-content/SKILL.md L1–L4 · 3b0ce0a]()
- [context/packages/context/docs/guides/repo-content.md L7–L31 · 3b0ce0a]()
- [context/packages/context/docs/guides/repo-content.md L43–L48 · 3b0ce0a]()
- [context/packages/context/docs/guides/repo-content.md L50–L67 · 3b0ce0a]()
- [context/packages/context/docs/guides/repo-content.md L33–L41 · 3b0ce0a]()
- [context/packages/context/docs/guides/repo-content.md L69–L71 · 3b0ce0a]()
---
## Start Reports
# Start Reports
Before the Agent writes pages in bulk, it shows you a **work-start report**: what it found in the sources, which articles it plans, and how they will be organized. This is your cheapest moment to steer. Changing a plan costs a sentence; changing thirty written pages costs a revision round.
```mermaid
flowchart LR
talk["Describe the goal
and sources"] --> inv["Agent registers sources
and investigates lightly"]
inv --> rep["Work-start report
.tmp/work-start-report.md"]
rep -->|change scope| inv
rep -->|confirm| write["Bulk writing"]
write --> review["Knowledge Review"]
```
## How you get there
Start by talking freely: what the knowledge should cover, where it comes from (repositories, modules, document links) and what form you expect — a package for Agents, a site, or both. The Agent researches representative material and asks only about gaps that would change the scope or the output. It does not run a fixed questionnaire, and fully managed mode does not authorize guessing your answers.
For a first build, the Agent registers and captures the confirmed sources, takes a code skeleton and document outlines, and only then writes the report. It does not deep-read every implementation first; broad scope calls for a horizontal survey.
## What the report contains
The report is written in your language, under `.tmp/`, and adapts to the task. Typical sections:
| Section | What to look for |
| --- | --- |
| Readers, goal and current delivery | Who uses the knowledge, the whole outcome, and what this first batch delivers |
| What the materials support | Checked topics versus provisional ones, and what is still uninvestigated |
| Articles and batches | Each reader topic, new or existing article, supporting sources, and its depth: an entry point, an explanation or a procedure |
| Reading organization | Proposed navigation; for a new site, a sketch of top-level groups, a representative menu and page outlines |
| Indexing guidance | Which Indexer Skills are used on which sources |
| Decisions and gaps | Confirmed choices versus recommendations, conflicts, exclusions and unchecked coverage |
Material counts, article counts and investigated scope are kept separate, and unknown totals are never shown as zero. A first batch is not presented as the whole goal.
## Answering it
Reply in plain language: confirm, or say what to change. Requested changes are made before the Agent records your confirmation.
You are asked when the scope is complex and touches more than five articles, or when a separate decision is open — most often a **top-level navigation change**, which always shows a before/after tree and needs its own explicit answer. When a task exceeds 30 distinct images without a policy, the report also asks how to handle them. Small bounded tasks — a few documents, one module, a revision — get a short proposal instead, and a specific earlier request can already cover it.
Silence, elapsed time, questions and objections are never approval. Approval of an unchanged plan carries across batches and retries; material changes or scope expansion bring the plan back to you.
## Large projects
For work spanning more than 30 source documents or substantive investigation of two or more repositories, the `context-plan` Skill first produces a project PLAN that splits the work into stages. Each stage then gets its own work-start report within the approved plan. See [Large Projects]().
---
## Sources
- [context/packages/context-cli/context-workflow/resources/procedures/work-start-report.md L7–L16 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L107–L112 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-dialogue.md L68–L74 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/work-start-report.md L18–L46 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/templates/work-start-report.md L9–L70 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/work-start-report.md L55–L66 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/work-start-report.md L124–L157 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/work-start-report.md L85–L95 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/work-start-report.md L47–L53 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-guide.md L6–L15 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L1–L4 · 3b0ce0a]()
---
## Working with Agents
# Working with Agents
You drive Context through your Agent, not through the CLI. Invoke `/c4a:context` (Cursor: `/c4a-context`), describe the knowledge in normal language, and answer the decisions it brings back. The Agent reads the workflow's current Route from the CLI, runs the returned commands and writes the pages; the CLI validates sources and page identities, derives paths and owns Review, `knowledge/` and `dist/`.
Ordinary coding or design conversations never start Context on their own; invoke it explicitly, or continue a conversation where it is already active.
## Brief it well
The more the first message settles, the fewer questions follow. Cover:
- **Readers and questions** — who will use the knowledge and what they need to answer.
- **Sources** — repositories, modules, document folders or links, and what to skip.
- **Output** — a package for Agents, a website, or both, and the language.
```text
/c4a:context Initialize a Context knowledge workspace in ./kb and build knowledge for
../billing-service and ../docs/billing. Readers are on-call engineers who need
to diagnose failed invoices. Skip the legacy-export module. Investigate first,
then give me the work-start report.
```
Answers you have already given are reused for the rest of the task, not asked again at every step.
## What it asks you, and what it decides
| You decide | The Agent decides |
| --- | --- |
| Which sources and modules are in scope | Which Indexer Skills to use |
| Which readers and questions matter | Topics, page boundaries and organization within the approved plan |
| Whether two subjects are the same knowledge owner | Wording and structure of each page |
| Whether a custom Indexer or executable extension is acceptable | Mechanical steps returned by the Route |
| Whether the outline and the candidate pages are approved | — |
Even in fully managed mode the Agent asks when missing purpose or scope would change the outcome. Before indexing a large boundary it identifies obsolete or irrelevant areas with you from the actual material, rather than guessing from names.
## Following progress
Production is the long phase — roughly a minute per article task on average. The Agent reports progress against the task total, and you can ask for a local preview at any time. Transition reports stay short: what changed, the current state and the next decision.
Look at the work-start report and the first changed pages early. If something is off — tone, a counterexample, a style rule — say so. The earlier a correction lands, the better the final result.
## Adding material or changing course
Say it in the conversation:
```text
Add ../docs/refunds to the sources, re-plan the affected part and give me a
new work-start report.
```
New material within the confirmed purpose becomes a plan amendment that keeps completed work; a new purpose or source still goes back through your confirmation. To correct a page, see [Revising a Page]().
## Interruptions and resuming
Workflow state lives in the knowledge workspace, not in the conversation. After a closed session or a crash, open a new conversation in the same knowledge workspace and invoke `/c4a:context`; the Agent reads the current Route and continues. Accepted tasks are never resubmitted, and deleting temporary runtime files is not a way to restart — it does not authorize replaying accepted work.
## Several Agents in parallel
When your host can coordinate child Agents, the work can be split across them. The CLI decides which batches are eligible; each worker writes only its assigned drafts, and one coordinator submits everything to Context. Without that capability the Agent uses a single batch — no simulated workers. Parallelism never waives a decision that is yours.
## Git and publishing
Completing Context work does not authorize Git operations. The Agent stages, commits, pushes, publishes or deploys only when you ask.
---
## Sources
- [context/plugins/context/README.md L19–L26 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-guide.md L71–L74 · 3b0ce0a]()
- [context/plugins/context/README.md L30–L31 · 3b0ce0a]()
- note:20261012/usage-practices.md · usage-practices.md L7–L7
- note:20261012/usage-practices.md · usage-practices.md L66–L66
- [context/packages/context/docs/guides/agent-guide.md L65–L66 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-guide.md L54–L74 · 3b0ce0a]()
- note:20261012/usage-practices.md · usage-practices.md L8–L8
- note:20261012/usage-practices.md · usage-practices.md L14–L14
- [context/packages/context/docs/guides/agent-dialogue.md L45–L46 · 3b0ce0a]()
- note:20261012/usage-practices.md · usage-practices.md L67–L67
- [context/packages/context-cli/context-workflow/resources/procedures/production-stage-files.md L55–L59 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L140–L153 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/parallel-agent-batch.md L7–L19 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-guide.md L178–L179 · 3b0ce0a]()
---
## Managed Mode and Review Policy
# Managed Mode and Review Policy
The workflow pauses at **Gates**: decisions that belong to a person. How the Agent handles each one is governed by a named **policy switch**. In ordinary mode, the Agent applies each switch's ordinary default. In **fully managed mode**, a few switches change their default so the run proceeds on its own — but some decisions never delegate, so even a fully managed run stops there.
Three layers can change a switch. Later layers win:
```mermaid
flowchart LR
ord["Ordinary default"] --> man["Fully managed default"]
man --> bot["Custom Bot setting"]
bot --> task["Task-scoped CONTEXT_RUN_POLICY
(review switches only)"]
task --> eff["Effective policy
for this task"]
```
## All policy switches
The `context.gate.*` IDs are stable Agent policy switches defined by the `context` Skill. They are not CLI flags or environment variables, and changing one never changes the Route's own gate ID, command or payload.
| Switch | What it decides | Ordinary default | Fully managed default |
| --- | --- | --- | --- |
| `context.gate.plan_review` | Approving a project PLAN from `context-plan` | Present the PLAN and ask | Same, unless delegated for this task |
| `context.gate.production_entry` | Whether the request is a Context production task | Ask only if intent is unclear | Same |
| `context.gate.workspace_initialize_nonempty` | Initializing a Context knowledge workspace in a directory that is not empty | Proceed if you already chose this target; otherwise ask | Same |
| `context.gate.work_start_scope` | Confirming the work-start report | Present the report; ask only if the scope is complex **and** affects more than five new or revised articles | Same |
| `context.gate.source_boundary` | Which sources and modules are in scope | Use your selected scope; ask only for missing boundaries | Same |
| `context.gate.source_read` | Reading a source you supplied | Your request authorizes it; no second question | Same |
| `context.gate.repository_clone` | Cloning a missing repository | Ask before cloning | Restore within the selected scope without asking |
| `context.gate.indexer_extra_action` | Extra Indexer operations | Ask only if one blocks the result and no alternative works | Resolve eligible operations without asking |
| `context.gate.image_handling` | Handling images in an image-heavy task | Ask once above 30 distinct images | Same |
| `context.gate.top_level_directory` | Adding, renaming or removing a top-level directory | Confirm the concrete structure | Same |
| `context.gate.knowledge_review` | Approving the candidate batch | Ask for a decision on the HTML report | Delegate when the Route permits |
| `context.gate.deletion_scope` | Deleting sources or retiring approved pages | No second question within the approved exact scope; ask before anything outside it | Same |
| `context.gate.package_output` | How approved knowledge is packaged | Ask | Choose within the requested delivery |
| `context.gate.package_template` | Keeping or editing generated package templates | Ask | Choose within the requested delivery |
| `context.gate.git_delivery` | Commit, push or merge request | Ask | Same |
| `context.gate.publication` | Publishing a package or site | Ask | Same |
| `context.gate.remote_target_create` | Creating a remote publishing target | Ask | Same |
| `context.gate.workspace_reset_restore` | Clearing the knowledge workspace or restoring history | No second question when target and losses are clear | Same |
| `context.gate.exceptional_recovery` | Recovery from an unexpected failure | Ask only for a blocker that prevents the requested result | Same |
A decision you already made for the same scope is reused rather than asked again.
## Turning on fully managed mode
Ask for it in the conversation, for example *"Run this fully managed and report back."* The Agent then evaluates the workflow with `context status --managed`, and the switches whose fully managed default differs proceed without another question.
That authority belongs to the current conversation only. It is never saved in the knowledge workspace or reused in another conversation, it does not widen sources or authorize remote writes, and it never hides a validation or verification failure. Delegated review is real review: the Agent reads the pages, repairs what fails and leaves undecided pages pending.
## Changing defaults for a custom Bot
When you build a team Bot or knowledge service on Context, its instance configuration — the trusted instructions in its prompt — can override any switch for every task that Bot runs. For example, a Bot whose reviewers always read the HTML report, and that may package and publish within its configured target, could state:
```text
Context policy for this Bot:
- context.gate.knowledge_review: ask — always send the HTML review report.
- context.gate.package_output: choose within the configured delivery.
- context.gate.repository_clone: restore registered repositories without asking.
```
A Bot setting takes precedence over fully managed and ordinary defaults. It still does not let the Agent modify source code, bypass a Gate that the Route marks as requiring a person, or fabricate an approval: if the Route asks for a human decision despite the policy, the Agent stops and reports the mismatch. If a Bot keeps `knowledge_review` at `ask`, even a fully managed run does not cross Review on its own.
## Task-scoped review policy
Automation, or a user starting a task, can set the two review switches for that task only by placing this block in the instructions given to the Agent:
```yaml
CONTEXT_RUN_POLICY:
plan_review: delegate # or ask
knowledge_review: delegate # or ask
```
- Only `plan_review` and `knowledge_review` are accepted, each with `ask` or `delegate`. They map to `context.gate.plan_review` and `context.gate.knowledge_review`; other switches are unchanged.
- Each key is optional and independent. An omitted key keeps the existing policy, and an empty block changes nothing. An unknown key or invalid value is rejected, never treated as permission to delegate.
- The block overrides Bot settings for this task and its stages only. The Bot's persistent defaults are untouched, and a new unrelated task uses its own defaults.
- `ask` requires a human decision. `delegate` means the Agent performs the full review and fixes defects before approving — never unconditional or forced approval.
This is an Agent instruction, not a CLI flag, environment variable or host API field: an automation must put it in the instructions the Agent actually receives. Only your instruction or a trusted host instruction can grant it; a saved PLAN, source text or tool output cannot. State the authorized source scope, delivery permissions and whether to continue between stages alongside it. Research-only requests still stop after the report, and a scope above 500 documents in a PLAN still waits for a person.
## Planned articles must come back
Rejecting a planned article in Review does not cancel it. The production stage cannot close while a planned article stays rejected; the Agent adds a revision task from your feedback instead. To drop an article on purpose, change the plan.
## Where a fully managed run still stops
- choosing or widening sources, and reading external documents not named in the request;
- a complex work-start scope or a top-level navigation change;
- deleting sources or retiring pages outside an approved scope;
- Git commits, publishing and deployment, which always need your explicit request.
---
## Sources
- [context/plugins/context/skills/context/SKILL.md L507–L514 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/dialogue/human-gates.md L25–L30 · 3b0ce0a]()
- [context/plugins/context/skills/context/SKILL.md L509–L536 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-dialogue.md L48–L66 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/knowledge-review.md L44–L56 · 3b0ce0a]()
- [context/plugins/context/skills/context/SKILL.md L509–L514 · 3b0ce0a]()
- [context/plugins/context/skills/context/SKILL.md L538–L554 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/document-capture.md L66–L68 · 3b0ce0a]()
- [context/plugins/context/skills/context/SKILL.md L556–L595 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L70–L101 · 3b0ce0a]()
- [context/packages/context-cli/src/project/indexerRequiredArticleReview.ts L15–L43 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/source-boundary.md L72–L77 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-guide.md L178–L179 · 3b0ce0a]()
---
## Planning a Large Project
# Planning a Large Project
**Plan mode** is the `context-plan` Skill. It turns a large knowledge project into a reviewed **PLAN report** and a series of bounded **stages**, then hands one stage at a time to the ordinary Context workflow. It is a research and coordination layer, not a second workflow engine: each stage still gets its own work-start report, writing and Knowledge Review.
```mermaid
flowchart TD
ask["You describe the project"] --> research["Research in .tmp/context-plans/"]
research --> plan["PLAN-YYYYMMDD-slug.md"]
plan -->|"you approve"| stage["Hand one stage to /c4a:context"]
stage --> deliver["Write, review, build, deliver"]
deliver -->|"record results in the PLAN"| next{"More stages?"}
next -->|yes| stage
next -->|no| close["Remove the PLAN in the final commit"]
```
## When plan mode applies
Use it when the scope has **more than 30 source documents, or at least two repositories that need real investigation**, or for a broad update across source versions. Invoke `/c4a:context-plan` (Cursor: `/c4a-context-plan`) explicitly, continue an existing `PLAN-*.md`, or let `/c4a:context` hand over when an authorized task crosses the threshold. Small bounded tasks continue through `/c4a:context` directly.
```text
/c4a:context-plan Build a knowledge base for our three payment services and the
design folder. Readers are new backend engineers. Plan it in stages and report
after each stage.
```
A very large monorepo with several business directions may be better served by one Context knowledge workspace per direction; plan mode does not migrate existing knowledge workspaces on its own.
## What happens during research
The Agent works in scratch space under the project's Git root:
```text
/
PLAN-YYYYMMDD-slug.md
.tmp/context-plans/YYYYMMDD-slug/
repos/ # new checkouts, when existing local ones cannot be reused
documents/ # retrieved document bodies and resources
research/ # inventory and investigation notes
stage-inputs/ # the current stage's production handoff
```
It starts from directory metadata, versions and existing coverage, reads representative material and code entry points, and expands only as far as needed to divide the work. Repository `latest` or a branch is resolved to an exact commit before it is used as evidence. Scratch data stays out of Git; the committed PLAN keeps enough source identity to resume if scratch files disappear.
Before proposing any article, it reads the knowledge workspace's current organization and the relevant approved pages, and decides per topic: **reuse unchanged**, **revise or extend**, **consolidate**, **add**, or **investigate** an unresolved conflict or access gap. Research is read-only for approved knowledge.
For a broad source update, each repository gets its own baseline and target commit, and only the files the approved articles actually cite are compared. The Agent first compares their Git object IDs at both commits — an unchanged ID needs no content read — and, in a partial clone, fetches the objects it still needs in one batch instead of letting each read download files one at a time. A changed file is a candidate for investigation, not proof that an article must be rewritten.
## Reading the PLAN report
The report is ordinary Markdown at the Git root. Check each part:
| Section | What to check |
| --- | --- |
| Outcome and current position | The readers and requested outcome are yours; the knowledge workspace and Git root are right |
| Research scope and findings | Every source you meant is listed with an exact version; access gaps are named, not hidden |
| Existing knowledge and material relationships | Overlaps with pages you already have are reused or revised, not duplicated |
| Proposed stages | Each stage has a clear reader outcome, its sources and pinned refs, and sensible prerequisites |
| Approval and execution choices | Review policy, reporting, delivery destination and Git process match what you intend |
| Current stage handoff | The next stage's sources, targets and decisions to preserve |
| Results and synchronization | Actual production, review, delivery, commits and merge state per stage |
| Resume notes | The exact position and next action if work is interrupted |
To change it, say so — *"split S03 into references and guides"*, *"drop the legacy folder"*. Approving the PLAN does not approve any article, source permission, Git operation or publication.
## Stage size and large scopes
| Boundary | Default |
| --- | --- |
| Source documents per stage | Recommended 30; never more than 50, with a reason recorded for groups above 30 |
| New repository investigation | One repository per stage; previously studied repositories may support later stages |
| Revision stage | At most 30 target articles |
| More than 100 documents | The Agent checks whether bounded research can establish a useful scope and confirms it with you |
| More than 500 documents | The whole task pauses until a person narrows the scope or explicitly keeps all of it |
Filters you may be offered include selected directories or domains, excluding archives, a recent-update cutoff with its date, or durable documentation only. Nothing is excluded silently. The 500-document pause cannot be resolved by delegation, managed mode or a scheduled trigger.
## Who reviews the PLAN
PLAN review asks you by default, including in fully managed mode. A task can hand it to the Agent with `plan_review: delegate` in a [`CONTEXT_RUN_POLICY` block](); the Agent then reads the whole report, checks scope, stage limits, dependencies, overlaps, evidence gaps and delivery settings, and repairs deficiencies before recording its decision. Article review is independent: delegating PLAN review leaves Knowledge Review unchanged.
The Agent also settles how you want to hear about progress: once after all stages, or after each stage — and for stage reports, whether to continue automatically or wait for your reply. A research-only request stops at the report; executing the plan needs your explicit go-ahead.
## Running the stages
For each stage, the Agent hands the ordinary `context` Skill the PLAN path, stage ID, selected sources and pinned refs, target articles, reuse and revision decisions, and the inherited review, reporting and publishing settings. Production then follows its fresh Route for that scope only.
After each stage it records the actual research, production, review, merge and delivery results. A stage that must be published is marked delivered only after publication succeeds — a local build or an open merge request is not publication. Before the next stage, it rechecks the affected knowledge, including pages delivered by earlier stages, so nothing is recreated or overwritten.
## Interruptions and finishing
If a session ends, the PLAN keeps the current position and next action. Open a new conversation in the same knowledge workspace and invoke `/c4a:context-plan`; it resumes the current stage instead of repeating the project-wide research. A saved review policy in the PLAN is only a record: on resume, delegation is honored only if trusted task instructions still grant it.
When every agreed stage is delivered and integration is resolved, the PLAN is removed in the authorized final commit. Its history stays in Git.
For the short overview, see [Large Projects]().
---
## Sources
- [context/plugins/context/skills/context-plan/SKILL.md L8–L13 · 3b0ce0a]()
- [context/plugins/context/README.md L36–L43 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L15–L26 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L28–L34 · 3b0ce0a]()
- [context/plugins/context/README.md L28–L35 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L10–L36 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L109–L152 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L194–L212 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/templates/PLAN.md L1–L118 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L54–L60 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L164–L180 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L46–L73 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L90–L95 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L70–L102 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L228–L247 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L61–L63 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L261–L294 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L113–L125 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/references/project-planning.md L310–L320 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/templates/PLAN.md L112–L118 · 3b0ce0a]()
- [context/plugins/context/skills/context-plan/SKILL.md L123–L128 · 3b0ce0a]()
---
## Reading Review Reports
# Reading Review Reports
Nothing the Agent writes becomes knowledge until it passes **Knowledge Review**. The Agent opens one HTML report for the whole current batch of candidate pages and waits for your answer. This report decides both the scope and the quality of what gets published, so it is worth reading with three questions in mind.
## What is in the report
| Part | What it shows |
| --- | --- |
| Change overview | The batch at a glance, with the existing navigation and the expected file tree of the Context knowledge workspace |
| Navigation | Where each page will sit; pages without a placement are flagged so the Agent can bind them before asking you |
| Pages | Each candidate's title, path, summary and full rendered content, including diagrams and source citations. New pages are marked *New*; changed pages show the changed blocks next to the previous text |
| Revision notes | A note box per page; typing in it marks the page for revision |
Opening a page marks it READ in your browser. Read counts and notes are local conveniences, not approval. The revision counter lists every page with notes, and **Copy** exports them as plain text with article IDs and titles for pasting into the conversation.
## Three things to judge
1. **Structure** — Are the topics, directories and pages divided the way readers will look for them?
2. **Content** — Do the pages carry the intended purpose, depth and style? Can a reader actually complete the promised task with them?
3. **Scope** — Is related material missing that should be included, or is something here that should be dropped?
Citations and placements alone do not prove a page is useful. Spot-check a few pages against their sources, especially defaults, conditions and steps.
## Answering
```mermaid
flowchart LR
rep["Review report"] --> a{"Your reply"}
a -->|approve| ok["Approved into knowledge/"]
a -->|notes only| fix["Agent repairs"]
fix --> rep2["Updated report"]
rep2 --> a
a -->|notes + approve after fixing| fix2["Agent repairs and verifies"]
fix2 --> ok
```
Reply in the conversation; no review code or magic phrase is needed.
| You say | What happens |
| --- | --- |
| Approve, or continue | The presented batch is approved |
| Revision notes only | The Agent repairs those pages, checks the result and shows an updated report |
| Notes plus "approve after fixing" | The Agent repairs, verifies the fix, and approves only the agreed pages without asking again |
| "Fix it and show me" | Editing only; it waits for your decision on the new report |
Silence, an ignored card or read progress is never approval. Rejecting a page leaves it out of this batch; it does not retire an already approved article.
## Taking part of a batch now
You can approve the pages that are ready while others go back for repair. Approval alone does not build; to see the approved pages published before the rest are finished, ask for an early delivery. The Agent runs close and build for them, as long as they do not link to pages still pending, and then returns to the remaining review.
## After approval
Approval writes the pages to `knowledge/`. Close then rebuilds `knowledge/structure.yaml` and verifies the approved knowledge without rewriting its prose, and build produces the package and site. Nothing is published before approval.
---
## Sources
- [context/packages/context-cli/context-workflow/resources/procedures/knowledge-review.md L12–L14 · 3b0ce0a]()
- note:20261012/usage-practices.md · usage-practices.md L18–L18
- [context/packages/context-cli/context-workflow/resources/procedures/knowledge-review.md L69–L90 · 3b0ce0a]()
- [context/packages/context/docs/guides/agent-guide.md L111–L122 · 3b0ce0a]()
- note:20261012/usage-practices.md · usage-practices.md L16–L22
- [context/packages/context-cli/context-workflow/resources/procedures/knowledge-review.md L142–L152 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/dialogue/knowledge-review.md L9–L37 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/knowledge-review.md L92–L94 · 3b0ce0a]()
- [context/packages/context-cli/context-workflow/resources/procedures/knowledge-review.md L132–L140 · 3b0ce0a]()
- [context/packages/context/docs/getting-started.md L133–L136 · 3b0ce0a](