Create hierarchical, bottom-up "layered summaries" by generating AGENTS.md files per directory in a subtree (e.g., reth/crates/engine)...
Generate a layered set of AGENTS.md files so that:
This is designed to pair well with Cursor's nested AGENTS.md support: when you work in a folder, you automatically get its local summary plus its ancestors' higher-level context.
AGENTS.md files. Do not change other files.AGENTS.md.[unclear] / [TBD] markers when needed.Use these helper scripts to make planning/scaffolding/verification deterministic and resumable.
All scripts support Repomix-style scoping flags:
--include "<glob1,glob2,...>" (positive filter)-i/--ignore "<glob1,glob2,...>" (negative filter; ignore wins on conflicts)** (e.g., docs/**/*.md matches docs/README.md and deeper files).--include/--ignore to focus and avoid huge generated/vendor trees.node_modules/, bower_components/, jspm_packages/. If there's some valid reason to include them, pass an explicit --include that targets them.scripts/agents_plan.py
--mode full and --mode update (git-based incremental planning).scripts/agents_scaffold.py
DIR/AGENTS.md stubs for meaningful directories.AGENTS.md files. Default is dry-run; pass --write to create.scripts/agents_verify.py
AGENTS.md, one-hop ledger matches filesystem, ASCII-only.--strict: also fail on remaining [TBD] or unchecked - [ ].scripts/normalize_agents_ascii.py
AGENTS.md (default dry-run; --write to edit).scripts/export_agents_md.py
AGENTS.md files from a subtree into a standalone folder.Use Explore subagents for every meaningful directory you process. Explore is read-only; it should only return analysis. The main agent must create/update AGENTS.md.
AGENTS.md. Always complete children first, then do the parent.For each directory DIR/ inside the target root:
DIR/.DIR/ (if any). "Trust children" applies only to nested folders, not the current directory's own files.AGENTS.md files exist, read them and incorporate their responsibilities into PURPOSE/RELATIONSHIPS. Treat child AGENTS.md as the source of truth for nested subfolders.child/AGENTS.md already exists. Prefer to synthesize from child/AGENTS.md instead.AGENTS.md template.Use this exact output structure from the Explore subagent (so the main agent can paste/transform it reliably):
DIRECTORY
- path: <path relative to target root>
- kind: leaf | non-leaf | aggregator-only
PURPOSE
<1-3 sentences>
PARENT ROLLUP
- <1-2 sentences or 1-3 bullets; keep it short; include up to 3 concrete pointers (subdirs/files/symbol names)>
CONTENTS (ONE HOP)
SUBDIRECTORIES
- <name>/ - process | skip (<reason>)
...
FILES
- <file> - <role (1-2 sentences)>
- key-items: <2-10 names or config keys>
- interactions: <optional 0-2 bullets, paths/modules only>
...
KEY APIS (NO SNIPPETS)
- types/classes/interfaces: <comma-separated names> - <optional 1-liners>
- modules/packages: <comma-separated names> - <optional 1-liners>
- functions: <comma-separated names> - <optional 1-liners>
RELATIONSHIPS
- depends-on: <paths/modules> - <why>
- used-by: <paths/modules> - <why>
- data-control-flow:
- <3-12 bullets, high level>
LEAF-ONLY (IF LEAF)
FILES (DETAILED)
- <file>
- role: <why it exists>
- key-items: <3-10 names>
- interactions: <how it connects to sibling files>
- knobs-invariants: <important constraints/tuning>
...
END-TO-END FLOW
- <5-12 bullets>
NOTES
- <0-n bullets; include [unclear] where needed>
reth/crates/engine.This skill and the helper scripts do not try to detect βcodeβ vs βnon-codeβ by language/framework.
Instead, scope is controlled by --include / --ignore, and a directory is treated as meaningful (must have an AGENTS.md) when:
--include is provided, it is in the include-closure), andAGENTS.md file, or contains at least one meaningful in-scope child directory (so it can roll up children).Directories that are out-of-scope or empty can still appear in the one-hop ledger, but must be marked as skipped with an explicit reason (e.g., out of scope, generated, vendored, binary blobs, empty).
tree for planning & quick verification (convenience)If tree is available, use it for a fast, human-readable scan of what exists and to spot large/unwanted subtrees early.
tree -a -L 4 reth/crates/engine
AGENTS.md already exists:tree -a --prune -P 'AGENTS.md' reth/crates/engine
If tree is not available, use find/directory listings instead. tree is a convenience; the ledger invariant (one-hop subdirectory checklist in every AGENTS.md) is the correctness mechanism.
Invariant: Every AGENTS.md must contain a one-hop inventory of its immediate subdirectories (excluding always-ignored and default-pruned dependency dirs unless explicitly included), and that list must match the filesystem under those rules.
Use checkbox statuses to make progress explicit:
- [ ] \child/` - [TBD]` = discovered, not processed yet- [x] \child/` - = processed, summary filled fromchild/AGENTS.md`- [x] \child/` - (skip: = inspected and intentionally skipped (e.g.out of scope, generated, vendored, empty`)Rule: Before leaving a directory, refresh the one-hop list from the filesystem and ensure no ledger-eligible child directory is missing from the list.
AGENTS.md templateUse this structure everywhere (omit sections that truly don't apply). Leaf directories must be more detailed than one-line-per-file (see "Leaf directories: required detail" below).
# <directory-name>
## Purpose
<1-3 sentences describing what this directory provides and why it exists.>
## Contents (one hop)
### Subdirectories
- [ ] `child-a/` - [TBD]
- [ ] `child-b/` - [TBD]
### Files
- `<important local file>` - <role (1-2 sentences)> (e.g. `README.md`, `docs.md`, `package.json`, `pyproject.toml`)
- **Key items**: <2-6 relevant names (headings/commands/config keys), or "n/a" if purely descriptive>
- `src/<file>` - <role (1-2 sentences)>
- **Key items**: `TypeA`, `TypeB`, `fn_x()`, `CONST_Y`
- **Interactions** (optional): <mentions of sibling files/modules this connects to>
- `<top-level file>` - <role (1-2 sentences)> (only if relevant to this directory's responsibility)
- **Key items**: <2-6 names>
## Key APIs (no snippets)
- **Types / Classes / Interfaces**: `Foo`, `Bar` - <1-liners>
- **Modules / Packages**: `<name>` - <1-liners> (if applicable)
- **Functions**: `qux()` - <1-liners>
## Relationships
- **Depends on**: <paths/modules> - <why>
- **Used by**: <paths/modules> - <why>
- **Data/control flow**: <3-7 bullets, high level>
## Notes
<Optional. Preserve this section across re-runs. Put [unclear] items here if needed.>
Even for non-leaf directories, avoid "just <role>" file entries.
Minimum requirement for every listed file:
<other file>", "spawns tasks consumed by <module>").If a directory has files but no meaningful subdirectories, treat it as a leaf and write a deeper, navigational summary:
Use this leaf template (still no big snippets/excerpts):
## Files (detailed)
### `<file-a>`
- **Role**: <why it exists>
- **Key items**: `TypeA`, `TypeB`, `fn_x()`, `CONST_Y`
- **Interactions**: <uses/calls/emits/consumes; point to sibling files>
- **Knobs / invariants**: <important constraints or tuning>
### `<file-b>`
- **Role**: ...
- **Key items**: ...
- **Interactions**: ...
- **Knobs / invariants**: ...
## End-to-end flow (high level)
- <step 1: where work starts, what enters>
- <step 2: how it fans out (tasks/channels), what's computed>
- <step 3: how results are joined/ordered, what is returned/emitted>
Use scripts to avoid manual recursion bookkeeping. The agent still writes AGENTS.md, but planning/scaffolding/verification are deterministic.
Plan waves (derived only, no writes)
python3 scripts/agents_plan.py --root <target-root>Create missing stubs (create-only)
python3 scripts/agents_scaffold.py --root <target-root> --writeDIR/AGENTS.md stubs for meaningful directories and does not modify existing AGENTS.md.Process waves deepest -> shallowest
missing/incomplete:DIR/AGENTS.md from the Explore report:## Notes.[ ]/[x] and explicit skip reasons where applicable.child/.Verify + normalize
python3 scripts/agents_verify.py --root <target-root> --strictpython3 scripts/normalize_agents_ascii.py --root <target-root> --fail-on-remaining (or --write)python3 scripts/export_agents_md.py --src <target-root> --out <output-dir>If an AGENTS.md already exists:
## Notes.[x] + summary text for children that still exist, unless you are intentionally updating that child (or it is now missing/invalid).Use this mode when the subtree already has AGENTS.md and you want to update only what changed (plus rollups above it).
python3 scripts/agents_plan.py --root <target-root> --mode update --base-ref <ref>--base-ref, it uses working tree changes (staged + unstaged + untracked).scripts/agents_verify.py --strict to ensure rollups and ledgers are consistent.Re-run planning and continue from the deepest remaining work:
python3 scripts/agents_plan.py --root <target-root>missing/incomplete, deepest waves first.scripts/agents_verify.py --strict as the final correctness check.You're done when:
AGENTS.md.AGENTS.md, the "Subdirectories" list matches the filesystem (no missing children).[TBD] remains for directories that were processed; everything is either [x] summarized or [x] (skip: <reason>).AGENTS.md reads like an architecture overview (components + how they connect), with details pushed down to children.python3 scripts/agents_verify.py --root <target-root> --strict exits 0.