Scan your whole stack
Are you using engagement-guard?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.1
engagement-guard was last scanned on 20 Oct 2026 at version 0.1.1. Risk score 40 of 100 (medium). No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.1.1 LATEST | 20 Oct 2026 | 1 rule fired |
| 0.0.0-stage | 20 Oct 2026 | Not shown |
Findings for v0.1.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
Code clears the Windows event logs (wevtutil cl, Clear-EventLog) while naming the Security, PowerShell, Defender or Sysmon logs, or every log it enumerates. Those logs are what an investigation reads first, and clearing them removes the record of what ran on the machine. System cleaners and some admin scripts do it on purpose, so on its own it only calls for a review.
MEDIUMThe score describes 0.1.1; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Authorisation-bounded execution for AI agents that run security tools.
engagement-guard sits between an AI agent and the security tools it runs. An engagement file sets the scope, the time window, the blackout hours and the rules of engagement. The guard reads each shell command or network tool call, extracts its targets, and passes, asks or denies. Every decision is written to a hash-chained audit log before it is returned.
It ships as a TypeScript library, a CLI, a Claude Code PreToolUse hook and an MCP server example.
agent ──▶ "nmap 192.0.2.66" ──▶ engagement-guard ──▶ deny OUT_OF_SCOPE ──▶ harness
│ reads .guard/engagement.yaml (scope, window, RoE)
└─ appends .guard/audit/…jsonl (hash-chained)
Why this exists. In an incident report dated 5 August 2026, the UK AI Security Institute counted 19 unsanctioned actions in 10 of 122 cyber-evaluation runs across seven frontier models, in a setup that deliberately allowed open internet access. Its recommended fixes are fine-grained network controls, and monitoring that blocks out-of-scope actions as a run proceeds. This package is the second kind of fix, for any agent harness.
.guard/engagement.yaml lists the in-scope and out-of-scope targets, the window, blackout hours, the tiers the rules of engagement allow, and rate limits. A frozen scope is hashed; an edited one must be attested again by a person.sudo, env, xargs, ssh, docker run and the like, knows the target flags of common security tools, reads target-list files, and sweeps everything else for literal addresses and URLs.audit verify checks the chains; audit export signs a bundle.The package is not on npm yet. Until it is published there as engagement-guard, install from a clone:
git clone https://github.com/rootMonsteR/engagement-guard.git
cd engagement-guard
pnpm install && pnpm build
npm install -g . # the `engagement-guard` command
Requires Node 22.12 or newer and pnpm. To use the library in a project before the npm release, add the clone as a dependency: npm install /path/to/engagement-guard.
The package is ESM only: import it; require() is not supported. Its types refer to Node's, so a TypeScript project needs @types/node installed. It is declared as an optional peer dependency and the declaration file references it, so no types entry in your tsconfig is needed.
Pre-1.0: a change to the reason codes, the audit record, the exit codes or the hook output is at least a minor version bump, and CHANGELOG.md names every one.
Write the engagement, attest it, and check four commands:
export GUARD_HOME="$(mktemp -d)" # the operator's home: acknowledgement and signing key
cd "$(mktemp -d)" # the workspace: shown as <demo> below
engagement-guard init --id demo-2026q4 --name Demo --client "Demo Ltd" \
--in 192.0.2.0/24 --out 192.0.2.66 \
--window-start 2026-10-17T19:02:38Z --window-end 2026-10-19T19:02:38Z --timezone UTC \
--auth-ref SOW-1 --authorised-by "Dana Reyes" --signed-on 2026-10-10
engagement-guard engagement validate
engagement-guard ack --operator alice # prints the operator statement; type I AGREE
engagement-guard engagement freeze --attest demo-2026q4
| Command | Verdict | Exit |
|---|---|---|
engagement-guard check "nmap 192.0.2.10" |
pass IN_SCOPE |
0 |
engagement-guard check "nmap 203.0.113.5" |
ask UNKNOWN_TARGET (in no scope list) |
1 |
engagement-guard check "nmap 192.0.2.66" |
deny OUT_OF_SCOPE (listed under out) |
2 |
engagement-guard check "echo bm1hcCAxOTIuMC4yLjY2 \| base64 -d \| sh" |
ask OPAQUE_CONSTRUCT (code the guard cannot read) |
1 |
Use a window that brackets the time of your run. init, ack and engagement freeze|edit|load must be typed at a terminal: piped, or run by an agent, they refuse, and the guard denies them when it sees them in a shell command. check exits 0 for a pass or a call it does not inspect, 1 for an ask and 2 for a deny. Run engagement-guard --help for every command.
Captured on Windows under Git Bash. Workspace paths are shown as <demo>, with forward slashes. The operator statement printed by ack is left out; read it in full when you run ack.
$ engagement-guard init --id demo-2026q4 --name Demo --client "Demo Ltd" --in 192.0.2.0/24 --out 192.0.2.66 --window-start 2026-10-17T19:02:38Z --window-end 2026-10-19T19:02:38Z --timezone UTC --auth-ref SOW-1 --authorised-by "Dana Reyes" --signed-on 2026-10-10
wrote <demo>/.guard/engagement.yaml
next: replace every TODO, then run: engagement-guard engagement validate
# exit code 0
$ engagement-guard engagement validate
valid: demo-2026q4 (0 warnings)
# exit code 0
$ engagement-guard ack --operator alice
[the first-run-v1 operator statement is printed here]
Type I AGREE to acknowledge: I AGREE
acknowledged: alice at 2026-10-18T19:02:38.776Z (first-run-v1 65fcc27572cf)
# exit code 0
$ engagement-guard engagement freeze --attest demo-2026q4
frozen: demo-2026q4 scope_hash bec26bff59783d9969cba8f353aaa78490aa412ee82c19b1a391c24f618bf94a
status: active — demo-2026q4 (scope_hash bec26bff5978)
# exit code 0
$ engagement-guard check "nmap 192.0.2.10"
pass IN_SCOPE
engagement-guard: PASS [IN_SCOPE]: all targets are in scope; tier and rate are within the RoE
Target: 192.0.2.10: in-scope, rule in[0]: 192.0.2.0/24
Tier: recon
Case: demo-2026q4 (<demo>/.guard/engagement.yaml)
Core permission rules decide next.
targets: 192.0.2.10 (in-scope)
# exit code 0
$ engagement-guard check "nmap 203.0.113.5"
ask UNKNOWN_TARGET
engagement-guard: NEEDS CONFIRMATION [UNKNOWN_TARGET]: a target matches no scope entry
Target: 203.0.113.5: unknown, no matching scope rule
Tier: recon
Case: demo-2026q4 (<demo>/.guard/engagement.yaml)
The operator must confirm; if the target belongs to the engagement, add it with `engagement-guard engagement edit`.
targets: 203.0.113.5 (unknown)
# exit code 1
$ engagement-guard check "nmap 192.0.2.66"
deny OUT_OF_SCOPE
engagement-guard: DENIED [OUT_OF_SCOPE]: a target is out of scope
Target: 192.0.2.66: out-of-scope, rule out[0]: 192.0.2.66
Tier: recon
Case: demo-2026q4 (<demo>/.guard/engagement.yaml)
If the client has authorised this, the operator can update `.guard/engagement.yaml` and run `engagement-guard engagement edit` (audited). Do not try to work around this check.
targets: 192.0.2.66 (out-of-scope)
# exit code 2
$ engagement-guard check "echo bm1hcCAxOTIuMC4yLjY2 | base64 -d | sh"
ask OPAQUE_CONSTRUCT
engagement-guard: NEEDS CONFIRMATION [OPAQUE_CONSTRUCT]: the command uses constructs the guard cannot read
Targets: none extracted
Opaque constructs: piped-code
Case: demo-2026q4 (<demo>/.guard/engagement.yaml)
Write the targets literally, or the operator must confirm.
# exit code 1
$ engagement-guard audit verify
ok demo-2026q4/37fc48ef-39ab-4c99-993a-ef796fc6298d.jsonl 2 e98bb87fce7e
ok demo-2026q4/9bcf0fbb-56a2-453b-b5aa-03c095dab693.jsonl 3 6705118ec282
ok demo-2026q4/307dadca-5576-4a3d-a393-74c9b01f4c0b.jsonl 3 285b1f400c0a
ok demo-2026q4/9dfc81cb-727a-4571-8f4c-f1958aa69e02.jsonl 2 3248fe68ecad
ok demo-2026q4/7becbe09-0f23-44f9-b0ba-d7c6d50d4cf0.jsonl 3 0d8510a8966e
# exit code 0
Each CLI call, the freeze included, runs as its own audit session, which is why audit verify lists five chains.
engagement-guard hook is a Claude Code PreToolUse hook. It checks each Bash command, and each Write, Edit, MultiEdit and NotebookEdit against the protected case paths, before the call runs. It answers deny or ask, or stays silent on a pass. Other tools are inspected when named with --tool and listed in the matcher.
[cannot be auto-approved].--timeout-ms becomes a deny with GUARD_ERROR on stdout and stderr and exit 2, because a crashed or timed-out hook would let the call run.Setup, sample output and limits: examples/claude-code/README.md.
An example MCP server with a guarded_shell tool: it runs a command only when guard.check passes, and returns the decision text otherwise. It also offers engagement_status. It is an example, not a published package: examples/mcp-server/README.md.
createGuard(options) opens the workspace's case and audit log and returns a Guard:
guard.check(command) decides a shell command and audits the decision. It resolves to an outcome (verdict, reason, message, annotation) or to 'not-inspected'. guard.checkRequest(req) does the same for any request, structured network tools included.guard.middleware is a before-rules permission middleware for a harness with its own permission engine. guard.install(host) registers it on a host with a use(mw, stage) method and returns the remover.guard.subscribe(events) routes a harness's events (exec.spawn, exec.exit, tool.result, …) into the audit log.guard.dispose() removes every middleware and subscription and flushes the audit log.import { createGuard } from 'engagement-guard'
const guard = await createGuard({ cwd: '/work/acme' }) // reads /work/acme/.guard/engagement.yaml
try {
const out = await guard.check('nmap -sV 192.0.2.66')
if (out === 'not-inspected') console.log('not a shell or network call')
else console.log(out.verdict, out.reason) // against the demo case above: deny OUT_OF_SCOPE
} finally {
await guard.dispose()
}
The home (first-run acknowledgement and signing key) is options.home, else GUARD_HOME from options.env, else ~/.engagement-guard. The guard never reads process.env on its own. Everything else the package exports (the scope engine, the extractor, the audit verifier and exporter) is listed in src/index.ts.
The guard applies its checks in this order:
HARD_REFUSAL. A write to the case file, the scope snapshots, the audit log or the keys is PROTECTED_PATH.FIRST_RUN_REQUIRED, NO_ACTIVE_CASE, CASE_INVALID, NOT_ACKNOWLEDGED, SCOPE_TAMPERED), and so are OUTSIDE_WINDOW and BLACKOUT. Nothing overrides the window or blackout hours.in, out and operator lists, with DNS resolution checked too: out-of-scope, unknown, unresolvable, partly covered, trusted infrastructure or in scope.rate_limits. Authorised exploitation still needs the operator to confirm.REASON_CODES wins.A failure anywhere in the guard is GUARD_ERROR, and an audit log that cannot be written is AUDIT_UNAVAILABLE. Both deny. The full matrix and every reason code are in docs/decision-matrix.md.
The guard reads command text, not behaviour.
eval, a pipe or redirect into a shell or interpreter, an encoded PowerShell command, inline code that decodes or executes data, a script written earlier in the same command../scan.sh, python3 s.py, make scan, npm run scan), a case file rewritten by an interpreter (python3 -c "open(…)"), git reset --hard or git stash in a repository that tracks the case file, or an archive extracted into the workspace.engagement-guard engagement edit shows before attesting.The suite has 2,200 tests. On Windows 2,197 pass and 3 are skipped (the POSIX file-mode and /proc checks); on Linux and macOS 2,196 pass and 4 are skipped (the Windows path-form checks). CI runs it on all three; the figures are from 2026-10-19, after the pre-release review. The command extraction table in test/fixtures/commands/extraction-table.yaml (243 rows) runs each row through the extractor and the guard.
pnpm install
pnpm check # biome lint, tsc typecheck, vitest
Apache-2.0; see LICENSE and NOTICE. The code was extracted from the security layer of the authors' Nemesis project. Comments in the source and in docs/decision-matrix.md that cite § sections or P-numbered rulings refer to that project's internal design documents, which are not published; they are kept so that each rule can be traced to its origin. What this package does is defined by docs/decision-matrix.md and the extraction table, not by those documents.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.