How 0x1adi/klarion works
Klarion scans source and Git changes for candidate credentials, then adjudicates candidates with an AI verifier and reports confirmed or uncertain findings. The main user workflows are filesystem scans, staged/changed/history Git scans, and pre-write or pre-commit protection through Claude Code hooks and MCP tools; baselines help distinguish existing findings. The graph includes documented report formats and verifier choices. Some subsystems are represented from the README or source index rather than sampled implementation, so their internal links are limited to documented or indexed relationships.
Main entry points: detector.go Secret detector · apply.go Verifier builder · run.go Scan runner · hook.go Claude Code hook
Components 31
Commands and workflows
- Folder scan
cmd/klarion/scan.go - Scan runner
cmd/klarion/run.go - Git scan
cmd/klarion/git.go - Protect setup
cmd/klarion/protect.go - Baseline commands
cmd/klarion/baseline.go - Configuration
internal/config/config.go - Git change reader
internal/git/git.go
Candidate detection
- Filesystem walker
internal/scan/walk.go - File scanner
internal/scan/scanner.go - Secret detector
internal/detect/detector.go - Structural checks
internal/detect/structural.go - Encoded scanning
internal/detect/decode.go - Built-in rules
internal/rules/builtin.go - Entropy scoring
internal/entropy/entropy.go
Verification
- Verifier builder
internal/verify/apply.go - Anthropic judge
internal/verify/anthropic.go - OpenAI-compatible judge
internal/verify/openai.go - Claude CLI judge
internal/verify/claudecli.go - Verdict cache
internal/verify/cache.go
Findings and reports
- Finding model
internal/finding/finding.go - Baseline state
internal/baseline/baseline.go - Report formats
internal/report/report.go
Protection integrations
- Claude Code hook
cmd/klarion/hook.go - MCP command
cmd/klarion/mcp.go - MCP server
internal/mcp/server.go - MCP scan tools
internal/mcp/tools.go
Other components
- Engineer
- MCP agent
- Claude Code
- AI model service
- Git repository
Connections 39
- Engineer → Folder scan: runs scan
README.md - Engineer → Git scan: checks changes
README.md - Folder scan → File scanner: scans paths
cmd/klarion/scan.go - File scanner → Filesystem walker: walks roots
internal/scan/scanner.go - File scanner → Secret detector: scans file content
internal/scan/scanner.go - Secret detector → Built-in rules: matches rules
internal/detect/detector.go - Secret detector → Structural checks: checks structure
README.md - Secret detector → Encoded scanning: rescans encodings
internal/detect/detector.go - Secret detector → Entropy scoring: scores randomness
internal/detect/detector.go - Secret detector → Finding model: emits candidates
internal/detect/detector.go - Git scan → Git change reader: reads changes
cmd/klarion/git.go - Git scan → Secret detector: scans changed lines
cmd/klarion/git.go - Git repository → Git change reader: supplies revisions
internal/git/git.go - Scan runner → Configuration: loads settings
cmd/klarion/run.go - Scan runner → Secret detector: builds pipeline
cmd/klarion/run.go - Scan runner → Verifier builder: adjudicates findings
cmd/klarion/run.go - Scan runner → Report formats: formats results
cmd/klarion/run.go - Verifier builder → Anthropic judge: selects provider
internal/verify/apply.go - Verifier builder → OpenAI-compatible judge: selects provider
internal/verify/apply.go - Verifier builder → Claude CLI judge: selects provider
internal/verify/apply.go - Verifier builder → Verdict cache: reuses verdicts
README.md - Anthropic judge → AI model service: requests judgments
README.md - OpenAI-compatible judge → AI model service: requests judgments
README.md - Verifier builder → Finding model: returns verdicts
internal/verify/apply.go - Baseline commands → Baseline state: creates baseline
cmd/klarion/baseline.go - Baseline state → Finding model: tracks findings
internal/baseline/baseline.go - Report formats → Finding model: renders findings
internal/report/report.go - Engineer → Protect setup: sets protection
README.md - Protect setup → Git change reader: configures Git hooks
cmd/klarion/protect.go - Claude Code → Claude Code hook: intercepts writes
README.md - Claude Code hook → Secret detector: scans tool content
cmd/klarion/hook.go - Claude Code hook → Git change reader: reads commit files
cmd/klarion/hook.go - Claude Code hook → Verifier builder: checks candidates
cmd/klarion/hook.go - MCP agent → MCP command: starts server
README.md - MCP command → MCP server: serves MCP
cmd/klarion/mcp.go - MCP agent → MCP scan tools: calls scan tools
README.md - MCP scan tools → Secret detector: scans content
- MCP scan tools → Verifier builder: judges candidates
- MCP server → MCP scan tools: dispatches tools