feat: establish the Target architecture as a graph before code

Design is now approved before any infrastructure code is written (ADR-0005).
A new target-architect Specialist produces one graph of Elements,
Relationships and Checks; the diagram is rendered from it, deployment
guidance must account for every Check, and validation gives a verdict per
Check. Requirements, components, products and recommendations carry ids in
data files, and a submission with a gap in the Requirements chain is refused.

Also in this commit:
- Customer cases group Executions, with an intent history per case
- lesson candidates are captured when an Execution ends
- evaluation gains chain, verdict, judged and interactive checks, and
  per-case thresholds
- Terraform providers are cached between checks
- the requirements analyst proposes defaults instead of asking
- the legacy-baseline case and the checks that only read it are removed
- ADR-0006 (Change requests) accepted; ADR-0004 and ADR-0007 proposed
- plans for iterations 4 to 7 under .agents/plans/

Unproven with a real model: no evaluation run has completed on this design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 13:59:09 +01:00
parent 7ee49ab352
commit e9246828b3
586 changed files with 5166 additions and 22432 deletions

View File

@@ -11,7 +11,7 @@ import os
import re
import tempfile
from collections.abc import Awaitable, Callable, Iterable, Mapping
from dataclasses import dataclass
from dataclasses import dataclass, field
from pathlib import Path, PurePosixPath
from typing import Any
@@ -76,7 +76,11 @@ async def mermaid_check(diagram: str) -> ToolResult:
class TerraformRunner:
binary: str = "terraform"
timeout_seconds: float = 300
# Providers are downloaded here once and reused by every later check. Without it,
# each validate or plan downloads its providers again into a scratch directory.
plugin_cache_dir: str | None = None
# Terraform's plugin cache is not safe for concurrent installs.
_init_lock: asyncio.Lock = field(default_factory=asyncio.Lock, repr=False)
async def fmt(self, files: Mapping[str, str]) -> ToolResult:
refusal = _check_files(files)
@@ -147,9 +151,12 @@ class TerraformRunner:
)
async def _init(self, root: Path) -> ToolResult | None:
code, output = await self._run(
[self.binary, "init", "-backend=false", "-input=false", "-no-color"], root
)
command = [self.binary, "init", "-backend=false", "-input=false", "-no-color"]
if self.plugin_cache_dir:
async with self._init_lock:
code, output = await self._run(command, root)
else:
code, output = await self._run(command, root)
if code != 0:
return ToolResult(_clip(f"terraform init failed:\n{output}"))
return None
@@ -159,7 +166,12 @@ class TerraformRunner:
) -> tuple[int, str]:
environment = {**os.environ, "TF_IN_AUTOMATION": "1", **(env or {})}
if self.plugin_cache_dir:
environment["TF_PLUGIN_CACHE_DIR"] = self.plugin_cache_dir
cache = Path(self.plugin_cache_dir).expanduser().resolve()
cache.mkdir(parents=True, exist_ok=True)
environment["TF_PLUGIN_CACHE_DIR"] = str(cache)
# Each check runs in a scratch directory with no dependency lock file.
# Without this, Terraform downloads a cached provider again to verify it.
environment["TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE"] = "true"
try:
process = await asyncio.create_subprocess_exec(
*args,