AGENTS.md instructions for /Users/pfleidi/entire/cli/.worktrees/feat/advanced-entire-search-key-bindings
New features and non-trivial changes — Plan First
When building new functionality, refactoring, or making changes that span multiple files or affect architecture:
Plan first: Enter plan mode. Read relevant source files, trace execution paths, and write a step-by-step implementation plan. Exit plan mode and wait for approval before writing any code.
Implement one step at a time: After the plan is approved, implement ONE logical step (e.g., one new file, one function, one test group). Then STOP.
Present changes for review: After each step, show what changed (files modified, key decisions made) and wait for explicit approval before proceeding to the next step.
"Yes" means "yes to the approach" — NOT "implement everything at once." Approval of a plan or analysis is permission to start the first step, not to run through all steps uninterrupted. After completing each step, STOP and show what you did. Silence from me does not mean "keep going."
Skill-driven workflows and small changes — Execute Directly
When following a skill (review, pr-feedback, simplify, pr, etc.) or making small targeted changes (fixing a lint issue, addressing a single review comment, tweaking a config):
The skill defines the workflow. Follow it directly — do NOT layer plan mode on top.
For small changes without a skill, read the relevant code, make the change, and present the result. No plan needed.
Always
Never auto-commit: NEVER create git commits unless the user explicitly asks. Present the completed work and let the user decide when to commit.
When asked to explore or analyze code, ALWAYS read the actual source files. NEVER delegate to a Task agent or give surface-level answers without thorough codebase exploration.
Search
When searching files, try to use faster tools like ripgrep rather than grep.
Scope Control
NEVER modify files or code beyond what the task requires:
No refactoring adjacent code, adding wrapper structs, or extracting abstractions unless explicitly requested
No renaming, reorganizing, or "improving" code outside the task scope
If you see improvement opportunities, list them separately at the end — NEVER bundle them into the change
When multiple items need attention (e.g., multiple failing agents, multiple commits), address ALL of them — not just the first one found. Confirm the full scope before starting work.
Stop and ask before: adding any dependency, changing function signatures in shared interfaces, or modifying code outside files directly related to the task.
Go Development
After editing Go files, ALWAYS run go build ./..., go vet ./..., and golangci-lint run ./... before considering the task done. Fix any unused variables, compilation errors, or lint findings before presenting results.
Always ensure that the code will lint without any issues.
Verification
When running linters, tests, or build commands, show the actual command output. NEVER summarize results as "passing" or "clean" without pasting the evidence. If a command fails, report the failure immediately — do not silently retry or omit it.
Before making claims about how the codebase works (what a struct contains, how a plugin behaves, whether a field exists), verify by reading the actual source. Do not guess based on naming conventions or prior context.
Multi-Terminal Awareness
When I re-run a command (e.g., /simplify, /review) or ask you to look at something again, always re-read the current state from scratch — run fresh git diff, re-read files, etc. NEVER assume the code or branch state hasn't changed since the last time you checked. I frequently make changes from other terminals.
Git Workflow
Git Operations
When committing, ALWAYS combine git add and git commit into a single shell command (e.g., git add file1.go file2.go && git commit -m "message"). Do NOT run them as separate tool calls — that forces unnecessary approval prompts.
When reverting changes, use surgical git operations (e.g., git checkout main -- <file> or git revert) — NEVER hard-reset entire branches.
NEVER force push without my consent. Try to avoid amending commits. If there's a need for amending a commit, double check if the commit was already pushed to a remote. If it was, don't amend and create a new commit instead.
Commit Messages
When writing commit messages, describe ONLY the net change between this commit and the previous one — the actual diff. NEVER describe:
The process of arriving at the change (debugging steps, failed attempts, iterations)
Conversations, decisions, or back-and-forth that happened during development
Work that was done and then undone before committing
Intermediate states that no longer exist in the final diff
The commit message must read as if a human wrote the code in one pass. A reader seeing only git log and git diff should find the message perfectly
sufficient — no hidden context needed.
Write the message by reading a diff (git diff or git diff --cached), not by recalling the session history. NEVER add Co-Authored-By: trailers. Write a semantically correct commit message only.
"Commit and Continue" Protocol
When I say "commit and continue" (or any variation like "commit & continue", "commit, continue"):
Commit — Stage and commit ONLY the current uncommitted changes. Use a clear, semantically correct commit message. Do NOT amend previous commits. Do NOT push.
Continue — Immediately proceed to the next step in the current workflow (plan step, review finding, feedback item, etc.) and implement it. Do NOT stop to ask permission — "continue" means keep going.
"Commit and continue" is permission to implement the NEXT step, not to run through ALL remaining steps. After completing the next step, follow the normal workflow rules (e.g., stop after each plan step, stop after each supervised review finding).
Pull Requests
Create complete but concise PR descriptions. Describe the problem solved and how it was implemented. Don't waste reviewer time. Do NOT add self-promotion to a pull request description. I don't want to see any "Generated with Claude Code" references in my pull requests ever.
Plans
NEVER check in plan files unless explicitly asked. The docs/plans and docs/superpowers folders are git-ignored.
--- project-doc ---
Entire - CLI
This repo contains the CLI for Entire.
Architecture
CLI built with github.com/spf13/cobra and github.com/charmbracelet/huh
Key Directories
Commands (cmd/)
entire/: Main CLI entry point
entire/cli: CLI utilities and helpers
entire/cli/commands: actual command implementations
entire/cli/agent: agent implementations (Claude Code, Gemini CLI, OpenCode, Cursor, Factory AI Droid, Copilot CLI) - see Agent Integration Checklist and Agent Implementation Guide
entire/cli/strategy: strategy implementation (manual-commit) - see section below
entire/cli/checkpoint: checkpoint storage abstractions (temporary and committed)
e2e/: E2E tests with real agent calls (see e2e/README.md)
Tech Stack
Language: Go 1.26.x
Build tool: mise, go modules
Linting: golangci-lint
Development
Running Tests
bash
mise run test
Running Integration Tests
bash
mise run test:integration
Running All Tests (CI)
bash
mise run test:ci
This runs unit tests, integration tests, and the E2E canary (Vogon agent) in sequence. Integration tests use the //go:build integration build tag and are located in cmd/entire/cli/integration_test/.
Running E2E Canary Tests (Vogon Agent)
The Vogon agent is a deterministic fake agent that exercises the full E2E test suite without making any API calls. Named after the Vogons from The Hitchhiker's Guide to the Galaxy — bureaucratic, procedural, and deterministic to a fault.
bash
mise run test:e2e:canary # Run all E2E tests with the Vogon agent
mise run test:e2e:canary TestFoo # Run a specific test
Runs as part of test:ci — canary failures block merges
No API calls, no cost — safe to run freely, unlike real agent E2E tests
If a canary test fails, the bug is in the CLI or test infrastructure, not in an agent
Located in e2e/vogon/ (binary) and cmd/entire/cli/agent/vogon/ (Agent interface)
The binary parses prompts via regex, creates/modifies/deletes files, and fires lifecycle hooks
IMPORTANT: When changing E2E test prompt wording, the Vogon binary (e2e/vogon/main.go) parses prompts with hardcoded regexes. New phrasing may not match existing patterns — always run mise run test:e2e:canary after changing prompt text and fix Vogon's parsing if tests fail.
Running E2E Tests (Only When Explicitly Requested)
IMPORTANT: Do NOT run E2E tests proactively. E2E tests make real API calls to agents, which consume tokens and cost money. Only run them when the user explicitly asks for E2E testing.
bash
mise run test:e2e [filter] # All agents, filtered
mise run test:e2e --agent claude-code [filter] # Claude Code only
mise run test:e2e --agent gemini-cli [filter] # Gemini CLI only
mise run test:e2e --agent opencode [filter] # OpenCode only
mise run test:e2e --agent cursor [filter] # Cursor only
mise run test:e2e --agent factoryai-droid [filter] # Factory AI Droid only
mise run test:e2e --agent copilot-cli [filter] # Copilot CLI only
E2E tests:
Use the //go:build e2e build tag
Located in e2e/tests/
See e2e/README.md for full documentation (structure, debugging, adding agents)
Test real agent interactions (Claude Code, Gemini CLI, OpenCode, Cursor, Factory AI Droid, Copilot CLI, or Vogon creating files, committing, etc.)
Validate checkpoint scenarios documented in docs/architecture/checkpoint-scenarios.md
Support multiple agents via E2E_AGENT env var (claude-code, gemini, opencode, cursor, factoryai-droid, copilot-cli, vogon)
Environment variables:
E2E_AGENT - Agent to test with (default: claude-code)
E2E_CLAUDE_MODEL - Claude model to use (default: haiku for cost efficiency)
E2E_TIMEOUT - Timeout per prompt (default: 2m)
Test Parallelization
Always use t.Parallel() in tests. Every top-level test function and subtest should call t.Parallel() unless it modifies process-global state (e.g., os.Chdir()).
Exception: Tests that modify process-global state cannot be parallelized. This includes os.Chdir()/t.Chdir() and os.Setenv()/t.Setenv() — Go's test framework will panic if these are used after t.Parallel().
Git in Tests
Tests that touch git state must use an isolated temp repo — never the real repo CWD.
Many handlers (lifecycle, strategy, hooks) resolve the git repo from CWD via OpenRepository, GetGitCommonDir, DetectFileChanges, etc. Without isolation, tests can create session state files, shadow branches, or other artifacts in the real .git/ directory.
Use the testutil helpers:
go
tmpDir := t.TempDir()
testutil.InitRepo(t, tmpDir) // git init + user config + disable GPG
testutil.WriteFile(t, tmpDir, "f.txt", "init") // create a file
testutil.GitAdd(t, tmpDir, "f.txt") // stage it
testutil.GitCommit(t, tmpDir, "init") // commit (needs at least one commit for HEAD)
t.Chdir(tmpDir) // redirect CWD-based git resolution
testutil.InitRepo configures user.name, user.email, and disables GPG signing — safe for CI environments without global git config.
Prefer testutil.InitRepo() over direct git.PlainInit() in tests. When a test in this repo needs an initialized repository, use testutil.InitRepo(t, dir) unless the test specifically needs lower-level initialization behavior that the helper cannot provide. Do not call git.PlainInit() directly and then create commits or run CLI git operations without also reproducing the helper's repo-local config.
Do NOT shell out to git init/git commit directly without setting user config and --no-gpg-sign, and do NOT run lifecycle/strategy handlers from the real repo CWD in tests.
Linting and Formatting
bash
mise run fmt && mise run lint
mise run fmt can rewrite files. Treat mise run fmt && mise run lint as a single verification sequence: if formatting changes anything, run lint again on the formatted tree rather than assuming a previous lint result still applies.
Before Every Commit (REQUIRED)
CI will fail if you skip these steps:
bash
mise run check
Equivalent expanded form:
bash
mise run fmt # Format code (CI enforces gofmt)
mise run lint # Lint check (CI enforces golangci-lint)
mise run test:ci # Run all tests (unit + integration)
mise run check runs the three commands above.
Safety note: do not treat a clean mise run lint result as final unless it was run after the most recent mise run fmt pass.
Before Any Push Or Remote Code Update (REQUIRED)
Before pushing commits or otherwise sending code changes to any remote, run mise run lint on the current tree and ensure it passes. If mise run fmt changed files, rerun mise run lint on the formatted tree before pushing.
Common CI failures from skipping this:
gofmt formatting differences → run mise run fmt
Lint errors → run mise run lint and fix issues
Test failures → run mise run test and fix
Code Duplication Prevention
Before implementing Go code, use /go:discover-related to find existing utilities and patterns that might be reusable.
Check for duplication:
bash
mise run dup # Comprehensive check (threshold 50) with summary
mise run dup:staged # Check only staged files
mise run lint # Normal lint includes dupl at threshold 75 (new issues only)
mise run lint:full # All issues at threshold 75
Tiered thresholds:
75 tokens (lint/CI) - Blocks on serious duplication (~20+ lines)
Check if a helper already exists in common.go or nearby utility files
If not, consider extracting the duplicated logic to a shared helper
If duplication is intentional (e.g., test setup), add a //nolint:dupl comment with explanation
Code Patterns
Error Handling
The CLI uses a specific pattern for error output to avoid duplication between Cobra and main.go.
How it works:
root.go sets SilenceErrors: true globally - Cobra never prints errors
main.go prints errors to stderr, unless the error is a SilentError
Commands return NewSilentError(err) when they've already printed a custom message
When to use SilentError:
Use NewSilentError() when you want to print a custom, user-friendly error message instead of the raw error:
go
// In a command's RunE function:
if _, err := paths.WorktreeRoot(); err != nil {
cmd.SilenceUsage = true // Don't show usage for prerequisite errors
fmt.Fprintln(cmd.ErrOrStderr(), "Not a git repository. Please run 'entire enable' from within a git repository.")
return NewSilentError(errors.New("not a git repository"))
}
When NOT to use SilentError:
For normal errors where the default error message is sufficient, just return the error directly. main.go will print it:
go
// Normal error - main.go will print "unknown strategy: foo"
return fmt.Errorf("unknown strategy: %s", name)
Key files:
errors.go - Defines SilentError type and NewSilentError() constructor
root.go - Sets SilenceErrors: true on root command
main.go - Checks for SilentError before printing
Settings
All settings access should go through the settings package (cmd/entire/cli/settings/).
Why a separate package:
The settings package exists to avoid import cycles. The cli package imports strategy, so strategy cannot import cli. The settings package provides shared settings loading that both can use.
Usage:
go
import "github.com/entireio/cli/cmd/entire/cli/settings"
// Load full settings object
s, err := settings.Load()
if err != nil {
// handle error
}
if s.Enabled {
// ...
}
// Or use convenience functions
if settings.IsSummarizeEnabled() {
// ...
}
Do NOT:
Read .entire/settings.json or .entire/settings.local.json directly with os.ReadFile
Duplicate settings parsing logic in other packages
Create new settings helpers without adding them to the settings package
Key files:
settings/settings.go - EntireSettings struct, Load(), and helper methods
config.go - Higher-level config functions that use settings (for cli package consumers)
Logging vs User Output
Internal/debug logging: Use logging.Debug/Info/Warn/Error(ctx, msg, attrs...) from cmd/entire/cli/logging/. Writes to .entire/logs/.
Enabling debug/perf logs locally: Prefer adding "log_level": "DEBUG" to .entire/settings.local.json when you need detailed hook/perf logs. This file is gitignored, so it is a low-risk local-only change. ENTIRE_LOG_LEVEL=debug also works and takes precedence.
User-facing output: Use fmt.Fprint*(cmd.OutOrStdout(), ...) or cmd.ErrOrStderr().
Don't use fmt.Print* for operational messages (checkpoint saves, hook invocations, strategy decisions) - those should use the logging package.
Privacy: Don't log user content (prompts, file contents, commit messages). Log only operational metadata (IDs, counts, paths, durations).
Git Operations
We use github.com/go-git/go-git for most git operations, but with important exceptions:
go-git v5 Bugs - Use CLI Instead
Do NOT use go-git v5 for checkout or reset --hard operations.
go-git v5 has a bug where worktree.Reset() with git.HardReset and worktree.Checkout() incorrectly delete untracked directories even when they're listed in .gitignore. This would destroy .entire/ and .worktrees/ directories.
See HardResetWithProtection() in common.go and CheckoutBranch() in git_operations.go for examples.
Regression tests in hard_reset_test.go verify this behavior - if go-git v6 fixes this issue, those tests can be used to validate switching back.
Repo Root vs Current Working Directory
Always use repo root (not os.Getwd()) when working with git-relative paths.
Git commands like git status and worktree.Status() return paths relative to the repository root, not the current working directory. When an agent runs from a subdirectory (e.g., /repo/frontend), using os.Getwd() to construct absolute paths will produce incorrect results for files in sibling directories.
This also affects path filtering. The paths.ToRelativePath() function rejects paths starting with .., so computing relative paths from cwd instead of repo root will filter out files in sibling directories:
When to use os.Getwd(): Only when you actually need the current directory (e.g., finding agent session directories that are cwd-relative).
When to use repo root: Any time you're working with paths from git status, git diff, or any git-relative file list.
Test case in state_test.go: TestFilterAndNormalizePaths_SiblingDirectories documents this bug pattern.
Session Strategy (cmd/entire/cli/strategy/)
The CLI uses a manual-commit strategy for managing session data and checkpoints. The strategy implements the Strategy interface defined in strategy.go.
Strategy Interface
The Strategy interface provides:
SaveStep() - Save session step checkpoint (code + metadata)
SaveTaskStep() - Save subagent task step checkpoint
GetRewindPoints() / Rewind() - List and restore to checkpoints
GetSessionLog() / GetSessionInfo() - Retrieve session data
ListSessions() / GetSession() - Session discovery
How It Works
The manual-commit strategy (manual_commit*.go) does not modify the active branch - no commits are created on the working branch. Instead it:
Creates shadow branch entire/<HEAD-commit-hash[:7]>-<worktreeHash[:6]> per base commit + worktree
Worktree-specific branches - each git worktree gets its own shadow branch namespace, preventing conflicts
Supports multiple concurrent sessions - checkpoints from different sessions in the same directory interleave on the same shadow branch
Condenses session logs to permanent entire/checkpoints/v1 branch on user commits
Uses the post-rewrite Git hook to keep local session linkage aligned after amend/rebase rewrites
Builds git trees in-memory using go-git plumbing APIs
Rewind restores files from shadow branch commit tree (does not use git reset)
Location-independent transcript resolution - transcript paths are always computed dynamically from the current repo location (via agent.GetSessionDir + agent.ResolveSessionFile), never stored in checkpoint metadata. This ensures restore/rewind works after repo relocation or across machines.
Copilot token scoping - Copilot CLI session.shutdown contains session-wide token aggregates. Checkpoint metadata must stay scoped to CheckpointTranscriptStart; condensation may separately backfill full-session Copilot totals into session state for entire status.
Tracks session state in .git/entire-sessions/ (shared across worktrees)
Shadow branch migration - if user does stash/pull/rebase (HEAD changes without commit), shadow branch is automatically moved to new base commit
Orphaned branch cleanup - if a shadow branch exists without a corresponding session state file, it is automatically reset when a new session starts
PrePush hook can push entire/checkpoints/v1 branch alongside user pushes
Safe to use on main/master since it never modifies commit history
{
"checkpoint_id": "abc123def456",
"session_id": "2026-01-13-uuid", // Current/latest session
"session_ids": ["2026-01-13-uuid1", "2026-01-13-uuid2"], // All sessions
"session_count": 2, // Number of sessions in this checkpoint
"strategy": "manual-commit",
"created_at": "2026-01-13T12:00:00Z",
"files_touched": ["file1.txt", "file2.txt"] // Merged from all sessions
}
When multiple sessions are condensed to the same checkpoint (same base commit):
Sessions are stored in numbered subfolders using 0-based indexing (0/, 1/, 2/, etc.)
Latest session is always in the highest-numbered folder
session_ids array tracks all sessions, session_count increments
Session State (filesystem, .git/entire-sessions/):
code
<session-id>.json # Active session state (base_commit, checkpoint_count, etc.)
Checkpoint ID Linking
The strategy uses a 12-hex-char random checkpoint ID (e.g., a3b2c4d5e6f7) as the stable identifier linking user commits to metadata.
How checkpoint IDs work:
Generated once per checkpoint: When condensing session metadata to the metadata branch
Added to user commits via Entire-Checkpoint trailer:
Manual-commit: Added via prepare-commit-msg hook (user can remove it before committing)
Used for directory sharding on entire/checkpoints/v1 branch:
Path format: <id[:2]>/<id[2:]>/
Example: a3b2c4d5e6f7 → a3/b2c4d5e6f7/
Creates 256 shards to avoid directory bloat
Appears in commit subject on entire/checkpoints/v1 commits:
Format: Checkpoint: a3b2c4d5e6f7
Makes git log entire/checkpoints/v1 readable and searchable
Bidirectional linking:
code
User commit → Metadata:
Extract "Entire-Checkpoint: a3b2c4d5e6f7" trailer
→ Read a3/b2c4d5e6f7/ directory from entire/checkpoints/v1 tree at HEAD
Metadata → User commits:
Given checkpoint ID a3b2c4d5e6f7
→ Search user branch history for commits with "Entire-Checkpoint: a3b2c4d5e6f7" trailer
Note: Commit subjects on entire/checkpoints/v1 (e.g., Checkpoint: a3b2c4d5e6f7) are
for human readability in git log only. The CLI always reads from the tree at HEAD.
Example:
code
User's commit (on main branch):
"Implement login feature
Entire-Checkpoint: a3b2c4d5e6f7"
↓ ↑
Linked via checkpoint ID
↓ ↑
entire/checkpoints/v1 commit:
Subject: "Checkpoint: a3b2c4d5e6f7"
Tree: a3/b2c4d5e6f7/
├── metadata.json (checkpoint_id: "a3b2c4d5e6f7")
├── full.jsonl (session transcript)
└── prompt.txt
Commit Trailers
On user's active branch commits:
Entire-Checkpoint: <checkpoint-id> - 12-hex-char ID linking to metadata on entire/checkpoints/v1
Added via prepare-commit-msg hook; user can remove it before committing to skip linking
On shadow branch commits (entire/<commit-hash[:7]>-<worktreeHash[:6]>):
Entire-Session: <session-id> - Session identifier
Entire-Metadata: <path> - Path to metadata directory within the tree
Entire-Strategy: manual-commit - Strategy that created the commit
On metadata branch commits (entire/checkpoints/v1):
Commit subject: Checkpoint: <checkpoint-id> (or custom subject for task checkpoints)
Trailers:
Entire-Session: <session-id> - Session identifier
Entire-Strategy: <strategy> - Strategy name (manual-commit)
Entire-Agent: <agent-name> - Agent name (optional, e.g., "Claude Code")
Ephemeral-branch: <branch> - Shadow branch name (optional)
Entire-Metadata-Task: <path> - Task metadata path (optional, for task checkpoints)
Note: The strategy keeps active branch history clean - the only addition to user commits is the single Entire-Checkpoint trailer. It never creates commits on the active branch (the user creates them manually). All detailed session data (transcripts, prompts, context) is stored on the entire/checkpoints/v1 orphan branch or shadow branches.
Multi-Session Behavior
Concurrent Sessions:
When a second session starts in the same directory while another has uncommitted checkpoints, a warning is shown
Both sessions can proceed - their checkpoints interleave on the same shadow branch
Each session's RewindPoint includes SessionID and SessionPrompt to help identify which checkpoint belongs to which session
On commit, all sessions are condensed together with archived sessions in numbered subfolders
Note: Different git worktrees have separate shadow branches (worktree-specific naming), so concurrent sessions in different worktrees do not conflict
Orphaned Shadow Branches:
A shadow branch is "orphaned" if it exists but has no corresponding session state file
This can happen if the state file is manually deleted or lost
When a new session starts with an orphaned branch, the branch is automatically reset
If the existing session DOES have a state file (concurrent session in same directory), a SessionIDConflictError is returned
Shadow Branch Migration (Pull/Rebase):
If user does stash → pull → apply (or rebase), HEAD changes but work isn't committed
The shadow branch would be orphaned at the old commit
Detection: base commit changed AND old shadow branch still exists (would be deleted if user committed)
Action: shadow branch is renamed from entire/<old-hash>-<worktreeHash> to entire/<new-hash>-<worktreeHash>
Session continues seamlessly with checkpoints preserved
When Modifying the Strategy
The strategy must implement the full Strategy interface
Test with mise run test - strategy tests are in *_test.go files
Update both CLAUDE.md and AGENTS.md when modifying the strategy to keep documentation current
Important Notes
Before committing: Follow the "Before Every Commit (REQUIRED)" checklist above - CI will fail without it
Integration tests: run mise run test:integration when changing integration test code
When adding new features, ensure they are well-tested and documented.
Always check for code duplication and refactor as needed.
Go Code Style
Write lint-compliant Go code on the first attempt. Before outputting Go code, mentally verify it passes golangci-lint (or your specific linter).
Follow standard Go idioms: proper error handling, no unused variables/imports, correct formatting (gofmt), meaningful names.
Handle all errors explicitly—don't leave them unchecked.
Reference .golangci.yml for enabled linters before writing Go code.
Accessibility
The CLI supports an accessibility mode for users who rely on screen readers. This mode uses simpler text prompts instead of interactive TUI elements.
Environment Variable
ACCESSIBLE=1 (or any non-empty value) enables accessibility mode
Users can set this in their shell profile (.bashrc, .zshrc) for persistent use
Implementation Guidelines
When adding new interactive forms or prompts using huh:
In the cli package:
Use NewAccessibleForm() instead of huh.NewForm():
go
// Good - respects ACCESSIBLE env var
form := NewAccessibleForm(
huh.NewGroup(
huh.NewSelect[string]().
Title("Choose an option").
Options(...).
Value(&choice),
),
)
// Bad - ignores accessibility setting
form := huh.NewForm(...)
In the strategy package:
Use the isAccessibleMode() helper. Note that WithAccessible() is only available on forms, not individual fields, so wrap confirmations in a form:
go
form := huh.NewForm(
huh.NewGroup(
huh.NewConfirm().
Title("Confirm action?").
Value(&confirmed),
),
)
if isAccessibleMode() {
form = form.WithAccessible(true)
}
if err := form.Run(); err != nil { ... }
Key Points
Always use the accessibility helpers for any huh forms/prompts
Test new interactive features with ACCESSIBLE=1 to ensure they work
The accessible mode is documented in --help output
You are modifying the entire search TUI in this repository to align its navigation and help behavior with the existing TUI standards used by commands like entire search, while keeping entire search scoped to the features it actually has today.
Context:
The entire search TUI is implemented in cmd/entire/cli/search_tui.go.
It is currently a single-view dashboard plus scrollable commit/search list.
It does not support drill-down/detail navigation, so do not invent or add one.
We want interaction consistency across TUIs, but we do NOT want to add features that search does not already conceptually support.
Task:
Update entire search so its keyboard behavior and visible help/footer follow the same general interaction vocabulary used by the newer interactive commands in this repo.
Requirements:
Keep the command as a single-screen TUI. Do not add detail modes, nested views, file pickers, search inputs, or any other new navigation model.
Add hidden vim-style aliases:
j = down / scroll down
k = up / scroll up
h should behave the same as esc if there is a meaningful back/exit action in this single-screen context
l should behave the same as enter only if there is already a meaningful confirm/open action; otherwise do not invent a new action just to support l
g = jump to top
G = jump to bottom
Support standard non-vim equivalents for top/bottom navigation:
home = jump to top
end = jump to bottom
Keep the visible/documented controls accessibility-first:
show arrow keys, j and k
show home/end, g/G
show q
Preserve existing quit behavior:
q quits
ctrl+c quits
esc should remain supported
Make the help/footer wording and ordering feel closer to the repo’s interactive conventions:
use compact, dot-separated hints
prefer labels like ↑/↓ scroll, home/end top/bottom, q quit
Assistant
I’ll read the current search TUI and nearby interactive TUI patterns first, then I’ll give you a scoped implementation plan and stop before editing, per the repo instructions for this kind of change.
Assistant
The current file already contains more modes than the task description expects: modeSearch and modeDetail are present, with footer text for / search, enter detail, esc back, and paging. I’m going to read those paths and the existing tests before proposing the plan, because the right scope depends on whether we preserve or remove already-present behavior.
Assistant
The tests also encode the extra modes: / enters an editable search mode, enter opens a full-screen detail view, and n/p paginate. Since your requirements explicitly say not to support those as visible controls and to keep this single-screen, I’m checking the base version next so the plan can distinguish existing branch drift from the intended current product shape.
Assistant
I read the source and tests. There’s a scope mismatch: search_tui.go already has modeSearch and modeDetail; browse mode opens detail on enter and search on / at search_tui.go. entire search with no args also starts focused in search mode at search_cmd.go.
Proposed plan, assuming we preserve existing behavior and only align the browse TUI controls/footer:
Update browse-mode keys in search_tui.go: keep arrows and j/k; add home/g top and end/G bottom; preserve q/ctrl+c; add esc and hidden h as exit aliases for the single-screen browse context. I would not add l unless we are treating the existing enter detail action as supported.
Update browse footer text to compact hints only: ↑/↓ scroll · j/k scroll · home/end top/bottom · g/G top/bottom · q quit, while preserving the results/page count on the right.
Add focused tests in search_tui_test.go for j/k, home/end, g/G, esc/h, and the revised footer text.
Run go test ./cmd/entire/cli -run SearchModel, go build ./..., go vet ./..., and golangci-lint run ./..., then paste the actual outputs.
Please confirm whether to preserve the existing / search and enter detail modes as current behavior, or whether you want the broader strict single-screen cleanup that removes/disables them.
User
Make it so
Assistant
I’ll implement the first approved step now: browse-mode key handling only. I’ll keep existing / search and enter detail behavior untouched, and stop after this step for review.
Assistant
The production key handler is patched. I’m running a narrow existing test now to catch obvious regressions from that first step before handing it back.
Assistant
Implemented step 1 only: search_tui.go now supports esc/h as browse-mode quit aliases, and home/g plus end/G for top/bottom navigation. Existing /, enter, and paging behavior is unchanged.
Verification run for this step:
text
$ gofmt -w cmd/entire/cli/search_tui.go
text
$ go test ./cmd/entire/cli -run TestSearchModel_Navigation
ok github.com/entireio/cli/cmd/entire/cli 0.576s
Current modified file:
text
M cmd/entire/cli/search_tui.go
Approve and I’ll do the next step: update the browse footer/help text.
User
Can you do tdd and tests as well?
Assistant
I’ll use the Test-Driven Development skill for the remaining work. Since I already made the browse-key production change before this request, I’ll bring the tests in now and use RED-GREEN for the footer behavior before changing the footer.
Assistant
The TDD skill is strict about not keeping production code written before the failing test. I’m reverting my untested browse-key change first, then I’ll add the focused failing tests and re-implement from those tests.
Assistant
I’m adding the first RED tests for keyboard behavior now: quit aliases, vim up/down aliases, and top/bottom jumps. These tests should fail on the missing aliases before I put the implementation back.
Assistant
The RED tests are in. I’m running just those focused tests now to verify they fail for the expected missing behavior, not because of a typo.
Assistant
The failures match the intended missing behavior. I’m putting back the minimal key handling needed to make those tests pass, without touching rendering or data loading.
Assistant
The first GREEN pass is done for keyboard behavior. I’m starting the next RED cycle for footer/help text, with a test that locks the documented controls to the requested compact vocabulary.
Assistant
The footer test fails on the old help string, as expected. I’m changing only the browse footer wording now; no render layout or data behavior changes.
Assistant
The TDD cycles are green for the focused behavior and footer tests. I’m moving into verification now: focused search-model tests first, then the required build, vet, and lint checks.
Assistant
go test, go build, and go vet are clean. I’m running golangci-lint run ./... as the repo instructions require after Go edits.
Assistant
golangci-lint is not on PATH in this shell, so I’m using the project’s configured lint task next. If that task needs network or tool installation and sandbox blocks it, I’ll request approval through the command tool.
Assistant
Lint found one real issue: this repo already has a constant for "esc". I’m reading that definition and then I’ll replace the new literal with the existing constant.
User
I think we should keep the / key there as well, no?
Assistant
Yes. Since / is an existing search action, keeping it documented is consistent with the “don’t invent new actions” constraint. I’m adjusting the footer test first so / search is part of the expected visible controls, while still keeping detail, open, and back out.
Assistant
The adjusted RED test fails exactly because / search is missing. I’m adding that one documented action to the footer now.
Assistant
/ search is back in the documented controls and the focused tests are green. I’m rerunning the required verification after that adjustment.
Assistant
The project lint task is clean. Because the bare golangci-lint binary is not on PATH, I’m also invoking it through mise exec so the requested linter command itself is covered by the tool-managed environment.
Assistant
Implemented with TDD.
Changed search_tui.go and search_tui_test.go:
j/k covered as vim scroll aliases.
home/end and g/G jump to top/bottom.
esc and hidden h quit from the single browse screen.
Footer no longer documents detail, open, back, or navigate.
TDD red checks failed first as expected, including missing top/bottom navigation and missing / search after your clarification.
Verification:
text
$ go test ./cmd/entire/cli -run SearchModel
ok github.com/entireio/cli/cmd/entire/cli 0.453s
text
$ go build ./...
(no output; exit 0)
text
$ go vet ./...
(no output; exit 0)
text
$ golangci-lint run ./...
zsh:1: command not found: golangci-lint
The repo-managed lint path passed:
text
$ mise run lint
[lint:go] golangci-lint has version 2.11.3 built with go1.26.1 from 6008b81b on 2026-03-10T10:25:44Z
[lint:go] 0 issues.
Finished in 3.58s
Current worktree has only the two intended files modified.
User
Can we keep the / key where it was at the beginning of the help text before? There's also a conditional here we should keep as-is:
code
if pages > 1 {
left += dot + m.styles.render(m.styles.helpKey, "n/p") + " page"
}
left += dot + m.styles.render(m.styles.helpKey, "q") + " quit"
Assistant
Yes, that makes sense. / search is an existing search action, so I’ll move it back to the front of the browse footer and restore the existing conditional n/p page hint before q quit; I’ll update the footer tests around that exact ordering.
Assistant
I’m updating the tests first so they fail against the current footer ordering and missing page hint. Then I’ll change the production footer to match.
Assistant
The updated footer tests fail for the expected reasons: / search is no longer first, and the multiple-page footer has no n/p page hint. I’m restoring that footer shape now.
Assistant
The footer-specific tests are green. I’m rerunning the search-model test group and the required Go verification after this change.
Assistant
Adjusted as requested: / search is back at the beginning of the browse footer, and the existing n/p page conditional is restored before q quit.
I also updated tests so single-page help omits paging, while multi-page help keeps n/p page in the expected order.
Verification:
text
$ go test ./cmd/entire/cli -run SearchModel
ok github.com/entireio/cli/cmd/entire/cli 0.415s
text
$ go build ./...
(no output; exit 0)
text
$ go vet ./...
(no output; exit 0)
text
$ mise run lint
[lint:go] golangci-lint has version 2.11.3 built with go1.26.1 from 6008b81b on 2026-03-10T10:25:44Z
[lint:go] 0 issues.
Finished in 1.75s
I’ll inspect PR #1056 and compare it against the current local diff before changing anything. Since this is a referenced PR, I’m going to verify the actual implementation rather than infer from the description.
Assistant
I found PR #1056 is the activity-TUI version of this same alignment. It keeps the footer compact by combining related aliases, so I’m reading its patch now and then I’ll adapt the search footer without changing search’s extra / and conditional paging behavior.
Assistant
PR #1056 combines equivalent aliases into one help hint: ↑/↓/j/k scroll and home/end/g/G top/bottom. I’m going to apply that same compression to search’s footer while keeping / search first and keeping the existing conditional n/p page.
Assistant
The footer tests now fail on the expected redundancy. I’m changing the footer construction to match the PR’s grouped alias style.
Assistant
The grouped footer tests are green now. I’m rerunning the search-model tests and required Go verification after this final footer change.
Assistant
I looked at PR #1056 and mirrored the relevant part: it groups equivalent aliases instead of listing them twice. Search now uses:
n/p page stays conditional for multi-page results, and / search is back at the beginning. I kept unsupported browse footer actions like detail, open, back, and navigate out of the help text.
$ go test ./cmd/entire/cli -run SearchModel
ok github.com/entireio/cli/cmd/entire/cli 0.407s
text
$ go build ./...
(no output; exit 0)
text
$ go vet ./...
(no output; exit 0)
text
$ mise run lint
[lint:go] golangci-lint has version 2.11.3 built with go1.26.1 from 6008b81b on 2026-03-10T10:25:44Z
[lint:go] 0 issues.
Finished in 4.07s
User
Okay, is there anything else to do here?
Assistant
I’ll do a quick fresh check of the worktree and verification state before answering, since you may have changed files from another terminal.
Assistant
There’s one unrelated .opencode/package-lock.json modification and one staged hunk in search_tui.go. I’m checking the staged/unstaged split so I can tell you exactly what remains without disturbing anything.
Assistant
One thing caught my eye in the fresh diff: the current footer text and one test appear to disagree on comma vs slash grouping. I’m running the focused tests again against the actual current tree before saying it’s done.
Assistant
Yes: one thing still needs cleanup before calling this done.
The current tree has a failing focused test because the footer implementation now says:
So we need to choose one convention and make code/tests match. PR #1056 uses slash grouping: ↑/↓/j/k and home/end/g/G, so I’d align search to that unless you prefer the comma split.
Also note there’s an unrelated .opencode/package-lock.json change in the worktree; I didn’t touch it.
User
I'm currently updating the grouping in the other PR. Let's use ↑/↓, j/k (with a space in between)
Assistant
I’ll update the footer grouping to the comma-plus-space form and keep the same pattern for top/bottom: home/end, g/G. I’ll patch the tests first, then the footer string, and rerun the focused and required Go checks.
Assistant
The tests now fail for the expected missing space. I’m updating the footer rendering to match ↑/↓, j/k and the same comma-space style for top/bottom.
Assistant
The footer grouping tests are green. I’m rerunning the broader search model tests and the required Go checks now.
n/p page remains conditional for multi-page results, and the tests now expect the same grouping.
Verification:
text
$ go test ./cmd/entire/cli -run SearchModel
ok github.com/entireio/cli/cmd/entire/cli 0.419s
text
$ go build ./...
(no output; exit 0)
text
$ go vet ./...
(no output; exit 0)
text
$ mise run lint
[lint:go] 0 issues.
Finished in 3.66s
User
Commit and continue
Assistant
I’ll commit only the search TUI changes, leaving any unrelated worktree changes alone. First I’m reading the current diff so the commit message reflects the actual final patch, then I’ll continue with a post-commit sanity check.
Assistant
The final diff is only the two search TUI files now. I’m committing those two files with a message based on the diff, then I’ll continue by confirming the post-commit worktree state.
Assistant
The commit succeeded after rerunning with approval because the git worktree index lives outside the writable sandbox path. I’m doing the requested continue step now: checking the branch state and whether there’s any remaining work.
Assistant
Committed the search TUI changes:
text
1c947b619 Align search TUI navigation help
Post-commit status is clean. There’s nothing else pending in this workflow. Verification was already run before commit: go test ./cmd/entire/cli -run SearchModel, go build ./..., go vet ./..., and mise run lint all passed.
User
Use the review skill
Assistant
I’ll use the review skill now. I’m going to read its workflow first, then run it against the current branch state.
Assistant
I’m following the review skill directly: first I’ll establish the current base and diff from scratch, then I’ll launch the three review lenses in parallel without waiting for confirmation if there are changed files.
Assistant
Review scope against main (51ccd66273a1eb75c6510ec1a3fa0b773547433a) is 2 files: cmd/entire/cli/search_tui.go and cmd/entire/cli/search_tui_test.go, 176 insertions and 11 deletions. I’m launching the security, correctness, and simplification review agents now.
Assistant
The three review agents are running. While they inspect independently, I’m doing a local verification pass over the changed code and tests so I can validate or discard findings when they come back.
Assistant
My local pass is focusing on two likely review points: top/bottom jumps across paged results, and whether the footer help is documenting only supported actions. I’m waiting for the parallel review agents now so I can synthesize and verify any findings.
Security review came back clean. I’m still waiting on correctness and simplification before presenting the report.
User
<subagent_notification>
{"agent_path":"019dd169-3974-7723-995e-180094411eae","status":{"completed":"cmd/entire/cli/search_tui.go:356 · Low · Improvement · unnecessary comment\n\nIssue: The default-branch comment still says g/G are forwarded to the viewport, but this diff now handles g and G explicitly.\n\nImpact: The keybinding logic is documented incorrectly, which can mislead future changes around browse-mode scrolling/navigation.\n\nEvidence:case \"home\", \"g\" and case \"end\", \"G\" return before the default branch, so g/G no longer reach m.browseVP.Update(msg).\n\nSuggested fix: Remove g/G from the comment, or make it generic: // Forward unhandled scrolling keys to the viewport."}}
</subagent_notification>
Assistant
Simplification found one low improvement about a stale comment. I’m waiting for correctness, then I’ll verify that finding against the source and produce the deduplicated report.
User
<subagent_notification>
{"agent_path":"019dd169-3926-79a0-b565-ca3ebeefc056","status":{"completed":"#1 · Low · correctness · cmd/entire/cli/search_tui.go:722\n\nClassification: Improvement\n\nIssue: Browse footer help says ↑/↓, j/k scroll, but those keys navigate the selected result, not the viewport scroll position.\n\nImpact if not fixed: Users following the footer get the wrong mental model: j/k and arrow keys change m.cursor and refresh the selected detail card, while only unhandled keys are forwarded to m.browseVP.Update for actual scrolling.\n\nEvidence:updateBrowseMode handles \"up\", \"k\" and \"down\", \"j\" at cmd/entire/cli/search_tui.go:297 and cmd/entire/cli/search_tui.go:302 by changing m.cursor; the viewport update path is only in the default branch at cmd/entire/cli/search_tui.go:355.\n\nSuggested fix: Change the footer label back to a navigation-oriented word, e.g. ↑/↓, j/k navigate, and update the footer test expectation accordingly."}}
</subagent_notification>
Assistant
Correctness is back with a second low improvement. I’m verifying both against the current source lines now before deciding what should be in the final report.
Issue: The fallback comment still says g/G are forwarded to the viewport, but g and G are now handled explicitly.
Impact if not fixed: Future edits may be misled about which keys reach the viewport fallback path.
Trade-offs: None.
Evidence:case "home", "g" and case "end", "G" return before the default branch, so g/G no longer reach m.browseVP.Update(msg).
Suggested fix: Change the comment to something generic like // Forward unhandled scrolling keys to the viewport.
I discarded one agent note about ↑/↓, j/k scroll being “navigate” rather than “scroll”: it conflicts with the requested vocabulary and PR #1056’s convention, and it is not a clear bug.
Summary: 0 required findings, 1 low improvement. The branch is merge-ready from this review’s perspective; the remaining item is a small stale-comment cleanup.
User
Use the pr skill
Assistant
I’ll use the pr skill now. I’m reading its workflow first, then I’ll run the required discovery and verification before pushing or creating anything.
Assistant
I’m starting PR prep against main: checking the branch commits, discovering the repo’s verification commands from project config, then I’ll run the full required checks before pushing.
Assistant
Verification source found: mise-tasks/build for build, mise run lint from .github/workflows/lint.yml, and CI test jobs from .github/workflows/ci.yml (mise run test:ci:core, integration shards, and mise run test:e2e:canary). I’m going to run the full local PR verification sequence now.
Assistant
Build and lint passed. I’m running the CI core tests next; this is broader than the earlier focused search tests and includes race detection.
Assistant
Core CI tests are still running. I’ll keep polling until the command completes; I won’t start the next stage until this finishes.
Assistant
mise run test:ci:core failed in an unrelated dispatch TUI test race on the global newDispatchProgram; this branch does not change dispatch code. I’m checking whether this is a base-branch issue before deciding whether PR prep can proceed or needs your direction.
Assistant
The failing files are unchanged versus the base branch, but the race is real: two dispatch_tui_test.go tests run in parallel while both replace the package-level newDispatchProgram. Because that is outside the search TUI files, I need your approval before I modify it, even though it blocks the PR verification path. I’m confirming the focused failure now.
Assistant
PR prep is blocked by full CI verification, not by the search TUI change.
Passed:
text
mise run build
mise run lint
Failed:
text
mise run test:ci:core
The failure is a confirmed race in unchanged dispatch tests: TestDefaultRunInteractiveDispatch_DoesNotUseAltScreen and TestDefaultRunInteractiveDispatch_ClearsLoadingCardBeforeReturn both call t.Parallel() while mutating the package-level newDispatchProgram. A focused race run reproduces it:
text
WARNING: DATA RACE
Read at ... dispatch_tui_test.go:78
Previous write at ... dispatch_tui_test.go:31
...
FAIL github.com/entireio/cli/cmd/entire/cli
This is outside the search TUI files, so I need approval before modifying it. Do you want me to fix that dispatch test race and continue PR prep?
User
Do it
Assistant
I’ll fix the dispatch test race as a small targeted verification blocker. The minimal fix is to stop running the two tests that mutate newDispatchProgram in parallel; I’ll patch only those tests, rerun the focused race test, then restart PR verification from the top as the PR workflow requires.
Assistant
The targeted race is fixed. Per the PR skill, I’m restarting full verification from the top now: build, lint, then CI test commands.
Assistant
Build and lint are clean after the dispatch test change. I’m rerunning mise run test:ci:core now.
Assistant
Core CI tests are still running. I’m polling until they finish before moving on.
Assistant
Core CI tests passed. I’m checking the integration shard task definition, then I’ll run the CI integration shards that the workflow uses.
Assistant
The CI workflow runs three integration shards (a, b, c) with race detection. I’m running those sequentially to keep the local output manageable.
Assistant
Integration shard a is still running. I’ll poll until it completes, then continue with b and c.
Assistant
Integration shard b is still running. I’ll keep polling.
Assistant
Integration shard c is still running; I’ll keep polling until it exits.
Assistant
All integration shards passed. The remaining CI test stage is the E2E canary, which is deterministic and explicitly part of this repo’s CI; I’m running it now.
Assistant
Full verification passed after the small dispatch test fix. I’m checking for uncommitted changes now; if there are any, the PR skill requires me to show the diff and ask you to approve the commit before pushing.
Assistant
Verification is now passing, but PR prep has one uncommitted auto-fix that needs your approval before I can push and create the PR.
mise run build
mise run lint
mise run test:ci:core
mise run test:ci:integration:shard -- a
mise run test:ci:integration:shard -- b
mise run test:ci:integration:shard -- c
mise run test:e2e:canary
Approve this commit message, or give me a different one.
User
Can you inline the esc key constant? I don't think it's really adding anything here.
User
<turn_aborted>
The user interrupted the previous turn on purpose. Any running unified exec processes may still be running in the background. If any tools/commands were aborted, they may have partially executed.
</turn_aborted>
User
continue
User
<turn_aborted>
The user interrupted the previous turn on purpose. Any running unified exec processes may still be running in the background. If any tools/commands were aborted, they may have partially executed.
</turn_aborted>
User
Commit the current changes and then continue
Assistant
I’ll re-read the current worktree first, then commit only the current uncommitted changes. After that I’ll continue the PR workflow from the post-verification step.
Assistant
I’m going to re-read the working tree state first, then commit only the current uncommitted dispatch test change and resume the PR workflow.
Assistant
The only uncommitted change is the dispatch TUI race-test fix, so I’m committing just that file now.
Assistant
The commit is created. I’m checking the branch state and then I’ll push and open the PR using the verification that already passed on this tree.
Assistant
The branch is clean. It now has three commits over main, including the current dispatch test race fix and the existing search-key follow-up, so I’ll include both in the PR description.
Assistant
There’s no upstream configured for this branch, so I’m pushing it with upstream tracking before creating the PR.
Assistant
The branch is pushed and tracking origin/feat/advanced-entire-search-key-bindings. I’m creating the PR now with a concise description and the verification commands that passed.