← Back to Use Attest your way

For Agents

Attest makes coding agents (Codex, Grok Build, Claude Code, and others) follow your rules by default. One init command sets up the local database, protected helpers, automatic wrappers, and agent instructions. You write and turn rules on in the Trust Center. Every check is written to the tamper-evident log.

  1. 1Initnpx attest-core init
  2. 2Trust Center ruleswrite and turn on
  3. 3Agents follow themhelpers, wrappers, AGENTS.md

1. Quick start

bash
npm install attest-core
npx attest-core init

This creates:

  • ./attest.db: rules and decision log
  • ./attest-guard: protected helpers and wrappers
  • AGENTS.md: instructions agents read automatically

Start the Trust Center:

bash
npx attest-ui --db ./attest.db

2. What the init command sets up

  • Local database with default posture
  • Protected helpers (protectedDeploy, protectedRefund, protectedDelete, protectedSendEmail, etc.)
  • wrapTools() and protectFetch() ready to use
  • AGENTS.md that tells every coding agent to use only the gated path

3. Protected helpers

javascript
import { protectedDeploy, protectedRefund } from "./attest-guard";

await protectedDeploy({ ... });
await protectedRefund({ amount: 2000 });

These call the gate internally. Denied or needs-approval results stop the action and are logged. Approval items appear in the Trust Center.

4. Automatic wrappers

wrapTools(): wrap your own functions.

javascript
import { wrapTools } from "./attest-guard";

const tools = wrapTools({
  deploy: realDeployFn,
  refund: realRefundFn,
  deleteUser: realDeleteFn
});

protectFetch(): automatically gate matching HTTP calls.

javascript
import { protectFetch } from "./attest-guard";

protectFetch({
  rules: [
    { urlPattern: /api\.stripe\.com\/v1\/refunds/, action: "refund" },
    { urlPattern: /deployments/, action: "deploy" }
  ]
});

Matching requests are checked before they go out. Non-matching requests pass through.

5. Agent instructions (AGENTS.md)

A representative block of what init writes:

text
# Attest Gate Rules

Before any deploy, refund, delete, or sensitive external call you MUST use the Attest gate.

Use only the helpers and wrapped tools from ./attest-guard.
If the result is denied or needsApproval, stop. Do not bypass.

Person: "codex-agent" / "grok-agent"   Role: "coder"

Codex, Grok Build, Claude Code, and similar agents read this file and follow it.

6. You control the rules in the Trust Center

  • Write rules in plain language and turn them on.
  • Reorder them, require approval, or switch the default posture.
  • Pending approvals, the full decision log, and evidence export live in the same Trust Center.
  • A rule you enable immediately affects the next call from any agent using the guard.

7. Same database for every agent

All agents and scripts share one attest.db. Decisions made by Codex appear in the Trust Center log. Rules changed in the Trust Center apply to Grok Build, Claude Code, or your own code on the next check.

8. Enforcement note

Attest automatically steers agents onto the gated path via protected helpers, wrapTools(), protectFetch(), and AGENTS.md. It is a governance and evidence layer. For stronger guarantees, route real credentials and tools only through the wrapped helpers so bypassing requires deliberate extra work.

← Back to Use Attest your way