benitogf/detritus · MCP server · v3.51.0

detritus

The sediment a codebase leaves behind — doctrine, code sense, and delivery — compacted into one Go binary an AI can read.

MCP server for AI coding assistants go 1.25 zero cloud calls stdio · read-only
MCP tools
7
Slash commands
39
Tests
130
Releases
66
Go source
7kloc
Host tools
6
00Overview

One binary. Three seams of value.

Detritus is a single, embeddable Go server that speaks the Model Context Protocol. It carries a curated knowledge base of engineering doctrine, a set of zero-setup tools for reading a codebase, and a layer of slash commands that move real work through one pipeline — plan → build → review → deliver — either inside your session or handed off to a separate multi-agent sidecar.

The genuinely unusual bet: the docs are the product, and the Go is the delivery mechanism. Everything a human touches installs itself into whatever coding tool you already use — and no flow ever merges on its own. The human merge stays the gate.

01Knowledge

// the kb_* seam

A knowledge base tuned for a machine reader

The corpus is markdown, split one chunk per ## section, enriched at build time with TF-IDF keyword triggers, and frozen into a deterministic data.gob — sorted and tie-broken so the same docs compile to the same bytes on any machine. At runtime it's a title-weighted bleve index reranked with MMR.

kb_search
Ranked cross-doc section search — returns snippets, machine-actionable "next hop" hints, and kb:// resource links instead of dumping whole files.
kb_get
Fetch a whole doc, or a single ## section — the token-economy path an agent uses after it knows what it wants.
kb_sections
List a doc's headings from metadata with no file read, so the agent can aim kb_get before spending context.
kb_list
Enumerate the corpus with descriptions — the map before the drill.

Every response is shaped for the consumer that reads it: an AI, not a person. Search punts identifier-shaped queries straight to code_graph rather than answering them badly. That restraint is the design.

02Code sense

// the code_* seam · zero-setup

Live code intelligence, no index to build

No pack, no config, no stored index — the tools read the repo live and auto-discover the project root (go.mod > .git > language marker). .gitignore honoured, binaries sniffed, and a per-file, mtime-keyed, atomically-written parse cache means the first pass pays and the rest is fast.

code_map
PageRank (damping 0.85) over the file→symbol-reference graph, token-budgeted and focus-biased — the important files first, within a budget.
code_graph
Real go/types + go/packages: who-calls, reachable-from, impacted-by (blast radius) and the tests that break — or interface implementers.
code_outline
go/ast signatures for Go; a fast regex pass for JS/TS, Python, Rust, Java, C# and C/C++.
The standout

code_graph is the best-engineered code in the tree. It canonicalizes the package/test-variant duplicates that Tests:true produces, gates its fallback on production packages only (a broken _test.go won't degrade your impact analysis mid-edit), keeps test funcs from crowding real dependents out of the cap, and never truncates silently — it even looks one hop past the depth bound to tell you a caller is out there. Each of those is a subtle bug a naive version gets wrong, and each is pinned by a named regression test.

03Memory

// learned long-term memory

A lesson is a pull request

The learned-memory subsystem was deleted and redesigned into nothing — and that's the clever part. There is no local store, no agent-write API, no LRU, no dedup pass, no recall-miss counter. A lesson is just a markdown doc under docs/lessons/, shipped by a reviewed PR, distributed by detritus --update, and retrieved by the same kb_search as everything else.

Why it's right

"The trust boundary is the review, not a runtime firewall." A shared agent-written store is a shared attack surface; here the surface is a code review. An entire category of runtime complexity was replaced by a workflow that already existed — the exact "if removing it doesn't break anything, it shouldn't exist" move the project's own doctrine preaches.

04Sidecar

// candyland · out-of-process delivery

When one session isn't enough: candyland

For work too big for a single agent, detritus hands off to candyland — a long-running REST sidecar it launches and correctly detaches (new session on Unix, new process group on Windows) so it outlives the session that started it. A tech-lead partitions the work, coders build concurrently in git worktrees, a reviewer loops fix→re-review until clean, then it delivers. (That engine lives in its own repo — what ships here is the launcher and the classifier.)

run one unit quest converge → 1 PR/repo quest --per-finding 1 PR / finding
The quiet genius: the delivery classifier

Before launching, detritus reads live gh state and decides whether your input means open a PR, address feedback, or review — and which PR. Its sharpest idea is telling a hand-off ("act on #97") from a citation (a plan that merely mentions #97 in prose), so a URL buried in a spec can't hijack delivery. Unaddressed change-requests beat review-intent; a later approval supersedes an older change-request; gh being down degrades honestly and says so. An ~18-row truth table locks all of it.

05Doctrine

// docs/flows · one source, many surfaces

Doctrine that installs itself

A doc is a command if and only if it lives under docs/flows/. From that single rule, one binary generates skills, prompt files, sub-agents, router instructions, the README table and marketplace shims — then registers itself as an MCP server across Claude Code, VS Code/Copilot, Cursor, Windsurf, Codex and Verdent. The generated shim is a stable kb_get indirection, so editing a doc ships new behaviour with nothing to regenerate client-side. Drift tests fail the build if the surface and the docs ever disagree.

  • truthseeker — always active. Prove before acting; reject fragility; make the invisible visible; push back on the user when the evidence demands it.
  • review-rigor — forbidden-action tables with IDs, mandatory checks R1–R11, closed-enum verdicts (approve|changes), and hedge-words banned outright. No "approve with reservations."
  • the universal pipeline — every flow runs plan → build → review-with-rework → deliver, and no flow may skip a stage. /babysit merges only when an approval's commit matches HEAD — a push invalidates it.
  • todoguard — a PreToolUse hook that trusts Claude's agent_id, deliberately distrusts the spoofable agent_type, and fails open. A small, honest threat model.

Get started

Give your assistant a codebase's memory and a craftsman's conscience — in one Go binary that installs itself.

Ask your AI coding tool to install it. The knowledge base, the zero-setup code intelligence, and the delivery commands register themselves across Claude Code, VS Code, Cursor, Windsurf, and Codex — no config to write.

please install detritus mcp https://github.com/benitogf/detritus
View on GitHub → Roadmap & issues