v0.2 turns Shield from a regex filter into a thinking guardrail. 45 rules across 8 destructive surfaces, composite scoring across every matching rule, a workspace context probe, local decision memory, and an in-process burst detector — all running offline on your machine. Drop-in for Cursor and Claude Code. Apache 2.0.
/etc / ~/.ssh / ~/.aws, dd to block device, find … -delete sweeps, world-writable chmod, recursive chown root.points score (defaulting to severity rank). When multiple rules fire on the same call, Shield sums their points and maps the total to its own severity tier: 2 → Medium, 5 → High, 9 → Critical. The final severity is whichever is higher — top single match or composite total.
git branch -D feature/legacy is a Medium warning. The same call inside a script that also reads ~/.aws/credentials and runs chmod 777 /var/data stacks four matches at 2 + 4 + 3 + 3 = 12 points and gets promoted to Critical. Composite scoring catches the shape of a destructive session even when no single command crosses the line.
.env.production, kubeconfig, prod/, terraform state, a Procfile. When any of them match, Shield logs a banner and bumps the severity of every subsequent match one tier. The probe takes under 1 ms and never recurses outside cwd. Disable per-run with --no-workspace-probe.
.aperion-shield/decisions.jsonl in your project root, fingerprinted by sha256(rule_id + canonical-JSON(params)). The log is append-only and never leaves your machine. Two adaptive behaviours derive from it:
UPDATE users SET email_verified=true WHERE id IN (…), Shield stops prompting. But if you ever deny one, the next attempt is treated harder. Disable per-run with --no-memory.
rms and a git push --force back-to-back — exactly the moment you want the brakes to tighten, not stay constant. Configurable threshold and window under policy.burst_detector; disable with --no-burst.
curl_pipe_sh — sees through sudo -u root bash and env FOO=bar python wrapper prefixes.network_fetch_to_interpreter — process-substitution form (bash <(curl …)).env_to_network — compound: secret source + network sink in the same command line.reverse_shell — 10 classic incantations.world_writable_chmod — numeric AND symbolic forms.untrusted_pkg_registry — allowlist-based detection of non-default npm/pip/yarn registries (since Rust regex has no negative lookahead).sensitive_paths matcher with ~ expansion and .. traversal normalisation, closing a class of evasion tricks (cat /etc/../etc/shadow and cat /etc/shadow resolve identically).
safer_alternative field in the JSON-RPC error payload, surfaced to the user in the IDE's tool-call panel. Examples:
fs.recursive_delete_root: “Scope to a specific subdirectory, e.g. rm -rf ./build/.”git.history_rewrite: “If you need to remove a commit, git revert it; rewrites strand collaborators.”supply.curl_pipe_sh: “curl -fSLo install.sh URL && shasum -a 256 install.sh && bash install.sh.”secret.env_to_network: “Never let an agent share a secret with an outside service. Copy manually and rotate afterwards.”[lib] + [bin]. The library at aperion_shield::engine exposes Engine, Adjustments, Evaluation, and decide() so embedders can drop the engine into non-MCP contexts: custom proxies, lint tools, pre-commit hooks, CI step that scans pending shell commands. Same YAML format, same predicates, no MCP plumbing required.
--telemetry flag remains reserved and stubbed — setting it today still prints the privacy-review notice and exits without sending anything. Nothing is phoning home in v0.2.
~/.cursor/mcp.json~/.claude/config.json or claude mcp addshield.yaml documents load unchanged in v0.2. Rules without an explicit points field default to their severity rank (Low = 1 … Critical = 4), so composite scoring “just works” on your existing ruleset without edits.
[shield] composite_scoring=true workspace_probe=true decision_memory=true burst_detector=true. If the workspace probe matches a prod signal, a second line names which signals fired. So you always know what's running.
--no-workspace-probe, --no-memory, --no-burst — disable the corresponding adaptive layer per-run. The old behaviour (single-rule, regex-only, no memory) is one flag away if you want it.
(rule_id, severity) tuples that power a community dashboard (think CVE tracker for AI-agent destructive operations). Gated on legal/DPO review; will never enable without explicit opt-in via --telemetry.
| # | Change | Tag | Notes |
|---|---|---|---|
| 01 | 45 rules · 8 destructive surfaces | Security | SQL · git · fs · secrets exfil · supply chain · reverse shells · privilege · cloud / k8s / docker |
| 02 | Composite scoring | Engine | Sum points across matches; 2 / 5 / 9 thresholds |
| 03 | Workspace context probe | Adaptive | Bumps one tier in prod-looking repos |
| 04 | Decision memory | Adaptive | .aperion-shield/decisions.jsonl; demote-after-3, deny-resets-streak |
| 05 | Burst detector | Adaptive | 5 destructives in 5 min escalates subsequent matches |
| 06 | Six new structured predicates | Engine | curl_pipe_sh · env_to_network · reverse_shell · world_writable_chmod · sudo_prefix · untrusted_pkg_registry |
| 07 | safer_alternative on every block | UX | Teach as you go — never just “denied.” |
| 08 | Hybrid lib+bin crate | Engine | Embed the engine in non-MCP contexts |
| 09 | 87 tests, all green | QA | 36 unit + 51 integration; positive + negative per rule |
| 10 | Still offline by default | Privacy | Nothing phones home. --telemetry remains stubbed. |