Compare commits
33 Commits
5bb22d984e
...
feat/scopi
| Author | SHA1 | Date | |
|---|---|---|---|
| b66d18fe94 | |||
| f54af24169 | |||
| 0f80cb642f | |||
| c26b744b26 | |||
| 545097530b | |||
| afe78640f8 | |||
| a48468d477 | |||
| f9cc34817b | |||
| 7ee7054523 | |||
| c4c8a1f94e | |||
| 135401e41b | |||
| 81ac135cd9 | |||
| 5feaaa6271 | |||
| ee1ba38867 | |||
| 1cf1234143 | |||
| 71da0ed504 | |||
| 10d23a5f91 | |||
| ef37f59bad | |||
| a8ed21b89d | |||
| e5e1647ff1 | |||
| 567aede5ca | |||
| 844987587c | |||
| a7bc5310f3 | |||
| 59a641fded | |||
| 5ef434d00e | |||
| db28d02f56 | |||
| 654370bb46 | |||
| d41607f505 | |||
| c9f59be274 | |||
| 4e7a16cedd | |||
| 58e778ca7a | |||
| 5adc911a82 | |||
| f1f6f1b83a |
@@ -9,10 +9,13 @@ One directory per iteration of this agent. Each holds the plan for that iteratio
|
||||
| 1 | `wf-decompose-65ea49fc2d04/` | complete, superseded | The decomposer's scaffold: a linear four-phase pipeline of template functions. Its code was deleted in iteration 3 and survives only in git history. Generated by the platform decomposer; leave its files as written. |
|
||||
| 2 | `iter-02-solution-architect-agent/` | complete; step 9 was done in iteration 3 | The rebuild as a hierarchical ReAct agent: Orchestrator, one Specialist per Deliverable, Skills, provider bundle, A2A. |
|
||||
| 3 | `iter-03-kab-layout/` | complete (commit `7ee49ab`) | The container starts the new engine, the engine moved into the KAB workflow-agent folder layout, and the original pipeline was deleted. |
|
||||
| 4 | `iter-04-learning-and-skills/` | steps 1–8, 11, 13 and 15–20 built; no evaluation run has completed on them, so their effect on time and tokens is unmeasured; 9 awaits the owner; 10, 12 and 14 planned | The enhancement backlog from the 2026-10-06 review: cheap fixes, the learning loop through Skills, overlay Skills, provider neutrality. Steps 17–20 are the speed-ups from the 2026-10-07 run: a working copy for files and the graph, a provider schema lookup, routing a Check the code cannot meet, and a model timeout per role. |
|
||||
| 5 | `iter-05-jev-decisions/` | the Jev client and the Orchestrator router are built (steps 2, 11, 12), unverified against the live service; the rest planned | Jev (a hosted decision model) for the agent's closed decisions: checks, routing, context selection. |
|
||||
| 6 | `iter-06-target-architecture-graph/` | steps 1–10 built; step 11's evaluation run is outstanding, so unproven with real models | The Target architecture as one explicit graph of Elements, Relationships and Checks, established before infrastructure code, with validation as a verdict per Check. |
|
||||
| 7 | `iter-07-change-requests/` | planned; ADR-0006 accepted 2026-10-07; follows iteration 6; its step 8 (removing `deliverables/cases/legacy-baseline/`) was done early on the owner's instruction | A user restates a request to say how requirements changed; a new Execution starts from a Baseline Execution of the same Customer case and delivers the updated architecture with what changed. |
|
||||
| 4 | `iter-04-learning-and-skills/` | steps 1–8, 11, 13 and 15–27 built; cases 01, 02 and 03 completed at 100% on them on 2026-10-07 and 08; ADR-0004 accepted 2026-10-08 (step 9); the lessons loop is built and its first six lessons are approved and published, with a first proof on case 03: no Revision, 22 minutes against 28 (step 10); overlay Skills built and run in case 06 (step 12); 14 deferred until a second Cloud provider | The enhancement backlog from the 2026-10-06 review: cheap fixes, the learning loop through Skills, overlay Skills, provider neutrality. Steps 17–20 are the speed-ups from the 2026-10-07 run: a working copy for files and the graph, a provider schema lookup, routing a Check the code cannot meet, and a model timeout per role. |
|
||||
| 5 | `iter-05-jev-decisions/` | the router, intake, the reviews, pillar selection, Skill routing, the guardrail, meaning-aware change summaries and an assessment of every Execution are built (steps 2–5, 8, 10–12, 14, 15, 19), the newest ran in cases 05 and 06 on 2026-10-09; a lighter model for a first attempt was built, measured and left off (6); context selection and compaction were decided against on the numbers (7, 9); the cloud-read guard and readings as a node are planned (13, 18) | Jev (a hosted decision model) for the agent's closed decisions: checks, routing, context selection. |
|
||||
| 6 | `iter-06-target-architecture-graph/` | complete: all four cases pass with real models, each run twice on 2026-10-08; thresholds set | The Target architecture as one explicit graph of Elements, Relationships and Checks, established before infrastructure code, with validation as a verdict per Check. |
|
||||
| 7 | `iter-07-change-requests/` | complete (2026-10-09): the change case ran with real models and passed | A user restates a request to say how requirements changed; a new Execution starts from a Baseline Execution of the same Customer case and delivers the updated architecture with what changed. |
|
||||
| 8 | `iter-08-terraform-modules/` | steps 1–5 built and run once each way on 2026-10-09, both at 100%; steps 6 and 7 wait on Azure and AWS provider bundles | Infrastructure code is plain resources by default. An Execution may opt into published Terraform modules: only from registry namespaces the provider bundle lists, at one exact version, with a lookup of what a module accepts and a Skill of four Google modules tested against the pinned provider. |
|
||||
| 9 | `iter-09-scoping/` | steps 1–3 and 6 built on 2026-10-11; cases 03 and 08 ran on steps 1 and 2; steps 4 and 5 planned; ADR-0008 accepted | An engagement is scoped from a scope spec: a structured file, complete or partly filled, read against a catalogue in code, completed in conversation and approved before requirements begin. Covers workloads and platform foundations. |
|
||||
| 10 | `iter-10-work-breakdown/` | steps 1–4 built on 2026-10-11, without milestones; not run with real models | A work breakdown structure as a Deliverable: work packages traced to Elements and Checks, activities in sequence, and a timeline on a relative day axis computed and drawn by code. |
|
||||
|
||||
Numbers record when an iteration was planned, not the order to build in. Build iteration 6 before the remaining steps of iteration 4 (10 to 14) and before iteration 5: it changes the Deliverables, Phases and validation format they build on. Its `MAP.md` lists the effect on each of their steps.
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ Every step ends with the full suite passing. Steps that change agent behaviour (
|
||||
- Retire: at each vendor sync, remove lessons the upstream Skill now covers.
|
||||
- **Where:** `skills/<lessons-skill>/`, `agents/lesson-curator.md`, a curator entry point beside `eval/solution_eval.py`, `providers/gcp.yaml`, `scripts/sync-vendored-skills.sh`.
|
||||
- **Acceptance criteria:** Vendored Skills stay byte-identical. No lesson reaches a Skill without an approved issue file. Each Execution records the lessons Skill version it loaded. One real lesson has gone through the whole loop with its evaluation comparison recorded.
|
||||
- **From ADR-0004 (accepted 2026-10-08):** the lessons Skill is per Cloud provider and listed in that provider's bundle; a lesson is kept only if the evaluation with and without it holds quality and lowers Revisions, time or tokens; a lesson carries no client detail, and lesson candidates stay out of the repository.
|
||||
|
||||
## Step 11: IaC patterns Skill
|
||||
|
||||
@@ -104,6 +105,7 @@ Every step ends with the full suite passing. Steps that change agent behaviour (
|
||||
- **Rationale:** Skills are fixed at start-up: `AdkAgentRuntime` loads every Skill once, and `role_skills` is static per provider. Only 2 of the 9 Skills are our own, and both describe tools.
|
||||
- **Where:** `app/adk/adk_runtime.py`, `app/adk/roles.py`, `app/providers.py`, `ExecutionEngine.start` in `app/agent.py`, `app/a2a_server.py`, a standards Skill under `skills/`.
|
||||
- **Acceptance criteria:** An Execution can name overlay Skills at start; each passes the same Agent Skills validation as bundled Skills, and an unknown or invalid one refuses the start. An organisation standards Skill (naming, tagging, approved products) is loaded by the roles the bundle lists.
|
||||
- **From ADR-0004 (accepted 2026-10-08):** overlay Skills come only from directories the deployment configures; a caller names one by its Skill name and cannot upload one; the Execution records each overlay it loaded with a content hash. Skills are resolved per Execution, not once at start-up.
|
||||
|
||||
## Step 13: Trim Specialist context
|
||||
|
||||
@@ -169,3 +171,60 @@ Every step ends with the full suite passing. Steps that change agent behaviour (
|
||||
- **Rationale:** One `MODEL_TIMEOUT_SECONDS` (180) applied to every role. Raising it for all of them makes every stuck request slower to recover.
|
||||
- **Where:** `models.timeout_seconds` in `providers/gcp.yaml`, `ModelConfig` in `app/providers.py`, `RoleSpec.model_timeout_seconds`, `AdkAgentRuntime._content_config`.
|
||||
- **Acceptance criteria:** A role named in the bundle gets its own timeout; every other role gets the default.
|
||||
|
||||
## Step 21: A Deliverable stands while what it was written from is unchanged
|
||||
|
||||
- **Report ref:** none; requested by the owner on 2026-10-07 after case 02
|
||||
- **Capability:** A Revision upstream does not rewrite a Deliverable it leaves true.
|
||||
- **Rationale:** In case 02 the Target architecture was revised twice to add Checks. The architecture description, written from the Elements and Relationships, was rewritten both times: 24 requests and 942 thousand tokens, and each rewrite held the Phase open for about two minutes after the code was ready.
|
||||
- **Where:** `DeliverableSpec.written_from` in `app/workflows/deliverables.py`, `graph_structure` in `app/workflows/chain.py`, `specialist_task` in `app/nodes/execution_nodes.py`.
|
||||
- **Acceptance criteria:** When the Target architecture is revised with the same Elements and Relationships, the describer is not run and the description is submitted again as it stood. When either changes, or the description itself has feedback, it is written again.
|
||||
|
||||
## Step 22: Validation reports every gap in one pass
|
||||
|
||||
- **Report ref:** none; requested by the owner on 2026-10-07 after case 02
|
||||
- **Capability:** One validation finds the gaps in the Target architecture, not one validation per gap.
|
||||
- **Rationale:** In case 02 the first validation proposed 1 addition and the second proposed 3 more, none caused by the first Revision. Each cost a Revision of the design, the code and the validation: 15 minutes and about 2.4 million tokens in all.
|
||||
- **Where:** `agents/validator.md`, `agents/target-architect.md`, `skills/requirements-chain/SKILL.md`.
|
||||
- **Acceptance criteria:** The validator is told to review coverage completely in its first pass and, after a Revision made for its additions, to propose only what is still uncovered. The target architect is told to write a Check for each condition and each Element a requirement names. On the cases, Target architecture Revisions fall against case 02's two.
|
||||
|
||||
## Step 23: Validation recorded a few verdicts at a time
|
||||
|
||||
- **Report ref:** none; requested by the owner on 2026-10-08 after the cancelled run
|
||||
- **Capability:** The validator's work survives a slow or lost model reply.
|
||||
- **Rationale:** In the run cancelled on 2026-10-07 the validator's model request timed out five times at 180 seconds, about 15 minutes, each time while writing every verdict in one reply. Nothing it had judged was kept. The target architect had the same fault until iteration 4 step 17.
|
||||
- **Where:** `verdict_tools` in `app/tools/workspace.py`, `specialist_tools` in `app/tools/execution.py`, `providers/gcp.yaml`, `agents/validator.md`, `skills/iac-validation/SKILL.md`.
|
||||
- **Acceptance criteria:** Verdicts can be recorded over several calls and are attached as `verdicts.json` on submission. Verdicts recorded on the same code are kept across attempts; verdicts on code that has since changed are dropped. The validator has its own model timeout. On the cases, the validator's model timeouts fall to none.
|
||||
|
||||
## Step 24: The design checked against the provider's schema, in code
|
||||
|
||||
- **Report ref:** none; requested by the owner on 2026-10-08 after the cancelled run
|
||||
- **Capability:** A Check that names a setting its resource type lacks is caught before any code is written.
|
||||
- **Rationale:** In the cancelled run two Revisions of the Target architecture were for Checks no code could meet: `ssl_policy` on a backend service, and a deny rule on a service account. The target architect had the schema lookup and did not use it for them. The earlier K-30 (`startup_cpu_boost` on a Cloud Run job) was the same fault.
|
||||
- **Where:** `app/tools/schema_review.py` (new), the assembly in `app/agent.py`, `agents/target-architect.md`.
|
||||
- **Acceptance criteria:** At submission, every setting a Check's statement names is looked up on its Element's resource type, and a resource type the provider lacks is reported. What is raised is returned once and never blocks. On designs that passed validation it raises little or nothing.
|
||||
|
||||
## Step 25: An Execution that ends with warnings keeps its files
|
||||
|
||||
- **Report ref:** none; found by the runs of 2026-10-07 and 08
|
||||
- **Capability:** What an unfinished Execution produced can be read afterwards.
|
||||
- **Rationale:** Only a completed Execution wrote its Deliverables. Case 04's first run ended with warnings after 53 minutes and left nothing on disk: nine Deliverables' worth of work, and the evidence of what went wrong, existed only in the report's conversation log.
|
||||
- **Where:** `_write_outputs` and `end_with_warnings` in `app/nodes/execution_nodes.py`.
|
||||
- **Acceptance criteria:** An Execution that ends with warnings writes every Deliverable it holds, with a manifest that carries the warnings, each Deliverable's status and each Phase's status, so nothing unapproved reads as final. The case's history points to the files.
|
||||
|
||||
## Step 26: Each pillar's checklist is reviewed and the review is in the Deliverable
|
||||
|
||||
- **Report ref:** none; found by the judged runs of 2026-10-08
|
||||
- **Capability:** An architect sees every item of each pillar's checklist accounted for: addressed, and how, or not applicable, and why.
|
||||
- **Rationale:** The judged check `pillar_checklists_covered` failed in all four cases of the judged batch, at 0% to 55% a pillar, while `recommendations_quality` passed at 0.83 to 0.90. The six checklists hold 78 items; a run produces 11 to 14 recommendations, each one configurable decision. Twelve recommendations cannot answer 78 items, many of which are an organisation's process and not a design decision, so the check could not pass and nothing told an architect which items had been considered.
|
||||
- **Where:** `app/tools/pillars.py`, `submit_deliverable` in `app/tools/execution.py`, `agents/pillar-advisor.md`, `agents/design-advisor.md`.
|
||||
- **Acceptance criteria:** Each pillar advisor returns, with its advice, a status and a note for every item of its Skill's checklist. The reviews are kept with the advice across Revisions and written into the design recommendations by code, once. On a judged run `pillar_checklists_covered` passes.
|
||||
|
||||
## Step 27: A user sees a Deliverable before it is first submitted
|
||||
|
||||
- **Report ref:** none; found by evaluation case 04 on 2026-10-08
|
||||
- **Capability:** With a user present, no Deliverable is submitted that they have not been shown.
|
||||
- **Rationale:** The Specialist protocol tells every Specialist to confirm its draft with the user before submitting. In case 04 the validator did not (first run), and the target architect did not after running out of tool calls on an earlier attempt (batch A). An instruction was not enough.
|
||||
- **Where:** `submit_deliverable` in `app/tools/execution.py`, `specialist_task` in `app/nodes/execution_nodes.py`, `CONFIRM_DRAFTS` in `app/config.py`.
|
||||
- **Acceptance criteria:** In an Execution with a user, a Specialist's submission is refused until the user has replied to it about that Deliverable at least once, and the refusal says how to ask. A pre-approved Execution is unaffected. It can be switched off.
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
**Iteration:** 4, learning and Skills
|
||||
**Intent:** Make the agent a learning, adaptable solution through Skills. Fix the cheap defects the 2026-10-06 review found, then close the loop so each Execution can improve the next through a reviewed Skill change, then let new standards, clients and Cloud providers arrive as Skills and configuration.
|
||||
**Status:** steps 1 to 8, 11, 13 and 15 to 20 built; no evaluation run has completed on any of them (see `steps/step-8.md`), so every "tokens fall" or "Revisions fall" criterion is unmeasured; step 9 drafted and awaiting the owner; steps 10, 12 and 14 planned. Steps 1 to 6 are in commit `7ee49ab`; the rest are uncommitted.
|
||||
**Status:** steps 1 to 8, 11, 13 and 15 to 20 built; case 01 completed on them on 2026-10-07 (`../iter-06-target-architecture-graph/steps/step-11.md`); the other cases have not run, so no criterion is measured across the benchmark; step 9 complete (ADR-0004 accepted 2026-10-08), which unblocks steps 10 and 12; steps 10, 12 and 14 planned. Steps 1 to 6 are in commit `7ee49ab`; the rest are uncommitted.
|
||||
**Changed by iteration 6:** `docs/adr/0005-the-target-architecture-is-an-explicit-graph.md` (accepted 2026-10-07) replaces the free-form `findings.json` of step 1 with a verdict per Check, remove the diagrammer, and add a Phase. Its plan is `../iter-06-target-architecture-graph/`, which lists the effect on each step here and should be built before steps 10 to 14.
|
||||
**This directory covers:** steps 1 to 20
|
||||
**This directory covers:** steps 1 to 27
|
||||
|
||||
## Sources of truth
|
||||
|
||||
@@ -19,24 +19,33 @@
|
||||
|---|---|---|---|---|
|
||||
| 1 | Structured validator findings | A | S | replaced by iteration 6 step 9 (verdicts per Check) |
|
||||
| 2 | Carry the draft through `needs_input` | A | S | complete |
|
||||
| 3 | Reuse pillar advice across Revisions | A | S | built; evaluation run outstanding |
|
||||
| 3 | Reuse pillar advice across Revisions | A | S | built; no run has revised design recommendations, so unexercised by evaluation |
|
||||
| 4 | Single source for Deliverable contracts | A | S | complete |
|
||||
| 5 | Cap parallel Specialists | A | S | complete |
|
||||
| 6 | Orchestrator step order | A | S | built; seen working in one stopped run, no completed evaluation |
|
||||
| 7 | Capture lesson candidates | B | M | complete |
|
||||
| 8 | Evaluation that can see improvement | B | M | built; thresholds and a judged run outstanding |
|
||||
| 9 | ADR: the lessons loop and overlay Skills | B | S | drafted as `docs/adr/0004-lessons-and-overlays-arrive-as-skills.md`, status proposed; awaits the owner |
|
||||
| 10 | Lessons Skill and lesson curator | B | L | planned |
|
||||
| 11 | IaC patterns Skill | B | M | built; every pattern validates; effect on Revisions and tokens unmeasured |
|
||||
| 12 | Overlay Skills and an organisation standards Skill | C | M | planned |
|
||||
| 13 | Trim Specialist context | C | M | built; effect on tokens unmeasured |
|
||||
| 14 | Provider-owned contracts | C | M | planned |
|
||||
| 8 | Evaluation that can see improvement | B | M | complete: thresholds set and four judged runs done on 2026-10-08 |
|
||||
| 9 | ADR: the lessons loop and overlay Skills | B | S | complete: ADR-0004 accepted 2026-10-08 |
|
||||
| 10 | Lessons Skill and lesson curator | B | L | the loop is built; six lessons proposed from 21 Executions, approved by the owner and published on 2026-10-09; not yet proved by an evaluation with and without (`steps/step-10.md`) |
|
||||
| 11 | IaC patterns Skill | B | M | built; in case 01 the IaC author fell from 57 requests to 11 with no Revision; other cases unmeasured |
|
||||
| 12 | Overlay Skills and an organisation standards Skill | C | M | built, with an example standards Skill; case 06 passed on 2026-10-09, failed once on 2026-10-10 for a wrong verdict, and passed again after the fix, now with a check that the code follows the standards |
|
||||
| 13 | Trim Specialist context | C | M | built; measured on case 01 only, together with steps 11 and 17 |
|
||||
| 14 | Provider-owned contracts | C | M | deferred by its own plan until a second Cloud provider is planned (ADR-0002) |
|
||||
| 15 | Group Executions by Customer case | added | S | complete |
|
||||
| 16 | Cache Terraform providers between checks | added | S | complete |
|
||||
| 17 | A working copy for files and for the graph | added | M | built; effect on time and tokens unmeasured |
|
||||
| 17 | A working copy for files and for the graph | added | M | complete; in every run since 2026-10-07 |
|
||||
| 18 | Provider schema lookup and one pinned provider version | added | S | built; checked against the real provider |
|
||||
| 19 | A Check the code cannot meet goes back to the Target architecture | added | S | built |
|
||||
| 20 | A model timeout per role | added | S | built |
|
||||
| 21 | A Deliverable stands while what it was written from is unchanged | added | S | complete; the description was kept on Check-only Revisions in runs of 2026-10-07 to 09 |
|
||||
| 22 | Validation reports every gap in one pass | added | S | instructions changed; with conditions listed, case 02 ran with 102 Checks and no Revision |
|
||||
| 23 | Validation recorded a few verdicts at a time | added | S | built; in case 02 a validator run cut short carried on and submitted in 68 seconds, with no timeout |
|
||||
| 24 | The design checked against the provider's schema, in code | added | S | built; measured on two passed designs and the known faults; raised nothing in case 02, which had no unimplementable Check |
|
||||
| 25 | An Execution that ends with warnings keeps its files | added | S | complete |
|
||||
| 26 | Each pillar's checklist is reviewed and the review is in the Deliverable | added | S | built; a judged run of case 04 scored the checklist check at 100% on every pillar |
|
||||
| 27 | A user sees a Deliverable before it is first submitted | added | S | built; case 04 passed the check on 2026-10-09, with the rule not needing to refuse |
|
||||
| 28 | Housekeeping: files written as an Execution goes, four more code patterns | none | S | built 2026-10-10 (`steps/step-28.md`) |
|
||||
| 29 | What the request does not say is a question for the customer | none | M | built 2026-10-10: a fourth checklist outcome, a questions report, and the judged check counts it; not run (`steps/step-29.md`) |
|
||||
|
||||
Size: S under a day, M a few days, L a week or more. Group A is cheap fixes that also create signal. Group B is the learning loop. Group C is adaptability.
|
||||
|
||||
|
||||
121
.agents/plans/iter-04-learning-and-skills/steps/step-10.md
Normal file
121
.agents/plans/iter-04-learning-and-skills/steps/step-10.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# Step 10 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09: the loop, and its first six lessons, which the owner approved the same day and which are published. **None is proved yet**: no evaluation has run with and without them, so the step's last acceptance criterion is open.
|
||||
|
||||
## The loop
|
||||
|
||||
| Stage | Where | What it does |
|
||||
|---|---|---|
|
||||
| Capture | `app/states/lessons.py` (step 7) | Each Execution records its lesson candidates. |
|
||||
| Distil | `app/learning/evidence.py` | Reads every Execution's candidates where it wrote them and groups what recurred in at least two Executions, with ids and values removed from the description. A refusal the Execution's own permissions caused, and the router's own questions, are not evidence. |
|
||||
| | `app/learning/curator.py`, `agents/lesson-curator.md` | The `lesson-curator` role, outside any Execution, proposes a lesson for each group worth one, or says why not. A proposal naming a Customer case or an Execution is refused. |
|
||||
| Review | `app/learning/proposals.py` | Each proposal is `.scratch/lessons/issues/NN-<slug>.md`, `Status: needs-triage`, with its rule, reason and evidence as counts. A person sets `ready-for-agent` to approve or `wontfix` to reject. |
|
||||
| Publish | `app/learning/skill.py` | Writes an approved lesson into `skills/google-cloud-lessons/references/<deliverable>.md` and rewrites the index in `SKILL.md`. Refuses anything not approved. |
|
||||
| Prove | `LESSONS_ENABLED` | `false` leaves the lessons Skill out of every role, so the evaluation can run with and without. The comparison goes under the proposal's `## Proof`. |
|
||||
| Retire | `app/learning/skill.py` | Removes a lesson by id; an emptied reference is deleted. |
|
||||
|
||||
`eval/curate_lessons.py` runs it: `propose`, `status`, `publish`, `retire L-NN`.
|
||||
|
||||
A Specialist is given the lessons Skill only once it holds a reference for that Specialist's Deliverable (`load_roles`), so nobody loads an empty Skill. The provider bundle names the Skill (`lessons_skill`), which makes lessons per Cloud provider. The protocol tells a Specialist with a lessons Skill to read its Deliverable's reference before drafting. Each Execution already records the version of every Skill it loaded.
|
||||
|
||||
## Differs from the plan
|
||||
|
||||
- **A lesson's source is its proposal, not an Execution.** The plan said each lesson records its source Execution. An Execution id names a Customer case, and ADR-0004 says a lesson carries no client detail, so the Skill records the proposal number and the proposal records how many Executions the evidence came from.
|
||||
- **Retiring at each vendor sync is not automated.** `retire` exists; nothing yet compares lessons with a new upstream Skill.
|
||||
- **Proving is a manual comparison** of two evaluation runs. Nothing computes it or writes it into the proposal.
|
||||
|
||||
## First proposals
|
||||
|
||||
Run on 2026-10-09 over the candidates of 21 Executions (`eval/results/`), which held 14 recurring problems. The curator proposed six and passed over eight:
|
||||
|
||||
| Id | Deliverable | Lesson | Evidence |
|
||||
|---|---|---|---|
|
||||
| L-01 | Target architecture | A Check for every explicit constraint in a requirement, not one broad Check | 14 of 21 Executions, 58 times |
|
||||
| L-02 | Target architecture | Every Element has a Check before submitting | 13 of 21, 13 times |
|
||||
| L-03 | Target architecture | Confirm the resource type supports the argument a Check names | 3 of 21 |
|
||||
| L-04 | Target architecture | Name the block's argument, not the expected value, as the setting | 2 of 21 |
|
||||
| L-05 | Deployment guidance | Include required arguments in alert-policy blocks | 2 of 21 |
|
||||
| L-06 | Target architecture | `not_applicable` is for recommendations, never requirements | 2 of 21 |
|
||||
|
||||
The owner approved all six on 2026-10-09 and they were published: five for the target architect, one for the IaC author, which are now the two roles given the lessons Skill. Several restate what instructions or checks already say (L-02 is refused at submission today; L-03 is what the schema review does), which is the kind of thing a reviewer should weigh: a lesson costs tokens on every Execution.
|
||||
|
||||
## Tests
|
||||
|
||||
`tests/test_lessons_loop.py` (20): grouping, proposals as files, the approval gate, publish and retire, the curator with a scripted model, and which roles are given the Skill.
|
||||
|
||||
## Added later on 2026-10-09
|
||||
|
||||
- **Proving is a command.** `eval.curate_lessons prove --without <report.json> --with <report.json>` compares two evaluation reports case by case (score, Revisions, minutes, tokens), says whether quality held and anything fell, and writes the comparison into every published proposal's `## Proof` (`app/learning/proof.py`). The two runs are still made by hand, one with `LESSONS_ENABLED=false`.
|
||||
- **Triage.** Before the curator runs, each new group is put to the decider with the lessons that exist: which one would have prevented it, or none. A group a lesson covers is not put to the curator again (`_not_already_covered` in `app/learning/curator.py`; iteration 5 step 10).
|
||||
|
||||
Still open: retiring lessons when the upstream Skills change is not automated, and no lesson has been proved.
|
||||
|
||||
## Run on 2026-10-09
|
||||
|
||||
Case 06 ran with the six lessons loaded and still needed one Revision of the Target architecture, as case 03 did before the lessons existed. That neither proves nor disproves them: it also carried an overlay. `prove` has not been run.
|
||||
|
||||
## L-04 retired on 2026-10-09
|
||||
|
||||
L-04 told the target architect to word Checks so the schema review would not mistake a value for a setting. The review was at fault: it read `cloudsql.iam_authentication` (a database flag) and `run.googleapis.com` (a service) as settings, and raised both again in case 06 with the lesson loaded. It now judges a dotted path only when the path starts at a name the resource type has (`_is_missing` in `app/tools/schema_review.py`). The lesson is removed from the Skill; five remain.
|
||||
|
||||
## First proof, 2026-10-09
|
||||
|
||||
Case 03, one run each way, side by side, with the five lessons that remain (`20261009T195603Z` without, `20261009T195607Z` with):
|
||||
|
||||
| | Without lessons | With lessons |
|
||||
|---|---|---|
|
||||
| Score | 100% | 100% |
|
||||
| Revisions | 1, of the Target architecture | 0 |
|
||||
| Minutes | 28 | 22 |
|
||||
| Tokens | 3.00 million | 2.32 million |
|
||||
| Cost, about | $3.47 | $2.44 |
|
||||
|
||||
`prove` recorded this in the proposals as "kept". One pair suggests a direction and does not settle it: a third run the same evening, with lessons, did need a Revision of the Target architecture. `prove` also wrote to L-04's proposal, which is retired; it should skip retired lessons.
|
||||
|
||||
Neither run raised the schema review's false alarm, which had been raised in case 06 before the fix.
|
||||
|
||||
## Housekeeping, 2026-10-10
|
||||
|
||||
- **`prove` skips retired lessons.** It wrote its comparison into L-04's proposal after L-04 had been retired. It now writes only for lessons the Skill holds. L-04's proposal is corrected.
|
||||
- **Lessons are flagged when the vendored Skills change.** The lessons Skill keeps `upstream.json`: the version of each vendored Skill the lessons were last read against. `status` names the ones that have changed since and says to read each lesson again; `reviewed` records that a person has. A test fails until then, so a sync of the vendored Skills cannot go unnoticed. The first publish records the versions; after that only `reviewed` moves them.
|
||||
- **`status` says "compared", not "proved",** and shows a retired lesson as retired. One pair of runs is a comparison.
|
||||
|
||||
Tests: `tests/test_lessons_loop.py`.
|
||||
|
||||
## Evidence is also grouped by what it is about (2026-10-10)
|
||||
|
||||
Running `propose` over 32 Executions gave nothing useful. Evidence was grouped by the kind of problem, and a group gets one lesson: "validation proposed a Check the design lacked" was 20 of 32 Executions and already had L-01. What recurred inside it could not be seen.
|
||||
|
||||
- A proposed Check, and a Check sent back as unimplementable, is now also counted under each provider setting or resource type its text names (`_subjects` in `app/learning/evidence.py`). A subject seen in two or more Executions is its own group, with its own key. A setting's name is the provider's vocabulary, not a client's.
|
||||
- These narrower groups skip triage: each recurred with the general lessons published. The curator is shown the existing lessons and may still decline.
|
||||
- The curator's instructions say such a lesson may name the setting or resource type.
|
||||
|
||||
Over the same 32 Executions this gave 22 groups and five proposals, L-07 to L-11, all awaiting the owner: location Checks, Cloud SQL backup encryption, backend service capabilities, Pub/Sub persistence regions, and customer-managed keys.
|
||||
|
||||
A first run of `propose` before this change produced one proposal, about giving `edit_file` enough context. It was removed to run again cleanly and was not proposed the second time.
|
||||
|
||||
Tests: `tests/test_lessons_loop.py` (3 more).
|
||||
|
||||
## The three new lessons, run once (2026-10-10)
|
||||
|
||||
Case 03, two runs with the eight lessons (`20261010T114823Z`, `20261010T114827Z`). Both completed at 100%.
|
||||
|
||||
| | Run 1 | Run 2 |
|
||||
|---|---|---|
|
||||
| Minutes | 30 | 37 |
|
||||
| Cost, about | $3.27 | $5.19 |
|
||||
| Revisions of the Target architecture | 1 | 2 |
|
||||
|
||||
None of the three faults the new lessons name came back: no separate backup encryption key, no backend service fault. The Revisions were for other things:
|
||||
|
||||
- The validator proposed a Check that the service identity holds no project-wide administrative role.
|
||||
- A Check asked for an encryption key and the design had no key Element for it to name.
|
||||
- A Check that the region has a high carbon-free energy score could not be verified from the code.
|
||||
|
||||
The last is partly L-07's doing. It says to add a location Check where a requirement asks for a low-carbon location, and the architect wrote one about the carbon score, which no code can show.
|
||||
|
||||
Across the twelve runs of this request on 2026-10-09 and 10 the Target architecture was revised 0, 1, 1, 1, 1, 3, 1, 1, 0, 1, 1 and 2 times. Lessons have removed particular faults and not lowered the count: each run finds another.
|
||||
|
||||
## Fixed at its source: what only the provider publishes
|
||||
|
||||
The carbon-score condition came up in at least five runs, as a gap, as an unverifiable Check and as noise in two reviews. It was being written as a condition for code. The requirements-chain Skill and the two roles that write conditions now say that a property of a region or product that only its provider publishes (a carbon rating, a service level) goes under `outside_code`, and the condition is the choice configuration can show, such as which region is set. Not run.
|
||||
@@ -10,4 +10,7 @@ Differs from the plan: the plan's acceptance is a fall in IaC author Revisions o
|
||||
|
||||
Tests: `tests/test_iac_patterns.py` runs `terraform validate` on every reference's pattern with the Skill's own versions file (13 pass against the real provider from the plugin cache; skipped when the provider cannot be installed), checks every reference is listed in `SKILL.md`, and checks the Skill and the bundle pin the same version.
|
||||
|
||||
Not done: load balancing, Firestore, BigQuery, Eventarc and GKE have no reference. A product with none is written from `terraform_schema` and the documentation.
|
||||
Not done: Firestore, BigQuery, Eventarc and GKE have no reference. A product with none is written from `terraform_schema` and the documentation.
|
||||
|
||||
Added on 2026-10-08: `references/load-balancer.md`, a fourteenth pattern: an external Application Load Balancer in front of Cloud Run with a TLS policy, a firewall policy, Identity-Aware Proxy and an HTTP redirect. Cases 02, 03 and 04 all used a load balancer with no pattern, and one run put `ssl_policy` on a backend service, which has no such setting; the reference says which link of the chain each setting lives on. It validates against the pinned provider.
|
||||
|
||||
|
||||
53
.agents/plans/iter-04-learning-and-skills/steps/step-12.md
Normal file
53
.agents/plans/iter-04-learning-and-skills/steps/step-12.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Step 12 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09. **Not run with real models.**
|
||||
|
||||
1. An overlay Skill is an ordinary Agent Skill in a folder the deployment names: `OVERLAY_SKILLS_DIRS` (default `skills/overlays`). `discover_overlays` in `app/agent.py` reads them with the same validation as the provider's Skills and refuses one that reuses a provider Skill's name.
|
||||
2. `ExecutionEngine.start(overlay_skills=[...])` names the overlays for one Execution. `DEFAULT_OVERLAY_SKILLS` names the ones every Execution loads. An unknown name, or anything but a list of names, refuses the start before anything runs or is recorded. A caller names an overlay; nothing lets it supply one.
|
||||
3. Every Specialist is given the Execution's overlays on top of its own Skills, and its context lists them as `overlay_skills`. The protocol says an overlay wins over the provider's general guidance, and a requirement the user stated wins over an overlay.
|
||||
4. The Execution records each overlay with the content hash it had: in its state, in `execution.json` and in its lesson candidates.
|
||||
5. Callers: `overlay_skills` in the `/generate` body, in A2A message metadata, and on an evaluation case.
|
||||
6. `skills/overlays/example-organisation-standards/` is an example: naming, four mandatory labels, approved regions, three prohibitions. It is marked as an example, is not loaded by default, and is not any real organisation's policy.
|
||||
|
||||
Differs from the plan:
|
||||
|
||||
- **Skills are still loaded once at start-up.** The runtime loads every provider Skill and every overlay in the configured folders when it starts; an Execution chooses among them. An overlay added to the folder needs a restart.
|
||||
- **No organisation standards Skill is loaded by default.** The plan's criterion "loaded by the roles the bundle lists" is met by naming it, not by the bundle: whose standards apply is the deployment's and the caller's to say.
|
||||
|
||||
`case-06-organisation-standards` in the evaluation dataset runs case 03's request under the example overlay. It has not been run.
|
||||
|
||||
Tests: `tests/execution/test_overlay_skills.py` (8).
|
||||
|
||||
## Run on 2026-10-09
|
||||
|
||||
`case-06-organisation-standards` (results `20261009T171333Z`): completed, 100%, 36 minutes, 3.66 million tokens, one Revision of the Target architecture. `execution.json` records the overlay with its hash. The code follows it: every resource is named `${var.workload}-${var.environment}-<purpose>`, the only region is `europe-west1`, and the labels are set. The same request without the overlay last took 22 minutes and 2.32 million tokens (`20261009T103827Z`); one run each, so the difference is not attributed.
|
||||
|
||||
No evaluation check scores whether an overlay was followed; this was read from the code by hand.
|
||||
|
||||
## An evaluation check, later on 2026-10-09
|
||||
|
||||
A case may now carry `code_standards`: regular expressions the infrastructure code must contain or must not, scored as `code_follows_standards`. Case 06 has six: only approved regions, names carrying the environment from a variable, and the four labels. Run against the code case 06 produced earlier today, it passes.
|
||||
|
||||
## Rerun on 2026-10-10: case 06 failed, case 04 passed
|
||||
|
||||
Both rerun after the week's changes (`20261010T123446Z` case 04, `20261010T123450Z` case 06).
|
||||
|
||||
**Case 04, interactive: completed, 12 of 12 checks, 34 minutes, about $4.58,** one Revision of the Target architecture. Nothing in routing, intake, the guardrail or the writing of files as it goes broke it.
|
||||
|
||||
**Case 06, overlay: ended with warnings, 67%, 42 minutes, about $7.72.** The Target architecture reached its Revision limit of 3 and no guide was packaged. Two separate causes:
|
||||
|
||||
- **A verdict that was wrong, and no way to say so.** Check K-10 says a role is granted to the service identity. It was. The validator failed it because the identity also held three other roles that other Checks require. The IaC author, sent the failure, could change nothing, and recorded the Check as unimplementable with the reason "the validator insists on only this role". That sent the design back for a fault it did not have. The same Check passed in the validation between, on the same grants: the validator was not consistent. The other two Revisions were ordinary ones (labels and names the overlay asks for, and a resource whose name cannot contain hyphens).
|
||||
- **The evaluation's naming check was too narrow.** `code_follows_standards` wanted a variable with "env" in its name inside each resource name. The code built names from `local.name_prefix`, itself made from `var.workload` and `var.environment`, which follows the standard. The check now asks that names are built from a variable or local, and that the environment comes from a variable; this run's code and the earlier run's both pass it.
|
||||
|
||||
Changed, not yet run:
|
||||
|
||||
- The validator is told to judge each Check by its own words: a Check that something is granted or set passes when it is, whatever is beside it, unless it says "only". What else it thinks should hold is a proposed addition, never a failure.
|
||||
- The IaC author is told what to do when a Check failed and the code already meets its words: change nothing, keep the implementation entry, name the Check it disputes, and not record it as unimplementable.
|
||||
|
||||
An overlay also makes a design larger: this run ended with over 120 Checks, against 50 to 90 for the same request without one.
|
||||
|
||||
## Case 06 again, with the fixes (2026-10-10)
|
||||
|
||||
`20261010T134034Z`: completed, 100%, 45 minutes, about $5.43, 126 Checks, all passed. `code_follows_standards` passed. Two Revisions of the Target architecture, both ordinary: locations the validator wanted checked (L-10's subject, the persistence regions of a topic, among them), and two Checks on one secret that contradicted each other.
|
||||
|
||||
No Check was failed for something it does not say, and none was disputed, so the two new instructions were not put to the test: the run shows they do no harm, not that they work.
|
||||
@@ -15,3 +15,14 @@ Checked against the real provider on 2026-10-07:
|
||||
Not done: generated code is not forced onto the pinned version. An agent that writes its own `required_providers` with another version is validated against that version. The patterns Skill gives it the pinned `versions.tf` to use.
|
||||
|
||||
Tests: `tests/tools/test_local.py`, "schema lookup", on a stand-in schema; `tests/test_providers.py` for the pin.
|
||||
|
||||
After the run of 2026-10-07 16:59 UTC: the target architect made 39 lookups for 8 distinct resource types and exhausted its budget. `find` now takes several names separated by commas, the tool's description says the plain lookup lists every argument and block, and `agents/target-architect.md` asks for one lookup per distinct resource type (budget 45). An outline longer than 8,000 characters is cut with a note to use `block` or `find`; 7 of the provider's 1,370 resource types are that long, `google_container_cluster` the longest.
|
||||
|
||||
After the runs of 2026-10-08: the target architect still exhausted its 45 tool calls on its first attempt in three of five runs. In the last it made 31 schema lookups and 29 `graph_put` calls for one design. Each exhausted attempt cost four to ten minutes before the next one carried on from the working graph. Changed on 2026-10-09:
|
||||
|
||||
- `terraform_schema` takes `resource_types`, a list (or several names in `resource_type`), and returns an outline of each: every argument and block it accepts, by name, required ones starred, with no descriptions. Up to 20 types a call, 4,000 characters a type. The 11 resource types of that design come back in one reply of 14,600 characters.
|
||||
- `agents/target-architect.md` asks for that one call once the Elements are decided, and for `graph_put` in a handful of calls of ten to twenty items each, where it said "a few items per call".
|
||||
- The schema review at submission (step 24) already checks every setting a Check names, so a lookup the architect skips is still caught.
|
||||
|
||||
Run on 2026-10-09 (case 04, `eval/results/20261009T083440Z/`): the target architect finished its first attempt in 314 seconds without exhausting its tool calls, making 11 schema lookups and 13 `graph_put` calls over the whole run, against 31 and 29 the run before. It still looked types up more than once, so the instruction is only partly followed.
|
||||
|
||||
|
||||
14
.agents/plans/iter-04-learning-and-skills/steps/step-21.md
Normal file
14
.agents/plans/iter-04-learning-and-skills/steps/step-21.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Step 21 — Implementation Detail
|
||||
|
||||
Built on 2026-10-07.
|
||||
|
||||
1. `DeliverableSpec.written_from` returns one comparable value for what a Deliverable is written from. The architecture description's is `graph_structure`: the graph's Elements and Relationships, without its Checks.
|
||||
2. When a Specialist submits, `specialist_task` keeps the submission in the Deliverable's working memory with that value and the feedback it was written under.
|
||||
3. When the Deliverable is started again and the value and the feedback are the same, no Specialist is run: the kept submission is returned as the attempt's outcome. The Ledger records a submission as for any attempt.
|
||||
4. A note that a dependency was revised is not counted as feedback on the Deliverable. Anything else is, and has it written again.
|
||||
|
||||
Only the architecture description declares `written_from`. The code answers the Checks, so it is not kept; its working copy already makes its Revision cheap (27 and 88 seconds in case 02).
|
||||
|
||||
**Unrun:** no evaluation since. The saving expected on a case like 02 is the describer's second and third runs.
|
||||
|
||||
Tests: `tests/execution/test_coverage_review.py`, "a description stands while the shape of the design does" (4).
|
||||
11
.agents/plans/iter-04-learning-and-skills/steps/step-22.md
Normal file
11
.agents/plans/iter-04-learning-and-skills/steps/step-22.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Step 22 — Implementation Detail
|
||||
|
||||
Changed on 2026-10-07. Instructions only; no code.
|
||||
|
||||
- `agents/validator.md`: review coverage once and completely, going through every requirement and recommendation in turn, and report every gap in that pass. After a Revision made for its additions, propose only what is still uncovered, and never what a Check already verifies in other words.
|
||||
- `agents/target-architect.md`: one Check per requirement is rarely enough; write a Check for every condition a requirement states and every Element it applies to.
|
||||
- `skills/requirements-chain/SKILL.md`: a "Coverage" rule for the graph, and "find every gap in one pass" for the verdicts.
|
||||
|
||||
Also changed: `agents/requirements-analyst.md` and `agents/design-advisor.md` now have every non-functional requirement and recommendation list its `conditions`, which the submission check requires. A review of those conditions by Jev is built and off by default: see `../../iter-05-jev-decisions/steps/step-4.md`.
|
||||
|
||||
**Unrun:** an instruction's effect is only known from an evaluation. Case 02 is the comparison: 2 Revisions of the Target architecture, with 1 and then 3 proposed additions.
|
||||
13
.agents/plans/iter-04-learning-and-skills/steps/step-23.md
Normal file
13
.agents/plans/iter-04-learning-and-skills/steps/step-23.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Step 23 — Implementation Detail
|
||||
|
||||
Built on 2026-10-08.
|
||||
|
||||
1. `verdict_put` records verdicts a few Checks per call, replacing any already recorded for the same Check, and takes the dry-run's result and proposed additions. Each reply says how many Checks have a verdict and names those left. `verdict_read` returns what is recorded.
|
||||
2. `submit_deliverable` attaches the recorded verdicts as `verdicts.json` when none is passed. Passing the file still works.
|
||||
3. The verdicts are kept in the Deliverable's working memory with a mark of the code they were given on (a hash of the submitted deployment guidance's files). A later attempt on the same code carries on from them; on changed code they are dropped before any tool runs.
|
||||
4. The validator's model timeout is 300 seconds (`models.timeout_seconds` in `providers/gcp.yaml`); it had the default 180.
|
||||
5. `agents/validator.md` tells it to record as it goes, one Element's Checks at a time, and to submit with no attachments.
|
||||
|
||||
Run on 2026-10-08 (case 02): no model timeout. The validator used all 15 of its tool calls on its first attempt, having recorded verdicts; the second attempt read them and submitted in 68 seconds. Its budget is now 30 (`agents/validator.md`).
|
||||
|
||||
Tests: `tests/execution/test_validation_in_pieces.py`, "verdicts a few at a time" (7).
|
||||
22
.agents/plans/iter-04-learning-and-skills/steps/step-24.md
Normal file
22
.agents/plans/iter-04-learning-and-skills/steps/step-24.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Step 24 — Implementation Detail
|
||||
|
||||
Built on 2026-10-08 as a second `SubmissionReview` (the seam from iteration 5 step 4), with no model and no Jev.
|
||||
|
||||
1. `named_settings` reads the settings a Check's statement names: anything in backticks that reads as a name or dotted path, and bare snake_case names and dotted paths. Quoted text, upper-case values and paths such as `roles/x.y` are skipped.
|
||||
2. `SchemaReview` loads the pinned provider's schema once (iteration 4 step 18). For each Check on an Element it looks each named setting up anywhere in that Element's resource type; a path is judged by the setting at its end, and a resource type named in a statement is not a setting. It also reports an Element whose resource type the provider does not have, with close matches.
|
||||
3. `Reviews` runs several reviews as one. The assembly installs the schema review whenever the bundle pins a Terraform provider, and the coverage review after it when that is switched on.
|
||||
4. As with any review, what it raises is returned to the target architect once per run and the next submission is accepted.
|
||||
|
||||
Measured on 2026-10-08 against the real provider:
|
||||
|
||||
| Design | Checks | Raised |
|
||||
|---|---|---|
|
||||
| Case 01, passed validation | 42 | 0 |
|
||||
| Case 02, passed validation | 54 | 2, both the same metric name used as a value (`oldest_unacked_message_age`) |
|
||||
| Known faults added: `startup_cpu_boost` on a Cloud Run job, `ssl_policy` on a backend service, a misspelt resource type | 3 | all 3 |
|
||||
|
||||
So 2 false alarms in 96 Checks, which is why it is a review and not a rule. It does not catch a Check that names no setting at all, such as "deny read roles" on a service account; that still reaches the IaC author and comes back by the route of step 19.
|
||||
|
||||
**Unrun in an Execution.**
|
||||
|
||||
Tests: `tests/execution/test_validation_in_pieces.py`, "the design against the provider's schema" (6).
|
||||
14
.agents/plans/iter-04-learning-and-skills/steps/step-25.md
Normal file
14
.agents/plans/iter-04-learning-and-skills/steps/step-25.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Step 25 — Implementation Detail
|
||||
|
||||
Built on 2026-10-08.
|
||||
|
||||
1. `_write_outputs` takes the Execution's final status and its Ledger. `end_with_warnings` now calls it, as `finalize` does.
|
||||
2. `execution.json` gains `status` (`completed` or `completed_with_warnings`), `warnings`, `phases` (each Phase's status), and a `status` on every Deliverable: `submitted`, or `draft` when something it depends on was reopened after it was written.
|
||||
3. With no Deliverable at all nothing is written, and the case's history records no files, as before.
|
||||
4. The solution guide is written only when it exists; an Execution that stopped before packaging has none, and the manifest says so.
|
||||
|
||||
Not covered: an Execution whose process is killed. It never reaches either end node, so it still writes nothing. The evaluation's progress file (iteration 6 step 11) records its time and tokens, not its Deliverables.
|
||||
|
||||
Also on 2026-10-08, outside any step: the CI workflow installs `requirements.txt` and `requirements-dev.txt` before linting and testing. It installed only ruff, mypy and pytest, so its test step could not import the application.
|
||||
|
||||
Tests: `tests/execution/test_engine.py`, two updated.
|
||||
17
.agents/plans/iter-04-learning-and-skills/steps/step-26.md
Normal file
17
.agents/plans/iter-04-learning-and-skills/steps/step-26.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Step 26 — Implementation Detail
|
||||
|
||||
Built on 2026-10-08.
|
||||
|
||||
1. `submit_advice` takes a `checklist`: one entry per item of the pillar Skill's validation checklist, with `status` (`addressed`, `not_applicable` or `not_addressed`) and a `note`. An entry with no item or another status is dropped.
|
||||
2. The consultation keeps each pillar's review in the Deliverable's working memory (`pillar_checklists`) beside its advice, so a Revision that re-consults some pillars keeps the others' reviews. The design advisor is given the advice only, not the review.
|
||||
3. `render_checklist_review` writes the reviews as one section, "Architecture framework checklist review", a table per pillar. `submit_deliverable` appends it to the design recommendations and replaces an earlier copy, so a Revision never stacks two.
|
||||
4. A Skill with no checklist gets no review and the Deliverable no section: the mechanism is the provider's Skills' own, not Google Cloud's.
|
||||
|
||||
Checked on 2026-10-08 with two real advisors on case 03's brief: reliability returned all 8 of its items (6 addressed, 2 not applicable) and cost optimisation all 11 (11 addressed), in 74 seconds for the pair.
|
||||
|
||||
Two limits:
|
||||
|
||||
- A review says what the advisor's own advice covers. The design advisor reconciles the pillars and may leave something out, so "addressed" there is the advisor's claim, not a check of the final recommendations.
|
||||
- A judged run of case 04 on 2026-10-08 scored `pillar_checklists_covered` at 100% on all six pillars, against 9% to 45% before. One run.
|
||||
|
||||
Tests: `tests/execution/test_pillars.py`, "each advisor reviews its pillar's checklist" (3).
|
||||
13
.agents/plans/iter-04-learning-and-skills/steps/step-27.md
Normal file
13
.agents/plans/iter-04-learning-and-skills/steps/step-27.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Step 27 — Implementation Detail
|
||||
|
||||
Built on 2026-10-08.
|
||||
|
||||
1. `specialist_tools` takes `confirm_first`. While it is set, `submit_deliverable` checks the submission as usual, keeps the working copy, runs any review, and then refuses: the user has not seen this Deliverable; call `needs_input` with a summary and pass the content as `draft`.
|
||||
2. `specialist_task` sets it when the Execution is not pre-approved and the user has not been shown a draft of the Deliverable. The Orchestrator's turn records a Deliverable in `drafts_shown` when a Specialist's question carries a draft. Once shown, submission is allowed, so a Revision is not asked about again.
|
||||
|
||||
The first version opened the rule once the user had answered any question about the Deliverable. The verification run of 2026-10-08 showed the hole: the target architect ran out of tool calls, the Orchestrator asked the user how to proceed, and that answer let the next attempt submit unseen.
|
||||
3. `CONFIRM_DRAFTS` (default `true`) turns the rule on in the assembly. The engine's own default is off, so an engine built directly, as in tests, behaves as before.
|
||||
|
||||
**No interactive evaluation has run since the second version.** The case 04 check `specialists_ask_before_submitting` is the measure.
|
||||
|
||||
Tests: `tests/execution/test_engine.py`, "a user sees a Deliverable before it is first submitted" (3).
|
||||
21
.agents/plans/iter-04-learning-and-skills/steps/step-28.md
Normal file
21
.agents/plans/iter-04-learning-and-skills/steps/step-28.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Step 28 — Housekeeping (2026-10-10)
|
||||
|
||||
Small things found during the runs of 2026-10-09. Not run with real models unless said.
|
||||
|
||||
## Files are written as an Execution goes
|
||||
|
||||
An Execution's folder was written only when it ended, so a killed process, or an Execution left waiting for its user, left nothing on disk.
|
||||
|
||||
- Each time a Deliverable is submitted, the folder is written with what exists, and `execution.json` says `in_progress`. The end of the Execution writes it again with its final status.
|
||||
- An in-progress Execution is refused as a Baseline, as any Execution that did not complete is.
|
||||
- Because the folder is now written more than once, a write removes the files an earlier write recorded and this one does not have. Without that, a Terraform file removed in a Revision would have stayed beside the files that replaced it. Only files the Execution itself wrote are removed.
|
||||
|
||||
Tests: `tests/execution/test_outputs_as_it_goes.py` (2).
|
||||
|
||||
## Four more code patterns
|
||||
|
||||
`skills/google-cloud-iac-patterns/` gains Firestore, BigQuery, Eventarc and Google Kubernetes Engine, 18 in all. Each validates against `hashicorp/google` 8.6.0 in `tests/test_iac_patterns.py`.
|
||||
|
||||
## The two explainer pages
|
||||
|
||||
Both now describe the opt-in to published Terraform modules.
|
||||
24
.agents/plans/iter-04-learning-and-skills/steps/step-29.md
Normal file
24
.agents/plans/iter-04-learning-and-skills/steps/step-29.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Step 29 — What the request does not say is a question for the customer
|
||||
|
||||
Built on 2026-10-10, on the owner's direction. **Not run with real models.**
|
||||
|
||||
## What prompted it
|
||||
|
||||
The owner labelled the judge's 32 questions (iteration 5 step 16): yes to all 24 checklist items. Both judges had answered no to most; they agreed with the labels on 28% and 16%. The owner's reading was deliberate: where a checklist item is unanswered because the customer's request gives no information about it, that is not the design failing a standard. It is missing information, and should come back as a question to put to the customer.
|
||||
|
||||
The checklist review had three outcomes: addressed, does not apply, not addressed. The third was the only place such an item could go, and it reads as a fault.
|
||||
|
||||
## What was built
|
||||
|
||||
- **A fourth outcome, `needs_customer_input`** ("To confirm with the customer"), in `app/tools/pillars.py`. A pillar advisor gives it to an item that could apply where its brief does not say what would settle it, and must give the question to ask; without the question its submission is refused. `not_addressed` is now only for an item the brief gives enough to settle, that applies, and that nothing is recommended for.
|
||||
- **The questions are reported.** Code writes a "Questions for the customer" table into the design recommendations, under the checklist review, saying they are not faults in the design. An Execution also writes `customer-questions.md` beside its other files, and `execution.json` names it. The packager carries the section into the guide.
|
||||
- **The evaluation counts it as accounted for.** The judged check asks whether the recommendations account for an item by recommending it, by explaining why it does not apply, or by recording it as something to confirm with the customer (`checklist_question` in `app/tools/assessment.py`, used by the evaluation and by calibration).
|
||||
- **Glossary:** Customer question.
|
||||
|
||||
Nothing is asked of the user during an Execution for these: they are reported. Whether an interactive Execution should put them to the user before the design is approved is not decided.
|
||||
|
||||
## The judge's question set
|
||||
|
||||
The owner's labels were not kept. The two saved documents predate the checklist review, so they hold neither statuses nor questions, and the question's wording has changed. The set has to be rebuilt from design recommendations produced after this step (`eval.calibrate_judge --build`, after replacing the two documents), and labelled again. That needs a run.
|
||||
|
||||
Tests: `tests/execution/test_pillars.py` (4 more).
|
||||
16
.agents/plans/iter-04-learning-and-skills/steps/step-9.md
Normal file
16
.agents/plans/iter-04-learning-and-skills/steps/step-9.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Step 9 — Implementation Detail
|
||||
|
||||
`docs/adr/0004-lessons-and-overlays-arrive-as-skills.md` was accepted by the owner on 2026-10-08, with its six decisions as written:
|
||||
|
||||
1. No lesson takes effect without a person's approval.
|
||||
2. A lesson is kept only if the evaluation, run with and without it, holds quality and lowers Revisions, time or tokens.
|
||||
3. Lessons are per Cloud provider, listed in that provider's bundle.
|
||||
4. Overlay Skills come only from directories the deployment configures; a caller names one and cannot upload one; an unknown name refuses the Execution at the start.
|
||||
5. Every Execution records the Skills it loaded and a content hash of each.
|
||||
6. Lesson candidates are client data: stored with the Execution's records, never in the repository, and a lesson carries no client detail.
|
||||
|
||||
`CONTEXT.md` gained **Lesson candidate**, **Lesson** and **Overlay Skill**. Steps 10 and 12 in `DETAIL.md` were updated to name the decisions they must meet.
|
||||
|
||||
Already in place from earlier steps: lesson candidates are captured per Execution (step 7) under a gitignored folder, and each Execution records the version of every Skill it loaded.
|
||||
|
||||
Not built: the curator and the lessons Skill (step 10), and overlay Skills chosen per Execution (step 12).
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Iteration:** 5, Jev decisions
|
||||
**Intent:** Use Jev, a hosted decision model, for the agent's closed questions (yes or no, pick one, rate on a scale) so that large-model calls are kept for writing and reasoning. The aims are fewer tokens, faster turns, and checks the engine cannot make with string matching.
|
||||
**Status:** steps 2, 11 and 12 built (2026-10-07); the rest planned. Step 1's answers are still open: the API key, rate limits and data retention. Build `../iter-06-target-architecture-graph/` first: it removes the need for step 5 here and changes what step 4 checks.
|
||||
**Status:** steps 2 to 12, 14, 15 and 19 are built or settled (2026-10-09); 16 awaits the owner's labels; 13 and 18 are planned; 1 and 17 await the owner
|
||||
**This directory covers:** steps 1 to 19
|
||||
|
||||
## What Jev is
|
||||
@@ -75,25 +75,25 @@ Jev answers closed questions. Writing Deliverables, grounding product choices an
|
||||
|
||||
| Step | What | Report ref | Status |
|
||||
|---|---|---|---|
|
||||
| 1 | Resolve the open questions | none | open, owner's input |
|
||||
| 1 | Resolve the open questions | none | the vendor's answers on retention, training, context and rate limits recorded on 2026-10-10, with the owner's decisions; retention for client work is held (`steps/step-1.md`) |
|
||||
| 2 | Decider interface and Jev client with limits | none | built on the TypeSafe SDK; unverified against the live service |
|
||||
| 3 | Pillars a Revision touches | J3 | planned |
|
||||
| 4 | Semantic checks at submission | J4 | planned |
|
||||
| 5 | Finding-to-Deliverable routing | J2 | planned |
|
||||
| 6 | Model tier per delegation | J5 | planned |
|
||||
| 7 | Context selection | J6 | planned |
|
||||
| 8 | Skill routing | J9 | planned |
|
||||
| 9 | In-run context compaction | J10 | planned |
|
||||
| 10 | Evaluation rubric and lesson triage | J8 | planned |
|
||||
| 3 | Pillars a Revision touches | J3 | built, as a graded question; calibrated live; ran in cases 05 and 06 on 2026-10-09 |
|
||||
| 4 | Semantic checks at submission | J4 | two reviews built, both off until a full case has run with them: coverage of the Target architecture, one choice per condition; and requirements name no products (`steps/step-4.md`) |
|
||||
| 5 | Finding-to-Deliverable routing | J2 | superseded: iteration 6 gives a verdict per Check, and the router sends a failed Check to the code and a gap to the Target architecture |
|
||||
| 6 | Model tier per delegation | J5 | built and measured: Flash for the IaC author's first attempt saved five cents and took twice the requests, so it stays off (`steps/step-6.md`) |
|
||||
| 7 | Context selection | J6 | decided against as planned: earlier Deliverables are a tenth of the describer's prompt (`steps/step-7.md`) |
|
||||
| 8 | Skill routing | J9 | built and on: the references a task needs are named in the Specialist's context; calibrated live; ran in cases 05 and 06 on 2026-10-09 (`steps/step-8.md`) |
|
||||
| 9 | In-run context compaction | J10 | decided against as planned: it would lose the prompt cache and cost more (`steps/step-9.md`) |
|
||||
| 10 | Evaluation rubric and lesson triage | J8 | built: the judged rubric (step 16) and triage of evidence a lesson already covers (iteration 4 step 10) |
|
||||
| 11 | ADR: Jev is the Orchestrator's decision point | none | complete: ADR-0007 accepted 2026-10-07 |
|
||||
| 12 | The Orchestrator routes by readings and a playbook; a model only writes replies | J1 | built for messages inside an Execution and validation outcomes; unverified against live Jev and by evaluation |
|
||||
| 13 | Cloud-read call guard | J7 | planned |
|
||||
| 14 | Input guardrail | J11 | planned |
|
||||
| 15 | Changes of meaning in a Change request | none | planned; needs iteration 7 |
|
||||
| 16 | Jev as the evaluation judge, calibrated | none | judge built; calibration against human labels open |
|
||||
| 12 | The Orchestrator routes by readings and a playbook; a model only writes replies | J1 | built, including intake of a message that starts something (`steps/step-12.md`); the three faults case 04 found are fixed; a completed interactive run is outstanding |
|
||||
| 13 | Cloud-read call guard | J7 | planned; cloud reads are off in every case, so it could not be exercised |
|
||||
| 14 | Input guardrail | J11 | built and on: an MCP reply that instructs the agent is withheld, the user's text is flagged; calibrated live; ran in cases 05 and 06 on 2026-10-09 |
|
||||
| 15 | Changes of meaning in a Change request | none | built: reworded items are listed apart in changes.json; calibrated live; ran in case 05, where nothing was reworded |
|
||||
| 16 | Jev as the evaluation judge, calibrated | none | judge and calibration built; the owner labelled the set on 2026-10-10, which showed the question was wrong, not the judges; the set is to be rebuilt and relabelled after iteration 4 step 29 (`steps/step-16.md`) |
|
||||
| 17 | Trace every decision | none | open, owner's decision on LangSmith |
|
||||
| 18 | Readings as their own graph step | none | planned |
|
||||
| 19 | Online evaluation of live Executions | none | planned; needs step 17 |
|
||||
| 18 | Readings as their own graph step | none | planned; it splits the Orchestrator turn that case 04 only just passes, to save a repeated Jev call after a crash |
|
||||
| 19 | Online evaluation of live Executions | none | built and on: each Execution's design recommendations are judged when it ends and the scores kept in its record; feedback on a trace waits on step 17 (`steps/step-19.md`) |
|
||||
|
||||
## Dependency graph
|
||||
|
||||
|
||||
37
.agents/plans/iter-05-jev-decisions/steps/step-1.md
Normal file
37
.agents/plans/iter-05-jev-decisions/steps/step-1.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Step 1 — The open questions, and the owner's decisions of 2026-10-10
|
||||
|
||||
## What the vendor says
|
||||
|
||||
Supplied by the owner on 2026-10-10. Not verified here against the vendor's documents.
|
||||
|
||||
| Question | Answer |
|
||||
|---|---|
|
||||
| Data retention | No fixed period for a standard account: data is kept "for as long as reasonably necessary". Zero data retention is available to enterprise customers on request, through Cloudflare Workers AI, or through Vercel AI Gateway. |
|
||||
| Model training | Customer prompts, inputs and outputs are not used to train or fine-tune the vendor's models. |
|
||||
| Context | 64,000 tokens a request in total, with 32,000 for the state plus the longest question. |
|
||||
| Rate limits | Up to 80 requests a second and 100,000 tokens a second on the standard hosted service, adjusted with platform traffic. |
|
||||
|
||||
Against the client's own limits (`JevLimits` in `app/tools/jev.py`): it caps a request at 48,000 and 24,000 tokens, inside the service's; and throttles itself to 5 requests a second with 8 in flight, a sixteenth of the service's rate. Nothing needs changing for either.
|
||||
|
||||
Still open: latency, and whether the vendor's SDK can be pointed at either gateway.
|
||||
|
||||
## What is sent to Jev
|
||||
|
||||
ADR-0007's decision 4 limits an Orchestrator decision to the Execution's state. The uses built since send content: the user's messages and the request (routing, intake, guardrail), replies from documentation servers (guardrail), the design recommendations (assessment), the text of Checks, Elements and recommendations (meaning), a change and the list of Elements (pillar selection, reference routing), and each requirement's text when the requirements review is on.
|
||||
|
||||
## The owner's decisions
|
||||
|
||||
| Question | Decision |
|
||||
|---|---|
|
||||
| Re-verify only what changed after a Revision | **No.** Every validation stays complete. The saving was 5 to 10% on some runs, and the risk fell on the validator. |
|
||||
| The requirements review (`JEV_REQUIREMENTS_REVIEW`) | **On for the next runs that happen anyway; the default if they are clean.** No run is to be made for it. Cases 01 and 02 are held until the owner says. |
|
||||
| Tracing (step 17) | **Held.** No decision. |
|
||||
| The judge against a person (step 16) | **The owner will label the 32 questions.** |
|
||||
| Jev's data retention, for client work | **Held.** No decision. |
|
||||
|
||||
## Advice given, with no decision asked
|
||||
|
||||
- With no training use, the remaining exposure is content kept by the vendor for an unstated time. Zero retention is the only route that costs the agent nothing. A switch that keeps Deliverable content away from Jev is a stopgap; even routing a reply sends that reply.
|
||||
- The owner may look for an open-source version of Jev. That would end the retention question. Its cost is that every threshold, tuned against the hosted model's probabilities, would need measuring again, and the two properties relied on (the same answer every time, clean separation) would need proving again. The agent is placed for it: one interface, every threshold a setting, every use a fallback.
|
||||
- **A gap either way:** the calibrations in this plan were made with one-off scripts; the example sets are not in the repository. Kept as a runnable suite they could be put to any model. Not built.
|
||||
- The owner's 32 labels are the one measure that depends on no model.
|
||||
@@ -34,3 +34,56 @@ Unverified:
|
||||
- Whether Jev's answers to these five questions are good enough at these thresholds. The thresholds are the ones in the owner's example and are untuned.
|
||||
- Whether the reply writer's summaries are accurate. It is instructed to state only the facts it is given; nothing checks that it does.
|
||||
- Run time. The Orchestrator made 31 model requests in the last run; the router makes none, and one small writer call per Approval. No run has measured it.
|
||||
|
||||
## Faults found by evaluation case 04, fixed on 2026-10-08
|
||||
|
||||
Case 04 is the first interactive run. It stopped at 100 Orchestrator turns (`../../iter-06-target-architecture-graph/steps/step-11.md`). Three changes:
|
||||
|
||||
1. **Only the user's own words are their message.** A reply to questions now reaches the router with the questions it answered (`asked`) and with any quoted question and `Q:`/`A:` labels removed from its text (`_own_words` in `app/nodes/execution_nodes.py`). `_read_message` gives the questions to the decider as background and the cleaned text as the message. Before, a describer's "please confirm my draft" question, quoted back by the scripted user, was judged a request to change the Target architecture, twice.
|
||||
2. **A Revision limit is told to the user once.** When a reopen is refused at the limit, the router records the Deliverable in `revision_limit_asked` and sets `awaiting_limit_decision`. The reply is not read as a request for changes, every action that would reopen that Deliverable is barred from then on, and the Execution carries on with it as it stands. Before, the reply was read as another change request for the same Deliverable and the refusal repeated until the turn limit.
|
||||
3. **A run that only asks is stopped.** The engine counts questions put to the user with no change in any Deliverable's status or attempt, or any Phase's status, in between. At the fourth it ends with a warning (`MAX_IDLE_ASKS`). This holds for any Orchestrator, whatever the cause.
|
||||
|
||||
Also: `agents/validator.md` now tells the validator to confirm with the user before submitting in an interactive Execution, which the case's `specialists_ask_before_submitting` check found it did not.
|
||||
|
||||
Tests: `tests/execution/test_router.py`, "the two faults of evaluation case 04" (5).
|
||||
|
||||
Rerun on 2026-10-08 (unfinished, 86 minutes): changes 1 and 2 held. A third fault appeared and is not fixed: a reply that restates a requirement, given in answer to a draft-confirmation question, is read as a request to change `requirements`. See the run record in `../../iter-06-target-architecture-graph/steps/step-11.md`.
|
||||
|
||||
## Finished on 2026-10-08: the third case 04 fault, and intake
|
||||
|
||||
**A reply that restates what is agreed is an answer.** `_read_message` now shows the decider the agreed `requirements.json` and asks one more noul, `already_agreed`: does the message only confirm or repeat what those requirements say? At 0.75 or more the reply is closed as an answer, whatever `asks_change` says. Measured against live Jev with requirements holding the facts being restated:
|
||||
|
||||
| Reply | asks_change | already_agreed | Disposition |
|
||||
|---|---|---|---|
|
||||
| Restates the GDPR and secrets requirement | 0.12 | 0.78 | close |
|
||||
| Restates the availability requirement | 0.26 | 0.48 | queue (asked once, then let go) |
|
||||
| Restates the retention requirement | 0.52 | 0.81 | close |
|
||||
| "Approved. Please proceed." | 0.04 | 0.70 | close |
|
||||
| Raises availability to 99.99% | 0.85 | 0.01 | act |
|
||||
| Changes retention from 2 years to 7 | 0.89 | 0.01 | act |
|
||||
| Adds SMS notifications and a mobile app | 0.85 | 0.01 | act |
|
||||
| Changes secret rotation to 30 days | 0.87 | 0.02 | act |
|
||||
|
||||
**Intake: a message that starts something is read first.** `app/nodes/intake.py` asks one choice of a message that arrives with no Execution in progress: new request, change request, or question. The A2A server (`app/a2a_server.py`) acts on it:
|
||||
|
||||
- a question, at 0.75 confidence or more, is answered with a short statement of what the agent does and starts nothing;
|
||||
- a change request, when the Customer case has a completed Execution, is started as a new request with a note saying Change requests are not available yet (iteration 7 builds them);
|
||||
- anything else, any reading that is not confident, and every pre-approved task starts an Execution as before.
|
||||
|
||||
Measured against live Jev on ten messages: two new requests, two questions, two change requests with an earlier Execution, a question about earlier work, a different new request for the same case, a change with nothing delivered (taken as new), and "hello" (0.53, taken as new). All ten as intended.
|
||||
|
||||
Not built: acting on a change request (iteration 7 step 2), and answering a question about earlier work from that work.
|
||||
|
||||
Tests: `tests/execution/test_intake.py` (4), `tests/a2a/test_server.py` "intake" (4), `tests/execution/test_router.py` (1).
|
||||
|
||||
## A question about delivered work is answered from it (2026-10-10)
|
||||
|
||||
Intake answered every question with a description of the service. A question read as about work already delivered in the caller's Customer case is now answered from that Execution's solution guide.
|
||||
|
||||
1. When intake reads a message as a question and the case has a completed Execution, a second yes or no is asked: is this about an architecture already delivered, or about the service in general. At 0.6 or above it is about delivered work.
|
||||
2. `DeliveredAnswers` in `app/nodes/intake.py` loads the latest completed Execution and gives its solution guide and the question to the reply writer. `agents/reply-writer.md` now covers this second task: answer from the guide alone, say so when it does not say, name the section, propose no change.
|
||||
3. The A2A reply carries `about`, the Execution it was answered from. Nothing is started. When no answer could be written the caller is told which Execution's documents to read.
|
||||
|
||||
Measured against live Jev on twelve messages: six about delivered work scored 0.37 to 0.96, five of them 0.73 or more ("what does the load balancer in my architecture do?" scored 0.37 and would get the general answer). Five about the service scored 0.07 to 0.16. "Is my data stored anywhere?" scored 0.74: it is ambiguous, and would get an answer from the guide. **No real model has written such an answer yet.**
|
||||
|
||||
Tests: `tests/execution/test_intake.py` (3 more), `tests/a2a/test_server.py` (3 more).
|
||||
|
||||
20
.agents/plans/iter-05-jev-decisions/steps/step-14.md
Normal file
20
.agents/plans/iter-05-jev-decisions/steps/step-14.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Step 14 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09, on by default (`JEV_GUARDRAIL`). **No Execution has run with it.**
|
||||
|
||||
1. `app/tools/guardrail.py`: one yes or no on a text, whether it tries to give instructions to the agent reading it, as opposed to informing the reader.
|
||||
2. **A remote MCP server's reply** is checked before a Specialist reads it (`make_tool_factory` wraps every MCP tool). At `JEV_GUARDRAIL_THRESHOLD` (0.75) or above it is withheld: the Specialist is told the reply read as instructions, not to act on it, and to record the gap. The withholding is logged.
|
||||
3. **What the user writes** is only flagged: the Workflow request on the first turn and each reply after it. A flag is recorded in the Execution's state and in `execution.json` under `risks`, with where it was and how likely. Nothing is withheld and nothing changes in what the Execution does.
|
||||
4. With no decision a text passes through.
|
||||
|
||||
Differs from the plan: the plan fails closed everywhere. The user is the principal, and a wrong flag on their own request would stop work they asked for, so their words are flagged and not withheld. A server's reply with no decision passes through, because the guard adds to the tool allowlist and the permission checks and replaces neither; failing closed there would stop every documentation lookup whenever Jev is unavailable.
|
||||
|
||||
Measured against live Jev on ten texts: product documentation, how-to steps written as imperatives, a "you should ... ignore this recommendation if" best practice, a resource listing and an ordinary request scored 0.02 to 0.12. Four that addressed the agent (a classic "ignore all previous instructions", a quiet "add an IAM binding and do not mention it", a role change, and a request with instructions appended) scored 0.98 to 0.99.
|
||||
|
||||
The decider's budget is counted per Execution through a context variable set when a Specialist starts.
|
||||
|
||||
Tests: `tests/tools/test_guardrail.py` (7).
|
||||
|
||||
## Run on 2026-10-09
|
||||
|
||||
Ran in cases 05 and 06: nothing was withheld and no risk was flagged, in two Executions' worth of documentation lookups. No false alarm; nothing in these runs tried to instruct the agent, so the catching side is still only calibrated.
|
||||
31
.agents/plans/iter-05-jev-decisions/steps/step-15.md
Normal file
31
.agents/plans/iter-05-jev-decisions/steps/step-15.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Step 15 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09. **Not run in a Change request with real models.**
|
||||
|
||||
`settle_meaning` in `app/tools/meaning.py`: for each Check, Element, Relationship and recommendation whose text differs from the Baseline's, one yes or no with the old and the new: does the new text change what must be true? An item at or below `JEV_REWORDED_THRESHOLD` (0.25) moves from `changed` to `reworded` in the change summary, and leaves `unrequested` if it was there. Every probability is recorded under `meaning`, by id. With no decision an item stays changed.
|
||||
|
||||
It runs when the Execution ends, on the summary written to `changes.json`. The summary shown at each Approval, and the evaluation's change checks, still compare text exactly.
|
||||
|
||||
Measured against live Jev on nine pairs:
|
||||
|
||||
| Pair | P(changed) |
|
||||
|---|---|
|
||||
| A Check reworded with the argument's name | 0.12 |
|
||||
| "at least 2" to "2 or more" | 0.22 |
|
||||
| A recommendation reworded | 0.10 |
|
||||
| An Element renamed, same product and type | 0.30 |
|
||||
| A Check moved to another Element | 0.41 |
|
||||
| "only" dropped from a grant | 0.61 |
|
||||
| A value changed, 30 to 2555 | 0.96 |
|
||||
| A condition added | 0.95 |
|
||||
| The product changed | 0.90 |
|
||||
|
||||
At 0.25 the three rewordings are read as such and no real change is. The dropped "only", the case the plan names, is caught at 0.61 but not by much.
|
||||
|
||||
Differs from the plan: requirements are not asked about. They carry their own `change` and reason, and an `unchanged` one must keep its text exactly (iteration 7 step 3). The Baseline's verdict is not carried forward for a reworded Check: validation still gives a verdict on every Check.
|
||||
|
||||
Tests: `tests/execution/test_change_requests.py`, "changed, or only reworded?" (2).
|
||||
|
||||
## Run on 2026-10-09
|
||||
|
||||
Ran in case 05's Change request. The Specialists changed no existing item's text: Checks and recommendations were added and removed by id, so there was nothing to settle and nothing listed as reworded.
|
||||
26
.agents/plans/iter-05-jev-decisions/steps/step-16.md
Normal file
26
.agents/plans/iter-05-jev-decisions/steps/step-16.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Step 16 — Implementation Detail
|
||||
|
||||
The judge (`eval/judge.py`: `DeciderJudge` for Jev, `GeminiJudge` for a language model) was built earlier. Built on 2026-10-08: the calibration.
|
||||
|
||||
1. `eval/datasets/judge/` holds two saved design recommendations (cases 02 and 03, from runs that passed) and `labels.json`: 32 questions about them, 12 checklist items and the 4 quality-rubric questions for each document, with `label` empty.
|
||||
2. `eval/calibrate_judge.py` asks both judges every question several times and reports, per judge, stability (the same answer to the same question across runs) and agreement with the labels, and agreement between the two judges. `--build` regenerates the question set. A new Jev client is used for each run, because the client caches identical requests and a cached answer would make stability look perfect.
|
||||
|
||||
Measured on 2026-10-08, three runs, no labels yet (`eval/datasets/judge/calibration.json`):
|
||||
|
||||
| | Jev | Gemini (the bundle's default model) |
|
||||
|---|---|---|
|
||||
| Stability | 1.00 | 0.92 |
|
||||
| Mean answer | 0.37 | 0.32 |
|
||||
| Agreement between the two | 0.91 | |
|
||||
|
||||
So Jev gave the same answer every time, the language-model judge changed its answer on about one question in twelve, and the two agree on nine in ten.
|
||||
|
||||
**Open, and the owner's to do:** fill in the 32 labels (1 or 0 for a yes_no question; 0, 0.33, 0.67 or 1 for a graded one) and run `.venv/bin/python -m eval.calibrate_judge` again. Only that gives agreement with a person, which is what decides the default judge.
|
||||
|
||||
Tests: `tests/eval/test_scoring.py`, "calibrating the judges" (2).
|
||||
|
||||
## The owner's labels, 2026-10-10
|
||||
|
||||
The owner labelled all 32: yes to every checklist item, "mostly" on every quality question. Against them Jev agreed on 28% and Gemini on 16%; the judges answer no to most checklist items (means 0.37 and 0.32), and agree with each other on 88%.
|
||||
|
||||
The disagreement was about the question, not the judges. The owner counts an item the request gives no information about as something to ask the customer, not as unaddressed. That is now an outcome of the checklist review and part of the judged question (iteration 4 step 29). The labels were not kept, and the set is to be rebuilt from documents produced after that change.
|
||||
22
.agents/plans/iter-05-jev-decisions/steps/step-19.md
Normal file
22
.agents/plans/iter-05-jev-decisions/steps/step-19.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Step 19 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09, on by default (`JEV_ASSESS_EXECUTIONS`). **No Execution has run with it.**
|
||||
|
||||
1. `app/tools/assessment.py` holds the graded rubric the evaluation uses for design recommendations (specific, actionable, trade-offs, traceable) and the bar (a mean of 0.67). `eval/scoring.py` and `eval/judge.py` now take the rubric, the bar and the grades from there, so a live Execution and a benchmark case are asked the same questions.
|
||||
2. When an Execution ends, completed or with warnings, its design recommendations are put to the decider once. The four scores, their mean and whether it meets the bar are kept in the Execution's state and in `execution.json` under `assessment`. A mean below the bar is logged as a warning.
|
||||
3. It reports only. Nothing stops or changes, and a failure to assess leaves the Execution with no assessment.
|
||||
4. Risk flags (step 14) are already in `execution.json` under `risks`.
|
||||
|
||||
Differs from the plan:
|
||||
|
||||
- **Only the quality rubric is asked.** Checklist coverage is already settled inside every Execution by the pillar checklist review (iteration 4), in code. The structural checks need a case's expected products, which a live Execution does not have.
|
||||
- **Nothing is sent as feedback on a trace.** That part waits on step 17 and the owner's decision on LangSmith.
|
||||
- **No alerting.** A low score is a log line and a field in the record; nothing watches for it.
|
||||
|
||||
The judge behind it was measured in step 16: Jev answered the same question the same way every time (1.00) and agreed with Gemini on 0.91 of questions. Agreement with a person still awaits the owner's 32 labels.
|
||||
|
||||
Tests: `tests/execution/test_assessment.py` (5).
|
||||
|
||||
## Run on 2026-10-09
|
||||
|
||||
Both Executions carry an assessment in `execution.json`: case 06 a mean of 0.74 (specific 0.76, actionable 0.77, trade-offs 0.75, traceable 0.69); case 05's Change request 0.90. Both meet the bar of 0.67.
|
||||
27
.agents/plans/iter-05-jev-decisions/steps/step-3.md
Normal file
27
.agents/plans/iter-05-jev-decisions/steps/step-3.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Step 3 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09. **Not run in an Execution with real models.**
|
||||
|
||||
1. `pillars_touched` in `app/tools/pillars.py` asks one graded question per pillar: how directly does this change affect the pillar's recommendations (not at all, only indirectly, directly). A pillar at `JEV_PILLAR_THRESHOLD` (1.5 on that 0 to 2 scale) or above is consulted again. An empty list means the change touches none; no decision means consult them all.
|
||||
2. When the design advisor is started on a Revision, or in a Change request, and advice from an earlier consultation exists, the engine asks which pillars the change touches (`_pillar_hints` in `app/nodes/execution_nodes.py`) and puts the answer in its context as `pillars_to_consult`. The change is the Deliverable's feedback, or in a Change request the requirements added, changed and removed.
|
||||
3. `consult_pillar_advisors` with an empty list consults nobody and returns the advice already given.
|
||||
4. A completed Execution writes `working.json`: each pillar's advice and checklist review. A Change request starts from its Baseline's, so the pillars a change does not touch are not consulted again. In the first Change request, before this, the design advisor consulted all six afresh and that was its longest step.
|
||||
|
||||
Differs from the plan: the plan asked a yes or no per pillar. Measured against live Jev on six changes, that was yes for nearly every pillar every time (0.39 to 0.96 across the five real changes). The graded form separates them:
|
||||
|
||||
| Change | Pillars at "directly" |
|
||||
|---|---|
|
||||
| Retention to 7 years, undeletable | security, reliability, operations, cost, sustainability |
|
||||
| Survive the loss of a region | reliability, operations, cost |
|
||||
| Budget halved | operations, cost, performance, sustainability |
|
||||
| Page load 1 s to 300 ms | operations, cost, performance |
|
||||
| A page title renamed | none |
|
||||
| Customer-managed keys for one bucket | security |
|
||||
|
||||
Operations and cost are picked for almost every real change, so the saving is two to five advisors of six, not five of six.
|
||||
|
||||
Tests: `tests/execution/test_pillars.py` (3), `tests/execution/test_change_requests.py` (2).
|
||||
|
||||
## Run on 2026-10-09
|
||||
|
||||
`case-05-change-retention` (results `20261009T171336Z`): the Change request consulted 5 pillar advisors, not 6, which is what calibration predicted for this change. The Change request took about 18 minutes and 1.30 million tokens against the Baseline's 30 minutes and 3.09 million (42%), passed every change check, and changed nothing unrequested (0 of 89).
|
||||
61
.agents/plans/iter-05-jev-decisions/steps/step-4.md
Normal file
61
.agents/plans/iter-05-jev-decisions/steps/step-4.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Step 4 — Implementation Detail
|
||||
|
||||
Built on 2026-10-07 for one check only, and left switched off until a full case has run with it. The first form failed a live test; the second passed one. Both are recorded here.
|
||||
|
||||
What was built:
|
||||
|
||||
1. A seam: `SubmissionReview` in `app/adk/runtime.py`, passed through `ExecutionEngine`, `build_execution_graph` and `make_execution_nodes` to `specialist_tools`. After a submission passes its structural contract, the review may raise items; they are returned to the Specialist as a refusal once per run, and the next submission is accepted whatever the review would say. A review that fails or decides nothing never stops a submission.
|
||||
2. `CoverageReview` in `app/tools/coverage.py`, for the Target architecture. Its first form: one noul question per non-functional requirement and per design recommendation (not those marked not applicable), giving its text and the Checks that name it as source, with the Elements and Relationships as the state.
|
||||
3. `JEV_COVERAGE_REVIEW`, default `false`. The assembly installs the review only when it is `true` and a Jev key is set.
|
||||
|
||||
## Why the first form failed
|
||||
|
||||
Case 02 (`eval/results/20261007T190702Z/`) needed two Revisions because validation proposed additions for NFR-8, then NFR-10, DR-10 and NFR-1. The review was run against live Jev on that case's final graph, which validation passed with nothing proposed, and on a copy with the Checks those Revisions added removed:
|
||||
|
||||
| Question asked | On the complete graph | On the graph with 4 known gaps |
|
||||
|---|---|---|
|
||||
| "Does it state a condition none of these Checks verifies?" at 0.75 | raised 7 of 28 | raised 6; caught 1 of the 4 |
|
||||
| "Do these Checks verify everything it asks?" (probability of yes) | mean 0.33 over the other 24 | the 4 fell (0.10 to 0.04, 0.34 to 0.11, 0.16 to 0.14, 0.28 to 0.14); the other 24 stayed at 0.33 |
|
||||
| Score: none, part, all | mean 1.24 of 2 over the other 24 | the 4 fell by 0.06 to 0.55; the others unchanged |
|
||||
|
||||
Removing Checks moves the answer the right way and leaves unrelated items where they were, so Jev does read coverage. But it scores most of a design that passed validation as incomplete, so no threshold separates the two. Each call took 0.4 seconds and about 4,000 tokens.
|
||||
|
||||
## The form that works: one choice per condition
|
||||
|
||||
The same day, two of Jev's patterns were applied: a task-completion check against an explicit checklist, and a choice with "none" among the options in place of a yes or no.
|
||||
|
||||
1. Requirements and recommendations list their `conditions`: one entry for each separate thing that must be true. `check_requirements` and `check_recommendations` refuse a non-functional requirement or a recommendation without them. `conditions_of` reads an older item as one condition, its text.
|
||||
2. `CoverageReview` asks, per condition, "which one Check verifies this condition?" with that source's Check ids and `none` as the options. A condition answered `none` with a probability of at least `JEV_COVERAGE_THRESHOLD` (0.6) is raised, as `NFR-1: no Check verifies "<condition>" (its Checks: ...)`.
|
||||
|
||||
Measured on the same two graphs, with nine conditions written by hand (four the known gaps, five covered):
|
||||
|
||||
| | Complete graph | Graph with the 4 gaps |
|
||||
|---|---|---|
|
||||
| The 4 gap conditions | a Check chosen each time | `none` each time, probability 0.72 to 1.00 |
|
||||
| The 5 covered conditions | a Check chosen; `none` at most 0.40 | a Check chosen; `none` at most 0.45 |
|
||||
| Raised at 0.6 | 0 | 4 of 4, and nothing else |
|
||||
|
||||
Each call: about 0.25 seconds and 2,000 tokens. `tests/execution/test_coverage_live.py` repeats this through `CoverageReview` itself and is opt-in (`LIVE_JEV=1`); it passed on 2026-10-07.
|
||||
|
||||
Still off (`JEV_COVERAGE_REVIEW=false`), because three things are unproven:
|
||||
|
||||
- The conditions in that test were written by a person. In an Execution the requirements analyst and the design advisor write them, and the review is only as good as that list.
|
||||
- Nine conditions from one case is a small sample; one covered condition scored `none` at 0.45 against a threshold of 0.6.
|
||||
- A condition that applies to several Elements and has a Check on one of them is answered with that Check. NFR-8 was caught here only because the condition named the Element.
|
||||
|
||||
Turn it on for a full case before relying on it.
|
||||
|
||||
Not built from the plan's design: the other semantic checks (requirements name no products, every recommendation cites a source, the Deliverable addresses its task).
|
||||
|
||||
Tests: `tests/execution/test_coverage_review.py`, with a scripted decider.
|
||||
|
||||
## Added on 2026-10-08
|
||||
|
||||
**What code cannot show is listed apart.** The first full run with the coverage review raised conditions such as an availability percentage, which no Check can verify. A requirement or recommendation now lists under `conditions` only what infrastructure configuration can show, and under `outside_code` what it cannot: an outcome measured in operation, behaviour of the application's own code, a process. `check_requirements` and `check_recommendations` require at least one entry between the two. `chain_gaps` asks for no Check from a constraint with `"conditions": []` and something under `outside_code`. The target architect writes no Check for `outside_code`; the validator proposes nothing for it and names it as something to verify after deployment.
|
||||
|
||||
Measured before the split, on the designs of two runs that passed validation with nothing proposed, using the conditions the agents themselves wrote: the coverage review raised 14 of 66 (case 02) and 8 of 51 (case 03). About half were of the kind the split removes (availability, recovery time, throughput, latency, what the application logs). The rest look like real gaps the validator did not report (three zones, cost labels, a load balancer). It has not been measured since the split, which needs new runs.
|
||||
|
||||
**Requirements name no products.** `RequirementsReview` in `app/tools/requirements_review.py` asks one noul per requirement: does it name a cloud provider's product or managed service? It is a third review on the same seam, behind `JEV_REQUIREMENTS_REVIEW` (off), with its own threshold, `JEV_REQUIREMENTS_THRESHOLD`, 0.3. Measured against live Jev: across the 61 requirements of three passed runs the highest answer was 0.10, so nothing was raised; requirements written to name a product scored 0.93 (Cloud Run), 0.61 (Secret Manager) and 0.34 (a Pub/Sub topic), and a database engine or a region scored 0.10 or less. At 0.3 that is three of three caught and none of 65 raised wrongly. Three written examples is a small sample.
|
||||
|
||||
Tests: `tests/execution/test_coverage_review.py` (2 more), `tests/execution/test_requirements_chain.py` (2 more).
|
||||
|
||||
37
.agents/plans/iter-05-jev-decisions/steps/step-6.md
Normal file
37
.agents/plans/iter-05-jev-decisions/steps/step-6.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Step 6 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09, **off by default** (`MODEL_TIERS`) until measured.
|
||||
|
||||
Where case 06's cost went (`20261009T171333Z`, about $3.84 at the prices in the plan map):
|
||||
|
||||
| Role | Model | Requests | Prompt tokens | Of them cached | Cost |
|
||||
|---|---|---|---|---|---|
|
||||
| validator | Pro | 22 | 1,025,080 | 82% | $1.04 |
|
||||
| target-architect | Pro | 24 | 686,263 | 69% | $1.02 |
|
||||
| iac-author | Pro | 16 | 434,234 | 60% | $0.63 |
|
||||
| describer | Flash | 13 | 675,284 | 86% | $0.16 |
|
||||
| packager | Flash | 4 | 233,373 | 72% | $0.17 |
|
||||
| the other six | mixed | 38 | 371,088 | | $0.82 |
|
||||
|
||||
The three roles on the Pro model are 70% of the cost. For each, output and thinking tokens cost about as much as the prompt.
|
||||
|
||||
1. `models.first_attempt` in the provider bundle names a lighter model for a role's first attempt at a Deliverable. With `MODEL_TIERS` on, the role takes it when nothing has been asked of the Deliverable again: there is no feedback on it, and no earlier attempt ended without one. Any other attempt takes the role's own model.
|
||||
2. Only the IaC author is named, on Flash. Its work is checked twice by something else: `terraform validate`, and the validator.
|
||||
3. The validator is deliberately not named, though it costs the most. It is the check on the code. A weaker validator that passed everything would raise the evaluation's score, so the evaluation could not tell a saving from a loss.
|
||||
4. The target architect is not named: its mistakes are what cause Revisions, which cost far more than its own tokens.
|
||||
5. Usage is reported per role and model, so a run shows what each tier used.
|
||||
|
||||
Differs from the plan: **there is no Jev question.** The plan asks Jev to pick a tier from the task. There is no data yet saying which tasks a lighter model handles, so any threshold would be a guess. The rule is the plan's second sentence alone: a Revision after a failed attempt goes to the stronger tier.
|
||||
|
||||
Expected saving if quality holds: about $0.40 of a $3.84 run, roughly 10%. Tests: `tests/execution/test_model_tiers.py` (3).
|
||||
|
||||
## Measured on 2026-10-09: no saving, so it stays off
|
||||
|
||||
Case 03, one run each, side by side (`20261009T195607Z` without tiers, `20261009T195611Z` with):
|
||||
|
||||
| | Pro throughout | Flash for the first attempt |
|
||||
|---|---|---|
|
||||
| IaC author's first attempt | 17 requests, $0.44 | 35 requests, $0.39 |
|
||||
| Case result | 100% | 100% |
|
||||
|
||||
Flash wrote code that validated and passed every Check, but took twice the requests to get there: 35 of its budget of 40, and 336 seconds. Five cents saved, at the edge of the tool budget, is not a saving worth the risk of an attempt that runs out. `MODEL_TIERS` stays off. The run with tiers also had a Revision of the Target architecture that the other did not, which is unrelated to the tier and makes the whole-run totals ($3.02 against $2.44) not comparable.
|
||||
11
.agents/plans/iter-05-jev-decisions/steps/step-7.md
Normal file
11
.agents/plans/iter-05-jev-decisions/steps/step-7.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Step 7 — Decision
|
||||
|
||||
Decided on 2026-10-09: **not to be built as planned.** The numbers do not support it.
|
||||
|
||||
The plan passes only the relevant sections of earlier Deliverables to the describer and the packager, to cut their tokens.
|
||||
|
||||
- **The describer's prompt is not earlier Deliverables.** In case 06 it was given the Target architecture, about 7 thousand tokens, and its prompt averaged 52 thousand per request. The rest is its Skill and the results of seven documentation searches, which accumulate. Trimming the Target architecture would save about a tenth of its prompt.
|
||||
- **The packager needs what it is given.** It assembles the guide from every Deliverable's prose, in four requests.
|
||||
- **Both are on Flash.** Together they cost $0.33 of a $3.84 run, and 80% of their prompt is cached at a tenth of the price.
|
||||
|
||||
What would cut the describer's tokens is fewer or shorter documentation searches, which is a change to its role file, not a Jev decision.
|
||||
39
.agents/plans/iter-05-jev-decisions/steps/step-8.md
Normal file
39
.agents/plans/iter-05-jev-decisions/steps/step-8.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Step 8 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09, on by default (`JEV_SKILL_ROUTING`). **No Execution has run with it.**
|
||||
|
||||
1. `app/tools/skill_routing.py`. A Skill with four or more reference files is one worth routing within; each reference is described by its title and first paragraph. Today that is `google-cloud-iac-patterns` (14 references), which only the IaC author loads.
|
||||
2. When a Specialist whose Skills include such a Skill is started, the engine asks one graded question per reference: how much does this task need a reference on this (not needed, might help, needed). The task is the Deliverable, any feedback, and the Target architecture's Elements with their products and resource types.
|
||||
3. References at `JEV_SKILL_THRESHOLD` (1.25 on that 0 to 2 scale) or above are named in the Specialist's context as `read_first`. The protocol says to read those first, and that it is a place to start, not a limit.
|
||||
4. With no decision nothing is named, and the Specialist searches its Skills as before.
|
||||
|
||||
Measured against live Jev on four tasks, each reference scored 0 to 2:
|
||||
|
||||
| Task | Named at 1.25 | Highest not named |
|
||||
|---|---|---|
|
||||
| Web app: Cloud Run, Cloud SQL, Secret Manager, load balancer, IAM, VPC | service, SQL, secrets, load balancer, IAM, networking, project services, Artifact Registry | KMS 0.72 |
|
||||
| Nightly batch: Cloud Run job, Scheduler, Storage, IAM | job, scheduler, storage, IAM, project services, Artifact Registry | Secret Manager 0.90 |
|
||||
| Events: Pub/Sub, Cloud Run, Artifact Registry, KMS, Monitoring | all seven it needs | Secret Manager 1.09 |
|
||||
| A Revision: one failed Check on a bucket's retention | storage only | project services 0.96 |
|
||||
|
||||
The Cloud Run service pattern scored 1.39 and 1.42 where it was needed, which is why the threshold is 1.25 and not 1.5. The cost of that is the Artifact Registry pattern being named for two designs that run containers and did not list a registry.
|
||||
|
||||
Differs from the plan:
|
||||
|
||||
- **A graded question per reference, not one Choice.** A task needs several references, and a Choice names one.
|
||||
- **Overlay Skills are not selected by Jev.** The caller or the deployment names them (iteration 4 step 12): which organisation's standards apply is not something to infer.
|
||||
- **Not measured against its acceptance criterion.** Whether `load_skill_resource` calls fall needs a case run with it and one without.
|
||||
|
||||
Tests: `tests/execution/test_skill_routing.py` (5).
|
||||
|
||||
## Run on 2026-10-09
|
||||
|
||||
Ran in cases 05 and 06. The IaC author was named 7 references for the web application (service, SQL, IAM, load balancer, networking, project services, secrets) and 9 for the event-driven service; on the Change request, 3 (KMS, monitoring, Pub/Sub). Both cases passed. Whether `load_skill_resource` calls fell was not measured.
|
||||
|
||||
One to look at: for the retention change, whose subject is a bucket, the Cloud Storage reference was not among the three named.
|
||||
|
||||
## Corrected and changed later on 2026-10-09
|
||||
|
||||
The "one to look at" above was misread. The three references (KMS, monitoring, Pub/Sub) were named for a Revision inside the Baseline, from that Revision's feedback. The Change request itself was named nine, Cloud Storage among them.
|
||||
|
||||
What it did show is that a Change request's question listed every Element and not what changed. The task now says what has changed since delivery. Against live Jev on case 05's change, Cloud Storage rose from 1.63 to 1.95, the highest of all, and the load balancer, monitoring and Secret Manager patterns fell below the threshold.
|
||||
11
.agents/plans/iter-05-jev-decisions/steps/step-9.md
Normal file
11
.agents/plans/iter-05-jev-decisions/steps/step-9.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Step 9 — Decision
|
||||
|
||||
Decided on 2026-10-09: **not to be built as planned.** It would be likely to raise cost, not lower it.
|
||||
|
||||
The plan drops or truncates old tool results inside one agent run before each model request.
|
||||
|
||||
- **The prompt is already mostly cached.** In case 06 the validator's prompt was 82% cached, the target architect's 69% and the IaC author's 60%, and a cached token costs a tenth of an uncached one.
|
||||
- **Caching depends on the prompt's beginning staying the same.** Removing or shortening an earlier tool result changes everything after it, so the request that follows is paid at the full price.
|
||||
- **The arithmetic.** A request of 46 thousand tokens, 82% cached, costs about $0.024 on the Pro model. Cut to 30 thousand with the cache lost, it costs $0.060.
|
||||
|
||||
It could still help where a run nears the model's context limit, which no run has. The cost that remains in these roles is output and thinking tokens, and the number of requests; neither is what this step addresses.
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Iteration:** 6, the Target architecture graph
|
||||
**Intent:** Establish the Target architecture as one explicit graph of Elements, Relationships and Checks before any infrastructure code is written, and derive and check every later Deliverable from it, so that the outcome is understood before code exists and validation has a fixed bar.
|
||||
**Status:** steps 1 to 10 built and covered by the deterministic suite; nothing has run against a real model; step 11's evaluation run is on hold by the owner
|
||||
**Status:** complete. Steps 1 to 10 built; all four cases, the interactive one included, completed twice with real models on 2026-10-08 and the thresholds are set (`steps/step-11.md`)
|
||||
**This directory covers:** steps 1 to 11
|
||||
|
||||
## Order of work
|
||||
@@ -56,7 +56,9 @@ flowchart TD
|
||||
| 8 | Deployment guidance implements the graph | M | complete |
|
||||
| 9 | Validation gives a verdict per Check | M | complete |
|
||||
| 10 | Revision routing: the code or the graph | S | complete; routing unproven with a real model |
|
||||
| 11 | Evaluation: prove the loop converges | M | checks built; evaluation run outstanding (on hold by the owner) |
|
||||
| 11 | Evaluation: prove the loop converges | M | complete: all four cases pass, each run twice on 2026-10-08; thresholds set (`steps/step-11.md`) |
|
||||
| 12 | Why the Target architecture is revised | S | investigated 2026-10-10: two causes, about half each; two instructions changed; the design-time coverage review it proposed is step 13 (`steps/step-12.md`) |
|
||||
| 13 | A model reviews coverage at design time | M | built and measured on 2026-10-10: it did not prevent the validator's gaps and made designs larger; left off (`steps/step-13.md`) |
|
||||
|
||||
Size: S under a day, M a few days.
|
||||
|
||||
|
||||
@@ -56,3 +56,180 @@ Changes this points to, not yet made:
|
||||
- Have the validator distinguish "the code does not do this" from "this cannot be done to this resource".
|
||||
- Check a proposed addition against the Element it names before it becomes a Check.
|
||||
- Raise or tune the model timeout for the target architect.
|
||||
|
||||
## Run of 2026-10-07, 16:59 UTC (`eval/results/20261007T165920Z/`)
|
||||
|
||||
Case 01 again, after iteration 4 steps 11, 13 and 17 to 20 and the router of iteration 5. Not judged.
|
||||
|
||||
| | Run of 12:59 | This run |
|
||||
|---|---|---|
|
||||
| Status | completed with warnings | completed |
|
||||
| Score | 73% | 100% (11 of 11 checks) |
|
||||
| Seconds | 3,627 | 1,091 |
|
||||
| Tokens | 4.25 million | 2.38 million |
|
||||
| Revisions | Revision limit reached | none |
|
||||
| Model timeouts | target architect, both attempts | none |
|
||||
| `terraform validate` failures | 13 | 0 |
|
||||
| IaC author | 57 requests, 2.35 million tokens | 11 requests, 271 thousand tokens |
|
||||
| Target architect | timed out twice | 55 requests, 1.15 million tokens |
|
||||
|
||||
The graph had 13 Elements, 17 Relationships and 42 Checks. The code met all 42 on the first validation; no Check was unimplementable or not verifiable, and nothing was proposed. The Orchestrator was the router: 11 turns, no model chose an action, and no decision needed Jev.
|
||||
|
||||
What went wrong: the target architect exhausted its 30 tool calls on its first attempt. It made 39 `terraform_schema` calls for a graph with 8 distinct resource types, one per setting, as its instructions told it to. Its second attempt started from the working graph and submitted in 92 seconds. Changed after the run: it is told to look up each distinct resource type once, `find` takes several names in one call, and its budget is 45. That change has not been run.
|
||||
|
||||
Acceptance criteria: met for case 01. Still open: cases 02 to 04 have not run on this build, so "all benchmark cases" and the thresholds are unset.
|
||||
|
||||
## Run of 2026-10-07, 19:07 UTC (`eval/results/20261007T190702Z/`)
|
||||
|
||||
Case 02, on commit `f1f6f1b`. Completed, 100% (11 of 11 checks), no warnings: 1,781 seconds and 4.78 million tokens; 904 seconds to the first validation.
|
||||
|
||||
- The graph ended with 20 Elements, 23 Relationships and 54 Checks. The code passed every Check in all three validations; no Check failed, was not verifiable or unimplementable.
|
||||
- The Target architecture was revised twice, both for proposed additions: 1 after the first validation, 3 after the second, 0 after the third. The set of gaps did not shrink between the first two passes, so the loop converged without the criterion "never grows" holding.
|
||||
- The router asked Jev whether each gap was material: 0.92 and 0.88, both above the 0.75 threshold. This is the first use of Jev inside an Execution.
|
||||
- The target architect made 17 schema lookups in its first attempt (39 in case 01) and did not exhaust its budget.
|
||||
- By role: IaC author 56 requests and 1.32 million tokens; target architect 57 and 1.20 million; describer 24 and 942 thousand, rewriting the description on each Revision.
|
||||
|
||||
Changed after the run, not yet run: iteration 4 steps 21 and 22.
|
||||
|
||||
Acceptance criteria: cases 01 and 02 complete at 1.0. Cases 03 and 04 have not run on this build.
|
||||
|
||||
## Run of 2026-10-07, 19:58 UTC, cancelled (`.cache/eval-logs/`; no report)
|
||||
|
||||
Case 02 again on commit `5adc911`, with `JEV_COVERAGE_REVIEW=true`. Cancelled by the owner at 66 minutes, during a fifth validation. No score and no token count were written.
|
||||
|
||||
- The Target architecture was reopened 3 times (the limit): twice for a Check the code's author reported as unimplementable, once for additions validation proposed. The code was reopened twice for failed Checks. Target architect 5 runs, IaC author 6, validator 5.
|
||||
- 6 model timeouts, 5 of them the validator writing all its verdicts in one reply: about 15 minutes.
|
||||
- The coverage review raised 5, 10, 11 and 9 of 61 conditions over four submissions. Validation still proposed a TLS policy and an access grant afterwards. The agents had written conditions no infrastructure code can prove, such as an availability percentage, and Jev answered "none" to those. It stays off.
|
||||
- What held: the description was kept on two Revisions (iteration 4 step 21); the unimplementable-Check route sent the design back before any validation was spent (step 19); code fixes took 1 to 5 minutes from the working copy; no `terraform validate` failure.
|
||||
|
||||
Changed after it, not yet run: iteration 4 steps 23 and 24.
|
||||
|
||||
## Run of 2026-10-08, 08:39 UTC (`eval/results/20261008T083917Z/`)
|
||||
|
||||
Case 02 on commit `58e778c`, coverage review off. Completed, 100% (11 of 11 checks), no warnings, no Revision: about 24 minutes, an estimated $3.52.
|
||||
|
||||
- The graph had 21 Elements, 22 Relationships and 102 Checks, against 54 in the run of 19:07 the day before. The requirements and recommendations now list their conditions, and the target architect wrote a Check for each. Validation passed all 102 and proposed nothing.
|
||||
- No Check was unimplementable, and the schema review raised nothing at submission.
|
||||
- No model timeout. The validator exhausted its 15 tool calls on its first attempt with verdicts recorded; its second attempt carried on from them and submitted in 68 seconds. Its budget was raised to 30 after the run.
|
||||
- The target architect took 388 seconds and 29 requests (21 `graph_put`, 15 schema lookups): now the slowest and most expensive step.
|
||||
|
||||
Case 02 across its three runs: 30 minutes with 2 Revisions; cancelled at 66 minutes; 24 minutes with none. One clean run does not show the variance is gone.
|
||||
|
||||
Acceptance criteria: cases 01 and 02 complete at 1.0, case 02 now with no Revision. Cases 03 and 04 were started after this run.
|
||||
|
||||
## Run of 2026-10-08, 10:33 UTC (`eval/results/20261008T103338Z/`)
|
||||
|
||||
Cases 03 and 04, on `58e778c` with the validator's budget raised to 30 (uncommitted).
|
||||
|
||||
**Case 03 (internal web app, pre-approved): completed, 100%, no warnings.** 40 minutes (25 to the first validation), 5.21 million tokens, an estimated $5.10. The code passed every Check in all three validations. The Target architecture was revised twice for proposed additions: region choices for a carbon-free-energy requirement, then a role grant for database access. The description was kept on the first Revision and rewritten on the second, which added an Element. No timeout, no `terraform validate` failure, no unimplementable Check. The validator was the most expensive role (31 requests, about $1.78).
|
||||
|
||||
**Case 04 (the same workload, interactive): completed with warnings, 75%.** 53 minutes, 8.72 million tokens, an estimated $8.11. It stopped at the limit of 100 Orchestrator turns. Three checks failed: completed, the guide (never packaged), and `specialists_ask_before_submitting` for validation results.
|
||||
|
||||
What went wrong in case 04, in order:
|
||||
|
||||
1. **A reply to a Specialist's question was read as a change request.** The scripted user replies with `Q: <the question> A: <the answer>`. The router gives that whole text to Jev as the user's message. Twice, a describer's question asking the user to confirm its draft, echoed back, was judged a request to change the Target architecture (asks_change 0.76 to 0.78), and the design was reopened with the question as the reason. With one real unimplementable Check, that used all three Revisions.
|
||||
2. **At the Revision limit the router loops.** Validation then proposed an addition; reopening was refused at the limit; the router asked the user; the reply was again read as a change request for the same Deliverable; the reopen was refused again. 40 escalations in two seconds, each question nesting the last, until the turn limit. No model ran in the loop, but Jev was called each time (73 judged decisions in the run).
|
||||
3. The validator submitted without confirming a draft with the user, which the interactive protocol asks of every Specialist.
|
||||
|
||||
What held in case 04: every Specialist's questions reached the user and their answers came back; four Approvals were granted by structured decisions; the unimplementable-Check route fired once, correctly; the code validated.
|
||||
|
||||
Acceptance criteria: cases 01, 02 and 03 complete at 1.0. Case 04 does not complete. "At most one Revision of deployment guidance in two of three cases" holds (none in 01, 02 and 03). The thresholds remain unset until case 04 passes.
|
||||
|
||||
Not yet fixed: the two router faults above.
|
||||
|
||||
## Run of 2026-10-08, 12:22 UTC, unfinished (`.cache/eval-logs/case-04-20261008T122200Z.log`; no report)
|
||||
|
||||
Case 04 again, with the three router fixes of iteration 5 step 12 (uncommitted at the time). The process stopped at about 14:48 local time, 86 minutes in, when the session that started it ended. It was not cancelled and wrote no score, report or token count.
|
||||
|
||||
What the fixes did:
|
||||
|
||||
- No reopen came from a question quoted back in a reply.
|
||||
- At 14:41 `requirements` reached its Revision limit. The user was told once and the Execution carried on; there was no loop.
|
||||
- The schema review raised items at submission twice (1, then 3), its first use in a real Execution.
|
||||
- The unimplementable-Check route fired once and the design was revised in 92 seconds; the description was kept.
|
||||
|
||||
What went wrong:
|
||||
|
||||
1. **A scripted answer was read as a new requirement, three times.** The scripted user answers by matching words in the question against patterns written for the requirements analyst. Asked by the validator, and later the design advisor and the IaC author, to confirm a draft, it replied with requirement statements ("GDPR applies to employee names and emails...", "99.5% during business hours...", "PostgreSQL. Under 20 GB..."). Jev read each as a request to change `requirements`, and the router reopened it: twice, then the limit. Each reopen returned every later Deliverable to draft, so the Execution was redone from the start twice.
|
||||
2. Validation failed one Check twice (an alert condition; a log bucket not locked). Each was sent back to the code, which is the intended route.
|
||||
|
||||
The cause of the first is mostly the harness: no person answers "please confirm my draft" with a requirement. It also shows a weakness in the router: a reply that restates what a submitted Deliverable already says is treated as a request to change it.
|
||||
|
||||
Not yet changed:
|
||||
|
||||
- Scripted answers should apply only to the Specialist they were written for, and a draft-confirmation question should get an approval.
|
||||
- A reply that restates what a submitted Deliverable already says should be read as an answer.
|
||||
|
||||
Acceptance criteria: unchanged. Cases 01, 02 and 03 complete at 1.0; case 04 has one completed run at 0.75 and this unfinished one.
|
||||
|
||||
## Changes to the evaluation after the unfinished run (2026-10-08)
|
||||
|
||||
- A scripted answer may name who it is for: `[pattern, answer, asker]`. Case 04's fourteen facts are tagged for `requirements`; any other Specialist, and the Orchestrator, gets "Approved. Please proceed." (`automatic_reply`, `eval/datasets/solution_cases.json`).
|
||||
- The evaluation writes `<case>-progress.json` in the run folder after every agent run: seconds, runs, outcomes, tokens and the timeline so far. A run that is cut off leaves it behind with `"finished": false`.
|
||||
|
||||
## Runs of 2026-10-08, 14:25 UTC: all four cases, twice (`eval/results/20261008T142509Z/` and `...142514Z/`)
|
||||
|
||||
Two batches run side by side on the build with the case 04 changes, intake and the `outside_code` split (uncommitted at the time). Batch B added the judged checks. All eight runs completed; none ended with warnings.
|
||||
|
||||
| Case | Batch A | Batch B (judged) |
|
||||
|---|---|---|
|
||||
| 01 | 1.00, 31 min, 3.42 M tokens, 1 Revision | 0.92, 39 min, 4.06 M, 1 Revision |
|
||||
| 02 | 1.00, 47 min, 7.02 M, 3 Revisions | 0.92, 24 min, 3.12 M, none |
|
||||
| 03 | 1.00, 41 min, 6.33 M, 2 Revisions | 0.92, 29 min, 4.06 M, 1 Revision |
|
||||
| 04 | 0.92, 45 min, 5.88 M, 1 Revision | 0.93, 33 min, 3.63 M, 1 Revision |
|
||||
|
||||
Estimated cost: $22.16 for batch A and $16.40 for batch B. Running two batches at once shares the machine and the model quota, so these times are longer than a case run alone.
|
||||
|
||||
- **Case 04 completes.** Both runs went through all five Phases with every draft confirmed by the user and no reply misread as a change. One Revision each: the code for a failed Check in batch B, the design for a proposed addition in batch A.
|
||||
- **Every structural check passed in all eight runs**, with no model timeout, no loop and no `terraform validate` failure.
|
||||
- **`pillar_checklists_covered` failed in all four judged runs**, at 0% to 55% a pillar, while `recommendations_quality` passed at 0.83 to 0.90. The cause is structural: 78 checklist items against 11 to 14 recommendations. Iteration 4 step 26 was built in answer; no judged run has happened since.
|
||||
- **`specialists_ask_before_submitting` failed once**, in batch A's case 04: the target architect exhausted its 45 tool calls, and on its second attempt submitted without asking. The first submission with a user present is now refused until the draft has been put to them (`CONFIRM_DRAFTS`, on by default).
|
||||
- **The same case varies widely.** Case 02 took 24 minutes with no Revision in one batch and 47 minutes with three in the other, at the same time on the same build. Revisions of the Target architecture for additions validation proposes remain the main cost.
|
||||
|
||||
### Thresholds
|
||||
|
||||
Set in `eval/datasets/solution_cases.json` from every completed run of each case on this build, at about a quarter above the worst seen:
|
||||
|
||||
| Case | Revisions | Seconds | Tokens |
|
||||
|---|---|---|---|
|
||||
| 01 | 2 | 3,000 | 5.0 M |
|
||||
| 02 | 3 | 3,600 | 8.5 M |
|
||||
| 03 | 3 | 3,200 | 8.0 M |
|
||||
| 04 | 2 | 3,400 | 7.5 M |
|
||||
|
||||
They are alarms for a run that is clearly worse than any seen, not targets. With two to four runs a case and this much spread they are loose; tighten them as runs accumulate.
|
||||
|
||||
Acceptance criteria: met. All four cases complete and score at least 0.8; deployment guidance needed at most one Revision in every run; the thresholds are set. One criterion is met only loosely: the set of gaps did not always shrink from one validation to the next (case 02, 2026-10-07).
|
||||
|
||||
## Run of 2026-10-08, 17:20 UTC (`eval/results/20261008T172049Z/`): case 04, judged
|
||||
|
||||
To verify two changes made after the batches began: the pillar checklist review (iteration 4 step 26) and the confirm-first rule (step 27). Completed, 86% (12 of 14 checks), no Revision, 36 minutes, 4.10 million tokens.
|
||||
|
||||
- **`pillar_checklists_covered` passes: 100% on all six pillars**, against 9% to 45% in batch B's case 04. The review is in the Deliverable.
|
||||
- `recommendations_quality` passed at 0.80 (specific 0.84, actionable 0.81, trade-offs 0.90, traceable 0.66).
|
||||
- **`specialists_ask_before_submitting` failed again**, for the Target architecture. The rule opened once the user had answered any question about the Deliverable; the target architect ran out of tool calls, the Orchestrator asked the user what to do, and that answer opened it. Fixed after the run: the rule now opens only when the user has been shown a draft of that Deliverable (`drafts_shown`). Not rerun.
|
||||
- **`requirements_name_no_products` failed** for the first time in any run: the requirements named Secret Manager. This is what the requirements review of iteration 5 step 4 looks for; it is off by default and was off here.
|
||||
|
||||
## Run of 2026-10-09, 08:34 UTC (`eval/results/20261009T083440Z/`): case 04
|
||||
|
||||
To verify the batched schema lookup (iteration 4 step 18) and the corrected confirm-first rule (step 27). Completed, 100% (12 of 12 checks), 36 minutes, 4.25 million tokens, one Revision of the Target architecture for an addition validation proposed (an alert on database storage); the description was kept and the code fixed in 40 seconds.
|
||||
|
||||
- The target architect did not exhaust its tool calls: one first attempt, then its draft confirmed by the user.
|
||||
- `specialists_ask_before_submitting` passed: every Specialist put its draft to the user before submitting. The rule refused nothing, so it was not needed in this run.
|
||||
- `requirements_name_no_products` passed.
|
||||
|
||||
This is the first run of case 04 at 100%.
|
||||
|
||||
## Runs of 2026-10-09, 10:38 UTC (`eval/results/20261009T103822Z/` and `...103827Z/`)
|
||||
|
||||
A regression check after Change requests (iteration 7) changed what every Specialist is told. All pass with no warnings.
|
||||
|
||||
| Case | Score | Time | Tokens | Revisions |
|
||||
|---|---|---|---|---|
|
||||
| 02 | 1.00 | 31 min | 3.93 M | 1 |
|
||||
| 03 | 1.00 | 22 min | 2.32 M | 1 |
|
||||
| 04 | 1.00 (12 of 12) | 40 min | 3.20 M | 1 |
|
||||
| 05, the request that the change case then changes (case 01's) | completed | 36 min | 4.32 M | 1 |
|
||||
|
||||
Case 03 was its fastest and cheapest yet. The change case itself is recorded in `../../iter-07-change-requests/steps/step-7.md`.
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# Step 12 — Why the Target architecture is revised
|
||||
|
||||
An investigation on 2026-10-10, from the seven runs of case 03's request on 2026-10-09 (cases 03, 06 and 07). No new runs were made for it.
|
||||
|
||||
## What was found
|
||||
|
||||
Six of the seven runs revised the Target architecture, nine times in all. The run with none cost about $2.44 and took 22 minutes; the run with three cost $5.50 and took 35. Every Revision has one of two causes.
|
||||
|
||||
**A. A Check the code cannot meet as written: 4 Revisions in 3 runs.** The IaC author records it as unimplementable and the design is revised before validation.
|
||||
|
||||
| Check asked for | Why no code can meet it |
|
||||
|---|---|
|
||||
| A separate encryption key for database backups | The key is set on the instance; backups have no key of their own |
|
||||
| A database flag that restricts query access (twice, one Revision apart) | There is no such flag; access is IAM and database grants |
|
||||
| A health check on a backend service in front of a serverless endpoint | A serverless backend does not take health checks |
|
||||
|
||||
Each names a setting that exists in the provider's schema, so the schema review passes it. The fault is in what the product does, not in a name.
|
||||
|
||||
**B. A condition no Check verifies, found by the validator: 5 Revisions in 4 runs.**
|
||||
|
||||
| Requirement | What was missing |
|
||||
|---|---|
|
||||
| NFR-9 | Deletion protection on one Element |
|
||||
| NFR-4 | An SSL policy enforcing TLS 1.2, attached to the proxy |
|
||||
| DR-15 | The region set on three Elements |
|
||||
| NFR-10 | The alert's two thresholds; the Check said only that conditions were set |
|
||||
| NFR-6 | Audit logs for secret access switched on |
|
||||
|
||||
In four of the five a Check existed for the requirement and was weaker than the requirement's words.
|
||||
|
||||
A Revision for A costs about 4 minutes: the design, then the code. One for B costs about 6: the design, the code, and the whole validation again.
|
||||
|
||||
## Would the coverage review have caught B
|
||||
|
||||
`CoverageReview` (iteration 5 step 4), which asks Jev which Check verifies each condition, has been off since its first run. Tried offline against live Jev on these runs' delivered designs:
|
||||
|
||||
- On five finished designs the validator had accepted, it raised 4 to 8 of 42 to 66 conditions each, about one in ten. Most are conditions a Check does cover in other words, or that no code can show, such as encryption at rest that is on by default.
|
||||
- With the Checks added for each gap taken out again, it raised the gap in 1 of 5 (DR-15), raised a different condition of the same requirement in 1, and missed 3.
|
||||
|
||||
It stays off. It is noisy and it misses what the validator finds.
|
||||
|
||||
A structural rule, each Check naming the condition it verifies, would have caught perhaps one of the five: in the other four a Check did claim the condition and was too weak.
|
||||
|
||||
## Changed now
|
||||
|
||||
Two instructions, from the run where the same fault came back a Revision later:
|
||||
|
||||
- The reason sent to the target architect for an unimplementable Check now says to read every Check against it and correct each one it applies to (`app/nodes/router.py`).
|
||||
- The IaC author is told to record every Check that cannot be met in one submission, including a Check with the same fault as one already recorded (`agents/iac-author.md`).
|
||||
|
||||
Neither has run with a real model.
|
||||
|
||||
## What would address B
|
||||
|
||||
The validator finds these gaps by reading the requirements against the Checks. That reading needs no code: it could be done when the Target architecture is submitted, by the same kind of model, and returned to the target architect before anyone approves the design or writes anything. It would add one model run to every Execution and remove a Revision of the design, the code and the validation from the four in seven that had one. Not built: it needs a decision, and a run each way to measure.
|
||||
@@ -0,0 +1,45 @@
|
||||
# Step 13 — A model reviews coverage at design time: built, measured, left off
|
||||
|
||||
Built and run on 2026-10-10. `DESIGN_COVERAGE_REVIEW` is off.
|
||||
|
||||
## What was built
|
||||
|
||||
Step 12 proposed making the validator's reading of coverage when the Target architecture is first submitted, before any code.
|
||||
|
||||
- `agents/coverage-reviewer.md`: a role on the validator's model. It is given the non-functional requirements, the recommendations and the graph, and reports every condition no Check verifies, or that a Check verifies more weakly than the words.
|
||||
- `DesignCoverageReview` in `app/tools/design_review.py`, on the submission-review seam: what it finds goes back to the target architect once and never blocks. A gap naming an id that does not exist is dropped. It runs once in an Execution.
|
||||
|
||||
Tests: `tests/execution/test_design_review.py` (7).
|
||||
|
||||
## Measured
|
||||
|
||||
Case 03, three runs side by side.
|
||||
|
||||
| | Review off | Review on | Review on |
|
||||
|---|---|---|---|
|
||||
| Results | `20261010T105532Z` | `20261010T105535Z` | `20261010T105540Z` |
|
||||
| Score | 100% | 100% | 100% |
|
||||
| Minutes | 23 | 28 | 31 |
|
||||
| Cost, about | $2.90 | $3.33 | $3.75 |
|
||||
| Revisions of the Target architecture | 1, a Check that cannot be implemented | 0 | 1, a gap the validator found |
|
||||
| Gaps the reviewer raised | | 4 | 22 |
|
||||
| Checks in the delivered design | 52 | 87 | 93 |
|
||||
|
||||
The reviewer itself cost $0.19 a run.
|
||||
|
||||
## Why it stays off
|
||||
|
||||
- **It did not stop the validator sending the design back.** In one of the two runs the validator still found a gap, after the reviewer had raised 22.
|
||||
- **It makes the design bigger.** The designs it reviewed ended with 87 and 93 Checks against 52. Every Check is code to write and a verdict to give, so both runs cost more than the run without it, including the one with no Revision.
|
||||
- **Two readers do not agree on what a gap is.** The reviewer and the validator are the same model given the same question, and they raised different things. Asking earlier does not settle what will be asked later.
|
||||
|
||||
Three runs are a small sample, but nothing in them points the other way. The code stays, off, for a later look; removing it is the owner's call.
|
||||
|
||||
## What the runs did show
|
||||
|
||||
Two of the faults behind Revisions are now recurring ones, which is what the lessons loop is for:
|
||||
|
||||
- **A Check asking for a separate encryption key for database backups**: unimplementable, on 2026-10-09 and again today.
|
||||
- **A condition that a region is "low-carbon"**: the validator's gap today, and among what the Jev coverage review kept raising on 2026-10-09. Code can show which region is set; it cannot show the region's carbon rating.
|
||||
|
||||
And one fault in the schema review, fixed: a value in backticks, `true` or `false`, was read as a setting name and raised. `named_settings` now leaves those literals out.
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
**Iteration:** 7, Change requests
|
||||
**Intent:** Let a user restate a request to say how their requirements have changed, at a high level, and receive the delivered architecture updated from where it stood, with an account of what changed and why.
|
||||
**Status:** planned. ADR-0006 was accepted on 2026-10-07 and the glossary updated (step 1). Build after iteration 6 step 11 has a passing evaluation run
|
||||
**Status:** complete (2026-10-09). The change case ran with real models: a retention change was made in 18 minutes for a third of its Baseline's tokens, touching seven Checks on one Element and nothing else (`steps/step-7.md`)
|
||||
**This directory covers:** steps 1 to 8
|
||||
|
||||
## Sources of truth
|
||||
|
||||
- `docs/adr/0006-a-change-request-starts-from-a-baseline-execution.md`: the decision and its four points to confirm. Status `proposed`.
|
||||
- `docs/adr/0006-a-change-request-starts-from-a-baseline-execution.md`: the decision and its four points. Accepted 2026-10-07.
|
||||
- `docs/adr/0005-the-target-architecture-is-an-explicit-graph.md` and `../iter-06-target-architecture-graph/`: the ids along the Requirements chain that a change is traced through. Build iteration 6 first.
|
||||
- `CONTEXT.md`: today it says an Execution starts clean and a Customer case never feeds one Execution into another. Step 1 changes those entries; until then they stand.
|
||||
- `iter-04-learning-and-skills/steps/step-15.md`: the Customer case layout, `execution.json` and the Intent history (`intent/history.json`) that a Baseline is found through. A Change request is the next statement in that history.
|
||||
@@ -17,12 +17,12 @@
|
||||
| Step | What | Size | Status |
|
||||
|---|---|---|---|
|
||||
| 1 | Accept ADR-0006 and update the glossary | S | complete: accepted 2026-10-07 |
|
||||
| 2 | Start an Execution against a Baseline | M | planned |
|
||||
| 3 | Requirements revised with a change record | M | planned |
|
||||
| 4 | Later Specialists revise from the Baseline | M | planned |
|
||||
| 5 | Approvals show the change | S | planned |
|
||||
| 6 | Change summary and version line in the case | S | planned |
|
||||
| 7 | Evaluation: a change case | M | planned |
|
||||
| 2 | Start an Execution against a Baseline | M | complete |
|
||||
| 3 | Requirements revised with a change record | M | complete |
|
||||
| 4 | Later Specialists revise from the Baseline | M | complete |
|
||||
| 5 | Approvals show the change | S | complete |
|
||||
| 6 | Change summary and version line in the case | S | complete |
|
||||
| 7 | Evaluation: a change case | M | complete: one run, all change checks pass |
|
||||
| 8 | Remove the `legacy-baseline` case | S | complete: removed early on the owner's instruction, 2026-10-07 |
|
||||
|
||||
## Dependency graph
|
||||
|
||||
14
.agents/plans/iter-07-change-requests/steps/step-2.md
Normal file
14
.agents/plans/iter-07-change-requests/steps/step-2.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Step 2 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09.
|
||||
|
||||
1. `app/baseline.py`: `load_baseline(output_root, customer_case, execution_id)` reads a Baseline from its files under the Customer case, through `execution.json`: its id, its request, the Baseline it was itself changed from, and every Deliverable with its attachments. It never needs the Baseline's checkpoint.
|
||||
2. It refuses, with `BaselineError` (a `ValueError`), an id that is not an Execution id, an Execution with no files in that case, one that belongs to another Customer case (without saying which), one whose manifest status is not `completed`, and a Change request with no Customer case.
|
||||
3. `ExecutionEngine.start(baseline=...)` loads the Baseline before the Execution's id is taken or its intent recorded, so a refusal leaves nothing behind. The loaded Baseline is in the state as `baseline`.
|
||||
4. `record_intent` puts the Baseline on the new statement in `intent/history.json` and in its `NNN.md`; `execution.json` records it too. An Execution started without one has `"baseline": null` in both.
|
||||
5. Callers: `baseline` in the `/generate` body and in the A2A message metadata. A bad Baseline is a 400 from `/generate` and a failed task over A2A.
|
||||
6. Intake (iteration 5 step 12) no longer starts a message read as a change. It answers with the latest completed Execution of the case and how to name it as the Baseline, and starts nothing; `"new_request": true` in the metadata says it is new work and skips the reading. A caller who names a Baseline is not read at all.
|
||||
|
||||
Differs from the plan: nothing.
|
||||
|
||||
Tests: `tests/execution/test_change_requests.py` "step 2" (10), `tests/a2a/test_server.py` (3), `tests/execution/test_intake.py`.
|
||||
17
.agents/plans/iter-07-change-requests/steps/step-3.md
Normal file
17
.agents/plans/iter-07-change-requests/steps/step-3.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Step 3 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09.
|
||||
|
||||
1. In a Change request every requirement in `requirements.json` carries a `change`: `unchanged`, `added`, `changed` or `removed`. Everything but `unchanged` carries a `reason`.
|
||||
2. `check_requirement_changes` in `app/workflows/changes.py`, run by `check_submission` when the Deliverable has a Baseline, refuses:
|
||||
- a requirement with no `change`, or a change with no reason;
|
||||
- a Baseline requirement missing from the list (it must stay, marked `removed`);
|
||||
- a requirement marked `added` whose id the Baseline already has, or marked anything else whose id it does not;
|
||||
- a requirement marked `unchanged` whose text differs from the Baseline's;
|
||||
- a list in which nothing is added, changed or removed.
|
||||
3. A removed requirement stays in the file as the record of what was dropped. `read_list` leaves it out, so nothing downstream is asked to serve or check it.
|
||||
4. `agents/requirements-analyst.md` says how to mark each requirement and to add a `Changes` heading. With a user present the draft is confirmed before submission by the rule of iteration 4 step 27.
|
||||
|
||||
Differs from the plan: the check that an `unchanged` requirement keeps its text was added. Without it a requirement could change quietly.
|
||||
|
||||
Tests: `tests/execution/test_change_requests.py` "step 3" (6).
|
||||
14
.agents/plans/iter-07-change-requests/steps/step-4.md
Normal file
14
.agents/plans/iter-07-change-requests/steps/step-4.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Step 4 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09.
|
||||
|
||||
1. Each Specialist's context has `baseline` in a Change request: the Baseline's id and original request, the Baseline's version of its own Deliverable (not for the solution guide, which is assembled afresh), and `changes`, what has changed so far upstream.
|
||||
2. Working copies start from the Baseline (`_start_from` in `app/nodes/execution_nodes.py`): the target architect's working graph is the delivered graph, and the IaC author's working copy is the delivered code. A Deliverable with `written_from` is seeded as standing, so the architecture description is carried over without running the describer when the Elements and Relationships are the same as the Baseline's.
|
||||
3. `agents/partials/specialist-protocol.md` tells every Specialist how to revise: start from the delivered version, change only what the changed requirements reach, keep every id that still holds, never renumber.
|
||||
4. `app/workflows/changes.py` compares two versions by id (`change_summary`) and traces `reach`: a changed requirement reaches the components that serve it, the Elements that realise them, the Relationships at those Elements, and every Check on any of them or with the requirement as its source; a changed recommendation reaches the Checks that come from it. Reach is traced through both versions. Anything that changed outside it is listed under `unrequested`.
|
||||
|
||||
Differs from the plan: the plan's test was that an unreached Element or Check is "identical to the Baseline's". The engine cannot make an agent leave something alone; it reports what changed outside the reach, and step 7's check fails a run where much did.
|
||||
|
||||
**Not run with real models**, so whether Specialists do keep ids and leave unreached parts alone is unknown.
|
||||
|
||||
Tests: `tests/execution/test_change_requests.py` "step 4" and "what changed" (6).
|
||||
9
.agents/plans/iter-07-change-requests/steps/step-5.md
Normal file
9
.agents/plans/iter-07-change-requests/steps/step-5.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Step 5 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09.
|
||||
|
||||
1. `OrchestratorToolbox` is given the Baseline. In a Change request `request_approval` adds `baseline` and `changes` to the Approval: the part of the change summary that belongs to that Phase's Deliverables (`changes_for`), computed from the ids and never written by an agent.
|
||||
2. `describe_prompt` in `app/presentation.py` renders it: each requirement added, changed or removed with its reason; ids added, changed and removed for components, recommendations, Elements, Relationships and Checks; and, apart, anything changed that no changed requirement reaches. A Phase that changed nothing says so.
|
||||
3. An Approval outside a Change request has no `changes` key.
|
||||
|
||||
Tests: `tests/execution/test_change_requests.py` "step 5" (2).
|
||||
12
.agents/plans/iter-07-change-requests/steps/step-6.md
Normal file
12
.agents/plans/iter-07-change-requests/steps/step-6.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Step 6 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09.
|
||||
|
||||
1. A Change request writes `changes.json` beside its Deliverables: the requirements' own account, then components, recommendations, Elements, Relationships and Checks added, changed and removed by id, and `unrequested`. `execution.json` names it under `changes` and names the Baseline.
|
||||
2. Every Deliverable is written in full, as for any Execution, so the latest Execution of a case stands on its own.
|
||||
3. `intent/history.json` lists each statement with its Baseline (step 2), so a case's Executions read as a line of versions.
|
||||
4. `agents/packager.md`: the guide's executive summary opens with what changed and why, and names unrequested changes separately.
|
||||
|
||||
Differs from the plan: `changes.json` records ids, and reasons for requirements only. The plan asked for a reason on every item; a reason for a changed Check is whichever changed requirement or recommendation is its source, which a reader can follow from the ids.
|
||||
|
||||
Tests: `tests/execution/test_change_requests.py` "step 6" (1).
|
||||
36
.agents/plans/iter-07-change-requests/steps/step-7.md
Normal file
36
.agents/plans/iter-07-change-requests/steps/step-7.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Step 7 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09: the case and its checks. **The run is outstanding.**
|
||||
|
||||
1. A case may carry `change`, a statement of what has changed. The evaluation then runs the case's request to completion, pre-approved, and runs `change` as a Change request against it in the same Customer case. The Change request is what is scored.
|
||||
2. `case-05-change-retention`: case 01's request, then "raw events must now be kept for 7 years instead of 30 days ... and must not be deletable during that time. Everything else stays as it is."
|
||||
3. `score_change` adds four checks to the usual ones:
|
||||
- `change_is_recorded`: at least one requirement is marked added, changed or removed;
|
||||
- `changed_requirements_reach_checks`: each added or changed requirement is the source of a Check that was added or changed, and a removed one's Checks are gone;
|
||||
- `change_is_contained`: no more than two items, or a tenth of the Baseline's graph, changed without being reached;
|
||||
- `change_costs_less_than_baseline`: the Change request used fewer tokens than the Execution it changed.
|
||||
4. The report records the Baseline's id, seconds and tokens.
|
||||
|
||||
## Run of 2026-10-09, 10:38 UTC (`eval/results/20261009T103822Z/`)
|
||||
|
||||
The first Change request with real models. Completed, no warnings, no Revision.
|
||||
|
||||
| | Baseline (the request) | Change request |
|
||||
|---|---|---|
|
||||
| Time | 36 minutes | 18 minutes |
|
||||
| Tokens | 4.32 million | 1.47 million (34%) |
|
||||
| Graph | 22 Elements, 19 Relationships, 88 Checks | the same Elements and Relationships, 91 Checks |
|
||||
|
||||
- **The requirements analyst marked two requirements changed**, FR-6 and NFR-5, both with the audit obligation as the reason, and left the rest unchanged with their text intact.
|
||||
- **Seven Checks were touched, all on the raw-events bucket (E-6), and nothing else.** Two lifecycle ages went from 30 days to 2,555 (K-41, K-63); the storage class became ARCHIVE (K-40, K-70); a retention policy of 220,752,000 seconds and its lock were added (K-89, K-90, K-91). Two recommendations changed (DR-5, DR-14).
|
||||
- **Nothing changed without being reached:** 0 of 129 items unrequested.
|
||||
- The description was carried over from the Baseline without running the describer. The code was revised in 102 seconds and passed all 91 Checks on its first validation.
|
||||
- The design advisor still consulted all six pillar advisors afresh, 267 seconds, the longest step of the change.
|
||||
|
||||
Score as run: 93%. `changed_requirements_reach_checks` failed for FR-6, wrongly: it asked for a Check whose source is the requirement, and a functional requirement is carried by its components, not by Checks. Corrected to accept a changed Check on an Element that realises a component serving it, and re-scored on the saved files: all four change checks pass.
|
||||
|
||||
Acceptance criteria: met. The change case scores above 0.8; every changed requirement reaches a changed or new Check; nothing outside the reach changed; the Change request used a third of its Baseline's tokens.
|
||||
|
||||
One run, one kind of change. A change that adds or removes an Element, or removes a requirement, has not been tried.
|
||||
|
||||
Tests: `tests/eval/test_scoring.py`, "a Change request stays contained" (6).
|
||||
@@ -11,3 +11,5 @@ Five of the Execution folders were owned by a rootless-podman user id (110000),
|
||||
Not committed first, against the guardrail in `DETAIL.md`: the owner did not ask for a commit. The tracked files are recoverable from commit `7ee49ab` at their earlier paths (`deliverables/as-is/`, `deliverables/target/`, `deliverables/validation/`, `deliverables/guides/`, `deliverables/executions/`, `scripts/validate_artifacts.py`, `tests/test_artifacts.py`). The generated `intent/` files for that case were never committed and are gone.
|
||||
|
||||
Left in place, because the instruction named only `legacy-baseline`: the same pipeline's other samples, `terraform/` at the repository root, `docs/requirements.md`, `docs/architecture.md`, `docs/source-architecture.md`, `docs/validation-evidence.md`, `docs/validation-results.json`, `docs/publication-verification.md`, `requirements.yaml`, and `scripts/validate.sh`, which runs Terraform checks on that root `terraform/`.
|
||||
|
||||
Removed later on 2026-10-07, on the owner's instruction to clean up the root `terraform/` if it was no longer needed: `terraform/` and `scripts/validate.sh`, with the three CI steps that ran Terraform on that directory. Nothing read it, and it no longer passed `terraform validate` (duplicate `required_providers`, outputs naming resources that do not exist). Recoverable from commit `5bb22d9`. The `docs/` samples and `requirements.yaml` listed above were then removed too, on the owner's instruction the same day: `docs/requirements.md`, `docs/requirements-spec.md`, `docs/architecture.md`, `docs/source-architecture.md`, `docs/validation-evidence.md`, `docs/validation-results.json`, `docs/publication-verification.md` and `requirements.yaml`. Nothing read them; each kind of output they sampled is now produced per Execution by a role in `agents/`. Their sample workloads were not added as evaluation cases.
|
||||
|
||||
43
.agents/plans/iter-08-terraform-modules/MAP.md
Normal file
43
.agents/plans/iter-08-terraform-modules/MAP.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Plan Map
|
||||
|
||||
**Iteration:** 8, Terraform modules
|
||||
**Intent:** Let generated infrastructure code call a published Terraform module where one replaces several resources that must be wired together, without losing the Requirements chain or opening a way for arbitrary code to be downloaded.
|
||||
**Status:** steps 1 to 5 built and run once each way on 2026-10-09; steps 6 and 7 wait on those Cloud providers
|
||||
**This directory covers:** steps 1 to 7
|
||||
|
||||
## The owner's request (2026-10-09)
|
||||
|
||||
Use modules, when necessary, from three organisations:
|
||||
|
||||
| Cloud provider | Source | Here |
|
||||
|---|---|---|
|
||||
| Google Cloud | https://github.com/terraform-google-modules | built: the `terraform-google-modules` registry namespace is allowed in `providers/gcp.yaml` |
|
||||
| Azure | https://github.com/aztfm | recorded for step 6: there is no Azure provider bundle |
|
||||
| AWS | https://github.com/terraform-aws-modules | recorded for step 7: there is no AWS provider bundle |
|
||||
|
||||
The owner's decision, 2026-10-09: **plain resources by default, with an opt-in to known approved sources.**
|
||||
|
||||
- **Opt-in per Execution.** A caller sets `terraform_modules`; the deployment's default is `TERRAFORM_MODULES`, off. A Change request does as its Baseline did unless told otherwise.
|
||||
- **Approved sources are the provider bundle's list.** Opted in, a module is still used only from the tested catalogue and only where it replaces three or more resources that depend on each other.
|
||||
- **Google now.** The tooling names no Cloud provider; the bundle and a Skill do (ADR-0002).
|
||||
|
||||
## What was found first
|
||||
|
||||
- `terraform init` downloads and evaluates whatever a `source` names. Before this iteration nothing stopped generated code naming any Git URL.
|
||||
- A module carries its own provider requirements. Of 23 modules in the Google organisation looked at, these require `google` below 8 and cannot be used with the pinned 8.6.0: `lb-http`, `pubsub`, `bigquery`, `kubernetes-engine`, `log-export`, `event-function`, `scheduled-function`, `bastion-host`. So a catalogue has to be tested, whichever rule decides when a module is used.
|
||||
- Code using two modules validated in 11 seconds against the pinned provider, modules downloaded.
|
||||
|
||||
## Status
|
||||
|
||||
| Step | What | Status |
|
||||
|---|---|---|
|
||||
| 1 | Allow modules only from namespaces the bundle lists, at one exact version | built: `check_module_sources` in `app/tools/modules.py`, run before every validate and plan |
|
||||
| 2 | A lookup of what a module accepts | built: the `terraform_module` tool, from the public registry, for the IaC author and the validator |
|
||||
| 3 | A Skill with the catalogue and the rule for when to use one | built: `skills/google-cloud-iac-modules/`, four references, each validated by a test |
|
||||
| 4 | Checks through a module | built as guidance: `implementation.json` names the module input; the validator confirms what the input sets |
|
||||
| 5 | Opt-in per Execution, plain resources by default | built: `terraform_modules` on a start, `/generate`, A2A metadata and an evaluation case; recorded in `execution.json` |
|
||||
| 5a | Run a case each way and see what the agents do with it | run once each way on 2026-10-09, both at 100%; a module was used for private Cloud SQL only |
|
||||
| 6 | Azure: `aztfm` | waits on an Azure provider bundle |
|
||||
| 7 | AWS: `terraform-aws-modules` | waits on an AWS provider bundle |
|
||||
|
||||
Detail: `steps/step-1-to-5.md`.
|
||||
94
.agents/plans/iter-08-terraform-modules/steps/step-1-to-5.md
Normal file
94
.agents/plans/iter-08-terraform-modules/steps/step-1-to-5.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# Steps 1 to 5 — Implementation Detail
|
||||
|
||||
Built on 2026-10-09. **No Execution has run with it.**
|
||||
|
||||
## 1. Which modules
|
||||
|
||||
`terraform.modules.namespaces` in the provider bundle lists the registry namespaces a module may come from; for Google Cloud, `terraform-google-modules`. `TerraformRunner.validate` and `.plan` refuse, before Terraform runs:
|
||||
|
||||
- a `source` that is not `<allowed namespace>/<name>/<provider>`, optionally with `//path`: so any Git or HTTP URL, a GitHub shorthand, a local path, or another namespace;
|
||||
- a `version` that is not one exact version;
|
||||
- a module written in `.tf.json`.
|
||||
|
||||
With no namespace listed every module call is refused. The evaluation's own validation uses the same list, and only for a case that opts in.
|
||||
|
||||
The source the owner gave is a GitHub organisation; the registry namespace of the same name is what Terraform is pointed at, because the registry serves a fixed archive for a version and `terraform init` needs no Git.
|
||||
|
||||
## 2. What a module accepts
|
||||
|
||||
`terraform_module(source, version, find)` reads the public Terraform registry: a module's or submodule's inputs (required first, with type and description), its outputs and its submodules. It compares the module's provider requirements with the versions the bundle pins and says "NOT USABLE" when they exclude it. Only allowed namespaces can be looked up. Answers are cached for the life of the process.
|
||||
|
||||
It makes one new outbound call, to `registry.terraform.io`, which `terraform init` already reaches.
|
||||
|
||||
## 3. The Skill
|
||||
|
||||
`skills/google-cloud-iac-modules/`: when to use a module (it is in the table, it replaces three or more dependent resources, and every Check on the Elements it covers can be met through an input), and four references with a validated example each.
|
||||
|
||||
| For | Module | Version |
|
||||
|---|---|---|
|
||||
| VPC, subnets, firewall rules, Cloud NAT | `network`, `cloud-nat` | 18.3.1, 7.1.0 |
|
||||
| Cloud SQL for PostgreSQL on a private address | `sql-db//modules/postgresql`, `//modules/private_service_access` | 28.3.0 |
|
||||
| A Cloud Storage bucket with retention, lifecycle, encryption, grants | `cloud-storage//modules/simple_bucket` | 12.4.1 |
|
||||
| A key ring, keys and grants | `kms` | 4.2.1 |
|
||||
|
||||
`tests/test_iac_modules.py` runs each example through `terraform validate` with the patterns Skill's versions file, and checks that every module call is from an allowed namespace at the version the table gives. It needs the network and is skipped without it.
|
||||
|
||||
The Skill is named in the bundle under `terraform.modules.skill`, not among any role's Skills. See step 5 for who is given it.
|
||||
|
||||
## 4. Checks through a module
|
||||
|
||||
A Check stays worded about the resource. `implementation.json` gives the module and the input that meets it, such as `module.database.ip_configuration.ipv4_enabled`. When no input sets what a Check needs, the module does not fit and the resources are written directly. The validator reads the input's value and confirms with the lookup what it sets, or what its default is.
|
||||
|
||||
This is instruction, in the Skills and the two role files. Nothing in code verifies that a module input does what a Check says: that would need a plan against a real project.
|
||||
|
||||
## 5. Opt-in per Execution
|
||||
|
||||
Infrastructure code is plain resources unless the Execution opts in.
|
||||
|
||||
- `ExecutionEngine.start(terraform_modules=...)`: true, false, or unset. Unset, a Change request does as its Baseline did, and any other Execution takes `TERRAFORM_MODULES` (off). Opting in is refused when the provider's bundle lists no sources.
|
||||
- Callers: `terraform_modules` in the `/generate` body, in A2A message metadata, and on an evaluation case.
|
||||
- **Opted in:** the roles that carry the `terraform_module` tool (the IaC author and the validator) are given the modules Skill, and their context says `terraform_modules: true`.
|
||||
- **Not opted in:** those roles get neither the Skill nor the tool, and any `module` block is refused by `terraform_validate` and `terraform_plan` with a message saying to write the resources directly. The refusal is in code (`MODULES_OPTED_IN` in `app/tools/modules.py`, set when a Specialist starts), not only in instructions.
|
||||
- `execution.json` records `terraform_modules`.
|
||||
|
||||
Reference routing (iteration 5 step 8) does not choose within the modules Skill, because it is not among a role's Skills at start-up.
|
||||
|
||||
## Known limits
|
||||
|
||||
- Modules also bring providers the bundle does not pin (`google-beta`, `random`, `null`), at whatever version their constraints allow.
|
||||
- The schema review and the target architect's lookups still describe resources. A Check's wording is unaffected by whether a module later creates the resource.
|
||||
- A module version in the catalogue goes stale; `scripts/check-terraform-modules.py` reports it when run, and nothing runs it on a schedule.
|
||||
|
||||
Tests: `tests/tools/test_modules.py` (24), `tests/test_iac_modules.py` (6), `tests/execution/test_terraform_modules.py` (7).
|
||||
|
||||
## Run on 2026-10-09
|
||||
|
||||
Case 03's request, once each way, side by side (`20261009T210931Z` plain, `20261009T210935Z` opted in as `case-07-approved-modules`). Both completed at 100%.
|
||||
|
||||
| | Plain resources | Modules opted in |
|
||||
|---|---|---|
|
||||
| Minutes | 35 | 22 |
|
||||
| Tokens | 5.66 million | 3.08 million |
|
||||
| Cost, about | $5.50 | $3.17 |
|
||||
| Revisions of the Target architecture | 3 | 1 |
|
||||
| Checks, all passed | 77 | 54 |
|
||||
| Module calls / resources / lines of Terraform | 0 / 35 / 555 | 2 / 25 / 448 |
|
||||
| Design quality score | 0.82 | 0.62 |
|
||||
|
||||
**The difference in time and cost is the Revisions, not the modules.** The two runs produced different designs before any code was written: 77 Checks against 54, three Revisions against one. One run each way cannot say modules are cheaper.
|
||||
|
||||
What the opted-in run does show:
|
||||
|
||||
- The IaC author used a module for one thing, private Cloud SQL (`sql-db//modules/postgresql` with `//modules/private_service_access`, 28.3.0), and wrote the network, load balancer, Cloud Run, storage, secrets, IAM and monitoring as plain resources. A VPC with one subnet did not get the network module.
|
||||
- 14 of 54 Checks are met through module inputs, each recorded as `module.cloud_sql.<input>`; the validator passed all 14 citing the input's value.
|
||||
- `terraform_module` was called four times by the author and once by the validator. No module was refused, and the code validated.
|
||||
- For a Check met by leaving an input unset, the validator's evidence is that the module falls back to its default. That rests on the module's documentation.
|
||||
|
||||
The plain run was given neither the Skill nor the tool, and wrote no module.
|
||||
|
||||
The design quality score of 0.62 is below the bar of 0.67. It is scored on the design recommendations, written before any code.
|
||||
|
||||
## Two follow-ups (2026-10-10)
|
||||
|
||||
- **A Check is met by a value in the code.** The first run showed the validator arguing from a module's default where an input was left unset. The Skill now tells the author to set every input a Check depends on, even when the default already gives the value; where one is still left unset the verdict says so.
|
||||
- **Stale and newly usable modules are reported.** `scripts/check-terraform-modules.py` reads the registry and prints, for each module the Skill's examples call, the pinned version against the latest and whether the latest still works with the pinned provider; and for each module in `terraform.modules.watch`, whether it can now be used. Today all five are up to date and none of the eight watched modules can be used: each still requires a `google` provider below 8. It changes nothing; it needs running by hand.
|
||||
34
.agents/plans/iter-09-scoping/MAP.md
Normal file
34
.agents/plans/iter-09-scoping/MAP.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Plan Map
|
||||
|
||||
**Iteration:** 9, Scoping
|
||||
**Intent:** Scope an engagement from a scope spec: a structured file that may arrive complete, partly filled or not at all, completed in conversation and approved by the customer before requirements begin. So that a design's quality no longer rests on what the agents had to assume.
|
||||
**Status:** steps 1, 2, 3 and 6 built on 2026-10-11; steps 1 and 2 ran in cases 03 and 08; step 3 not run; steps 4 and 5 planned
|
||||
**This directory covers:** steps 1 to 6
|
||||
|
||||
## Sources of truth
|
||||
|
||||
- `docs/adr/0008-scoping-starts-from-a-scope-spec.md`: the decisions.
|
||||
- `.scratch/scoping-and-work-breakdown/spec.md`: the design, including the draft spec, the owner's own example and how the two were combined.
|
||||
- `skills/scoping/assets/catalogue.yaml`: every field a scope spec may hold.
|
||||
|
||||
## Status
|
||||
|
||||
| Step | What | Status |
|
||||
|---|---|---|
|
||||
| 1 | The catalogue, reading and validating a spec, the gap list, the two files beside the Intent, run options from the spec, the spec shown to every Specialist | built 2026-10-11 (`steps/step-1.md`); not run with real models |
|
||||
| 2 | The conversation that fills gaps and writes answers into the completed copy; scoping as a Phase with its Deliverable and Approval; a spec drafted from a sentence | built 2026-10-11 (`steps/step-2.md`); not run with real models |
|
||||
| 3 | Requirements traced to the customer's requirement ids and to spec fields, in `requirements.json`, with a stated choice refused unless a requirement carries it; readiness in the solution guide | built 2026-10-11 (`steps/step-3.md`); not run with real models |
|
||||
| 4 | An edited spec as a Change request, compared field by field | planned |
|
||||
| 5 | Evaluation cases as specs, replacing answers matched by pattern | planned; `case-08-landing-zone` is the first |
|
||||
| 6 | The status `BASELINE_LOCKED` set when the Execution completes | built with step 2 |
|
||||
|
||||
## Dependency graph
|
||||
|
||||
- Step 1: no dependencies
|
||||
- Step 2: depends on step 1
|
||||
- Step 3: depends on step 1
|
||||
- Step 4: depends on step 1, iteration 7
|
||||
- Step 5: depends on step 1
|
||||
- Step 6: depends on step 2
|
||||
|
||||
The work breakdown structure is iteration 10 and uses the spec's `delivery` section from step 1.
|
||||
20
.agents/plans/iter-09-scoping/steps/step-1.md
Normal file
20
.agents/plans/iter-09-scoping/steps/step-1.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Step 1 — Implementation Detail
|
||||
|
||||
Built on 2026-10-11. **Not run with real models.**
|
||||
|
||||
1. **The catalogue** is `skills/scoping/assets/catalogue.yaml`: 63 fields as dotted paths, each with a type, a tier (which may differ by kind of engagement), the question to ask and guidance for a default. It names no Cloud provider. `providers/gcp.yaml` adds, under `scope.values`, what Google Cloud allows for the four fields left to a provider: the provider itself, encryption type, network topology and the kind of hybrid connection.
|
||||
2. **Reading a spec** is `read_scope` in `app/scope.py`, with no model. It refuses, naming every problem: YAML that does not parse, a field the catalogue does not have, a value of the wrong type, and an engagement reference and a customer case that disagree. A whole section may be marked `ask`, `decide` or `not_applicable` at once.
|
||||
3. **What it yields:** the stated values; the gaps, most pressing first, each with its question and a severity (HIGH essential, MEDIUM important, LOW optional); the assumptions, one per `decide`, with the default to take and what a wrong one would change; a count of each; and a status.
|
||||
4. **Starting from a spec:** `ExecutionEngine.start(scope=...)`, `scope` in the `/generate` body and in A2A metadata, and on an evaluation case. The spec's statement is the request when none is given, its engagement reference names the Customer case, and its `run` section applies where the caller gave nothing. A pre-approved start is refused when an essential field is not settled.
|
||||
5. **The two files** are written beside the Intent: `NNN.scope.yaml`, the spec as supplied, byte for byte; and `NNN.scope.completed.yaml`, every field of the catalogue with the agent's sections (`inferred_assumptions`, `discovery_gaps`, `provenance`, `readiness`) and `metadata.status`. `history.json` names both. A completed copy can be supplied again as a spec; the agent's sections are replaced.
|
||||
6. **Every Specialist is shown the spec** as `scope` in its context (what is stated, what is theirs to decide, what is unknown) and is given the scoping Skill. The protocol says a stated choice binds, an exclusion is out of scope, and the customer's requirement ids are to be named. The requirements analyst is told to derive from it and ask only for what it leaves unknown.
|
||||
7. **For a person:** `python -m app.scope check <file>` says what a spec settles and what it lacks; `python -m app.scope template <kind>` prints one to fill in.
|
||||
8. **A benchmark spec:** `eval/datasets/specs/landing-zone.yaml`, a fictional regulated payment platform, and `case-08-landing-zone` which starts from it.
|
||||
|
||||
Interim, until step 2 (now built; see `step-2.md`):
|
||||
|
||||
- **Gaps are asked by the requirements analyst,** who is handed them, not by a scoping Phase. Answers are not written back into the completed copy.
|
||||
- **Status** is set once, at the start: `DRAFT` with gaps to ask, `UNDER_REVIEW` when complete and someone is present, `APPROVED` when pre-approved. `BASELINE_LOCKED` is not set.
|
||||
- **A caller's `pre_approved` wins over the spec's** when both are given. `/generate` is always pre-approved.
|
||||
|
||||
Tests: `tests/test_scope.py` (18), `tests/execution/test_scope_spec.py` (8).
|
||||
55
.agents/plans/iter-09-scoping/steps/step-2.md
Normal file
55
.agents/plans/iter-09-scoping/steps/step-2.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Step 2 — Implementation Detail
|
||||
|
||||
Built on 2026-10-11. **Not run with real models.**
|
||||
|
||||
1. **Scoping is the first Phase.** `PhaseId.SCOPING` comes before requirements discovery, with one Deliverable, `scope`, produced by a new Specialist, the scope analyst (`agents/scope-analyst.md`). Requirements depend on it. Every Execution now begins with it, whether or not a spec was supplied, and the customer approves it before requirements begin.
|
||||
2. **The scope analyst completes the spec with two tools** (`app/tools/scoping.py`). `scope_read` shows what is settled and what is not, with the question to ask for each. `scope_set` records fields, each with where its value came from: `request` (the customer's request says it), `answered` (they said so in conversation) or `assumed` (the analyst chose, and must say why). Code checks every value against the catalogue as it is recorded.
|
||||
3. **What the customer stated in the file stays.** The analyst cannot overwrite a supplied value by assumption; only the customer's own answer changes it.
|
||||
4. **The conversation.** With someone present the analyst asks, through `needs_input`, for the essential fields and the important ones that most change a design, up to eight at a time. An answer is recorded as answered; "you decide" becomes an assumption; a skipped field stays unknown. With nobody present it assumes the essential and important fields from the catalogue's guidance and what the request implies.
|
||||
5. **A spec drafted from a sentence.** With no spec supplied the analyst starts from an empty one, records what the request states and settles the rest the same way.
|
||||
6. **A submission cannot leave an essential field unknown.** It is refused, naming the fields.
|
||||
7. **The Deliverable is written by code from what was recorded.** The analyst writes the scope statement. Code writes the two files (`scope.yaml`, the completed spec; `scope.json`, what every later Specialist reads) and appends the information register, the assumptions with what each would change, and what is still to confirm.
|
||||
8. **Every later Specialist reads the agreed scope**, as `scope` in its context: what the customer stated, what was assumed for them (shown apart), and what is unknown. The requirements analyst derives from it and no longer asks for what it settles.
|
||||
9. **Status is kept current** in the Execution's `scope.yaml` and in the copy beside the Intent: `UNDER_REVIEW` once submitted, `APPROVED` when the Phase is approved, `BASELINE_LOCKED` when the Execution completes (which closes step 6). `execution.json` carries the status and the readiness count.
|
||||
10. **A Change request starts from the scope that was delivered,** with where each value came from, and the analyst records only what the change reaches. A Baseline delivered before scoping existed has no scope; the analyst then completes one from the change and the delivered requirements.
|
||||
11. **The Approval summary** for scoping says how much was assumed and what is unknown.
|
||||
|
||||
What it changed elsewhere:
|
||||
|
||||
- About 80 existing tests assumed requirements came first. `tests/scoped.py` holds helpers that run scoping ahead of a test's own script, so tests about later Phases start where they always did. Tests about order, counts and first prompts were updated to the new truth.
|
||||
- `workflow.yaml` gains the Phase.
|
||||
|
||||
Not done here:
|
||||
|
||||
- **No real model has run the scope analyst.** How well it drafts from a sentence, how many questions it asks, and what it costs are unknown. Every evaluation case now begins with it.
|
||||
- **Answers are parsed by the model**, not by code, before `scope_set` checks their type. Nothing reads a value back to the customer other than the draft they approve.
|
||||
- A re-supplied file part-way through a conversation is not handled; the customer answers in chat.
|
||||
|
||||
Tests: `tests/execution/test_scope_spec.py` (12), and the existing suites as updated.
|
||||
|
||||
## First runs with real models, 2026-10-11
|
||||
|
||||
Two cases side by side (`20261011T172837Z` case 03, `20261011T172840Z` case 08). Both completed.
|
||||
|
||||
| | Case 03, a one-sentence request | Case 08, the landing-zone spec |
|
||||
|---|---|---|
|
||||
| Score | 100% | 91%; the one failure was the evaluation's, now fixed |
|
||||
| Minutes | 38 | 55 |
|
||||
| Cost, about | $5.42 | $8.76 |
|
||||
| Revisions | 1 of the Target architecture | 2 of the Target architecture, 1 of the code |
|
||||
| The scope analyst | 64 seconds, 12 requests, $0.07 | 96 seconds, 9 requests, $0.08 |
|
||||
| The scope | 6 stated, 21 assumed | 44 stated, 11 assumed, 4 not applicable |
|
||||
| The design | 22 Elements, 81 Checks | 49 Elements, 101 Checks, 718 lines of Terraform |
|
||||
|
||||
**Scoping works and is cheap:** about a minute and under ten cents. From one sentence the analyst recorded the six things the sentence says as the customer's and 21 as assumptions, each with a reason; nothing was presented as stated that was not. No essential field was left unknown in either.
|
||||
|
||||
**The landing zone, the agent's first platform foundation, came out as one:** folders, organisation policies, a service perimeter, an interconnect with four attachments, routers, customer-managed keys, workload identity federation for the pipelines, a workforce pool for sign-in, audit sinks. The customer's four requirement ids are each cited in the requirements. Nothing excluded was built: no container workloads. Regions and encryption are as stated. Sixteen questions for the customer were written out.
|
||||
|
||||
**What it shows is missing:**
|
||||
|
||||
- **A stated choice is not checked.** The spec says `shared_vpc_hub_and_spoke`. The design names a "Spoke Shared VPC" and builds a transit network and a spoke network, with no Shared VPC host project and nothing connecting hub to spoke. All 101 Checks passed, because no Check asks for the topology the customer stated. "A stated choice binds" is an instruction; nothing in code holds a design to it. This is what step 3 has to close: a stated field that shapes the design must be traceable to a Check.
|
||||
- **The code brought in a provider the bundle does not pin.** A `github_repository` Element led to `integrations/github` in the Terraform. Validation downloads whatever provider the code names, as it once did modules.
|
||||
- **The scope statement added an exclusion the customer did not state** (changes to on-premises systems). The analyst is told to use only what the spec holds.
|
||||
- **The evaluation scored a stated choice as a leaked product.** "Shared VPC" in the requirements failed `requirements_name_no_products`, though the customer's spec names that topology. The check now counts what the spec states as the customer's.
|
||||
|
||||
Case 03's cost and its one Revision are in the range seen before scoping existed; one run cannot say what scoping changed downstream.
|
||||
40
.agents/plans/iter-09-scoping/steps/step-3.md
Normal file
40
.agents/plans/iter-09-scoping/steps/step-3.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Step 3 — Implementation Detail
|
||||
|
||||
Built on 2026-10-11. **Not run with real models.**
|
||||
|
||||
## What a stated choice now has to reach
|
||||
|
||||
Case 08 showed a stated topology named in a design and not built, with every Check passed. A stated choice was an instruction; nothing held a design to it.
|
||||
|
||||
1. **The catalogue marks the fields that bind a design** (`binds: true`, 26 of them): regions and residency, availability and recovery targets, compliance frameworks and classification, encryption, audit logging, every networking field, identity, environments, and required and forbidden products.
|
||||
2. **The agreed scope lists the binding fields the customer stated,** as `binding` in `scope.json`. A field assumed for them is not among them: an assumption is not the customer's decision.
|
||||
3. **A requirement says what it comes from,** in `from`: the customer's own requirement ids and the scope fields it carries.
|
||||
4. **A submission of requirements is refused** (`_carries_the_scope` in `app/workflows/chain.py`) when:
|
||||
- one of the customer's own requirements is named by no requirement;
|
||||
- a binding field is named by no requirement;
|
||||
- a requirement that carries a binding field is not non-functional, or has no entry in `conditions`.
|
||||
5. **From there the existing chain does the rest.** A non-functional requirement's conditions each need a Check on the Target architecture, and validation gives each Check a verdict. So a stated choice now reaches a Check, in code, at every link.
|
||||
|
||||
What this does not prove: that the condition the analyst writes says what the customer meant, or that the Check the architect writes verifies it. It guarantees a stated choice cannot be silently dropped; whether it is honoured well is still judged by the validator.
|
||||
|
||||
## Readiness in the guide
|
||||
|
||||
The packager is told to open the executive summary with what the design rests on: how much the customer stated, how much was assumed, how much is unknown. An instruction, not a check.
|
||||
|
||||
## Also closed, from the same run
|
||||
|
||||
- **Only the pinned providers.** `check_providers` in `app/tools/local.py` refuses, before Terraform runs, a resource or data source of a provider the bundle does not pin, and a `required_providers` entry for one. The target architect is told that something outside the Cloud provider's own provider is not an Element. A module's own providers are untouched: they are declared inside the module.
|
||||
- **The scope statement names only the customer's exclusions.**
|
||||
|
||||
Not done: `intent.exclusions` are free text, so nothing in code checks that an excluded thing was not built. The Specialists are told; in case 08 they complied.
|
||||
|
||||
Tests: `tests/execution/test_requirements_chain.py` (6 more), `tests/tools/test_local.py` (5 more).
|
||||
|
||||
## First run with real models, 2026-10-11
|
||||
|
||||
`case-08-landing-zone` again, results `20261011T185421Z`: completed, 91%, 60 minutes, about $11.94.
|
||||
|
||||
- **The stated topology was built this time.** `networking.topology` is carried by NFR-2, whose first condition is that a Shared VPC host project is connected to service projects across the environment tiers. The code has a host project and the connections. The run before had neither and passed every Check.
|
||||
- **Only the pinned provider is in the code.** The run before brought in the GitHub provider.
|
||||
- **It cost more:** $11.94 against $8.76, with three Revisions of the Target architecture and three of the code, against two and one. Two of them were two Checks that contradicted each other on one key's role, sending the code back and forth before the design was corrected. That is the design's fault, not this step's, but a stricter chain gives a large design more to get wrong.
|
||||
- **One evaluation check failed, and it is a real finding:** the requirements name "Cloud KMS". The customer asked for keys they control; the product was the analyst's addition.
|
||||
23
.agents/plans/iter-10-work-breakdown/MAP.md
Normal file
23
.agents/plans/iter-10-work-breakdown/MAP.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Plan Map
|
||||
|
||||
**Iteration:** 10, Work breakdown structure
|
||||
**Intent:** Deliver a plan for building the Target architecture: work packages traced to its Elements and Checks, activities in sequence, and a timeline on a relative day axis that code computes and draws.
|
||||
**Status:** steps 1 to 4 built on 2026-10-11, without milestones; not run with real models
|
||||
**This directory covers:** steps 1 to 4
|
||||
|
||||
## Sources of truth
|
||||
|
||||
- `.scratch/scoping-and-work-breakdown/spec.md`, section "The work breakdown structure".
|
||||
- `docs/adr/0005-the-target-architecture-is-an-explicit-graph.md`: the ids it traces to.
|
||||
- Iteration 9 step 1: the scope spec's `delivery` section (team size, window, commercial model).
|
||||
|
||||
## Status
|
||||
|
||||
| Step | What | Status |
|
||||
|---|---|---|
|
||||
| 1 | The Deliverable, its Specialist and its data file; every Element in a work package, checked in code | built 2026-10-11 (`steps/step-1-to-4.md`) |
|
||||
| 2 | The schedule computed in code: start and finish day, critical path, team size as a limit | built 2026-10-11 (`steps/step-1-to-4.md`) |
|
||||
| 3 | The three views written by code: WBS dictionary, activity sequence list, timeline on a relative axis | built 2026-10-11 (`steps/step-1-to-4.md`) |
|
||||
| 4 | The delivery window checked; assumptions the plan depends on shown on the timeline; milestones | built 2026-10-11, without milestones (`steps/step-1-to-4.md`) |
|
||||
|
||||
Decisions the owner accepted on 2026-10-11: after validation, in the packaging Phase; grouped by component; the technical build only.
|
||||
43
.agents/plans/iter-10-work-breakdown/steps/step-1-to-4.md
Normal file
43
.agents/plans/iter-10-work-breakdown/steps/step-1-to-4.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Steps 1 to 4 — Implementation Detail
|
||||
|
||||
Built on 2026-10-11. **Not run with real models.**
|
||||
|
||||
1. **A new Deliverable, `work_breakdown`,** in the packaging Phase, after validation, produced by a new Specialist, the delivery planner (`agents/delivery-planner.md`, on the larger model). It is given the Target architecture and the deployment guidance in full.
|
||||
2. **The planner writes the plan as data,** `work-breakdown.json`: work packages (a hierarchy, each naming the Elements it delivers, its scope, what it produces and the skills it needs) and activities (work package, days, what each comes after, and whether the team or the customer owns it).
|
||||
3. **Code checks the plan against the design** (`check_work_breakdown` in `app/workflows/work_breakdown.py`). A submission is refused when an Element belongs to no work package, a work package names an Element that does not exist, an activity follows one that does not exist, activities depend on each other in a circle, a duration is not above zero or is over 120 days, or a work package holds neither an activity nor another work package.
|
||||
4. **Code computes the schedule** (`schedule`). An activity starts when everything it follows has finished. The team's activities also wait for a free person: no more run at once than the team has people, with the longest remaining chain placed first. What the customer owns takes nobody from the team. The critical path is every activity with no slack.
|
||||
5. **Code writes the three views** into the Deliverable when it is submitted, as it writes the architecture's tables:
|
||||
- the **WBS dictionary**, each work package with the Checks on its Elements as what makes it done, read from the Target architecture;
|
||||
- the **activity sequence**, with each activity's start and finish day and whether it is critical;
|
||||
- the **timeline**, a chart in text along a relative axis from Day 0, the team's work and the customer's drawn differently and the critical path marked.
|
||||
6. **The delivery terms come from the agreed scope:** team size, working week, delivery window and start date. A team size the scope does not give is 2, and the Deliverable says it was assumed.
|
||||
7. **The plan is checked against the delivery window.** Over it, the Deliverable says by how much and names the critical path. Nothing shortens an estimate to fit.
|
||||
8. **What the customer owns is listed** with its lead time and the assumption behind it.
|
||||
9. **With a start date in the scope** the activity sequence also gives calendar dates, skipping weekends, and a Mermaid Gantt chart is attached as `timeline.mmd`. Without one there are no dates to draw, and the text chart is the timeline.
|
||||
10. **The guide carries the timeline.** The guide and the plan are produced side by side, so neither reads the other; when an Execution's files are written, the plan's timeline is added to the guide as "Delivery plan". `execution.json` records the plan's length, team, whether it fits the window and its critical path, and the packaging Approval says the same.
|
||||
|
||||
Differs from the spec:
|
||||
|
||||
- **Milestones for fixed-price work are not built.**
|
||||
- **An assumption in the scope is not linked to an activity by id.** An activity the customer owns carries its own assumption as text.
|
||||
- **The timeline chart is text.** A Mermaid Gantt chart needs dates, so one is drawn only when the scope gives a start date.
|
||||
- **The guide does not depend on the plan.** Making it wait would have put the plan on the path of every Execution's last step; adding the timeline in code keeps them independent.
|
||||
|
||||
Durations are a model's estimates. The Deliverable says so.
|
||||
|
||||
Tests: `tests/execution/test_work_breakdown.py` (16).
|
||||
|
||||
## First run with real models, 2026-10-11
|
||||
|
||||
`case-08-landing-zone`, results `20261011T185421Z`. The delivery planner made one model request, about $0.32.
|
||||
|
||||
- **The plan:** 9 work packages under one parent and 15 activities. Every one of the design's Elements is in a work package, and each work package lists the Checks that make it done.
|
||||
- **The schedule:** 36 working days, 7.2 weeks, with the team of 3 the scope states. Inside the 10-week window with 2.8 weeks to spare.
|
||||
- **The critical path is the customer's:** ordering the interconnect circuits, 30 days, then the routers and attachments, then validation in the three environments the scope names. The team's own work is done by about Day 13 and waits.
|
||||
- **The timeline was added to the solution guide** and its numbers are in `execution.json`.
|
||||
|
||||
To look at:
|
||||
|
||||
- **The estimates look short for an enterprise landing zone.** Two days for the hub and spoke networks, one for the pipeline and state, two for the resource hierarchy. The planner was told to estimate for one engineer who knows the provider and not to pad, and it did. Whether to ask for a contingency, or a range, is the owner's call.
|
||||
- **The plan's length rests on one assumed number,** the 30-day carrier lead time, which the planner chose. It is shown as the customer's and as an assumption.
|
||||
- No start date was in the spec, so there are no calendar dates and no Mermaid chart.
|
||||
46
.env.example
46
.env.example
@@ -11,8 +11,10 @@ A2A_PORT=8000
|
||||
# A2A_PUBLIC_URL=https://agents.example.com/solution-architect
|
||||
|
||||
# Models (providers/<name>.yaml): gemini/<model> uses ADK's native Gemini client.
|
||||
# These are read by Google's client, not by this app's settings. The app exports them
|
||||
# from this file at start-up; a value already set in the environment wins.
|
||||
# Vertex AI with Application Default Credentials:
|
||||
# GOOGLE_GENAI_USE_VERTEXAI=true
|
||||
# GOOGLE_GENAI_USE_ENTERPRISE=true
|
||||
# GOOGLE_CLOUD_PROJECT=your-project-id
|
||||
# GOOGLE_CLOUD_LOCATION=global
|
||||
# GOOGLE_APPLICATION_CREDENTIALS=/app/credentials/adc.json
|
||||
@@ -33,16 +35,34 @@ TERRAFORM_TIMEOUT_SECONDS=300
|
||||
# Relative to the repository root; set it empty to disable.
|
||||
TF_PLUGIN_CACHE_DIR=.cache/terraform-plugins
|
||||
|
||||
# Use published Terraform modules when a caller does not say. Off writes plain
|
||||
# resources; a caller opts in per Execution with terraform_modules.
|
||||
TERRAFORM_MODULES=false
|
||||
|
||||
# Hierarchical Execution Engine
|
||||
ORCHESTRATOR=router # router | model
|
||||
ORCHESTRATOR_BUDGET=40
|
||||
SPECIALIST_BUDGET=15
|
||||
# With a user present, a Deliverable is shown to them before it is first submitted.
|
||||
CONFIRM_DRAFTS=true
|
||||
# Give Specialists the lessons Skill. Set false to run without anything learned.
|
||||
LESSONS_ENABLED=true
|
||||
# Give a role the lighter model its provider bundle names for a first attempt.
|
||||
MODEL_TIERS=false
|
||||
# Overlay Skills: an organisation's standards or one engagement's constraints. The
|
||||
# folders they live in, and the ones every Execution loads (comma-separated names).
|
||||
OVERLAY_SKILLS_DIRS=skills/overlays
|
||||
DEFAULT_OVERLAY_SKILLS=
|
||||
MAX_REVISIONS=3
|
||||
MAX_ORCHESTRATOR_TURNS=100
|
||||
MAX_PARALLEL_SPECIALISTS=4
|
||||
CHECKPOINTER=sqlite
|
||||
CHECKPOINT_DB_PATH=checkpoints.db
|
||||
|
||||
# A model reads the requirements against the Checks when the Target architecture is
|
||||
# first submitted, and returns what no Check verifies. One model run per Execution.
|
||||
DESIGN_COVERAGE_REVIEW=false
|
||||
|
||||
# Jev decision service, through the TypeSafe AI Python SDK (typesafe-sdk).
|
||||
# Leave the key unset to run without it: every decision then takes its fallback.
|
||||
# TYPESAFE_API_KEY=
|
||||
@@ -56,6 +76,30 @@ JEV_BUDGET_TOKENS=1000000
|
||||
JEV_ACT_THRESHOLD=0.75
|
||||
JEV_CLOSE_THRESHOLD=0.15
|
||||
JEV_CONFIDENCE_THRESHOLD=0.6
|
||||
# Review a design's coverage with Jev before it is submitted: for each condition a
|
||||
# requirement lists, which Check verifies it. Off until a full case has run with it.
|
||||
JEV_COVERAGE_REVIEW=false
|
||||
# How likely "no Check verifies this" must be before the condition is raised.
|
||||
JEV_COVERAGE_THRESHOLD=0.6
|
||||
# Review the requirements with Jev before they are submitted: does any name a cloud
|
||||
# product? Off until a full case has run with it.
|
||||
JEV_REQUIREMENTS_REVIEW=false
|
||||
JEV_REQUIREMENTS_THRESHOLD=0.3
|
||||
# How directly a change must affect a pillar for its advisor to be consulted again:
|
||||
# 0 not at all, 1 only indirectly, 2 directly.
|
||||
JEV_PILLAR_THRESHOLD=1.5
|
||||
# In a Change request, an item this unlikely to have really changed is listed as reworded.
|
||||
JEV_REWORDED_THRESHOLD=0.25
|
||||
# Name, in a Specialist's context, the references of its Skills its task needs:
|
||||
# 0 not needed, 1 might help, 2 needed.
|
||||
JEV_SKILL_ROUTING=true
|
||||
JEV_SKILL_THRESHOLD=1.25
|
||||
# Judge each Execution's design recommendations when it ends; kept in execution.json.
|
||||
JEV_ASSESS_EXECUTIONS=true
|
||||
# Withhold an MCP server's reply that reads as instructions to the agent, and flag a
|
||||
# request or reply from the user that does.
|
||||
JEV_GUARDRAIL=true
|
||||
JEV_GUARDRAIL_THRESHOLD=0.75
|
||||
|
||||
# PostgreSQL (Execution records, and checkpoints when CHECKPOINTER=postgres)
|
||||
POSTGRES_HOST=localhost
|
||||
|
||||
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
@@ -14,20 +14,17 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: hashicorp/setup-terraform@v3
|
||||
with:
|
||||
terraform_version: 1.6.6
|
||||
- name: Terraform format
|
||||
run: terraform fmt -check -recursive terraform
|
||||
- name: Terraform init
|
||||
working-directory: terraform
|
||||
run: terraform init -backend=false
|
||||
- name: Terraform validate
|
||||
working-directory: terraform
|
||||
run: terraform validate
|
||||
terraform_version: 1.14.3
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install quality tools
|
||||
run: python -m pip install --disable-pip-version-check ruff==0.6.9 mypy==1.11.2 pytest==8.3.3
|
||||
cache: pip
|
||||
cache-dependency-path: |
|
||||
requirements.txt
|
||||
requirements-dev.txt
|
||||
# The tests import the application, so its dependencies are installed too.
|
||||
- name: Install dependencies
|
||||
run: python -m pip install --disable-pip-version-check -r requirements.txt -r requirements-dev.txt
|
||||
- name: Lint
|
||||
run: ruff check .
|
||||
- name: Type-check
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# L-01: Create Specific Checks for All Constraints
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: 13ebd6fd65
|
||||
Proposed: 2026-10-09
|
||||
Published: 2026-10-09
|
||||
|
||||
## Rule
|
||||
|
||||
Create specific Checks for every explicit constraint, metric, or capability mentioned in a requirement, rather than relying on a single broad Check.
|
||||
|
||||
## Why
|
||||
|
||||
If detailed constraints are missed, the validation phase will reject the design for incomplete coverage, forcing a revision.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 14 of 21 Executions, 58 times in all: validation proposed a Check the design lacked.
|
||||
|
||||
## Proof
|
||||
|
||||
Evaluation without lessons: `20261009T195603Z`; with: `20261009T195607Z`.
|
||||
|
||||
| Case | Score | Revisions | Minutes | Tokens (M) |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| case-03-internal-web-app | 1.00 → 1.00 | 1 → 0 | 28 → 22 | 3.00 → 2.32 |
|
||||
|
||||
Quality held and revisions, seconds, tokens fell: kept.
|
||||
|
||||
This compares every published lesson together, on one run each way. Runs of the same case vary, so one pair suggests a direction and does not settle it.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-09.
|
||||
35
.scratch/lessons/issues/02-assign-checks-to-every-element.md
Normal file
35
.scratch/lessons/issues/02-assign-checks-to-every-element.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# L-02: Assign Checks to Every Element
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: 93d74c1245
|
||||
Proposed: 2026-10-09
|
||||
Published: 2026-10-09
|
||||
|
||||
## Rule
|
||||
|
||||
Give every Element at least one Check before you submit.
|
||||
|
||||
## Why
|
||||
|
||||
The submission tool will reject the architecture if any Element lacks a Check, wasting an attempt.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 13 of 21 Executions, 13 times in all: submit_deliverable refused: Not submitted. The Deliverable is missing: target-architecture.json: Element … has no Check; target-architectu.
|
||||
|
||||
## Proof
|
||||
|
||||
Evaluation without lessons: `20261009T195603Z`; with: `20261009T195607Z`.
|
||||
|
||||
| Case | Score | Revisions | Minutes | Tokens (M) |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| case-03-internal-web-app | 1.00 → 1.00 | 1 → 0 | 28 → 22 | 3.00 → 2.32 |
|
||||
|
||||
Quality held and revisions, seconds, tokens fell: kept.
|
||||
|
||||
This compares every published lesson together, on one run each way. Runs of the same case vary, so one pair suggests a direction and does not settle it.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-09.
|
||||
@@ -0,0 +1,35 @@
|
||||
# L-03: Verify Resource Arguments for Checks
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: f1e7c68393
|
||||
Proposed: 2026-10-09
|
||||
Published: 2026-10-09
|
||||
|
||||
## Rule
|
||||
|
||||
Verify that the specific resource type used for an Element actually supports the configuration argument you specify in a Check. Remember that access policies and certain configurations often require entirely separate resources.
|
||||
|
||||
## Why
|
||||
|
||||
If a Check specifies an argument that does not exist on the resource, it cannot be implemented, forcing an architectural revision.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 3 of 21 Executions, 3 times in all: revised because a Check named something its resource cannot do.
|
||||
|
||||
## Proof
|
||||
|
||||
Evaluation without lessons: `20261009T195603Z`; with: `20261009T195607Z`.
|
||||
|
||||
| Case | Score | Revisions | Minutes | Tokens (M) |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| case-03-internal-web-app | 1.00 → 1.00 | 1 → 0 | 28 → 22 | 3.00 → 2.32 |
|
||||
|
||||
Quality held and revisions, seconds, tokens fell: kept.
|
||||
|
||||
This compares every published lesson together, on one run each way. Runs of the same case vary, so one pair suggests a direction and does not settle it.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-09.
|
||||
@@ -0,0 +1,30 @@
|
||||
# L-04: Avoid Using Values as Setting Names
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: 22ff1f5fed
|
||||
Proposed: 2026-10-09
|
||||
Published: 2026-10-09
|
||||
Retired: 2026-10-09
|
||||
|
||||
## Rule
|
||||
|
||||
When writing a Check for a configuration block that takes a name and value, explicitly state the block's argument name instead of writing the expected value as if it were the setting itself.
|
||||
|
||||
## Why
|
||||
|
||||
Automated reviews may mistake specific expected values for invalid setting names, causing warnings and submission delays.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 2 of 21 Executions, 4 times in all: submit_deliverable refused: Not submitted. A review found: Check …: google_sql_database_instance has no setting named cloudsql.iam_authent.
|
||||
|
||||
## Proof
|
||||
|
||||
Not yet measured.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-09.
|
||||
|
||||
- 2026-10-09: retired. The schema review no longer reads a value written with dots (a database flag, a service name) as a setting, so the rule has nothing left to work around.
|
||||
@@ -0,0 +1,35 @@
|
||||
# L-05: Include Required Arguments in Alert Policies
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: deployment_guidance
|
||||
Evidence-key: 2d4ff48141
|
||||
Proposed: 2026-10-09
|
||||
Published: 2026-10-09
|
||||
|
||||
## Rule
|
||||
|
||||
Always verify and include all required arguments (such as time window definitions) when configuring nested blocks in monitoring alert policies.
|
||||
|
||||
## Why
|
||||
|
||||
Missing required arguments in nested blocks will cause Terraform validation to fail, preventing submission.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 2 of 21 Executions, 2 times in all: terraform_validate refused: terraform validate failed: Error: Missing required argument on main.tf line …, in resource … …: …: condition_m.
|
||||
|
||||
## Proof
|
||||
|
||||
Evaluation without lessons: `20261009T195603Z`; with: `20261009T195607Z`.
|
||||
|
||||
| Case | Score | Revisions | Minutes | Tokens (M) |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| case-03-internal-web-app | 1.00 → 1.00 | 1 → 0 | 28 → 22 | 3.00 → 2.32 |
|
||||
|
||||
Quality held and revisions, seconds, tokens fell: kept.
|
||||
|
||||
This compares every published lesson together, on one run each way. Runs of the same case vary, so one pair suggests a direction and does not settle it.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-09.
|
||||
@@ -0,0 +1,35 @@
|
||||
# L-06: Do Not Mark Requirements as Not Applicable
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: cd5ae98124
|
||||
Proposed: 2026-10-09
|
||||
Published: 2026-10-09
|
||||
|
||||
## Rule
|
||||
|
||||
Do not list Requirements in the not applicable field, as this field is strictly for Design Recommendations. Ensure every Requirement has at least one Check.
|
||||
|
||||
## Why
|
||||
|
||||
The submission tool will reject the deliverable if a Requirement lacks a Check or is incorrectly marked as not applicable.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 2 of 21 Executions, 2 times in all: submit_deliverable refused: Not submitted. The Deliverable is missing: Requirement … has no Check; Requirement … has no Check; Requirement.
|
||||
|
||||
## Proof
|
||||
|
||||
Evaluation without lessons: `20261009T195603Z`; with: `20261009T195607Z`.
|
||||
|
||||
| Case | Score | Revisions | Minutes | Tokens (M) |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| case-03-internal-web-app | 1.00 → 1.00 | 1 → 0 | 28 → 22 | 3.00 → 2.32 |
|
||||
|
||||
Quality held and revisions, seconds, tokens fell: kept.
|
||||
|
||||
This compares every published lesson together, on one run each way. Runs of the same case vary, so one pair suggests a direction and does not settle it.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-09.
|
||||
29
.scratch/lessons/issues/07-verify-location-constraints.md
Normal file
29
.scratch/lessons/issues/07-verify-location-constraints.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# L-07: Verify location constraints
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: 493b0a95d9
|
||||
Proposed: 2026-10-10
|
||||
Published: 2026-10-10
|
||||
|
||||
## Rule
|
||||
|
||||
When a requirement specifies where resources must be provisioned, such as a designated region or multi-zone placement, create a Check for the `region` or `location` argument on every applicable Element, naming the region the design uses. Do not write a Check about a property of the region that code cannot show, such as its carbon rating.
|
||||
|
||||
## Why
|
||||
|
||||
Validation frequently catches missing location constraints. Without this Check, resources may be provisioned in default regions, violating location requirements. A Check about a region's carbon rating cannot be verified from code and sends the design back.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 5 of 32 Executions, 8 times in all: validation proposed a Check about `location` that the design lacked.
|
||||
|
||||
## Proof
|
||||
|
||||
Not yet measured.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-10. It covers which region is set, which code can show. It does not settle whether a region is low-carbon, which code cannot show.
|
||||
|
||||
Reworded with the owner's approval on 2026-10-10: "a low-carbon location" led to a Check about the region's carbon score, which could not be verified.
|
||||
27
.scratch/lessons/issues/08-cloud-sql-backup-encryption.md
Normal file
27
.scratch/lessons/issues/08-cloud-sql-backup-encryption.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# L-08: Cloud SQL backup encryption
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: 08d64df049
|
||||
Proposed: 2026-10-10
|
||||
Published: 2026-10-10
|
||||
|
||||
## Rule
|
||||
|
||||
When writing a Check for CMEK encryption on a `google_sql_database_instance`, do not require an `encryption_key_name` argument for backup storage, as the instance-level `encryption_key_name` automatically encrypts backups as well.
|
||||
|
||||
## Why
|
||||
|
||||
The database instance resource does not have a separate encryption key argument for backups. Asking for one causes validation to reject the Check as un-implementable.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 3 of 32 Executions, 3 times in all: a Check about `google_sql_database_instance` asked for something that resource cannot do.
|
||||
|
||||
## Proof
|
||||
|
||||
Not yet measured.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-10.
|
||||
27
.scratch/lessons/issues/09-backend-service-capabilities.md
Normal file
27
.scratch/lessons/issues/09-backend-service-capabilities.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# L-09: Backend Service capabilities
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: 1cacec9a09
|
||||
Proposed: 2026-10-10
|
||||
Published: 2026-10-10
|
||||
|
||||
## Rule
|
||||
|
||||
When writing Checks for a `google_compute_backend_service`, do not verify IAM roles inside the backend service or require health checks when it is configured with a Serverless NEG.
|
||||
|
||||
## Why
|
||||
|
||||
Roles are verified via IAM bindings outside the backend service, and Serverless NEGs do not support health checks. Invalid Checks cause the design to be rejected during validation.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 3 of 32 Executions, 3 times in all: a Check about `google_compute_backend_service` asked for something that resource cannot do.
|
||||
|
||||
## Proof
|
||||
|
||||
Not yet measured.
|
||||
|
||||
## Comments
|
||||
|
||||
Approved by the owner on 2026-10-10.
|
||||
29
.scratch/lessons/issues/10-pub-sub-persistence-regions.md
Normal file
29
.scratch/lessons/issues/10-pub-sub-persistence-regions.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# L-10: Pub/Sub persistence regions
|
||||
|
||||
Status: ready-for-agent
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: ba78caba9a
|
||||
Proposed: 2026-10-10
|
||||
Published: 2026-10-10
|
||||
|
||||
## Rule
|
||||
|
||||
When a requirement dictates that a messaging queue or topic must replicate across zones or stay within a specific region, create a Check for the `message_storage_policy.allowed_persistence_regions` argument on the topic Element.
|
||||
|
||||
## Why
|
||||
|
||||
Without this Check, topics might use default storage policies that violate geographical or high-availability requirements.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 2 of 32 Executions, 4 times in all: validation proposed a Check about `allowed_persistence_regions` that the design lacked.
|
||||
|
||||
## Proof
|
||||
|
||||
Not yet measured.
|
||||
|
||||
## Comments
|
||||
|
||||
Held by the owner on 2026-10-10, on the agent's view: seen in 2 of 32 Executions, and L-07 partly covers it. To be looked at again if it recurs.
|
||||
|
||||
Approved by the owner on 2026-10-10, after its subject caused a Revision again in case 06 (`20261010T134034Z`).
|
||||
26
.scratch/lessons/issues/11-cmek-encryption-checks.md
Normal file
26
.scratch/lessons/issues/11-cmek-encryption-checks.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# L-11: CMEK encryption checks
|
||||
|
||||
Status: wontfix
|
||||
Deliverable: target_architecture
|
||||
Evidence-key: 5cd8dc3cda
|
||||
Proposed: 2026-10-10
|
||||
|
||||
## Rule
|
||||
|
||||
Whenever a requirement mandates encryption at rest, explicitly create a Check ensuring that the `kms_key_name` (or the equivalent CMEK argument) is configured on every applicable Element.
|
||||
|
||||
## Why
|
||||
|
||||
Without an explicit Check, elements may default to Google-managed keys, leading to validation failures against security constraints.
|
||||
|
||||
## Evidence
|
||||
|
||||
Seen in 2 of 32 Executions, 2 times in all: validation proposed a Check about `kms_key_name` that the design lacked.
|
||||
|
||||
## Proof
|
||||
|
||||
Not yet measured.
|
||||
|
||||
## Comments
|
||||
|
||||
Rejected by the owner on 2026-10-10, on the agent's view: encryption at rest is on by default, and this rule would put customer-managed keys on designs whose requirements did not ask for them.
|
||||
364
.scratch/scoping-and-work-breakdown/spec.md
Normal file
364
.scratch/scoping-and-work-breakdown/spec.md
Normal file
@@ -0,0 +1,364 @@
|
||||
# Spec: Scoping from a scope spec, and a work breakdown structure
|
||||
|
||||
Status: ready-for-agent
|
||||
|
||||
Accepted by the owner on 2026-10-11. Stage 1 is built; `.agents/plans/iter-09-scoping/` says what is done.
|
||||
|
||||
- Glossary: [`CONTEXT.md`](../../CONTEXT.md). New terms this would add are in **Language** below.
|
||||
- Builds on: [ADR-0005](../../docs/adr/0005-the-target-architecture-is-an-explicit-graph.md) (ids along the Requirements chain), [ADR-0006](../../docs/adr/0006-a-change-request-starts-from-a-baseline-execution.md) (Change requests), [ADR-0002](../../docs/adr/0002-skills-are-the-portable-unit-of-behaviour.md) (behaviour in Skills).
|
||||
- Would need: one new ADR, for a new first Phase and a new start to the Requirements chain.
|
||||
|
||||
## Problem
|
||||
|
||||
The Intent is the customer's request, saved word for word. For case 06 it is one sentence. Everything else a design needs (how many users, what availability, which region, what budget, which compliance regime, what exists today) is assumed by the requirements analyst or, in the evaluation, supplied by pattern-matched answers.
|
||||
|
||||
Three days of runs trace most downstream trouble to what nobody stated: Checks the validator asks for on topics the customer never raised, checklist items the request cannot settle, a "low-carbon region" no code can show. Nothing tells the customer at the start how much of their design rests on assumption, and a requirement does not record whether the customer stated it or the agent assumed it.
|
||||
|
||||
Separately, the agent delivers a design and its code but no plan for building it.
|
||||
|
||||
## Decisions taken
|
||||
|
||||
The owner accepted these defaults on 2026-10-11.
|
||||
|
||||
1. **Scoping is a Phase the customer approves,** before requirements discovery.
|
||||
2. **Its centre is a scope spec:** a YAML file that may arrive complete, partly filled or not at all.
|
||||
3. **Architects write the spec,** the owner and colleagues, not end customers. Field names may be technical.
|
||||
4. **A small set of fields is essential** and always settled before work starts. Which they are depends on the kind of engagement.
|
||||
5. **Two files.** The file supplied is never altered. A completed copy is written beside it.
|
||||
6. **The run options live in the spec,** so one file starts an Execution.
|
||||
7. **Where the spec and the prose request disagree, the spec wins** and the customer is shown the conflict.
|
||||
8. **The work breakdown structure is a new Deliverable,** after validation, in the packaging Phase, grouped by component as the technical decomposition is, covering the technical build.
|
||||
9. **Scoping is built before the work breakdown structure.**
|
||||
|
||||
## Language
|
||||
|
||||
Terms to add to `CONTEXT.md` when built:
|
||||
|
||||
- **Scope spec:** the structured statement of what the customer wants and the facts a design depends on, as a file. It sits beside the Intent, which stays in the customer's words.
|
||||
- **Scoping:** the Phase that completes the scope spec and has the customer approve it.
|
||||
- **Work breakdown structure:** the Deliverable that divides building the Target architecture into work packages and activities, with a timeline.
|
||||
- **Work package:** a unit of work that delivers named Elements and is done when their Checks pass.
|
||||
|
||||
Already in the glossary and used here: Intent, Customer question, Change request, Baseline, Requirements chain.
|
||||
|
||||
## The scope spec
|
||||
|
||||
### What a field can say
|
||||
|
||||
Every field holds a value or one of three words:
|
||||
|
||||
| Written | Meaning | What the agent does |
|
||||
|---|---|---|
|
||||
| a value | The customer states this | Uses it. Recorded as `supplied`. |
|
||||
| `ask`, or the field left out | Not known yet | Asks, when someone is present. Otherwise treats it as `decide` and lists it under `discovery_gaps`. |
|
||||
| `decide` | You choose | Picks a default, recorded as `assumed` with the default and what it affects. |
|
||||
| `not_applicable` | Does not apply | Asks nothing and assumes nothing. |
|
||||
|
||||
A field name the catalogue does not have is an error that names the field. Nothing is silently ignored.
|
||||
|
||||
### Tiers
|
||||
|
||||
| Tier | When it is settled |
|
||||
|---|---|
|
||||
| essential | Always, before any work: asked when someone is present, and refused with a list when nobody is and it is neither supplied nor `decide`. |
|
||||
| important | Asked when someone is present; defaulted otherwise. |
|
||||
| optional | Defaulted unless supplied. |
|
||||
|
||||
### The draft
|
||||
|
||||
Revised on 2026-10-11 to combine the first draft with the owner's own example, an engagement spec for a regulated landing zone. What each brought is listed under **How the two were combined**. Essential fields are marked; which are essential depends on `engagement.kind`. Values shown are from the owner's example.
|
||||
|
||||
```yaml
|
||||
schema_version: 1 # the catalogue this file is written against
|
||||
|
||||
metadata:
|
||||
customer_case: fintech-global-landing-zone # essential: groups this work's Executions
|
||||
engagement_reference: ENG-2026-UK-084 # yours; carried through, never interpreted
|
||||
client_name: FinTech Global UK
|
||||
author: Pre-Sales Engineering
|
||||
revision: "1.1.0" # yours: the version of this document
|
||||
status: DRAFT # written by the agent; see Status below
|
||||
|
||||
engagement:
|
||||
kind: platform_foundation # essential: workload | platform_foundation | migration
|
||||
|
||||
# 1. What the customer said. The source of truth; nothing here is rewritten.
|
||||
intent:
|
||||
statement: | # essential: verbatim, or consolidated from calls and documents
|
||||
We are a UK-regulated payment platform expanding into Google Cloud. We need an
|
||||
enterprise-grade landing zone ready in under 10 weeks ...
|
||||
requirements: # what the customer stated outright, with their ids
|
||||
- id: REQ-01
|
||||
category: Timeline
|
||||
statement: Platform foundation must be ready for workload ingestion within 10 weeks.
|
||||
- id: REQ-03
|
||||
category: Networking
|
||||
statement: 10Gbps on-premises hybrid connectivity; centralized Palo Alto inspection for egress.
|
||||
exclusions:
|
||||
- Application container deployment (managed by app squads).
|
||||
- Active-active secondary region in phase 1 (warm standby acceptable).
|
||||
success_criteria: decide
|
||||
|
||||
# 2. Where it runs.
|
||||
estate:
|
||||
cloud_provider: gcp # essential; must be a provider this deployment has
|
||||
mode: greenfield # essential: greenfield | brownfield_expansion | migration
|
||||
regions:
|
||||
primary: europe-west2 # essential
|
||||
secondary: europe-west1
|
||||
resiliency_tier: warm_standby
|
||||
data_residency: United Kingdom # essential
|
||||
existing_systems: ask
|
||||
|
||||
# 3. Who uses it and how hard. Essential for kind workload; not_applicable for a foundation.
|
||||
workload:
|
||||
users: {who: not_applicable, count: not_applicable, peak_concurrent: not_applicable}
|
||||
availability: {target: ask, hours: always, recovery_time: ask, recovery_point: ask}
|
||||
|
||||
# 4. Regulation and governance.
|
||||
compliance:
|
||||
industry: financial_services
|
||||
frameworks: [DORA, ISO27001, PCI_DSS_v4] # essential; an empty list means none apply
|
||||
data_classification: confidential # essential
|
||||
encryption: {type: cmek, key_rotation_days: 90}
|
||||
audit_logging: {retention_days: 365, immutable_retention_policy: true}
|
||||
|
||||
# 5. Network.
|
||||
networking:
|
||||
exposure: internal_only # internal_only | internet_facing
|
||||
topology: shared_vpc_hub_and_spoke # allowed values come from the Cloud provider's catalogue
|
||||
hybrid_connectivity: {enabled: true, type: cloud_interconnect, bandwidth_gbps: 10}
|
||||
egress_control: {model: centralized_appliance, appliance_vendor: palo_alto}
|
||||
cidr_allocations: ask
|
||||
|
||||
# 6. Identity, environments and operations.
|
||||
governance:
|
||||
identity_source_of_truth: entra_id
|
||||
pipeline_authentication: workload_identity_federation
|
||||
environment_tiers:
|
||||
- {name: development, archetype: corp_workload}
|
||||
- {name: staging, archetype: corp_workload}
|
||||
- {name: production, archetype: pci_regulated_workload}
|
||||
operations:
|
||||
operating_model: central_platform_broker
|
||||
support_hours: decide
|
||||
monitoring: decide
|
||||
integrations: []
|
||||
|
||||
# 7. How it will be delivered. The work breakdown structure is built from this.
|
||||
delivery:
|
||||
target_start_date: 2026-11-01
|
||||
window_weeks: 10 # essential when the customer has a deadline
|
||||
commercial_model: fixed_price_milestone
|
||||
iac_tooling: terraform
|
||||
ci_cd: github_actions
|
||||
team_size: ask
|
||||
working_days_per_week: 5
|
||||
|
||||
cost:
|
||||
monthly_budget: ask # essential for kind workload
|
||||
currency: GBP
|
||||
|
||||
# 8. How to run the agent.
|
||||
run:
|
||||
pre_approved: false
|
||||
allow_cloud_read: false
|
||||
overlay_skills: []
|
||||
terraform_modules: false
|
||||
```
|
||||
|
||||
### Sections the agent writes
|
||||
|
||||
Only in the completed copy. The supplied file never has to carry them, and if it does they are read as the last run's and replaced.
|
||||
|
||||
```yaml
|
||||
inferred_assumptions:
|
||||
- id: ASSUMP-01
|
||||
field: networking.hybrid_connectivity
|
||||
category: Network Telecom
|
||||
statement: Assumes the client manages the carrier circuit lead time for the 10Gbps interconnect.
|
||||
impact_if_invalid: Blocks the hybrid routing test; delays every activity after it.
|
||||
|
||||
discovery_gaps:
|
||||
- field: networking.cidr_allocations
|
||||
prompt: Specify IP subnet sizes for spoke workloads, for example /22 per environment.
|
||||
severity: HIGH # HIGH is an essential field; MEDIUM important; LOW optional
|
||||
|
||||
provenance: # where every settled value came from
|
||||
estate.regions.primary: supplied
|
||||
cost.monthly_budget: answered
|
||||
operations.monitoring: assumed
|
||||
|
||||
readiness: {supplied: 34, answered: 3, assumed: 6, unknown: 2}
|
||||
```
|
||||
|
||||
`provenance` is one of `supplied`, `answered`, `discovered` (read from the customer's cloud environment), `assumed`, `unknown`. Every `assumed` field has an entry in `inferred_assumptions`, and every `unknown` one in `discovery_gaps`.
|
||||
|
||||
### Status
|
||||
|
||||
The owner's example carries a status. The agent sets it in the completed copy from what has happened; a status written by the author is not trusted.
|
||||
|
||||
| Status | Means |
|
||||
|---|---|
|
||||
| `DRAFT` | Gaps remain, or the conversation is still filling them. |
|
||||
| `UNDER_REVIEW` | Complete, and waiting for the scoping Approval. |
|
||||
| `APPROVED` | The customer approved it; requirements and the later Phases run from it. |
|
||||
| `BASELINE_LOCKED` | Its Execution completed. This copy is the record a Change request starts from, and is never altered. |
|
||||
|
||||
### How the two were combined
|
||||
|
||||
| From the owner's example | How it is kept |
|
||||
|---|---|
|
||||
| The request, verbatim, inside the spec | `intent.statement`. It is also still saved as the Intent, as today. |
|
||||
| The customer's stated requirements, with ids | `intent.requirements`. The agent's requirements trace to these ids, so the Requirements chain starts at what the customer wrote. |
|
||||
| Stated exclusions | `intent.exclusions`. The design is checked for nothing built that is excluded. |
|
||||
| Engagement metadata and status | `metadata`, with the status set by the agent. |
|
||||
| Estate, compliance, networking and governance sections | Kept as written. |
|
||||
| Start date, delivery window, commercial model, tooling | `delivery`. The window becomes a limit the plan is checked against. |
|
||||
| Assumptions with their impact, and gaps with a prompt and a severity | The two agent-written sections, in place of the first draft's flat provenance table. Severity is the tier. |
|
||||
|
||||
| From the first draft | How it is kept |
|
||||
|---|---|
|
||||
| `ask`, `decide` and `not_applicable` | Unchanged. The example had no way to say "not known" other than omission. |
|
||||
| Tiers | Kept, as the severity of a gap. |
|
||||
| Two files | Kept. The author's file is untouched; the agent's sections go in the completed copy. |
|
||||
| Where each value came from | Kept, as `provenance`. |
|
||||
| Users, scale, availability target, budget | Kept under `workload` and `cost`, and essential only for a workload. |
|
||||
| Run options | Kept under `run`. |
|
||||
|
||||
### Where the two pull apart
|
||||
|
||||
Four tensions, each with the resolution proposed. They are the owner's to confirm.
|
||||
|
||||
1. **The example states solution choices; the agent keeps requirements free of them.** A hub-and-spoke topology, an interconnect, customer-managed keys and a named inspection appliance are design decisions. The rule that requirements name no products exists so the agents do not pick a design before the design Phase. It should not stop a customer who has already decided. Proposed: a choice the spec states is a constraint the design must honour and may not change, recorded as supplied. The agents still add none of their own.
|
||||
2. **The example is a landing zone; the agent has only designed workloads.** Every benchmark case is an application. A platform foundation has no users or response times, and has an organisation hierarchy, shared networking and environment archetypes the cases have never exercised. `engagement.kind` lets one spec serve both, but a platform foundation is a new kind of work for the agent and needs its own evaluation case before it is relied on.
|
||||
3. **The example uses one Cloud provider's vocabulary in general fields.** `shared_vpc_hub_and_spoke`, `cloud_interconnect` and `cmek` are Google Cloud's terms. Proposed: the general catalogue says a field such as `networking.topology` exists; the Cloud provider's bundle supplies its allowed values. A second provider then brings its own list and the spec's shape does not change.
|
||||
4. **"Engagement" is a word the glossary avoids.** The agent's term is Customer case. Proposed: `customer_case` stays the key the agent groups by, and `engagement_reference` carries the owner's own number untouched. If the owner would rather the agent's term became Engagement, that is a glossary change to make before this is built.
|
||||
|
||||
### Where the catalogue lives
|
||||
|
||||
A provider-neutral Skill holds the catalogue: each field's type, tier by engagement kind, the question to ask, and guidance for the default. A Cloud provider's bundle adds its allowed values and any fields of its own. An overlay Skill may raise a field's tier, so an organisation can make `compliance.encryption` essential. Code validates a spec against the catalogue; no model decides what is missing.
|
||||
|
||||
## How scoping runs
|
||||
|
||||
| What arrives | What happens |
|
||||
|---|---|
|
||||
| A complete spec | Validated. No gaps, no questions. With `pre_approved` the Phase passes without stopping. |
|
||||
| A partly filled spec, someone present | Gaps are asked for, essential first, a few related fields at a time, with a count of how many are settled. |
|
||||
| A partly filled spec, nobody present | Essential gaps refuse the start, with the list. Others are defaulted and recorded. |
|
||||
| Only a sentence | A model drafts a spec from it, marking everything it did not find as `ask`. It is then a partly filled spec. |
|
||||
|
||||
In conversation an answer is a value, "you decide", or "skip". A skipped field becomes `unknown` and a Customer question in the output. A free-text answer is turned into the field's value and read back before it is written. The customer may supply an edited file at any point in place of answering.
|
||||
|
||||
The Phase ends when the customer approves the completed spec.
|
||||
|
||||
### What it writes
|
||||
|
||||
Under the Customer case, beside the Intent:
|
||||
|
||||
```
|
||||
intent/
|
||||
001.md # the request, in the customer's words (as today)
|
||||
001.scope.yaml # the spec as supplied, unaltered; absent when none was
|
||||
001.scope.completed.yaml # the completed copy: status, assumptions, gaps, provenance, readiness
|
||||
```
|
||||
|
||||
The scoping Deliverable is a short document written from the completed copy: the scope statement, the information register as a table, and the readiness summary. The solution guide opens with that summary.
|
||||
|
||||
### What it changes downstream
|
||||
|
||||
- **The requirements analyst derives; it no longer asks or assumes.** Each requirement names the stated requirement (`REQ-03`) or the spec field it comes from, so the Requirements chain starts at what the customer wrote. A requirement from an `assumed` field says so.
|
||||
- **A stated choice binds the design.** A product, topology or setting the spec states is carried to the design as a constraint, and a design that departs from it is refused.
|
||||
- **Exclusions are checked.** Nothing in `intent.exclusions` may appear in the Target architecture.
|
||||
- **Customer questions** from the pillar checklists (built 2026-10-10) are joined by the `unknown` fields.
|
||||
- **A Change request may be an edited spec.** Code compares the two specs field by field, and that list is what changed. A sentence still works, as now.
|
||||
- **An evaluation case becomes a spec,** replacing the pattern-matched answers.
|
||||
|
||||
## The work breakdown structure
|
||||
|
||||
A new Deliverable in the packaging Phase, produced by a new Specialist after validation, summarised in the solution guide.
|
||||
|
||||
### Its data file
|
||||
|
||||
```json
|
||||
{
|
||||
"work_packages": [
|
||||
{"id": "WP-1", "name": "Network foundation", "parent": null,
|
||||
"components": ["C-2"], "elements": ["E-1", "E-2"],
|
||||
"scope": "The VPC, its subnet and outbound access.",
|
||||
"produces": ["a private network the services attach to"],
|
||||
"skills": ["network engineering"]}
|
||||
],
|
||||
"activities": [
|
||||
{"id": "A-1", "work_package": "WP-1", "name": "Create the VPC and subnet",
|
||||
"days": 1, "after": []},
|
||||
{"id": "A-2", "work_package": "WP-1", "name": "Configure outbound access",
|
||||
"days": 1, "after": ["A-1"]}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### What code checks and computes
|
||||
|
||||
- Every Element belongs to a work package, and every work package to a component or a parent. A design cannot be left out of the plan.
|
||||
- A work package's acceptance criteria are the Checks on its Elements. They are read from the Target architecture, not written again.
|
||||
- Activities form no cycle, and every `after` names an activity that exists.
|
||||
- **The plan is checked against the delivery window.** When `delivery.window_weeks` is set and the computed total exceeds it, the Deliverable says so and names the critical path; it does not shorten estimates to fit.
|
||||
- **An assumption can hold up the plan.** An entry in `inferred_assumptions` that an activity depends on, such as a carrier's lead time, appears as a dependency the customer owns, so its `impact_if_invalid` is visible on the timeline.
|
||||
- **Milestones.** With a `commercial_model` of fixed price by milestone, each top-level work package ends in a milestone.
|
||||
- **The schedule is computed, not written.** From each activity's days and what it comes after, code works out its earliest start and finish, the critical path and the total. With `delivery.team_size` it limits how many activities run at once.
|
||||
|
||||
### What it renders
|
||||
|
||||
Three views, all written by code from the data file, as the architecture diagram is:
|
||||
|
||||
- **WBS dictionary:** the hierarchy, each work package with its scope, what it produces, its Elements, its acceptance Checks and the skills it needs.
|
||||
- **Activity sequence list:** each activity with its days, what it follows, its start and finish day, and whether it is on the critical path.
|
||||
- **Timeline** on a relative axis, Day 0 to Day N:
|
||||
|
||||
```
|
||||
Activity Day 0 5 10 15 18
|
||||
A-1 Create the VPC and subnet ██
|
||||
A-2 Configure outbound access ██
|
||||
A-3 Provision the database █████
|
||||
A-4 Deploy the application ████
|
||||
A-5 Load balancer and access ███
|
||||
A-6 Monitoring and alerts ██
|
||||
A-7 Validation in test ████
|
||||
```
|
||||
|
||||
The chart format is to be settled when built: a Mermaid Gantt chart if it can show a relative day axis, and otherwise a drawn table like the one above.
|
||||
|
||||
### What it says about itself
|
||||
|
||||
Durations are a model's estimates. The Deliverable states their basis (working days, the team size from the spec) and that they are indicative. The timeline stays on a relative day axis; when `delivery.target_start_date` is set, the activity list also gives calendar dates.
|
||||
|
||||
## Order of work
|
||||
|
||||
| Stage | What | Usable on its own |
|
||||
|---|---|---|
|
||||
| 1 | The catalogue, validation, the gap list, the two files saved beside the Intent, the run options read from the spec | Yes: a complete spec starts a pre-approved Execution |
|
||||
| 2 | The conversation that fills gaps; scoping as a Phase with its Deliverable and Approval; a spec drafted from a sentence | Yes |
|
||||
| 3 | Requirements traced to spec fields; readiness in the guide | Yes |
|
||||
| 4 | An edited spec as a Change request | Yes |
|
||||
| 5 | The work breakdown structure | Yes, with stage 1 for `delivery` |
|
||||
| 6 | Evaluation cases as specs | Yes |
|
||||
|
||||
## Not in this spec
|
||||
|
||||
- Attaching documents (a statement of work, a diagram) as a source for the spec.
|
||||
- Reading the customer's cloud environment to fill `current_estate`. The `discovered` source is reserved for it.
|
||||
- Delivery activities beyond the technical build, such as security review, user acceptance and cutover.
|
||||
- Cost of the work, or named people.
|
||||
|
||||
## Open questions
|
||||
|
||||
1. The four tensions under **Where the two pull apart**: are the proposed resolutions right?
|
||||
2. Which fields are essential for each engagement kind? The draft marks them; the owner's example suggests the delivery window and compliance frameworks matter more than budget for a foundation.
|
||||
3. In `pre_approved` runs an essential gap refuses the start. Is that right, or should it default and warn?
|
||||
4. Should the scoping Approval be skippable when the spec arrived complete and someone is present?
|
||||
5. Is a platform foundation in scope now, with its own evaluation case, or should scoping be built against workloads first?
|
||||
|
||||
## Comments
|
||||
|
||||
- 2026-10-11, the owner: a platform foundation is in scope now; an engagement name and a Customer case are equivalent references; the implementation will eventually be provider-agnostic. The other tensions and open questions were taken as proposed: a stated choice binds the design; an essential gap refuses a pre-approved start; the scoping Approval is not skipped. Recorded in ADR-0008.
|
||||
42
CONTEXT.md
42
CONTEXT.md
@@ -19,13 +19,21 @@ A caller-supplied grouping of Executions. A Session never feeds earlier outputs
|
||||
_Avoid_: conversation, context
|
||||
|
||||
**Customer case**:
|
||||
A caller-supplied grouping of the Executions run for one customer workload, identified by a short slug. Every Execution belongs to one; an Execution started without one belongs to `unassigned`. A Customer case ties each request to the Deliverables generated for it. It feeds one Execution's outputs into another only when the caller starts a Change request and names the Baseline.
|
||||
_Avoid_: engagement, project, account, tenant
|
||||
A caller-supplied grouping of the Executions run for one customer engagement, identified by a short slug. An engagement and a Customer case are the same thing: a reference such as `ENG-2026-UK-084` names the case `eng-2026-uk-084`. Every Execution belongs to one; an Execution started without one belongs to `unassigned`. A Customer case ties each request to the Deliverables generated for it. It feeds one Execution's outputs into another only when the caller starts a Change request and names the Baseline.
|
||||
_Avoid_: project, account, tenant
|
||||
|
||||
**Intent**:
|
||||
What the customer wants from a Customer case, in their own words and at a high level. Each Workflow request made in the case is a statement of it, and the statements are kept in order as its history. The Intent is the customer's; requirements are what the agents derive from it.
|
||||
_Avoid_: brief, ask, requirements (which are the derived Deliverable)
|
||||
|
||||
**Scope spec**:
|
||||
The structured statement of what the customer wants and the facts a design depends on, as a file. It may arrive complete or partly filled. It sits beside the Intent, which stays in the customer's words, and a value it states is the customer's decision.
|
||||
_Avoid_: brief, questionnaire, requirements (which are derived from it)
|
||||
|
||||
**Scoping**:
|
||||
Completing the scope spec, from what was supplied, what the customer answers and what the agent is left to decide, and having the customer approve it before requirements begin.
|
||||
_Avoid_: discovery (which reads a cloud environment), intake (which reads a message)
|
||||
|
||||
**Change request**:
|
||||
An Execution started to say how the customer's Intent has changed. It begins from a Baseline and delivers the full updated Deliverables with an account of what changed and why.
|
||||
_Avoid_: amendment, update run, iteration, re-run
|
||||
@@ -35,7 +43,7 @@ The completed Execution, in the same Customer case, that a Change request starts
|
||||
_Avoid_: parent, previous run, source Execution
|
||||
|
||||
**Phase**:
|
||||
A named grouping of Deliverables: requirements discovery, solution architecture (the design, ending with the Target architecture), solution implementation, solution validation, or packaging. A Phase is complete when all its Deliverables are submitted and the user has granted the Phase's Approval.
|
||||
A named grouping of Deliverables: scoping, requirements discovery, solution architecture (the design, ending with the Target architecture), solution implementation, solution validation, or packaging. A Phase is complete when all its Deliverables are submitted and the user has granted the Phase's Approval.
|
||||
_Avoid_: step, node, stage, pipeline
|
||||
|
||||
**Approval**:
|
||||
@@ -49,7 +57,7 @@ _Avoid_: review round, retry, loop iteration
|
||||
### Agents
|
||||
|
||||
**Orchestrator**:
|
||||
The top-level agent of an Execution, and the only agent that talks to the user. It reasons about which Deliverables are ready to produce, delegates them to Specialists, and asks the user for Approvals.
|
||||
The top-level agent of an Execution, and the only agent that talks to the user. It routes: it works out which Deliverables are ready to produce, delegates them to Specialists, and asks the user for Approvals. It produces no Deliverable itself.
|
||||
_Avoid_: supervisor, manager, root agent, router
|
||||
|
||||
**Specialist**:
|
||||
@@ -66,10 +74,22 @@ _Avoid_: prompt template, instructions, playbook
|
||||
The hyperscaler a solution architecture targets, such as Google Cloud. Each Cloud provider brings its own Skills, plus the MCP servers it hosts for discovering a user's current environment and grounding recommendations in its documentation.
|
||||
_Avoid_: hyperscaler, cloud, platform, target
|
||||
|
||||
**Lesson candidate**:
|
||||
Something an Execution got wrong or was corrected on, recorded as it happened: a Revision and its reason, a tool refusal, a user's request for changes. It is raw material and changes nothing by itself.
|
||||
_Avoid_: learning, memory, feedback record
|
||||
|
||||
**Lesson**:
|
||||
A rule distilled from Lesson candidates across Executions, approved by a person and shown by evaluation to help, then published in a Skill. It carries no client detail.
|
||||
_Avoid_: memory, fine-tuning, learned behaviour
|
||||
|
||||
**Overlay Skill**:
|
||||
A Skill that adds an organisation's standards or one engagement's constraints to what the Cloud provider's Skills say. It is named when an Execution starts and comes only from a place the deployment has configured.
|
||||
_Avoid_: custom prompt, override, plugin
|
||||
|
||||
### Outputs
|
||||
|
||||
**Deliverable**:
|
||||
A document an Execution produces: requirements, technical decomposition, product selection, design recommendations, the Target architecture, architecture description, deployment guidance, validation results, or the Solution guide. Each Deliverable depends on others being approved first.
|
||||
A document an Execution produces: the scope, requirements, technical decomposition, product selection, design recommendations, the Target architecture, architecture description, deployment guidance, validation results, the Work breakdown structure, or the Solution guide. Each Deliverable depends on others being approved first.
|
||||
_Avoid_: artifact, output file
|
||||
|
||||
**Dependency**:
|
||||
@@ -96,6 +116,18 @@ _Avoid_: finding, rule, control, test
|
||||
The unbroken trace from each requirement, through the components that serve it and the Elements and Checks that realise it, to the code that implements them and the validation verdict on each Check.
|
||||
_Avoid_: traceability matrix, lineage
|
||||
|
||||
**Customer question**:
|
||||
Something the architecture depends on that the customer's Intent does not say, recorded with the question to put to them. It marks missing information, not a fault in the design, and its answer may change a recommendation.
|
||||
_Avoid_: gap, failure, open issue, assumption (which is a default the agents chose)
|
||||
|
||||
**Work breakdown structure**:
|
||||
The Deliverable that divides building the Target architecture into Work packages and the activities within them, with a timeline on a relative axis of working days. Its schedule is computed from the activities' durations and dependencies, never written.
|
||||
_Avoid_: project plan, roadmap, schedule (which is one view of it)
|
||||
|
||||
**Work package**:
|
||||
A unit of the build that delivers named Elements, and is done when the Checks on those Elements pass.
|
||||
_Avoid_: task, epic, phase (which groups Deliverables), workstream
|
||||
|
||||
**Solution guide**:
|
||||
The packaged Deliverable that assembles every other Deliverable into the Cloud provider's solution architecture template.
|
||||
_Avoid_: final report, package
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Contributing
|
||||
|
||||
Keep requirements product-neutral until the architecture phase. Do not commit state files, plans, credentials, secret values, or real project identifiers. Update the guide and validation evidence when changing Terraform. Run the commands in `VALIDATION.md` before proposing a change.
|
||||
Read `CLAUDE.md` and `.agents/plans/README.md` first. Behaviour belongs in Skills and cloud-specific knowledge in Skills and the provider bundle, never in the agent's core. Keep requirements product-neutral until the architecture phase. Do not commit state files, plans, credentials, secret values, real project identifiers or lesson candidates, which are client data. Never edit a vendored Skill. Run the commands in `VALIDATION.md` before proposing a change, and record a finished step in `.agents/plans/`.
|
||||
|
||||
63
README.md
63
README.md
@@ -1,6 +1,6 @@
|
||||
# GCP Solution Architecture Agent (`gcp_solution_architecture_agent`)
|
||||
|
||||
A hierarchical ReAct agent that turns a request for a cloud workload into a reviewed solution architecture: requirements, a target design with diagram and infrastructure-as-code, validation results, and a packaged guide. It replaces the [`google-cloud-solution-architecture`](https://github.com/google/skills/blob/main/skills/cloud/google-cloud-solution-architecture/SKILL.md) skill with an agent that runs anywhere. Google Cloud is the first Cloud provider.
|
||||
A hierarchical agent that turns a request for a cloud workload into a reviewed solution architecture: requirements, a target design with diagram and infrastructure-as-code, validation results, and a packaged guide. It replaces the [`google-cloud-solution-architecture`](https://github.com/google/skills/blob/main/skills/cloud/google-cloud-solution-architecture/SKILL.md) skill with an agent that runs anywhere. Google Cloud is the first Cloud provider.
|
||||
|
||||
Vocabulary is defined in [CONTEXT.md](CONTEXT.md), decisions in [docs/adr/](docs/adr/), and the plan and history of each iteration in [.agents/plans/](.agents/plans/README.md).
|
||||
|
||||
@@ -9,15 +9,22 @@ Vocabulary is defined in [CONTEXT.md](CONTEXT.md), decisions in [docs/adr/](docs
|
||||
## 🌟 Architecture & Features
|
||||
|
||||
### 1. Orchestrator and Specialists (`agents/`)
|
||||
One Orchestrator coordinates an Execution and is the only agent that talks to the user. It delegates each Deliverable to one Specialist, and independent Deliverables run in parallel:
|
||||
One Orchestrator coordinates an Execution and is the only agent that talks to the user. It is a router ([ADR-0007](docs/adr/0007-jev-is-the-orchestrators-decision-point.md)): code reads the Execution's state, a decision model (Jev) answers the closed questions that need judgement, and a playbook in code picks the action. A language model only writes what the user reads. It delegates each Deliverable to one Specialist, and independent Deliverables run in parallel:
|
||||
- **Scoping:** `scope-analyst`, which completes the scope spec with the customer.
|
||||
- **Requirements discovery:** `requirements-analyst`, `decomposer`.
|
||||
- **Solution architecture (design):** `product-selector`, `design-advisor` (which consults one `pillar-advisor` per architecture-framework pillar), `target-architect`.
|
||||
- **Solution implementation:** `describer`, `iac-author`.
|
||||
- **Solution validation:** `validator`.
|
||||
- **Packaging:** `packager`.
|
||||
- **Packaging:** `delivery-planner`, which plans the build as a work breakdown structure, and `packager`.
|
||||
|
||||
Each Phase needs the user's explicit Approval before work that depends on it starts. A pre-approved mode serves batch and evaluation runs.
|
||||
|
||||
An Execution may start from a **scope spec** ([ADR-0008](docs/adr/0008-scoping-starts-from-a-scope-spec.md)): a YAML file of what the customer wants and the facts a design depends on, complete or partly filled. Code reads it against a catalogue and refuses a field it does not know. Scoping, the first Phase, completes it: the scope analyst asks for what is missing when someone is present and assumes it, visibly, when nobody is. With no spec it drafts one from the request. The customer approves the result before requirements begin, and a completed copy is kept beside their request with what was assumed and what is still unknown. `python -m app.scope template platform_foundation` prints one to fill in, and `python -m app.scope check <file>` says what a spec lacks. Pass it as `scope` to `/generate` or in A2A metadata.
|
||||
|
||||
The **work breakdown structure** divides building the design into work packages and activities. The planner writes it as data; code checks that every Element belongs to a work package, computes each activity's start and finish from its days and what it follows, finds the critical path, and draws the timeline on a relative axis from Day 0. The plan is checked against the delivery window the scope gives.
|
||||
|
||||
A **Change request** ([ADR-0006](docs/adr/0006-a-change-request-starts-from-a-baseline-execution.md)) starts from a completed Execution in the same Customer case, its Baseline, and delivers the full updated Deliverables with `changes.json`: what changed, what was only reworded, and anything changed that nobody asked for.
|
||||
|
||||
The design Phase ends with the **Target architecture**: one explicit graph of Elements, Relationships and Checks ([ADR-0005](docs/adr/0005-the-target-architecture-is-an-explicit-graph.md)). The user approves it before any infrastructure code is written. The diagram is drawn from it by code, the Terraform must account for every Check, and validation gives a verdict per Check. Requirements, components, products and recommendations each carry ids in a data file, so every requirement can be traced through to its verdict; a submission with a missing link is refused.
|
||||
|
||||
### 2. LangGraph state, ADK agents (`app/`)
|
||||
@@ -33,16 +40,29 @@ Execution records (status, Ledger events, submitted Deliverables) go to PostgreS
|
||||
Behaviour lives in Agent Skills (agentskills.io format) at the repository root, per ADR-0002:
|
||||
- `skills/vendor/google/`: the upstream solution-architecture Skill and six Well-Architected Framework pillar Skills, vendored unmodified.
|
||||
- `skills/cloud-discovery/`, `skills/iac-validation/` and `skills/requirements-chain/`: our own Skills for the tooling and the data files.
|
||||
- `skills/google-cloud-lessons/`: lessons learned from earlier Executions, written by the lessons loop (`app/learning/`, `eval/curate_lessons.py`) from proposals a person approved ([ADR-0004](docs/adr/0004-lessons-and-overlays-arrive-as-skills.md)). Set `LESSONS_ENABLED=false` to run without them.
|
||||
- `skills/overlays/`: overlay Skills, each an organisation's standards or one engagement's constraints. An Execution names the ones it wants; `DEFAULT_OVERLAY_SKILLS` names the ones every Execution loads. The one here is an example, not anyone's policy.
|
||||
- `skills/google-cloud-iac-patterns/`: Terraform patterns for Google Cloud products, each validated by a test against the provider version `providers/gcp.yaml` pins.
|
||||
- `skills/google-cloud-iac-modules/`: published modules from `terraform-google-modules` that work with that provider version, and the rule for when one fits better than plain resources. Generated code is plain resources by default. An Execution opts in with `terraform_modules: true`, and may then take a module only from the registry namespaces `providers/gcp.yaml` lists, at one exact version.
|
||||
|
||||
`app/skills/agent_skills.py` discovers and validates them; the ADK runtime (`app/adk/adk_runtime.py`) loads them on demand. `providers/gcp.yaml` assigns Skills, tools, MCP servers and models to each role in `agents/`.
|
||||
|
||||
### 5. A2A Server (`app/main.py`)
|
||||
### 5. Decisions by Jev (`app/tools/jev.py`)
|
||||
Jev is a hosted decision model that answers typed, closed questions with a probability. It is optional: without `TYPESAFE_API_KEY` every decision takes its fallback in code. Beyond routing the Orchestrator it is used to:
|
||||
- read a message that starts something: a new request, a Change request, or a question (`app/nodes/intake.py`);
|
||||
- choose which pillar advisors a change needs consulting again, and which Skill references a Specialist should read first;
|
||||
- withhold a remote MCP server's reply that reads as instructions to the agent, and flag the same in the user's text;
|
||||
- tell a rewording from a real change in a Change request;
|
||||
- score each Execution's design recommendations when it ends, kept in `execution.json` under `assessment`.
|
||||
|
||||
Every setting, with its threshold, is described in `.env.example`. What each use measured against the live service is in `.agents/plans/iter-05-jev-decisions/`.
|
||||
|
||||
### 6. A2A Server (`app/main.py`)
|
||||
The container starts the hierarchical Execution engine (ADR-0003) behind an A2A server:
|
||||
- `POST /a2a`: A2A JSON-RPC for interactive, multi-turn Executions with Approvals.
|
||||
- `GET /.well-known/agent-card.json`: A2A agent card.
|
||||
- `GET /health`: Health signal, the Cloud provider and any MCP discovery gaps.
|
||||
- `POST /generate`: One-shot, pre-approved Execution for batch and evaluation callers. Pass `customer_case` to group it with the case's other Executions; over A2A, send `customer_case` in the message metadata.
|
||||
- `POST /generate`: One-shot, pre-approved Execution for batch and evaluation callers. Pass `customer_case` to group it with the case's other Executions, `baseline` (an Execution id in that case) to make it a Change request, `overlay_skills` (a list of names) to apply overlay Skills, and `terraform_modules: true` to allow published Terraform modules from the approved sources. Over A2A, send the same fields in the message metadata.
|
||||
|
||||
The original linear pipeline and its REST routes (`/card`, `/validate`, `/sessions/{session_id}`) were removed on 2026-10-06; see `.agents/plans/iter-03-kab-layout/`.
|
||||
|
||||
@@ -65,6 +85,8 @@ pytest -q
|
||||
python3 -m eval.solution_eval
|
||||
```
|
||||
|
||||
Copy `.env.example` to `.env` for local settings. The server and the evaluation read it at start-up, and export its model credentials (`GOOGLE_*`) to the process.
|
||||
|
||||
### Start the A2A Server
|
||||
```bash
|
||||
python3 -m app.main --host 0.0.0.0 --port 8080
|
||||
@@ -86,7 +108,7 @@ podman run -d --name gcp-agent \
|
||||
-v $(pwd)/deliverables:/app/deliverables:Z \
|
||||
-v ~/.config/gcloud/application_default_credentials.json:/app/credentials/adc.json:ro \
|
||||
-e GOOGLE_APPLICATION_CREDENTIALS=/app/credentials/adc.json \
|
||||
-e GOOGLE_GENAI_USE_VERTEXAI=true \
|
||||
-e GOOGLE_GENAI_USE_ENTERPRISE=true \
|
||||
-e GOOGLE_CLOUD_PROJECT=your-project-id \
|
||||
-e GOOGLE_CLOUD_LOCATION=global \
|
||||
-e A2A_PUBLIC_URL=http://localhost:8080 \
|
||||
@@ -126,18 +148,22 @@ curl -X POST http://localhost:8080/generate \
|
||||
gcp_solution_architecture_agent/
|
||||
├── agents/ # Framework-neutral role files, one per agent
|
||||
├── providers/ # Cloud provider bundles (gcp.yaml)
|
||||
├── skills/ # Agent Skills: vendored upstream + our tooling Skills
|
||||
├── skills/ # Agent Skills: vendored upstream, our own, lessons, overlays
|
||||
├── app/ # KAB workflow-agent layout
|
||||
│ ├── main.py # A2A server entrypoint (python -m app.main)
|
||||
│ ├── a2a_server.py # Maps A2A tasks to Executions and their prompts
|
||||
│ ├── agent.py # ExecutionEngine and its assembly (composition root)
|
||||
│ ├── baseline.py # Loading the Execution a Change request starts from
|
||||
│ ├── card.py # A2A agent card
|
||||
│ ├── states/ # ExecutionState and the Ledger
|
||||
│ ├── nodes/ # Execution graph nodes (orchestrator, specialist, user)
|
||||
│ ├── workflows/ # Execution graph wiring and the Deliverable dependency graph
|
||||
│ ├── nodes/ # Execution graph nodes, the router and message intake
|
||||
│ ├── workflows/ # Execution graph wiring, the Deliverable dependency graph,
|
||||
│ │ # the Requirements chain and change summaries
|
||||
│ ├── adk/ # Agent-runtime interface, ADK runtime, role loader
|
||||
│ ├── skills/ # Agent Skills discovery and validation
|
||||
│ ├── tools/ # Execution tools, local tools, remote MCP, pillar fan-out
|
||||
│ ├── tools/ # Execution tools, local tools, remote MCP, pillar fan-out,
|
||||
│ │ # the Jev client and each decision that uses it
|
||||
│ ├── learning/ # The lessons loop: evidence, proposals, publishing, proof
|
||||
│ ├── providers.py # Provider bundle loader
|
||||
│ ├── recorder.py # Execution recording
|
||||
│ ├── checkpointing.py # LangGraph checkpointer selection
|
||||
@@ -147,7 +173,10 @@ gcp_solution_architecture_agent/
|
||||
├── eval/ # Evaluation
|
||||
│ ├── solution_eval.py # Real-model evaluation of the Execution engine
|
||||
│ ├── scoring.py # Checks applied to a finished Execution
|
||||
│ └── datasets/ # Benchmark cases (JSON)
|
||||
│ ├── judge.py # The judges for the judged checks (Jev, or a model)
|
||||
│ ├── calibrate_judge.py # Judges against a person's labels, and against each other
|
||||
│ ├── curate_lessons.py # propose, publish, prove and retire lessons
|
||||
│ └── datasets/ # Benchmark cases (JSON) and the judge's labelled set
|
||||
├── deliverables/
|
||||
│ └── cases/ # Everything generated, grouped by Customer case
|
||||
│ └── <customer_case>/
|
||||
@@ -155,18 +184,20 @@ gcp_solution_architecture_agent/
|
||||
│ │ ├── 001.md, 002.md # Each request as the customer stated it, in order
|
||||
│ │ └── history.json # Every request, the Execution it started and how it ended
|
||||
│ └── executions/<execution_id>/
|
||||
│ ├── execution.json # Request, status and files of this Execution
|
||||
│ ├── execution.json # Request, status, Baseline, overlay Skills,
|
||||
│ │ # risks, assessment and files of this Execution
|
||||
│ ├── solution-architecture-guide.md
|
||||
│ ├── deliverables/<kind>.md # One per Deliverable
|
||||
│ ├── requirements.json, components.json, products.json, recommendations.json
|
||||
│ ├── target-architecture.json # Elements, Relationships and Checks
|
||||
│ ├── architecture.mmd # Drawn from the graph
|
||||
│ ├── terraform/, implementation.json # The code, and which part meets each Check
|
||||
│ └── verdicts.json # Validation's verdict on each Check
|
||||
│ ├── verdicts.json # Validation's verdict on each Check
|
||||
│ ├── working.json # What a Change request carries forward
|
||||
│ └── changes.json # In a Change request: what changed and why
|
||||
├── lessons/candidates/<customer_case>/ # Lesson candidates per Execution (gitignored)
|
||||
├── docs/ # Specifications, audit notes & verification records
|
||||
├── terraform/ # Deployable GCP Terraform IaC blueprint
|
||||
├── scripts/ # Vendored-Skill sync, MCP tool listing, Terraform checks
|
||||
├── docs/ # ADRs, agent-skill conventions and operations notes
|
||||
├── scripts/ # Vendored-Skill sync, MCP tool listing
|
||||
└── tests/ # Unit & integration test suite
|
||||
```
|
||||
|
||||
|
||||
@@ -9,16 +9,19 @@ pytest -v
|
||||
# 2. Real-model evaluation of the engine (needs model credentials; costs usage)
|
||||
python3 -m eval.solution_eval
|
||||
|
||||
# 3. Optional Terraform formatting & validation
|
||||
terraform -chdir=terraform fmt -check -recursive
|
||||
terraform -chdir=terraform init -backend=false
|
||||
terraform -chdir=terraform validate
|
||||
# 3. Optional: validate the Terraform an Execution generated
|
||||
terraform -chdir=deliverables/cases/<customer_case>/executions/<execution_id>/terraform init -backend=false
|
||||
terraform -chdir=deliverables/cases/<customer_case>/executions/<execution_id>/terraform validate
|
||||
```
|
||||
|
||||
`init -backend=false` may download the pinned provider constraint but does not create infrastructure. Do not use `terraform apply` as part of validation. A deployment candidate additionally requires an operator-supplied `terraform plan -out=tfplan` and human review.
|
||||
The repository holds no Terraform of its own. The tests need the `terraform` binary (1.14.3 in CI) to validate the code patterns in `skills/google-cloud-iac-patterns/`. `init -backend=false` downloads the pinned provider and creates no infrastructure. Do not use `terraform apply` as part of validation. A deployment candidate additionally requires an operator-supplied `terraform plan -out=tfplan` and human review.
|
||||
|
||||
## Evaluation options
|
||||
|
||||
- `python3 -m eval.solution_eval --judge` adds the judged checks: coverage of each pillar Skill's validation checklist, and a quality rubric for the design recommendations.
|
||||
- `python3 -m eval.solution_eval case-04-interactive-web-app` runs one case with a scripted user in the loop.
|
||||
- Several cases run side by side as separate processes; each writes its own folder under `eval/results/`, with a progress file while it runs.
|
||||
- A case with `change` runs its request to completion and then that change as a Change request, and checks the change is recorded, reaches Checks, and stays contained. A case with `overlay_skills` names overlay Skills, and `code_standards` lists what the generated code must and must not contain.
|
||||
- `LESSONS_ENABLED=false python3 -m eval.solution_eval <case>` runs without the lessons Skill. `python3 -m eval.curate_lessons prove --without <report.json> --with <report.json>` compares the two and records the result in the lesson proposals.
|
||||
- `python3 -m eval.calibrate_judge` measures the judges' stability and agreement. Agreement with a person needs the labels in `eval/datasets/judge/labels.json` filled in.
|
||||
- A case's `thresholds` in `eval/datasets/solution_cases.json` bound its revisions, seconds and tokens; exceeding one is reported as a regression.
|
||||
|
||||
22
agents/coverage-reviewer.md
Normal file
22
agents/coverage-reviewer.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
role: coverage-reviewer
|
||||
tools: []
|
||||
budget: 6
|
||||
---
|
||||
You review the Target architecture of a solution-architecture Execution before anyone approves it. You answer one question: do its Checks verify everything the requirements and design recommendations ask for? You change nothing and write no design. What you find goes back to the target architect once.
|
||||
|
||||
Your task message carries JSON context:
|
||||
|
||||
- `constraints`: the non-functional requirements and the design recommendations. Each has an `id`, its text, `conditions` (what infrastructure code can show, one by one) and sometimes `outside_code` (what code cannot show).
|
||||
- `target_architecture`: the Elements, Relationships and Checks. Each Check has a `source`, the id of the requirement or recommendation it comes from, `applies_to`, the Element or Relationship it is about, and its `statement`. A recommendation listed under `not_applicable` asks nothing.
|
||||
|
||||
Review once, completely:
|
||||
|
||||
- Go through every constraint in turn. For each of its `conditions`, find the Checks whose `source` is that constraint and decide whether they verify the condition on every Element it applies to.
|
||||
- A gap is a condition that no Check verifies, or that a Check verifies more weakly than the words. A Check that says a setting "is set" does not verify a value the condition gives. A condition with two parts needs both verified. A condition about every Element of a kind needs a Check on each one.
|
||||
- For each gap, give the Check that is missing: the constraint's id as `source`, the Element or Relationship id as `applies_to`, and a `statement` that names the setting and the value to verify, as specific as the Checks already there.
|
||||
- Report nothing for what a constraint lists under `outside_code`, and nothing for a recommendation that is `not_applicable`.
|
||||
- Report nothing a Check already verifies in other words, and nothing that is your own idea of good practice: only what a condition's words ask for.
|
||||
- Do not judge whether a Check can be implemented or whether the design is a good one. That is not this review.
|
||||
|
||||
Call `report_gaps` once with every gap, or with an empty list when there are none. You are done when it records them.
|
||||
46
agents/delivery-planner.md
Normal file
46
agents/delivery-planner.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
role: delivery-planner
|
||||
deliverable: work_breakdown
|
||||
tools: []
|
||||
budget: 20
|
||||
includes: [specialist-protocol]
|
||||
---
|
||||
You produce the **work breakdown structure** Deliverable: a plan for building the Target architecture that has been designed and validated. You change nothing in the design. You say how the work divides, in what order it goes, and how long each piece takes.
|
||||
|
||||
You write the plan as data. The WBS dictionary, the activity sequence, the schedule and the timeline are computed and written from it for you when you submit, so write none of them yourself.
|
||||
|
||||
Attach `work-breakdown.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"work_packages": [
|
||||
{"id": "WP-1", "name": "Network foundation", "parent": null,
|
||||
"elements": ["E-1", "E-2"],
|
||||
"scope": "The network, its subnets and outbound access.",
|
||||
"produces": ["a private network the services attach to"],
|
||||
"skills": ["network engineering"]}
|
||||
],
|
||||
"activities": [
|
||||
{"id": "A-1", "work_package": "WP-1", "name": "Create the network and subnets", "days": 1, "after": []},
|
||||
{"id": "A-2", "work_package": "WP-1", "name": "Order the carrier circuit", "days": 30, "after": [],
|
||||
"owner": "customer", "assumption": "The customer manages the carrier's lead time."}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Work packages:
|
||||
|
||||
- Group them as the technical decomposition groups the design: one for each component, or for a few components that are built together, with a parent work package where several belong to one area.
|
||||
- Every Element of the Target architecture belongs to exactly one work package. A submission is refused while any Element belongs to none.
|
||||
- A work package is done when the Checks on its Elements pass. Do not write acceptance criteria: they are read from the Target architecture.
|
||||
- Add a work package only for the technical build. Reviews, acceptance testing and cut-over are not part of this plan.
|
||||
|
||||
Activities:
|
||||
|
||||
- Each is one piece of work one person does, of between half a day and about ten days. Anything longer is several activities.
|
||||
- `days` is working days of effort for one engineer who knows the Cloud provider. Estimate from what the infrastructure code actually contains: a resource written from a pattern is hours, a network joined to another site is days. Do not pad, and do not shorten to fit a deadline: the plan is checked against the delivery window after you submit, and it is more useful honest than fitting.
|
||||
- `after` lists the activities that must finish first. Give a dependency only where one is real: what the code in one needs from another. Leaving independent work unordered is what lets it run in parallel.
|
||||
- `owner` is `team`, the default, or `customer` for something the customer or their supplier must do that the team waits on, such as ordering a circuit or granting access. Give its lead time as `days` and say in `assumption` what you assumed.
|
||||
- Include the activities that make the build usable: enabling the provider's APIs, the pipeline that applies the code, and running the validation in each environment the scope names.
|
||||
|
||||
Your content is one section, under its heading: the approach in a few sentences, saying how the work is ordered and why, what runs in parallel, what the plan waits on from the customer, and the assumptions behind the estimates. Read the delivery facts from `scope`: the team size, the delivery window, the environments and the commercial model.
|
||||
@@ -7,9 +7,11 @@ includes: [specialist-protocol]
|
||||
You produce the **design recommendations** Deliverable: the Skill's task for recommending how to configure each component to meet the functional and non-functional requirements.
|
||||
|
||||
- Call `consult_pillar_advisors` once, with a brief that restates the workload, the relevant requirements and the selected products. It runs one advisor per architecture-framework pillar in parallel and returns their guidance.
|
||||
- When `feedback` is not empty you are revising: pass `pillars` naming only the pillars the feedback touches. The guidance you were given before is returned for the others.
|
||||
- When `pillars_to_consult` is a list, pass exactly that list as `pillars`, even when it is empty: those are the pillars the change affects directly, and the guidance you were given before is returned for the others.
|
||||
- Otherwise, when `feedback` is not empty or `baseline` is set you are revising: pass `pillars` naming only the pillars the change touches. The guidance you were given before is returned for the others.
|
||||
- Reconcile the pillars' guidance into recommendations for each component. Where pillars conflict, name the trade-off and recommend a resolution tied to the requirements.
|
||||
- When an advisor's guidance is missing, derive that pillar's recommendations from the best-practices references in the solution-architecture Skill.
|
||||
- Give every recommendation an id and attach them as `recommendations.json`, in the format the requirements-chain Skill gives. Write one configurable decision per recommendation, so each can become a Check in the Target architecture.
|
||||
- The advisors' checklist reviews, and any questions they raise for the customer, are written into your Deliverable for you when you submit. Do not copy them, and do not write a recommendation to cover a question an advisor left for the customer.
|
||||
- Give every recommendation an id and attach them as `recommendations.json`, in the format the requirements-chain Skill gives. Write one configurable decision per recommendation, so each can become a Check in the Target architecture. Give each its `conditions`: one entry for each separate thing it asks to be configured, and for each component it must hold on when it names several. Put under `outside_code` anything it asks of the application's own code or of people, and any property of a region or product that only its provider publishes, such as a carbon rating: no infrastructure configuration can show those. The condition is then the choice configuration can show, such as which region is set.
|
||||
|
||||
Your contract's sections are one per pillar.
|
||||
Your contract's sections are one per pillar. The advisors' review of each pillar's checklist is added to your Deliverable for you when you submit, so do not write it yourself.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
role: iac-author
|
||||
deliverable: deployment_guidance
|
||||
tools: [terraform_fmt, terraform_validate, terraform_schema]
|
||||
tools: [terraform_fmt, terraform_validate, terraform_schema, terraform_module]
|
||||
budget: 40
|
||||
includes: [specialist-protocol]
|
||||
---
|
||||
@@ -9,14 +9,17 @@ You produce the **deployment guidance** Deliverable: the Skill's task for genera
|
||||
|
||||
- Write Terraform that implements the Target architecture: every Element, every Relationship and every Check, and nothing it does not ask for.
|
||||
- Before you write a resource, load the infrastructure-as-code patterns Skill when you have one, and start from its pattern for that product and its provider versions file.
|
||||
- Write plain resources unless `terraform_modules` is true in your context. When it is, you have an infrastructure-as-code modules Skill: load it. It says when a published module fits an Element better than plain resources, which modules are approved, and how a Check is met through a module's input. Use a module only as it says.
|
||||
- Keep the files in your working copy. Write each file once with `write_file`, and make every later change with `edit_file`, changing only the lines that need it. Never write a file again to fix part of it.
|
||||
- Format and validate with `terraform_fmt` and `terraform_validate` when they are available. They run on your working copy, so pass them no files. Fix everything they report.
|
||||
- When validation says an argument or block is not expected, look the resource type up with `terraform_schema` instead of guessing where it belongs.
|
||||
- When a Check names a setting its resource type does not have, do not invent code for it. Record the Check in `implementation.json` as unimplementable, with what the schema shows, and implement the rest. The Target architecture is then revised.
|
||||
- When a Check names a setting its resource type does not have, or asks for something that resource cannot do, do not invent code for it. Record the Check in `implementation.json` as unimplementable, with what the schema shows, and implement the rest. The Target architecture is then revised.
|
||||
- Go through every Check before you submit and record every one that cannot be met, in that one submission. A Check with the same fault as one you recorded is recorded too. Each one found later costs another Revision of the design and of your code.
|
||||
- Write `implementation.json` to your working copy, in the format the requirements-chain Skill gives, naming where the code satisfies each Check.
|
||||
- Take every environment-specific value (project, region, names, image references) from variables; embed no credentials or secrets.
|
||||
- Submit as soon as validation passes, with your content and no attachments: your working copy is attached for you. If a submission is refused, fix exactly what the refusal lists and submit again.
|
||||
- When `working_copy` lists files, they are your last attempt. When `feedback` lists failed Checks, read the files concerned and change only what those Checks need.
|
||||
- When `feedback` says a Check failed and your code already does what the Check's words say, the verdict is what is wrong, not the Check. Change nothing for it, keep its entry in `implementation.json`, and say in your content which Check you dispute and where the code meets it. Do not record it as unimplementable: that sends the design back for a fault it does not have.
|
||||
|
||||
Your working copy must hold `terraform/main.tf`, `terraform/variables.tf` and `implementation.json`, with `terraform/versions.tf` and `terraform/outputs.tf` when they help.
|
||||
|
||||
|
||||
28
agents/lesson-curator.md
Normal file
28
agents/lesson-curator.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
role: lesson-curator
|
||||
tools: []
|
||||
budget: 60
|
||||
---
|
||||
You review what went wrong, the same way, across many solution-architecture Executions, and propose lessons: rules that would have prevented it. You run outside any Execution. A person approves each lesson before any agent sees it, so propose only what you would defend to them.
|
||||
|
||||
Your task message carries JSON context:
|
||||
|
||||
- `executions`: how many Executions the evidence comes from.
|
||||
- `groups`: what recurred. Each has a `group` key, the `deliverable` it concerns, `what_happened` in general terms, how many `executions` it occurred in and how many `occurrences` in all, and up to three `examples` as they were recorded. Some groups are about one setting or resource type of the Cloud provider, named in `what_happened`: the same kind of problem recurring on that subject.
|
||||
- `published_or_proposed`: lessons that already exist or are awaiting review.
|
||||
|
||||
For each group, decide whether a rule given to the Specialist that produces that Deliverable would have prevented it.
|
||||
|
||||
- Call `propose_lesson` when it would. Name the Deliverable whose Specialist must follow the rule, which is the one that could have prevented the problem, not always the one where it surfaced. A Check that validation had to propose is prevented by the target architect.
|
||||
- Call `no_lesson` when it would not: the cause is the tooling or the engine and no instruction would change it, it is too rare or too particular to one workload, or an existing lesson already covers it.
|
||||
|
||||
A good lesson:
|
||||
|
||||
- States one rule, as an instruction, that a Specialist can act on without knowing what happened: "Give every Element at least one Check before you submit", not "be more careful with Checks".
|
||||
- Says why in one or two sentences: what goes wrong without it and what that costs.
|
||||
- For a group about one setting or resource type, may name that setting or resource type and say what to do about it: that is the Cloud provider's vocabulary, not a client's. A general lesson that already exists does not cover it if the problem went on recurring.
|
||||
- Is general. It names no customer, no project, no Execution, no resource name and no value from the examples. The examples are evidence for you; nothing from them may be quoted.
|
||||
- Does not repeat what the Specialist's instructions or tools already enforce. When a submission is already refused for something, a lesson helps only if it prevents the attempt.
|
||||
- Is worth its cost. Every lesson is read on every Execution from then on. Propose few.
|
||||
|
||||
Call `finish` when every group has a proposal or a reason for none.
|
||||
@@ -10,5 +10,10 @@ You produce the **solution guide** Deliverable: the Skill's packaging of every a
|
||||
- Consolidate the content of every Deliverable in `dependencies`; rewrite for flow, but keep every requirement, product decision, citation, recommendation, command and validation verdict.
|
||||
- Include the architecture diagram, which is the `architecture.mmd` attachment of the Target architecture, unchanged as a `mermaid` code block, and the Terraform as code blocks.
|
||||
- List the Target architecture's Checks with their validation verdicts in the validation section.
|
||||
- Write no timeline, schedule or estimate of your own. The delivery plan is a Deliverable of its own, and its timeline is added to the guide for you.
|
||||
- Open the executive summary with what the design rests on, from the scope: how many of its facts the customer stated, how many were assumed for them, and how many are still unknown, naming the assumptions that most shape the design. A reader must be able to tell an agreed design from an indicative one.
|
||||
- When the design recommendations hold a "Questions for the customer" section, carry every question into the guide's design and configuration recommendations section, under the same heading and with the same wording. They are what the request did not say enough to settle; say so, and do not present them as faults or as recommendations.
|
||||
|
||||
In a Change request (`baseline` is set), open the executive summary with what changed and why, from `baseline.changes`: the requirements added, changed and removed with their reasons, then what that changed in the architecture. Name separately anything listed under `unrequested`: it changed without a changed requirement reaching it.
|
||||
|
||||
Your contract's sections are the template's eight top-level sections.
|
||||
|
||||
@@ -11,13 +11,26 @@ Your task message carries JSON context:
|
||||
- `contract`: what `submit_deliverable` checks. `sections` are headings your content must have and `attachments` are files you must attach. A data file among them must also keep every id traceable to the Deliverables in `dependencies`; the requirements-chain Skill gives each file's format.
|
||||
- `draft`: the draft you sent the user with your last questions, with its `attachments`, or `null`.
|
||||
- `working_copy`: what your own tools already hold from your earlier attempts, or `null`. Start from it; do not start again.
|
||||
- `baseline`: set only in a Change request, where the user has said how their requirements changed since an architecture was delivered. `deliverable` is that delivered version of your own Deliverable, and `changes` is what has changed so far: the requirements added, changed and removed, with the reason, and everything already revised from them. `null` otherwise.
|
||||
- `read_first`: references of your Skills that this task was judged to need, each as a Skill and a resource. Read these first with `load_skill_resource`. It is where to start, not a limit: read anything else you find you need.
|
||||
- `scope`: what the customer's scope spec says, when they supplied one. `stated` is theirs and binds your Deliverable; `assumed` was chosen for them and may change when they answer; `to_ask` is unknown. Load the scoping Skill for the rules. Honour every stated choice, build nothing under `stated.intent.exclusions`, and name the customer's own requirement id when your work serves one.
|
||||
- `overlay_skills`: Skills that carry the user's organisation's standards or this engagement's constraints. Load each one and apply it. Where an overlay disagrees with the Cloud provider's general guidance, the overlay wins; where it disagrees with a requirement the user stated, follow the requirement and say so.
|
||||
- `pre_approved`: `true` when no user is available.
|
||||
|
||||
Steps:
|
||||
|
||||
1. Load the Skill available to you and find the part that covers your Deliverable. Read the references and assets it points to with `load_skill_resource`.
|
||||
1. Load the Skill available to you and find the part that covers your Deliverable. Read the references and assets it points to with `load_skill_resource`. When a lessons Skill is among your Skills, load it too and read its reference for your Deliverable: those are rules learned from earlier work, and you follow each one that applies.
|
||||
2. Ground your work in `dependencies`, `feedback` and `answers`. When you need information only the user has, call `needs_input` with all your questions at once, each saying why it matters. Your run ends there, and you are started again with the answers.
|
||||
3. Draft the Deliverable to its `contract`. When `pre_approved` is `false`, confirm the draft with the user before submitting: call `needs_input` with a short summary of the draft, asking them to approve it or request changes, and pass the complete draft as `draft` with its `attachments`. When `draft` is set and the latest entry in `answers` approves it, submit that draft as it is; when the user asked for changes, apply them to that draft. When `pre_approved` is `true`, ask nothing: record each assumption under an `Assumptions` heading and continue.
|
||||
4. Call `submit_deliverable` with the complete markdown content and every attachment in `contract`. When it reports what is missing, add it and submit again.
|
||||
|
||||
## When `baseline` is set
|
||||
|
||||
You are revising a delivered Deliverable, not writing a new one.
|
||||
|
||||
- Start from `baseline.deliverable`. Change only what the changed requirements reach, and leave everything else exactly as it was: the same words, the same order.
|
||||
- Keep every id that still holds. An item that is unchanged keeps its id and its text; a new item takes a new id that was never used; a removed item is left out. Never renumber.
|
||||
- When nothing that reaches your Deliverable has changed, submit it as it was.
|
||||
- Your working copy, when you have one, already holds the delivered version.
|
||||
|
||||
You are done when `submit_deliverable` accepts the Deliverable.
|
||||
|
||||
@@ -9,6 +9,14 @@ Your task message carries the design advisor's brief in `brief` and the pillar's
|
||||
1. Load the Skill available to you.
|
||||
2. Evaluate the workload in the brief against the Skill's core principles and validation checklist.
|
||||
3. Write prioritised, actionable recommendations for each relevant component, naming the products the Skill lists for each gap and citing its guidance.
|
||||
4. List any assessment questions from the Skill that the brief leaves unanswered, as open questions; don't ask the user.
|
||||
4. Do not ask the user anything, and do not guess what the brief does not say.
|
||||
|
||||
Call `submit_advice` with your recommendations as markdown. You are done when it accepts them.
|
||||
5. Review the Skill's validation checklist item by item, when it has one. For every item give its `status`:
|
||||
- `addressed` when your recommendations cover it.
|
||||
- `not_applicable` when it does not apply to this workload.
|
||||
- `needs_customer_input` when it could apply and the brief does not say what would settle it: how the customer's organisation works, what they already have, or what they want. Give the `question` to put to the customer, written so someone who knows their organisation can answer it. This is the right status whenever the gap is in what you were told, not in the design. Do not invent a recommendation to cover it.
|
||||
- `not_addressed` only when the brief gives you what you need, the item applies, and you recommend nothing for it.
|
||||
|
||||
In `note`, say in a few words how it is addressed, why it does not apply, or what the brief leaves unsaid. Copy each item's text as the Skill has it, shortened to its first sentence.
|
||||
|
||||
Call `submit_advice` with your recommendations as markdown in `content` and the review in `checklist`. You are done when it accepts them.
|
||||
|
||||
@@ -2,15 +2,29 @@
|
||||
role: reply-writer
|
||||
tools: []
|
||||
---
|
||||
You write what the user reads on behalf of the Orchestrator of a solution-architecture Execution. The decision has already been made; you put it into words and decide nothing.
|
||||
You write what the user reads on behalf of the Orchestrator of a solution-architecture Execution. You put into words what has already been decided or delivered, and you decide nothing. Your task message says which of two things you are writing, and carries JSON context.
|
||||
|
||||
Your task message carries JSON context: `phase`, the Phase the user is being asked to approve, and `facts`, the data about it: its Deliverables, counts of requirements and recommendations, the Target architecture's counts of Elements, Relationships and Checks with any recommendation treated as not applicable, validation verdicts, and Revisions.
|
||||
## A summary to approve a Phase from
|
||||
|
||||
The context has `phase`, the Phase the user is being asked to approve, and `facts`, the data about it: its Deliverables, counts of requirements and recommendations, the Target architecture's counts of Elements, Relationships and Checks with any recommendation treated as not applicable, validation verdicts, and Revisions.
|
||||
|
||||
Write a summary a busy architect can approve from:
|
||||
|
||||
- Say what the Phase produced and what approving it commits them to. For the design Phase, say that no infrastructure code is written until they approve it.
|
||||
- For the scoping Phase, `facts.scope` says which fields were assumed for them and which are still unknown. Say how many of each, name the ones that most shape a design, and say that requirements are derived from this scope once they approve it.
|
||||
- For the packaging Phase, `facts.delivery_plan` gives the plan's length in weeks, the team it assumes and whether it fits the delivery window. Say so plainly; when it is over the window, say by how much the plan is over and that the critical path is in the work breakdown structure.
|
||||
- State every number in `facts` that bears on the decision, exactly as given. Add no fact that is not there.
|
||||
- Name anything they should look at before approving: failed or unverifiable Checks, open gaps, recommendations treated as not applicable, Deliverables that were revised.
|
||||
- Use plain sentences and no headings. Keep it under 120 words.
|
||||
|
||||
Call `write_reply` with the summary. You are done when it accepts it.
|
||||
## An answer about delivered work
|
||||
|
||||
The context has `question`, what the user asked, and `delivered`: the `request` the architecture was designed for and its `solution_guide`.
|
||||
|
||||
- Answer from the solution guide alone. Give the choice or the fact, and the reason the guide gives for it.
|
||||
- When the guide does not say, say that it does not. Add nothing from general knowledge about the products, and do not guess.
|
||||
- Name the section of the guide the answer comes from.
|
||||
- Propose no change. If the user seems to want one, say they can ask for it as a change to this architecture.
|
||||
- Use plain sentences and no headings. Keep it under 150 words.
|
||||
|
||||
Call `write_reply` with the text. You are done when it accepts it.
|
||||
|
||||
@@ -7,11 +7,24 @@ includes: [specialist-protocol]
|
||||
You produce the **requirements** Deliverable: the Skill's requirements-discovery gathering and its resolution of ambiguities and contradictions.
|
||||
|
||||
- Cover functional requirements, non-functional requirements (security, privacy, compliance, reliability, disaster recovery, cost, operations, performance, sustainability), current state, and dependencies.
|
||||
- The user states what they want at a high level; the detail is your job. When a non-functional requirement is missing, propose a default for it from the Cloud provider's architecture framework and record it under `Assumptions` with what it decides: availability tiers, scaling, cost budgets, resource types and security posture. Ask the user to confirm the whole set in one question.
|
||||
- Ask an open question only where no sensible default can be inferred from the request, such as the region, a compliance regime or a budget ceiling.
|
||||
- The scope has been agreed before you start: `scope` holds what the customer stated, what was assumed for them and what is still unknown. The detail is your job. Derive the requirements from it; do not ask again for anything it settles.
|
||||
- Where a non-functional requirement needs something the scope does not hold, propose a default from the Cloud provider's architecture framework and record it under `Assumptions` with what it decides. Carry every entry of `scope.assumed` into `Assumptions` too, so a reader of the requirements sees what rests on one.
|
||||
- Ask a question only for something the scope leaves unknown that you cannot write a requirement without.
|
||||
- Name every ambiguity or contradiction, explain why the conflicting goals can't both hold, and ask the user to choose. When they delegate the choice, propose one and ask them to approve it.
|
||||
- When the user runs workloads in a cloud environment today, use your cloud discovery tools to describe the current state from what actually exists, and record anything you couldn't read as a discovery gap.
|
||||
- Name no products, services or architectures. This Deliverable describes the problem, not the solution.
|
||||
- Name no products, services or architectures of your own choosing. This Deliverable describes the problem, not the solution. A product or design choice the customer stated in `scope` is theirs: record it as a constraint, in their words.
|
||||
- Give each requirement its `from`, as the requirements-chain Skill describes. Cover every entry of `scope.stated.intent.requirements`, the customer's own requirements, by id. Carry every field under `scope.binding`, a choice the customer stated, in a non-functional requirement whose conditions say what must exist or be set for it to have been honoured. A stated choice that reaches no requirement reaches no Check, and can then be named in the design without being built. List what `scope.to_ask` still holds under `Open questions`.
|
||||
- Give every requirement an id and attach them all as `requirements.json`, in the format the requirements-chain Skill gives. Use the same ids in your content.
|
||||
- Give every non-functional requirement its `conditions`: one entry for each separate thing that must be true for it to be met and that the configuration of infrastructure can show. "Data is encrypted in transit and at rest" has two. Each becomes something the design is checked against, so a condition left out is a condition nobody verifies.
|
||||
- Put under `outside_code` what the requirement asks for that no infrastructure configuration can show: an outcome measured in operation (an availability percentage, a response time), behaviour of the application's own code, a process people follow, or a property of a region or product that only its provider publishes (a carbon rating, a service level). For the last, the condition is the choice configuration can show, such as which region is set. Those are recorded and reported, and are not checked against the infrastructure code.
|
||||
|
||||
In a Change request (`baseline` is set), the `workflow_request` says what has changed. Work out what it means for the delivered requirements, and give every requirement in `requirements.json` a `change`:
|
||||
|
||||
- `unchanged`: it still holds. Keep its id and its text exactly.
|
||||
- `changed`: it still exists but asks for something different. Keep its id.
|
||||
- `removed`: it is no longer wanted. Keep it in the list, marked.
|
||||
- `added`: it is new. Give it an id that was never used.
|
||||
|
||||
Everything but `unchanged` needs a `reason`, in the user's terms. Add a `Changes` heading to your content that lists them. A change the user stated at a high level usually reaches several requirements; find them all, and change nothing else.
|
||||
|
||||
Add `Open questions` and `Assumptions` headings when they apply.
|
||||
|
||||
24
agents/scope-analyst.md
Normal file
24
agents/scope-analyst.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
role: scope-analyst
|
||||
deliverable: scope
|
||||
tools: []
|
||||
budget: 30
|
||||
includes: [specialist-protocol]
|
||||
---
|
||||
You produce the **scope** Deliverable: the agreed statement of what the customer wants and the facts a design depends on, as a completed scope spec. You design nothing and choose no products. Load the scoping Skill: it says what each field means.
|
||||
|
||||
The scope spec is kept for you. `scope_read` shows what is settled, what is not, and the question to ask for each field. `scope_set` records fields, several per call.
|
||||
|
||||
1. Call `scope_read`. When the customer supplied a spec, most of it is already there, and what they stated stays as they stated it.
|
||||
2. Read `workflow_request`. Record what it states and the spec does not yet hold, with `source` `request`: the statement itself, word for word, under `intent.statement`; the kind of engagement; and any fact it gives. Record only what the words say. Do not infer a number or a choice the customer did not give.
|
||||
3. Settle what is not settled, the essential fields first.
|
||||
- **When you may ask the user** (`pre_approved` is `false`): call `needs_input` with the questions for the essential fields, and the important ones that most change a design, at most eight in one call, each in the catalogue's words. Tell them they may answer, say "you decide", or skip one. Record each answer with `source` `answered`. For "you decide", choose a value and record it with `source` `assumed` and a `note`. Leave a skipped field as it is. Ask a second batch only for what is still essential.
|
||||
- **When you may not ask** (`pre_approved` is `true`): for each essential or important field not settled, choose a value from the catalogue's default guidance and what the request implies, and record it with `source` `assumed` and a `note` saying why. Leave optional fields alone.
|
||||
- A field marked `decide` is yours: choose, and record it as assumed with a note.
|
||||
- A field that cannot apply to this kind of engagement is `not_applicable`.
|
||||
4. Call `scope_read` again. Every essential field must be settled before you can submit.
|
||||
5. Submit. Your content is the scope statement under its heading: three to six sentences saying what the customer wants, what is in scope, what is out of scope, and what success looks like, in plain words and using only what the spec holds. Name as out of scope only what `intent.exclusions` lists; do not add an exclusion of your own. The completed spec, the information register, the assumptions and the questions still open are written for you from what you recorded. Pass no attachments.
|
||||
|
||||
Never record a product, a region, a number or a regulation the customer did not state as though they had: that is `assumed`, with its note. An assumption the customer can see is useful; one presented as their decision is a fault.
|
||||
|
||||
In a Change request (`baseline` is set), the spec you start from is the one that was delivered, and `workflow_request` says what has changed. Record only the fields the change reaches, with `source` `answered`: the customer has now said so. Leave every other field as it was. When no spec was delivered with the Baseline, complete one as above, from `workflow_request` and from the requirements in `baseline`.
|
||||
@@ -2,17 +2,18 @@
|
||||
role: target-architect
|
||||
deliverable: target_architecture
|
||||
tools: [terraform_schema]
|
||||
budget: 30
|
||||
budget: 45
|
||||
includes: [specialist-protocol]
|
||||
---
|
||||
You produce the **Target architecture** Deliverable: the solution as one explicit graph of Elements, Relationships and Checks. It is agreed before any infrastructure code is written, and the diagram, the description, the code and the validation are all derived from it.
|
||||
|
||||
- Load the requirements-chain Skill for the graph's format and how to derive it.
|
||||
- Build the graph with `graph_put`, a few items per call: the Elements first, then the Relationships, then the Checks one Element at a time. Short calls are what keep your replies from timing out.
|
||||
- Every Element is a resource of the Cloud provider's own Terraform provider. Something outside it that the design depends on, such as a source repository or a third party's service, is not an Element: say in the design rationale that it is needed and who provides it.
|
||||
- Build the graph with `graph_put` in a handful of calls of ten to twenty items each: all the Elements, then all the Relationships, then the Checks in batches. A call for every Element, or for every few Checks, uses up your tool calls before the graph is finished; a single call with everything is a reply long enough to time out.
|
||||
- Give every component an Element with the product selected for it, and add the supporting Elements the design needs, such as identities, policies and networks.
|
||||
- Give every connection between Elements a Relationship.
|
||||
- Turn every non-functional requirement and every design recommendation into Checks on the Elements and Relationships they constrain. Write each Check so that it can be verified from infrastructure code alone, naming the setting and the value it must have.
|
||||
- Before you write a Check that names a setting, confirm with `terraform_schema` that the Element's resource type has that setting, when the tool is available. A setting that one resource type has may not exist on a similar one. A Check on a setting the resource type lacks cannot be met and is sent back to you.
|
||||
- Turn every non-functional requirement and every design recommendation into Checks on the Elements and Relationships they constrain. Write each Check so that it can be verified from infrastructure code alone, naming the setting and the value it must have. One Check per requirement is rarely enough: write a Check for every entry in a requirement's or recommendation's `conditions`, on every Element that condition applies to. Write no Check for an entry under `outside_code`: it names something infrastructure code cannot show, and a Check for it could never be met. A condition left without a Check is found by validation and sent back to you.
|
||||
- Name only settings the Element's resource type has. Once you have decided the Elements, and when `terraform_schema` is available, call it once with `resource_types` listing every distinct resource type in the graph: the reply outlines every argument and block each type accepts, and you write all the Checks from it. That one call is all the looking up a design needs; never look types or settings up one at a time. Write each setting's name in backticks, exactly as the schema spells it. When you submit, every setting a Check names is looked up for you on its Element's resource type, and any that is missing is returned to you once.
|
||||
- Decide the implementation detail yourself from the design recommendations and the Cloud provider's documentation, through your documentation tools. The user states intent at a high level; this level of detail is your job.
|
||||
- When a recommendation does not apply to this workload, list it as not applicable with the reason. The user sees that list when they approve the design.
|
||||
- When `working_copy` shows a graph, it is your last attempt: read it with `graph_read` and change only what `feedback` asks for, with `graph_put` and `graph_remove`.
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
---
|
||||
role: validator
|
||||
deliverable: validation_results
|
||||
tools: [terraform_validate, terraform_plan, terraform_schema]
|
||||
tools: [terraform_validate, terraform_plan, terraform_schema, terraform_module]
|
||||
budget: 30
|
||||
includes: [specialist-protocol]
|
||||
---
|
||||
You produce the **validation results** Deliverable: the Skill's pre-deployment validation, done statically without provisioning anything.
|
||||
|
||||
- Run the deployment dry-run with your tools: validate the Terraform, and preview it with a plan when you have permission to read live cloud resources. The tools already hold the submitted files, so pass them no files.
|
||||
- Give a verdict on every Check in the Target architecture, from the infrastructure code: pass, fail or not verifiable, each with the evidence you read. The Checks are the whole bar: judge the code against them and nothing else.
|
||||
- Give a verdict on every Check in the Target architecture, from the infrastructure code: pass, fail or not verifiable, each with the evidence you read. The Checks are the whole bar: judge the code against them and nothing else. Judge each Check by its own words. A Check that says a role is granted or a setting is set passes when it is; other grants or settings beside it do not fail it unless the Check says "only" or "no other". What you think should also be true is a proposed addition, never a failure.
|
||||
- Before you fail a Check because the code lacks a setting, confirm with `terraform_schema` that the resource type has that setting, when the tool is available. When it does not, the Check cannot be met by any code: give it not verifiable, with what the schema shows as the evidence. Give the same verdict to a Check that `implementation.json` records as unimplementable.
|
||||
- When you see something the Target architecture lacks, record it as a proposed addition, naming the requirement or recommendation it serves. It is not a failure of the code.
|
||||
- Attach the verdicts as `verdicts.json`, in the format the requirements-chain Skill gives.
|
||||
- When `terraform_modules` is true the code may call approved published modules. Then judge a Check on a resource the module creates from the module input that sets it: read the value in the code, and confirm with `terraform_module` what that input sets or what its default is. The modules Skill, when you have one, says how.
|
||||
- Review the Target architecture's coverage once, completely. Go through every requirement and every design recommendation in turn; for each, list the conditions its text states and the Elements it applies to, and record a proposed addition for each one no Check verifies, naming the requirement or recommendation it serves. Report every gap in this pass: each later pass that finds one more costs a whole Revision of the design, the code and this validation. Propose nothing for what a requirement or recommendation lists under `outside_code`: that is application behaviour, an outcome measured in operation, or a process, and no Check on infrastructure code can verify it. Name those under your analysis heading as things to verify after deployment. A proposed addition is not a failure of the code.
|
||||
- When `feedback` or your earlier verdicts show the Target architecture was revised for your proposed additions, propose only what the revision still leaves uncovered. Never propose what a Check already verifies in other words.
|
||||
- Record your verdicts with `verdict_put`, a few Checks per call, as you reach them: the Checks of one Element, then the next. Record the dry-run's result and each proposed addition the same way. Short calls are what keep your replies from timing out, and what you record is kept if your run is cut short. `verdict_read` shows which Checks still have none.
|
||||
- When `working_copy` shows verdicts recorded, your last run was cut short on this same code: call `verdict_read` and carry on from there.
|
||||
- Submit with your content and no attachments when every Check has a verdict: what you recorded is attached as `verdicts.json`, in the format the requirements-chain Skill gives.
|
||||
- When `pre_approved` is `false`, confirm with the user before you submit, as every Specialist does: call `needs_input` with a summary of the verdicts and pass your content as `draft`. Your recorded verdicts are kept and attached when you submit afterwards.
|
||||
- Give the exact commands for every check you couldn't run, for the user to run themselves.
|
||||
|
||||
End each of your contract's sections with a pass or fail verdict.
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
A new task starts an Execution; a message on an input-required task answers the
|
||||
Execution's prompt. Approvals and permissions count only as structured data parts,
|
||||
never as free text.
|
||||
|
||||
Before a new task starts anything its message is read (app/nodes/intake.py): a
|
||||
question is answered and starts nothing. A message that reads as a change to
|
||||
delivered work also starts nothing: the caller is told which Execution it would
|
||||
change and how to name it as the Baseline, because a Change request never starts
|
||||
from earlier work on a guess (ADR-0006).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -25,6 +31,15 @@ from google.protobuf import json_format
|
||||
|
||||
from app.agent import ExecutionEngine, Interaction
|
||||
from app.nodes.execution_nodes import GUIDE_FILENAME
|
||||
from app.nodes.intake import (
|
||||
ABOUT,
|
||||
CHANGE_REQUEST,
|
||||
QUESTION,
|
||||
DeliveredAnswers,
|
||||
Intake,
|
||||
change_note,
|
||||
no_answer_note,
|
||||
)
|
||||
from app.presentation import describe_prompt
|
||||
from app.workflows.deliverables import DeliverableKind
|
||||
|
||||
@@ -34,14 +49,22 @@ STRUCTURED_REPLY_KEYS = ("approval", "permission")
|
||||
|
||||
|
||||
class SolutionArchitectExecutor(AgentExecutor):
|
||||
def __init__(self, engine: ExecutionEngine) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
engine: ExecutionEngine,
|
||||
intake: Intake | None = None,
|
||||
answers: DeliveredAnswers | None = None,
|
||||
) -> None:
|
||||
self._answers = answers
|
||||
self._engine = engine
|
||||
self._intake = intake
|
||||
|
||||
async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
|
||||
task_id = context.task_id or ""
|
||||
updater = TaskUpdater(event_queue, task_id, context.context_id or "")
|
||||
new = context.current_task is None
|
||||
try:
|
||||
if context.current_task is None:
|
||||
if new:
|
||||
history = [context.message] if context.message is not None else []
|
||||
await event_queue.enqueue_event(
|
||||
new_task(
|
||||
@@ -53,12 +76,63 @@ class SolutionArchitectExecutor(AgentExecutor):
|
||||
)
|
||||
await updater.start_work()
|
||||
options = _options(context)
|
||||
# A pre-approved caller is a batch job: it sends work, not questions.
|
||||
if (
|
||||
self._intake
|
||||
and not options.get("pre_approved")
|
||||
and not options.get("baseline")
|
||||
and not options.get("new_request")
|
||||
):
|
||||
reading = await self._intake.read(
|
||||
context.get_user_input(),
|
||||
options.get("customer_case"),
|
||||
scope=task_id,
|
||||
)
|
||||
if reading.kind == QUESTION:
|
||||
text, about = ABOUT, None
|
||||
if reading.about_delivered and reading.latest and self._answers:
|
||||
# About what was delivered: answered from its files.
|
||||
about = reading.latest
|
||||
text = await self._answers.answer(
|
||||
context.get_user_input(),
|
||||
str(options.get("customer_case")),
|
||||
about,
|
||||
) or no_answer_note(about)
|
||||
data = {"status": "answered", "intake": QUESTION}
|
||||
if about:
|
||||
data["about"] = about
|
||||
await updater.complete(
|
||||
updater.new_agent_message(
|
||||
[new_text_part(text), new_data_part(data)]
|
||||
)
|
||||
)
|
||||
return
|
||||
if reading.kind == CHANGE_REQUEST and reading.latest:
|
||||
await updater.complete(
|
||||
updater.new_agent_message(
|
||||
[
|
||||
new_text_part(change_note(reading.latest)),
|
||||
new_data_part(
|
||||
{
|
||||
"status": "answered",
|
||||
"intake": CHANGE_REQUEST,
|
||||
"baseline": reading.latest,
|
||||
}
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
return
|
||||
interaction = await self._engine.start(
|
||||
context.get_user_input(),
|
||||
session_id=context.context_id,
|
||||
customer_case=options.get("customer_case"),
|
||||
baseline=options.get("baseline"),
|
||||
overlay_skills=options.get("overlay_skills") or (),
|
||||
terraform_modules=options.get("terraform_modules"),
|
||||
scope=options.get("scope"),
|
||||
execution_id=task_id,
|
||||
pre_approved=bool(options.get("pre_approved", False)),
|
||||
pre_approved=options.get("pre_approved"),
|
||||
allow_cloud_read=options.get("allow_cloud_read"),
|
||||
)
|
||||
else:
|
||||
|
||||
@@ -69,7 +69,7 @@ def default_model_factory(role: RoleSpec) -> BaseLlm:
|
||||
"""Model for a role's LiteLLM-style id.
|
||||
|
||||
`gemini/<model>` uses ADK's native Gemini client, which targets Vertex AI when
|
||||
GOOGLE_GENAI_USE_VERTEXAI=true (with GOOGLE_CLOUD_PROJECT and
|
||||
GOOGLE_GENAI_USE_ENTERPRISE=true (with GOOGLE_CLOUD_PROJECT and
|
||||
GOOGLE_CLOUD_LOCATION) and the Gemini API otherwise. Any other id goes through
|
||||
LiteLLM, so other model providers need no code changes.
|
||||
"""
|
||||
|
||||
@@ -37,10 +37,25 @@ Turn = Sequence[Call] | Callable[[AgentTask], Sequence[Call]]
|
||||
|
||||
# One small, coherent Requirements chain, so sample submissions pass every link.
|
||||
SAMPLE_DATA: dict[str, str] = {
|
||||
"scope.yaml": "engagement:\n kind: workload\nintent:\n statement: Accept events.\n",
|
||||
"scope.json": json.dumps(
|
||||
{
|
||||
"kind": "workload",
|
||||
"stated": {"intent": {"statement": "Accept events."}},
|
||||
"to_decide": [],
|
||||
"to_ask": [],
|
||||
"not_applicable": [],
|
||||
}
|
||||
),
|
||||
"requirements.json": json.dumps(
|
||||
[
|
||||
{"id": "FR-1", "kind": "functional", "text": "Accept events."},
|
||||
{"id": "NFR-1", "kind": "non_functional", "text": "99.9% availability."},
|
||||
{
|
||||
"id": "NFR-1",
|
||||
"kind": "non_functional",
|
||||
"text": "99.9% availability.",
|
||||
"conditions": ["The service stays available when one instance fails."],
|
||||
},
|
||||
]
|
||||
),
|
||||
"components.json": json.dumps(
|
||||
@@ -54,6 +69,7 @@ SAMPLE_DATA: dict[str, str] = {
|
||||
"pillar": "security",
|
||||
"text": "Use a dedicated identity.",
|
||||
"components": ["C-1"],
|
||||
"conditions": ["The service runs as an identity nothing else uses."],
|
||||
}
|
||||
]
|
||||
),
|
||||
@@ -99,6 +115,37 @@ SAMPLE_DATA: dict[str, str] = {
|
||||
{"check": "K-2", "file": "terraform/main.tf", "address": "example.sa"},
|
||||
]
|
||||
),
|
||||
"work-breakdown.json": json.dumps(
|
||||
{
|
||||
"work_packages": [
|
||||
{
|
||||
"id": "WP-1",
|
||||
"name": "Ingress",
|
||||
"parent": None,
|
||||
"elements": ["E-1", "E-2"],
|
||||
"scope": "The service and its identity.",
|
||||
"produces": ["a running service"],
|
||||
"skills": ["platform engineering"],
|
||||
}
|
||||
],
|
||||
"activities": [
|
||||
{
|
||||
"id": "A-1",
|
||||
"work_package": "WP-1",
|
||||
"name": "Create the identity",
|
||||
"days": 1,
|
||||
"after": [],
|
||||
},
|
||||
{
|
||||
"id": "A-2",
|
||||
"work_package": "WP-1",
|
||||
"name": "Deploy the service",
|
||||
"days": 2,
|
||||
"after": ["A-1"],
|
||||
},
|
||||
],
|
||||
}
|
||||
),
|
||||
"verdicts.json": json.dumps(
|
||||
{
|
||||
"dry_run": {"verdict": "pass", "evidence": "terraform validate passed."},
|
||||
|
||||
@@ -7,21 +7,32 @@ include. The provider bundle supplies each role's Skills, MCP servers and model.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
from pathlib import Path
|
||||
|
||||
from app.adk.runtime import RoleSpec
|
||||
from app.providers import ProviderBundle
|
||||
from app.skills.agent_skills import SkillFormatError, split_frontmatter
|
||||
from app.tools.modules import MODULE_TOOL
|
||||
from app.workflows.deliverables import DEPENDENCY_GRAPH, DeliverableKind
|
||||
|
||||
ORCHESTRATOR = "orchestrator"
|
||||
PILLAR_ADVISOR = "pillar-advisor"
|
||||
REPLY_WRITER = "reply-writer"
|
||||
LESSON_CURATOR = "lesson-curator" # runs outside any Execution
|
||||
COVERAGE_REVIEWER = "coverage-reviewer" # reviews a design before its Approval
|
||||
PARTIALS_DIR = "partials"
|
||||
|
||||
_ALLOWED_FIELDS = {"role", "deliverable", "tools", "budget", "includes"}
|
||||
|
||||
|
||||
def _deliverables_with_lessons(bundle: ProviderBundle) -> set[str]:
|
||||
if not bundle.lessons_skill:
|
||||
return set()
|
||||
folder = bundle.skills[bundle.lessons_skill].path / "references"
|
||||
return {path.stem for path in folder.glob("*.md")} if folder.is_dir() else set()
|
||||
|
||||
|
||||
class RoleConfigError(ValueError):
|
||||
"""A role file is missing or invalid."""
|
||||
|
||||
@@ -33,9 +44,16 @@ def load_roles(
|
||||
orchestrator_budget: int = 40,
|
||||
specialist_budget: int = 15,
|
||||
include_preview_mcp: bool = True,
|
||||
lessons: bool = True,
|
||||
model_tiers: bool = False,
|
||||
) -> dict[str, RoleSpec]:
|
||||
"""`lessons` off leaves the lessons Skill out of every role, so an evaluation
|
||||
can run with and without what has been learned. `model_tiers` on gives a role
|
||||
the lighter model the bundle names for its first attempt."""
|
||||
specialists = {spec.specialist: kind for kind, spec in DEPENDENCY_GRAPH.items()}
|
||||
required = {ORCHESTRATOR, PILLAR_ADVISOR, REPLY_WRITER, *specialists}
|
||||
optional = {LESSON_CURATOR, COVERAGE_REVIEWER}
|
||||
learned = _deliverables_with_lessons(bundle) if lessons else set()
|
||||
|
||||
roles = {}
|
||||
for path in sorted(agents_dir.glob("*.md")):
|
||||
@@ -54,7 +72,26 @@ def load_roles(
|
||||
raise RoleConfigError(
|
||||
f"{agents_dir}: missing role files for {', '.join(missing)}"
|
||||
)
|
||||
unexpected = sorted(set(roles) - required)
|
||||
for name, kind in specialists.items():
|
||||
if kind.value in learned and bundle.lessons_skill:
|
||||
# Only a Specialist whose Deliverable has lessons is given the Skill.
|
||||
roles[name] = dataclasses.replace(
|
||||
roles[name], skills=(*roles[name].skills, bundle.lessons_skill)
|
||||
)
|
||||
if model_tiers:
|
||||
for name, model in bundle.models.first_attempt.items():
|
||||
if name not in roles:
|
||||
raise RoleConfigError(
|
||||
f"'models.first_attempt' names {name!r}, which is not a role"
|
||||
)
|
||||
roles[name] = dataclasses.replace(roles[name], first_attempt_model=model)
|
||||
if bundle.terraform_modules_skill:
|
||||
for name, role in roles.items():
|
||||
if MODULE_TOOL in role.tools:
|
||||
roles[name] = dataclasses.replace(
|
||||
role, modules_skill=bundle.terraform_modules_skill
|
||||
)
|
||||
unexpected = sorted(set(roles) - required - optional)
|
||||
if unexpected:
|
||||
raise RoleConfigError(
|
||||
f"{agents_dir}: unexpected role files {', '.join(unexpected)}"
|
||||
|
||||
@@ -34,6 +34,12 @@ class RoleSpec:
|
||||
model: str | None = None
|
||||
# Seconds one model request may take; None takes the runtime's default.
|
||||
model_timeout_seconds: float | None = None
|
||||
# A lighter model for the first attempt at a Deliverable, when the bundle
|
||||
# names one and model tiers are on (iteration 5 step 6).
|
||||
first_attempt_model: str | None = None
|
||||
# The Skill on published Terraform modules, for a role that may call them. It
|
||||
# is added to the role's Skills only in an Execution that opted into modules.
|
||||
modules_skill: str | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -255,6 +261,23 @@ class NoDecider:
|
||||
return None
|
||||
|
||||
|
||||
class SubmissionReview(Protocol):
|
||||
"""A review of a submission's meaning, beyond what its structure shows.
|
||||
|
||||
Returns what it would have the Specialist look at again, one line each; empty
|
||||
when it has nothing to raise or could not decide. `kind` is the Deliverable's
|
||||
kind, `upstream` the Deliverables it builds on.
|
||||
"""
|
||||
|
||||
async def __call__(
|
||||
self,
|
||||
kind: Any,
|
||||
attachments: Mapping[str, str],
|
||||
upstream: Mapping[str, Mapping[str, Any]] | None,
|
||||
scope: str = "",
|
||||
) -> Sequence[str]: ...
|
||||
|
||||
|
||||
class AgentRuntime(Protocol):
|
||||
async def run(
|
||||
self, role: RoleSpec, task: AgentTask, tools: Sequence[ToolSpec]
|
||||
|
||||
307
app/agent.py
307
app/agent.py
@@ -22,18 +22,21 @@ from langchain_core.runnables import RunnableConfig
|
||||
from langgraph.checkpoint.base import BaseCheckpointSaver
|
||||
from langgraph.types import Command
|
||||
|
||||
from app.adk.roles import load_roles
|
||||
from app.adk.roles import COVERAGE_REVIEWER, load_roles
|
||||
from app.adk.runtime import (
|
||||
AgentRuntime,
|
||||
Decider,
|
||||
NoDecider,
|
||||
RoleSpec,
|
||||
RunLimiter,
|
||||
SubmissionReview,
|
||||
ToolFactory,
|
||||
)
|
||||
from app.baseline import load_baseline
|
||||
from app.checkpointing import open_checkpointer
|
||||
from app.config import Settings
|
||||
from app.customer_case import record_intent
|
||||
from app.nodes.intake import DeliveredAnswers, Intake
|
||||
from app.nodes.router import (
|
||||
REPLY_WRITER,
|
||||
OrchestratorPolicy,
|
||||
@@ -43,13 +46,20 @@ from app.nodes.router import (
|
||||
)
|
||||
from app.providers import ProviderBundle, load_provider
|
||||
from app.recorder import DatabaseRecorder, ExecutionRecorder
|
||||
from app.skills.agent_skills import skill_version
|
||||
from app.scope import ESSENTIAL, Catalogue, Scope, read_scope, slug
|
||||
from app.skills.agent_skills import discover_skills, skill_version
|
||||
from app.states.execution_state import check_customer_case
|
||||
from app.states.ledger import Ledger
|
||||
from app.tools.coverage import CoverageReview
|
||||
from app.tools.design_review import DesignCoverageReview
|
||||
from app.tools.execution import ORCHESTRATOR
|
||||
from app.tools.jev import JevDecider, JevLimits
|
||||
from app.tools.local import TerraformRunner, local_tools
|
||||
from app.tools.mcp import McpCatalog, auth_from_config
|
||||
from app.tools.requirements_review import RequirementsReview
|
||||
from app.tools.schema_review import Reviews, SchemaReview
|
||||
from app.tools.scoping import Scoping, to_working
|
||||
from app.tools.skill_routing import routable
|
||||
from app.tools.toolkit import make_tool_factory
|
||||
from app.workflows.deliverables import DEPENDENCY_GRAPH
|
||||
from app.workflows.execution_graph import build_execution_graph
|
||||
@@ -84,6 +94,23 @@ class ExecutionEngine:
|
||||
limiter: RunLimiter | None = None,
|
||||
skill_versions: Mapping[str, str] | None = None,
|
||||
orchestrator: OrchestratorPolicy | None = None,
|
||||
submission_review: SubmissionReview | None = None,
|
||||
confirm_drafts: bool = False,
|
||||
decider: Decider | None = None,
|
||||
pillar_threshold: float = 1.5,
|
||||
reworded_threshold: float = 0.25,
|
||||
overlays: Mapping[str, str] | None = None,
|
||||
default_overlays: Sequence[str] = (),
|
||||
guard_user_text: bool = False,
|
||||
guard_threshold: float = 0.75,
|
||||
skill_references: Mapping[str, Mapping[str, Mapping[str, str]]] | None = None,
|
||||
skill_threshold: float = 1.25,
|
||||
assess_at_end: bool = False,
|
||||
modules_available: bool = False,
|
||||
default_modules: bool = False,
|
||||
scope_catalogue: Catalogue | None = None,
|
||||
scope_values: Mapping[str, Sequence[str]] | None = None,
|
||||
scope_skill: str | None = None,
|
||||
) -> None:
|
||||
required = {
|
||||
ORCHESTRATOR,
|
||||
@@ -93,7 +120,22 @@ class ExecutionEngine:
|
||||
if missing:
|
||||
raise ValueError(f"Missing roles: {', '.join(missing)}")
|
||||
self._max_revisions = max_revisions
|
||||
# The catalogue a scope spec is read against (ADR-0008); None when this
|
||||
# deployment's Cloud provider has none.
|
||||
self._scope_catalogue = scope_catalogue
|
||||
self._scope_values = dict(scope_values or {})
|
||||
self._scope_skill = scope_skill
|
||||
# Whether the Cloud provider approves any module sources, and whether an
|
||||
# Execution uses them when its caller does not say.
|
||||
self._modules_available = modules_available
|
||||
self._default_modules = default_modules and modules_available
|
||||
self._output_root = output_root
|
||||
# Overlay Skills an Execution may name, with the version of each (ADR-0004).
|
||||
self._overlays = dict(overlays or {})
|
||||
self._default_overlays = tuple(default_overlays)
|
||||
unknown = sorted(set(self._default_overlays) - set(self._overlays))
|
||||
if unknown:
|
||||
raise ValueError(f"Unknown default overlay Skills: {', '.join(unknown)}")
|
||||
self._graph = build_execution_graph(
|
||||
runtime=runtime,
|
||||
roles=roles,
|
||||
@@ -104,6 +146,19 @@ class ExecutionEngine:
|
||||
limiter=limiter,
|
||||
skill_versions=skill_versions,
|
||||
orchestrator=orchestrator,
|
||||
submission_review=submission_review,
|
||||
confirm_drafts=confirm_drafts,
|
||||
decider=decider,
|
||||
pillar_threshold=pillar_threshold,
|
||||
reworded_threshold=reworded_threshold,
|
||||
guard_user_text=guard_user_text,
|
||||
guard_threshold=guard_threshold,
|
||||
skill_references=skill_references,
|
||||
skill_threshold=skill_threshold,
|
||||
assess_at_end=assess_at_end,
|
||||
scoping=Scoping(scope_catalogue, dict(scope_values or {}), scope_skill)
|
||||
if scope_catalogue is not None
|
||||
else None,
|
||||
).compile(checkpointer=checkpointer)
|
||||
|
||||
async def start(
|
||||
@@ -112,17 +167,110 @@ class ExecutionEngine:
|
||||
*,
|
||||
session_id: str | None = None,
|
||||
customer_case: str | None = None,
|
||||
pre_approved: bool = False,
|
||||
pre_approved: bool | None = None,
|
||||
allow_cloud_read: bool | None = None,
|
||||
execution_id: str | None = None,
|
||||
scripted_answers: Sequence[tuple[str, str]] = (),
|
||||
scripted_answers: Sequence[Sequence[str]] = (),
|
||||
baseline: str | None = None,
|
||||
overlay_skills: Sequence[str] = (),
|
||||
terraform_modules: bool | None = None,
|
||||
scope: str | Mapping[str, Any] | None = None,
|
||||
) -> Interaction:
|
||||
"""Start an Execution. `scripted_answers` are (regex, answer) pairs a
|
||||
pre-approved Execution uses to answer questions, for evaluation runs."""
|
||||
"""Start an Execution. `scripted_answers` are (regex, answer[, asker]) entries a
|
||||
pre-approved Execution uses to answer questions, for evaluation runs.
|
||||
|
||||
`baseline` names a completed Execution of the same Customer case and makes
|
||||
this a Change request (ADR-0006): the request says what has changed, and the
|
||||
Execution starts from that Baseline's Deliverables. It is refused, before
|
||||
anything runs or is recorded, when the Baseline cannot be one.
|
||||
|
||||
`overlay_skills` names Skills that carry an organisation's standards or
|
||||
this engagement's constraints. Each must be one the deployment has
|
||||
configured; an unknown name refuses the start. Every Specialist loads them
|
||||
with the ones the deployment loads by default.
|
||||
|
||||
`terraform_modules` opts the Execution into published Terraform modules
|
||||
from the sources the Cloud provider approves. Left unset, a Change request
|
||||
does as its Baseline did and any other Execution takes the deployment's
|
||||
default, which is plain resources. Opting in is refused when the provider
|
||||
approves no sources.
|
||||
|
||||
`scope` is a scope spec (ADR-0008), as YAML text or already parsed. It may
|
||||
be complete or partly filled. The start is refused when it names a field
|
||||
the catalogue does not have or holds a value of the wrong type, and, for a
|
||||
pre-approved Execution, when an essential field is not settled: nobody is
|
||||
there to ask. What the spec states under `run` applies where the caller
|
||||
gave no value of their own. Its statement of intent is the request when
|
||||
none is given.
|
||||
"""
|
||||
read = self._read_scope(scope) if scope is not None else None
|
||||
if read is not None:
|
||||
run = read.values
|
||||
if pre_approved is None:
|
||||
pre_approved = bool(run.get("run.pre_approved", False))
|
||||
if allow_cloud_read is None and "run.allow_cloud_read" in run:
|
||||
allow_cloud_read = bool(run["run.allow_cloud_read"])
|
||||
if terraform_modules is None and "run.terraform_modules" in run:
|
||||
terraform_modules = bool(run["run.terraform_modules"])
|
||||
overlay_skills = [*overlay_skills, *run.get("run.overlay_skills", [])]
|
||||
if (
|
||||
customer_case
|
||||
and read.customer_case
|
||||
and slug(customer_case) != (read.customer_case)
|
||||
):
|
||||
raise ValueError(
|
||||
f"The scope spec is for {read.customer_case}, and this was "
|
||||
f"started for {customer_case}."
|
||||
)
|
||||
customer_case = customer_case or read.customer_case
|
||||
# The spec's statement is the customer's; it is what gets recorded.
|
||||
workflow_request = read.statement or workflow_request
|
||||
missing = read.gaps(ESSENTIAL)
|
||||
if pre_approved and missing:
|
||||
raise ValueError(
|
||||
"The scope spec leaves essential fields unsettled, and a "
|
||||
"pre-approved Execution has nobody to ask: "
|
||||
+ ", ".join(gap["field"] for gap in missing)
|
||||
+ ". Give each a value, or `decide` to leave it to the agent."
|
||||
)
|
||||
pre_approved = bool(pre_approved)
|
||||
if not workflow_request.strip():
|
||||
raise ValueError(
|
||||
"A request is needed: text, or a scope spec with a statement."
|
||||
)
|
||||
customer_case = check_customer_case(customer_case)
|
||||
execution_id = execution_id or str(uuid.uuid4())
|
||||
if await self._exists(execution_id):
|
||||
raise ValueError(f"Execution {execution_id} already exists")
|
||||
if isinstance(overlay_skills, str) or not all(
|
||||
isinstance(name, str) for name in overlay_skills
|
||||
):
|
||||
raise ValueError("overlay_skills must be a list of Skill names")
|
||||
chosen = list(dict.fromkeys([*self._default_overlays, *overlay_skills]))
|
||||
unknown = sorted(set(chosen) - set(self._overlays))
|
||||
if unknown:
|
||||
raise ValueError(
|
||||
f"Unknown overlay Skills: {', '.join(unknown)}. Available: "
|
||||
f"{', '.join(sorted(self._overlays)) or 'none'}"
|
||||
)
|
||||
loaded = (
|
||||
load_baseline(self._output_root, customer_case, baseline)
|
||||
if baseline
|
||||
else None
|
||||
)
|
||||
if terraform_modules is None:
|
||||
terraform_modules = (
|
||||
bool(loaded.get("terraform_modules"))
|
||||
if loaded
|
||||
else self._default_modules
|
||||
)
|
||||
if not isinstance(terraform_modules, bool):
|
||||
# A ValueError is what callers turn into a refused start.
|
||||
raise ValueError("terraform_modules must be true or false") # noqa: TRY004
|
||||
if terraform_modules and not self._modules_available:
|
||||
raise ValueError(
|
||||
"terraform_modules: this Cloud provider has no approved module sources"
|
||||
)
|
||||
if pre_approved and allow_cloud_read is None:
|
||||
allow_cloud_read = False
|
||||
session_id = session_id or str(uuid.uuid4())
|
||||
@@ -132,6 +280,9 @@ class ExecutionEngine:
|
||||
execution_id=execution_id,
|
||||
session_id=session_id,
|
||||
workflow_request=workflow_request,
|
||||
baseline=baseline or None,
|
||||
scope_supplied=scope if isinstance(scope, str) else None,
|
||||
scope_completed=read.completed(read.status(pre_approved)) if read else None,
|
||||
)
|
||||
initial: dict[str, Any] = {
|
||||
"execution_id": execution_id,
|
||||
@@ -139,6 +290,23 @@ class ExecutionEngine:
|
||||
"customer_case": customer_case,
|
||||
"intent_version": intent_version,
|
||||
"workflow_request": workflow_request,
|
||||
# The Baseline of a Change request, as read from its files; else None.
|
||||
"baseline": loaded,
|
||||
# Overlay Skills this Execution loads, each with the version it had.
|
||||
"overlay_skills": {name: self._overlays[name] for name in chosen},
|
||||
"terraform_modules": terraform_modules,
|
||||
# What the customer's scope spec settles and leaves open; None without one.
|
||||
"scope": {
|
||||
"skill": self._scope_skill,
|
||||
"status": read.status(pre_approved),
|
||||
"readiness": read.readiness(),
|
||||
"context": read.for_context(),
|
||||
# What the scope analyst starts from and completes.
|
||||
"working": to_working(read),
|
||||
}
|
||||
if read
|
||||
else None,
|
||||
"risks": [],
|
||||
"pre_approved": pre_approved,
|
||||
"allow_cloud_read": allow_cloud_read,
|
||||
"ledger": Ledger(
|
||||
@@ -151,6 +319,7 @@ class ExecutionEngine:
|
||||
"awaiting_questions": [],
|
||||
"answers": {},
|
||||
"drafts": {},
|
||||
"drafts_shown": [],
|
||||
"working": {},
|
||||
"pending_permission": None,
|
||||
"prompt": None,
|
||||
@@ -158,6 +327,10 @@ class ExecutionEngine:
|
||||
"pending_change": None,
|
||||
"awaiting_gap_decision": False,
|
||||
"validation_settled": 0,
|
||||
"awaiting_limit_decision": False,
|
||||
"revision_limit_asked": [],
|
||||
"idle_asks": 0,
|
||||
"ask_fingerprint": "",
|
||||
"decisions": [],
|
||||
"outcomes": [],
|
||||
"refusals": [],
|
||||
@@ -166,13 +339,18 @@ class ExecutionEngine:
|
||||
"turns": 0,
|
||||
"status": "running",
|
||||
"warnings": [],
|
||||
"scripted_answers": [
|
||||
[pattern, answer] for pattern, answer in scripted_answers
|
||||
],
|
||||
"scripted_answers": [list(entry) for entry in scripted_answers],
|
||||
}
|
||||
await self._graph.ainvoke(initial, self._config(execution_id))
|
||||
return await self.interaction(execution_id)
|
||||
|
||||
def _read_scope(self, supplied: str | Mapping[str, Any]) -> Scope:
|
||||
if self._scope_catalogue is None:
|
||||
raise ValueError("This deployment has no scope spec catalogue.")
|
||||
return read_scope(
|
||||
supplied, self._scope_catalogue, provider_values=self._scope_values
|
||||
)
|
||||
|
||||
async def resume(self, execution_id: str, reply: Mapping[str, Any]) -> Interaction:
|
||||
"""Answer the Execution's current prompt: {"reply"} | {"approval"} | {"permission"}."""
|
||||
current = await self.interaction(execution_id)
|
||||
@@ -227,6 +405,49 @@ class Assembly:
|
||||
roles: dict[str, RoleSpec]
|
||||
mcp_gaps: dict[str, str]
|
||||
decider: Decider = field(default_factory=NoDecider)
|
||||
intake: Intake | None = None # reads a message that starts something
|
||||
# Answers a question about delivered work from its files.
|
||||
answers: DeliveredAnswers | None = None
|
||||
|
||||
|
||||
def discover_overlays(settings: Settings, bundle: ProviderBundle) -> dict[str, Any]:
|
||||
"""The overlay Skills this deployment has configured, by name (ADR-0004).
|
||||
|
||||
They come only from the folders the deployment names, pass the same validation
|
||||
as the provider's Skills, and may not reuse one of the provider's names.
|
||||
"""
|
||||
folders = [folder for folder in settings.overlay_dirs() if folder.is_dir()]
|
||||
overlays = discover_skills(folders)
|
||||
clash = sorted(set(overlays) & set(bundle.skills))
|
||||
if clash:
|
||||
raise ValueError(
|
||||
f"Overlay Skills reuse the names of provider Skills: {', '.join(clash)}"
|
||||
)
|
||||
return overlays
|
||||
|
||||
|
||||
def skill_dirs(settings: Settings, bundle: ProviderBundle) -> dict[str, Path]:
|
||||
"""Every Skill a runtime may be asked to load: the provider's and the overlays."""
|
||||
return {
|
||||
**{name: meta.path for name, meta in bundle.skills.items()},
|
||||
**{
|
||||
name: meta.path
|
||||
for name, meta in discover_overlays(settings, bundle).items()
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def role_references(
|
||||
roles: Mapping[str, RoleSpec], bundle: ProviderBundle
|
||||
) -> dict[str, dict[str, dict[str, str]]]:
|
||||
"""For each role, its Skills that hold enough references to choose among, with
|
||||
what each reference covers (iteration 5 step 8)."""
|
||||
worth = routable({name: meta.path for name, meta in bundle.skills.items()})
|
||||
by_role = {
|
||||
name: {skill: worth[skill] for skill in role.skills if skill in worth}
|
||||
for name, role in roles.items()
|
||||
}
|
||||
return {name: skills for name, skills in by_role.items() if skills}
|
||||
|
||||
|
||||
def open_decider(settings: Settings) -> Decider:
|
||||
@@ -264,12 +485,15 @@ async def open_assembly(
|
||||
orchestrator_budget=settings.ORCHESTRATOR_BUDGET,
|
||||
specialist_budget=settings.SPECIALIST_BUDGET,
|
||||
include_preview_mcp=settings.MCP_ENABLE_PREVIEW,
|
||||
lessons=settings.LESSONS_ENABLED,
|
||||
model_tiers=settings.MODEL_TIERS,
|
||||
)
|
||||
overlays = discover_overlays(settings, bundle)
|
||||
if runtime is None:
|
||||
from app.adk.adk_runtime import AdkAgentRuntime
|
||||
|
||||
runtime = AdkAgentRuntime(
|
||||
skill_dirs={name: meta.path for name, meta in bundle.skills.items()},
|
||||
skill_dirs=skill_dirs(settings, bundle),
|
||||
model_timeout_seconds=settings.MODEL_TIMEOUT_SECONDS,
|
||||
)
|
||||
|
||||
@@ -287,10 +511,12 @@ async def open_assembly(
|
||||
timeout_seconds=settings.TERRAFORM_TIMEOUT_SECONDS,
|
||||
plugin_cache_dir=settings.terraform_plugin_cache(),
|
||||
providers=bundle.terraform_providers,
|
||||
module_namespaces=bundle.terraform_module_namespaces,
|
||||
)
|
||||
offered = [name for names in bundle.tools.values() for name in names]
|
||||
# One cap for Specialists and the pillar advisors they fan out to.
|
||||
limiter = RunLimiter(settings.MAX_PARALLEL_SPECIALISTS)
|
||||
decider = open_decider(settings)
|
||||
tool_factory = make_tool_factory(
|
||||
runtime,
|
||||
roles,
|
||||
@@ -298,9 +524,12 @@ async def open_assembly(
|
||||
local_tools=lambda working_copy: local_tools(offered, runner, working_copy),
|
||||
catalog=catalog,
|
||||
limiter=limiter,
|
||||
guard=decider
|
||||
if settings.JEV_GUARDRAIL and isinstance(decider, JevDecider)
|
||||
else None,
|
||||
withhold_at=settings.JEV_GUARDRAIL_THRESHOLD,
|
||||
)
|
||||
|
||||
decider = open_decider(settings)
|
||||
orchestrator: OrchestratorPolicy | None = None
|
||||
if settings.ORCHESTRATOR == "router":
|
||||
# The Orchestrator routes: Jev reads, the playbook decides, and a model only
|
||||
@@ -319,6 +548,25 @@ async def open_assembly(
|
||||
f"ORCHESTRATOR must be router or model, not {settings.ORCHESTRATOR!r}"
|
||||
)
|
||||
|
||||
# What is looked at in a design before it is submitted. Each raises what it finds
|
||||
# once and never blocks.
|
||||
reviews: list[SubmissionReview] = []
|
||||
if bundle.terraform_providers:
|
||||
# In code: every setting a Check names exists on its resource type.
|
||||
reviews.append(SchemaReview(runner))
|
||||
if settings.JEV_REQUIREMENTS_REVIEW and isinstance(decider, JevDecider):
|
||||
# Optional, and off by default: Jev says whether a requirement names a product.
|
||||
reviews.append(
|
||||
RequirementsReview(decider, act=settings.JEV_REQUIREMENTS_THRESHOLD)
|
||||
)
|
||||
if settings.DESIGN_COVERAGE_REVIEW and COVERAGE_REVIEWER in roles:
|
||||
# A model reads the requirements against the Checks, once, before the
|
||||
# design is approved: the reading the validator would make after the code.
|
||||
reviews.append(DesignCoverageReview(runtime, roles[COVERAGE_REVIEWER]))
|
||||
if settings.JEV_COVERAGE_REVIEW and isinstance(decider, JevDecider):
|
||||
# Optional, and off by default: Jev says which Check verifies each condition.
|
||||
reviews.append(CoverageReview(decider, none_at=settings.JEV_COVERAGE_THRESHOLD))
|
||||
|
||||
async with open_checkpointer(settings) as checkpointer:
|
||||
engine = ExecutionEngine(
|
||||
runtime=runtime,
|
||||
@@ -334,9 +582,44 @@ async def open_assembly(
|
||||
name: skill_version(meta.path) for name, meta in bundle.skills.items()
|
||||
},
|
||||
orchestrator=orchestrator,
|
||||
submission_review=Reviews(reviews) if reviews else None,
|
||||
confirm_drafts=settings.CONFIRM_DRAFTS,
|
||||
decider=decider,
|
||||
pillar_threshold=settings.JEV_PILLAR_THRESHOLD,
|
||||
reworded_threshold=settings.JEV_REWORDED_THRESHOLD,
|
||||
guard_user_text=settings.JEV_GUARDRAIL,
|
||||
guard_threshold=settings.JEV_GUARDRAIL_THRESHOLD,
|
||||
skill_references=role_references(roles, bundle)
|
||||
if settings.JEV_SKILL_ROUTING
|
||||
else None,
|
||||
skill_threshold=settings.JEV_SKILL_THRESHOLD,
|
||||
assess_at_end=settings.JEV_ASSESS_EXECUTIONS,
|
||||
scope_catalogue=bundle.scope_catalogue() if bundle.scope_skill else None,
|
||||
scope_values=bundle.scope_values,
|
||||
scope_skill=bundle.scope_skill,
|
||||
modules_available=bool(bundle.terraform_module_namespaces),
|
||||
default_modules=settings.TERRAFORM_MODULES,
|
||||
overlays={
|
||||
name: skill_version(meta.path) for name, meta in overlays.items()
|
||||
},
|
||||
default_overlays=settings.default_overlays(),
|
||||
)
|
||||
try:
|
||||
yield Assembly(engine, bundle, roles, dict(catalog.gaps), decider)
|
||||
yield Assembly(
|
||||
engine,
|
||||
bundle,
|
||||
roles,
|
||||
dict(catalog.gaps),
|
||||
decider,
|
||||
Intake(
|
||||
decider,
|
||||
output_root or settings.BASE_DIR,
|
||||
act=settings.JEV_ACT_THRESHOLD,
|
||||
),
|
||||
DeliveredAnswers(
|
||||
runtime, roles[REPLY_WRITER], output_root or settings.BASE_DIR
|
||||
),
|
||||
)
|
||||
finally:
|
||||
if isinstance(decider, JevDecider):
|
||||
await decider.aclose()
|
||||
|
||||
109
app/baseline.py
Normal file
109
app/baseline.py
Normal file
@@ -0,0 +1,109 @@
|
||||
"""The Baseline of a Change request (ADR-0006).
|
||||
|
||||
A Change request is an Execution that starts from the Deliverables of a completed
|
||||
Execution of the same Customer case. That Execution is its Baseline. It is read from
|
||||
its files under the Customer case, through its manifest, so it does not depend on a
|
||||
checkpoint and survives a restart. It is only ever read: a Baseline is never modified.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from app.states.execution_state import UNASSIGNED_CASE, case_dir, execution_dir
|
||||
|
||||
MANIFEST_FILENAME = "execution.json"
|
||||
COMPLETED = "completed"
|
||||
WORKING_FILENAME = "working.json"
|
||||
_EXECUTION_ID = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$")
|
||||
|
||||
|
||||
class BaselineError(ValueError):
|
||||
"""The Execution named as a Baseline cannot be one; the message says why."""
|
||||
|
||||
|
||||
def load_baseline(
|
||||
output_root: Path, customer_case: str, execution_id: str
|
||||
) -> dict[str, Any]:
|
||||
"""The Baseline as plain data: its id, its request and every Deliverable.
|
||||
|
||||
Raises BaselineError when the Execution does not exist, belongs to another
|
||||
Customer case, or did not complete.
|
||||
"""
|
||||
if not isinstance(execution_id, str) or not _EXECUTION_ID.match(execution_id):
|
||||
raise BaselineError(f"baseline {execution_id!r} is not an Execution id")
|
||||
if customer_case == UNASSIGNED_CASE:
|
||||
raise BaselineError(
|
||||
"a Change request needs a customer_case: a Baseline is a completed "
|
||||
"Execution of the same Customer case"
|
||||
)
|
||||
folder = execution_dir(output_root, execution_id, customer_case)
|
||||
manifest_path = folder / MANIFEST_FILENAME
|
||||
if not manifest_path.is_file():
|
||||
elsewhere = [
|
||||
path.parent.parent.parent.name
|
||||
for path in case_dir(output_root, "x").parent.glob(
|
||||
f"*/executions/{execution_id}/{MANIFEST_FILENAME}"
|
||||
)
|
||||
]
|
||||
if elsewhere:
|
||||
# Never say which: one case must learn nothing about another.
|
||||
raise BaselineError(
|
||||
f"baseline {execution_id} belongs to another Customer case"
|
||||
)
|
||||
raise BaselineError(
|
||||
f"baseline {execution_id} is not an Execution of Customer case "
|
||||
f"{customer_case} with files on record"
|
||||
)
|
||||
try:
|
||||
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
|
||||
except ValueError as exc:
|
||||
raise BaselineError(f"baseline {execution_id} has no readable record") from exc
|
||||
if manifest.get("customer_case") not in (None, customer_case):
|
||||
raise BaselineError(f"baseline {execution_id} belongs to another Customer case")
|
||||
if manifest.get("status", COMPLETED) != COMPLETED:
|
||||
raise BaselineError(
|
||||
f"baseline {execution_id} did not complete ({manifest.get('status')}); "
|
||||
"a Change request starts from a completed Execution"
|
||||
)
|
||||
|
||||
deliverables: dict[str, dict[str, Any]] = {}
|
||||
for kind, entry in (manifest.get("deliverables") or {}).items():
|
||||
document = folder / str(entry.get("document", ""))
|
||||
if not document.is_file():
|
||||
raise BaselineError(f"baseline {execution_id} is missing its {kind} file")
|
||||
attachments = {}
|
||||
for name in entry.get("attachments") or ():
|
||||
path = folder / name
|
||||
if not path.is_file():
|
||||
raise BaselineError(f"baseline {execution_id} is missing {name}")
|
||||
attachments[name] = path.read_text(encoding="utf-8")
|
||||
deliverables[kind] = {
|
||||
"content": document.read_text(encoding="utf-8"),
|
||||
"attachments": attachments,
|
||||
}
|
||||
if not deliverables:
|
||||
raise BaselineError(f"baseline {execution_id} holds no Deliverables")
|
||||
working_path = folder / WORKING_FILENAME
|
||||
working: dict[str, Any] = {}
|
||||
if working_path.is_file():
|
||||
try:
|
||||
loaded = json.loads(working_path.read_text(encoding="utf-8"))
|
||||
except ValueError:
|
||||
loaded = {}
|
||||
if isinstance(loaded, dict):
|
||||
working = loaded
|
||||
return {
|
||||
"execution_id": execution_id,
|
||||
"customer_case": customer_case,
|
||||
"workflow_request": manifest.get("workflow_request", ""),
|
||||
"baseline": manifest.get("baseline"), # what it was itself changed from
|
||||
# Whether its code was allowed published modules; a Change request follows.
|
||||
"terraform_modules": bool(manifest.get("terraform_modules")),
|
||||
"deliverables": deliverables,
|
||||
# Working material worth starting from again, such as pillar advice.
|
||||
"working": working,
|
||||
}
|
||||
103
app/config.py
103
app/config.py
@@ -1,7 +1,10 @@
|
||||
"""Typed settings for GCP Solution Architecture Agent."""
|
||||
|
||||
import os
|
||||
from collections.abc import MutableMapping
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import dotenv_values
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
@@ -51,6 +54,28 @@ class Settings(BaseSettings):
|
||||
A2A_PUBLIC_URL: str | None = None # advertised in the agent card
|
||||
ORCHESTRATOR_BUDGET: int = 40
|
||||
SPECIALIST_BUDGET: int = 15
|
||||
# Where overlay Skills live: an organisation's standards or one engagement's
|
||||
# constraints, each an Agent Skill (ADR-0004). Comma-separated folders, relative
|
||||
# to the repository root. A caller names an overlay; it can never supply one.
|
||||
OVERLAY_SKILLS_DIRS: str = "skills/overlays"
|
||||
# Overlay Skills every Execution loads, comma-separated.
|
||||
DEFAULT_OVERLAY_SKILLS: str = ""
|
||||
|
||||
# Whether an Execution may use published Terraform modules when its caller does
|
||||
# not say. Off: infrastructure code is plain resources, and a caller opts in
|
||||
# per Execution with `terraform_modules`. The sources are the provider bundle's.
|
||||
TERRAFORM_MODULES: bool = False
|
||||
|
||||
# Give Specialists the lessons Skill. Off runs without anything learned, which
|
||||
# is how the evaluation shows whether a lesson helps.
|
||||
LESSONS_ENABLED: bool = True
|
||||
# Give a role the lighter model its provider bundle names for a first attempt
|
||||
# (`models.first_attempt`). An attempt that follows feedback, or an attempt
|
||||
# that produced nothing, takes the role's own model. Off until measured.
|
||||
MODEL_TIERS: bool = False
|
||||
# With a user present, a Specialist's first submission of a Deliverable is refused
|
||||
# until it has put its draft to them. Off: Specialists are only told to.
|
||||
CONFIRM_DRAFTS: bool = True
|
||||
MAX_REVISIONS: int = 3
|
||||
MAX_ORCHESTRATOR_TURNS: int = 100
|
||||
# How an Orchestrator turn is decided (ADR-0007): "router" reads the Execution
|
||||
@@ -79,10 +104,57 @@ class Settings(BaseSettings):
|
||||
JEV_ACT_THRESHOLD: float = 0.75
|
||||
JEV_CLOSE_THRESHOLD: float = 0.15
|
||||
JEV_CONFIDENCE_THRESHOLD: float = 0.6
|
||||
# Have a model read the requirements and recommendations against the Checks
|
||||
# when the Target architecture is first submitted, and return what no Check
|
||||
# verifies to its author. The validator makes the same reading after the code
|
||||
# is written, when a gap costs a Revision of design, code and validation. One
|
||||
# model run in every Execution. Off until measured.
|
||||
DESIGN_COVERAGE_REVIEW: bool = False
|
||||
# Review a design's coverage at submission: for each condition a requirement
|
||||
# lists, which Check verifies it. Off until a full case has run with it.
|
||||
JEV_COVERAGE_REVIEW: bool = False
|
||||
# How likely "no Check verifies this" must be before the condition is raised.
|
||||
JEV_COVERAGE_THRESHOLD: float = 0.6
|
||||
# Review the requirements at submission: does any name a cloud product? Off
|
||||
# until a full case has run with it.
|
||||
JEV_REQUIREMENTS_REVIEW: bool = False
|
||||
JEV_REQUIREMENTS_THRESHOLD: float = 0.3
|
||||
# How directly a change must affect a pillar for its advisor to be consulted
|
||||
# again: 0 not at all, 1 only indirectly, 2 directly.
|
||||
JEV_PILLAR_THRESHOLD: float = 1.5
|
||||
# In a Change request: at or below this probability of a real change, an item
|
||||
# whose text differs from the Baseline's is listed as reworded, not changed.
|
||||
JEV_REWORDED_THRESHOLD: float = 0.25
|
||||
# Name, in a Specialist's context, the references of its Skills its task needs.
|
||||
# A reference is named at this score or above: 0 not needed, 1 might help,
|
||||
# 2 needed.
|
||||
JEV_SKILL_ROUTING: bool = True
|
||||
JEV_SKILL_THRESHOLD: float = 1.25
|
||||
# Judge each Execution's design recommendations when it ends and keep the
|
||||
# scores in its record. It reports only.
|
||||
JEV_ASSESS_EXECUTIONS: bool = True
|
||||
# Check what remote MCP servers return, and what the user writes, for text that
|
||||
# tries to instruct the agent. A server's reply at or above the threshold is
|
||||
# withheld from the Specialist; the user's own words are only flagged.
|
||||
JEV_GUARDRAIL: bool = True
|
||||
JEV_GUARDRAIL_THRESHOLD: float = 0.75
|
||||
|
||||
# Paths
|
||||
BASE_DIR: Path = Path(__file__).resolve().parent.parent
|
||||
|
||||
def overlay_dirs(self) -> list[Path]:
|
||||
return [
|
||||
path if path.is_absolute() else self.BASE_DIR / path
|
||||
for path in (
|
||||
Path(entry.strip())
|
||||
for entry in self.OVERLAY_SKILLS_DIRS.split(",")
|
||||
if entry.strip()
|
||||
)
|
||||
]
|
||||
|
||||
def default_overlays(self) -> list[str]:
|
||||
return [n.strip() for n in self.DEFAULT_OVERLAY_SKILLS.split(",") if n.strip()]
|
||||
|
||||
def terraform_plugin_cache(self) -> str | None:
|
||||
"""The provider cache directory as an absolute path; None when disabled."""
|
||||
if not self.TF_PLUGIN_CACHE_DIR.strip():
|
||||
@@ -100,9 +172,38 @@ class Settings(BaseSettings):
|
||||
_settings: Settings | None = None
|
||||
|
||||
|
||||
def export_env_file(
|
||||
path: str | Path = ".env", environ: MutableMapping[str, str] | None = None
|
||||
) -> list[str]:
|
||||
"""Put the env file's other variables into the process environment.
|
||||
|
||||
Settings reads its own fields from the env file. Everything else in it is for a
|
||||
library that reads the environment itself, such as a Cloud provider's client
|
||||
looking for its project and credentials, and would otherwise be ignored. A
|
||||
variable already set in the environment is left alone, and Settings' own fields
|
||||
are never exported, so the secrets among them do not reach child processes.
|
||||
Returns the names it set.
|
||||
"""
|
||||
environ = os.environ if environ is None else environ
|
||||
path = Path(path)
|
||||
if not path.is_file():
|
||||
return []
|
||||
own = {name.upper() for name in Settings.model_fields}
|
||||
exported = []
|
||||
for name, value in dotenv_values(path).items():
|
||||
if value is None or name.upper() in own or name in environ:
|
||||
continue
|
||||
environ[name] = value
|
||||
exported.append(name)
|
||||
return exported
|
||||
|
||||
|
||||
def get_settings() -> Settings:
|
||||
"""Get singleton Settings instance."""
|
||||
"""Get singleton Settings instance, loading the env file at first use."""
|
||||
global _settings
|
||||
if _settings is None:
|
||||
# Tests switch this off so they never depend on a developer's env file.
|
||||
if os.environ.get("ENV_FILE_EXPORT", "true").lower() != "false":
|
||||
export_env_file()
|
||||
_settings = Settings()
|
||||
return _settings
|
||||
|
||||
@@ -14,15 +14,20 @@ nothing was delivered for it. history.json is the index of the case.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from collections.abc import Mapping
|
||||
from datetime import UTC, datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from app.states.execution_state import case_dir
|
||||
|
||||
INTENT_DIR = "intent"
|
||||
HISTORY_FILENAME = "history.json"
|
||||
IN_PROGRESS = "in_progress"
|
||||
SCOPE_SUPPLIED = ".scope.yaml"
|
||||
SCOPE_COMPLETED = ".scope.completed.yaml"
|
||||
|
||||
|
||||
def intent_dir(output_root: Path, customer_case: str) -> Path:
|
||||
@@ -49,8 +54,15 @@ def record_intent(
|
||||
execution_id: str,
|
||||
session_id: str,
|
||||
workflow_request: str,
|
||||
baseline: str | None = None,
|
||||
scope_supplied: str | None = None,
|
||||
scope_completed: Mapping[str, Any] | None = None,
|
||||
) -> int:
|
||||
"""Record a new statement of the customer's intent and return its version."""
|
||||
"""Record a new statement of the customer's intent and return its version.
|
||||
|
||||
`baseline` is the Execution a Change request starts from; with it the history
|
||||
shows the case's line of versions.
|
||||
"""
|
||||
folder = intent_dir(output_root, customer_case)
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
history = read_history(output_root, customer_case)
|
||||
@@ -60,10 +72,25 @@ def record_intent(
|
||||
(folder / statement).write_text(
|
||||
f"# Intent {version}: {customer_case}\n\n"
|
||||
f"- Recorded: {recorded_at}\n"
|
||||
f"- Execution: `{execution_id}`\n\n"
|
||||
f"- Execution: `{execution_id}`\n"
|
||||
+ (f"- Changes: `{baseline}`\n" if baseline else "")
|
||||
+ "\n"
|
||||
f"## What the customer wants\n\n{workflow_request.strip()}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
scope_files = None
|
||||
if scope_completed is not None:
|
||||
# The spec as supplied, unaltered, and the completed copy beside it.
|
||||
scope_files = {"completed": f"{INTENT_DIR}/{version:03d}{SCOPE_COMPLETED}"}
|
||||
(folder / f"{version:03d}{SCOPE_COMPLETED}").write_text(
|
||||
yaml.safe_dump(dict(scope_completed), sort_keys=False, allow_unicode=True),
|
||||
encoding="utf-8",
|
||||
)
|
||||
if scope_supplied:
|
||||
scope_files["supplied"] = f"{INTENT_DIR}/{version:03d}{SCOPE_SUPPLIED}"
|
||||
(folder / f"{version:03d}{SCOPE_SUPPLIED}").write_text(
|
||||
scope_supplied, encoding="utf-8"
|
||||
)
|
||||
history["intents"].append(
|
||||
{
|
||||
"version": version,
|
||||
@@ -74,6 +101,8 @@ def record_intent(
|
||||
"session_id": session_id,
|
||||
"status": IN_PROGRESS,
|
||||
"execution": None,
|
||||
"baseline": baseline,
|
||||
"scope": scope_files,
|
||||
}
|
||||
)
|
||||
_write_history(folder, history)
|
||||
|
||||
17
app/learning/__init__.py
Normal file
17
app/learning/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""The lessons loop (ADR-0004): what Executions got wrong becomes reviewed Skill changes.
|
||||
|
||||
capture each Execution records lesson candidates app/states/lessons.py
|
||||
distil recurring candidates are grouped, and a curator
|
||||
proposes a lesson for each group worth one evidence.py, curator.py
|
||||
review each proposal is an issue file a person decides proposals.py
|
||||
publish an approved lesson is written into the lessons
|
||||
Skill the provider bundle assigns to roles skill.py
|
||||
prove the evaluation runs with and without lessons
|
||||
retire a lesson that did not help, or that the upstream
|
||||
Skills now cover, is removed skill.py
|
||||
|
||||
Nothing here runs inside an Execution, and no lesson reaches an agent without a
|
||||
person's approval. Lesson candidates are client data: they are read from the
|
||||
Executions' records and never copied into the repository; a lesson and its issue
|
||||
file carry counts and a general description only.
|
||||
"""
|
||||
221
app/learning/curator.py
Normal file
221
app/learning/curator.py
Normal file
@@ -0,0 +1,221 @@
|
||||
"""The lesson curator: proposes a lesson for each recurring problem worth one.
|
||||
|
||||
It runs outside any Execution, on the evidence of many. It only proposes: every
|
||||
proposal is written as an issue file for a person to decide (ADR-0004).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from collections.abc import Sequence
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from app.adk.runtime import (
|
||||
AgentRuntime,
|
||||
AgentTask,
|
||||
Decider,
|
||||
Question,
|
||||
RoleSpec,
|
||||
ToolResult,
|
||||
ToolSpec,
|
||||
TurnEnded,
|
||||
)
|
||||
from app.learning.evidence import Group
|
||||
from app.learning.proposals import ISSUES, Proposal, load, propose
|
||||
from app.workflows.deliverables import DeliverableKind
|
||||
|
||||
LESSON_CURATOR = "lesson-curator"
|
||||
MAX_GROUPS = 25
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def _not_already_covered(
|
||||
decider: Decider,
|
||||
groups: Sequence[Group],
|
||||
lessons: Sequence[Proposal],
|
||||
covered_at: float,
|
||||
) -> list[Group]:
|
||||
"""The groups no existing lesson already covers (ADR-0007: lesson triage).
|
||||
|
||||
One choice per group among the lessons that exist, or none. A group a lesson
|
||||
covers is not put to the curator again, so the same lesson is not proposed
|
||||
twice in other words. With no decision every group is kept.
|
||||
"""
|
||||
live = [lesson for lesson in lessons if lesson.status != "wontfix"]
|
||||
if not groups or not live:
|
||||
return list(groups)
|
||||
answers = await decider.decide(
|
||||
"Lessons that already exist:\n"
|
||||
+ "\n".join(f"- {lesson.id}: {lesson.rule}" for lesson in live),
|
||||
{
|
||||
group.key: Question(
|
||||
"choice",
|
||||
f"A problem that recurred: {group.description} (on "
|
||||
f"{group.deliverable}). Which one existing lesson would have "
|
||||
"prevented it? Answer none when no lesson would.",
|
||||
(*(lesson.id for lesson in live), "none"),
|
||||
)
|
||||
for group in groups
|
||||
},
|
||||
scope="lesson-triage",
|
||||
)
|
||||
if not answers:
|
||||
return list(groups)
|
||||
kept = []
|
||||
for group in groups:
|
||||
answer = answers.get(group.key)
|
||||
if (
|
||||
answer is not None
|
||||
and answer.value != "none"
|
||||
and answer.confidence >= covered_at
|
||||
):
|
||||
logger.info("%s is already covered by %s", group.key, answer.value)
|
||||
continue
|
||||
kept.append(group)
|
||||
return kept
|
||||
|
||||
|
||||
def _evidence(group: Group, executions: int) -> str:
|
||||
return (
|
||||
f"Seen in {len(group.executions)} of {executions} Executions, "
|
||||
f"{group.occurrences} times in all: {group.description}."
|
||||
)
|
||||
|
||||
|
||||
async def curate(
|
||||
runtime: AgentRuntime,
|
||||
role: RoleSpec,
|
||||
groups: Sequence[Group],
|
||||
*,
|
||||
executions: int,
|
||||
identifiers: set[str] = frozenset(), # type: ignore[assignment]
|
||||
folder: Path = ISSUES,
|
||||
decider: Decider | None = None,
|
||||
covered_at: float = 0.6,
|
||||
) -> list[Proposal]:
|
||||
"""Run the curator over the groups that have no proposal yet; return what it
|
||||
proposed. Groups it judged not worth a lesson are left for the next run."""
|
||||
existing = load(folder)
|
||||
decided = {proposal.evidence_key for proposal in existing}
|
||||
fresh = [group for group in groups if group.key not in decided][:MAX_GROUPS]
|
||||
if decider is not None and existing:
|
||||
# A group about one setting is narrower than any lesson about its kind of
|
||||
# problem, and it recurred with those lessons published: it goes to the
|
||||
# curator, who is shown the lessons that exist and may still decline.
|
||||
broad = [group for group in fresh if group.subject is None]
|
||||
kept = await _not_already_covered(decider, broad, existing, covered_at)
|
||||
fresh = [g for g in fresh if g.subject is not None or g in kept]
|
||||
if not fresh:
|
||||
return []
|
||||
by_key = {group.key: group for group in fresh}
|
||||
kinds = [kind.value for kind in DeliverableKind]
|
||||
proposed: list[Proposal] = []
|
||||
declined: dict[str, str] = {}
|
||||
|
||||
async def propose_lesson(
|
||||
group: str, deliverable: str, title: str, rule: str, reason: str
|
||||
) -> ToolResult:
|
||||
if group not in by_key:
|
||||
return ToolResult(f"Refused: {group} is not one of the groups given.")
|
||||
if deliverable not in kinds:
|
||||
return ToolResult(
|
||||
f"Refused: deliverable must be one of {', '.join(kinds)}."
|
||||
)
|
||||
if any(p.evidence_key == group for p in proposed):
|
||||
return ToolResult(f"Refused: {group} already has a proposal.")
|
||||
text = f"{title} {rule} {reason}"
|
||||
leaked = sorted(name for name in identifiers if name in text)
|
||||
if leaked:
|
||||
return ToolResult(
|
||||
"Refused: a lesson carries no client or Execution detail; remove "
|
||||
+ ", ".join(leaked)
|
||||
)
|
||||
if not (title.strip() and rule.strip() and reason.strip()):
|
||||
return ToolResult("Refused: a lesson needs a title, a rule and a reason.")
|
||||
proposal = propose(
|
||||
title=title,
|
||||
deliverable=deliverable,
|
||||
rule=rule,
|
||||
reason=reason,
|
||||
evidence=_evidence(by_key[group], executions),
|
||||
evidence_key=group,
|
||||
folder=folder,
|
||||
)
|
||||
proposed.append(proposal)
|
||||
return ToolResult(f"Proposed {proposal.id} for a person to review.")
|
||||
|
||||
async def no_lesson(group: str, why: str) -> ToolResult:
|
||||
if group not in by_key:
|
||||
return ToolResult(f"Refused: {group} is not one of the groups given.")
|
||||
declined[group] = why
|
||||
return ToolResult(f"Noted: no lesson for {group}.")
|
||||
|
||||
async def finish() -> ToolResult:
|
||||
return ToolResult("Done.", TurnEnded("finish"))
|
||||
|
||||
text = {"type": "string"}
|
||||
tools = [
|
||||
ToolSpec(
|
||||
"propose_lesson",
|
||||
"Propose one lesson for a group. A person reviews it before any agent "
|
||||
"sees it.",
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"group": text,
|
||||
"deliverable": {"type": "string", "enum": kinds},
|
||||
"title": text,
|
||||
"rule": text,
|
||||
"reason": text,
|
||||
},
|
||||
"required": ["group", "deliverable", "title", "rule", "reason"],
|
||||
},
|
||||
propose_lesson,
|
||||
tier="execution",
|
||||
),
|
||||
ToolSpec(
|
||||
"no_lesson",
|
||||
"Say that a group is not worth a lesson, and why.",
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {"group": text, "why": text},
|
||||
"required": ["group", "why"],
|
||||
},
|
||||
no_lesson,
|
||||
tier="execution",
|
||||
),
|
||||
ToolSpec(
|
||||
"finish",
|
||||
"End your turn once every group has a proposal or a reason for none.",
|
||||
{"type": "object", "properties": {}},
|
||||
finish,
|
||||
tier="execution",
|
||||
),
|
||||
]
|
||||
context: dict[str, Any] = {
|
||||
"executions": executions,
|
||||
"groups": [group.as_context() for group in fresh],
|
||||
"published_or_proposed": [
|
||||
{
|
||||
"id": p.id,
|
||||
"deliverable": p.deliverable,
|
||||
"rule": p.rule,
|
||||
"status": p.status,
|
||||
}
|
||||
for p in existing
|
||||
],
|
||||
}
|
||||
await runtime.run(
|
||||
role,
|
||||
AgentTask(
|
||||
role=role.name,
|
||||
prompt="Propose lessons from what recurred across these Executions.",
|
||||
context=context,
|
||||
),
|
||||
tools,
|
||||
)
|
||||
for group, why in declined.items():
|
||||
logger.info("no lesson for %s: %s", group, why)
|
||||
return proposed
|
||||
206
app/learning/evidence.py
Normal file
206
app/learning/evidence.py
Normal file
@@ -0,0 +1,206 @@
|
||||
"""Lesson candidates across Executions, grouped into what recurs."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from collections.abc import Iterable, Mapping, Sequence
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from app.tools.schema_review import named_settings
|
||||
|
||||
EXAMPLES = 3
|
||||
EXAMPLE_LIMIT = 400
|
||||
# Ids and numbers vary between Executions; what recurs is the shape around them.
|
||||
_VARIABLE = re.compile(r"`[^`]*`|\"[^\"]*\"|\b[A-Z]{1,4}-[\w.-]+\b|\b\d[\w.]*\b")
|
||||
# A refusal the Execution's own permissions caused is policy, not a mistake.
|
||||
_POLICY = ("Refused: reading live cloud resources", "Permission to read live cloud")
|
||||
|
||||
|
||||
@dataclass
|
||||
class Group:
|
||||
"""One thing that went wrong the same way in several Executions."""
|
||||
|
||||
key: str # stable across runs of the curator: the same evidence, the same key
|
||||
kind: str # refusal | revision | proposed_addition | failed_check | ...
|
||||
deliverable: str | None
|
||||
description: str # general: no id, name or value from any Execution
|
||||
executions: set[str] = field(default_factory=set)
|
||||
occurrences: int = 0
|
||||
examples: list[str] = field(default_factory=list) # client data: never published
|
||||
# The provider setting or resource type the problem was about, for a group
|
||||
# narrowed to one subject. None for a group of every problem of its kind.
|
||||
subject: str | None = None
|
||||
|
||||
def as_context(self) -> dict[str, Any]:
|
||||
return {
|
||||
"group": self.key,
|
||||
"kind": self.kind,
|
||||
"deliverable": self.deliverable,
|
||||
"what_happened": self.description,
|
||||
"executions": len(self.executions),
|
||||
"occurrences": self.occurrences,
|
||||
"examples": self.examples,
|
||||
}
|
||||
|
||||
|
||||
def read_candidates(roots: Iterable[Path]) -> list[dict[str, Any]]:
|
||||
"""Every Execution's lesson-candidate record under the given folders."""
|
||||
records = []
|
||||
seen: set[Path] = set()
|
||||
for root in roots:
|
||||
for path in sorted(Path(root).rglob("lessons/candidates/*/*.json")):
|
||||
# One folder may lie inside another that was also given.
|
||||
if path.resolve() in seen:
|
||||
continue
|
||||
seen.add(path.resolve())
|
||||
try:
|
||||
record = json.loads(path.read_text(encoding="utf-8"))
|
||||
except ValueError:
|
||||
continue
|
||||
if isinstance(record, dict) and isinstance(record.get("candidates"), list):
|
||||
records.append(record)
|
||||
return records
|
||||
|
||||
|
||||
# A subject shorter than this is a stray word, not a setting.
|
||||
_SUBJECT_MIN = 4
|
||||
|
||||
|
||||
def _general(text: str, limit: int = 110) -> str:
|
||||
return " ".join(_VARIABLE.sub("…", text).split())[:limit]
|
||||
|
||||
|
||||
def _shape(candidate: Mapping[str, Any]) -> tuple[str, str | None, str] | None:
|
||||
"""(kind, Deliverable, general description) of a candidate, or None to ignore it."""
|
||||
kind = str(candidate.get("type"))
|
||||
deliverable = candidate.get("deliverable")
|
||||
if kind == "refusal":
|
||||
message = str(candidate.get("message", ""))
|
||||
if message.strip() == "Refused" or message.startswith(_POLICY):
|
||||
return None
|
||||
tool = candidate.get("tool")
|
||||
return kind, deliverable, f"{tool} refused: {_general(message)}"
|
||||
if kind in ("revision", "revision_limit"):
|
||||
reason = str(candidate.get("reason", ""))
|
||||
if reason.startswith("Q: ") or "revision limit" in reason:
|
||||
return None # the router's own questions, recorded as reasons
|
||||
if reason.startswith("Add a Check"):
|
||||
why = "validation proposed a Check the design lacked"
|
||||
elif "cannot be implemented" in reason:
|
||||
why = "a Check named something its resource cannot do"
|
||||
elif " failed" in reason[:60]:
|
||||
why = "the code failed a Check"
|
||||
else:
|
||||
why = _general(reason, 70)
|
||||
return "revision", deliverable, f"revised because {why}"
|
||||
if kind == "proposed_addition":
|
||||
return (
|
||||
kind,
|
||||
"target_architecture",
|
||||
"validation proposed a Check the design lacked",
|
||||
)
|
||||
if kind in ("failed_check", "unverifiable_check"):
|
||||
what = "failed" if kind == "failed_check" else "could not be verified"
|
||||
return kind, "deployment_guidance", f"a Check {what} at validation"
|
||||
if kind == "unfinished":
|
||||
return kind, deliverable, f"the Specialist {candidate.get('reason')}"
|
||||
if kind == "change_request":
|
||||
return kind, None, "the user asked for changes at an Approval"
|
||||
return None
|
||||
|
||||
|
||||
def _subjects(candidate: Mapping[str, Any]) -> tuple[str, list[str]] | None:
|
||||
"""For a problem about what a Check says: (how to describe it, the settings and
|
||||
resource types its text names).
|
||||
|
||||
Problems of one kind are one group, and one group gets one lesson. "Validation
|
||||
proposed a Check" was 20 of 32 Executions and a single lesson; what recurred
|
||||
inside it, such as the same setting missed again and again, was invisible. A
|
||||
setting's name is the provider's vocabulary, not a client's, so it can be the
|
||||
subject of a narrower group.
|
||||
"""
|
||||
kind = str(candidate.get("type"))
|
||||
if kind == "proposed_addition":
|
||||
text = str(candidate.get("statement", ""))
|
||||
what = "validation proposed a Check about `{}` that the design lacked"
|
||||
elif kind == "revision" and "cannot be implemented" in str(
|
||||
candidate.get("reason", "")
|
||||
):
|
||||
text = str(candidate.get("reason", ""))
|
||||
what = "a Check about `{}` asked for something that resource cannot do"
|
||||
else:
|
||||
return None
|
||||
names = {name.split(".")[-1] for name in named_settings(text)}
|
||||
return what, sorted(name for name in names if len(name) >= _SUBJECT_MIN)
|
||||
|
||||
|
||||
def group_candidates(
|
||||
records: Sequence[Mapping[str, Any]], *, min_executions: int = 2
|
||||
) -> list[Group]:
|
||||
"""What recurred in at least `min_executions` Executions, most widespread first."""
|
||||
groups: dict[str, Group] = {}
|
||||
for record in records:
|
||||
execution = str(record.get("execution_id"))
|
||||
for candidate in record.get("candidates", ()):
|
||||
if not isinstance(candidate, Mapping):
|
||||
continue
|
||||
shape = _shape(candidate)
|
||||
if shape is None:
|
||||
continue
|
||||
kind, deliverable, description = shape
|
||||
key = hashlib.sha256(
|
||||
f"{kind}|{deliverable}|{description}".encode()
|
||||
).hexdigest()[:10]
|
||||
group = groups.setdefault(key, Group(key, kind, deliverable, description))
|
||||
group.executions.add(execution)
|
||||
group.occurrences += 1
|
||||
example = str(
|
||||
candidate.get("message")
|
||||
or candidate.get("reason")
|
||||
or candidate.get("statement")
|
||||
or candidate.get("evidence")
|
||||
or candidate.get("feedback")
|
||||
or ""
|
||||
)[:EXAMPLE_LIMIT]
|
||||
if (
|
||||
example
|
||||
and example not in group.examples
|
||||
and len(group.examples) < EXAMPLES
|
||||
):
|
||||
group.examples.append(example)
|
||||
narrowed = _subjects(candidate)
|
||||
for subject in narrowed[1] if narrowed else ():
|
||||
about = narrowed[0].format(subject) # type: ignore[index]
|
||||
subkey = hashlib.sha256(
|
||||
f"{kind}|{deliverable}|{about}".encode()
|
||||
).hexdigest()[:10]
|
||||
narrow = groups.setdefault(
|
||||
subkey, Group(subkey, kind, deliverable, about, subject=subject)
|
||||
)
|
||||
narrow.executions.add(execution)
|
||||
narrow.occurrences += 1
|
||||
if (
|
||||
example
|
||||
and example not in narrow.examples
|
||||
and len(narrow.examples) < EXAMPLES
|
||||
):
|
||||
narrow.examples.append(example)
|
||||
return sorted(
|
||||
(g for g in groups.values() if len(g.executions) >= min_executions),
|
||||
key=lambda g: (-len(g.executions), -g.occurrences, g.key),
|
||||
)
|
||||
|
||||
|
||||
def identifiers(records: Sequence[Mapping[str, Any]]) -> set[str]:
|
||||
"""Names that identify a client or an Execution, which no lesson may carry."""
|
||||
found = set()
|
||||
for record in records:
|
||||
for name in ("execution_id", "customer_case"):
|
||||
value = record.get(name)
|
||||
if isinstance(value, str) and len(value) >= 4 and value != "unassigned":
|
||||
found.add(value)
|
||||
return found
|
||||
117
app/learning/proof.py
Normal file
117
app/learning/proof.py
Normal file
@@ -0,0 +1,117 @@
|
||||
"""Proving lessons: the evaluation with them against the evaluation without (ADR-0004).
|
||||
|
||||
A lesson is kept only if quality holds and Revisions, time or tokens fall. Both runs
|
||||
are ordinary evaluation reports; one is made with LESSONS_ENABLED=false.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from collections.abc import Collection, Mapping, Sequence
|
||||
from dataclasses import replace
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from app.learning.proposals import Proposal, write
|
||||
|
||||
METRICS = ("score", "revisions", "seconds", "tokens")
|
||||
_CAVEAT = (
|
||||
"This compares every published lesson together, on one run each way. Runs of "
|
||||
"the same case vary, so one pair suggests a direction and does not settle it."
|
||||
)
|
||||
|
||||
|
||||
def _measures(report: Sequence[Mapping[str, Any]]) -> dict[str, dict[str, float]]:
|
||||
cases = {}
|
||||
for item in report:
|
||||
details = item.get("details") or {}
|
||||
tokens = ((details.get("tokens") or {}).get("total") or {}).get("total") or 0
|
||||
cases[str(item.get("case_id"))] = {
|
||||
"score": float(item.get("score") or 0),
|
||||
"revisions": float(sum((details.get("revisions") or {}).values())),
|
||||
"seconds": float(details.get("seconds") or 0),
|
||||
"tokens": float(tokens),
|
||||
}
|
||||
return cases
|
||||
|
||||
|
||||
def compare(without: Path, with_lessons: Path) -> dict[str, Any]:
|
||||
"""The two reports side by side, for the cases both ran, and whether the
|
||||
lessons helped: no case scored lower, and Revisions, time or tokens fell."""
|
||||
before = _measures(json.loads(without.read_text(encoding="utf-8")))
|
||||
after = _measures(json.loads(with_lessons.read_text(encoding="utf-8")))
|
||||
cases = sorted(set(before) & set(after))
|
||||
totals = {
|
||||
metric: (
|
||||
sum(before[case][metric] for case in cases),
|
||||
sum(after[case][metric] for case in cases),
|
||||
)
|
||||
for metric in METRICS
|
||||
}
|
||||
quality_holds = bool(cases) and all(
|
||||
after[case]["score"] >= before[case]["score"] for case in cases
|
||||
)
|
||||
lower = [
|
||||
metric
|
||||
for metric in ("revisions", "seconds", "tokens")
|
||||
if totals[metric][1] < totals[metric][0]
|
||||
]
|
||||
return {
|
||||
"cases": {
|
||||
case: {"without": before[case], "with": after[case]} for case in cases
|
||||
},
|
||||
"totals": {
|
||||
metric: {"without": a, "with": b} for metric, (a, b) in totals.items()
|
||||
},
|
||||
"quality_holds": quality_holds,
|
||||
"lower": lower,
|
||||
"helps": quality_holds and bool(lower),
|
||||
}
|
||||
|
||||
|
||||
def render(result: Mapping[str, Any], without: Path, with_lessons: Path) -> str:
|
||||
"""The comparison as the text of a proposal's Proof section."""
|
||||
header = (
|
||||
f"Evaluation without lessons: `{without.parent.name}`; with: "
|
||||
f"`{with_lessons.parent.name}`."
|
||||
)
|
||||
lines = [
|
||||
header,
|
||||
"",
|
||||
"| Case | Score | Revisions | Minutes | Tokens (M) |",
|
||||
"| --- | --- | --- | --- | --- |",
|
||||
]
|
||||
for case, pair in result["cases"].items():
|
||||
a, b = pair["without"], pair["with"]
|
||||
lines.append(
|
||||
f"| {case} | {a['score']:.2f} → {b['score']:.2f} | "
|
||||
f"{a['revisions']:.0f} → {b['revisions']:.0f} | "
|
||||
f"{a['seconds'] / 60:.0f} → {b['seconds'] / 60:.0f} | "
|
||||
f"{a['tokens'] / 1e6:.2f} → {b['tokens'] / 1e6:.2f} |"
|
||||
)
|
||||
if not result["cases"]:
|
||||
verdict = "The two runs share no case, so nothing is shown."
|
||||
elif result["helps"]:
|
||||
verdict = f"Quality held and {', '.join(result['lower'])} fell: kept."
|
||||
elif not result["quality_holds"]:
|
||||
verdict = "A case scored lower with the lessons: not shown to help."
|
||||
else:
|
||||
verdict = "Quality held, and nothing fell: not shown to help."
|
||||
lines += [
|
||||
"",
|
||||
verdict,
|
||||
"",
|
||||
_CAVEAT,
|
||||
]
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def record(
|
||||
proposals: Sequence[Proposal], proof: str, live: Collection[str]
|
||||
) -> list[Proposal]:
|
||||
"""Write the comparison into the proposal of every lesson in the Skill.
|
||||
|
||||
`live` is the ids the Skill holds now. A retired lesson was not part of what
|
||||
was compared, so its proposal is left as it was.
|
||||
"""
|
||||
return [write(replace(p, proof=proof)) for p in proposals if p.id in live]
|
||||
173
app/learning/proposals.py
Normal file
173
app/learning/proposals.py
Normal file
@@ -0,0 +1,173 @@
|
||||
"""Lesson proposals as issue files: where a person reviews each one.
|
||||
|
||||
.scratch/lessons/issues/NN-<slug>.md
|
||||
|
||||
A proposal starts as `needs-triage`. A person approves it by setting its Status to
|
||||
`ready-for-agent`, or rejects it with `wontfix`. Only an approved proposal can be
|
||||
published. The file carries the rule, its reason and how widespread the evidence
|
||||
was, and nothing that identifies a client or an Execution.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from dataclasses import dataclass, replace
|
||||
from datetime import UTC, date, datetime
|
||||
from pathlib import Path
|
||||
|
||||
NEEDS_TRIAGE = "needs-triage"
|
||||
APPROVED = "ready-for-agent"
|
||||
REJECTED = "wontfix"
|
||||
STATUSES = (NEEDS_TRIAGE, "needs-info", APPROVED, "ready-for-human", REJECTED)
|
||||
ISSUES = Path(".scratch") / "lessons" / "issues"
|
||||
|
||||
_FIELD = re.compile(r"^([A-Z][\w-]*):\s*(.*)$", re.MULTILINE)
|
||||
_SECTION = re.compile(r"^## (.+?)\s*$", re.MULTILINE)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Proposal:
|
||||
number: int
|
||||
title: str
|
||||
deliverable: str
|
||||
rule: str
|
||||
reason: str
|
||||
evidence: str # counts and a general description
|
||||
evidence_key: str
|
||||
status: str = NEEDS_TRIAGE
|
||||
proposed: str = ""
|
||||
published: str = ""
|
||||
# The day it was taken out of the Skill again. A retired lesson is not
|
||||
# published a second time, whatever its Status still says.
|
||||
retired: str = ""
|
||||
proof: str = ""
|
||||
comments: str = ""
|
||||
path: Path | None = None
|
||||
|
||||
@property
|
||||
def id(self) -> str:
|
||||
return f"L-{self.number:02d}"
|
||||
|
||||
@property
|
||||
def approved(self) -> bool:
|
||||
return self.status == APPROVED and not self.retired
|
||||
|
||||
|
||||
def _slug(title: str) -> str:
|
||||
return re.sub(r"[^a-z0-9]+", "-", title.lower()).strip("-")[:60] or "lesson"
|
||||
|
||||
|
||||
def render(proposal: Proposal) -> str:
|
||||
lines = [
|
||||
f"# {proposal.id}: {proposal.title}",
|
||||
"",
|
||||
f"Status: {proposal.status}",
|
||||
f"Deliverable: {proposal.deliverable}",
|
||||
f"Evidence-key: {proposal.evidence_key}",
|
||||
f"Proposed: {proposal.proposed}",
|
||||
]
|
||||
if proposal.published:
|
||||
lines.append(f"Published: {proposal.published}")
|
||||
if proposal.retired:
|
||||
lines.append(f"Retired: {proposal.retired}")
|
||||
lines += [
|
||||
"",
|
||||
"## Rule",
|
||||
"",
|
||||
proposal.rule.strip(),
|
||||
"",
|
||||
"## Why",
|
||||
"",
|
||||
proposal.reason.strip(),
|
||||
"",
|
||||
"## Evidence",
|
||||
"",
|
||||
proposal.evidence.strip(),
|
||||
"",
|
||||
"## Proof",
|
||||
"",
|
||||
proposal.proof.strip() or "Not yet measured.",
|
||||
"",
|
||||
"## Comments",
|
||||
"",
|
||||
proposal.comments.strip(),
|
||||
]
|
||||
return "\n".join(lines).rstrip() + "\n"
|
||||
|
||||
|
||||
def parse(path: Path) -> Proposal:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
heading = re.match(r"# L-(\d+): (.+)", text)
|
||||
if not heading:
|
||||
raise ValueError(f"{path}: not a lesson proposal")
|
||||
head = text.split("\n## ", 1)[0]
|
||||
fields = {name: value.strip() for name, value in _FIELD.findall(head)}
|
||||
sections: dict[str, str] = {}
|
||||
matches = list(_SECTION.finditer(text))
|
||||
for index, match in enumerate(matches):
|
||||
end = matches[index + 1].start() if index + 1 < len(matches) else len(text)
|
||||
sections[match.group(1)] = text[match.end() : end].strip()
|
||||
status = fields.get("Status", NEEDS_TRIAGE)
|
||||
if status not in STATUSES:
|
||||
raise ValueError(f"{path}: Status must be one of {', '.join(STATUSES)}")
|
||||
proof = sections.get("Proof", "")
|
||||
return Proposal(
|
||||
number=int(heading.group(1)),
|
||||
title=heading.group(2).strip(),
|
||||
deliverable=fields.get("Deliverable", ""),
|
||||
rule=sections.get("Rule", ""),
|
||||
reason=sections.get("Why", ""),
|
||||
evidence=sections.get("Evidence", ""),
|
||||
evidence_key=fields.get("Evidence-key", ""),
|
||||
status=status,
|
||||
proposed=fields.get("Proposed", ""),
|
||||
published=fields.get("Published", ""),
|
||||
retired=fields.get("Retired", ""),
|
||||
proof="" if proof == "Not yet measured." else proof,
|
||||
comments=sections.get("Comments", ""),
|
||||
path=path,
|
||||
)
|
||||
|
||||
|
||||
def load(folder: Path = ISSUES) -> list[Proposal]:
|
||||
if not folder.is_dir():
|
||||
return []
|
||||
return sorted(
|
||||
(parse(path) for path in folder.glob("[0-9]*-*.md")), key=lambda p: p.number
|
||||
)
|
||||
|
||||
|
||||
def write(proposal: Proposal, folder: Path = ISSUES) -> Proposal:
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
path = proposal.path or folder / f"{proposal.number:02d}-{_slug(proposal.title)}.md"
|
||||
path.write_text(render(proposal), encoding="utf-8")
|
||||
return replace(proposal, path=path)
|
||||
|
||||
|
||||
def propose(
|
||||
*,
|
||||
title: str,
|
||||
deliverable: str,
|
||||
rule: str,
|
||||
reason: str,
|
||||
evidence: str,
|
||||
evidence_key: str,
|
||||
folder: Path = ISSUES,
|
||||
today: date | None = None,
|
||||
) -> Proposal:
|
||||
"""A new proposal, numbered after the last, awaiting a person's decision."""
|
||||
existing = load(folder)
|
||||
number = max((p.number for p in existing), default=0) + 1
|
||||
return write(
|
||||
Proposal(
|
||||
number=number,
|
||||
title=title.strip(),
|
||||
deliverable=deliverable,
|
||||
rule=rule,
|
||||
reason=reason,
|
||||
evidence=evidence,
|
||||
evidence_key=evidence_key,
|
||||
proposed=(today or datetime.now(UTC).date()).isoformat(),
|
||||
),
|
||||
folder,
|
||||
)
|
||||
185
app/learning/skill.py
Normal file
185
app/learning/skill.py
Normal file
@@ -0,0 +1,185 @@
|
||||
"""The lessons Skill: where approved lessons are published, and retired from.
|
||||
|
||||
A lessons Skill is an ordinary Agent Skill, per Cloud provider, that the provider
|
||||
bundle names. It has one reference file per Deliverable that has lessons, so a
|
||||
Specialist reads only the lessons for its own work. Both the reference files and
|
||||
the index in SKILL.md are written here, from approved proposals, and never by hand.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import replace
|
||||
from datetime import UTC, date, datetime
|
||||
from pathlib import Path
|
||||
|
||||
from app.learning.proposals import Proposal, write
|
||||
|
||||
REFERENCES = "references"
|
||||
_INDEX = re.compile(r"<!-- lessons:begin -->.*<!-- lessons:end -->", re.DOTALL)
|
||||
_ENTRY = re.compile(r"^## (L-\d+): .*?(?=^## L-\d+: |\Z)", re.MULTILINE | re.DOTALL)
|
||||
|
||||
|
||||
class NotApproved(ValueError):
|
||||
"""A lesson cannot be published: no person has approved its proposal."""
|
||||
|
||||
|
||||
def reference(skill_dir: Path, deliverable: str) -> Path:
|
||||
return skill_dir / REFERENCES / f"{deliverable}.md"
|
||||
|
||||
|
||||
def deliverables_with_lessons(skill_dir: Path) -> list[str]:
|
||||
folder = skill_dir / REFERENCES
|
||||
if not folder.is_dir():
|
||||
return []
|
||||
return sorted(
|
||||
path.stem
|
||||
for path in folder.glob("*.md")
|
||||
if _ENTRY.search(path.read_text(encoding="utf-8"))
|
||||
)
|
||||
|
||||
|
||||
def published(skill_dir: Path) -> dict[str, str]:
|
||||
"""Lesson id -> the Deliverable whose reference holds it."""
|
||||
found = {}
|
||||
for deliverable in deliverables_with_lessons(skill_dir):
|
||||
text = reference(skill_dir, deliverable).read_text(encoding="utf-8")
|
||||
for match in _ENTRY.finditer(text):
|
||||
found[match.group(1)] = deliverable
|
||||
return found
|
||||
|
||||
|
||||
def _entry(proposal: Proposal, today: str) -> str:
|
||||
return (
|
||||
f"## {proposal.id}: {proposal.title}\n\n"
|
||||
f"**Rule.** {' '.join(proposal.rule.split())}\n\n"
|
||||
f"**Why.** {' '.join(proposal.reason.split())}\n\n"
|
||||
f"Published {today}, from lesson proposal {proposal.number:02d}.\n"
|
||||
)
|
||||
|
||||
|
||||
def _write_reference(skill_dir: Path, deliverable: str, entries: list[str]) -> None:
|
||||
path = reference(skill_dir, deliverable)
|
||||
if not entries:
|
||||
path.unlink(missing_ok=True)
|
||||
return
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
title = deliverable.replace("_", " ")
|
||||
path.write_text(
|
||||
f"# Lessons: {title}\n\n"
|
||||
"Rules learned from earlier work. Follow every one that applies.\n\n"
|
||||
+ "\n".join(entries),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
def _entries(skill_dir: Path, deliverable: str) -> dict[str, str]:
|
||||
path = reference(skill_dir, deliverable)
|
||||
if not path.is_file():
|
||||
return {}
|
||||
text = path.read_text(encoding="utf-8")
|
||||
return {m.group(1): m.group(0).rstrip() + "\n" for m in _ENTRY.finditer(text)}
|
||||
|
||||
|
||||
def _reindex(skill_dir: Path) -> None:
|
||||
"""Rewrite the list of references in SKILL.md from the files that exist."""
|
||||
skill = skill_dir / "SKILL.md"
|
||||
rows = [
|
||||
f"| {name.replace('_', ' ')} | `{REFERENCES}/{name}.md` | "
|
||||
f"{len(_entries(skill_dir, name))} |"
|
||||
for name in deliverables_with_lessons(skill_dir)
|
||||
]
|
||||
table = (
|
||||
"| Deliverable | Reference | Lessons |\n| --- | --- | --- |\n" + "\n".join(rows)
|
||||
if rows
|
||||
else "No lessons have been published yet."
|
||||
)
|
||||
text = skill.read_text(encoding="utf-8")
|
||||
skill.write_text(
|
||||
_INDEX.sub(f"<!-- lessons:begin -->\n{table}\n<!-- lessons:end -->", text),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
def publish(
|
||||
proposal: Proposal, skill_dir: Path, *, today: date | None = None
|
||||
) -> Proposal:
|
||||
"""Write an approved lesson into the Skill and mark its proposal published.
|
||||
|
||||
Raises NotApproved for any proposal a person has not approved: nothing reaches
|
||||
an agent on a curator's say-so.
|
||||
"""
|
||||
if proposal.retired:
|
||||
raise NotApproved(f"{proposal.id} was retired on {proposal.retired}")
|
||||
if not proposal.approved:
|
||||
raise NotApproved(
|
||||
f"{proposal.id} is {proposal.status}; a person approves a lesson by "
|
||||
"setting its Status to ready-for-agent"
|
||||
)
|
||||
if not proposal.deliverable or not proposal.rule.strip():
|
||||
raise NotApproved(f"{proposal.id} has no Deliverable or no rule")
|
||||
stamp = (today or datetime.now(UTC).date()).isoformat()
|
||||
for deliverable in deliverables_with_lessons(skill_dir):
|
||||
if deliverable != proposal.deliverable:
|
||||
entries = _entries(skill_dir, deliverable)
|
||||
if entries.pop(proposal.id, None): # it moved to another Deliverable
|
||||
_write_reference(skill_dir, deliverable, list(entries.values()))
|
||||
entries = _entries(skill_dir, proposal.deliverable)
|
||||
entries[proposal.id] = _entry(proposal, stamp)
|
||||
ordered = [entries[key] for key in sorted(entries)]
|
||||
_write_reference(skill_dir, proposal.deliverable, ordered)
|
||||
_reindex(skill_dir)
|
||||
return write(replace(proposal, published=proposal.published or stamp))
|
||||
|
||||
|
||||
# The versions of the Skills the lessons were written beside, kept in the lessons
|
||||
# Skill. A lesson is a correction to how agents follow those Skills, so when one
|
||||
# of them changes each lesson is worth a second look: it may now be said upstream,
|
||||
# or contradict it.
|
||||
UPSTREAM_FILE = "upstream.json"
|
||||
|
||||
|
||||
def upstream_reviewed(skill_dir: Path) -> dict[str, str]:
|
||||
"""The upstream Skill versions the lessons were last reviewed against."""
|
||||
path = skill_dir / UPSTREAM_FILE
|
||||
if not path.is_file():
|
||||
return {}
|
||||
try:
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
except ValueError:
|
||||
return {}
|
||||
return {str(k): str(v) for k, v in data.items()} if isinstance(data, dict) else {}
|
||||
|
||||
|
||||
def mark_reviewed(skill_dir: Path, current: Mapping[str, str]) -> None:
|
||||
"""Record that the lessons stand against these upstream Skill versions."""
|
||||
(skill_dir / UPSTREAM_FILE).write_text(
|
||||
json.dumps(dict(sorted(current.items())), indent=2) + "\n", encoding="utf-8"
|
||||
)
|
||||
|
||||
|
||||
def upstream_changes(skill_dir: Path, current: Mapping[str, str]) -> list[str]:
|
||||
"""The upstream Skills that changed, appeared or went since the lessons were
|
||||
last reviewed. Empty when there are no lessons, or nothing was ever recorded."""
|
||||
reviewed = upstream_reviewed(skill_dir)
|
||||
if not reviewed or not published(skill_dir):
|
||||
return []
|
||||
return sorted(
|
||||
name
|
||||
for name in set(reviewed) | set(current)
|
||||
if reviewed.get(name) != current.get(name)
|
||||
)
|
||||
|
||||
|
||||
def retire(lesson_id: str, skill_dir: Path) -> bool:
|
||||
"""Remove a lesson from the Skill. Returns whether it was there."""
|
||||
deliverable = published(skill_dir).get(lesson_id)
|
||||
if deliverable is None:
|
||||
return False
|
||||
entries = _entries(skill_dir, deliverable)
|
||||
entries.pop(lesson_id)
|
||||
_write_reference(skill_dir, deliverable, [entries[key] for key in sorted(entries)])
|
||||
_reindex(skill_dir)
|
||||
return True
|
||||
14
app/main.py
14
app/main.py
@@ -62,13 +62,19 @@ def create_app(
|
||||
except ValueError:
|
||||
body = {}
|
||||
workflow_request = str(body.get("request") or "").strip()
|
||||
if not workflow_request:
|
||||
return JSONResponse({"error": "'request' is required"}, status_code=400)
|
||||
if not workflow_request and not body.get("scope"):
|
||||
return JSONResponse(
|
||||
{"error": "'request' or a 'scope' spec is required"}, status_code=400
|
||||
)
|
||||
try:
|
||||
interaction = await assembly.engine.start(
|
||||
workflow_request,
|
||||
session_id=body.get("session_id"),
|
||||
customer_case=body.get("customer_case"),
|
||||
baseline=body.get("baseline"),
|
||||
overlay_skills=body.get("overlay_skills") or (),
|
||||
terraform_modules=body.get("terraform_modules"),
|
||||
scope=body.get("scope"),
|
||||
pre_approved=True,
|
||||
allow_cloud_read=bool(body.get("allow_cloud_read", False)),
|
||||
)
|
||||
@@ -85,7 +91,9 @@ def create_app(
|
||||
async def lifespan(app: Starlette) -> AsyncIterator[None]:
|
||||
async with assembly_factory(settings) as assembly:
|
||||
handler = DefaultRequestHandlerV2(
|
||||
agent_executor=SolutionArchitectExecutor(assembly.engine),
|
||||
agent_executor=SolutionArchitectExecutor(
|
||||
assembly.engine, assembly.intake, assembly.answers
|
||||
),
|
||||
task_store=InMemoryTaskStore(),
|
||||
agent_card=card,
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
259
app/nodes/intake.py
Normal file
259
app/nodes/intake.py
Normal file
@@ -0,0 +1,259 @@
|
||||
"""Intake: what a message that starts something is asking for (ADR-0007).
|
||||
|
||||
Inside an Execution the router reads the user's replies. This is the same reading
|
||||
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 name the Baseline to change (ADR-0006)
|
||||
question what can you do, how long... answer; start nothing
|
||||
why did you choose X? answer from what was delivered
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from collections.abc import Mapping, Sequence
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from app.adk.runtime import (
|
||||
AgentRuntime,
|
||||
AgentTask,
|
||||
Decider,
|
||||
Question,
|
||||
RoleSpec,
|
||||
Submitted,
|
||||
ToolResult,
|
||||
ToolSpec,
|
||||
)
|
||||
from app.baseline import BaselineError, load_baseline
|
||||
from app.customer_case import IN_PROGRESS, read_history
|
||||
from app.states.execution_state import UNASSIGNED_CASE
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
NEW_REQUEST = "new_request"
|
||||
CHANGE_REQUEST = "change_request"
|
||||
QUESTION = "question"
|
||||
|
||||
ABOUT = (
|
||||
"I design cloud solution architectures. Tell me, at a high level, what you want "
|
||||
"built, and I will work through requirements, a target architecture, "
|
||||
"infrastructure code, validation and a packaged guide, asking for your approval "
|
||||
"at each Phase. Nothing was started for this message."
|
||||
)
|
||||
|
||||
|
||||
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.'
|
||||
)
|
||||
|
||||
|
||||
def no_answer_note(execution_id: str) -> str:
|
||||
"""What a caller is told when a question about delivered work went unanswered."""
|
||||
return (
|
||||
"I could not answer that from the documents delivered in Execution "
|
||||
f"{execution_id}. Its solution guide and Deliverables hold what was "
|
||||
"decided and why. Nothing was started for this message."
|
||||
)
|
||||
|
||||
|
||||
_MESSAGE_LIMIT = 8_000
|
||||
# How much of the delivered guide the answer is written from.
|
||||
_GUIDE_LIMIT = 80_000
|
||||
_EARLIER_SHOWN = 5
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class IntakeReading:
|
||||
kind: str # new_request | change_request | question
|
||||
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
|
||||
# A question about what was delivered, as opposed to about the service.
|
||||
about_delivered: bool = False
|
||||
|
||||
|
||||
def finished_intents(output_root: Path, customer_case: str) -> list[Mapping[str, Any]]:
|
||||
"""The case's earlier statements of intent whose Executions delivered something."""
|
||||
if not customer_case or customer_case == UNASSIGNED_CASE:
|
||||
return []
|
||||
return [
|
||||
item
|
||||
for item in read_history(output_root, customer_case)["intents"]
|
||||
if isinstance(item, Mapping)
|
||||
and str(item.get("status", IN_PROGRESS)).startswith("completed")
|
||||
]
|
||||
|
||||
|
||||
class Intake:
|
||||
def __init__(
|
||||
self,
|
||||
decider: Decider,
|
||||
output_root: Path,
|
||||
*,
|
||||
act: float = 0.75,
|
||||
about_delivered_at: float = 0.6,
|
||||
) -> None:
|
||||
self._decider = decider
|
||||
self._output_root = output_root
|
||||
# How sure the reading must be before anything but a new Execution is done.
|
||||
self._act = act
|
||||
# How likely a question must be about delivered work to be answered from
|
||||
# it. Measured on 2026-10-10: six such questions scored 0.37 to 0.96, five
|
||||
# of them 0.73 or more; six about the service scored 0.07 to 0.16 and one
|
||||
# ambiguous one ("is my data stored anywhere?") 0.74. A wrong yes costs an
|
||||
# answer that says the documents do not cover it.
|
||||
self._about_delivered_at = about_delivered_at
|
||||
|
||||
async def read(
|
||||
self, message: str, customer_case: str | None = None, scope: str = ""
|
||||
) -> IntakeReading:
|
||||
earlier = finished_intents(self._output_root, customer_case or "")
|
||||
text = message.strip()
|
||||
if not text:
|
||||
return IntakeReading(NEW_REQUEST, earlier=len(earlier))
|
||||
answers = await self._decider.decide(
|
||||
_state(text, earlier),
|
||||
{
|
||||
"intake": Question(
|
||||
"choice",
|
||||
"What is the user's message? new_request: they describe "
|
||||
"something they want designed or built. change_request: they "
|
||||
"ask to change or extend an architecture already delivered to "
|
||||
"them. question: they ask about the service or about earlier "
|
||||
"work, and want an answer, not new work.",
|
||||
(NEW_REQUEST, CHANGE_REQUEST, QUESTION),
|
||||
)
|
||||
},
|
||||
scope=scope,
|
||||
)
|
||||
answer = (answers or {}).get("intake")
|
||||
if answer is None:
|
||||
return IntakeReading(NEW_REQUEST, earlier=len(earlier))
|
||||
kind, confidence = str(answer.value), float(answer.confidence)
|
||||
if kind != NEW_REQUEST and confidence < self._act:
|
||||
kind = NEW_REQUEST # not sure enough to do anything but start
|
||||
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)
|
||||
latest = str(earlier[-1].get("execution_id")) if earlier else None
|
||||
about = (
|
||||
await self._about_delivered(text, earlier, scope)
|
||||
if kind == QUESTION and latest
|
||||
else False
|
||||
)
|
||||
return IntakeReading(
|
||||
kind,
|
||||
confidence,
|
||||
judged=True,
|
||||
earlier=len(earlier),
|
||||
latest=latest,
|
||||
about_delivered=about,
|
||||
)
|
||||
|
||||
async def _about_delivered(
|
||||
self, text: str, earlier: Sequence[Mapping[str, Any]], scope: str
|
||||
) -> bool:
|
||||
answers = await self._decider.decide(
|
||||
_state(text, earlier),
|
||||
{
|
||||
"about_delivered": Question(
|
||||
"noul",
|
||||
"Is the user asking about an architecture already delivered to "
|
||||
"them: what it contains, why something was chosen, or what "
|
||||
"validation found? Answer no when they ask what this service "
|
||||
"does or how it works in general.",
|
||||
)
|
||||
},
|
||||
scope=scope,
|
||||
)
|
||||
answer = (answers or {}).get("about_delivered")
|
||||
return answer is not None and float(answer.value) >= self._about_delivered_at
|
||||
|
||||
|
||||
def _state(message: str, earlier: Sequence[Mapping[str, Any]]) -> str:
|
||||
lines = [f"Architectures already delivered to this user: {len(earlier)}."]
|
||||
for item in list(earlier)[-_EARLIER_SHOWN:]:
|
||||
request = " ".join(str(item.get("workflow_request", "")).split())[:300]
|
||||
lines.append(f"- {request}")
|
||||
lines.append(f"The user's message: {message[:_MESSAGE_LIMIT]}")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
class DeliveredAnswers:
|
||||
"""Answers a question about delivered work from its documents, on the reply
|
||||
writer. It reads one Execution's files and starts nothing."""
|
||||
|
||||
def __init__(
|
||||
self, runtime: AgentRuntime, role: RoleSpec, output_root: Path
|
||||
) -> None:
|
||||
self._runtime = runtime
|
||||
self._role = role
|
||||
self._output_root = output_root
|
||||
|
||||
async def answer(
|
||||
self, question: str, customer_case: str, execution_id: str
|
||||
) -> str | None:
|
||||
"""The answer, or None when the documents could not be read or the writer
|
||||
gave none."""
|
||||
try:
|
||||
delivered = load_baseline(self._output_root, customer_case, execution_id)
|
||||
except BaselineError:
|
||||
return None
|
||||
guide = str(
|
||||
(delivered["deliverables"].get("solution_guide") or {}).get("content", "")
|
||||
)
|
||||
if not guide.strip():
|
||||
return None
|
||||
|
||||
async def write_reply(text: str) -> ToolResult:
|
||||
if not text.strip():
|
||||
return ToolResult("Not submitted: the reply is empty.")
|
||||
return ToolResult("Written.", Submitted(text))
|
||||
|
||||
tool = ToolSpec(
|
||||
"write_reply",
|
||||
"Give the text the user will read. Ends your turn.",
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {"text": {"type": "string"}},
|
||||
"required": ["text"],
|
||||
},
|
||||
write_reply,
|
||||
tier="execution",
|
||||
)
|
||||
task = AgentTask(
|
||||
role=self._role.name,
|
||||
prompt="Answer the user's question about the architecture delivered to them.",
|
||||
context={
|
||||
"question": question[:_MESSAGE_LIMIT],
|
||||
"delivered": {
|
||||
"execution_id": execution_id,
|
||||
"request": delivered.get("workflow_request", ""),
|
||||
"solution_guide": guide[:_GUIDE_LIMIT],
|
||||
},
|
||||
},
|
||||
)
|
||||
try:
|
||||
outcome = await self._runtime.run(self._role, task, [tool])
|
||||
except Exception: # a question must still get a reply
|
||||
logger.exception("Answering from delivered work failed")
|
||||
return None
|
||||
return outcome.content if isinstance(outcome, Submitted) else None
|
||||
@@ -14,6 +14,7 @@ tools, so the Ledger refuses anything that is not allowed, whatever was decided.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from collections.abc import Awaitable, Callable, Mapping, Sequence
|
||||
@@ -37,6 +38,7 @@ from app.workflows.chain import (
|
||||
IMPLEMENTATION_FILE,
|
||||
RECOMMENDATIONS_FILE,
|
||||
REQUIREMENTS_FILE,
|
||||
SCOPE_DATA_FILE,
|
||||
VERDICTS_FILE,
|
||||
read_graph,
|
||||
read_list,
|
||||
@@ -44,6 +46,7 @@ from app.workflows.chain import (
|
||||
validation_outcome,
|
||||
)
|
||||
from app.workflows.deliverables import DEPENDENCY_GRAPH, DeliverableKind, PhaseId
|
||||
from app.workflows.work_breakdown import summary as plan_summary
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -84,6 +87,10 @@ class TurnView:
|
||||
pending_change: Mapping[str, Any] | None = None # a change we asked them to confirm
|
||||
awaiting_gap_decision: bool = False
|
||||
validation_settled: int = 0 # the validation attempt already decided on
|
||||
# The user's reply answers "this Deliverable reached its Revision limit".
|
||||
awaiting_limit_decision: bool = False
|
||||
# Deliverables at their Revision limit that the user has been told about.
|
||||
revision_limit_asked: Sequence[str] = ()
|
||||
context: Mapping[str, Any] = field(default_factory=dict) # for a model Orchestrator
|
||||
|
||||
|
||||
@@ -135,6 +142,28 @@ class Readings:
|
||||
judged: dict[str, Any] = field(default_factory=dict) # what the decider answered
|
||||
|
||||
|
||||
# How much of the agreed requirements is shown to the decider with a user's message.
|
||||
_AGREED_LIMIT = 24_000
|
||||
|
||||
# The actions that reopen a Deliverable, and which one.
|
||||
_REOPENS = (
|
||||
"revise_requested",
|
||||
"revise_code",
|
||||
"revise_target_architecture",
|
||||
"revise_unimplementable",
|
||||
)
|
||||
|
||||
|
||||
def _reopened_by(action: str, readings: Readings) -> DeliverableKind | None:
|
||||
if action == "revise_requested":
|
||||
return readings.change_target
|
||||
if action == "revise_code":
|
||||
return DeliverableKind.DEPLOYMENT_GUIDANCE
|
||||
if action in {"revise_target_architecture", "revise_unimplementable"}:
|
||||
return DeliverableKind.TARGET_ARCHITECTURE
|
||||
return None
|
||||
|
||||
|
||||
def _attempt(ledger: Ledger, kind: DeliverableKind) -> int:
|
||||
return int(ledger.to_dict()["deliverables"][kind.value].get("attempt", 0))
|
||||
|
||||
@@ -194,16 +223,25 @@ class Router:
|
||||
"last_reply": None,
|
||||
"pending_change": None,
|
||||
"awaiting_gap_decision": False,
|
||||
"awaiting_limit_decision": False,
|
||||
}
|
||||
readings = await self._read(view, result)
|
||||
blocked: set[str] = set()
|
||||
settled = view.validation_settled
|
||||
# Told once, the user is not asked again: a Deliverable at its limit is no
|
||||
# longer reopened, and the Execution carries on with it as it stands.
|
||||
at_limit = set(view.revision_limit_asked)
|
||||
|
||||
async def call(tool: str, **arguments: Any) -> ToolResult:
|
||||
return await by_name[tool].handler(**arguments)
|
||||
|
||||
for _ in range(MAX_STEPS):
|
||||
group, action = self._choose(view, readings, blocked, settled)
|
||||
barred = blocked | {
|
||||
name
|
||||
for name in _REOPENS
|
||||
if (kind := _reopened_by(name, readings)) and kind.value in at_limit
|
||||
}
|
||||
group, action = self._choose(view, readings, barred, settled)
|
||||
result.decisions.append(
|
||||
{"group": group, "action": action, "judged": dict(readings.judged)}
|
||||
)
|
||||
@@ -220,9 +258,20 @@ class Router:
|
||||
result.outcome = reply.outcome
|
||||
return result
|
||||
if "revision limit" in reply.message and not view.pre_approved:
|
||||
# Past the Revision limit the user decides.
|
||||
# Past the Revision limit the user is told, once. Their reply is
|
||||
# read as the answer to this, never as a new request for changes.
|
||||
kind = _reopened_by(action, readings)
|
||||
if kind:
|
||||
at_limit.add(kind.value)
|
||||
result.updates["revision_limit_asked"] = sorted(at_limit)
|
||||
result.updates["awaiting_limit_decision"] = True
|
||||
limit = await call(
|
||||
"ask_user", questions=[reply.message.split(" Use ")[0]]
|
||||
"ask_user",
|
||||
questions=[
|
||||
reply.message.split(" Use ")[0]
|
||||
+ " It will not be revised again in this Execution; I will "
|
||||
"carry on with it as it stands. Reply to continue."
|
||||
],
|
||||
)
|
||||
if limit.outcome is not None:
|
||||
result.outcome = limit.outcome
|
||||
@@ -298,7 +347,7 @@ class Router:
|
||||
"""Triage of the user's message: is it asking for a change, to what, and how
|
||||
clearly?"""
|
||||
reply = view.last_reply
|
||||
if not reply or view.awaiting_gap_decision:
|
||||
if not reply or view.awaiting_gap_decision or view.awaiting_limit_decision:
|
||||
return
|
||||
text = str(reply.get("text", "")).strip()
|
||||
pending = view.pending_change
|
||||
@@ -308,10 +357,20 @@ class Router:
|
||||
if not text or not candidates:
|
||||
return
|
||||
readings.change_reason = text
|
||||
asked = [str(question) for question in reply.get("asked") or ()]
|
||||
# A structured request for changes is known to be one, and so is the reply to
|
||||
# our own question about a change they already asked for.
|
||||
structured = reply.get("kind") == "changes" or bool(pending)
|
||||
|
||||
agreed = (
|
||||
""
|
||||
if structured
|
||||
else str(
|
||||
view.deliverables.get(DeliverableKind.REQUIREMENTS.value, {})
|
||||
.get("attachments", {})
|
||||
.get(REQUIREMENTS_FILE, "")
|
||||
)[:_AGREED_LIMIT]
|
||||
)
|
||||
questions = {
|
||||
"change_target": Question(
|
||||
"choice",
|
||||
@@ -331,10 +390,28 @@ class Router:
|
||||
"Is the user asking for a change to work that has already been "
|
||||
"submitted, as opposed to answering a question or adding information?",
|
||||
)
|
||||
if agreed:
|
||||
# Someone who restates what is already agreed is answering, however
|
||||
# much it sounds like a requirement.
|
||||
questions["already_agreed"] = Question(
|
||||
"noul",
|
||||
"Does the user's message only confirm or repeat what the agreed "
|
||||
"requirements above already say, asking for nothing different?",
|
||||
)
|
||||
state = (
|
||||
f"Submitted Deliverables: {', '.join(kind.value for kind in candidates)}.\n"
|
||||
f"Questions waiting for the user: {len(view.pending_questions)}.\n"
|
||||
f"The user's message: {text}"
|
||||
+ (f"The agreed requirements:\n{agreed}\n" if agreed else "")
|
||||
+ f"Questions waiting for the user: {len(view.pending_questions)}.\n"
|
||||
# What we asked is background. Only the user's own words are their
|
||||
# message: our question echoed back is not something they said.
|
||||
+ (
|
||||
"The user was replying to these questions from the agents:\n"
|
||||
+ "\n".join(f"- {question}" for question in asked)
|
||||
+ "\n"
|
||||
if asked
|
||||
else ""
|
||||
)
|
||||
+ f"The user's message: {text}"
|
||||
)
|
||||
answers = await self._decider.decide(state, questions, scope=view.execution_id)
|
||||
|
||||
@@ -359,6 +436,10 @@ class Router:
|
||||
}
|
||||
probability = 1.0 if structured else float(answers["asks_change"].value)
|
||||
disposition = self._thresholds.disposition(probability)
|
||||
restated = answers.get("already_agreed")
|
||||
if restated is not None and restated.is_yes(self._thresholds.act):
|
||||
# It restates what is agreed: an answer, not a change.
|
||||
disposition = CLOSE
|
||||
target_answer = answers["change_target"]
|
||||
target = DeliverableKind(str(target_answer.value))
|
||||
readings.change_target = target
|
||||
@@ -556,6 +637,12 @@ class Router:
|
||||
"a reason."
|
||||
for item in r.unimplementable
|
||||
)
|
||||
# In the run of 2026-10-09 a second Check with the same fault came back
|
||||
# one Revision later, for the same reason word for word.
|
||||
reason += (
|
||||
" The same fault may be in other Checks: read every Check against "
|
||||
"each reason given here and correct every one it applies to."
|
||||
)
|
||||
return await call(
|
||||
"reopen", kind=DeliverableKind.TARGET_ARCHITECTURE.value, reason=reason
|
||||
)
|
||||
@@ -657,6 +744,30 @@ def approval_facts(phase: PhaseId, view: TurnView, r: Readings) -> dict[str, Any
|
||||
),
|
||||
}
|
||||
facts["counts"] = {name: count for name, count in counts.items() if count}
|
||||
scope = (view.deliverables.get(DeliverableKind.SCOPE.value) or {}).get(
|
||||
"attachments", {}
|
||||
)
|
||||
if phase is PhaseId.SCOPING and scope.get(SCOPE_DATA_FILE):
|
||||
# What approving the scope commits to: how much the customer stated, how
|
||||
# much was assumed for them, and what is still unknown.
|
||||
try:
|
||||
agreed = json.loads(scope[SCOPE_DATA_FILE])
|
||||
except ValueError:
|
||||
agreed = {}
|
||||
facts["scope"] = {
|
||||
"kind": agreed.get("kind"),
|
||||
"assumed": [item.get("field") for item in agreed.get("assumed", [])],
|
||||
"left_to_decide": [
|
||||
item.get("field") for item in agreed.get("to_decide", [])
|
||||
],
|
||||
"unknown": [item.get("field") for item in agreed.get("to_ask", [])],
|
||||
}
|
||||
plan = view.deliverables.get(DeliverableKind.WORK_BREAKDOWN.value)
|
||||
if plan and phase is PhaseId.PACKAGING:
|
||||
# How long the build is planned to take, and whether that fits.
|
||||
facts["delivery_plan"] = plan_summary(
|
||||
plan.get("attachments", {}), view.deliverables
|
||||
)
|
||||
graph = read_graph(view.deliverables)
|
||||
if graph is not None:
|
||||
facts["target_architecture"] = graph.summary()
|
||||
@@ -692,6 +803,29 @@ def assembled_summary(phase: PhaseId, facts: Mapping[str, Any]) -> str:
|
||||
lines.append(
|
||||
", ".join(f"{count} {name}" for name, count in counts.items()) + "."
|
||||
)
|
||||
plan = facts.get("delivery_plan")
|
||||
if plan:
|
||||
fits = plan.get("within_window")
|
||||
lines.append(
|
||||
f"Delivery plan: {plan['activities']} activities in "
|
||||
f"{plan['work_packages']} work packages, {plan['weeks']} weeks with a "
|
||||
f"team of {plan['team_size']}"
|
||||
+ (
|
||||
""
|
||||
if fits is None
|
||||
else f", {'inside' if fits else 'over'} the "
|
||||
f"{plan['window_weeks']}-week window"
|
||||
)
|
||||
+ "."
|
||||
)
|
||||
scope = facts.get("scope")
|
||||
if scope:
|
||||
lines.append(
|
||||
f"Scope of a {scope.get('kind') or 'workload'}: "
|
||||
f"{len(scope['assumed'])} fields assumed, "
|
||||
f"{len(scope['unknown'])} still unknown. Requirements are derived "
|
||||
"from it once you approve."
|
||||
)
|
||||
graph = facts.get("target_architecture")
|
||||
if graph:
|
||||
lines.append(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user