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.

Workspace & sessionszehnCLI

Three search systems

OptionWhat it does
Previous Sessions modalgxserver 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 fDirect 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
OptionWhat it does
find | fSearch agent prompt history with bundled zehn
--projectFilter results to current or selected project directory
--listList mode instead of interactive picker
--agentFilter by agent (claude, codex, pi, etc.)
--accept-all / --no-accept-allOverride Ghostex Accept All setting for resume permissions

gx search is not a public alias. Use gx find or gx f.

Indexed agent histories

OptionWhat 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).

OptionWhat it does
Type to filterNarrow results interactively
↑ / ↓Move selection
Entercd to project and run agent resume command
EscQuit
Ctrl+TFilter by agent
Ctrl+RFilter by project
Ctrl+DToggle day grouping
Ctrl+FToggle favorite on selected row
Ctrl+YCopy prompt text
Ctrl+OFork 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.

Related docs