Skip to content

fix(TAP-1876): name the file-based remediation in validate-command.sh denial + ship python-introspection skill#20

Merged
wtthornton merged 1 commit into
mainfrom
tap-1876-python-introspection-friction
May 16, 2026
Merged

fix(TAP-1876): name the file-based remediation in validate-command.sh denial + ship python-introspection skill#20
wtthornton merged 1 commit into
mainfrom
tap-1876-python-introspection-friction

Conversation

@wtthornton
Copy link
Copy Markdown
Owner

Summary

Claude burned ~28 of 50 loops in the 2026-05-15 → 2026-05-16 tapps-brain campaign retrying python3 -c "…" for read-only introspection. The hook correctly denied each attempt, but the denial message said nothing about the workaround — file-based execution is allowed and trivial.

  • templates/hooks/validate-command.sh section 4 now emits the BLOCKED line WITH a per-interpreter remediation suggesting the right /tmp/ extension (.py/.js/.pl/.rb/.sh). .ralph/ runtime copy kept byte-identical per the TAP-624 parity rule.
  • New Tier-B skill at templates/skills/global/python-introspection/ — decision ladder (Read/Grep first, then file-based script, then project-tree snippet) with one worked example + anti-pattern list.
  • lib/skill_retro.sh gains an interpreter_dash_c_denials friction signal — at ≥3 BLOCKED lines matching (python|python3|perl|ruby|node|bash|sh|zsh) -[ce], skill_retro_apply auto-installs the new skill.

Test plan

  • tests/unit/test_validate_command.bats (+15 cases): BLOCKED + remediation text for all 7 interpreters, file-based invocations stay allowed, skill files exist + describe remediation, friction detector gates at the 3-denial threshold, byte-parity guard
  • Full unit suite — 1741/1741 pass
  • Full integration suite — 203/203 pass

🤖 Generated with Claude Code

… denial + ship python-introspection skill

Claude burned ~28 of 50 loops in the 2026-05-15 → 2026-05-16 tapps-brain
campaign retrying `python3 -c "…"` for read-only introspection. The hook
correctly denied each attempt, but the denial message said nothing about
the workaround — file-based execution is allowed and trivial.

Three changes, all of which carry the same answer (`python3 /tmp/snippet.py`)
to a different surface:

1. templates/hooks/validate-command.sh section 4 now emits the
   BLOCKED line WITH a per-interpreter remediation suggesting the
   right /tmp/ extension (.py / .js / .pl / .rb / .sh) and the
   file-based invocation Claude should use instead. The .ralph/
   runtime copy is kept byte-identical per the TAP-624 parity rule.

2. New Tier-B skill at templates/skills/global/python-introspection/
   walks a decision ladder — Read/Grep first, then file-based script,
   then a project-tree snippet for repeated use — with one worked
   example (import + version check) and an explicit anti-pattern list.

3. lib/skill_retro.sh gains a new friction signal:
   interpreter_dash_c_denials. When the rolling window catches ≥3
   BLOCKED lines matching `(python|python3|perl|ruby|node|bash|sh|zsh) -[ce]`,
   skill_retro_apply auto-installs python-introspection so the next
   loop reaches for the file-based path instead.

The 15 new bats cases cover BLOCKED + remediation text for all seven
interpreters, confirm file-based invocations still pass through, gate
the friction-detector at the 3-denial threshold, and re-assert the
template/.ralph byte-parity invariant. Full unit (1741) + integration
(203) suites green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wtthornton wtthornton merged commit 8fe15c6 into main May 16, 2026
3 checks passed
@wtthornton wtthornton deleted the tap-1876-python-introspection-friction branch May 16, 2026 21:06
wtthornton added a commit that referenced this pull request May 16, 2026
…1876, TAP-1877)

Cuts 2.15.1 over the 2026-05-15 → 2026-05-16 tapps-brain log review.
All three tickets land as fixes to observable regressions in the
coordinator brief flow, the validate-command.sh denial UX, and the
post-run Execution stats WARN line.

- TAP-1875 (#19) — coordinator brief.json missing on ~88% of cache-miss
  spawns. Tighter agent contract + harness-side prompt + one-time retry
  + brain_learn_failure regression signal.
- TAP-1876 (#20) — python3 -c friction in validate-command.sh denial
  flow. Remediation message + Tier-B python-introspection skill +
  skill_retro auto-install hook.
- TAP-1877 (#21) — '(00 scope, N system)' double-zero leak in Execution
  stats WARN. Replaced `grep -c | echo 0` idiom with documented
  `tr -cd '0-9' || true` pattern; extracted into testable helper.

CLAUDE.md "Coordinator brief" section updated with the TAP-1875 retry +
brain_learn invariants. Unit suite 1751/1751 green, integration 203/203
green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant