Skip to content

fix(skill): capture refinements when prompt contradicts surfaced decision (#154)#163

Merged
jinhongkuan merged 1 commit into
devfrom
fix/154-resolve-collision-on-contradiction
May 3, 2026
Merged

fix(skill): capture refinements when prompt contradicts surfaced decision (#154)#163
jinhongkuan merged 1 commit into
devfrom
fix/154-resolve-collision-on-contradiction

Conversation

@jinhongkuan

Copy link
Copy Markdown
Contributor

Summary

  • Adds Step 5.6 to skills/bicameral-preflight/SKILL.md: when the 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.
  • Documents three action values (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.preflight surfaces 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

  • Run tests/e2e/run_e2e_flows.py against the pinned desktop/desktop commit. Flow 2a should flip FAIL → PASS without any other change.
  • Confirm Flow 2 (auto-fire) still PASSES — Step 5.6 fires after the surfaced block renders, not before.
  • Manual sanity: in normal mode, ingest a roadmap decision, then submit a contradicting prompt — agent should call bicameral.ingest(source="agent_session") followed by bicameral.resolve_collision(action="supersede") before any code work.
  • Spot-check that keep_both and link_parent are not selected when the user's intent is clearly "replace" — the kind heuristics in the step should bias toward supersede for replacement signals.

Out of scope

  • Server-side auto-detection of contradictions (deliberately removed in v0.9.3 per handlers/ingest.py:262-263).
  • Multi-turn correction capture (already owned by bicameral-capture-corrections).

🤖 Generated with Claude Code

…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>
@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d1aaebf1-a138-463b-b7b8-bd7f536e6a04

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/154-resolve-collision-on-contradiction

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jinhongkuan jinhongkuan merged commit 51e631d into dev May 3, 2026
7 of 8 checks passed
jinhongkuan added a commit that referenced this pull request May 3, 2026
…#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
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