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

@@ -18,7 +18,6 @@ from app.agent import ExecutionEngine
from app.providers import load_provider
from app.recorder import InMemoryRecorder
from app.tools.toolkit import make_tool_factory
from app.workflows.deliverables import DEPENDENCY_GRAPH, DeliverableKind
AGENTS_DIR = Path(__file__).parents[2] / "agents"
@@ -42,11 +41,6 @@ def call(tool: str, **args) -> list[types.Part]:
return [types.Part(function_call=types.FunctionCall(name=tool, args=args))]
def requirements_markdown() -> str:
sections = DEPENDENCY_GRAPH[DeliverableKind.REQUIREMENTS].sections
return "\n".join(f"## {section}\nDetails." for section in sections)
def task_context(request: LlmRequest) -> dict:
text = (request.contents[0].parts or [])[0].text or ""
return json.loads(text.split("```json\n", 1)[1].rsplit("\n```", 1)[0])
@@ -58,26 +52,24 @@ async def test_engine_runs_role_files_through_adk_with_one_voice(tmp_path):
models = {
"orchestrator": RoleScriptedLlm(
script=[
call("delegate", kinds=["requirements"]),
call("delegate", kinds=["scope"]),
call("ask_user", questions=[]),
call("delegate", kinds=["requirements"]),
call("delegate", kinds=["scope"]),
call("ask_user", questions=["Anything to add?"]),
]
),
"requirements-analyst": RoleScriptedLlm(
"scope-analyst": RoleScriptedLlm(
script=[
call("load_skill", skill_name="google-cloud-solution-architecture"),
call("load_skill", skill_name="scoping"),
call(
"needs_input", questions=["What availability target do you need?"]
),
call(
"submit_deliverable",
content=requirements_markdown(),
content="# Scope\n## Scope statement\nRegional event ingestion.\n",
attachments=[
{
"path": "requirements.json",
"content": SAMPLE_DATA["requirements.json"],
}
{"path": name, "content": SAMPLE_DATA[name]}
for name in ("scope.yaml", "scope.json")
],
),
]
@@ -101,7 +93,7 @@ async def test_engine_runs_role_files_through_adk_with_one_voice(tmp_path):
assert asked.prompt == {
"questions": [
{
"from": "requirements",
"from": "scope",
"question": "What availability target do you need?",
}
]
@@ -109,11 +101,8 @@ async def test_engine_runs_role_files_through_adk_with_one_voice(tmp_path):
answered = await engine.resume(asked.execution_id, {"reply": "99.9% in one region"})
assert (
answered.state["ledger"]["deliverables"]["requirements"]["status"]
== "submitted"
)
analyst_second_run = models["requirements-analyst"].requests[-1]
assert answered.state["ledger"]["deliverables"]["scope"]["status"] == "submitted"
analyst_second_run = models["scope-analyst"].requests[-1]
assert task_context(analyst_second_run)["answers"] == [
{
"questions": ["What availability target do you need?"],
@@ -122,7 +111,5 @@ async def test_engine_runs_role_files_through_adk_with_one_voice(tmp_path):
]
orchestrator_prompt = models["orchestrator"].requests[0].config.system_instruction
assert "You coordinate one solution-architecture Execution" in orchestrator_prompt
analyst_prompt = (
models["requirements-analyst"].requests[0].config.system_instruction
)
analyst_prompt = models["scope-analyst"].requests[0].config.system_instruction
assert "## How you work" in analyst_prompt