Skip to content

Refuse a directory of the layer that documents nothing

A directory added under the layer without a context document fails validation by name, nothing resolves against the tree until it says what it is for, and the same hierarchy is readable over MCP and the API without running the gate.

guaranteed Repository knowledgeintermediatemaintainerreviewerread-only

Situation

Somebody adds a directory under .ai/ — a new section, a place for data, a subdivision of an existing one — and writes no README.md. Nothing breaks that day. The directory contributes nothing to the chain a worker resolves, it names no format for the files it holds, and the next person to land there reads its ancestors and guesses the rest. Left alone, that is how a layer with a contract per directory becomes a layer with a contract per directory somebody remembered.

What you run

  • context validate: the whole tree, with missing-contract naming every directory that owes a document
  • context resolve <path>: refuses while the tree is broken, rather than answering from the part that happens to be fine
  • doctor: the same check through majordomus.context-integrity, which the pre-commit hook runs

Scenario

setup: undocumented-directory
given:
  - 'a repository with Majordomus installed, a new section that carries its contract, and one directory below it that carries none'
steps:
  - id: validate
    run: ['context', 'validate']
    note: 'the directory with no document is named, and the one that has its contract is not'
    expect:
      exit: 10
      stdout_contains: ['missing-contract', 'zones/deep']
      stdout_not_contains: ['zones — missing-contract']
  - id: resolve
    run: ['context', 'resolve', '.ai/repo/zones']
    note: 'nothing resolves against a tree that does not validate, not even the part that is correct'
    expect:
      exit: 10
      stdout_contains: ['does not validate']
  - id: doctor
    run: ['doctor']
    note: 'the same finding through the rule majordomus.context-integrity, which the pre-commit hook runs'
    expect:
      exit: 10
      stdout_contains: ['missing-contract']
then:
  - 'a directory of the layer with no context document is a named failure, not a silence'
  - 'the same tree, and what each directory owes, is readable through majordomus_directories and GET /api/v1/directories without running the gate'
  - 'the finding names the directory, so the fix is one file in one place'
  - 'the tree refuses to resolve until it is fixed, so nobody reads a half-documented layer'
  - 'the same tree, and what each directory owes, is readable through majordomus_directories and GET /api/v1/directories without running the gate'

Outcome

The obligation to document a directory is enforced rather than remembered. The fix is one file: a README.md carrying schema: context/v1, saying what the directory is for and what belongs in it. Where the directories below a contract are instances of a kind rather than sections — a skill and its examples — the governing contract exempts them with children.require_contract: false, and the exemption travels with the tree it describes.

The scenario

Executed against the real tool, in a repository prepared by undocumented-directory, every time this site is generated. What follows is not a description of what should happen; it is what happened.

given

  • a repository with Majordomus installed, a new section that carries its contract, and one directory below it that carries none

when

  1. 1majordomus context validate
  2. 2majordomus context resolve .ai/repo/zones
  3. 3majordomus doctor

then

  • a directory of the layer with no context document is a named failure, not a silence
  • the same tree, and what each directory owes, is readable through majordomus_directories and GET /api/v1/directories without running the gate
  • the finding names the directory, so the fix is one file in one place
  • the tree refuses to resolve until it is fixed, so nobody reads a half-documented layer
  • the same tree, and what each directory owes, is readable through majordomus_directories and GET /api/v1/directories without running the gate

What the tool did

Evidence of the run this page was generated from: pass, 3 step(s). Output is normalised: the repository's path, timestamps, ids and durations are placeholders; nothing else is edited.

Tested by test/cases/94_use_cases.sh, which runs every scenario and refuses a step whose recorded output is not what it produced.

  1. the directory with no document is named, and the one that has its contract is not

    FAIL context     .ai/repo/zones/deep — missing-contract: carries no context document; a directory inside the tree says what it is for, or its governing contract exempts it (children.require_contract: false)  [reproduce: printf '%s\n' '---' 'schema: context/v1' > .ai/repo/zones/deep/README.md]
    context validate: 1 problem(s) in 21 document(s)
    • exit 10
    • stdout_contains /missing-contract/
    • stdout_contains /zones/deep/
    • stdout_not_contains /zones — missing-contract/
  2. nothing resolves against a tree that does not validate, not even the part that is correct

    FAIL context     .ai/repo/zones/deep — missing-contract: carries no context document; a directory inside the tree says what it is for, or its governing contract exempts it (children.require_contract: false)  [reproduce: printf '%s\n' '---' 'schema: context/v1' > .ai/repo/zones/deep/README.md]
    majordomus: context: the tree does not validate (1 problem(s) above); nothing is resolved partially
    • exit 10
    • stdout_contains /does not validate/
  3. the same finding through the rule majordomus.context-integrity, which the pre-commit hook runs

    OK   knowledge   graph — buildable here: 101 node(s), 58 edge(s), compiled into a temporary file and removed; no stored index to go stale
    OK   knowledge   records — 0 record(s) valid against knowledge/v1; every reference resolves  [reproduce: majordomus knowledge check]
    OK   knowledge   candidates — 0 await review, cap 40
    OK   layout      .ai/manifest.yaml — schema ai-repository/v1
    OK   layout      .ai/repo/scope.yaml — version 1; 14 in pathspec(s); every key is one the schema declares
    OK   layout      .ai/local/ — ignored, and nothing under it is tracked
    OK   layout      .ai/ — every section the manifest names exists; the layer is readable without the tool
    OK   layout      .ai/repo/prompts — present
    OK   layout      .ai/local/state/handovers — present, 0 record(s)
    OK   layout      .ai/local/state/checkpoints — present, 0 record(s)
    OK   records     ledger.jsonl — every line is a well-formed event
    OK   policy      39 key(s) — every policy value the code reads is declared, with no reader-side default
    OK   bootstrap   3 projection(s) — each points at .ai/README.md, carries no rule of its own and names only rules in force
    OK   catalogue   0 use case(s), 0 application(s) — every command, doctrine, claim, responsibility, category, setup and cross-reference resolves, both directions
    FAIL context     .ai/repo/zones/deep — missing-contract: carries no context document; a directory inside the tree says what it is for, or its governing contract exempts it (children.require_contract: false)  [reproduce: printf '%s\n' '---' 'schema: context/v1' > .ai/repo/zones/deep/README.md]
    OK   policy      .ai/repo/policy.yaml — parsed, version 1
    OK   profiles    4 files — parsed; default 'implementation' exists
    INFO adr         .ai/repo/adrs/ — no decisions; nothing to validate
    OK   records     decisions.md — every entry is attributable
    INFO project     .ai/repo/project — no canonical project model here; nothing to validate
    OK   command     surface — 30 public command(s), reconciled against the dispatch table  [reproduce: majordomus doctor]
    OK   doctrine    50 of 61 rule(s) carry a validator — validator, dispatch, propagation, test and CI resolve for every one of the 50; the remaining 11 declare no validator and this check does not examine them
    FAIL wiring      doctor-on-commit — hook .git/hooks/pre-commit does not exist  [reproduce: ls -l .git/hooks/pre-commit]
    FAIL wiring      finish-on-push — hook .git/hooks/pre-push does not exist  [reproduce: ls -l .git/hooks/pre-push]
    OK   command     coverage — every public command is exercised and refuted  [reproduce: bash test/run.sh 31_command_coverage]
    OK   resolver    handovers — no record for this worktree and branch (absence, not a stale match)  [reproduce: majordomus handover --resolve]
    OK   lifecycle   activity — 0 episode(s) opened here; too few to judge whether the writers stopped
    OK   knowledge   wiring — the close path and the compaction adapter call the deriver
    OK   knowledge   deriver — no episode has closed here; nothing to judge
    INFO project     .ai/repo/project — no canonical project model here; nothing to validate
    OK   projection  AGENTS.md — content matches its stamp
    OK   projection  CLAUDE.md — content matches its stamp
    OK   projection  GEMINI.md — content matches its stamp
    OK   budget      AGENTS.md — 42 lines, budget 150
    OK   links       AGENTS.md — all references resolve
    OK   counts      AGENTS.md — no hardcoded counts
    OK   context     builder — 21 lines, budget 300  [reproduce: majordomus context]
    OK   capture     share/schemas/majordomus/capture/capture.v1 — 2 file(s) describe majordomus.capture/v1 at the path the identifier derives: the record as JSON Schema, the document as protobuf
    OK   capture     .ai/local/prompts — ignored and untracked
    OK   capture     .ai/local/prompts — no records yet; the archive is empty
    OK   capture     .ai/local/prompts — every prompt is present as all three: the record, the Markdown and the YAML
    OK   prompts     .ai/local/prompts — the archive and every record in it are readable by their owner only
    OK   prompts     .ai/local/prompts — no records yet; the archive is empty
    OK   prompt      4 asset(s) — front matter valid, every token known
    OK   records     open-questions.md — every entry parses
    OK   retention   ledger — 1 lines, cap 5000
    OK   retention   handovers — 0 files, cap 200
    OK   retention   checkpoints — 0 files, cap 500
    OK   retention   sessions — 0 records, cap 500
    INFO project     .ai/repo/project — no canonical project model here; nothing to validate
    OK   rules       .ai/repo/rules/vendor/majordomus — every file matches the manifest (1 (1.0.0-alpha.9))
    OK   rules       61 rule(s) — resolve in one deterministic order; vendored baseline plus project rules, no override — 51 carry a validator, 10 are normative text this tool does not check
    OK   rules       blocking — all 44 blocking rule(s) carry a validator
    OK   schema      rules — 61 rule(s) resolve in one order: the vendored baseline in manifest order, then the project's, as a dependency graph
    OK   schema      share/kinds.yaml — 37 kind(s); every one that carries metadata declares a schema
    OK   schema      share/schemas — 54 schema(s), each valid JSON and each applied — by a kind, through an allow-list the tool reads, by a validator that names it, or as a generated document's contract (15)
    OK   records     0 record(s) — every changed_files names work, not generated or local state
    OK   session     .ai/local/session-contexts — ignored and untracked
    OK   session     .ai/local/session-contexts — no working contexts yet; the store is empty
    INFO skill       .ai/repo/skills/ — no skills; nothing to validate
    OK   skill       reachable — no personal command or skill shares a name with a projected skill  [reproduce: majordomus run editors.status]
    INFO use-case    30 advisory gap(s) — not covered by an active use case, and the policy does not require it: command:init command:update command:doctor command:watch command:start command:context command:checkpoint command:handover command:check command:finish command:history command:decision command:question command:prompt command:evidence command:skills command:capture command:search command:doctrine command:plan command:version command:session command:knowledge command:adr command:usecase command:rules command:migrate command:recover command:bench command:archive  [reproduce: majordomus usecase coverage]
    OK   use-case    0 of 30 target(s) covered — every public command the policy requires is named and run by an active use case (policy use_cases.coverage)
    INFO env         - — bash <version>, git <version>, jq <version>, shellcheck present
    WARN clone       unpushed — commits on no remote: main(3) — work on one disk is invisible to every other session and cannot be integrated  [reproduce: git push -u origin <branch>]
    OK   clone       uncommitted — no linked worktree, so no uncommitted work can sit in one
    INFO clone       trunk — no remote-tracking branch, so this checkout's distance from the remote trunk cannot be measured
    INFO clone       release — no remote-tracking branch, so whether the trunk's landed work is released cannot be measured
    ·    reasoning   <decided by the advisors and the executable of the recording machine>
    ·    layout      - — <judged when the recording machine has built the executable>
    ·    budget      doctor — <timed against the policy budget>
    doctor: 3 failure(s)
    • exit 10
    • stdout_contains /missing-contract/

Why the tool knows this

The chain from this page to the code: the use case names commands, rules and claims; each rule is dispatched from the registry and each claim names the test that proves it; the scenario above executed the commands. Nothing in this chain is prose about intent.

Over MCP the same layer is reached through majordomus_directories (the MCP surface).

The rules that make it hold

Guarantees exercised

Related use cases

Computed from what they share: claims, rules, commands, category, applications. Nobody maintains this list.

The moments this answers

Searches the titles and descriptions of every page this site publishes.