[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116463":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":13,"stars30d":13,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":32,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},116463,"dsh-super-agent","LofiSu\u002Fdsh-super-agent","LofiSu","Open-source DeepSeek Super-agent style multi-agent framework with a thin harness — Router\u002FWorker, triggers, Watchdog (not an official DeepSeek product).","",null,"TypeScript",152,19,60,1,0,3,13,61.3,"MIT License",false,"main",[24,25,26,27,28,29,30,31],"agent-framework","ai-agent","deepseek","multi-agent","openai-compatible","super-agent","typescript","watchdog","2026-11-22 04:33:27","2026-11-23 14:12:23","\u003Cdiv align=\"center\">\n  \u003Cimg src=\"docs\u002Fassets\u002Fds-agent-banner.png\" alt=\"dsh-super-agent banner\" width=\"100%\" \u002F>\n\u003C\u002Fdiv>\n\n# 🤖 dsh-super-agent\n\nEnglish | [简体中文](README.zh-CN.md)\n\n[![TypeScript](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTypeScript-5.9%2B-3178C6?logo=typescript&logoColor=white)](.\u002Fpackage.json)\n[![Node.js](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNode.js-22%2B-339933?logo=node.js&logoColor=white)](.\u002Fpackage.json)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](.\u002FLICENSE)\n\nA demo inspired by a DeepSeek blog post I read at the time.\n\nA thin async ReAct runtime at the bottom. A proactive domain engine on top:\n**Router \u002F Worker**, **Triggers**, **Threads**, **Eval**, **Tickets**, **Assignments**, and a **Watchdog**.\n\n[Documentation](docs\u002Findex.md) · [Quick start](#quick-start) · [Core features](#core-features) · [Architecture](#architecture) · [Safety](docs\u002Fsafety.md) · [Modules](docs\u002FMODULES.md) · [Demo](#demo-real-channels)\n\n> [!NOTE]\n> Not an official DeepSeek project or a complete product; I iterate on it when I can.\n\n---\n\n## Table of Contents\n\n- [One-line setup for coding agents](#one-line-setup-for-coding-agents)\n- [Quick start](#quick-start)\n- [What this is](#what-this-is)\n- [Core features](#core-features)\n  - [Proactive by construction](#proactive-by-construction)\n  - [Two roles, one sequence point](#two-roles-one-sequence-point)\n  - [Context that scales](#context-that-scales)\n  - [Work that outlives a turn](#work-that-outlives-a-turn)\n  - [The owner stays in control](#the-owner-stays-in-control)\n  - [Channels](#channels)\n  - [Sandboxed execution](#sandboxed-execution)\n  - [Observability](#observability)\n  - [Extension domains](#extension-domains)\n- [Architecture](#architecture)\n- [Configuration](#configuration)\n  - [Models](#models)\n  - [Runtime settings](#runtime-settings)\n  - [MCP servers](#mcp-servers)\n- [Demo (real channels)](#demo-real-channels)\n- [Safety and deployment](#safety-and-deployment)\n- [Status](#status)\n- [Documentation](#documentation)\n- [Credits](#credits)\n- [License](#license)\n\n## One-line setup for coding agents\n\nIf you use Claude Code, Codex, Cursor, or another coding agent, hand it this sentence:\n\n```text\nClone https:\u002F\u002Fgithub.com\u002FLofiSu\u002Fdsh-super-agent, run pnpm install, then run\npnpm typecheck and pnpm lint. Read README.md and docs\u002Finstall.md. Stop before\npnpm test or pnpm demo so I can supply model credentials and a writable GitHub repo.\n```\n\nThe agent should stop with the exact commands you still need to run, rather than guessing a provider or writing to a repository on your behalf.\n\n## Quick start\n\nRequires **Node.js 22+** (the store uses `node:sqlite`) and [pnpm](https:\u002F\u002Fpnpm.io\u002F).\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FLofiSu\u002Fdsh-super-agent.git\ncd dsh-super-agent\npnpm install\n\npnpm typecheck\npnpm lint\n```\n\nThe repository is not published to npm. `package.json` keeps a `build` script and a `bin` entry for packaging, but day-to-day use is `pnpm ds-agent ...` from the checkout.\n\n### Configure a model\n\n`ds-agent` speaks any OpenAI-compatible API. Point it at DeepSeek directly:\n\n```bash\nexport DS_AGENT_API_BASE=https:\u002F\u002Fapi.deepseek.com\nexport DS_AGENT_API_KEY=sk-...\nexport DS_AGENT_API_MODEL=deepseek-flash\n```\n\nOr set a single provider key and let the presets fill in the base URL and default model (see [Models](#models)). A half-set `DS_AGENT_API_BASE` \u002F `DS_AGENT_API_KEY` pair fails instead of falling back silently.\n\n### Run it\n\n```bash\npnpm ds-agent init                              # create the SQLite store in .\u002F.ds-agent\npnpm ds-agent chat \"fix the login timeout\"\npnpm ds-agent tasks                             # tickets and their stage\npnpm ds-agent panel                             # Panel · Execution\n```\n\nState lives in `DS_AGENT_HOME`, or in `.\u002F.ds-agent` when unset. `pnpm ds-agent serve` runs the daemon and Watchdog timer over persisted state; it starts no inbound channel loop. To inspect the read model in a browser:\n\n```bash\nDS_AGENT_UI_TOKEN=\"$(openssl rand -hex 16)\" pnpm ds-agent ui\n```\n\nThe dashboard is read-only, binds to loopback, and requires a token of at least 16 characters. See [docs\u002FUI.md](docs\u002FUI.md).\n\n### Tests and the live demo\n\n`pnpm test` and `pnpm demo` use a live model; MockModel is forbidden on those paths. If `DS_AGENT_API_*` is unset, the `test` script fills a local Magpie default (`http:\u002F\u002F127.0.0.1:3425\u002Fv1`, key `magpie`, model `workbuddy\u002Fdeepseek-v4.1-flash`), so it needs that gateway running. For a no-key fixture run, use:\n\n```bash\npnpm test:coverage     # offline fixture suite; no model key required\n```\n\n`pnpm demo` is the real-channel acceptance path. It needs `gh` auth and creates real GitHub issues and comments in `DS_AGENT_GH_REPO`:\n\n```bash\ngh auth login\nexport DS_AGENT_GH_REPO=your-account\u002Fyour-writable-repo\npnpm demo\n```\n\nRead [Demo (real channels)](#demo-real-channels) before running it.\n\n## What this is\n\nMost agent frameworks give you a loop: messages in, tool calls out, repeat. That loop is necessary, but it is not an operating model. A personal agent also needs to notice inbound work, decide what matters, keep state across restarts, run long jobs without blocking the conversation, and recover when something gets stuck.\n\nThis repository implements that operating model in two layers:\n\n- **Harness.** A session event log, an async ReAct loop, OpenAI-compatible model calls, tools registered by role, and a daemon.\n- **Engine.** Intake → Eval (Gate + Assessment) → Mandate\u002FTicket → Assignment → Outbox. Domain writes stay in the Engine.\n\nThe Router is the sequence point: it talks to people, batches triggers, and dispatches work. Workers execute in isolated sessions. Triggers drive the loop. The Watchdog lives outside the control path and nudges or fails stuck work.\n\n## Core features\n\n### Proactive by construction\n\nChannels emit semi-structured **Triggers** into Ingress. A deterministic **Fast Path** applies source and noise rules; an optional model-based **Slow Path** (`DS_AGENT_SLOW_PATH=model`) refines the decision, with a deterministic rule fallback on timeout, error, or invalid output. The default is rules-only.\n\nEach topic or pull request becomes a **Thread**. The Router batches triggers waiting on the same Thread, **Eval** separates noise from actionable work, and actionable input becomes a **Ticket** and an **Assignment**. A speculative Assignment can start before delivery, and a **deliver gate** drops results that are not worth sending. Restarts resume from SQLite; the demo includes a restart check.\n\n### Two roles, one sequence point\n\n- **Router** keeps continuity, talks to the owner, and dispatches. It stays light and can run a smaller model.\n- **Worker** executes alone with the full tool set, in its own session.\n- Workers report upward. A Worker session holds `WorkerPorts`, not the Engine, so it cannot `reply` or `decide`; only the Router writes to a channel.\n- A Thread that already has a Worker is served directly (`bypass=subscription`), skipping Router Eval.\n- A Worker can spawn a **team**: async member jobs report `TEAM_MEMBER_DONE` and the parent aggregates one report. Team rows persist in SQLite and are inspectable offline with `ds-agent team` \u002F `ds-agent teams`.\n- A Worker can delegate one self-contained task to a configured local CLI agent — Claude Code, Codex, OpenCode, Hermes, or a custom command — through `delegate_agent`. There is no shell, the cwd is the Worker workspace, and timeout, output size, and environment are bounded. See [docs\u002FLOCAL_AGENTS.md](docs\u002FLOCAL_AGENTS.md).\n\n### Context that scales\n\nShort summaries stay inline. Long content is **spilled** out of band with an id, and tools receive typed `kind:id` handles first. `read_object` expands one hop at a time, which gives the model a **Chain of Recall** instead of a context dump. See [docs\u002FMODULES.md](docs\u002FMODULES.md).\n\nLong-term memory keeps hot tickets and Router decisions (1000 entries \u002F 90 days) plus cold Thread digests (200 \u002F 3650 days). Recall is hybrid: lexical search, one tag hop, and an optional `EmbeddingPort`. The default offline `HashedEmbedding` works without a model; `DS_AGENT_SEMANTIC_RECALL=0` disables the semantic arm, and `DS_AGENT_EMBEDDING_FLOOR` sets its cosine floor (default `0.35`, clamped to 0–1). Month-scale behavior is not yet measured, so T48 stays partial; the dated measurement protocol and its offline fixture smoke are in [docs\u002FT48_MONTH_SCALE_PROTOCOL.md](docs\u002FT48_MONTH_SCALE_PROTOCOL.md).\n\n### Work that outlives a turn\n\n`start_job` returns `{status:'started', jobId}` immediately and ends the turn. The harness enqueues the next turn when the job finishes as a `JOB_DONE` prompt, and the foreground keeps accepting new input meanwhile. This is async ReAct, not a long-blocking tool call.\n\nFor mid-task collaboration, the CLI exposes `pause`, `intervene`, `resume`, and `collab`, backed by a durable `Ticket.collaboration`. The harness and Watchdog honor a pause.\n\n### The owner stays in control\n\n- **Approvals.** A Worker can call `request_approval` with an exact outward action instead of performing it. The ticket holds; the Router asks; `ds-agent approve` \u002F `ds-agent deny` records the decision and resumes through the normal path. The model may request, never decide, and chat text is not consent. See [docs\u002FAPPROVALS.md](docs\u002FAPPROVALS.md).\n- **Routines.** `routines.json` schedules a prompt every N minutes, or once per UTC day at a chosen time and weekdays, on a chosen channel and thread. The daemon fires a missed slot once after a gap, not per missed interval. Routines pass through normal ingress and rules; the model cannot create or edit one. See [docs\u002FROUTINES.md](docs\u002FROUTINES.md).\n- **Skills.** An owner-authored `skills\u002F\u003Cid>\u002FSKILL.md` adds a playbook without a code change. The prompt carries only an id and description index (capped at 2000 characters); `read_skill` loads the body on demand. A skill cannot grant a tool or widen a role. See [docs\u002FSKILLS.md](docs\u002FSKILLS.md).\n- **Prompt architecture.** One stable system prompt composed from 33 ordered sections, plus nine owner-written runtime files: `SOUL.md`, `IDENTITY.md`, `USER.md`, `INSTRUCTIONS.md`, `AGENTS.md`, `MEMORY.md`, `TOOLS.md`, `HEARTBEAT.md`, and `PROACTIVE_PREFERENCES.md`. `SOUL.md` is optional: a built-in default voice always renders. Core file sections always fit; optional ones are omitted whole under the 20,000-character budget, and each file is capped at 4,000 characters. `PERSONA.md` still loads as a deprecated soul fallback. `ds-agent prompt --layers` shows every section and its source. See [docs\u002FPROMPTS.md](docs\u002FPROMPTS.md).\n\n### Channels\n\nCLI, GitHub-style sources, Feishu, iMessage, A2A, and a local OpenAI-compatible gateway.\n\n- **GitHub** uses the machine's `gh` login. The real demo creates and reads issues and posts comments through `gh api`.\n- **Feishu** polls exactly one chat per process, stores its cursor in SQLite, and never sends during preflight. Inbound delivery is polling only; webhooks and long-connection delivery are not implemented. See [docs\u002FREAL_CHANNELS.md](docs\u002FREAL_CHANNELS.md).\n- **iMessage** is a two-way channel for a dedicated Apple ID: inbound reads `~\u002FLibrary\u002FMessages\u002Fchat.db` read-only (`is_from_me = 0` only), outbound goes through Messages.app via `osascript`. It needs macOS Full Disk Access and Automation permission. See [docs\u002FIMESSAGE.md](docs\u002FIMESSAGE.md).\n- `serve --imessage --feishu` runs both inbound loops over one Runtime and SQLite store. Both configurations are validated before startup; a missing item fails before any network or database access.\n- Run `ds-agent channels check` first. It needs no model, opens no SQLite, and sends nothing.\n\n### Sandboxed execution\n\nEvery Worker `bash` call is wrapped: `sandbox-exec` on macOS, `bwrap` on Linux. A missing wrapper is a hard error; there is no plain-bash fallback. By default the wrapper confines writes to the workspace and denies network unless the policy allows it. The child gets an allowlisted environment, secret-named values are redacted, and `FileVault.describe()` returns names only.\n\n> [!WARNING]\n> The default wrapper confines writes and network, but **not reads**. On macOS `file-read*` is broad and on Linux the wrapper uses `--ro-bind \u002F \u002F`, so a Worker can still read `\u003CstateDir>\u002Fds-agent.db`. Set `DS_AGENT_SANDBOX_READ_ISOLATION=1` (or `true` \u002F `strict`) to opt into strict read confinement, or put the process in a container. Host vault and seccomp policy remain external. Details: [docs\u002Fsafety.md](docs\u002Fsafety.md).\n\n### Observability\n\n- `ds-agent tasks` — tickets and their stage.\n- `ds-agent panel` — Panel · Execution, with Mandate, Executor Session, directory, report, and Outbox delivery counts.\n- `ds-agent health` — store, vault mode, machines, Watchdog.\n- `ds-agent metrics` — counters for ingress, Eval, bypass fan-out, speculative deliver\u002Fdiscard, Watchdog nudge\u002Ffail, and model latency.\n- `ds-agent memory` — recent long-term memory entries.\n- `ds-agent ui` — read-only, token-gated loopback dashboard with tickets, threads, Outbox metadata, health, metrics, and sanitized lifecycle events.\n\n### Extension domains\n\nThese services are always constructed by `Runtime.create`; there is no opt-in feature flag. They live inside their owning M module:\n\n- **Router shards** (`DS_AGENT_SHARDS`, `RuntimeOptions.routerShards`) — the default shard always exists.\n- **Worker mesh** (`DS_AGENT_MESH_CAPACITY`, `DS_AGENT_MESH_QUEUE`) — logical placement by least-loaded node, with a bounded FIFO wait queue.\n- **Long-term memory** — hot tickets, decisions, and cold Thread digests.\n- **Lifecycle events** — a read model for panels and CLI views.\n- **A2A** (`DS_AGENT_INSTANCE_ID`) — authenticated HMAC-SHA256 HTTP transport.\n\nSee [docs\u002FMODULES.md](docs\u002FMODULES.md) for the full reference.\n\n## Architecture\n\nA Channel enters Ingress, then the Engine. The Engine routes and batches, then runs Thread → Eval → Ticket → Assignment. The Harness runs the Worker Session. Store and Env sit underneath. The Watchdog stays outside that path.\n\n```mermaid\nflowchart TB\n  subgraph Channels[\"Channel\"]\n    C1[\"CLI \u002F Feishu IM \u002F GitHub (real adapters)\"]\n  end\n\n  subgraph Ingress[\"Ingress\"]\n    Fast[Fast Path]\n    Slow[Slow Path]\n    Fast --> TK[Thread key]\n    Slow --> TK\n  end\n\n  subgraph Engine[\"Engine\"]\n    Intake[Intake \u002F routing + batching]\n    Thread[Thread]\n    Eval[Eval]\n    Ticket[Ticket]\n    Assign[Assignment]\n    Intake --> Thread --> Eval\n    Eval -->|actionable| Ticket --> Assign\n    Eval -->|noise| Drop[drop \u002F archive]\n  end\n\n  subgraph Harness[\"Harness\"]\n    Sess[Session · async ReAct · model · tools]\n    Worker[Worker]\n    Assign --> Worker\n    Worker --> Sess\n  end\n\n  subgraph Bottom[\"Foundation\"]\n    Store[(Store · SQLite + Spill)]\n    Env[Env · LocalEnv \u002F daemon]\n  end\n\n  WD[Watchdog]\n\n  C1 --> Fast\n  C1 --> Slow\n  TK --> Intake\n  Sess --> Store\n  Sess --> Env\n  Worker -.->|report| Intake\n  WD -.-> Worker\n```\n\nText flow:\n\n```text\nChannel ──► Ingress (Fast\u002FSlow → Thread key)\n              │\n              ▼\n           Engine.receive\n              │  routing \u002F batching\n              ▼\n           Thread ──► Eval ──► Ticket ──► Assignment\n                         │                    │\n                         └─ drop              ▼\n                                        Harness Worker\n                                              │\n                    Store ◄───────────────────┤\n                    Env   ◄───────────────────┘\n                              Watchdog → stuck Workers\n```\n\nA subscribed Thread uses `bypass=subscription`. It skips Router Eval and goes straight to the Worker already on that Thread.\n\n| Layer | Job |\n|-------|-----|\n| Channel | inbound adapters, outbound shape |\n| Ingress | Fast \u002F Slow Path → Thread key |\n| Engine | routing and batching, Thread, Eval, Ticket, Assignment |\n| Harness | session, async ReAct, model, tools, daemon |\n| Store | SQLite, Spill, `read_object` |\n| Env | sandbox directory and process |\n| Watchdog | stuck Workers |\n\n## Configuration\n\n### Models\n\nBoth `DS_AGENT_API_BASE` and `DS_AGENT_API_KEY` win over the presets below. Omit the model and that pair sends `deepseek-chat`. For V4.1 Flash, set `deepseek-flash`.\n\n| Variable | Meaning |\n|----------|---------|\n| `DS_AGENT_API_BASE` | OpenAI-compatible base. DeepSeek: `https:\u002F\u002Fapi.deepseek.com`. Local Magpie: `http:\u002F\u002F127.0.0.1:3425\u002Fv1`. |\n| `DS_AGENT_API_KEY` | API key. On Magpie, this is the gateway token, not a DeepSeek key. |\n| `DS_AGENT_API_MODEL` | Model id. `deepseek-flash` is DeepSeek V4.1 Flash. On Magpie use `deepseek\u002Fdeepseek-flash`. |\n\nA provider key alone fills in the base and default model. The first matching row wins; `DS_AGENT_PROVIDER` picks one explicitly. Aliases: `xai` \u002F `grok`, `moonshot` \u002F `kimi`, `zhipu` \u002F `glm`, `gemini` \u002F `google`, `anthropic` \u002F `claude`.\n\n| Provider | Environment variable | OpenAI-compatible base | Default model |\n|----------|----------------------|------------------------|---------------|\n| DeepSeek | `DEEPSEEK_API_KEY` | `https:\u002F\u002Fapi.deepseek.com` | `deepseek-flash` |\n| OpenAI | `OPENAI_API_KEY` | `https:\u002F\u002Fapi.openai.com\u002Fv1` | `gpt-4o-mini` |\n| OpenRouter | `OPENROUTER_API_KEY` | `https:\u002F\u002Fopenrouter.ai\u002Fapi\u002Fv1` | `deepseek\u002Fdeepseek-chat` |\n| xAI \u002F Grok | `XAI_API_KEY` or `GROK_API_KEY` | `https:\u002F\u002Fapi.x.ai\u002Fv1` | `grok-4.7` |\n| Moonshot \u002F Kimi | `MOONSHOT_API_KEY` or `KIMI_API_KEY` | `https:\u002F\u002Fapi.moonshot.cn\u002Fv1` | `kimi-k3.1-pro` |\n| Zhipu \u002F GLM | `ZHIPU_API_KEY` or `GLM_API_KEY` | `https:\u002F\u002Fopen.bigmodel.cn\u002Fapi\u002Fpaas\u002Fv4` | `glm-5.3` |\n| Gemini | `GEMINI_API_KEY` or `GOOGLE_API_KEY` | `https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fopenai` | `gemini-3.8-flash` |\n| Anthropic | `ANTHROPIC_API_KEY` | `https:\u002F\u002Fapi.anthropic.com\u002Fv1` | `claude-opus-5-5` |\n\n`HttpOpenAI` posts to `{base}\u002Fchat\u002Fcompletions` with `Authorization: Bearer`. Moonshot's international base is `https:\u002F\u002Fapi.moonshot.ai\u002Fv1`; Zhipu's overseas base is `https:\u002F\u002Fapi.z.ai\u002Fapi\u002Fpaas\u002Fv4`. Set those with `DS_AGENT_API_BASE` and `DS_AGENT_API_KEY`.\n\nUse a small model for the Router and Watchdog and a stronger one for Workers. The table above configures one model for the process; role-level overrides come from `roleModelsFromEnv`.\n\n### Runtime settings\n\n| Variable | Default | Purpose |\n|----------|---------|---------|\n| `DS_AGENT_HOME` | `.\u002F.ds-agent` | State directory (SQLite, metrics, gateway token). |\n| `DS_AGENT_GH_REPO` | `LofiSu\u002Fdsh-super-agent` | Repository the GitHub demo writes to. |\n| `DS_AGENT_SLOW_PATH` | rules only | Set to `model` to enable the model-based ingress policy. |\n| `DS_AGENT_SHARDS` | one default shard | Router shard JSON. |\n| `DS_AGENT_MESH_CAPACITY` | in-process default | Maximum concurrent Worker nodes. |\n| `DS_AGENT_MESH_QUEUE` | `100` | Bounded FIFO wait list when every node is full. |\n| `DS_AGENT_INSTANCE_ID` | unset | Local A2A address and mesh node id. |\n| `DS_AGENT_SEMANTIC_RECALL` | on | Set to `0` to disable embedding recall. |\n| `DS_AGENT_EMBEDDING_FLOOR` | `0.35` | Cosine similarity floor for semantic recall, clamped to 0–1. |\n| `DS_AGENT_SANDBOX_READ_ISOLATION` | off | `1` \u002F `true` \u002F `strict` for strict read confinement. |\n| `DS_AGENT_UI_TOKEN` | unset | Bearer token for `ds-agent ui`, minimum 16 characters. |\n\n### MCP servers\n\nWorkers can call tools from external Model Context Protocol servers configured\nas data. The Router and the Watchdog never see them.\n\n```bash\nexport DS_AGENT_MCP_SERVERS='[\n  {\"name\":\"krene\",\"command\":\"\u002Fabsolute\u002Fpath\u002Fto\u002Fkrene-mcp\",\"args\":[\"serve\"],\"timeoutMs\":120000}\n]'\n```\n\n- `name` matches `[A-Za-z0-9_-]`, starts with a letter or digit, is at most 32\n  characters, is unique, and contains no `__` (that is the namespace\n  separator). `command` is a non-empty executable (`\u002Fabsolute\u002Fpath` is safest\n  because the child inherits the current working directory). `args` defaults\n  to `[]`, `env` to `{}`, and `timeoutMs` to `120000`.\n- Tools appear to Workers as `mcp__\u003Cserver>__\u003Ctool>`. Text stays text;\n  image\u002Fresource payloads are written to `\u003CDS_AGENT_HOME>\u002Fmcp\u002F\u003Cserver>\u002F` and\n  referenced by path. A result whose JSON text exceeds 65,536 characters\n  (UTF-16 code units) goes to spill and returns `{ spillId, bytes, preview }`;\n  `bytes` is the UTF-8 byte length of the spilled body.\n- The child process inherits only `PATH`, `HOME`, `LANG`, `TZ`, `HTTP_PROXY`,\n  `HTTPS_PROXY`, and `NO_PROXY`, plus the server's own `env`. On non-Windows\n  hosts the MCP SDK also adds its own safe defaults (`HOME`, `LOGNAME`, `PATH`,\n  `SHELL`, `TERM`, `USER`); on Windows it additionally inherits variables such\n  as `APPDATA`, `USERPROFILE`, and `PROGRAMFILES`. Put credentials in `env`,\n  not in your shell. Secret-named `env` values of at least 8 characters (for\n  example `KRENE_TOKEN`) join the redaction list; shorter values are left as-is.\n- Unreadable configuration is logged as\n  `[mcp] DS_AGENT_MCP_SERVERS ignored: ...` and ignored. A server whose\n  connection attempt rejects increments `mcp.connect_error` and is omitted. A\n  server still not connected when the shared listing deadline expires is\n  skipped with `reason=not-connected` and does not increment the counter. The\n  runtime and the other servers keep working.\n\n`RuntimeOptions.mcpServers` accepts the same array when embedding the runtime.\n\n## Demo (real channels)\n\n`pnpm demo` is the acceptance path and uses real channels only:\n\n| Scenario | Real inbound Source | Real outbound Outbox |\n|----------|---------------------|----------------------|\n| `01-parallel-github` | three real GitHub issues pulled via `gh api` | one issue comment per ticket |\n| `02-spill-github` | one real issue body + two real comments | Router replies as issue comments |\n| `03-watchdog-github` | one real issue pulled via `gh api` | acknowledgement issue comment |\n\nEach run creates fresh issues on `DS_AGENT_GH_REPO` (default `LofiSu\u002Fdsh-super-agent`), waits for the live model, posts real comments, then re-reads those comments from the GitHub API as proof. Logs and JSON proofs land in `\u002Ftmp\u002Fds-agent-live-e2e-logs\u002Fdemos\u002F`.\n\n```bash\nexport DS_AGENT_API_BASE=http:\u002F\u002F127.0.0.1:3425\u002Fv1\nexport DS_AGENT_API_KEY=magpie\nexport DS_AGENT_API_MODEL=workbuddy\u002Fdeepseek-v4.1-flash\nexport DS_AGENT_GH_REPO=LofiSu\u002Fdsh-super-agent\ngh auth login\n\npnpm demo                              # all three scenarios\npnpm demo -- --only watchdog           # one scenario\nDS_AGENT_GH_KEEP=1 pnpm demo           # keep the real issues open\n```\n\nClosing the issues is best-effort. The close runs after each scenario's main work; a failed close is ignored, and a throw or an early return before the close leaves issues open. Check afterwards for open issues labeled `ds-agent-demo`. `DS_AGENT_GH_KEEP=1` skips the close on purpose.\n\n`pnpm demo:local` runs the in-memory fixture baseline for channel smoke checks, not the acceptance path; it still uses a live model. `pnpm demo:feishu` exercises the real Feishu message API when `FEISHU_APP_ID`, `FEISHU_APP_SECRET`, and `FEISHU_CHAT_ID` are set. `pnpm test:live` runs the live-model tests when a key is already in the environment.\n\n## Safety and deployment\n\nThis is a local harness. With a model key it calls a model; with `gh` or Feishu configured, the Router can post outward. Treat it as a tool running with your credentials.\n\n- **Keys stay in the environment.** Never commit them or paste them into an issue or chat.\n- **The demo writes real data.** `pnpm demo` creates GitHub issues and comments in `DS_AGENT_GH_REPO`. Point it at a repository you can write to before running it.\n- **The UI is loopback-only** and requires a token. Keep `--host` on a loopback address unless you have added authentication and network controls in front of it.\n- **Outward actions can be held for approval.** Use `request_approval` in Worker instructions when an action is hard to reverse. The model cannot approve its own request.\n- **Sandbox limits are real.** Default confinement covers writes and network, not reads. Add strict read isolation or a container boundary for untrusted work.\n- **Only the Router speaks outward.** Workers report upward; they cannot write a channel directly.\n\nFull details: [docs\u002Fsafety.md](docs\u002Fsafety.md), [docs\u002FSECURITY.md](docs\u002FSECURITY.md), and the channel-specific pages.\n\n## Status\n\nThe core modules are implemented and covered by the test suite. The full task matrix is [PLAN.md](PLAN.md) (T01–T51); where the plan and the code diverge is recorded in [docs\u002FREVIEW.md](docs\u002FREVIEW.md).\n\n| Module | Scope | Status |\n|--------|-------|--------|\n| M0 shared | types \u002F ports | Shipped |\n| M1 Harness | §2 \u002F §4.1 \u002F §5 | Shipped |\n| M2 Store | §5.1 \u002F §3.3 Spill | Shipped |\n| M3 Engine | §2 \u002F §3 Eval, Ticket, Assignment | Shipped |\n| M4 Ingress | §3.1 | Shipped |\n| M5 Subscribe | §3.2 | Shipped |\n| M6 Memory | §3.3 | Shipped |\n| M7 Speculate | §3.4 | Shipped |\n| M8 Channels | §4.2 | Shipped |\n| M9 Env | §5.2 | Shipped |\n| M10 Watchdog | §6 | Shipped |\n| M11 CLI demo | acceptance script | Shipped — `pnpm demo` |\n\nPartial and owner-gated areas, stated plainly:\n\n- **Router scale-out** — the shard registry is always wired and the default shard exists, but there is no multi-process scale-out claim.\n- **Worker mesh** — placement is logical within this process; a remote transport exists, starts no listener, and is not yet connected to the local placement queue.\n- **Long-term memory** — hot\u002Fcold tiers and hybrid recall work; calendar-month behavior is bounded, not measured across real months.\n- **A2A** — HMAC-SHA256 HTTP transport is implemented; cross-host exposure and remote dispatch remain operator-gated.\n- **Watchdog drift checks** — nudge\u002Ffail, rules, and read-only `ds-agent health` work; deeper natural-language goal-drift checks are still thin.\n- **Latency bake-off** — one dated local dual-layer versus single-session run is recorded in [docs\u002FBAKEOFF.md](docs\u002FBAKEOFF.md); it is a single sample, not a benchmark.\n\n## Documentation\n\n| Page | What it covers |\n|------|----------------|\n| [docs\u002Findex.md](docs\u002Findex.md) | Documentation home. |\n| [docs\u002Finstall.md](docs\u002Finstall.md) | Install, model setup, first run. |\n| [docs\u002Farchitecture.md](docs\u002Farchitecture.md) | Architecture in prose. |\n| [docs\u002FMODULES.md](docs\u002FMODULES.md) | M0–M11 module reference. |\n| [docs\u002Fsafety.md](docs\u002Fsafety.md) | Keys, demo writes, tool text, sandbox limits. |\n| [docs\u002FSECURITY.md](docs\u002FSECURITY.md) | Security model and reporting. |\n| [docs\u002FREAL_CHANNELS.md](docs\u002FREAL_CHANNELS.md) | GitHub, Feishu, and channel setup. |\n| [docs\u002FGATEWAY.md](docs\u002FGATEWAY.md) | Local OpenAI-compatible gateway. |\n| [docs\u002FIMESSAGE.md](docs\u002FIMESSAGE.md) | macOS iMessage channel. |\n| [docs\u002FLOCAL_AGENTS.md](docs\u002FLOCAL_AGENTS.md) | Delegating to local CLI agents. |\n| [docs\u002FSKILLS.md](docs\u002FSKILLS.md) | Owner-authored skills. |\n| [docs\u002FROUTINES.md](docs\u002FROUTINES.md) | Scheduled routines. |\n| [docs\u002FAPPROVALS.md](docs\u002FAPPROVALS.md) | Approval holds for outward actions. |\n| [docs\u002FPROMPTS.md](docs\u002FPROMPTS.md) | The composed system prompt and runtime files. |\n| [docs\u002FUI.md](docs\u002FUI.md) | The read-only dashboard. |\n| [docs\u002FROADMAP.md](docs\u002FROADMAP.md) | Roadmap and current gaps. |\n\nChinese pages live under [docs\u002Fzh\u002F](docs\u002Fzh\u002Findex.md).\n\n## Credits\n\nThe shape of this project comes from DeepSeek's public writing and prototype. The code is an independent implementation.\n\n| Source | Link | What it informed |\n|--------|------|------------------|\n| WeChat article | [Super-agent 设计探索](https:\u002F\u002Fmp.weixin.qq.com\u002Fs\u002FzoS7GlReWPhfCjENGxXCdg) | §2–§6: dual Router\u002FWorker, Triggers, async tools, multi-channel, state vs environment, Watchdog |\n| Official prototype | [deepseek-ai\u002Fdsh-superagent-prototype](https:\u002F\u002Fgithub.com\u002Fdeepseek-ai\u002Fdsh-superagent-prototype) | Trigger → Eval → Ticket → Assignment |\n| Personal Agent (3) | [从 DeepSeek Super-agent 看主动服务的设计模式](https:\u002F\u002Fmy.feishu.cn\u002Fdocx\u002FYtDVdzfxdobjAkxKZiIcl5Emnth) | Main Agent \u002F Executor, context-only Subscription, Mandate, Panel · Execution |\n\nAuthor: **LofiSu**. Co-written with Grokbot (CoderBot).\n\nBuilt on Node.js, TypeScript, `node:sqlite`, `tsx`, and Vitest — no agent framework dependency.\n\n## License\n\n[MIT](.\u002FLICENSE)\n\n[![Star History Chart](https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=LofiSu\u002Fdsh-super-agent&type=Date)](https:\u002F\u002Fstar-history.com\u002F#LofiSu\u002Fdsh-super-agent&Date)\n","dsh-super-agent 是一个开源的轻量级多智能体（Multi-Agent）框架，受 DeepSeek 相关设计启发，实现 Router\u002FWorker 双角色协同、事件触发（Triggers）、看门狗（Watchdog）监控、线程化任务流与沙箱化执行等核心机制。基于 TypeScript 构建，兼容 OpenAI API 协议，支持 MCP 服务集成，强调可控性、可观测性与上下文可扩展性。适用于需要编排多个 AI 智能体协作完成复杂任务的场景，如自动化编程辅助、RAG 流水线调度、AI 工作流编排及实验性智能体系统原型开发。",2,"2026-11-24 04:53:36","CREATED_QUERY"]