Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
tokenhound
command
Command tokenhound finds leaked AI keys before attackers do.
|
Command tokenhound finds leaked AI keys before attackers do. |
|
docs
|
|
|
schema
Package schema embeds the published JSON Schemas: the Report (report.v1.json), the tokenhound.yaml config (config.v1.json), the baseline file (baseline.v1.json) and the benchmark ground truth (bench-truth.v1.json).
|
Package schema embeds the published JSON Schemas: the Report (report.v1.json), the tokenhound.yaml config (config.v1.json), the baseline file (baseline.v1.json) and the benchmark ground truth (bench-truth.v1.json). |
|
examples
|
|
|
library
command
Command library is the Go library example (examples/README.md): it scans a directory with github.com/aiagentpro/tokenhound/pkg/tokenhound, prints one line per finding with the redacted key and the first fix step, then the grade, and exits 1 when it found a key.
|
Command library is the Go library example (examples/README.md): it scans a directory with github.com/aiagentpro/tokenhound/pkg/tokenhound, prints one line per finding with the redacted key and the first fix step, then the grade, and exits 1 when it found a key. |
|
internal
|
|
|
agenthook
Package agenthook installs and uninstalls TokenHound's coding agent hooks in the agent's own settings file (Claude Code's settings.json today).
|
Package agenthook installs and uninstalls TokenHound's coding agent hooks in the agent's own settings file (Claude Code's settings.json today). |
|
benchtruth
Package benchtruth loads the ground truth file of a benchmark build (go build -tags benchmark, see docs/benchmark.md).
|
Package benchtruth loads the ground truth file of a benchmark build (go build -tags benchmark, see docs/benchmark.md). |
|
browser
Package browser opens a URL in the operating system's default browser.
|
Package browser opens a URL in the operating system's default browser. |
|
candidate
Package candidate defines the stage envelopes: Chunk, which carries content from source through decode to detect, and Candidate, which detect hands on toward verify with a Finding, its secret.Secret key material and the precomputed suppression context.
|
Package candidate defines the stage envelopes: Chunk, which carries content from source through decode to detect, and Candidate, which detect hands on toward verify with a Finding, its secret.Secret key material and the precomputed suppression context. |
|
cli
Package cli is the command line front door: it defines the Cobra commands, maps results to exit codes and carries the build version, commit and date injected by ldflags.
|
Package cli is the command line front door: it defines the Cobra commands, maps results to exit codes and carries the build version, commit and date injected by ldflags. |
|
config
Package config resolves TokenHound configuration once per run.
|
Package config resolves TokenHound configuration once per run. |
|
decode
Package decode is the second pipeline stage: it decodes base64, URL, JSON-escaped and env-file encodings and expands archives in memory within configured size, depth and entry limits.
|
Package decode is the second pipeline stage: it decodes base64, URL, JSON-escaped and env-file encodings and expands archives in memory within configured size, depth and entry limits. |
|
detect
Package detect is the third pipeline stage: it matches registry patterns, entropy and keyword context, computes the fingerprint id and confidence, and emits candidate.Candidate envelopes.
|
Package detect is the third pipeline stage: it matches registry patterns, entropy and keyword context, computes the fingerprint id and confidence, and emits candidate.Candidate envelopes. |
|
engine
Package engine wires the scan pipeline: it connects the stages (source, decode, detect, suppress, verify, enrich, grade, fixplan) over bounded channels, runs the worker pools and the single barrier after enrich, applies timeouts and sorts findings once.
|
Package engine wires the scan pipeline: it connects the stages (source, decode, detect, suppress, verify, enrich, grade, fixplan) over bounded channels, runs the worker pools and the single barrier after enrich, applies timeouts and sorts findings once. |
|
enrich
Package enrich is the sixth pipeline stage: it derives tier, scopes, org, first_seen, age and dollars at risk per day from verify evidence and the spend registry.
|
Package enrich is the sixth pipeline stage: it derives tier, scopes, org, first_seen, age and dollars at risk per day from verify evidence and the spend registry. |
|
fixplan
Package fixplan runs once after the engine barrier and the location sort: it sets the fix plan of every finding (live, dead, unverified and suppressed alike).
|
Package fixplan runs once after the engine barrier and the location sort: it sets the fix plan of every finding (live, dead, unverified and suppressed alike). |
|
fuzzcheck
Package fuzzcheck holds the assertions every fuzz target shares and the fuzz inventory (Story 4.13).
|
Package fuzzcheck holds the assertions every fuzz target shares and the fuzz inventory (Story 4.13). |
|
githook
Package githook installs and uninstalls the TokenHound git pre-commit and pre-push hooks with a single owner (AD-18).
|
Package githook installs and uninstalls the TokenHound git pre-commit and pre-push hooks with a single owner (AD-18). |
|
gitx
Package gitx is the only package that runs the system git binary, with argument slices, validated refs and hardened flags and environment.
|
Package gitx is the only package that runs the system git binary, with argument slices, validated refs and hardened flags and environment. |
|
gitx/gitxtest
Package gitxtest builds throwaway git repositories for tests.
|
Package gitxtest builds throwaway git repositories for tests. |
|
grade
Package grade runs once after the engine barrier: it computes the A to F grade per target and overall, with the reasons for each grade.
|
Package grade runs once after the engine barrier: it computes the A to F grade per target and overall, with the reasons for each grade. |
|
hook
Package hook runs TokenHound as a coding agent pre-tool hook.
|
Package hook runs TokenHound as a coding agent pre-tool hook. |
|
ignore
Package ignore holds the parts of the ignore grammar (docs/schema/ignore.v1.md) that both the config resolver and the suppress stage need: rule validation and the forward-slash glob matcher.
|
Package ignore holds the parts of the ignore grammar (docs/schema/ignore.v1.md) that both the config resolver and the suppress stage need: rule validation and the forward-slash glob matcher. |
|
lintcheck
Package lintcheck owns the lint self-test fixtures under testdata.
|
Package lintcheck owns the lint self-test fixtures under testdata. |
|
mcpserver
Package mcpserver is the `tokenhound mcp` front door: a stdio Model Context Protocol server with exactly four tools (scan, verify_status, fix_plan and report).
|
Package mcpserver is the `tokenhound mcp` front door: a stdio Model Context Protocol server with exactly four tools (scan, verify_status, fix_plan and report). |
|
netx
Package netx is the only package that builds HTTP clients and transports: HTTPS only, a closed purpose enum, registry-declared hosts for verification, no redirects for verify, proxy and custom CA support.
|
Package netx is the only package that builds HTTP clients and transports: HTTPS only, a closed purpose enum, registry-declared hosts for verification, no redirects for verify, proxy and custom CA support. |
|
netx/netxtest
Package netxtest holds loopback test wiring for code that talks through internal/netx: a throwaway certificate authority, TLS test servers whose leaf certificates name any host, and a CONNECT-only proxy.
|
Package netxtest holds loopback test wiring for code that talks through internal/netx: a throwaway certificate authority, TLS test servers whose leaf certificates name any host, and a CONNECT-only proxy. |
|
ownership
Package ownership is a test helper for AD-2 field ownership: each Finding field is set only by its owning stage.
|
Package ownership is a test helper for AD-2 field ownership: each Finding field is set only by its owning stage. |
|
registry
Package registry loads and validates the provider, surface and spend registries (YAML validated by JSON Schema) from the embedded snapshot or a refreshed copy.
|
Package registry loads and validates the provider, surface and spend registries (YAML validated by JSON Schema) from the embedded snapshot or a refreshed copy. |
|
report/social
Package social is how tools/socialpreview reaches the share card renderer for the repository social preview without making it public library API (Story 4.14).
|
Package social is how tools/socialpreview reaches the share card renderer for the repository social preview without making it public library API (Story 4.14). |
|
secret
Package secret holds credential material in an opaque Secret type whose formatting and marshalling methods return only the redacted form.
|
Package secret holds credential material in an opaque Secret type whose formatting and marshalling methods return only the redacted form. |
|
source
Package source is the first pipeline stage: adapters read files, staged changes, git history, images, notebooks, agent surfaces, stdin and forge orgs, and emit content chunks with their Location.
|
Package source is the first pipeline stage: adapters read files, staged changes, git history, images, notebooks, agent surfaces, stdin and forge orgs, and emit content chunks with their Location. |
|
source/fs
Package fs is the working tree source adapter ("fs"): it walks a directory, or reads one file, and emits each regular file as one chunk.
|
Package fs is the working tree source adapter ("fs"): it walks a directory, or reads one file, and emits each regular file as one chunk. |
|
source/git
Package git holds the git source adapters.
|
Package git holds the git source adapters. |
|
source/stdin
Package stdin is the stream source adapter ("stdin"): it reads one stream, such as standard input, whole and emits it as one chunk with Location kind stdin and target {stdin, stdin, unknown}.
|
Package stdin is the stream source adapter ("stdin"): it reads one stream, such as standard input, whole and emits it as one chunk with Location kind stdin and target {stdin, stdin, unknown}. |
|
source/surface
Package surface is the agent surface source adapter ("surface"): it reads the files coding agents keep on disk (settings, allowlists, MCP config, transcripts) as the registry describes them, parses each with the format's structure-aware parser and emits one chunk per extracted entry with a Location of kind surface (surface id, path, field) so that credentials in one entry pair under same-surface-entry.
|
Package surface is the agent surface source adapter ("surface"): it reads the files coding agents keep on disk (settings, allowlists, MCP config, transcripts) as the registry describes them, parses each with the format's structure-aware parser and emits one chunk per extracted entry with a Location of kind surface (surface id, path, field) so that credentials in one entry pair under same-surface-entry. |
|
source/surface/parse
Package parse reads the file formats of agent surfaces (json, jsonc, jsonl, toml, yaml, ini, dotenv, shell-history and ipynb) into a small tree that keeps the 1-based source line of every value, and selects string values from it with field selectors.
|
Package parse reads the file formats of agent surfaces (json, jsonc, jsonl, toml, yaml, ini, dotenv, shell-history and ipynb) into a small tree that keeps the 1-based source line of every value, and selects string values from it with field selectors. |
|
stagereg
Package stagereg is the adapter registry every pipeline stage package uses: adapters register a factory under a name at init(), and the engine looks factories up by name.
|
Package stagereg is the adapter registry every pipeline stage package uses: adapters register a factory under a name at init(), and the engine looks factories up by name. |
|
suppress
Package suppress is the fourth pipeline stage: it alone decides whether a candidate is suppressed (test keys, inline allows, allowlists, ignore files, baselines) and records the reason.
|
Package suppress is the fourth pipeline stage: it alone decides whether a candidate is suppressed (test keys, inline allows, allowlists, ignore files, baselines) and records the reason. |
|
verify
Package verify is the fifth pipeline stage: it checks keys with read-only, registry-declared requests through netx and sets status, status_reason and verify_evidence.
|
Package verify is the fifth pipeline stage: it checks keys with read-only, registry-declared requests through netx and sets status, status_reason and verify_evidence. |
|
warnx
Package warnx builds report warnings from errors as {code, location, detail_code}, so foreign error text never reaches warnings, logs or MCP output.
|
Package warnx builds report warnings from errors as {code, location, detail_code}, so foreign error text never reaches warnings, logs or MCP output. |
|
yamlschema
Package yamlschema parses single-document YAML files and validates them against a JSON Schema, reporting every problem as "file:line: field: message".
|
Package yamlschema parses single-document YAML files and validates them against a JSON Schema, reporting every problem as "file:line: field: message". |
|
pkg
|
|
|
config
Package config resolves configuration once, with precedence flags, then TOKENHOUND_* environment, then user config, then project tokenhound.yaml, then defaults, into tokenhound.Options.
|
Package config resolves configuration once, with precedence flags, then TOKENHOUND_* environment, then user config, then project tokenhound.yaml, then defaults, into tokenhound.Options. |
|
model
Package model is the TokenHound Finding and Report model: statuses and their classes, confidence, grades, targets, locations, warnings, progress events and the canonical JSON Report (docs/schema/report.v1.json).
|
Package model is the TokenHound Finding and Report model: statuses and their classes, confidence, grades, targets, locations, warnings, progress events and the canonical JSON Report (docs/schema/report.v1.json). |
|
report
Package report renders a tokenhound.Report.
|
Package report renders a tokenhound.Report. |
|
tokenhound
Package tokenhound finds leaked AI keys, verifies them safely and prices the exposure.
|
Package tokenhound finds leaked AI keys, verifies them safely and prices the exposure. |
|
Package registry embeds the TokenHound registry data: the snapshot manifest, the JSON Schemas and the provider, spend and surface YAML files.
|
Package registry embeds the TokenHound registry data: the snapshot manifest, the JSON Schemas and the provider, spend and surface YAML files. |
|
tools
|
|
|
benchsync
command
Command benchsync pulls the published summary of the agent leak benchmark (benchmark/ in this repository) into docs/benchmark/results.json and regenerates the README block between <!-- benchmark:start --> and <!-- benchmark:end --> from it, so every benchmark number in the README comes from that one data file.
|
Command benchsync pulls the published summary of the agent leak benchmark (benchmark/ in this repository) into docs/benchmark/results.json and regenerates the README block between <!-- benchmark:start --> and <!-- benchmark:end --> from it, so every benchmark number in the README comes from that one data file. |
|
changelogrelease
command
Command changelogrelease keeps the hand-written CHANGELOG.md in step with releases.
|
Command changelogrelease keeps the hand-written CHANGELOG.md in step with releases. |
|
channelcheck
command
Command channelcheck checks the Homebrew cask and the Scoop manifest of a GoReleaser bin/release/ directory against its checksums.txt (Story 4.4).
|
Command channelcheck checks the Homebrew cask and the Scoop manifest of a GoReleaser bin/release/ directory against its checksums.txt (Story 4.4). |
|
checklistcheck
command
Command checklistcheck keeps docs/release/v1-checklist.md honest (Story 4.19, NFR11): every adoption blocker of the PRD and every non-functional requirement NFR1 to NFR10 has a row, and every row has evidence that exists.
|
Command checklistcheck keeps docs/release/v1-checklist.md honest (Story 4.19, NFR11): every adoption blocker of the PRD and every non-functional requirement NFR1 to NFR10 has a row, and every row has evidence that exists. |
|
communitycheck
command
Command communitycheck validates the community and governance files of Story 4.14, reporting each problem as "file:line: message":
|
Command communitycheck validates the community and governance files of Story 4.14, reporting each problem as "file:line: message": |
|
covercore
command
Command covercore runs `go test -cover` on the core packages, prints a per-package coverage table and exits 1 when any package is below the minimum, naming it.
|
Command covercore runs `go test -cover` on the core packages, prints a per-package coverage table and exits 1 when any package is below the minimum, naming it. |
|
dashlint
command
Command dashlint fails on em dash, en dash and ellipsis characters in tracked text files.
|
Command dashlint fails on em dash, en dash and ellipsis characters in tracked text files. |
|
errtextlint
command
Command errtextlint enforces the AD-3 text hygiene rule that forbidigo cannot see: outside internal/warnx and _test.go files, an error value must not be passed to a fmt print function (Sprint*, Print*, Fprint*, Append*) or to any log or log/slog function, method or attribute constructor.
|
Command errtextlint enforces the AD-3 text hygiene rule that forbidigo cannot see: outside internal/warnx and _test.go files, an error value must not be passed to a fmt print function (Sprint*, Print*, Fprint*, Append*) or to any log or log/slog function, method or attribute constructor. |
|
gates
command
Command gates holds the threshold logic of the v1.0 release gates and the post-publish install check (Story 4.18, NFR11).
|
Command gates holds the threshold logic of the v1.0 release gates and the post-publish install check (Story 4.18, NFR11). |
|
genremembers
command
Command genremembers generates the launch post "What your coding agent remembers" (docs/launch/what-your-coding-agent-remembers.md) from the embedded surface registry (registry/surfaces/): for each agent or tool, every surface with its files per OS, its file format, the fields that can hold a key, the registry note (for example that Claude Code's "don't ask again" allowlist in settings.local.json stores whole commands) and the vendor documentation (Story 4.17).
|
Command genremembers generates the launch post "What your coding agent remembers" (docs/launch/what-your-coding-agent-remembers.md) from the embedded surface registry (registry/surfaces/): for each agent or tool, every surface with its files per OS, its file format, the fields that can hold a key, the registry note (for example that Claude Code's "don't ask again" allowlist in settings.local.json stores whole commands) and the vendor documentation (Story 4.17). |
|
internal/channel
Package channel holds what the Homebrew and Scoop channel tools share (Story 4.4): release version rules, archive names and download URLs, checksums.txt parsing and the Scoop manifest renderer.
|
Package channel holds what the Homebrew and Scoop channel tools share (Story 4.4): release version rules, archive names and download URLs, checksums.txt parsing and the Scoop manifest renderer. |
|
internal/evidence
Package evidence resolves the evidence references that documents in this repository cite, so a checker can fail when a cited test, CI job or file no longer exists.
|
Package evidence resolves the evidence references that documents in this repository cite, so a checker can fail when a cited test, CI job or file no longer exists. |
|
internal/labels
Package labels reads and validates .github/labels.yml, the repository labels that tools/labelsync syncs to GitHub and tools/communitycheck checks in CI (Story 4.14).
|
Package labels reads and validates .github/labels.yml, the repository labels that tools/labelsync syncs to GitHub and tools/communitycheck checks in CI (Story 4.14). |
|
issueguard
command
Command issueguard decides whether a new or edited issue, or issue comment, holds what looks like a key (Story 4.14).
|
Command issueguard decides whether a new or edited issue, or issue comment, holds what looks like a key (Story 4.14). |
|
labelsync
command
Command labelsync creates or updates every label of .github/labels.yml on GitHub with `gh label create --color <c> --description <d> --force -- <name>` (Story 4.14).
|
Command labelsync creates or updates every label of .github/labels.yml on GitHub with `gh label create --color <c> --description <d> --force -- <name>` (Story 4.14). |
|
launchrender
command
Command launchrender renders the launch artefacts under docs/launch/ from the templates in docs/launch/templates/ and checks every launch file (Story 4.17).
|
Command launchrender renders the launch artefacts under docs/launch/ from the templates in docs/launch/templates/ and checks every launch file (Story 4.17). |
|
linkcheck
command
Command linkcheck checks the relative links and #anchors of Markdown files offline: every relative link must name a file or directory that exists, and every anchor into a Markdown file must match one of its headings (GitHub's slug rules, including the -1, -2 suffixes of repeated headings) or an explicit <a name> or id.
|
Command linkcheck checks the relative links and #anchors of Markdown files offline: every relative link must name a file or directory that exists, and every anchor into a Markdown file must match one of its headings (GitHub's slug rules, including the -1, -2 suffixes of repeated headings) or an explicit <a name> or id. |
|
mdcheck
Package mdcheck holds the Markdown checks that tools/readmegen (the README) and tools/launchrender (the launch files under docs/launch/) share: line and fence splitting, the hook-claims check against docs/hooks/policy.md wording, and the AD-3 leak check.
|
Package mdcheck holds the Markdown checks that tools/readmegen (the README) and tools/launchrender (the launch files under docs/launch/) share: line and fence splitting, the hook-claims check against docs/hooks/policy.md wording, and the AD-3 leak check. |
|
readmegen
command
Command readmegen generates the README blocks between <!-- name:start --> and <!-- name:end --> markers from the registry and the data files, and checks the README (Story 4.16):
|
Command readmegen generates the README blocks between <!-- name:start --> and <!-- name:end --> markers from the registry and the data files, and checks the README (Story 4.16): |
|
registryids
command
Command registryids is the registry id stability check (AD-4).
|
Command registryids is the registry id stability check (AD-4). |
|
releasecredits
command
Command releasecredits prints the "Registry contributors" block of the release notes from GitHub pull request JSON.
|
Command releasecredits prints the "Registry contributors" block of the release notes from GitHub pull request JSON. |
|
scoopmanifest
command
Command scoopmanifest renders the Scoop manifest tokenhound.json from the template in dist/scoop and a release's signed checksums.txt (Story 4.4).
|
Command scoopmanifest renders the Scoop manifest tokenhound.json from the template in dist/scoop and a release's signed checksums.txt (Story 4.4). |
|
selfscan
command
Command selfscan checks a TokenHound JSON Report for unsuppressed findings, so the CI self-scan needs no jq (AD-16).
|
Command selfscan checks a TokenHound JSON Report for unsuppressed findings, so the CI self-scan needs no jq (AD-16). |
|
serverjson
command
Command serverjson renders the MCP registry manifest for a release and checks what the registry lists after publishing (Story 4.7).
|
Command serverjson renders the MCP registry manifest for a release and checks what the registry lists after publishing (Story 4.7). |
|
socialpreview
command
Command socialpreview renders the repository social preview, a 1280x640 PNG in the DESIGN.md identity (ink background, Hound amber wordmark, the headline sentence, no key material), with the share card's fonts and renderer, reached through internal/report/social (pkg/report registers it; it is not library API).
|
Command socialpreview renders the repository social preview, a 1280x640 PNG in the DESIGN.md identity (ink background, Hound amber wordmark, the headline sentence, no key material), with the share card's fonts and renderer, reached through internal/report/social (pkg/report registers it; it is not library API). |
|
testkeys
command
Command testkeys prints synthetic test keys generated from the embedded registry.
|
Command testkeys prints synthetic test keys generated from the embedded registry. |
|
testkeys/keygen
Package keygen generates synthetic test keys from registry patterns (AD-16).
|
Package keygen generates synthetic test keys from registry patterns (AD-16). |
|
testkeys/leakcheck
Package leakcheck is the one AD-3 leak checker of the test suites: it looks for more of a generated key than its redacted form in a captured output, raw and in its JSON-escaped, URL-encoded and base64-encoded views, and reports each hit by format, file, byte offset, encoding and finding id, never by the matched text.
|
Package leakcheck is the one AD-3 leak checker of the test suites: it looks for more of a generated key than its redacted form in a captured output, raw and in its JSON-escaped, URL-encoded and base64-encoded views, and reports each hit by format, file, byte offset, encoding and finding id, never by the matched text. |
|
threatmodelcheck
command
Command threatmodelcheck keeps docs/threat-model.md honest: every evidence reference it cites must exist in the repository, and every threat row must name a mitigating AD rule and at least one piece of evidence.
|
Command threatmodelcheck keeps docs/threat-model.md honest: every evidence reference it cites must exist in the repository, and every threat row must name a mitigating AD rule and at least one piece of evidence. |
|
workflowcheck
command
Command workflowcheck enforces the workflow hygiene rules of AD-27 on every GitHub Actions workflow:
|
Command workflowcheck enforces the workflow hygiene rules of AD-27 on every GitHub Actions workflow: |
Click to show internal directories.
Click to hide internal directories.