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:
@@ -27,6 +27,7 @@ def describe_prompt(prompt: Mapping[str, Any]) -> str:
|
||||
return (
|
||||
f"Please review the {approval['phase']} Phase: {approval['summary']}\n\n"
|
||||
f"Deliverables: {', '.join(approval['deliverables'])}.\n\n"
|
||||
f"{_describe_changes(approval)}"
|
||||
f"{_describe_target_architecture(approval.get('target_architecture'))}"
|
||||
f"To approve, reply with the data {json.dumps(reply)}. "
|
||||
f"To request changes, reply with {json.dumps(changes)}. "
|
||||
@@ -47,6 +48,42 @@ def describe_prompt(prompt: Mapping[str, Any]) -> str:
|
||||
return "\n".join(lines) + "\n\nReply in text; answer every question you can."
|
||||
|
||||
|
||||
_CHANGE_WORDS = {"added": "Added", "changed": "Changed", "removed": "Removed"}
|
||||
|
||||
|
||||
def _describe_changes(approval: Mapping[str, Any]) -> str:
|
||||
"""In a Change request: what this Phase changes against the Baseline. It comes
|
||||
from the ids in the two versions, not from an agent's account."""
|
||||
if "changes" not in approval:
|
||||
return ""
|
||||
changes = approval["changes"]
|
||||
lines = [f"This changes the architecture delivered in {approval.get('baseline')}."]
|
||||
if not changes:
|
||||
lines.append("Nothing in this Phase differs from it.")
|
||||
for item in changes.get("requirements", []):
|
||||
lines.append(
|
||||
f"- Requirement {item['id']} {item['change']}: {item['text']} "
|
||||
f"({item['reason']})"
|
||||
)
|
||||
for part in (
|
||||
"components",
|
||||
"recommendations",
|
||||
"elements",
|
||||
"relationships",
|
||||
"checks",
|
||||
):
|
||||
for change, word in _CHANGE_WORDS.items():
|
||||
ids = changes.get(part, {}).get(change)
|
||||
if ids:
|
||||
lines.append(f"- {word} {part}: {', '.join(ids)}")
|
||||
for part, ids in changes.get("unrequested", {}).items():
|
||||
lines.append(
|
||||
f"- Changed without being asked for ({part}): {', '.join(ids)}. No "
|
||||
"changed requirement reaches these."
|
||||
)
|
||||
return "\n".join(lines) + "\n\n"
|
||||
|
||||
|
||||
def _describe_target_architecture(summary: Mapping[str, Any] | None) -> str:
|
||||
"""What the design Approval commits to: no code is written until it is granted."""
|
||||
if not summary:
|
||||
|
||||
Reference in New Issue
Block a user