feat(mar-887): shared agent SDK file inside the agent folder - #356
Merged
Merged
Conversation
Both agent templates carried a full copy of the runtime: the runner protocol, telemetry v1, the artifact shapes, the broker and browser channels, the command acknowledgements and the idle-until-asked state machine. ADR 0032 recorded the fork as a later packet's job; this is that packet. `agent-kit/template/dash-agent-sdk.mjs` is that runtime as one self-contained ESM file, node builtins only, shipped inside the agent folder and imported by `agent.mjs` with a relative path. It absorbs `brief-fingerprint.mjs`, so the mirror DASH pins is now one file rather than two. The templates keep their definition and their task logic and nothing else. Every message the runner sees is unchanged: same telemetry, same artifact key order, same acknowledgements, same waiting task. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…mport `TemplateSources` gained `sdk`, so every fixture that stood in for the template files carries it. `scout-curates` copies both files rather than the program alone, because a relative import that resolves to nothing is a process that dies before it can be watched. The fingerprint mirror now compares DASH's half against the runtime, which is where that function went. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…dates it Two things no spawning test can see. `tests/agent-sdk.test.ts` holds the runtime to the property that makes it shippable at all: node builtins only, no bare specifier and no dynamic import, because a scaffold declares no dependencies and the packaged sample is copied as bytes. `tests/legacy-agent.test.ts` spawns the monolithic template as it stood at cb2cb1c under a real Supervisor, because the agents at risk from this change are not on this branch, they are on people's disks. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ADR 0034 records the decision and the two shapes it rejects: an npm package, which fails at the only place that matters (a scaffold declares no dependencies and the packaged sample is copied as bytes), and bundling the runtime into agent.mjs at scaffold time, which destroys the one property the split exists for. `docs/foundation/sdk-upgrades.md` states the rule the version is for -- an upgrade replaces `dash-agent-sdk.mjs` and never touches `agent.mjs` -- and says plainly that the mechanism is not built, and why: there is no hook in `lib/sample-refresh.ts` to ride, and a write into a stored agent folder is a write ADR 0008 says the next import discards. Both READMEs and the skill now name the file an author edits and the one they must not, in that order. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e lives Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Thebeatkicks
marked this pull request as ready for review
September 7, 2026 15:36
Thebeatkicks
added a commit
that referenced
this pull request
Sep 7, 2026
…ce log Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Stage 1 of MAR-886. There were two copies of the agent runtime and no shared
module; ADR 0032 recorded the fork as a later packet's job, and this is that
packet.
What this is
agent-kit/template/dash-agent-sdk.mjsis the runtime as one self-contained ESMfile — node builtins only, no package, no
node_modules— that ships insidethe agent folder beside
agent.mjsand is imported from it by relative path.Both scaffolders and the packaged sample write the same bytes.
The templates keep their definition and their task logic and nothing else:
agent-kit/template/agent.mjsgoes from 1060 lines to 554,tools/dash-mcp/template/agent.mjsfrom 743 to 416.brief-fingerprint.mjsisabsorbed into the runtime, which already carried the same do not edit warning;
DASH's half stays at
lib/brief/fingerprint.tsand the mirror test still pinsthe two halves against each other.
Why a file rather than a dependency
agent-kit/scaffold.tswritesdependencies: {}on purpose, and the packagedsample is copied as raw bytes into the user's Documents folder by
scripts/build-shell.mjs. There is no install step anywhere in the installedjourney and no place to put one a person would forgive. Bundling the runtime
into
agent.mjsat scaffold time was the other candidate and destroys theproperty the split exists for: a runtime fix that reaches an agent somebody has
been editing for months without touching their file. ADR 0034 has both
arguments.
Nothing the runner sees changed
Same seven telemetry types at
event_version: 1, the sameseq/tsdiscipline, the same artifact shapes at versions 1 and 2, the same four
acknowledged commands, the same waiting task. The one place a shape could have
moved — the digest's
generated_at, which one template stamped and the otherdid not — is resolved by stamping it only when the author did not, so both
templates emit the same keys in the same order they did before.
Old agents are untouched and keep working: ADR 0008 makes the folder the unit
and nothing rewrites
agent.mjsin place, so every agent generated before thisis still monolithic and spawned by a runner that did not change.
tests/legacy-agent.test.tsspawns those exact bytes (cb2cb1c, kept attests/fixtures/legacy-agent-kit-template.mjs) under a realSupervisor.Verified
pnpm typecheckclean.pnpm test— 283 files, 5352 passed, 13 skipped, 0 failed.pnpm build:agent-kit, then the real CLI: a scaffold on disk carryingagent.mjsanddash-agent-sdk.mjs.pnpm build:renderer; pnpm build:shell—dist/electron/agent-kit/holdsboth files.
[smoke] all proofs passed.6blistsdash-agent-sdk.mjsin the handoffDASH creates,
6c-fshowscode/dash-agent-sdk.mjsaccepted with its hashinto DASH's own stored copy, and
6d–6kare the acceptance sentence runagainst a real generated agent through the SDK: it waits to be asked, nothing
runs on its own, Run now goes through the audited bridge, telemetry renders
compliant: truewith no sequence gap, and the digest reaches both the folderand DASH. Runner retired with
scripts/retire-scratch-runners.mjs(202).Evidence class: fixture tests plus an installed-style shell on a scratch store.
The real store was never opened; the installed-build proof is the orchestrator's.
docs/foundation/stage-1-handoff.mdcarries the deviations, what is not done,and what the next session should read first.
🤖 Generated with Claude Code