Skip to content

docs(AGENTS.md): when the frame budget outweighs a shared predicate - #556

Merged
derek73 merged 1 commit into
masterfrom
claude/agents-md-frame-budget
Sep 29, 2026
Merged

derek73 merged 1 commit into
masterfrom
claude/agents-md-frame-budget

Conversation

@derek73

@derek73 derek73 commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Adds one bullet to AGENTS.md's 2.0 conventions: frames are a budget for hot and scaling paths; everywhere else, prefer the shared predicate.

Why. The conventions asked for frame cost on hot paths but gave no way to weigh a frame against readability. On #552 the cleanup pass treated "no added frames" as a hard rule and declined is_title_piece for a single frame on comma credential runs: 24 ns a parse, no guard moved.

What it says.

  • The scale of one frame, measured 2026-09-28 on py3.11: a trivial call costs about 13 ns, against 40–80 µs for a whole parse, so one frame per parse is roughly 0.03% of it.
  • Four questions, in order:
    1. Does the cost multiply with the input?
    2. How many names pay it?
    3. Does it move an enforced guard (the ±2% _CALL_BASELINE band, or a scaling ratio)?
    4. What does the inline alternative cost to maintain? A drifting copy of a predicate is mechanisms.md#ONE-PREDICATE-PER-QUESTION; a narrower question stated exactly is not a copy.
  • The converse from Parsing slows quadratically for a long given part after a family comma (Doe, Jane …) #553: the frame counter cannot see C-level work such as x in some_list, so "no new frames" is not "no new cost".

Docs only; the doc tests pass.

🤖 Generated with Claude Code

The 2.0 conventions asked for frame cost on hot paths but never said how
to weigh a frame against readability, and #544's cleanup applied "no
added frames" as a hard rule: it declined is_title_piece for one frame
on comma credential runs (24 ns a parse, no guard moved). A new bullet
states the measured scale of one frame (about 13 ns against 40-80 us a
parse, py3.11, 2026-09-28) and four questions to weigh it by: does it
multiply with the input, how many names pay it, does it move an
enforced guard, and what does the inline alternative cost to maintain.
It also records the converse #553 showed: the frame counter cannot see
C-level work, so no new frames is not no new cost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added the docs Documentation fixes and updates label Sep 29, 2026
@derek73 derek73 self-assigned this Sep 29, 2026
@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.85%. Comparing base (003b496) to head (3068de8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #556   +/-   ##
=======================================
  Coverage   98.85%   98.85%           
=======================================
  Files          45       45           
  Lines        3934     3934           
=======================================
  Hits         3889     3889           
  Misses         45       45           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@derek73
derek73 merged commit 09a5749 into master Sep 29, 2026
11 checks passed
@derek73
derek73 deleted the claude/agents-md-frame-budget branch September 29, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation fixes and updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant