Skip to content

feat(simplify-code): risk-tiered application, Chesterton's Fence, slop + silent failure detection - #49070

Merged
teknium1 merged 2 commits into
mainfrom
salvage/42209-simplify-code-tiers
Jun 19, 2026
Merged

teknium1 merged 2 commits into
mainfrom
salvage/42209-simplify-code-tiers

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

The simplify-code skill now applies findings in explicit risk tiers (SAFE / CAREFUL / RISKY) instead of flat, and teaches its reviewers Chesterton's-Fence-via-git blame, AI-slop detection, and silent-failure detection.

Salvage of #42209 by @Sahil-SS9 onto current main (authorship preserved via cherry-pick).

Changes

  • skills/software-development/simplify-code/SKILL.md (+45/-8):
    • Risk tiers — every finding carries confidence AND risk: SAFE (auto-apply: dead code, unused imports, pass-throughs), CAREFUL (apply + verify per file: renames, ternary flattening, helper extraction), RISKY (flag for human review, never auto-apply: N+1 restructuring, public-API renames, concurrency/error-handling changes).
    • Chesterton's Fencegit blame a line before flagging it for removal; if you can't determine why it exists → confidence: low, don't guess.
    • Slop detection (Reviewer 2) — restating-the-obvious comments, defensive null-checks on validated inputs, as any casts, file-inconsistent patterns.
    • Silent-failure detection (Reviewer 3) — empty catch blocks, ignored error returns, except: pass, .catch(() => {}); log before swallowing.
    • Apply in tier order, dry-run presents all tiers and applies nothing; pitfalls added for over-trusting dead-code tools, renaming public contracts, and removing intentional error handling.

Validation

  • Skill-content-only change (no code path to test). Frontmatter description unchanged (48 chars, ≤60). Prose references native Hermes tools (read_file, search_files, git blame).

Closes #42209.

Infographic

risk-tiered-code-simplification

Sahil-SS9 and others added 2 commits June 19, 2026 06:58
… slop + silent failure detection

Five targeted enhancements to the upstream simplify-code skill:

1. Risk-tiered application (SAFE/CAREFUL/RISKY) — safe changes auto-applied,
   careful changes verified per-file, risky changes flagged for human review.
   Prevents auto-applying N+1 restructures and public API renames.

2. Chesterton's Fence — before flagging anything for removal, reviewers run
   'git blame' to understand why it exists. Low-confidence findings are
   escalated rather than guessed.

3. AI slop detection — Quality reviewer now catches: extra comments restating
   obvious code, unnecessary defensive null-checks on validated inputs, 'as any'
   casts, and patterns inconsistent with the rest of the file.

4. Silent failure detection — Efficiency reviewer now catches: empty catch
   blocks, ignored error returns, except:pass, .catch(()=>{}) with no handling,
   and error propagation gaps.

5. Structured reviewer output with confidence+risk tags — reviewers report in
   'file:line → problem → fix | confidence: H/M/L | risk: SAFE/CAREFUL/RISKY'
   format, enabling the orchestrator to tier the application.

Plus 3 new pitfalls: over-trusting dead code tools, public contract awareness,
and preserving intentional error handling.

Total: +45/-8 lines. Keeps the 212-line compact spirit.

Ref: #379
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: salvage/42209-simplify-code-tiers vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 11059 on HEAD, 11061 on base (✅ -2)

🆕 New issues (1):

Rule Count
invalid-assignment 1
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`

✅ Fixed issues (2):

Rule Count
unresolved-attribute 2
First entries
run_agent.py:2971: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`

Unchanged: 5789 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have labels Jun 19, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Approved

Risk-tiered application (SAFE/CAREFUL/RISKY), Chesterton's Fence discipline, and slop + silent failure detection are all well-constructed additions to the simplify-code skill. The structured output format with confidence and risk tiers is a clear improvement over the flat high/medium/low confidence model.

Looks Good

  • Risk-tiered apply order (SAFE first, CAREFUL with verification, RISKY flagged) is the right priority
  • Chesterton's Fence requirement prevents false-positive dead-code removal
  • AI slop patterns (obvious comments, unnecessary null-checks, as any casts) are real problems worth detecting
  • Silent failure detection (except:pass, empty catch) is a valuable safety net
  • New pitfalls (over-trusting dead code tools, renaming public contracts, removing error handling) are all practical
  • Author attribution in release.py is trivially correct

Reviewed by Hermes Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants