feat(kennel): strip personality emote lines before storing drawers#485
Open
SrividyaGanapathi wants to merge 2 commits into
Open
feat(kennel): strip personality emote lines before storing drawers#485SrividyaGanapathi wants to merge 2 commits into
SrividyaGanapathi wants to merge 2 commits into
Conversation
Code Puppy's playful emotes (*wags tail excitedly*, *zooms around*) were stored verbatim in the kennel and packed back into the system prompt each session, wasting ~23% of the token budget on noise with zero memory value. Add `_strip_noise()` to recorder.py that removes lines matching the RPG emote pattern (*...*) while preserving code fences, bold text, bullet points, and inline italics. Controlled by PUPPY_KENNEL_STRIP_NOISE env var (default on). Evals on a representative mixed response: - 23.5% char reduction per drawer (~42 tokens saved) - Packer fits 8 → 11 drawers in the 1500-token budget (+37%) - Latency: <1ms even at max drawer size (32k chars) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- F541: remove f-prefix from strings without placeholders (lines 282, 333) - F841: remove unused variable `pure_emote` (line 311) - E741: rename ambiguous loop variable `l` to `line` (line 363) - ruff format: apply auto-formatting Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
_strip_noise()torecorder.pythat removes Code Puppy personality emote lines (e.g.*wags tail excitedly*,*zooms around happily*) before a response is stored as a kennel drawerPUPPY_KENNEL_STRIP_NOISEenv var toconfig.py(defaulton) so users can opt out without code changestests/plugins/test_puppy_kennel_recorder.pywith 13 correctness tests and 3 quantitative evalsProblem
Agent responses were stored verbatim, including personality emotes. These got packed back into the system prompt each session, consuming token budget with zero memory signal.
How it works
The sanitizer processes responses line-by-line before
add_draweris called:^\s*\*(?!\*)[^*\n]+\*\s*$(the RPG emote pattern)```is never touched**bold**,* bullets, and inline*italic*mid-sentence untouchedEvals (measured on a representative mixed response)
Test plan
_strip_noise()strips emote linesrecord_run_endno-ops (no drawer written)PUPPY_KENNEL_STRIP_NOISE=0disables filtering end-to-end🤖 Generated with Claude Code