Research log / RL-013

RL-013 Draft-edit routing, registry-derived capabilities, previous-turn route

Evidence grade DC

Field Value
Date 2026-09-13
Harness version 2026-09-12-app-workflows-15 (+ unrecorded RL-012a) β†’ 2026-09-13-intent-awareness-1
Models observed: qwen3:4b-thinking (desktop). Tests: MockLlm (synthetic)
Evidence grade D (motivating journal) + C (replay and tests). No live model measurement.
Pre-registered partially: observations and replay baseline recorded before the change; hypotheses stated in the review immediately before implementation
Source record HARNESS.md Β§8b, metrics/2026-09-13.json

Observation

Journal, 2026-09-12 23:29–23:53, app-workflows-15, qwen3:4b-thinking, n = 8 turns (2 failed, 2 fast path):

Time Message Intent Reply (excerpt)
23:34 okay now add some styling to it, all in line task (list of the user's workspaces; names withheld)
23:52 Help me plan my day chat Sure! What's your main goal for the day?
23:53 get tiny agent to a point where we can build full apps ask (list of coding-agent sessions; titles withheld)
23:53 did you get lost there buddy chat Nope, I didn't get lost! πŸ˜„

The first and third were addressed by the unrecorded changes (RL-012a). The fourth shows the mechanism that remained: the chat model had no record of how the previous turn was routed, so it denied the misroute.

Baseline replay on the code as found (2026-09-13, before this change), classifyIntent with code mode on and a complete HTML draft:

Message Routed
make the header blue task
add a contact section task
okay now add some styling to it, all in line chat
add a task to fix the header task

Self-description baseline: "what can you do?" returned a fixed string listing notes, tasks, reminders and status. Registered but unlisted: code drafts, web search, workspace file read/edit, terminal read/run. The chat system prompt stated only that no tools exist in this conversation; "can you edit files?" and "can you run commands?" went to inference with no capability information.

Hypotheses

Intervention

Prompt cost (harness estimateTokens, not server-counted), chat system prompt:

Configuration Chars Est. tokens
Before (no abilities, no route instruction) 776 296
After, full desktop registry (search, files, terminal) 1,556 584
β€” of which APP ABILITIES block, full desktop 531 197
β€” of which APP ABILITIES block, no optional tools 399 149
β€” of which previous-turn instruction 179 66
Per-turn PREVIOUS TURN line (in user message) 79 30

That is roughly +290 estimated tokens (+97%) per chat inference on the full desktop, against a 4,096–8,192 window. This conflicts with the AGENTS.md preference for code fixes over prompt text and must be justified by H3's live result or trimmed.

Method

  1. Deterministic replay of 9 messages through classifyIntent with code mode and a complete draft, before and after.
  2. Unit tests with synthetic model output: tests/capabilities.test.ts (5 tests), one new case in tests/codeConversation.test.ts.
  3. Full regression suite, typecheck, build.

Results

Message (draft open) Before After Expected
make the header blue task chat chat
add a contact section task chat chat
okay now add some styling to it, all in line chat chat chat
add a task to fix the header task task task
add styling to index.html task task task
add milk to my shopping list task task task
set a reminder to change the header task task task
can you edit files? chat (inferred) chat (registry answer) chat
what can you do chat (stale fixed) chat (registry answer) chat

Threats to validity

Conclusion

Post-deployment observations (grade D)

Journal under intent-awareness-1, desktop, qwen3:4b-thinking, n = 2:

Time (UTC) Message Intent / status Elapsed Reply (excerpt)
00:14:38 oh my mistake chat / ok 8.6 s No worries at all! 😊 Let's get back to planning your day…
00:17:34 lets create a web app, about dogs, with little write ups on each dog breed, use 10 dog breeds, 10 different pages, use css and styling chat / ok 125.0 s This draft is incomplete; it has not been verified as runnable.

Evidence record

Backfilled 2026-09-13 under protocol step 10, after the entry was written. Raw journal rows (turns 108–116, runs 377–385, with steps and stored model output): evidence/RL-013/journal-turns-runs-steps.json. The replay and prompt-size measurements were run as one-off scripts whose output was not saved; their results are the tables above.

User prompts (verbatim)

Workspace, file and session names in replies are withheld here; the raw rows are kept only in the private evidence file.

In Tiny Agent (journal, app-workflows-15, qwen3:4b-thinking):

Turn Time (UTC) Prompt Route / status Reply (verbatim start)
108 2026-09-12 23:29:17 Let's build a website chat / error, 127.4 s 2/3 supported browser checks passed. These checks do not verify every requirement.
109 23:34:22 okay now add some styling to it, all in line task / ok (list of the user's workspaces; names withheld)
110 23:36:48 continue chat / fast_path There is no unfinished output to continue. The current draft is still available; tell me what you would like to add or change.
111 23:42:15 i wanted you to edit the html website you created, currently sat in your code window and add css styling to it chat / error, 294.2 s 2/3 supported browser checks passed. …
113 23:52:58 Help me plan my day chat / ok Sure! What's your main goal for the day? I can help you structure it with tasks, breaks, or priorities.
114 23:53:19 get tiny agent to a point where we can build full apps ask / ok (list of coding-agent sessions; titles withheld)
115 23:53:41 did you get lost there buddy chat / ok Nope, I didn't get lost! πŸ˜„ Just need a quick "what's your main goal for the day?" to help you plan. What's on your mind?
116 2026-09-13 00:14:38 oh my mistake chat / ok No worries at all! 😊 Let's get back to planning your dayβ€”what's your main goal for today?

To Claude Code, which made the change:

  1. "check were we are up to with the local ai agent harness, how we can improve output and further allow the models to understand user intent and the harness and controls they have around them"
  2. "okay get them done, fast and efficient, clean and proper"

Model prompts and responses (verbatim excerpts)

Turn 109: the model, given the broad task catalogue, emitted

{"type":"tool","tool":"get_workspaces"}

for a request to style the open draft β€” a wrong tool on a misrouted turn.

Turn 115 (qwen3:4b-thinking, chat prompt without a route record):

Nope, I didn't get lost! πŸ˜„ Just need a quick "what's your main goal for the day?" to help you plan. What's on your mind?

The previous turn (114) had answered a request about building apps with a list of coding-agent sessions. The model denied it.

Turns 108 and 111, visible in the stored steps: all three browser-verified repair attempts in each run were rejected with

Last repair rejected: the model spent its reply budget on reasoning and returned no answer

After the change, no live model was run (see Threats); the only responses are from MockLlm in tests.

Issues encountered, in order

# Issue How it surfaced Outcome
1 Replay script could not import the harness from the scratch directory (relative path) tsx error Absolute file:/// imports
2 AgentEvent not exported (TS2305) in the replay script Typecheck of the script Type derived from AgentRunnerOptions['onEvent']
3 First draft of this entry gave the APP ABILITIES size as an estimate Self-review while logging Replaced with measured character and estimated-token sizes
4 Turns 108 and 111 lost all repairs to reasoning-budget exhaustion; runs 377 and 380 have failure = null Journal Out of scope here; led to the failure-category work in RL-015
5 The prompt-cost increase (+β‰ˆ290 estimated tokens per chat inference) conflicts with AGENTS.md's code-over-prompt rule Measurement Recorded; justification depends on H3's untested live effect

Assumptions and what turned out to be true

# Assumption Verdict Evidence
1 Draft edits misrouted because the code-mode rule lacked edit verbs Γ— page parts Correct (C) Replay 2/2 β†’ 0/2, controls 4/4 unchanged
2 The 23:34 styling message had already been fixed by the unrecorded changes (RL-012a) Correct (C) Baseline replay routed it to chat before this change
3 A capability answer built from the registry stays truthful as tools change Correct (C) Tests with tools added, removed and permission flipped
4 The model denied the misroute because it had no record of the route Untested No live model run with the PREVIOUS TURN line
5 The extra prompt text is worth its cost Untested / at odds with AGENTS.md +97% chat system prompt; no live benefit measured
6 The page-part lexicon covers real edit phrasing Untested Cases chosen after seeing the failures
7 This change would not disturb other routes Correct (C) on the tested set 662 β†’ 668 tests, 0 failures

What was correct and what was not

Follow-ups

  1. Widen the multi-page guard to numeric and "different/separate" page counts; log as a new entry with this turn as its observation.
  2. Live A/B for H3: replay the 23:53 two-turn sequence on qwen3:4b-thinking, qwen2.5-coder:7b and qwen2.5:1.5b-instruct, n = 5 each, with and without APP ABILITIES/PREVIOUS TURN; score "acknowledges misroute" vs "denies"; record server prompt tokens.
  3. If H3's effect is small, cut APP ABILITIES to the Can: line or include it only when the user asks about abilities or signals confusion.
  4. Measure draft-edit recall with a held-out set of β‰₯ 30 edit phrasings written before looking at the lexicon.
  5. Check the journal after a week on intent-awareness-1 for task turns while in code mode (grade D).

Reproduce

npm test
npm run typecheck
npm run research:snapshot -- --out docs/research-log/metrics/2026-09-13.json