feat(puppy_kennel): kennel_forget + kennel_update tools + fix /kennel search scope bug#487
Open
SrividyaGanapathi wants to merge 1 commit into
Open
Conversation
…nnel search scope Three improvements to the puppy_kennel plugin: * kennel_forget(drawer_id) — permanently delete a drawer by ID. Returns a content preview so the agent can verify the right row was removed. FTS index stays in sync via the existing drawers_ad trigger in schema.py. * kennel_update(drawer_id, new_content) — replace a drawer's content by ID. FTS index updated automatically via the drawers_au trigger. * /kennel search bug fix — _cmd_search was hardcoded to "code-puppy" as the agent name, so only default-agent drawers were ever searched. Now resolves the active agent via get_current_agent_name() with fallback. Seven new tests cover: happy paths, missing-ID errors, empty-content guards, content-preview truncation, and FTS index consistency after update. 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
kennel_forget(drawer_id)— permanently delete a drawer by ID. Returns a preview of the deleted content so the agent can confirm it removed the right memory. FTS index stays in sync automatically via the existingdrawers_adtrigger inschema.py.kennel_update(drawer_id, new_content)— replace a drawer's content in-place by ID. FTS index updated automatically via thedrawers_autrigger. Both tools follow the same pattern as the existing five kennel tools: pydanticBaseModeloutput,@agent.tooldecorator, never raises.Bug fix:
/kennel searchhardcoded agent name —_cmd_searchwas callingdefault_recall_scope("code-puppy", ...)regardless of the active agent, so any agent other than the default would never see its ownagent:<name>wing in search results. Fixed by resolving the active agent viaget_current_agent_name()with a safe fallback to"code-puppy".Design rationale
kennel_forgetandkennel_updateare intentionally ID-based rather than query-based. The agent workflow is: callkennel_recallto find the relevant drawer (BM25 handles ranking), read the returnedid, then callkennel_forget/kennel_updatewith that ID. This keeps deletion unambiguous, reuses the existing retrieval path, and avoids duplicating search logic inside the mutation tools.Test plan
test_kennel_forget_deletes_existing_drawer— drawer removed, count goes to 0test_kennel_forget_missing_id_returns_error— graceful error,found=Falsetest_kennel_forget_content_preview_truncated_at_200— preview capped at 200 charstest_kennel_update_replaces_content— new content in storage, old gonetest_kennel_update_missing_id_returns_error— graceful errortest_kennel_update_empty_content_returns_error— rejected before hitting DBtest_kennel_update_fts_index_reflects_new_content— BM25 finds new term, not oldtest_register_tools_callback_exposes_full_surface— updated to include both new toolsruff check+ruff format --check— clean🤖 Generated with Claude Code