π reference β overview/guide, not tied to a code symbol
Validation by Beadloom
doc_syncβ same source assync-check.
Getting Started β
This guide takes you from zero to a working Beadloom setup β including the configurable, multi-agent dev flow.
What Beadloom does β
Beadloom keeps the architecture you intended and the code you actually shipped from drifting apart. It stores a queryable map of your system β domains, services, features, components, and the contracts between them β as plain YAML in Git, then continuously checks the real code against it:
- Docs that can't go stale. Beadloom tracks which docs describe which code and flags the ones that fall behind β on every commit, in CI, or on demand.
- Boundaries that are enforced. You write architecture rules in YAML;
beadloom lintblocks violations in CI, no matter who (or which AI tool) wrote the code. - Contracts checked across services. Federate per-repo graphs into one landscape and Beadloom reconciles what each service says it provides against what its consumers actually use β catching a broken contract before it ships.
- Context for AI agents.
beadloom primehands an agent a compact (<2K-token) picture of the architecture, andsetup-agentic-flowcomposes a full multi-agent workflow (dev β test β review β tech-writer) for Claude Code and Cursor. - A self-governing model. No shadow code: every source module must be a tracked graph node or explicitly exempt, enforced as a CI error.
Requirements β
- Python 3.10+
- uv (recommended) or pip
- Optional: a git repo (for the hooks and the agentic flow),
bd(the beads tracker, for the agentic flow)
Install β
uv tool install beadloom # recommended
pipx install beadloom # alternative
pip install beadloom # also worksOptional extras (language parsers, TUI, file watcher):
uv tool install "beadloom[languages]" # TS/JS, Go, Rust, Kotlin, Java, Swift, C/C++, Objective-C
uv tool install "beadloom[tui]" # interactive terminal dashboard
uv tool install "beadloom[watch]" # file watcher for auto-reindex
uv tool install "beadloom[graphql]" # typed GraphQL contract checking (graphql-core)
uv tool install "beadloom[all]" # everythingInitialize β
cd your-project
beadloom init --bootstrap # scan code β generate an initial graph--bootstrap scans your code structure and proposes domains, services, and features. Use --yes (-y) to skip prompts (CI / automation). init creates:
.beadloom/_graph/services.ymlβ the architecture graph (nodes + edges).beadloom/_graph/rules.ymlβ auto-generated architecture lint rules.beadloom/config.ymlβ project configurationdocs/β documentation skeletons for each graph node.mcp.json(or equivalent) β MCP config for the detected editor
It also runs a full reindex: code symbols are extracted, imports resolved, and depends_on edges inferred from code.
No documentation is required to start β Beadloom bootstraps a skeleton from code structure alone. You fill it in by hand or with any AI agent (see
beadloom docs polish), and Beadloom keeps it current.
Configuration β
Everything lives under .beadloom/ in your repo.
.beadloom/config.yml β
| Key | Default | Description |
|---|---|---|
scan_paths | ["src", "lib", "app"] | Source directories to scan |
languages | all supported | File extensions to parse (e.g. [".py", ".ts"]) |
docs_dir | docs/ | Documentation root directory |
sync.hook_mode | warn | Pre-commit hook mode: warn or block |
.beadloom/flow.yml β the agentic dev flow β
Declare what your project is, once. setup-agentic-flow reads this to compose the role workflow:
tools: [claude, cursor] # generate adapters for one or both
architecture: [ddd] # ddd | fsd (exactly one)
stack: [python] # python, fastapi, javascript, typescript, vuejs
quality: [clean-code, tdd]Then:
# Compose roles from CORE + architecture overlay + stack overlays,
# and write the per-tool adapter set(s):
beadloom setup-agentic-flow
# Override the flow.yml selection from flags:
beadloom setup-agentic-flow --tool cursor --architecture fsd --stack typescript,vuejsThis writes .claude/agents/* (Claude Code) and/or .cursor/agents/* (Cursor) at parity. config-check byte-guards every generated adapter against its composition, so the workflow never silently drifts from the graph.
Git hooks β pre-commit + the pre-push Gate β
beadloom install-hooksInstalls both hooks by default:
- pre-commit (lighter) β runs
sync-check, lint, and the ACTIVE/tracker coherence step (warnorblockvia--mode). - pre-push Beadloom Gate (authoritative) β runs the full
beadloom ci(reindex βlint --strictβ sync-check β docs-audit β config-check β doctor) and blocks the push on red. It is fail-safe (a no-op whenbeadloomisn't onPATH);git push --no-verifyis the documented escape hatch.
Select one with --pre-commit / --pre-push; remove with --remove.
MCP + IDE rules β
beadloom setup-mcp # .mcp.json (Claude Code) / .cursor/mcp.json (Cursor) / Windsurf config
beadloom setup-mcp --tool cursor # target a specific editor
beadloom setup-rules # thin IDE adapter files pointing at .beadloom/AGENTS.mdThe MCP server (beadloom mcp-serve) exposes 18 tools β 14 graph read/write tools plus four process tools (task_init, bead_context, checkpoint, complete_bead) that drive the agentic flow.
Usage examples β
A. The core loop β
beadloom prime # compact (<2K-token) project context for an agent
beadloom ctx sync-check # full context bundle for a node (add --json to parse)
beadloom why sync-check # impact analysis: upstream deps + downstream dependents
beadloom graph # Mermaid architecture diagram
beadloom search "stale" # FTS5 search across nodes, docs, and code symbols
beadloom status # node/edge/doc counts, coverage, health trendsValidate before you commit:
$ beadloom sync-check
β 149/149 doc-code pairs in sync
$ beadloom lint --strict # exit 1 on error-severity violations (for CI)
β All architecture rules satisfied
$ beadloom ci # the unified gate, one exit code
reindex PASS
lint PASS
sync-check PASS
docs-audit PASS
config-check PASS
doctor PASS
β CI gate passed
sync-checkexits 2 when docs are stale.beadloom sync-update <ref> --yeswalks you through (or auto-applies) the fix until the stale count reaches 0.
B. The agentic dev flow walkthrough β
With flow.yml configured and setup-agentic-flow run, a feature flows through gated waves. The process roles live in your editor adapters (.claude/commands/* for Claude Code); the four work roles are subagents:
/task-initβ scaffold the work item (PRD/RFC/CONTEXT/PLAN/ACTIVE or BRIEF) and create the beads (tracked inbd)./coordinatorβ orchestrate the waves, gated by bead dependencies:- dev β implement the bead (TDD), update its
SPEC.md/DOC.md. - test β write/extend tests, verify coverage.
- review β read-only quality + boundary check (
beadloom diff,lint). - tech-writer β refresh the docs the change touched (
sync-update).
- dev β implement the bead (TDD), update its
- Push β the pre-push Beadloom Gate runs
beadloom ci; a red gate blocks the push ("no code reachesmainwithout current docs and clean boundaries"). - PR β opening the PR triggers CI and the AI tech-writer (below); a human merges once green.
Each agent starts from beadloom prime / beadloom ctx <ref> instead of grepping the codebase from scratch, so it works inside your architecture.
C. The AI tech-writer β
On a pull request, a packaged harness repairs drifted docs on the PR branch:
# Run it manually against the drift since a git ref (the push's parent commit);
# --platform selects the CI adapter, --dry-run reports the wiring without a model/PR:
python -m beadloom.ai_agents.ai_techwriter --platform github --since "$(git rev-parse origin/main)" --dry-runIt is symbol-scoped (a doc is rewritten only when a symbol it references actually changed), bounded-parallel, and verdict-classified β ok / flagged / infra β so a genuine unresolved doc drift blocks the PR, but a dead runner or exhausted quota never freezes merges. CI is the true enforcement; the refresh is a proposal a human merges.
D. Federation β hub + satellites β
Inside one repo the dangerous bugs hide between services. Each service ("satellite") exports its graph; a hub composes them and reconciles contracts:
# In each service repo β emit a deterministic, commit-stamped artifact:
beadloom export --out service-a.json
# At the hub β compose >=2 artifacts into one landscape and reconcile contracts:
beadloom federate service-a.json service-b.json service-c.json
# Arm the CI landscape gate (writes the artifact, THEN exits 1 on a bad verdict):
beadloom federate service-*.json --fail-on default
# default fail-set = breaking,drift,orphaned_consumer,undeclared_producerfederate writes .beadloom/federated.json + .beadloom/federated.txt and assigns each contract a verdict (CONFIRMED / BREAKING / ORPHANED_CONSUMER / UNDECLARED_PRODUCER / EXTERNAL / DRIFT) over AMQP and GraphQL, plus per-satellite staleness. beadloom ci --hub <export> --fail-on default folds the landscape gate into the unified CI verdict.
Publish a knowledge base β
beadloom docs site --out site # generate a VitePress content tree
(cd site && npm install && npm run docs:build) # build the static siteThe site is a metrics dashboard, an interactive architecture view, a cross-service landscape map, and your hand-written docs with a freshness badge on each. docs site reads the graph read-only and never writes into your source docs/ tree.
Keep docs in sync β
beadloom sync-check # docβcode freshness (exit 2 = stale)
beadloom sync-update <ref> # review/apply the fix for a node (--yes to auto-apply)
beadloom docs audit # detect stale numeric/version facts in prose docs (--stale-only, --json); also the docs-audit gate stepLimits β
- Code indexer parses Python, TypeScript/JavaScript, Go, Rust out of the box; Kotlin, Java, Swift, C/C++, Objective-C via
beadloom[languages]. Import analysis spans 9 languages. - Documentation is indexed from
docs/(configurable viaconfig.yml). - The graph is YAML under
.beadloom/_graph/; rules in.beadloom/_graph/rules.yml. - Maximum documentation chunk size: 2000 characters.
Next steps β
- Architecture β system design, the node-kind model, the rules engine, the agentic-flow configurator.
- CI Setup β GitHub Actions / GitLab CI integration.
- VitePress Site β publish the knowledge base.