Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

What KeyHog can do

Use this page to choose an execution mode, input source, and output contract. Each table links to the chapter that owns the details.

GPU detection

The VYRE CUDA and WGPU engines match region presence for the whole compiled detector corpus in a single resident dispatch. They then feed the same confirmation pipeline as the CPU backends. A GPU route changes execution, not findings, and it is selected only when the host’s calibration proves it fastest for that workload.

An RTX 5090 diagnostic recorded 24.6 ms on VYRE CUDA and 69.6 ms on Hyperscan with identical findings. That run did not attest a clean source tree, so it is historical performance evidence rather than a release crossover claim. See Backends and routing for the evidence contract.

Choose an execution mode

Start with the narrowest mode that covers the input you need.

NeedCommandBoundary
Scan files or directories oncekeyhog scan <path>...Directories and ineligible policy combinations run in process. On Unix, an eligible single-file request may use an already-ready daemon under the default auto policy.
Scan Git statekeyhog scan --git-staged, --git-diff <range>, or --git-history <repo>Staged and diff modes inspect selected changes. History mode walks commits. These run in process.
Scan one file repeatedly on Unixkeyhog daemon start, then keyhog scan <file>Starting the foreground server is explicit. Eligible single-file and stdin requests may then use its warm scanner.
Monitor local directorieskeyhog watch <path>...Own foreground filesystem-event loop and in-process scanner; never uses the daemon socket.
Audit a hostkeyhog scan-systemWalks eligible local mounted filesystems and discovered Git histories. Network mounts require --include-network.

See Architecture for routing ownership and Exit codes for the process outcome contract.

Daemon routing has three explicit states. An absent daemon flag uses opportunistic auto behavior, but never starts a daemon: it uses a compatible server only when one is already ready. Bare --daemon or --daemon=on requires that server. --daemon=off guarantees in-process execution. The daemon transport is Unix-only.

Choose a scan policy

PolicyCommandResolved behavior
Defaultkeyhog scan .Decode depth 10, entropy and ML enabled, global confidence floor 0.40.
Fast presetkeyhog scan . --fastNamed regex and multiline matching remain; recursive decode, entropy discovery, and ML scoring are disabled.
Deep presetkeyhog scan . --deepSource-file entropy and comment scanning at full confidence, heuristic evidence beside entropy ML, depth 10, and prepared decode chunks up to 1 MiB.
Precision presetkeyhog scan . --precisionEntropy discovery and the relaxed keyword bridge off, ML on, decode depth 1, every confidence floor at least 0.85.
Lockdown modekeyhog scan . --lockdownLinux-only fail-closed process protection. Requires a sufficient memlock limit; CAP_IPC_LOCK, unlimited ulimit -l, or a sufficiently large finite limit can provide it. Standard hosted Linux currently fails closed at mlockall; the maintained digest-pinned push/PR source lane proves real root+nested Action explicit-CPU lockdown, while authenticated manual dispatch proves release auto+lockdown. It is an execution security mode, not a scan preset.

The three presets are mutually exclusive bases. Compatible explicit options refine them; a precision confidence override may raise but never lower 0.85. Lockdown refuses fast and other completeness-reducing switches, and always runs in process. See Configuration and Hardening.

Choose a detector corpus mode

--detectors <DIR> selects a custom detector directory. Choose how it participates in the corpus:

ModeCommandResult
Replace--detectors ./reviewed --detectors-mode replaceUses only the custom directory. This is also the compatibility behavior when an explicit custom directory omits the mode.
Overlay--detectors ./extra --detectors-mode overlayAdds the custom directory to the embedded corpus. Duplicate detector IDs fail corpus loading.

The selected corpus owns matching, validation, entropy, suppression, ML, and declared decode-transform policy. Replace mode does not inherit detector-local policy from the embedded corpus. See Detectors.

What KeyHog can scan

The default and official release builds support the sources below. Reduced source builds can omit feature-gated Git, web, cloud, container, and verifier support. Every enabled source feeds the same compiled detector pipeline.

SourceHow to point at itChapter
Working treekeyhog scan <path>... (default)Your first scan
stdin / single file--stdin or keyhog scan path/to/fileDaemon and warm scans
Git history--git-history <repo>Deep recovery
Git diff / staged--git-diff <range>, --git-stagedPre-commit hook
GitHub org / repos--github-org, --github-collaboration (issues, PRs, discussions, wiki, gists)GitHub collaboration scans
GitLab group--gitlab-groupMass scanning
Bitbucket workspace--bitbucket-workspaceMass scanning
S3 / GCS / Azure Blob--s3-bucket, --gcs-bucket, --azure-container-urlMass scanning
Docker image--docker-image <ref>Mass scanning
Web URLs--url <url>...HTTP and wire scanning
HAR captureskeyhog scan capture.harHTTP and wire scanning
Archives, compressed files, and supported containerspass the containing path; formats are detected during filesystem and remote-source expansionSource archives

How KeyHog decides what is real

Precision is the product. A finding survives several independent stages before it reaches your terminal.

StageWhat it doesChapter
DetectorsThe embedded detector catalog is compiled from TOML data under detectors/; query the running binary for its exact countDetectors
Entropy and shapevectorized entropy plus declarative charset/grouping shape checksHow detection works
On-device MoEa small mixture-of-experts model scores ambiguous candidates locallyHow detection works
Context and suppressionexample-credential, vendored-bundle, comment, and ${{ secrets.NAME }} suppression by defaultSuppressions
Verificationoptional live checks for detectors with a verification plan; these checks send credential-derived requests to the serviceVerification

How KeyHog stays fast

CapabilityWhat it buys youChapter
Autoroute calibrationpicks the fastest correct backend for your exact host, corpus, and data shapeAutoroute calibration
GPU region presenceVYRE CUDA / WGPU dispatch for the whole corpus at onceBackends and routing
Hyperscan SIMD prefiltervectorized literal and regex prefiltering on the CPU pathBackends and routing
Daemon and warm scansa resident process serves IDE-save and single-file scans without cold start (Unix)Daemon and warm scans
Incremental scansa content-addressed index rescans only what changedMass scanning

What KeyHog emits

OutputUseChapter
Eleven formatstext, json, json-envelope, jsonl, jsonl-envelope, sarif, csv, github-annotations, gitlab-sast, html, junitOutput formats
Baselinesaccept known findings once; only new secrets fail future scansCI integration
Exit codesstable codes for clean, findings, and error so scripts branch reliablyExit codes

How KeyHog protects the secrets it reads

A scanner holds credentials in memory by design, so KeyHog hardens the process that does it.

PropertyWhat it meansChapter
Local defaultlocal filesystem, Git, stdin, archive, decoding, and detector work do not send findings or telemetryHardening and data handling
In-process scan hardeningLinux and macOS in-process scans attempt core-dump and debugger-attachment protections before reading inputHardening and data handling
Linux lockdown mode--lockdown fails closed unless memory locking and dump protections apply, and it refuses network verification and plaintext outputHardening and data handling
Credential buffer zeroizationthe report credential buffer is zeroized on drop; reports redact unless --show-secrets is explicitHardening and data handling
Authenticated releasesthe normal install, update, and repair paths verify release checksums and signatures before replacementInstall

Every subcommand

CommandPurpose
scanscan any source and report findings (--verify adds live credential checks)
scan-systemaudit eligible local mounted filesystems and discovered Git histories under one --space ceiling; --include-network opts into network mounts (guide)
watchcontinuously scan one or more directories as files change
diffdiff two baselines or artifacts: NEW / REMOVED / UNCHANGED
explainshow a detector’s spec, regex, severity, and rotation guide
detectorslist and inspect the embedded detector corpus
configprint the resolved scan configuration without scanning
hookinstall or remove the git pre-commit hook
daemonstart, stop, or query the warm-scan daemon (Unix)
calibrateshow or update per-detector Bayesian confidence calibration
calibrate-autorouteprime autoroute across every policy preset and workload bucket
backendinspect hardware, routing heuristics, and autoroute evidence
bloom-diagnosticmeasure the production Bloom rejection gate and prove enabled-versus-bypassed finding parity
doctorhealth-check the install: host, PATH, corpus, scan and GPU self-test
updateverified download and self-replace to the latest release, with rollback
repairreinstall a known-good binary, then verify
uninstallremove the binary (dry run unless --yes)
completionemit shell completions (bash, zsh, fish, powershell, elvish)

The full flag surface for every command is in the CLI reference.