Skip to content

Latest commit

 

History

History
173 lines (118 loc) · 43.5 KB

AGENTS.md

File metadata and controls

173 lines (118 loc) · 43.5 KB

getaway Development Guide

Plan award flights from Claude Code, backed by seats.aero availability across 28 mileage programs.

Repository Structure

getaway/
├── .claude/
│   └── components/           # cc-present block pack, installed with the plugin
├── .claude-plugin/           # Plugin + marketplace manifests (install as getaway@getaway)
├── cli/                      # Python CLI (uv project): state docs, seats.aero client, cache, judgment engine
├── skills/
│   ├── getaway/              # The flight-planning skill (SKILL.md + plan-trip.js workflow + references/)
│   ├── onboard/              # First-run onboarding skill
│   └── refresh/              # Balance/status refresh skill + gather.md shared mechanism
├── hooks/                    # Plugin-shipped capt-hook pack (hooks.json + reflect.py + onboard.py)
├── tests/workflow/           # node --test harness for plan-trip.js
├── docs/
│   ├── assets/               # Mascot logo, README banner, social card
│   └── seats-aero-api.md     # seats.aero Partner API reference
├── capt-hook.toml            # Pack manifest for the plugin-shipped hooks
├── AGENTS.md                 # This file — shared conventions
└── README.md                 # Project overview

Ask Before Assuming

When the user's request has ambiguity — unclear scope, multiple plausible interpretations, undefined edge cases, or unspecified tradeoffs — stop and ask. Propose 2-4 concrete options and let the user pick, or list the assumptions you'd otherwise make and ask which ones hold. There is no such thing as too many questions; one wrong implementation costs more than ten clarifying exchanges. Default to interrogating the user when in doubt — multiple short questions early beat a wrong direction later.

Code Review Response (Plan Re-Entry)

When the user reviews code you wrote and re-enters plan mode — whether by leaving inline diff comments, pasting a numbered list of issues, or otherwise sending review-shaped feedback after a recent edit cycle — you MUST:

  1. Delegate context-gathering to a subagent. Spawn one Explore subagent with every cite (file:line + the user's verbatim comment text). Instruct it to, per cite, Grep the file with ~5 lines of context either side of the cited line (-B 5 -A 5), and only escalate to a full Read when the ±5-line window is insufficient (e.g. the comment refers to a function defined further up). Have it also surface sibling call sites with the same issue (Grep across the module). Use the subagent's digest as your source of truth when drafting the plan. Do NOT bulk-Read the cited files yourself in the main turn — it bloats the main context window before you've even started writing the plan.
  2. Draft a new plan, not a code change. Plan-mode re-entry is the user asking "let's align on what you'll do next," not "go fix it."
  3. Inline every comment verbatim in the plan. Each comment gets a short anchor (#N, the file:line if provided, or a quoted excerpt) plus the user's exact wording in a blockquote or *"…"* italics. Do not paraphrase. The user must be able to scan the plan and see every comment they wrote reproduced exactly.
  4. Cluster when many. If there are more than ~5 comments, group them into themes (e.g. "T1 — Guards against impossible states") and list every verbatim trigger per theme. Address every cited line and extrapolate the rule to other call sites that have the same problem.
  5. Map every comment. Maintain a "verbatim feedback table" near the end of the plan with one row per comment: # | file:line | verbatim | cluster. No comment may be silently dropped.
  6. Do NOT start implementing before the plan is approved via ExitPlanMode. Delegating reads via #0 is fine; editing source is not.

The canonical shape is the Overarching themes table + per-cluster **#N (verbatim):** *"…"* anchors + final mapping table. When a comment is ambiguous, ask via AskUserQuestion rather than guessing.

Plan follow-up questions

After you write a plan, the user may respond with questions ("why this approach?", "what about X?", "did you consider Y?") rather than approval. In that case you MUST NOT edit the plan to bake in answers. Instead:

  1. Answer the question conversationally in your text response — explain the reasoning, the tradeoffs, and what you'd recommend.
  2. Propose options via AskUserQuestion — one question per ambiguity, each with 2–4 concrete options the user can pick from. Batch related questions into one AskUserQuestion call.
  3. Wait for the user's choice before editing the plan. The plan edit then reflects the user's pick, not your assumption.

Editing the plan first robs the user of the choice and forces them to diff the plan to find what you decided. Surface the decision point first.

Parallelize Independent Work

Batch and fan out cheap independent reads, greps, outlines, and network calls, plus source edits in separate worktrees or lanes; a single message carrying several independent tool calls is the first choice. Local builds, test suites, repo-wide scans or indexing, benchmarks, and similar compiler- or IO-heavy jobs share a host budget: one such job at a time across a root coordinator and every descendant lane, including workers and nested coordinators, with the root coordinator recording who holds the slot, and at most two compiler or test workers on the host at once. Right before starting one, check load average against core count, idle CPU, and free memory; when the host is saturated, defer every optional job and let CI grade the work; a necessary local reproduction waits for real headroom. CI grades tests; run a suite locally only to reproduce a red CI run or for a check no pipeline grades. Use no timed retry loops around git or stack writes and no separate fetch, rebase, or restack before a ship or submit that already does it; read a refusal and retry only when its cause changes. When budget is unavailable, queue the resource-intensive lane and continue cheap work; waiting on host budget is correct scheduling. Never stop, restart, suspend, signal, or reprioritize existing sessions, their processes, or anyone else's jobs to free capacity; use lower priority (nice, background QoS) only for disposable local jobs you create yourself in this task. Pick the surface by scale:

  • Batch tool calls in one message — the cheapest parallelism and the most missed. Independent reads, greps, globs, and read-only Bash go in a single message, never one per turn.
  • Parallel subagent calls in one message — ad-hoc independent investigations: "explore X while I check Y", multi-file reviews, independent edits. One message, N Agent tool uses, results gathered in parallel.
  • Dynamic workflow — default for substantive multi-step work, with or without ultracode: this guide is standing opt-in to the Workflow tool, and ultracode only raises the scale ceiling. The script holds the loop, branching, and intermediate results. Cleanups, sweeps, and refactors never run inline in the main agent — each one fans out as a dynamic workflow. See CLAUDE.md ## Plan Execution & Orchestration. Workflows are also the cheapest surface, and stage granularity is why: a pipeline() stage returns a value and the next stage is a fresh agent whose context is only that value, so the condense-and-respawn discipline below is enforced by the script instead of left to a delegate's judgment. schema makes the handoff structured by construction. A workflow whose stages each run hundreds of turns forfeits all of this — split the stage, don't grow it.
  • Named team — long-running peers needing agent-to-agent handoffs mid-run, via TeamCreate. Sized for a handful of peers; a teammate's own subagents are foreground-only, so an N-unit sweep inside a team delegates to a workflow instead of nesting Agent calls.

Single-step exception: one task, no parallel sibling, no follow-on → one subagent call is fine.

Bound a delegate's life, not just its scope. A delegate's cost grows with the square of its turn count: its context grows by roughly a thousand tokens per tool call and every call re-reads the whole thing, so a turn at 200 costs several times the same turn at 20. Past ~50 tool calls a delegate spends more re-reading its own history than doing the work.

At ~50 tool calls, a delegate stops and hands off rather than pressing on: it returns findings, open questions, and the next concrete step — never its transcript, never a narrated log of what it tried. The caller respawns a fresh delegate with that summary as its entire context. Splitting one 200-turn agent into four 50-turn ones costs roughly half as much and loses nothing a real handoff carries; the fresh prefix each respawn pays for is noise against the saving. This is a budget, not a deadline — a delegate that finishes in ten turns finishes, and one mid-edit at turn 50 completes the edit first, because an interrupted mutation costs more to reconstruct than the turns it saves. A delegate that keeps going past the budget records why in its handoff.

Worker model defaults

Roots run Opus 5.5. Fable is for exceptional cases only: the most sensitive local implementation, using the Mac's existing interactive authentication. Ordinary Claude workers and subdesks use Opus or Sonnet per the routing table; Opus is the default for Claude implementation workers. Auth, migrations, concurrency, or error-prone code alone does not qualify for Fable. Preserve explicitly requested models and effort within these roles. Never use Fable as a general fallback or set fallbackModel.

Set the model explicitly on worker definitions or dispatches so ordinary workers never inherit Fable.

Writing Plans

When you write a plan — in plan mode, or any "here's what I'll do" before you start editing — use this shape so it's fast to scan and complete enough to execute:

  • Context — why this change: the problem or need, what prompted it, the intended outcome.
  • Approach — the recommended approach only (not every alternative you weighed), as ordered steps. Name the critical files to touch; for a pattern repeated across many files, describe it once with a few representative paths instead of listing them all. Cite existing utilities/patterns you'll reuse, with their paths.
  • Potential Pitfalls — the sharp edges specific to this work: ordering constraints, code that looks safe to change but isn't, prior art that must not be "fixed", state that diverges from how it's described. One bullet each — front-load the gotchas you'd otherwise hit mid-implementation.
  • Workflow Plan — required in every plan; a plan without it is incomplete. One line on what the main agent alone does (track state, dispatch, decide, report), then a Phase | Shape | Agents | Blocks on | Verification table covering every fan-out the plan anticipates: Shape is pipeline / parallel / loop; Agents names each phase's model and effort per the Models table (e.g. opus xhigh ×4, gpt-6.1-sol via codex-wrapper ×2, sonnet low → codex); Blocks on names the upstream phase(s) whose output this phase consumes, — when it consumes none; Verification names the check that gates each phase's output. The table is the schedule's dependency graph, and ready rows dispatch together within the host budget, phases without an edge between them may run concurrently, and an edge exists only where a named artifact or verdict is consumed — a plan that sequences phases on anything vaguer is incomplete. Speculative lanes are rows of their own — marked (speculative), Blocks on —, worktree-isolated, the verdict that lands or discards them named in their Verification cell (CLAUDE.md § Plan Execution & Orchestration). When nothing fans out, one line saying everything stays at the main-agent level replaces the table.
  • Verification — how to prove it works end to end: the exact commands to run, tests to add, and behavior to observe.

Compact Context (ccx)

cc-context — the ccx CLI and the cc-context MCP (its tools mirror the query surface — read, search, symbol, outline, diff, edit — plus ccx_exec/ccx_exec_tools for multi-call composition and BashFormat for JSON re-encoding) — is the first stop for TARGETED code questions: a file section, a symbol, a search, a diff. It returns token-bounded output (signatures + line numbers, explicit overflow, never silent truncation) instead of raw dumps, and the capt-hook ccx guard pack rewrites the mappable token-heavy commands (raw grep, page-dump curl) to their ccx equivalents in place and warns once on the rest (bare git diff/git show, oversized Reads), which then run as written. That budget discipline covers ccx itself: never re-truncate ccx output with | head/| tail — it re-introduces silent truncation and eats the overflow footer; raise --budget, narrow with --section/-g, or compose with ccx exec (entry 16).

  1. Orient a repo → ccx repo overview
  2. "How does X work / where is Y" (intent) → ccx code search "<question>" (semantic — a native in-process engine, no external process; model weights download once into a local cache on first use; --content narrows the corpus, space-separated code|docs|config|all defaulting to code docs, honored by ccx code search/related and the MCP search/related tools)
  3. A specific symbol (where + signature) → ccx code symbol <name> (alias ccx code grok; terse by default with a counts trailer — --callers/--callees/--body/--full expand, --budget N caps an expanded card)
  4. Literal or regex text → ccx code grep <text> [paths...] [--regex] [-g GLOB]... [-i] [-w] (literal-first with auto-regex: a zero-match literal pass whose pattern carries regex metachars and compiles reruns as a regex, the header saying (auto-regex) — so a|b works without the flag; --regex forces regex from the start; --regex/-i/-w and explicit file operands run on ripgrep; system grep fills in when rg is missing. -g/--glob is the one file selector — repeatable and ordered in ripgrep's gitignore dialect: ! excludes, last match wins, any include turns the set into a whitelist, a slash-less pattern matches basenames at any depth, and it filters within explicit paths too; shared by code symbol, vcs diff, and vcs show (on those two a slashed glob is repo-root-relative rather than cwd-relative, since they filter git's changed-file list instead of walking the tree), while --scope is deleted everywhere (unknown flag, not a deprecation). One ccx twist raw ripgrep lacks: a metachar-free glob naming a real directory means its subtree — -g internal searches internal/**, the drop-in for the old --scope D (--scope D --glob G → -g 'D/**/G'). A glob anchored at a real path — -g '.venv/**/*.py' — is searched even where ignore rules would hide it, but only while every include shares that anchor: add -g '*.sh' and the ignored tree silently drops out — put both under the anchor (-g '.venv/**/*.{py,sh}') or make two calls)
  5. List files → ccx repo find <glob...> [--budget N] (globs are positionals — repeatable, ordered, same gitignore dialect and bare-directory rule as entry 4's -g, so ccx repo find internal lists internal/**; gitignore-honoring, VCS stores skipped, sorted; budget-capped with a footer counting withheld rows and ignore-hidden files; a glob anchored at a real path — .venv/**/*.py — lists files ignore rules would hide; orientation is entry 1, not "**/*")
  6. Read a file → ccx code outline <file-or-dir> first (ast-grep structural map for the languages it outlines and any directory, a markdown heading outline or an honest head window otherwise; top-level by default — --deep expands members, --section A-B windows a file), then ccx code read <file> --section A-B for the part you need (whole file: ccx code read <file> --full)
  7. Edit a file → ccx code edit <file> --at A-B#hash --content <text> (hash-verified write: refuses on anchor mismatch, re-anchors moved content, returns the new anchor so edits chain; --content - reads stdin, --delete removes the range; --match <text> addresses by exact bytes instead of a span — an ambiguous match errors listing candidate anchors, --at scopes the scan, --all replaces every occurrence)
  8. Review changes → ccx vcs diff [src] (structural, jj-aware; exact hunks: git diff -- <file>)
  9. Inspect one commit → ccx vcs show [ref] (message + structural per-file diff; default @-/HEAD)
  10. How a file evolved → ccx vcs history <path> [-n N] (per-commit sha · date · subject + changed symbols)
  11. Locate a repo/module/package on disk → ccx repo locate <name> (sibling repo, Go module, or Python package by import or dist name; prints tab-separated kind/path/version rows — an installed Python package yields both its sibling repo row and its installed package row; exit 3 when nothing resolves)
  12. Read installed dependency source (.venv, site-packages, vendored) → spawn the cc-context:dep-reader agent with the package and your question — cited conclusions come back, the source never enters your context. Inline: ccx repo locate <pkg> for the on-disk path, then entries 4/6 with that path (-g <path> or an anchored glob) — never raw rg into .venv
  13. Commit, push, watch CI → ccx vcs ship -m "<msg>" [paths...] (jj-aware commit + push + a watch over every workflow run on the pushed commit, in one call — per-run workflow · conclusion · duration · url report, plus failing jobs and a --budget-capped log excerpt when a run goes red; trailing paths scope the commit to just those files, leaving the rest of a shared working copy untouched; scoping goes below the file too — ccx vcs hunks [paths...] lists every pending hunk as a stable file:A-B#hash ref, and repeatable --skip-hunk <ref>/--only-hunk <ref> commit a file partially without ever rewriting it on disk, leaving excluded hunks (a concurrent session's, say) uncommitted in @, and refusing outright when a selection would cut an empty commit or a ref has drifted; an empty working copy refuses outright too (nothing to commit — a prior ship likely already landed it) instead of cutting an empty duplicate; and where the commit goes is one decision, resolved before any mutation and reported as a branch <name> or created <name> segment — on a non-trunk branch or bookmark ship appends to it, on trunk it appends in your own repositories and starts a branch when GitHub positively says the repository is someone else's (an org trunk rejects the commit through its protect hook and leaves it dangling; the native GitHub stack lane and the legacy gt lane always branch on trunk; actual native membership takes precedence, existing Graphite membership stays on Graphite until migrated, ccx.stack (github|graphite) selects the backend for new or untracked stacks, --no-stack bypasses both stack lanes, and --no-gt bypasses the legacy Graphite lane only while leaving native GitHub stacks active; plain git and jj ship outside both stack lanes open ordinary PRs, whereas the native stack lane also registers actual native stack metadata and edits exactly the fields this invocation restated; raw gt commands, hooks, and rules apply only to the legacy gt backend, while the native lane uses the GitHub stack API, local catalog, and git operations under the same ccx safety checks; ccx derives the name from the commit subject itself, slugified and capped, keeping the Claude-Session-Id trailer out of it), a detached HEAD or an ambiguous trunk refuses, and --branch <name>, --new-branch[=<name>], --append, and --allow-trunk state intent explicitly (--bookmark is the jj-only alias of --branch, --create the deprecated alias of --new-branch; --new-branch name and --new-branch=name both name the branch, -- keeps the positionals after a bare --new-branch as paths, and a name that is also a path on disk is refused as ambiguous); an updated remote is handled in-call on both backends — ship fetches first and rebases the stack onto the target (jj bookmark, or origin/<branch> on plain git, autostashing uncommitted work), rolling back and reporting a rebase that would conflict, and a push that still loses the race to a concurrent push re-fetches, re-rebases, and retries up to 3 attempts before failing with the manual recovery steps — though a rejected --amend push refuses instead of force-retrying over the other session's work). A live Graphite config (.git/.graphite_repo_config, resolved through the git common dir so a linked worktree counts) makes the gt lane a candidate — even in colocated jj repos; --no-gt falls back to the jj>git detection, and three gates run before any mutation, each demoting to the jj/git lane with the reason named in a leading lane <kind> (<reason>) segment: ccx.nogt set in git config (the durable opt-out for a repo carrying a stale Graphite config), GitHub positively saying the repo is someone else's — public, and you neither administer it nor share an owner or organization with it (a lookup that cannot be made keeps the lane) — and a cached probe of whether Graphite can actually submit here, since the config alone only proves gt init once ran (a probe that times out or cannot reach Graphite demotes too — a lane nobody could confirm is not one to ride — and each verdict caches for its own span: a yes a day, a no an hour, an unanswered probe a minute, so an outage costs one probe a minute, not one per command). On the gt lane commits go through gt (gt create <name> starts a stacked branch, gt modify -c appends to one, --amend amends the branch tip; an untracked branch is adopted first with gt track -f, --parent naming its parent — refused before any commit forms when the resolved parent is a branch the remote trunk already contains, pointing at --parent <branch> and ccx vcs prune instead), and the push no longer shells to gt submit at all: the gt lane calls Graphite's HTTP API directly (internal/gtapi), force-pushing every branch of the downstack in one atomic multi-ref push and then posting one submit entry per branch, bottom-up — published by default, --draft opts out, --publish says so explicitly — and since none of it runs through gt itself, none of it shows up in gt's own debug logs. The submit anchors on the remote trunk rather than the local one, fetching exactly one ref (origin/<trunk>, moving no local branch and no working copy) and reading each branch's base sha and each new pull request's title and body range off it — a local trunk left behind the remote used to make an already-upstream branch look like a real stack member, and Graphite refused the empty pull request that followed; past that one ref ship still never fetches, and it never retries there. Every downstack branch whose head the remote trunk already contains is dropped from the push and named as skipped, and ship refuses outright when the branch being shipped is itself already contained, pointing at ccx vcs prune — which now reparents the graphite rows it forgets onto the first surviving ancestor with trunk as the floor and strikes each forgotten row from its parent's children, so a prune cannot strand a stack in either direction. A needs_restack anywhere on the downstack, or a base off the fetched trunk, is no longer a refusal: ship commits first and then runs the stack rebase over the downstack, reported as restacked in isolation; the working copy holding a moved branch must be clean, and a conflict stops in a conflict-<branch> workspace with rerere off, where ccx vcs stack continue finishes the rebase, pushes, submits, and restates the PR flags, and ccx vcs stack abort drops the run; ship still refuses up front on a branch gt cannot adopt, or on --amend on trunk, and a failed submit reports its recovery step instead of retrying (gt auth for a rejected token; a push refused past its lease reports the git error, and ccx vcs stack submit restacks and resubmits the stack), the report reading submitted <branch> → PR #<n> <url>. Ship owns the pull request in every lane: --pr-title/--pr-body-file are repeatable and branch-scoped (<branch>=<value>, a bare value applying to the tip; --pr-body-file - reads stdin once, and every body file is read before the commit forms) — outside the gt lane ship opens the branch's PR when there is none and edits exactly the fields this invocation restated when there is, so a hand-edited description survives a re-ship that does not mention it; in the gt lane it fills the title and body gt submit leaves empty, the only way a downstack PR gets a body at all; --draft/--publish apply in every lane, converting an existing PR in either direction, --no-pr opts out, and a ship naming no PR flag makes no gh pr call. --reviews chains a review watch (entry 14) after the CI watch. A red run hands off to the cc-context:ci-triage agent — spawn it with the run id for root cause, a minimal excerpt, and the next step instead of the full log
  14. Stream PR review comments → ccx vcs reviews [pr-or-branch...] (attaches to open PRs — positionals mix PR numbers and branch names, none → the current branch's PR, --stack → the selected native GitHub or legacy Graphite downstack — and polls every --interval (default 30s), streaming each review verdict, inline comment, and issue comment as one block with author, locus, and a --budget-capped body; a changes_requested review carries a pointer to spawn the cc-context:pr-review-triage agent with the PR and review id; the watch exits when every watched PR is merged or closed, and Ctrl-C prints the exact resume command; --since replays history — RFC3339, a duration ago like 90m, or all, default now — so arm a Monitor on ccx vcs reviews --since 5m right after a ship to close the gap between push and attach; the watch is at-least-once, so a resume may re-print events already seen; ship --reviews chains the same watch in-call after CI)
  15. Bring the stack current with trunk → ccx vcs stack restack (lane-selected like ship, gates included — the native GitHub and legacy gt stack lanes run ccx vcs stack rebase --no-push, jj fetches and rebases the working-copy stack onto trunk() and rolls a conflict back, plain git replays the branch onto the fetched remote default branch; on the stack and git lanes a conflict moves nothing and stops in a conflict-<branch> workspace with rerere off, where ccx vcs stack continue finishes the rebase once the files are resolved and added and ccx vcs stack abort drops the run — never headless resolution; --no-stack forces the jj/git lane, while --no-gt bypasses only the legacy gt lane). ccx vcs stack rebase rebases the whole stack onto trunk and pushes it; the working copy holding a moved branch must be clean. The rest of the group cuts and lands such a stack — ccx vcs stack new <name> cuts a branch stacked on this one in a working copy of its own, leaving the calling one on its branch, ccx vcs stack list names the working copy holding each branch, and ccx vcs stack submit restacks every lane and then submits the whole stack
  16. Compose several calls / post-process any output → ccx exec '<python>' — a sandboxed script whose async host functions are every ccx query op, a gated sh(cmd), and every stateless MCP server's tools (auto-reflected, no flag needed); only the script's return value enters context. Rule of thumb: one question → one ccx call (entries 1–15, 17–23); a pipeline, filter, fan-out, or any output you'd immediately post-process (project a JSON blob, sweep signatures across files, join search hits) → exec. Discover the host functions and the Python-subset rules with ccx exec --list-tools (MCP: ccx_exec_tools), once per session.
  17. Re-encode JSON tool output → ccx format -- <cmd> (or … | ccx format) — a shape classifier picks the leanest encoding (prose, markdown table, CSV/TSV, TOON, TRON, JSONL, or compact JSON), never larger than compact JSON by bytes; --format=X forces one encoder
  18. Map a web page → ccx web outline <url> (heading tree with stable § section refs; pages cache 24h, --refresh refetches)
  19. Read one section of a page → ccx web read <url> --section <ref> (budget-capped section subtree + prev/next nav; whole page: --full)
  20. Ask a question of a page → ccx web search <url> "<question>" (top-k relevant chunks with <url> §2.3#hash cites; hybrid BM25 + local embeddings — native in-process, no uv; BM25-only with a note when the model weights are unavailable, i.e. offline with an empty cache)
  21. Which lane a mutating vcs command takes, and why → ccx vcs info (alias lane; vcs kind, selected stack and queue providers — native GitHub stacks in <git-common-dir>/gh-stack at schema version 1 vs Graphite, with actual native branch membership taking precedence, existing Graphite membership kept until migrated, ccx.stack (github|graphite) choosing new or untracked stacks, --no-stack bypassing both, --no-gt retained for legacy compatibility, and ccx.queue (trunk with TRUNK_MERGE_API_KEY) selecting the queue provider — plus repo root, branch, trunk, dirty state, Graphite config/CLI/reachability, the GitHub repo record, and the downstack with each branch's PR and whether that PR has a body; --json, --refresh refetches the cached GitHub metadata and reachability verdict, --no-stack, --no-gt; fails soft when GitHub is unreachable)
  22. A repo's stated contribution rules → ccx vcs guidelines (alias contributing; every PR template variant, CONTRIBUTING.md, code of conduct, and issue config, each served verbatim, never summarized — so a PR template can be reproduced down to its checkboxes; the GitHub payload caches for a day but local files re-read every run, since a branch switch changes CONTRIBUTING.md on disk; --json, --refresh, --full adds issue-template bodies, --budget caps per document)
  23. Every branch of the stack, and what blocks each from landing → ccx vcs status (one batched round trip for the whole stack — per branch, in stack order: its divergence from trunk, whether it sits off its parent in the native GitHub stack API or legacy gt state, its pull request's mergeability, the checks on the head and which of them the base branch's protection rule requires, every standing review and whether it was cast on the head, and a blocked line per hold. mergeable is re-asked once when GitHub answers UNKNOWN, which it usually does on a first ask, and CI is read through statusCheckRollup, never gh run list, so a repository on Buildkite reports its pipeline rather than "no CI". It also reports queue state from the configured queue provider — Trunk via ccx.queue=trunk (where an API error stays UNKNOWN with no legacy fallback), generic GitHub, or the legacy Graphite merge queue (reconstructing the admitted snapshot from merge labels, draft queue PRs, and the queue's activity comment against the branch's head history); --json, --refresh, --no-stack, --no-gt, --budget caps the human report)

Entries 9–15 and 21–23 are CLI-only (entry 12's locate step included) — the MCP mirrors the query surface (1–8) plus exec (16), format (17, as BashFormat), and web (18–20, as ccx_web_outline/ccx_web_read/ccx_web_search), not these.

A path operand missing its extension resolves itself across the path-taking ops: pkg/events where only pkg/events.py exists runs against the sibling and notes the substitution (# note: pkg/events → pkg/events.py); several candidates error listing them, none errors clean (exit 3) — never raw engine stderr.

A one-shot question about a page → spawn the cc-context:web-fetch agent with the URL and your prompt verbatim (the WebFetch drop-in: cited answer out, the page never enters your context); research spanning several pages → cc-context:web-researcher.

Durable prose — plans, reviews, memory files — cites code as path:line#hash (e.g. internal/render/finalize.go:31#k2fa); any later session resolves the cite statelessly with ccx, because the hash re-anchors by content even after the file drifts.

Reach for your LSP when the answer must be exhaustive/structural (findReferences, rename, goToImplementation) — and verify any complete-set answer ("every subclass", "every importer") by reading the candidate files: bounded views optimize for precision, not exhaustiveness — or spawn the cc-context:enumerator agent, which packages that gather-and-verify loop and returns the verified set with cites and named blind spots. Use Grep/Glob or rg only for literal content in non-source files (logs, JSON, YAML) — on source, raw rg is gated the same as raw grep.

Style

Comments are terse and used sparingly — the code documents itself through names, types, and organization. The one exception is documentation-generation comments (the doc comments your language's doc tool renders for the public API); beyond those, comment only for TODOs, non-obvious workarounds, or disabled code — never to restate the signature.

@STYLEGUIDE.md

General Rules

Minimal changes. Stay within scope; fix the issue, then stop.

Match surrounding code. Follow the conventions of the file you're in, then the module.

No defensive coding. No fallbacks, shims, or backwards-compat layers; no guards against impossible states. If unused, delete it. Crash on the unexpected.

Search before writing. Before creating a helper, query the codebase via ccx code search (intent or symbol queries both work). Sibling modules and base classes win over re-implementation.

Code stewardship. When you touch a file, fix nearby bugs, style violations, and broken tests; don't wave them off as pre-existing or out of scope.

Observe, don't infer. Inspect actual data — read fixtures, dump objects, run the code — before reasoning from assumption.

Don't use external failures as an excuse to stop. API quota, rate-limit, and outage errors rarely block the whole task; trace the catch sites and confirm a failure actually stops you before claiming it does.

Verify before asserting. Don't report something as working, fixed, blocked, or impossible until you've checked — run it, read the output, reproduce the failure. "It should work" is not "it works."

Reproduce before fixing. When something breaks, isolate the smallest failing case before editing or re-running. Re-running the whole command while changing code between runs hides the root cause; narrow to the one failing call, payload, or test first.

Research after repeated failure. After ~2 failed approaches, stop guessing and gather evidence — search the web, read the docs and source — before a third attempt.

Get a second opinion on a plateau. On a debugging plateau (2 failed attempts before a 3rd), a non-trivial architectural decision, or algorithmic/security-sensitive code, get an outside check (e.g. /codex) before committing to the approach.

Don't contort code to satisfy a checker. The type checker and linter serve the code, not the other way around. Don't reshape a data model, widen a type, or bolt on a cast(...) / narrowing-only assert isinstance(...) / blanket ignore just to silence a diagnostic. If a clean fix isn't obvious, leave the diagnostic — a visible diagnostic is preferable to scar tissue. (Most checker noise isn't worth acting on at all; act only when it flags a real bug.)

Mechanical linting. CI and hooks handle formatting and import order; fix only what needs human judgment. When reviewing code, don't flag mechanical lint violations (line length, whitespace, import order, trailing commas).

Testing. The test suite is the CI in .github/workflows/ci.yml: jq empty over both .claude-plugin manifests plus a plugin-name match and a SKILL.md frontmatter name-matches-directory check; jq empty over cli/getaway/data/*.json; the Python CLI via uv run --project cli pytest, ruff check cli, and ty check cli; the trip workflow via node --test 'tests/workflow/*.test.mjs'; and the block pack in .claude/components via bun install --frozen-lockfile && bun run typecheck && bun run build && bun run smoke plus cc-present pack lint .. Run those same commands locally before pushing.

Writing docs. When writing or revising docs, a README, a tutorial, a how-to, or reference, use the writing-docs skill (Diataxis modes, voice rules, and runnable code-sample rules) and run slop-cop check <file> --lang=markdown before you finish (slop-cop is a Go binary; if it's not on PATH, run the /slop-cop-check skill — never uvx slop-cop).

Version control. This repo is a colocated jj repo over git — prefer jj (jj describe / jj commit, jj git push) over raw git for day-to-day work. Commits stay atomic and scoped: one logical change each. For the routine commit, push, and watch-CI cycle, ccx vcs ship -m "<msg>" runs the whole dance in one call — a jj-aware commit, the push, and a watch over every workflow run on the pushed commit, with a per-run report and failure logs — instead of the three-to-six Bash calls by hand. A working copy shared with a concurrent session is no reason to bypass ship: ccx vcs ship -m "<msg>" <paths...> commits only your paths and leaves the rest of @ untouched. A single file mixing your hunks with a concurrent session's is no reason either: ccx vcs hunks <file> lists each pending hunk as a file:A-B#hash ref, and ccx vcs ship --skip-hunk <ref> commits around the foreign one — the partial commit is cut through jj's diff-editor protocol (git: a temp index), never by rewriting the file on disk. Ship also runs the repo's prek commit hooks (uvx prek) before committing. Auto-fixes are folded into the commit and a finding is reported without stopping it, because CI grades the result. A golangci-lint hook that gave no verdict (another run held its lock, a timeout, a load failure) stops the ship with nothing committed, and so does a failed public-names, the hook that refuses a teammate's name on a line a commit adds to a public repository. Before any commit, push or gh call, ship also runs public-pr-body over each --pr-body-file, which refuses a teammate's name, a picture outside a demo- or public- path or a private repository's PR in a public repository's body, and stops when it fails. --no-verify skips every one of these gates. Hunk-scoped ships skip it too and report a hooks hunk-skip segment, since a partial selection can't be verified externally. The hooks run once per ship: a commit ship has already hooked itself carries --no-verify, so git's pre-commit hook doesn't re-run them through prek's unstaged-stash path, which restores from the current index rather than a pinned tree and reports a failed restore only on stderr. A repo ship didn't hook keeps its own git hooks — no prek config, no uvx, a jj repo with no .git, a hunk selection, or a config declaring a commit-msg/prepare-commit-msg stage that prek run --files never reaches. Where the commit goes resolves before the commit forms, so a refusal — a detached HEAD, an ambiguous trunk — leaves the working copy exactly as it was: parked on a non-trunk bookmark ship appends to it and names it in the report, on trunk it appends in your own repositories and starts a branch named from the commit subject when GitHub says the repository is someone else's, and --branch <name> (jj alias --bookmark) or --new-branch[=<name>] targets a different branch explicitly. Ship also refuses an empty working copy (nothing to commit — did a prior ship already land <sha>?), so a double-run cuts no empty duplicate — a no-diff merge or a conflicted @ still commits. Drop to the manual jj steps when ship still doesn't fit, like a multi-commit split. An updated remote is not one of those cases: ship fetches first and rebases the stack onto the target itself — on plain-git repos too, autostashing uncommitted work — rolling back and reporting a rebase that would conflict, and a push rejected because origin advanced again mid-ship re-fetches, re-rebases, and retries (up to 3 attempts) before failing with the manual steps. A rejected --amend push is the exception: ship refuses rather than force-retrying over the concurrent push. The manual recovery — jj git fetch then jj rebase (your in-flight @ rides along untouched) — remains for non-ship flows and for resolving a conflicted rebase ship refused; never git stash or a worktree + cherry-pick dance.

Watch CI after every push. A push that kicks off CI isn't done until every run is green. ccx vcs ship folds this in — it pushes, then watches every workflow run on the pushed commit (found by --commit, retrying registration for up to a minute) and reports each run's conclusion, duration, and URL, plus failing jobs and a --budget-capped log excerpt when a run goes red; on a terminal the watch streams live. A CI error segment means the watch itself hit an infra failure after a successful push — the report's check: line says how to resume; a bare re-run of ship refuses (nothing to commit) instead of cutting a duplicate. For a push ship didn't make, watch the run to completion yourself before you stop — gh run watch "$(gh run list -L1 --json databaseId -q '.[0].databaseId')" --exit-status — and never walk away from a red run: when the failures are mechanical (lint, format, vet — pre-existing baseline debt included), fix them forward in an immediate follow-up commit; report-only (a cc-notes bug) is reserved for failures that need a design or owner decision. (--exit-status exits non-zero when the run fails; give the run a moment to register before watching.)

Stack provider selection prefers native GitHub stacks (<git-common-dir>/gh-stack, schema version 1, backed by the GitHub stack API) for new stacks while retaining the Graphite backend: actual native branch membership takes precedence, existing Graphite branch membership stays on Graphite until deliberately migrated, and ccx.stack (github or graphite) chooses the backend for new or untracked stacks (--no-stack bypasses both; --no-gt remains for legacy compatibility). Queue provider selection is configured separately via ccx.queue (such as trunk, authenticated with the scoped v2 TRUNK_MERGE_API_KEY) without assuming every native GitHub stack uses Trunk. In a repo riding the Graphite lane (.git/.graphite_repo_config, found through the git common dir in a linked worktree too), ship is gated before any mutation: ccx.nogt set in git config, GitHub saying the repo is someone else's, or Graphite reporting it cannot submit here each demote to the jj/git flow with the reason in a leading lane <kind> (<reason>) segment, and ccx vcs info (alias lane) reports the selected provider, verdict, and why without mutating anything. On the native GitHub stack lane or the gt lane, ship cuts or updates the stacked branch and lands it as a submitted PR (--tip-only preserves already-approved or queued lower commits) — published by default, --draft opts out — never committing onto trunk. ccx vcs stack restack is the one-command catch-up with trunk — ccx vcs stack rebase --no-push on a stack lane / jj fetch + rebase onto trunk() / git replay onto the fetched remote trunk — and a conflict stops in a conflict-<branch> workspace, where ccx vcs stack continue finishes and ccx vcs stack abort drops the run; ccx vcs stack submit restacks and resubmits the whole stack; and the signal needn't stop at CI: ship --reviews keeps streaming review comments until the submitted PRs merge or close, and ccx vcs reviews attaches the same watch to an existing PR.