Expand description
Majordomus control-plane CLI.
The library half of the executable. Dependencies flow inward toward the domain model:
cli / commands -> mcp (surface, protocol, stdio) -> index / model
discovery, metadata, repository, git -> model, errorNothing below commands knows about clap; nothing below mcp knows about JSON-RPC; and
the model knows nothing about either.
Re-exports§
pub use index::Index;pub use model::Diagnostic;pub use model::Object;pub use model::Provenance;pub use model::Severity;pub use repository::Repository;
Modules§
- about
- What the executable says about itself, written once. The OpenAPI document’s
info, the MCPinitializeinstructions, the HTTP index and the generated reference all read these sentences from here, so that no projection describes the surface in words of its own and none can drift from the others. Prose only: counts, URLs of a running server and anything else that is measured are added by the projection that measures it. - app
- The application context every command starts from: the repository, its index, and the capability registry composed once from the builtin executables and the index. Commands differ in what they do with it; none of them builds it differently.
- bench
- The benchmark projection: every externally callable operation of the registry, as a
target, derived and never listed by hand. A capability with a required benchmark
policy is a target directly and through every transport its exposure declares; the
inputs come from its input type’s
BenchmarkCases; the transports’ own operations (initialize,tools/list,/openapi.json, …) are system targets declared once insystem. Coverage iscovered / requiredwith a generated denominator; the runners time targets through the executor, a real loopback socket and a real child process; the results are a versioned document; the accepted baseline is compared against a policy that is data. - build_
identity - Which commit an executable was built from, and whether that tree was dirty: the decision
build.rsmakes once, at build time, and compiles in asMAJORDOMUS_COMMITandMAJORDOMUS_DIRTY(read back ascrate::COMMITandcrate::DIRTY). - capability
- The canonical capability model and its registry: the one place a capability is defined. MCP, HTTP, OpenAPI, the CLI’s introspection and the generated documentation are projections of what lives here and define nothing of their own.
- cli
- The command line, declared with clap’s derive API. Every command starts from the same
RepoArgs;capabilitiesreaches the registry through the registry’s own introspection capabilities, so no list of capabilities lives here. - cockpit
- The Cockpit: the human-facing projection of the registry, server-rendered.
- command_
graph - The canonical command graph: every command this repository offers, from whichever program offers it, with where each one is projected.
- commands
- Command dispatch: the one place a parsed command line becomes a call.
- commit
- The commit as a value: one grammar, one policy, one verdict, one plan.
- convergence
- Where the work of this repository is being held, and whether any of it is held somewhere it can be lost.
- deploy
- The deployment objects of the layer, typed:
.ai/repo/deployments/*.yamlparsed into values that cannot hold nonsense, and validated against what this repository actually contains before anything is built from them. - devcontext
- The context compiler: what a development session should be given, derived from the repository rather than composed by hand.
- devtask
- The executable development task: one issue or one milestone read as work to be done, with the origin of every value on the value.
- diagram
- Diagrams, canonically: nodes, edges and groups in Rust, derived from whatever already states the topology, and rendered to Mermaid by a function that is one reader among several.
- discovery
- Discovery: which files of the repository are declarative sources, and of which kind.
- economics
- Token economics, measured rather than claimed.
- entity
- Entities: the one projection that makes every object of the layer addressable.
- environment
- The repository environment: one typed snapshot of what this checkout is right now — the project, the repository, version control, the toolchains it declares, what the layer holds, the workflows a person can run, the provider projections and the local services — with a provenance entry for every fact in it.
- episodes
- Episodes: the execution episode of a client that has no provider hooks, drawn by the MCP connection itself (ADR 0103).
- evidence
- Evidence: what actually ran, against which commit, and whether it still proves anything.
- execution
- Executions: watching a capability call that takes longer than a request should be held open for.
- gates
- Completion as a provable state: which gates a task’s own change set must pass, what each one said, whether that verdict still describes the tree, and therefore whether the task may be called finished.
- generate
- Generated projections that are committed for review: the OpenAPI document, the
capability reference, the benchmark matrix, the registry manifest, and the shell
tool’s key allow-lists derived from the JSON Schemas. All come through this one
pipeline; the committed files are caches of it, never sources, and
--checksays when they are stale. - generation
- The generation of an executable: which revision of the crate it was built from.
- git
- A minimal, optional, read-only view of git.
- graph
- Graphs, canonically: a node and edge model in Rust, derived from the registry and the
index, and projected to whatever a reader wants. Nothing here knows about Cytoscape,
Mermaid or Graphviz; a rendering library is a consumer of
Graph, never its shape. - guard
- The edit guard (I2735): before a provider’s tool writes a file of this checkout, is the path claimed?
- http
- The HTTP projection: the surfaces this repository exposes, resolved once and served.
- index
- The index: every declarative object the repository declares, read, validated and identified, plus every diagnostic about what could not be read. Built once per invocation from a discovery pass; the MCP surface is a projection of it.
- intent
- Intents: what must become true above the milestones that realise it, and whether the recorded evidence says it has.
- intent_
binding - The binding: what a piece of work serves, resolved once, before it starts (ADR 0111).
- intent_
plan - Intent coverage: which work makes which intent criterion true, derived from the plan.
- intent_
realization - Intent realization: which work realises which intent, through which sessions and providers, how each link is known, and what the intent still lacks.
- intent_
review - The two planning records an intent is held to before execution: the gap and the critique.
- lease
- One shared server per checkout: the lease that decides who it is. The first
majordomus mcp(orserve) to createstate/mcp/server.jsonunder the checkout’s local half owns the server and publishes its URL there; every later process reads the file, checks that the server answers for this root, and attaches to it. A lease whose server does not answer is stale, and the next process takes it over; so is a file that is not a lease document, an empty one, or one whose owner never published a URL. A server that is slow to answer while its process is alive is busy, not stale: the election waits for it forBUSY_GRACEbefore it takes anything over. The file lives under.ai/local/(never tracked, by the layer’s contract), and it is removed when the server stops — including whenSIGTERM,SIGINTorSIGHUPasks it to — but only by the process that still holds it: every removal and every rewrite re-reads the file under the lock beside it (server.lock) and acts only on a lease that carries the actor’s own token (take_over_withsays why it is a lock). - ledger
- The ledger: the append-only record of what happened to this checkout, and the one writer of it in this executable.
- live
- The repository as a long-lived process must see it: current, not as it was when the process started.
- logging
- Where diagnostics go, and where they must never go.
- mcp
- The MCP capability: a projection of the index into resources and tools (
surface), the JSON-RPC and MCP method handling over it (protocol), the one local transport (stdio), and the bridge that forwards a stdio session to the shared server of another process (bridge). Onlyprotocolknows the wire shapes; onlystdioknows about file descriptors;surfaceknows neither. - mesh
- The mesh: how one running Majordomus learns that others exist, and proves which one it is. ADR 0050 is the decision; this module is the whole implementation, and its boundaries are the point:
- metadata
- Metadata: the kind schema (
kinds.yaml) and one JSON Schema per kind, both read at run time from the tool distribution’s share directory and, when a repository adds its own, from.ai/repo/knowledge/; and the YAML helpers shared by every reader. The contract is documented indocs/CAPABILITIES.mdand inshare/kinds.yamlitself. - model
- The domain model: what an object is, where it came from, and what was wrong with what could not become one.
- models
- The model catalogue: which AI models exist for this tool’s world, what each can do,
and which one a stated need selects — as declared data, never as a live client. ADR
0044 is the decision; ADR 0032’s boundary stands untouched: this crate calls no
model, holds no SDK, and reads no credential’s value. The catalogue is
share/models.yaml— one declaration, exactly likeshare/providers.yaml— andmodels.list/models.routeproject it to the CLI, HTTP, OpenAPI, MCP and the Cockpit, so no consumer keeps a model name of its own. - order
- Canonical presentation order.
- pack
- The source pack: the tracked tree as a few text files a language model’s file search can index, with nothing in it that is not source.
- peers
- Peers: the clients attached to one shared server. Every MCP session, the owner’s
stdio one and every one that arrived over HTTP, is a peer from the moment it attaches;
initializegives it a name (the client’s ownclientInfo), andpeers.announcelets it say what it is working on. The board lives in the server’s memory and nowhere else: it ends with the process, and nothing here touches the repository. - perf
- Performance truth: process-wide counters of the work that must happen once (a
repository scan, an index build, a registry build, a schema generation, a projection
build) and of the work that happens per call (executions, handler invocations, cache
hits and misses), plus phase timings on a monotonic clock. They are what the
structural tests read after hundreds of requests to prove that no request rebuilt
canonical state, what
perf.countersanswers over every transport, and what the benchmark evidence carries beside its latencies. Atomics only: reading them costs nothing worth measuring, and nothing here allocates on a hot path. - plan
- The plan: milestones, issues, the two graphs between them, and everything derived from them — execution waves, issue status, milestone status, the roadmap order, the active milestone, the next executable issue and every validation finding.
- policy
- The canonical policy, typed:
.ai/repo/policy.yamland the profiles beside it. The policy is the one canonical input of the provider projections; the shell tool reads the same file with the same subset reader, so the two agree byte for byte on what a projection is and which hash it carries. - product
- The product model: what this repository’s product does for a person, as the features under the layer’s features section declare it, with every fact a surface may say about a feature derived from the registries that own those facts.
- proto
- The reader for the layer’s Markdown document schemas.
- providers
- The provider projections:
AGENTS.md,CLAUDE.md,GEMINI.mdand whatever else the policy’sprojections[]declares, rendered from the provider templates and the canonical policy. They are one-way: the policy and the templates are the sources, the targets are caches thatgenerate --checkcompares andgeneraterewrites. - quality
- What this executable’s own public surface is held to, measured by the executable.
- reasoning
- Reasoning: how a session turns material engineering uncertainty into a recorded,
evidence-backed conclusion — with independent advisors when some are present, and
without them when none are. ADR 0098 is the decision;
docs/REASONING.mdthe manual. - redaction
- The one rule set that makes text a run printed fit to publish.
- release
- The release: what this project has shipped, what it would ship next, and the changelog that is a projection of both rather than a file somebody remembered to update.
- repository
- Repository discovery: the nearest ancestor of the start directory that carries
.ai/manifest.yamlis the root, and the manifest is the only thing read to find it. - rules
- The rules module: a rule, and everything the repository can show that proves it.
- scope
- The repository scope: what a worker reads of the repository, and what it never reads.
- served
- What a deployment actually serves, observed from outside and judged against the commit that was meant to be there.
- session
- The session domain: one typed account of what an episode is, what identifies it, how it moves, and how it is closed exactly once.
- share
- The tool distribution’s data directory:
share/kinds.yamlandshare/schemas/<kind>.schema.json, read at run time. Nothing about kinds or keys is compiled into the executable; the directory is located per invocation, explicitly or by convention, and named in every error when it is not. - site
- The site’s registry dataset: what GitHub Pages renders about the executable, derived
from the registry, the index, the command line, the benchmark projection and the
accepted baselines, and nothing else. The site has no content model of its own for
any of it; its templates read
site/data/registry/registry.jsonand lay it out, and the shell site generator readsdocs/generated/registry.jsonfor the ids it turns into routes. - skill
- Skills as proven capabilities: what the repository can show about each skill, derived.
- synthetic
- A synthetic repository: the layer
majordomus initwrites, with as many rules and documents as a test or a benchmark asks for, in a fresh temporary directory that is removed on drop. One generator for the property tests, the scaling benchmarks and the registry benchmarks, so that they measure and test the same shape of repository. Not a git repository: discovery goes through the filesystem, which is what a benchmark wants to measure and a property test wants to control. - ui
majordomus ui: the primary surface, a product of its own, server-rendered (ADR 0135).- web
- The repository’s web surfaces: one model, discovered once, read by everything that serves, publishes, validates or describes them.
- why
- The Why catalogue: the operational moments this tool is a response to, the audiences that recognise them and the areas they fall under, read from the index and answered as one immutable typed model.
- worktree
- The branch-to-worktree topology: where every linked worktree of a repository belongs, derived from git and from nothing else, and everything that follows from it.
Macros§
- capability
- The one canonical declaration of an executable capability. From it every projection is derived: the MCP tool and its schemas, the HTTP route and its OpenAPI operation, the Swagger UI entry, the command line’s introspection, the benchmark targets for every transport it is exposed on, the cache policy the executor applies, and the generated reference. Nothing is declared a second time anywhere.
- compose_
modules - Compose the application from its modules: each name is a Rust module with a
module()function. This list is the one composition a person maintains at the root; a capability added inside a module needs no edit here. - module
- Build a
ModuleDescriptor: the module’s identity and metadata once, and the executables it composes, each acapability!value.
Enums§
- Error
- Everything that stops a command.
Constants§
- COMMIT
- The commit this executable was built from, or
unknownoutside a work tree. Read at build time: nothing here shells out to git, and an installed binary needs no repository in order to say what it is. - DIRTY
- Whether the tree
COMMITnames carried uncommitted changes when this executable was built:Some(true)orSome(false)when the build knew,Nonewhen it did not — a commit handed in throughMAJORDOMUS_BUILD_COMMITwithoutMAJORDOMUS_BUILD_DIRTY, or a build outside a work tree. It covers the crate’s directory as the build script last saw it;build_identity::identifyis the decision and holds its table. - GENERATION
- The generation this executable was built from: the digest
generation::crate_generationtakes over the crate sources, compiled in bybuild.rs, orunknownwhen the build could not read them. - PROFILE
- The cargo profile this executable was built with.
- TARGET
- The Rust target triple this executable was built for, from
build.rs. The same string the distribution model names a target by, so that a build can say which artifact it is. - VERSION
- The executable’s version, from the crate manifest.