Skip to content

Trace a change to the context documents it affects

List the scoped context documents, resolve which apply to a path and why, and find out which documents a change set touches before it lands.

guaranteed Repository knowledgeintermediatemaintainerreviewerread-only

Situation

Context is not one file. A directory carries its own document, the root carries another, and a change deep in the tree may fall under a document nobody remembers writing. When a document changes, which paths and which projections does it affect? Guessing is how a stale rule survives a review.

What you run

  • context list: every scoped document with its scope and composition
  • context resolve <path> and context explain <path>: what applies to a path, in order, and why
  • context affected: the documents a change set touches, from git
  • context check-sync: validate the tree, then the projections against their stamps, then the affected set

Scenario

setup: installed
given:
  - 'a repository with Majordomus installed and projections generated, and one commit of work'
steps:
  - id: list
    run: ['context', 'list']
    note: 'every scoped document: id, path, scope, composition, providers, status'
    expect:
      exit: 0
      stdout_contains: ['ai.layer']
  - id: resolve
    run: ['context', 'resolve', 'lib']
    note: 'the documents that apply to a path, root to target, in effective order with provenance'
    expect:
      exit: 0
      stdout_contains: ['^01  ai.layer']
  - id: explain
    run: ['context', 'explain', 'lib']
    note: 'the same, with why each applies and why each candidate was left out'
    expect:
      exit: 0
      stdout_contains: ['ai.layer']
  - id: affected
    run: ['context', 'affected']
    note: 'which documents the working tree’s changes touch; nothing is changed here, so nothing is affected'
    expect:
      exit: 0
      tree_unchanged: true
  - id: sync
    run: ['context', 'check-sync']
    note: 'the tree validates, every projection matches its stamp, and nothing is affected'
    expect:
      exit: 0
      stdout_contains: ['in sync']
then:
  - 'resolution is deterministic: the same path gives the same ordered list'
  - 'a change under a scope names the document that governs it'
  - 'the projections are checked against the documents they were rendered from'

Outcome

Every path has one deterministic answer to “what governs me”, every change has one answer to “what did I touch”, and a projection rendered from a document that has since changed is reported, not trusted.

The scenario

Executed against the real tool, in a repository prepared by installed, 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 and projections generated, and one commit of work

when

  1. 1majordomus context list
  2. 2majordomus context resolve lib
  3. 3majordomus context explain lib
  4. 4majordomus context affected
  5. 5majordomus context check-sync

then

  • resolution is deterministic: the same path gives the same ordered list
  • a change under a scope names the document that governs it
  • the projections are checked against the documents they were rendered from

What the tool did

Evidence of the run this page was generated from: pass, 5 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. every scoped document: id, path, scope, composition, providers, status

    ai.layer                     .ai/README.md                                subtree   final   *              active
    ai.repo                      .ai/repo/README.md                           subtree   extend  *              active
    ai.repo.adrs                 .ai/repo/adrs/README.md                      subtree   extend  *              active
    ai.repo.applications         .ai/repo/applications/README.md              subtree   extend  *              active
    ai.repo.deployments          .ai/repo/deployments/README.md               subtree   extend  *              active
    ai.repo.features             .ai/repo/features/README.md                  subtree   extend  *              active
    ai.repo.knowledge            .ai/repo/knowledge/README.md                 subtree   extend  *              active
    ai.repo.mesh                 .ai/repo/mesh/README.md                      subtree   extend  *              active
    ai.repo.profiles             .ai/repo/profiles/README.md                  subtree   extend  *              active
    ai.repo.project              .ai/repo/project/README.md                   subtree   extend  *              active
    ai.repo.prompts              .ai/repo/prompts/README.md                   subtree   extend  *              active
    ai.repo.rules                .ai/repo/rules/README.md                     subtree   extend  *              active
    ai.repo.sessions             .ai/repo/sessions/README.md                  subtree   extend  *              active
    ai.repo.skills               .ai/repo/skills/README.md                    subtree   extend  *              active
    ai.repo.use-cases            .ai/repo/use-cases/README.md                 subtree   extend  *              active
    ai.repo.why                  .ai/repo/why/README.md                       subtree   extend  *              active
    ai.repo.workflows            .ai/repo/workflows/README.md                 subtree   extend  *              active
    ai.repo.knowledge.candidates .ai/repo/knowledge/candidates/README.md      subtree   extend  *              active
    ai.repo.knowledge.curated    .ai/repo/knowledge/curated/README.md         subtree   extend  *              active
    ai.repo.rules.project        .ai/repo/rules/project/README.md             subtree   extend  *              active
    • exit 0
    • stdout_contains /ai.layer/
  2. the documents that apply to a path, root to target, in effective order with provenance

    # effective context for lib
    01  ai.layer                   .ai/README.md                              subtree   final   *
    • exit 0
    • stdout_contains /^01 ai.layer/
  3. the same, with why each applies and why each candidate was left out

    # effective context for lib
    01  ai.layer                   .ai/README.md                              subtree   final   *
        applies: the tree root; the target is outside .ai/
    
    # left out
    (nothing: every candidate applies)
    
    # order
    depth (tree root first), then order, then path; never the order the filesystem lists files in
    fingerprint <sha><hash16>ef77ca97
    • exit 0
    • stdout_contains /ai.layer/
  4. which documents the working tree’s changes touch; nothing is changed here, so nothing is affected

    • exit 0
  5. the tree validates, every projection matches its stamp, and nothing is affected

    OK   context     .ai/ — 20 document(s) validate
    OK   context     AGENTS.md — projection for agents matches its stamp and the policy as it is
    OK   context     CLAUDE.md — projection for claude-code matches its stamp and the policy as it is
    OK   context     GEMINI.md — projection for gemini matches its stamp and the policy as it is
    context check-sync: in sync (20 document(s), 3 projection(s), 0 affected)
    • exit 0
    • stdout_contains /in sync/

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.

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.