# CARBON intelligence layer

Use `carbon-runtime intelligence all --root <project>` or the
`carbon_intelligence` MCP tool with `action=all` for the one-command adaptive
experience. The operation is local, writes only under `.carbon/`, and produces
one interactive self-contained HTML report.

## Readiness doctor

The doctor scores seven inspectable areas: project understanding, local
execution, reusable test assets, evidence/reproducibility, memory freshness,
explainable multidimensional confidence, and safety/recovery boundaries. Every
score includes observed evidence, gaps, a concrete repair action, and a next
Carbon command. A score is diagnostic evidence—not a release probability.

## Evidence graph and why-this-test

`evidence-graph.json` uses typed nodes and edges for project surfaces, APIs,
flows, source provenance, candidates, regressions, runs, results, findings, and
evidence handles. `why-test --test-id <id>` explains:

- the risk or product entity the test covers;
- its source/code/contract provenance;
- the reason and oracle;
- observed results and evidence;
- lifecycle and staleness; and
- invalidations that make prior lineage unsafe to trust.

## Failure intelligence

Failure clustering gathers findings and failed tests across durable runs,
groups related records by shared test identity and semantic signals, assigns an
investigation classification, links portable repros, and states whether the
cluster was observed once or across distinct runs. Classification and likely
root cause remain hypotheses until a representative occurrence is reproduced
and the artifacts are compared.

## Project memory

Project memory fingerprints source, tests, dependencies, schemas, and
configuration. Changes invalidate the exact kinds of prior knowledge they can
make stale. Evidence older than the configured freshness window becomes aging.
The framework includes memory freshness and invalidations in every new plan.

## Seeded-defect dogfood benchmark

The packaged deterministic fixture contains known DOM, accessibility, console,
network, security, performance, visual, and cross-artifact correlation defects.
Carbon analyzes the fixture with its own artifact engine and reports precision,
recall, F1, missed seeds, and unexpected signals. This guards the detector
contract; it does not estimate performance on arbitrary real products.

## Interactive report and confidence dimensions

The Intelligence report provides tabs, search, state/classification filters,
and expand/collapse controls across readiness, confidence, graph nodes,
failures, memory, and benchmark evidence. Confidence is reported separately for
functional behavior, security/privacy, accessibility, performance, reliability,
usability, data integrity, and operational readiness. An unassessed dimension
stays visibly unassessed rather than inheriting the overall band.
