feat(extension): add "Add to memory" capture, settings list, and agent memory tools - #4762
Merged
Conversation
Contributor
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe agent-memory storage layer ( Overview
Issue Details (click to expand)WARNING
Files Reviewed (47 files)
Fix these issues in Kilo Cloud Reviewed by claude-sonnet-5 · Input: 34 · Output: 21.2K · Cached: 934.6K Review guidance: REVIEW.md from base branch |
pandemicsyn
approved these changes
Jul 24, 2026
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
Adds an "Add to memory" right-click context-menu action to the Kilo browser extension (Chrome MV3 + Firefox MV3). Highlight text on any page → Add to memory opens the side panel with a save card (optional ≤200-char note). Saved memories live extension-locally (same lifecycle as conversations: per-browser, wiped on sign-out), are listed in a Memories section of the settings dialog, and are surfaced to the side-panel agent through (a) a compact capped index inside the hidden
<system_environment>message suffix and (b) two new read-only safe tools,search_memoriesandget_memory, so the agent can look memories up without their contents polluting the context.How it works
contextMenusregistration (selection-only) in the background; a click builds a sanitized draft synchronously (trim, 8,000-char cap withtruncatedflag, query/hash-stripped URL, capture-timecreatedAt), opens the side panel first (user-gesture contract — ChromesidePanel.openis gesture-gated and must not cross anawait), then persists the pending draft. Open failures degrade gracefully: the draft survives and the card appears the next time the panel opens.Saved to memoryconfirmation (explicitDone, no timed fade), retryable save error (Couldn't save memory. Try again.+Retry), non-retryable full state at 200 memories (Memory is full.+Manage memories, no Retry), and load-error retry. The full state is reactive: deleting below 200 restores the draft form.<section aria-label="Memories">mounted directly below the "Signed in" card — newest-first list with per-item immediate delete (uniqueDelete memory "<preview>"accessible names),Loading…row, retryable load error, and an empty state with guidance text and no CTA.- [id] preview (domain, YYYY-MM-DD)+ "N more" note, ~400 tokens worst case) inside the single<system_environment>wrapper — omitted entirely when the store is empty and byte-for-byte identical to today's suffix otherwise.search_memories(AND of case-insensitive tokens over text + note + title + URL, newest-first, ≤10 results with snippets, explicitNo memories matched.ok-result) andget_memory(full memory orMemory not found.) are read-only safe tools, available in both modes; deletion stays UI-only.browser.storage.localwith an injected-area module (same convention asremote-mcp-storage.ts); invalid drafts/entries are normalized away; store-full is a discriminatedAgentMemoryStoreFullError; sign-out's existingstorage.clear('local')wipes memories and drafts.Commits
extension: add agent memory store and Add-to-memory context menu capture— data model, storage binding, watcher hook with latest-only refresh reconciliation, background capture flow,contextMenuspermission, manifest assertions.extension: add memory save card and settings memories section— save card + pure state machine, settings section, settings-dialog jotai atom.extension: add search_memories/get_memory tools and memory index context— full lockstep (enums, gateway allowlists, runtime early branches, persistence round-trip incl.memoryId, compaction detail, system-prompt +AGENTS.mdcarve-outs) plus the sweep of every exact tool-name assertion to the canonical orders, and the memory-index injection via the singleformatSystemEnvironmentbuilder.extension: cover memories feature in Chrome and Firefox E2E— 8 new Chrome Playwright tests and 5 mirrored Firefox Selenium scenarios (plusseedFirefoxStorage, aseenChatBodiesseam, andexpandToolExchangehelpers).main(session-cost popover feat(extension): show session cost in the context popover #4751, collapsible code blocks feat(extension): collapse long assistant code blocks #4750, empty-arguments fix fix(extension): treat empty streamed tool-call arguments as empty object #4753) with the tool-list sweep extended to the new tests.Testing
pnpm --filter kilo-extension verify— typecheck + lint + format:check + 333 Vitest pass.pnpm --filter kilo-extension build/build:firefox— pass; both manifests carrycontextMenus, host permissions unchanged, Firefox still has nodebugger.pnpm --filter kilo-extension e2e:chrome— 63 passed, 10 skipped (local-backend gated).pnpm --filter kilo-extension e2e:firefox— 32/32 passed.Not E2E-reproducible, Vitest-only with recorded rationale: retryable storage write/read failures (cannot deterministically force
chrome.storagefailure). Native context-menu click is not automatable; covered by manifest + service-worker listener assertions with the post-click flow driven by seeded drafts (recorded limitation).Notes for reviewers / release
contextMenuspermission on both browsers (no host-permission change). Chrome shows no extra warning; a store re-review note may be warranted on submission.search_memories/get_memoryin safe and dangerous modes (canonical order pinned in tests).