e2e/: E2E tests with real agent calls (see e2e/README.md)
Command Layout
The visible CLI is organized around five noun groups plus a small set of
top-level verbs. The groups are the canonical home for each verb; legacy
top-level shortcuts remain functional but hidden, and emit a deprecation hint
pointing at the canonical group form. Newer experimental command families are
discoverable through entire labs and may remain hidden from root help while
their canonical paths are still runnable.
session (alias: sessions): list, info, tokens, stop, attach, resume, current.
resume with a branch arg switches to it and resumes its session; with no arg
it opens an interactive picker of stopped sessions (across all worktrees),
resolving each to its branch and pointing at the owning worktree when the
branch is checked out elsewhere. Resume keeps an existing local session log
as-is by default ( overwrites it from the checkpoint).
Review the current branch changes and report actionable findings. Prioritize correctness, regressions, security, and missing test coverage. Do not make code changes.
Review profile: codex-temp
Task: Review this change for correctness, regressions, API design, missing tests, maintainability, and user-facing behavior changes. Return only real, actionable defects with concrete evidence and an exact code pointer. No praise, summaries, speculation, style preferences, or nice-to-have refactors.
Output format:
Start with one verdict line: approve / approve with nits / request changes, plus a short reason.
Then list actionable findings only. Each finding MUST be a separate top-level Markdown bullet starting with [high], [medium], or [low].
Include an exact file:line pointer in each finding when possible, plus the bug, impact, and fix in one concise paragraph.
Assistant
I’ll review the branch diff only and keep this read-only. I’m using the code-reviewer skill for the review stance and the review-swarm skill because this request is specifically a diff review.
Assistant
I’m checking the branch boundary and working tree first so findings stay inside the requested scope: commits unique to this branch versus origin/main, plus any uncommitted edits.
Assistant
The branch has uncommitted edits in the Codex agent hook files. I’m reading the branch diff and those files now, then I’ll validate likely runtime paths against the existing tests and hook behavior.
Assistant
The committed branch diff is separate from the uncommitted hook fallback work: committed scope adds .gitignore entries and t1.txt; the working tree changes the Codex hook installer. I’m checking exact line numbers and surrounding implementation before deciding whether any issue is real.
Assistant
One committed defect is already concrete: .gitignore contains unresolved conflict markers. I’m still checking the Windows hook fallback logic for runtime regressions so the final output does not miss a higher-impact issue.
Assistant
The hook installer change appears aimed at avoiding shell-wrapper commands on Windows only when a compatibility probe fails. I’m tracing install, idempotency, uninstall, and doctor/trust checks because changing command shape can leave stale hooks behind if detection is inconsistent.
Assistant
The most important hook risk I found is migration/idempotency: when the desired command switches from wrapped to direct, the installer checks only exact command equality, so an existing managed wrapped hook is left in place and a direct duplicate is appended. I’m doing one last pass over the changed tests to ensure that finding is not already covered.
Assistant
I’m checking the caller flow for InstallHooks now. If enable skips installation when hooks are already present, the stale-wrapper issue is worse than just duplication on reinstall.
Assistant
The caller check confirms the migration path matters: AreHooksInstalled treats any managed command shape as installed, so higher-level setup can believe stale wrapped Codex hooks are current even though this change now wants direct hooks on affected Windows setups.
Assistant
I found the non-interactive setup path: it skips InstallHooks unless ForceHooks is set when AreHooksInstalled returns true, and Codex’s AreHooksInstalled only checks for any managed hook. That makes the Windows fallback unreachable for users with already-installed wrapped hooks unless they know to force reinstall.
Assistant
request changes - unresolved merge markers are committed, and the Windows hook fallback does not migrate existing broken wrapped hooks.
[high] cmd/entire/cli/agent/codex/hooks.go:113 checks only for the exact desired command before appending, while removeEntireHooks only runs under force at line 83. If a Windows user already has the wrapped sh -c ... Codex hooks installed and the new probe selects direct hooks, a normal reinstall appends direct commands but leaves the failing wrapped commands in .codex/hooks.json, so Codex still runs the broken hook. Fix by replacing/removing existing Entire-managed Codex hooks when switching command forms, and add a test that installs wrapped hooks, flips the probe to failure, then verifies only direct hooks remain.
[medium] .gitignore:72 contains unresolved merge conflict markers (<<<<<<<, =======, >>>>>>>), confirmed by git diff --check. This commits merge debris into the repo and makes the intended ignore rule ambiguous. Resolve the conflict to the intended single skills/ or /skills/ entry and remove the markers.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
checkpoint (aliases: cp, checkpoints): list, explain, tokens, search, plus
the deprecated rewind (functional, prints a cobra deprecation message, will
be removed in a future release)
agent: bare opens the interactive agent selector, plus list, add, remove
configure: bare prints help and a hint pointing at entire agent; flags
manage non-agent settings (telemetry, git-hook installation mode, strategy
options, summary provider). Agent CRUD lives under entire agent.
auth: login, logout, status, contexts, use, plus the hidden
token (prints the active control-plane bearer to stdout for scripting/curl;
honors ENTIRE_TOKEN, else the refreshed active-context login JWT). logout
takes --everywhere (revoke every session on the active core, not just the
current one) and --all-contexts (log out of every saved login)
doctor: bare runs the scan-and-fix flow, plus trace, logs, bundle
Experimental command families advertised through entire labs:
tokens: profile (hidden from root help while token diagnostics mature)
Hidden top-level shortcuts (functional, emit a one-line deprecation hint):
resume → session resume, attach → session attach, explain →
checkpoint explain, trace → doctor trace.
Cobra-native aliases (no hint): sessions → session, cp/checkpoints →
checkpoint. The search top-level remains hidden without a hint.
Deprecated top-level commands (functional, print a cobra deprecation message):
reset → clean, and rewind (no replacement, announces removal — same
deprecation as checkpoint rewind).
The hideAsAlias(cmd, canonical) helper in cmd/entire/cli/aliascmd.go
marks a command Hidden and sets cobra's Deprecated field so the hint
renders to stderr on every invocation while the command stays functional.
Diagnostic subcommands live alongside doctor.go as doctor_logs.go and
doctor_bundle.go. Group roots and noun-group children live in files
named <noun>_group.go and <noun>_<verb>.go respectively.
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.
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 as an example here, replace `claude-code` with other agents to run tests for those agents
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, Pi, 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, pi, 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.
Config/Cache/Keyring Isolation in Tests
Tests must never read or write the developer's real ~/.config/entire
(contexts.json, version_check.json), ~/.cache/entire (nodes.json,
cluster_cores.json, api_discovery.json), or OS keychain. The developer may be
using entire for real while tests run.
Single resolver: internal/entireclient/userdirs is the only place
that resolves the per-user config dir (userdirs.Config():
$ENTIRE_CONFIG_DIR else ~/.config/entire) and cache dir
(userdirs.Cache(): $XDG_CACHE_HOME/entire else ~/.cache/entire).
Never derive these paths anywhere else.
In-process safety net: userdirs and the tokenstore default backend
detect go test (via internal/testdirs) and fall back to a throwaway
per-process temp directory when their env override is unset. The fallback
is shared across tests in one process — for per-test isolation still set
t.Setenv("ENTIRE_CONFIG_DIR", t.TempDir()) and
tokenstore.UseFileBackendForTesting(...).
Spawned binaries are NOT covered: testing.Testing() is false in a
subprocess. The integration and e2e TestMains set ENTIRE_CONFIG_DIR,
XDG_CACHE_HOME, ENTIRE_TOKEN_STORE=file, ENTIRE_TOKEN_STORE_PATH, and
ENTIRE_TEST_AUTH_STORE_FILE process-wide so every spawned entire (and
every agent-invoked hook) inherits isolation. Any new harness that spawns
the real binary must do the same.
Legacy auth store: auth.NewStore() talks straight to the zalando
keyring; packages whose tests can reach it need keyring.MockInit() in
TestMain (see cmd/entire/cli/global_test.go) — the testdirs fallback
does not cover it in-process.
Spawning subprocesses in tests (TTY detection)
Tests that spawn the real entire or git binary need the child to be non-interactive so prompts don't hang on a developer terminal.
interactive.CanPromptInteractively() resolves in this order:
ENTIRE_TEST_TTY=1 → force interactive ON (any other non-empty value → force OFF).
testing.Testing() → false. In-process go test runs are non-interactive by default; no per-test t.Setenv("ENTIRE_TEST_TTY", "0") is needed.
For subprocesses spawning the real entire binary (e2e, integration tests, entire calling itself from a hook), prefer execx.NonInteractive over env-var plumbing:
execx.NonInteractive puts the child in a new session with no controlling terminal (Setsid on Unix, DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP on Windows), so the child's /dev/tty probe fails naturally. No env var required.
interactive.UnderTest() returns true when testing.Testing() or ENTIRE_TEST_TTY is set — use it where code needs to skip a real-terminal operation even if CanPromptInteractively() returns true (e.g., reading from /dev/tty directly inside askConfirmTTY).
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, 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. 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.
Control-Plane Core Resolution (which core am I talking to?)
Control-plane commands dial one of three cores: the active context's
(coreapi.New), a specific cluster's (coreapi.NewForCluster), or — when
ENTIRE_TOKEN is set — the env token's aud (the bypass inside New/
NewForCluster). This precedence lives only inside coreapi; nothing else
re-derives it.
To display which core a request uses, ask the client: client.CoreOrigin().
It returns whatever was actually wired in, so the shown core can never diverge
from where the request goes. Do NOT re-resolve with
auth.ResolveControlPlaneTarget() for display — it only knows the active
context and silently ignores both ENTIRE_TOKEN and the cluster case, so it can
name a core the request never touches (this was a real bug in the mirror list
banner; see repo_mirror.go and coreapi.Client.CoreOrigin).
When a command resolves auth outside a coreapi.Client (e.g. entire auth status, which builds its own /me client), it must apply the same
env-token-first precedence itself — see resolveAuthStatusTarget /
resolveEnvTokenStatusTarget in auth.go, which branch on
auth.EnvTokenVar before falling back to the active context. logout is the
deliberate exception: it manages a stored login session, which an ephemeral
env token has none of, so it stays on the active context.
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
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
Each committed session stores the raw transcript (full.jsonl, read by CLI rewind/resume/explain) plus a best-effort compact transcript (transcript.jsonl, generated via transcript/compact and pre-sliced to the checkpoint's checkpoint_transcript_start). Both are pushed with the v1 branch. The root metadata.jsonsessions[].transcript pointer keeps targeting full.jsonl; when the compact transcript was generated the session entry also carries a compact_transcript path pointing at transcript.jsonl (omitted otherwise) so external readers can locate it next to full.jsonl.
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.
Token usage scoping - SessionState.TokenUsage is the session-wide total used by entire status; SessionState.CheckpointTokenUsage is the pending checkpoint delta since the last condensation. Checkpoint metadata must stay scoped to CheckpointTranscriptStart or the pending checkpoint delta. Cursor tokens come only from stop-hook payloads, while Copilot CLI can also backfill full-session totals from session.shutdown.
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
OPF (OpenAI Privacy Filter) runs at pre-push, not post-commit: when redaction.openai_privacy_filter.enabled is true, the PrePush hook re-redacts unpushed entire/checkpoints/v1 commits with the OPF 8th layer, builds new commits carrying an Entire-OPF-Applied: true trailer, and atomically updates the local v1 ref before pushing. Per-commit condensation stays on the fast 7-layer pipeline. See strategy/manual_commit_opf_rewrite.go and docs/security-and-privacy.md for the full flow, including divergence detection, bootstrap caps, and CAS-on-conflict semantics.
Safe to use on main/master since it never modifies commit history
manual_commit_opf_rewrite.go - Pre-push OPF re-redaction: walks unpushed v1 commits, runs OPF over their blobs, rebuilds commits with Entire-OPF-Applied: true trailer, CAS-updates the local ref. Sentinel error types (use errors.As): V1DivergedError, BootstrapTooLargeError, V1RefMovedError, OPFRuntimeFailedError.
cleanup.go - Cleanup discovery/deletion for shadow branches, session states, and checkpoint metadata
session_state.go - Package-level session state functions
hooks.go - Git hook installation
Note: checkpoint/configloader.go overrides go-git's default config loader with a symlink-following billy.Basic (osSymlinkFS) — go-git's default reads config via os.Root, which rejects absolute symlinks in any path component (e.g. a ~/.config managed by a dotfile tool), silently dropping global config so author identity fell back to "Unknown" and signing was skipped.
Deep-Dive Reference
The phase state machine, metadata directory layout, sharded checkpoint format, multi-session metadata, checkpoint ID linking, commit trailers, and concurrent-session / shadow-branch-migration behavior are documented in:
Sessions and Checkpoints - domain model, storage layout, checkpoint ID linking, commit trailers, package structure
Checkpoint Scenarios - phase state machine and worked condensation scenarios
When Modifying the Strategy
The strategy must implement the full Strategy interface
Test with mise run test - strategy tests are in *_test.go files
Keep this file and docs/architecture/sessions-and-checkpoints.md current when changing strategy behavior (AGENTS.md is a symlink to this file)
entire review Command
entire review runs a configured review profile. Keep documentation brief and user-facing.
See Review Command for usage, minimal profile config, and key files.
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
Do not combine multiple defects in one bullet or paragraph. Do not emit severity-heading paragraphs like "[HIGH] ..." without a leading bullet.
If there are no actionable findings, output only the verdict line.
Scope: review the commits unique to this branch vs origin/main, plus any uncommitted changes in the working tree. Ignore code outside this scope.
Checkpoint context from commits in scope:
79bf8e72decd: checkpoint metadata unavailable
1cf96d1dbe7e: prompt: You are reviewing one semantic feature for clawpatch. Return strict JSON only. No markdown fences. Project: { "name": "cli", "detected": { "languages": [ "go" ], "frameworks": [], "packageManagers": [], "commands": { "typecheck": "go test ./...", "lint": null, "format": null, "test": "go test ./..." } } } Feature: {...
0c902d094d5c: checkpoint metadata unavailable
Use entire explain <id> for full checkpoint context, or entire explain <id> --raw-transcript for raw transcripts.