Implement Checkpoint Resume Command

Claude Code·pfleidi·2mo ago·75hr 7min·9 Checkpoints·22 file changes·+977/-140·1.6M tokens

Using the brainstorming skill, I'd like to introduce a new command called entire checkpoint resume hoping it would fully replace entire session resume someday. I'd like it to behave the same as entire session resume with some differences:

  • It should behave similar to entire explain in the sense that it should have --checkpoint and --commit flags and by default takes a checkpoint ID, a commit sha and a branch (like entire session resume)
  • It should re-use as much of the existing code as we have and the lookup should be somewhat performant. Investigate how explain manages to figure out commit shas or checkpoint IDs. I'm assuming there's a pattern we can apply to figure out which input is which
  • The command should allow to be fully driven by an agent if necessary
2mo ago·8.7s

Base directory for this skill: /Users/pfleidi/.claude/plugins/cache/claude-plugins-official/superpowers/6.0.3/skills/brainstorming

Brainstorming Ideas Into Designs

Help turn ideas into fully formed designs and specs through natural collaborative dialogue.

Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.

<HARD-GATE> Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity. </HARD-GATE>

Anti-Pattern: "This Is Too Simple To Need A Design"

Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.

Checklist

You MUST create a task for each of these items and complete them in order:

  1. Explore project context — check files, docs, recent commits
  2. Offer the visual companion just-in-time — NOT upfront. The first time a question would genuinely be clearer shown than described, offer it then (its own message); on approval its browser tab opens for you. If no visual question ever arises, never offer it. See the Visual Companion section below.
  3. Ask clarifying questions — one at a time, understand purpose/constraints/success criteria
  4. Propose 2-3 approaches — with trade-offs and your recommendation
  5. Present design — in sections scaled to their complexity, get user approval after each section
  6. Write design doc — save to docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md and commit
  7. Spec self-review — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
  8. User reviews written spec — ask user to review the spec file before proceeding
  9. Transition to implementation — invoke writing-plans skill to create implementation plan

Process Flow

The terminal state is invoking writing-plans. Do NOT invoke frontend-design, mcp-builder, or any other implementation skill. The ONLY skill you invoke after brainstorming is writing-plans.

The Process

Understanding the idea:

  • Check out the current project state first (files, docs, recent commits)
  • Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
  • If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
  • For appropriately-scoped projects, ask questions one at a time to refine the idea
  • Prefer multiple choice questions when possible, but open-ended is fine too
  • Only one question per message - if a topic needs more exploration, break it into multiple questions
  • Focus on understanding: purpose, constraints, success criteria

Exploring approaches:

  • Propose 2-3 different approaches with trade-offs
  • Present options conversationally with your recommendation and reasoning
  • Lead with your recommended option and explain why

Presenting the design:

  • Once you believe you understand what you're building, present the design
  • Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
  • Ask after each section whether it looks right so far
  • Cover: architecture, components, data flow, error handling, testing
  • Be ready to go back and clarify if something doesn't make sense

Design for isolation and clarity:

  • Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
  • For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
  • Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
  • Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.

Working in existing codebases:

  • Explore the current structure before proposing changes. Follow existing patterns.
  • Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
  • Don't propose unrelated refactoring. Stay focused on what serves the current goal.

After the Design

Documentation:

  • Write the validated design (spec) to docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md
    • (User preferences for spec location override this default)
  • Use elements-of-style:writing-clearly-and-concisely skill if available
  • Commit the design document to git

Spec Self-Review: After writing the spec document, look at it with fresh eyes:

  1. Placeholder scan: Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
  2. Internal consistency: Do any sections contradict each other? Does the architecture match the feature descriptions?
  3. Scope check: Is this focused enough for a single implementation plan, or does it need decomposition?
  4. Ambiguity check: Could any requirement be interpreted two different ways? If so, pick one and make it explicit.

Fix any issues inline. No need to re-review — just fix and move on.

User Review Gate: After the spec review loop passes, ask the user to review the written spec before proceeding:

"Spec written and committed to <path>. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."

Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.

Implementation:

  • Invoke the writing-plans skill to create a detailed implementation plan
  • Do NOT invoke any other skill. writing-plans is the next step.

Key Principles

  • One question at a time - Don't overwhelm with multiple questions
  • Multiple choice preferred - Easier to answer than open-ended when possible
  • YAGNI ruthlessly - Remove unnecessary features from all designs
  • Explore alternatives - Always propose 2-3 approaches before settling
  • Incremental validation - Present design, get approval before moving on
  • Be flexible - Go back and clarify when something doesn't make sense

Visual Companion

A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.

Offering the companion (just-in-time): Do NOT offer it upfront. Wait until a question would genuinely be clearer shown than told — a real mockup / layout / diagram question, not merely a UI topic. The first time that happens, offer it then, as its own message:

"This next part might be easier if I show you — I can put together mockups, diagrams, and comparisons in a browser tab as we go. It's still new and can be token-intensive. Want me to? I'll open it for you."

This offer MUST be its own message. Only the offer — no clarifying question, summary, or other content. Wait for the user's response. If they accept, start the server with --open so their browser opens to the first screen automatically. If they decline, continue text-only and don't offer again unless they raise it.

Per-question decision: Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: would the user understand this better by seeing it than reading it?

  • Use the browser for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
  • Use the terminal for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions

A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser.

If they agree to the companion, read the detailed guide before proceeding: skills/brainstorming/visual-companion.md

ARGUMENTS: New command entire checkpoint resume intended to eventually replace entire session resume, with explain-style --checkpoint/--commit flags and positional auto-detection of checkpoint ID / commit sha / branch, code reuse, and agent-drivable operation

2mo ago·2m

I have a good picture of resume.go and explain.go now. Let me check the command group wiring and the checkpoint ID package to understand the auto-detection pattern.

Ask me again since I accidentally clicked on an option and selected it but didn't want to

2mo ago·10m

No response requested.

Yes?

2mo ago·30m

What would you like to clarify about the checkout question before answering?

I personally don't think that checking out a given branch would be very helpful. We could check out the provided branch or the git sha associated with a particular checkpoint but that state might be super outdated and not particularly helpful. What other options do we have?

2mo ago·1h 11m

What would you like to clarify about the detection order or the flag set?

I think I've come to a few conclusions:

  • The --branch option doesn't make any sense if we won't be checking out any changes into the current worktree
  • Given that trail resume and session resume already exist and both check out work in progress, I don't think that resume as a name would be fitting for this command if it didn't mirror the existing behavior
  • If we don't check out files in git, this command wouldn't work as a drop-in replacement for session resume

So the question for me here is:

  • Would this command still be useful
  • Should it allow checking out a git sha to it can actually
2mo ago·40m

What would you like to clarify about the bare-invocation behavior?

First and foremost, I don't think we currently are resuming sessions. Last time I checked entire session resume specifically restored all sessions in a particular checkpoint. Is that still the case. Second, I think it must be possible for an AI agent to drive the checkpoint resume. I'm tempted to say: When in an interactive shell, open a selection showing the last X number of checkpoints (similar to session resume with the same number of items). When no interactive shell is present, we should list the same checkpoints without a TUI.

2mo ago·4m

Here's the design, in two batches. First: command surface and target resolution.


Design: entire checkpoint resume — part 1

1. Command surface

Registered in newCheckpointGroupCmd alongside list/explain/tokens/search. Positional arg is mutually exclusive with the three target flags, and the flags with each other (explain's exact validation pattern). session resume stays completely untouched — no deprecation, no alias, no hint. The command shows up in agent-help automatically since it renders live from the cobra tree.

2. Target resolution (the explain pattern, extended)

Resolution order for the positional arg:

  1. Checkpoint ID prefix — match against the persistent store's List(), with the remote-fetch retry on miss (matchCheckpointPrefixWithRemoteFallback, same as explain). Ambiguous prefix → explain's styled failure listing the matches.
  2. Branch namebranchCommit() already resolves local branch then origin/<name>. Checked before commit because a branch name also parses as a revision.
  3. Commit revisionresolveCommitUnambiguous (ambiguity-detecting rev-parse) → trailers.ParseAllCheckpoints on the commit message. Multiple checkpoint trailers on one commit (squash merge) → resolveLatestCheckpoint by CreatedAt, same as session resume. No trailer → explain-style "no associated Entire checkpoint" message.

The forced flags jump straight to the corresponding step. Scope note: targets resolve to committed checkpoints only — temp checkpoints on shadow branches (which explain also handles) aren't resumable via RestoreLogsOnly and stay out of scope.

3. Resume flow per resolved target

  • Branch → exactly today's runResume: checkout (with fetch-from-origin prompt, --force skips), find latest checkpoint on branch-only commits, restore all its sessions, launch/print.
  • Checkpoint ID (direct or via commit trailer) → find its containing branch with the picker's buildCheckpointBranchIndex (default branch indexed first, bounded walk):
    • branch found, checked out in another worktree → print the existing worktree-clash pointer, stop
    • branch found → resumeSessionOnBranch (checkout branch tip + restore that specific checkpoint)
    • no branch found → fall back to restore-only via resumeByCheckpointID with an explanatory line ("checkpoint's commit isn't on any local branch; restored session logs without switching branches") — resuming a fetched teammate checkpoint still works
  • After restore, existing continueRestoredSessions behavior: TTY asks whether/which session to launch; non-TTY prints all resume commands.

Does part 1 look right so far? Anything you'd change before I present part 2 (picker/non-TTY listing, error handling, testing)?

Sounds good so far

2mo ago·23.1s

Design: entire checkpoint resume — part 2

4. Bare invocation: checkpoint picker + non-TTY listing

Data source is the persistent store's List() (not local session-state files like session resume's picker), sorted by CreatedAt descending, capped at a new package constant (proposal: 20). Each entry resolves its branch best-effort via the same buildCheckpointBranchIndex.

  • TTY: a huh select (via NewAccessibleForm, matching the existing picker) with one row per checkpoint: short checkpoint ID, relative age, branch (or "no local branch"), and first line of the session's prompt/summary when cheaply available from the list metadata. Selecting one enters the checkpoint-ID flow from part 1 (branch checkout or restore-only fallback).
  • Non-TTY: the same entries as plain text — full checkpoint ID, timestamp, branch, prompt line — followed by the hint resume: entire checkpoint resume <id>. Full information, stable identifiers, no truncation of IDs; satisfies the repo's agent-safe-fallback rule. No --json in v1 — entire explain --json already lists checkpoints machine-readably; we can add --json here later if agents want it.

5. Error handling

All reused paths keep their existing behavior: ambiguous checkpoint/commit prefixes render the styled failure block + SilentError; uncommitted changes block checkout with the existing message; missing metadata falls through checkRemoteMetadata's fetch cascade. New errors are three: "nothing matched <target> as a checkpoint, branch, or commit", the no-trailer commit message (reused rendering), and the restore-only fallback note — the first gets a hint pointing at entire checkpoint list.

6. Testing

  • Unit tests (checkpoint_resume_test.go): resolution ordering — checkpoint prefix beats branch beats commit; a branch named like a hex sha resolves as branch; forced flags bypass detection; ambiguity errors; commit-without-trailer; mutual-exclusion validation.
  • Integration tests (isolated testutil.InitRepo repos): resume by checkpoint ID end-to-end (checkpoint on a branch → checkout + restored log), restore-only fallback when the branch is deleted, non-TTY bare listing via execx.NonInteractive, and --force overwrite semantics.
  • No E2E addition; canary suite must still pass (mise run test:e2e:canary) since no prompts change.

7. Docs

CLAUDE.md's command-layout section gains resume under the checkpoint group (and AGENTS.md follows via symlink). No changelog edits.


Does part 2 look right? If yes, I'll write the spec doc — given your global rule about plan files, I'd put it at docs/superpowers/specs/2026-07-06-checkpoint-resume-design.md but not commit it unless you say otherwise.

Sounds good

2mo ago·1m

Spec written to docs/superpowers/specs/2026-07-06-checkpoint-resume-design.md — self-reviewed for placeholders, contradictions, and ambiguity (fixed nothing material; the one soft spot, "prompt line when available from list metadata", is deliberately marked best-effort). Left uncommitted per your plan-files rule.

Please review the spec and let me know if you want changes. Once you approve, I'll move to the implementation plan — per your global workflow that means plan mode with an execution mode and commit shape declared up front.

I approve

2mo ago·20.1s

Spec approved. Moving to the implementation plan via the writing-plans skill:

Base directory for this skill: /Users/pfleidi/.claude/plugins/cache/claude-plugins-official/superpowers/6.0.3/skills/writing-plans

Writing Plans

Overview

Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste. Document everything they need to know: which files to touch for each task, code, testing, docs they might need to check, how to test it. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.

Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design very well.

Announce at start: "I'm using the writing-plans skill to create the implementation plan."

Context: If working in an isolated worktree, it should have been created via the superpowers:using-git-worktrees skill at execution time.

Save plans to: docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md

  • (User preferences for plan location override this default)

Scope Check

If the spec covers multiple independent subsystems, it should have been broken into sub-project specs during brainstorming. If it wasn't, suggest breaking this into separate plans — one per subsystem. Each plan should produce working, testable software on its own.

File Structure

Before defining tasks, map out which files will be created or modified and what each one is responsible for. This is where decomposition decisions get locked in.

  • Design units with clear boundaries and well-defined interfaces. Each file should have one clear responsibility.
  • You reason best about code you can hold in context at once, and your edits are more reliable when files are focused. Prefer smaller, focused files over large ones that do too much.
  • Files that change together should live together. Split by responsibility, not by technical layer.
  • In existing codebases, follow established patterns. If the codebase uses large files, don't unilaterally restructure - but if a file you're modifying has grown unwieldy, including a split in the plan is reasonable.

This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently.

Task Right-Sizing

A task is the smallest unit that carries its own test cycle and is worth a fresh reviewer's gate. When drawing task boundaries: fold setup, configuration, scaffolding, and documentation steps into the task whose deliverable needs them; split only where a reviewer could meaningfully reject one task while approving its neighbor. Each task ends with an independently testable deliverable.

Bite-Sized Task Granularity

Each step is one action (2-5 minutes):

  • "Write the failing test" - step
  • "Run it to make sure it fails" - step
  • "Implement the minimal code to make the test pass" - step
  • "Run the tests and make sure they pass" - step
  • "Commit" - step

Plan Document Header

Every plan MUST start with this header:

Task Structure

No Placeholders

Every step must contain the actual content an engineer needs. These are plan failures — never write them:

  • "TBD", "TODO", "implement later", "fill in details"
  • "Add appropriate error handling" / "add validation" / "handle edge cases"
  • "Write tests for the above" (without actual test code)
  • "Similar to Task N" (repeat the code — the engineer may be reading tasks out of order)
  • Steps that describe what to do without showing how (code blocks required for code steps)
  • References to types, functions, or methods not defined in any task

Remember

  • Exact file paths always
  • Complete code in every step — if a step changes code, show the code
  • Exact commands with expected output
  • DRY, YAGNI, TDD, frequent commits

Self-Review

After writing the complete plan, look at the spec with fresh eyes and check the plan against it. This is a checklist you run yourself — not a subagent dispatch.

1. Spec coverage: Skim each section/requirement in the spec. Can you point to a task that implements it? List any gaps.

2. Placeholder scan: Search your plan for red flags — any of the patterns from the "No Placeholders" section above. Fix them.

3. Type consistency: Do the types, method signatures, and property names you used in later tasks match what you defined in earlier tasks? A function called clearLayers() in Task 3 but clearFullLayers() in Task 7 is a bug.

If you find issues, fix them inline. No need to re-review — just fix and move on. If you find a spec requirement with no task, add the task.

Execution Handoff

After saving the plan, offer execution choice:

"Plan complete and saved to docs/superpowers/plans/<filename>.md. Two execution options:

1. Subagent-Driven (recommended) - I dispatch a fresh subagent per task, review between tasks, fast iteration

2. Inline Execution - Execute tasks in this session using executing-plans, batch execution with checkpoints

Which approach?"

If Subagent-Driven chosen:

  • REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development
  • Fresh subagent per task + two-stage review

If Inline Execution chosen:

  • REQUIRED SUB-SKILL: Use superpowers:executing-plans
  • Batch execution with checkpoints for review

ARGUMENTS: Implementation plan for entire checkpoint resume, from approved spec at docs/superpowers/specs/2026-07-06-checkpoint-resume-design.md. Per user's global workflow, the plan must declare an execution mode (step-by-step default) and a commit shape up front.

2mo ago·9m

I'm using the writing-plans skill to create the implementation plan. First, let me pin down the exact signatures of every helper the plan will reuse.

Continue

2mo ago·3m

Plan complete and saved to docs/superpowers/plans/2026-07-06-checkpoint-resume.md. It declares step-by-step execution (new public CLI surface) and a 3-commit shape:

  1. checkpoint resume: add command with target resolution — new checkpoint_resume.go with flags, auto-detection (checkpoint → branch → commit, gated by a cheap shape-regex so non-ID-looking targets never hit the store or remote), the three resume flows, and 6 unit tests
  2. checkpoint resume: bare picker and non-TTY listing — newest-20 checkpoint picker plus the plain-text agent-safe fallback, 3 tests
  3. checkpoint resume: integration tests and docs — two spawned-binary integration tests and the CLAUDE.md command-layout update

Self-review found one spec deviation worth flagging: checkpoint.CheckpointInfo (the store's list metadata) carries no prompt text, so picker rows show ID · branch · agent · age instead of a prompt line — fetching prompts would cost one store read per row. That's recorded in the plan with rationale.

Two execution options:

1. Subagent-Driven (recommended by the skill) — I dispatch a fresh subagent per task, review between tasks.

2. Inline Execution — I execute the tasks in this session, pausing at each of the three checkpoints for your review and commit approval (this maps one-to-one onto your step-by-step workflow).

Which approach?

1

2mo ago·9.6s

Base directory for this skill: /Users/pfleidi/.claude/plugins/cache/claude-plugins-official/superpowers/6.0.3/skills/subagent-driven-development

Subagent-Driven Development

Execute plan by dispatching a fresh implementer subagent per task, a task review (spec compliance + code quality) after each, and a broad whole-branch review at the end.

Why subagents: You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.

Core principle: Fresh subagent per task + task review (spec + quality) + broad final review = high quality, fast iteration

Narration: between tool calls, narrate at most one short line — the ledger and the tool results carry the record.

Continuous execution: Do not pause to check in with your human partner between tasks. Execute all tasks from the plan without stopping. The only reasons to stop are: BLOCKED status you cannot resolve, ambiguity that genuinely prevents progress, or all tasks complete. "Should I continue?" prompts and progress summaries waste their time — they asked you to execute the plan, so execute it.

When to Use

vs. Executing Plans (parallel session):

  • Same session (no context switch)
  • Fresh subagent per task (no context pollution)
  • Review after each task (spec compliance + code quality), broad review at the end
  • Faster iteration (no human-in-loop between tasks)

The Process

Pre-Flight Plan Review

Before dispatching Task 1, scan the plan once for conflicts:

  • tasks that contradict each other or the plan's Global Constraints
  • anything the plan explicitly mandates that the review rubric treats as a defect (a test that asserts nothing, verbatim duplication of a logic block)

Present everything you find to your human partner as one batched question — each finding beside the plan text that mandates it, asking which governs — before execution begins, not one interrupt per discovery mid-plan. If the scan is clean, proceed without comment. The review loop remains the net for conflicts that only emerge from implementation.

Model Selection

Use the least powerful model that can handle each role to conserve cost and increase speed.

Mechanical implementation tasks (isolated functions, clear specs, 1-2 files): use a fast, cheap model. Most implementation tasks are mechanical when the plan is well-specified.

Integration and judgment tasks (multi-file coordination, pattern matching, debugging): use a standard model.

Architecture and design tasks: use the most capable available model. The final whole-branch review is one of these — dispatch it on the most capable available model, not the session default.

Review tasks: choose the model with the same judgment, scaled to the diff's size, complexity, and risk. A small mechanical diff does not need the most capable model; a subtle concurrency change does.

Always specify the model explicitly when dispatching a subagent. An omitted model inherits your session's model — often the most capable and most expensive — which silently defeats this section.

Turn count beats token price. Wall-clock and context cost scale with how many turns a subagent takes, and the cheapest models routinely take 2-3× the turns on multi-step work — costing more overall. Use a mid-tier model as the floor for reviewers and for implementers working from prose descriptions. When the task's plan text contains the complete code to write, the implementation is transcription plus testing: use the cheapest tier for that implementer. Single-file mechanical fixes also take the cheapest tier.

Task complexity signals (implementation tasks):

  • Touches 1-2 files with a complete spec → cheap model
  • Touches multiple files with integration concerns → standard model
  • Requires design judgment or broad codebase understanding → most capable model

Handling Implementer Status

Implementer subagents report one of four statuses. Handle each appropriately:

DONE: Generate the review package (scripts/review-package BASE HEAD, from this skill's directory — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never HEAD~1, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path.

DONE_WITH_CONCERNS: The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns are about correctness or scope, address them before review. If they're observations (e.g., "this file is getting large"), note them and proceed to review.

NEEDS_CONTEXT: The implementer needs information that wasn't provided. Provide the missing context and re-dispatch.

BLOCKED: The implementer cannot complete the task. Assess the blocker:

  1. If it's a context problem, provide more context and re-dispatch with the same model
  2. If the task requires more reasoning, re-dispatch with a more capable model
  3. If the task is too large, break it into smaller pieces
  4. If the plan itself is wrong, escalate to the human

Never ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change.

Handling Reviewer ⚠️ Items

The task reviewer may report "⚠️ Cannot verify from diff" items — requirements that live in unchanged code or span tasks. These do not block the rest of the review, but you must resolve each one yourself before marking the task complete: you hold the plan and cross-task context the reviewer lacks. If you confirm an item is a real gap, treat it as a failed spec review — send it back to the implementer and re-review.

Constructing Reviewer Prompts

Per-task reviews are task-scoped gates. The broad review happens once, at the final whole-branch review. When you fill a reviewer template:

  • Do not add open-ended directives like "check all uses" or "run race tests if useful" without a concrete, task-specific reason
  • Do not ask a reviewer to re-run tests the implementer already ran on the same code — the implementer's report carries the test evidence
  • Do not pre-judge findings for the reviewer — never instruct a reviewer to ignore or not flag a specific issue. If you believe a finding would be a false positive, let the reviewer raise it and adjudicate it in the review loop. If the prompt you are writing contains "do not flag," "don't treat X as a defect," "at most Minor," or "the plan chose" — stop: you are pre-judging, usually to spare yourself a review loop.
  • The global-constraints block you hand the reviewer is its attention lens. Copy the binding requirements verbatim from the plan's Global Constraints section or the spec: exact values, exact formats, and the stated relationships between components ("same layout as X", "matches Y"). The reviewer's template already carries the process rules (YAGNI, test hygiene, review method) — the constraints block is for what THIS project's spec demands.
  • Hand the reviewer its diff as a file: run this skill's scripts/review-package BASE HEAD and pass the reviewer the file path it prints (or, without bash: git log --oneline, git diff --stat, and git diff -U10 for the range, redirected to one uniquely named file). The output never enters your own context, and the reviewer sees the commit list, stat summary, and full diff with context in one Read call. Use the BASE you recorded before dispatching the implementer — never HEAD~1, which silently truncates multi-commit tasks.
  • A dispatch prompt describes one task, not the session's history. Do not paste accumulated prior-task summaries ("state after Tasks 1-3") into later dispatches — a real session's dispatch hit 42k chars of which 99% was pasted history. A fresh subagent needs its task, the interfaces it touches, and the global constraints. Nothing else.
  • Dispatch fix subagents for Critical and Important findings. Record Minor findings in the progress ledger as you go, and point the final whole-branch review at that list so it can triage which must be fixed before merge. A roll-up nobody reads is a silent discard.
  • A finding labeled plan-mandated — or any finding that conflicts with what the plan's text requires — is the human's decision, like any plan contradiction: present the finding and the plan text, ask which governs. Do not dismiss the finding because the plan mandates it, and do not dispatch a fix that contradicts the plan without asking.
  • The final whole-branch review gets a package too: run scripts/review-package MERGE_BASE HEAD (MERGE_BASE = the commit the branch started from, e.g. git merge-base main HEAD) and include the printed path in the final review dispatch, so the final reviewer reads one file instead of re-deriving the branch diff with git commands.
  • Every fix dispatch carries the implementer contract: the fix subagent re-runs the tests covering its change and reports the results. Name the covering test files in the dispatch — a one-line fix does not need the whole suite. Before re-dispatching the reviewer, confirm the fix report contains the covering tests, the command run, and the output; dispatch the re-review once all three are present.
  • If the final whole-branch review returns findings, dispatch ONE fix subagent with the complete findings list — not one fixer per finding. Per-finding fixers each rebuild context and re-run suites; a real session's final-review fix wave cost more than all its tasks combined.

File Handoffs

Everything you paste into a dispatch prompt — and everything a subagent prints back — stays resident in your context for the rest of the session and is re-read on every later turn. Hand artifacts over as files:

  • Task brief: before dispatching an implementer, run this skill's scripts/task-brief PLAN_FILE N — it extracts the task's full text to a uniquely named file and prints the path. Compose the dispatch so the brief stays the single source of requirements. Your dispatch should contain: (1) one line on where this task fits in the project; (2) the brief path, introduced as "read this first — it is your requirements, with the exact values to use verbatim"; (3) interfaces and decisions from earlier tasks that the brief cannot know; (4) your resolution of any ambiguity you noticed in the brief; (5) the report-file path and report contract. Exact values (numbers, magic strings, signatures, test cases) appear only in the brief.
  • Report file: name the implementer's report file after the brief (brief …/task-N-brief.md → report …/task-N-report.md) and put it in the dispatch prompt. The implementer writes the full report there and returns only status, commits, a one-line test summary, and concerns.
  • Reviewer inputs: the task reviewer gets three paths — the same brief file, the report file, and the review package — plus the global constraints that bind the task.
  • Fix dispatches append their fix report (with test results) to the same report file and return a short summary; re-reviews read the updated file.

Durable Progress

Conversation memory does not survive compaction. In real sessions, controllers that lost their place have re-dispatched entire completed task sequences — the single most expensive failure observed. Track progress in a ledger file, not only in todos.

  • At skill start, check for a ledger: cat "$(git rev-parse --show-toplevel)/.superpowers/sdd/progress.md". Tasks listed there as complete are DONE — do not re-dispatch them; resume at the first task not marked complete.
  • When a task's review comes back clean, append one line to the ledger in the same message as your other bookkeeping: Task N: complete (commits <base7>..<head7>, review clean).
  • The ledger is your recovery map: the commits it names exist in git even when your context no longer remembers creating them. After compaction, trust the ledger and git log over your own recollection.
  • git clean -fdx will destroy the ledger (it's git-ignored scratch); if that happens, recover from git log.

Prompt Templates

Example Workflow

Advantages

vs. Manual execution:

  • Subagents follow TDD naturally
  • Fresh context per task (no confusion)
  • Parallel-safe (subagents don't interfere)
  • Subagent can ask questions (before AND during work)

vs. Executing Plans:

  • Same session (no handoff)
  • Continuous progress (no waiting)
  • Review checkpoints automatic

Efficiency gains:

  • Controller curates exactly what context is needed; bulk artifacts move as files, not pasted text
  • Subagent gets complete information upfront
  • Questions surfaced before work begins (not after)

Quality gates:

  • Self-review catches issues before handoff
  • Task review carries two verdicts: spec compliance and code quality
  • Review loops ensure fixes actually work
  • Spec compliance prevents over/under-building
  • Code quality ensures implementation is well-built

Cost:

  • More subagent invocations (implementer + reviewer per task)
  • Controller does more prep work (extracting all tasks upfront)
  • Review loops add iterations
  • But catches issues early (cheaper than debugging later)

Red Flags

Never:

  • Start implementation on main/master branch without explicit user consent
  • Skip task review, or accept a report missing either verdict (spec compliance AND task quality are both required)
  • Proceed with unfixed issues
  • Dispatch multiple implementation subagents in parallel (conflicts)
  • Make a subagent read the whole plan file (hand it its task brief — scripts/task-brief — instead)
  • Skip scene-setting context (subagent needs to understand where task fits)
  • Ignore subagent questions (answer before letting them proceed)
  • Accept "close enough" on spec compliance (reviewer found spec issues = not done)
  • Skip review loops (reviewer found issues = implementer fixes = review again)
  • Let implementer self-review replace actual review (both are needed)
  • Tell a reviewer what not to flag, or pre-rate a finding's severity in the dispatch prompt ("treat it as Minor at most") — the plan's example code is a starting point, not evidence that its weaknesses were chosen
  • Dispatch a task reviewer without a diff file — generate it first (scripts/review-package BASE HEAD) and name the printed path in the prompt
  • Move to next task while the review has open Critical/Important issues
  • Re-dispatch a task the progress ledger already marks complete — check the ledger (and git log) after any compaction or resume

If subagent asks questions:

  • Answer clearly and completely
  • Provide additional context if needed
  • Don't rush them into implementation

If reviewer finds issues:

  • Implementer (same subagent) fixes them
  • Reviewer reviews again
  • Repeat until approved
  • Don't skip the re-review

If subagent fails task:

  • Dispatch fix subagent with specific instructions
  • Don't try to fix manually (context pollution)

Integration

Required workflow skills:

  • superpowers:using-git-worktrees - Ensures isolated workspace (creates one or verifies existing)
  • superpowers:writing-plans - Creates the plan this skill executes
  • superpowers:requesting-code-review - Code review template for the final whole-branch review
  • superpowers:finishing-a-development-branch - Complete development after all tasks

Subagents should use:

  • superpowers:test-driven-development - Subagents follow TDD for each task

Alternative workflow:

  • superpowers:executing-plans - Use for parallel session instead of same-session execution

ARGUMENTS: Execute docs/superpowers/plans/2026-07-06-checkpoint-resume.md task-by-task. Step-by-step mode: after each task, present the diff to the user and wait for explicit commit approval before committing and starting the next task.

2mo ago·13m

Task 1 checkpoint — ready for your review. No commits made yet.

What changed:

  • New cmd/entire/cli/checkpoint_resume.go (~230 lines): entire checkpoint resume [target] with --checkpoint/-c, --commit, --branch, --force/-f. Auto-detection: checkpoint-ID prefix (gated by a shape regex so non-ID-looking targets never touch the store or remote) → branch via branchCommit (local then origin/, no network) → commit revision → trailer. Checkpoint targets check out the containing branch via buildCheckpointBranchIndex + resumeSessionOnBranch, print the worktree-clash pointer when the branch lives elsewhere, and fall back to restore-only (resumeByCheckpointID) when no local branch contains the checkpoint. Bare invocation is a stub error until Task 2's picker lands.
  • New cmd/entire/cli/checkpoint_resume_test.go: 6 tests — flag exclusivity, checkpoint-beats-branch (HEAD unmoved), branch-beats-commit (hex-named branch checks out), --commit trailer resolution, no-trailer error, nothing-matched error.
  • checkpoint_group.go: registers the command, adds it to group help + example (and I fixed the now-stale doc comment the reviewer flagged).

Verification (implementer-run, reviewer-verified against the diff): go test -run 'TestCheckpointResume' ./cmd/entire/cli/ -count=1 → PASS (6/6); full package go test ./cmd/entire/cli/ -count=1 → ok; mise run fmt && mise run lint → 0 issues.

Two things worth knowing:

  1. One test commits a .entire/.gitignore in its fixture because logging.Init creates .entire/logs/, which would trip resume's pre-existing uncommitted-changes check in the bare test repo (real repos have this ignored via entire enable). Test-only; no production change.
  2. Reviewer minor, deferred to final review: branch-target paths init logging twice (here + inside runResume) — idempotent, no behavior impact.

Planned commit: checkpoint resume: add command with target resolution. Approve the commit?

commit and continue

2mo ago·7m

Task 2 checkpoint — ready for your review. Review came back spec ✅, quality approved; the brief's code applied verbatim with no adaptations.

What changed (working tree on top of 677c3ce0f0):

  • checkpoint_resume.go (+98): the Task 1 stub is now the real bare-invocation flow. recentCheckpoints sorts lookup.committed newest-first and caps at 20; non-TTY prints full checkpoint IDs, local timestamp, branch (- when none), agent, and the hint Resume one with: entire checkpoint resume <checkpoint-id>; TTY shows a huh select (accessible-form aware) with rows shortID · branch · agent · age plus Cancel, and a selection enters the same resumeResolvedCheckpoint flow as an explicit ID.
  • checkpoint_resume_test.go (+66): sort/cap unit test, non-TTY listing test (both IDs present, newest first, hint), empty-store message test.

Verification: 9/9 focused tests pass, mise run fmt && mise run lint clean (0 issues). The mid-task IDE compile error you may have seen was stale — I re-ran the test to confirm.

Reviewer minors, deferred to final review: cancelling the picker exits silently (plan-mandated wording gap), and the TTY picker rendering itself has no automated test (plan-scoped — huh forms aren't unit-testable without a TTY harness).

Planned commit: checkpoint resume: bare picker and non-TTY listing. Approve?

commit and continue

2mo ago·9m

Task 3 checkpoint — ready for your review, including your two requests. All verification green.

What's in the working tree (on top of 095936a82d):

  1. Integration tests (new cmd/entire/cli/integration_test/checkpoint_resume_test.go): resume-by-ID from another branch (asserts the containing branch gets checked out and the session restored) and bare non-TTY listing (asserts full checkpoint ID + hint line). Both pass against the spawned binary.
  2. Your requests:
    • checkpoint resume is now Hidden: true — runnable but absent from entire checkpoint --help (also removed from the group's hand-written command list and examples, matching how this repo treats hidden commands).
    • The command help no longer references session resume; the branch-target sentence now just describes the behavior ("checks the branch out and resumes its latest checkpoint"). Nothing anywhere in tracked files talks about replacing or removing session resume — commit messages so far don't either.
  3. Review fix (Important, plan-authored): the CLAUDE.md sentence had the auto-detection order wrong ("checkpoint ID, commit SHA, or branch ... in that order"). It now states the implemented order — checkpoint ID, branch, commit SHA — and notes the command is hidden while experimental.
  4. Reviewer minor fixed: the integration test reuses the existing masterBranch constant.

Verification: mise run fmt && mise run lint → 0 issues; unit + integration focused tests → PASS; the implementer's canary run (63/63) predates the hide flag, but hiding doesn't touch any prompt or hook path the canary exercises.

Since the hide change touches files from Tasks 1–2, I'd split this into two commits instead of the planned one:

  1. checkpoint resume: hide while experimentalcheckpoint_resume.go, checkpoint_group.go
  2. checkpoint resume: integration tests and docs — test file + CLAUDE.md

Approve that shape?

Can you undo all changes to claude.md?

2mo ago·25.7s

Done — CLAUDE.md is back to its committed state; the docs part of Task 3 is dropped. Remaining working-tree changes:

  • checkpoint_resume.go + checkpoint_group.go — the hide-while-experimental changes (Hidden flag, help-list removal, session-resume mention dropped)
  • cmd/entire/cli/integration_test/checkpoint_resume_test.go — the two integration tests

Revised commit shape:

  1. checkpoint resume: hide while experimental
  2. checkpoint resume: integration tests

Approve?

Commit and continue

2mo ago·15m

Re-review is running in the background — I'll report back with the verdict and then present the final fix commit for your approval.

2mo ago·1m

Final checkpoint — fix wave ready for your review. The whole-branch reviewer's verdict after verifying the fixes: ready to merge.

What's in this last diff (working tree on top of b702fd7d9b):

  • Auto-detection hardened (resumeAutoTarget): order is now local checkpoint prefix → local branch only (branchExistsLocally, no origin/ fallback) → remote checkpoint fallback → commit. This fixes the reviewer's main finding: entire checkpoint resume HEAD used to match refs/remotes/origin/HEAD and dead-end in a bogus "fetch branch 'HEAD'?" flow; it now resolves as a commit and resumes the checkpoint at HEAD. Side benefit: hex-named local branches no longer trigger a remote checkpoint fetch and spinner. Remote-only branches remain reachable via explicit --branch. Help text updated to say "then local branch".
  • Worktree-clash message is now checkpoint-specific: cd '<path>' && entire checkpoint resume <id> instead of pointing at the session picker, which might not list the checkpoint.
  • Small polish: picker cancel prints "Resume cancelled."; the ambiguous-prefix error says "checkpoint prefix" instead of "commit prefix" (sentinel kept for errors.Is).
  • Tests: new HEAD-resolves-as-commit regression test (with origin/HEAD seeded so it actually fails against the old code — reviewer's suggestion), and a pure unit test for the picker label fallbacks.

Verification: focused unit tests, integration tests, mise run fmt && mise run lint — all green.

Two deferred items (reviewer-endorsed, not blockers): the pre-existing unguarded fetch prompt in switchToBranchForResume (resume.go, deliberately untouched — worth a follow-up issue), and a residual remote-fetch spinner when the target is a commit-SHA prefix matching no checkpoint.

Proposed commit: checkpoint resume: harden auto-detection and clash message. Approve?

commit and continue

2mo ago·1m

The plan is fully executed — entire checkpoint resume is complete and the final whole-branch review says ready to merge. Five commits on checkpoint-resume:

  • 677c3ce0f0 — command with target resolution (checkpoint ID → local branch → commit, forced flags, branch checkout via checkpoint index, restore-only fallback)
  • 095936a82d — bare picker + non-TTY listing (newest 20, full IDs, agent-safe)
  • e4e48b42e1 — hidden while experimental, no session resume references
  • b702fd7d9b — two spawned-binary integration tests
  • a9d4ce908f — final-review hardening (HEAD/remote-branch misroute fixed, checkpoint-specific worktree-clash message, cancel feedback, plus a regression test that actually fails against the old resolution order)

Every commit was reviewed (per-task spec+quality gates, then a whole-branch review whose two Important findings were fixed and re-verified). Verification along the way: focused unit tests, integration tests, mise run fmt && mise run lint, and the e2e canary (63/63).

Two loose ends, both deliberate:

  1. Follow-up issue candidate: switchToBranchForResume's fetch-from-origin prompt (resume.go) has no non-TTY guard — pre-existing, reachable from session resume too; the reviewer recommended fixing it at the source rather than caller-side. Want me to file a GitHub issue for it?
  2. The design/plan docs live untracked in docs/superpowers/ (gitignored) — per your rule I haven't committed them.

Natural next step when you're ready: push and open a PR (/pr), or keep iterating on the hidden command first.

/simplify → 4 cleanup agents in parallel → apply the fixes

You are improving the quality of the changed code, not hunting for bugs. Review it for reuse, simplification, efficiency, and altitude issues, then fix what you find. Do not look for correctness bugs — that is what /code-review is for.

Phase 0 — Gather the diff

Run git diff @{upstream}...HEAD (or git diff main...HEAD / git diff HEAD~1 if there's no upstream) to get the unified diff under review. If there are uncommitted changes, or the range diff is empty, also run git diff HEAD and include the working-tree changes in scope — the review often runs before the commit. If a PR number, branch name, or file path was passed as an argument, review that target instead. Treat this diff as the review scope.

Phase 1 — Review (4 cleanup agents in parallel)

Launch 4 independent review agents via the Agent tool, all in a single message so they run concurrently. Pass each agent the diff and one of the four angles below. Each returns its findings with file, line, a one-line summary, and the concrete cost (what is duplicated, wasted, or harder to maintain).

Reuse

Flag new code that re-implements something the codebase already has — Grep shared/utility modules and files adjacent to the change, and name the existing helper to call instead.

Simplification

Flag unnecessary complexity the diff adds: redundant or derivable state, copy-paste with slight variation, deep nesting, dead code left behind. Name the simpler form that does the same job.

Efficiency

Flag wasted work the diff introduces: redundant computation or repeated I/O, independent operations run sequentially, blocking work added to startup or hot paths. Also flag long-lived objects built from closures or captured environments — they keep the entire enclosing scope alive for the object's lifetime (a memory leak when that scope holds large values); prefer a class/struct that copies only the fields it needs. Name the cheaper alternative.

Altitude

Check that each change is implemented at the right depth, not as a fragile bandaid. Special cases layered on shared infrastructure are a sign the fix isn't deep enough — prefer generalizing the underlying mechanism over adding special cases.

Phase 2 — Apply the fixes

Wait for all four agents to complete, dedup findings that point at the same line or mechanism, and fix each remaining one directly. Skip any finding whose fix would change intended behavior, require changes well outside the reviewed diff, or that you judge to be a false positive — note the skip rather than arguing with it. Finish with a brief summary of what was fixed and what was skipped (or confirm the code was already clean).

2mo ago·8m

/simplify done — 4 findings fixed, 5 skipped with reasons. All focused tests, integration tests, and mise run fmt && mise run lint pass. Changes are uncommitted for your review.

Fixed:

  1. Redundant re-sort (reuse): recentCheckpoints duplicated the store's ordering comparator. I verified all three PersistentStore.List implementations already return newest-first via the shared sortCheckpointInfosByRecency (documented as the cross-backend contract), so the function is now a plain cap on lookup.committed, and its sort test is deleted — ordering stays covered end-to-end by the non-TTY listing test, which goes through the real store.
  2. Duplicated ULID shape knowledge (altitude): the hand-rolled checkpointPrefixShape regex hardcoded the Crockford alphabet and the 12/26 widths that the id package deliberately centralizes. Moved it there as id.CouldBePrefix (documented as a shape gate, not validation, kept next to Pattern/ulidPattern so widths can't drift), with a table test including the HEAD-is-Crockford-shaped case.
  3. Duplicate cancel constant (simplification): the picker now reuses the existing resumePickerCancel instead of its own identical checkpointPickerCancel.
  4. Copy-pasted test setup (simplification): the four tests repeating tmpDir/chdir/Claude-dir setup now share a setupCheckpointResumeRepo helper.

Skipped:

  • Shared huh-form-runner helper across both pickers — would modify resume_picker.go, which this branch deliberately leaves untouched, for ~10 saved lines.
  • Double buildCheckpointBranchIndex in the picker flow — real but unmeasured; the walk is bounded and the flow is interactive. Your no-premature-optimization rule applies; threading the index through would add a parameter/mode to four call sites.
  • restoreByCheckpointID reopens repo/store — fixing needs new seams in resume.go; every existing resume flow works this way.
  • Shared lookup double-close bookkeeping with explain — same explain.go-scope reason.
  • Extracting the 2-line worktree-clash Fprintf into a builder — single call site, no reuse; a function would just add indirection.

Proposed commit: checkpoint resume: simplify picker and prefix gate (includes the id package addition — the one change outside the original diff's files, flagging it explicitly). Approve?

commit the changes, then run /pfleidi:review

2mo ago·27.6s

Base directory for this skill: /Users/pfleidi/.agents/skills/pfleidi/skills/review

Code Review

1. Determine Diff Against origin/main

Always review changes against origin/main directly. Do not use local main, git merge-base, a PR base branch, or a user-specified alternate base.

Get the CURRENT diff — never use cached results from earlier in the conversation. Include both committed and uncommitted changes (staged + unstaged):

Note: git diff origin/main (not origin/main...HEAD) diffs origin/main against the working tree, capturing committed changes, staged changes, and unstaged changes in one pass.

Show the user the file list and total count. If there are 0 changed files, report that to the user and stop — there is nothing to review. Otherwise, immediately proceed to the review agents. Do NOT wait for confirmation.

Before launching agents, build a concise review context and pass it to every agent. Show the context as a table before launching agents so assumptions are visible:

ContextSourceValue
User goalConversationOne-line summary, or not provided
Implementation planConversation / docsOne-line summary, or not provided
PR contextPR title/bodyOne-line summary, or no PR found
Commitsgit log --oneline origin/main..HEADOne-line summary of commit intent
Changed surfacediff file listMain packages/files touched
Inferred behaviorcommits/tests/docs/user textIntended behavior change, or diff-only inference
  • The user's request and any implementation plan, design notes, or acceptance criteria provided in the conversation.
  • Branch commit messages from git log --oneline origin/main..HEAD.
  • PR title/body when a PR exists for the branch.
  • The changed-file list and any obvious intended behavior changes inferred from commits, tests, docs, or user-facing text.

Treat this context as the statement of intent. If no implementation plan or PR context exists, say that intent is inferred from the diff and commits only.

2. Spawn Parallel Review Agents

Review Philosophy

Pass these rules to every agent:

  • It is OK to find nothing. A clean review is a valid outcome. Do NOT manufacture findings to justify the review. Only flag issues you are confident are real problems.
  • Be opinionated and consistent. If a pattern is acceptable, don't flag it. If you flag something, commit to that position — don't suggest the opposite approach on a re-review.
  • Don't flag trade-offs with no clear winner. If there are two reasonable approaches and neither is clearly better, don't flag it. The author already made a choice.
  • High confidence only. Every finding must pass the bar: "I am confident this is a problem, and I can explain specifically what goes wrong if it's not fixed." Vague unease is not a finding.
  • Permission-friendly reads. Avoid shell pipelines, command separators, subshells, and output filters for read-only investigation because they create extra permission prompts and block background review agents. Do not run commands like git show HEAD:path | sed -n '10,40p'. Use workspace file range reads, rg with path limits, path-scoped git diff $BASE -- <path>, or one standalone git show <rev>:<path> only when the output is acceptably small.
  • Intent-aware review. Review changed code against the review context, not against the old behavior alone. Do not classify an intentional behavior change as Required merely because it differs from origin/main. A Required finding must either contradict stated intent, break an existing contract that the intent did not change, introduce a concrete bug/security issue, or leave the intended behavior unverified in a way that would likely fail.

Launch four baseline sub-agents in parallel using the Agent tool. Pass each agent origin/main as the base ref, the full list of changed files, the review context, and the review philosophy above.

When the repository is a Go project and the diff includes Go-related files (*.go, go.mod, or go.sum), also launch Agent 5 in the same batch. Do not run the Go-specific agent for non-Go diffs.

Agent 1: Security & Adversarial

Review git diff $BASE with fresh eyes for:

  • Injection — command injection, SQL injection, path traversal
  • TOCTOU and race conditions — check-then-act patterns, concurrent access without synchronization
  • Unvalidated input at system boundaries — user input, API parameters, external data
  • Auth/authz gaps — missing permission checks, privilege escalation paths
  • Secrets or credentials — hardcoded tokens, leaked keys, credentials in code or config

For EACH finding: read the actual source file and trace whether the code path is reachable in production. Discard any finding you cannot confirm with a concrete code reference.

Agent 2: Correctness & Quality

Review git diff $BASE for:

  • Logic errors — off-by-one, wrong comparison, inverted conditions
  • Nil/null handling — unchecked nil dereferences, missing error checks (especially unchecked errors in Go)
  • Edge cases in concurrency — goroutine leaks, missing locks, channel misuse, deferred unlock ordering
  • Redundant state — state that duplicates existing state, cached values that could be derived
  • Production test seams — mutable function variables, package-wide settings, reset hooks, or exported knobs added only so tests can swap behavior instead of using dependency injection or a higher-scope test
  • Parameter sprawl — adding new parameters instead of restructuring
  • Leaky abstractions — exposing internal details, breaking existing abstraction boundaries
  • Stringly-typed code — using raw strings where constants or typed values already exist in the codebase
  • Test coverage and scope gaps — changed behavior, edge cases, or error paths not exercised by meaningful tests; tests that prove implementation details instead of behavior; or unit tests used where integration/e2e coverage is the right confidence boundary
  • Test helper over-abstraction — helpers that hide the behavior, expected values, or assertions and make the test harder to understand than a small amount of duplication

For EACH finding: verify the claim by reading the source. Check call sites to confirm the issue is real, not hypothetical.

Agent 3: Simplification & De-slop

Use the local pfleidi:de-slop skill's slop taxonomy as the source of truth: skills/pfleidi/skills/de-slop/SKILL.md ("What Counts as Slop"). Apply its criteria as a detection lens only — find and report slop; do not run de-slop's remediation workflow, create commits, or open a PR.

Review git diff $BASE for:

  • Dead code — unreachable branches, unused functions, struct fields never read, data computed but never used
  • Reinvention — hand-rolled solutions to problems already solved by the repo, the standard library, or a dependency in use; name the existing mechanism to use instead
  • Code reuse & duplication — existing utilities and helpers that could replace newly written code; near-duplicate blocks that should be unified
  • Unnecessary abstractions — wrapper types, indirection, single-caller layers, or overly defensive fallbacks that mask errors
  • Premature optimization — complexity added for performance no one measured; prefer the clear version unless a bottleneck was shown
  • Unnecessary work — redundant computations, repeated file reads, duplicate API calls, N+1 patterns
  • Missed concurrency — independent operations run sequentially when they could be parallel
  • Hot-path bloat — blocking work added to startup or per-request paths
  • Unnecessary existence checks — pre-checking file/resource existence before operating (TOCTOU anti-pattern); operate directly and handle the error
  • Unnecessary comments — comments explaining WHAT the code does (well-named identifiers already do that); keep only non-obvious WHY

For EACH suggestion: verify it does not break existing behavior by checking call sites and usages. Discard cosmetic-only suggestions (renames, formatting).

Agent 4: Readability & Go Idioms

Review git diff $BASE for code that is hard to read, maintain, or reason about:

  • Poor factoring — functions doing multiple jobs, tangled control flow, or missing helper extraction where a small local helper would clarify behavior
  • Mixed abstraction levels — high-level orchestration mixed with low-level IO, parsing, protocol, or data-structure details; low-level helpers that also make workflow or policy decisions
  • Generated-code smell — repetitive pasted logic, shallow wrappers, generic names, or code that reads like it was assembled without domain intent
  • Data-flow opacity — values transformed across too many steps, unclear ownership, hidden mutation, pass-through helper chains, or state threaded through unrelated code
  • Control-flow complexity — deeply nested conditionals, boolean flag plumbing, early returns used inconsistently, or error paths that obscure the main path
  • Naming clarity — names that hide domain meaning or force callers to inspect implementation to understand usage
  • Go API readability — ambiguous (result, bool) returns outside clear comma-ok/presence checks, oversized interfaces, unnecessary pointer indirection, or cleverness where explicit Go would be clearer
  • Error readability — errors that lose operation/context, wrap inconsistently, or make call sites branch on strings/booleans instead of clear errors or typed status

For EACH finding: explain the readability cost in concrete maintenance terms. Prefer small, local refactor suggestions. Discard formatting-only, gofmt-only, or personal taste comments.

Agent 5: Clean Go & Modern Go (Go diffs only)

Use the local pfleidi:clean-go skill as the source of truth: skills/pfleidi/clean-go/SKILL.md.

Review only changed Go code plus surrounding source, tests, interfaces, and call sites needed to verify findings. Apply the skill's Clean Go checks and version-gated Modern Go checks. This includes the modern-go guidance incorporated from JetBrains' use-modern-go skill: detect the relevant go.mod target version, only suggest features available for that version, and do not perform blanket modernization.

Focus on concrete changed-code findings around composable functions, abstraction level, function size/signatures, errors, pointers, small interfaces, any/interface{}, testing guidance from skills/pfleidi/testing/SKILL.md, and modern standard-library helpers. Discard findings that would merely restyle existing code or require a broad rewrite unrelated to the current diff.

Second-Pass Coverage Sweep

After the first-pass agents complete, run a second independent review pass before synthesis. The goal is recall: catch high-confidence findings that the lens-specific agents may have missed.

Launch one fresh coverage agent with origin/main as the base ref, the full list of changed files, the review context, and the review philosophy above. Do not pass the first-pass findings to this agent.

Ask the coverage agent to:

  • Re-read the changed files and the surrounding code needed to understand each changed path.
  • Trace changed behavior through callers, callees, tests, configuration, migrations, generated interfaces, and user/API entry points where relevant.
  • Search the repository for related patterns, duplicated logic, and existing helpers that affect the changed code.
  • Look across all lenses together: security, correctness, tests, de-slop, readability, performance, and Go cleanliness when applicable.
  • Prioritize missed Required findings over optional improvements.
  • Return only high-confidence findings with concrete file:line evidence and a short explanation of the traced path.

Then compare the second-pass findings with the first-pass findings. Deduplicate overlaps, verify any new claim by reading source yourself, and discard anything that cannot be confirmed.

3. Synthesize Report

After all launched agents complete:

  1. Collect findings from both the first-pass agents and the second-pass coverage sweep
  2. Deduplicate — merge findings from different agents that point to the same underlying issue
  3. Verify — for any finding where the agent did not cite a specific file:line with evidence, read the source and confirm or discard it
  4. Group by file
  5. Sort by severity within each file: Critical > High > Medium > Low

Severity Definitions

  • Critical — Must fix before merge. Bugs, security vulnerabilities, data loss risk, race conditions with observable impact.
  • High — Should fix before merge. Missing error handling, meaningful test gaps, performance issues on hot paths.
  • Medium — Worth fixing. Code reuse opportunities, unnecessary complexity, readability problems that make future changes error-prone, minor efficiency improvements.
  • Low — Optional. Minor readability improvements or cosmetic suggestions.

Relevance Classification

For each finding, classify as:

  • Required — The change does not work correctly without this fix in light of the review context. Bugs, missing error handling that causes failures, security vulnerabilities, race conditions, contradictions of stated intent, or missing tests for intended behavior that would likely fail. The branch should not merge without addressing these.
  • Improvement — Valid finding, but the change works correctly without it. Better factoring, clearer Go APIs, using existing helpers, code reuse, unnecessary complexity, style. Worth addressing in a follow-up, not in this branch.

Autofix Eligibility

Mark each Required finding as Autofix eligible or Needs decision:

  • Autofix eligible — source-backed, high confidence, minimal fix is clear, no new dependencies, no shared/public interface change, no product/design choice, no broad refactor, and the directly related verification path is clear.
  • Needs decision — any Required finding that fails one of the autofix checks, including intentional behavior questions, API shape changes, cross-cutting refactors, or fixes where multiple reasonable approaches exist.

Present findings as compact tables, not prose blocks. Use one summary table for scanning and one details table for evidence and fixes.

Summary table format:

#SeveritySourcesLocationClassificationAutofixIssueImpact
1Mediumcorrectness + coveragecmd/entire/cli/checkpoint/v2_committed.go:234RequiredEligibleOne-sentence problem.Concrete consequence if not fixed.

Details table format:

#EvidenceSuggested fixTrade-offs
1Source-backed confirmation from code path, call site, or test gap.Concrete code change, not vague advice.One sentence, or None if strictly better.

Keep table cells short and scannable. Put the smallest useful quote or evidence in the table rather than full paragraphs. Escape | characters inside code or text so the table remains valid Markdown. Use n/a for Autofix on Improvements. The Sources column lists the agents that independently found or confirmed the issue, such as security, correctness, de-slop, readability, clean-go, or coverage.

If no findings exist at a severity level, omit that section.

If there are 0 findings across all agents, report that the review is clean and stop.

4. Present Report and Proceed With Default Fixes

Present findings in two sections:

Required

Table of findings classified as Required, sorted by severity. Include the Autofix value for each finding. Follow it with the details table for those same Required findings.

Improvements (follow-up)

Table of findings classified as Improvement, continuing the numbering. These are presented for awareness but are NOT included in the fix cycle by default. Follow it with the details table for those same Improvement findings.

End with a one-paragraph summary: total required vs improvement findings, overall merge-readiness assessment, and any patterns across files.

Before editing, present a planned-autofix table for Autofix eligible Required findings:

#LocationPlanned changeRelated test/verificationFiles expected
1path/file.go:42Minimal code change to address the finding.Focused test or lint/build command.path/file.go, path/file_test.go

Do not ask the user to choose a mode. Immediately proceed to Step 5 for Autofix eligible Required findings after showing the planned-autofix table. Do not fix Improvements by default.

If there are Required findings but none are Autofix eligible, stop after the report and list the exact decisions needed.

5. Fix Cycle

Scope Rules

  • Make the MINIMAL change that addresses the finding
  • Keep the diff limited to files and lines directly required by the finding
  • First decide whether the finding is local or systemic. Fix at the narrowest correct level; do not add a local workaround that hides a shared/root-cause bug.
  • If the finding requires a behavior-changing code fix, add or update the directly related test in the same fix step. Prefer TDD, but complete the focused red-to-green cycle before stopping: write/update the failing test, confirm it fails, implement the fix, confirm the focused test passes. Do not stop after only adding the failing test unless the user explicitly asks.
  • Do NOT rename variables, reformat code, or touch lines outside the finding scope
  • Do NOT refactor adjacent code, even if it looks related
  • Do NOT create any git commits — code changes only

Default Batched Fixes

Fix all Autofix eligible Required findings in report order by default. Do not ask which findings to fix.

Choose an artifact directory using the AGENTS.md temporary artifact rule with agent name pfleidi-review:

  • Use ./tmp/pfleidi-review/ only when ./tmp/ already exists and is already ignored.
  • If no project-local artifact directory is available, do not create file artifacts by default; keep ledger/log/cache information in the response and mark file paths n/a. Ask before using /tmp/pfleidi-review/ or modifying ignore files.

When an artifact directory is available, create a temporary fix ledger at <artifact-dir>/review-<repo-name>-<timestamp>.md before editing. If no artifact directory is available, keep the same ledger fields in the final summary table instead. Update the ledger after each finding with:

  • Finding number, status, and source location.
  • Files touched.
  • What changed and why.
  • Related tests or verification commands.
  • Rollback notes sufficient for the user to understand how to revert the finding-specific change manually.

For each Autofix eligible finding:

  • Read the relevant code to confirm the fix approach
  • Re-check eligibility before editing; if the fix is no longer clearly eligible, mark it Needs decision and continue to the next finding
  • Implement the fix — ONLY the code changes for that single finding
  • Add or update the directly related test in the same diff when the fix changes behavior; if using TDD, complete red-to-green before moving on; if no test is added, state why
  • Keep the diff limited to files and lines directly required by that finding
  • If a fix would require changing a function signature in a shared interface, adding a dependency, expanding scope outside the finding, or making an ambiguous product/design choice, skip that finding as Needs decision and continue
  • Track the exact files changed, what changed, and why the change addresses the finding

If a skipped finding has partial edits, remove only your own partial edits for that finding before continuing. If you cannot safely isolate those partial edits, stop and explain the conflict.

After all eligible fixes are applied, proceed directly to Step 6 (Verify Fixes). Do NOT show a diff yet.

6. Verify Fixes

Run the project's compile/build, lint, and test commands scoped to only the changed files and their directly related tests. Use safe background batches for independent validators instead of running every command sequentially.

When selecting verification commands, reuse <artifact-dir>/verification-<repo-name>.md if an artifact directory is available and the cache is fresh under the cache rules from pfleidi:pr; otherwise discover the smallest relevant lint/test/build commands. Update the cache only when an artifact directory is available.

  • Build / compile — run a relevant compile/build command when one is discoverable for the changed production code.
  • Lint / static analysis — run the project's documented lint task, scoped to the files that were modified by the fixes when the task supports scoping. Prefer lint-specific task wrappers such as make lint or mise run lint over invoking linter binaries directly. Do not use aggregate check, ci, or verify tasks unless you have confirmed they only run lint/static analysis. If the documented lint task cannot be scoped, run the smallest relevant project lint task.
  • Tests — run only the test files that cover the modified code (same package, same module, co-located test files). Do NOT run the full test suite.

If no compile/build command or project lint task exists, state that explicitly instead of assuming an unavailable command.

Run formatters, generators, snapshot updates, or other mutating commands alone before validators that depend on their output. Run independent read-only validators concurrently when they do not require the same exclusive service, port, database, fixture directory, or generated output. Keep integration/e2e/service-backed commands separate unless the project documents that they are parallel-safe.

For each background batch, start every command from the same working-tree state, capture stdout/stderr/exit status from the tool, do not edit files while the batch is running, and wait for every command to finish. Run each selected validator directly, for example mise run lint, go test ..., or npm test -- .... Do not wrap validators in sh -c, shell redirection, tee, command separators, or pipelines solely to write logs; that defeats command-prefix approvals and causes extra permission prompts. If an artifact directory is available and file logs can be written after the command completes without rerunning through a shell wrapper, save them under <artifact-dir>/logs-<repo-name>-<timestamp>/; otherwise mark the full-log path as n/a. If files change after a failed batch, none of that batch's successful results count as current verification.

Show verification as a compact table:

CommandExitRelevant outputFull log
go test ./pkg/foo -run TestBar -count=10Short success excerpt.<artifact-dir>/logs-.../go-test-pkg-foo.log or n/a

For failures or short outputs, show complete output in the relevant-output column or immediately below the table. For long successful outputs, show the relevant excerpt and log path.

On Failure: Auto-Fix

If compile/build, lint, or tests fail due to issues introduced by the review fixes:

  1. Read the error output and identify every failure
  2. Fix all issues — apply the minimal changes needed
  3. Re-run the failing commands using the same safe batching rules
  4. Show the complete output again

Cap at 2 fix attempts. If still failing after 2 rounds, present the remaining failures to the user with full output. Do not describe the work as done or commit-ready while compile/build status is failing or unknown for changed production code.

7. Present Results

Once verification passes (or the user has seen the remaining failures), present a summary table. If compile/build did not pass for code changes, say the work is not commit-ready before the table. Do NOT show a diff — the Edit tool already showed each change inline.

#FindingFileStatusWhat changedWhy
1Descriptionpath:lineFixedAdded nil check in fooPrevents panic on missing config
3Descriptionpath:lineFixedAdded focused test for invalid inputVerifies intended error path
6Descriptionpath:lineNeeds decisionNoneAPI shape has two reasonable options

Also present a rollback/traceability table and the ledger path:

#Files touchedRollback notes
1path/file.go, path/file_test.goRevert the nil-check and focused test added for finding #1.

Ledger: <artifact-dir>/review-<repo-name>-<timestamp>.md, or n/a when no project-local artifact directory was available.

STOP and wait. The user decides what to commit.

8. Post-Fix

  • If the user asks for changes, apply them
  • If the user asks to revert specific fixes, revert ONLY those changes using surgical git checkout of the affected lines
  • Do NOT commit. The user handles commits on their own terms.
2mo ago·15m

All agents complete (first pass + coverage sweep). Synthesized report:

Review Report — checkpoint-resume branch (6 files, +699/−1)

Security: clean (input flows traced through the pre-hardened CheckoutBranch/ValidateBranchName/go-git paths; shell-quoting in the clash message verified). Coverage sweep: clean. No Required findings — everything below is classified Improvement.

Improvements (follow-up)

#SeveritySourcesLocationClassificationAutofixIssueImpact
1Mediumreadabilitycheckpoint_resume.go:178Improvementn/aresumeCommitTarget discards the underlying git-resolution error without a logging.Debug, unlike the parallel runExplainAuto path."Resume didn't find my target" reports have no debug-log trail to diagnose.
2Mediumreadabilitycheckpoint_resume.go:99-151Improvementn/aresumeAutoTarget returns the swapped lookup solely so the caller's defer closes it; discarding the return would silently leak a repo handle.Fragile contract a future simplification could break; could own cleanup via local defer fresh.Close() and return only error.
3Mediumcorrectnesscheckpoint_resume.go:100Improvementn/a--checkpoint flag path has no direct test (only its mutual-exclusion rejection).One of three documented target modes relies solely on shared-helper coverage.
4Lowcorrectnesscheckpoint_resume.go:160Improvementn/aAmbiguous checkpoint-prefix branch untested for this command.Ambiguity rendering regression would go unnoticed here (it is tested for explain).
5Lowcorrectnesscheckpoint_resume.go:217Improvementn/aWorktree-clash pointer path untested.Message wording/flow regression would go unnoticed.
6Lowde-slopcheckpoint_resume.go:70-75Improvementn/aRunE's logging.Init/Close bracket duplicates the identical self-init inside runResume/resumeSessionOnBranch; branch-path invocations open/flush/close the log twice.Harmless today (documented idempotent); latent surprise if logging is added after the inner helper returns.
7Lowclean-gocheckpoint/id/id.go:47-51Improvementn/aComment claims the prefix regex "cannot drift" from Pattern/ulidPattern, but nothing enforces that — it's an independent literal.A reader trusts the guarantee and skips updating the regex when ID formats change.
8Lowclean-gocheckpoint_resume.go:115-124Improvementn/aresumeAutoTarget docstring says checkpoint (local then remote) → branch → commit, but the code runs local checkpoint → local branch → remote checkpoint → commit.Doc misleads a maintainer about precedence; the deliberate branch-before-remote-fetch ordering deserves stating.
#EvidenceSuggested fixTrade-offs
1explain.go:494-503 logs resolveErr at debug before the generic message; checkpoint_resume.go has zero logging.Debug calls.Add one debug log with ref + error before wrapping in errNoResumeCommit.None
2runCheckpointResume:108 reassigns lookup that is never read again — exists only for the defer at 92-97.Local defer fresh.Close() inside resumeAutoTarget when swapped; drop lookup from the signature.Diverges slightly from explain.go's threading idiom
3–5Untested branches confirmed by reading checkpoint_resume_test.go — no test sets --checkpoint, seeds colliding prefixes, or simulates a second worktree.Three focused unit tests using the existing fixtures (setupCheckpointResumeRepo, writeCommittedResumeCheckpoint).Clash test needs a second-worktree fixture — slightly more setup
6resume.go:84-89 and resume.go:174-179 re-run the identical init; logging.Init/Close documented safe to call twice.Drop the RunE bracket, or fix at the source by hoisting init out of the inner helpers (touches resume.go).Fixing at the source touches deliberately-unmodified files
7prefixShapeRegex is a standalone literal; no test asserts its bounds against Pattern/MaxIDLength.Reword to "kept adjacent as a reminder to update together" or add a bounds cross-check test.None
8Code at checkpoint_resume.go:257-284: branchExistsLocally runs before matchCheckpointPrefixWithRemoteFallback.Correct the docstring to the four-step order and note the avoid-network rationale.None

Summary: 0 Required, 8 Improvements. The branch is merge-ready — no bugs, security issues, or intent contradictions surfaced across five lenses plus an independent coverage sweep; the lookup-lifecycle and injection surfaces (the two riskiest areas) were explicitly traced clean by multiple agents. The findings cluster into two patterns: diagnostic/test coverage parity with the sibling explain/session resume flows (#1, #3–5) and small documentation/contract-clarity polish (#2, #7, #8). Per the review's default, Improvements are not auto-fixed — tell me if you'd like any of them addressed now (the #8 docstring fix and #1 debug log are one-liners; #3–5 are three small tests).

Commit the changes then fix everything but #6 which sounds like it would touch too many files

2mo ago·5m

All fixes applied and verified — mise run lint 0 issues, all 13 unit tests, both integration tests, and the id-package tests pass. Changes are uncommitted for your review.

CommandExitRelevant outputFull log
mise run fmt && mise run lint0golangci-lint: 0 issues (after fixing 3 lint hits in the new test: CommandContext, checked cleanup error, masterBaseBranch const)n/a
go test -run 'TestCheckpointResume' ./cmd/entire/cli/ -count=10ok, 13/13 incl. 3 new testsn/a
go test -tags integration -run 'TestCheckpointResume' ./cmd/entire/cli/integration_test/ -count=10ok, 2/2n/a
go test -run 'TestCouldBePrefix' ./cmd/entire/cli/checkpoint/id/ -count=10okn/a
#FindingFileStatusWhat changedWhy
1Dropped resolve errorcheckpoint_resume.goFixedlogging.Debug with ref + error before the errNoResumeCommit wrapDiagnosable "target not found" reports, parity with explain
2Lookup-swap threadingcheckpoint_resume.goFixedresumeAutoTarget now closes a swapped-in lookup itself via local defer and returns only error; caller simplified to a plain returnLeak-prone contract removed from the caller
3--checkpoint untestedcheckpoint_resume_test.goFixedTestCheckpointResumeFlag_Checkpoint (flag + prefix match → restore)Covers the third documented target mode
4Ambiguity untestedcheckpoint_resume_test.goFixedTestCheckpointResumeFlag_AmbiguousCheckpointPrefix (two colliding IDs → styled failure listing both)Pins the ambiguity rendering
5Clash untestedcheckpoint_resume_test.goFixedTestCheckpointResume_WorktreeClash — real second worktree via git worktree add in the temp repo (existing pattern from session_adopt_test.go); asserts message, resume command, HEAD unmovedPins the clash pointer end-to-end
6Duplicate logging initSkipped (your call)NoneWould touch resume.go
7Overclaiming commentcheckpoint/id/id.goFixed"cannot drift" → "reminder to update together"Comment no longer promises an unenforced guarantee
8Docstring vs actual ordercheckpoint_resume.goFixedDocstring now states local checkpoint → local branch → remote fallback → commit, with the avoid-network rationale (folded into #2's rewrite)Doc matches behavior

Rollback notes: #1/#2/#8 are all within resumeAutoTarget/resumeCommitTarget in checkpoint_resume.go; #3–5 are three self-contained test functions; #7 is a comment-only edit. Each reverts independently. Ledger: n/a (no ./tmp/ artifact directory in this repo).

To be clear on your "commit the changes" instruction: there was nothing to commit when you sent it — the review itself made no edits and the simplify work was already committed. These review fixes are what's pending now. Want me to commit them (proposed: checkpoint resume: address review findings)?

commit and continue

2mo ago·40.9s

Committed as 75b158bfb6. The branch is now fully wrapped up — here's where things stand:

checkpoint-resume branch, 8 commits:

  • 677c3ce0f0 add command with target resolution
  • 095936a82d bare picker and non-TTY listing
  • e4e48b42e1 hide while experimental
  • b702fd7d9b integration tests
  • a9d4ce908f harden auto-detection and clash message
  • c6659c5c0a simplify picker and prefix gate
  • 75b158bfb6 address review findings

Quality gates passed along the way: per-task spec+quality reviews, a whole-branch review (findings fixed and re-verified), /simplify (4 fixes), and /pfleidi:review across five lenses plus a coverage sweep (0 Required; 7 of 8 improvements fixed, #6 skipped at your direction). Current tree: lint clean, 13 unit + 2 integration tests green, e2e canary green.

Open items, both intentionally deferred:

  1. The unguarded fetch-from-origin prompt in switchToBranchForResume (resume.go) — pre-existing, also affects session resume; worth a GitHub issue.
  2. The duplicate logging.Init bracket (#6) — fixable at the source in resume.go whenever someone's in that file.

Natural next step is pushing and opening a draft PR (/pr) — say the word. I can also file the follow-up issue for item 1 if you want it on record.

Base directory for this skill: /Users/pfleidi/.agents/skills/pfleidi/skills/pr

Create Pull Request

1. Understand the Branch

Use origin/main as the comparison base for understanding branch scope. Do not use local main, a local PR target branch, or direct tree diffs such as git diff main or git diff origin/main for scope checks; those can include upstream-only changes and make this branch look like it reverted unrelated work.

Read the commit history to understand the full scope of changes on this branch.

Review the changed file list from the merge base to the current working tree and confirm every changed file belongs to the PR's stated goal:

If unrelated files or commits are present, STOP and report them. Do not create a PR that bundles unrelated work.

2. Sync with origin/main

Before discovering verification commands, bring the branch up to date with origin/main so verification runs against the merged state.

Check that the working tree is clean:

If there are uncommitted changes, STOP and ask the user to commit or stash them before continuing. A sync into a dirty tree creates ambiguous failure states.

Fetch and merge:

Three outcomes:

  • Already up to date — no commits to merge. Proceed to step 3.
  • Clean merge — merge commit created (or fast-forward applied). Proceed to step 3.
  • Conflicts — merge halts with conflicted files. STOP and report each conflicted file. Do NOT auto-resolve; the user must resolve the conflicts and complete the merge commit themselves. Re-run the PR skill after resolution.

3. Discover Project Verification Commands

Inspect the project to determine how to build, lint, and test. Collect candidate commands from these sources, then deduplicate them before running anything:

  1. Makefile — look for build, lint, check, test, ci, verify targets. Read the target recipes to understand what they run.
  2. mise — check for .mise.toml or .mise/*.toml. Look for [tasks] definitions covering build, lint, test. If found, use mise run <task>.
  3. CI workflows — read .github/workflows/*.yml (or .gitlab-ci.yml, etc.) to understand required coverage. CI is the ground truth for what must pass, but CI matrix shards and CI-only wrappers are not automatically local verification commands.
  4. README.md — look for "Development", "Contributing", "Building", or "Testing" sections that document how to run checks.
  5. Package manager conventions — detect from project files:
    • go.modgo build ./..., go vet ./..., go test ./...; do NOT infer a lint command from Go alone
    • package.json → check scripts for build, lint, test
    • Cargo.tomlcargo build, cargo clippy, cargo test
    • pyproject.toml / setup.py → check for configured linters, pytest

If no lint command exists after checking all sources, state that explicitly instead of assuming an unavailable linter binary.

Reuse Cached Verification Discovery

Before rediscovering commands from scratch, choose an artifact directory using the AGENTS.md temporary artifact rule with agent name pfleidi-pr:

  • Use ./tmp/pfleidi-pr/ only when ./tmp/ already exists and is already ignored.
  • If no project-local artifact directory is available, do not use a verification cache by default. Ask before using /tmp/pfleidi-pr/ or modifying ignore files.

When an artifact directory is available, check for a verification cache at <artifact-dir>/verification-<repo-name>.md. The cache is only an input-token optimization; never commit it and never trust it blindly. If no artifact directory is available, perform normal discovery and skip writing the cache.

Reuse the cache only when all of these are true:

  • It names the same worktree root and remote.
  • It lists the verification source files it was based on, such as Makefile, .mise.toml, .mise/*.toml, CI workflow files, README files, and package manifests.
  • Those source files still exist or are still intentionally absent.
  • git diff --name-only origin/main -- <source files> shows no branch changes to those source files.

If the cache is missing, stale, or incomplete, perform normal discovery. After discovery, update the cache with:

  • Repository root and remote.
  • Verification source files inspected.
  • Selected command plan grouped by coverage area.
  • Commands intentionally skipped as duplicates, aggregate/subtask overlaps, CI-only jobs, or too-slow shard matrices.
  • Any assumptions, such as "no documented lint task found."

Deduplicate Verification Commands

Build a command plan by coverage area, not by source. Do not run every command discovered.

  • Run at most one command for each coverage area: build/compile, lint/static analysis, unit/core tests, integration tests, e2e/smoke tests.
  • Prefer documented local developer tasks over CI-specific commands when they cover the same area.
  • Do not run both an aggregate task and its constituent tasks. For example, if mise run check runs lint and tests, either run mise run check alone or run the narrower lint/test tasks, not both.
  • Treat CI matrix shards as duplicated slices of one suite. Do not run every *:shard:* command locally when an unsharded local task covers the suite.
  • If CI has only sharded commands and no local equivalent, ask before running all shards. Otherwise, run the smallest representative or changed-scope test command and note that the full shard matrix remains for CI.
  • Do not run CI-only canary/e2e jobs locally by default. Run them only when the PR changes that surface, when the user asks, or when the project documents them as required local PR verification.

Log which sources you used, which duplicate/CI-only commands you skipped, and what commands you will run. If the deduplication rules require asking before slow CI-only coverage, STOP for confirmation; otherwise immediately proceed to step 4.

4. Run Verification and Auto-Fix

Run the deduplicated command plan in the fewest safe batches. Prefer background processing for independent validation tasks instead of running everything sequentially.

The commands should cover, at minimum:

  • Build — the project compiles without errors
  • Lint / static analysis — no lint warnings or static analysis failures
  • Tests — the selected local test coverage passes without duplicating CI shards or aggregate/subtask combinations

Use the exact commands, flags, and build tags found in step 3 for the commands you selected. Do not invent your own flags.

Parallel Verification Rules

Partition the selected commands into dependency-safe batches before running them:

  • Run mutating commands alone and before validators that depend on their output. This includes formatters, generators, codegen, migrations, package installation, or commands known to update snapshots, lockfiles, generated files, caches in the repo, or test fixtures.
  • Run dependent commands after their prerequisite batch passes. For example, do not start tests that require generated code until generation succeeds.
  • Run independent read-only validation commands concurrently in the same background batch. Build, lint/static analysis, typecheck/vet, and unit tests can usually share a batch when they do not mutate the working tree and do not require the same exclusive service, port, database, or fixture directory.
  • Keep integration, e2e, or service-backed commands separate unless the project documents that they are parallel-safe.
  • If unsure whether two commands are independent, run them sequentially. Correctness of validation beats speed.

For each background batch:

  1. Start every command from the same working-tree state.

  2. Run each selected validator directly, for example mise run lint, go test ..., or npm test -- .... Do not wrap validators in sh -c, shell redirection, tee, command separators, or pipelines solely to capture logs; that defeats command-prefix approvals and causes extra permission prompts.

  3. Capture each command's stdout, stderr, exit status, and command line from the tool output separately.

  4. While the batch is running, do not edit files, start auto-fixes, or treat partial output as a result.

  5. Wait for every command in the batch to finish, then show verification as a compact table:

    CommandExitRelevant output
    go test ./pkg/foo -run TestBar -count=10Short success excerpt.
  6. For failures or short outputs, show complete output in the relevant-output column or immediately below the table. For long successful outputs, show the relevant excerpt and state that the rest was truncated.

  7. If any command in the batch fails, treat the whole batch as failed for the fix loop. Results from other commands in that stale batch may help diagnose, but they do not count as passing verification after files change.

On Failure: Fix and Re-verify

If any command fails, do NOT stop. Instead:

  1. Read the error output and identify every failure
  2. Fix all issues — apply the minimal changes needed to make the failing command pass
  3. Re-run the deduplicated verification plan from the top, using the same safe batching rules (not just the previously failing command — fixes can introduce new issues)
  4. Show the updated verification table again, including complete failure output for any command that still fails

Repeat this cycle until all commands pass. Cap at 3 fix attempts. If verification still fails after 3 rounds, STOP and present the remaining failures to the user with full failure output — do not keep looping.

5. Prompt for Commit

After all verification passes, check for uncommitted changes:

If there are uncommitted changes (from auto-fixes in step 4):

  1. Show the diff of all uncommitted changes
  2. Propose a semantically correct commit message using the subject-plus-context style from AGENTS.md. The message must describe the net fix (e.g., "fix lint warnings in config parser" not "fix issues found during PR prep").
  3. If compile/build did not pass for code changes, say the work is not commit-ready and do not ask to commit until the gap is resolved or the user explicitly takes over.
  4. STOP and wait for user approval. The user may edit the message, split the changes, or commit themselves.

If the user approves the commit, do not rerun the full verification suite before committing unless files changed after step 4. If another sanity check is needed, use the commit-time verification scope from AGENTS.md: lint tasks, a compile/build check for code changes, and tests directly related to the changed code only.

If there are no uncommitted changes, proceed directly to step 6.

6. Push the Branch

If the branch has no upstream yet, use git push -u origin HEAD.

7. Create the PR

Determine a concise PR title (under 70 characters) from the commit history and diff.

Set the target base branch from the user-provided PR base, or main when the user did not provide one. Scope checks still use origin/main; the PR target base controls only the GitHub PR destination.

If the user provided a PR target base, set PR_BASE to that branch name instead.

Determine the pushed source branch:

If HEAD_BRANCH is empty, STOP and report that PR creation needs a named local branch.

Determine the GitHub repository slug from the origin remote before writing the PR body:

Extract GITHUB_REPO as <owner>/<repo> from these origin URL forms:

  • git@github.com:<owner>/<repo>.git
  • https://github.com/<owner>/<repo>.git
  • ssh://git@github.com/<owner>/<repo>.git
  • entire://<mirror-host>/gh/<owner>/<repo>

Strip a trailing .git when present. For entire:// remotes, ignore the mirror host and use only the suffix after /gh/; do not use any checkpoint-storage repository URL as the PR target when the entire://.../gh/... origin is available.

If the origin URL does not expose a GitHub repository, try:

If that still cannot identify a repository, STOP and ask the user for the GitHub target.

Use the same branch-only comparison from step 1 ($MERGE_BASE to the current working tree) when deriving the title, PR body, changed-file list, and mostly-Markdown detection. Do not use local main or direct git diff origin/main output for PR description decisions.

Write the PR body to help a reviewer (human or bot) understand the change without re-deriving it from the diff. Include these sections; omit any that genuinely don't apply:

  • Why — the motivation: what problem this solves, what behavior was broken or missing, what constraint forced the change. This is the most important section. Be specific so neither a reviewer nor a bot has to infer the reason from the diff alone.
  • What changed — a short, factual summary of the net change. One or two sentences; the diff is the source of truth.
  • Usage examples — for a new or changed command, API, config option, workflow, or user-facing behavior, show a small realistic example of how to use it and what to expect. For UI work, add screenshot placeholders such as Before: <screenshot> and After: <screenshot> when actual screenshots are not available yet.
  • Decisions made during development — non-obvious choices from the development process: why one approach over another, why an existing abstraction wasn't reused, why a check lives where it does, what assumptions shaped the implementation, and what constraints were intentionally accepted.
  • Technical tradeoffs — when a real engineering tradeoff was made, name the options weighed, what the chosen approach gives up, and why that tradeoff is acceptable. Skip if the change was mechanical with no meaningful alternatives.
  • Reviewer notes — only for migrations, deployment ordering, backwards-incompatible behavior, or known follow-up work not in this PR. Skip otherwise.
  • Rendered Markdown (for mostly Markdown PRs) — links to the changed Markdown files rendered on GitHub.

Do NOT include:

  • A "Test plan" or "Verification" section listing the CLI commands run. Verification already happened in step 4; the transcript doesn't help the reviewer.
  • A list of newly added tests. The diff already shows them; the list rots when tests are renamed or moved.
  • A file-by-file changes summary. The diff already shows this too.

Choose the PR creation command from the origin URL.

For entire://.../gh/<owner>/<repo> origins, do not use gh pr create. It may still inspect the local git remote and fail to infer a GitHub host even when --repo "$GITHUB_REPO" is supplied. Use the GitHub API through gh api with the already-derived repository slug and pushed branch:

For normal GitHub remotes, use gh pr create:

If a non-entire:// origin hits the same host-inference failure from gh pr create, use this gh api creation path once instead of retrying gh pr create.

Create a ready-for-review PR only when the user explicitly asks for it with wording such as "non-draft", "ready for review", or "publish it as ready". In that case, omit --draft from gh pr create or omit -F draft=true from the gh api call.

Show the PR URL and STOP.

Rules

  • Do NOT add "Generated with Claude Code" or any AI attribution anywhere
  • Do NOT summarize what you just did after showing the URL
  • Treat a PR as "mostly Markdown" when more than half of changed files are Markdown (.md, .mdx, .markdown) or the main review target is Markdown documentation. In that case, include GitHub rendered links for the changed Markdown files using the pushed branch, e.g. https://github.com/$GITHUB_REPO/blob/<branch>/<path>.md. Link all changed Markdown files when the list is short; for large docs PRs, link the main entry points or most important changed files.
  • If the user provides a title or description, use it verbatim instead of generating one, but append rendered Markdown links for mostly Markdown PRs unless the user explicitly says not to modify the description.
  • If the PR description contains checklist items (- [ ]), check them (- [x]) if and only if the corresponding step was actually verified during this workflow (e.g., build passed, tests passed, lint passed). Do NOT check items that were not verified. Do NOT leave items unchecked if they were verified.
2mo ago·2m

While the suite runs, here's the draft PR content I'll use (origin is an entire://.../gh/entireio/cli remote, so creation will go through gh api with draft=true):

Title: Add hidden checkpoint resume command

Body draft:

Why

Resuming an agent session currently requires knowing which branch it lives on (entire session resume <branch>) or using the interactive picker — a TTY-only path. Checkpoints surfaced by entire checkpoint list, search, or explain give you IDs and commit SHAs, but neither could be resumed directly, and a non-interactive agent had no way to resume anything.

What changed

New entire checkpoint resume [target] under the checkpoint group, hidden while experimental. The target can be a checkpoint ID (or prefix), a commit SHA/ref (resolved via its Entire-Checkpoint trailer), or a branch — auto-detected in that order, or forced with --checkpoint/--branch/--commit. Checkpoint and commit targets check out the branch containing the checkpoint's commit at its current tip and restore the session log(s); with no containing local branch, logs are restored in place. Bare invocation shows the newest 20 checkpoints: interactive picker on a TTY, plain-text list with full IDs otherwise.

Usage examples

Decisions made during development

  • Checkout targets the containing branch's tip, never the checkpoint's own SHA — a detached HEAD on stale code isn't a workable resume state; the conversation comes from the checkpoint, the code state from the branch.
  • Auto-detection only treats local branches as branch targets. branchCommit's origin/<name> fallback would classify HEAD as a branch (via refs/remotes/origin/HEAD) and misroute revision syntax; remote-only branches remain reachable via --branch. The local-branch check also runs before the remote checkpoint fetch so branch names never pay a network round-trip.
  • Restore-only fallback keeps fetched teammate checkpoints resumable when no local branch contains them.
  • Implementation stitches existing helpers (explain's target resolution, the picker's checkpoint→branch index, resume's restore flows) without modifying explain.go/resume.go/resume_picker.go.

Reviewer notes

Pre-existing follow-up, not in this PR: switchToBranchForResume's fetch-from-origin prompt has no non-TTY guard (also affects session resume).

I'll adjust if the suite surfaces anything. Waiting on mise run test:ci.

Can you update the description to also include use cases where someone would like to extend something that was build already but the branch was already merged so resume failed?

2mo ago·18.6s

Updated draft — the merged-branch case is now the lead motivation in Why, with a matching usage example:

Body (updated sections only):

Why

Resuming an agent session currently requires knowing which branch it lives on (entire session resume <branch>) or using the interactive picker — a TTY-only path. That breaks down entirely once work lands: after a branch is merged (and typically deleted), session resume has nothing to resume from, even though the session is preserved in the checkpoint referenced by the merge/squash commit. Picking up merged work to extend it — "continue where that PR left off" — had no supported path. Separately, checkpoints surfaced by entire checkpoint list, search, or explain give you IDs and commit SHAs, but neither could be resumed directly, and a non-interactive agent had no way to resume anything.

Usage examples

And one sentence added to What changed: "Squash-merge commits carrying multiple checkpoint trailers resolve to the newest checkpoint, so merged branches resume from their final state; when the original branch no longer exists locally, the session logs are restored in place without switching branches."

Everything else stays as drafted. Still waiting on mise run test:ci — I'll push and open the PR with this description once it's green.

2mo ago·1m

Both running in the background — I'll report when they finish and then push and open the PR.

Can you also mention that entire session resume, while working with sessions, in most cases resumes each session in the most recent checkpoint in a branch. In my opinion entire checkpoint resume is the more intuitive fit since it lives under the checkpoint subcommand.

2mo ago·16.0s

Added to the Why section — updated draft of that section in full:

Why

Resuming an agent session currently requires knowing which branch it lives on (entire session resume <branch>) or using the interactive picker — a TTY-only path. That breaks down entirely once work lands: after a branch is merged (and typically deleted), session resume has nothing to resume from, even though the session is preserved in the checkpoint referenced by the merge/squash commit. Picking up merged work to extend it — "continue where that PR left off" — had no supported path. Separately, checkpoints surfaced by entire checkpoint list, search, or explain give you IDs and commit SHAs, but neither could be resumed directly, and a non-interactive agent had no way to resume anything.

Naming-wise this operation also fits the checkpoint group better: despite its name, entire session resume in most cases resumes the session(s) recorded in the most recent checkpoint on a branch — the checkpoint is the actual unit being resumed. entire checkpoint resume makes that explicit and lives under the noun it operates on.

Everything else unchanged. Still waiting on the integration suite and canary runs; once green I'll push and create the draft PR with this description.

2mo ago·1m

Can you double check my claim about entire session resume actually resuming full checkpoints?

2mo ago·50.2s

Your claim checks out, verified against current source (post-merge):

  1. The restore unit is the checkpoint, not the session. Both session resume paths funnel into RestoreLogsOnly, whose contract states it plainly (strategy/manual_commit_rewind.go:627): "When multiple sessions were condensed to the same checkpoint, ALL sessions are restored." Neither path sets PreferredSessionID (resume.go:245-252 builds the continue options without it — that field is only used by trail resume).

  2. Branch mode picks exactly "the most recent checkpoint on the branch"restoreFromCurrentBranch walks branch-only commits for the newest Entire-Checkpoint trailer, and when a squash commit carries several trailers, resolveLatestCheckpoint picks the newest by CreatedAt (resume.go:297,313). Then all of that checkpoint's sessions are restored.

Two nuances, in case you want your PR wording airtight:

  • The picker path is per-session in selection but still checkpoint-granular in restore. Picking a stopped session resolves that session's checkpoint (which may not be the branch's most recent one when several sessions share a branch) — but the restore still brings back every session in that checkpoint. Your "in most cases" hedge covers this correctly.
  • Only the restore is checkpoint-wide; the launch is one session — after restoring, a TTY prompts which single session to start (non-TTY prints all resume commands).

So the PR sentence — "despite its name, entire session resume in most cases resumes the session(s) recorded in the most recent checkpoint on a branch" — is accurate as written. If you want it bulletproof, appending "(the interactive picker resolves a specific session's checkpoint instead, but still restores that checkpoint in full)" would cover the one exception. Want me to update the PR body with that?

Base directory for this skill: /Users/pfleidi/.agents/skills/pfleidi/skills/pr-feedback

PR Feedback

1. Identify the PR

If the user provided a PR number or URL, use that. Otherwise, detect from the current branch:

If no PR exists for the current branch, stop and tell the user.

2. Fetch Review Comments

Fetch PR metadata first so comment decisions have intent context:

Also collect branch commits and changed files for context:

Show the PR context as a table before classifying comments:

ContextSourceValue
PRtitle/bodyOne-line PR intent
BranchcommitsOne-line commit summary
Changed surfacediff file listMain packages/files touched
Base/headPR metadatabase <- head

Fetch unresolved review threads with GraphQL as the primary source of truth. Group work by thread, not by individual REST comment:

Filter to unresolved threads only. If there are no unresolved threads, report that to the user and stop — there is nothing to fix.

If GraphQL pagination indicates more review threads or thread comments are available, paginate before classifying. Do not classify a partial thread set as complete.

Use REST pull-review comments only as a fallback when GraphQL data is incomplete or a thread cannot be mapped to a review comment ID:

When REST fallback is used, deduplicate by GraphQL thread ID first, then by file/line/body/author. Do not present or fix the same review request twice.

3. Parse, Classify, and Group

Use permission-friendly reads while investigating comments. Avoid shell pipelines, command separators, subshells, and output filters for read-only source inspection because they create extra permission prompts and can block background work. Do not run commands like git show HEAD:path | sed -n '10,40p'. Use workspace file range reads, rg with path limits, path-scoped diffs, or one standalone git show <rev>:<path> only when the output is acceptably small.

For each comment, extract:

  • Author — who left it
  • Author type — bot, automated reviewer, human reviewer, or maintainer
  • File and line — where it points
  • Body — the actual feedback (verbatim, not paraphrased)
  • Thread context — any replies in the same thread (to understand if it was already discussed or resolved conversationally)
  • Thread ID and top-level comment ID — the GraphQL review thread ID and the original top-level review comment databaseId needed to reply and resolve. Replies to replies are not supported; if only a reply ID is available, fetch the full thread and use the first/top-level review comment ID.

Group each unresolved review thread into a single finding. If multiple comments in one thread refine or supersede each other, use the latest unresolved reviewer request as the finding and retain the earlier messages as context.

Classify each finding source:

  • Bot — GitHub bot, CI system, or linter/static-analysis account such as github-actions[bot] or codecov[bot]
  • Automated reviewer — review-assistant accounts that produce natural-language suggestions, such as Copilot or CodeRabbit
  • Human reviewer — non-bot reviewer
  • Maintainer — repository owner/member/maintainer when that can be inferred from GitHub metadata

4. Present Findings

Present two separate sections:

Human Comments

Table ordered by:

  1. Bugs / correctness issues — reviewer identified broken logic or missing error handling
  2. Design / architecture feedback — structural changes, API shape, naming of public interfaces
  3. Style / nits — formatting, naming of local variables, minor readability

Use this table format:

#PriorityLocationReviewerRequestKey quoteAutofix
1Bugfile.go:42reviewerOne-line summary of what the reviewer is asking for.Short verbatim excerpt.Eligible, or Needs decision with the exact decision needed.

For automated reviewers, use the same table and set Reviewer to the tool account, with Priority based on the substance of the request.

Bot Comments (batched)

Table continuing the numbering from above, grouped by tool/bot:

#BotLocationRequired fixAutofix
8linter-namefile.go:42One-line summary of the required fix.Eligible, or Needs decision with the exact decision needed.

Keep table cells short and scannable. Use the smallest useful verbatim quote, not the full comment body. Escape | characters inside code or text so the table remains valid Markdown.

End with a summary: total human comments, total bot comments, overall assessment of effort.

Do not stop for mode selection. After the decision gate below, proceed by default with bot comments and human comments marked Autofix eligible. Mark a human comment Autofix eligible only when the requested change is source-backed, high confidence, minimal, unambiguous, does not require a product/design decision, does not add a dependency, does not change a shared/public interface, and has a clear verification path.

Leave all other human comments unresolved as Needs decision, with the exact decision needed. Do not reject a reviewer comment by default; rejection requires a user-provided public rationale.

Decision Gate Before Fixes

Before applying any fixes, handle every Needs decision finding first. Do not let bot comments or easy autofixes push these questions to the end.

  1. Present a short "Decision needed first" table:

    #LocationReviewerDecision neededWhy it blocks
    3file.go:42reviewerChoose whether the API should return nil or an empty slice.Either answer changes caller behavior.
  2. Try to answer each decision from source, PR context, existing project patterns, and the full review thread before asking the user.

  3. If the answer is source-backed, low risk, and has one clear implementation, reclassify the finding as Autofix eligible and record the reasoning.

  4. If the correct answer is "do not change this", record it as a proposed rejection, but do not publish the rejection without a user-provided public rationale.

  5. If any finding still needs a product/design call, shared/public interface decision, dependency choice, or other user judgment, STOP before bot or autofix work. Ask for all remaining decisions in one concise list.

  6. Continue to Step 5 only after every decision is either answered, reclassified, proposed for rejection with a user-provided rationale, or explicitly deferred by the user. Deferred Needs decision findings remain unresolved and must be listed again in the final summary.

Before applying any fixes, record the starting commit:

Choose an artifact directory using the AGENTS.md temporary artifact rule with agent name pfleidi-pr-feedback:

  • Use ./tmp/pfleidi-pr-feedback/ only when ./tmp/ already exists and is already ignored.
  • If no project-local artifact directory is available, do not create file artifacts by default; keep ledger/log/cache information in the response and mark file paths n/a. Ask before using /tmp/pfleidi-pr-feedback/ or modifying ignore files.

When an artifact directory is available, create a temporary thread ledger at <artifact-dir>/pr-feedback-<pr-number>.md. If no artifact directory is available, keep the same ledger fields in the final summary table instead. Update the ledger after each thread with:

  • Thread ID, source category, reviewer, location, and status.
  • Files touched.
  • What changed and why.
  • Related tests or verification commands.
  • Planned review-thread reply body, if any.
  • Resolve decision: yes/no and why.

5. Fix Bot Comments (batched)

After the decision gate, fix all bot comments first — these are mechanical and clearing them reduces noise before the human-comment phase.

  1. For each bot finding:
    • Read the relevant code
    • Implement the fix — ONLY the changes needed for that single finding
    • Track the files changed for this finding so the review-thread reply can identify the commit that contains the fix
    • If a fix is ambiguous or would conflict with a human-comment fix already applied, mark it Needs decision and continue
  2. After all bot fixes are applied, present a summary table. Do NOT show a diff — the Edit tool already showed each change inline.
#FindingFileBotStatus
8Descriptionpath:linelinter-nameFixed
9Descriptionpath:linelinter-nameFixed
11Descriptionpath:linelinter-nameSkipped — conflicts with #3
  1. Proceed directly to Step 6.

6. Fix Human Comments (batched)

After bot fixes, work through Autofix eligible human comments in report order:

  1. State which finding you are addressing (number and one-line description)
  2. Read the relevant code and the full comment thread to understand intent
  3. Re-check eligibility before editing; if the fix is no longer clearly eligible, mark it Needs decision and continue
  4. Implement the fix — ONLY the changes needed for that single finding
  5. Track the files changed for this finding so the review-thread reply can identify the commit that contains the fix
  6. If a comment needs a product/design decision, shared/public interface change, dependency, broad refactor, or has multiple reasonable fixes, mark it Needs decision and continue
  7. If the user rejects the comment instead of fixing it, record the specific rationale to use in the review-thread reply

Scope Rules

  • Make the MINIMAL change that addresses the reviewer's feedback
  • Keep the diff limited to files and lines directly required by the feedback
  • First decide whether the feedback points to a local or systemic issue. Fix at the narrowest correct level; do not add a local workaround that hides a shared/root-cause bug.
  • If the feedback requires a behavior-changing code fix, add or update the directly related test in the same fix. Prefer TDD, but complete the focused red-to-green cycle before stopping: write/update the failing test, confirm it fails, implement the fix, confirm the focused test passes. Do not stop after only adding the failing test unless the user explicitly asks.
  • Do NOT rename variables, reformat code, or touch lines outside the feedback scope
  • Do NOT refactor adjacent code, even if it looks related
  • If the reviewer's comment is ambiguous, mark it Needs decision and continue with unrelated unambiguous comments
  • Do NOT create any git commits during the fix cycle. Commits are handled only in the publish step, and only with explicit user approval when needed.

7. Verify Fixes

After all fixes are applied, run the project's compile/build, lint, and test commands scoped to only the changed files and their directly related tests. If no code changed, skip verification and proceed to Step 8. Use safe background batches for independent validators instead of running every command sequentially.

When selecting verification commands, reuse <artifact-dir>/verification-<repo-name>.md if an artifact directory is available and the cache is fresh under the cache rules from pfleidi:pr; otherwise discover the smallest relevant lint/test/build commands. Update the cache only when an artifact directory is available.

  • Build / compile — run a relevant compile/build command when one is discoverable for the changed production code.
  • Lint / static analysis — run the project's documented lint task, scoped to the files that were modified when the task supports scoping. Prefer lint-specific task wrappers such as make lint or mise run lint over invoking linter binaries directly. Do not use aggregate check, ci, or verify tasks unless you have confirmed they only run lint/static analysis. If the documented lint task cannot be scoped, run the smallest relevant project lint task.
  • Tests — run only the test files that cover the modified code (same package, same module, co-located test files). Do NOT run the full test suite.

If no compile/build command or project lint task exists, state that explicitly instead of assuming an unavailable command.

Run formatters, generators, snapshot updates, or other mutating commands alone before validators that depend on their output. Run independent read-only validators concurrently when they do not require the same exclusive service, port, database, fixture directory, or generated output. Keep integration/e2e/service-backed commands separate unless the project documents that they are parallel-safe.

For each background batch, start every command from the same working-tree state, capture stdout/stderr/exit status from the tool, do not edit files while the batch is running, and wait for every command to finish. Run each selected validator directly, for example mise run lint, go test ..., or npm test -- .... Do not wrap validators in sh -c, shell redirection, tee, command separators, or pipelines solely to write logs; that defeats command-prefix approvals and causes extra permission prompts. If an artifact directory is available and file logs can be written after the command completes without rerunning through a shell wrapper, save them under <artifact-dir>/logs-<pr-number>-<timestamp>/; otherwise mark the full-log path as n/a. If files change after a failed batch, none of that batch's successful results count as current verification.

Show verification as a compact table:

CommandExitRelevant outputFull log
go test ./pkg/foo -run TestBar -count=10Short success excerpt.<artifact-dir>/logs-.../go-test-pkg-foo.log or n/a

For failures or short outputs, show complete output in the relevant-output column or immediately below the table. For long successful outputs, show the relevant excerpt and log path.

If compile/build, lint, or tests fail due to issues introduced by the fixes:

  1. Read the error output and identify every failure
  2. Fix all issues — apply the minimal changes needed
  3. Re-run the failing commands using the same safe batching rules
  4. Show the complete output again

Cap at 2 fix attempts. If still failing after 2 rounds, present the remaining failures to the user with full output. Do not describe the work as done or commit-ready while compile/build status is failing or unknown for changed production code.

Once verification passes, show a summary: how many comments were addressed, rejected, intentionally left unresolved, or still blocked. If compile/build did not pass for code changes, say the work is not commit-ready before the summary. Do NOT show a diff — the Edit tool already showed each change inline.

Proceed to Step 8 for threads that were addressed or intentionally rejected. Leave Needs decision threads unresolved and do not post replies to them unless the user provided a public rejection rationale. Do not block publishing addressed threads just because unrelated threads still need a decision.

8. Publish PR Updates

After addressed/rejected threads are ready to publish:

  1. Check branch state:

  2. If there are uncommitted fix changes, STOP and ask the user whether to commit them now or let the user commit manually. Do not push until the fixes are committed. If compile/build did not pass for code changes, say the work is not commit-ready and do not ask to commit until the gap is resolved or the user explicitly takes over. If the user approves committing after verification, stage only files changed for the PR feedback fixes and write the commit message from the actual diff using the subject-plus-context style from AGENTS.md.

  3. Push the committed changes for the current branch:

    If the branch has no upstream and the push fails for that reason, use:

    Never force-push.

  4. Map each addressed finding to the commit or commits that contain its fix. Use the recorded starting commit, changed-file tracking, ledger, and git log / git show to identify the relevant short SHA(s). If one commit fixes multiple comments, reference the same commit in each review-thread reply.

  5. Build and show a direct review-thread reply plan before calling the API:

    ThreadTop-level comment IDStatusReply bodyResolve
    PRRT_...123456789AddressedAddressed in abc1234 by adding the nil check before dereferencing.Yes
    PRRT_...n/aNeeds decisionn/aNo

    Proceed without asking when every actionable reply body is either addressed or a user-approved rejection. Needs decision rows with Reply body = n/a and Resolve = No do not block publishing addressed threads only if they already passed the decision gate and were explicitly deferred by the user. Stop before API calls if a rejection lacks a public rationale, if a top-level comment ID is missing for a thread that should receive a reply, or if any reply body is uncertain.

  6. Post one direct review-thread reply for each addressed or user-approved rejected thread:

    • For addressed comments, state what changed and the commit SHA(s), e.g. Addressed in abc1234 by adding the nil check before dereferencing.

    • For rejected comments, state why it was not changed, e.g. Not changed: this path already returns before allocation failure can be observed.

    • Keep replies concise but specific. Do not over-explain or repeat the diff.

    • Do not reply to comments the user explicitly chose to leave unresolved unless needed to publish a user-approved rejection rationale.

    • Use the REST review-comment reply endpoint:

    This endpoint posts an immediate reply to the existing review thread. Do not use gh pr review, GraphQL addPullRequestReviewThreadReply, gh pr comment, or the regular issue comment endpoint as a fallback.

  7. Resolve each addressed or user-approved rejected thread after its direct review-thread reply succeeds:

    Do not resolve a thread that did not receive a successful direct reply, is still ambiguous, or still needs user approval.

  8. Present a final summary table:

    ThreadReviewerLocationStatusCommentedResolved
    PRRT_...reviewerfile.go:42AddressedYesYes
    PRRT_...reviewerfile.go:99Needs decisionNoNo

    Include push result, branch, ledger path, rejected comments and rationale, and any comments intentionally left unresolved or not resolvable via API.

9. Post-Publish

  • If the user asks for adjustments, apply them
  • If the user asks to revert specific fixes, revert ONLY those changes
  • Do NOT commit or push additional changes unless explicitly asked
2mo ago·3m

All eligible fixes are applied and verified (the compile-error diagnostics that just appeared are stale IDE state from the merge — go test, go build, and golangci all pass on the current tree).

CommandExitRelevant output
go test -run TestCouldBePrefix ./cmd/entire/cli/checkpoint/id/ -count=10ok — including new HEAD=false, 7ZZZZZ=true, 8ZZZZZ=false cases
go test -run TestCheckpointResume ./cmd/entire/cli/ -count=10ok — all 13 tests, clash test now isolated
mise run fmt && mise run lint00 issues
#FindingFileStatus
1ULID prefix branch requires leading [0-7]checkpoint/id/id.goFixed — regex is now [0-7][REDACTED]{0,25}; "HEAD" no longer shape-matches, so auto-detect skips the store/remote entirely for it
2Update CouldBePrefix("HEAD") expectationcheckpoint/id/id_test.goFixed — plus boundary cases 7ZZZZZ/8ZZZZZ; also corrected the now-stale comment on the HEAD regression test
4Missing testutil.IsolateGitConfigEnv(t)checkpoint_resume_test.goFixed — added at the top of TestCheckpointResume_WorktreeClash
3Best-effort resolveLatestCheckpointcheckpoint_resume.goAwaiting your decision

Two things I need from you before publishing:

  1. Decision on #3 — my recommendation stands: reject with the public rationale I proposed (matches session resume's identical fatal handling; best-effort would silently resume an older checkpoint; the right home for a metadata fallback is the shared helper). Say "reject as proposed", or ask me to implement Copilot's suggestion instead.
  2. Commit approval for the three fixes — proposed message: checkpoint resume: address PR review feedback with body noting the ULID prefix tightening and test git-config isolation.

Once I have both, I'll commit, push, reply to each thread with the fix SHA (or rejection rationale), and resolve them.

For 1, I agree that we should reject the finding. Otherwise, commit the changes.

2mo ago·1m

All PR feedback is handled — fixes committed, pushed, every thread replied to and resolved.

ThreadReviewerLocationStatusCommentedResolved
…LcXCopilotcheckpoint/id/id.go:51Addressed (e4021a7978)YesYes
…LdKCopilotcheckpoint/id/id_test.go:325Addressed (e4021a7978)YesYes
…LdhCopilotcheckpoint_resume.go:207Rejected (your approval, rationale posted)YesYes
…LsvCursor Bugbotcheckpoint_resume_test.go:250Addressed (e4021a7978)YesYes

Push: 95ce35d7fe..e4021a7978checkpoint-resume. Ledger: n/a (no project-local artifact directory). Nothing left unresolved on the PR — it's still a draft at https://github.com/entireio/cli/pull/1701 whenever you want to mark it ready.

One thing to note here:

Auto-detection only treats local branches as branch targets.

I think this isn't right: If we have determined that neither a checkpoint ID nor a commit sha was passed, we should always try to fall back to remote branches if the branch doesn't exist locally. The main purpose of this feature is to resume sessions from other people or machines so it's unlikely for the branch to be locally available. If the branch exits locally, fine, but generally speaking I'd expect having to fetch it from the remote.

2mo ago·2m

All green — 14 unit tests now, lint clean. Ready for your review:

What changed:

  • resumeAutoTarget gains a final remote-branch fallback: when nothing matched as a checkpoint, local branch, or commit, it checks BranchExistsOnRemote (local origin/<name> tracking ref, then git ls-remote) and hands off to runResume — which offers to fetch and check the branch out (--force skips the prompt). The HEAD-misroute protection is preserved structurally: revision syntax gets consumed by commit resolution before the remote-branch check can see it.
  • Help text and docstring updated: detection order is now checkpoint ID → local branch → commit → remote branch (offering to fetch).
  • New test TestCheckpointResumeAuto_RemoteBranchFallback: a second temp repo acts as origin with a remote-feature branch that doesn't exist locally; auto-detect with --force fetches and checks it out.

One caveat worth naming: the non---force path for a remote-only branch hits the fetch confirmation prompt, which still has no non-TTY guard (the known deferred resume.go follow-up) — so non-interactive agents should pass --force for remote branches. Unchanged from session resume's behavior.

After committing I'll also update the PR description bullet ("Auto-detection only treats local branches as branch targets") to describe the new order.

Proposed commit: checkpoint resume: fall back to remote branches in auto-detection. Approve?

commit the changes and also update the PR description

2mo ago·58.8s

Done. Committed and pushed 8828752a7b (remote-branch fallback + test), and the PR description at https://github.com/entireio/cli/pull/1701 now reflects the new auto-detection order — the "local branches only" decision bullet is replaced with the remote-fallback rationale, the usage example shows the fetch behavior, and the reviewer notes mention --force for non-interactive remote-branch resumes.