/goal Work only in a worktree on a new local branch tui-context-switcher cut from master, never in the shared master tree; never push. FIRST report there: git rev-parse --abbrev-ref HEAD, then NO_COLOR=1 AGENTGREP_TUI_WATCHDOG=1 env -u VIRTUAL_ENV -u UV_NO_SYNC .venv/bin/python -m pytest tests/test_ui_context_switcher.py -v. That module does not exist today; do not gate on the -m tui lane, 11 tests already green on master. End state: HEAD is that branch, that module passes with cases for filtering, preview, rename, selection, cancellation, unknown branch, focus restore and legacy migration, the -m tui lane still exits 0, and uv run ty check is clean. Per issue #126: Ctrl-R opens one project-aware switcher; a context snapshots query text, SearchScope, agents and optional origin narrowing (cwd, repo, worktree, branch) applied in one update; Ctrl-A, Ctrl-B and Ctrl-W give all projects, current branch and worktrees, branch shown unavailable rather than guessed when unknown; Space previews lazily; modal-local Ctrl-R renames an agentgrep-local alias only; Esc restores focus. Stores and Git stay read-only; no absolute path reaches a label or log. ADR 0011: no file open, subprocess, sqlite3, network, filesystem walk, lock or queue wait, .result(), json load/dump or unbounded CPU reachable from a pump callable even one helper hop down; new pump entrypoints carry @pump_only, run_worker targets carry @offload with a stable group, bulk updates use stream_apply. The hook arms only under a truthy AGENTGREP_TUI_WATCHDOG and is blind to open, os.scandir and CPU spin, so also name the entrypoints and hops you traced. Keep scope and origin separate; add no effort axis, persistent index or MCP primitive, and leave SearchQuery semantics unchanged. Or stop after 25 turns and report what remains.
Summary
Expand the existing
Ctrl+Rsearch-history recall into a pi-minimal, project-aware search context switcher. A context restores the query text, content scope (prompts,conversations, orall), and any origin narrowing (cwd, repository, worktree, or branch), so moving between projects does not require reconstructing query predicates by hand.Interaction
Ctrl+Aall projects ·Ctrl+Bcurrent branch ·Ctrl+Wall worktrees ·Spacepreview ·Ctrl+Rrename · Type to search ·EsccancelCtrl+Ropens the switcher; modal-localCtrl+Rrenames the highlighted context.Up/Downmoves through contexts andEnterapplies the highlighted context.Spacelazily previews the resolved query, content scope, agent coverage, and home-elided origin metadata without running a new search.Esccloses without changing the active query or scope and restores the previously focused widget.Scope semantics
SearchScope, selected agents, and optional origin filters; applying one updates those values atomically and dispatches through the normal search workflow.Ctrl+Aremoves project-origin narrowing while preserving the query, agents, and content scope.Ctrl+Bnarrows to the active repository and branch; when branch identity is unavailable, show the action as unavailable rather than guessing.Ctrl+Wshows every known worktree for the active repository regardless of branch, while exact rows can still select one recordedcwd, worktree, or branch.Product behavior
SearchQuery/ origin-filter semantics so CLI, TUI, Python, and MCP do not acquire different meanings for scope,cwd, worktree, or branch. This issue adds TUI navigation; it does not require a new MCP primitive.Open-source precedent
Cwd/Allfilter and loads a selected transcript preview only when expanded: https://github.com/openai/codex/blob/41efc63/codex-rs/tui/src/resume_picker.rs#L1622-L1635 and https://github.com/openai/codex/blob/41efc63/codex-rs/tui/src/resume_picker.rs#L1678-L1696Ctrl+Rrename,Esccancellation, and plain typing for fuzzy search: https://github.com/charmbracelet/crush/blob/cd592e8/internal/ui/dialog/sessions.go#L80-L131 and https://github.com/charmbracelet/crush/blob/cd592e8/internal/ui/dialog/sessions.go#L176-L217Ctrl+Ras the default rename binding: https://github.com/sst/opencode/blob/9976269/packages/web/src/content/docs/keybinds.mdx#L35-L46Acceptance criteria
Ctrl+Ropens one switcher from the supported HUD without replacing the mounted shell or losing the active search state.cwd, exact-worktree, and exact-branch contexts can be searched and selected.Goal
Idempotent completion condition for
/goal. It asserts an end state, not an action: if the state already holds, the first evaluation passes and nothing is edited.NO_COLOR=1 AGENTGREP_TUI_WATCHDOG=1 env -u VIRTUAL_ENV -u UV_NO_SYNC .venv/bin/python -m pytest tests/test_ui_context_switcher.py -v (run in the tui-context-switcher worktree, after git rev-parse --abbrev-ref HEAD names that branch)