# Audit Reporting

Use this reporting contract when writing either scoped worker artifacts or canonical synthesis reports.

## Output targets

Write two report files under `edc-context/reports/` when running the current whole-repo audit command or synthesis pass:

- `edc-context/reports/complexity.md`
- `edc-context/reports/issues.md`

Reports MUST live under `edc-context/reports/`, never at the top level of `edc-context/`.

When invoked as a scoped worker, write only the assigned report artifact. The synthesis pass owns canonical report generation.

## `edc-context/reports/complexity.md`

```md
<!-- generated by edc-audit -->
# Code Quality Audit

## Summary
- Quality risk score: X/10 (0 = lean, 10 = severe quality risk)
- Bloat score: X/10 (0 = lean, 10 = severely bloated)
- Dead exports: N
- Wrapper functions: N
- Over-abstracted modules: N
- Duplicated code blocks: N
- Oversized files/functions: N
- Test-value risks: N

## LOC Estimates vs Reality
[table]

## Dead Exports / Public Surface
[list]

## Wrapper Functions
[list]

## Over-Abstracted Modules
[list]

## Duplication
[list]

## Oversized Files / Functions
[list]

## Deep Call Chains
[list]

## Test Mirroring / Test Value
[list]

## Correctness and Error-Handling Risks
[maintainability-level findings]

## Interface / Type / Contract Risks
[list]

## Simplicity Opportunities
[list]
```

## `edc-context/reports/issues.md`

Promote any audit findings that represent real correctness risks from code-quality problems (as opposed to pure bloat) into `edc-context/reports/issues.md`. If the file already exists from a prior `edc-build-impl` run, merge new findings in rather than overwriting unrelated entries.

```md
<!-- generated by edc-audit -->
# Known Issues

## <severity> — <short title>
- where: file:line
- problem: ...
- recommendation: ...
```

## Finding format

Each finding in either report should include:
- what the problem is
- where it appears (`file:line` where practical)
- why it matters
- whether it violates a cited standard or is a possible smell / judgement call
- suggested simplification or fix in one sentence
