Skip to content

docs(openspec): plan #3057 let the implement job amend its plan - #3184

Merged
dan-petty merged 6 commits into
mainfrom
feat/3057-the-implement-agent-can-amend-the
Nov 2, 2026
Merged

dan-petty merged 6 commits into
mainfrom
feat/3057-the-implement-agent-can-amend-the

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Plans #3057

A step of the implement job that finds a wrong plan can only stop. This plan lets the job amend the plan under rules in code. The agent asks with a plan-request block, and the job decides. It may fix a missing path, a verification command or a missing task of a group that is not done. It does so in its own commit, with a bullet in tasks.md and a line in the pull request comment. A false premise returns the item to New with the evidence. A change of a requirement or a criterion stops the item with a question. A group over the window is split once, through the split step of the stage job.

Change: openspec/changes/3057-the-implement-agent-can-amend-the/

🤖 Generated with Claude Code

https://claude.ai/code/session_01PeiMDoPafqUWqpk1WxhaYW

Copy link
Copy Markdown
Owner

Review of the plan for #3057.

Status: all 18 check runs pass or are skipped, including the required Semantic PR title. Premise checked against origin/main (5dc4da7): the defect is real (a step only stops), but the plan conflicts with the code and the spec it changes. The PR base (6f648d5) predates #3177 and #3182. No plan file conflicts with them, but the plan was not checked against them (finding 6).

  1. The plan breaks existing requirements and has no MODIFIED. The delta is ADDED only. On origin/main:

    • implement_step.py:755-777 (_restore_tasks) says "The job owns the file: it reads the verification commands from the text before the run, so no edit of the file changes what judges the work". openspec/specs/roadmap-implement-step/spec.md:468 ("A step writes tasks.md back to its text before the run") has the scenario "The model rewrites a verification command to one that passes", where the step runs only the original command. An amendment of a "wrong verify command" is the case this rule forbids. The plan does not say how an amendment passes the restore. It does not say what stops an agent from weakening its own check (AGENTS.md rule 5).
    • Task 4.2 replaces the refusal at implement_step.py:298-307 and spec.md:76 ("A step refuses an input that does not fit the window"). That needs MODIFIED of that requirement.
    • Task 3.2 puts return_item (which calls store.comment and store.set_field) in implement_step.py. spec.md:195 says the step "SHALL write no issue, comment, label or milestone". ItemReader (implement_step.py:138) is read-only.
      Fix: write MODIFIED for these requirements (with the full text) and add a design decision for the tasks.md restore. Or move the writes to the job (finding 2) and keep the step read-only.
  2. Wrong module, and the job loop is missing. Tasks 2.2 and the Impact list implement_submit.py. That file is the Service's submission of the runner Job (see its module docstring: Report, Wait, Submit, Clear). The pull request comment of each step is _comment in implement_run.py:597 (comment_on_pull). The stop and the Blocked status are implement_run.py:729-760. implement_run.py is in no task. _groups (implement_run.py:417-440) parses tasks.md once before its loop, so new groups from a re-split or an amendment would not run. The roadmap-implement-job capability gets no delta, though the job posts the comment, returns the item and runs the new groups. Fix: name implement_run.py and add the job requirements.

  3. The re-split cannot reuse _Planner._fit as written.

    • stage.py:801 is a private method of the planner. It takes a StageTarget and a StageProposal, and _ask needs the planner's client.
    • _split_asked (stage.py:808-810) allows one split for each item. Its docstring says "After that split, a group over the budget stays over it".
    • stage.py is not in the Changes lists of the tasks, so the extraction is not planned.
    • The budgets differ. Stage measures against self._budget with measure_groups. Implement measures against the window minus the reserve (implement_step.py:298).
    • The stage.groups record (store.py:193, stage.py:1162) goes stale after a re-split.
      The design's rejected alternative ("a new split implementation") rests on this reuse, and the split is itself a model call (see "no extra model call" in the design). Fix: plan a public split function that the stage and the job share, with its budget and its one-split limit.
  4. The mechanism is not specified.

    • Nothing says how a step "raises" an amendment. There is no tool, no output schema and no marker.
    • Task 1.2 makes classify_defect deterministic, but its input is not named. The design says "no extra model call".
    • Nothing says how "changes a spec requirement or an acceptance criterion" is detected.
    • Nothing says the Status after the question on the issue (the current stop path sets Blocked). Nothing says what happens to the branch and the draft pull request after a return to New.
      The tests of groups 1-4 cannot be written from this. Fix: say the interface and a deterministic scope check (for example, an amendment may touch only task text of tasks.md, never specs/, the issue or a criterion).
  5. The tasks.md is not in the format the step reads.

    • step_files.py:27,55 takes verification commands only from Verification: lines. These tasks have inline "and verify that ..." text, so the step runs no command. Merged plans use a Verification: line (see openspec/changes/archive/2026-11-02-3153-the-stage-job-verifies-its-plan/tasks.md).
    • Tasks 1.1, 2.1, 3.1 and 4.1 name a file but not the scenarios to test. Task 1.2 holds "Write the failing test first", which repeats 1.1.
    • Group 5 and the Impact section point to openspec/changes/3057-plan-amendment/.... The real folder is 3057-the-implement-agent-can-amend-the. The group "writes" the spec delta and tasks.md that already exist, and ticks the tasks of earlier groups, which must happen in the commit that completes each task. Task 5.2 starts with a path and has no instruction.
  6. Proposal gaps.

  7. PR title. docs(openspec): plan #3057 Plan the bounded plan-amendment step for the... has a summary of 58 characters, so the check passes. It ends mid-sentence with "...". Suggested: docs(openspec): plan #3057 the bounded plan amendment.

Related issues:

Not verified: whether the premise rate still holds after #3182, and whether openspec validate --strict passes on the delta (I did not run it; the requirements are all under 500 characters, and the ADDED names are new in roadmap-implement-step).

Verdict: hold until findings 1 to 5 are fixed. The plan modifies the step's invariants (tasks.md ownership, the window refusal, the read-only step) without MODIFIED requirements. It also names the wrong module for the pull request comment and gives groups that the step cannot verify.


Generated by Claude Code

… code

Rewrite the plan so the agent asks and the job decides. The step code and
its spec stay as they are: the job writes tasks.md, judges a request with
rules in code, commits an amendment, comments it, returns an item whose
premise is false, and splits a group over the window through a function
that the stage job shares. All deltas are ADDED, in a new capability
roadmap-plan-amendment and in roadmap-implement-job.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PeiMDoPafqUWqpk1WxhaYW
@dan-petty dan-petty changed the title docs(openspec): plan #3057 Plan the bounded plan-amendment step for the... docs(openspec): plan #3057 let the implement job amend its plan Nov 2, 2026

Copy link
Copy Markdown
Owner

Plan rewritten at 78f68145 against origin/main 80ffc5c1. What changed for each finding of the review:

  1. The step stays read-only. The agent ends its last message with a plan-request block; the job judges it with rules in code, commits an amendment, and runs the group again. _restore_tasks and its spec are untouched. No existing requirement becomes false, so every delta is ADDED (new capability roadmap-plan-amendment, and roadmap-implement-job).
  2. The work is in implement_run.py (_groups reads tasks.md again after an amendment or a split; _comment; the stop). implement_submit.py is out.
  3. The split is a shared function in a new stage_split.py. The job sends the text of the group, because tasks.md keeps no kind, test or verify (probe in the Feasibility). One split for each item; the budget is an argument.
  4. The interface, the five kinds, the rules of the scope check, the Status after a question (Blocked, plan_defect, action left wait, implement: retry), and what a return leaves (branch and draft stay, four marks cleared) are in design.md, with a table of what the job may change and what needs a person.
  5. Every task has a Verification: line and the inline form; nine groups, 29,655 to 37,778 tokens of 40,000.
  6. Feasibility has output for each premise. Cost in tokens and time is stated. ## Dependencies names feat(roadmap): every step repairs before it gives up, in bounded rounds #3053 and feat(roadmap): the implement job keeps, classifies and continues a partial implementation #3098 (they disagree with amend and return), refactor(roadmap): group the job modules in subpackages #3187, the open plans on the same files, and feat(roadmap): give the stage planner three more read-only tools #3250 (merged during this work).
  7. Title: plan #3057 let the implement job amend its plan.

Two defects found on the way, outside this item: the stage renders "verify that X passes" in the task text while the step reads only Verification: lines (a staged plan makes the step run no verification command), and the stage form admits ! git grep while the step refuses !.


Generated by Claude Code

Copy link
Copy Markdown
Owner

The conflict with #3053 and #3098 that this plan lists under Dependencies is settled by the owner (2026-11-02), recorded in a comment on #3053: premise false stops at once and returns the item; plan defect stops at once unless the bounded amendment of this plan covers it, and #3098 keeps the class plan_defect as a state that does not need a person by itself. The plan therefore needs no change. Before merge, the Dependencies line may read "settled in the comment on #3053 (2026-11-02)".


Generated by Claude Code

@dan-petty
dan-petty merged commit 984de52 into main Nov 2, 2026
20 checks passed
@dan-petty
dan-petty deleted the feat/3057-the-implement-agent-can-amend-the branch November 2, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants