{}

/AI CASE STUDY / SYSTEM DESIGN

Building an approval-gated AI copilot for deterministic JSON tools

A production-minded case study of constrained agents, explicit user control, provider-neutral orchestration, measurable evals, private infrastructure, and a hard operating budget.

4

fixed tools

3

turns / session

100%

final routing score

$0.000918

p95 eval session

Request → proposal trust path

  1. 01Submit context
  2. 02Moderate instruction
  3. 03Route
  4. 04Fixed-schema tool
  5. 05Rust validate
  6. 06Safe summary
  7. 07Apply to workspace

Architecture chapters

01 PRODUCT

Contextual Copilot drawer

Available from Formatter, Diff, Patch, and Pointer with selected context, prompts, turns, a safe summary, and explicit workspace approval.

Welcome · clarify · trace · summary → Apply

02 AGENT

Provider-neutral orchestration

The Responses API sits behind AgentProvider with no runtime model escalation and strict round-trip and tool-loop limits.

≤ 2 round trips · ≤ 2 tools/turn

03 CONTRACTS

Four shared tool schemas

format_json, diff_json, apply_json_patch, and resolve_json_pointer are schema-validated for web and the private local MCP package.

One contract · two surfaces

04 SECURITY

Untrusted by default

Prompts and JSON remain data. The agent receives no shell, filesystem, network, URL, database, or dynamic tool access.

Private backend · store:false

05 IDENTITY + QUOTA

Account-free, signed, bounded

A signed HttpOnly visitor identity, rotating IP HMAC, and Firestore transactions enforce every hosted quota.

1 session/24h · 3 turns

06 EVALS

60 routing and adversarial cases

The final paid Luna run passed all 60 routing, ambiguity, injection, and abuse cases with schema-valid calls and Jason-valid Patch proposals.

100% route · 100% valid

07 COST + ROLLOUT

$20 combined target

Scale-to-zero, an enforced $8 provider hard cap, measured p95 cost, and an approved 10-session daily pilot limit surprise spend.

10/day pilot · no automatic increase

08 MCP

Local stdio parity

The private, client-neutral Jason MCP package exposes identical schemas and invokes the local jason binary with fixed arguments and stdin.

Caller model · caller budget

RELEASE STATUS

Evidence stays labeled through release

The final Luna evaluation reached 100% routing with a $0.000918 p95 session estimate. Production smoke now covers Formatter, Diff, Patch, and Pointer with explicit workspace approval. Cumulative pilot estimated usage is $0.003728. The 10-session daily pilot remains active while its seven-day review continues.