Scope Drift Trimmer
What was this identity granted, what did it use, and what's the trim?
Lists each grant beside the platform's own record of use, says how good that record is, and drafts the trim for you to review and run.
AI agents, service principals and bot accounts pick up permissions and rarely give them back, and when one is retired nobody checks that its keys really died. The NHI Toolkit covers both ends. Each tool reads what you export and drafts; none of them changes a thing.
They share the Agent Security Suite's inventory format, so one tool's output is the next one's input: Scope Drift Trimmer flags a dormant identity, you retire it, and GhostGrant proves the retirement held.
What was this identity granted, what did it use, and what's the trim?
Lists each grant beside the platform's own record of use, says how good that record is, and drafts the trim for you to review and run.
We retired this agent. Are its credentials really dead, and do they stay dead?
Checks a retired agent's GitHub, AWS and Slack credentials stopped working, then checks again at 24 hours, 7, 30 and 90 days, and alerts on a flip.
Service principals, IAM roles and bot accounts pick up permissions and rarely give them back. The demo loads a fictional estate and flags legacy-invoice-sync, an app with no owner that holds Mail.ReadWrite and Mail.Send and hasn't signed in for months, before you click anything.
Reads files you export yourself: AWS Access Analyzer unused-access findings and last-accessed details, an Entra ID Graph export, Okta service apps with their scope grants and System Log, or an agent inventory document from another Agent Security Suite tool.
AWS IAM · Entra ID · OktaA grant is usageKnown: true only when the platform records its use, and every claim names the data and the window behind it. Unobserved use is never called unused.
Dormant privileged identities (worst when nobody owns them), unused grants, permissions with a narrower alternative, and grants whose use can't be observed at all.
--fail-on <severity>A platform-shaped change per finding: a Graph DELETE, an AWS policy diff, a GitHub permission downgrade, an Okta scope revoke. Each starts with DRAFT. and goes nowhere until you run it.
cd nhi-toolkit/tools/scope-drift-trimmer # after the one-clone setup below
npm pack
npm install --global ./scope-drift-trimmer-0.0.0.tgz
sdt analyze tests/fixtures/estate.inventory.json --out inventory.json
sdt analyze tests/fixtures/entra
sdt analyze <inventory.json> [--out <file>] [--fail-on <severity>]
Exit 0 ran clean, 1 the --fail-on threshold was reached, 2 bad usage or an input that isn't a valid schema v0.1 inventory. It drafts; you review and run. It reads exported files, makes no network call and holds no credential, never narrows an AWS wildcard from last-accessed data alone, and doesn't cover human identities or GCP.
When a team shuts down an AI agent, somebody clicks revoke and moves on. Nobody goes back to see whether the GitHub token still answers, or whether the Slack bot quietly came back after a reinstall. GhostGrant does the going back.
A YAML file naming the credentials the agent held: type and identifier, never the secret itself. ghostgrant decommission records it with a timestamp and the manifest's checksum.
GitHub: GET /user, where 200 is alive and 401 is dead. Slack: auth.test. A timeout, 5xx or rate limit is unknown, never dead. AWS, Okta and Google Workspace answer unknown until their adapters land.
Each check runs the window that's due: 24 hours, 7, 30 and 90 days. --mock runs the same checks against canned answers.
A credential that goes from dead back to alive prints an ALERT and goes to alerts.log. ghostgrant report gives a dated report ending in a verdict, or --json.
ghostgrant import records every retired identity from an Agent Security Suite inventory, such as Scope Drift Trimmer's. export --format inventory writes the checks back as lastVerifiedDeadAt and findings.
cd nhi-toolkit/tools/ghost-grant # after the one-clone setup below
node dist/cli.js decommission examples/manifest.yaml
node dist/cli.js check --mock
node dist/cli.js report billing-bot --mock
printenv OLD_AGENT_GH_TOKEN | node dist/cli.js check --live # tokens come in on stdin, never in the manifest
Records live under $GHOSTGRANT_HOME (default ~/.ghostgrant). A report's verdict is clean, dead-so-far, unknown, alive, flipped or not-checked; unknown never counts as dead. It won't revoke or rotate anything, sign or attest its reports, or run as a hosted service.
GhostGrant's daily re-check and weekly report, and Scope Drift Trimmer's inventory review, published as templates for Cronsole. Import one, point it at your clone of the toolkit, and it runs on your own schedule.
Loading the templates…
Nothing is on npm yet. Clone the toolkit and build it with Node 22.18 or newer; one install covers every tool (npm workspaces). Each tool's section above has its own commands.
git clone https://github.com/ai-automation-tools/nhi-toolkit.git
cd nhi-toolkit
npm install # one install for every tool
npm run build # builds every tool
npm test # tests every tool