Skip to main content

Composite analysis workflows

Combine Scenario 18 or 19 findings through the supported CLI or governed MCP route without treating suggestions as applied edits.

User Guides

Composition combines findings from several analysis scenarios, removes duplicates, resolves conflicts and ranks the result. The supported composite jobs are Scenario 18 optimization analysis and Scenario 19 standards analysis. Both workflows run in analysis-only mode and produce analysis output; confirm source changes with the recorded diff and repository checks.

Choose the orchestrator

Choose the orchestrator
Orchestrator Purpose Current boundary
s18 / scenario_18 Merge security, performance, quality, refactoring and debt signals into optimization suggestions. Does not apply or approve an optimization.
s19 / scenario_19 Merge standards and related code-quality signals. Does not import a standards document, approve a deviation, or change source.

The current CLI exposes only these two orchestrators. Treat the full audit branch as a separate workflow with its own persistence and evidence contract.

Run composite analysis from the CLI

Save the result to a caller-owned JSON file:

python -m src.cli composition run "Analyze the bounded component for optimization opportunities." --orchestrator s18 --output composition.json
python -m src.cli composition run "Check the bounded component against the accepted standards." --orchestrator s19 --output composition.json

Record the source and CPG revision, query, orchestrator, configuration, sub-scenarios invoked, merge metadata, conflicts, findings and output digest. The CLI uses process-local session storage; a session ID is not durable across processes or restarts.

The registered --sub-scenario, parallel and merge-strategy arguments are not all projected into the current direct CLI execution path. Do not claim that a printed option changed execution unless result metadata proves it.

Run the governed MCP route

Call codegraph_runtime_composition_workflow_run with native values and an exact task scope. For example, the effective request is:

{
  "query": "Analyze the bounded component for optimization opportunities.",
  "orchestrator": "s18",
  "language": "en",
  "namespace": "default",
  "task_id": "<task-id>"
}

For s18 and s19, the MCP implementation resolves the owning employee and invokes RoleBoundScenarioInvocationRequest. Governed scope is required by the role-bound contract. The tool returns answer, evidence and metadata; source mutation and release authorization use separate governed workflows.

CLI apply behavior and mutation

python -m src.cli composition apply <finding-id> --session <session-id> first looks only in the process-local session dictionary. Without a matching session or pending edit it fails. With a matching edit and no --preview, the current command prints Edit application not implemented in CLI demo, returns exit code 0, and does not apply source changes.

The follow-up line that refers users to the MCP tool points to the current role-bound analysis surface: codegraph_runtime_composition_workflow_run returns analysis only. A source change requires a separate governed implementation task with exact files, accepted preview, tests, review, rollback and revision-bound evidence.

Interpret the result

  • Deduplication and ranking help prioritize investigation; review each source finding in its bound revision.
  • Conflict resolution metadata records how findings were merged. The accountable reviewer records the resulting decision separately.
  • A pending edit is a proposal. Verify source context and current revision before any separate mutation.
  • Empty or degraded sub-scenario output must remain visible; do not convert it into a clean bill of health.

Source contract

  • src/cli/domain_suite/composition_commands.py — CLI orchestrators, process-local sessions and non-applying apply command;
  • src/mcp/tools/core/compose.py — governed role-bound MCP analysis route;
  • src/workflow/scenarios/code_quality/code_optimization_composite.py — Scenario 18 composite analysis;
  • src/workflow/scenarios/code_quality/standards_check_composite.py — Scenario 19 composite analysis;
  • src/workflow/composition/ — merging, priority and conflict models.