Skip to content

Installation ​

Before you start ​

You install Context once per machine (or remote Agent environment), not once per task. You need:

  • Node.js 20 or later with npm;
  • Bun: a new knowledge workspace installs its dependencies with bun install right after initialization;
  • 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.

Or install the plugin from the plugin marketplace ​

The context4ai/context repository is itself a plugin marketplace. In Claude Code or Codex you can add it and install the c4a plugin through the host instead of running context plugin install:

bash
claude plugin marketplace add context4ai/context && claude plugin install c4a@c4a
codex plugin marketplace add context4ai/context && codex plugin add c4a@c4a

The CLI is still required: install it with npm install -g @c4a/context-cli@latest first, because the plugin hands the workflow and the bundled Indexers to it. Choose one method per host — both provide the same c4a plugin — and use context plugin install for Cursor.

What you get ​

EntryUse it to
/c4a:contextCreate a knowledge workspace, continue one, and run production, review, update and build
/c4a:context-planPlan a large project in stages before production
/c4a:context-inspect-searchAsk questions against knowledge packages or approved knowledge in a knowledge workspace, with sources
/c4a:context-repo-contentRegister docs and Skills already maintained in the same repository, so Context references them instead of producing them again

/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 <path>/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. For Claude and Cursor a local install also copies the resources/ folders that the installed commands link to, such as the routine update and version alignment references, and keeps each command's front matter as a global install does.

Check the installation ​

bash
context --version
context plugin status

context plugin status inspects the global hosts. Both it and context plugin install look for the claude and codex commands on the same PATH as the shell you run them from, so if Claude Code or Codex is reported missing, check that its command resolves in that shell. Cursor needs no command on PATH; its plugin files are written directly. Then open your Agent and invoke /c4a:context. If the entry is present but the context executable is missing, the Agent installs it once when your host already allows it to upgrade Context to a minimum version, checks context --version and continues. Otherwise it shows the install command above and stops, rather than partially initializing a knowledge workspace. A normal "not found" message from Context itself is not mistaken for a missing CLI.

Keep versions together ​

Three parts carry a Context version: the context CLI, the Context Skill installed in your Agent host (its entry states the version it ships with), and the @c4a/context SDK that your knowledge workspace depends on. When you start production in a workspace, the Agent compares them once and brings them to the latest release of the version line you are on:

  • the CLI is installed at that exact release;
  • Skills installed with context plugin install are refreshed; Skills supplied by your host are left as they are and reported, so whoever manages the host can update them;
  • the workspace SDK is raised and installed, and the change is committed together with your next delivery rather than on its own;
  • when the workspace also pins @c4a/context-cli, its ./node_modules/.bin/context is the CLI for that workspace: the Agent runs every workflow command with it and aligns it together with the SDK.

When a newer major version exists, the Agent does not move to it by itself. It shows you the latest release of your current major and of the new one, what changes between them, the expected impact on your workspace and a recommendation, and waits for your choice. Nothing is ever downgraded, and if the release list cannot be read the Agent reports it once and continues with the versions you have.

Next: Quick Start.

安装 ​

准备工作 ​

Context 每台机器(或远程 Agent 环境)只需安装一次,而不是每个任务安装一次。你需要:

  • Node.js 20 或更高版本,以及 npm;
  • Bun:新建的知识工作区在初始化后会立即用 bun install 安装依赖;
  • 至少一个 Agent 宿主:Claude Code、Codex 或 Cursor;
  • 对计划整理成知识的仓库和文档有读取权限。

Context 在你的本机运行。CLI 自身从不调用 LLM:阅读和写作由宿主中的 Agent 完成,CLI 负责确定性的工作,例如观察 Context 知识工作区、采集来源、索引代码、校验证据、应用审核结果和构建知识包。

安装 CLI 和插件 ​

bash
npm install -g @c4a/context-cli@latest
context plugin install

第一条命令安装 context 运行时。第二条命令把 Agent 集成安装到它找到的所有受支持宿主中。完成后重启或刷新 Agent 宿主,让它加载新的入口。

mermaid
flowchart LR
  npm["npm install -g @c4a/context-cli"] --> cli["context 运行时"]
  cli -->|context plugin install| hosts["Claude Code / Codex / Cursor"]
  hosts --> entries["/c4a:context 等入口"]
  hosts --> providers["Indexer Provider 技能"]

全局安装会创建带命名空间的 Context 入口,同时以无命名空间的形式提供四个 Indexer Provider 技能——context-code-indexer、context-markdown-indexer、context-note-indexer 和 context-sessions-indexer——让每个宿主都能找到它们。安装 Provider 只是让它可被发现;具体用哪些 Provider,由工作流按任务选择。

或者从插件市场安装插件 ​

context4ai/context 仓库本身就是一个插件市场。在 Claude Code 或 Codex 中,可以添加该市场并通过宿主安装 c4a 插件,代替运行 context plugin install:

bash
claude plugin marketplace add context4ai/context && claude plugin install c4a@c4a
codex plugin marketplace add context4ai/context && codex plugin add c4a@c4a

CLI 仍是必需的:请先用 npm install -g @c4a/context-cli@latest 安装,因为插件会把工作流和内置 Indexer 交给它执行。每个宿主选择一种方式即可——两种方式提供的是同一个 c4a 插件;Cursor 请使用 context plugin install。

安装后得到什么 ​

入口用途
/c4a:context创建或继续知识工作区,执行生产、审核、更新和构建
/c4a:context-plan在生产前分阶段规划大型项目
/c4a:context-inspect-search基于知识包或知识工作区中已批准的知识提问,并附带来源
/c4a:context-repo-content登记同一仓库中已维护的文档和 Skill,让 Context 直接引用而不是重新生产

/c4a:context 是新建和已有知识工作区的生产入口;其他三个入口负责规划、回答或登记内容,并把生产交回给它。你不需要学习生命周期命令,用日常语言描述知识目标即可。普通的编码或设计对话不会自动启动 Context——需要显式调用它,或在进行中的 Context 对话里继续。命令与技能 列出了全部入口、各宿主中的写法,以及无需调用即可运行的 Skill。

只安装到单个仓库 ​

如果不想改动全局配置,可以把入口只安装到某个仓库:

bash
context plugin install --local /path/to/repo --agent auto-detect

--local 需要显式指定 --agent:

  • claude、cursor 或 codex 分别安装到该仓库的 .claude、.cursor 或 .agents 目录;
  • all 同时安装这三种布局;
  • auto-detect 使用上述目录中已存在的那些,都不存在时回退到 .agents/skills;
  • standalone 把所有技能直接写入 <path>/skills,不包含命令。

每种模式都支持 --dry-run。刷新时只替换未被修改过的托管文件;被自定义过的入口会保留,并作为冲突报告出来。本地安装的入口没有插件命名空间。对于 Claude 和 Cursor,本地安装还会复制已安装命令所链接的 resources/ 目录(例如例行更新和版本对齐的参考文档),并像全局安装一样保留每个命令的 front matter。

检查安装结果 ​

bash
context --version
context plugin status

context plugin status 检查全局宿主。它和 context plugin install 都会在你运行它们的那个 shell 的 PATH 上查找 claude 和 codex 命令;如果提示缺少 Claude Code 或 Codex,请检查对应命令能否在该 shell 中解析。Cursor 不需要 PATH 上的命令,它的插件文件会被直接写入。然后打开 Agent,调用 /c4a:context。如果入口存在但缺少 context 可执行文件:当你的宿主已经允许 Agent 把 Context 升级到某个最低版本时,Agent 会安装一次,用 context --version 确认后继续;否则它会给出上面的安装命令并停止,而不会只初始化一半知识工作区。Context 自身正常返回的 "not found" 信息不会被误判为缺少命令行。

保持版本一致 ​

有三处带着 Context 版本:context 命令行、安装在 Agent 宿主中的 Context 技能(入口里写明它随哪个 Context 版本发布),以及知识工作区依赖的 @c4a/context SDK。在一个工作区开始生产时,Agent 会比较一次这三处,并把它们升到你当前版本线的最新正式版:

  • 命令行安装为这个确切版本;
  • 用 context plugin install 安装的技能会被刷新;由宿主提供的技能保持原样并报告出来,以便宿主的维护者更新;
  • 工作区 SDK 提升并安装,这一变化随你的下一次交付一起提交,不单独提交;
  • 工作区同时固定了 @c4a/context-cli 时,它的 ./node_modules/.bin/context 就是该工作区的命令行:Agent 用它运行所有工作流命令,并与 SDK 一起对齐版本。

出现更新的主版本时,Agent 不会自行升级过去。它会给你看当前主版本和新主版本各自的最新版、两者之间的变化、对你的工作区的预计影响以及建议,然后等你选择。任何部分都不会降级;如果读不到发布列表,Agent 会报告一次,并继续使用现有版本。

下一步:快速开始。