dsh-edge
AGENTS.md26 starsChanged 34 days agoMITView on GitHub
dsh-edge is an independent community wrapper that runs published DeepSeek Harness packages on Cloudflare Workers. It is maintained by pawaca and is not affiliated with or endorsed by DeepSeek. edge-container.yml runs the Container integration against the promoted standalone artifact daily and on demand (not on pull requests, so it never gates merging). A red daily run means a Container regression reached main; fix it before the next release. The root and standalone lockfiles serve different purposes. The root lock installs…
- Reads credentials
- Installs packages
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- codex-review-loopSkill
- dsh-code-reviewSkill
- dsh-pre-push-checksSkill
- dsh-releaseSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
19 rules. About 0 are common, 11 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Do not restore upstream monorepo source, vendored packages, examples, SDKs, native code, or development workflows.
- Very specific: line 34
Keep every @deepseek-ai/dsh-* standalone dependency on one exact upstream version.
- Very specific: line 40
Never log DSH_EDGE_ACCESS_KEY, bearer tokens, or owner cookies.
- Very specific: line 41
When registering a cordis sub-registry entry (e.g.
- Distinctive: line 43
Every retained upstream patch needs a version-bound filename, a failing-without-the-patch check, a rationale, and a removal condition.
- Distinctive: line 59
Treat database cost as a correctness requirement in every path: normal requests, streaming, startup, migrations, cleanup, deletion, alarms, …
- Distinctive: line 69
Do not decode large images in the Worker (an 8192×8192 RGBA bitmap alone is 256 MiB).
- Distinctive: line 74
Prefer the smallest Edge-owned adapter over reimplementing an upstream capability.
- Distinctive: line 75
Add focused unit coverage for local behavior and update the dual-mode integration or browser snapshots when a user-visible or durable path …
- Very specific: line 76
Update English and Chinese documents together, then run pnpm run doc-pairs -- --write.
- Distinctive: line 77
Keep AGENTS.md as the full source of truth.
- Distinctive: line 90
Every version published to npm must also have a matching GitHub Release and git tag.
- Very specific: line 92
Write bilingual release notes: create docs/releases/<version>.md, docs/releases/<version>.zh.md, and their .i18n.yaml pairing record, then …
- Very specific: line 101
Use .agents/skills/dsh-release/SKILL.md to run a release: it holds the preflight checks, the failure-handling table, and the verification …
- Very specific: line 105
Every release publishes docker.io/pawaca/dsh-edge-computer:<version> from apps/dsh-edge/container/Dockerfile.
- Very specific: line 109
If publish fails after publish-image succeeded, npm is not published and the image tag is orphaned but harmless (no package references it).
- Distinctive: line 116
All feature, fix, and release work happens in an isolated worktree:
- Distinctive: line 126
After a PR is merged, clean up completely — worktree directory, local branch, and remote branch:
- Distinctive: line 137
Before starting a new iteration, verify a clean state: git worktree list shows only the primary checkout, git branch --show-current returns …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
dsh-edge repository instructions
dsh-edge is an independent community wrapper that runs published DeepSeek Harness packages on Cloudflare Workers. It is maintained by pawaca and is not affiliated with or endorsed by DeepSeek.
Ownership boundary
apps/dsh-edge/owns the Worker runtime, Durable Object adapters, installer, release CLI, tests, and package documentation.packages/client/ui-edge/owns the Edge-specific browser plugin.apps/dsh-edge/standalone/owns the exact upstream dependency closure, audited patches, Web assembly, and Direct/Dynamic Worker builds..agents/owns this repository's review workflow and skills.- Do not restore upstream monorepo source, vendored packages, examples, SDKs, native code, or development workflows. Use published packages and public extension points; use a version-bound patch only when composition cannot express the change.
Commands
pnpm install
pnpm --dir apps/dsh-edge/standalone install --frozen-lockfile
pnpm run check
pnpm run build
pnpm --filter dsh-edge dev
pnpm --filter dsh-edge dev:isolated
pnpm --filter dsh-edge dev:container # needs a local Docker engine
pnpm --filter dsh-edge run test:integration
pnpm --filter dsh-edge run test:snapshot
pnpm --filter dsh-edge run test:container # needs a local Docker engineedge-container.yml runs the Container integration against the promoted standalone artifact daily and on demand (not on pull requests, so it never gates merging). A red daily run means a Container regression reached main; fix it before the next release.
The root and standalone lockfiles serve different purposes. The root lock installs repository tests and tooling; the standalone lock is the release assembly and must build successfully before the root install in CI so parent dependencies cannot mask missing release inputs.
Runtime and release invariants
- Keep every
@deepseek-ai/dsh-*standalone dependency on one exact upstream version. Upgrade it only in an explicit upstream-baseline PR. pnpm run upstream-parity(part ofpnpm run check) requires every enabled plugin in the upstream reference compositions (dsh-base,dsh-web-app, the agent presets) and every package in the upstream tool catalog to be used by the Edge or classified inapps/dsh-edge/upstream-parity.json(substitute,not-applicable,trackedwith an issue,declined, orgap), each with a reason.apps/dsh-edge/upstream-reference.jsonis generated for the pinned baseline; never edit it by hand.- The Container image's computerd (
apps/dsh-edge/container/Dockerfile) and the bundled@cloudflare/computerform one wire-protocol pair with no negotiation; upgrade them in the same PR. - Keep Direct and Dynamic Loader modes behaviorally aligned except for provider-gated runtime capabilities (the runtime providers in
apps/dsh-edge/src/runtime-provider.ts, such as the command-execution backend) and each provider's Cloudflare plan requirement. A capability that only some providers offer must be absent, not broken, where its provider is unavailable. - Preserve Durable Object class names, bindings, session/event formats, workspace/VFS state, owner authentication, and public HTTP/WebSocket behavior.
- Durable Object SQL queries on request-serving paths must not use correlated subqueries or per-row scans against unbounded tables. A correlated
EXISTSprobe is allowed when it is a single index seek that stops at the first match and the outer rows are bounded by aLIMITover an index range (for example, bounded background maintenance pages); state the bound and the measured rows read next to it. Pre-compute read-heavy aggregations in a materialized table maintained atomically at write time; never derive per-request summaries by scanning event or log history. - Never log
DSH_EDGE_ACCESS_KEY, bearer tokens, or owner cookies. Provider credentials persist only through the upstreamCredentialProviderseam in Durable Object storage; resolved values remain request-scoped in the LLM adapter and are never logged, cached across requests, or written to session events. - When registering a cordis sub-registry entry (e.g.
ctx.storage.backend.register(name, backend)), callctx.provide(key, value)if another plugin usesctx.inject([key])to wait for it. Sub-registryregister()methods only update internal Maps; they do not trigger cordis inject resolution. Usectx.effect()to pair registration withprovideand clean up on disposal. - Each Worker mode must stay within Cloudflare's 64 MiB uncompressed size limit (checked while bundling; there is no compressed-size limit) and within the startup budget that
apps/dsh-edge/scripts/check-startup.mjsmeasures against Cloudflare's 1 s startup CPU limit. Release tests must start the promoted prebuilt artifacts, not source entrypoints. - Every retained upstream patch needs a version-bound filename, a failing-without-the-patch check, a rationale, and a removal condition.
- The npm package, tag, GitHub Release, Container image tag, deployment identity, and documentation must report the same dsh-edge version.
apps/dsh-edge/package.jsonis the only release-version source. Test assertions and snapshot expectations derive the version and npm dist-tag channel at runtime; a version bump requires no other file changes. Private workspace manifests omitversionso they cannot imply a second product or upstream release identity.
Upstream baseline upgrades
An upstream-baseline PR changes dshEdge.upstreamVersion and both lockfiles, and also:
- Runs
pnpm run upstream-parity -- docs-diff <new-version>before changing code, and reviews every bucket of the report: added and removed subsystems, the changed catalogs (tools, configuration, persistence, session format), and subsystem pages for packages the Edge uses or replaces. Its last bucket lists the README and type-declaration changes of every package the Edge partly serves (edgeOwnedinapps/dsh-edge/upstream-parity.json), replaces (substitute), or patches: upstream changes there do not reach the Edge through the upgrade, so give each one a disposition against the Edge implementation. Record the disposition of each behavior change in the PR description. When a change makes the Edge serve part of a used package itself, or stop doing so, updateedgeOwned. - Runs
pnpm run upstream-parity -- refreshafter the version bump (setGITHUB_TOKENto avoid GitHub rate limits), then classifies every new reference entry untilpnpm run upstream-paritypasses. If upstream moves a reference composition, updateREFERENCE_SOURCESinscripts/upstream-parity.mjs. - Lists the wiki pages to add, update, or retire for the new subsystem set.
- Before the first release on the new baseline, builds the Workers and runs
node apps/dsh-edge/tests/upgrade-from-release.probe.mjswithDSH_EDGE_UPGRADE_FROMset to the latest published release. The probe upgrades state that release created through its real API in place and must pass; fixtures alone do not cover a released format. - In the same build, runs
node apps/dsh-edge/tests/row-cost.probe.mjswithDSH_EDGE_COST_FROMset to the same release. It replays one scripted conversation on both builds and compares, as the Workers runtime counts them, the SQL rows each turn writes and reads and the SQLite-backed KV and alarm write operations; plain turns must not exceed the release by more than 10 % in SQL rows written or in KV and alarm writes.
Durable Object database budgets
- Treat database cost as a correctness requirement in every path: normal requests, streaming, startup, migrations, cleanup, deletion, alarms, retries, recovery, and maintenance scripts. Successful SQL or correct final data alone does not prove a safe upgrade.
- The Workers Free SQLite allowance is currently 100,000 rows written and 5 million rows read per account per day, resetting at 00:00 UTC. Verify current Cloudflare pricing before operational changes; leave room for existing account usage. Never assume a deployment, transaction rollback, or point-in-time restore refunds consumed quota.
- Count affected rows, not SQL calls or final database size. DELETE consumes row writes; INSERT/UPDATE, indexes, cascades, triggers, SQLite-backed KV operations, and setAlarm can add writes. Batching reduces call overhead but does not by itself reduce billed rows.
- Before changing a persistence path, estimate its cost at realistic retained-data volume and request frequency, including retries and repeated cold starts. For bulk operations or a changed write strategy, measure SqlStorageCursor.rowsWritten/rowsRead in the Cloudflare runtime with representative local data; Node SQLite changes counts alone are not billing evidence. Keep a focused regression test for the cost growth being prevented.
- Prefer bounded incremental writes, compact streaming records, and idempotent startup. Compare the total cost of copying, deleting, rebuilding, and updating summaries before choosing a migration. Preserve atomicity and existing logs; verify failure rollback and retry without repeatedly rewriting already migrated data. Do not assume DDL is free without measuring it in the target runtime.
- Never replay a large migration or destructive cleanup against production just to benchmark it. Validate locally first; preserve a recovery point for authorized production recovery, and account for quota already consumed. If the remaining budget is unknown or insufficient, report that limitation instead of claiming an unconditional safe upgrade or silently switching to a paid plan.
Memory budget
- A Worker isolate, and a Durable Object with it, has 128 MB. Never read content of unbounded size into memory at once: uploads, attachments, file reads, session logs and exports, command output, and spills stream end to end. Write large bytes to R2 (or bounded Durable Object chunks) as they arrive, read them back as ranged streams, keep only a bounded tail or page in memory, and cap whatever must be buffered (a base64 Remote upload, an image to decode).
- Do not decode large images in the Worker (an 8192×8192 RGBA bitmap alone is 256 MiB); transform them through the Cloudflare Images binding or refuse them with a clear limit.
- State the peak memory of a new large-content path in its PR and measure it with input sizes well above the expected ones, as the paged session log export did (#328).
Change discipline
- Prefer the smallest Edge-owned adapter over reimplementing an upstream capability.
- Add focused unit coverage for local behavior and update the dual-mode integration or browser snapshots when a user-visible or durable path changes.
- Update English and Chinese documents together, then run
pnpm run doc-pairs -- --write. Both languages carry equal authority. - Keep
AGENTS.mdas the full source of truth.CLAUDE.mdmust remain a real file that directs Claude Code to this file. - Files end with exactly one newline;
git diff --checkmust pass.
Review and publication
Use .agents/skills/dsh-pre-push-checks/SKILL.md before a push and .agents/skills/codex-review-loop/SKILL.md after opening or updating a PR. Review findings are technical claims: fix valid in-scope problems, rebut stale or incorrect claims with evidence, and ask the user only when a choice changes product, security, durable data, or public API behavior, or when a problem family recurs a third time.
Review rounds are convergence checkpoints, not a fixed retry budget. On repeated problem families, audit all affected callers and replace local patches with one invariant-preserving repair. Stop only for genuine scope decisions, a problem family's third occurrence, or non-convergence. Never merge automatically.
Review scope for runtime compatibility (routing, shells, and the container): a finding needs a code change only when it shows a wrong result in a workflow a coding agent realistically runs; routing findings must reproduce in the Container integration's differential routing corpus. Compatibility findings that depend on exotic preconditions (symlinks pointing outside /workspace, state only another runtime can create, deliberately contorted command spellings) are P3: document them as limitations instead of adding code. This gate never applies to security, authentication, credential, or durable-data findings, which stay actionable whatever input reaches them, hostile requests included. A PR states its scope in its description, and review replies cite it. Keep code simple over closing exotic compatibility cases.
Release procedure
Every version published to npm must also have a matching GitHub Release and git tag. Skipping any step breaks the same-version invariant in "Runtime and release invariants".
- Write bilingual release notes: create
docs/releases/<version>.md,docs/releases/<version>.zh.md, and their.i18n.yamlpairing record, then runpnpm run doc-pairs -- --write. - Merge the release PR to main (squash merge).
- Pull main and verify
apps/dsh-edge/package.jsonversion matches the intended release. - Create and push a git tag:
git tag dsh-edge-v<version> && git push origin dsh-edge-v<version>. - The tag push triggers
release-edge.ymlwhich automatically builds, verifies, publishes to npm (trusted publishing), and creates the GitHub Release. Itspublish-imagejob first pushesdocker.io/pawaca/dsh-edge-computer:<version>(once; a rerun reuses the published image), and npm publication waits for it. - Verify:
npm view dsh-edge@<version>,gh release view dsh-edge-v<version>, andhttps://hub.docker.com/v2/repositories/pawaca/dsh-edge-computer/tags/<version>all resolve; record the image digest.
The workflow can also be triggered manually via request-release.yml (workflow_dispatch) or repository_dispatch as a fallback. Prerelease versions (containing -) are published to the next npm dist-tag and marked as GitHub prerelease.
Use .agents/skills/dsh-release/SKILL.md to run a release: it holds the preflight checks, the failure-handling table, and the verification commands.
Container image
- Every release publishes
docker.io/pawaca/dsh-edge-computer:<version>fromapps/dsh-edge/container/Dockerfile; no separate image release step exists. TheDOCKERHUB_USERNAMEandDOCKERHUB_TOKENrepository secrets must be valid. An expired token failspublish-imageat login, before anything is published; replace the secret and rerun the same tag throughrequest-release.yml. - An image tag is pushed once.
publish-imagepushes only after Docker Hub answers 404 for the tag, reuses an existing tag on rerun, and fails on any other lookup result. Never overwrite, delete, or hand-push a release tag; fix a bad image by releasing a new version. - The Dockerfile pins its computerd and Debian bases by digest, so base images never change silently. Refresh them in a reviewed PR;
edge / container imagemust pass, andpnpm --filter dsh-edge run test:containermust pass locally with a Docker engine. - A computerd upgrade changes the Dockerfile base, both
@cloudflare/computerpins (app and standalone), the lockfiles, and the third-party notices in one PR (see the wire-protocol invariant above). - If
publishfails afterpublish-imagesucceeded, npm is not published and the image tag is orphaned but harmless (no package references it). Release the fix as a new version.
Stage, commit, push, PR creation, review replies, thread resolution, releases, tags, npm publication, and Cloudflare deployment require the corresponding user authorization.
Git and worktree hygiene
- The primary checkout stays on
main. Use it only for pulling, global builds, and small documentation edits that do not need a PR. - All feature, fix, and release work happens in an isolated worktree:
mkdir -p ../dsh-edge-worktrees
git worktree add ../dsh-edge-worktrees/<slug> -b <branch> main
cd ../dsh-edge-worktrees/<slug>
pnpm install
pnpm --dir apps/dsh-edge/standalone install --frozen-lockfile- After a PR is merged, clean up completely — worktree directory, local branch, and remote branch:
cd /path/to/dsh-edge # return to primary checkout
git worktree remove ../dsh-edge-worktrees/<slug> # 1. remove worktree
git branch -D <branch> # 2. delete local branch (-D for squash-merged PRs)
git push origin --delete <branch> # 3. delete remote branch (skip if GitHub auto-delete is on)
git pull # 4. sync main- Automated tools may create their own worktrees. If not auto-cleaned, verify the worktree is clean or its PR was merged before removing. Unlock if locked:
git worktree unlock <path>, thengit worktree remove <path>. - Before starting a new iteration, verify a clean state:
git worktree listshows only the primary checkout,git branch --show-currentreturnsmain, andgit branchlists onlymain.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

