What it does
The whole system. A TypeScript system of 6,761 lines of application code in 68 files: 2,377 lines in 19 modules under src/, 4,268 lines in 41 TypeScript command-line scripts under scripts/ (43 scripts with the two shell scripts, 72 more lines), and three hook scripts. Counted widest, with the two shell scripts and the Codex copies of the three hooks, the application code is 6,761 lines in 68 files. Beside it sit 2,083 lines of tests in 13 files holding 134 test cases, 4,784 lines of Markdown and YAML (the operating manual, the three specialist agents, nine commands and eight documents on the venue receptionist), 16 workspace-tool files, 4 agent files, 4 phone-number files and 53 commits. It runs its voice agents on live phone numbers, and it was built to run any number more.
- The scheduled jobs. Two shell scripts run outside any session.
run-check-credits.shis the daily launchd entry for the credit watchdog: it fetches the key from the Keychain into that one process, logs to a state folder and exits 3 if the repository is missing.run-model-comparison.shruns the whole test suite on the live model and on the staging model, five repeats each, saves the log and emails it through Resend; it is idempotent per day and refuses to spend credits again if that day's log exists, so the result arrives even if the session that scheduled it has closed. - The one-shot edit scripts. Eight dated scripts (1,331 lines) are the receptionist's recorded changes: phase 1, phase 2 and its follow-up, phase 3 and its waves (the workspace-tool description fixes, the capture-lead description patch), and a read-only audit of lead capture by channel that never prints a rate it did not measure. Each carries its engagement-frame self-check and its plan reference in a header comment, so every change to the live agent can be traced to its finding.
- The headless scorer.
src/claude-cli.tsruns Claude Code as a clean one-prompt request: no tools, no tool servers, no saved session, authenticated by the subscription login, so scoring bills against the subscription and a scorer can touch nothing. - The evidence on disk. The receptionist's cache holds 857 conversation files, 584 scorecards, a 1,831-line audit and a 1,052-line summary, with three hand-over documents of 702 lines from the audit under
plans/handoffs/. The project settings also denyrm -rf, force push, hard reset and the refusal-stub script. - The agent files. Each agent (a venue receptionist, the agency's own line, and an inbound and an outbound agent for an environmental testing company) is one complete file: voice, AI model, opening line, full instructions, tool wiring, turn-taking and speech-recognition settings, call limits. Together they hold instructions of 23,131 characters (the receptionist), 10,747, 7,357 and 4,931. Each phone number is one file, keyed by the number, naming the agent that answers it.
- The schemas.
src/schema.ts(183 lines) describes every agent, phone number, webhook and knowledge-base document, and every answer the vendor returns is checked against it before the system acts. It encodes the vendor's real shape where the natural guess is wrong: a number's agent sits nested underassigned_agent, not at the top. A round-trip test pins that reading a file, stripping the vendor's own fields and reading it again loses nothing. - The write contract.
src/writable-schema.tslists, from the vendor's published interface definition, exactly the five fields the system owns and may write (name,conversation_config,platform_settings,tags,workflow); everything else the vendor adds is excluded by default so its changes cannot leak into the files.scripts/check-writable-schema.tsre-reads the vendor's live definition and fails if the list has drifted. - Sync and drift.
pull-agents.tscopies live agents and numbers into files;diff-agent.tsanddiff-tools.tscompare files with the live service (a stable deep-equality diff insrc/diff.ts) and exit with an error on any difference. The tool check also reports a live tool that has no file, the more dangerous direction. - Staging push and promotion.
push-to-staging.tscreates each agent's staging copy on first use and writes only there.promote-to-main.tsmerges staging into the live agent and refuses without the typed flag--i-am-a-human-and-tested.push-agent.tsandpush-tool.tsexist only to refuse. - The workspace-tool system. All 16 shared tools (webhooks that decide what each agent sends to a production system) are tracked in
tools/, withsrc/tool-schema.tsdescribing them.promote-tool.tsis a dry run unless given--i-am-promoting-to-live; it refuses without a tracked baseline, saves a snapshot of the live tool totools/.rollback/, writes, reads the tool back to prove the change landed, and prints the undo.rollback-tool.tsrestores a snapshot.pull-tools.tswarns on duplicate names instead of overwriting one. Two names exist twice, pointing at two different businesses, so those files carry the tool's id in their names and no script guesses between them. - The hooks. Before any agent is created or updated through the vendor's tools, a check parses the request and denies it on failure; after a create, a ledger records the new agent's id; at the end of every session the full gate runs.
pnpm gateis the type check, the whole test suite and a validation of every JSON file in the repository against its schema. - Creating an agent from a brief. One command,
/new-agent, takes a short description of the business and the job. The voice-agent-builder designs the whole agent: voice, AI model, opening line and instructions. After approval it is created, recorded in the ledger, pulled back as a file and checked by the gate. - Nine commands and three specialists.
/pull,/diff,/push,/new-agent,/update-agent,/call,/transcript,/clone-voiceand/improve, each a short written procedure that fires only when typed. All nine are mirrored for Codex, with the three specialists, the hooks and a generated copy of the manual (AGENTS.md, 388 lines). - The specialists. The voice-agent-builder designs a complete agent from a brief (name, business, task, voice, model, opening line, limits; it asks for what is missing and never invents). The prompt-doctor audits instructions against twelve kinds of defect (conflict, vagueness, over-specification, tone collapse, no outcome, forbidden-list bloat, variable misuse, opening-line mismatch, engagement-frame violation, transfer-language inflation, a forbidden behaviour whose tool is still held, and a channel-conditional affordance) and never rewrites. The transcript-analyst turns the worst failure groups into findings in a fixed form (flag, severity, count, root cause, quoted evidence, what to fix) and writes no new wording.
- The measuring pipeline.
bulk-transcripts.tspages through every call and caches it;src/spam-filter.tsremoves robocalls (191 of the receptionist's phone calls, 27.1%, were scripted business-listing scams that looked like dropped callers and distorted every rate by about 28%);score-transcripts.tshas Claude score each call on six measures (task execution, conversation quality, compliance, sentiment, technical performance, business outcome) throughclaude -pon the existing subscription, so no API key is needed;src/voice-flags.tsflags silences, slow replies, failed interruptions and clarification loops from timestamps alone, with no AI;src/cluster-flags.tsmerges the many spellings the scorer gives one failure into one ranked cluster, in an ordered rule table where the most specific rule wins;summarize-flags.tsandaudit-failures.tsrender an audit of nine numbered sections (disposition, engagement gap, transfers, failure clusters, voice flags, score distribution, worst-ten call dossiers, prompt crosswalk, ranked investigation priorities), plus lead capture by channel and a weekly-volume appendix. The cache holds 857 recorded calls of the receptionist; 584 are scored. - Lead capture by channel.
src/conversation-facts.tsreads which channel each call came in on (phone, website chat, browser voice) and says "unknown" for calls before the vendor recorded it, never a guess. The audit prints website-chat lead capture on every run, so the figure cannot be skipped. - /improve. One command runs the chain: cache the calls, score them, cluster the failures, have the analyst and prompt-doctor read them, write exact current-wording and revised-wording pairs, pass each through a local check (not unchanged, not more than three times the size, found exactly once in the instructions), show the difference, and on a yes route to the staging copy.
- Tests before going live.
agent-tests/eric.jsonholds 13 tests built from real calls (lead capture on a name, the "speak with a named person" callback, refund in and out of hours, tour booking parameters, price date normalising, website visitor with no caller number, no farewell, declined name, Spanish opener, phone caller never asked for a number, closed-on-Saturday awareness, website refund).push-agent-tests.tsloads them by name;run-agent-tests.tsruns them against live or staging, any number of repeats, prints each judge's reasoning and the credits the run spent, and can override the model so a candidate runs on the live instructions untouched.run-model-comparison.shruns the suite on both versions at a set time and emails the log. - The credit watchdog.
src/credit-watchdog.tsandscripts/check-credits.tsturn the vendor's usage counter into green, warn at 70%, critical at 90% or exhausted, project whether the burn rate empties the allowance before the reset, and email once per threshold per billing period (state kept in a file, a saved-snapshot option for tests, a 100%-used snapshot that must exit with code 2). A scheduled job runs it daily at 08:10. - Outbound calling and the rest of the vendor surface. Single and batch outbound calls (each confirmation-gated), importing a Twilio number, creating, listing and deleting webhooks and knowledge-base documents, deleting an agent (needs a typed
--yes), listing and reading conversations. The ElevenLabs and Twilio tool servers are wired in by.mcp.jsonwith credentials passed as flags and kept in the macOS Keychain. - The audit trail on the receptionist. Eight documents under
docs/eric/: the first findings (F1 to F9), the improvement plan in phases 0 to 4, a defect register with evidence, root cause and fix direction for each entry, the optimisation plan with its empirical unknowns and workstreams, the credit record, the prompt-doctor audit, the model comparison, and the realignment audit. - The receptionist's connection to the venue platform. It books tours, checks dates and prices, looks bookings up, sends booking information, requests callbacks and captures leads through eight functions of the venue's own system, on two channels: the venue's published phone line and the website chat.
- Agent prompts in use. The receptionist sits on a current-generation low-cost model with two fallback models; the agency's line shows callers the product it sells ("you are talking to one of the agents we build"); the outbound agent books free consultations by phone, falling back to permission to send information; the inbound agent answers for the testing company and emails leads through a worker.
What it achieved
- Calls handed to staff: 59.8% to 9.5%. Leads captured: 11.5% to 76.2%. After-hours transfers: zero.
- Measured on 857 recorded calls, 584 of them scored, with 191 robocalls removed first. A snapshot of 840 conversations held 706 phone, 132 website chat and 2 software-kit conversations.
- The receptionist moved to an AI model costing about a third as much per request (5.7 credits per request against 17.9), with equal or better behaviour on the phone, proven by the test suite before promotion. The plan's 100,000 credits now cover about 180 to 200 call-minutes instead of 105 to 130.
- A daily watch emails before the vendor allowance runs out, once per threshold in each billing period.
The problem it solves
- A voice agent on a business's public phone line is live infrastructure. A vendor's dashboard gives it no history, no review and no undo.
- The AI should do the technical work end to end, including checking its own changes. The platform's job is to make that safe.
- Left alone, an AI "improves" an agent in ways that defeat the business purpose: it sends callers back to the human office, or shortens the instructions. Every recommendation has to be tied to what the business is paying for.
- When agent after agent makes the same wrong assumption, the instructions are the cause, so the fix goes into the manual and not into one session. A blended lead-capture rate can hide a channel that captures nothing, so lead capture is measured by channel and every channel's figure prints on every run.
- A vendor's service cannot be taken at its word. This one silently ignores settings it does not accept (a branch parameter on tools returned an identical answer with or without it, and the tools' history paths returned not-found), so every fact about it is checked against the live service and written into the platform.
- A write that returns success is not proof: a direct write to a live agent can drop its tools and still report success. So every change goes through the staging copy and the refusal stubs, and every write is read back.
- A prompt can contradict the tools its agent holds, and the tool wins: an agent told it cannot end calls will still end them while it holds an end-call tool. So the affordance is removed, and the receptionist ends no call itself.
- The ElevenLabs dashboard shows credits used, which reads as a balance. He had spending measured to the credit (48% call minutes, 50% the language model, 2% the other agents), set a rule of no spending beyond the subscription, and built the watchdog.
- The test framework cannot fake the clock and cannot read query parameters; he established both by experiment and wrote them down, so no one trusted a result the framework could not produce.
- A model's "do not" instructions lose to the tools it holds and to its habits. The fixes are removing the affordance, naming the forbidden placeholder values (None, N/A, unknown@example.com) and rejecting them in the backend as well.
- Prompt length is not a latency lever. He researched the voice-agent benchmark suite and found its figures already assume a 12,000-token knowledge base, larger than the receptionist's roughly 4,000-token instructions, and wrote the measurement into the manual.
How he built it
Maxwell builds by directing AI agents. Claude Code did the work in this system under rules he wrote into the repository, and those rules are what make a live phone line safe to hand to an AI.
- JSON wins. Every agent, phone number, webhook, knowledge-base pointer and tool is a file under version control; the vendor's dashboards are read-only; any difference between the files and the live service is detected and a person is asked which side is right.
- Always validate. Every vendor answer is parsed against a schema before it is acted on; every commit clears
pnpm gate; failure means find the root cause, never retry in hope. - Fail closed. No empty catches; a failed fetch or parse is shown and stops the work, and the create-agent hook exits with a denial when a request does not parse.
- Tools in a fixed order. Vendor tool servers first, then the repository's scripts, then raw web requests, with the reason written down.
- Confirmation for real-world actions. Placing calls, cloning a voice, deleting anything and pushing to staging after a real difference each need a typed yes in the immediately preceding message.
- Staging first. AI cannot change a live agent directly; that script exists only to refuse. A change goes to a copy no caller reaches, the AI verifies it (a prompt-doctor audit read from the staging branch, a field-by-field difference against live, checks of tool wiring and workflow edges), and it goes live only on a typed yes. The rule's own text says the safeguard is thorough checking by the AI, which hands the operator recorded proof to judge instead of code to read.
- Snapshot, diff, verify, roll back. The sixteen shared tools have no staging copy at the vendor; the platform supplies what staging would have given: a tracked baseline, drift detection, a saved copy before every write, a reviewed field-level difference, a read-back proving the change landed, and a one-command undo. The manual says why it is written down this way: claiming a protection that does not exist is worse than having none, because it stops people looking.
- The engagement frame. Each client has a written frame stating what the business is paying for. For the venue, the human office line is the cost the engagement exists to reduce, not a place to send callers. Every proposed improvement must say which of four measures it moves (fewer transfers to staff, more leads captured, fewer dropped calls, more successful tool calls); anything that hands the caller back to the office is rejected, and the prompt-doctor copies the frame to the top of its report and rechecks its own findings against it.
- Ownership stated outright. The manual says the venue's backend is the agency's own code on the same machine, bans "blocked on the venue's backend operator" as a blocker, and tells the AI to read the route handler and fix the root cause.
- The two-channel block. Before proposing any receptionist change the AI must state which channels it holds on; "phone only" means it is not finished. It must not infer channel from the text-only flag, and it must report unknown for calls from before the vendor recorded the channel.
- Never shorten a prompt. A hard rule: no trimming, condensing, tightening or "reducing bloat" in any framing, because a prompt's job is to carry all the context and removing context makes the agent invent. No fix has removed anything from the receptionist's instructions, which run to 23,131 characters. The manual names the urge as the tell.
- The capability matrix. The manual lists what an agent might wrongly believe it cannot do (send email, place calls, analyse transcripts, tune turn-taking, add a tool, run Claude without a key, end a call, reassign a number) and how, so a new session does not give up on something the platform already does. It carries a table of every turn-taking and speech setting the vendor exposes and which one is the noise lever.
- Verified, not remembered. Any line in the manual that states a live setting says in its own text to re-check it with a command; the per-agent runtime table holds facts read from the live service.
- Pointer discipline. Plans are signposted from the manual in the same commit that adds them, so no plan goes unread.
- Who checks whom. Scoring runs as a separate headless Claude run, never inside the session that edits the agent; the analyst never rewrites; the prompt-doctor never rewrites; the staging copy is audited by a fresh prompt-doctor each round; the test suite decides promotion; the gate checks the AI at the end of every session.
- Secrets stay out. Keys live in the macOS Keychain and reach one child process through
with-secrets; they are never echoed, written or committed. - How the operator judges a change. He judges each change by the evidence the system produces, not by reading the files. He is asked one plain question ("Promote the staging version to live? Reply yes promote") with a table of results beside it, and the system emails him the credit warnings and the test logs.
Named concepts
The named concepts, defined
JSON wins · Staging first · The refusal stub · Snapshot, diff, verify, roll back · The engagement frame · Never shorten a prompt · The capability matrix · The two-channel block · Fail closed · voice-agent-builder · prompt-doctor · transcript-analyst · /improve
What it shows
He can give AI the whole job of building and running a live service for a business, and make it safe by design, with the results measured.