TUI Memory Inspector Implementation Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Implement operator TUI screens for Memory v1 search/list/detail/forget/export (issue #665).
Architecture: Add an operator-core memoryStore backed by WS memory.* requests and expose it through OperatorCore. Extend the Ink TUI with a new memory route that renders list/search results and a selected item detail panel, plus dialogs for search and forget confirmation.
Tech Stack: TypeScript (strict, ESM), Vitest, Ink, @tyrum/client WS helpers, @tyrum/operator-core stores.
Task 1: Add memory route state and reducer support
Files:
- Modify:
packages/tui/src/tui-input.ts - Test:
packages/tui/tests/tui-input.test.ts
Step 1: Write the failing test
- Add a test that
input === "6"routes tomemoryand initializes memory cursor state.
Step 2: Run test to verify it fails
- Run:
pnpm test packages/tui/tests/tui-input.test.ts - Expected: FAIL (route not supported).
Step 3: Write minimal implementation
- Extend
TuiRouteId,TuiUiState, andreduceTuiInputto supportmemory.
Step 4: Run test to verify it passes
- Run:
pnpm test packages/tui/tests/tui-input.test.ts
Task 2: Add operator-core memory store (WS-backed)
Files:
- Create:
packages/operator-core/src/stores/memory-store.ts - Modify:
packages/operator-core/src/operator-core.ts - Modify:
packages/operator-core/src/deps.ts - Modify:
packages/operator-core/src/index.ts - Test:
packages/operator-core/tests/operator-core.test.ts
Step 1: Write the failing test
- Extend the operator-core test fake ws client to include
memory.list/get/search/forget/exportmethods, then assert the core exposesmemoryStore.
Step 2: Run test to verify it fails
- Run:
pnpm test packages/operator-core/tests/operator-core.test.ts
Step 3: Write minimal implementation
- Add
memoryStoreand wire it into core creation.
Step 4: Run test to verify it passes
- Run:
pnpm test packages/operator-core/tests/operator-core.test.ts
Task 3: Implement Memory screen in TUI
Files:
- Modify:
packages/tui/src/app.tsx - Test:
packages/tui/tests/app.test.ts
Step 1: Write the failing test
- Extend the TuiApp test core stub with a
memoryStoreand assert route renders and key presses call the right store methods.
Step 2: Run test to verify it fails
- Run:
pnpm test packages/tui/tests/app.test.ts
Step 3: Write minimal implementation
- Add route
memory, render list + selected detail, and dialogs for search and forget confirmation.
Step 4: Run test to verify it passes
- Run:
pnpm test packages/tui/tests/app.test.ts
Task 4: Ensure Admin Mode can perform memory write actions
Files:
- Modify:
packages/tui/src/core.ts - Test:
packages/tui/tests/admin-mode.test.ts
Step 1: Write the failing test (if needed)
- If existing tests cover requested scopes, extend; otherwise add a focused assertion that elevated token minting includes
operator.writefor memory operations.
Step 2: Implement
- Add
operator.writeto the minted scopes list.
Step 3: Verify
- Run:
pnpm test packages/tui/tests/admin-mode.test.ts
Task 5: Full verification + PR
Step 1: Verify formatting
- Run:
pnpm format:check(runpnpm formatif needed)
Step 2: Verify quality gates
- Run:
pnpm test && pnpm typecheck && pnpm lint
Step 3: Open PR
gh pr createwith body includingCloses #665and test evidence.