plumb
AGENTS.md4 starsChanged 4 months agoMITView on GitHub
Source of truth: edit AGENTS.md only. CLAUDE.md and GEMINI.md are relative symlinks to it; never edit, replace, or unlink those paths. This is the always-loaded engineering contract for the public Plumb codebase. Keep rules here and reference detail in docs/; make check-brief enforces the budget. Plumb gives coding agents an IDE intelligence layer over MCP: LSP semantics, a tree-sitter topology index, project memory, and a complete safe-filesystem toolkit. plumb serve is a resilient stdio proxy in front of a shared…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,196 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- add-lsp-adapterSkill
- add-mcp-toolSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
13 rules. About 0 are common, 4 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Avoid version drift: Read VERSION and CHANGELOG.md for the current version.
- Distinctive: line 19
Concurrency-safe durability: Write tools use per-path locks, optimistic checks, atomic rename, and the shared durable-write path.
- Distinctive: line 20
Per-session isolation: Read tracking, rate limits, and caches belong to a connection or declared agent, never accidental process globals.
- Very specific: line 39
Every durable write goes through internal/fsync.AtomicWrite.
- Distinctive: line 65
Use Australian English in prose, comments, logs, and errors.
- Very specific: line 67
Use log/slog; wrap errors with context.
- Very specific: line 68
Do real wiring in constructors, not init().
- Very specific: line 70
Every //nolint needs an inline reason.
- Very specific: line 76
Keep tests beside code and table-driven where appropriate.
- Very specific: line 79
Use topology_affected during the edit loop.
- Very specific: line 86
Use conventional commit types (feat, fix, refactor, test, docs, ci, chore).
- Distinctive: line 87
Treat concurrency, the rate limiter, read tracking, and the stats schema as high-risk invariants.
- Very specific: line 88
Keep this file as rules plus pointers.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.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
Plumb — Agent Instructions
Source of truth: edit
AGENTS.mdonly.CLAUDE.mdandGEMINI.mdare relative symlinks to it; never edit, replace, or unlink those paths.
This is the always-loaded engineering contract for the public Plumb codebase. Keep rules here and reference detail in docs/; make check-brief enforces the budget.
Working contract
- Use Plumb's lane. When Plumb exposes a capability, use its MCP tool instead of native file, search, shell, or Git tools. Native tools bypass Plumb's concurrency guards, diagnostics, and session tracking. Exceptions are capabilities Plumb does not cover and read-only commodity tools hidden by a lean profile.
- Bootstrap and guard writes. Call
session_startfirst, passing a stable per-agentsession_id(on Claude Code the identity hook supplies it and stamps every later call; asession_idalone identifies only that call). Afterread_file, use Plumb edits and pass itsmtimeorsha256asexpected_mtimeorexpected_shawhen a concurrent writer may intervene. Prefer configuredrun_taskslots over raw build/test/lint commands. - Trust live descriptions. Tool behaviour and schemas come from
tools/list;session_startsupplies client-specific guidance. This brief is orientation, not a second tool reference. - Avoid version drift. Read
VERSIONandCHANGELOG.mdfor the current version.
Purpose and invariants
Plumb gives coding agents an IDE intelligence layer over MCP: LSP semantics, a tree-sitter topology index, project memory, and a complete safe-filesystem toolkit. plumb serve is a resilient stdio proxy in front of a shared daemon.
- LSP-correct semantics. Writes notify language servers through
workspace/didChangeWatchedFiles; capabilities are negotiated, including server-initiated registration. - Concurrency-safe durability. Write tools use per-path locks, optimistic checks, atomic rename, and the shared durable-write path.
- Per-session isolation. Read tracking, rate limits, and caches belong to a connection or declared agent, never accidental process globals.
- Configurable safety. Compiled defaults, global config, project config, and environment overrides resolve with explicit provenance.
Architecture
Lower layers never import higher ones. internal/arch assigns every first-party package and tests reject violations, missing assignments, and stale entries.
Foundation (paths, durable writes, tokenisation, redaction, colour data)
→ Transport (MCP/LSP) → Domain (symbols, edits, capabilities)
→ Intelligence (topology)
→ Application (composite tools, caching, rate-limiting)
→ Presentation (TUI, CLI)The package map, daemon/persistence layout, extractor choices, and concurrency model live in docs/architecture.md. Hard seams worth keeping in context:
internal/qualityis foundation;internal/mcpandinternal/lspare transport;internal/cacheis domain;internal/topologyis intelligence;internal/toolsis application;internal/cliandinternal/tuiare presentation.internal/arch/layers.goholds the full list — read it rather than guessing, because its tests reject a wrong, missing, or stale entry.internal/lsp/adapters/base.Adapterexports exactlylsp.Client. Put escape hatches in package functions, not methods, or every embedded adapter gains a false capability.- Every durable write goes through
internal/fsync.AtomicWrite; every SQLite DSN goes throughinternal/sqlitex. internal/langsupportis the source of truth for each language's structural engine and LSP adapter.
Reference map
- Architecture, package map, daemon, workspace detection, persistence:
docs/architecture.md. - Config precedence, every section, reload tiers, trust:
docs/configuration.md. - Tool inputs and behaviour: each MCP description, then
docs/tools.md. - Setup, hooks, skills, doctor, session/mail CLI:
docs/cli-reference.md. - Build, style, testing, commits, and TUI rules:
docs/contributing.md. - Adapter validation and implementation:
docs/adding-an-lsp.md.
Configuration and clients
Resolution is compiled defaults → global config → project .plumb/config.toml → environment; use plumb config show for values and provenance. The lean profile hides the non-lean remainder (39 tools today, out of 61) only for clients with verified deferred discovery; hidden tools remain callable by name.
plumb setup <client> registers MCP configuration. plumb skills sync installs eight idempotent user-scoped skills for clients that read SKILL.md: plumb-explore, plumb-refactor, plumb-testing, plumb-minimal-change, plumb-memory, plumb-diagnose, plumb-git, and plumb-chat. Lifecycle hooks are separate and opt-in through plumb hooks install [client].
Contributor recipes live in .claude/skills/: use add-mcp-tool for a new tool and add-lsp-adapter for a new language server.
Available tools (61)
Full schemas live in tools/list and docs/tools.md. Use the smallest semantic lane that answers the question: workspace_search → topology/LSP → exact search_in_files → bounded read_file. Prefer semantic edits for symbols, Plumb filesystem writes for text, the policy-gated git tool for repositories, and topology_affected plus run_task for verification.
Code style rules
- Use Australian English in prose, comments, logs, and errors; external protocol and library identifiers keep canonical spelling.
- Format through
golangci-lint run --fix ./..., never a standalonegofumpt; install the pinned hooks after cloning. - Use
log/slog; wrap errors with context; putcontext.Contextfirst on blocking/I/O calls; document each type's concurrency contract. - Do real wiring in constructors, not
init(). Add no globals beyond the documented TUI styles and intentional tool locks. - Comments explain non-obvious why. Keep production files near 600 lines, tests near 900, and first-party non-test functions at cyclomatic complexity 15 or below.
- Every
//nolintneeds an inline reason. Re-review deliberately rejected linters before enabling one.
Detailed rules and exceptions live in docs/contributing.md; TUI code uses Bubble Tea/Lip Gloss/Bubbles v2 only.
Testing requirements
- Keep tests beside code and table-driven where appropriate.
internal/lsp,internal/cache, andinternal/toolsrequire meaningful coverage; write-tool tests useWriteDeps{}and session-isolation tests stay with the package they protect. - Internal tool-to-tool
Executecalls use canonical parameter names because aliases resolve only at the MCP dispatch boundary. - Gate tests needing external binaries with
//go:build integration; do not chase TUI coverage. - Use
topology_affectedduring the edit loop. Before delivery runmake verify-full-container(the full gate in Docker: its daemon-starting suites refuse on a developer machine); runmake lint-crossafter platform-constrained or linter-config changes.make coverandmake vulnremain separate CI/on-demand gates. make testputst.TempDir()under repository.testcache; tests must not assume a system-temp ancestry.
Delivery and risk
make install-hooksis required after cloning;make verify-full(verify + the integration suite), run viamake verify-full-containeror CI, defines ready to commit.make helpanddocs/contributing.mdown the full command matrix.- Version resolution is exact tag →
VERSION→ short commit. After rebuilding, runplumb restart; source changes do not activate in an old daemon. - Use conventional commit types (
feat,fix,refactor,test,docs,ci,chore). Keep changes bisectable and add aCHANGELOG.mdentry for each discrete change. - Treat concurrency, the rate limiter, read tracking, and the stats schema as high-risk invariants; inspect their tests and architecture before editing.
- Keep this file as rules plus pointers.
make check-briefenforces its line and byte budgets.
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.

