Skip to content

I3014 — The repository is found once per process, and a counter proves it

Repository::open, which Repository::discover ends in, answers from one process-wide cell keyed by the root: the first open reads and parses .ai/manifest.yaml, every later open of the same root answers from what was read while the manifest's length and modification time are unchanged, and an edited manifest is read again. perf gains a repository_discoveries counter, bumped only by a real walk, listed in startup_work, and tests/hot_path.rs asserts it is 1 after startup.

READY wave 0 · p0 · implementation profile · parallel safe

Part of two-folder-integration — A repository that adopts Majordomus gains two directories and two lines, and can give them back.

Ready. Every dependency is done, so majordomus plan start I3014 will be accepted.

Objective

Repository::open, which Repository::discover ends in, answers from one process-wide cell keyed by the root: the first open reads and parses .ai/manifest.yaml, every later open of the same root answers from what was read while the manifest's length and modification time are unchanged, and an edited manifest is read again. perf gains a repository_discoveries counter, bumped only by a real walk, listed in startup_work, and tests/hot_path.rs asserts it is 1 after startup.

Why

The first slice of I1105 (one model, discovered once). On 2026-10-20 a read-only survey of origin/master 9a5a9b77520 found four ways to find a root and nothing cached: Repository::discover walks and reads the manifest at every entry, and manifest_value reads it again. Without a counter, discovered once is a claim nobody can check.

Current state

Repository { root, manifest } (apps/majordomus-cli/src/repository.rs) is built anew by every discover and open; perf counts repository_scans (the file walk) but not discoveries.

Desired state

One discovery per root per process, counted; the counter is a startup-work counter the hot-path test holds at 1.

Scope

  • apps/majordomus-cli/src/repository.rs
  • apps/majordomus-cli/src/perf.rs
  • apps/majordomus-cli/tests/hot_path.rs

Out of scope

  • Rewiring serve, mcp or the capabilities (I3015, I3016)
  • Caching environment, provider or service facts (I1107)

Dependencies

None. This issue is a root of the graph.

What waits on this

Acceptance criteria

  • A second open of the same root reads no manifest and an edited one is read again, proved by a unit test that makes the manifest unreadable after the first open
  • perf reports repository_discoveries, it is listed in startup_work, and tests/hot_path.rs asserts it is 1 after startup

Validation

  • cargo test --workspace --all-features

Evidence required

  • discovered_once_counter

Evidence

None recorded. Every token above needs a command or an artifact behind it before this issue can be completed; narrative is refused.

Timeline

started
—
verified
—
completed
—

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I3014.yaml. Read it back with majordomus plan show I3014.

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