Skip to content

feat(puppy_kennel): kennel_forget + kennel_update tools + fix /kennel search scope bug#487

Open
SrividyaGanapathi wants to merge 1 commit into
mpfaffenberger:mainfrom
SrividyaGanapathi:feature/kennel-forget-update
Open

feat(puppy_kennel): kennel_forget + kennel_update tools + fix /kennel search scope bug#487
SrividyaGanapathi wants to merge 1 commit into
mpfaffenberger:mainfrom
SrividyaGanapathi:feature/kennel-forget-update

Conversation

@SrividyaGanapathi

Copy link
Copy Markdown

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 existing drawers_ad trigger in schema.py.

  • kennel_update(drawer_id, new_content) — replace a drawer's content in-place by ID. FTS index updated automatically via the drawers_au trigger. Both tools follow the same pattern as the existing five kennel tools: pydantic BaseModel output, @agent.tool decorator, never raises.

  • Bug fix: /kennel search hardcoded agent name_cmd_search was calling default_recall_scope("code-puppy", ...) regardless of the active agent, so any agent other than the default would never see its own agent:<name> wing in search results. Fixed by resolving the active agent via get_current_agent_name() with a safe fallback to "code-puppy".

Design rationale

kennel_forget and kennel_update are intentionally ID-based rather than query-based. The agent workflow is: call kennel_recall to find the relevant drawer (BM25 handles ranking), read the returned id, then call kennel_forget/kennel_update with 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 0
  • test_kennel_forget_missing_id_returns_error — graceful error, found=False
  • test_kennel_forget_content_preview_truncated_at_200 — preview capped at 200 chars
  • test_kennel_update_replaces_content — new content in storage, old gone
  • test_kennel_update_missing_id_returns_error — graceful error
  • test_kennel_update_empty_content_returns_error — rejected before hitting DB
  • test_kennel_update_fts_index_reflects_new_content — BM25 finds new term, not old
  • test_register_tools_callback_exposes_full_surface — updated to include both new tools
  • ruff check + ruff format --check — clean

🤖 Generated with Claude Code

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