# Agent & Passport Endpoints
Source: https://docs.complior.ai/api/agent
Passport lifecycle, FRIA generation, evidence chain, export, audit trail, and document generation.
## Passport CRUD
### `POST /agent/init`
Auto-generate Agent Passport from codebase analysis.
```json theme={null}
{
"path": ".",
"overrides": { "risk_class": "high" },
"force": false
}
```
***
### `GET /agent/list`
List all passports in the project.
```bash theme={null}
curl "http://localhost:3578/agent/list?path=."
```
**Response:** Array of `AgentPassport` objects (36 fields each).
***
### `GET /agent/show`
Get a specific passport by name.
```bash theme={null}
curl "http://localhost:3578/agent/show?path=.&name=my-chatbot"
```
***
### `POST /agent/rename`
```json theme={null}
{ "path": ".", "oldName": "agent-1", "newName": "customer-chatbot" }
```
***
### `GET /agent/validate`
Validate passport schema, ed25519 signature, and completeness.
```bash theme={null}
curl "http://localhost:3578/agent/validate?path=.&name=my-chatbot"
```
***
### `GET /agent/completeness`
Get passport completeness percentage (0–100%).
***
### `GET /agent/autonomy`
Analyze project autonomy level (L1–L5).
***
## Documents
### `POST /agent/fria`
Generate Fundamental Rights Impact Assessment.
```json theme={null}
{
"path": ".",
"name": "my-chatbot",
"organization": "Acme Corp",
"assessor": "Jane Doe",
"impact": "Medium impact on customer communication",
"mitigation": "Human oversight on all decisions",
"approval": "CTO approval obtained"
}
```
***
### `POST /agent/notify`
Generate Worker Notification (Art. 26(7)).
```json theme={null}
{
"path": ".",
"name": "my-chatbot",
"companyName": "Acme Corp",
"contactName": "Jane Doe",
"contactEmail": "jane@acme.com",
"deploymentDate": "2026-06-01",
"affectedRoles": "Customer Support Agents",
"impactDescription": "AI assists with response drafting"
}
```
***
### `POST /agent/policy`
Generate industry-specific AI usage policy.
```json theme={null}
{
"path": ".",
"name": "my-chatbot",
"industry": "finance",
"organization": "Acme Bank",
"approver": "Chief Compliance Officer"
}
```
Industries: `hr`, `finance`, `healthcare`, `education`, `legal`.
***
### `POST /agent/doc`
Generate a single compliance document.
```json theme={null}
{ "path": ".", "name": "my-chatbot", "docType": "fria", "organization": "Acme Corp" }
```
***
### `POST /agent/doc/all`
Generate ALL required compliance documents at once.
***
## Evidence & Audit
### `GET /agent/evidence`
Get evidence chain summary.
***
### `GET /agent/evidence/verify`
Verify evidence chain integrity (hash chain + ed25519 signatures).
```bash theme={null}
curl "http://localhost:3578/agent/evidence/verify?path=."
```
**Response:**
```json theme={null}
{
"valid": true,
"entries": 47,
"firstEntry": "2026-03-15T10:00:00Z",
"lastEntry": "2026-03-28T14:30:00Z"
}
```
***
### `GET /agent/audit`
Query audit trail.
| Query param | Description |
| ----------- | ---------------------------------- |
| `agent` | Filter by agent name |
| `since` | ISO timestamp (e.g., `2026-03-01`) |
| `until` | ISO timestamp |
| `type` | Event type filter |
| `limit` | Max entries (default: 100) |
***
### `GET /agent/audit-package`
Export audit-ready package as tar.gz (passports + evidence + scan results + documents).
***
## Export & Import
### `GET /agent/export`
Export passport to external format.
```bash theme={null}
curl "http://localhost:3578/agent/export?path=.&name=my-chatbot&format=a2a"
```
Formats: `a2a` (Google A2A), `aiuc-1`, `nist`.
***
### `POST /agent/import`
Import passport from external format.
```json theme={null}
{ "format": "a2a", "data": { ... }, "path": "." }
```
***
## Registry & Permissions
### `GET /agent/registry`
Per-agent compliance dashboard with scores, findings, and status.
***
### `GET /agent/permissions`
Get permissions matrix for all agents — tools, data access, autonomy constraints.
# Eval Endpoints
Source: https://docs.complior.ai/api/eval
Dynamic system evaluation — 680 probes for bias, transparency, security, and conformity testing.
Eval endpoints test **live AI systems** via HTTP. Unlike scan (static code analysis), eval sends actual probes to your endpoint and evaluates the responses.
## Run evaluation
### `POST /eval/run`
Run full evaluation suite. Returns results after all probes complete.
**Request body:**
```json theme={null}
{
"target": "http://localhost:8080/api/chat",
"det": true,
"llm": false,
"security": true,
"full": false,
"agent": "my-chatbot",
"categories": ["bias", "transparency", "security"],
"concurrency": 5,
"requestTemplate": {
"messages": [{ "role": "user", "content": "{{prompt}}" }]
},
"responsePath": "choices.0.message.content",
"headers": { "Authorization": "Bearer token" }
}
```
| Field | Type | Default | Description |
| ----------------- | --------- | -------- | ------------------------------------------------ |
| `target` | string | required | Endpoint URL |
| `det` | boolean | `false` | Deterministic probes only |
| `llm` | boolean | `false` | Include LLM-judged probes |
| `security` | boolean | `false` | Include security attack probes |
| `full` | boolean | `false` | Run all probe categories |
| `agent` | string | — | Filter by agent name |
| `categories` | string\[] | all | Specific categories |
| `concurrency` | number | 5 | Parallel probes |
| `requestTemplate` | object | — | Custom request format (`{{prompt}}` placeholder) |
| `responsePath` | string | — | Dot-path to extract response text |
| `headers` | object | — | Custom HTTP headers |
**Response:** `EvalResult`
```json theme={null}
{
"target": "http://localhost:8080/api/chat",
"total": 680,
"passed": 612,
"failed": 68,
"score": 90,
"categories": {
"bias": { "passed": 120, "failed": 5, "score": 96 },
"transparency": { "passed": 80, "failed": 12, "score": 87 },
"security": { "passed": 95, "failed": 30, "score": 76 }
},
"failures": [
{
"id": "bias-gender-001",
"category": "bias",
"probe": "Gender bias in hiring context",
"expected": "No gender preference",
"actual": "Response showed preference for male candidates",
"severity": "high"
}
]
}
```
***
### `POST /eval/run/stream`
Same parameters as `/eval/run`, but returns SSE stream with per-probe progress:
```
data: {"type":"probe_start","id":"bias-gender-001","category":"bias"}
data: {"type":"probe_result","id":"bias-gender-001","passed":true,"elapsed":450}
data: {"type":"category_complete","category":"bias","passed":120,"failed":5}
data: {"type":"complete","score":90,"total":680}
```
***
## Results
### `GET /eval/last`
Get the most recent evaluation result.
### `GET /eval/list`
List all saved evaluation results.
```json theme={null}
{
"results": [
{ "id": "eval-2026-03-28-1", "target": "...", "score": 90, "timestamp": "..." }
],
"judgeConfigured": true
}
```
### `GET /eval/findings`
Convert eval failures into scanner-compatible findings for unified scoring.
***
## Remediation
### `GET /eval/remediation`
Get remediation suggestions for specific test failures.
**Query:** `testIds=bias-gender-001,security-injection-003`
### `POST /eval/remediation-report`
Generate full remediation report across all eval failures with markdown output.
***
## Red-Team
### `POST /redteam/run`
Run adversarial red-team probes against an agent.
```json theme={null}
{
"agentName": "my-chatbot",
"categories": ["injection", "jailbreak", "exfiltration"],
"maxProbes": 100
}
```
### `GET /redteam/last`
Get the most recent red-team report.
***
## Audit (Combined)
### `POST /audit/run`
Run combined scan + eval with weighted scoring (40% scan, 60% eval).
```json theme={null}
{
"path": ".",
"target": "http://localhost:8080/api/chat",
"agent": "my-chatbot",
"full": true
}
```
# Fix Endpoints
Source: https://docs.complior.ai/api/fix
Preview, apply, and undo compliance fixes. Batch operations with validation.
## Preview
### `GET /fix/preview`
Preview all available fixes without applying.
```bash theme={null}
curl http://localhost:3578/fix/preview
```
**Response:**
```json theme={null}
{
"fixes": [
{
"checkId": "no-disclosure",
"type": "code",
"strategy": "disclosure-inject",
"description": "Add AI disclosure system message for Art.50 transparency",
"file": "src/agent.ts",
"line": 12,
"diff": " messages: [\n+ { role: 'system', content: 'You are an AI assistant. Users must be informed they are interacting with AI per EU AI Act Art.50.' },\n { role: 'user', content: userInput }",
"scoreImpact": "+5"
}
],
"count": 24
}
```
***
### `POST /fix/preview`
Preview fix for a specific finding.
**Request body:**
```json theme={null}
{
"checkId": "no-disclosure",
"obligationId": "OBL-050",
"useAi": false
}
```
***
## Apply
### `POST /fix/apply`
Apply a single fix.
**Request body:**
```json theme={null}
{
"checkId": "no-disclosure",
"obligationId": "OBL-050",
"useAi": false
}
```
**Response:** `FixResult` with applied diff, new score, and evidence entry ID.
***
### `POST /fix/apply-and-validate`
Apply fix and immediately re-scan to validate the result.
**Request body:** Same as `/fix/apply`
**Response:**
```json theme={null}
{
"result": { "applied": true, "checkId": "no-disclosure" },
"validation": { "scoreBefore": 40, "scoreAfter": 48, "findingResolved": true }
}
```
***
### `POST /fix/apply-all`
Batch apply all available fixes.
**Request body:**
```json theme={null}
{
"useAi": false,
"projectPath": "."
}
```
**Response:**
```json theme={null}
{
"results": [...],
"summary": { "applied": 29, "failed": 0, "skipped": 3 },
"unfixedFindings": [...]
}
```
***
## Undo
### `POST /fix/undo`
Revert a previously applied fix.
**Request body:**
```json theme={null}
{
"id": 5
}
```
Omit `id` to undo the most recent fix.
***
### `GET /fix/history`
List all applied fixes with timestamps, diffs, and undo availability.
```bash theme={null}
curl http://localhost:3578/fix/history
```
# API Reference
Source: https://docs.complior.ai/api/overview
Complior engine exposes a REST API on localhost for CLI, TUI, and MCP integrations. 100+ endpoints across scan, eval, fix, agent, and system operations.
The Complior engine runs as a background daemon and exposes an HTTP API on `localhost:3578`. All tools (CLI, TUI, MCP server) communicate with the engine through this API.
The API is **local-only** by default. No authentication required. The daemon binds to `127.0.0.1` and is not accessible from the network.
## Base URL
```
http://localhost:3578
```
Override with `--port` when starting the daemon:
```bash theme={null}
complior daemon start --port 4000
```
## Response format
All endpoints return JSON. Errors follow a consistent format:
```json theme={null}
{
"error": "Not found",
"status": 404,
"details": "No scan results available. Run `complior scan` first."
}
```
## Endpoint groups
Static analysis, deep scan, diff, SBOM generation, and dynamic evaluation with 680 probes.
Preview, apply, undo fixes. Batch operations with validation.
Passport CRUD, FRIA generation, evidence chain, export, audit trail, and document generation.
Engine status, SSE events, file operations, onboarding, badges, sharing, and sync.
## SSE streaming
Some endpoints return Server-Sent Events for real-time progress:
| Endpoint | Description |
| ----------------------- | -------------------------------------------------------------- |
| `GET /events` | Global event stream (scan results, score updates, gate events) |
| `POST /eval/run/stream` | Eval progress with per-probe updates |
| `POST /chat` | LLM chat responses streamed token-by-token |
## Quick examples
```bash theme={null}
curl -X POST http://localhost:3578/scan \
-H "Content-Type: application/json" \
-d '{"path": "."}'
```
```bash theme={null}
curl http://localhost:3578/fix/preview
```
```bash theme={null}
curl "http://localhost:3578/agent/list?path=."
```
```bash theme={null}
curl http://localhost:3578/status
```
# Scan & Eval Endpoints
Source: https://docs.complior.ai/api/scan
Static analysis, deep scan, diff, SBOM, and dynamic evaluation endpoints.
## Scan
### `POST /scan`
Run 5-layer static compliance analysis.
**Request body:**
```json theme={null}
{
"path": ".",
"saasToken": "optional-token",
"saasUrl": "https://app.complior.ai"
}
```
| Field | Type | Required | Description |
| ----------- | ------ | -------- | ----------------------------------- |
| `path` | string | Yes | Project directory path |
| `saasToken` | string | No | SaaS sync token (auto-push results) |
| `saasUrl` | string | No | SaaS instance URL |
**Response:** `ScanResult`
```json theme={null}
{
"score": { "compliance": 72, "security": null },
"frameworks": {
"eu-ai-act": { "score": 72, "grade": "C" }
},
"findings": [...],
"agents": [...],
"layers": { "L1": "PASS", "L2": "WARN", "L3": "PASS", "L4": "WARN" },
"elapsed": 2100,
"regulationVersion": "1.0.0"
}
```
***
### `POST /scan/deep`
L5 LLM-powered deep analysis for findings in the uncertain zone (50–80% confidence). Requires BYOK API key in `.complior/.env`.
**Request body:** Same as `POST /scan`
***
### `POST /scan/diff`
Compare compliance state against changed files. Useful for PR reviews.
**Request body:**
```json theme={null}
{
"path": ".",
"changedFiles": ["src/agent.ts", "package.json"],
"markdown": true
}
```
**Response:** `ScanDiffResult` with `added`, `removed`, `changed` findings and score delta.
***
### `POST /scan/tier2`
Run external tools (Semgrep, Bandit, ModelScan, detect-secrets) via uv. Requires `uv` installed.
**Request body:** Same as `POST /scan`
***
### `GET /sbom`
Generate Software Bill of Materials (CycloneDX 1.5 JSON).
**Query params:** `path` (project directory)
```bash theme={null}
curl "http://localhost:3578/sbom?path=."
```
***
## Eval
### `POST /eval/run`
Run dynamic evaluation against a live endpoint. Blocking — returns full result.
**Request body:**
```json theme={null}
{
"target": "http://localhost:8080/api/chat",
"det": true,
"llm": false,
"security": true,
"agent": "my-chatbot",
"categories": ["bias", "transparency", "security"],
"concurrency": 5,
"requestTemplate": { "messages": [{ "role": "user", "content": "{{prompt}}" }] },
"responsePath": "choices.0.message.content"
}
```
| Field | Type | Required | Description |
| ----------------- | --------- | -------- | ---------------------------------------- |
| `target` | string | Yes | Endpoint URL to test |
| `det` | boolean | No | Deterministic probes only (no LLM judge) |
| `llm` | boolean | No | Include LLM-judged probes |
| `security` | boolean | No | Include security attack probes |
| `agent` | string | No | Filter by agent name |
| `categories` | string\[] | No | Probe categories to run |
| `concurrency` | number | No | Parallel probe count (default: 5) |
| `requestTemplate` | object | No | Custom request format |
| `responsePath` | string | No | Dot-path to extract response text |
**Response:** `EvalResult`
***
### `POST /eval/run/stream`
Same as `/eval/run` but returns SSE stream with per-probe progress updates.
***
### `GET /eval/last`
Get the most recent eval result.
***
### `GET /eval/findings`
Convert eval failures into scanner-compatible findings for unified reporting.
***
### `GET /eval/remediation`
Get remediation plan for specific test failures.
**Query params:** `testIds` (comma-separated test IDs)
# System Endpoints
Source: https://docs.complior.ai/api/status
Engine status, events, file operations, onboarding, badges, sharing, sync, and more.
## Status & Events
### `GET /status`
Get engine status.
```bash theme={null}
curl http://localhost:3578/status
```
**Response:**
```json theme={null}
{
"status": "running",
"version": "1.0.0",
"mode": "daemon",
"uptime": 3600,
"last_scan": "2026-03-28T14:00:00Z",
"agents_count": 3,
"total_findings": 42,
"compliance_score": 72
}
```
***
### `GET /events`
Subscribe to Server-Sent Events stream.
```bash theme={null}
curl -N http://localhost:3578/events
```
Event types: `scan.complete`, `score.update`, `gate.pass`, `gate.fail`, `fix.applied`, `agent.created`, `evidence.appended`.
***
## Onboarding
### `GET /onboarding/status`
Check if project has been onboarded.
### `POST /onboarding/detect`
Auto-detect project information (frameworks, languages, AI systems).
### `GET /onboarding/questions`
Get onboarding question blocks for interactive setup.
### `POST /onboarding/complete`
Submit onboarding answers to generate profile.
### `POST /onboarding/guided/start`
Start guided onboarding wizard (8 steps).
### `GET /onboarding/guided/status`
Get current guided onboarding progress.
### `POST /onboarding/guided/step/:n`
Execute step N of guided onboarding.
***
## Badges & Reports
### `GET /badge`
Get compliance badge as SVG image.
```bash theme={null}
curl http://localhost:3578/badge > badge.svg
```
### `POST /badge/generate`
Generate badge SVG + `COMPLIANCE.md` file.
### `POST /report/pdf`
Generate PDF compliance report.
```json theme={null}
{ "organization": "Acme Corp", "jurisdiction": "DE", "isFree": true }
```
### `POST /report/markdown`
Generate markdown compliance report.
***
## Sharing
### `POST /share`
Create a shareable compliance result.
```json theme={null}
{
"jurisdiction": "DE",
"scanType": "standard",
"expirationDays": 30
}
```
**Response:**
```json theme={null}
{
"id": "abc123",
"url": "https://app.complior.ai/share/abc123",
"expiresAt": "2026-04-28T00:00:00Z",
"score": 72,
"findingsCount": 42
}
```
### `GET /share/:id`
Get a shared result by ID.
### `GET /shares`
List all shared results.
***
## SaaS Sync
### `POST /sync/passport`
Push all passports to SaaS dashboard.
### `POST /sync/scan`
Push scan results to SaaS.
### `POST /sync/documents`
Push compliance documents to SaaS.
### `POST /sync/evidence`
Push evidence chain to SaaS.
### `GET /sync/status`
Check SaaS sync status and authentication.
All sync endpoints require `token` and `saasUrl` in the request body.
***
## Frameworks & Scoring
### `GET /frameworks`
List available compliance frameworks.
### `GET /frameworks/scores`
Get scores for all selected frameworks (EU AI Act, AIUC-1, ISO 42001, etc.).
### `GET /debt`
Get compliance debt score with optional trend data.
### `GET /cost-estimate`
Estimate remediation cost in hours and euros.
***
## Jurisdictions
### `GET /jurisdictions`
List 30 EU/EEA jurisdictions with local authorities.
### `GET /jurisdictions/:code`
Get jurisdiction details (authority name, contact, language).
***
## Tools
### `GET /tools/status`
Check status of external tools (uv, Semgrep, Bandit, detect-secrets).
### `POST /tools/update`
Install or update external analysis tools.
***
## What-If & Simulation
### `POST /whatif`
Analyze hypothetical scenario.
```json theme={null}
{
"type": "jurisdiction",
"params": { "from": "DE", "to": "FR" }
}
```
Types: `jurisdiction`, `tool`, `risk_level`.
### `POST /simulate`
Batch compliance simulation — predict score impact of multiple actions.
```json theme={null}
{
"actions": ["fix:no-disclosure", "fix:missing-fria", "doc:ai-policy"],
"passportCompleteness": 85
}
```
# Changelog
Source: https://docs.complior.ai/changelog
Release history and notable changes for Complior.
## Patch — `fix --doc` error message clarity
Closes the only known limitation from v1.0.0.
**Fixed**
* `complior fix --doc ` now surfaces the actual engine error message (e.g. `Error: Passport not found: default`) instead of the generic `Error: Unknown engine error` when an invalid passport name is passed. Functional behaviour was already correct in v1.0.0 (exit code 1, no fake "Document generated" output) — only the displayed message has improved.
**Affected paths**
* `cli/src/headless/fix.rs` (`run_doc_generate_single`)
* `cli/src/headless/doc.rs` (`run_doc_generate` and `run_doc_generate_fix`)
**Verification**
* 4-cycle exhaustive E2E across 3 profile contexts (deployer/limited/general, provider/high/healthcare, deployer/high/finance) — confirmed clean.
* 0 regressions on prior fixes.
* 226 Rust + 2,493 TS = 2,719 tests, 0 failures.
* Released as `complior@1.0.1` on npm, `complior-cli@1.0.1` on crates.io, and 5 platform binaries on GitHub Releases.
## Initial public release
First general-availability release of the Complior open-source compliance platform. Production-ready for EU AI Act compliance scanning, evaluation, fix automation, Agent Passports, and report generation. All v1.0 pipeline commands (`init`, `scan`, `eval`, `fix`, `report`, `agent`/`passport`, `doctor`) are stable with full flag coverage and exhaustive E2E verification across 3 profile contexts.
**Scan Engine**
* 5-layer static analysis (L1 file presence, L2 document structure, L3 dependencies, L4 code patterns, L5 LLM opt-in)
* 57+ AI framework detection (LangChain, CrewAI, OpenAI, Anthropic, Vercel AI, HuggingFace, AutoGen, Bedrock, Ollama, etc.)
* 37 secret patterns (API keys, tokens, passwords) via NHI scanner
* 33 code pattern rules across 8 compliance categories
* Cross-layer verification (7 consistency rules including `cross-passport-code-mismatch`)
* Profile-aware filtering: `role × riskLevel × domain → applicableObligations` (16 / 67 / 46 across deployer-limited / provider-high-healthcare / deployer-high-finance)
* Incremental scan (mtime + SHA-256 cache, 10–50× speedup)
* Supply chain audit (45+ AI SDKs with CVE detection)
* Dependency scan (5 package managers with lock file parsing)
* SARIF v2.1.0 and JSON output
**Eval Engine**
* 680 dynamic probes across 11 EU AI Act conformity categories + 300 OWASP/MITRE security probes
* Profile-aware filtering: 319 / 335 / 327 of 388 tests applicable per profile
* Deterministic + LLM-judged probe modes (BYOK or hosted judge)
* Custom request template support for any API format
* Auto-detect adapters (OpenAI, Anthropic, Google, custom)
* SSE streaming with real-time progress
* Refusal heuristic (correctly identifies model declines vs. failures)
* CI threshold gates (`--ci --threshold N`)
**Agent Passport**
* 36-field standardized AI system identity card
* 3 creation modes: Auto (65–70% from code), Guided (interactive), Manual (full control)
* Ed25519 cryptographic signing with key management at `~/.config/complior/keys/`
* Export: A2A, AIUC-1, NIST formats
* Evidence chain (SHA-256 hash linking + ed25519 signatures, tamper-proof)
* Worker Notification template
* FRIA Generator (template + AI Enricher with scaffold/enhance modes)
**Fix Engine**
* 18 remediation strategies (code, document, config, cross-layer)
* Preview with score impact prediction (capped at 99 — estimates, not certainty)
* 14 EU AI Act + ISO 42001 document generators (FRIA, AI Policy, SoA, Risk Register, Worker Notification, Tech Documentation, Monitoring Policy, Data Governance, etc.)
* LLM-assisted document generation (`--ai` opt-in)
* ENRICH semantics for existing files (no overwrite of user edits)
* Full undo capability via backup chain
**CLI & TUI**
* 40+ headless commands across 7 verbs (init, scan, eval, fix, report, agent, doctor)
* 9-page interactive TUI dashboard (Dashboard, Scan, Findings, Passport, Obligations, Tests, Report, Log, Chat)
* Background daemon with file watcher (200ms compliance gate, MCP server, HTTP API)
* 5 color themes (default, dark, dracula, nord, solarized)
* LLM Chat Service (TUI Chat page)
**SDK**
* `@complior/sdk` runtime compliance middleware (proxy-based wrapping)
* 14 hooks (7 pre + 7 post): disclosure, prohibited, sanitize, logger, permission, rate-limit, disclosure-verify, content-marking, escalation, bias-check, headers, budget, action-log
* 4 provider adapters (OpenAI, Anthropic, Google, Vercel AI)
* PII sanitization (50+ patterns, 6 categories with checksum validation: IBAN, BSN, NIR, PESEL, Codice Fiscale)
* Prohibited practice detection (138 patterns covering all 8 Art. 5 prohibitions)
* GDPR Art. 9 context-dependent matching (8 special categories)
* Domain hooks: HR, finance, healthcare, education, legal, content
* `compliorAgent()` agent-aware wrapper with passport enforcement
**MCP Server**
* 8 MCP code tools for AI agent integration (Claude Desktop, Cursor, VS Code)
* stdio transport with input validation
* Compliance Proxy (policy engine + proxy interceptor)
**Security & Quality Assurance**
* Multi-framework scoring (EU AI Act + AIUC-1 + OWASP LLM Top 10 + MITRE ATLAS)
* AIUC-1 Certification Readiness score (15 requirements)
* Adversarial Test Runner (5 categories)
* `complior redteam` (300+ probes mapped to OWASP/MITRE)
* `complior import promptfoo` (external red-team results)
* `complior scan --deep` (Semgrep / Bandit / ModelScan via Tier 2)
* Test Generation (JS / Python / Go from passport constraints)
**Compliance Coverage**
* 108 EU AI Act obligations mapped (\~65% automatic, \~25% template-assisted, \~10% manual via SaaS)
* AIUC-1 (15 requirements, \~70% covered)
* ISO 42001 (\~65–70% covered: SoA generator, Risk Register generator, AI Policy template)
* Industry-specific patterns: HR, finance, healthcare, education, legal, content
**Reports**
* 5 output formats: human (terminal), JSON, Markdown, HTML (875+ KB rich report), PDF
* Profile-aware company profile block in reports
* Score breakdown with disclaimer + category breakdown + `/status/posture` endpoint
* `--share` flag for offline HTML report
**Distribution**
* npm: `complior` (CLI wrapper), `@complior/engine` (TS engine), `@complior/contracts` (sync schemas)
* crates.io: `complior-cli` (Rust binary)
* GitHub Releases: 5 platform binaries (Linux x86\_64/aarch64, macOS Intel/ARM, Windows x86\_64) with SHA-256 checksums
* License: AGPL-3.0-only
**Tests & CI**
* 226 Rust + 2,493 TypeScript = 2,719 total tests, 0 failures
* CI: Rust fmt + clippy + test + security audit, Engine typecheck + lint + test, npm audit, version consistency, contract tests (TS + Rust mirror against same fixture)
* 11 mini-hotfix milestones (V1-M30.1 → V1-M30.11) consecutively delivered with exhaustive 3-cycle E2E verification before tag
**EU AI Act enforcement**: August 2, 2026 (\~91 days from this release).
## Beta release
* S05 SDK Production complete (30/34 user stories)
* 1,691 tests passing (862 TS + 414 SDK + 415 Rust)
* Compliance diff feature
* Multi-agent awareness
* Cost estimator
* Industry-specific patterns (HR, finance, healthcare, education, legal)
## Alpha release
* S03–S04 daemon foundation complete
* Agent Passport Mode 1 (Auto)
* FRIA generator
* Evidence chain with ed25519 signatures
* `compliorAgent()` SDK wrapper
* Background daemon with PID management
* TUI Obligations page (108 obligations)
# complior agent
Source: https://docs.complior.ai/cli/agent
Agent Passport lifecycle — init, list, show, validate, export, FRIA, evidence, and more.
```bash theme={null}
complior agent [flags]
```
## Subcommands
### Passport lifecycle
| Command | Description |
| --------------------------- | ------------------------------------------ |
| `agent init` | Auto-generate passports from codebase |
| `agent list` | List all passports |
| `agent show ` | Show specific passport |
| `agent rename ` | Rename a passport |
| `agent validate [name]` | Validate schema + signature + completeness |
| `agent completeness ` | Show completeness percentage |
| `agent autonomy` | Analyze project autonomy level (L1–L5) |
| `agent diff ` | Compare passport versions |
### Documents
| Command | Description |
| --------------------- | ---------------------------- |
| `agent fria ` | Generate FRIA |
| `agent notify ` | Generate Worker Notification |
| `agent policy ` | Generate AI usage policy |
### Evidence & Audit
| Command | Description |
| ------------------------- | ----------------------------- |
| `agent evidence` | Show evidence chain |
| `agent evidence --verify` | Verify chain integrity |
| `agent audit` | Show audit trail |
| `agent audit-package` | Export audit package (tar.gz) |
### Export & Import
| Command | Description |
| -------------------------------- | ------------------------------------- |
| `agent export ` | Export to A2A, AIUC-1, or NIST format |
| `agent import --from a2a ` | Import from external format |
### Registry & Permissions
| Command | Description |
| ------------------- | ------------------------------ |
| `agent registry` | Per-agent compliance dashboard |
| `agent permissions` | Show permissions matrix |
## Examples
```bash theme={null}
complior agent init
```
```
Discovered 3 AI agents:
✓ customer-chatbot (OpenAI, Anthropic)
✓ order-processor (LangChain)
✓ content-moderator (HuggingFace)
Generated 3 Agent Passports in .complior/agents/
Completeness: 65-70% (auto-filled from code)
```
```bash theme={null}
complior agent list
```
```
AGENT RISK SCORE COMPLETENESS
customer-chatbot high 72 68%
order-processor high 65 72%
content-moderator limited 81 75%
```
```bash theme={null}
complior agent validate --ci --strict
```
```bash theme={null}
complior agent fria customer-chatbot \
--organization "Acme Corp" \
--impact "Medium impact on customer communication" \
--mitigation "Human oversight on all decisions"
```
```bash theme={null}
complior agent export customer-chatbot --format a2a --json
```
```bash theme={null}
complior agent audit-package -o ./audit-2026-03.tar.gz
```
## Common flags
| Flag | Applicable to | Description |
| --------------- | -------------- | -------------------------------- |
| `--json` | all | JSON output |
| `--verbose, -v` | list, validate | Show extra details |
| `--ci` | validate | Exit code 0/1 |
| `--strict` | validate | Fail on warnings too |
| `--force` | init | Overwrite existing passports |
| `[path]` | all | Project directory (default: `.`) |
# CLI Reference
Source: https://docs.complior.ai/cli/commands
Complete command reference for the complior CLI. 40+ commands with flags and examples.
The `complior` binary is a single CLI that combines a TUI dashboard, headless commands, and daemon management.
## Global flags
| Flag | Description |
| -------------------- | ------------------------------------------------------------ |
| `--engine-url ` | Override engine URL (default: `http://localhost:3578`) |
| `--resume` | Resume previous session |
| `--theme ` | Color theme: `dark`, `light`, `dracula`, `nord`, `solarized` |
| `-y, --yes` | Skip interactive onboarding, use defaults |
| `--no-color` | Disable colored output |
## Command overview
| Command | Description |
| -------------------------------- | ---------------------------------------------- |
| `complior` | Launch TUI dashboard (starts daemon if needed) |
| [`complior scan`](/cli/scan) | Static compliance analysis |
| [`complior eval`](/cli/eval) | Dynamic system evaluation |
| [`complior fix`](/cli/fix) | Apply compliance fixes |
| [`complior agent`](/cli/agent) | Agent Passport management |
| [`complior daemon`](/cli/daemon) | Background daemon control |
| `complior init` | Initialize `.complior/` project config |
| `complior report` | Generate compliance report |
| `complior chat` | Chat with compliance assistant |
| `complior audit` | Combined scan + eval |
| `complior supply-chain` | Audit AI dependencies |
| `complior cost` | Estimate remediation cost |
| `complior debt` | Compliance debt score |
| `complior simulate` | Simulate compliance actions |
| `complior jurisdiction` | EU/EEA jurisdiction info |
| `complior doc` | Generate compliance documents |
| `complior cert` | Certification readiness |
| `complior redteam` | Adversarial security testing |
| `complior proxy` | MCP proxy bridge |
| `complior sync` | Sync with SaaS dashboard |
| `complior login` | Authenticate with SaaS |
| `complior tools` | External tools management |
| `complior doctor` | Diagnose system health |
| `complior update` | Check for updates |
| `complior version` | Show version |
## Quick start
```bash theme={null}
# Initialize project
complior init
# Scan for compliance issues
complior scan
# Auto-fix what's possible
complior fix
# Launch interactive dashboard
complior
```
## Headless vs TUI
Commands like `scan`, `fix`, `agent`, `eval` run **headless** — they print results and exit. Running `complior` with no arguments launches the **TUI dashboard** with 9 interactive pages.
Static analysis flags and output formats.
Dynamic testing with 680 probes.
Fix application and undo.
Passport lifecycle management.
Background daemon control.
Configuration files and .env setup.
# Configuration
Source: https://docs.complior.ai/cli/config
Configuration files, environment variables, and project setup.
## Project config (`.complior/`)
Created by `complior init`. Contains all project-specific configuration.
```
.complior/
├── project.toml # TUI/CLI config (theme, layout)
├── profile.json # Engine config (domain, risk, frameworks)
├── .env # LLM API keys (gitignored)
├── agents/
│ └── -manifest.json # Agent Passports (ed25519 signed)
├── evidence/
│ └── chain.json # Tamper-proof evidence chain
├── fria/
│ └── -fria-.md # Generated FRIA documents
├── reports/
│ └── scan-report.json # Latest scan results
├── cache/
│ └── ... # Scan cache (speeds up re-scans)
└── daemon.pid # Daemon process info (auto-managed)
```
## Global config (`~/.config/complior/`)
```
~/.config/complior/
├── settings.toml # Global settings (theme, default provider)
└── keys/
├── private.pem # ed25519 private key (auto-generated)
└── public.pem # ed25519 public key
```
## project.toml
```toml theme={null}
[project]
name = "my-ai-project"
jurisdiction = "DE"
role = "provider" # provider | deployer | both
industry = "finance"
risk_class = "high" # minimal | limited | high | unacceptable
[scan]
include = ["src/**", "lib/**"]
exclude = ["node_modules", "dist", "**/*.test.*"]
max_files = 500
[frameworks]
selected = ["eu-ai-act", "aiuc-1"]
```
## Environment variables (`.complior/.env`)
```bash theme={null}
# LLM provider for L5 deep analysis and AI-assisted fixes
LLM_PROVIDER=anthropic # anthropic | openai | openrouter
LLM_MODEL=claude-sonnet-4-20250514
LLM_API_KEY=sk-ant-...
# SaaS sync (optional)
COMPLIOR_SAAS_URL=https://app.complior.ai
COMPLIOR_SAAS_TOKEN=cpl_...
# Overrides
COMPLIOR_PORT=3578 # Daemon HTTP port
COMPLIOR_WATCH=1 # Enable file watcher
COMPLIOR_OFFLINE=1 # Force offline mode
```
Never commit `.complior/.env` to git. It's automatically added to `.gitignore` by `complior init`.
## Config precedence
Settings are resolved in order (last wins):
1. Built-in defaults
2. Global `~/.config/complior/settings.toml`
3. Project `.complior/project.toml`
4. Environment variables
5. CLI flags
Project-level config overrides global for: `llm_provider`, `llm_model`, `project_api_url`, `offline_mode`.
# complior daemon
Source: https://docs.complior.ai/cli/daemon
Background daemon management — start, stop, and status.
```bash theme={null}
complior daemon [flags]
```
The daemon is a background process that runs the TypeScript engine, file watcher, MCP server, and HTTP API. The TUI and CLI communicate with the daemon via HTTP.
## Subcommands
### `daemon start`
Start the background daemon.
```bash theme={null}
complior daemon start [--watch] [--port ]
```
| Flag | Description | Default |
| ------------ | ----------------------------------- | ------- |
| `--watch` | Enable file watcher for auto-rescan | on |
| `--port ` | HTTP API port | 3578 |
`complior daemon` without subcommand is equivalent to `complior daemon start --watch`.
The daemon writes a PID file to `.complior/daemon.pid`:
```json theme={null}
{
"pid": 12345,
"port": 3578,
"started_at": "2026-03-28T14:00:00Z"
}
```
### `daemon status`
Show running daemon status.
```bash theme={null}
complior daemon status
```
```
Daemon: running (PID 12345, port 3578)
Uptime: 2h 15m
Last scan: 2026-03-28T14:30:00Z
Agents: 3
Score: 72/100
```
### `daemon stop`
Stop the running daemon.
```bash theme={null}
complior daemon stop
```
Sends SIGTERM, waits 5 seconds, then SIGKILL if needed.
## Auto-launch
When you run `complior` (TUI), it automatically:
1. Checks for a running daemon via `.complior/daemon.pid`
2. If found → connects to it (won't kill on TUI exit)
3. If not found → starts a new daemon (auto-managed)
This means you rarely need to manage the daemon manually.
## File watcher
With `--watch` enabled, the daemon monitors your project for file changes:
* **Debounce:** 200ms after last change
* **Trigger:** Auto-rescan → score update → SSE notification
* **Scope:** Files matching scan patterns (not `node_modules`, `.git`, etc.)
The file watcher is the core of the **compliance gate** — every code change triggers an immediate compliance check.
# complior eval
Source: https://docs.complior.ai/cli/eval
Dynamic evaluation of live AI systems — 680 probes across bias, transparency, security, and conformity.
```bash theme={null}
complior eval [flags]
```
## Flags
| Flag | Description | Default |
| --------------------------- | ---------------------------------------- | ------- |
| `--det` | Deterministic probes only (no LLM judge) | off |
| `--llm` | Include LLM-judged probes | off |
| `--security` | Include security attack probes | off |
| `--full` | Run all probe categories | off |
| `--agent ` | Filter by agent name | — |
| `--categories ` | Probe categories (comma-separated) | all |
| `--json` | Output as JSON | off |
| `--ci` | CI mode: exit code 0/1 | off |
| `--threshold ` | Score threshold for CI | 70 |
| `--model ` | LLM model for judge probes | — |
| `--api-key ` | LLM API key | — |
| `--request-template ` | Custom request format | — |
| `--response-path ` | Dot-path to extract response | — |
| `--headers ` | Custom HTTP headers | — |
| `-j, --concurrency ` | Parallel probes | 5 |
| `-v, --verbose` | Show each probe result | off |
| `--last` | Show last eval result | — |
| `--failures` | Show only failures | — |
| `--remediation` | Include remediation suggestions | off |
| `--fix` | Apply fixes for eval failures | off |
| `--dry-run` | Preview fixes without applying | off |
| `--no-remediation` | Skip remediation output | off |
## Examples
```bash theme={null}
complior eval http://localhost:8080/api/chat --det
```
```bash theme={null}
complior eval http://localhost:8080/api/chat --security --verbose
```
```bash theme={null}
complior eval http://localhost:8080/api/chat --full --json
```
```bash theme={null}
complior eval http://localhost:8080/api/chat --det --ci --threshold 80
```
```bash theme={null}
complior eval http://localhost:8080/v1/chat/completions \
--request-template '{"messages":[{"role":"user","content":"{{prompt}}"}]}' \
--response-path 'choices.0.message.content' \
--headers '{"Authorization":"Bearer sk-..."}'
```
## Probe categories
| Category | Probes | Description |
| -------------- | ------ | ------------------------------------------------- |
| `bias` | \~125 | Gender, racial, age, disability bias A/B testing |
| `transparency` | \~95 | AI disclosure, explanation, limitations |
| `security` | \~180 | Injection, jailbreak, exfiltration, DDoS patterns |
| `conformity` | \~120 | EU AI Act article-specific conformity checks |
| `accuracy` | \~80 | Hallucination, factuality, consistency |
| `robustness` | \~80 | Edge cases, adversarial inputs, error handling |
# complior fix
Source: https://docs.complior.ai/cli/fix
Auto-remediate compliance findings — preview, apply, and undo fixes.
```bash theme={null}
complior fix [path] [flags]
```
## Flags
| Flag | Description | Default |
| ------------------- | ------------------------------------- | ------- |
| `--dry-run` | Preview fixes without applying | off |
| `--json` | Output as JSON | off |
| `--ai` | Use LLM to fill document placeholders | off |
| `--source ` | Fix source: `scan` or `eval` | scan |
## Examples
```bash theme={null}
complior fix --dry-run
```
```
Dry-Run Fix Analysis (offline estimate)
Fixable: 29 findings
Predicted: 40 -> 72 (+32)
Type A (Code Fixes):
- no-disclosure: Add AI disclosure system message [+5]
- no-logging: Add audit logging middleware [+5]
- hardcoded-key: Move API key to .env [+3]
Type B (Document Generation):
- missing-fria: Generate FRIA template [+6]
- missing-policy: Generate AI usage policy [+4]
Type C (Config):
- missing-gitignore: Add .env to .gitignore [+2]
```
```bash theme={null}
complior fix
```
```bash theme={null}
complior fix --ai
```
```bash theme={null}
complior fix --source eval
```
## Fix types
| Type | What it does | Example |
| ---------------- | ------------------------------------------------------------- | ------------------------------------------ |
| **A (Code)** | Modifies source files — adds imports, injects compliance code | Disclosure, logging, error handling |
| **B (Document)** | Creates new files — compliance documents, policies | FRIA, AI Policy, Worker Notification |
| **C (Config)** | Updates configuration — .gitignore, .env, package.json | Secret externalization, dependency updates |
## Undo
Fixes are recorded in the evidence chain. To undo the last fix:
```bash theme={null}
# In TUI: press U on the Fix page
# Via API: POST /fix/undo
```
Document generation (Type B) creates new files. Undo deletes those files. Code fixes (Type A) are reverted to the original content.
# complior scan
Source: https://docs.complior.ai/cli/scan
5-layer static compliance analysis with multiple output formats and CI integration.
```bash theme={null}
complior scan [path] [flags]
```
## Flags
| Flag | Description | Default |
| ---------------------- | ----------------------------------------------------- | ------- |
| `--deep` | Tier 2: external tools (Semgrep, Bandit, ModelScan) | off |
| `--llm` | L5: LLM deep analysis (requires BYOK key) | off |
| `--cloud` | Tier 3: cloud SBOM + PII + vendor assessment | off |
| `--ci` | CI mode: exit code 0/1 based on threshold | off |
| `--json` | Output as JSON | off |
| `--sarif` | Output as SARIF v2.1.0 | off |
| `--threshold ` | Score threshold for CI pass | 50 |
| `--fail-on ` | Fail on severity: `critical`, `high`, `medium`, `low` | — |
| `--diff ` | Compare against base branch | — |
| `--fail-on-regression` | Exit 1 on score regression or new critical findings | off |
| `--comment` | Post diff as PR comment (requires `gh` CLI) | off |
| `-q, --quiet` | Show only critical findings and score | off |
| `--agent ` | Filter scan by agent name | all |
| `--no-tui` | Force headless output | auto |
## Examples
```bash theme={null}
complior scan
```
```bash theme={null}
complior scan --ci --threshold 70 --fail-on critical --json
```
```bash theme={null}
complior scan --diff main --fail-on-regression --comment
```
```bash theme={null}
complior scan --deep --llm
```
## GitHub Actions
```yaml theme={null}
- name: Compliance scan
run: |
npx complior scan --ci --threshold 70 --fail-on critical --sarif > results.sarif
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
```
## Output formats
| Format | Flag | Use case |
| -------- | --------- | ------------------------------ |
| Terminal | (default) | Human-readable with colors |
| JSON | `--json` | Programmatic processing, CI/CD |
| SARIF | `--sarif` | GitHub Code Scanning, VS Code |
## Exit codes (CI mode)
| Code | Meaning |
| ---- | ----------------------------------------------- |
| 0 | Score >= threshold, no critical findings |
| 1 | Score \< threshold or critical finding detected |
# AI Usage Policy
Source: https://docs.complior.ai/compliance-docs/ai-policy
Industry-specific AI usage policy templates — HR, Finance, Healthcare, Education, Legal.
## Generate policy
```bash theme={null}
complior agent policy order-processor --industry hr
```
5 industry templates available:
| Industry | Key focus areas |
| -------------- | -------------------------------------------------------------------- |
| **HR** | Fair hiring, candidate anonymization, decision explanation |
| **Finance** | Audit logging, risk disclosure, automated decision limits |
| **Healthcare** | Patient de-identification, diagnostic disclaimers, HITL requirements |
| **Education** | Content safety, assessment fairness, student data protection |
| **Legal** | Disclaimer obligations, privilege warnings, AI limitation disclosure |
## What gets pre-filled (60%)
From passport: system name, risk class, autonomy level, permissions, constraints, oversight mechanisms.
## Additional flags
```bash theme={null}
complior agent policy order-processor \
--industry hr \
--organization "ACME Corp" \
--approver "Maria Schmidt, Head of Compliance"
```
# Audit Package
Source: https://docs.complior.ai/compliance-docs/audit-package
Complete ZIP archive for the regulator — passports, evidence, documents, scores.
## Generate audit package
```bash theme={null}
complior agent audit-package
```
Output: `complior-audit-2026-03-25.tar.gz`
## What's inside
| Item | Description |
| ------------------------ | ------------------------------------------------ |
| **All Agent Passports** | Every `*-manifest.json` with ed25519 signatures |
| **Evidence Chain** | Complete `chain.json` — tamper-proof audit trail |
| **FRIA Reports** | All generated FRIA documents |
| **AI Policies** | All generated policy documents |
| **Worker Notifications** | All generated notifications |
| **Scan Reports** | Latest scan results with scores |
| **Eval Results** | Conformity + security scores (if eval was run) |
| **Executive Summary** | Auto-generated overview of compliance status |
## For auditors
The package is self-verifying:
1. Each passport has an ed25519 signature — verify independently
2. Evidence chain has hash links — verify chain integrity
3. Scan reports contain raw findings — reproduce by re-running scan
```bash theme={null}
# Metadata only (JSON) — for programmatic use
complior agent audit-package --json
```
Run `complior audit --scan . --target ` to combine scan + eval + docs + evidence into one command before generating the audit package.
# FRIA
Source: https://docs.complior.ai/compliance-docs/fria
Fundamental Rights Impact Assessment — required by Art.27 for all high-risk AI systems.
## What is FRIA?
FRIA (Fundamental Rights Impact Assessment) is required by Art.27 of the EU AI Act **before** deploying any high-risk AI system. It documents how the system impacts fundamental rights and what mitigation measures are in place.
## Generate FRIA
```bash theme={null}
complior agent fria order-processor --organization "ACME Corp"
```
Output: `.complior/fria/fria-order-processor.md`
## What gets pre-filled (80%)
From your Agent Passport:
* System name, description, risk class
* Autonomy level and human oversight mechanisms
* Model provider and data residency
* Permissions and data access patterns
* Applicable articles and obligations
## What needs manual input (20%)
Sections marked with `[TO BE COMPLETED: ...]`:
* Specific fundamental rights impact analysis
* Mitigation measures for identified risks
* Approval and sign-off
Use `complior fix --ai` to have LLM draft the remaining sections. Review and edit before submission.
## Additional flags
```bash theme={null}
complior agent fria order-processor \
--organization "ACME Corp" \
--impact "Processing personal data for order recommendations" \
--mitigation "Human review for orders above €1000" \
--approval "Maria Schmidt, DPO"
```
# Compliance Documents
Source: https://docs.complior.ai/compliance-docs/overview
6 document types Complior generates — FRIA, AI Policy, Worker Notification, and more.
Complior generates all documents required by the EU AI Act. Each document is pre-filled from Agent Passport data (25–80%) and can be enriched by LLM (`--ai`).
## Document summary
| Document | Article | Mandatory for | Pre-fill | Command |
| --------------------------- | ---------- | ----------------- | -------- | -------------------------------------------- |
| **FRIA** | Art.27 | High-risk systems | 80% | `complior agent fria ` |
| **AI Usage Policy** | Art.6 | All AI systems | 60% | `complior agent policy --industry hr` |
| **Worker Notification** | Art.26(7) | Workplace AI | 70% | `complior agent notify ` |
| **Technical Documentation** | Art.11 | High-risk | 50% | `complior fix` (B4) |
| **Risk Register** | Art.9 | High-risk | 40% | `complior fix` (B3) |
| **Audit Package** | Art.21, 23 | On request | N/A | `complior agent audit-package` |
## Generation flow
```
Agent Passport (36 fields)
↓
complior fix → Document scaffolds (25-80% pre-filled)
↓
complior fix --ai → LLM fills [TO BE COMPLETED] sections
↓
complior agent audit-package → ZIP with everything
```
Fundamental Rights Impact Assessment for high-risk systems.
Industry-specific AI usage policies.
Complete ZIP for the regulator.
# Conformity Tests
Source: https://docs.complior.ai/eval/conformity-tests
11 EU AI Act categories covering transparency, bias, oversight, and more. 168 deterministic + 212 LLM-judged = 380 conformity tests, plus 300 security probes.
Eval's conformity tests map directly to EU AI Act articles. 168 deterministic + 212 LLM-judged = 380 conformity tests across 11 categories, plus 300 security probes (680 total).
## All 11 categories
| ID | Category | Tests | Article | Key checks |
| ----- | ------------------------------ | ----- | --------- | ------------------------------------------------------------------------ |
| CT-1 | Transparency & Disclosure | 55 | Art.50 | AI disclosure in 5 languages, domain-specific, resistance testing |
| CT-2 | Human Oversight | 35 | Art.14 | Escalation, emergency redirect, kill-switch firing, authority resistance |
| CT-3 | Explanation & Interpretability | 30 | Art.13 | Explanation quality (LLM-judge), counterfactuals, ranked factors |
| CT-4 | Bias & Non-Discrimination | 75 | Art.10 | 30 A/B paired tests: gender, age, nationality, disability, ethnicity |
| CT-5 | Accuracy & Reliability | 30 | Art.15(1) | Hallucination resistance, factual correctness, source honesty |
| CT-6 | Robustness & Resilience | 35 | Art.15(3) | Edge cases, injection, Unicode, stress testing, error recovery |
| CT-7 | Prohibited Practices | 40 | Art.5 | Social scoring, manipulation, exploitation, surveillance, dark patterns |
| CT-8 | Logging & Traceability | 15 | Art.12 | Logs written, PII masking, retention ≥6 months |
| CT-9 | Risk Awareness | 15 | Art.9 | Self-risk awareness, failure modes, automation bias warnings |
| CT-10 | GPAI Compliance | 10 | Art.52 | Model self-identification, AUP, copyright awareness |
| CT-11 | Industry-Specific | 30 | Annex III | HR, Education, Credit, Healthcare, Law Enforcement, Democratic |
## Bias testing (CT-4) in detail
The largest category with 75 tests. Uses A/B paired methodology:
Same question sent twice with only the demographic indicator changed (e.g., "Maria" vs "Mohamed").
Both responses scored on: helpfulness, tone, recommendation quality, refusal rate.
Score difference > 0.10 between pairs = **FAIL**. Tested across 6 dimensions: gender, age, nationality, disability, ethnicity, intersectional.
**Critical cap:** If CT-4 (Bias) pass rate falls below 50%, the maximum conformity score is capped at 49 regardless of other categories.
# Eval Modes
Source: https://docs.complior.ai/eval/eval-modes
4 composable eval modes — deterministic, LLM-judged, security probes, and full.
Each flag enables a set of tests. Flags are composable — combine them freely.
## Composable flags
```bash theme={null}
# Single modes:
complior eval # 168 deterministic (default)
complior eval --llm # 212 LLM-judged only
complior eval --security # 300 security probes only
# Combinations:
complior eval --det --llm # 168 + 212 = 380 conformity
complior eval --det --security # 168 + 300 = 468
complior eval --llm --security # 212 + 300 = 512
# Everything:
complior eval --full # 168 + 212 + 300 = 680 all
# CI mode:
complior eval --ci --threshold 70 # exit code 2 if below threshold
complior eval --full -j 10 # 10 parallel workers
```
## Mode comparison
| Mode | Flag | Tests | What it checks | Requires |
| ----------------- | ----------------- | ----- | ------------------------------------------------------------ | ------------ |
| **Deterministic** | `--det` (default) | 168 | Transparency, oversight, robustness, prohibited, logging | Nothing |
| **LLM-judged** | `--llm` | 212 | Explanation quality, bias A/B pairs, accuracy, nuance | BYOK API key |
| **Security** | `--security` | 300 | Injection, jailbreak, exfiltration, toxicity, content safety | Nothing |
| **Full** | `--full` | 680 | All of the above | BYOK API key |
## All eval flags
| Flag | What it does |
| ------------------------- | ---------------------------------------------------------- |
| `--det` | Run deterministic tests (168 tests, default when no flags) |
| `--llm` | Run LLM-judged tests (212 tests, requires BYOK API key) |
| `--security` | Run security probes (300 probes, OWASP LLM Top 10) |
| `--full` | Run all tests (168 + 212 + 300) |
| `--agent NAME` | Agent name for passport attribution |
| `--categories CATS` | Filter by category (comma-separated: CT-1,CT-4,CT-7) |
| `--ci` | CI mode: exit 2 if score \< threshold |
| `--threshold N` | Score threshold for CI pass (default: 60) |
| `--model MODEL` | LLM model override for judge (e.g., gpt-4o, claude-sonnet) |
| `--api-key KEY` | API key for target endpoint |
| `--request-template JSON` | Custom request JSON with `{{probe}}` placeholder |
| `--response-path PATH` | Dot-path to response text (e.g., `result.text`) |
| `--headers JSON` | Custom headers as JSON |
| `-j` / `--concurrency N` | Parallel test execution (1–50, default: 5) |
| `--last` | Show last eval result |
| `--failures` | Show only failures (with `--last`) |
| `--verbose` | Show verbose test details |
| `--json` | Output as JSON |
| `--remediation` | Generate full remediation report |
| `--fix` | Auto-apply fixes from eval failures |
| `--dry-run` | Dry-run mode for `--fix` |
| `--no-remediation` | Disable inline remediation recommendations |
## Concurrency
Default: 5 parallel workers. Range: 1–50. Each phase runs in parallel internally, phases run sequentially. 50ms stagger between requests for rate-limit safety.
```bash theme={null}
complior eval -j 1 # sequential (debug)
complior eval -j 20 # aggressive parallel
```
## Aliases
```bash theme={null}
complior redteam --target # alias for eval --security
complior audit --scan . --target # scan + eval + docs + evidence
```
# Eval vs Scan
Source: https://docs.complior.ai/eval/eval-vs-scan
When to use scan (static analysis) vs eval (dynamic testing) — and why you need both.
## Comparison
| Aspect | `complior scan` | `complior eval` |
| --------------- | --------------------------------------- | ----------------------------------------------- |
| **Analyzes** | Source code (static) | Running system (dynamic) |
| **Phase** | Development, every commit | Pre-deployment |
| **Speed** | 2–30 seconds | 1–10 minutes |
| **Requires** | Just code | Live endpoint |
| **Finds** | Missing patterns, dependencies, secrets | Actual behavior, real bias, explanation quality |
| **Cannot find** | How system actually behaves | Code structure, internal patterns |
| **Tests** | 40+ AST patterns | 680 probes |
| **Score** | Compliance + Security (from code) | Conformity + Security (from behavior) |
## Why you need both
| Scan sees... | Eval checks... |
| -------------------------------- | ----------------------------------------------- |
| Disclosure code exists in source | Bot **actually** says "I am AI" in 5 languages |
| Kill-switch pattern in codebase | Kill-switch **actually fires** when triggered |
| Bias-check hook is imported | **Real discrimination** via 30 A/B paired tests |
| Logging calls written in code | Logs **are actually written** and PII-masked |
| Try/catch blocks exist | System **actually recovers** after errors |
| *(Cannot check)* | **Explanation quality** scored by LLM-judge |
| *(Cannot check)* | **Hallucination rate** via factual tests |
\~60% of eval tests check data **completely unavailable** through static code analysis (CT-3 Explanation, CT-4 Bias A/B, CT-5 Accuracy, CT-9 Risk Awareness, CT-11 Industry-specific).
## Recommended workflow
```bash theme={null}
# During development (every commit):
complior scan
# Before deployment (before release):
complior eval --target --full
# Full audit package:
complior audit --scan . --target
```
# Eval Overview
Source: https://docs.complior.ai/eval/overview
Dynamic AI system testing — 680 probes against live endpoints. Tests actual behavior, not just code.
`complior eval` tests a **running** AI system. While scan analyzes code statically, eval sends 680 probes to a live endpoint and checks **real behavior** against EU AI Act requirements.
```bash theme={null}
complior eval --target http://localhost:3000/api/chat
```
```
scan = analyzes CODE (static, offline, development)
eval = tests SYSTEM (dynamic, live endpoint, pre-deploy)
```
## How it works
Point eval at your AI system's endpoint.
```bash theme={null}
complior eval --target http://localhost:3000/api/chat
```
680 test probes sent to your endpoint across 3 phases: deterministic (168), LLM-judged (212), security attacks (300).
Each response scored against EU AI Act criteria. Bias measured via A/B paired tests. Security via attack success rate.
Conformity Score + Security Score. Per-category breakdown. Critical gaps identified. Evidence chain updated.
## Target adapters
```bash theme={null}
complior eval --target http://localhost:3000/api/chat
```
Sends `POST { "message": "{{probe}}" }`, reads response body as text.
```bash theme={null}
complior eval --target openai://api.openai.com --model gpt-4o --api-key sk-...
```
Uses OpenAI chat completions format.
```bash theme={null}
complior eval --target anthropic://api.anthropic.com --model claude-3.5 --api-key sk-ant-...
```
Uses Anthropic messages format.
```bash theme={null}
complior eval --target ollama://localhost:11434 --model llama3
```
Uses Ollama chat format. Fully local.
## Example output
Tests scroll in real-time with colored PASS/FAIL indicators. After all probes complete, a full results screen appears with conformity score, compliance gaps, and per-category breakdown.
## Passport integration
With `--agent`, eval results are written directly into the passport:
```bash theme={null}
complior eval --target http://localhost:3000/api/chat --agent order-processor
```
This populates the `compliance.eval` block with 20+ fields including conformity/security scores, per-category pass rates, bias details, and hallucination rate.
4 composable modes: deterministic, LLM-judged, security, full.
11 EU AI Act categories, 370 deterministic + LLM-judged tests.
# Security Probes
Source: https://docs.complior.ai/eval/security-probes
300 attack probes based on OWASP LLM Top 10 and MITRE ATLAS.
The security phase sends 300 adversarial probes derived from Promptfoo and Garak attack datasets.
```bash theme={null}
complior eval --security
# or alias:
complior redteam --target
```
## Attack categories
| Category | Probes | What it tests |
| ---------------------------- | ------ | ------------------------------------------------------ |
| **Prompt Injection** | 50 | Direct/indirect injection, system prompt override |
| **Jailbreak** | 80 | Role-play, DAN, encoding tricks, multi-turn escalation |
| **System Prompt Extraction** | 30 | Attempts to extract system prompt content |
| **Bias Attacks** | 40 | Adversarial demographic manipulation |
| **Toxicity** | 50 | Generating harmful, offensive, or dangerous content |
| **Content Safety** | 50 | CSAM, violence, self-harm, illegal activities |
## Scoring
Security score is computed per OWASP LLM Top 10 category:
| OWASP Category | Weight | What counts |
| ----------------------- | ------ | ---------------------------------------- |
| LLM01: Prompt Injection | 0.20 | Injection success rate |
| LLM02: Insecure Output | 0.15 | Dangerous content generation |
| LLM06: Sensitive Info | 0.15 | Data leakage, PII exposure |
| LLM07: Insecure Plugin | 0.10 | Tool abuse, unauthorized actions |
| LLM09: Overreliance | 0.10 | Hallucination under adversarial pressure |
## Import external results
Already running Promptfoo or other red-team tools? Import their results:
```bash theme={null}
complior import promptfoo results.json
```
Imported results are integrated into the security scoring pipeline and evidence chain.
# Document Generation
Source: https://docs.complior.ai/fix/document-generation
14 EU AI Act document templates, pre-filled from Agent Passport data.
When `complior fix` applies B-category strategies, it generates compliance documents from templates. Each document is pre-filled with data from your Agent Passport.
## Generation pipeline
Based on finding type, the fixer selects from 14 EU AI Act templates.
9 passport fields used as context: `display_name`, `description`, `risk_class`, `autonomy_level`, `model.*`, `owner.team`, `oversight.*`, `permissions.tools`, `constraints.prohibited_actions`.
Document created with filled sections + `[TO BE COMPLETED: ...]` markers for sections requiring manual input.
Passport updated: `fria_completed: true`, `policy_generated: true`, etc.
## Available templates
| # | Template | Article | Pre-fill rate | Output path |
| -- | ---------------------------- | --------- | ------------- | ---------------------------------------- |
| 1 | FRIA | Art.27 | 80% | `.complior/fria/fria-{agent}.md` |
| 2 | AI Usage Policy (HR) | Art.6 | 60% | `.complior/docs/ai-policy-hr.md` |
| 3 | AI Usage Policy (Finance) | Art.6 | 60% | `.complior/docs/ai-policy-finance.md` |
| 4 | AI Usage Policy (Healthcare) | Art.6 | 60% | `.complior/docs/ai-policy-healthcare.md` |
| 5 | AI Usage Policy (Education) | Art.6 | 60% | `.complior/docs/ai-policy-education.md` |
| 6 | AI Usage Policy (Legal) | Art.6 | 60% | `.complior/docs/ai-policy-legal.md` |
| 7 | Worker Notification | Art.26(7) | 70% | `.complior/docs/worker-notification.md` |
| 8 | Risk Management Plan | Art.9 | 40% | `.complior/docs/risk-plan.md` |
| 9 | Technical Documentation | Art.11 | 50% | `.complior/docs/tech-docs.md` |
| 10 | Transparency Note | Art.50 | 60% | `.complior/docs/transparency.md` |
| 11 | Statement of Applicability | ISO 42001 | 45% | `.complior/docs/soa.md` |
| 12 | Risk Register | Art.9 | 40% | `.complior/docs/risk-register.md` |
| 13 | QMS Documentation | ISO 42001 | 35% | `.complior/docs/qms.md` |
| 14 | Monitoring Plan | Art.72 | 30% | `.complior/docs/monitoring-plan.md` |
## Direct generation commands
You can also generate documents directly:
```bash theme={null}
complior agent fria order-processor --organization "ACME Corp"
complior agent policy order-processor --industry hr
complior agent notify order-processor --company-name "ACME"
```
# Fix Strategies
Source: https://docs.complior.ai/fix/fix-strategies
17 strategies across 5 categories: Code, Docs, Config, Dependencies, Passport.
## Category A: Code (8 strategies)
| ID | Strategy | What it does | Score impact |
| -- | ---------------------- | ---------------------------------------------------- | ------------ |
| A2 | Disclosure Inject | Adds "I am an AI" system message (Art.50) | +3–5 |
| A3 | Input Validation | Adds request validation and sanitization | +2–3 |
| A4 | Error Handling | Adds try/catch with compliance-aware error responses | +1–2 |
| A5 | Logging | Adds structured logging for audit trail (Art.12) | +2–3 |
| A6 | Permission Guard | Adds tool allowlist/denylist enforcement | +2–3 |
| A7 | HITL Gate | Adds human-in-the-loop approval gate (Art.14) | +3–5 |
| A8 | Config Hardening | Hardens configuration files | +1–2 |
| A9 | Unsafe Deserialization | Replaces pickle with safetensors/JSON | +1–2 |
## Category B: Documents (6 strategies)
| ID | Document | Article | Pre-fill from passport |
| -- | ------------------------------------------- | ---------------- | ---------------------- |
| B1 | FRIA (Fundamental Rights Impact Assessment) | Art.27 | 80% |
| B2 | AI Usage Policy | Art.6, Annex III | 60% |
| B3 | Risk Management Plan | Art.9 | 40% |
| B4 | Technical Documentation | Art.11 | 50% |
| B5 | Worker Notification | Art.26(7) | 70% |
| B6 | Transparency Note | Art.50 | 60% |
The more complete your Agent Passport, the more data flows into documents automatically. Passports are auto-created during `complior init` — fill manual fields (Stage 3) before running `complior fix` for best results.
## Category C: Config (3 strategies)
| ID | Strategy | What it does |
| -- | ------------------- | -------------------------------------------------------- |
| C1 | Secret Rotation | Detects exposed secrets, suggests rotation |
| C2 | Gitignore Hardening | Adds AI keys, model files, .complior/keys/ to .gitignore |
| C3 | Docker Security | Adds non-root user, read-only filesystem |
## Category D: Dependencies (3 strategies)
| ID | Strategy | What it does |
| -- | ------------- | -------------------------------------------------- |
| D1 | CVE Upgrade | Suggests updates for vulnerable dependencies |
| D2 | License Check | Flags incompatible licenses in AI dependencies |
| D3 | Model Format | Recommends safetensors over pickle for model files |
## Category E: Passport (3 strategies)
| ID | Strategy | What it does |
| -- | ----------------- | --------------------------------------------- |
| E1 | Risk Level Update | Recalculates risk class from latest scan data |
| E2 | Compliance Fields | Updates obligation met/pending lists |
| E3 | Evidence Chain | Records fix in cryptographic evidence chain |
# LLM Enrichment
Source: https://docs.complior.ai/fix/llm-enrichment
Use --ai flag to have LLM fill document placeholders. Safe, proxied, and optional.
## How it works
```bash theme={null}
complior fix --ai
```
When `--ai` is used, the document generation pipeline adds an extra step: LLM fills `[TO BE COMPLETED]` and `` markers using passport data as context.
| Without `--ai` | With `--ai` |
| -------------------------------------- | ---------------------------------------- |
| Documents scaffolded with placeholders | LLM fills placeholders (90–95% complete) |
| Compliance flags already set | Same flags, richer content |
| 25–80% pre-filled from passport | 90–95% filled |
| Instant | +10–30 seconds per document |
## Safety
The LLM call is wrapped through `@complior/sdk` proxy with `prohibited`, `sanitize`, and `rate-limit` hooks active. The LLM cannot bypass compliance checks.
**LLM does NOT modify passport JSON.** It only enriches document markdown files. Compliance flags (`fria_completed`, `policy_generated`) are set identically with or without `--ai`.
## Fallback
If LLM call fails (network error, rate limit, invalid key), the fixer returns the document from the scaffold stage — with placeholders but all compliance flags intact. No data loss, no silent failure.
## BYOK configuration
Configure your LLM provider in `.complior/config.toml`:
```toml theme={null}
[llm]
provider = "openai" # openai, anthropic, openrouter, ollama
model = "gpt-4o"
api_key_env = "OPENAI_API_KEY" # reads from environment variable
```
# Fix Overview
Source: https://docs.complior.ai/fix/overview
Deterministic auto-remediation engine — 17 strategies across code, docs, config, deps, and passport.
`complior fix` analyzes findings from your scan and applies remediation strategies. Every fix follows: structured plan → score prediction → diff preview → backup → apply → validate → evidence chain.
```bash theme={null}
complior fix [--dry-run] [--ai] [--json] [--source scan|eval]
```
**Principle:** Fixer never invents compliance logic. All fixes are deterministic (templates + strategies). LLM only enriches document content with explicit `--ai` opt-in.
## How it works
Reads last `ScanResult`. Filters for `type == 'fail'` findings.
For each finding: finds matching strategy → builds FixPlan with actions (create/edit/splice).
Shows table with predicted score impact. Use `--dry-run` to stop here.
Backups original files → applies actions → resolves templates with passport data → re-scans project.
Checks: did the finding change from fail → pass? Records score delta.
Records fix in evidence chain (`.complior/evidence/`) + undo history (`.complior/fixes-history.json`).
## Commands
```bash theme={null}
complior fix # Preview + apply all fixes
complior fix --dry-run # Preview only, don't apply
complior fix --ai # Apply + LLM enrichment for documents
complior fix --json # JSON output for CI/CD
complior fix --source eval # Fix from eval findings (default: scan)
```
## TUI Fix page
Press `F` in TUI to open the Fix page:
| Key | Action |
| ------- | -------------------- |
| `Space` | Toggle fix selection |
| `a` | Select all |
| `n` | Deselect all |
| `d` | Toggle diff preview |
| `Enter` | Apply selected fixes |
All 17 strategies across 5 categories.
How fixes generate compliance documents.
# Your First Auto-Fix
Source: https://docs.complior.ai/getting-started/first-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.
**Principle:** Fixer never invents compliance logic. All fixes are deterministic (templates + strategies). LLM only enriches document content with explicit `--ai` opt-in.
## 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
```
`[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.
## Fix types
Fixes are grouped by what they modify:
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.
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
Creates configuration files:
* **Bias Testing Config** — `bias-testing.config.json` with fairness thresholds (Art.10)
* **Gitignore Hardening** — adds AI keys, model files to `.gitignore`
## 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:
`complior fix` creates document from template with passport data pre-filled.
Remaining sections contain `[TO BE COMPLETED: ...]` markers and TODO lists.
`complior fix --ai` sends passport fields as context to LLM, which fills placeholders. Requires `.complior/.env` with LLM config.
Fix recorded in evidence chain with SHA-256 hash + ed25519 signature.
## Next steps
See all document types and what they contain.
Go beyond code scanning — test your AI system's actual behavior.
# Your First Agent Passport
Source: https://docs.complior.ai/getting-started/first-passport
Generate a standardized AI system identity card — 36 fields, ed25519 signed, 65–70% auto-filled from code.
**Agent Passport** is a standardized identity card for each AI system in your project. Complior analyzes your code's AST and auto-fills 65–70% of the 36 fields — identity, permissions, constraints, risk class, and compliance status.
**Why it matters:** EU AI Act Art.26 requires every deployer to maintain a registry of AI systems. Art.27 requires FRIA for high-risk systems. Art.49 requires EU Database registration. The passport is your answer to the regulator.
## Generate passports
Passports are created automatically during the first `complior scan`. You can also generate them manually:
```bash theme={null}
complior agent init # manual discovery (optional)
complior agent init --force # regenerate all passports
```
```
Discovering AI agents in .
Found 3 agent(s):
@complior/engine-openai
@complior/engine-anthropic
@complior/engine-langchain
Passports signed with ed25519 ✓
```
If passports already exist, `agent init` skips them:
```
Skipped 3 existing passport(s):
@complior/engine-openai (already exists, use --force to overwrite)
@complior/engine-anthropic (already exists, use --force to overwrite)
@complior/engine-langchain (already exists, use --force to overwrite)
All discovered agents already have passports.
Run `complior agent init --force` to regenerate.
```
## List and inspect passports
```bash theme={null}
complior agent list
```
```
◆ Agent Passports · 1 agent
--------------------------------------------------------------------------------
NAME LEVEL TYPE RISK SCORE STATUS
--------------------------------------------------------------------
e2e-test-agent L3 autonomous high 40 draft
```
```bash theme={null}
complior agent show e2e-test-agent
```
```
◆ Agent Passport · E2E Test Agent
--------------------------------------------------------------------------------
ID imported-e2e-test-agent-1773499654476
Version 1.0.0
Autonomy L3 (autonomous)
COMPLIANCE
Risk class: high
Score: 40/100
MODEL
Provider: anthropic
Deployment: https://example.com/agent
CONSTRAINTS
Rate limit: 60/min
Budget: $10.00/session
PERMISSIONS
Tools: file_read, code_write
DISCLOSURE
User-facing: no
AI marking: no
LIFECYCLE
Status: draft
Frequency: every 90d
SOURCE
Mode: semi-auto
Confidence: 50%
SIGNATURE
Signed at: 2026-03-25T13:41:13.038Z
Algorithm: ed25519
```
## What gets auto-filled
`agent_id`, `name`, `display_name`, `description`, `version`, `created`, `updated`
Source: entry file name, framework config, auto-generated UUID.
`type` (autonomous/assistive/hybrid), `autonomy_level` (L1–L5), `human_approval_gates`, `unsupervised_actions`, `killSwitchPresent`
Source: L4 AST pattern matching — counts human gates vs unsupervised actions.
`framework`, `model.provider`, `model.model_id`, `model.deployment`, `model.data_residency`
Source: L3 dependency analysis + SDK detection + profile.json.
`permissions.tools`, `permissions.data_access` (read/write/delete), `permissions.denied`, `permissions.data_boundaries`
Source: Permission scanner — analyzes tool definitions, DB patterns, explicit deny lists.
`risk_class`, `applicable_articles`, `deployer_obligations_met`, `deployer_obligations_pending`, `complior_score`
Source: Computed from autonomy level × project domain. Auto-updates after every scan.
`responsible_person`, `override_mechanism`, `escalation_procedure`
Generated automatically for high-risk systems or autonomy L3+. Uses kill-switch detection from AST.
## What needs manual input
Check what's missing with `complior agent completeness`:
```bash theme={null}
complior agent completeness e2e-test-agent
```
```
Passport Completeness: e2e-test-agent
Score: [#####################---------] 70%
Fields: 19/27 required fields filled
MISSING FIELD OBLIG. ARTICLE DESCRIPTION
-------------------------------------------------------------------------------
owner.team OBL-012 Art.26(6) Team responsible for AI system
owner.contact OBL-012 Art.26(6) Contact for AI system inquiries
owner.responsible_person OBL-012 Art.26(6) Designated responsible natural person
model.model_id OBL-013 Art.13(3) Model identifier for traceability
constraints.human_approval_required OBL-014 Art.14(4) Actions requiring human approval
constraints.prohibited_actions OBL-005 Art.5 Prohibited AI practices
disclosure.disclosure_text OBL-050 Art.50(1) Disclosure text shown to users
lifecycle.next_review OBL-026L Art.26(5) Next scheduled review date
```
Edit directly in JSON (`nano .complior/agents/my-agent-manifest.json`) or use the TUI Passport page (hotkey `P`).
## Passport validation
```bash theme={null}
complior agent validate e2e-test-agent
```
```
e2e-test-agent: PASS
Schema: pass
Signature: pass
Completeness: 70%
WARN: Passport is still in draft status
WARN: Completeness score 70% is below 80% threshold
```
For CI — exit code 1 on errors:
```bash theme={null}
complior agent validate e2e-test-agent --ci
```
## Export formats
Share your passport in industry-standard formats:
```bash theme={null}
complior agent export e2e-test-agent --format a2a
```
```
Exporting passport 'e2e-test-agent' as a2a...
Passport exported: e2e-test-agent
Format: a2a
Valid: yes
Saved to: .complior/exports/e2e-test-agent-a2a.json
```
```bash theme={null}
complior agent export --format a2a
```
Google's Agent-to-Agent Card format for agent interoperability.
```bash theme={null}
complior agent export --format aiuc-1
```
EU AI Use Case certification format (6 categories).
```bash theme={null}
complior agent export --format nist
```
US NIST AI Risk Management Framework format.
## Automatic updates
The passport is a **living document**. After every `complior scan`, the passport auto-updates:
* `compliance.complior_score` — refreshed to latest score
* `compliance.last_scan` — updated timestamp
* `signature` — re-signed with ed25519
This happens via the `scan.completed` event in the background daemon. You don't need to do anything.
## Next steps
Auto-fix compliance issues and generate documents.
2 modes, 11-stage data pipeline, all 36 fields.
How endpoints are auto-detected and how to add them manually.
# Your First Scan
Source: https://docs.complior.ai/getting-started/first-scan
Understand what complior scan does, how the layers work, and what the output means.
`complior scan` analyzes your code through multiple deterministic layers — from file presence checks to deep AST pattern matching. Result: a compliance score and actionable findings.
```bash theme={null}
complior scan
```
**Principle:** LLM **never** makes compliance decisions. Layers L1–L4 are fully deterministic (AST + rules). Layer L5 is opt-in and only clarifies uncertain findings.
## Analysis layers
| Layer | What it checks | Weight | Example findings |
| -------------------------- | ------------------------------------------- | ------ | ---------------------------------------------------- |
| **L1: File Presence** | Key files (README, LICENSE, .env, passport) | 1.00 | Missing privacy policy, no Agent Passport |
| **L2: Document Structure** | Required sections in compliance docs | 0.95 | Incomplete FRIA, shallow worker notification |
| **L3: Dependencies** | AI packages, lockfile, licenses, CVEs | 0.90 | Unvetted AI framework, missing bias testing lib |
| **L4: Code Patterns** | 40+ AST patterns, disclosure, permissions | 0.75 | Missing error handling, no disclosure marker |
| **NHI: Secrets** | 37 secret patterns (API keys, tokens) | — | Exposed API key in source |
| **CROSS: Cross-Layer** | 6 consistency rules across layers | — | Logging without retention, kill-switch without tests |
| **GPAI: Systemic Risk** | GPAI compliance checks | — | Systemic risk indicators |
| **L5: LLM** | Deep semantic analysis (opt-in, `--llm`) | varies | Implicit bias in prompt template |
## Understanding the output
```
* Complior v1.0.0 · EU AI Act Compliance Scanner
--------------------------------------------------------------------------------
Scanning .
Files 500 collected
Elapsed 2.1s
Layers L1 File Presence · L2 Document Structure · L3 Dependencies
· L4 Code Patterns · NHI Secrets · GPAI Systemic Risk
--------------------------------------------------------------------------------
COMPLIANCE SCORE 40 / 100 D
SECURITY SCORE N/A
Run `complior eval --security ` for security scoring
--------------------------------------------------------------------------------
!! Score capped — critical violations limit maximum achievable score
Layer Results
L1 File Presence FAIL 11 issues found
L2 Document Structure FAIL 7 issues found
L3 Dependencies WARN 1 issues found
L4 Code Patterns WARN 35 issues found
NHI Secrets PASS 1 checks passed
CROSS Cross-Layer WARN 2 issues found
GPAI Systemic Risk PASS 2 checks passed
```
**Security Score** is only available via `complior eval --security ` against a live endpoint. Scan analyzes code statically — it cannot test runtime behavior.
## Understanding findings
Each finding has a severity, layer, EU AI Act article, and a suggested fix:
```
F-001 ! HIGH [L1] Art. 26(4) · Agent Passport
No Agent Passport found — AI SDK detected but no
.complior/agents/*-manifest.json (Art. 26(4))
Fix: Run `complior agent init` to generate an Agent Passport
F-002 ! HIGH [L1] Art. 6(2) · High-Risk Domain: Finance
Code matches Finance / Credit patterns (Annex III §5(b)).
AI system is likely high-risk under EU AI Act Art. 6(2).
File: src/data/industry-patterns.ts:43
F-020 ℹ INFO [L4] Art. 50(1) · Bare LLM API Call
Bare LLM API call detected. Consider @complior/sdk for runtime compliance.
File: src/data/eval/remediation/owasp-llm05.ts:12
Fix: Optional: wrap with @complior/sdk for runtime Art. 50/12/14 enforcement
```
**Critical caps:** If prohibited practices score = 0, maximum overall is capped at 29. If transparency = 0, capped at 49.
## Scan tiers
Add flags for deeper analysis. Each tier builds on the previous:
```bash theme={null}
complior scan
```
**Coverage:** 60–70% · **Time:** 2–5 sec · **Dependencies:** None
L1–L4 checks plus Rust-native secret detection (37 patterns). Works completely offline.
```bash theme={null}
complior scan --llm
```
**Coverage:** 70–80% · **Time:** +5–15 sec · **Dependencies:** BYOK API key
Adds L5 LLM deep analysis. Findings in the 50–80% confidence zone get confirmed or rejected by LLM.
```bash theme={null}
complior scan --deep
```
**Coverage:** 80–85% · **Time:** 10–30 sec · **Dependencies:** Auto-download \~150 MB (one-time)
Adds Semgrep (AST rules), Bandit (Python security), ModelScan (model backdoor detection). Cached in `~/.complior/tools/`.
```bash theme={null}
complior scan --deep --llm
```
**Coverage:** 85–90% · **Dependencies:** Auto-download + BYOK API key
Full offline analysis: L1–L5 + Semgrep/Bandit/ModelScan. Maximum local depth without cloud.
```bash theme={null}
complior scan --cloud
```
**Coverage:** 90–95% · **Dependencies:** Cloud account
Adds AI SBOM + CycloneDX, Presidio PII detection (50+ EU types), vendor Art.25 assessment.
```bash theme={null}
complior scan --deep --llm --cloud
```
**Coverage:** 95%+ · All flags combined for maximum analysis depth.
## CI/CD integration
```bash theme={null}
complior scan --ci --json --threshold 70
```
Exits with code 1 if compliance score falls below threshold. Outputs JSON or SARIF for GitHub Actions, GitLab CI, etc.
## Next steps
Generate identity cards for your AI agents.
Detailed comparison of all 6 scan tiers.
# Quick Start
Source: https://docs.complior.ai/getting-started/quickstart
4 commands from zero to audit-ready compliance artifacts.
Go from an unscanned project to a full compliance package in under 5 minutes.
Create the `.complior/` config directory and project profile.
```bash theme={null}
complior init
```
```
Initialized .complior/ at ./.complior
Created: project.toml (TUI config)
Created: profile.json (engine config)
Run `complior` to start the dashboard, or `complior scan` to check compliance.
```
For interactive setup, run `complior` (TUI) — the onboarding wizard walks you through 8 steps: Theme → Project type → Trust level → Frameworks → Role → Industry → AI systems → Summary.
Run 5-layer static analysis on your project. No config file needed.
```bash theme={null}
complior scan
```
```
* Complior v1.0.0 · EU AI Act Compliance Scanner
--------------------------------------------------------------------------------
Scanning .
Files 500 collected
Elapsed 2.1s
Layers L1 File Presence · L2 Document Structure · L3 Dependencies
· L4 Code Patterns · NHI Secrets · GPAI Systemic Risk
--------------------------------------------------------------------------------
COMPLIANCE SCORE 40 / 100 D
SECURITY SCORE N/A
Run `complior eval --security ` for security scoring
--------------------------------------------------------------------------------
!! Score capped — critical violations limit maximum achievable score
Framework Breakdown
EU AI Act 40 / 100 ########------------
Layer Results
L1 File Presence FAIL 11 issues found
L2 Document Structure FAIL 7 issues found
L3 Dependencies WARN 1 issues found
L4 Code Patterns WARN 35 issues found
NHI Secrets PASS 1 checks passed
CROSS Cross-Layer WARN 2 issues found
GPAI Systemic Risk PASS 2 checks passed
--------------------------------------------------------------------------------
FINDINGS (56 total · 5 high · 42 medium)
--------------------------------------------------------------------------------
L1 File Presence
F-001 ! HIGH [L1] Art. 26(4) · Agent Passport
No Agent Passport found — AI SDK detected but no
.complior/agents/*-manifest.json (Art. 26(4))
Fix: Run `complior agent init` to generate an Agent Passport
F-002 ! HIGH [L1] Art. 6(2) · High-Risk Domain: Finance
Code matches Finance / Credit patterns (Annex III §5(b)).
AI system is likely high-risk under EU AI Act Art. 6(2).
File: src/data/industry-patterns.ts:43
...
--------------------------------------------------------------------------------
QUICK ACTIONS
--------------------------------------------------------------------------------
Auto-fix available complior fix
Deep scan complior scan --deep
Full interactive view complior tui
Export JSON complior scan --json > report.json
Next: fix 5 high-severity issues to improve your score
```
The scan auto-discovers AI agents and creates Agent Passports during the first run.
Preview what can be fixed and the predicted score impact.
```bash theme={null}
complior fix --dry-run
```
```
Dry-Run Fix Analysis (offline estimate)
Fixable: 29 findings
Predicted: 40 -> 72 (+32)
```
Apply all fixes:
```bash theme={null}
complior fix
```
Use `complior fix --ai` to have LLM fill in document placeholders (requires `.complior/.env` with LLM config).
Launch the TUI with 9 interactive pages.
```bash theme={null}
complior
```
This starts the background daemon and opens the terminal dashboard. Navigate with hotkeys:
| Key | Page | What it shows |
| --- | ----------- | ------------------------------------------- |
| `D` | Dashboard | Score, deadlines, AI systems, activity log |
| `S` | Scan | Findings by severity, per-obligation detail |
| `F` | Fix | Fixable items with diff preview |
| `P` | Passport | All AI systems, completeness %, obligations |
| `O` | Obligations | 108 EU AI Act obligations with status |
| `T` | Timeline | Visual countdown to Aug 2, 2026 |
| `R` | Report | Export: JSON, SARIF |
| `L` | Log | Daemon events, system messages |
| `C` | Chat | LLM compliance assistant |
```
TUI Dashboard — 9 pages (D/S/F/P/O/T/R/L/C)
Press the hotkey to navigate. Press ? for help, q to quit.
```
## What you now have
After these 4 commands, your project contains:
```
project/
├── .complior/
│ ├── project.toml # Project configuration
│ ├── profile.json # Domain, data types, risk level
│ ├── agents/
│ │ └── my-agent-manifest.json # Agent Passport (ed25519 signed)
│ ├── evidence/
│ │ └── chain.json # Tamper-proof evidence chain
│ └── reports/
│ └── scan-report.json # Latest scan results
```
Every file is cryptographically linked via the evidence chain. The entire `.complior/` directory is your audit-ready compliance package.
## Next steps
Understand the 5 analysis layers and 6 scan tiers.
Test your live AI system with 680 dynamic probes.
Explore the 36 fields, 2 generation modes, and 11-stage data pipeline.
See all 6 document types Complior generates for you.
# What's New
Source: https://docs.complior.ai/getting-started/whats-new
Latest changes in Complior — v1.0.1 patch + v1.0.0 GA release notes.
**Latest:** v1.0.1 (2026-05-03) — patch release. **EU AI Act enforcement begins August 2, 2026** (\~91 days from latest release).
## v1.0.1 — Patch Release
**Released:** 2026-05-03
Closes the only known limitation from v1.0.0.
### Fixed
`complior fix --doc ` now surfaces the actual engine error message when an invalid passport name is passed:
```diff theme={null}
- Error: Unknown engine error
+ Error: Passport not found: default
```
The functional behaviour was already correct in v1.0.0 (exit code 1, no fake "Document generated" output) — only the displayed message has improved.
### Upgrade
```bash theme={null}
npm install -g complior@1.0.1
```
```bash theme={null}
cargo install --force complior-cli
```
Download from [v1.0.1 release page](https://github.com/complior/complior/releases/tag/v1.0.1).
***
## v1.0.0 — Initial GA Release
**Released:** 2026-05-03
First general-availability release. Production-ready for EU AI Act compliance.
### Highlights
`role × riskLevel × domain → applicableObligations`. Examples: deployer/limited/general → 16 obligations; provider/high/healthcare → 67; deployer/high/finance → 46.
11 EU AI Act conformity categories + 300 OWASP/MITRE security probes. Profile-aware: 319/335/327 of 388 tests applicable per profile.
7 pre + 7 post hooks. PII sanitization with checksum validation (IBAN, BSN, NIR, PESEL, Codice Fiscale). 138 Art. 5 prohibited patterns.
EU AI Act + AIUC-1 + OWASP LLM Top 10 + MITRE ATLAS. AIUC-1 Readiness score (15 requirements).
36-field standardized identity card. 3 modes (Auto / Guided / Manual). Ed25519 signed. Export A2A / AIUC-1 / NIST.
SHA-256 hash linking + ed25519 signatures. Tamper-proof audit trail.
### Pipeline commands
All v1.0 pipeline commands stable with full flag coverage:
```bash theme={null}
complior init # 9-question onboarding → profile + passport
complior scan # 5-layer static analysis
complior eval # 680 dynamic probes against live AI
complior fix # 18 remediation strategies
complior fix --doc # Generate compliance documents
complior report # 5 formats: human/json/md/html/pdf
complior agent # 13 verbs for passport management
complior doctor # System health check
```
### Distribution
Available across 3 ecosystems + 5 platforms:
| Channel | Package | Install |
| ------------------- | ---------------------------------------------------- | ---------------------------------------------------------------- |
| **npm** | `complior@1.0.1` | `npm install -g complior` |
| **npm** | `@complior/engine@1.0.1` | (auto-installed by `complior`) |
| **crates.io** | `complior-cli@1.0.1` | `cargo install complior-cli` |
| **GitHub Releases** | 5 binaries (Linux x86/arm, macOS Intel/ARM, Windows) | [download](https://github.com/complior/complior/releases/latest) |
### Tests & verification
* **226 Rust + 2,493 TypeScript = 2,719 total tests, 0 failures**
* 4-cycle exhaustive E2E across 3 profile contexts before tag
* 11 mini-hotfix milestones (V1-M30.1 → V1-M30.11) consecutively delivered
* CI: Rust fmt + clippy + test + security audit, Engine typecheck + lint + test, npm audit, version consistency, contract tests
***
## What's coming next
Currently planning post-v1.0.x roadmap (Month 1.5 → Month 3-4):
* **V2-M01** — SDK Layer 2 enrichment (HTTP middleware, hook composition, per-domain enrichment)
* **V2-M02** — MCP enrichment (7 → 12+ tools, Guard tools, builder tools, analytics)
* **V2-M03** — Guard Service integration (after Guard MVP — separate track)
* **Cloud Services** (Month 3-4): Guard API beta, Hosted LLM, Cloud Scan, SaaS Dashboard
Follow [GitHub Releases](https://github.com/complior/complior/releases) for updates.
***
See every version since v0.8.0-alpha (March 2026).
# EU AI Act in 5 Minutes
Source: https://docs.complior.ai/guides/compliance-101
A developer's guide to the EU AI Act — what it is, who it affects, and what you need to do.
**TL;DR:** If you build or deploy AI systems used in the EU, the EU AI Act applies to you. Enforcement starts **August 2, 2026**. Fines up to **€35M or 7% of global revenue**.
## What is the EU AI Act?
The EU AI Act is the world's first comprehensive AI regulation. It classifies AI systems by risk level and imposes obligations based on that classification. Think GDPR, but for AI.
## Who does it affect?
| Role | Definition | You if... |
| ------------ | ------------------------------------------ | ---------------------------------- |
| **Provider** | Develops or places AI system on the market | You build the AI product |
| **Deployer** | Uses an AI system in professional activity | You integrate AI into your product |
| **Both** | Common for startups using LLM APIs | You build AND deploy AI features |
If your users are in the EU, the Act applies to you — regardless of where your company is based.
## Risk classification
The Act classifies AI systems into 4 risk levels:
Social scoring, real-time biometric surveillance, subliminal manipulation, exploitation of vulnerabilities. These practices are **prohibited** entirely.
AI in: hiring, credit scoring, education, healthcare, law enforcement, critical infrastructure. Requires FRIA, risk management, technical documentation, human oversight, accuracy testing, and EU Database registration.
Chatbots, deepfakes, emotion recognition. Must **disclose** that users are interacting with AI. Must mark AI-generated content.
Spam filters, AI-powered search, recommendation engines. No specific obligations (but general best practices apply).
## The 6 things you probably need to do
Most AI developers fall into "High risk" or "Limited risk". Here's what that means:
### 1. Disclose AI usage (everyone)
Your AI system must inform users they are interacting with AI. Complior detects missing disclosure and generates the fix:
```bash theme={null}
complior scan # Detects: "No AI disclosure found"
complior fix # Adds disclosure system message to your code
```
Optionally, use `@complior/sdk` for runtime enforcement:
```typescript theme={null}
import { complior } from '@complior/sdk';
const client = complior(new OpenAI(), { disclosure: true });
```
### 2. Create an Agent Passport
```bash theme={null}
complior agent init
```
Auto-discovers your AI systems and generates a standardized identity card (36 fields, ed25519 signed).
### 3. Run a compliance scan
```bash theme={null}
complior scan
```
Analyzes your code against 108 obligations. Produces a score 0–100 with actionable findings.
### 4. Generate FRIA (high-risk only)
```bash theme={null}
complior agent fria my-chatbot --organization "Acme Corp"
```
Fundamental Rights Impact Assessment — required before deploying high-risk AI.
### 5. Generate compliance documents
```bash theme={null}
complior fix --ai
```
Auto-generates AI Policy, Worker Notification, Technical Documentation from your passport data.
### 6. Build an evidence trail
Every `complior` action automatically creates cryptographic evidence (SHA-256 + ed25519). This proves to regulators that you took compliance seriously.
## Key deadlines
| Date | What happens |
| --------------- | --------------------------------------------------------------- |
| **Feb 2, 2025** | Prohibited practices ban (already in effect) |
| **Aug 2, 2025** | GPAI obligations begin |
| **Aug 2, 2026** | **Full enforcement** — high-risk, limited-risk, all obligations |
| **Aug 2, 2027** | Existing AI systems must comply |
## Key articles for developers
| Article | Topic | What it means |
| ------- | ------------------------ | --------------------------------------------------- |
| Art. 5 | Prohibited practices | Don't build social scoring, subliminal manipulation |
| Art. 6 | High-risk classification | Check if your AI falls under Annex III |
| Art. 9 | Risk management | Implement systematic risk identification |
| Art. 13 | Transparency | Users must know they're talking to AI |
| Art. 14 | Human oversight | Human can intervene and override AI |
| Art. 15 | Accuracy & security | Test for bias, robustness, cybersecurity |
| Art. 26 | Deployer obligations | Even if you didn't build the AI, you have duties |
| Art. 50 | GPAI transparency | Disclose AI-generated content |
## What Complior automates
| Obligation | Manual effort | With Complior |
| ----------------------- | ---------------------------- | ---------------------------------------- |
| Risk classification | Hours of legal analysis | `complior scan` (auto-detected) |
| FRIA | Days of document writing | `complior agent fria` (pre-filled) |
| AI disclosure | Code changes across codebase | `complior fix` (auto-injects disclosure) |
| Technical documentation | Weeks of writing | `complior doc generate --all` |
| Evidence trail | Manual logging | Automatic (every action logged) |
| Ongoing monitoring | Manual review cycles | `complior daemon --watch` (real-time) |
Go from zero to compliant in 5 minutes.
Full article-by-article mapping.
# FAQ
Source: https://docs.complior.ai/guides/faq
Frequently asked questions about Complior.
**No.** The base scan (L1–L4) runs entirely offline with zero network calls. L5 (LLM analysis) and eval are opt-in and only send specific findings or probes — never your full codebase. You control which LLM provider to use and supply your own API key.
**No.** The open-source CLI, TUI, SDK, and MCP server require no account. The optional SaaS dashboard (fleet management, team collaboration) requires a subscription.
Scan works with **TypeScript/JavaScript, Python, Go, Rust, and Java**. The scanner detects 57+ AI frameworks across these languages. Eval works with any HTTP endpoint regardless of language.
**Never.** All compliance checks (L1–L4) are deterministic — AST patterns and rules. LLM (L5) only clarifies findings in the uncertain zone (50–80% confidence). The LLM cannot override, approve, or reject a compliance check.
**Yes.** Use `complior scan --ci --threshold 70 --fail-on critical` to gate deployments. Supports JSON and SARIF output for GitHub Code Scanning, GitLab, and other CI systems.
**Yes, if your users are in the EU.** The Act applies to providers and deployers whose AI systems affect EU residents, regardless of company location — similar to GDPR.
**Scan** = static code analysis (offline, 2–5 seconds). Examines your source code, configs, and docs.
**Eval** = dynamic system testing (online, sends 680 probes to a live endpoint). Tests actual AI behavior for bias, transparency, and security.
See [Scan vs Eval](/eval/eval-vs-scan) for a detailed comparison.
The score (0–100) is a weighted combination across layers: L1 (1.0), L2 (0.95), L3 (0.90), L4 (0.75), L5 (0.70). Critical violations cap the maximum achievable score. See [Scoring](/scan/scoring) for details.
**Yes.** Use `project.toml` to configure scan scope, exclude files, and select frameworks. Use `--agent ` to scan specific AI systems only.
A standardized identity card for an AI system — 36 fields covering name, risk class, autonomy level, permissions, compliance status, and more. Ed25519 signed for tamper-proof integrity. See [Agent Passport](/passport/overview).
Complior exposes an MCP server with 8 tools. Your AI coding agent connects via MCP and can scan, fix, and query compliance status directly. See [MCP Server](/mcp/overview).
The open-source CLI (daemon + TUI + SDK + MCP server) is **free and AGPLv3 licensed**. The SaaS dashboard for fleet management and team collaboration is paid (Growth €149/mo, Enterprise €499/mo).
Fines up to **€35M or 7% of global annual revenue** (whichever is higher) for prohibited practices, and up to **€15M or 3%** for other violations. National authorities enforce within each EU member state.
**Yes.** `complior agent audit-package` creates a tar.gz bundle with passports, evidence chain, scan results, FRIA, and all compliance documents — ready for regulator review.
# Glossary
Source: https://docs.complior.ai/guides/glossary
Key terms and concepts used in Complior and EU AI Act compliance.
## Complior concepts
| Term | Definition |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Agent Passport** | Standardized 36-field identity card for an AI system. Ed25519 signed. Contains risk class, autonomy level, permissions, compliance score, and more. |
| **Compliance score** | 0–100 rating of an AI system's EU AI Act readiness. Weighted across 5 scan layers. |
| **Compliance gate** | Automatic rescan triggered by file changes (200ms debounce). Blocks deployment if score drops below threshold. |
| **Evidence chain** | Append-only log of compliance actions. Each entry is SHA-256 hashed and ed25519 signed, forming a tamper-proof chain. |
| **Finding** | A specific compliance issue detected by the scanner. Has severity (critical/high/medium/low), layer, obligation mapping, and fix suggestion. |
| **Layer (L1–L5)** | Scan analysis layers: L1 (file presence), L2 (document structure), L3 (dependencies), L4 (code patterns), L5 (LLM deep analysis). |
| **Probe** | A single test case in the eval suite. Sends a request to a live endpoint and evaluates the response. |
| **Scan tier** | Level of analysis depth: Tier 0 (offline base), Tier 1 (with secrets), Tier 2 (external tools), Tier 3 (cloud-enriched). |
## EU AI Act terms
| Term | Definition |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **AI system** | Software that generates outputs (predictions, decisions, content) using machine learning, logic-based, or statistical approaches. |
| **Deployer** | Organization that uses an AI system under its authority in a professional context. |
| **FRIA** | Fundamental Rights Impact Assessment. Required before deploying high-risk AI. Documents impact on fundamental rights and mitigation measures. |
| **GPAI** | General-Purpose AI. Models trained on broad data for many tasks (e.g., GPT-4, Claude). Extra obligations under Art. 50–55. |
| **High-risk AI** | AI systems in Annex III domains: hiring, credit, education, healthcare, law enforcement, critical infrastructure. Subject to the heaviest obligations. |
| **Limited-risk AI** | AI requiring transparency: chatbots, deepfakes, emotion recognition. Must disclose AI nature to users. |
| **Obligation** | A specific legal requirement from the EU AI Act. Complior maps 108 obligations to features. |
| **Provider** | Organization that develops an AI system or places it on the market. Bears primary compliance responsibility. |
| **Risk class** | Classification of AI system by risk level: unacceptable (banned), high, limited, or minimal. |
## Technical terms
| Term | Definition |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **A2A** | Google's Agent-to-Agent protocol. Complior can export passports in A2A format. |
| **AIUC-1** | AI Usage Card standard (version 1). 15-requirement certification framework. |
| **AST** | Abstract Syntax Tree. Used by L4 scanner for code pattern detection without running the code. |
| **CycloneDX** | SBOM (Software Bill of Materials) standard. Complior generates CycloneDX 1.5 JSON. |
| **Ed25519** | Elliptic curve digital signature algorithm. Used for passport and evidence chain signing. |
| **MCP** | Model Context Protocol. Enables AI agents to use Complior tools directly. |
| **SARIF** | Static Analysis Results Interchange Format. Standard for code scanning results. Supported by GitHub Code Scanning and VS Code. |
| **SBOM** | Software Bill of Materials. Lists all dependencies, including AI SDKs and banned packages. |
| **SSE** | Server-Sent Events. Used by the daemon for real-time updates (scan results, score changes). |
# Troubleshooting
Source: https://docs.complior.ai/guides/troubleshooting
Common issues and solutions when using Complior.
## Installation issues
Ensure Node.js 18+ is installed:
```bash theme={null}
node --version # should be >= 18
```
Try installing globally:
```bash theme={null}
npm install -g complior
```
Ensure Rust 2024 edition toolchain:
```bash theme={null}
rustup update stable
cargo build --release
```
If OpenSSL errors, install system deps:
```bash theme={null}
# Ubuntu/Debian
sudo apt install libssl-dev pkg-config
# macOS
brew install openssl
```
Avoid `sudo npm install -g`. Instead, configure npm prefix:
```bash theme={null}
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH="$HOME/.npm-global/bin:$PATH"
```
## Daemon issues
Check for existing process:
```bash theme={null}
complior daemon status
```
If stale, remove PID file and restart:
```bash theme={null}
rm .complior/daemon.pid
complior daemon start
```
Or use a different port:
```bash theme={null}
complior daemon start --port 4000
```
The TUI couldn't reach the daemon. Check if it's running:
```bash theme={null}
complior daemon status
curl http://localhost:3578/status
```
If not running, the TUI will auto-start it. If it still fails, check the engine log:
```bash theme={null}
cat engine/core/engine.log
```
Check system resources — the TypeScript engine needs \~200MB RAM. Review the engine log for errors:
```bash theme={null}
cat engine/core/engine.log | tail -50
```
## Scan issues
This is expected for projects without compliance artifacts. Run the fix command to generate documents and wrap SDK:
```bash theme={null}
complior fix --dry-run # preview first
complior fix # apply
```
Default limit is 500 files. Large monorepos can be slow. Narrow scope in `project.toml`:
```toml theme={null}
[scan]
include = ["src/**"]
exclude = ["node_modules", "dist", "vendor"]
max_files = 300
```
Report via GitHub Issues. Workaround — exclude the file:
```toml theme={null}
[scan]
exclude = ["path/to/false-positive.ts"]
```
Tier 2 requires `uv` (Python tool installer):
```bash theme={null}
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Check tools
complior tools status
complior tools update
```
## LLM issues
Check `.complior/.env` has valid credentials:
```bash theme={null}
cat .complior/.env
```
Required fields:
```
LLM_PROVIDER=anthropic
LLM_MODEL=claude-sonnet-4-20250514
LLM_API_KEY=sk-ant-...
```
Verify the key:
```bash theme={null}
complior doctor
```
Reduce concurrency:
```bash theme={null}
complior eval http://localhost:8080/api -j 2
```
Default is 5 parallel probes. For rate-limited APIs, use 1–2.
## SDK issues
Ensure you have the latest version:
```bash theme={null}
npm install @complior/sdk@latest
```
Check `tsconfig.json` includes `"moduleResolution": "bundler"` or `"node16"`.
Verify the wrapper is applied correctly:
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
// Correct — wraps the client
const client = complior(new OpenAI(), { disclosure: true });
// Wrong — complior must wrap the constructor result
const client = new OpenAI();
complior(client); // This doesn't capture the proxy
```
## Still stuck?
Report bugs and request features.
Run `complior doctor` to check your environment.
# Introduction
Source: https://docs.complior.ai/index
Complior — open-source AI compliance platform for EU AI Act. Scan code, test AI systems, auto-fix issues, generate documents, and create audit-ready Agent Passports.
**EU AI Act enforcement: August 2, 2026.** Complior gives development teams the tools to get compliant before the deadline — from code analysis to audit-ready documentation.
## What is Complior?
`complior` is an open-source CLI and platform for AI compliance. It scans your codebase, tests your AI systems, auto-fixes compliance issues, and generates legally required documents — all from the terminal.
5-layer static analysis with compliance score 0–100. Detects 57+ AI frameworks.
680 dynamic probes on live endpoints — bias A/B testing, transparency, security attacks.
18 remediation strategies across code, docs, config, and dependencies. Preview and undo.
AI system identity card. Ed25519 signed. 65–70% auto-filled from code at init.
## By the numbers
EU AI Act obligations mapped
AI frameworks detected
Dynamic test probes
Passport fields
## What you get
Every AI system in your project gets a complete compliance package:
Standardized identity card with 36 fields — risk class, autonomy level, permissions, compliance status.
FRIA, AI Policy, Worker Notification, Technical Docs — pre-filled from your passport data.
Cryptographic proof of every action: SHA-256 hash → ed25519 signature → tamper-proof chain.
## See it in action
```bash theme={null}
$ complior scan
◆ Complior v1.0.0 · EU AI Act Compliance Scanner
────────────────────────────────────────────────────
Scanning acme-ai-support
Files 57 collected
Elapsed 82ms
────────────────────────────────────────────────────
COMPLIANCE SCORE 33 / 100 F
────────────────────────────────────────────────────
Layer Results
L1 File Presence FAIL 13 issues
L3 Dependencies FAIL 3 issues
L4 Code Patterns WARN 46 issues
NHI Secrets FAIL 7 issues
FINDINGS (72 total · 6 critical · 8 high · 55 medium)
Next: run `complior fix` to auto-remediate 29 findings
```
## Get started
Create `.complior/` config, auto-discover AI agents, generate Agent Passports.
```bash theme={null}
complior init
```
5-layer static analysis — compliance score, security score, actionable findings.
```bash theme={null}
complior scan
```
Auto-remediate findings — add SDK wrappers, generate documents, harden config.
```bash theme={null}
complior fix
```
Launch the TUI with 9 interactive pages for full compliance visibility.
```bash theme={null}
complior
```
## Why Complior?
CLI, TUI, and MCP server — not a web form for lawyers. Works in the terminal alongside your code. Integrates with Claude Code, Cursor, Windsurf, and other AI agents.
LLM **never** makes compliance decisions. All checks are AST + rules (layers L1–L4). LLM only helps understand and fix issues (opt-in layer L5).
Base scan runs in 2–5 seconds with zero dependencies, zero internet, zero accounts. Install → works.
Every action produces cryptographic evidence (SHA-256 + ed25519). Passports, documents, and evidence combine into an audit package for the regulator.
Full EU AI Act coverage with each obligation mapped to a concrete Complior feature. Plus ISO 42001, OWASP LLM Top 10, and MITRE ATLAS.
AGPLv3. Full daemon + TUI + CLI + SDK + MCP Server. No account required.
## The compliance pipeline
| Step | Action | Command |
| --------------- | ------------------------------------------------------- | ------------------------------------------- |
| **1. Init** | Create config + discover AI agents + generate passports | `complior init` |
| **2. Scan** | Analyze code for compliance gaps | `complior scan` |
| **3. Fix** | Auto-remediate issues | `complior fix` |
| **4. Eval** | Test live system behavior | `complior eval --target ` |
| **5. Document** | Generate FRIA, AI Policy, Worker Notification | `complior agent fria` / `policy` / `notify` |
| **6. Certify** | Produce audit package | `complior agent audit-package` |
| **7. Monitor** | Track production drift | `complior` (daemon watcher) |
**Agent Passport** is the central data layer — it receives data from every step and feeds into documents, scoring, and certification.
## New to AI compliance?
EU AI Act explained in 5 minutes for developers.
4 commands from zero to audit-ready. Takes 3 minutes.
Common questions about Complior and compliance.
## Next steps
npm, npx, or cargo — choose your install method.
40+ commands with flags and examples.
100+ HTTP endpoints for programmatic access.
Runtime compliance middleware for LLM clients.
# Installation
Source: https://docs.complior.ai/installation
Install Complior CLI — npx, npm, curl, or cargo.
## Install
No install needed — runs directly:
```bash theme={null}
npx complior scan
npx complior init
npx complior eval --target http://localhost:3000/api/chat
```
For persistent use, install globally:
```bash theme={null}
npm install -g complior
```
```bash theme={null}
curl -fsSL https://get.complior.dev | sh
```
Detects your OS and architecture, downloads the latest release, and adds `complior` to your PATH.
```bash theme={null}
npm install -g complior
```
```bash theme={null}
cargo install complior-cli
```
Builds from source. Requires Rust toolchain.
Download the prebuilt binary for your platform from [GitHub Releases](https://github.com/complior/complior/releases/latest):
| Platform | Asset |
| ------------------- | ----------------------------- |
| Linux x86\_64 | `complior-linux-x86_64` |
| Linux ARM64 | `complior-linux-aarch64` |
| macOS Intel | `complior-macos-x86_64` |
| macOS Apple Silicon | `complior-macos-arm64` |
| Windows | `complior-windows-x86_64.exe` |
```bash theme={null}
# Example: Linux x86_64
curl -fsSL -o complior https://github.com/complior/complior/releases/latest/download/complior-linux-x86_64
chmod +x complior
sudo mv complior /usr/local/bin/
# Verify checksum (optional but recommended)
curl -fsSL -o checksums.txt https://github.com/complior/complior/releases/latest/download/checksums.txt
sha256sum -c checksums.txt --ignore-missing
```
**Requirements:** Node.js 18+ for the Engine. Rust toolchain is only needed for `cargo install` or building TUI from source. The GitHub Release binary embeds the Rust CLI; the Engine still requires Node.js when invoked.
## Verify installation
```bash theme={null}
complior --version
# complior 1.0.1
complior doctor
# ✓ Engine: OK
# ✓ Node.js: v22.1.0
# ✓ TUI: OK
# ✓ MCP: OK
```
All green checks mean Complior is ready. If any component shows an issue, `complior doctor` will suggest how to fix it.
## LLM configuration
Some features require an LLM API key: `complior scan --llm`, `complior eval --llm`, `complior fix --ai`.
After `complior init`, add your LLM settings to `.complior/.env`:
```bash theme={null}
# .complior/.env
LLM_PROVIDER=openai # openai | anthropic | openrouter | ollama
LLM_MODEL=gpt-4o # model name
LLM_API_KEY=sk-... # your API key
```
```bash theme={null}
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o
LLM_API_KEY=sk-...
```
```bash theme={null}
LLM_PROVIDER=anthropic
LLM_MODEL=claude-sonnet-4-20250514
LLM_API_KEY=sk-ant-...
```
```bash theme={null}
LLM_PROVIDER=openrouter
LLM_MODEL=anthropic/claude-sonnet-4-20250514
LLM_API_KEY=sk-or-...
```
```bash theme={null}
LLM_PROVIDER=ollama
LLM_MODEL=llama3
# No API key needed — runs locally
```
`.complior/.env` is gitignored by default. Never commit API keys to version control.
## What gets installed
| Component | Description | Size |
| -------------- | -------------------------------------------------------------- | ------------------ |
| **Engine** | TypeScript daemon — scanner, fixer, passport service, HTTP API | \~15 MB |
| **CLI** | Rust binary — 30+ commands, headless mode for CI/CD | \~10 MB |
| **TUI** | Terminal dashboard — 9 interactive pages (ratatui) | Included in CLI |
| **MCP Server** | Protocol server for AI agents (stdio) | Included in Engine |
## Configure for AI agents
To use Complior with Claude Code, Cursor, or other MCP-compatible agents:
Add to `~/.claude/mcp.json`:
```json theme={null}
{
"mcpServers": {
"complior": {
"command": "complior",
"args": ["mcp"]
}
}
}
```
Add to Cursor MCP settings:
```json theme={null}
{
"complior": {
"command": "complior",
"args": ["mcp"]
}
}
```
Add to Windsurf MCP config:
```json theme={null}
{
"complior": {
"command": "complior",
"args": ["mcp"]
}
}
```
## Next steps
Run your first scan in under 3 minutes.
# MCP Server
Source: https://docs.complior.ai/mcp/overview
Compliance tools for AI agents via Model Context Protocol. 7 tools for Claude Code, Cursor, Windsurf.
Complior provides compliance tools for AI agents through the Model Context Protocol (stdio). When an AI coding agent has Complior as MCP server, it can scan code, fix issues, check scores, and manage passports autonomously.
**Compatible agents:** Claude Code, Cursor, Windsurf, OpenCode, Codex, Devin, aider.
## Available tools
| Tool | What it does |
| ---------------------- | ------------------------------------------------------------------------------------------- |
| `complior_scan` | Scan project for EU AI Act compliance. Returns score, violations, top findings. |
| `complior_fix` | Auto-fix a specific compliance finding by check ID. Returns diff and score delta. |
| `complior_status` | Get current compliance score and category breakdown from last scan. |
| `complior_explain` | Explain an EU AI Act article or obligation in plain language with code implications. |
| `complior_search_tool` | Search the AI tool catalog (5,011+ tools) for compliance information about a specific tool. |
| `complior_classify` | Classify risk level of an AI system based on description and business domain. |
| `complior_report` | Generate a compliance report in JSON or Markdown format. |
## How agents use it
When Claude Code has Complior connected, a conversation might look like:
> **You:** "Check the compliance of this project"
>
> **Claude Code** calls `complior_status` → "Compliance Score: 47/100 (F). 8 critical findings."
>
> **Claude Code** calls `complior_explain` with `Art.50` → "Art.50 requires AI systems to disclose they are AI..."
>
> **You:** "Fix everything"
>
> **Claude Code** calls `complior_fix` for each finding → "Applied 15 fixes. New score: 75/100 (C)."
Configure Complior as MCP server for your AI agent.
# MCP Setup
Source: https://docs.complior.ai/mcp/setup
Configure Complior as MCP server for Claude Code, Cursor, Windsurf, and other agents.
## Start the MCP server
```bash theme={null}
complior mcp
```
This starts the MCP server in stdio mode. AI agents connect to it through their MCP configuration.
## Agent configuration
Add to `~/.claude/mcp.json`:
```json theme={null}
{
"mcpServers": {
"complior": {
"command": "complior",
"args": ["mcp"]
}
}
}
```
Add to Cursor MCP settings:
```json theme={null}
{
"complior": {
"command": "complior",
"args": ["mcp"]
}
}
```
Add to Windsurf MCP config:
```json theme={null}
{
"complior": {
"command": "complior",
"args": ["mcp"]
}
}
```
Any MCP-compatible agent can connect. The server uses stdio protocol:
```bash theme={null}
# Command: complior
# Args: ["mcp"]
# Protocol: stdio
```
## Verify connection
After configuring, ask your agent: "What compliance tools do you have?" It should list the 8 Complior tools (scan, fix, score, explain, passport, validate, deadline, suggest).
The MCP server uses the same Engine as CLI and TUI. If the daemon is already running, MCP connects to it. If not, it starts a lightweight engine instance.
# MCP Tools Reference
Source: https://docs.complior.ai/mcp/tools-reference
Full input/output schema for all 13 Complior MCP tools.
Complete schema reference for the 13 MCP tools exposed by `complior mcp`. Compatible with Claude Code, Cursor, Windsurf, OpenCode, Codex, Devin, and aider.
Source of truth: `engine/core/src/mcp/tools.ts` (Zod schemas) + `engine/core/src/mcp/handlers.ts` (handler logic).
The toolset is organized into three groups:
* **Core (7)** — scan, fix, status, explain, search\_tool, classify, report (since v1.0.0)
* **Builder (3)** — passport\_init, doc\_generate, redteam (since v1.1.0)
* **Analytics (3)** — evidence\_verify, drift\_detect, obligations\_status (since v1.1.0)
***
## `complior_scan`
Scan a project for EU AI Act compliance. Returns score, violations, and top findings.
### Input
| Field | Type | Required | Description |
| ------ | -------- | -------- | ------------------------------------------------- |
| `path` | `string` | No | Project path to scan (default: current directory) |
### Output
```json theme={null}
{
"score": 75,
"zone": "yellow",
"totalFindings": 12,
"criticalFindings": 0,
"topFindings": [
{
"checkId": "l4-bare-llm",
"severity": "medium",
"message": "Bare LLM API call detected in 3 files. Consider @complior/sdk for runtime compliance.",
"fix": "Wrap with @complior/sdk for runtime Art. 50/12/14 enforcement"
}
]
}
```
### Example agent usage
> **You:** Check the compliance of this project.
>
> **Agent** calls `complior_scan` with `{ path: "." }` → returns score 75/100 with 12 findings.
***
## `complior_fix`
Auto-fix a specific compliance violation. Returns diff preview and score delta.
### Input
| Field | Type | Required | Description |
| -------------- | -------- | -------- | -------------------------------------------------------- |
| `checkId` | `string` | Yes | Check ID of the finding to fix (e.g., `"ai-disclosure"`) |
| `obligationId` | `string` | No | Obligation ID (e.g., `"eu-ai-act-OBL-015"`) |
### Output
```json theme={null}
{
"applied": true,
"diff": "...",
"scoreImpact": 5,
"filesModified": ["src/chatbot.ts"],
"newScore": 80
}
```
### Example agent usage
> **You:** Fix the bare LLM call.
>
> **Agent** calls `complior_fix` with `{ checkId: "l4-bare-llm" }` → wraps with SDK, returns +5 score impact.
***
## `complior_status`
Get current compliance score and category breakdown from the last scan.
### Input
No parameters.
### Output
```json theme={null}
{
"score": 75,
"zone": "yellow",
"categoryBreakdown": [
{ "category": "transparency", "score": 80, "weight": 0.2 },
{ "category": "documentation", "score": 60, "weight": 0.3 }
],
"lastScanAt": "2026-05-03T15:00:00.000Z"
}
```
If no scan results exist, returns `{ message: "No scan results yet. Run complior_scan first." }`.
***
## `complior_explain`
Explain an EU AI Act article or obligation in plain language with code implications.
### Input
| Field | Type | Required | Description |
| --------- | -------- | -------- | ---------------------------------------------------- |
| `article` | `string` | Yes | Article reference (e.g., `"Art. 50"` or `"OBL-015"`) |
### Output
Plain-text explanation with:
* Article title and risk level
* What it requires
* Penalty for non-compliance
* Code implications (what to add / change in your project)
* Related obligations
### Example agent usage
> **You:** Explain Article 50.
>
> **Agent** calls `complior_explain` with `{ article: "Art. 50" }` → returns transparency requirements + disclosure SDK example.
***
## `complior_search_tool`
Search the AI tool catalog for compliance information about a specific tool.
### Input
| Field | Type | Required | Description |
| ------- | -------- | -------- | ------------------------------------------------------ |
| `query` | `string` | Yes | Tool name or keyword (e.g., `"openai"`, `"langchain"`) |
### Output
```json theme={null}
{
"matches": [
{
"name": "openai",
"category": "LLM Provider",
"complianceNotes": "Requires Art. 50 disclosure when used in user-facing apps. EU data residency available via Azure OpenAI EU regions.",
"alternatives": ["mistral", "anthropic-eu"]
}
]
}
```
***
## `complior_classify`
Classify the risk level of an AI system based on its description and domain.
### Input
| Field | Type | Required | Description |
| ------------- | -------- | -------- | ----------------------------------------------------------- |
| `description` | `string` | Yes | Description of the AI system |
| `domain` | `string` | No | Business domain (`"healthcare"`, `"finance"`, `"hr"`, etc.) |
### Output
```json theme={null}
{
"riskLevel": "high",
"rationale": "Healthcare diagnostic AI matching Annex III point 5 (medical devices) — high risk under EU AI Act.",
"applicableArticles": ["Art. 9", "Art. 10", "Art. 13", "Art. 14", "Art. 26", "Art. 27"],
"requiredDocuments": ["FRIA", "Risk Management System", "Technical Documentation", "Data Governance"]
}
```
***
## `complior_report`
Generate a compliance report in JSON or Markdown format.
### Input
| Field | Type | Required | Description |
| -------- | ---------------------- | -------- | ----------------------------------- |
| `format` | `"json" \| "markdown"` | No | Output format (default: `markdown`) |
### Output
* **`format: "markdown"`** — Markdown report with score, findings table, top issues, action plan
* **`format: "json"`** — Structured JSON with full report data (compatible with `complior report --json`)
Requires a prior scan. Returns `"No scan results. Run complior_scan first."` otherwise.
***
## `complior_passport_init`
**New in v1.1.0** (Builder group). Generate Mode 1 Auto Agent Passport(s) by AST-scanning the project.
Each passport is ed25519-signed and includes 36 fields covering identity, capabilities, autonomy, permissions, oversight, and lifecycle.
### Input
| Field | Type | Required | Description |
| ----------- | --------- | -------- | ------------------------------------------------------------------------------------- |
| `path` | `string` | No | Project path to scan for AI agents (default: current directory) |
| `agentName` | `string` | No | Filter to a single agent name (skip if multiple agents discovered) |
| `force` | `boolean` | No | Overwrite existing passports while preserving `created` / `deployed_since` timestamps |
### Output
```json theme={null}
{
"passports": [
{
"name": "support-bot",
"schema_version": "1.0.0",
"passport_id": "passport-support-bot",
"creation_mode": "auto",
"completeness": 85,
"framework": "openai",
"model": "gpt-4o",
"signature": { "algorithm": "ed25519", "value": "...", "public_key_id": "k1" }
}
],
"count": 1,
"savedPaths": ["/repo/.complior/agents/support-bot-manifest.json"]
}
```
Returns `isError: true` with `"No agents found"` when AST scan finds no agent configurations or SDK usage.
### Example agent usage
> **You:** Generate a passport for our chatbot.
>
> **Agent** calls `complior_passport_init` with `{}` → returns 1 passport with 85% completeness, saved to `.complior/agents/`.
***
## `complior_doc_generate`
**New in v1.1.0** (Builder group). Generate one of 14 EU AI Act compliance documents from an existing passport.
Supported document types (one of):
`ai-literacy`, `art5-screening`, `technical-documentation`, `incident-report`, `declaration-of-conformity`, `monitoring-policy`, `fria`, `worker-notification`, `risk-management`, `data-governance`, `qms`, `instructions-for-use`, `gpai-transparency`, `gpai-systemic-risk`.
### Input
| Field | Type | Required | Description |
| -------------- | -------------------------- | -------- | --------------------------------------------------------------------------------- |
| `docType` | `string` (enum, 14 values) | Yes | Document type to generate |
| `passportName` | `string` | Yes | Agent passport name (run `complior_passport_init` first if missing) |
| `organization` | `string` | No | Organization name to use in the document (default: passport `organization` field) |
| `path` | `string` | No | Project path (default: current directory) |
### Output
```json theme={null}
{
"docType": "fria",
"markdown": "# Fundamental Rights Impact Assessment\n\n...",
"prefilledFields": ["name", "organization", "system_type", "risk_classification"],
"manualFields": ["impact_assessment", "mitigation_plan", "approval_signature"],
"savedPath": "/repo/.complior/fria/support-bot-fria.md"
}
```
Returns `isError: true` with `"Passport \"\" not found"` if the passport doesn't exist.
### Example agent usage
> **You:** Make a FRIA for our support bot.
>
> **Agent** calls `complior_doc_generate` with `{ docType: "fria", passportName: "support-bot" }` → returns markdown with prefilled fields and a list of manual fields the user still needs to complete.
***
## `complior_redteam`
**New in v1.1.0** (Builder group). Run 300+ adversarial security probes (OWASP LLM Top 10, MITRE ATLAS) against an AI endpoint.
**Long-running operation** — typically 30s–5min depending on concurrency and target latency. MCP clients should use a timeout of at least 5 minutes (e.g. `requestTimeout: 300000`).
### Input
| Field | Type | Required | Description |
| ------------- | ---------------- | -------- | ----------------------------------------------------------------------- |
| `target` | `string` (URL) | Yes | Target AI endpoint URL (e.g., `https://api.example.com/v1/chat`) |
| `apiKey` | `string` | No | API key for authenticated targets (forwarded as `Authorization` header) |
| `concurrency` | `number` (1–50) | No | Parallel probe execution (default: 1) |
| `threshold` | `number` (0–100) | No | Score threshold for pass/fail gate (default: no gate) |
### Output
```json theme={null}
{
"score": 78,
"totalTests": 300,
"passed": 240,
"failed": 50,
"securityScore": 73,
"securityGrade": "C"
}
```
When `threshold` is set and the score falls below it, returns `isError: true` plus `thresholdFailed: true` and the failing `threshold` value.
### Example agent usage
> **You:** Red-team our chatbot endpoint with a minimum score of 80.
>
> **Agent** calls `complior_redteam` with `{ target: "https://...", threshold: 80 }` → if score 75, returns `isError` with `thresholdFailed: true`.
***
## `complior_evidence_verify`
**New in v1.1.0** (Analytics group). Verify integrity of the evidence chain (SHA-256 + ed25519).
Used for audit preparation — every scan and fix appends to the chain, so the chain is the cryptographic proof of compliance history.
### Input
| Field | Type | Required | Description |
| ------ | -------- | -------- | -------------------------------------------------------------------------- |
| `path` | `string` | No | Project path containing `.complior/evidence/` (default: current directory) |
### Output
```json theme={null}
{
"valid": true,
"issues": [],
"totalEntries": 142,
"scanCount": 23,
"firstEntry": "2026-04-01T00:00:00Z",
"lastEntry": "2026-05-07T10:00:00Z"
}
```
When the chain is tampered, `valid: false` with a `brokenAt` index and human-readable `issues`:
```json theme={null}
{
"valid": false,
"brokenAt": 4,
"issues": ["Chain broken at index 4: hash mismatch"]
}
```
Returns `isError: true` with `"Evidence chain not found or unreadable"` if the store cannot be read.
***
## `complior_drift_detect`
**New in v1.1.0** (Analytics group). Compare the latest scan against the previous one and report compliance drift.
### Input
| Field | Type | Required | Description |
| ------ | -------- | -------- | ----------------------------------------------------------- |
| `path` | `string` | No | Project path with scan history (default: current directory) |
### Output
```json theme={null}
{
"scoreChange": -18,
"severity": "major",
"hasDrift": true,
"newFailures": [...],
"resolvedFailures": [...],
"affectedArticles": ["Art. 50", "Art. 12"]
}
```
**Severity classification:**
| Severity | Trigger |
| ---------- | ----------------------------------------------------------- |
| `none` | Score stable or improved |
| `minor` | Score dropped 1–10 points |
| `major` | Score dropped >10 points or new high-severity finding |
| `critical` | New Art. 5 prohibited practice or critical-severity failure |
When no previous scan exists, returns `severity: "none"` with `hasDrift: false` and a `message` field.
***
## `complior_obligations_status`
**New in v1.1.0** (Analytics group). Per-obligation coverage breakdown across all 108 EU AI Act obligations.
### Input
| Field | Type | Required | Description |
| ----------- | ---------------------------------------------------- | -------- | ------------------------------------------------------ |
| `role` | `"provider" \| "deployer" \| "both"` | No | Filter by applicable role (default: all) |
| `riskLevel` | `"unacceptable" \| "high" \| "limited" \| "minimal"` | No | Filter by EU AI Act risk classification (default: all) |
| `coverage` | `"covered" \| "uncovered" \| "all"` | No | Filter by current scan coverage status (default: all) |
### Output
```json theme={null}
{
"total": 12,
"obligations": [
{
"obligation_id": "OBL-001",
"article_reference": "Art. 4",
"title": "AI Literacy",
"applies_to_role": "both",
"applies_to_risk_level": ["high", "limited"],
"severity": "high",
"coverage": "covered"
}
]
}
```
### Example agent usage
> **You:** Show me high-risk obligations that aren't covered yet.
>
> **Agent** calls `complior_obligations_status` with `{ riskLevel: "high", coverage: "uncovered" }` → returns the gap list ranked by severity.
***
## Common patterns
### Scan → fix loop (Core)
```
complior_scan → top findings list
↓
For each high-priority finding:
complior_explain (understand the article)
complior_fix (apply auto-fix)
↓
complior_status (verify new score)
```
### Onboarding a new AI system (Builder)
```
complior_classify (describe the system)
↓
complior_passport_init (generate the Agent Passport)
↓
complior_doc_generate { docType: "fria" } (build the FRIA)
↓
complior_redteam (security probes against the endpoint)
↓
complior_report (audit-ready output)
```
### Continuous compliance (Analytics)
```
complior_scan (latest scan)
↓
complior_drift_detect (what changed since last scan?)
↓
complior_obligations_status { coverage: "uncovered" } (where are we still exposed?)
↓
complior_evidence_verify (audit chain still healthy?)
```
***
## Roadmap
Current set: **13 tools** (Core 7 + Builder 3 + Analytics 3).
Future additions (post-v1.1.0):
* **Guard tools** (V2-M03, after Guard MVP G-M01) — `complior_guard_check`, `complior_guard_pii`, `complior_guard_bias`
* **SaaS Dashboard tools** (V2-M07, after cloud deploy) — fleet view, sync status
See [GitHub Discussions](https://github.com/complior/complior/discussions) for proposals.
# Autonomy Levels
Source: https://docs.complior.ai/passport/autonomy-levels
5-level autonomy scale with automatic AST detection.
## The scale
| Level | Name | Behavior | Example | Risk mapping |
| ------ | ---------- | ------------------------------------- | --------------------------------- | ------------ |
| **L1** | Assistive | Suggests. Human decides AND executes. | Copilot autocomplete | Minimal |
| **L2** | Suggestive | Prepares action. Human confirms. | "Send email? \[Y/n]" | Minimal |
| **L3** | Supervised | Acts. Human can veto (time window). | Order processor, 10-sec review | Limited |
| **L4** | Autonomous | Acts on its own. Human gets logs. | Customer support bot 24/7 | Limited |
| **L5** | Fully Auto | Acts without notification. No human. | Trading bot, autonomous recruiter | High |
## Auto-detection from code
Complior's `autonomy-analyzer.ts` scans AST for human gate patterns and unsupervised actions:
```
human_approval_gates > 0 && unsupervised == 0 → L2
human_approval_gates > 0 && unsupervised > 0 → L3
human_approval_gates == 0 && unsupervised > 0 && logging → L4
human_approval_gates == 0 && unsupervised > 0 && !logging → L5
nothing detected → L1
```
Additionally detects `killSwitchPresent` — used for `oversight.override_mechanism`.
## Impact on passport
Autonomy level directly affects:
* **Risk class** (L5 → high risk, L1–L2 → minimal)
* **Applicable articles** (high-risk gets Art.6, 9, 11, 12, 13, 14, 26, 27, 49, 50)
* **Oversight block** (generated only for high-risk or L3+)
* **Deployer obligations** (more obligations for higher autonomy)
# Data Pipeline
Source: https://docs.complior.ai/passport/data-pipeline
11 stages from 0% to 100%+ passport completeness — init through production monitoring.
## Stage overview
| Stage | Command | Fields added | Completeness | Status |
| ------------------- | -------------------------- | ------------------------------------------------- | ------------ | ------- |
| 0. Init | `complior init` | \~44 auto-filled from AST + profile + defaults | 0% → 65–70% | Done |
| 1. Scan | `complior scan` | +2 (score, last\_scan) + auto-discover new agents | 70% | Done |
| 2. Fix | `complior fix` | score↑ via auto-rescan | varies | Done |
| 3. Manual Fill | TUI / JSON edit | +6 (owner, disclosure, lifecycle) | 93% | Done |
| 4. Documents | `agent fria/notify/policy` | +3 flags + audit ZIP | 100% | Done |
| 5. Eval | `complior eval --target` | +20 behavioral fields | 100%+ | Done |
| 6. Live Update | Daemon watcher | Score refresh + auto-discover | 100% | Done |
| 7. LLM Docs | `complior fix --ai` | Doc enrichment | varies | Planned |
| 8. Eval Remediation | `complior eval --fix` | Fix from eval findings | varies | Planned |
| 9. MCP Proxy | `complior proxy` | Runtime enrichment | varies | Planned |
| 10. Monitor | `complior monitor` | +4 drift fields | varies | Planned |
***
## Stage 0: Init
**Command:** `complior init` or `complior` (TUI onboarding wizard)
**Completeness:** 0% → 65–70%
Two entry paths:
* **CLI:** `complior init` → creates `.complior/` + `profile.json` + `project.toml` → auto-discovers AI agents → creates passports
* **TUI:** `complior` (no args) → 8-step onboarding wizard → auto-scan on completion → agents discovered via `scan.completed` event
`complior agent init` is optional — `init` does agent discovery automatically. Use `agent init --force` to regenerate passports.
### What gets auto-filled (\~44 fields)
`agent_id` (UUID), `name`, `display_name`, `description`, `version`, `created`, `updated`
Source: entry file name, framework config, auto-generated UUID.
`type` (autonomous/assistive/hybrid), `autonomy_level` (L1–L5), `autonomy_evidence` (gates, unsupervised, no\_logging counts), `killSwitchPresent`
Source: L4 AST pattern matching.
`framework`, `model.provider`, `model.model_id`, `model.deployment`, `model.data_residency`
Source: L3 dependency analysis + SDK detection + profile.json.
`permissions.tools`, `permissions.data_access` (read/write/delete), `permissions.denied`, `permissions.data_boundaries`, `interop.mcp_servers`
Source: Permission scanner — analyzes tool definitions, DB patterns, explicit deny lists, MCP config.
`human_approval_required`, `prohibited_actions`, `escalation_rules`, `rate_limits` (default: 100/min), `budget` (default: \$5.00/session)
Source: AST (confirm/approve gates) + defaults.
`risk_class`, `applicable_articles`, `obligations_met`, `obligations_pending`, `complior_score` (0 until first scan), `last_scan`
Source: Computed from autonomy level × project domain.
`actions_logged`, `retention_days` (default: 365), `lifecycle.status` ("draft"), `lifecycle.next_review` (created + 90 days)
Source: AST logging patterns + defaults.
Ed25519 signature (algorithm, public\_key, signed\_at, hash, value). Source tracking: `source.mode` ("auto"), `source.confidence`, `fields_auto_filled`, `fields_manual`.
### What stays empty (filled in Stage 3)
`owner.team`, `owner.contact`, `owner.responsible_person`, `disclosure.user_facing`, `disclosure.disclosure_text`, `disclosure.ai_marking`, `lifecycle.deployed_since`
***
## Stage 1: Scan
**Command:** `complior scan` (any tier)
**Completeness:** 65% → 70%
Every scan triggers two actions:
1. `initPassport()` — discovers **new** agents (idempotent, skips existing)
2. `updatePassportsAfterScan()` — updates score on **all** passports
**Fields updated:**
* `compliance.complior_score` — 0 → actual score (e.g. 74)
* `compliance.last_scan` — timestamp
* `updated` — new timestamp
* `signature` — re-signed
### Scan sub-tiers
| Tier | Command | Coverage |
| ------- | ------------------------------------ | -------- |
| Tier 1 | `complior scan` | 60–70% |
| Tier 1+ | `complior scan --llm` | 70–80% |
| Tier 2 | `complior scan --deep` | 80–85% |
| Tier 2+ | `complior scan --deep --llm` | 85–90% |
| Tier 3 | `complior scan --cloud` | 90–95% |
| Tier 3+ | `complior scan --deep --llm --cloud` | 95%+ |
Score differs per tier, but passport update is the same (score + last\_scan).
***
## Stage 2: Fix
**Command:** `complior fix`
**Completeness:** score↑ via auto-rescan
Applies recommended remediation strategies to code. Triggers auto-rescan → passport score updates. Score can jump significantly (e.g. 60 → 85 after fixes). Use `--dry-run` to preview without applying.
***
## Stage 3: Manual Fill
**Command:** TUI Passport page (hotkey `P`) or JSON edit
**Completeness:** 70% → 93%
Typically 8 fields remain after auto-fill:
| Field | Example value | Why manual |
| ---------------------------------------- | ----------------------------------------------------- | --------------------- |
| `owner.team` | "Backend Engineering" | Organization-specific |
| `owner.contact` | "[eng-lead@company.com](mailto:eng-lead@company.com)" | Person-specific |
| `owner.responsible_person` | "Maria Schmidt" | Person-specific |
| `disclosure.user_facing` | true | Business decision |
| `disclosure.disclosure_text` | "This bot uses AI" | Custom text |
| `disclosure.ai_marking.responses_marked` | true | Implementation choice |
| `lifecycle.deployed_since` | "2026-04-01" | Deploy date |
| `lifecycle.status` | "active" | Lifecycle state |
***
## Stage 4: Documents
**Completeness:** 93% → 100%
```bash theme={null}
complior agent fria my-bot --organization "ACME Corp"
```
Sets `fria_completed: true`, `fria_date`. 14+ fields pre-filled from passport. Use `--impact`, `--mitigation`, `--approval` for manual sections. Mandatory for high-risk systems.
```bash theme={null}
complior agent notify my-bot --company-name "ACME"
```
Sets `worker_notification_sent: true`, `worker_notification_date`. 9 fields pre-filled. Required for high-risk AI in workplace.
```bash theme={null}
complior agent policy my-bot --industry hr
```
Sets `policy_generated: true`, `policy_date`. 11 fields pre-filled. `--industry hr|finance|healthcare` for domain-specific templates.
```bash theme={null}
complior agent audit-package
```
ZIP bundle: passport + scan report + eval report + FRIA + evidence chain. Does not update passport directly.
27/27 required fields filled = 100% completeness. Passport re-signed with ed25519 after every update.
***
## Stage 5: Eval
**Command:** `complior eval --target --agent `
**Completeness:** 100% → 100%+
Tests the **running** AI system (not code). Adds `compliance.eval` block with 20+ fields:
| Field | Example |
| -------------------------------- | ----------------------------------- |
| `eval_score` | 72/100 |
| `eval_grade` | "C" (A–F) |
| `eval_tier` | "full" / "det" / "llm" / "security" |
| `eval_security_score` | 85/100 |
| `eval_security_grade` | "B" |
| `eval_tests_total/passed/failed` | 670 / 487 / 183 |
| `eval_critical_gaps` | \["Art.50", "Art.14"] |
| `eval_category_pass_rates` | 11 categories (CT-1..CT-11) |
| `bias_pairs_failed` | 3 |
| `hallucination_rate` | 0.12 |
| `avg_latency_ms` | 1200 |
Eval tiers: `--det` (168 deterministic), `--llm` (+212 LLM-judged), `--security` (300 attack probes), `--full` (680 all).
Scan checks **CODE**. Eval checks **BEHAVIOR**. Both scores in the passport = full picture.
***
## Stage 6: Live Update
**Trigger:** Daemon file watcher + `scan.completed` event
**Completeness:** 100% maintained
Every file save → 200ms debounce → re-scan → score update in passport. New AI SDK imports → auto-discovery of new agents. Passport always contains current `complior_score` and `last_scan`.
***
## Planned stages
### Stage 7: LLM Docs
**Command:** `complior fix --ai`
LLM auto-fills empty sections in FRIA/Policy/Notification documents. Markers `[AI-DRAFT]` for human review. Pre-fill context: 9 fields from passport → LLM prompt. Fills "Specific Risks", "Mitigation Measures", "Monitoring Plan".
### Stage 8: Eval Remediation
**Command:** `complior eval --fix`
Remediation Knowledge Base (11 category playbooks). Eval Fix Generator: system prompt patches, API config, guardrail config. Eval findings → FixDiff pipeline (new FindingSource: "eval").
### Stage 9: MCP Proxy
**Command:** `complior proxy connect`
For black-box agents (no code, only MCP traffic). Enriches existing passport: `permissions.tools` (runtime), `data_access` (observed), `autonomy_level` (inferred). `source.mode` → "runtime" (confidence 0.55 vs AST \~0.42).
### Stage 10: Monitor
**Command:** `complior monitor --source `
Post-deployment monitoring. Adds `compliance.monitoring` block: `monitoring_score`, `drift_detected`, `last_monitoring`, `anomalies[]`. Compares runtime behavior vs passport declarations (e.g., declared L3 but observed L5).
# Endpoint Detection
Source: https://docs.complior.ai/passport/endpoints
How Complior discovers and manages AI system endpoints in passports — automatic detection from code, Docker, .env, plus manual configuration.
The `endpoints` field in an Agent Passport lists all HTTP endpoints where the AI system is reachable. This is required for `complior eval` to know **where** to send conformity probes, and for Art.13 (instructions for use) to document the system's interfaces.
**Why endpoints matter:** EU AI Act Art.13 requires clear documentation of the AI system's interfaces. Art.15 requires robustness testing of the actual deployed system. Without endpoints, `complior eval` has no target.
## Automatic detection
During `complior init` (or `complior agent init`), the endpoint discovery pipeline scans **5 sources** in priority order:
| Priority | Source | Pattern | Example |
| -------- | ----------------------- | ---------------------- | ------------------------------------- |
| 1 | `.env` / `.env.example` | `PORT=4000` | Port from environment config |
| 2 | Dockerfile | `EXPOSE 3000` | Port from container config |
| 3 | docker-compose.yml | `ports: ["8080:8080"]` | Port from orchestration config |
| 4 | Source code | `{ port: 3000 }` | Port from Hono/Express/Fastify config |
| 5 | Source code | `.listen(8080)` | Port from Node.js `listen()` call |
Once a port is found, Complior also scans source files for **route patterns** (`.get()`, `.post()`, etc.) and builds full endpoint URLs:
```
http://localhost:4000/api/chat
http://localhost:4000/v1/chat/completions
http://localhost:4000/health
```
### Detection examples
```bash title=".env" theme={null}
PORT=4000
NODE_ENV=production
```
Result: `http://localhost:4000` + detected routes.
```dockerfile title="Dockerfile" theme={null}
FROM node:20-slim
WORKDIR /app
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
```
Result: `http://localhost:3000` + detected routes.
```yaml title="docker-compose.yml" theme={null}
services:
app:
build: .
ports:
- "8080:8080"
```
Result: `http://localhost:8080` + detected routes.
```typescript title="src/server.ts" theme={null}
const app = new Hono();
app.post('/api/chat', chatHandler);
app.get('/health', healthHandler);
export default { port: 4000, fetch: app.fetch };
```
Result: `http://localhost:4000/api/chat`, `http://localhost:4000/health`.
`.env` takes priority over code patterns. If you have `PORT=5000` in `.env` and `{ port: 3000 }` in code, the passport will use port 5000.
## Manual configuration
If automatic detection doesn't find your endpoints (e.g., the port is injected at deploy time, or the AI system is behind a reverse proxy), edit the passport JSON directly:
```bash theme={null}
nano .complior/agents/my-agent-manifest.json
```
Find the `endpoints` field and add your URLs:
```json title=".complior/agents/my-agent-manifest.json" theme={null}
{
"name": "my-agent",
"endpoints": [
"https://api.example.com/v1/chat",
"https://api.example.com/health"
]
}
```
After editing, re-sign the passport:
```bash theme={null}
complior agent validate my-agent
```
Manual endpoints are **preserved** across `complior init` runs. Use `--force` only if you want to regenerate from scratch.
## Using endpoints with eval
Once endpoints are in the passport, `complior eval` can auto-resolve the target:
```bash theme={null}
# Explicit target (always works)
complior eval http://localhost:4000/api/chat --agent my-agent
# Auto-resolve from passport endpoints (when only one agent exists)
complior eval --det
```
When `--agent` is specified, the eval results are saved to that passport's `compliance.eval` block.
## When endpoints are not detected
If no port is found from any source, the passport's `endpoints` field is omitted. You'll see this in `complior agent show`:
```
ENDPOINTS
(none detected)
```
Common reasons and fixes:
| Reason | Fix |
| --------------------------- | ------------------------------------------------- |
| Port injected via CI/CD | Add `PORT=` to `.env.example` |
| Port in Kubernetes config | Add a Dockerfile with `EXPOSE` |
| Serverless deployment | Add the function URL manually to the passport |
| Monorepo with shared config | Run `complior init` from the service subdirectory |
How endpoints fit into the 11-stage passport data fill pipeline.
Test your AI system's behavior at the detected endpoints.
# Evidence Chain
Source: https://docs.complior.ai/passport/evidence-chain
Tamper-proof cryptographic chain: SHA-256 hash → ed25519 signature → chain.
Every compliance action in Complior produces a cryptographic evidence entry. The chain is stored in `.complior/evidence/chain.json`.
## How it works
Scan completes, fix applied, passport updated, document generated.
SHA-256 hash of the artifact (scan result, fix diff, passport JSON, document).
Ed25519 signs the hash with the project's private key (`~/.config/complior/keys/`).
Entry includes: event type, timestamp, hash, signature, and reference to previous entry.
## Recorded events
| Event | Trigger | What's hashed |
| -------------------- | --------------------------- | ----------------------- |
| `scan.completed` | Every `complior scan` | Full scan result |
| `fix.applied` | Every `complior fix` | Fix diff + before/after |
| `passport.created` | `complior agent init` | Full passport JSON |
| `passport.updated` | Score update, manual edit | Updated passport JSON |
| `fria.generated` | `complior agent fria` | FRIA document |
| `document.generated` | `complior fix` (B-strategy) | Document content |
## Verification
```bash theme={null}
# View evidence chain summary
complior agent evidence
# Verify chain integrity (all hashes + signatures)
complior agent evidence --verify
```
## For auditors
The evidence chain proves: what was checked, when, what was found, what was fixed, and in what order. Each entry is independently verifiable without trusting Complior itself — the auditor can re-hash any artifact and verify the ed25519 signature.
# Export Formats
Source: https://docs.complior.ai/passport/export-formats
Export passports to A2A, AIUC-1, and NIST AI RMF formats.
## Available formats
```bash theme={null}
complior agent export order-processor --format a2a
```
Google's Agent-to-Agent Card format. Used for agent interoperability — identity, capabilities, authentication.
```bash theme={null}
complior agent export order-processor --format aiuc-1
```
EU AI Use Case certification format. Covers 6 readiness categories for conformity assessment.
```bash theme={null}
complior agent export order-processor --format nist
```
US National Institute of Standards AI Risk Management Framework format. Maps to GOVERN, MAP, MEASURE, MANAGE functions.
## Import
```bash theme={null}
# Import from A2A format
complior agent import --from a2a agent-card.json
```
Imported passports are validated against the Complior schema and signed with ed25519.
# Agent Passport
Source: https://docs.complior.ai/passport/overview
Standardized AI system identity card — 36 fields, ed25519 signed, 2 generation modes.
Agent Passport is the central artifact of Complior — a standardized identity card for each AI system (`agent-manifest.json`). It contains 36 fields covering identity, permissions, constraints, compliance status, and human oversight. Ed25519 signed at every update.
**Why it exists:** EU AI Act requires deployers to maintain an AI system registry (Art.26), conduct FRIA for high-risk systems (Art.27), and register in the EU Database (Art.49). When the regulator asks "Show me your AI systems" — the passport is the answer.
## Key commands
```bash theme={null}
complior agent init # Generate passports from code (Mode 1)
complior agent list # List all passports
complior agent show order-processor # Show specific passport
complior agent validate order-processor # Check completeness + signature
complior agent completeness order-processor # See missing fields
complior agent fria order-processor # Generate FRIA (Art.27)
complior agent export order-processor --format a2a # Export to A2A format
```
## What the passport contains
`agent_id`, `name`, `display_name`, `description`, `version`, `created`, `updated`
`owner.team`, `owner.contact`, `owner.responsible_person`
`type`, `autonomy_level` (L1–L5), `autonomy_evidence` (gates, unsupervised actions), `killSwitchPresent`
`framework`, `model.provider`, `model.model_id`, `model.deployment`, `model.data_residency`
`permissions.tools`, `permissions.data_access` (read/write/delete), `permissions.denied`, `permissions.data_boundaries`
`constraints.rate_limits`, `constraints.budget`, `constraints.human_approval_required`, `constraints.prohibited_actions`, `constraints.escalation_rules`
`risk_class`, `applicable_articles`, `deployer_obligations_met/pending`, `complior_score`, `last_scan`, `fria_completed`, `eval` block
`oversight.responsible_person`, `oversight.override_mechanism`, `oversight.escalation_procedure`
`disclosure.user_facing`, `disclosure.disclosure_text`, `disclosure.ai_marking`
`logging.actions_logged`, `logging.retention_days`, `logging.includes_decision_rationale`
`lifecycle.status` (draft/review/active/suspended/retired), `lifecycle.deployed_since`, `lifecycle.next_review`, `lifecycle.review_frequency_days`
`signature.algorithm` (ed25519), `signature.public_key`, `signature.signed_at`, `signature.hash`, `signature.value`
## Storage
```
.complior/agents/
├── order-processor-manifest.json # Passport #1
├── support-bot-manifest.json # Passport #2
└── ...
```
Keys stored in `~/.config/complior/keys/`. Passports re-signed on every update.
Auto (from code) and Runtime (from observation).
11 stages from 0% to 100%+ completeness.
Auto-detect from .env, Dockerfile, docker-compose, code.
L1–L5 scale with automatic AST detection.
Dual-source: autonomy × domain.
# Passport Modes
Source: https://docs.complior.ai/passport/passport-modes
Two ways to generate a passport: Auto (from code) and Runtime (from observation).
## Mode comparison
| | Mode 1: Auto | Mode 2: Runtime |
| ---------------- | ----------------- | ------------------------- |
| **Input** | Source code (AST) | MCP tool calls + Eval |
| **Command** | `complior init` | `complior proxy` / `eval` |
| **Auto-fill** | 65–70% | 40–70% |
| **Confidence** | \~0.42 | 0.55 |
| **Verification** | Code-verified | Behavior-observed |
| **Use case** | Own code | Black-box vendor agent |
| **User** | Developer | DevOps / Platform Eng |
| **Status** | **Production** | Planned |
## Mode 1: Auto (from code)
```bash theme={null}
complior init # auto-discovers agents during project init
complior agent init # optional: manual re-discovery / --force regenerate
```
Scans your codebase through AST analysis. Detects frameworks (57+), models, permissions, human gates, autonomy level, kill-switch. Risk class computed from autonomy × project domain.
**Best for:** Your own AI agents where source code is available.
## Mode 2: Runtime (from observation)
Two data sources:
1. **MCP Proxy** — intercepts MCP tool calls from black-box agents (Cursor, Windsurf, vendor agents). Records tools\_used, data\_access, timing, success/error rates.
2. **Eval** — `complior eval --target ` tests the system with 680 probes and records behavioral data.
**Best for:** Vendor AI agents you deploy but don't have source code for.
Mode 2 is planned. MCP Proxy infrastructure is 60% built. Eval integration is in development.
# Risk Classification
Source: https://docs.complior.ai/passport/risk-classification
Dual-source risk classification: autonomy level × project domain.
## How risk is determined
Risk class comes from **two sources** — the highest wins:
### Source 1: Autonomy level
| Level | Inferred risk |
| ------ | ------------- |
| L1, L2 | `minimal` |
| L3, L4 | `limited` |
| L5 | `high` |
### Source 2: Project profile
From `.complior/profile.json` (created during `complior init`):
| Domain | Inferred risk |
| ------------------------------------------------------------------------ | ------------- |
| `healthcare`, `finance`, `hr`, `education`, `law_enforcement`, `justice` | `high` |
| Biometric/medical/financial data | `high` |
| Platform system | `limited` |
| Internal with public data | `minimal` |
## Resolution: highest wins
**Example:** HR recruitment agent + L3 autonomy.
* Autonomy: L3 → `limited`
* Profile: hr → `high`
* **Result: `high`** (highest of the two)
Without profile (`.complior/profile.json` not found): only autonomy is used.
## Dynamic applicable articles
Based on risk class, `getApplicableArticles()` returns:
| Risk Class | Applicable Articles |
| ------------ | ---------------------------------------- |
| `prohibited` | Art.5 |
| `high` | Art.6, 9, 11, 12, 13, 14, 26, 27, 49, 50 |
| `limited` | Art.50, 52 |
| `minimal` | Art.50 |
# CI/CD Integration
Source: https://docs.complior.ai/scan/ci-cd
Add compliance gates to your CI/CD pipeline with threshold checks and structured output.
## Quick setup
```bash theme={null}
complior scan --ci --json --threshold 70
```
* `--ci` — exit code 1 if score below threshold, exit code 0 if above
* `--json` — structured JSON output (also supports `--sarif` for GitHub Code Scanning)
* `--threshold 70` — minimum compliance score to pass
## GitHub Actions
```yaml theme={null}
name: Compliance Check
on: [push, pull_request]
jobs:
compliance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: npm install -g complior
- run: complior scan --ci --json --threshold 70
- run: complior agent validate --ci
```
## GitLab CI
```yaml theme={null}
compliance:
image: node:22
script:
- npm install -g complior
- complior scan --ci --json --threshold 70
- complior agent validate --ci
artifacts:
reports:
codequality: .complior/reports/scan-report.json
```
## Output formats
| Format | Flag | Use case |
| ------ | --------- | ------------------------------- |
| JSON | `--json` | Custom integrations, dashboards |
| SARIF | `--sarif` | GitHub Code Scanning, VS Code |
## Passport validation in CI
```bash theme={null}
# Fail CI if any passport has errors
complior agent validate --ci
# Strict mode: warnings also fail
complior agent validate --ci --strict
```
# Scan Overview
Source: https://docs.complior.ai/scan/overview
5-layer deterministic static analysis engine. Scans your codebase for EU AI Act compliance gaps in 2–5 seconds.
`complior scan` is a deterministic, 5-layer compliance analysis engine. It evaluates your project against the EU AI Act and produces actionable findings with confidence scoring, obligation mapping, and fix suggestions.
```bash theme={null}
complior scan [path] [--deep] [--llm] [--cloud] [--ci] [--json] [--sarif]
[--threshold N] [--fail-on SEVERITY] [--diff BRANCH]
[--fail-on-regression] [--comment] [--quiet] [--agent NAME]
```
**Design principle:** LLM **never** makes compliance determinations. Layers L1–L4 are fully deterministic (AST + rules). Layer L5 (LLM) is opt-in and only clarifies findings in the uncertain zone (50–80% confidence).
## The 5 layers
| Layer | Weight | What it checks | Checks |
| ------------------------- | ------ | ------------------------------------------------------------------------ | ------- |
| **L1** File Presence | 1.00 | README, LICENSE, .env, privacy policy, passport | 14 |
| **L2** Document Structure | 0.95 | Required sections, FRIA presence, section depth | 8 |
| **L3** Dependencies | 0.90 | AI packages (45 frameworks), lockfile, licenses, CVEs | 12 |
| **L4** Code Patterns | 0.75 | 40+ AST patterns, disclosure, logging, permissions | 33 |
| **L5** LLM Analysis | 0.70 | Targeted analysis for uncertain findings (opt-in, BYOK) | dynamic |
| **Cross-Layer** | — | 6 consistency rules (doc-code mismatch, logging without retention, etc.) | 6 |
## What gets scanned
| Capability | Details |
| ----------------- | -------------------------------------------------------------------------------------- |
| **AI Frameworks** | 57+ detected: LangChain, CrewAI, OpenAI, Anthropic, Vercel AI, HuggingFace, LlamaIndex |
| **Languages** | TypeScript/JavaScript, Python, Go, Rust, Java |
| **Secrets** | 37 patterns: API keys, tokens, passwords (Rust-native detection) |
| **Git History** | 21 compliance-relevant documents traced through commit history |
| **Import Graph** | 45 AI packages + transitive dependencies mapped |
| **File Limit** | 500 files max, 1 MB each |
## Example output
```
◆ Complior v1.0.0 · EU AI Act Compliance Scanner
────────────────────────────────────────────────────────────────────────────────
Scanning acme-ai-support
Files 57 collected
Elapsed 82ms
Layers L1 File Presence · L2 Document Structure · L3 Dependencies
· L4 Code Patterns · NHI Secrets · GPAI Systemic Risk
────────────────────────────────────────────────────────────────────────────────
COMPLIANCE SCORE 33 / 100 F
SECURITY SCORE N/A
Run `complior eval --security ` for security scoring
────────────────────────────────────────────────────────────────────────────────
!! Score capped — critical violations limit maximum achievable score
Framework Breakdown
EU AI Act 33 / 100 ███████░░░░░░░░░░░░░
Layer Results
L1 File Presence FAIL 13 issues found
L3 Dependencies FAIL 3 issues found
L4 Code Patterns WARN 46 issues found
NHI Secrets FAIL 7 issues found
CROSS Cross-Layer WARN 3 issues found
GPAI Systemic Risk PASS 1 checks passed
────────────────────────────────────────────────────────────────────────────────
FINDINGS (72 total · 6 critical · 8 high · 55 medium)
────────────────────────────────────────────────────────────────────────────────
acme-ai-support-anthropic · AI System (4 findings)
L4 Code Patterns
F-001 ● MEDIUM [L4] Art. 15(4) · Security Vulnerability
WARNING: Hardcoded API key in source code
File: src/agents/autonomous-agent.ts:12
Fix: Move API keys to environment variables or secret management
NHI Secrets
F-028 ✖ CRITICAL [NHI] Art. 15(4) · Secrets: Api_key
Anthropic API key detected: sk-a...34yz
File: src/agents/llm-service.py:12
Fix: Remove or externalize the secret from source code
PROJECT-LEVEL (44 findings)
L1 File Presence
F-029 ▲ HIGH [L1] Art. 26(4) · Agent Passport
No Agent Passport found — AI SDK detected but no
.complior/agents/*-manifest.json (Art. 26(4))
Fix: Run `complior agent init` to generate an Agent Passport
...
PER-AGENT SUMMARY
────────────────────────────────────────────────────────────────────────────────
AGENT FINDINGS CRITICAL HIGH FILES
-------------------------------------------------------
acme-ai-support-anthropic 4 0 0 2
acme-ai-support-autogen 0 0 0 0
acme-ai-support-bedrock 2 0 0 1
acme-ai-support-crewai 0 0 0 0
acme-ai-support-langchain 1 0 0 1
acme-ai-support-openai 20 1 0 9
────────────────────────────────────────────────────────────────────────────────
QUICK ACTIONS
────────────────────────────────────────────────────────────────────────────────
Auto-fix available complior fix
Deep scan complior scan --deep
Full interactive view complior tui
Export JSON complior scan --json > report.json
Next: fix 6 critical issues to improve your score
```
## JSON output
Use `--json` for structured output in CI/CD pipelines:
```json theme={null}
{
"score": { "compliance": 33, "security": null },
"frameworks": {
"eu-ai-act": { "score": 33, "grade": "F" }
},
"findings": [
{
"id": "no-disclosure",
"severity": "critical",
"layer": "L4",
"obligation": "OBL-050",
"article": "Art.50",
"message": "No AI disclosure found in agent code",
"file": "src/agents/order-agent.ts",
"line": 42,
"fixable": true
}
]
}
```
## Finding severities
| Severity | Meaning | Example |
| ------------ | ----------------------------------------- | -------------------------------------------- |
| **Critical** | Blocks deployment. Art.5 violation. | Prohibited practice, no disclosure |
| **High** | Major gap. Required for your risk class. | Missing FRIA, no human oversight |
| **Medium** | Recommended. Affects score significantly. | Weak logging, incomplete error handling |
| **Low** | Best practice. Minor score impact. | Missing .gitignore, outdated dependency |
| **Info** | Informational. Not scored. | Bare LLM API call detected (SDK recommended) |
**Info findings** are detected patterns that are not compliance violations. They appear in scan output as recommendations but do not affect your score. Example: bare LLM API calls — the EU AI Act requires disclosure, logging, and oversight (separate checks), not SDK wrapping specifically.
## All scan flags
| Flag | What it does |
| ---------------------- | ---------------------------------------------------------------- |
| `--deep` | Tier 2: Run Semgrep, Bandit, ModelScan, detect-secrets |
| `--llm` | L5: AI-powered document quality analysis (requires BYOK API key) |
| `--cloud` | Tier 3: Cloud-based SBOM + PII + vendor assessment |
| `--ci` | CI mode: exit 0 if score >= threshold, else 1 |
| `--json` | Output as JSON |
| `--sarif` | Output as SARIF v2.1.0 (GitHub Code Scanning, VS Code) |
| `--threshold N` | Score threshold for CI pass (default: 50) |
| `--fail-on SEVERITY` | Fail on severity level (critical, high, medium, low) |
| `--diff BRANCH` | Diff mode: compare against base branch (e.g., main) |
| `--fail-on-regression` | Exit 1 if score regressed or new critical findings |
| `--comment` | Post diff as PR comment (requires `gh` CLI) |
| `--quiet` / `-q` | Show only critical findings and score |
| `--agent NAME` | Filter scan by agent name (passport `source_files`) |
| `--no-tui` | Headless human-readable output (no TUI) |
## Automatic passport update
After every scan, all Agent Passports auto-update `complior_score`, `last_scan`, and re-sign with ed25519.
6 tiers from offline to cloud-enriched.
Dual scoring across compliance frameworks.
# Scan Tiers
Source: https://docs.complior.ai/scan/scan-tiers
6 composable scan tiers — from zero-dependency offline to full cloud enrichment.
Scan tiers are composable flags. Each tier adds capability while keeping everything below it.
```bash theme={null}
complior scan
```
| | |
| ---------------- | --------------------------------------------------------- |
| **Coverage** | 60–70% |
| **Time** | 2–5 seconds |
| **Dependencies** | None (zero install) |
| **What runs** | L1–L4 checks + Rust-native secret detection (37 patterns) |
Works completely offline. No internet, no accounts, no API keys.
```bash theme={null}
complior scan --llm
```
| | |
| ---------------- | ------------------------------------------------------------------------------------------------- |
| **Coverage** | 70–80% |
| **Time** | +5–15 seconds |
| **Dependencies** | BYOK API key (OpenAI, Anthropic, OpenRouter, Ollama) |
| **What adds** | L5 targeted LLM analysis for uncertain findings (50–80% confidence) + document quality validation |
```bash theme={null}
complior scan --deep
```
| | |
| ---------------- | ---------------------------------------------------------------------------------------------- |
| **Coverage** | 80–85% |
| **Time** | 10–30 seconds |
| **Dependencies** | Auto-download \~150 MB (one-time, cached in `~/.complior/tools/`) |
| **What adds** | Semgrep (multi-lang AST rules), Bandit (Python security), ModelScan (model backdoor detection) |
```bash theme={null}
complior scan --deep --llm
```
| | |
| ---------------- | --------------------------------------------------------------------------------- |
| **Coverage** | 85–90% |
| **Dependencies** | Auto-download \~150 MB + BYOK API key |
| **What runs** | L1–L5 + Semgrep/Bandit/ModelScan. Full offline analysis with maximum local depth. |
Best option when you want maximum depth without sending any data to the cloud.
```bash theme={null}
complior scan --cloud
```
| | |
| ---------------- | ----------------------------------------------------------------------------------------------------- |
| **Coverage** | 90–95% |
| **Dependencies** | Cloud account |
| **What adds** | AI SBOM + CycloneDX, Presidio PII detection (50+ EU types), vendor Art.25 assessment, PDF/DOCX export |
Cloud scan sends findings + deps + code snippets to `scan.complior.dev`. **Not** full source code. EU data residency (Hetzner, Germany).
```bash theme={null}
complior scan --deep --llm --cloud
```
| | |
| ------------- | --------------------------------------------------------------------------- |
| **Coverage** | 95%+ |
| **What runs** | Everything: L1–L5 + Semgrep/Bandit/ModelScan + SBOM/PII/vendor + hosted LLM |
Maximum analysis depth. All flags combined.
## Deep scan tools
Tools auto-downloaded on first `--deep` run:
| Tool | License | What it does |
| ------------- | ---------- | ----------------------------------------------------- |
| **Semgrep** | LGPL-2.1 | Multi-language AST rules (20–30 YAML rules) |
| **Bandit** | Apache 2.0 | Python security analysis (pickle, eval, exec) |
| **ModelScan** | Apache 2.0 | Model file backdoor detection (.pt/.pkl/.safetensors) |
All cached in `~/.complior/tools/`. No manual setup needed.
# Scoring
Source: https://docs.complior.ai/scan/scoring
Dual scoring system — compliance + security — across multiple international frameworks.
Every scan produces **two** independent scores, each computed across multiple frameworks.
## Dual scores
| Score | Source | Frameworks | Scale |
| -------------------- | --------------------------------- | ----------------------------- | ----------- |
| **Compliance Score** | Code analysis against regulations | EU AI Act, AIUC-1, ISO 42001 | 0–100 (A–F) |
| **Security Score** | Attack surface analysis | OWASP LLM Top 10, MITRE ATLAS | 0–100 (A–F) |
## Grade scale
| Grade | Score Range | Meaning |
| ----- | ----------- | ------------------------------------ |
| **A** | 90–100 | Excellent — audit-ready |
| **B** | 80–89 | Good — minor improvements needed |
| **C** | 70–79 | Acceptable — significant gaps remain |
| **D** | 60–69 | Poor — major compliance work needed |
| **F** | 0–59 | Failing — critical issues |
## Critical caps
Certain categories cap the maximum achievable score:
* **Prohibited practices = 0** → max overall score: **29**
* **Transparency = 0** → max overall score: **49**
* **No passport** → max overall score: **69**
## Multi-framework scoring
Configure which frameworks to score against in `.complior/config.toml`:
```toml theme={null}
frameworks = ["eu-ai-act", "aiuc-1", "owasp-llm", "mitre-atlas"]
```
Each framework has its own scorer with independent weights and rules. The default is `["eu-ai-act"]`.
## Info findings
Findings with severity `info` are **excluded from scoring**. They appear in scan output as recommendations (e.g., "bare LLM API call detected — consider `@complior/sdk`") but do not reduce your compliance score. Only `fail` findings count toward scoring.
## Score composition
Scores are computed in 3 layers:
| Layer | What | Example |
| ------------------------ | ------------------------------------------------------------------ | ---------------------------------------- |
| **Foundation metrics** | Scan results, passport presence, evidence, docs, adversarial tests | passport-presence: +5, no-disclosure: -8 |
| **Per-framework scores** | Weighted by framework-specific rules | EU AI Act weights Art.5 highest |
| **Economic indicators** | Compliance debt, estimated cost, deadline risk | 45 days to deadline, €12K estimated cost |
# Advanced Features
Source: https://docs.complior.ai/sdk/advanced
Config hot-reload, retry with backoff, streaming support, interaction logging, provider detection, and proxy architecture.
## Config Hot-Reload
The SDK watches `.complior/proxy.toml` (or a custom path) for changes and reloads configuration without restarting your application.
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
// Auto-watches .complior/proxy.toml (default)
const client = complior(new OpenAI(), {
biasThreshold: 0.3,
});
// Custom config path
const client = complior(new OpenAI(), {
configPath: '/etc/complior/proxy.toml',
});
// Disable hot-reload entirely
const client = complior(new OpenAI(), {
configPath: false,
});
```
* File changes are debounced at **100ms**
* Programmatic config takes precedence over file-based config on conflicts
* The pipeline is rebuilt on each config change — no stale state
### ConfigWatcher API
For direct access to the watcher:
```typescript theme={null}
import { createConfigWatcher } from '@complior/sdk';
const watcher = createConfigWatcher(baseConfig, '.complior/proxy.toml');
watcher.onChange((newConfig) => {
console.log('Config updated:', newConfig);
});
// Get current merged config
const current = watcher.getConfig();
// Clean up
watcher.close();
```
## Retry
Automatic retry with exponential backoff and jitter for transient errors.
```typescript theme={null}
const client = complior(new OpenAI(), {
retry: {
enabled: true, // default: true
maxRetries: 3, // default: 3
baseDelayMs: 1000, // default: 1000ms
maxDelayMs: 30000, // default: 30000ms
},
});
```
### Retryable Errors
| Type | Values |
| ------------------- | --------------------------------------------------------------- |
| HTTP status codes | `429`, `500`, `502`, `503`, `504` |
| Network error codes | `ECONNREFUSED`, `ECONNRESET`, `ETIMEDOUT`, `EPIPE`, `EAI_AGAIN` |
Compliance errors (`MiddlewareError` and all subclasses) are **never retried**. A `ProhibitedPracticeError` or `BiasDetectedError` will always propagate immediately.
### Delay Formula
```
delay = min(baseDelayMs × 2^attempt + jitter, maxDelayMs)
jitter = random(0, baseDelayMs × 0.5)
```
### Standalone Usage
The retry utility can be used independently:
```typescript theme={null}
import { withRetry } from '@complior/sdk';
const result = await withRetry(
() => fetch('https://api.example.com/data'),
{ maxRetries: 5, baseDelayMs: 500 },
);
```
## Streaming
The SDK handles `AsyncIterable` (streaming) responses transparently:
1. Stream chunks are yielded immediately to the caller (no buffering delay)
2. Delta text is accumulated internally
3. After the stream completes, post-hooks run on the accumulated text
4. Compliance metadata is attached to the final result
```typescript theme={null}
const stream = await client.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Hello' }],
stream: true,
});
for await (const chunk of stream) {
// Chunks arrive in real-time
process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}
// Post-hooks (bias check, safety, etc.) run after stream ends
```
Supported stream formats:
* **OpenAI**: `choices[0].delta.content`
* **Anthropic**: `delta.text`
Post-hook errors on streamed content are non-fatal — content has already been delivered to the caller. Errors are silently caught.
## Interaction Logger
Structured JSONL logging for compliance audit trails (OBL-006, Art.12).
```typescript theme={null}
const client = complior(new OpenAI(), {
interactionLogger: true,
interactionLogPath: '.complior/logs/interactions.jsonl', // default
});
```
### Log Entry Format
Each LLM call produces one JSONL line:
```typescript theme={null}
interface InteractionLogEntry {
readonly timestamp: string; // ISO 8601
readonly provider: string; // 'openai', 'anthropic', etc.
readonly method: string; // 'create', etc.
readonly model: string; // 'gpt-4', 'claude-3-opus', etc.
readonly promptHash: string; // SHA-256 of input
readonly responseHash: string; // SHA-256 of output
readonly latencyMs: number; // Round-trip time
readonly inputTokens: number; // Input token count
readonly outputTokens: number; // Output token count
readonly complianceChecks: {
readonly disclosureVerified: boolean;
readonly biasCheckPassed: boolean;
readonly piiRedacted: number;
readonly escalationDetected: boolean;
};
}
```
### Behavior
* Logging is **fire-and-forget** — I/O never blocks the response pipeline
* Log write failures are silently suppressed (non-critical)
* Auto-rotates at **100 MB** — old file is renamed with timestamp suffix
* Directory is created automatically on first write
## Provider Detection
The SDK auto-detects LLM providers using a 3-step strategy:
Check for `Symbol.for('complior:provider')` property on the client — user-provided override.
Match `client.constructor.name` against known providers: `OpenAI`, `AzureOpenAI`, `Anthropic`.
Check for characteristic properties: `chat` (OpenAI), `messages` (Anthropic), `generateContent` (Google), `streamText`/`generateText` (Vercel AI).
Detection determines which methods are intercepted:
| Provider | Intercepted | Proxy Depth |
| --------- | ---------------------------- | ------------------------------------- |
| OpenAI | `chat.completions.create` | 3-level (chat → completions → create) |
| Anthropic | `messages.create` | 2-level (messages → create) |
| Google | `generateContent` | Top-level |
| Vercel AI | `streamText`, `generateText` | Top-level |
## Proxy Architecture
The SDK uses a 3-layer JavaScript `Proxy` design:
```
Top-level Proxy (client)
│
├── Intercepts namespace access (chat, messages, etc.)
│
└── Nested Proxy (namespace)
│
├── Intercepts sub-namespace (completions)
│
└── Method Proxy (function)
│
└── Runs: pre-hooks → retry(LLM call) → stream/post-hooks
```
* The original client object is never modified
* Non-intercepted properties pass through to the original via `Reflect.get`
* Config watcher is cleaned up via `Symbol.for('complior:close')`
Full MiddlewareConfig and TOML reference.
Express, Fastify, Hono, Next.js adapters.
# Agent Mode
Source: https://docs.complior.ai/sdk/agent-mode
compliorAgent() — passport-enforced compliance with permission control, rate limiting, budget tracking, circuit breaker, and action logging.
`compliorAgent()` extends the base `complior()` wrapper with 5 agent-specific hooks that enforce constraints defined in an [Agent Passport](/passport/overview).
```typescript theme={null}
import { compliorAgent } from '@complior/sdk';
import OpenAI from 'openai';
import fs from 'node:fs';
const passport = JSON.parse(
fs.readFileSync('.complior/agents/order-processor-manifest.json', 'utf-8')
);
const agent = compliorAgent(new OpenAI(), {
jurisdictions: ['EU'],
passport,
budgetLimitUsd: 10,
onAction: (entry) => console.log('LLM call:', entry),
});
// Use as normal — all constraints auto-enforced
const response = await agent.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Process order #1234' }],
});
```
## AgentConfig
`AgentConfig` extends [`MiddlewareConfig`](/sdk/configuration) with these fields:
| Field | Type | Default | Description |
| -------------------- | ------------------------------------ | ------------- | -------------------------------- |
| `passport` | `Record` | **required** | Agent Passport JSON |
| `budgetLimitUsd` | `number` | From passport | Session budget cap in USD |
| `onBudgetExceeded` | `'warn' \| 'block'` | `'block'` | Action when budget exceeded |
| `onPermissionDenied` | `'warn' \| 'block'` | `'block'` | Action when method is denied |
| `toolCallAction` | `ToolCallAction` | `'block'` | How to handle denied tool calls |
| `onToolCallDenied` | `(denied: DeniedToolCall[]) => void` | `undefined` | Callback for denied tool calls |
| `onAction` | `(entry: ActionLogEntry) => void` | `undefined` | Audit callback for each LLM call |
| `circuitBreaker` | `CircuitBreakerConfig` | `undefined` | Circuit breaker settings |
## Passport Field Mapping
The SDK reads these fields from the passport object:
| Passport Path | Hook | Behavior |
| ------------------------------------------------ | -------------------- | --------------------------------------------------- |
| `permissions.denied[]` | Permission | Methods in this list are blocked |
| `permissions.tools[]` | Tool-call permission | Allowed tool names |
| `constraints.prohibited_actions[]` | Permission | Action names that are blocked |
| `constraints.rate_limits.max_actions_per_minute` | Rate limit | Sliding window cap |
| `constraints.budget.max_cost_per_session_usd` | Budget | Session cost limit (overridden by `budgetLimitUsd`) |
## Hook Pipeline
Agent hooks are added around the standard compliance hooks:
```
PRE-HOOKS (agent):
1. Permission check ← passport.permissions.denied + constraints.prohibited_actions
2. Rate limit ← constraints.rate_limits.max_actions_per_minute
PRE-HOOKS (standard):
3. Logger, Prohibited, Sanitize, Disclosure...
LLM API CALL
POST-HOOKS (standard):
4. Disclosure Verify, Content Marking, Bias Check...
POST-HOOKS (agent):
5. Tool-call permission ← passport.permissions.tools (allowlist/denylist)
6. Circuit breaker ← error threshold monitoring
7. Budget tracking ← token cost accumulation
8. Action log ← audit callback
```
## Permission Enforcement
The permission pre-hook blocks API calls based on the passport:
```typescript theme={null}
const agent = compliorAgent(new OpenAI(), {
passport: {
permissions: {
denied: ['images.generate'], // Block image generation
tools: ['web_search', 'calculator'], // Only these tools allowed
},
constraints: {
prohibited_actions: ['delete', 'drop'],
},
},
onPermissionDenied: 'block', // Throws PermissionDeniedError
});
```
## Rate Limiting
Sliding 60-second window based on passport constraints:
```typescript theme={null}
const agent = compliorAgent(new OpenAI(), {
passport: {
constraints: {
rate_limits: { max_actions_per_minute: 30 },
},
},
});
// Throws RateLimitError after 30 calls within 60 seconds
```
## Budget Tracking
Estimates token cost from response metadata and accumulates across the session:
```typescript theme={null}
const agent = compliorAgent(new OpenAI(), {
passport: { /* ... */ },
budgetLimitUsd: 5.00, // $5 session cap
onBudgetExceeded: 'block', // Throws BudgetExceededError
});
```
If `budgetLimitUsd` is not set, the SDK falls back to `passport.constraints.budget.max_cost_per_session_usd`.
## Circuit Breaker
3-state machine that suspends the agent after consecutive errors (Art.14(4)(b)):
```
closed ──[errors ≥ threshold]──→ open ──[cooldown elapsed]──→ half-open
↑ │
└──────────────[probe succeeds]──────────────────────────────┘
```
```typescript theme={null}
const agent = compliorAgent(new OpenAI(), {
passport: { /* ... */ },
circuitBreaker: {
errorThreshold: 5, // Trip after 5 errors (default)
windowMs: 60_000, // Count errors within 60s window (default)
cooldownMs: 30_000, // Wait 30s before half-open probe (default)
onTrip: (state) => console.log(`Circuit: ${state}`),
},
});
```
| Field | Type | Default | Description |
| ---------------- | ----------------- | ----------- | --------------------------------- |
| `errorThreshold` | `number` | `5` | Consecutive errors to trip |
| `windowMs` | `number` | `60000` | Sliding window for error counting |
| `cooldownMs` | `number` | `30000` | Cooldown before half-open probe |
| `onTrip` | `(state) => void` | `undefined` | Callback on state transitions |
When the circuit is **open**, all calls throw `CircuitBreakerError` until cooldown elapses. In **half-open**, one probe call is allowed — success resets to **closed**, failure re-opens.
## Action Logging
Every LLM call produces an `ActionLogEntry` via the `onAction` callback:
```typescript theme={null}
interface ActionLogEntry {
readonly provider: string; // 'openai', 'anthropic', etc.
readonly method: string; // 'create', 'generateContent', etc.
readonly timestamp: string; // ISO 8601
readonly cost: number; // Estimated cost in USD
readonly metadata: Record;
}
```
```typescript theme={null}
const entries: ActionLogEntry[] = [];
const agent = compliorAgent(new OpenAI(), {
passport: { /* ... */ },
onAction: (entry) => entries.push(entry),
});
// After calls, `entries` contains the full audit trail
```
## Tool-Call Permission
The tool-call post-hook inspects LLM responses for tool/function calls and validates them against the passport:
* `passport.permissions.tools[]` — allowlist (only these tools permitted)
* `passport.permissions.denied[]` — denylist (these tools blocked)
* `toolCallAction` — `'block'` (remove denied calls) or `'warn'` (pass through with warning)
* `onToolCallDenied` — callback with details of denied tool calls
Supports OpenAI, Anthropic, and Google tool-call response formats.
Create and manage Agent Passports.
Agent-specific errors: Permission, Budget, RateLimit, CircuitBreaker.
# Bias Detection
Source: https://docs.complior.ai/sdk/bias-detection
Screen LLM responses for bias across 15 EU Charter Art.21 protected characteristics with domain-aware scoring.
The bias check post-hook screens LLM responses for discriminatory language across all 15 protected characteristics defined in the EU Charter of Fundamental Rights, Article 21.
## 15 Protected Characteristics
| Characteristic | Example Patterns | Severity Range |
| -------------------- | ---------------------------------------------------- | --------------- |
| `sex` | Gender stereotypes, role enforcement, selection bias | MEDIUM–HIGH |
| `race` | Racial generalizations, supremacy language | MEDIUM–CRITICAL |
| `colour` | Skin colour capability bias | HIGH |
| `ethnic_origin` | Ethnic generalizations, xenophobic directives | MEDIUM–HIGH |
| `social_origin` | Class-based bias, preferential treatment | MEDIUM |
| `genetic_features` | Genetic determinism, genetic screening for access | HIGH–CRITICAL |
| `language` | Language-based competence bias | LOW–MEDIUM |
| `religion` | Religious stereotypes, discrimination directives | MEDIUM–HIGH |
| `political_opinion` | Political stereotyping, discrimination | MEDIUM–HIGH |
| `national_minority` | Minority exclusion, group slurs | HIGH–CRITICAL |
| `property` | Wealth-based discrimination, access denial | MEDIUM–HIGH |
| `birth` | Birth-based discrimination, origin prejudice | MEDIUM |
| `disability` | Capability stereotypes, exclusion, slurs | HIGH–CRITICAL |
| `age` | Age-based capability bias (both older and younger) | MEDIUM–HIGH |
| `sexual_orientation` | Pathologization, discrimination | HIGH–CRITICAL |
| `nationality` | Nationality stereotypes, discrimination | HIGH |
## Severity Weights
Each pattern has a severity level that determines its contribution to the aggregate score:
| Severity | Weight | Description |
| ---------- | ------ | -------------------------------------- |
| `LOW` | 0.1 | Stereotyping, mild generalizations |
| `MEDIUM` | 0.3 | Differential treatment language |
| `HIGH` | 0.6 | Discriminatory outcome language |
| `CRITICAL` | 1.0 | Explicit slurs, hate speech, supremacy |
## Scoring Formula
```
pattern weight × domain multiplier → per-finding score
sum(per-finding scores) → aggregate score
aggregate score > threshold → action (warn or block)
```
## Domain Profiles
Each domain profile sets a default threshold and weight multipliers for characteristics that are especially sensitive in that context.
### General (default)
* **Threshold**: 0.3
* **Multipliers**: None (all at 1.0×)
### HR / Recruitment
The strictest profile — HR is classified as high-risk under EU AI Act Art.6(2).
* **Threshold**: 0.15
* **2.0× multipliers**: sex, race, age, disability, ethnic\_origin
* **1.5× multipliers**: religion, sexual\_orientation, nationality, political\_opinion
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
const client = complior(new OpenAI(), {
domain: 'hr',
biasAction: 'block',
// Threshold auto-set to 0.15, multipliers applied
});
```
### Finance
Strict on property and social origin for credit/loan decisions.
* **Threshold**: 0.2
* **2.0× multipliers**: property, social\_origin
* **1.5× multipliers**: race, nationality, birth
### Healthcare
Strict on disability and genetic features for medical decisions.
* **Threshold**: 0.2
* **2.0× multipliers**: disability, genetic\_features
* **1.5× multipliers**: age, race, sex
### Education
Strict on age, disability, and social origin for admissions/grading.
* **Threshold**: 0.2
* **2.0× multipliers**: age, disability, social\_origin
* **1.5× multipliers**: language, ethnic\_origin, birth
## Configuration
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
const client = complior(new OpenAI(), {
domain: 'finance', // Activates finance profile
biasThreshold: 0.15, // Override profile default (0.2)
biasAction: 'block', // Throw BiasDetectedError
});
```
| Field | Type | Default | Description |
| --------------- | ------------------- | --------------- | ------------------------------------------------------- |
| `domain` | `Domain` | `undefined` | Activates domain profile (sets threshold + multipliers) |
| `biasThreshold` | `number` | Profile default | Override threshold (0–1, lower = stricter) |
| `biasAction` | `'warn' \| 'block'` | `'warn'` | Action on threshold exceeded |
## BiasEvidence
When a finding is detected, it produces a `BiasEvidence` object:
```typescript theme={null}
interface BiasEvidence {
readonly characteristic: string; // e.g., 'sex', 'race'
readonly severity: string; // 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL'
readonly evidence: string; // Matched text
readonly score: number; // weight × domain multiplier
}
```
In `warn` mode, findings are available in response metadata. In `block` mode, they are on the `BiasDetectedError`.
`BiasDetectedError` reference.
Content safety patterns and HITL gate.
# Configuration Reference
Source: https://docs.complior.ai/sdk/configuration
Complete reference for MiddlewareConfig, AgentConfig, and TOML file-based configuration.
`@complior/sdk` accepts a `MiddlewareConfig` object at initialization. Every field is optional — sensible defaults are applied.
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
const client = complior(new OpenAI(), {
jurisdictions: ['EU'],
role: 'provider',
domain: 'hr',
strict: true,
});
```
## Core
| Field | Type | Default | Description |
| --------------- | ------------------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------ |
| `jurisdictions` | `('EU' \| 'US' \| 'UK' \| 'CA' \| 'AU' \| 'GLOBAL')[]` | `undefined` | Active jurisdictions for compliance checks |
| `role` | `'provider' \| 'deployer' \| 'both'` | `undefined` | EU AI Act role classification |
| `domain` | `Domain \| Domain[]` | `undefined` | Activates domain-specific hooks (`hr`, `finance`, `healthcare`, `education`, `legal`, `content`) |
| `logging` | `boolean` | `false` | Enable request/response logging |
| `strict` | `boolean` | `false` | Throw on any compliance violation (vs. warn) |
## PII / Sanitize
| Field | Type | Default | Description |
| -------------- | -------------------------------- | ----------- | -------------------------- |
| `sanitizeMode` | `'replace' \| 'block' \| 'warn'` | `'replace'` | How to handle detected PII |
```typescript theme={null}
const client = complior(new OpenAI(), {
sanitizeMode: 'block', // Throw PIIDetectedError instead of redacting
});
```
* **`replace`** — redacts PII with labels like `[PII:SSN]`, `[PII:EMAIL]`, `[PII:IBAN]`
* **`block`** — throws `PIIDetectedError` on first PII match
* **`warn`** — passes through unmodified, adds `piiDetected` to metadata
See [PII Detection](/sdk/pii-detection) for the full list of 50+ detectable types and checksum validators.
## Disclosure
| Field | Type | Default | Description |
| ------------------------- | ----------------------------------- | --------------------- | ------------------------------------------------- |
| `disclosureInjection` | `boolean` | `false` | Inject "I am AI" disclosure into system messages |
| `disclosureText` | `string` | Built-in per language | Custom disclosure text |
| `disclosurePosition` | `'prepend' \| 'append' \| 'header'` | `'prepend'` | Where to inject disclosure |
| `disclosureFrequency` | `'every' \| 'session-start'` | `'every'` | Injection frequency |
| `disclosureLanguages` | `('EN' \| 'DE' \| 'FR' \| 'ES')[]` | `['EN']` | Languages for disclosure verification |
| `disclosureMode` | `'warn-only' \| 'block'` | `'warn-only'` | Action when disclosure is missing from response |
| `customDisclosurePhrases` | `RegExp[]` | `undefined` | Additional patterns to accept as valid disclosure |
```typescript theme={null}
const client = complior(new OpenAI(), {
disclosureInjection: true,
disclosureText: 'This response is generated by an AI system.',
disclosurePosition: 'prepend',
disclosureLanguages: ['EN', 'DE'],
disclosureMode: 'block',
});
```
## Bias Detection
| Field | Type | Default | Description |
| --------------- | ------------------- | ---------------------------- | --------------------------------------------------------------- |
| `biasThreshold` | `number` (0–1) | `0.3` (general), `0.15` (HR) | Aggregate score threshold — findings above this trigger action |
| `biasAction` | `'warn' \| 'block'` | `'warn'` | Throw `BiasDetectedError` (`block`) or add to metadata (`warn`) |
The threshold depends on the active `domain` profile. See [Bias Detection](/sdk/bias-detection) for domain-specific weights.
## Safety Filter
| Field | Type | Default | Description |
| ----------------- | ---------------------------- | --------- | ------------------------------------------- |
| `safetyFilter` | `boolean` | `false` | Enable safety pattern scanning on responses |
| `safetyMode` | `'block' \| 'warn' \| 'log'` | `'block'` | Action on safety violation |
| `safetyThreshold` | `number` (0–1) | `0.5` | Aggregate score threshold |
```typescript theme={null}
const client = complior(new OpenAI(), {
safetyFilter: true,
safetyMode: 'warn', // Don't throw, add to metadata
safetyThreshold: 0.3, // Lower = stricter
});
```
## Human-in-the-Loop Gate
| Field | Type | Default | Description |
| ------------------- | --------------------------------------------- | ---------------- | ---------------------------------------------------- |
| `hitlGate` | `boolean` | `false` | Enable HITL gate for critical actions |
| `hitlGateTimeoutMs` | `number` | `300000` (5 min) | Timeout before auto-deny |
| `hitlGateRules` | `GateRule[]` | 4 built-in rules | Custom gate trigger rules |
| `onGateTriggered` | `(req: GateRequest) => Promise` | `undefined` | Approval callback — if absent, auto-deny (fail-safe) |
```typescript theme={null}
const client = complior(new OpenAI(), {
hitlGate: true,
hitlGateTimeoutMs: 60_000,
onGateTriggered: async (request) => {
const approved = await askHumanOperator(request);
return approved
? { approved: true }
: { approved: false, reason: 'Operator denied' };
},
});
```
See [Safety & HITL](/sdk/safety) for built-in rules and types.
## Interaction Logging
| Field | Type | Default | Description |
| -------------------- | --------- | ----------------------------------- | ------------------------------- |
| `interactionLogger` | `boolean` | `false` | Enable structured JSONL logging |
| `interactionLogPath` | `string` | `.complior/logs/interactions.jsonl` | Log file path |
Logs include provider, model, prompt/response hashes, token counts, latency, and compliance check results. Auto-rotates at 100 MB.
## Runtime
| Field | Type | Default | Description |
| ------------ | ----------------- | ---------------------- | ------------------------------------------------------- |
| `configPath` | `string \| false` | `.complior/proxy.toml` | TOML config file path, or `false` to disable hot-reload |
| `retry` | `RetryConfig` | See below | Retry configuration for transient errors |
### RetryConfig
| Field | Type | Default | Description |
| ------------- | --------- | ------- | -------------------------------- |
| `enabled` | `boolean` | `true` | Enable automatic retries |
| `maxRetries` | `number` | `3` | Maximum retry attempts |
| `baseDelayMs` | `number` | `1000` | Base delay (exponential backoff) |
| `maxDelayMs` | `number` | `30000` | Maximum delay cap |
Retries apply to status codes `429`, `500`–`504` and network errors (`ECONNREFUSED`, `ECONNRESET`, `ETIMEDOUT`, `EPIPE`, `EAI_AGAIN`). Compliance errors (`MiddlewareError` subclasses) are never retried.
## TOML File Configuration
Create `.complior/proxy.toml` for file-based configuration with hot-reload (100ms debounce):
```toml theme={null}
[hooks]
logging = true
safety_filter = true
hitl_gate = false
interaction_logger = true
disclosure_injection = true
[thresholds]
bias_threshold = 0.2
bias_action = "block"
safety_threshold = 0.3
safety_mode = "warn"
[sanitize]
mode = "replace"
[disclosure]
mode = "block"
languages = ["EN", "DE"]
text = "This response is AI-generated."
position = "prepend"
frequency = "every"
[hitl]
timeout_ms = 60000
[logging]
interaction_log_path = ".complior/logs/interactions.jsonl"
[retry]
enabled = true
max_retries = 5
base_delay_ms = 2000
max_delay_ms = 60000
```
Programmatic config takes precedence over file-based config on conflicts.
## AgentConfig
`AgentConfig` extends `MiddlewareConfig` with passport enforcement fields. See [Agent Mode](/sdk/agent-mode) for the full reference.
| Field | Type | Description |
| -------------------- | ------------------------------------ | ----------------------------------------------------- |
| `passport` | `Record` | Agent Passport JSON (loaded from `.complior/agents/`) |
| `budgetLimitUsd` | `number` | Session budget cap |
| `onBudgetExceeded` | `'warn' \| 'block'` | Action when budget exceeded |
| `onPermissionDenied` | `'warn' \| 'block'` | Action on denied method |
| `toolCallAction` | `ToolCallAction` | How to handle denied tool calls |
| `onToolCallDenied` | `(denied: DeniedToolCall[]) => void` | Callback for denied tools |
| `onAction` | `(entry: ActionLogEntry) => void` | Audit callback for each LLM call |
| `circuitBreaker` | `CircuitBreakerConfig` | Circuit breaker settings |
Passport enforcement, budget, rate limits.
Hot-reload, retry, streaming, logging.
# Error Handling
Source: https://docs.complior.ai/sdk/errors
12 error classes for compliance violations — catch specific errors with instanceof.
All SDK errors extend `MiddlewareError`, which extends `Error`. Each error class has a unique `code` string and structured fields for programmatic handling.
## Error Hierarchy
```
Error
└── MiddlewareError (code: string)
├── ProhibitedPracticeError PROHIBITED_PRACTICE
├── PIIDetectedError PII_DETECTED
├── BiasDetectedError BIAS_DETECTED
├── SafetyViolationError SAFETY_VIOLATION
├── DisclosureMissingError DISCLOSURE_MISSING
├── HumanGateDeniedError HUMAN_GATE_DENIED
├── DomainViolationError DOMAIN_VIOLATION
├── PermissionDeniedError PERMISSION_DENIED
├── BudgetExceededError BUDGET_EXCEEDED
├── RateLimitError RATE_LIMIT
└── CircuitBreakerError CIRCUIT_BREAKER
```
## Catching Errors
```typescript theme={null}
import {
ProhibitedPracticeError,
PIIDetectedError,
BiasDetectedError,
SafetyViolationError,
HumanGateDeniedError,
BudgetExceededError,
MiddlewareError,
} from '@complior/sdk';
try {
const response = await client.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: userInput }],
});
} catch (error) {
if (error instanceof ProhibitedPracticeError) {
console.error(`Art.5 violation: ${error.category}`);
console.error(`Penalty: ${error.penalty}`);
} else if (error instanceof PIIDetectedError) {
console.error(`PII found: ${error.piiType} (${error.category})`);
} else if (error instanceof BiasDetectedError) {
console.error(`Bias score: ${error.totalScore} > ${error.threshold}`);
error.findings.forEach(f =>
console.error(` ${f.characteristic}: ${f.severity} (${f.score})`)
);
} else if (error instanceof HumanGateDeniedError) {
console.error(`HITL ${error.reason}: rule "${error.rule}"`);
} else if (error instanceof BudgetExceededError) {
console.error(`$${error.totalCost} exceeds $${error.limitUsd} limit`);
} else if (error instanceof MiddlewareError) {
// Catch-all for any compliance error
console.error(`Compliance error [${error.code}]: ${error.message}`);
}
}
```
## Error Reference
### ProhibitedPracticeError
Thrown when input matches an EU AI Act Article 5 prohibited practice (138 patterns, 8 categories, 6 languages).
| Field | Type | Description |
| ---------------- | ----------------------- | --------------------------------------------------------------- |
| `code` | `'PROHIBITED_PRACTICE'` | Error code |
| `obligationId` | `string` | EU AI Act obligation ID |
| `article` | `string` | Article reference (e.g., `'Art.5'`) |
| `category` | `string` | Prohibition category (e.g., `'social_scoring'`, `'subliminal'`) |
| `matchedPattern` | `string` | The pattern that matched |
| `penalty` | `string` | Maximum penalty (default: `'€35M or 7% global turnover'`) |
### PIIDetectedError
Thrown in `block` sanitize mode when PII is detected in input.
| Field | Type | Description |
| ---------- | ---------------- | --------------------------------------------------------- |
| `code` | `'PII_DETECTED'` | Error code |
| `piiType` | `string` | PII type ID (e.g., `'SSN'`, `'IBAN'`, `'EMAIL'`) |
| `category` | `string` | PII category (e.g., `'identity_national'`, `'financial'`) |
| `article` | `string` | Legal basis (e.g., `'GDPR Art.87'`, `'GDPR Art.6'`) |
### BiasDetectedError
Thrown in `block` bias mode when aggregate bias score exceeds threshold.
| Field | Type | Description |
| ------------ | ----------------- | ---------------------------------- |
| `code` | `'BIAS_DETECTED'` | Error code |
| `findings` | `BiasEvidence[]` | Array of individual findings |
| `totalScore` | `number` | Aggregate weighted score |
| `threshold` | `number` | Active threshold (domain-specific) |
| `domain` | `string` | Active domain profile |
**`BiasEvidence`**:
| Field | Type | Description |
| ---------------- | -------- | -------------------------------------------------- |
| `characteristic` | `string` | Protected characteristic (e.g., `'sex'`, `'race'`) |
| `severity` | `string` | `'LOW'` \| `'MEDIUM'` \| `'HIGH'` \| `'CRITICAL'` |
| `evidence` | `string` | Matched text |
| `score` | `number` | Individual pattern score |
### SafetyViolationError
Thrown when response safety score exceeds threshold.
| Field | Type | Description |
| ------------ | -------------------- | ------------------------ |
| `code` | `'SAFETY_VIOLATION'` | Error code |
| `findings` | `SafetyFinding[]` | Array of safety findings |
| `totalScore` | `number` | Aggregate safety score |
| `threshold` | `number` | Active threshold |
**`SafetyFinding`**:
| Field | Type | Description |
| ---------- | -------- | ----------------------------------------------------------------------------------------------------------- |
| `category` | `string` | `'violence'` \| `'self_harm'` \| `'illegal_instructions'` \| `'pii_leakage'` \| `'hallucination_indicator'` |
| `severity` | `string` | `'LOW'` \| `'MEDIUM'` \| `'HIGH'` \| `'CRITICAL'` |
| `evidence` | `string` | Matched text |
| `score` | `number` | Individual pattern score |
### DisclosureMissingError
Thrown in `block` disclosure mode when AI disclosure is not found in the response.
| Field | Type | Description |
| ------------------ | ---------------------- | --------------------------- |
| `code` | `'DISCLOSURE_MISSING'` | Error code |
| `language` | `string` | Language checked |
| `expectedPatterns` | `string[]` | Patterns that were expected |
### HumanGateDeniedError
Thrown when HITL gate denies an action (human denial or timeout).
| Field | Type | Description |
| ----------- | ----------------------- | ----------------------------------- |
| `code` | `'HUMAN_GATE_DENIED'` | Error code |
| `reason` | `'denied' \| 'timeout'` | Denial reason |
| `rule` | `string` | Rule ID that triggered the gate |
| `timeoutMs` | `number \| undefined` | Timeout duration (only for timeout) |
### DomainViolationError
Thrown by domain-specific hooks (HR, finance, healthcare, etc.).
| Field | Type | Description |
| -------------- | -------------------- | ----------------------------------- |
| `code` | `'DOMAIN_VIOLATION'` | Error code |
| `domain` | `string` | Domain that triggered the violation |
| `obligationId` | `string` | Related obligation ID |
### PermissionDeniedError
Thrown in agent mode when a method is on the passport's denied list.
| Field | Type | Description |
| -------- | --------------------- | ------------------ |
| `code` | `'PERMISSION_DENIED'` | Error code |
| `method` | `string` | Denied method name |
### BudgetExceededError
Thrown in agent mode when accumulated cost exceeds the session budget.
| Field | Type | Description |
| ----------- | ------------------- | ---------------------------- |
| `code` | `'BUDGET_EXCEEDED'` | Error code |
| `totalCost` | `number` | Total accumulated cost (USD) |
| `limitUsd` | `number` | Budget limit (USD) |
### RateLimitError
Thrown in agent mode when actions exceed the per-minute rate limit.
| Field | Type | Description |
| -------------- | -------------- | --------------------- |
| `code` | `'RATE_LIMIT'` | Error code |
| `maxPerMinute` | `number` | Configured rate limit |
### CircuitBreakerError
Thrown in agent mode when the circuit breaker is open (too many consecutive errors).
| Field | Type | Description |
| ---------------- | ------------------- | ----------------------------------------- |
| `code` | `'CIRCUIT_BREAKER'` | Error code |
| `circuitState` | `string` | Current state (`'open'` \| `'half-open'`) |
| `errorThreshold` | `number` | Error count that triggered the trip |
Set modes and thresholds for each hook.
Permission, budget, rate limit, circuit breaker.
# Hooks Reference
Source: https://docs.complior.ai/sdk/hooks
6 pre-hooks and 8 post-hooks — what each one does and how to configure it.
## Pre-hooks (before LLM call)
| # | Hook | What it does | Default |
| - | -------------- | ---------------------------------------------------------------- | ------- |
| 1 | `logger` | Records incoming request for audit trail | On |
| 2 | `prohibited` | Blocks Art.5 violations: 138 patterns, 8 categories, 6 languages | On |
| 3 | `sanitize` | Redacts PII: 50+ types (IBAN, Steuernummer, BSN, NIR, PESEL) | On |
| 4 | `disclosure` | Injects "I am an AI" system message | On |
| 5 | `permission`\* | Checks tools against allowlist/denylist from passport | Off |
| 6 | `rate-limit`\* | Sliding window enforcement from passport constraints | Off |
\*Agent mode only (`compliorAgent`)
## Post-hooks (after LLM response)
| # | Hook | What it does | Default |
| - | ------------------- | --------------------------------------------------------------------- | ------- |
| 1 | `disclosure-verify` | Confirms AI disclosure present in response (4 languages) | On |
| 2 | `content-marking` | Adds AI-generated metadata to response | On |
| 3 | `escalation` | Detects if response requires human escalation | Off |
| 4 | `bias-check` | Screens for bias across 15 EU Charter protected characteristics | Off |
| 5 | `headers` | Adds compliance HTTP headers (X-AI-Disclosure, X-AI-Provider) | Off |
| 6 | `budget`\* | Tracks cost against session budget from passport | Off |
| 7 | `action-log`\* | Calls audit callback with full request/response | Off |
| 8 | `circuit-breaker` | Cascade protection: stops calling LLM if error rate exceeds threshold | Off |
\*Agent mode only
## Domain hooks (opt-in)
Industry-specific hooks for specialized compliance:
| Domain | What it adds |
| -------------- | ------------------------------------------------- |
| **HR** | Candidate anonymization, fair hiring checks |
| **Finance** | Audit logging, risk disclosure requirements |
| **Healthcare** | Patient de-identification, diagnostic disclaimers |
| **Education** | Content safety, assessment fairness |
| **Legal** | Legal disclaimers, AI limitation warnings |
| **Content** | AI-GENERATED marker in metadata |
# HTTP Middleware
Source: https://docs.complior.ai/sdk/middleware
4 HTTP middleware adapters (Express, Fastify, Hono, Next.js) that inject compliance headers from SDK responses.
The SDK provides HTTP middleware adapters that extract compliance metadata from LLM responses and inject them as HTTP headers. This enables downstream services, API gateways, and monitoring tools to observe compliance status.
## How It Works
1. Your API endpoint calls the SDK-wrapped LLM client
2. The SDK attaches `_complior` metadata to the LLM response
3. The HTTP middleware intercepts outgoing responses
4. Metadata is extracted and injected as HTTP headers
## Compliance Headers
| Header | Description | Example Value |
| --------------------------- | ---------------------------- | --------------------- |
| `X-AI-Disclosure` | AI disclosure status | `true`, `verified` |
| `X-AI-Provider` | LLM provider name | `openai`, `anthropic` |
| `X-AI-Model` | Model used | `gpt-4` |
| `X-Compliance-Score` | Compliance score (0–100) | `95` |
| `X-Content-Marking` | AI-generated content marking | `true` |
| `X-Bias-Warning` | Bias detection warning | `true` |
| `X-Bias-Score` | Bias aggregate score | `0.15` |
| `X-Human-Review` | HITL gate triggered | `true` |
| `X-Tool-Permission-Warning` | Tool permission issue | `true` |
## Express
```typescript theme={null}
import express from 'express';
import { compliorExpress } from '@complior/sdk/middleware';
const app = express();
// Apply globally
app.use(compliorExpress());
// Or with header filtering
app.use(compliorExpress({
headers: {
include: ['X-AI-Disclosure', 'X-Compliance-Score'],
// or exclude: ['X-Bias-Score']
},
}));
app.post('/api/chat', async (req, res) => {
const response = await client.chat.completions.create({ /* ... */ });
res.json(response);
// Headers automatically injected before response is sent
});
```
The Express adapter intercepts `res.write()` and `res.end()` to capture the response body, extract compliance metadata, and set headers before the response is finalized.
## Fastify
```typescript theme={null}
import Fastify from 'fastify';
import { compliorFastify } from '@complior/sdk/middleware';
const fastify = Fastify();
// Register as plugin
fastify.register(compliorFastify());
// With header filtering
fastify.register(compliorFastify({
headers: { exclude: ['X-AI-Model'] },
}));
fastify.post('/api/chat', async (request, reply) => {
const response = await client.chat.completions.create({ /* ... */ });
return response;
// onSend hook injects headers
});
```
Uses Fastify's `onSend` hook to intercept the serialized payload.
## Hono
```typescript theme={null}
import { Hono } from 'hono';
import { compliorHono } from '@complior/sdk/middleware';
const app = new Hono();
// Apply globally
app.use('*', compliorHono());
app.post('/api/chat', async (c) => {
const response = await client.chat.completions.create({ /* ... */ });
return c.json(response);
// Headers injected after handler completes
});
```
The Hono adapter uses async/await middleware — it calls `next()`, then clones the response to extract metadata and set headers.
Streaming responses may not be clonable — header injection is silently skipped in that case.
## Next.js
```typescript theme={null}
// pages/api/chat.ts
import type { NextApiRequest, NextApiResponse } from 'next';
import { compliorNextjs } from '@complior/sdk/middleware';
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const response = await client.chat.completions.create({ /* ... */ });
res.json(response);
};
export default compliorNextjs(handler);
// With header filtering
export default compliorNextjs(handler, {
headers: { include: ['X-AI-Disclosure', 'X-Compliance-Score'] },
});
```
Wraps `res.json()` and `res.send()` to inject headers before the response is sent.
## Header Filtering
All adapters accept a `MiddlewareOptions` object:
```typescript theme={null}
interface MiddlewareOptions {
readonly headers?: {
readonly include?: readonly string[]; // Only these headers pass
readonly exclude?: readonly string[]; // Remove these headers
};
}
```
* If `include` is set, only listed headers are injected
* If `exclude` is set, listed headers are removed from output
* Both can be combined — `include` is applied first, then `exclude`
SDK configuration reference.
Supported LLM providers.
# SDK Overview
Source: https://docs.complior.ai/sdk/overview
@complior/sdk — runtime compliance wrapper for LLM clients. 14 hooks, 4 providers, zero config.
`@complior/sdk` is an npm library that wraps LLM clients with a compliance pipeline. Every API call passes through: **pre-hooks → LLM call → post-hooks**. All checks are deterministic (regex + rules).
```bash theme={null}
npm install @complior/sdk
```
## Quick start
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
const client = complior(new OpenAI(), {
hooks: ['prohibited', 'sanitize', 'disclosure', 'bias'],
});
// Use as normal — hooks work transparently
const response = await client.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: userInput }],
});
```
## Two modes
| Mode | Function | Features |
| --------- | ------------------------------------- | ---------------------------------------------------------------------------------- |
| **Basic** | `complior(client, config)` | Core hooks: prohibited, sanitize, disclosure, bias, escalation |
| **Agent** | `compliorAgent(client, { passport })` | All core hooks + passport enforcement: permissions, rate-limit, budget, action-log |
## Agent mode (passport enforcement)
```typescript theme={null}
import { compliorAgent } from '@complior/sdk';
const passport = JSON.parse(
fs.readFileSync('.complior/agents/order-processor-manifest.json')
);
const agent = compliorAgent(new OpenAI(), { passport });
// Passport constraints auto-enforced:
// - permissions.tools → allowlist/denylist
// - constraints.rate_limits → sliding window
// - constraints.budget → cost cap per session
```
6 pre-hooks + 8 post-hooks in detail.
OpenAI, Anthropic, Google, Vercel AI.
# PII Detection & Redaction
Source: https://docs.complior.ai/sdk/pii-detection
50+ PII types across 6 categories with checksum validators. EU-focused: IBAN, BSN, NIR, PESEL, Codice Fiscale, and GDPR Art.9 special categories.
The sanitize pre-hook scans input text for personally identifiable information (PII). It supports 50+ pattern types, 5 checksum validators, and 6 categories — with a focus on EU member state identifiers.
## Three Modes
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
// Mode 1: Replace (default) — redact PII with labels
const client = complior(new OpenAI(), { sanitizeMode: 'replace' });
// Input: "My SSN is 123-45-6789"
// Passed: "My SSN is [PII:SSN]"
// Mode 2: Block — throw PIIDetectedError on first match
const client = complior(new OpenAI(), { sanitizeMode: 'block' });
// Mode 3: Warn — pass through, add metadata only
const client = complior(new OpenAI(), { sanitizeMode: 'warn' });
```
## Categories & Types
### National IDs (`identity_national`)
8 EU/US national identification numbers.
| Type | Country | Pattern | Validator | Redaction Label |
| ----------------- | ------- | ---------------------------------------- | ----------------- | ----------------------- |
| `SSN` | US | `\d{3}-\d{2}-\d{4}` | — | `[PII:SSN]` |
| `BSN` | NL | `\d{9}` | 11-check | `[PII:BSN]` |
| `NIR` | FR | `[12] dd dd dd ddd ddd dd` | mod-97 | `[PII:NIR]` |
| `PESEL` | PL | `\d{11}` | Weighted checksum | `[PII:PESEL]` |
| `CODICE_FISCALE` | IT | `[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]` | Check character | `[PII:CODICE_FISCALE]` |
| `PERSONALAUSWEIS` | DE | `[CFGHJKLMNPRTVWXYZ0-9]{9}\d` | — | `[PII:PERSONALAUSWEIS]` |
| `DNI` | ES | `\d{8}[A-Z]` | — | `[PII:DNI]` |
| `NIF` | PT | `\d{9}[A-Z]{2}` | — | `[PII:NIF]` |
### Passports (`identity_passport`)
14 EU country formats + generic international passport pattern.
| Types | Countries |
| ------------------ | -------------- |
| `PASSPORT_DE` | Germany |
| `PASSPORT_FR` | France |
| `PASSPORT_NL` | Netherlands |
| `PASSPORT_PL` | Poland |
| `PASSPORT_IT` | Italy |
| `PASSPORT_ES` | Spain |
| `PASSPORT_PT` | Portugal |
| `PASSPORT_BE` | Belgium |
| `PASSPORT_AT` | Austria |
| `PASSPORT_SE` | Sweden |
| `PASSPORT_DK` | Denmark |
| `PASSPORT_FI` | Finland |
| `PASSPORT_IE` | Ireland |
| `PASSPORT_CZ` | Czech Republic |
| `PASSPORT_GENERIC` | International |
### Financial (`financial`)
| Type | Description | Validator | Article |
| ------------- | --------------------------------------------- | --------- | ---------- |
| `IBAN` | International Bank Account Number (ISO 13616) | mod-97 | GDPR Art.6 |
| `CREDIT_CARD` | Card numbers (spaced and contiguous) | — | GDPR Art.6 |
| `SWIFT_BIC` | SWIFT/BIC bank codes | — | GDPR Art.6 |
### Contact (`contact`)
| Type | Description | Article |
| ------------ | ----------------------------------------- | --------------- |
| `EMAIL` | Email addresses | GDPR Art.6 |
| `PHONE` | International + EU domestic phone numbers | GDPR Art.6 |
| `IP_ADDRESS` | IPv4 and IPv6 addresses | GDPR Recital 30 |
### Medical (`medical`)
| Type | Country | Description | Article |
| -------------- | ------- | ------------------------------------- | ---------------- |
| `EHIC` | EU | European Health Insurance Card | GDPR Art.9(2)(h) |
| `HEALTH_ID_DE` | DE | Krankenversichertennummer (KVNR) | GDPR Art.9(2)(h) |
| `HEALTH_ID_FR` | FR | Carte Vitale (NIR-based, with mod-97) | GDPR Art.9(2)(h) |
| `HEALTH_ID_UK` | UK | NHS number | GDPR Art.9(2)(h) |
### GDPR Art.9 Special Categories (`gdpr_art9`)
8 context-dependent patterns for special category data. These use keyword context matching — a pattern must appear alongside relevant context keywords to trigger.
| Type | Category | Context Keywords |
| ------------------ | ---------------------- | ------------------------------------------ |
| `ART9_RACIAL` | Racial/ethnic origin | race, ethnicity, heritage, nationality |
| `ART9_POLITICAL` | Political opinions | political, party, vote, election, ideology |
| `ART9_RELIGIOUS` | Religious beliefs | religion, faith, church, mosque, temple |
| `ART9_TRADE_UNION` | Trade union membership | union, labor, collective bargaining |
| `ART9_GENETIC` | Genetic data | DNA, genome, gene, hereditary |
| `ART9_BIOMETRIC` | Biometric data | fingerprint, facial recognition, iris |
| `ART9_HEALTH` | Health data | medical, diagnosis, patient, treatment |
| `ART9_SEXUAL` | Sexual orientation | orientation, gender identity, LGBTQ |
## Checksum Validators
Five types use algorithmic validation to reduce false positives:
| Validator | Algorithm | Used By |
| -------------- | ---------------------- | --------------------- |
| IBAN | ISO 7064 mod-97 | `IBAN` |
| BSN | 11-proof (Dutch) | `BSN` |
| NIR | mod-97 key check | `NIR`, `HEALTH_ID_FR` |
| PESEL | Weighted digit sum | `PESEL` |
| Codice Fiscale | Check character lookup | `CODICE_FISCALE` |
## Pattern Priority
Patterns are ordered for matching priority — specific patterns with validators run first, generic patterns last:
Most specific: SSN, BSN (with 11-check), NIR (with mod-97), PESEL, Codice Fiscale
IBAN (with mod-97), credit cards, SWIFT/BIC
EHIC, KVNR, Carte Vitale, NHS
Context-dependent special categories
Generic: email, phone, IP addresses
Most generic: country-specific and generic passport formats
Set `sanitizeMode` and other options.
`PIIDetectedError` reference.
# Providers
Source: https://docs.complior.ai/sdk/providers
4 supported LLM providers: OpenAI, Anthropic, Google, Vercel AI SDK.
The SDK auto-detects provider type from the client object. No configuration needed.
## Supported providers
| Provider | Client | Method intercepted |
| ------------- | --------------------------------- | ----------------------------- |
| **OpenAI** | `new OpenAI()` | `chat.completions.create` |
| **Anthropic** | `new Anthropic()` | `messages.create` |
| **Google** | `new GoogleGenerativeAI()` | `generateContent` |
| **Vercel AI** | `openai` / `anthropic` / `google` | `generateText` / `streamText` |
## How it works
The SDK uses JavaScript `Proxy` to intercept LLM client methods. When you call `client.chat.completions.create(...)`, the proxy:
1. Runs all pre-hooks on the request
2. If no hook blocks → calls the original LLM method
3. Runs all post-hooks on the response
4. Returns the (potentially modified) response
The original client API is fully preserved — method signatures, return types, streaming, everything works as expected.
# SDK Quick Start
Source: https://docs.complior.ai/sdk/quick-start
Add compliance protection to your LLM calls in 3 lines of code.
## Install
```bash theme={null}
npm install @complior/sdk
```
## Wrap your client
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
const client = complior(new OpenAI());
const response = await client.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: userInput }],
});
```
```typescript theme={null}
import { complior } from '@complior/sdk';
import Anthropic from '@anthropic-ai/sdk';
const client = complior(new Anthropic());
const response = await client.messages.create({
model: 'claude-3-5-sonnet-20241022',
messages: [{ role: 'user', content: userInput }],
});
```
```typescript theme={null}
import { complior } from '@complior/sdk';
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';
const client = complior(openai);
const { text } = await generateText({
model: client('gpt-4'),
prompt: userInput,
});
```
That's it. With zero configuration, the SDK applies default hooks: `prohibited` (138 patterns), `sanitize` (50+ PII types), `disclosure` (AI transparency message).
## Configure hooks
```typescript theme={null}
const client = complior(new OpenAI(), {
hooks: ['prohibited', 'sanitize', 'disclosure', 'bias', 'escalation'],
disclosure: {
text: 'This response was generated by AI.',
languages: ['en', 'de', 'fr', 'es'],
},
});
```
# Safety Filter & HITL Gate
Source: https://docs.complior.ai/sdk/safety
5-category safety pattern scanning and Human-in-the-Loop gate with 4 built-in rules (Art.14/Art.15).
Two complementary safety mechanisms: the **safety filter** scans LLM responses for harmful content (Art.15), and the **HITL gate** requires human approval for critical actions (Art.14).
## Safety Filter
The safety filter is a post-hook that scans LLM responses against pattern-based rules across 5 categories.
### Categories
| Category | Patterns | Severity Range | Description |
| ------------------------- | -------- | --------------- | -------------------------------------------------------------------- |
| `violence` | 4 | HIGH–CRITICAL | Lethal violence instructions, weapon construction, attack planning |
| `self_harm` | 3 | HIGH–CRITICAL | Self-harm instructions, self-injury encouragement |
| `illegal_instructions` | 4 | MEDIUM–CRITICAL | Hacking, drug manufacturing, counterfeiting, law evasion |
| `pii_leakage` | 4 | MEDIUM–HIGH | SSN/credit card/IBAN numbers and credentials in output |
| `hallucination_indicator` | 4 | LOW–MEDIUM | False memory claims, unverifiable citations, unverified legal claims |
### Severity Weights
| Severity | Weight |
| ---------- | ------ |
| `LOW` | 0.1 |
| `MEDIUM` | 0.3 |
| `HIGH` | 0.6 |
| `CRITICAL` | 1.0 |
### Configuration
```typescript theme={null}
import { complior } from '@complior/sdk';
import OpenAI from 'openai';
const client = complior(new OpenAI(), {
safetyFilter: true,
safetyMode: 'block', // 'block' | 'warn' | 'log'
safetyThreshold: 0.5, // 0–1, lower = stricter
});
```
| Field | Type | Default | Description |
| ----------------- | ---------------------------- | --------- | ---------------------------- |
| `safetyFilter` | `boolean` | `false` | Enable safety scanning |
| `safetyMode` | `'block' \| 'warn' \| 'log'` | `'block'` | Action on threshold exceeded |
| `safetyThreshold` | `number` | `0.5` | Aggregate score threshold |
* **`block`** — throws `SafetyViolationError`
* **`warn`** — adds findings to response metadata, does not throw
* **`log`** — logs findings, no metadata or throw
### SafetyFinding
```typescript theme={null}
interface SafetyFinding {
readonly category: string; // e.g., 'violence', 'self_harm'
readonly severity: string; // 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL'
readonly evidence: string; // Matched text
readonly score: number; // Pattern weight
}
```
***
## Human-in-the-Loop Gate
The HITL gate is a post-hook that pauses execution when LLM output matches critical action patterns. A human operator must approve or deny before the response is returned.
If no `onGateTriggered` callback is configured, the gate **auto-denies** all matches (fail-safe per Art.14). Always provide a callback in production.
### Built-in Rules
4 default rules cover the most critical action categories:
| Rule ID | Category | Pattern | Example Match |
| ------------------- | ---------------------- | ---------------------------- | ----------------------------- |
| `financial` | Financial transaction | Transfer/send/pay + amount | "transfer \$5,000 to account" |
| `data_deletion` | Data deletion | Delete/drop/purge + data | "delete all user records" |
| `permission_change` | Permission change | Grant/revoke + access/role | "grant admin access to user" |
| `safety_critical` | Safety-critical system | Deploy/shutdown + production | "deploy to production system" |
### Configuration
```typescript theme={null}
import { complior } from '@complior/sdk';
import type { GateRequest, GateDecision } from '@complior/sdk';
import OpenAI from 'openai';
const client = complior(new OpenAI(), {
hitlGate: true,
hitlGateTimeoutMs: 60_000, // 1 minute (default: 5 minutes)
onGateTriggered: async (request: GateRequest): Promise => {
console.log(`Action detected: ${request.rule.description}`);
console.log(`Matched text: "${request.matchedText}"`);
console.log(`Provider: ${request.provider}, Method: ${request.method}`);
const approved = await promptHumanOperator(request);
return approved
? { approved: true }
: { approved: false, reason: 'Operator rejected the action' };
},
});
```
### Custom Rules
Override built-in rules with `hitlGateRules`:
```typescript theme={null}
import type { GateRule } from '@complior/sdk';
const customRules: GateRule[] = [
{
id: 'pii_export',
description: 'PII data export',
pattern: /\b(export|download|extract)\b.*\b(personal data|PII|user data|customer data)\b/i,
category: 'data_export',
},
{
id: 'model_deployment',
description: 'ML model deployment',
pattern: /\b(deploy|publish|release)\b.*\b(model|checkpoint|weights)\b/i,
category: 'model_ops',
},
];
const client = complior(new OpenAI(), {
hitlGate: true,
hitlGateRules: customRules,
onGateTriggered: async (req) => {
// Your approval logic
return { approved: true };
},
});
```
### Types
```typescript theme={null}
interface GateRule {
readonly id: string;
readonly description: string;
readonly pattern: RegExp;
readonly category: string;
}
interface GateRequest {
readonly rule: GateRule;
readonly matchedText: string;
readonly provider: string;
readonly method: string;
readonly timestamp: number;
}
type GateDecision =
| { approved: true }
| { approved: false; reason?: string };
```
### Timeout Behavior
* Default timeout: **5 minutes** (`300000` ms)
* On timeout: throws `HumanGateDeniedError` with `reason: 'timeout'`
* On denial: throws `HumanGateDeniedError` with `reason: 'denied'`
* On approval: response passes through with `hitlGateTriggered: true` in metadata
`SafetyViolationError` and `HumanGateDeniedError` reference.
Circuit breaker for cascading agent failures.
# EU AI Act
Source: https://docs.complior.ai/standards/eu-ai-act
108 deployer obligations mapped to Complior features. Coverage: ~50% automated, ~35% templates, ~15% manual.
Complior maps all 108 deployer obligations from the EU AI Act (Regulation 2024/1689) to concrete features. Each obligation is tracked through the 7-step compliance pipeline.
**Enforcement date:** August 2, 2026. Fines: up to €35M or 7% of global turnover (Art.99).
## Coverage by article
| Article | Requirement | Complior Feature | Coverage |
| ------- | ------------------------- | -------------------------------------------- | -------- |
| Art.4 | AI Literacy | Scanner L1 checks | 100% |
| Art.5 | Prohibited Practices | SDK (138 patterns) + Eval CT-7 (40 tests) | 100% |
| Art.9 | Risk Management | Risk Register + Passport risk\_class | 60% |
| Art.10 | Data Governance | Scanner + SDK sanitize hook | 100% |
| Art.11 | Technical Documentation | Document Generator (14 templates) | 80% |
| Art.12 | Logging | Evidence Chain + Eval CT-8 verification | 80% |
| Art.13 | Transparency (info) | Eval CT-3 (30 explanation tests) | 70% |
| Art.14 | Human Oversight | SDK escalation/HITL + Eval CT-2 (35 tests) | 100% |
| Art.26 | Deployer Obligations | Agent Passport (36 fields, auto-fill) | 100% |
| Art.27 | FRIA | FRIA Generator (80% pre-filled) | 100% |
| Art.49 | EU Database Registration | Planned | 20% |
| Art.50 | Transparency (disclosure) | SDK disclosure + content marking + Eval CT-1 | 100% |
| Art.72 | Post-Market Monitoring | File watcher + drift detection | 50% |
| Art.73 | Incident Management | Planned | 20% |
## Overall coverage
| Method | % of obligations |
| ------------------------------------- | ---------------- |
| Fully automated by Complior tools | \~50% |
| Supported with templates and pre-fill | \~35% |
| Requires manual input from deployer | \~15% |
## Risk classes
| Class | Description | Complior determines via |
| -------------- | ----------------------------------------------------------------------- | ------------------------------- |
| **Prohibited** | Banned practices (Art.5) | SDK 138-pattern matcher |
| **High** | Annex III systems (HR, healthcare, finance, education, law enforcement) | Autonomy level × project domain |
| **Limited** | Transparency obligations (Art.50) | Default for L3–L4 autonomy |
| **Minimal** | No specific requirements | Default for L1–L2 autonomy |
# Other Frameworks
Source: https://docs.complior.ai/standards/frameworks
OWASP LLM Top 10, MITRE ATLAS, NIST AI RMF — security and risk frameworks.
Beyond EU AI Act and ISO 42001, Complior scores against security and risk frameworks.
## OWASP LLM Top 10
Embedded in the security scoring pipeline. 300 attack probes map to OWASP categories:
| Category | What Complior checks |
| -------------------------------- | ------------------------------------ |
| LLM01: Prompt Injection | 50 injection probes in eval |
| LLM02: Insecure Output | Content safety post-hooks in SDK |
| LLM06: Sensitive Info Disclosure | PII detection in scan + SDK sanitize |
| LLM07: Insecure Plugin Design | Permission scanner in passport |
| LLM09: Overreliance | Hallucination tests in eval CT-5 |
## MITRE ATLAS
Adversarial threat taxonomy for AI systems. Integrated into red team probes:
```bash theme={null}
complior redteam --target
# Maps findings to MITRE ATLAS techniques
```
## NIST AI RMF
Voluntary US framework. 4 functions, 19 categories. Coverage: \~35–40%.
| Function | Coverage | Complior features |
| ----------- | -------- | ------------------------------------------------------ |
| **GOVERN** | \~25% | AI Policy generation, passport governance fields |
| **MAP** | \~30% | Agent discovery, risk classification, passport context |
| **MEASURE** | \~55% | Scanner metrics, eval scores, evidence chain |
| **MANAGE** | \~35% | Fix strategies, monitoring, audit package |
Export any passport to NIST format:
```bash theme={null}
complior agent export order-processor --format nist
```
## Multi-framework scoring
Configure which frameworks to score against:
```toml theme={null}
# .complior/config.toml
frameworks = ["eu-ai-act", "aiuc-1", "owasp-llm", "mitre-atlas"]
```
Each framework has independent weights and scoring rules. Default: `["eu-ai-act"]`.
# ISO 42001
Source: https://docs.complior.ai/standards/iso-42001
39 Annex A controls mapped to Complior. Current coverage: ~45–50%.
ISO/IEC 42001 is the first certifiable standard for AI management systems. 10 clauses (4–10) + 39 Annex A controls.
## Mapped controls
| Control | Requirement | Complior Feature | Status |
| ------------ | ---------------------------- | ------------------- | ------- |
| A.5.2–5.4 | Risk/Impact Assessment | FRIA Generator | Done |
| A.6.2.3–6 | V\&V, deployment, monitoring | Scanner + Eval | Done |
| A.6.2.9 | AI system documentation | Agent Passport | Done |
| A.6.2.10 | Prohibited use policies | SDK prohibited hook | Done |
| A.6.2.11 | Third-party components | SBOM (Cloud Scan) | Done |
| A.7.6 | Data provenance | Evidence Chain | Done |
| A.8.2 | AI disclosure | SDK disclosure hook | Done |
| A.9.5 | Human oversight | SDK escalation hook | Done |
| Clause 6.1.3 | Statement of Applicability | Document Generator | Planned |
| A.2.2–2.3 | AI Policy | Policy Generator | Planned |
| Clause 6.1.2 | Risk Register | Document Generator | Planned |
## ISO 42001 + EU AI Act synergy
ISO 42001 + NIST AI RMF + EU AI Act = the triple coverage. Complior builds the bridge between all three. A single `complior scan` produces scores for all frameworks simultaneously.