Skip to content

fix: comprehension-first guard + reuse rung (#245, #217) - #253

Merged
DietrichGebert merged 1 commit into
mainfrom
fix/issue-245-217-comprehension-reuse
Jun 22, 2026
Merged

DietrichGebert merged 1 commit into
mainfrom
fix/issue-245-217-comprehension-reuse

Conversation

@DietrichGebert

Copy link
Copy Markdown
Owner

Fixes two behavioural issues with the ruleset.

#245 "Dangerously lazy"

The "shortest diff wins" reflex made the agent patch the nearest symptom instead of tracing the problem and shipping a confident wrong fix. The fix adds a comprehension-first guard plus the part that actually changed behaviour — an operational directive:

Bug fix = root cause, not symptom. Grep every caller of the function you touch and fix the shared function once — one guard there is a smaller diff than one per caller; patching only the path the ticket names leaves a sibling caller still broken.

Framing the root-cause fix as the lazier (smaller) diff makes ponytail's own instinct pull toward it.

Validated on the agentic benchmark. New trace-transfer task: transfer() and withdraw() both debit through a shared _debit(); the report names transfers, the scorer exercises an un-named overdrawing withdraw, so only a fix that traces the flow and repairs _debit() passes.

model baseline ponytail (this PR)
Sonnet 4.6 (issue's model) 1/6 6/6
Opus 4.8 1/6 6/6 (held across 4 runs)

All passing cells repair the shared _debit() (verified by reading the code). A control confirms it's the operational wording: pre-fix ponytail and a plain-prose version both scored 0/3 on Opus; only the grep-the-callers directive reached 6/6.

#217 "Missing rung"

Adds ladder rung 2 — "Already in this codebase? Reuse it, don't re-write it." Propagated across SKILL.md, AGENTS.md, all agent mirror copies, the hook fallback, and both READMEs (check-rule-copies passes). Note: in benchmarking, both baseline and ponytail already reuse existing helpers, so the rung is correct guidance that regresses nothing, but its behavioural benefit didn't reproduce to measure (see writeup).

Benchmark additions

  • 4 deterministic quality-tier tasks (reuse-slug, reuse-money, trace-transfer, trace-amount), each with --selftest-proven good/bad refs.
  • Harness: multi-file seed support in --selftest, distinctive-behaviour reuse detection, and counting in-file __main__/demo() self-checks as test LOC (not source bloat) on surgical tasks.
  • Full writeup: benchmarks/results/2026-06-22-issue-245-217-comprehension.md.

Regression check

Pre-fix vs post-fix across the 27-task runnable suite (Haiku, n=3): safety identical (all 7 deterministic safety tasks 1.0 before and after — no guard dropped), LOC cuts preserved, correctness unchanged within noise.

Closes #245
Closes #217

#245 "Dangerously lazy": add an operational "fix the root cause, not the
symptom" directive — grep every caller of the function you touch and fix the
shared function once (the smaller diff). Validated on the agentic benchmark: on
a shared-helper bug-fix trap, baseline fixes the root cause 1/6 while ponytail
does 6/6 on both Sonnet 4.6 (the model the issue was filed on) and Opus 4.8,
verified by reading the produced code. Plain prose ("trace the flow") did not
move it; the actionable, lazy-framed directive did.

#217 "Missing rung": add ladder rung 2 "Already in this codebase? Reuse it,
don't re-write it." Propagated across SKILL.md, AGENTS.md, all agent mirror
copies, the hook fallback, and both READMEs (check-rule-copies passes).

Benchmark: 4 new deterministic quality-tier tasks (reuse-slug, reuse-money,
trace-transfer, trace-amount) with selftest-proven good/bad refs; harness gains
multi-file seed support in --selftest, distinctive-behaviour reuse detection,
and counts in-file __main__/demo() self-checks as test LOC (not source bloat)
for surgical tasks. Full writeup in
benchmarks/results/2026-06-22-issue-245-217-comprehension.md.

Also carries the in-progress todo-null benchmark task already present in the
working tree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@DietrichGebert
DietrichGebert merged commit dedc97c into main Jun 22, 2026
1 check passed
@DietrichGebert
DietrichGebert deleted the fix/issue-245-217-comprehension-reuse branch June 22, 2026 21:30
DietrichGebert pushed a commit that referenced this pull request Jul 9, 2026
The reuse rung added in #253 ("Already in this codebase? Reuse it, don't
re-write it.") is load-bearing now, but it was not in the INVARIANTS list,
so a future reword could silently drop it from SKILL.md or AGENTS.md without
tripping the check. Pin it with the substring "in this codebase", present in
both files' rung 2, the same way the safety carve-outs are pinned.

Co-authored-by: Rafaelpta <15382305+Rafaelpta@users.noreply.github.com>
Afristrat pushed a commit to Afristrat/ponytail that referenced this pull request Sep 29, 2026
…richGebert#217) (DietrichGebert#253)

DietrichGebert#245 "Dangerously lazy": add an operational "fix the root cause, not the
symptom" directive — grep every caller of the function you touch and fix the
shared function once (the smaller diff). Validated on the agentic benchmark: on
a shared-helper bug-fix trap, baseline fixes the root cause 1/6 while ponytail
does 6/6 on both Sonnet 4.6 (the model the issue was filed on) and Opus 4.8,
verified by reading the produced code. Plain prose ("trace the flow") did not
move it; the actionable, lazy-framed directive did.

DietrichGebert#217 "Missing rung": add ladder rung 2 "Already in this codebase? Reuse it,
don't re-write it." Propagated across SKILL.md, AGENTS.md, all agent mirror
copies, the hook fallback, and both READMEs (check-rule-copies passes).

Benchmark: 4 new deterministic quality-tier tasks (reuse-slug, reuse-money,
trace-transfer, trace-amount) with selftest-proven good/bad refs; harness gains
multi-file seed support in --selftest, distinctive-behaviour reuse detection,
and counts in-file __main__/demo() self-checks as test LOC (not source bloat)
for surgical tasks. Full writeup in
benchmarks/results/2026-06-22-issue-245-217-comprehension.md.

Also carries the in-progress todo-null benchmark task already present in the
working tree.

Co-authored-by: Dietrich Gebert <dgebert@Dietrichs-MacBook-Pro.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dangerously lazy Missing rung: did I already write this here?

1 participant