CLI Commands
The context CLI holds the workflow state of a Context knowledge workspace. You rarely type these commands yourself: the Agent runs them, and most of them are returned by the current Route — the single next step that context status or a previous command hands back, often with an exact --revision to pass. Commands that drive the workflow print JSON with --format json, which is what the Agent reads.
Run context <command> --help for the full option list of any command. For the Skills that call these commands, see Skills; for a short tour, see Commands and Skills.
Setup
| Command | What it does | Key options |
|---|---|---|
context entry [dir] | Resolves the single Agent entry: plans initialization for a new directory or evaluates the workflow of an existing workspace | --name, --language en|zh-CN, --managed, --authority |
context init [dir] | Initializes a Context knowledge workspace in the directory | --name, --language, --allow-nonempty (after explicit confirmation) |
context plugin path | Prints the bundled plugin root used by install | |
context plugin status | Shows the bundled plugin root and which Agents have the plugin globally | |
context plugin install | Installs the Agent plugin globally, or copies standalone Skills into a repository | --agent claude|codex|cursor|all, --local <repo> (also auto-detect, standalone), --dry-run |
context evidence install [dir] | Installs or safely upgrades the bundled remote code evidence plugin, without starting production | |
context clean-cache | Removes orphaned Claude Code plugin caches | --dry-run |
Workflow
| Command | What it does | Key options |
|---|---|---|
context status | Prints the workspace overview and the next Route; --view full also expands phases and sources | --format table|json, --view summary|full, --managed, --authority |
context run [phase] | Inspects or runs a declared phase; with no phase, advances deterministic Routes | --list, --dry-run, --until blocked-or-complete, --max-steps, --deliver, --resume-writing |
context resource acknowledge-current | Records that every resource required by the current Route was read | |
context resource materialize <id> | Writes one revision-bound Context view to a local file | |
context action prepare-current | Prepares or retries the current production batch, or every page of a prepared revision batch, without resubmitting accepted work | --revision, --input, --managed |
context action complete-current | Submits the semantic output — a report decision, drafts, a Gate answer — for the exact current revision; --preview checks one revised page, a whole prepared revision batch or the article files of a production stage, listing every problem at once without saving anything | --revision, --input, --managed, --multi-agent, --preview |
Tasks and maintenance
| Command | What it does |
|---|---|
context task prepare | Previews or discards current task state; keeps knowledge, sources and other temporary files |
context task resume | Explicitly reopens cleared production from registered requirements and retained knowledge |
context task adjust | Adjusts current source and module inputs, or the knowledge map, without disturbing unrelated work (--input, --schema, --inspect); an input with knowledge_map is checked against the map's own fields, so an error names the map entry to fix |
context task maintain | Registers a scoped page revision, regeneration or approved-output rebuild |
context task record-fix | Records a purely mechanical correction (a typo, a broken link) made after a batch's approval and before its delivery, with the reason; it needs no further review |
context task advance-maintenance | Executes the current maintenance transition |
context task maintenance-status | Shows maintenance requests and the current cancellation revision |
context task cancel-maintenance <id> | Cancels a pending maintenance request without discarding an active draft |
context task retire | Previews or applies retirement of an approved article and cleanup of references to it |
context task recover | Inspects or previews scoped recovery outside the normal Route; --managed keeps a managed session's mode |
context task rollback | Previews exact user-selected reversions and discarded drafts, and what happens to the open production stage: discard-whole-task deletes it with its unfinished tasks and working directory at cleanup, keep resumes it when only a page revision that interrupted it is rolled back; a requested partial delivery that the rollback cancels is listed. Never resets the repository |
context task finish-rollback | Finishes a rollback after close and all builds succeed, also when the workspace had an unfinished production stage |
context update | Checks acquired source changes against approved knowledge in confirmed scopes (--input, reading only what the checkouts already have), or, with --pending and no input file, processes registered repositories whose commit moved past the processed version, fetching that commit and the cited contents a partial clone lacks; pass exactly one of the two |
context revise <target> | Repairs one draft or approved page through the Indexer lifecycle (--instruction, --regenerate, --timing after-batch|priority, --move-to) |
Review
| Command | What it does | Key options |
|---|---|---|
context review html [collection] | Renders a self-contained local review report; without a graphical session, --open prints the path to open instead | --all, --out, --open |
context review list [collection] | Lists draft candidates in the terminal | |
context review apply <file> | Applies scoped JSON or JSONL decisions and revision instructions | |
context review approve-all [collection] | Approves the whole current review scope | --all, --confirmed (your confirmation), --managed |
context review approve <id> / reject <id> | Approves or rejects one draft candidate | |
context review deprecate <article-id> | Marks an approved page deprecated without deleting it | |
context review original-revisions | Lists the revisions proposed for pages kept as written in the current review batch; --propose adds proposals from a YAML/JSON file or - (Context reads the original passage itself), --resolve removes a proposal once its decision is applied to the article | --propose <file>, --resolve <id|all> (repeatable), --format |
Delivery
| Command | What it does | Key options |
|---|---|---|
context close | Closes approved knowledge: derives structure.yaml and runs final verification | --format |
context verify | Validates the workspace | --compact, --view diagnostics, --page-size, --page-token |
context build | Builds the declared packages and sites | --verbose |
context translate status | Reports translation freshness per locale, including translations whose page no longer exists | |
context translate prepare | Writes a draft per pending article — its stale translation, or the approved source when missing — with a source_diff against the source it was last translated from, plus a submission file. When only translations of removed pages remain, it removes them and finishes the round | |
context translate submit | Validates and saves translated articles and navigation titles | --input |
context translate skip | Publishes pending translations in the primary language for now |
Versions and packages
| Command | What it does | Key options |
|---|---|---|
context version inspect | Shows formal changes since the current version tag or a given ref; a version already on the remote default branch is reported as merged_to, and only an unmerged one is offered as reusable_version | --base |
context version record | Records the workspace SemVer and changelog entry; refuses while drafts still await review | --input |
context package site-url <package> <url> | Records a deployed site root in the site maps, without network checks | |
context package template accept [package] | Explicitly accepts an unchanged generated starter template |
Sources and Indexers
| Command | What it does |
|---|---|
context source add repo|file|lark [date] | Registers a repository, local file or Lark document module under a YYYYMMDD batch |
context source add repo [date] --module <name> | Registers or updates a repository module. --local <path> reads the remote and current commit from a checkout and may point at a monorepo package directory; --remote <url> and --ref <sha> pin it without a checkout; --subpath <dir> names a repository-relative package directory together with --remote/--ref or a --local repository root (a different directory than a --local package path is rejected) |
context source add file [date] --module <name> | Registers or updates a file module. --local <path> names the directory or file (an existing source keeps its path when omitted); --layout tree keeps folders and the images and small files documents link to (default flat); --document-ext <ext> also captures that extension as citable text (repeatable, e.g. .json, .yaml); --freeze keeps the current snapshot and stops capturing, --unfreeze allows capturing again; --origin-kind, --origin-id, --origin-version and --origin-url record the versioned origin of installed content (built-in kind: git) — see Published and Archived Collections |
context source add batch [date] | Registers several modules under one batch from a YAML/JSON --input. Repo items accept type, module, local, remote, ref and subpath; an unsupported field is rejected with the list of fields that item type accepts |
context source import | Imports managed Markdown (notes, session summaries) or prefetched Lark content, singly or in a batch |
context source discover / fetch | Discovers a source inventory, or fetches a portable snapshot, without registering anything |
context source batch-status <job-id> | Reads a saved registration checkpoint |
context source list / get <id> | Lists registry entries, or shows one |
context source rename <id> | Renames a note or session summary and updates its references |
context source remove <id> | Previews or removes an unreferenced source and its snapshot |
context source inspect [name] | Shows repository module boundaries without extraction |
context source ensure [name] | Checks repository checkouts without cloning, checking out or resetting |
context source recovery-plan [name] | Plans recovery of missing repository checkouts without changing files |
context source restore | Restores repository checkouts from explicit local or clone decisions, or one registered document's snapshot from Git history |
context indexer catalog | Lists bundled Skill names, descriptions and entries |
context indexer report-benchmark | Builds a forward-test report from an independently loaded oracle |
Diagnostics
| Command | What it does |
|---|---|
context debug enable / disable | Turns workspace-local tracing on or off; disabling keeps existing traces |
context debug status | Shows debug configuration, counts and trace paths |
context debug export | Builds a replay projection from the event stream |
Tracing can also be enabled at creation with context init --debug.
CLI 命令
context CLI 保存 Context 知识工作区的工作流状态。你很少需要亲自输入这些命令:它们由 Agent 执行,而且大多数由当前 Route 返回——Route 是 context status 或上一条命令交回的唯一下一步,通常还附带需要传入的确切 --revision。驱动工作流的命令在使用 --format json 时输出 JSON,Agent 读取的正是这份输出。
运行 context <command> --help 可查看任一命令的完整选项列表。调用这些命令的 Skill 见 Skill;简要介绍见 命令与技能。
安装与设置
| 命令 | 作用 | 主要选项 |
|---|---|---|
context entry [dir] | 解析唯一的 Agent 入口:为新目录规划初始化,或评估已有知识工作区的工作流 | --name、--language en|zh-CN、--managed、--authority |
context init [dir] | 在该目录中初始化 Context 知识工作区 | --name、--language、--allow-nonempty(需明确确认后使用) |
context plugin path | 输出安装时使用的内置插件根目录 | |
context plugin status | 显示内置插件根目录,以及哪些 Agent 已全局安装该插件 | |
context plugin install | 全局安装 Agent 插件,或把独立 Skill 复制到某个仓库 | --agent claude|codex|cursor|all、--local <repo>(也可为 auto-detect、standalone)、--dry-run |
context evidence install [dir] | 安装或安全升级内置的远程代码证据插件,不会启动生产 | |
context clean-cache | 删除孤立的 Claude Code 插件缓存 | --dry-run |
工作流
| 命令 | 作用 | 主要选项 |
|---|---|---|
context status | 输出知识工作区概览和下一个 Route;--view full 还会展开各阶段和来源 | --format table|json、--view summary|full、--managed、--authority |
context run [phase] | 检查或运行某个已声明的 phase;不指定 phase 时,推进确定性的 Route | --list、--dry-run、--until blocked-or-complete、--max-steps、--deliver、--resume-writing |
context resource acknowledge-current | 记录当前 Route 要求的所有资源均已读取 | |
context resource materialize <id> | 把一个绑定修订的 Context 视图写入本地文件 | |
context action prepare-current | 准备或重试当前生产批次,或已准备好的修订批次中的每个页面,不会重新提交已接受的内容 | --revision、--input、--managed |
context action complete-current | 针对确切的当前修订提交语义输出——报告决定、草稿或 Gate 回答;--preview 检查单个修订页面、整个已准备的修订批次或生产阶段的文章文件,一次列出所有问题,不保存任何内容 | --revision、--input、--managed、--multi-agent、--preview |
任务与维护
| 命令 | 作用 |
|---|---|
context task prepare | 预览或丢弃当前任务状态;保留知识、来源和其他临时文件 |
context task resume | 根据已登记的需求和保留的知识,显式重新开启已清除的生产 |
context task adjust | 调整当前的来源和模块输入或知识地图,不影响无关的工作(--input、--schema、--inspect);含 knowledge_map 的输入按知识地图自身的字段校验,因此错误会指出需要修正的地图条目 |
context task maintain | 登记限定范围的页面修订、重新生成或已批准输出的重建 |
context task record-fix | 记录批次批准之后、交付之前做的纯机械性修正(错别字、失效链接)及其原因,无需再次审核 |
context task advance-maintenance | 执行当前的维护转换 |
context task maintenance-status | 显示维护请求和当前的取消修订 |
context task cancel-maintenance <id> | 取消待处理的维护请求,不会丢弃进行中的草稿 |
context task retire | 预览或执行已批准文章的下线,并清理对它的引用 |
context task recover | 在正常 Route 之外检查或预览限定范围的恢复;--managed 保持托管会话的模式 |
context task rollback | 预览用户选定的确切回退和将被丢弃的草稿,以及进行中的生产阶段将如何处理:discard-whole-task 会在清理时删除该阶段及其未完成的任务和工作目录,keep 表示只回滚打断了它的页面修订,之后继续该阶段;回滚取消的已请求部分交付也会列出。绝不会重置仓库 |
context task finish-rollback | 在 close 和所有构建成功后完成回滚,工作区有未完成的生产阶段时也可以 |
context update | 在已确认的范围内,将已获取的来源变更与已批准的知识进行比对(--input,只读取检出中已有的内容);或使用 --pending(无需输入文件),处理登记的 commit 已超过已处理版本的代码仓库,并获取该 commit 以及部分克隆中缺少的被引用文件内容。两者必须且只能指定一个 |
context revise <target> | 通过 Indexer 生命周期修复一份草稿或一个已批准页面(--instruction、--regenerate、--timing after-batch|priority、--move-to) |
审核
| 命令 | 作用 | 主要选项 |
|---|---|---|
context review html [collection] | 生成一份自包含的本地审核报告;没有图形会话时,--open 改为输出要打开的路径 | --all、--out、--open |
context review list [collection] | 在终端中列出草稿候选 | |
context review apply <file> | 应用限定范围的 JSON 或 JSONL 决定和修订指令 | |
context review approve-all [collection] | 批准当前审核范围内的全部内容 | --all、--confirmed(你的确认)、--managed |
context review approve <id> / reject <id> | 批准或拒绝单个草稿候选 | |
context review deprecate <article-id> | 将已批准页面标记为已弃用,但不删除 | |
context review original-revisions | 列出当前审核批次中针对原样纳入页面提出的修订;--propose 从 YAML/JSON 文件或 - 添加建议(Context 自己读取原文段落),--resolve 在决定已落到文章后移除对应建议 | --propose <file>、--resolve <id|all>(可重复)、--format |
交付
| 命令 | 作用 | 主要选项 |
|---|---|---|
context close | close(归档)已批准的知识:生成 structure.yaml 并执行最终验证 | --format |
context verify | 验证知识工作区 | --compact、--view diagnostics、--page-size、--page-token |
context build | 构建已声明的知识包和站点 | --verbose |
context translate status | 按语言报告翻译是否为最新,包括原文页面已不存在的译文 | |
context translate prepare | 为每篇待翻译文章写出草稿——过期的现有译文,或缺失时的已批准原文;附带与上次翻译所依据原文之间的 source_diff;同时写出提交文件。只剩已删除页面的译文时,它会删除这些译文并结束本轮 | |
context translate submit | 校验并保存翻译后的文章和导航标题 | --input |
context translate skip | 暂时以主语言发布待翻译内容 |
版本与知识包
| 命令 | 作用 | 主要选项 |
|---|---|---|
context version inspect | 显示自当前版本标签或指定 ref 以来的正式变更;已进入远端默认分支的版本报告为 merged_to,只有未合入的版本才会作为 reusable_version 提供 | --base |
context version record | 记录知识工作区的 SemVer 和 Changelog 条目;仍有草稿等待审核时拒绝执行 | --input |
context package site-url <package> <url> | 在站点地图中记录已部署站点的根地址,不做网络检查 | |
context package template accept [package] | 显式接受未修改过的生成起始模板 |
来源与 Indexer
| 命令 | 作用 |
|---|---|
context source add repo|file|lark [date] | 在某个 YYYYMMDD 批次下登记仓库、本地文件或飞书文档模块 |
context source add repo [date] --module <name> | 登记或更新一个仓库模块。--local <path> 从检出目录读取远程地址和当前提交,可以指向 monorepo 中的包目录;--remote <url> 和 --ref <sha> 无需检出即可固定版本;--subpath <dir> 与 --remote/--ref 或指向仓库根目录的 --local 一起使用,指定相对仓库根目录的包目录(若与 --local 指向的包目录不同则会被拒绝) |
context source add file [date] --module <name> | 登记或更新一个文件模块。--local <path> 指定目录或文件(已有来源省略时保留原路径);--layout tree 保留文件夹以及文档链接的图片和小文件(默认 flat);--document-ext <ext> 让该扩展名也作为可引用文本采集(可重复,如 .json、.yaml);--freeze 保留当前快照并停止采集,--unfreeze 恢复采集;--origin-kind、--origin-id、--origin-version 和 --origin-url 记录已安装内容的版本化来源(内置类型:git)——参见按版本发布与即将归档的资料 |
context source add batch [date] | 通过 YAML/JSON --input 在同一批次下登记多个模块。仓库条目接受 type、module、local、remote、ref 和 subpath;不支持的字段会被拒绝,并列出该类条目接受的字段 |
context source import | 单个或批量导入托管的 Markdown(笔记、会话摘要)或预先抓取的飞书内容 |
context source discover / fetch | 发现来源清单,或抓取可移植的快照,不登记任何内容 |
context source batch-status <job-id> | 读取已保存的登记检查点 |
context source list / get <id> | 列出登记表条目,或显示其中一条 |
context source rename <id> | 重命名笔记或会话摘要,并更新对它的引用 |
context source remove <id> | 预览或删除未被引用的来源及其快照 |
context source inspect [name] | 显示仓库的模块边界,不进行抽取 |
context source ensure [name] | 检查仓库检出,不执行克隆、检出或重置 |
context source recovery-plan [name] | 规划缺失仓库检出的恢复,不修改文件 |
context source restore | 根据明确的本地或克隆决定恢复仓库检出,或从 Git 历史恢复某个已登记文档的快照 |
context indexer catalog | 列出内置 Skill 的名称、描述和入口 |
context indexer report-benchmark | 基于独立加载的 oracle 生成前向测试报告 |
诊断
| 命令 | 作用 |
|---|---|
context debug enable / disable | 开启或关闭知识工作区本地的追踪;关闭时保留已有的追踪记录 |
context debug status | 显示调试配置、计数和追踪路径 |
context debug export | 根据事件流生成回放投影 |
也可以在创建时通过 context init --debug 开启追踪。