feat: consult only the pillars a change affects directly (iteration 5 step 3)

A graded question per pillar (not at all, only indirectly, directly) picks
the pillar advisors to consult again on a Revision or a Change request; the
design advisor is told which, and keeps its earlier advice for the rest. As
a yes or no the answer was yes for nearly every pillar of every change.

A completed Execution now writes working.json with each pillar's advice
and checklist review, and a Change request starts from its Baseline's, so
only the pillars a change touches are consulted afresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 15:22:57 +01:00
parent a7bc5310f3
commit 844987587c
10 changed files with 290 additions and 4 deletions

View File

@@ -22,6 +22,8 @@ from typing import Any
from app.adk.runtime import (
AgentRuntime,
AgentTask,
Decider,
Question,
RoleSpec,
RunLimiter,
Submitted,
@@ -34,6 +36,9 @@ NO_GUIDANCE = "No guidance"
ADVICE_KEY = "pillar_advice" # working memory: pillar -> the advice last given
CHECKLIST_KEY = "pillar_checklists" # working memory: pillar -> its checklist review
REVIEW_HEADING = "Architecture framework checklist review"
# What a Change request carries over from its Baseline's working memory.
KEPT_FOR_CHANGES = (ADVICE_KEY, CHECKLIST_KEY)
_CHANGE_LIMIT = 6_000
STATUSES = ("addressed", "not_applicable", "not_addressed")
_STATUS_WORDS = {
"addressed": "Addressed",
@@ -42,6 +47,53 @@ _STATUS_WORDS = {
}
AFFECTED = ("not at all", "only indirectly", "directly")
async def pillars_touched(
decider: Decider,
pillars: Sequence[str],
change: str,
*,
threshold: float = 1.5,
scope: str = "",
) -> list[str] | None:
"""The pillars whose recommendations a change affects directly (ADR-0007).
One graded question per pillar: not at all, only indirectly, directly. A pillar
at `threshold` or above, on that scale of 0 to 2, is consulted again. An empty
list means the change touches none of them. None means no decision was
available, and every pillar is consulted.
Asked as a yes or no ("does this change call for revisiting ...?") the answer
was yes for nearly every pillar of every change; measured on 2026-10-09.
"""
if not change.strip() or not pillars:
return None
answers = await decider.decide(
f"A change to a cloud solution architecture:\n{change[:_CHANGE_LIMIT]}",
{
pillar: Question(
"score",
f"How directly does this change affect the {pillar} "
"recommendations for the workload?",
AFFECTED,
)
for pillar in pillars
},
scope=scope,
)
if not answers:
return None
return [
pillar
for pillar in pillars
if (answer := answers.get(pillar)) is not None
and isinstance(answer.value, (int, float))
and answer.value >= threshold
]
def pillar_consultation_tool(
runtime: AgentRuntime,
advisor: RoleSpec,
@@ -65,7 +117,9 @@ def pillar_consultation_tool(
)
async def consult(brief: str, pillars: Sequence[str] | None = None) -> ToolResult:
chosen = list(pillars) if pillars else list(pillar_skills)
# No `pillars` consults them all; an empty list consults none, and returns
# what was said before.
chosen = list(pillar_skills) if pillars is None else list(pillars)
unknown = [pillar for pillar in chosen if pillar not in pillar_skills]
if unknown:
return ToolResult(
@@ -111,7 +165,8 @@ def pillar_consultation_tool(
"Get guidance from one advisor per architecture-framework pillar, in parallel. "
"Give a brief with the workload, its requirements and the selected products. "
"Omit `pillars` to consult every pillar afresh. Name `pillars` to re-consult "
"only those; advice already given for the others is returned unchanged.",
"only those; advice already given for the others is returned unchanged. An "
"empty list consults none and returns the advice already given.",
{
"type": "object",
"properties": {