Skip to content

feat: VS Code extension — Mnemonic for VS Code #367

@jkbennitt

Description

@jkbennitt

Overview

Build a VS Code extension that surfaces mnemonic's semantic memory system directly in the editor. The daemon and REST API already exist -- the extension is a smart client that connects to localhost:9999.

Goal: Developers should not have to leave the editor or open the dashboard. The right memory should appear at the right moment, automatically.


Architecture

VS Code Extension (TypeScript)
    | REST API + WebSocket (localhost:9999)
Mnemonic Daemon (already running)
    |
SQLite + LLM

Zero new infrastructure. Extension is a pure REST/WS client against the existing API.


Prerequisite: Daemon API Work

Before the extension MVP ships, the REST API needs parity with what MCP tools already expose.

Must-have for Phase 1 (~2.5 hours)

Endpoint What Why Effort
Wire project, source, type, min_salience through POST /api/v1/query Retrieval agent already supports these; REST handler does not expose them Sidebar needs project filtering, CodeLens needs source filtering ~30 min
GET /api/v1/memories/by-file?path=... Extract concepts from path server-side, return relevant memories Core Related Memories sidebar feature -- cleaner than client-side concept extraction ~1 hour
POST /api/v1/query/batch Array of queries in, array of results out CodeLens performance -- one request per file, not per symbol ~1 hour

Must-have for Phase 2 (~3 hours)

Endpoint What Why
POST /api/v1/memories/{id}/amend Update memory content in place Memory editing in sidebar/WebView
POST /api/v1/memories/{id}/archive Archive (forget) a memory Memory management
GET /api/v1/sessions/{id}/summary Session summary Welcome back notification
REST equivalents for recall_project, get_context, session_summary Expose MCP-only tools via REST Sidebar project context, proactive suggestions

Existing API assets the extension can use today

  • POST /api/v1/query -- semantic search (limited params, fixed in prereq)
  • POST /api/v1/remember -- create memories
  • POST /api/v1/feedback -- rate recall quality
  • GET /api/v1/health -- daemon status + version + memory count
  • GET /api/v1/memories/{id}/context -- rich memory detail
  • GET /api/v1/activity -- daemon recent concept activity tracker
  • GET /api/v1/system/update-check -- version check
  • WS /ws -- real-time events (16 event types)
  • SearchByEntity(name, entityType, limit) -- store method for symbol-level CodeLens

Features (prioritized)

Phase 1 -- MVP (ship first)

1. Memory Sidebar

TreeView panel in the Explorer sidebar:

  • Related Memories -- updates based on the active file via GET /api/v1/memories/by-file?path=... (server-side concept extraction)
  • Project Context -- pinned section showing active patterns, recent decisions/insights, current episodes
  • Powered by project-filtered queries once prereq wiring is done

2. Quick Recall (Cmd+Shift+M)

QuickPick dialog for instant semantic search:

  • Natural language input via POST /api/v1/query (with project filtering)
  • Select a result to copy to clipboard or insert as comment

3. Status Bar

Minimal status bar item showing memory count and connection status.

  • Click to open sidebar
  • Daemon connection status via GET /api/v1/health
  • Graceful degradation: empty/offline states, stale cache where possible

Phase 2 -- Real-time + Terminal

4. WebSocket Integration

Subscribe to /ws for real-time events:

  • memory_encoded -> invalidate sidebar cache for affected file/concepts
  • consolidation_completed -> update project context section
  • pattern_discovered -> notify user of new patterns
  • Foundation for session awareness and CodeLens cache invalidation

5. Session Awareness

Driven by WebSocket events (not polling). Uses consolidation_completed events + GET /api/v1/sessions/{id}/summary.

6. Terminal Error Memory

Pattern-match terminal errors against mnemonic error-type memories via POST /api/v1/query with type: error filtering. High value, straightforward once query params are wired.

7. Remember from Editor

Right-click context menu on selected code:

  • Remember This Decision -> POST /api/v1/remember with type: decision
  • Remember This Error -> type: error
  • What Do I Know About This? -> recall scoped to selection
  • Remember This Insight -> type: insight

Phase 3 -- CodeLens + Detail Views

8. Inline Memory Hints (CodeLens)

File-level batch query architecture, not per-symbol:

  1. On file open, extract file path + top-level symbols via DocumentSymbolProvider
  2. Single POST /api/v1/query/batch request with all symbols
  3. Client-side distribute results to CodeLens positions
  4. Cache invalidated via WebSocket memory_encoded events -- no polling

9. Memory Detail WebView

Click a memory in the sidebar to open a rich WebView panel showing full context via GET /api/v1/memories/{id}/context, associated memories, concepts, tags, salience score, and edit/forget controls.

10. Settings UI

  • mnemonic.endpoint -- daemon URL (default: http://127.0.0.1:9999)
  • mnemonic.token -- API auth token
  • mnemonic.inlineHints.enabled -- toggle CodeLens
  • mnemonic.inlineHints.minSalience -- threshold (0.0-1.0)
  • mnemonic.sidebar.autoRefresh -- refresh interval (default: 30s)
  • mnemonic.notifications.sessionStart -- toggle welcome-back notifications

What NOT to build

  • Do not duplicate the dashboard -- web UI exists for deep exploration
  • Do not add a chat interface -- Claude Code + MCP tools handles this
  • Do not require auth for localhost
  • Do not poll for real-time data -- use the WebSocket

Concept Extraction Strategy

Server-side via GET /api/v1/memories/by-file -- daemon has concepts.FromPath() in Go. Extension sends path, server extracts concepts and queries.

Error States / Graceful Degradation

  • Daemon not running: status bar offline, sidebar/CodeLens empty with Start daemon action
  • LLM unavailable: features still work (FTS search, cached embeddings)
  • Slow responses: sidebar loading state, CodeLens uses stale cache

Repo Structure

TBD -- monorepo (vscode/ dir) or separate repo. Separate repo likely better for independent release cadence.

Tech Stack

  • VS Code Extension API (TypeScript)
  • REST client + WebSocket against localhost:9999
  • TreeView for sidebar, CodeLens for inline hints, QuickPick for search
  • WebView only for rich memory detail (Phase 3)

Publishing

Monetization Notes

The extension is free -- it drives adoption of the core product. Pro features (cloud sync, team memory) are what we charge for. The extension makes the free tier stickier by reducing friction to zero.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepicMulti-phase project trackingv1.0Required for v1.0 public release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions