agentleFS
Get-Concord-AIGet-Concord-AI/concord-mcp/CLAUDE.md

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
  1. Distinctive:

    Check before writing: Search for an existing type, schema, repository, or helper before adding a new one.

    line 45
  2. Very specific:

    Keep domain/ pure and dependency-free so it is trivially testable.

    line 82
  3. Very specific:

    Run pnpm lint && pnpm typecheck && pnpm test && pnpm build before pushing.

    line 96
  4. Very specific:

    Every change ships as: new branch → focused commits → PR → squash-merge to main.

    line 100
  5. Very specific:

    Use inspect_work to read the workspace or one task.

    line 116
  6. Very specific:

    Use transfer_work for assignment, acceptance, decline, release, reassignment, evidence-bearing handoff offers, and reopening.

    line 118
  7. Very specific:

    Keep each claim small and resolve reported overlaps before editing.

    line 124

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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.

  1. PRs stay under 600 LOC (added + removed, excluding pnpm-lock.yaml). Enforced by the pr-size-check CI job. If a change grows past this, split it.
  2. No file over 1000 lines. Enforced by ESLint max-lines. Aim far lower — most files should be under ~300 lines. Extract modules early.
  3. Strict types. Never any. strict + noUncheckedIndexedAccess + exactOptionalPropertyTypes in tsconfig; strictTypeChecked in ESLint (no-explicit-any, all no-unsafe-*, no-non-null-assertion).
  4. unknown only at boundaries. unknown is allowed only as the immediate input to a Zod .parse() / .safeParse() that narrows it. Never store, return, or pass around unknown.
  5. Never typecast. as assertions are forbidden (consistent-type-assertions: never); only as const is allowed. Narrow types with Zod parsing, type guards, or control flow — not casts.
  6. Clear naming. camelCase values/functions, PascalCase types, UPPER_CASE module constants. kebab-case filenames. Enforced by naming-convention.
  7. Modular, layered structure (see below). Dependencies point one way: tools / cli → domain / artifacts → db → config. Lower layers never import higher ones.
  8. 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 cast

The 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: sqlite

Keep 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 --write

Run 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_work with 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_work to read the workspace or one task. Use update_work for durable progress, decisions, assumptions, questions, blockers, and findings.
  • Use transfer_work for assignment, acceptance, decline, release, reassignment, evidence-bearing handoff offers, and reopening.
  • Before finishing, call finish_work once 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 -->

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.