Write in Yellow · Fitz Worldbuilder · Ada on DeepSeek V4.1 Flash · 22 to 23 October 2026

Worldbuilder Revision Repair

A request to revise a full eighteen-beat outline came back with nothing at all. This is the record of finding out why, and of the five other problems that appeared once the first was out of the way. Eleven local commits on worldbuilding-agent, four live reruns of the failing request, and one end-to-end pass on the final build.

32,768output tokens for Ada in Worldbuilding, doubled from 16,384
83–87%of each revision's output was hidden reasoning
3 of 4reruns needed more than the old 16,384 ceiling
1 of 4reruns produced a card on the build that served it: the last one
11commits, 18 files, 972 lines added
1,899focused tests passing, in overlapping suites

The failure

The test story is a scratch novel built with Fitz in Worldbuilding mode: six saved wiki articles, two recorded decisions, and a working plan of six chapters and eighteen planned beats tied to four named promise threads. Fitz had already produced the complete outline in one reply. The writer then asked for three targeted improvements to that outline, keeping every chapter title, day range and beat, with beat bodies allowed to grow to 350 characters.

The reply showed nothing. The app reported the empty result honestly, and the usage log held one row:

// .wwp/usage-log.jsonl, 2026-10-22T21:19:03Z (abridged)
{"servedModel":"deepseek/deepseek-v4.1-flash-1017","thinkingEffort":"medium",
 "inputTokens":22721,"outputTokens":16384,"apiCalls":1,"historyMessages":2,
 "toolReads":0,"promptChars":61341}

What the writer saw

Ada finished without a visible reply or proposal card. Please try asking for one part at a time.

The empty-result guard from the previous repair. Accurate, but it could not say why.

What the row could not tell us. Output equalled the ceiling exactly, which pointed to a cut-off. But nothing recorded why the call ended, how much was reasoning and how much visible text, or whether the visible text existed and failed to parse. The model, OpenRouter, the reasoning share and the app's own parsing were all still possible causes.

Where the tokens went

The project owner asked for the allowance to be doubled first. With 32,768 tokens available and the new per-call diagnostics recording each call's finish reason and reasoning share, the same request was replayed four times. Every rerun finished normally (finish_reason: stop). Three needed more than the old ceiling. In each, most of the output was reasoning the writer never sees.

Output tokens per call, reasoning and visible Horizontal bars on one scale from 0 to 34,000 tokens. The original failure used exactly 16,384 with an unknown split. Run 1 used 18,328 (15,526 reasoning), run 2 14,087 (11,673), run 3 16,484 (13,833), run 4 17,507 (15,192), and the one-beat edit 3,381 (1,123). Lines mark the old ceiling at 16,384 and the new allowance at 32,768. old ceiling 16,384 allowance now 32,768 Original failure 16,384 · split not recorded Run 1 18,328 · 85% reasoning Run 2 14,087 · 83% Run 3 16,484 · 84% Run 4 (pass) 17,507 · 87% One-beat edit 3,381 · 33% 0 8k 16k 24k 32k
reasoning (provider's own count) visible reply not recorded old ceiling current allowance
One API call per row; no tool reads in any of them. Reasoning tokens come from the provider's completion_tokens_details.reasoning_tokens; visible is the remainder. The visible part of each revision was about 2,300 to 2,800 tokens: the outline itself is small. The original failure's split was never captured, so its bar is hatched. The reruns make a length cut-off the likely cause, but do not prove it.

Ada never sent a reasoning setting. The thinkingEffort: "medium" in every usage row is the app's own setting. The only reasoning control in the provider code is gated to the MiMo gateway, and Ada's identity is not the gateway, so OpenRouter has been running DeepSeek at its default reasoning depth, uncapped, sharing the output allowance. OpenRouter lists reasoning, reasoning_effort, response_format and structured_outputs for this model. None is used yet; see Still open.

Four reruns

Each rerun used a fresh clone of the test vault at the commit just before the original failure, so the conversation held the same two history messages. A disposable server ran on its own bundle and port, driven through the app's HTTP API and WebSocket rather than the browser. The writer's live vault and the service on port 18083 were not touched during the reruns. Each run that failed exposed a new defect, which was fixed before the next.

  1. A good revision in the wrong envelope. The outline was revised correctly, but Ada wrapped the card in the read-only history-snapshot format it saw on its own previous turn, comment markers and label included. The app recognises offers only in the live offers block, so no card appeared and the writer would have seen 13,193 characters of raw JSON. Fixed in 8a55a296.
  2. Broken JSON, silently discarded. This time Ada used the right block, but its 9,114-character payload did not parse. The app stripped it, staged nothing, and saved the turn as a success whose prose said Everything you asked is revised in place and nothing else moved. The next turn's history would have told Fitz it had offered a card it never delivered. The payload and its parse error were gone. Fixed in 175cc490.
  3. The wrapper again, as v2. Ada copied the history wrapper a second time but wrote its version marker as v2, which the exact-marker match from run 1 missed. Offline, the outline also showed drift the writer could only find by hand: two beat titles renamed and thread links changed on five beats, despite the reply saying everything was preserved. Fixed in ec3e3ff4 and 6e5a4bc5.
  4. One live outline card. The revision arrived as a card with a 545-character summary. A follow-up asking to change only beat 9 returned one card in which only beat 9's body differed (3,381 tokens, 22 s). Details in Checking run 4.
RunBuildOutputReasoningReply charsShown charsCardsOutcome
Original1f0dcd9416,384not recordednot recorded00empty
1eacf615718,32815,52613,19313,1930copied wrapper
28a55a29614,08711,6739,5294150unreadable JSON
3175cc49016,48413,83314,02414,0240wrapper v2
4ec3e3ff417,50715,1928,9745451pass
4, editec3e3ff43,3811,1238,7163161pass

Reply chars: what the model streamed. Shown chars: what was left once offers were split off. All figures from the usage rows' new diagnostics.

Run 1, after the fix. Run 1's real reply was put through the repaired extraction offline. It became one valid outline card: three acts, six chapters, eighteen beats, longest body 323 characters. Its structure matched the original offer except for one added thread link. That is good evidence the fix works on real output, but it is not the same as a live pass, and is not counted as one.

Reply to card

Most of this work happens between the model's reply and the card the writer accepts or dismisses. The order matters: each step sees only what the step before it left. The steps marked new were added in this work.

  1. The provider streams the reply

    Visible text reaches the writer as it arrives; an offers block is held back once it starts. Now also recorded per call: finish reason, visible and reasoning size, tool-call count.new

  2. A copied history wrapper becomes an offer

    If a fresh reply contains the read-only snapshot wrapper, in any version, its JSON is moved into the live offers block. Saved history never takes this path, so a restored snapshot stays display-only.new

  3. Offers are found and stripped

    The tagged block wins, then a trailing mis-tagged block, then a bare trailing array. Every candidate leaves the prose, so the writer never sees wire format.

  4. The payload is read

    Whole JSON first, then a salvage of complete objects from a cut-off array. If nothing can be read, the payload and its parse error are now kept in .wwp/unreadable-offers.jsonl and noted in the usage row.new

  5. Each offer is validated

    The same validators as before, with the same outline caps (400 characters a beat body, 400 beats). Nothing here changed.

  6. Notes are attached

    Pad destinations are checked as before. An outline that revises an earlier one in the conversation now gets a note naming renamed beats, changed thread links and count changes.new

  7. The saved turn is made honest

    If an offer was attempted and none survived, the app appends its own status line to the reply, whatever the prose claims. The same text goes to the screen, the chat file and the next turn's history.new

  8. The writer decides

    Add or Dismiss, exactly as before. Nothing in this work writes to the story or accepts anything on the writer's behalf.

The repairs

Doubled allowance 9208da47

Problem
16,384 tokens, shared between hidden reasoning and the reply, was not enough for a full-outline revision.
Change
Ada in Worldbuilding now requests 32,768. The request budget still reserves the full allowance against the context window. Other providers and modes are unchanged. OpenRouter lists 393,216 maximum completion tokens for this model.
Where
src/main/core/chatSession.ts (ADA_WORLDBUILDING_MAX_TOKENS)
Tests
The allowance table and the learned-window test now use 32,768; the window in that test was widened to 60,000 so history still has to be evicted.

Per-call diagnostics eacf6157

Problem
A usage row summed the turn and kept no finish reason, so an empty reply could not be explained.
Change

Each usage chunk now lists every API call in order: finish reason, visible characters, tool calls, reasoning characters (counted from the stream, never kept) and the provider's output and reasoning tokens. A stalled stream is listed too, with a null finish reason. The usage row adds how much of the raw reply survived as prose, how many cards survived and how many offer warnings there were.

An empty Ada reply whose last call ended on length now names the allowance it used up.

Where
modelProvider.ts (ProviderCallDiagnostic), mimoProvider.ts (streamed, non-streamed and no-tools paths), chatSession.ts (TurnUsageRecord)
Tests
Reasoning-only length cut-off with the reasoning text absent from every chunk; a stalled stream, its non-streamed redo and a final round in order; the no-tools path; the new error and the log fields.
// run 4's usage row, the new fields
"calls":[{"finishReason":"stop","contentChars":8974,"toolCalls":0,
  "reasoningChars":63993,"outputTokens":17507,"reasoningTokens":15192}],
"replyChars":8974,"visibleChars":545,"proposals":1,"proposalWarnings":0,
"unreadableOffer":null

A copied history wrapper becomes the offer 8a55a296 · ec3e3ff4

Problem
Completed offers are kept in saved turns as a read-only snapshot, so Fitz can revise its own draft exactly. In two of four runs Ada imitated that snapshot instead of using the live offers block, once with an invented v2 marker.
Change

A fresh reply containing the wrapper, whatever its version and even if cut off before it closes, has the wrapper replaced by the live offers block before extraction. Its payload then meets the same validation and the writer's own Add and Dismiss. This only runs on the reply being completed; saved history never comes through it.

The offer instructions now say that a snapshot at the end of an earlier reply is app-added and must not be copied. The snapshot's own label was left unchanged, because older saved chats are recognised by that exact text.

Where
chatProposals.ts (adoptModelProposalHistory), chatSession.ts (all three reply-reading sites), contextAssembler.ts
Tests
The app's exact wrapper, a hand-written one without label or escaping, a cut-off one, one whose fence closed but whose close marker was cut, a v2 marker, an unrelated reply left byte-identical, and a session test that the saved answer ends with exactly one app-written snapshot. The pinned guarantee that extraction alone never turns a saved snapshot into cards still holds.

Unreadable offers are kept and named 175cc490

Problem
When an offer's JSON did not parse, the app discarded it and saved the prose, which could claim success. The diagnosis was lost with it.
Change

The unreadable payload and JSON.parse's message go to .wwp/unreadable-offers.jsonl in the writer's own vault, capped at 200,000 characters, and the usage row records its size and error. A Worldbuilding reply whose offer was lost gets an app status line based on that evidence, not on how the prose is phrased. An empty reply whose only content was an unreadable card gets its own error.

Where
chatProposals.ts (unreadableOffer), harness/worldbuildingCaptureStatus.ts, chatSession.ts, ipc.ts
Tests
Run 2's exact prose over a malformed block; the payload and error recorded; the status in both the shown reply and the saved file; the empty-reply error; a readable offer leaves no record. The payload reader's own pinned shape is unchanged.

Ada

Everything you asked is revised in place and nothing else moved …

App status: This reply tried to offer a card, but the offer could not be read, so no proposal card is available to accept.

an offer in that reply could not be read — nothing was offered

Run 2's reply as the writer would now see it, and as the chat file and the next turn's history now record it.

Error, empty reply

Ada wrote a proposal card that could not be read, so nothing was offered. Please try asking for one part at a time.

Ada used its whole 32,768-token reply allowance without a visible reply or proposal card. Please try asking for one part at a time.

The two new, more specific errors. The original message remains for any other empty reply. None of them retries a paid request.

A note when a revision changes the structure 6e5a4bc5 · 086220a9

Problem
Run 3 renamed two beats and moved promise links on five while saying it had preserved them. Context retention cannot catch that; only comparison can.
Change
When an outline offer follows an earlier one for the same book in the conversation (or one naming no book on either side), the app compares them by position: act names, chapter titles and count, beat count, beat titles, thread names and each beat's links. Bodies are not compared, since a revision exists to change them. The differences appear as a note under the card. It judges nothing and blocks nothing.
Where
src/main/core/outlineRevision.ts (new), chatSession.ts, shared/chatProposalHistory.ts (proposalHistoryPayload)
Tests
Body-only change stays silent; renames and link changes by beat number; act, chapter and count changes and a lost thread name; a session test reading the earlier snapshot from history.

Note under run 3's card, computed offline from the real outlines

Compared with the outline offered earlier in this conversation: beat 9 renamed (“…” → “…”); beat 12 renamed (“…” → “…”); thread links changed on beats 7, 8, 12 and 14. Check these were intended before adding it.

Story titles are elided on this page. For run 1 the same check reported only “thread links changed on beat 5”, matching the hand comparison. The note was not live in run 4, which was served by the build before it.

Futile filing loops stop after three rounds 5b7e8311

Problem
Filing calls (propose_*, withdraw_card) always run, because their result depends on the cards staged so far. A model re-offering a card the validator kept refusing had spent 13 to 22 paid requests in one reply.
Change
After three consecutive rounds in which every executed call was a refused filing call (Not staged: … or arguments the schema rejected), the next round is the final answer, with a note telling Fitz to explain in plain words what it meant to offer and why it could not be staged. A staged card or any read resets the count, so a corrected call always gets through.
Where
mimoProvider.ts (FILING_STALL_ROUNDS, FILING_STALL_NOTE, and the module's guard documentation)
Tests
Three refused rounds force a fourth whose call never runs; a staged card and a read each reset the count across eight rounds.

Recorded decisions count as a quote source e7cf55ed

Problem
Every prompt carries the recorded decisions in force, but the quote check searched only the wiki and chapters. A fresh continuity answer quoted a decision correctly and was flagged as Not found in the book.
Change
The quote corpus now includes the decisions still in force, exactly as the prompt carries them, labelled Recorded decisions (plot/decisions.md). A replaced decision is not a source, invented text is still flagged, and wiki filters are unchanged. The verify_quote tool shares the corpus, so it gains the same source.
Where
chatTools.ts (quoteCorpus)
Tests
An active decision quote passes; the same quote without decisions is flagged; a struck decision and an invented line are flagged; verify_quote names the decision source. Checked separately against the real decision file and the real saved answer: the flagged quote now matches verbatim.

Checking run 4

Both of run 4's cards were compared mechanically with the original offer, then read against the saved choices. Story content is summarised here, not quoted.

Structure, compared by script

CheckRevisionOne-beat edit
Acts (3)samesame
Chapter titles and day ranges (6)samesame
Beat titles (18)samesame
Thread names (4)samesame
Thread links1 added none removedsame
Beat bodies changedall 18beat 9 only
Longest body337 / 350337 / 350

Rewriting every body was broader than the targeted revision asked for. The structure held; the scope did not.

Saved choices, read by hand

  • keptThe one-use item is spent once, at the end, on the purpose the decision allows; the alternative use is offered, declined and never taken.
  • keptThe signatory count is exact: the fixed number of living designers plus the protagonist's additional one, not a substitute.
  • keptThe fixed deadline cannot be paused or cheated by local time effects.
  • keptA parent's abandonment stays that parent's responsibility, never framed as punishment.
  • keptOthers' lived history, memories and choices stay intact.
  • keptThe secondary decision's mechanism (compartmentalised briefs, evidence found by connecting documents) is used, not replaced.

Requested improvements

  • doneEach designer's consent shown; the protagonist's unasked change causes the disaster; the full rescue happens; a companion makes a corrective contribution; a correction leaves a real, finite cost.
  • doneA specific discovery about the parent's own choices fills the emotional middle, and the final sacrifice is freely chosen.
  • doneThe final hearing shows rescued people, observable harm reduction and their informed refusal of demolition; the credited exception stays a qualification.

Fresh-chat continuity check

On a clone of the accepted plan, a new conversation asked which promises had been paid in prose, whether a forbidden sequence fitted the current choice, and what the signatory plan was. All three answers were correct. The context summary showed six entries, eighteen beats and four threads, and no false quote warning fired. That answer quoted no decision text, so the quote repair was confirmed separately against the real files.

What the evidence covers

ClaimEvidenceLimit
A full-outline revision can finish and stage a cardliveOne pass in four runs of one prompt. A sample, not a reliability figure.
A one-beat edit changes only that beatliveOne run.
Doubling the allowance was neededliveThree of four runs exceeded 16,384. The original failure's own split was never captured.
Copied wrappers become cardsoffline on real outputRuns 1 and 3 converted offline; no run copied the wrapper on a build that handled it.
Revision note names driftoffline on real outputMatched the hand comparison for runs 1 and 3. Not live in any run.
Unreadable offers are kept and namedunit testsBuilt from run 2's prose; run 2's actual payload was lost before the fix.
Decision quotes no longer warnoffline on real filesThe real answer's flagged quote matches the real decision file verbatim.
Futile filing loops stopunit testsNo live run triggered it.
Cards-only replies and cancellation still workunit testsExisting deterministic tests pass; not exercised live.
The browser UI shows all of this correctlynot checkedEvery live check used the HTTP API. Safari was not used.
Release qualitynot claimedThe full suite and the 48-run live gate have not run.

Focused suites: 1,899 tests passed across the chat, proposal, provider, tool, context, capture-status, revision-note, renderer and web suites. Groups overlap and are not summed into a unique total. Both TypeScript targets, scoped lint, whitespace checks and the web build passed.

Still open

Cap the reasoning. OpenRouter accepts reasoning (an effort level or a token budget) for this model. Ada sends none, so reasoning can take most of any allowance. A budget would bound the hidden share and leave room for the visible reply. Untried; it may change output quality, so it needs its own comparison.

Constrain the JSON. response_format and structured_outputs are listed for this model. Constrained decoding is the real cure for broken offer JSON. A native propose_outline tool would not be on its own: an unparseable tool argument is currently dropped silently, so the loop would first need to answer it with a parse error the model can correct.

Check candidates against saved choices. Only the structural comparison exists. A model check of an outline against the live decisions could quote conflicts and cite beats, but it must be bound to the exact candidate and source versions, show an incomplete check as unchecked, and never rewrite canon or add a mandatory approval step.

Keep revisions targeted. Run 4 rewrote all eighteen bodies when asked for three targeted improvements. The revision note will not flag this, because bodies are expected to change. A patch-style revision, where Fitz returns only the beats it changed, would need a new offer shape.

Page through long turns. Conversation search still cuts each turn at 12,000 characters. Recent history holds full drafts, so this only matters after eviction. Bounded paging through the search tool's existing schema is the likely shape.

Before calling it done. Run the full suite and the documented 48-run live quality gate, and repeat the revision in Safari with the rebuilt client. Record failures as failures.

Live state and rerunning

Branch
worldbuilding-agent, eleven commits from 02d40d0c to f29275b0. Local only: nothing pushed, merged or deployed.
Local service
127.0.0.1:18083, rebuilt and restarted on 086220a9 with its unchanged environment. The one later commit is documentation. Reload any open tab before testing, since the client was rebuilt too.
Test vault
Unchanged at its last accepted state. All reruns used disposable clones.
Written record
docs/worldbuilding-2026-10-22.md, section “Substantial revision repair”, in the repository.
Evidence
Kept privately on the development machine under ~/Documents/WiY Tests/2026-10-22 Revision reruns: each run's chat events and usage rows, the prompts, the comparison scripts and the headless driver, with a README.

Rerunning without a browser

The first headless reproduction path for this project. The server's own HTTP surface is enough to open a vault, select a conversation, send a turn and collect the reply events.

# 1. bundle the server outside out/, so the live service's files are untouched
npx esbuild src/server/index.ts --bundle --platform=node --format=cjs \
  --packages=external --target=node22 --sourcemap --outfile=<dir>/server/index.js

# 2. clone the vault into <data>/writers/local/projects/<name>, check out the fixture
#    commit, remove the origin remote, copy .wwp/config.json, set providerId deepseek

# 3. start it on a spare port, the provider key taken from the environment
NODE_PATH=<repo>/node_modules WIY_DATA_DIR=<data> WIY_PORT=18093 \
  WIY_FITZ_PROVIDER=deepseek node out-elsewhere/server/index.js

# 4. drive one turn: POST /api/vault:open, /api/chat:switchConversation, /api/chat:send
#    (header x-wiy-request: 1, x-wiy-client: <id>), events on /ws?client=<id>
node drive.mjs http://127.0.0.1:18093 <vault root> <slug | new> prompt.txt out.json

Commit ledger

CommitWhat it doesKind
9208da47Double Ada Worldbuilding output allowance to 32,768budget
eacf6157Record per-call finish reasons and reply survival for Ada turnsdiagnostics
e7cf55edCount recorded decisions as a quote sourcequote check
8a55a296Stage offers Ada writes in the saved-history wrapperrun 1 fix
5b7e8311Stop Ada's tool loop after three rounds of refused filing callscost guard
175cc490Keep unreadable Ada offers and say so in the saved turnrun 2 fix
ec3e3ff4Recognise any version of a copied history wrapper, and ask Ada not to copy itrun 3 fix
6e5a4bc5Note structural changes when Ada revises an earlier outline offerrun 3 fix
2451d3a7Record the substantial-revision repair and its live rerunsrecord
086220a9Compare outline revisions that drop or add the book slugrefinement
f29275b0Name where the revision rerun evidence is keptrecord

Changed: chatSession.ts, mimoProvider.ts, chatProposals.ts, chatTools.ts, modelProvider.ts, contextAssembler.ts, harness/worldbuildingCaptureStatus.ts, ipc.ts, shared/chatProposalHistory.ts, the new outlineRevision.ts, seven test files and the written record.