Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ab3f5fb
feat(repo): repo budget counts .claude/rules
napetrov Oct 31, 2026
d4d63e8
fix(repo): rules: paths that names no pattern starts, warn on a linke…
napetrov Oct 31, 2026
1b7ccad
fix(repo): warn on a rules link out of the tree; read paths as YAML f…
napetrov Oct 31, 2026
82fd9bf
fix(repo): a rule frontmatter too deep for YAML no longer crashes budget
napetrov Oct 31, 2026
f1718b7
fix(repo): budget counts a rule linked to guidance once, at its loadi…
napetrov Oct 31, 2026
21e287c
Merge branch 'main' of https://github.com/intel/dokimi into pq-326-fix
napetrov Oct 31, 2026
cc17f0d
fix(repo): budget reads rule frontmatter, links and promoted files as…
napetrov Nov 1, 2026
f2da52f
fix(repo): budget reads a paths key on its own, keeps rules out of th…
napetrov Nov 1, 2026
6cc0717
fix(repo): rule exclusions follow the harness flag; an open flow list…
napetrov Nov 1, 2026
b1f2624
Docs: a rule a root guidance file imports is start whatever its paths
antonwolfy Nov 1, 2026
cd427e9
fix(budget): comments and alias links do not change how a rule's path…
napetrov Nov 1, 2026
adbfd73
fix(budget): an indented field of another key ends the paths block
napetrov Nov 1, 2026
6d372ac
fix(budget): a scoped rule does not cover a cut import at start
napetrov Nov 1, 2026
b484dc8
Recognise a quoted key after empty paths as another field
antonwolfy Nov 1, 2026
b852254
Merge remote-tracking branch 'intel/main' into pr326-land1031
napetrov Nov 1, 2026
c09d9e4
fix(repo): budget keeps a root CLAUDE.md's imports and loads rule ali…
napetrov Nov 2, 2026
f4b58f8
fix(budget): follow an @ path of a rule a CLAUDE.md imports; cut-warn…
napetrov Nov 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Added

- **`repo budget` counts `.claude/rules`** — a `.claude/rules/**/*.md` file is a `rule` entry.
A rule in the root `.claude/rules/` whose `paths` frontmatter names no pattern is `start`; one
whose `paths` does, and every rule of a subdirectory's `.claude/rules/`, is `lazy`, unless a root `CLAUDE.md` or `AGENTS.md` imports it: then it is `start` whatever its `paths`. The
frontmatter is not counted, since Claude Code removes it before loading the rule, and an `@`
path in a rule is not followed, unless a CLAUDE.md imports the rule: then the rule loads at start and its `@` imports are followed, transitively and within the hop limit. A link to a directory under `.claude/rules` is a
warning: the rules behind it are not counted. A link under `.claude/rules` that does not resolve in
the tree is named too, whatever its suffix, since the tree cannot tell a dangling file from a directory; a
`CLAUDE.md` under `.claude/rules` is a rule, not guidance. Measured on Claude Code 2.1.304: a root rule
raised the first prompt by its size, `paths: []` included; a scoped or nested one loaded only
once the agent read a file it covers; a rule's `@extra.md` was not expanded. `start` was too
low by unscoped root rules before; `repo_budget.v1` widens `kind` with `rule`. Rules are counted
for a harness profile with the new optional `guidance.claude_rules: true` (`claude-code`
only); the Codex and Copilot profiles leave it unset.
16 changes: 11 additions & 5 deletions dokimi/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,18 @@ next release.
non-empty body line, as Claude Code does. It warns on skills with no description or body text,
skills with near-duplicate descriptions (identical descriptions, or Jaccard index >= 0.5
after stop-word removal when both have 3+ words left), on AGENTS.md files turned off, on
unreadable files (non-UTF-8, dangling or out-of-tree link), and on imports past the harness's
hop limit, each of which also trips
`--fail-on-warning`. `start` is not an upper bound: it is too low by what it does not count
(`.claude/rules/*.md` files; only `@path.md` imports are followed, so `@notes.txt` adds nothing;
unreadable files (non-UTF-8, dangling or out-of-tree link), on imports past the harness's
hop limit, and on a link at or below `.claude/rules` to a directory or out of the tree (the rules behind
it are not counted), each of which also trips `--fail-on-warning`. For a profile with `guidance.claude_rules` (Claude Code),
`.claude/rules/**/*.md` files are `rule` entries: `start` in the root `.claude/rules/` when
`paths` names no pattern, `lazy` when it does or in a subdirectory's `.claude/rules/`, but `start` whatever its `paths` when a root CLAUDE.md or
AGENTS.md imports it, the frontmatter not counted. An `@` path in a rule is not followed, unless a CLAUDE.md imports
the rule: then the rule loads at start and its `@` imports are followed, transitively and within the hop limit. `start` is not an upper bound: it is too low by what it does not count
(only `@path.md` imports are followed, so `@notes.txt` adds nothing;
skills are read only from real `.claude/skills/*/SKILL.md` directories at the root, so a skill
behind a linked directory is not seen, and a nested `<subdir>/.claude/skills/` skill, which Claude
behind a linked directory is not seen, nor are the rules behind a link at or below `.claude/rules` (a warning
names it; a `.claude` link itself is neither counted nor named), and a
nested `<subdir>/.claude/skills/` skill, which Claude
Code loads on the first read in that subdirectory, is not counted; and imports past the profile's `guidance.import_max_depth`,
four hops for Claude Code, which warn naming what was skipped). It is too high by whatever the
harness cuts from the skill listing: the listing is charged in full, and the harness cuts it past
Expand Down
11 changes: 8 additions & 3 deletions dokimi/docs/repo-evaluation-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ SPDX-License-Identifier: Apache-2.0
> no LLM call): root CLAUDE.md files and their `@` imports plus the skill listing at
> start (AGENTS.md files and their imports too, unless a root CLAUDE*, `.claude/CLAUDE.md` or
> `CLAUDE.local.md` turns them off), nested guidance lazily, skill bodies on demand, and AGENTS.md
> files a root CLAUDE* turns off. The `start` total is not an upper bound: it is too low by what it does
> not count (`.claude/rules/*.md` files, non-`.md` imports, skills behind a linked directory, nested
> `.claude/skills/` skills, and
> files a root CLAUDE* turns off. For a profile with `guidance.claude_rules` (`claude-code`),
> `.claude/rules/**/*.md` files are `rule` entries: at start in the root `.claude/rules/` unless
> their frontmatter's `paths` names a pattern, lazily then and in a subdirectory's `.claude/rules/`; a rule a root CLAUDE.md or AGENTS.md
> imports is `start` whatever its `paths`;
> an `@` path in a rule is not followed, unless a CLAUDE.md imports the rule: then the rule loads at start and
> its `@` imports are followed, transitively and within the hop limit. The `start` total is not an upper bound:
Comment on lines +53 to +54

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation · low
Nit: importing a rule from a nested CLAUDE.md does not necessarily load it at start. With sub/CLAUDE.md = "@.claude/rules/r.md\n" and sub/.claude/rules/r.md = "---\npaths: src/**\n---\nbody\n", the implementation reports the rule as lazy, even with an in-limit import. Distinguish import expansion from loading time: root guidance imports load at start; nested guidance imports load lazily. The same unconditional 'then the rule loads at start' wording appears in architecture.md and the changelog fragment and should be corrected there too.

> it is too low by what it does not count (non-`.md` imports, skills behind a linked directory, rules behind a
> link at or below `.claude/rules` to a directory, which warns, nested `.claude/skills/` skills, and
> imports past the profile's `guidance.import_max_depth`, four hops for Claude Code, which warns
> naming what was skipped), and too high by whatever the harness cuts from the skill listing.
> Usage:
Expand Down
2 changes: 1 addition & 1 deletion dokimi/docs/what-it-measures.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ manifest it owns:

- `dokimi repo scan` (L0, no LLM): do the links, paths, identifiers, commands
and build labels the guidance names exist in the tree?
- `dokimi repo budget` (no LLM): how many characters of guidance and skill
- `dokimi repo budget` (no LLM): how many characters of guidance, `.claude/rules` and skill
listing every model call pays for at start-up, what loads lazily or on
demand, and which AGENTS.md files a CLAUDE.md turns off.
- `dokimi repo reach` (L1): which guidance files does a given harness actually
Expand Down
2 changes: 1 addition & 1 deletion dokimi/dokimi/commands/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def cmd_repo_budget(args: argparse.Namespace) -> None:
print(f"✗ {exc}", file=sys.stderr)
sys.exit(EXIT_USAGE)
_, tree = _source_tree(args)
payload = budget(tree, profile.guidance_names, profile.import_max_depth)
payload = budget(tree, profile.guidance_names, profile.import_max_depth, profile.reads_claude_rules)
if args.out:
try:
save_artifact("repo_budget", payload, Path(args.out))
Expand Down
Loading
Loading