concord-mcp
CLAUDE.md403 starsChanged 5 months agoMITView on GitHub
This file governs how code is written in this repository. It applies to human contributors and to coding agents (Claude Code, Codex, Cursor, etc.). Read it before making changes. concord-mcp is a local MCP server plus a concord CLI that gives coding agents shared work-state: agents register their presence, claim work, share typed task context, leave handoffs, and generate review packets before opening PRs. SQLite is the source of truth; human-readable markdown artifacts are rendered from it for PR visibility.
- Installs packages
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 45
Check before writing: Search for an existing type, schema, repository, or helper before adding a new one.
- Very specific: line 82
Keep domain/ pure and dependency-free so it is trivially testable.
- Very specific: line 96
Run pnpm lint && pnpm typecheck && pnpm test && pnpm build before pushing.
- Very specific: line 100
Every change ships as: new branch → focused commits → PR → squash-merge to main.
- Very specific: line 116
Use inspect_work to read the workspace or one task.
- Very specific: line 118
Use transfer_work for assignment, acceptance, decline, release, reassignment, evidence-bearing handoff offers, and reopening.
- Very specific: line 124
Keep each claim small and resolve reported overlaps before editing.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Concord MCP — Engineering Guide
This file governs how code is written in this repository. It applies to human contributors and to coding agents (Claude Code, Codex, Cursor, etc.). Read it before making changes.
What this project is
concord-mcp is a local MCP server plus a concord CLI that gives coding agents
shared work-state: agents register their presence, claim work, share
typed task context, leave handoffs, and generate review packets
before opening PRs. SQLite is the source of truth; human-readable markdown
artifacts are rendered from it for PR visibility.
The surface is intentionally six MCP tools: register_agent, get_work_state,
claim_work, update_task, get_task_context, and handoff. Review packets
are produced by handoff with ready_for_review set, not a separate tool.
register_agent was added with explicit product pull for agent presence (who is
here and what they are working on); liveness is derived from last_seen in
domain/presence.ts, not stored. Do not add more tools without explicit product
pull.
Coding rules (non-negotiable)
These are enforced in CI. A PR that violates them will not go green.
- PRs stay under 600 LOC (added + removed, excluding
pnpm-lock.yaml). Enforced by thepr-size-checkCI job. If a change grows past this, split it. - No file over 1000 lines. Enforced by ESLint
max-lines. Aim far lower — most files should be under ~300 lines. Extract modules early. - Strict types. Never
any.strict+noUncheckedIndexedAccess+exactOptionalPropertyTypesin tsconfig;strictTypeCheckedin ESLint (no-explicit-any, allno-unsafe-*,no-non-null-assertion). unknownonly at boundaries.unknownis allowed only as the immediate input to a Zod.parse()/.safeParse()that narrows it. Never store, return, or pass aroundunknown.- Never typecast.
asassertions are forbidden (consistent-type-assertions: never); onlyas constis allowed. Narrow types with Zod parsing, type guards, or control flow — not casts. - Clear naming. camelCase values/functions, PascalCase types, UPPER_CASE
module constants. kebab-case filenames. Enforced by
naming-convention. - Modular, layered structure (see below). Dependencies point one way:
tools/cli→domain/artifacts→db→config. Lower layers never import higher ones. - Check before writing. Search for an existing type, schema, repository, or helper before adding a new one. Reuse over duplication.
The "never typecast" pattern for DB rows and external JSON
better-sqlite3 returns loosely-typed rows and MCP tool args arrive as raw
input. Do not reach for as. Instead, define a Zod schema and parse:
// db/rows.ts
const taskRow = z.object({ id: z.string(), title: z.string(), risk_tags: z.string() });
// repository
const raw: unknown = stmt.get(id); // `unknown` is fine here — it dies at parse()
if (raw === undefined) return undefined;
const row = taskRow.parse(raw); // fully typed, no castThe unknown never escapes the function; parse() produces a typed value.
Architecture
src/
index.ts MCP server entry (stdio) [bin: concord-mcp]
server.ts McpServer construction + tool wiring
config/paths.ts .concord/ resolution, repo-root discovery
db/ SQLite: connection, schema, row parsers, repositories
domain/ types, Zod input schemas, overlap detection (pure logic)
tools/ five-tool MCP surface; review-ready.ts is a
handoff-invoked helper, not a registered tool
artifacts/ render HANDOFF.md / REVIEW_PACKET.md / WORK_STATE.json
install/ per-client instruction writers
cli/ commander CLI [bin: concord]
test/ mirrors src/, uses :memory: sqliteKeep domain/ pure and dependency-free so it is trivially testable. Tools and
CLI commands are thin: validate input → call domain/db → render.
Working in this repo
pnpm install # better-sqlite3 ships prebuilds; the build allowlist is a fallback
pnpm typecheck # tsc --noEmit
pnpm lint # eslint (strict, type-aware)
pnpm test # vitest run
pnpm build # emit dist/ from src/
pnpm format # prettier --writeRun pnpm lint && pnpm typecheck && pnpm test && pnpm build before pushing.
PR workflow
Every change ships as: new branch → focused commits → PR → squash-merge to
main. Branch names: feat/…, fix/…, chore/…, docs/…. Commit messages
use Conventional Commits (feat:, fix:, chore:, ci:, docs:). One logical
concern per PR; keep it under 600 LOC.
<!-- concord:start -->Concord — shared work-state for coding agents
<!-- concord:workflow-version=1 -->This project uses Concord MCP. Keep coordination to the five workflow tools:
- Before editing, call
start_workwith the task, your agent kind/id, and expected files or modules. It registers presence, accepts assigned work when appropriate, claims the scope, and returns overlap warnings. - Use
inspect_workto read the workspace or one task. Useupdate_workfor durable progress, decisions, assumptions, questions, blockers, and findings. - Use
transfer_workfor assignment, acceptance, decline, release, reassignment, evidence-bearing handoff offers, and reopening. - Before finishing, call
finish_workonce with the outcome, changed files, tests, assumptions, decisions, risks, guardrails, and provenance. It records evidence and can mark work review-ready or terminal.
Keep each claim small and resolve reported overlaps before editing. Concord
regenerates human-readable review artifacts in .concord/.
Enforcement remains client-dependent. concord doctor reports setup and
workflow adoption; optional hooks can block exact-file collisions.
<!-- concord:end -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

