Skip to content

Add reflection: async dissonance detection#18

Open
tkellogg wants to merge 2 commits intomainfrom
reflection-feature
Open

Add reflection: async dissonance detection#18
tkellogg wants to merge 2 commits intomainfrom
reflection-feature

Conversation

@tkellogg
Copy link
Copy Markdown
Owner

@tkellogg tkellogg commented Mar 4, 2026

Summary

  • Adds async self-review after each send_message — the agent's own model evaluates outgoing messages against criteria in a user-editable markdown file
  • When dissonance is detected (confidence >= 0.7), a 🪞 reaction appears on the sent message
  • Off by default (reflection.enabled: false), trivially enabled via config.yaml
  • New builtin dissonance skill explains what 🪞 means and how to tune it
  • Default criteria pre-populated from Strix's proven dissonance patterns (service wrap-ups, hollow validation, stance avoidance, ball-handing)

Architecture

  • reflection.pyReflectionHook class, fired from send_message after successful delivery
  • Fire-and-forget via asyncio.create_task — does not block message delivery
  • Side-effect only — result is NOT injected into the agent's conversation context
  • Questions file read fresh each evaluation, so edits take effect immediately
  • Uses the agent's configured model (not a separate API key)

Config

reflection:
  enabled: false
  questions_file: state/is-dissonant-prompt.md

Visible in default config with explanatory comment. The questions file path lets the user know where to look.

Files changed

File Change
open_strix/reflection.py Core reflection logic (201 lines)
open_strix/config.py ReflectionConfig dataclass + parsing
open_strix/app.py Hook initialization on startup
open_strix/tools.py 6-line hook call after send_message
open_strix/builtin_skills/dissonance/SKILL.md Skill docs (what 🪞 means, tuning)
open_strix/builtin_skills/dissonance/default-questions.md Pre-populated criteria
SETUP.md Config reference docs
tests/test_reflection.py 23 tests

Test plan

  • 23 new tests covering config parsing, questions file reading, hook behavior (skip empty, skip missing file, dissonance detected, no dissonance, low confidence, null result), and builtin skill discovery
  • Full suite: 183 passed, 0 regressions (1 pre-existing uv PATH failure in onboarding test)
  • Manual test: enable on Motley or Verge, verify 🪞 appears on appropriate messages

🤖 Generated with Claude Code

claude added 2 commits March 4, 2026 02:25
When enabled, each outgoing message is evaluated against user-defined
criteria in a markdown file. If dissonance is detected (confidence >= 0.7),
a 🪞 reaction is added to the sent message.

- New builtin skill: dissonance (explains 🪞 reactions, tuning guide)
- Config: reflection.enabled (false by default) + questions_file path
- Pre-populated default criteria (service wrap-ups, hollow validation, etc.)
- 23 new tests, all passing (183 total, 0 regressions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…in_skills

Both features are independent additions to AppConfig and load_config.

Co-Authored-By: Claude Opus 4.6 <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.

2 participants