Implement Checkpoint Resume Command · Entire

Home

Log in

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:

1w ago·8.7s·1 call

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.

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.

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

digraph brainstorming {
    "Explore project context" [shape=box];
    "Ask clarifying questions" [shape=box];
    "Propose 2-3 approaches" [shape=box];
    "Present design sections" [shape=box];
    "User approves design?" [shape=diamond];
    "Write design doc" [shape=box];
    "Spec self-review\n(fix inline)" [shape=box];
    "User reviews spec?" [shape=diamond];
    "Invoke writing-plans skill" [shape=doublecircle];

"Explore project context" -> "Ask clarifying questions";
    "Ask clarifying questions" -> "Propose 2-3 approaches";
    "Propose 2-3 approaches" -> "Present design sections";
    "Present design sections" -> "User approves design?";
    "User approves design?" -> "Present design sections" [label="no, revise"];
    "User approves design?" -> "Write design doc" [label="yes"];
    "Write design doc" -> "Spec self-review\n(fix inline)";
    "Spec self-review\n(fix inline)" -> "User reviews spec?";
    "User reviews spec?" -> "Write design doc" [label="changes requested"];
    "User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
}

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:

Exploring approaches:

Presenting the design:

Design for isolation and clarity:

Working in existing codebases:

After the Design

Documentation:

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:

Key Principles

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?

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

1w ago·2m·20 calls

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

1w ago·10m

No response requested.

Yes?

1w ago·30m·1 call

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?

1w ago·1h 11m·3 calls

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

I think I've come to a few conclusions:

So the question for me here is:

1w ago·40m·4 calls

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.

1w ago·4m·9 calls

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


Design: entire checkpoint resume — part 1

1. Command surface

entire checkpoint resume [target]        # auto-detect: checkpoint ID | commit sha | branch
entire checkpoint resume                 # TTY: picker of recent checkpoints; non-TTY: plain-text list
  --checkpoint, -c <id>                  # force interpretation as checkpoint ID (or prefix)
  --commit <ref>                         # force interpretation as commit-ish
  --branch <name>                        # force interpretation as branch name
  --force, -f                            # skip confirmations, overwrite existing local session logs

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 name — branchCommit() already resolves local branch then origin/<name>. Checked before commit because a branch name also parses as a revision.
  3. Commit revision — resolveCommitUnambiguous (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


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

1w 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.

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

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

1w ago·1m·3 calls

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

1w ago·20.1s·3 calls

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

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.

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):

Plan Document Header

Every plan MUST start with this header:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# [Feature Name] Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** [One sentence describing what this builds]

**Architecture:** [2-3 sentences about approach]

**Tech Stack:** [Key technologies/libraries]

## Global Constraints

[The spec's project-wide requirements — version floors, dependency limits,\
naming and copy rules, platform requirements — one line each, with exact\
values copied verbatim from the spec. Every task's requirements implicitly\
include this section.]

---

Task Structure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

### Task N: [Component Name]

**Files:**
- Create: `exact/path/to/file.py`
- Modify: `exact/path/to/existing.py:123-145`
- Test: `tests/exact/path/to/test.py`

**Interfaces:**
- Consumes: [what this task uses from earlier tasks — exact signatures]
- Produces: [what later tasks rely on — exact function names, parameter\
  and return types. A task's implementer sees only their own task; this\
  block is how they learn the names and types neighboring tasks use.]

- [ ] **Step 1: Write the failing test**

```python
def test_specific_behavior():
    result = function(input)
    assert result == expected
```

- [ ] **Step 2: Run test to verify it fails**

Run: `pytest tests/path/test.py::test_name -v`
Expected: FAIL with "function not defined"

- [ ] **Step 3: Write minimal implementation**

```python
def function(input):
    return expected
```

- [ ] **Step 4: Run test to verify it passes**

Run: `pytest tests/path/test.py::test_name -v`
Expected: PASS

- [ ] **Step 5: Commit**

```bash
git add tests/path/test.py src/path/file.py
git commit -m "feat: add specific feature"
```

No Placeholders

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

Remember

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:

If Inline Execution chosen:

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.

1w ago·9m·20 calls

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

1w ago·3m·2 calls

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

1w ago·9.6s·1 call

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

digraph when_to_use {
    "Have implementation plan?" [shape=diamond];
    "Tasks mostly independent?" [shape=diamond];
    "Stay in this session?" [shape=diamond];
    "subagent-driven-development" [shape=box];
    "executing-plans" [shape=box];
    "Manual execution or brainstorm first" [shape=box];

"Have implementation plan?" -> "Tasks mostly independent?" [label="yes"];
    "Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];
    "Tasks mostly independent?" -> "Stay in this session?" [label="yes"];
    "Tasks mostly independent?" -> "Manual execution or brainstorm first" [label="no - tightly coupled"];
    "Stay in this session?" -> "subagent-driven-development" [label="yes"];
    "Stay in this session?" -> "executing-plans" [label="no - parallel session"];
}

vs. Executing Plans (parallel session):

The Process

digraph process {
    rankdir=TB;

subgraph cluster_per_task {
        label="Per Task";
        "Dispatch implementer subagent (./implementer-prompt.md)" [shape=box];
        "Implementer subagent asks questions?" [shape=diamond];
        "Answer questions, provide context" [shape=box];
        "Implementer subagent implements, tests, commits, self-reviews" [shape=box];
        "Write diff file, dispatch task reviewer subagent (./task-reviewer-prompt.md)" [shape=box];
        "Task reviewer reports spec ✅ and quality approved?" [shape=diamond];
        "Dispatch fix subagent for Critical/Important findings" [shape=box];
        "Mark task complete in todo list and progress ledger" [shape=box];
    }

"Read plan, note context and global constraints, create todos" [shape=box];
    "More tasks remain?" [shape=diamond];
    "Dispatch final code reviewer subagent (../requesting-code-review/code-reviewer.md)" [shape=box];
    "Use superpowers:finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen];

"Read plan, note context and global constraints, create todos" -> "Dispatch implementer subagent (./implementer-prompt.md)";
    "Dispatch implementer subagent (./implementer-prompt.md)" -> "Implementer subagent asks questions?";
    "Implementer subagent asks questions?" -> "Answer questions, provide context" [label="yes"];
    "Answer questions, provide context" -> "Dispatch implementer subagent (./implementer-prompt.md)";
    "Implementer subagent asks questions?" -> "Implementer subagent implements, tests, commits, self-reviews" [label="no"];
    "Implementer subagent implements, tests, commits, self-reviews" -> "Write diff file, dispatch task reviewer subagent (./task-reviewer-prompt.md)";
    "Write diff file, dispatch task reviewer subagent (./task-reviewer-prompt.md)" -> "Task reviewer reports spec ✅ and quality approved?";
    "Task reviewer reports spec ✅ and quality approved?" -> "Dispatch fix subagent for Critical/Important findings" [label="no"];
    "Dispatch fix subagent for Critical/Important findings" -> "Write diff file, dispatch task reviewer subagent (./task-reviewer-prompt.md)" [label="re-review"];
    "Task reviewer reports spec ✅ and quality approved?" -> "Mark task complete in todo list and progress ledger" [label="yes"];
    "Mark task complete in todo list and progress ledger" -> "More tasks remain?";
    "More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];
    "More tasks remain?" -> "Dispatch final code reviewer subagent (../requesting-code-review/code-reviewer.md)" [label="no"];
    "Dispatch final code reviewer subagent (../requesting-code-review/code-reviewer.md)" -> "Use superpowers:finishing-a-development-branch";
}

Pre-Flight Plan Review

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

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):

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:

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:

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.

Prompt Templates

Example Workflow

You: I'm using Subagent-Driven Development to execute this plan.

[Read plan file once: docs/superpowers/plans/feature-plan.md]
[Create todos for all tasks]

Task 1: Hook installation script

[Run task-brief for Task 1; dispatch implementer with brief + report paths + context]

Implementer: "Before I begin - should the hook be installed at user or system level?"

You: "User level (~/.config/superpowers/hooks/)"

Implementer: "Got it. Implementing now..."
[Later] Implementer:
  - Implemented install-hook command
  - Added tests, 5/5 passing
  - Self-review: Found I missed --force flag, added it
  - Committed

[Run review-package, dispatch task reviewer with the printed path]
Task reviewer: Spec ✅ - all requirements met, nothing extra.
  Strengths: Good test coverage, clean. Issues: None. Task quality: Approved.

[Mark Task 1 complete]

Task 2: Recovery modes

[Run task-brief for Task 2; dispatch implementer with brief + report paths + context]

Implementer: [No questions, proceeds]
Implementer:
  - Added verify/repair modes
  - 8/8 tests passing
  - Self-review: All good
  - Committed

[Run review-package, dispatch task reviewer with the printed path]
Task reviewer: Spec ❌:
  - Missing: Progress reporting (spec says "report every 100 items")
  - Extra: Added --json flag (not requested)
  Issues (Important): Magic number (100)

[Dispatch fix subagent with all findings]
Fixer: Removed --json flag, added progress reporting, extracted PROGRESS_INTERVAL constant

[Task reviewer reviews again]
Task reviewer: Spec ✅. Task quality: Approved.

[Mark Task 2 complete]

...

[After all tasks]
[Dispatch final code-reviewer]
Final reviewer: All requirements met, ready to merge

Done!

Advantages

vs. Manual execution:

vs. Executing Plans:

Efficiency gains:

Quality gates:

Cost:

Red Flags

Never:

If subagent asks questions:

If reviewer finds issues:

If subagent fails task:

Integration

Required workflow skills:

Subagents should use:

Alternative workflow:

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.

1w ago·13m·15 calls

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

What changed:

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

1w ago·7m·9 calls

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):

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?

677c3cecheckpoint resume: add command with target resolution\ \ Resume agent sessions by checkpoint ID, commit SHA, or branch. Checkpoint\ and commit targets check out the containing branch at its tip (restore-only\ when no local branch contains the checkpoint); branch targets reuse the\ session-resume flow. Auto-detection tries checkpoint, then branch, then\ commit; --checkpoint/--commit/--branch force one interpretation.\ \ Entire-Checkpoint: 01KWYRTVSDQ4WRJ7WQVB0PA0VT+391/-2

commit and continue

1w ago·9m·17 calls

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 experimental — checkpoint_resume.go, checkpoint_group.go
  2. checkpoint resume: integration tests and docs — test file + CLAUDE.md

Approve that shape?

095936acheckpoint resume: bare picker and non-TTY listing\ \ Bare invocation shows the newest 20 committed checkpoints: an interactive\ picker on a terminal, a complete plain-text list (full IDs, timestamps,\ branch, agent) otherwise, so agents can list and then resume by ID.\ \ Entire-Checkpoint: 01KX1C7S64969W3NCJ3ZCK95CP+162/-2

Can you undo all changes to claude.md?

1w ago·25.7s·1 call

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

Revised commit shape:

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

Approve?

Commit and continue

1w ago·15m·10 calls

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

e4e48b4checkpoint resume: hide while experimental\ \ Keep the command runnable but out of help output while the surface\ settles; drop the session-resume comparison from its help text.\ \ Entire-Checkpoint: 01KX1EDMAWF7JFGQNC5KTYBTTY+6/-7

b702fd7checkpoint resume: integration tests\ \ Cover the by-ID resume flow (branch checkout via checkpoint index) and\ the non-TTY bare listing end-to-end with the spawned binary.\ \ Entire-Checkpoint: 01KX1EDSKA7BA4R9RTSAAWWFSC+76

ab06ef7c5fe9cf445 toolu\_018vAzp4MJQKnuw2ALATk83w /private/tmp/claude-501/-Users-pfleidi-entire-cli--worktrees-checkpoint-resume/32ec1d17-fac5-45b1-9bb6-83860bacb40b/tasks/ab06ef7c5fe9cf445.output completed Agent "Final whole-branch review" finished A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once. ### Verdict per issue

Issue 1 (HEAD misrouted as branch): Fixed. The new order in resumeAutoTarget (checkpoint_resume.go) — local checkpoint prefix → branchExistsLocally (local refs only, resolved via plumbing.NewBranchReferenceName, no origin/ fallback) → remote checkpoint fallback → commit — eliminates the refs/remotes/origin/HEAD route entirely; "HEAD" now falls through to resolveCommitUnambiguous. The help text and the function comment were updated to match, and remote-only branches remain reachable via explicit --branch (which goes straight to runResume). The precedence guarantee the original tests pin (local checkpoint beats same-named local branch) is preserved because the local prefix match still runs first.

Issue 2 (worktree-clash pointer): Fixed. The message now names the exact recovery command cd &lt;path&gt; &amp;&amp; entire checkpoint resume &lt;cpID&gt; with the path shell-quoted via the existing shellQuote; cpID is always a store/trailer-validated checkpoint ID, so nothing unquoted-and-attacker-shaped lands in the copy-paste line. Built locally in resumeResolvedCheckpoint — resume_picker.go untouched, as intended.

Issue 3 (hex-named local branches pay a remote fetch): Fixed for the reported case — a local branch check now precedes the remote fallback, so resume abcdef with a local branch of that name never fetches. Residual (see below): hex-shaped targets that are commit SHA prefixes still pay the remote checkpoint fetch before commit resolution. Acceptable.

Issue 5 (silent picker cancel): Fixed. Explicit Cancel and esc/Ctrl+C both print "Resume cancelled." (the sibling session picker only prints on explicit Cancel; printing on abort too is a harmless, arguably better divergence).

Issue 6 (sentinel wording): Fixed. Message now says "checkpoint prefix … matches N checkpoints"; errors.Is compatibility kept.

Triage item 3 (label test): Fixed.TestCheckpointResumeOptionLabel_Fallbacks covers both the "no local branch" and unknown-agent fallbacks plus the indexed-branch case — exactly the cheap pure-function test I asked for.

Issue 4: correctly deferred per my recommendation (belongs in switchToBranchForResume, deliberately-unmodified file; follow-up issue).

New concerns introduced by the fixes

  1. The regression test doesn't actually pin the Issue 1 fix — checkpoint_resume_test.go, TestCheckpointResumeAuto_HeadResolvesAsCommit. The test repo has no origin remote, so refs/remotes/origin/HEAD doesn't exist; on the old code, branchCommit(repo, "HEAD") fails both ref lookups and falls through to commit resolution anyway — the test passes pre-fix. It verifies the desired end behavior but would not catch the bug regressing. One-line-ish strengthening: seed the trigger condition in setup with repo.Storer.SetReference(plumbing.NewSymbolicReference(plumbing.NewRemoteHEADReferenceName("origin"), plumbing.NewRemoteReferenceName("origin", "master"))) plus an origin/master hash ref, which makes the test fail against the old resolution order. Minor, but worth doing while the file is hot.

  2. Residual from Issue 3 (pre-existing shape, not a regression): a target that is a commit SHA prefix (hex, ≤12 chars) and matches no local checkpoint or branch still triggers matchCheckpointPrefixWithRemoteFallback's network fetch + spinner before commit resolution — e.g. entire checkpoint resume abc1234. Correctness is fine; it's latency plus a momentarily misleading spinner. Fine to leave for the soft launch.

Everything else in the diff is clean: the split of the picker's err != nil || !ok preserves error propagation while adding the cancel message; the lookup-lifecycle contract is unchanged (the swapped lookup is still returned/assigned and the deferred double-close guard still holds — the early local-only matchCheckpointPrefix call never swaps).

Final verdict

Ready to merge? Yes. Both Important issues are correctly and minimally fixed, no new correctness issues were introduced, and the two remaining notes (a regression test that doesn't fail on the old code, and a residual spinner on SHA-prefix targets) are minor polish appropriate for a follow-up — though the test strengthening is cheap enough to fold in before merge if the window is still open. <subagent_tokens>151997</subagent_tokens><tool_uses>2</tool_uses><duration_ms>69061</duration_ms>

1w ago·1m·4 calls

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

1w ago·1m·3 calls

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.

a9d4ce9checkpoint resume: harden auto-detection and clash message\ \ Auto-detection now only treats local branches as branch targets, so\ revision syntax like HEAD and remote-only branch names fall through to\ commit resolution instead of misrouting via branchCommit's origin/\ fallback; the local-branch check also runs before the remote checkpoint\ fetch, sparing hex-named branches a network round-trip. The worktree-\ clash message points at 'entire checkpoint resume ' in the owning\ worktree instead of the session picker, cancelling the picker prints\ feedback, and the ambiguous-prefix error names checkpoints.\ \ Entire-Checkpoint: 01KX43N6X1W5H2P290WEM1F45E+96/-12

/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).

1w ago·8m·29 calls

/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

1w ago·27.6s·2 calls

c6659c5checkpoint resume: simplify picker and prefix gate\ \ Rely on store.List's documented newest-first ordering instead of\ re-sorting, move the checkpoint-prefix shape gate into the id package\ next to the patterns it must not drift from, reuse the existing picker\ cancel sentinel, and share the repeated test repo setup.\ \ Entire-Checkpoint: 01KX48VMKTYXYNTAGAK3B2BCQN+64/-74

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):

1
2

BASE=origin/main
git diff $BASE --stat

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:

Context Source Value
User goal Conversation One-line summary, or not provided
Implementation plan Conversation / docs One-line summary, or not provided
PR context PR title/body One-line summary, or no PR found
Commits git log --oneline origin/main..HEAD One-line summary of commit intent
Changed surface diff file list Main packages/files touched
Inferred behavior commits/tests/docs/user text Intended 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:

# Severity Sources Location Classification Autofix Issue Impact
1 Medium correctness + coverage cmd/entire/cli/checkpoint/v2_committed.go:234 Required Eligible One-sentence problem. Concrete consequence if not fixed.

Details table format:

# Evidence Suggested fix Trade-offs
1 Source-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:

# Location Planned change Related test/verification Files expected
1 path/file.go:42 Minimal 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:

Command Exit Relevant output Full log
go test ./pkg/foo -run TestBar -count=1 0 Short 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.

# Finding File Status What changed Why
1 Description path:line Fixed Added nil check in foo Prevents panic on missing config
3 Description path:line Fixed Added focused test for invalid input Verifies intended error path
6 Description path:line Needs decision None API shape has two reasonable options

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

# Files touched Rollback notes
1 path/file.go, path/file_test.go Revert 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.

1w ago·15m·9 calls

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)

# Severity Sources Location Classification Autofix Issue Impact
1 Medium readability checkpoint_resume.go:178 Improvement n/a resumeCommitTarget 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.
2 Medium readability checkpoint_resume.go:99-151 Improvement n/a resumeAutoTarget 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.
3 Medium correctness checkpoint_resume.go:100 Improvement n/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.
4 Low correctness checkpoint_resume.go:160 Improvement n/a Ambiguous checkpoint-prefix branch untested for this command. Ambiguity rendering regression would go unnoticed here (it is tested for explain).
5 Low correctness checkpoint_resume.go:217 Improvement n/a Worktree-clash pointer path untested. Message wording/flow regression would go unnoticed.
6 Low de-slop checkpoint_resume.go:70-75 Improvement n/a RunE'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.
7 Low clean-go checkpoint/id/id.go:47-51 Improvement n/a Comment 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.
8 Low clean-go checkpoint_resume.go:115-124 Improvement n/a resumeAutoTarget 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.
# Evidence Suggested fix Trade-offs
1 explain.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
2 runCheckpointResume: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–5 Untested 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
6 resume.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
7 prefixShapeRegex 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
8 Code 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

1w ago·5m·18 calls

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.

Command Exit Relevant output Full log
mise run fmt && mise run lint 0 golangci-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=1 0 ok, 13/13 incl. 3 new tests n/a
go test -tags integration -run 'TestCheckpointResume' ./cmd/entire/cli/integration_test/ -count=1 0 ok, 2/2 n/a
go test -run 'TestCouldBePrefix' ./cmd/entire/cli/checkpoint/id/ -count=1 0 ok n/a
# Finding File Status What changed Why
1 Dropped resolve error checkpoint_resume.go Fixed logging.Debug with ref + error before the errNoResumeCommit wrap Diagnosable "target not found" reports, parity with explain
2 Lookup-swap threading checkpoint_resume.go Fixed resumeAutoTarget now closes a swapped-in lookup itself via local defer and returns only error; caller simplified to a plain return Leak-prone contract removed from the caller
3 --checkpoint untested checkpoint_resume_test.go Fixed TestCheckpointResumeFlag_Checkpoint (flag + prefix match → restore) Covers the third documented target mode
4 Ambiguity untested checkpoint_resume_test.go Fixed TestCheckpointResumeFlag_AmbiguousCheckpointPrefix (two colliding IDs → styled failure listing both) Pins the ambiguity rendering
5 Clash untested checkpoint_resume_test.go Fixed TestCheckpointResume_WorktreeClash — real second worktree via git worktree add in the temp repo (existing pattern from session_adopt_test.go); asserts message, resume command, HEAD unmoved Pins the clash pointer end-to-end
6 Duplicate logging init — Skipped (your call) None Would touch resume.go
7 Overclaiming comment checkpoint/id/id.go Fixed "cannot drift" → "reminder to update together" Comment no longer promises an unenforced guarantee
8 Docstring vs actual order checkpoint_resume.go Fixed Docstring 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

1w ago·40.9s·1 call

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.

75b158bcheckpoint resume: address review findings\ \ Log commit-resolution failures at debug for diagnosability, contain the\ remote-fallback lookup swap inside resumeAutoTarget so callers no longer\ thread it to their deferred close, correct the auto-detection docstring\ to the actual local-checkpoint / local-branch / remote-fallback / commit\ order, and cover the --checkpoint flag, ambiguous prefixes, and the\ worktree-clash pointer with tests.\ \ Entire-Checkpoint: 01KX4A9S37VZTVXCK59QGTVYJJ+124/-25

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.

1
2
3

BASE=origin/main
MERGE_BASE=$(git merge-base HEAD "$BASE")
git log --oneline "$BASE"..HEAD

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:

1

git diff --name-status "$MERGE_BASE"

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:

1

git status --short

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:

1
2

git fetch origin main
git merge origin/main

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.mod → go build ./..., go vet ./..., go test ./...; do NOT infer a lint command from Go alone
    • package.json → check scripts for build, lint, test
    • Cargo.toml → cargo 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:

Command Exit Relevant output
go test ./pkg/foo -run TestBar -count=1 0 Short success excerpt.
  1. 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.

  2. 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:

1

git status --short

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

1

git push origin HEAD

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.

1

PR_BASE=main

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

Determine the pushed source branch:

1

HEAD_BRANCH=$(git branch --show-current)

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:

1

REMOTE_URL=$(git remote get-url origin)

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:

1

gh repo view --json owner,name --jq '"\(.owner.login)/\(.name)"'

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:

1
2
3
4
5
6
7

gh api "repos/$GITHUB_REPO/pulls" \
  -f title="<title>" \
  -f body="<body>" \
  -f head="$HEAD_BRANCH" \
  -f base="$PR_BASE" \
  -F draft=true \
  --jq .html_url

For normal GitHub remotes, use gh pr create:

1

gh pr create --draft --repo "$GITHUB_REPO" --base "$PR_BASE" --head "$HEAD_BRANCH" --title "<title>" --body "<body>"

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.

1w ago·2m·7 calls

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

entire checkpoint resume 01HZXW5J8KQ2M3N4P5Q6R7S8T9   # checkpoint ID or unique prefix
entire checkpoint resume abc1234                       # commit SHA → its checkpoint trailer
entire checkpoint resume feature/foo                   # branch, like session resume
entire checkpoint resume --commit HEAD                 # forced interpretation
entire checkpoint resume                               # picker (TTY) / plain list (non-TTY)

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?

1w 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

entire checkpoint resume 01HZXW5J8KQ2M3N4P5Q6R7S8T9   # checkpoint ID or unique prefix
entire checkpoint resume abc1234                       # commit SHA → its checkpoint trailer
entire checkpoint resume feature/foo                   # branch, like session resume
entire checkpoint resume --commit HEAD                 # e.g. extend already-merged work from main
entire checkpoint resume                               # picker (TTY) / plain list (non-TTY)

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.

bislgn73n REDACTED /private/tmp/claude-501/-Users-pfleidi-entire-cli--worktrees-checkpoint-resume/664f5cbc-ea34-474b-8d3a-53e3f5cb9230/tasks/bislgn73n.output failed Background command "Run full CI test suite (unit + integration + canary)" failed with exit code 1

1w ago·1m·6 calls

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.

1w ago·16.0s

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

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.

b677u1kfi toolu\_019UM914wH7wwhRYoHSLRSsE /private/tmp/claude-501/-Users-pfleidi-entire-cli--worktrees-checkpoint-resume/664f5cbc-ea34-474b-8d3a-53e3f5cb9230/tasks/b677u1kfi.output completed Background command "Run e2e canary suite" completed (exit code 0)

1w ago·1m·5 calls

https://github.com/entireio/cli/pull/1701

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

1w ago·50.2s·2 calls

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:

1

gh pr view --json number,title,url --jq '.number, .title, .url'

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:

1

gh pr view {number} --json number,title,url,body,headRefName,baseRefName

Also collect branch commits and changed files for context:

1
2

git log --oneline origin/main..HEAD
git diff --name-status origin/main

Show the PR context as a table before classifying comments:

Context Source Value
PR title/body One-line PR intent
Branch commits One-line commit summary
Changed surface diff file list Main packages/files touched
Base/head PR metadata base <- head

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

gh api graphql -F owner={owner} -F repo={repo} -F number={number} -f query='
query($owner: String!, $repo: String!, $number: Int!) {
  repository(owner: $owner, name: $repo) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          id
          isResolved
          path
          line
          comments(first: 50) {
            nodes {
              id
              databaseId
              body
              author { login }
            }
          }
        }
      }
    }
  }
}'

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:

1
2

gh api repos/{owner}/{repo}/pulls/{number}/comments --paginate
gh api repos/{owner}/{repo}/pulls/{number}/reviews --paginate

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:

# Priority Location Reviewer Request Key quote Autofix
1 Bug file.go:42 reviewer One-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:

# Bot Location Required fix Autofix
8 linter-name file.go:42 One-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:
# Location Reviewer Decision needed Why it blocks
3 file.go:42 reviewer Choose whether the API should return nil or an empty slice. Either answer changes caller behavior.
  1. Try to answer each decision from source, PR context, existing project patterns, and the full review thread before asking the user.

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

  3. 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.

  4. 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.

  5. 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:

1

git rev-parse HEAD

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.
# Finding File Bot Status
8 Description path:line linter-name Fixed
9 Description path:line linter-name Fixed
11 Description path:line linter-name Skipped — 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.

  • 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.

Show verification as a compact table:

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

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:
1

git status --short --branch
  1. 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.

  2. Push the committed changes for the current branch:

1

git push origin HEAD

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

1

git push -u origin HEAD

Never force-push.

  1. 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.

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

Thread Top-level comment ID Status Reply body Resolve
PRRT_... 123456789 Addressed Addressed in abc1234 by adding the nil check before dereferencing. Yes
PRRT_... n/a Needs decision n/a No

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.

  1. 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:

     1

gh api --method POST repos/{owner}/{repo}/pulls/{number}/comments/{comment_id}/replies -f body="$REPLY_BODY"
     ```

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:

1 2 3 4 5 6

gh api graphql -f query=' mutation($thread: ID!) { resolveReviewThread(input: {threadId: $thread}) { thread { id isResolved } } }' -f thread="$THREAD_ID"


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:

| Thread | Reviewer | Location | Status | Commented | Resolved |
| --- | --- | --- | --- | --- | --- |
| `PRRT_...` | `reviewer` | `file.go:42` | Addressed | Yes | Yes |
| `PRRT_...` | `reviewer` | `file.go:99` | Needs decision | No | No |

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

1w ago·3m·13 calls

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).

| Command | Exit | Relevant output |
| --- | --- | --- |
| `go test -run TestCouldBePrefix ./cmd/entire/cli/checkpoint/id/ -count=1` | 0 | ok — including new `HEAD=false`, `7ZZZZZ=true`, `8ZZZZZ=false` cases |
| `go test -run TestCheckpointResume ./cmd/entire/cli/ -count=1` | 0 | ok — all 13 tests, clash test now isolated |
| `mise run fmt && mise run lint` | 0 | 0 issues |

| # | Finding | File | Status |
| --- | --- | --- | --- |
| 1 | ULID prefix branch requires leading `[0-7]` | `checkpoint/id/id.go` | Fixed — regex is now `[0-7][REDACTED]{0,25}`; "HEAD" no longer shape-matches, so auto-detect skips the store/remote entirely for it |
| 2 | Update `CouldBePrefix("HEAD")` expectation | `checkpoint/id/id_test.go` | Fixed — plus boundary cases `7ZZZZZ`/`8ZZZZZ`; also corrected the now-stale comment on the HEAD regression test |
| 4 | Missing `testutil.IsolateGitConfigEnv(t)` | `checkpoint_resume_test.go` | Fixed — added at the top of `TestCheckpointResume_WorktreeClash` |
| 3 | Best-effort `resolveLatestCheckpoint` | `checkpoint_resume.go` | **Awaiting 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.

1w ago·1m·6 calls

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

| Thread | Reviewer | Location | Status | Commented | Resolved |
| --- | --- | --- | --- | --- | --- |
| `…LcX` | Copilot | `checkpoint/id/id.go:51` | Addressed (`e4021a7978`) | Yes | Yes |
| `…LdK` | Copilot | `checkpoint/id/id_test.go:325` | Addressed (`e4021a7978`) | Yes | Yes |
| `…Ldh` | Copilot | `checkpoint_resume.go:207` | Rejected (your approval, rationale posted) | Yes | Yes |
| `…Lsv` | Cursor Bugbot | `checkpoint_resume_test.go:250` | Addressed (`e4021a7978`) | Yes | Yes |

Push: `95ce35d7fe..e4021a7978` → `checkpoint-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](https://github.com/entireio/cli/pull/1701) whenever you want to mark it ready.

[e4021a7checkpoint resume: address PR review feedback\\
\\
Tighten the checkpoint-prefix shape gate: a ULID's leading timestamp\\
character cannot exceed 7, so requiring \[0-7\] stops revision syntax like\\
HEAD from shape-matching and triggering store lookups. Isolate git\\
config env in the worktree-clash test, which shells out to the git CLI.\\
\\
Entire-Checkpoint: 01KX4BWWR8MB2SND1PY7E5QPD3+12/-8](/content/gh/entireio/cli/commit/e4021a79786317cd79aeb8b3d9f65f1a8a9c9ac3/index.html)

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.

1w ago·2m·8 calls

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

1w ago·58.8s·2 calls

Done. Committed and pushed `8828752a7b` (remote-branch fallback + test), and the PR description at [https://github.com/entireio/cli/pull/1701](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.

[8828752checkpoint resume: fall back to remote branches in auto-detection\\
\\
Resuming another machine's work usually means the branch only exists on\\
origin. When a target matches no checkpoint, local branch, or commit,\\
check the remote and hand off to the branch flow, which offers to fetch\\
it. Remote branches are tried only after commit resolution so revision\\
syntax like HEAD cannot be misrouted into the branch flow.\\
\\
Entire-Checkpoint: 01KX4D7RQN0TKWZFESR1N8PZTH+46/-10](/content/gh/entireio/cli/commit/8828752a7be5f21ecd02478f4db4f400dadff9ce/index.html)