Context Autopilot

io.github.ChiragBachani由 GitHub 账号 ChiragBachani 发布v0.6.0更新于 Oct 25, 2026

Mines your Claude Code and Cursor sessions into evidence-based CLAUDE.md / AGENTS.md rules.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,把 Claude Code 与 Cursor 会话历史挖掘成有证据支撑、由你批准的 CLAUDE.md 与 AGENTS.md 规则。

可以做什么
列出有可观察 Claude Code 或 Cursor 会话历史的项目,并扫描其中重复的指令、纠正和被拒绝的工具调用,附上原文引用作为证据。把这些信号提炼为项目级或跨所有项目的全局上下文规则提案。把已保存在项目记忆或上下文文件中的规则提升到全局规则文件。审阅提案,只把你接受的规则写入 CLAUDE.md 和 AGENTS.md 的受管区块。查找过时的上下文文件引用,例如缺失的文件或已删除的 npm 脚本,并以非零退出码供 CI 使用。
适用场景
当你反复向编码助手重复同样的约定,希望基于自己过去的会话而非泛泛的仓库扫描来建立持久上下文文件时使用。适合同时使用 Claude Code 和 Cursor、并希望在写入任何内容前明确批准或拒绝的开发者。
运行要求
通过 npx 以 stdio 在本地运行,需要 Node.js;挖掘 Cursor 会话需要 Node 22 或更高版本,旧版本会跳过该来源。提炼通过你现有的 claude CLI 完成,无需 API 密钥。它会读取本地 Claude Code 记录和 Cursor 的本地 SQLite 存储。
安装前请注意
被接受的规则会写入 CLAUDE.md 和 AGENTS.md,全局模式或 promote 会写入你个人的 ~/.claude/CLAUDE.md;promote 只读取项目文件。从会话中提取的信号引用会发送给你已在使用的编码模型,除此之外不会上传其他内容。应用前请审阅提案,因为它们会改变后续助手会话读取的文件。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Context Autopilot,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Context Autopilot

Automated context collection for coding agents. Mines your real agent sessions — every instruction you repeated, every correction you made, every tool call you rejected — and distills them into CLAUDE.md / AGENTS.md rules you approve.

Part of The Context Layer.

Run in your terminal (it's a plain CLI — don't paste this into a chat):

$ npx context-autopilot scan
Scanned 3 session(s) for ~/projects/my-appFound 26 signal(s):
  [CORRECTION] ×2 across 2 session(s)  (score 9)      "There are still so many buttons that dont work, like the publish…"  [REPEATED] ×4 across 3 session(s)  (score 10)      "Do not reference the legacy directory. Only work within…"
$ npx context-autopilot distill
[1/8] Perform click-and-type tests before reporting UI work complete  (confidence: high)    + Before declaring any screen done, click every button and verify it works.    evidence:      · 2026-06-27 — "There are still so many buttons that dont work…"
$ npx context-autopilot apply

Why

Every session starts blank, so you re-teach your agent the same conventions — and when you forget, it repeats the same mistakes. Hand-writing context files works but nobody keeps them current. And naive auto-generation is worse: research on LLM-generated context files found they reduce task success and raise cost, because repo scans produce generic filler.

Context Autopilot takes a third path: evidence. Your session history is a literal record of what the agent got wrong and what you said to fix it. Autopilot mines that record and only proposes rules your own words support — each one shipped with the quotes that justify it.

How it works

  1. Observe — ctxlayer scan parses your local Claude Code transcripts (~/.claude/projects) and Cursor sessions and extracts three signal types: instructions repeated across sessions, corrections after the agent went wrong, and rejected tool calls. Runs 100% locally.
  2. Distill — ctxlayer distill sends the signals (not your history) through Claude — via your existing claude CLI, no API key needed — and gets back imperative, project-specific rules with evidence and confidence ratings.
  3. Approve — ctxlayer apply walks you through each proposal. Accepted rules land in a managed block:
markdown
<!-- ctxlayer:begin -->## Learned conventions (Context Autopilot)
- **Staff login cannot access admin view** — When authenticated as staff, the admin role toggle must be hidden or disabled.<!-- ctxlayer:end -->

Hand-written content is never touched; re-runs update the block idempotently. Rules are written to both CLAUDE.md and AGENTS.md, so Claude Code, Cursor, Copilot, Codex, and every AGENTS.md-aware agent benefits.

Install

bash
npm install -g context-autopilot   # or use npx, no install

Commands

CommandWhat it does
ctxlayer projectsList projects with observable session history (Claude Code + Cursor)
ctxlayer scanMine signals from this project's sessions
ctxlayer distillDistill signals into proposals (.ctxlayer/proposals.json)
ctxlayer promoteScan every project's saved memory (auto-memory + CLAUDE.md) for rules that belong in your global ~/.claude/CLAUDE.md; --dry-run lists candidates without calling a model
ctxlayer applyReview proposals interactively; write accepted ones
ctxlayer checkFast, model-free: how many new signals since the last distill? --hook prints a nudge only past --threshold (default 3), else stays silent
ctxlayer staleFind context-file references the repo has outgrown — missing files, removed npm scripts. Exits 1 on findings, so it drops straight into CI
ctxlayer exportExport distilled entries as Agent Operating Procedure JSON

Global mode

bash
ctxlayer distill --global

Project context files hold repo conventions — but some feedback is about you: "explain things in plain English", "don't build while I'm brainstorming", "run independent work in parallel". Global mode mines all your projects across all your tools for exactly that, and maintains a managed block in your personal ~/.claude/CLAUDE.md, so every future session in every project starts already knowing how you like to work. Rules that mention a specific project are excluded by design — those belong in the project's own context file.

Promote saved memory to global

bash
ctxlayer promote

Where global mode mines your session transcripts, promote mines the memory your agents have already written down: each project's auto-memory files (~/.claude/projects/<name>/memory/) and each repo's CLAUDE.md/AGENTS.md. Rules about how you work — or rules duplicated in two or more projects — are proposed for your global ~/.claude/CLAUDE.md, generalized and with the source files as evidence. Additive only: project files are read, never edited. Anything already covered globally is filtered before the model is even called.

Options: --project <path>, --global, --source claude-code|cursor|all, --model <model>, --min-score <n>, --yes, --json.

Cursor session mining reads Cursor's local SQLite storage via Node's built-in node:sqlite (Node 22+; on older Node the Cursor source is skipped gracefully).

Claude Code plugin

/plugin marketplace add chiragbachani/context-autopilot/plugin install context-autopilot@the-context-layer

Then ask Claude to "update project context from my session history" — or don't ask at all: the plugin ships a SessionStart hook that runs ctxlayer check (fast, no model call) when a session begins. If enough new signals have accumulated since the last distillation, Claude gets a nudge to offer distillation at a natural pause. No new signals → complete silence.

MCP server

json
{  "mcpServers": {    "context-autopilot": {      "command": "npx",      "args": ["-y", "-p", "context-autopilot", "ctxlayer-mcp"]    }  }}

Exposes list_observable_projects, scan_context_signals, distill_context_proposals, distill_global_context, promote_to_global, apply_context_proposals, and find_stale_context.

The approval loop closes entirely inside chat: distill tools return each proposal with its evidence and instruct the agent to ask you which to accept; apply_context_proposals then writes exactly the titles you approved, remembers the ones you rejected (never re-proposed), and leaves the rest pending. No tool ever touches a context file without your explicit decision.

FAQ

How is this different from Claude Code's /insights? /insights is the same core observation — instructions you repeat belong in CLAUDE.md — shipped as a personal usage report: an HTML page with suggestions you copy-paste by hand, Claude Code only. Context Autopilot is the pipeline version: it also mines Cursor history, attaches your verbatim quotes as evidence to every rule, runs an explicit approve/reject flow, writes accepted rules into managed blocks in both CLAUDE.md and AGENTS.md (so Codex/Copilot/Cursor benefit), maintains a global cross-project rules file, and adds a CI staleness check. Fully open source and local.

How is this different from Claude Code's auto-memory? Auto-memory captures what the model notices live, in the moment, in one harness. Autopilot is retroactive and systematic: it mines months of existing history across tools, and finds cross-session patterns (you said it 6× in 4 sessions) that no single live session can see.

Troubleshooting

  • "Skill not found" / agent can't see the tools — MCP servers load at session start. After installing, start a new session (resumed/old sessions won't have the tools), and say "MCP tools" rather than a slash command: "Using the context-autopilot MCP tools, distill this project's context proposals."
  • Everything else (evidence presentation, approval flow, error hints) is built into the server itself — the tool results tell the agent exactly what to show and when to ask you.

Privacy

Everything runs on your machine. Transcripts are parsed locally; only the extracted signals (short quotes of your own instructions) are sent to the model you already use for coding. Nothing is uploaded anywhere else, ever.

Roadmap

Coding agents are chapter one. The engine is source-agnostic — it distills observations of work into Agent Operating Procedures (AOPs):

  • Now: Claude Code + Cursor sessions → CLAUDE.md / AGENTS.md; global cross-project rules (--global); staleness detection (ctxlayer stale)
  • Next: team-shared context; a GitHub Action for context linting in CI
  • Later: browser-workflow observation → AOPs for web tasks; ambient capture — until agents absorb the work you repeat, without you ever "building an agent"

License

MIT © The Context Layer

来源:README.md,提交 9ece859

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.6.0最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。