Skip to content

feat(memory): port openclaude's /memory — TUI picker overlay, $EDITOR spawn, backend memory controls#693

Merged
agentforce314 merged 1 commit into
mainfrom
feat/memory-slash-command-tui
Jul 12, 2026
Merged

feat(memory): port openclaude's /memory — TUI picker overlay, $EDITOR spawn, backend memory controls#693
agentforce314 merged 1 commit into
mainfrom
feat/memory-slash-command-tui

Conversation

@agentforce314

Copy link
Copy Markdown
Owner

Summary

Ports openclaude's /memory command (typescript/src/commands/memory/ + MemoryFileSelector) to clawcodex. Previously /memory had no reachable surface — the Python InteractiveCommand port existed but the Ink TUI (sole interactive UI since #566) never dispatched it, so typing it hit the "isn't wired into the clawcodex backend yet" fallback.

  • Picker overlay (ui-tui/src/components/memoryPicker.tsx): /memory opens the memory-file hierarchy — synthetic User memory (~/.clawcodex/CLAUDE.md) and Project memory rows first, then every loaded CLAUDE.md / rules file / @-import with its "Saved in …" / "@-imported" description. Remembers the last selection across opens (TS lastSelectedPath idiom).
  • Editor flow (ui-tui/src/lib/memoryEdit.ts): selecting a row ensure-creates the file (exclusive-create preserves content), suspends the TUI to the alternate screen, spawns $VISUAL/$EDITOR (bare code/subl get wait flags — the TS EDITOR_OVERRIDES), then prints the TS-verbatim Opened memory file at … line + editor hint.
  • Backend controls (src/server/agent_server.py): memory_targets serializes the shared build_memory_options enumeration for the picker; memory_edited busts the memory-file cache (keys on cwd only) so the next turn re-reads the edited content.
  • /memory added to the slash registry + completion catalog; memoryPicker overlay wired into overlay state, Esc/Ctrl+C close, and $isBlocked.
  • Documented divergence: cancel closes silently like the sibling pickers (/model, /logo) instead of printing "Cancelled memory editing".

Testing

🤖 Generated with Claude Code

… spawn, backend memory controls

Typing /memory in the Ink TUI now opens the memory-file picker (port of
openclaude's commands/memory + MemoryFileSelector): synthetic User/Project
rows plus every loaded CLAUDE.md / rules file / @-import, served by a new
memory_targets control over the shared build_memory_options enumeration.

Selecting a file ensure-creates it (exclusive-create), suspends the TUI to
the alternate screen, spawns $VISUAL/$EDITOR (bare code/subl get wait
flags — the TS EDITOR_OVERRIDES), prints the TS-verbatim 'Opened memory
file at …' line + editor hint, and busts the backend memory-file cache
(memory_edited) so the next turn re-reads the edited content.

Previously /memory had no reachable surface: the Python InteractiveCommand
port existed but the Ink TUI (sole interactive UI since #566) never
dispatched it.

Verified end-to-end over a real PTY (picker rows, editor spawn under
suspend, transcript message, file created+edited, Esc cancel) plus 17 new
unit tests (3 backend controls, 14 memoryEdit lib).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@agentforce314 agentforce314 merged commit 1384645 into main Jul 12, 2026
2 checks passed
@agentforce314 agentforce314 deleted the feat/memory-slash-command-tui branch July 12, 2026 03:44
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