docs(examples): tighten the good/great examples — simpler, zero capability lost#377
Merged
Conversation
…ility lost - driver-loop: extract the worker/adapter/validator fixture to scripted-worker.ts so the driver (the subject) leads; keep the fold demo + THE FOLD anchors - researcher-loop: extract the hand-written fixture to synthetic-researcher.ts so the runLoop + inline-fanout wiring leads; keep the namespace-leak hard-fail - recursive-supervisor: extract the executor-registry plumbing to inline-executor.ts so the scope.spawn lesson leads; keep Part 1 + Part 2 + the budget-exhausted demo - strategy-suite: add an offline mode — an in-process mock OpenAI-compatible router (mock-router.ts) gated on the absence of TANGLE_API_KEY; live router stays the upgrade - chat-handler: note the NDJSON drain is illustrative (no decoder is exported); point at handleChatTurn as the framing owner - intelligence-recommend: import the shared scaffolding from improve.ts (de-dup ~50 lines); guard improve.ts main() so import does not double-run - stream-backends: import the real SandboxEvent union; default the OpenAI-compatible backend to the real OpenAI endpoint so OPENAI_* names are honest - sanitized-telemetry-streaming: collapse the near-duplicate safe/verbose halves into one drain helper, both demonstrated states kept - runtime-run: drop the cosmetic task.metadata workspaceId/threadId duplication of the explicit args
tangletools
approved these changes
Jun 24, 2026
tangletools
left a comment
Contributor
There was a problem hiding this comment.
✅ Auto-approved PR — 7f19b4b4
Blanket team auto-approval is enabled for this reviewer service.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: blanket_auto_approve · 2026-06-24T15:35:59Z
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tightens the GOOD/GREAT examples a prior three-persona review flagged as marginal-but-left-alone. Every change makes the example simpler / clearer / more reusable while keeping exactly what it does and teaches — fixtures are extracted (not deleted), concepts de-duped (not dropped), an offline mode added (not removed). Verified each touched example still typechecks, runs, and keeps its output/teaching.
What was tightened (per example)
scripted-worker.tsso the driver (the subject) leads. The fold demo + theTHE FOLD, PART 1/2anchors are unchanged. Subject file 211 → 146 lines (+81-line sibling). Output identical.synthetic-researcher.tsso therunLoop+ inline-fanout wiring leads. The namespace-leak hard-fail demo is intact (the leak candidate is still pruned, the in-namespace candidate wins). Subject file 201 → 78 lines (+147-line sibling). Output identical.inline-executor.tsso thescope.spawnconserved-budget lesson leads. Part 1 (rawscope.spawn), Part 2 (fanoutcombinator), and the rejected-third-spawnbudget-exhausteddemo all kept. Subject file 205 → 131 lines (+94-line sibling). Output identical.mock-router.ts) gated on the absence ofTANGLE_API_KEY. The whole comparison now runs end-to-end with zero credentials, driving the REALrunBenchmarkmachinery (Supervisor, conserved budget pool, every strategy, the env's own check) against localhost. The live Tangle router stays the drop-in upgrade. Capability added, none lost.handleChatTurnas the framing owner so consumers don't think they must re-implement it. Lifecycle envelope demo unchanged.DemoScenario/scenarios/agent/judge/scriptedWinner/profile) fromimprove.tsinstead of duplicating ~50 lines, so it reads as "improve, but the findings come from a recorded trace" — its actual new idea (recordTrace → findings → improve) is all that's left.improve.ts'smain()is guarded with an entry-check so the import doesn't double-run. 134 → 88 lines. Both outputs identical.SandboxEventis now the real exported union from@tangle-network/sandbox(a status the SDK adds is a compile error here, not a silent miss). The OpenAI-compatible backend now defaults to the real OpenAI endpoint so theOPENAI_*env names are honest, with a note that you can point it at the Tangle router. All three transports kept.drain(label, collector)helper. Both demonstrated states are kept: default-redaction (PII/args/result/uri stripped) and opt-in verbose (those fields exposed). Thetask.intentPII footgun note stays.task.metadataworkspaceId/threadIdduplication of the explicitstartRuntimeRunargs (these never flowed into the row's typed columns — verified insrc/runtime-run.ts). Persisted row identical.Skipped (no no-capability-loss simplification available)
SandboxInstancehelper). No change made deliberately.handleChatTurn), not a consumer-side decoder, so there is nothing to import; took the lighter "add a note" path the brief allows.Verification
pnpm run build,pnpm run typecheck(src +typecheck:examples),pnpm run lint,pnpm run docs:check— all green (docs freshness: no drift; 0 errors).finally).origin/main(git merge-tree).