feat: Change requests against a Baseline (ADR-0006)

A caller restates a request to say how requirements have changed, naming a
completed Execution of the same Customer case as the Baseline.

- app/baseline.py reads a Baseline from its files and refuses one that
  does not exist, did not complete or belongs to another case, before
  anything runs or is recorded. A Baseline is never modified.
- Requirements carry a change (unchanged, added, changed, removed) and a
  reason. Submission is refused when a Baseline requirement disappears, an
  id is reused, or an unchanged requirement's text differs. A removed
  requirement stays on record and asks nothing downstream.
- Each Specialist starts from its delivered version; the graph and the code
  are its working copy, and the description is carried over when the
  design's shape is the same.
- app/workflows/changes.py compares versions by id and traces what each
  changed requirement reaches; anything else that changed is listed as
  unrequested. Approvals show the change for their Phase, and changes.json
  is written with the full Deliverables.
- Intake no longer starts a message read as a change: it names the
  Execution to give as the Baseline.
- A fifth evaluation case runs a request and then a change to it, with
  four checks that the change is recorded, reaches Checks, stays contained
  and costs less than its Baseline.

Tested with scripted agents only; no Change request has run with real
models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 11:38:15 +01:00
parent db28d02f56
commit 5ef434d00e
32 changed files with 1824 additions and 40 deletions

View File

@@ -4,9 +4,13 @@ Inside an Execution the router reads the user's replies. This is the same readin
one step earlier, for a message that arrives with no Execution in progress:
new request design this workload start an Execution
change request change what was delivered (ADR-0006; not built yet)
change request change what was delivered name the Baseline to change (ADR-0006)
question what can you do, how long... answer; start nothing
A change is never started from earlier work on a guess: the caller chooses the
Baseline. So a message read as a change is answered with the Execution it would
change and how to name it, and starts nothing.
Without a decision, and whenever the reading is not confident, the message is taken
as a new request: that is what every message was before, and starting work nobody
asked for is cheaper to put right than refusing work somebody did.
@@ -36,11 +40,18 @@ ABOUT = (
"infrastructure code, validation and a packaged guide, asking for your approval "
"at each Phase. Nothing was started for this message."
)
CHANGE_NOTE = (
"This reads as a change to work already delivered for this Customer case. "
"Changing an earlier architecture in place is not available yet, so this is "
"being designed as a new request."
)
def change_note(baseline: str) -> str:
"""What a caller is told when their message reads as a change to delivered work."""
return (
"This reads as a change to the architecture already delivered for this "
f"Customer case, in Execution {baseline}. Nothing was started. To change "
f'that architecture from where it stood, send this again with "baseline" '
f'set to "{baseline}". To design it as new work instead, send it again '
'with "new_request" set to true.'
)
_MESSAGE_LIMIT = 8_000
_EARLIER_SHOWN = 5
@@ -52,6 +63,7 @@ class IntakeReading:
confidence: float = 0.0
judged: bool = False # False when no decision was available
earlier: int = 0 # finished Executions of the same Customer case
latest: str | None = None # the most recent of them: what a change would change
def finished_intents(output_root: Path, customer_case: str) -> list[Mapping[str, Any]]:
@@ -110,7 +122,10 @@ class Intake:
if kind == CHANGE_REQUEST and not earlier:
kind = NEW_REQUEST # there is nothing delivered to change
logger.info("[%s] intake: %s (%.2f)", scope, kind, confidence)
return IntakeReading(kind, confidence, judged=True, earlier=len(earlier))
latest = str(earlier[-1].get("execution_id")) if earlier else None
return IntakeReading(
kind, confidence, judged=True, earlier=len(earlier), latest=latest
)
def _state(message: str, earlier: Sequence[Mapping[str, Any]]) -> str: