feat: scoping is the first Phase, completed in conversation (iteration 9 step 2)
Some checks failed
validation / verify (push) Failing after 10s

Every Execution now begins by agreeing the scope, before requirements.

- A new Phase and Deliverable, produced by a scope analyst with two tools:
  scope_read shows what is settled and what is not; scope_set records fields
  with where each value came from (the request, the customer's answer, or an
  assumption with its reason). Code checks each value against the catalogue.
- With someone present the analyst asks for what is missing; with nobody
  present it assumes it, visibly. With no spec it drafts one from the request.
  A value the customer stated in the file is changed only by their own answer.
- A submission cannot leave an essential field unknown. Code writes the
  completed spec, the data every later Specialist reads, and the information
  register, from what was recorded.
- The spec's status follows the Execution: under review, approved, then
  locked as a Baseline. A Change request starts from the delivered scope.
- The requirements analyst derives from the agreed scope and no longer asks
  for what it settles.

About 80 tests assumed requirements came first; tests/scoped.py runs scoping
ahead of a test's own script, and tests about order and counts are updated.
Not run with real models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 18:17:32 +01:00
parent afe78640f8
commit 545097530b
38 changed files with 1054 additions and 123 deletions

View File

@@ -22,6 +22,14 @@ from app.adk.runtime import (
)
from app.states.ledger import Ledger, LedgerRefusal, PhaseStatus
from app.tools.pillars import REVIEW_HEADING, render_checklist_review
from app.tools.scoping import (
REGISTER_HEADING,
Scoping,
render_register,
scope_tools,
unsettled,
)
from app.tools.scoping import attachments as scope_attachments
from app.tools.workspace import (
FILES,
basis_of,
@@ -284,6 +292,7 @@ def specialist_tools(
review: Callable[[Mapping[str, str]], Awaitable[Sequence[str]]] | None = None,
confirm_first: bool = False,
baseline: Mapping[str, Any] | None = None,
scoping: Scoping | None = None,
) -> list[ToolSpec]:
"""A Specialist's tools: submit, ask, its working copy, and its role's tools with
the cloud-read gate.
@@ -298,6 +307,8 @@ def specialist_tools(
this Deliverable: a submission is then refused until the Specialist has put its
draft to them. A rule, because an instruction alone was not always followed.
`baseline` is the Baseline's version of this Deliverable in a Change request.
`scoping` is the scope spec's catalogue; with it the scope Deliverable's two
files and its information register are written from what was recorded.
"""
working = {} if working is None else working
is_graph = kind is DeliverableKind.TARGET_ARCHITECTURE
@@ -310,12 +321,30 @@ def specialist_tools(
if is_validation:
working_verdicts(working, basis) # drops verdicts given on other code
graph_now = read_graph(upstream)
is_scope = kind is DeliverableKind.SCOPE and scoping is not None
async def submit_deliverable(content: str, attachments: Any = None) -> ToolResult:
try:
attachments = files_from_argument(attachments)
except TypeError as exc:
return _refused(f"attachments: {exc}")
if is_scope and scoping is not None:
# Nothing essential may be left unknown, and the files are written
# from what was recorded: they cannot disagree with it.
missing_fields = unsettled(working, scoping)
if missing_fields:
return ToolResult(
"Not submitted. Essential fields of the scope spec are not "
"settled: " + ", ".join(missing_fields) + ". Ask the user for "
"each with `needs_input`; when you may not ask, choose a value "
"and record it with `source` assumed and a note."
)
attachments = scope_attachments(working, scoping)
content = (
content.split(f"\n## {REGISTER_HEADING}")[0].rstrip()
+ "\n\n"
+ render_register(working, scoping)
)
# The working copy is the submission; a file passed here replaces its copy.
if own_files:
attachments = {**working_files(working), **attachments}
@@ -455,6 +484,7 @@ def specialist_tools(
if library
else ()
),
*(scope_tools(working, scoping) if is_scope and scoping else ()),
*(graph_tools(working) if is_graph else ()),
*(
verdict_tools(working, basis, graph_now.check_ids if graph_now else ())