The guided tour

The whole system explained end to end for someone becoming an engineer: every term defined on first use, every component and how it connects, and an honest ledger of what is proven live versus still promised.

Open canonical source page · UNDERSTANDING.md
On this page

Understanding JARVIS

A guided tour of the whole system, written for someone who is smart, is not yet an engineer, and intends to become one.

The runtime foundation and measurements below were last verified on 2026-08-10. Phil changed the product target on 2026-08-12. Part 1 now explains that current target; Parts 2 onward explain the existing foundation it will reuse and do not claim JARVIS Home is live.


How to read this

This is long on purpose. It is meant to be read in order, over hours, not skimmed. It builds vocabulary as it goes: every technical term is defined the first time it appears, and later sections assume the earlier ones.

The substance is not simplified. A working engineer reading this would not find it dumbed down — they would find it unusually explicit about things most documentation leaves implicit, because those implicit things are exactly what separates someone who can follow a codebase from someone who cannot.

Three conventions:

  • Bold marks a term being defined for the first time.
  • Monospace marks something that exists literally in the system — a filename, a column, a command you could run.
  • Where a claim can be checked, I give you the command that checks it. A claim you can verify yourself is worth more than one you have to trust.

Part 1 — What this system is for

The current product is JARVIS Home: a private home screen and application library where source-linked personal data becomes persistent applications. A source-linked fact records where it came from and when it was observed, so a screen can distinguish current, stale, unavailable, and invented information.

The user can use and revise an application through one Ask JARVIS bar. The bar visibly selects exactly one destination:

  1. Ask JARVIS a normal question.
  2. Edit the entire current application.
  3. After semantic selection ships, edit one selected interface object.

Edits do not rewrite the live application. JARVIS gives the exact base version, source, tests, data contract, instruction, and ordered Application history to a new linked coding Task. Home presents those Tasks as one continuous application thread. The Task builds an isolated candidate—a proposed immutable version that is not live—then checks source/build identity, security, declared behavior, non-regression, and phone/desktop rendering. Critic evidence informs the user; it does not claim to decide subjective taste. The user can Preview, Keep, Discard, or Undo. Only Keep may change the live version; Discard leaves live unchanged.

The first release is intentionally narrow: migrate and adopt Gym Log, an application JARVIS already generated, then complete two sequential phone edits within 72 hours—one candidate Kept and one Discarded. Build Room then uses pre-existing Task, Attempt, event, and outcome records. JARVIS Results must reuse the same typed query with no new connector, storage type, or runtime primitive and open one real delivered artifact. That is the compounding test.

Restaurant browser automation and six-channel parity are preserved future work, not current release gates. GENERATIVE_APPLICATIONS_PLAN.md defines the exact GA0–GA6 build and fourteen-day decision deadline.

The existing conversation and Task architecture below still matters because it is the foundation for Ask JARVIS and the coding Task. It is not the current product boundary by itself.

The four things it can decide to do

Every incoming message produces exactly one Interaction Outcome — the system's decision about what kind of response this message deserves. There are four, and they are a closed set:

OutcomeMeaning
answer_nowI know the answer; here it is.
ask_clarifyingI cannot answer without one more fact from you.
use_capabilityThis needs me to do something in the world (book a table).
delegate_taskThis is a real piece of work; I'll assign an agent and report back.

Why exactly one? Because "one" is checkable. If the rule were "produce a helpful response," nothing could ever be tested — helpfulness is a judgment. If the rule is "produce exactly one of four named outcomes," then a message that produced two, or zero, is a bug you can detect automatically. This pattern — replace a judgment with a countable fact — recurs everywhere in this system and is worth watching for as you read.

You can see the contract in the code at src/immediate-outcome-contract.mjs. Note that the file only names two of the four outcomes:

const IMMEDIATE_BRANCHES = Object.freeze({
  answer_now:     { field: "reply",    kind: "reply" },
  ask_clarifying: { field: "question", kind: "question" },
});

That is not an omission. These two are the immediate outcomes — the ones that finish inside the same moment the message arrived. The other two (use_capability, delegate_task) start work that outlives the message, so they are handled elsewhere. The file is named immediate-outcome-contract precisely because it covers only the immediate half. Filenames in this codebase are load-bearing; when one seems to promise less than you expected, that is usually information.


Part 2 — The existing foundation, in one page

Before any detail, here is the current conversation and Task foundation. Every box is real; the Application API, application records, generated-app shell, and candidate verifier in architecture.md are target components, not yet live.

Existing conversation and Task foundation. The exact text source is available below.
Read exact diagram source
%% title Existing conversation and Task foundation
flowchart TB
    subgraph world["The outside world"]
        H["A person<br/>(Phil, Eleanor, …)"]
    end

    subgraph lanes["Channel lanes — one per way in"]
        IM["iMessage<br/>1:1 and group"]
        EM["Email"]
        WB["Web"]
        PH["Phone / SMS"]
    end

    subgraph core["The coordinator — one always-running process"]
        GW["Channel Gateway<br/>puts arrivals in order"]
        IN["Intake<br/>turns an arrival into a record"]
        FG["Foreground model<br/>chooses ONE outcome"]
        OB["Outbox<br/>gets the answer back out"]
    end

    subgraph work["Work that outlives the message"]
        CAP["Capabilities<br/>e.g. book a table"]
        TA["Task Agents<br/>Codex or Claude"]
    end

    ST[("Record Store<br/>SQLite · 62 tables · 197 triggers")]

    H --> IM & EM & WB & PH
    IM & EM & WB & PH --> GW --> IN --> FG
    FG -->|answer_now / ask_clarifying| OB
    FG -->|use_capability| CAP --> OB
    FG -->|delegate_task| TA --> OB
    OB --> H
    IN <--> ST
    FG <--> ST
    CAP <--> ST
    TA <--> ST
    OB <--> ST

Read it as a loop: a person speaks, the message is put in a queue, it becomes a permanent record, a model decides what kind of thing it is, work happens, and an answer comes back out the same way it came in.

The store touches everything. That is the real architecture. Almost nothing in this system passes data to the next stage by handing it over in memory; each stage writes to the database and the next stage reads it back. That looks inefficient and it is the reason the system survives being killed mid-thought.


Part 3 — The vocabulary

These terms recur constantly. Learn them once here.

Process. A running program. When you "start" software, the operating system loads the code into memory and runs it; that running copy is a process. Critically, a process holds a copy of the code as it was when the process started. Change the file on disk and the running process does not notice. This one fact causes more confusion than anything else in software, and it has its own rule later.

Record store. The database. Here it is SQLite — a database that lives in a single ordinary file on disk (records.sqlite) rather than running as its own server. Today it has 62 tables, 191 indexes and 197 triggers. You can verify:

sqlite3 "file:/Users/jarvis/.local/share/jarvis-mvp/prod/state/records.sqlite?mode=ro" "SELECT type, count(*) FROM sqlite_master GROUP BY type"

Table. A grid of data with named columns. people has one row per person; interactions has one row per message JARVIS reasoned about.

Row. One entry in a table — one person, one message, one task.

Schema. The definition of what tables and columns exist and what is allowed in them. Not the data; the shape of the data.

CHECK constraint. A rule written into the schema that the database itself enforces on every write. CHECK (state IN ('pending','sending','sent')) means no code anywhere, correct or buggy, can put any other value in that column. The write is rejected. This is the strongest kind of rule in the system and Part 7 is about why.

Trigger. A small piece of logic the database runs automatically whenever a row is inserted, changed or deleted. Like a CHECK constraint, it cannot be bypassed by application code. 197 of them is a lot, and it is a deliberate choice.

Migration. A script that changes the schema of an existing database without destroying the data in it. Because the live database has real history in it, you cannot simply delete and recreate it — you must transform it in place, in order. The current schema version is 55, meaning 54 such transformations have been applied in sequence.

Interaction. One complete "JARVIS thought about a message and decided something" event. The unit of reasoning.

Outbox. The queue of things JARVIS intends to say. Writing to the outbox is not the same as the message being delivered, and the difference is enforced.

Channel. One way in and out: imessage, email, web, phone, sms.

Lane. The running machinery for one channel. "The email lane" is the code and state that watches email and answers on email.

Coordinator. The single always-running process that owns all the lanes. When people say "is JARVIS up?", they mean "is the coordinator running?"

Harness. A third-party coding agent JARVIS can hand real work to. Two exist: Codex (OpenAI) and Claude (Anthropic). If one is unavailable, work moves to the other.

Release. An immutable, timestamped copy of the entire codebase at one exact commit, built for production to run from. Not a branch — a frozen directory.

Commit. A saved snapshot of the code in version control, identified by a hash like f2e7a8c. The unit of change.

Branch. A named line of development. main is the trunk.


Part 4 — The journey of one message, end to end

This is the spine of the system. Follow it once carefully and most of the rest follows.

Suppose you text JARVIS: "Book me a table at Roti for Friday at 7."

One message through Personal JARVIS. The exact text source is available below.
Read exact diagram source
%% title One message through Personal JARVIS
sequenceDiagram
    participant P as Phil (iMessage)
    participant M as Messages.app<br/>on the Mac
    participant W as Watch reader
    participant G as Channel Gateway
    participant I as Intake
    participant S as Record Store
    participant F as Foreground model
    participant C as Capability
    participant O as Outbox

    P->>M: "Book me a table at Roti…"
    M->>W: row lands in chat.db
    W->>G: arrival, with a position number
    G->>I: hand to intake, strictly in order
    I->>S: write the message durably
    I->>F: ask for exactly one outcome
    F->>S: record the outcome: use_capability
    F->>C: run the reservation capability
    C->>S: record each step as evidence
    C->>O: queue "Booked, confirmation #…"
    O->>M: send via Messages
    M->>P: the reply arrives

Step 1 — Arrival is not delivery

JARVIS does not receive iMessages directly. Apple does not offer a way to. Messages arrive at the Messages app on a physical Mac, which records them in its own SQLite database (chat.db). JARVIS reads that database.

This has a consequence you have already felt: latency. If the Mac's Messages app takes ten minutes to sync a message from Apple's servers, JARVIS cannot see the message for ten minutes, because for those ten minutes the message does not exist anywhere JARVIS can look. That is not a JARVIS bug and JARVIS cannot fix it from inside; it is a property of reading someone else's inbox.

Step 2 — The Channel Gateway puts arrivals in strict order

Every arrival on a channel gets a position — a number saying "this is the Nth thing that arrived on this channel." Positions must be dense and strictly increasing by one: 1, 2, 3, 4. Never 1, 2, 4.

Why so strict? Because the position is how the system knows what it has already handled. It stores a watch position meaning "I have processed everything up to N." If a gap appeared — if message 3 never got a number — then either the system waits forever for a message that will never come, or it skips it and silently loses a real person's request. Both are unacceptable, so the system refuses to create a gap in the first place.

The cost of that strictness is that a single unprocessable message blocks the lane behind it. This is called blocking the inbox head, and it is a real failure mode that has happened here: one oversized group attachment closed the iMessage, web, email and phone lanes at the same time, while the process stayed alive and looked healthy. That incident is recorded as item N-33 in the work list and the shape of it is not yet fixed.

This is a genuine engineering tradeoff, and it is worth sitting with: ordered-and-can-jam versus unordered-and-can-lose. This system chose ordered. Losing a real person's message silently was judged worse than stopping loudly.

Step 3 — Intake makes it permanent

Intake writes the message into the record store: who sent it, in which conversation, what it said, when. From this point the message survives a crash, a restart, a deploy, a power cut.

Intake also answers "who is this?" A Person is a known human with a name. A Handle is one way of reaching them — a phone number, an email address. One person has many handles. Eleanor is eleanor with the handle +1415…; that mapping is why JARVIS can greet her by name.

Someone who is not recognised is an unknown sender, and there is a separate, deliberately narrow path for enrolling them.

Step 4 — The foreground model chooses exactly one outcome

The foreground model is the AI model call that reads the message and decides which of the four Interaction Outcomes applies. It is called "foreground" because the person is waiting on it — as opposed to background work that runs for minutes.

Today it is gpt-5.4-mini. Whether that is the right choice is an open question tracked as N-61, deliberately framed as a measurement to run, not a swap to make — because the quality evidence gathered so far is a claim about this specific model, and changing it invalidates that evidence.

The model does not return free text. It returns a structured answer that must match a contract, and if it does not match, the interaction fails rather than guessing. That is requireImmediateOutcome in src/immediate-outcome-contract.mjs.

A limit you hit personally, now fixed. Until 2026-08-07 that same file enforced a flat 280-code-point ceiling on every reply:

if ([...text].length > 280) throw new TypeError(`${branch.field} is too long`);

280 is a voice number — a caller will not sit through a monologue. Every text lane inherited it and had nothing to protect with it, because the durable contract allows 16,384 and the transports accept 1,600 (SMS), 20,000 (iMessage) and 65,536 (email). It bound in practice: re-measured on 2026-08-06, a phone answer to someone who explicitly asked for a long reply came back at exactly 280 twice in three samples, once ending mid-word.

Budgets now come from ceilings the transports already enforce (src/reply-length-budget.mjs), applied inside the provider's structured-output schema where the model cannot exceed them rather than being caught after the fact. A channel added tomorrow defaults to the read budget instead of silently inheriting the voice one.

This is worth pausing on as an engineering pattern: the old check rejected bad output after generating it, so the user saw a failure. The new one makes bad output unrepresentable, so it never happens. Preferring "cannot happen" over "is detected" is the same instinct as putting rules in the schema (Part 7).

Step 5 — The answer goes out through the Outbox

JARVIS never sends directly from the code that decided what to say. It writes an Outbox Event — a row meaning "I intend to say this, to this conversation" — and a separate dispatcher picks it up and sends it.

Every Outbox Event moves through a state machine the schema enforces:

Durable Outbox event lifecycle. The exact text source is available below.
Read exact diagram source
%% title Durable Outbox event lifecycle
stateDiagram-v2
    [*] --> pending: intent recorded
    pending --> sending: a dispatcher claims it
    sending --> sent: provider returned a real receipt
    sending --> failed: provider refused
    sending --> delivery_unknown: we genuinely cannot tell
    sent --> [*]
    failed --> [*]
    delivery_unknown --> [*]

The interesting state is delivery_unknown. Most systems have "sent" and "failed." This one insists on a third state for we do not know, because pretending to know is how a system ends up telling a person something false.

sent has to be earned: the schema will not allow the sent state unless the row also carries a provider identifier and a receipt. You cannot mark something sent by simply saying it was.

There is a related subtlety worth understanding, because it shows the standard of evidence here. When JARVIS sends an iMessage, the message comes back to it a moment later — JARVIS is reading a Messages database that includes JARVIS's own outgoing messages. It must recognise its own echo. The correlation logic in src/sent-echo-support.mjs has exactly three ways to match an echo, and a comment explaining a fourth that was deliberately deleted:

There is deliberately no fourth branch matching on conversation and text. Those are properties of a class of messages, not of one message.

Matching on "same conversation, same words" would work almost always and would be wrong: send "On it." twice and you cannot tell the two apart. That comment is a good example of the standard the codebase holds itself to — almost always right is treated as wrong.


Part 5 — The parts, one at a time

381 modules under src/, 11 command-line programs under bin/, 7 checks under check/, and 296 test files. Grouped by what they are for:

PrefixCountWhat it is
task-*141The Task Agent lane — by far the biggest thing here
record-store-*29The database, its schema and its 54 migrations
twilio-*18Phone calls and SMS
channel-*17The gateway, cursors, inbox ordering
web-*16The website, sign-in, the Task page
opentable-*15Restaurant reservations
foreground-*12The model call that picks an outcome
capability-*11Doing things in the world
outbox-* / email-*9 eachGetting answers out; the email lane

That task-* is 141 modules — more than a third of the system — tells you where the difficulty actually is. Answering a question is comparatively easy. Handing real work to an autonomous agent, watching it, letting the person steer or stop it, surviving a restart in the middle, and proving what it actually did — that is where the engineering went.

The Task Agent lane, in detail

When JARVIS decides delegate_task, this is what happens:

Delegated Task Agent lane. The exact text source is available below.
Read exact diagram source
%% title Delegated Task Agent lane
flowchart TD
    D["delegate_task chosen"] --> A["Admission:<br/>record the goal and<br/>acceptance criteria"]
    A --> H{"Which Harness?"}
    H -->|Codex available| C1["Codex"]
    H -->|Codex out of credit| C2["Claude"]
    C1 & C2 --> R["Runtime worker:<br/>claim the attempt, run it"]
    R --> E["Provider events<br/>stream in and are recorded"]
    E --> Q{"Agent needs<br/>a decision?"}
    Q -->|yes| EL["Elicitation:<br/>ask the requester"]
    EL --> E
    Q -->|no| F["Finished"]
    F --> P["Publish result to<br/>Cloudflare Workers"]
    P --> V["Verify the URL<br/>actually serves"]
    V --> RC["Completion receipt<br/>back to the room"]

Every one of those stages is real and every one has failed at least once in a way that taught something.

Harness selection and failover. On 2026-08-06 Eleanor asked, in a group chat, for a website. Codex had no credit. The system moved the work to Claude without being told to, built the site, published it, verified it returned HTTP 200, and posted the result back to the group. That is the failover working unattended on a real user's request — and it is worth knowing that an earlier version of the selector silently always chose Codex because it was called without the outage information it needed. Its own evidence row proudly recorded available: true, pinned_runtime_assumed. A system can log confidently and be wrong.

Elicitation is the agent asking the requester a question mid-flight, and waiting. This is harder than it sounds, because the agent runs for minutes while the person is asleep.

Publishing goes to Cloudflare Workers — small programs that run on Cloudflare's servers worldwide. A finished website is deployed as one of these and gets a public URL.

Two failures here are instructive:

  1. A freshly published Worker returns 404 on the very first request, 100% of the time. Measured: 404 at 0ms, 500 at 1.2s, 200 at 3.5s. The verification step believed the 404 and reported failure for work that had succeeded. Fixed with a bounded wait.
  2. A release is built with npm ci --no-bin-links, which means the directory node_modules/.bin/ does not exist in it. The publisher pointed at node_modules/.bin/wrangler. In development that worked; in production the file was simply absent. A task with 354 events of completed work parked, and the person was told "could not verify deployment readiness" — a sentence that names the symptom and hides that a file is missing.

That second one is the single best example in this codebase of a lesson worth internalising: the environment you develop in is not the environment you ship to, and the differences are invisible until they are catastrophic.

Capabilities and reservations

A Capability is JARVIS doing something in the world rather than saying something. Reservations are the one that matters for the MVP.

There is a rule here called NEVER-BREAK 1: never book a restaurant other than the one that was asked for. It sounds obvious. It is the hardest rule in the system, because restaurant names are ambiguous, accented, duplicated across cities, and rendered differently on every page.

A second rule (D42): if the page's time-slot container is missing, that is a hard error, never an inference of "no availability." The difference matters enormously — "there are no tables" and "I could not find where the tables are listed" look identical to a user and mean opposite things.

A third (D43): every page selector ships with the dated screenshot that proved it worked. Web pages change; a selector with no evidence is a guess.

One live proof exists: a real booking at Roti Indian Bistro, confirmation 2109951926, subsequently cancelled, verified by OpenTable's own page. That is what "live proof" means in this project — not a passing test.

There is substantial unmerged work on the double-booking guard (lane/reservation-guard-final, 7 commits), triaged as NEEDS_WORK.


Part 6 — How a message gets back out to each channel

Channel parity is a rule: a capability is not done when it works in one lane. It must reach every lane a person can invoke it from, and the worker for that lane must know the capability exists, so it never falsely denies something it can actually do.

Outbound channel dispatch and receipts. The exact text source is available below.
Read exact diagram source
%% title Outbound channel dispatch and receipts
flowchart LR
    OB["Outbox Event<br/>(pending)"] --> DIS["Dispatcher claims it<br/>(sending)"]
    DIS --> IM2["iMessage:<br/>AppleScript to Messages.app"]
    DIS --> EM2["Email: SMTP"]
    DIS --> WB2["Web: stream to<br/>an open browser"]
    DIS --> TW["Phone/SMS: Twilio"]
    IM2 & EM2 & WB2 & TW --> RCPT{"Real receipt<br/>returned?"}
    RCPT -->|yes| SENT["sent"]
    RCPT -->|no, refused| FAIL["failed"]
    RCPT -->|cannot tell| UNK["delivery_unknown"]

The iMessage lane is the awkward one. Sending happens by driving the Messages app through AppleScript — Apple's automation language for controlling Mac applications. This requires an operating-system permission called Automation, granted per-application. It is why a message can fail with error -1743: "Not authorized to send Apple events to Messages."

There is a live consequence right now. The coordinator holds that permission and sends normally. An agent shell does not, so bin/notify-phil.mjs can send Phil email but never text. It reports this honestly (text: false, non-zero exit) rather than looking successful. Tracked as N-64; the fix is to route the text through the coordinator that already has the grant, not to widen a permission.

Attachments need a different permission — Full Disk Access — because writing to ~/Library/Messages/Attachments is a filesystem operation, not an automation one. Two different permissions, two different error codes (NSCocoaErrorDomain 513 and -1743), commonly confused.


Part 7 — Where the rules live, and why it matters

This is the most important engineering idea in the system, and the one most worth your time.

The same rule can be enforced in three places, and they are not equally strong.

Relative strength of rule enforcement. The exact text source is available below.
Read exact diagram source
%% title Relative strength of rule enforcement
flowchart TB
    T["A test<br/>'we checked this once'"] --> W["WEAKEST"]
    C["A JavaScript guard<br/>'this code path checks'"] --> M["MIDDLE"]
    S["A schema CHECK or trigger<br/>'the database refuses'"] --> ST["STRONGEST"]

A test proves the rule held for the cases the test thought of, at the moment it ran. New code that never runs that path is unconstrained by it.

A JavaScript guard — an if statement that throws — protects every caller that goes through that function. A new code path that writes to the database directly bypasses it entirely.

A schema constraint cannot be bypassed by any code, correct or buggy, present or future. The database rejects the write.

This is why 197 triggers is a design statement rather than clutter. Consider the outbox rule again:

CHECK (
  (state = 'pending' AND attempts = 0 AND provider_id IS NULL AND receipt_json IS NULL)
  OR
  (state = 'sent' AND attempts > 0 AND provider_id IS NOT NULL AND receipt_json IS NOT NULL)
  ...
)

"You may not claim a message was sent unless you are also holding a receipt" is not a convention here. It is arithmetic the database performs on every write.

The counter-lesson: a schema rule can be wrong too

Strength is not correctness. Every provider-evidence table once carried CHECK (provider = 'codex'). When Claude became a second Harness, a Claude attempt's first evidence row was refused by the database. Worse, the rule turned out to be inverted — a Claude-bound attempt could only write an event naming Codex.

For days, production's entire account of why tasks died was one code: task_runtime_setup_or_lifecycle_failed, which names the stage and says nothing about the cause. The real cause — a one-line schema fact — was being thrown away at the moment it was raised, by a catch {} that discarded the error.

Both halves are now fixed, and the fix is instructive. The reason code stayed as it was, because it is a closed vocabulary the store constrains. The cause now goes to the service log through a sink, and the code that builds that log line is careful in a way worth reading:

function reportSetupFailure(sink, claim, error) {
  try {
    sink(Object.freeze({ causes: describeCauseChain(error), ... }));
  } catch { /* logging must never outrank the failure being logged */ }
}

The detail object is built inside the try. An earlier version built it as an argument at the call site — outside the guard — so describing the error could itself throw and skip the settle. A reviewer proved it with throw Object.create(null): the task was left stuck, and the whole lane's intake closed while the process stayed up looking healthy.

Error handling that can itself fail is a real category of bug, and it is nearly invisible until someone attacks it deliberately.

Migrations, and an irreversible near-miss

Because the schema is this load-bearing, changing it is dangerous. Each change is a numbered migration; the store is at version 54.

On 2026-08-06 two parallel branches each independently created a file named record-store-v52-migration.mjs with different contents. The live store had already run trunk's version 52. If the other branch had merged, the store would have stamped itself "v53" while permanently missing three guards a fresh v53 store has — including one that forces a first-prompt dispatch to be born pending. The migrator returns early once the version matches, so no later run would ever repair it.

Production was not damaged, because the colliding branches were never merged. But nothing would have stopped it. Two things now do:

  • test/record-store-migration-chain.test.mjs asserts the chain is contiguous and that some runner applies every migration that exists.
  • check/migration-sweep.mjs migrates every historical backup plus a live copy and asserts each lands schema-identical to a fresh store.

The sweep has been proven to actually fail on real divergence — deleting one guard made it name the missing trigger on all 15 stores at v53, while the 16th already at v53 passed. That contrast is the proof it works. A check that has never been seen to fail is not yet known to work.


Part 8 — Code, markdown, and tests: what each is for

You asked how these relate. They are three different kinds of claim.

Code (src/, bin/) is what actually runs. It is the only one of the three that can be wrong in a way that hurts a person directly.

Tests (test/, 296 files) are executable claims about the code. A test that passes proves that specific situation behaves as expected. It does not prove the feature works for a real person — a distinction this project is emphatic about.

Markdown (the .md files) is human intent: what we decided, why, and what counts as done. Markdown cannot be wrong in a way that breaks anything at runtime, which is exactly why it goes stale — nothing forces it to stay true. This document is markdown, so treat its age as a real caveat.

Three of these files are unusual enough to call out:

  • TODO.md is the only work list, and there is a check that enforces this (node check/one-list.mjs). The old system's defining pathology was work scattered across hundreds of places.
  • DECISIONS.md records decisions by number (D42, D179, D189). When code comments cite D43, this is where that lives.
  • INTRO_SCRIPT.md is the ~400-word script every new user hears, and it is treated as the actual requirements document — because it is the only document stating what a real human was promised.

The 300-line rule

No authored executable file may exceed 300 significant lines. node check/size.mjs enforces it; the largest file today sits at exactly 300.

This is not about aesthetics. A file you can read in one sitting is a file whose bugs you can see. The old system's 254,000 lines were mostly unreadable and therefore mostly unmaintained.

The gate

Before anything merges, five things must pass:

npm run test:root && npm run test:phase-b && node check/one-list.mjs && node check/size.mjs && git diff --check

Today: 826 root tests, 656 phase-b tests, all passing.

One caveat, because a green number should not be trusted more than it has earned: on 2026-08-08 the root suite reported one failure that could not be identified and then passed twice. So the suite is not fully deterministic. A flake is a defect in its own right — it hides real failures, because the next genuine break in that test reads as "the flaky one again." Tracked as N-67, and deliberately not closed by re-running until green.

check/deployed.mjs is deliberately not in that gate, because its inputs are machine state rather than the code being reviewed. It answers a different question, and it is the subject of the next part.


Part 9 — Getting to production without lying about it

Three rules govern this, each learned the hard way.

"Merged is not deployed"

A running process holds the code it had at startup. Merging a fix changes a file on disk; the running process does not care. This mistake was made three times in one week here, and Phil caught all three.

check/deployed.mjs now refuses to let "live" be claimed unless the serving release equals HEAD:

node check/deployed.mjs
# deployed: ok — serving f2e7a8c…, equal to HEAD

Production runs from its own checkout

Production never runs from a directory anyone develops in. The old system violated this — its live iMessage bridge read code from the same checkout agents switched branches in, meaning changing branches could change production.

Here, each release is an immutable directory:

~/.local/share/jarvis-mvp/releases/<40-character-commit-hash>/

built by bin/create-task-runtime-release.mjs, which clones the repository at one exact commit, verifies the commit did not move, and installs dependencies with npm ci --no-bin-links. The macOS service (launchd, the thing that keeps programs running) points at one such directory.

Deploying is not free

Restarting the coordinator kills whatever is in flight. This has destroyed two of Phil's tasks. So the sequence is: check for running attempts, back up the record store, verify the backup matches, cut the release, repoint the service, restart, then verify with check/deployed.mjs.

One practical wrinkle: the restart races itself. launchctl bootout returns before the old process has finished exiting, and the immediate bootstrap fails with Bootstrap failed: 5: Input/output error. Retrying after a few seconds succeeds. Between those two, production is down — about 25 seconds.

And one worse thing, learned by doing it on 2026-08-10. A deploy left the coordinator refusing to start three times and the site serving 502 for about six minutes. The message was "Twilio voice route does not identify this immutable endpoint": the coordinator will not serve unless Twilio's configured voice webhook is exactly the endpoint this release answers at, and Twilio had drifted to a different host.

The interlock is right and stays — it is what stops the clean lane claiming a phone number it does not actually answer, and the status callback had NOT drifted, so the two halves of the route disagreed with each other, which is precisely the state it exists to catch.

What is wrong is that nothing owns the drift. The route was correct while the previous release ran and wrong minutes later with no deploy touching it, and the old system's com.jarvis.phone-watchdog is still loaded and running. Two systems are quietly contesting one phone number. The fix is deliberately NOT to re-point Twilio from the deploy script: that would make JARVIS win a fight nobody has diagnosed, and if the old watchdog re-points the number back mid-call, the failure lands on a real caller.


Part 10 — What is actually true today

The honest ledger, as of 2026-08-10.

Proven live, with evidence

ThingThe evidence
A reservation completed THROUGH the product pathA message chose use_capability, resolved the venue by street address, held for confirmation, took a yes, and booked a real table — Roti Indian Bistro, confirmation 2109952049. Cancelled immediately. Before this, capability_runs held exactly one row and it was not a reservation: the earlier booking was proven beside the product, not through it
Open-ended booking, no interrogation"Book me an italian dinner for 2 any time after 6pm any day next week" produces a Run with no clarifying question. A request omitting party size draws exactly one question — for the party size
Reservations on iMessage, 1:1 and groupPhil's own two texts both reached use_capability; channel parity for reservations, live
The double-booking guard under real concurrencyTwo Runs live against the same restaurant and time produced exactly one reservation
iMessage delivery is provable6 rows moved unknown → sent; 50 foreign echoes correctly refused
Group silence works2 unaddressed group messages → 0 interactions, 0 outbox events
The intro video in a group"Jarvis, meet the room." → "Hello, room." + the video; the first intro_greeting: row that has ever existed
A group Task, end to endEleanor's request → Codex out of credit → failed over to Claude → built → published → HTTP 200 → receipt to the room
Quality vs. the old system253–141–77 across 471 turns, p = 1.8 × 10⁻⁸
Replies no longer cut off mid-wordper-lane budgets enforced in the model's output schema, 736 + 582 tests green

Known broken or unfinished

  • N-33 — a lane failure can leave a live process that answers nobody and never restarts. Proved on real deployed bytes.
  • N-63 — Task completions arrive as one text blob with two URLs, so iMessage renders no link preview. Needs a second outbox message per completion with its own replay semantics.
  • N-64 — every milestone notification is email-only; the text leg has never worked from an agent shell.
  • N-37 — the intro video is proven on demand, but not proven arriving unprompted in a brand-new conversation, nor proven to send only once.
  • N-60 — the statistical gate for A/B judging is broken in both directions.
  • iMessage sync latency — 10+ minutes before JARVIS can see a message.
  • Twilio A2P — SMS registration still in review.

Unmerged work that was triaged tonight

25 branches were examined. Six were judged to contain real unlanded value. One of those, fix-the-three-named-losses, was then adversarially verified — an independent reviewer tried to refute all three of its claims and could not — and is now merged and live. It carried the truncation fix above, a Task acknowledgement that tells you JARVIS will message you when it finishes rather than only handing you a link, and a rule stopping JARVIS re-asking a choice you already delegated ("any steak house") — measured 8/9 before, 0/14 after.

The other five have since been verified adversarially, one skeptic each, told to refute rather than confirm. Not one was a clean merge, and triage had rated every one of them "land it." That gap between a confident first read and a hostile second read is the single most useful thing in this section.

Two landed, and only after the defects the review found were fixed:

  • test-the-real-boundary — a command that meets real external boundaries instead of stand-ins. It is deliberately not in npm run check, and must not be: it launches a visible browser and writes a probe file under ~/Library/Messages/Attachments. Exit 0 alone is not a pass — a "not configured" tail means inconclusive.
  • synthetic-test-user — a way to make JARVIS answer a real message without spending one of Phil's turns. Merging it is inert: it adds nothing to any identity seed, so no deployment has the probe until someone seeds it deliberately.

Three were refused, and their reasons are worth reading as examples of how a plausible change hides a real one:

  • ab-as-a-defect-finder (N-65) exports the 280 constant this work removed and uses it as a truncation detector. Both conflict resolutions are broken: take its side and a long reply the provider schema explicitly allowed then throws and the turn fails outright — worse than truncation. Take the trunk's side and three modules import an export that no longer exists, proven to die at load time.
  • shutdown-grace-honest (N-68) silently widens replacement eligibility. The trunk creates a successor only when a Task is active; the branch also admits awaiting_user, so a Task the trunk would end now resumes work. A new live execution path that none of its three new tests names.
  • carry-the-real-cause (N-69) unbounds something the trunk deliberately bounds. Today there is at most one blocked-event per (task, attempt, state, code). The branch adds the cause to that key — and its causes interpolate byte counts, hashes and raw socket errors. One stuck Task could then write unboundedly many events.

Two of these — the widened eligibility and the unbounded key — are changes the branches' own descriptions never mentioned. The most dangerous diff is not the one that is wrong; it is the one that does something true and also something unmentioned.


Part 11 — The decisions that shaped this, and why

The Build Test

Before writing any line of code: if I deleted this and used the best existing tool instead, what would a user notice? If the answer is "nothing," reuse.

This is why JARVIS uses Codex and Claude as Harnesses rather than building an agent runtime, uses Cloudflare for hosting, uses SQLite rather than a database server, and uses OpenTable rather than talking to restaurants.

The algorithm, in order

  1. Make requirements less dumb — challenge each one by the name of the person who set it.
  2. Delete. If you are not adding back at least 10%, you did not delete enough.
  3. Simplify — only after deleting.
  4. Accelerate cycle time.
  5. Automate last.

Step 2 is the one the old system always skipped, and the ordering is the whole point: simplifying something that should not exist is wasted work.

You saw this operate tonight. I had built a Task-visibility fix with two separate permission scopes — one for reading, one for steering. Your rule ("anyone in the group can edit a task started in that group") collapsed them into one query and I deleted the rest. The requirement change made the code smaller.

Live proof or it did not happen

A passing test is not proof a feature works. A README is not proof. Proof is a real message delivered, a real booking confirmed, a real log line from a real run.

Nothing is ever lost

Archive before deleting, verify the archive, then delete. Tonight's worktree cleanup went 158 → 60 worktrees and 164 → 63 branches, but only after a 34 MB bundle containing 328 refs was written and verified as recording a complete history, and 14 uncommitted diffs were saved as patches that were each checked to parse.

One caution on honesty

The intro video promises nightly self-improvement, and as vision that is fine. But JARVIS in a live conversation must never claim it already fixed something overnight. A pitch may aspire; a live claim must be true.

The self-improvement loop therefore ships as detection only — it finds JARVIS's own misses and queues them on one list. It never merges its own code.


Where to go next

Read in this order:

  1. INTRO_SCRIPT.md — the ~400 words that are the real requirements
  2. TODO.md — the only work list
  3. DECISIONS.md — every D-number cited in code comments
  4. architecture.md — the formal C4 diagrams
  5. DURABILITY.md — which parts survive a much more capable model

And one habit worth more than any of them: when this document and the code disagree, the code is right. Markdown cannot be wrong at runtime, which is precisely why it drifts. Check the claim, then fix the document.