> ## Documentation Index
> Fetch the complete documentation index at: https://docs.complior.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Your First Auto-Fix

> Auto-remediate compliance issues with strategies across code, docs, config, and dependencies.

`complior fix` analyzes findings from your scan and applies remediation strategies. Every fix: structured plan → score prediction → backup → apply → evidence chain.

<Warning>
  **Principle:** Fixer never invents compliance logic. All fixes are deterministic (templates + strategies). LLM only enriches document content with explicit `--ai` opt-in.
</Warning>

## Preview fixes

Always preview before applying:

```bash theme={null}
complior fix --dry-run
```

```
Dry-Run Fix Analysis (offline estimate)
Fixable: 29 findings
Predicted: 40 -> 72 (+32)
```

## Apply fixes

```bash theme={null}
complior fix
```

```
◆ Complior Fix Report  ·  EU AI Act Auto-Remediation
--------------------------------------------------------------------------------
Project   .
Fixes     33 applied · 0 failed
--------------------------------------------------------------------------------

DOCUMENTS CREATED  (5 fixes)

  ✓  Art. 4    AI Literacy Doc Structure  [SCAFFOLD]
               → docs/compliance/ai-literacy-policy.md
               TODO: Company Name, Approved By (Name, Title), Training levels
               ↳ Fill placeholders and review with your compliance team

  ✓  Art. 26   Monitoring Policy Structure  [SCAFFOLD]
               → docs/compliance/monitoring-policy.md
               TODO: Company Name, Approved By (Name, Title), AI systems in scope
               ↳ Fill placeholders and review with your compliance team

  ✓  Art. 27   FRIA Structure Validation  [SCAFFOLD]
               → docs/compliance/fria.md
               TODO: Company Name, Approved By (Name, Title), Affected groups
               ↳ Fill placeholders and review with your compliance team

  ...

CODE FIXES — INLINE  (22 fixes)

  Security Fixes (5 fixes)
    ✓  Art. 15(4) Add compliance-aware error handling  [SCAFFOLD]
                   src/middleware/ai-error-handler.ts
    ✓  Art. 15(4) Fix security risk
                   src/data/eval/remediation/owasp-llm05.ts (+ 1 more)

  Error Handling (17 fixes)
    ✓  Art. 14   Add error handling
                   src/domain/passport/agent-discovery.test.ts (+ 4 more)

CONFIG & DEPENDENCIES  (1 fix)

  ✓  Art. 10   Bias Testing Missing → bias-testing.config.json  [SCAFFOLD]
               ↳ Populate test data paths and adjust fairness thresholds

--------------------------------------------------------------------------------
NEXT STEPS
--------------------------------------------------------------------------------
Fill TODO fields          Review generated documents and complete manual sections
Review code changes       Verify inline fixes don't break functionality
Re-scan                   complior scan
--------------------------------------------------------------------------------
UPGRADE [SCAFFOLD] → PRODUCTION
--------------------------------------------------------------------------------
LLM-enhanced docs         complior fix --ai
Coding agent via MCP      Connect your coding agent to Complior MCP server
                          See: complior mcp --help
```

<Note>
  `[SCAFFOLD]` means the file was created from a template with placeholders. Use `complior fix --ai` to have LLM fill `[TO BE COMPLETED]` sections, or connect a coding agent via MCP to complete them.
</Note>

## Fix types

Fixes are grouped by what they modify:

<Tabs>
  <Tab title="Documents">
    Generates legally required compliance documents from templates:

    * **FRIA** (Art.27) — Fundamental Rights Impact Assessment
    * **AI Usage Policy** (Art.6) — industry-specific templates
    * **Worker Notification** (Art.26(7)) — employee notification
    * **AI Literacy** (Art.4) — training documentation
    * **Monitoring Policy** (Art.26) — post-market monitoring
    * **Art.5 Screening** (Art.5) — prohibited practices report

    Documents are pre-filled from Agent Passport data. The more complete your passport, the fewer manual sections remain.
  </Tab>

  <Tab title="Code (inline)">
    Modifies source code to add compliance features:

    * **Disclosure Inject** — adds "I am an AI" system message for transparency (Art.50)
    * **Error Handling** — adds try-catch around LLM calls (Art.14)
    * **Security Fixes** — removes unsafe patterns like eval(), command injection (Art.15)
    * **Compliance Middleware** — creates wrapper and error handler scaffolds
  </Tab>

  <Tab title="Config">
    Creates configuration files:

    * **Bias Testing Config** — `bias-testing.config.json` with fairness thresholds (Art.10)
    * **Gitignore Hardening** — adds AI keys, model files to `.gitignore`
  </Tab>
</Tabs>

## Diff preview in TUI

Press `F` in TUI to open the Fix page. Select a fix to see the exact diff:

| Key     | Action               |
| ------- | -------------------- |
| `Space` | Toggle fix selection |
| `a`     | Select all           |
| `n`     | Deselect all         |
| `d`     | Toggle diff preview  |
| `Enter` | Apply selected fixes |

## Backups

Every fix creates a backup before applying. Fix history is stored in `.complior/fixes-history.json` for auditability.

## Document generation pipeline

When fixes generate documents, the flow is:

<Steps>
  <Step title="Scaffold">
    `complior fix` creates document from template with passport data pre-filled.
  </Step>

  <Step title="Placeholders">
    Remaining sections contain `[TO BE COMPLETED: ...]` markers and TODO lists.
  </Step>

  <Step title="LLM enrichment (optional)">
    `complior fix --ai` sends passport fields as context to LLM, which fills placeholders. Requires `.complior/.env` with LLM config.
  </Step>

  <Step title="Evidence">
    Fix recorded in evidence chain with SHA-256 hash + ed25519 signature.
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Compliance Documents" icon="file-shield" href="/compliance-docs/overview">
    See all document types and what they contain.
  </Card>

  <Card title="Eval: Test Live Systems" icon="flask-vial" href="/eval/overview">
    Go beyond code scanning — test your AI system's actual behavior.
  </Card>
</CardGroup>
