Skip to content

refactor(docs): cut README 551→138 + reorder examples by progression + trim headers#57

Merged
drewstone merged 2 commits into
mainfrom
refactor/example-pedagogy-readme-cut
May 25, 2026
Merged

refactor(docs): cut README 551→138 + reorder examples by progression + trim headers#57
drewstone merged 2 commits into
mainfrom
refactor/example-pedagogy-readme-cut

Conversation

@drewstone
Copy link
Copy Markdown
Contributor

Summary

Following a staff audit (`/.evolve/audits/2026-05-25-claude-staff-audit.md`) that found three big DX problems, this PR addresses the highest-leverage docs/examples fixes.

What the audit found

  1. Examples teach a surface no consumer uses. A grep across 6 product repos (gtm/creative/legal/tax/agent-builder/agent-eval) showed zero imports of `runAgentTask`, `coderProfile`, `runLoop`, `createFanoutVoteDriver`. Real consumers import `handleChatTurn` / `defineAgent` / `runAnalystLoop` / `PlatformHubClient` / `DefaultVerdict` / `createOpenAICompatibleBackend` / `startRuntimeRun` / `RuntimeStreamEvent`. The example pedagogy leads with the wrong primitive.
  2. README is 551 lines on landing. A 6-row "What you get" table dumps every entry point in the first 30 seconds. Users can't tell which to pick.
  3. 15-line block comments at the top of every advanced example narrate what the example IS — pure README content in .ts files.

Changes

README: 551 → 138 lines

  • Hello world is `handleChatTurn` (the real production surface), not `runAgentTask`.
  • New decision tree for picking entry points (chat vs runLoop vs runAgentTask etc.)
  • New defaults table — what fires when nothing is specified (model, provider, base URLs, iteration cap, OTEL).
  • Composition diagram for agent-runtime + agent-eval + agent-knowledge + sandbox.
  • Full original archived to `docs/README-full.md` for one minor.

examples/README.md reorder

Phase Examples
Start here chat-handler / with-knowledge-readiness / sanitized-telemetry-streaming / runtime-run
Delegation mcp-delegation
Advanced fanout coder-loop / researcher-loop / fleet-delegation
Lower-level (folded into above, one-minor migration) basic-task / sandbox-stream-backend / openai-stream-backend / sse-stream / sanitized-telemetry / agent-into-reviewer

The four "start here" examples are everything a production product needs. The grab-bag of lower-level building blocks is demoted with a migration note.

Example header trims

Replaced 14-16 line JSDoc block comments in `coder-loop` / `researcher-loop` / `mcp-delegation` / `fleet-delegation` with single-line `//` pointers to README.md. Code does the talking now.

Verified

  • `pnpm typecheck` ✓
  • `pnpm test` ✓ — 284/284 tests pass

Follow-ups (in audit, not in this PR)

  • Split `backends.ts` (897 LOC) into ~5 backend-per-file modules
  • Sweep JSDoc on every public export in `src/index.ts`
  • Add `examples/self-improving-loop/` — the 4-package composition demo (agent-runtime + agent-eval + agent-knowledge + sandbox all wired)
  • Bump `agent-builder` + `creative-agent` off stale runtime/eval versions
  • Add `pnpm bump:substrate` to the agent-stack-adoption skill template

drewstone added 2 commits May 25, 2026 03:18
…trim example headers

Staff audit at .evolve/audits/2026-05-25-claude-staff-audit.md found:

1. The 17 examples teach a surface no production consumer uses. Grep
   across 6 product repos shows zero imports of runAgentTask /
   coderProfile / runLoop / createFanoutVoteDriver — real consumers
   import handleChatTurn (chat path) / defineAgent / runAnalystLoop /
   PlatformHubClient / DefaultVerdict. The example pedagogy was leading
   with the wrong primitive.

2. README was 551 lines on landing — overwhelming first impression.

3. Each loop+MCP+fleet example had a 15-line block comment narrating
   what the example IS — pure README content sitting in .ts file.

Changes:

- README: 551 → 138 lines. New structure: hello world is handleChatTurn
  (the real production surface), decision tree for picking entry points,
  defaults table, composition story with agent-eval / knowledge / sandbox.
  Full original archived to docs/README-full.md for one minor.

- examples/README.md: reordered. chat-handler / with-knowledge-readiness /
  sanitized-telemetry-streaming / runtime-run are the "start here"
  progression. mcp-delegation is "add tools". coder-loop / researcher-loop
  / fleet-delegation are "advanced fanout". Lower-level building blocks
  (basic-task, sandbox-stream-backend, openai-stream-backend, sse-stream,
  sanitized-telemetry, agent-into-reviewer) demoted with one-minor
  migration note — they're now redundant with the consolidated four.

- Trimmed 14-16-line JSDoc headers in coder-loop / researcher-loop /
  mcp-delegation / fleet-delegation to single-line // comments pointing
  at README.md. Code does the talking now.

Verified: pnpm typecheck clean; 284/284 tests pass.

Follow-ups (per audit, not in this PR):
- backends.ts 897 LOC → split into ~5 files
- Sweep JSDoc on every public export in src/index.ts
- Add self-improving-loop composition example (agent-runtime + agent-eval
  + agent-knowledge + sandbox all wired — the 100x post-worthy demo)
- Migration note for consumers still on 0.18.x (creative-agent)
@drewstone drewstone merged commit bd3ec73 into main May 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant