claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Capture out-of-scope findings as follow-ups, and stop at the goal instead of asking "should I also fix…?"

Open comsky opened this issue 1 week ago • 4 comments

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

A session starts with one goal ("fix X"). While working, Claude finds related problems. At the end it asks "Should I also fix Y?" or lists "Remaining work". Each yes brings the next finding, so a session meant for one change keeps running.

This costs more than tokens:

  • No clear end. The user has to decide at every "should I also…?" whether to stop. Saying no feels like losing the finding.
  • Lost focus. The original change gets mixed with unrelated edits. Review, commit history and context get harder to follow.
  • The real blocker is trust. I can only let a finding go if I trust it will not disappear. Today the only safe place for it is the current session, so I say "yes, fix it too", and the session grows.

Two existing features solve parts of this, but not together:

  • /goal sets a done condition and a separate evaluator decides when it is met. It does not say what happens to findings outside the goal, and after the goal is met Claude still offers more work.
  • "Suggested task" chips capture a follow-up, but they are session-local. If I do not act on a chip before the session ends, it is gone. #75622 asked for a one-click path from a chip to an issue tracker; it was closed as stale, not resolved.

Related symptom reports: #97117 (scope creep), #102256 (unrequested fix rounds).

Proposed Solution

One feature: a follow-up list for out-of-scope findings, with a scope rule that uses it.

  1. One rule for findings. Problems caused by the current change (newly failing tests or CI, defects in code just changed, review comments on this PR) are fixed now. Anything else (pre-existing bugs, improvements, refactors, docs) is recorded, not fixed, and the original task continues.
  2. Durable follow-ups. Recorded findings become suggested-task chips that are also saved to a per-project list, e.g. /followups. Each entry has a title, how it was found, related files, and a link to the session. Entries survive the session.
  3. Export through hooks. A hook (e.g. FollowupCreated) or a setting sends entries to GitHub Issues, Jira, Linear or any task board, so findings land where the user already plans work. This covers the request in #75622.
  4. Stop at the goal. When the /goal condition (or a done condition stated at the start) is met, Claude ends with a short report instead of offering more work:
    • what was done
    • follow-ups captured, with links
    • where the next session starts
  5. Explicit widening only. Scope grows only when the user says so ("also do Y", or /goal with a new condition).

Behavior could be opt-in at first, e.g. "followups": { "scope": "strict" } in settings.

Part 2 is what makes 1 and 4 acceptable. Users let a finding go only when it is kept somewhere they trust, and the final report shows where each one went.

Alternative Solutions

What I use today is a rule in ~/.claude/CLAUDE.md:

## Session scope
- At the start, confirm the goal and done condition in one line. If I did not state one, propose it and ask.
- When the done condition is met, stop. Do not propose next tasks or ask "should I also fix…?".
- In this session, fix only problems this change caused: newly broken tests or CI, defects in the code just changed, review comments on this PR.
- Do not fix other findings (pre-existing bugs, improvements, refactors, docs). Note them and continue the original task.
- At the end, file the notes as GitHub issues: the relevant repo, assignee me, label `follow-up`, body with how it was found and related files/PR.
- Final report is three lines plus issue links: what was done / issues created / where the next session starts.
- Widen scope only when I explicitly say "do this too".

A scheduled job puts follow-up issues on my daily task board, so I set their priority the next morning, not inside the session.

This works, but:

  • Every user has to write and maintain the rule.
  • It depends on gh and a GitHub repo. There is no common place for follow-ups.

Other options I tried:

  • A skill or slash command at session end. I have to decide when to call it, which is the problem I want to remove.
  • /goal alone. Defines when the work is done, but not what happens to findings along the way.
  • Suggested-task chips alone. Capture a finding, but only until the session ends, and they do not stop Claude from offering to fix it now.
  • Plan mode. Helps define the goal before work starts, but not during execution.

Priority

Medium - Would be very helpful

Feature Category

Interactive mode (TUI)

Use Case Example

  1. I run /goal the 403 on the semantic table list for the user role is fixed, and a PR is open with CI green.
  2. Claude finds a pre-existing N+1 query and an outdated doc page. It records both as follow-ups and keeps working on the 403.
  3. CI is green and the PR is open. The goal is met. Claude reports: done; 2 follow-ups (links); next session starts from review comments.
  4. A hook has already created two issues. Next morning both are on my task board. I pick one for a new, short session.

This saves time because each session ends at one change. I no longer review mixed diffs or decide mid-session whether each finding is worth chasing.

Additional Context

  • Existing building blocks: /goal (https://code.claude.com/docs/en/goal) and suggested-task chips.
  • #75622 asked for durable suggested tasks only. This request adds the scope rule and the stop-at-goal report that use them.
  • The key idea from my own workflow: a finding can be dropped from the session only if the user trusts it will not be lost. The follow-up list and the links in the final report are what create that trust.

comsky avatar Nov 25 '26 05:11 comsky

Two cases from my own sessions since Nov 24, when I added the rule from "Alternative Solutions" to my ~/.claude/CLAUDE.md. Case 1 supports part 2 of the proposal, the durable list. Case 2 shows the record-and-report flow done by hand, and where buttons would help.

Environment: Claude Code 2.1.330 in the macOS desktop app, for the parts described here. Case 1 ran on Opus 5.5, case 2 on Fable 5.2. Dates are UTC.

Case 1: One finding, three prompts, two fixes (Nov 25)

A session could not push: two tests that already failed on main blocked the pre-push hook. Claude searched and reported that no open PR or issue covered the failure. The finding then reached me in three places (button texts are translated):

  • a new-task card from that session, for a session that fixes the two tests
  • the end-of-turn question of that session, with the buttons "Fix separately, then push" and "Fix in this PR"
  • a question from the parent session that had started it, with the buttons "Separate fix PR" and "Hand over to the author"

I answered the parent with "Separate fix PR". Within the next 30 seconds I also started the card and answered the first session with "Fix separately, then push". The parent began its own fix, and the session from the card fixed the same two tests.

Before the parent asked its question, it had read in the first session's report that a card was proposed. Its question did not mention the card. The parent's context was compacted when I answered, and the compaction summary did not mention the card. The parent learned that the card's session was running 17 minutes after my answer, when I asked for the PR status and a report from the first session arrived with my message. By then each session had a commit, and the two commits fixed the same tests in different ways. Claude asked me which fix should become the PR. I chose the fix from the card's session. The parent stopped its push and deleted its branch and worktree.

The card and the two questions were separate prompts in two sessions. With one entry in a follow-up list, all three would point to the same entry, and its status would show that a fix had already started. The parent ran in a different repository from the other two sessions, so the list must be shared between linked sessions, or belong to the repository of the finding.

Case 2: Record, report, and a typed hand-off (Nov 25–26)

The goal of the session was a fix for a data-import bug. The session started before I added the rule. The part described here is from after.

I ran /code-review high --fix on the change. The review reported four findings. Claude fixed two and did not fix the other two. One of these two was a side effect of the fix itself: Claude deferred it because it saw no safe way to fix it in this change. The other had existed before the change. Claude filed an issue for each of the two, with a section on how it was found and a list of related issues, the PR and files. Later it listed both under "Out of Scope" in the PR description.

After the PR was merged, the session reported (translated and shortened, issue numbers replaced):

  • Done: Fixed the import so that it no longer overwrites the table of a dataset that it reuses, and merged the PR.
  • Issues created: issue A, issue B
  • Next session starts from: issue A

The session then continued with other requests from me. A later wrap-up report listed a third issue and gave the same "Next session starts from" line. After that I typed "Archive this session and go ahead with issue A". Claude started a new session with a brief for issue A, and that session opened a PR that will close the issue when it is merged.

This is close to the Use Case Example from the issue, done with the CLAUDE.md rule and gh. There are two differences. The findings came from a review that I ran. And one of them was caused by the change itself, which part 1 of the proposal fixes in the same session.

Buttons on the final report

I like the "Next session starts from" line. But to act on it, I had to type the request above. Parts of this exist today. The end-of-turn summary can carry an Archive button: 25 of my about 1,700 summaries since mid-October had one. Its list of actions also names a new_session action, but none of my summaries carried it, and I have not seen what it does. A new-task card starts a session too (case 1). None of the summaries after the report above carried one of these buttons. The final report could carry three buttons by default:

  • Create issues: files the recorded follow-ups to the tracker, when export is not set to run on its own. One click approves all of them.
  • Start new session: opens a new session with a brief from the follow-up in "Next session starts from": its issue, related files and the finished PR.
  • Archive this session: the existing Archive action, placed next to the report.

Mock-up:

+- Session complete --------------------------------------------+
| Done        Import fix merged.                                |
| Follow-ups  2 recorded, not filed yet                         |
| Next        Start from follow-up 1                            |
|                                                               |
| [ Create issues ]  [ Start new session ]  [ Archive session ] |
+---------------------------------------------------------------+

This is not the same as "Should I also fix…?". No work continues in the current session. The next work starts in a new session, and only when I click.

comsky avatar Nov 27 '26 05:11 comsky

packed roughly your CLAUDE.md rule into a kitbag profile, so the same thing runs in claude code, codex, gemini cli and grok build. its an always-on rule (fix what this change broke, file the rest, stop), a /followup command, and a script that opens a followup issue with path:line, why and a suggested fix, or writes .followups.md when theres no gh or remote.

still just a rule, so it doesnt give you the native stop-at-/goal part

https://github.com/cargopete/shop-floor#follow-ups

cargopete avatar Nov 27 '26 08:11 cargopete

Thanks for sharing this.

The .followups.md fallback covers a limit that I listed under "Alternative Solutions": my rule depends on gh and a GitHub repo, and there is no common place for follow-ups.

You also say that it is still only a rule, so it cannot give the stop at the /goal condition. I see the same limit with my rule. That part needs to be built in.

comsky avatar Nov 30 '26 06:11 comsky

The "should I also fix Y?" prompt is hard to refuse, because saying no feels like losing the finding. One habit that has helped in review workflows: treat the plan as the contract for this run.

When something out of scope turns up, add it to a follow-up list on the plan (ticket or path, and why) and leave it there. Approve only the in-scope steps. If the plan later grows, that approval should no longer apply.

Claude Code plan mode is the right local start (Shift+Tab or /plan). For a team, we put the plan in the pull request and bind approval to that exact file version, so a later "also fix Y" cannot keep the old sign-off. We built that as Gate; disclosure: we are the authors. A native stop-at-goal and a durable follow-up list in Claude Code would still be the better fix. +1 on the request.

getlake avatar Nov 30 '26 17:11 getlake