A command palette for Claude Code that intercepts
Ctrl-Gto launch editors, tools, and specialized agents.
✅ Working and Simple - FZF command palette with persistent sessions.
✅ Working Now:
- FZF command palette with 8+ options
- Edit with Emacs/Vi/Nano (returns to Claude Code when done)
- Open Terminal (full shell with
$PROMPTenv var set to temp file path) - Recent Files - Query JSONL logs for last 25 files Claude touched (with intelligent caching)
- Subagent Context Package - Spawn Claude instances with rich parent context (conversation + tools + files)
- Interactive + non-interactive prompt enhancement
- Universal command palette accessible from any terminal via
menuormcommands
📋 Future Exploration (Not Actively Planned):
- Menu extensions based on real usage needs (git ops, log streaming, test runners)
- Enhanced history viewer - "Better Ctrl-O" parsing ~/.claude/projects
- Context file system for multi-file opening (may revisit if use cases emerge)
- Multi-pane tmux layouts with logs
- MCP tool for Claude to write context files
- Multi-agent orchestration (interesting theory, likely overkill)
When you press Ctrl-G in Claude Code to edit a prompt, it launches whatever is in your $EDITOR environment variable. This project intercepts that hook to provide a command palette that can launch:
- ✅ Interactive menus with FZF for choosing editors and tools
- ✅ Prompt enhancement agents that investigate your codebase and rewrite prompts
- ✅ Any editor (emacs, vi, nano) or viewer (batcat)
- ✅ Anything scriptable - the menu accepts any command or script
- 📋 Multiple files at specific line numbers (requires context file system - planned)
- 📋 Tmux layouts with editor, logs, and test panes (planned)
- 📋 Log streams from servers or browsers (planned)
┌───────────────────────────────────────────────┐
│ You hit Ctrl-G in Claude Code │
└───────────────────────────────────────────────┘
↓
┌───────────────────────────────────────────────┐
│ FZF menu appears: │
│ • Edit with Emacs │
│ • Edit with Vi │
│ • Edit with Nano │
│ • Open Terminal ($PROMPT available) │
│ • Recent Files (last 25 files touched) │
│ • Detach │
│ • Enhance (Interactive) │
│ • Enhance (Non-interactive) │
└───────────────────────────────────────────────┘
↓
┌───────────────────────────────────────────────┐
│ Select action → Execute → Exit returns to │
│ Claude Code with your edited prompt │
└───────────────────────────────────────────────┘
Key Features:
- Simple FZF menu - Fuzzy searchable command palette
- Open Terminal - Full bash shell with
$PROMPTenv var pointing to temp file - Recent Files - Access last 25 files Claude touched via JSONL parsing (no dependencies)
- Prompt enhancement - Interactive or auto modes for Claude to investigate and enhance prompts
- Clean and minimal - Just works, no complexity
Recent Files Details:
The Recent Files feature reads Claude Code's JSONL session logs directly from ~/.claude/projects/. No external dependencies or daemons required.
Performance:
- First run: ~1s (parses last 5000 lines from each JSONL file)
- Subsequent runs: <100ms (uses cached results until JSONL files change)
- Cache location:
lib/cache/recent-files-*.json
How it works:
- Detects current project directory → maps to
~/.claude/projects/-project-name/ - Finds all JSONL files, sorted by modification time
- Parses Read/Edit/Write tool invocations with
jq - Groups by file path, keeps most recent timestamp
- Returns top 25 files, most recent first
Subagent Context Package Details: When spawning interactive Claude instances (Ctrl-G → "Enhance (Interactive)"), a context package is automatically created with:
Context Package Structure:
/tmp/claude-subagent-{PID}/
├── system-prompt.txt # Instructions + output file path
├── parent-context.md # Last 15 conversation turns with tool usage
├── recent-files.txt # 25 most recently edited files
└── meta.json # Metadata (working dir, timestamps)
Parent Context Format:
## USER
[user message]
## ASSISTANT
[assistant response]
**Tools Used:**
- `Read` → /path/to/file.js
- `Edit` → /path/to/modified.ts
- `Bash` → Command description
- `Grep` → Pattern: search_termBenefits:
- Subagents understand parent conversation context
- See what files were recently read/edited
- Know what commands were run
- Clear output channel (write to specified file)
- No shell escaping issues (file-based prompt injection)
✅ Prompt Enhancement (Working Now):
- You write:
#enhance\nAdd dark mode support - Hit Ctrl-G → Choose "Enhance (Non-interactive)"
- Haiku investigates codebase, finds theme system patterns
- Rewrites prompt with file paths (src/styles/theme.ts:42), architectural context
- Returns to main Claude session with enhanced prompt
Available directives: #enhance, #spellcheck, #suggest, #investigate, #fix, #please
✅ Interactive Enhancement with Context Package (Working Now):
- Hit Ctrl-G → Choose "Enhance (Interactive)"
- New Claude subagent window opens with rich context:
- Recent conversation history (last 15 turns)
- Tool usage (Read/Edit/Write/Bash/Grep actions)
- Recently edited files (last 25 files)
- Clear instructions on output file location
- Subagent investigates, enhances prompt, writes back
- Exit returns enhanced prompt to parent Claude session
✅ Editor Selection (Working Now):
- Hit Ctrl-G → FZF menu shows Emacs/Vi/Nano options
- Select preferred editor for the prompt file
📋 Code Review (Planned):
- Claude identifies 5 files needing changes
- Writes context file with file paths and line numbers
- Hit Ctrl-G → Opens split-pane emacs at right locations
- Requires: Context file system (issue editor-hook-3)
📋 Debugging (Planned):
- Claude detects an error
- Hit Ctrl-G → Multi-pane tmux with code + logs
- Requires: Multi-pane layouts (issue editor-hook-13)
# Clone the repo
cd ~/code
git clone [your-repo-url] claude-editor-hook
cd claude-editor-hook
# Run the install script (experimental)
./install.sh install
# Update your shell config (~/.bashrc or ~/.zshrc)
export EDITOR="claude-editor-hook"
# Reload your shell
source ~/.bashrcThe install script attempts to:
- Create a symlink from
~/.local/bin/claude-editor-hookto the project - Track installation metadata with git commit hash, branch, and date
- Store deployment info in
~/.local/bin/.claude-editor-hook-install.json
Check installation details:
./install.sh infoThis shows which git commit, branch, and date you deployed. Perfect for knowing exactly what version is running.
Uninstall:
./install.sh uninstall# Symlink directly
mkdir -p ~/.local/bin
ln -s ~/code/claude-editor-hook/bin/claude-editor-hook ~/.local/bin/# Test the menu
claude-editor-hook /tmp/test-file📋 Context file system not yet implemented. The workflow below describes planned functionality:
You: "Show me where the authentication bug is"
Claude: "I found the issue in auth.js line 42. Let me set up the view..."
[writes ~/.claude/editor-context.yaml] # Not implemented yet
"Now hit Ctrl-G to open the files"
You: [hits Ctrl-G]
[Currently: shows menu. Future: opens files from context]
Current workflow: Hit Ctrl-G → Choose from menu → Edit prompt or enhance it
See memory-bank/01-architecture/systemPatterns.md for complete architecture documentation.
Current structure:
bin/claude-editor-hook- Main entry point (~50 lines)lib/menu-core.sh- Unified menu system with all optionslib/scripts/- Helper scripts for recent files, context packages, etc.install.sh- Installation script with git metadata tracking
Extensibility Model:
Add new capabilities by editing lib/menu-core.sh. The menu definition is a simple list:
MENU="Display Text:command-to-execute
Another Option:some-script.sh
Third Option:inline bash code"Currently implemented menu options:
- Edit with Emacs/Vi/Nano
- Open Terminal (with $PROMPT env var)
- Recent Files (JSONL-based with caching)
- Project Switcher (fuzzy search ~/code)
- Find Files (recursive fd search)
- Git Operations (status, log, branches)
- Enhancement agents (interactive and non-interactive)
Future menu options could include:
- Log streaming (
tail -f /var/log/app.log) - Test runners (
npm test --watch) - Database queries
- Beads issue browser
Ctrl-G as a leverage point to improve on Claude Code's limited Ctrl-O history:
Problem: Ctrl-O shows cramped recent history, forces you to "tab out" of the session
Solution: Menu option that analyzes ~/.claude/projects/<project>/calls/ to show:
- Last 10-20 files touched (read, edited, created, deleted) in past X minutes
- Raw message excerpts (truncated or expandable)
- Optional Haiku summary of recent activity
- Filterable, searchable interface (fzf, batcat, custom TUI)
Why this is powerful: "Tab out" to rich history view while keeping the interactive session alive. Return when done exploring.
# See what's being worked on
cat memory-bank/02-active/currentWork.md
# Check the roadmap
cat memory-bank/02-active/nextUp.md
# View architecture
cat memory-bank/01-architecture/systemPatterns.mdIssue tracking via Beads:
bd ready # Show issues ready to work on
bd create "New idea" # Create issue
bd list # List all issuesThis is a personal project but ideas welcome! See memory-bank/02-active/nextUp.md for planned features.
MIT
Inspired by the realization that $EDITOR is just a hook we can intercept, and Claude can write files.