Repository navigation
fix(engine): Match a declared Behavior however the model capitalises it - #233
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4 tasks done
omesser
added a commit
that referenced
this pull request
Sep 2, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
omesser
added a commit
that referenced
this pull request
Sep 2, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4 tasks done
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.
Closes #231.
ModelDirector::knowscompared a proposed Behavior name to the declared ones with==, and models write the name at the start of a line, so they capitalise it: every local model measured in #175 answeredProwlwhere the manifest declaresprowl. The reply was refused,as_speechcaught the whole thing, and it reached the user as dialogue with the Behavior name stuck on the front. The buddy talked and never acted.What changed
declared(name)replacesknows(name): it compares without case and returns the Character's own spelling, which the proposal is then rebuilt with. Case-insensitive matching alone would not have been enough — the Engine looks a Behavior up by its declared name, so a proposal still carryingProwlwould have found nothing downstream. The test asserts the declared spelling, not merely that the reply was accepted.saybeside it was already matched witheq_ignore_ascii_case; this is the same rule for the name next to it, which is why this reads as removing an inconsistency rather than loosening a check. The duplicated speech-or-fail fallback is extracted intospoken_or_failed.Measured, not just tested
The same 40-wake harness from #230, against the same two local models, before and after:
gemma4:latest8Bllama3.2:1bThe case-only bucket is empty in both runs. What remains is the models' real contract-break rate, unchanged by this PR — which is the number #144 should argue from.
It does not invent Behaviors
The looser comparison only ever matches something a Character declared. Pinned by a second test using
Check, the exact invented namellama3.2:1bproduced during the measurement, and visible in the runs above:gemma4's remaining prose reply wasSulksand the 1B's weredelightandwatch— none of them declared by cat, all correctly spoken rather than played.Verify
cargo test --all-targets(514) andnode --test tests/(26) green.a_declared_behavior_is_known_however_the_model_capitalises_itwas written first and observed red against main.AI_BUDDY_DIRECTOR_BASE_URL=http://localhost:11434 AI_BUDDY_DIRECTOR_MODEL=gemma4 cargo test -p ai-buddy measure_the_reply_contract -- --ignored --nocaptureOnce this and #230 are both in, the README's "contract kept" column is the accepted column, and that paragraph wants a sentence saying so.
🤖 Generated with Claude Code