AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
Capsid는 AI 코딩 에이전트를 위한 오픈소스 MCP 서버입니다
Capsid is an open-source MCP server for AI coding agents. It gives them a shared memory, limits what each one can do, and checks their finished work against GitHub.
개발 도구TypeScript · JavaScriptGitHub @DrDustinEdwards온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기MCP server and control plane for AI coding agents: signed work queue, scoped per-job credentials, claims checked against verified outcomes, audit log, and the Capsid Portal. Cloudflare Workers + D1.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗Capsid is a Model Context Protocol (MCP) server and control plane for AI coding agents. It runs as a single Cloudflare Worker and provides four functions to the agents that connect to it:
The repository contains the source of one production deployment, operated by its owner and the co-owners listed in CO_OWNER_EMAILS. It is published under the MIT license for reference. It is not a hosted service and is not supported for third-party use; Installation describes how to run a separate instance.
The public system explorer at capsid.dustinedwards.info, generated daily from Capsid's public data.
Capsid is written in TypeScript and deployed as one Cloudflare Worker. It uses the following bindings:
| Binding | Type | Purpose |
|---|---|---|
DB | D1 | Documents, document versions, jobs, agents, namespaces, outcomes and the audit log. Full-text search uses SQLite FTS5. |
APP_KV | KV | Cached GitHub installation tokens, switches and short-lived state. |
OAUTH_KV | KV | OAuth grants and client registrations. |
MEDIA | R2 | Daily database exports and the Markdown mirror of every document. |
AI_SEARCH | AI Search | A derived semantic index of the documents, used for hybrid search. D1 remains the source of record. |
ASSETS | Static assets | The built Capsid Portal (dashboard/dist). |
The Worker answers on two hosts, each restricted to its own set of paths:
mcp.dustinedwards.info): the MCP endpoints, OAuth sign-in, agent and operator routes under /ops/, and the public read-only documents. The permitted paths are listed in src/mcp-host.ts.portal.dustinedwards.info): the Capsid Portal, the administrative web application. See src/portal-host.ts.The system explorer at capsid.dustinedwards.info is a separate, assets-only Worker built from explorer/. It is prerendered from Capsid's public documents and makes no requests to Capsid at read time.
| Caller | Mechanism |
|---|---|
| Owner and co-owners, through an MCP client or the Portal | Cloudflare Access for SaaS (OIDC), issued as an OAuth access token by @cloudflare/workers-oauth-provider. |
| Agents and scheduled clients | A per-agent bearer key on /ops/mcp. Only the key's SHA-256 hash is stored. |
| Capsid, towards GitHub | A GitHub App. The Worker signs an RS256 JWT and exchanges it for a short-lived installation token; no long-lived GitHub token is stored. |
Every caller resolves to an agent record with a name, a set of scopes and an audit identity. Authorization is checked in one function, checkScope in src/scope.ts.
Three Cron Triggers are declared, and their expressions are defined once in src/index.ts:
| Schedule (UTC) | Task |
|---|---|
*/5 * * * * | The tick: site watcher, auto-merge evaluation, merge-state sweep, search indexing, phone alerts, the daily email digest, and the daily build of the public model and statistics. |
0 9 * * * | Database backup to R2, followed by pruning of old document versions and audit rows. |
30 9 * * * | Weekly skills refresh, which runs on one configured day and posts a job when a model's prompting guide has changed. |
A document is a row in D1 identified by namespace and path, with a title, a Markdown body, a type, a status and tags. A namespace corresponds to one project and maps to one or more GitHub repositories; that mapping is also the boundary for repository access. Document types include core, concept, decision, spec, protocol, procedural, task and reference (docs/schema.md).
Every overwrite or delete stores the previous body in document_versions and writes a row to audit_log. Search combines FTS5 keyword matching with semantic matching from an AI Search index. The index is filled from D1 by the five-minute tick, and every semantic result is re-checked against D1 before it is returned.
An agent's scopes have five axes: namespaces, repos, tools, grants (read, or read and write) and flags. Flags control operations with a wide effect, such as merging (can_merge), committing directly to a default branch (can_direct_write), dispatching workflows (can_dispatch) and writing protected paths (can_touch_protected). A new agent receives read access to its named namespaces and no flags. Scopes that fail to parse resolve to no access. The required grant for each tool is declared in TOOL_GRANTS (src/scope.ts), and a tool absent from that table requires the write grant. See docs/auth.md.
A job consists of a title and a body; the body is the complete prompt an agent executes. Bodies are signed when posted, and a claim verifies the signature first, so a body altered outside the queue's own edit action is rejected. The lifecycle is post, claim, then complete, fail, block or resume. A job that reaches an operation requiring a person (a push, a deploy, a secret, a live migration or a merge) is blocked with the exact command to run. Capsid assigns each job a kind and a recommended model and effort (src/model-routing.ts).
Capsid can start a Claude Code cloud session for a queued job by firing a saved Claude Code routine (docs/routines.md). When an agent completes a job, it names the pull request that carries the work. Capsid then reads that pull request from GitHub and stores the verified state beside the agent's claim, so the two can be compared (docs/work-queue.md).
Repository tools resolve the target repository from the namespace mapping and check the resolved repository against the caller's repos axis (docs/repo-access.md). Agents open pull requests; merging requires the can_merge flag.
Automatic merging is governed by a policy document that must be signed by the administrator before it has any effect; an unsigned policy, or one edited after signing, authorizes nothing. When enabled, the tick merges only pull requests that pass every check in the policy. Certain paths, including migrations, workflows, lockfiles and authentication code, are always refused automatic merging (docs/autonomy.md). Both automatic merging and the overnight run (docs/overnight.md) are disabled in a new installation.
The Portal is a single-page application in dashboard/, served by the Worker as static assets and restricted to the administrator's Cloudflare Access session. It presents items awaiting the owner, site health, the job queue, open pull requests, deploys, agents, activity and backups, and exposes the administrative controls defined in src/controls.ts (docs/portal.md).
Portal Health view, rendered from sample data.
Portal job queue with a job's detail drawer open, rendered from sample data.
The watcher, which runs on the tick, reads each registered site's health route, CI status, deploys and live responses (docs/health-format.md, docs/live-checks.md). Search performance is read from Google Search Console and Bing Webmaster Tools (docs/search-console.md, docs/bing-webmaster.md).
Claude Code sessions can send hook events to /ops/hooks and OpenTelemetry metrics to /ops/otlp/v1/*. Capsid keeps per-session summaries and per-job cost and token totals; it does not store prompts, responses or tool content (docs/hooks.md, docs/telemetry.md).
Once a day the Worker builds a public system model and a set of aggregate statistics, after a privacy filter, and serves them without authentication (docs/public-data.md). Current figures are available at mcp.dustinedwards.info/public/stats/v1.json. The system explorer is built from these documents (explorer/README.md).
D1 Time Travel provides 30-day point-in-time recovery. In addition, the daily backup writes one JSON export per table and a Markdown mirror of every document to R2, and the exports are mirrored to a private repository outside the Cloudflare account. A scheduled workflow rehearses a restore (docs/backups.md). Rolling back a faulty deploy is described in docs/rollback.md.
Capsid serves 22 tools over two MCP servers. The count is derived from TOOL_GRANTS by src/counts.ts, and the registrations are in src/tools/surface.ts. Most tools take an action argument that selects one operation.
Capsid (/mcp, /ops/mcp): 14 tools for project work.
| Tool | Grant | Function |
|---|---|---|
capsid_start_session | read | Session briefing for a namespace. |
capsid_find_docs | read | List, glob or full-text search documents; list reachable namespaces. |
capsid_read_doc | read | Read a document, its versions or its edges. |
capsid_write_doc | write | Create, change, restore or move a document. |
capsid_delete_doc | write | Delete a document, retaining its last version. |
capsid_lint_namespace | per action | Gather, finalize and report on a namespace's documents (docs/consolidation.md). |
capsid_read_repo | read | List directories, read files and search code in a mapped repository. |
capsid_inspect_repo | read | Branches, tags, pull requests, history, CI runs, live site checks and search-console data. |
capsid_change_repo | write | Write or delete a file, or create a branch. |
capsid_open_pr | write | Open a pull request or comment on one. |
capsid_close_pr | write | Merge or close a pull request, delete a branch, tag a commit or publish a release. |
capsid_run_ci | write | Dispatch a workflow or rerun failed jobs. |
capsid_work_jobs | per action | The work queue lifecycle. |
capsid_run_improve | read | Capsid status per namespace: queue, breaker, maintenance and items awaiting the owner. The name is retained from a removed feature. |
Capsid Admin (/mcp/admin, /ops/mcp/admin): 8 tools, available to the administrator identity only.
| Tool | Grant | Function |
|---|---|---|
capsid_admin_whats_next | admin read | Items awaiting the owner across every namespace. |
capsid_admin_manage_namespaces | admin | Register, remap or delete a namespace. |
capsid_admin_manage_agents | admin | Mint, revoke and re-scope agent credentials. |
capsid_admin_read_claims | admin read | Agent claims beside verified outcomes. |
capsid_admin_read_ops | admin read | Watcher state, Cloudflare Access and Email Routing configuration, Workers Builds. |
capsid_admin_run_controls | admin | Preview and perform administrative controls with a single-use token. |
capsid_admin_control_improve | admin | Operator keys, policy signing, the job breaker and the overnight switch. |
capsid_admin_set_site_key | admin | Mint a site key and install it on the site Worker. |
Adding a tool requires a recorded ruling (CLAUDE.md, rule 1).
The router is defaultHandler in src/routes.ts. The principal routes are:
| Route | Authentication | Purpose |
|---|---|---|
POST /mcp, POST /mcp/admin | OAuth | MCP over Streamable HTTP for the owner and co-owners. |
POST /ops/mcp, POST /ops/mcp/admin | Bearer key | MCP for agents and scheduled clients. |
/authorize, /callback, /token, /register, /.well-known/* | None | OAuth sign-in and discovery. |
POST /ops/hooks, POST /ops/otlp/v1/* | Bearer key | Claude Code hook events and telemetry. |
GET /ops/inbox, POST /ops/inbox/report | Bearer key | Items awaiting the owner, per application. |
GET /health | None | Deploy provenance and a store probe; returns 503 when D1 or FTS5 fails. |
GET /public/model/v1.json, /public/stats/v1.json, /public/code/v1.json | None | Public system model, statistics and code maps. |
/portal/* | Access session | The Capsid Portal and its API. |
The complete list, including signed backup and benchmark routes, is in docs/auth.md.
| Path | Contents |
|---|---|
src/ | Worker source. index.ts is the entry point; tools/ holds the MCP tool surface. |
migrations/ | D1 schema migrations, applied in order. |
dashboard/ | The Capsid Portal (Vite) and its Playwright tests. |
explorer/ | The public system explorer, a separate assets-only Worker. |
system/ | The hand-written public system model and its JSON Schema. |
scripts/ | Deploy, agent minting, backup and verification scripts. |
test/ | Unit tests and lint checks. |
test-integration/ | Integration tests run in workerd through @cloudflare/vitest-plugin. |
docs/ | Reference documentation. docs/policy/ holds the reviewable copies of the signed policies. |
wrangler.jsonc.example | Template for the Worker configuration. The real wrangler.jsonc is not committed. |
An installation requires a Cloudflare account and a GitHub App. The procedure is given in full in docs/bootstrap.md, section 10. In outline:
npm install. Node.js 26.11.1 or later is required.wrangler.jsonc.example to wrangler.jsonc and enter the resource identifiers. APP_KV and OAUTH_KV must be different namespaces.npx wrangler d1 migrations apply capsid --remote.npm run check and npm run deploy.https://<worker-host>/mcp as a custom connector in the MCP client.wrangler.jsonc, .dev.vars, .env, keys and real document content must never be committed. Optional features, including site monitoring, Cloudflare reads, phone alerts and automatic merging, remain inactive until configured.
| Command | Purpose |
|---|---|
npm run check | Type-check the Worker. |
npm test | Unit tests. |
npm run test:integration | Integration tests in workerd. |
npm run lint | Lint checks, including documentation drift. |
npm run build:dashboard | Build the Portal and enforce its size budget. |
npm run test:browser | Portal browser tests (Playwright). |
npm --prefix dashboard run dev | Serve the Portal locally against sample data. |
EXPECT_SHA=<sha> npm run verify:live | Verify the deployed Worker. |
The full pre-push sequence is in docs/bootstrap.md. Continuous integration runs these checks on every pull request, and a merge to master deploys to production.
Setup and access
Jobs and agents
Sites and public data
Data and recovery
MIT. See LICENSE. Citation metadata is in CITATION.cff.