fix(skill): capture refinements when prompt contradicts surfaced decision (#154)#163
Conversation
…sion (#154) Adds Step 5.6 to bicameral-preflight: when a user's prompt contradicts a decision the surfaced block just rendered, mechanically ingest the refinement with source=agent_session and call bicameral.resolve_collision to wire it to the seed. Three actions documented (supersede / keep_both / link_parent) so the agent can pick mechanically without asking. The user has already stated the refinement explicitly; PM ratifies the supersession in the inbox. Closes #154. Validation: tests/e2e/run_e2e_flows.py Flow 2a should flip FAIL → PASS without any other change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…#154) Step 5.6 of skills/bicameral-preflight (added by #163) instructs the agent to ingest a refinement with source=agent_session and call resolve_collision when the user's prompt contradicts a surfaced decision. Skill-instruction adherence isn't reliable: e2e Flow 2a fails on dev with "saw 0 ingest call(s), none with agent_session" even though preflight surfaced the right seed. Same pattern that closed #146: a Claude Code hook bypasses skill adherence by injecting a system-reminder into the agent's next-turn context. #146 used UserPromptSubmit + a verb classifier; this PR uses PostToolUse scoped to mcp__bicameral__bicameral_preflight, with the "contradiction signal" being "preflight returned ≥1 decision." The reminder is conditional ("IF your prompt contradicts ...") because preflight has no view of the user prompt; the LLM gates applicability. Symmetric to the UserPromptSubmit hook that over-fires on any implementation verb and lets the skill be the gate. Closes #154. Files: - scripts/hooks/post_preflight_capture_reminder.py — new hook - tests/test_post_preflight_capture_hook.py — 8 cases (fired, silent, JSON-string vs dict response, malformed stdin, idempotent) - pyproject.toml — bicameral-mcp-collision-capture-reminder console script - setup_wizard.py — _BICAMERAL_COLLISION_CAPTURE_REMINDER_COMMAND + _BICAMERAL_PREFLIGHT_TOOL_NAME constants; new PostToolUse entry (matcher=mcp__bicameral__bicameral_preflight) merged into _install_claude_hooks - tests/e2e/_harness_setup.py — second PostToolUse entry materialized alongside the existing Bash matcher - .claude/settings.json — dogfood entry invoking the source script directly - skills/bicameral-preflight/SKILL.md — Hook reinforcement subsection documenting that the hook templates Step 5.6
Summary
skills/bicameral-preflight/SKILL.md: when the user's prompt contradicts a decision the surfaced block just rendered, mechanically ingest the refinement withsource=agent_sessionand callbicameral.resolve_collisionto wire it to the seed.actionvalues (supersede/keep_both/link_parent) so the agent can pick mechanically without asking — the user has already stated the refinement explicitly.Closes #154.
Why P0
Without this,
bicameral.preflightsurfaces contradictions but the correction-capture loop dies — every dev refinement that doesn't survive the session is a silent failure of the bicameral product's central differentiator (dev contradicts spec → bicameral catches → refinement captured → PM ratifies).The v0.9.3 server-side supersession-detection removal moved this cognition onto the agent. This PR teaches the agent to do it.
Test plan
tests/e2e/run_e2e_flows.pyagainst the pinneddesktop/desktopcommit. Flow 2a should flip FAIL → PASS without any other change.bicameral.ingest(source="agent_session")followed bybicameral.resolve_collision(action="supersede")before any code work.keep_bothandlink_parentare not selected when the user's intent is clearly "replace" — the kind heuristics in the step should bias towardsupersedefor replacement signals.Out of scope
handlers/ingest.py:262-263).bicameral-capture-corrections).🤖 Generated with Claude Code