Search by text
Ghostex bundles zehn for cross-agent prompt-history search. The sidebar Search by Text button launches gx f in a new terminal tab; gx find and gx f also work from any shell. This is separate from Previous Sessions metadata search and Cmd+P session switching.
Three search systems
| Option | What it does |
|---|---|
Previous Sessions modal | gxserver session titles and metadata — browse/restore closed sessions |
Search by Text (sidebar) | Launches zehn TUI via gx f in the active project terminal |
gx find / gx f | Direct CLI access to bundled zehn — searches on-disk agent prompt history |
zehn indexes prompt files from Claude, Codex, Pi, OpenCode, Cursor, and Grok — not Ghostex session rows.
Search by Text launcher
- Sidebar Search row → hover Search by Text button (file-search icon).
- Creates a terminal tab titled Search by Text (∗ prefix until real title replaces it).
- Runs gx f with a leading space so Atuin and shell history ignore the launch command.
- Terminal opens in the active project with visible placement in the focused tab group.
- No dedicated hotkey — use the sidebar hover button or run gx f directly.
CLI commands
gx find
gx f
gx find --project
gx f --list
gx f --agent claude
gx f --no-accept-all
# Standalone (outside Ghostex)
zehn
zehn update # explicit update only — no auto-update on search| Option | What it does |
|---|---|
find | f | Search agent prompt history with bundled zehn |
--project | Filter results to current or selected project directory |
--list | List mode instead of interactive picker |
--agent | Filter by agent (claude, codex, pi, etc.) |
--accept-all / --no-accept-all | Override Ghostex Accept All setting for resume permissions |
gx search is not a public alias. Use gx find or gx f.
Indexed agent histories
| Option | What it does |
|---|---|
claude | ~/.claude/history.jsonl |
codex | ~/.codex/history.jsonl and ~/.codex/sessions/**/*.jsonl |
pi | ~/.pi/agent/sessions/*/*.jsonl |
opencode | ~/.local/share/opencode/opencode.db (requires sqlite3) |
cursor | ~/.cursor/projects/*/agent-transcripts/*/*.jsonl |
grok | ~/.grok/sessions/*/*/chat_history.jsonl |
Codex session metadata is cached at ~/.ghostex/zehn/codex-sessions-v4 for faster rescans.
zehn TUI
zehn presents a fuzzy fzf-style picker. Ghostex 4.x groups results by last-active day (newest first).
| Option | What it does |
|---|---|
Type to filter | Narrow results interactively |
↑ / ↓ | Move selection |
Enter | cd to project and run agent resume command |
Esc | Quit |
Ctrl+T | Filter by agent |
Ctrl+R | Filter by project |
Ctrl+D | Toggle day grouping |
Ctrl+F | Toggle favorite on selected row |
Ctrl+Y | Copy prompt text |
Ctrl+O | Fork prompt to another agent |
Two-line rows show agent + matched prompt on the first line, last-active time + session title/project on the second.
Accept All setting
Settings → Agents → Accept All (agentAcceptAllEnabled) affects gx find and gx f only.
- When enabled, Ghostex auto-prepends --accept-all to zehn unless you pass --accept-all or --no-accept-all.
- Read via gxserver /api/readAgentSettings at launch time.
- Does not change Previous Sessions modal behavior.
Binary resolution
- $GHOSTEX_ZEHN_BIN — explicit override
- Bundled app path: Web/bin/zehn inside the Ghostex.app resources
- Dev checkout: zehn/zig-out/bin/zehn or zig build run in the zehn submodule
- Favorites stored in $XDG_CONFIG_HOME/zehn/favorites
Resume workflow
- Pick a row in zehn → zehn cds to the project directory and runs the agent resume command.
- Ghostex placeholder title Search by Text is replaced when the terminal reports a real title.
- Resume opens a new agent session in zehn's target project — not necessarily the project where you launched gx f.
- Leading-space launch scripts (Search by Text, session restore) skip Atuin shell history capture.
Tips
- Use gx f --project when you only care about prompts from the repo you are in.
- Run zehn update manually when a new zehn release ships — search never auto-updates.
- Previous Sessions finds closed Ghostex sessions; zehn finds raw agent transcripts on disk.
- Pass --no-accept-all for one-off resumes when Accept All is enabled globally.
- Ctrl+D day grouping helps when you have weeks of prompt history across agents.