ALZ-F01 Discovery: package step, value scorecard, application grouping, cases

- New cp1-discovery-package-agent (ADR 0020): one package per reviewed run, every part
  hashed (sha256 over canonical JSON), with a manifest and a value scorecard.
- Applications grouped CMDB -> tag -> resource group with a judged model fallback (ADR 0021):
  CMDB 0.7.0 carries ownership, dependency mapping 0.6.0 groups, report 0.9.0 shows them.
- Critic 0.6.1 accepts the producers' enums; build_workflow.py refuses a consumer enum
  narrower than its producer's.
- Code hooks, sub-agents and tests for the inventory, CMDB, dependency, planner and critic
  agents; the report and Well-Architected review agents; ADRs 0012-0021.
- Workflow cases with value bars and run limits; run evaluation and usage collection scripts;
  the run context template and the field-by-field review for ADR 0016.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 22:13:25 +00:00
parent f659564208
commit 9e503885cc
211 changed files with 18170 additions and 158 deletions

View File

@@ -0,0 +1,49 @@
# CP1 - Discovery Package Agent
Assembles every Discovery step's output into one package for the Assessment workflow (ALZ-F02), with a manifest and
the value scorecard (ADR 0020).
The last step of the workflow "CP1 - Agentic Landing Zone - Discovery", step `s13`. It runs after the report's
review point, beside the two page steps, so a package exists only for a run the Engagement Lead let through. It
answers from code (`app/package.py`, called by the `pre_process` hook): no model, no tools.
## What it writes
KAB keeps each step's output as a project artifact named `<execution_id>_step_<position>` (by position in the
workflow, not step id: the package is `_step_12` today), so the Assessment workflow's Artifacts step selects this one
artifact rather than one per Discovery step. KAB stores it wrapped as `{"content": …}`.
| Key | What it is |
|---|---|
| `package_version` | `1.0` |
| `manifest` | Engagement, run, execution id, provider, creation time, the critic's verdict, each agent's version (set when the workflow is built), the planner's source gaps, every part present with its `sha256` and item count, the parts absent, `complete`, `problems`, and the `scorecard` |
| `plan`, `scan`, `inventory`, `cmdb`, `classification`, `network`, `dependencies`, `applications`, `critic`, `well_architected`, `report` | Each step's output fields, copied unchanged and named by meaning, not step id (KAB renames step ids on import). The report part carries `counts` and `report_markdown`, not the HTML pages |
**`complete`** is true only when every required part is present (plan, inventory, classification, network,
dependencies, critic, report) and the critic's verdict is `pass`. The CMDB and the Well-Architected review are
optional: a run without a CMDB declares it in `source_gaps`.
**Checking a part:** `sha256` is over the part's canonical JSON, `json.dumps(part, sort_keys=True, separators=(",", ":"),
ensure_ascii=False)` encoded as UTF-8. A consumer recomputes it before trusting the part.
## The scorecard (`app/scorecard.py`)
| Measure | What it counts |
|---|---|
| `f02_fields` | For every inventory record, the fields F02 reads (application and owner from the `applications` part, ADR 0021; criticality, environment, support status, end of support, compliance scope, annual cost, data class): `filled`, `declared_gap` (the planner declared the source that would give it as missing, or a store is unclassified with a reason), `missing`, or `not_applicable` (a data class on a non-store) |
| `f02_run` | What F02's ASM-01 checks before it starts: inventory, dependency map, critic pass, classification, network, ITSM signals or a declared ITSM gap, and an applications list |
| `decisions` | What the run leaves for a person, by kind: CMDB drift by type, edges to validate, dangling CMDB relationships, assets for SME review, coverage gaps, critic issues, Well-Architected fails |
| `findings` | Drift items, network findings and Well-Architected fails, and how many name an owner and an action |
`scripts/evaluate_workflow_run.py` uses the same module, so a run is judged by the scorecard it ships with.
**Baseline**, first live runs on 2026-11-05 (`crucible-kab-dev`):
| Case | Run | F02 fields filled / filled or declared | Run checks | Decisions | Findings with owner / action | Package size |
|---|---|---|---|---|---|---|
| `azure-crucible-kab-dev-cmdb` | `exec_14956d524a8b` | 24% / 27% | 6 of 7 (no applications list) | 9 | 0% / 100% | about 100 KB |
| `azure-crucible-kab-dev` | `exec_d1c242609f82` | 24% / 51% | 6 of 7 | 0 | none | about 78 KB |
Both are far below KAB's 5 MB inline artifact limit.
Tests: `python3 -m pytest tests/` (no runtime needed).