Repository navigation
hygiene: add a tokens mode; make the skill line-count CI step blocking - #601
Merged
Merged
Conversation
`pyauto-brain hygiene tokens` reads the organism's token-load budgets as a finding: PyAutoMind scripts/token_load.py violations (four-organ AGENTS.md tokens, start_dev / prm procedure lines) plus skills whose SKILL.md + body exceed 200 lines. A file the scan root lacks is listed, not counted; with no Mind checkout the row is advisory, never clean. Breaches route to /refactor. It joins the default ranked scan. This is the hygiene report line PyAutoMind draft/maintenance/organs/reduce_session_token_load.md asked for. With #597 and #600 merged every skill is within 200 lines, so the tests.yml line-count step drops `continue-on-error`. It is scoped to Brain's own skills (check_skill_line_counts.sh now takes an optional repo list) so a Mind skill cannot redden a Brain PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016nhQ8NoTm1hEGXkFTcNwbd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR does two things for PyAutoMind
draft/maintenance/organs/reduce_session_token_load.md, now that #597 and #600 are merged:What changed
pyauto-brain hygiene tokens(new mode, backed byagents/conductors/hygiene/_hygiene_tokens.py). It reports one finding row that combines two measurements that already exist:scripts/token_load.py;bin/check_skill_line_counts.shfinds over 200 lines.The count is how many budgets are broken. A file the scan root simply lacks is listed but not counted. With no Mind checkout the row is
advisory, neverclean. Breaches route to/refactor. The mode also joins the default ranked scan.--detail(the human-readable mode) lists each breach..github/workflows/tests.yml: the skill line-count step losescontinue-on-error, so it now fails the PR when a skill goes over budget. It checks Brain's skills only. Mind is also checked out in this CI, and a Mind skill must not turn a Brain PR red, which is the same rule the firewall step's--onlyfollows.bin/check_skill_line_counts.sh: takes an optional list of repos after the limit (... 200 PyAutoBrain). With no list it behaves as before.Docs: the hygiene conductor's
AGENTS.md(mode table, usage, ranking list) andskills/hygiene/hygiene.mdlist the new mode.Evidence
python3 -m pytest -q -n auto tests: 1645 passed, 1 skipped. Two new tests:token_load.pyreporting one breach and one absent file gives count 1, and the detail lists both.hygiene tokensreportsclean, 0 budgets broken. The numbers it shows:check_skill_line_counts.sh: all 40 skills within budget unscoped, 38 when scoped to Brain. Scoping to Mind with a limit of 100 correctly flags one skill.install.sh --check-project-discovery: Brain, Mind and Memory OK (the Memory fix is PyAutoLabs/PyAutoMemory, linked from the Mind ledger).Decision taken
Scoping the blocking step to Brain's own skills was my choice; the prompt didn't settle it. Without it, a Mind skill that grew past 200 lines would merge green in Mind, because Mind's CI doesn't run this check, and then turn every Brain PR red.
Not checked
Generated by Claude Code