Open source · local CLIs with no server, no account and no telemetry.

View source
NHI Toolkit
ai-automation-tools · two CLIs · one repo

The access your bots hold, from the grant to the retirement.

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.

The tools

Two tools, one identity's life

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.

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.

GhostGrant

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.

Tool 1 · while it's alive

Scope Drift Trimmer: granted, next to used

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.

The Scope Drift Trimmer demo: a critical banner for legacy-invoice-sync and the findings table, most severe first, with the first finding's evidence expanded.
The live demo with the first finding's evidence opened. A fictional estate of 8 identities and 16 grants.
28 seconds, no sound: the flagged identity, the findings with evidence and a draft remediation opened, and the per-identity grant tables.

Import

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 · Okta

Grade the evidence

A 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.

usageKnown

Four rules

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>

Draft the trim

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.

drafts only

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.

Tool 2 · after it's retired

GhostGrant: did its credentials actually die?

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.

Write a manifest

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.

YAML manifest

Ask the provider

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.

check --live

Re-check windows

Each check runs the window that's due: 24 hours, 7, 30 and 90 days. --mock runs the same checks against canned answers.

24h · 7d · 30d · 90d

Alert on a flip

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.

dead → alive

Inventory in, inventory out

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.

schema v0.1

Try it in mock mode

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.

Schedule it

Run them unattended, as Cronsole templates

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…

Get started

One clone, every tool

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
Resources

Everything is in the repo