Repository navigation
Plan / Interface: admitted AGENTS.md hierarchy - #2092
Conversation
Relates to #2090. Define the draft acceptance and interface contract for human review; no implementation. Co-authored-by: Mecatl <[email protected]>
Reuse operand extraction and bounded workspace reads, keep a single assembly path, and extend RootAssembler and discovery without legacy variants. Co-authored-by: Mecatl <[email protected]>
rdimitrov
left a comment
There was a problem hiding this comment.
Verdict: request changes. The plan gets the agents.md rules right: root-to-leaf loading, the nearest file wins on conflicts, sibling folders stay separate, and the user's explicit prompt beats repo guidance. The problem is how it delivers those rules. It is much heavier than what Codex, Claude Code, Gemini CLI, Cursor or OpenCode do, and in a few places it is less forgiving. The agents.md spec only says "nearest file wins". Everything past that is Mecatl's own choice, so the extra machinery should justify itself.
Main issues
1. Blocking a whole batch before it runs is unusual and mostly unnecessary.
- No major harness makes the model decide again before a tool call. Claude Code loads a nested CLAUDE.md when a tool reads a file in that subtree, and attaches it to the context. Codex loads the root-to-cwd chain once at session start.
- Mecatl already requires a Read before an Edit or an overwrite (
engine/adapter/fstools/write.go:91). So if guidance arrives with the Read result, Edit is already covered. - That leaves only new-file Write, Copy, Move and Remove. Those are the only places that need a "guidance not seen yet, try again" stop.
- That cuts most of the deferral and re-check logic from the plan. That logic covers whole-batch deferral, re-checking unexecuted calls after the first one runs, effective-argument re-checks, and fingerprinting cached reviews per run.
2. Dropping old folder guidance on every batch will cause thrashing.
- Each batch's target set replaces the active folders instead of adding to them.
- Example: edit
website/a, thenservices/b, thenwebsite/c. That costs three extra model decisions, and the model keeps losing guidance it already saw. - Claude Code keeps nested files loaded once they're seen, for the rest of the session.
- Recommendation: accumulate active folders within a run, with a size cap and least-recently-used eviction.
3. Starting in a subfolder hides the root AGENTS.md by default.
- Codex, Claude Code, Gemini and OpenCode all walk up from where the session starts to the project root (the git root, in Codex's case), so
repo/AGENTS.mdapplies to a session started inrepo/website. - This plan finds ancestors only if the broader root was explicitly admitted, and it says it never walks up the host filesystem or infers a git repo.
- That is the most common monorepo setup. "Can't see the root rules" will be the first bug report.
- Trust can still gate this: if the git root is already trusted, admit its chain.
4. An oversized file stops the whole run.
- Limits are 64 KiB per file and 256 KiB total, and going over is a "visible failure", not truncation.
- Codex defaults to 32 KiB total and truncates. Claude Code warns.
- Stopping a run because someone's AGENTS.md is 65 KiB is hostile.
- Recommendation: skip or truncate that file and log a diagnostic. Also, 256 KiB (about 64k tokens) is too high a total; something nearer Codex's 32 KiB is the norm.
5. The new bounded-read transport is scope creep, and it makes completion depend on an external release.
- The plan adds a new
FILE_OPERATION_READ_BOUNDED(bounded-read) protobuf operation and a matching MicroVM operation, and blocks completion on an external MicroVM runtime release (AC7.3). - The plan itself says existing transport frame limits already cap the reply envelope. Applying the 64 KiB rule on the client after a frame-limited read is enough for small instruction files.
- Recommendation: move bounded reads to a follow-up, so hierarchy can ship without waiting on another team.
6. Nested CLAUDE.md is ignored, but root CLAUDE.md is a fallback.
- If CLAUDE.md is supported for compatibility, apply the same rule in every folder: AGENTS.md first, CLAUDE.md if it's missing.
- Codex lets operators configure fallback filenames, and many repos (this one included) use CLAUDE.md symlinks.
- Today a repo with nested CLAUDE.md files gets root guidance only, which is confusing.
What's fine as is
- Not parsing Shell commands for paths. Claude Code has the same gap.
- Leaving AGENTS.override.md out of scope, since only Codex supports it.
- Never saving instruction bodies to the transcript.
- The breaking signature change to the assembler with no compatibility shim.
- Keeping the existing trust model unchanged.
Summary
Ship the industry-standard version first:
- At session start, load the chain from the root to the session's starting folder.
- When a tool first touches a new folder, attach that folder's guidance to the Read result.
- Keep loaded folders for the rest of the run.
- Stop and retry only for new-file Write, Copy, Move and Remove.
- Truncate oversized files with a warning instead of stopping.
That covers what #2090 asks for at a fraction of the 9 open human decisions and 22 acceptance criteria. Batch reconsideration and the bounded transport can come back as separate proposals if they turn out to be needed.
🤖 Generated with Claude Code
Co-authored-by: Mecatl <[email protected]>
Avoid the ADR 0374 collision with the persisted mecatui server CA decision on main. Update only the proposed decision and its spec references. Co-authored-by: Mecatl <[email protected]>
rdimitrov
left a comment
There was a problem hiding this comment.
Verdict: much better. Five of my six points are fixed, but one compliance gap is still open. The plan went from 490 lines to 140 and now looks like what other harnesses do.
How each point was handled
| # | Earlier feedback | Status |
|---|---|---|
| 1 | Batch blocking and reconsideration | Fixed, and went further. All instruction-based blocking is gone, including for new-file Write, Copy, Move and Remove. Guidance now arrives on the next model request. This matches Claude Code, which also doesn't load nested guidance before a first write. Fine. |
| 2 | Active folders replaced each batch | Fixed. Folders the run has already seen are kept, and moving to a sibling folder no longer drops them. |
| 3 | Root AGENTS.md hidden when starting in a subfolder | Not fixed. See below. |
| 4 | Oversized file stops the run | Fixed. 32 KiB total by default (Codex's number), cut at a safe text boundary, with a warning. It never blocks tools. |
| 5 | Bounded-read transport and external MicroVM release | Fixed. Both removed. It uses existing reads and documents that limit. |
| 6 | Nested CLAUDE.md | Fixed. AGENTS.md first, CLAUDE.md if it's missing or blank, in every folder. |
Remaining issues
1. In the default setup, the root AGENTS.md still isn't loaded when starting in a subfolder (blocker).
- The plan now says "root-to-starting-folder chain" but still rules out walking up the host filesystem or finding the git root. It only sees ancestors if a broader source was explicitly admitted.
- The default local source is the starting folder. The plan's "root" and the starting folder are the same in the default setup:
internal/app/harness_context_compatibility.go:33builds the assembler on the configured workspace (RootAssembler{Source: local.Workspace}).cmd/mecatui/config.go:885sets that workspace to the current directory when none is given.
- So
cd repo/website && mecatuiloadswebsite/AGENTS.mdand neverrepo/AGENTS.md. Codex, Claude Code, Gemini CLI and OpenCode all load the repo root here. - Fix: the default local source should use the trusted project root (the git root or the existing trust anchor) as its root, with the session's starting folder as the subfolder. The plan already supports that subfolder mapping. Trust still controls it, and nothing is read above the trusted root.
2. Keeping scopes in first-seen order is the wrong priority (recommendation for open decision 2).
- When the 32 KiB budget is full, new folders are "omitted" and loading stops.
- Late in a long run, the folder the model is working on now gets no guidance, while folders it touched an hour ago keep their space.
- Recommendation: always keep the starting chain, and evict the least recently used folder scopes when space runs out.
- The retention policy is still an open decision, so this is the moment to settle it.
3. Whole-source replace can drop guidance mid-run (minor). Because scopes are now kept, touching website/ once can suppress source B's guidance for services/ for the rest of the run. That only matters when several sources use replace, which no other harness has. Disclosing it is acceptable. Just make sure the diagnostic fires when it happens, not only in the docs.
What's fine as is
- Not parsing Shell commands for paths, and telling the model about that gap.
- Leaving AGENTS.override.md out of scope.
- Keeping the trust model unchanged.
- Keeping one
Deps.Instructionscomposition path. - Leaving the discovery limit open until it's measured.
Summary
Approve once issue 1 is fixed. Issue 2 belongs in the open retention decision. Issue 3 is fine with a diagnostic.
🤖 Generated with Claude Code
Record the confirmed subfolder-root boundary and source-selection positive control in the hierarchy plan and ADR. Co-authored-by: Mecatl <[email protected]>
Co-authored-by: Mecatl <[email protected]>
Co-authored-by: Mecatl <[email protected]>
Record session-stable lazy guidance, inherited child behavior, trusted source boundaries, and a configurable 64 KiB default. Co-authored-by: Mecatl <[email protected]>
Plan / interface
Relates to #2090.
Documentation-only plan; hierarchy support is not implemented or claimed shipped. Existing public and architecture guides remain unchanged until implementation.
Agreed MVP behavior
Remaining draft contracts
Concrete proposals and review remain for exact exported signatures/manifest fields and caller migration, config name/type/validation/threading, live-session retention ownership/cleanup, and a measured new-scope discovery-work ceiling. The prototype's 128 probes and 64 directories are not approved defaults.
The product decisions above do not constitute approval of an implementation-ready plan. ADR 0376 and the plan remain draft and unmerged.
Publication baseline
Current plan head:
4168ab3b298ff384ec6c5cd4f0fc01db696a3ee7.This records the operator's MVP decisions on top of
9250ec196dd6c7f6bb6e90c7532e8a28092a6879, without incorporating arbitrary newer main changes. The separate NONSHIPPING prototype in #2110 has not been updated to implement these amendments and remains based on the earlier plan commit.Verification
For the amended documents:
task docspassed.git diff --checkpassed.No runtime implementation tests or aggregate code gates are claimed for this documentation-only update.