Carry the receipts
Picture a run that pauses Friday afternoon and resumes after Monday's deploy. If its request, commands, and decisions lived only in the old process, the reviewer gets a confident answer with no usable history.
export const evidenceSchema = z.object({
details: z.string().optional(),
kind: z.enum(["observation", "command", "test", "decision", "diff"]),
recordedAt: z.iso.datetime(),
summary: z.string().min(1),
});A work order gives every station the same request, current status, route, and evidence. eve keeps that object attached to a durable session across model calls, sandboxes, redeploys, and approval pauses.
Carry Evidence Across Every Pause
Create a durable work-order contract with tools that initialize work and append observable evidence.
Hands-on Exercise 1.2
Create agent/lib/work-order.ts. Define these accepted values first:
import { z } from "zod";
export const workTypeSchema = z.enum([
"documentation",
"bug",
"public-api",
"unknown",
]);
export const riskSchema = z.enum(["low", "medium", "high"]);
export const laneSchema = z.enum([
"documentation",
"bug",
"public-api",
"manual",
]);Add evidenceSchema from the opening, then define workOrderSchema. Its source is always present. Classification and route are optional because intake has not made those decisions yet.
export const workOrderSchema = z.object({
classification: z.object({
actionable: z.boolean(),
confidence: z.number().min(0).max(1),
questions: z.array(z.string()),
rationale: z.string(),
risk: riskSchema,
type: workTypeSchema,
}).optional(),
evidence: z.array(evidenceSchema).default([]),
id: z.string().min(1),
route: z.object({
approvalRequired: z.boolean(),
lane: laneSchema,
reason: z.string(),
}).optional(),
source: z.object({
body: z.string(),
number: z.number().int().positive(),
title: z.string().min(1),
url: z.url(),
}),
status: z.enum([
"received", "needs-clarification", "routed", "investigating",
"awaiting-approval", "building", "verifying",
"ready-for-draft-pr", "stopped",
]),
});Infer Evidence and WorkOrder types from the schemas. Add an addEvidence function that creates the timestamp and parses the updated object. Create the timestamp inside addEvidence rather than accepting it from tool input.
Create agent/tools/create_work_order.ts and agent/tools/record_evidence.ts. Each file becomes an eve tool, so their filenames become the tool names.
import { defineTool } from "eve/tools";
import { z } from "zod";
import { workOrderSchema } from "../lib/work-order.js";
export default defineTool({
description: "Create the typed work order for one GitHub issue.",
execute(input) {
return workOrderSchema.parse({
evidence: [],
id: `issue-${input.number}`,
source: input,
status: "received",
});
},
inputSchema: z.object({
body: z.string(),
number: z.number().int().positive(),
title: z.string().min(1),
url: z.url(),
}),
});record_evidence accepts the current work order and one evidence record without recordedAt. It returns the entire updated work order.
Finally, configure the output budget and idle window for investigation, verification, and approval pauses. In agent/agent.ts, keep the starter's sessionUsage check and add sessionTimeoutMs:
limits: {
sessionUsage: ({ window }) => window.outputTokens >= 80_000,
sessionTimeoutMs: 7 * 24 * 60 * 60 * 1_000,
},sessionUsage runs before each model call and returns true once the session has written 80,000 output tokens. When that happens, eve pauses the turn and asks a person to Continue or Stop, so an accidental runaway loop waits for a decision instead of spending quietly.
A specialist's tokens count toward the root's usage, and each subagent session also checks its own usage against this same rule, because the stations author none of their own. The check is a ceiling, and it doesn't reserve or spend 80,000 tokens by itself.
Disable eve's general delegation tool at agent/tools/agent.ts:
import { disableTool } from "eve/tools";
export default disableTool();sessionTimeoutMs measures idle time. eve's default window is much longer (current default), and the clock restarts each time a turn settles. A session never expires while a turn is open, including one waiting for a person to approve a specification. Seven days means a work order nobody touches for a week gets closed out. General delegation stays off until we add named specialists with narrow jobs.
Try It
Create agent/lib/work-order.test.ts with one new work order and one appended observation. Then run:
pnpm test agent/lib/work-order.test.ts
pnpm typecheck
pnpm exec eve infoThe test should report two passing checks. eve should discover zero subagents and seven tools: our two authored tools plus eve's five defaults (bash, read_file, write_file, web_fetch, and web_search). The general agent tool no longer appears:
Compile ready
Diagnostics 0 errors, 0 warnings
Tools 7 tools
Subagents 0 subagentsCommit
git add agent
git commit -m "feat(factory): preserve durable evidence"Done-When
- Every work order carries its source, status, route, and evidence
- New work orders begin with an empty evidence list
- Evidence timestamps are created by the factory
- Root sessions close after seven idle days
eve inforeports seven tools, includingcreate_work_orderandrecord_evidence, and zero diagnostics
The work order can now outlive the process that created it. Only trusted GitHub events should be allowed to create one.
Solution
The exercise contains the complete schemas, tool shape, and session limits. Compare agent/lib/work-order.ts, agent/tools/record_evidence.ts, and agent/agent.ts with the complete folder if a focused test fails.
Was this helpful?