Weave 5 Whys into harness failure response paths#81
Merged
Conversation
Four integration points (cycle detection was PR #80): 1. System prompt: route introspection → 5 Whys when patterns emerge, and route prediction misses to structured reflection 2. Post-turn failure context: when a turn ends with an error or circuit breaker, inject reflection guidance into the next turn's prompt 3. Prediction-review → 5 Whys bridge: SKILL.md now guides agents to decompose surprising misses via 5 Whys instead of just logging false 4. Chat history scan: prediction-review scheduled job now also scans recent chat for corrections, error reactions, and repeated attempts The 5 Whys skill existed but nothing routed agents toward it when failure happened. Now four paths converge on it: introspection findings, prediction misses, circuit breaker events, and chat history patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jptreen
pushed a commit
to jptreen/open-strix
that referenced
this pull request
Apr 11, 2026
Merged upstream changes: - PR tkellogg#80: Cycle detection prompts reflection instead of just stopping - PR tkellogg#81: Five-whys integration into harness failure paths - PR tkellogg#82: Five-whys chainlink docs - PR tkellogg#83: Phone book → JSONL migration + alias enrichment Conflict resolution: - app.py: Kept both _withhold_final_text (ours) and _last_turn_failure (upstream) - prompts.py: Preserved auto-send model while adding aliases/failure sections - tools.py: Added missing file tools to tools list (read_file, glob_files, edit_file, write_file) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Merged
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.
Summary
prediction_true: falsePR #80 already covers cycle detection (integration point #2). This PR covers the remaining four.
The core problem: the 5 Whys skill existed as a callable tool but nothing in the harness actually routed agents toward it when failure happened. Like a fire extinguisher in a locked cabinet with no sign. Now four paths converge on it.
Files changed
prompts.py— Two new skill routing bullets in system prompt (introspection→5Whys, prediction miss→5Whys)app.py—_last_turn_failurefield captures error/circuit-breaker context, injected into next turn viarender_turn_promptconfig.py— Default scheduler job expanded: prediction misses trigger 5 Whys, plus chat history failure scanprediction-review/SKILL.md— New "When a Prediction Misses" section with 5 Whys routing criteriaTest plan
render_turn_promptaccepts optionallast_turn_failureparam (backward compatible, defaults toNone)🤖 Generated with Claude Code