fix: add write-hygiene guardrails to skill review prompts (prevent SKILL.md bloat) - #23288
Open
gejifeng wants to merge 1 commit into
Open
fix: add write-hygiene guardrails to skill review prompts (prevent SKILL.md bloat)#23288gejifeng wants to merge 1 commit into
gejifeng wants to merge 1 commit into
Conversation
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thank you for identifying the completion-bias issue; it remains present on current main in agent/background_review.py:171-175 and :282-284.
Problems
- The prompt source moved:
run_agent.py:1576-1582imports these constants fromagent.background_review, so therun_agent.pyportion needs to be ported rather than applied directly. - The proposed hard checks run for all
create/edit/patchcallers. Current main deliberately distinguishes autonomous review from foreground user-directed edits intools/skill_manager_tool.py:297-312; please avoid applying heuristic date/heading/growth rejections to foreground writes. - The PR replaces
tests/tools/test_skill_manager_tool.pywith+62/-907. Please retain the existing unrelated regression coverage and add focused tests instead.
Suggested changes
- Port the prompt change to
agent/background_review.py. - Build on the existing background-review read-before-write guard at
tools/skill_manager_tool.py:382-409(commit20871c1d941a697723aae24cd8e88afe701793ae) and scope any new autonomous-only enforcement accordingly.
Automated hermes-sweeper review.
| @@ -1,945 +1,100 @@ | |||
| """Tests for tools/skill_manager_tool.py — skill creation, editing, and deletion.""" | |||
| """Tests for tools/skill_manager_tool.py write-hygiene checks.""" | |||
Contributor
There was a problem hiding this comment.
Please retain the existing test module and add focused hygiene cases to it. This rewrite removes 907 lines of unrelated CRUD, validation, path-safety, external-directory, dispatcher, and pinned-skill coverage while adding only 62 lines.
gejifeng
force-pushed
the
fix/skill-review-completion-bias
branch
from
July 14, 2026 10:36
7b980d0 to
6ac681f
Compare
Author
|
Addressed the latest review and rebased the PR onto current Changes:
Local verification:
|
gejifeng
force-pushed
the
fix/skill-review-completion-bias
branch
from
July 14, 2026 10:43
6ac681f to
c5ccd95
Compare
This was referenced Jul 28, 2026
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.
Problem
The background skill-review agent continuously inflates
SKILL.mdfiles across sessions. Root causes:_SKILL_REVIEW_PROMPTsaid "most sessions produce at least one skill update", so the model treats no-op as a failure.skill_viewfirst, so it cannot detect duplicate content.Updated 2026-05-10,NEW — Session ...) that accumulate across sessions.Related upstream discussions: #12877, #20595, #22620.
Fix — two-layer defence
Layer 1 — Prompt-level (run_agent.py)
In both
_SKILL_REVIEW_PROMPTand_COMBINED_REVIEW_PROMPT:"Be ACTIVE — most sessions produce at least one skill update"(the completion-bias trigger).patchoveredit, treat nothing to save as the correct default.Layer 2 — Code-level hard rejection (tools/skill_manager_tool.py)
Added
_run_write_hygiene()called by_edit_skill()and_patch_skill()before any bytes hit disk. It contains three independent hard-rejection checks that return tool-call errors, forcing the model to fix the content rather than ignoring prompt instructions:_check_date_stamps()Updated 2026-05-10,Added 2024-11,<!-- session … -->etc.editandpatch_check_duplicate_headings()##heading appears twice in new contenteditandpatch_check_content_growth()editonlyThe growth guard is disabled for
patch(targeted by design); date-stamp and duplicate-heading checks apply to both.Why prompt-only is insufficient
As noted in #20595: "Completion bias is a cognitive failure mode, not a prompt-attention failure." The model will comply with soft wording when convenient and ignore it when under pressure to produce output. Code-level checks are the only way to guarantee enforcement.
Testing