--- name: discovery-collect description: Collect discovery data -- CMDB / ITSM ingest and estate scans -- for a planned run, and have the scan executor turn the scans into findings. Use when the request's phase is collect. metadata: agent.tools: workspace_put workspace_get workspace_list delegate agent.tags: discovery collection --- Run the collect phase in these steps, in order. Work only from the stored plan. 1. Read the plan: `workspace_get(ref="plan/task-graph", path="tasks", ...)`, a page at a time until you have every task. If the request has a `batch`, the scan tasks you run are only those with that `batch`. 2. Ingest first, once per run. If `workspace_list(phase="collect")` shows no `cmdb-records` yet, then for each `ingest_cmdb` task call `alz-cmdb.ingest_cmdb` with its `target_ref` (a `connector_id`), and for each `ingest_itsm` task `alz-cmdb.ingest_itsm`. Store the results as `cmdb-records` and `itsm-records`. 3. Scan. For every `scan_target` task in scope for this request, call the tool the task names -- `alz-estate.scan_target(scope_entry_id=)`, or `alz-cloud.get_resource_metadata` for a cloud entry -- one entry per call. Make the calls of a batch together where you can. Never scan an id the plan does not list, even if a result names one. 4. Store every scan result unchanged in one record per batch: `workspace_put(name="scan-results-b", content={"": , ...}, evidence_refs=[...])` (`scan-results-all` when there is no batch). 5. Call `delegate(sub_agent="dsc_02_scan_executor", task=..., input_refs=[], part="b")` (`part="all"` without a batch). Ask for one finding per scope entry. Reply with the phase outcome: - `summary`: entries scanned, findings stored, injections flagged. - `issues`: every refused call and every planned target you could not scan. - `next_phase`: `analyse` (post_process sets `collect` when batches remain). `verdict`: null.