blake-gate

Policy outside the model.

Part of blake-guard: compile owner rules into a policy artifact, then gate every dangerous intent before the tool runs. Same package on Blake or your host.

blake-guard · blake-gate · Apache-2.0 · Node ≥ 20

why

Gate before the tool.

  • Outside the model

    The LLM proposes intents. The gate decides. Prompts are not the enforcement layer.

  • Allow · deny · ask

    Every dangerous action returns allow, deny, or require_approval — with reasons and rule ids for audit.

  • Spawn locked by default

    agent.spawn and agent.replicate default to deny — uncontrolled replication stays at zero until the owner authorizes.

install

Get the package.

npm install blake-gate

# or from GitHub
npm install github:ndblk3/blake-gate

gate

Compile, then evaluate.

import { compilePolicy, evaluateIntent } from "blake-gate";

const policy = compilePolicy({
  agentId: "your-agent-id",
  ownerId: "your-user-id",
  environment: "personal_private",
  agentSpawn: "deny",
  agentReplicate: "deny",
  connectors: [{ id: "github", tier: "write" }],
  stops: "No send. No force-push.",
});

const decision = evaluateIntent(
  { type: "git.merge", agentId: "your-agent-id", environment: "personal_private", connectorId: "github" },
  policy,
  { now: new Date().toISOString() },
);

intents

What the gate understands.

  • run.start
  • secret.read
  • git.push
  • git.force_push
  • git.open_pr
  • git.merge
  • mail.send
  • chat.send
  • outbound.publish
  • agent.spawn
  • agent.replicate

cli

No import required.

npx blake-gate compile --in source.json --out policy.json
npx blake-gate evaluate --policy policy.json --intent intent.json
npx blake-gate materialize --policy policy.json --dir ./workspace

schematics

Not a prompt.

01 · gate loopModel proposes. Gate decides. Tool runs only on allow.
LLM / agentproposes intent
evaluateIntentblake-gate
allowrun tool
require_approvalhuman ticket
denyhard stop

Prompts are not enforcement. The decision object carries effect, rules, fingerprint, and optional signed allowToken.

02 · artifactPolicy is compiled once — versioned, hashed, not a prompt.
Owner rulesstops · connectors · env
compilePolicyPolicySource →
policy.jsonpolicyHash · version
gate.mjsworkspace / CI
  1. Host maps product fields → PolicySource.
  2. compilePolicy stamps policyHash / version.
  3. materializePolicyWorkspace writes .blake-policy/ + history jsonl.
  4. diffPolicies shows what changed for this agent.
03 · dual-envPractice never sees personal scopes — compliance suite, not UI.

personal_private

may personal secrets

not practice credentials

org_private

may org secrets

not personal secrets

hire_sandbox

may practice tools only

not personal · org

CI: npx blake-gate env-check · assertEnvIsolation()

04 · before · afterGate before the tool. Audit after the fact.
Gate beforeevaluateIntent
Tool / Cursor / CImerge · push · send
Evidencelog · PR · outbound
evaluatePostActionprior decision vs fact
okmatched allow
ViolationEventdeny / approval ignored

Competitors often stop at “before.” Drift between prompt and merge log becomes a violation event.

05 · capability ticketsSame fingerprint + policyHash → durable allow. Drift asks again.
fingerprinttype · target · repo · branch · agent · env
require_approvalfirst time
ApprovalRequestwebhook · email · Slack
grantApprovalstore ticket
same intent againno drift
allowapproval.durable
allowTokenHMAC · verify before tool

Not chat moderation — capability tickets. Without a valid allow-token, merge/send must refuse even if the model “decides.”

06 · one contractSame package on every runner.
blake-gateHOST_CONTRACT_VERSION
  • Cursor CLI
  • Claude Code
  • GitHub Actions
  • custom worker
  • Blake host

Delivery adapters stay thin. Core is runtime — approval is protocol, not a Blake-only UI.

on blake

Already wired into runs.

Blake gates run.start, writes .blake-policy/, and owners can probe intents at /api/account/policy.

Part of blake-guard — gate · witness · trail.