prd.ts as backlog, state model, and gatekeeper.

Agents use prd.ts + gate files to build in reverse: define expected behavior, then verify it.

1) Install
npx gateproof prdts # paste a prompt, get prd.ts
2) Use
bun run prd.ts # pick a task, you execute it with your own agent
3) Loop
bun run prd:loop # (optional) agent fixes, gates re-run, loop until all gates pass
What's in prd.ts? (Agent-First Structure)
  • id: Unique identifier (type-safe literal)
  • title: What to do + evidence of completion
  • gateFile: Path to automated verifier
  • dependsOn: Execution order (dependencies)
  • scope: What files can change (guardrails)
  • progress: Progress checkpoints for agents

Patterns & Examples

Real-world examples for every use case. Copy, adapt, deploy.

Try the hello-world agent: a tiny loop with read/list/bash/edit/search + gates.

Requires OPENCODE_ZEN_API_KEY and network access to opencode.ai.

CLI: npx gateproof prdts — paste a prompt, get prd.ts.

One file: define a Story, run its Gate

Minimal end-to-end: story metadata + gate execution in one file.

      // patterns/e2e.story-and-gate.ts
import { Gate, Act, Assert, type Story } from "gateproof";
import { CloudflareProvider } from "gateproof/cloudflare";

// 1) The Story (your PRD can be a list of these)
const story: Story = {
  id: "user-signup",
  title: "User can sign up",
  gateFile: "./gates/user-signup.gate.ts"
};

// 2) The Gate (executable proof for that story)
const provider = CloudflareProvider({
  accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
  apiToken: process.env.CLOUDFLARE_API_TOKEN!
});

const result = await Gate.run({
  name: story.id,
  observe: provider.observe({ backend: "analytics", dataset: "worker_logs" }),
  act: [Act.browser({ url: "https://app.example.com/signup" })],
  assert: [Assert.noErrors(), Assert.hasAction("user_created")],
  stop: { idleMs: 3000, maxMs: 15000 }
});

if (result.status !== "success") process.exit(1);
    

See it work

This runs 3 gates against a live API (httpbin.org) in an isolated sandbox. Watch it validate HTTP responses in real-time.

live-demo.ts

Click "Run Demo" to see gateproof validate a live API

Gates will test: health check, JSON response, header echo

Runs in isolated Cloudflare container
🔍
Observe
HTTP requests monitored
Assert
Responses validated
Evidence
Pass/fail recorded