docs(readme): lead with the front doors consumers actually use - #867
Conversation
A measured DX audit read the README cold and counted the entry points that 183 importing files across 10 consumer repositories really use. The README led with the one API family that has zero real call sites, and never named the most imported symbol in the fleet. README: 591 lines and 3,433 words become 127 lines and 1,176 words. - The quickstart is now `examples/quickstart/minimal.ts` in full. It compiles and runs as pasted. The old excerpt used five identifiers it never defined. - One decision table replaces the three routers that disagreed. Rows run in the order real products use them, and each row links to a runnable example. - A five-word table defines worker, driver, decision, verdict, and harness under the quickstart. - The improvement reference moves to docs/improve.md, and the PrimeIntellect adapter to docs/primeintellect.md. The pinned pip revisions move with them. - Retained-run depth moves to examples/retained-run, which also carries the table that maps what died to the mechanism that continues the work. Examples: three new front doors, each with a README in three sections — when to use it against its siblings, how to use it, and why it exists. - examples/stream-a-turn: `runAgentTaskStream` plus the `RuntimeStreamEvent` union, the most imported symbol in the fleet and previously unmentioned. - examples/tool-loop: `runToolLoop` with your model turn and your executors. - examples/retained-run: start, persist the claim ticket, and reattach. examples/quickstart absorbs the minimal call and the refine loop in one place. Two API honesty fixes: - Export `TERMINAL_DECISIONS`, `TerminalDecision`, and `isTerminalDecision`. The four values that stop the loop were a private string comparison, so a caller could not tell kernel keywords from its own vocabulary. - `Driver.name` documents that it is a trace label with no behavioral effect, and the quickstart stops naming a driver after a decision value. The 767-export kernel barrel stays as it is. Tiering it is out of scope here.
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 58f581f2
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
This approval is provisional. It rests on the audit running. If the audit cannot run — for example the CLI bridge rejects it — this approval is dismissed rather than left standing, so an unrun check never reads as a passing one.
tangletools · auto-approval · reason: drewstone_author · 2026-08-15T07:03:36Z
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 8b570a08
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
This approval is provisional. It rests on the audit running. If the audit cannot run — for example the CLI bridge rejects it — this approval is dismissed rather than left standing, so an unrun check never reads as a passing one.
tangletools · auto-approval · reason: drewstone_author · 2026-08-15T07:05:23Z
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 07186d45
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
This approval is provisional. It rests on the audit running. If the audit cannot run — for example the CLI bridge rejects it — this approval is dismissed rather than left standing, so an unrun check never reads as a passing one.
tangletools · auto-approval · reason: drewstone_author · 2026-08-15T07:09:01Z
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 3d4abe1c
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
This approval is provisional. It rests on the audit running. If the audit cannot run — for example the CLI bridge rejects it — this approval is dismissed rather than left standing, so an unrun check never reads as a passing one.
tangletools · auto-approval · reason: drewstone_author · 2026-08-15T07:33:26Z
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 3d4abe1c
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
This approval is provisional. It rests on the audit running. If the audit cannot run — for example the CLI bridge rejects it — this approval is dismissed rather than left standing, so an unrun check never reads as a passing one.
tangletools · auto-approval · reason: drewstone_author · 2026-08-15T08:06:17Z
|
@tangletools review now |
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 3d4abe1c
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
This approval is provisional. It rests on the audit running. If the audit cannot run — for example the CLI bridge rejects it — this approval is dismissed rather than left standing, so an unrun check never reads as a passing one.
tangletools · auto-approval · reason: drewstone_author · 2026-08-15T08:16:16Z
tangletools
left a comment
There was a problem hiding this comment.
🟡 Value Audit — sound-with-nits
| Verdict | sound-with-nits |
| Coverage | 2 of 2 lenses (value, usefulness) |
| Concerns | 3 (1 low, 2 weak-concern) |
| Heuristic | 0.0s |
| Duplication | 0.2s |
| Interrogation | 470.5s (2 bridge agents) |
| Total | 470.7s |
💰 Value — sound-with-nits
Rewrites the README around a usage-ordered front-door table with a verified-compiling quickstart, adds the three missing front-door examples, and promotes the terminal-decision vocabulary to public API — a coherent, verified improvement; two weak concerns only.
- What it does: Three deltas. (1) README 591→133 lines: the flagship quickstart is now examples/quickstart/minimal.ts in full (self-contained; old version at 08fc914:README.md:36-67 referenced free identifiers output/validator/Task/Note defined only in another file), a 9-row front-door table ordered by real consumer use replaces the old 5-row router, the 240-line improve deep-dive and PrimeIntellect section move
- Goals it achieves: Make the package's front door match what real consumers actually do: a quickstart that compiles and runs as pasted (verified), the fleet's most-imported symbol RuntimeStreamEvent finally named in the README (README.md:84), runnable examples for the two front doors that had none (runToolLoop, startRetainedRun), reference depth moved out of the install-time page into docs/, and the terminal-decision
- Assessment: Good on its merits and in the codebase's grain. Every claim I could test held: pnpm typecheck:examples passes; after pnpm build, minimal.ts, quickstart.ts, stream-a-turn.ts, and tool-loop.ts all run offline and print exactly the outputs the READMEs promise; the old quickstart demonstrably did not compile as pasted; docs/api regeneration is in sync with the new exports and docstrings; the '33 examp
- Better / existing approach: none — this is the right approach. Searched for prior art before concluding: no example used runToolLoop (rg hits only in src/, docs/, tests); no example or doc demo covered startRetainedRun for consumers; runAgentTaskStream appeared only inside examples/stream-backends' three-factory comparison and examples/agents-of-all-shapes, neither of which teaches the bare contract. The lighter alternative
- Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 2
- Bridge warning: opencode/kimi-for-coding/k2p7: opencode: opencode error
🎯 Usefulness — sound
An evidence-driven README/examples rewrite plus a minimal, correct kernel export (TERMINAL_DECISIONS/TerminalDecision/isTerminalDecision) that makes the documented front doors compile, run offline, and match measured consumer usage; every claim I checked held.
- Integration: Verified reachable and wired.
pnpm run typecheck:examplespasses; all four runnable examples execute offline andminimal.tsprints exactly the README-claimeddecision: done — 1 iteration(s). The new exports flow src/runtime/run-loop.ts:1223-1231 → src/runtime/index.ts:386-394 → tsdownkernelentry → package.json./kernel, and the generated docs were regenerated (docs/api/runtime.md:19638 - Fit with existing patterns: Fits the grain. The code delta is a pure visibility change (private
isTerminalDecision→ exported const array + type predicate; identical logic, run-loop tests 11/11 pass), which exists so the README example can typedecidewithout inline string unions — the exact awkwardness the old example exposed. The examples follow the established pattern (one dir per front door, imports via published pac - Real-world viability: The examples are deterministic and verified to run; the retained-run example is honestly labeled compile-checked-only and that is accurate —
startRetainedRunrequires a real provider and an awaited onAdmission hook (retained-run-start.ts:75), and the file's guard prints its template notice instead of failing. The quickstart rewrite dropsmaxIterations: 3but the plan closure still caps attempt - Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 1
🔎 Heuristic Signals
🟡 Cruft: console debug added examples/quickstart/minimal.ts
+console.log(
decision: ${result.decision} — ${result.iterations.length} iteration(s))
💰 Value Audit
🟡 stream-a-turn overlaps stream-backends' first section [duplication] ``
Both write a scripted backend by hand and call runAgentTaskStream (examples/stream-backends/stream-backends.ts:34-42 vs examples/stream-a-turn/stream-a-turn.ts:29-78). The overlap is deliberate and bounded — stream-backends is about choosing among three factory sources, stream-a-turn about the bare AgentExecutionBackend contract plus the full event vocabulary (llm_call, final) — and each README points to the other as the sibling for its non-question (stream-backends/README.md:14-16). Keeping bot
🟡 'front door' now names two different routers [maintenance] ``
The PR motivates the rewrite by the three disagreeing routers, but only the README's side is reconciled: docs/canonical-api.md §2.1 (line 192) still titles itself 'Which front door do I use?' with a disjoint four-verb list (delegate/supervise/runAgentic/runPersonified), while README.md:77-92 presents nine front doors ordered by consumer use. The audiences differ (contributor vs npm consumer) so it is not a contradiction, but the shared term now has two authoritative tables with no cross-referenc
What this audit checks
It judges the change on its merits — not whether it was tasked out in an issue. Unticketed, fast-moving work is fine; the question is whether the change is good and whether a better or existing approach should be used instead.
| Pass | What it asks |
|---|---|
| Heuristic | Vague title? Whitespace-only or cruft-bearing diff? (content signals only) |
| Duplication | Do added function/class names already exist elsewhere in the repo? |
| Value Audit | What does it do? What goal does it achieve? Is it good? Better architecture or already-exists? |
| Usefulness Audit | Does it integrate and fit? Will it hold up in real use and actually get used? |
Findings are concerns, not blocks — the human reviewer decides what to do with them.
Why
A measured DX audit read the README cold and counted the entry points that real consumers use: 183 importing files across 10 repositories. Findings that drove every decision here:
runAgentRoundsexample did not compile as pasted (worker,output,validatorfree identifiers;TaskandNoteundefined) and has zero real call sites in the fleet.RuntimeStreamEvent(36 files). The README never mentioned it.improve) took 40.6% of the file, including an 86-line code block and pip installs pinned to git revisions.What changed
README: 591 → 127 lines, 3,433 → 1,176 words.
examples/quickstart/minimal.tsin full. It compiles and runs as pasted, offline.concepts.mdpattern: when to call it, what you give it, what you get back. Rows are ordered by real consumer use, sorunAgentTaskStreamleads and the zero-consumer driver pattern is no longer the front door.docs/improve.mdanddocs/primeintellect.mdreceive the moved reference material, pinned pip revisions included. Retained-run depth moves into its example, which also carries the "what died → which mechanism continues it" table for the five continuity paths.Examples: one directory per front door, each README in three sections — when to use it (honest, against its siblings), how to use it (runnable compiling code), why it exists.
stream-a-turn(new)chat-handlerstream-backendstool-loop(new)runtime-runquickstart(absorbed)superviseretained-run(new)improveexamples/quickstartnow holdsminimal.ts(the README quickstart) andquickstart.ts(the same call grown into a refine loop), so there is one place for the loop instead of two.Two API honesty fixes
TERMINAL_DECISIONS,TerminalDecision, andisTerminalDecisionare exported from/kernel. The four values that stop the loop were a private string comparison, so a reader could not tell kernel keywords (stop,pick-winner,fail,done) from caller vocabulary. Drivers can now typedecideas'your-word' | TerminalDecision.Driver.namedocuments that it is a trace label with no behavioral effect, and the quickstart stops naming a driver'refine'— a word that also worked as a decision value three lines later.Out of scope, deliberately: the
/kernelbarrel exports 770 names (767 before this change). Tiering that surface is real work and belongs in its own change.Proof
pnpm typecheck(source + examples): clean.tsconfig.examples.jsongains the/tool-looppath mapping so the new example resolves.pnpm lint: 596 files checked, no findings.pnpm run docs:freshness: OK, no drift.docs/apiregenerated for the three new kernel exports.minimal.ts→decision: done — 1 iteration(s);quickstart.ts→decision: pick-winner — winner: shot 1;stream-a-turn→cost: $0.0009 — reply chars: 81;tool-loop→turns: 2 — stopReason: completed.retained-runis compile-checked only, and its README says so: no in-repo provider advertises the seven retained capabilities.pnpm test: 2,696 of 2,711 tests pass. Every failure is a 15s/20s/60s timeout under concurrent load on this host, and the set changes between runs. The three files that failed in the full run pass in isolation (79/79), as do the tests for the changed code path (run-loop.test.ts+run-loop.provenance.test.ts, 31/31).