Content Is Never Authority: Reading dsh-superagent as an Architect
A repository filed as a research sketch turns out to be 25,000 lines of designed system. One idea in it is worth more than the rest combined: the model may propose, but it may never grant itself permission.
What it actually is
deepseek-ai/dsh-superagent-prototype is easy to dismiss. Its README calls it a research prototype, not an official product, warns that it may contain bugs, and says much of the engineering was done by coding agents. It carries 23,817 stars, was created on 31 October, has issues disabled, and has not been pushed since 3 November. Every signal says “sketch”.
Then you clone it. There are 25,388 lines of TypeScript under src/, spread across a domain layer, an engine, a policy module, an executor and a plugin registry. There are nine numbered design documents totalling 2,052 lines, sixteen prompt files, and two skills. There is a 617-line architecture guide that maps every concept to the class that implements it.
And there is a sentence in docs/002-authorization.md that is worth the clone on its own:
“The host enforces allowed lists, rules and Mandates. Messages, comments and quoted documents are inputs to a decision; they cannot change those permissions.”
That is the design. Everything else is consequence.
The invariant: content is not authority
Most agent systems grant authority implicitly, through context. If a string reached the model, the model may act on it. That single decision is what turns prompt injection from an annoyance into an execution primitive: the attacker does not need to break authentication, because the agent's authority was never separate from the text it read.
This system separates them structurally. Content flows in through Sources — GitHub and Feishu — into Threads. Authority is minted only by a gate, and only as a Mandate. The model sees the content and produces a proposal; it cannot produce permission. The gate is ordinary application code that the model cannot address.
The distinction is not philosophical. It means the security boundary is drawn where it can be enforced — in the host — rather than where it can only be asserted — in a system prompt.
A Mandate records why, so it can be revoked
Each Mandate carries a basis recording how the gate admitted the work:
via | Admission basis |
|---|---|
addressed | An allowed sender addressed the agent |
followup | A message arrived on a Thread that already has Tickets |
admission | An admission-table cell; observation marks an inferred candidate |
bot | A listed bot produced an inferred candidate |
Two methods make the record useful rather than decorative. Policy.revalidate(mandate) re-checks whether an existing Mandate still holds — so authority is not a one-time grant that silently outlives its justification. And Engine.policyChanged(from, to, effects) notifies only the live Tickets a change actually bears on, using policyEffects to identify them, while policyVersion hashes the rules, accept mode and the Sources' policy parts including bot lists.
The admission table is part of that version. Weakening a cell does not immediately stop open Tickets accepted under it, but it can revoke their Mandates when they are revalidated before resuming.
The pattern worth taking: authority should be a record with provenance, not a boolean computed at call time. If you cannot answer “why was this agent allowed to do that”, you can neither audit it nor revoke it selectively.
Two channels, with different capabilities
The system has two paths for an incoming event, and they are deliberately not equivalent.
The Eval path decides whether work starts at all. The gate checks the sender and the Source's policy and returns a strength. Only explicit admission can create a Ticket and a Mandate.
The Subscription path continues work that already exists. Every message on a subscribed Thread reaches its subscribed Tickets — but the documentation is explicit: this delivery “bypasses the gate and grants no new authority. Each Ticket remains limited by its Mandate.”
There is a weaker third channel, too. A context-only subscription lets an Executor follow a related Thread: its messages reach the Ticket but “grant no authority or follow-up strength”, and a human message there does not resume an ended Ticket.
Most event-driven agent designs collapse these into one bus, where “an event arrived” implies “the agent may act”. Here the read-only channel exists as a first-class capability, with its own limits written down.
Strength is three-valued, and bots have a ceiling
Admission returns explicit, inferred or not admitted. The middle value is the interesting one, because that is where most real policy lives: allowed to propose, not to act.
An inferred candidate normally requires a full assessment before it becomes work. There is exactly one shortcut — if the candidate's card clearly touches no enabled rule, such as plain chat, the main Session may ignore it directly, recording ignoredFromCard to distinguish that from a rule-based assessment.
The admission table is per-Source, with rows as receiving scopes — Feishu chats and direct messages, GitHub issues, pull requests, comments and default-branch CI — and up to three cells per row: on-list/not-addressing, not-on-list/addressing, not-on-list/not-addressing. A CI result has no sender, so its row offers only the last cell. Setting the unlisted-addressed cell to explicit makes a dedicated support channel work without giving every participant implicit authority.
Bots are capped in the type system rather than asked nicely in a prompt. The host recognises GitHub Apps, logins ending in [bot], and Feishu bots. A Source may list one whose messages become inferred candidates — never explicit requests, and they “cannot make explicit requests or stop Tickets”.
One owner per message
Conversational systems rot when two components believe they own the same message. This one makes ownership a checked property.
A person's message on a Ticket's own Thread belongs to that Ticket's Executor to decide. While the Executor owns it, the main Session “may only stop work on the person's request; accept, attach, ignore and requeue are refused”. An Executor hands a message back at most once, with a reason, when it wants work beyond the scope or the message belongs elsewhere — and the Ticket keeps its Subscription.
When a Ticket ends, unread messages that were never acknowledged, answered or handed back return to Eval for a fresh decision, provided no other Ticket owns them. The message that stopped a Ticket is not re-evaluated, so a stop cannot loop.
That is distributed-systems discipline applied to conversation: single writer, explicit hand-off, idempotent release, and a terminal state with defined semantics.
The engine writes; the queue acts afterwards
The Engine is “the only writer of Triggers, Threads, Decisions, Tickets and Assignments”. Its methods are synchronous, and each command changes its aggregates in a single transaction. Callers do not get the Engine; they get a Pick scoped to their role — EngineForSources, EngineForMainSession, EngineForPeople, EngineForSettings, EngineForExecutor. Capability-based design, inside one process.
Side effects are not performed inline. Effects is a durable queue, and a command enqueues work inside its transaction; execution begins only after commit. One row per kind and key; re-enqueuing the same waiting key replaces the payload and makes it due immediately without changing queue order.
The per-kind configuration is the most stealable table in the repository:
| Kind | Concurrency while running | Retry |
|---|---|---|
assessment | 4 | 2 s doubling to 60 s |
launch | free worker slots | provider/network: 5 s doubling to 300 s, three times; anything else fails the Ticket |
delivery | 4 | 2 s doubling to 60 s |
relay | 1, in order | 2 s doubling to 60 s |
notice | 1, in order | 2 s doubling to 60 s |
reply | 1 | 5 s doubling to 300 s |
Two details make it work in practice. Throwing a Later defers work without counting a failure, which is what you want when the reason is “no worker slot free” rather than “something is wrong”. And each kind has its own health entry that reports after three consecutive failures — except delivery, whose failures surface on the Ticket instead, where the operator will actually look.
Attention is the resource being scheduled
This is the part almost every agent platform omits.
waitsForPerson is a shared predicate: the latest Assignment reported blocked or failed and no human message has arrived since. While it holds, automatic inputs and failed launches are held. The system will not pile machine work onto a Ticket that is waiting for a human.
followupOwners tracks which Tickets are still responsible for a human follow-up; while one exists, the main Session may only stop work.
And then the scheduler trick: the concurrency limit applies to worker slots, “with one extra slot for a person's message or a status request… New work therefore cannot prevent a person from continuing an existing Ticket.”
Background work is accounted for honestly. A turn that ends with shell jobs or subagents still running keeps its worker slot and stays working; shell jobs are capped at thirty minutes after the turn, with subagents allowed to continue. Hand-off to a person frees the slot immediately.
The scarce resource in these systems is not CPU. It is the attention of the one person who has to answer. Reserving a slot for them is a small decision with an outsized effect, and it is the difference between a queue that drains and one that deadlocks behind its own enthusiasm.
State is derived, so it cannot drift
Each open Ticket has exactly one stage, computed by reading a table top to bottom and taking the first match: person/delivery → person/answer → person/review → person/blocked|failed → working/queued → idle → working. ticketStage implements it as a function over facts: the latest Assignment, the latest Report, any failed delivery, whether an Attention is open.
There is no stored stage column to repair after a crash, because there is no stored stage. Recovery is correct by construction — the projection simply recomputes — and no sequence of failures can leave a Ticket in an impossible state.
What it refuses to pretend
The candour is why I take the design seriously. It names its own limits:
- “These wrappers and directories establish defaults, not a security boundary. A worker can still execute a program by absolute path.”
- Auto-merge is prompt-governed: “The host has no merge-specific decision logic.” By default the Executor never enables auto-merge, because GitHub attributes a merge to whoever enabled it. Enforcement belongs in branch protection, not in instructions.
- An automated reviewer using an ordinary account “counts as a person to the host” — a real gap, stated.
- Sessions run commands without approval as the operator's OS user.
That last cluster is the honest position for a prototype: enforce identity and authority in the application, put isolation where it can actually be enforced, and do not pretend a prompt is a sandbox.
What to take from it
- Move the permission decision outside the model and make it a record. A Mandate with a basis is auditable and revocable; a boolean inside the agent is neither.
- Keep context and authority on separate channels. One bus that implies “may act” is how injection becomes execution.
- Make strength three-valued. Explicit, inferred, not-admitted lets automated sources propose without making them principals.
- Enqueue side effects inside the transaction, then let a durable queue act. Per-kind concurrency and backoff beat one global job queue.
- Derive your state machine from facts rather than storing it.
- Schedule attention, not just work. One reserved slot for humans prevents the failure mode where the agent is busy and the person is waiting.
None of these require a research prototype to adopt. They are ordinary engineering decisions that most agent systems skip because the demo works without them.
Limits
It is a research prototype and says so. Some designs described in the accompanying article are explicitly not implemented. I read the code and the design documents and did not run the system, so I make no operational claims. And a correction to my own previous piece: I described this repository as 37 KB on the strength of the GitHub API size field. Whatever that field measures, it is not code volume — the working tree is 25,388 lines of TypeScript and a shallow clone is about 4 MB. The star-and-bytes framing was a bad proxy, and cloning it was the only way to find that out.
Put the Permission Decision Outside the Model
Elatify builds agent workforces with an authority record behind every action, so a decision can be audited and a grant can be revoked. Ask us to walk your next architecture review through it, or scope the work with an AI Kickstarter.
