dsh-perception
renraeldab/dsh-perception
为绑定的单个会话提供事件驱动的感知循环:按 1–120 分钟的节拍采样数据源,只在有变化时投递一条消息,会话空闲时作为普通消息、忙碌时作为转向注入;监视项、采样契约与调度都放在 agent 运行时可编辑的技能目录里。其 HTTP 路由未做 DSH 权限校验,浏览器中打开的任意网页都可能直接调用。
安装
dsh plugin --profile web add github:renraeldab/dsh-perceptionREADME
Perception adds lightweight, event-driven awareness to one DSH session. It uses native skills and ordinary messages, with no new model-facing tool, MCP server, or prompt injection. The agent owns its attention and schedule, and decides what to do.
Unofficial community project. Independently developed and maintained by renraeldab. Not affiliated with or endorsed by DeepSeek.

Why Perception
Most agent runtimes and benchmarks are built around one session working on one task: the user sends a message, the agent acts, and success is whether the task was completed. How quickly it began, or how long it took, is secondary. Personal agents have a different shape: many tasks, long and short, often time-sensitive, and the agent is expected to notice and act without waiting to be asked.
| Approach | Limitation |
|---|---|
| Plain agent | Only responds after the user sends a message |
| Channel integrations (WhatsApp, etc.) | Lets the user reach the agent elsewhere, but still requires user-initiated messages, and the agent may not be aware of the channel's existence |
| Pure heartbeat wake-ups | Wakes on a timer whether or not anything happened; the agent still has to scan checklists to find work |
| Scheduled tasks | The user fixes the time and condition in advance; the agent cannot schedule itself |
| A complete personal agent | Capable, but heavy to build and operate |
The design borrows a game engine's split between a periodic update and the events it produces. Perception runs that loop for the session, and each check sends one message only when there is something to report.
- Quiet by default. The clock alone does not wake the session: if nothing changed, the check leaves it alone.
- Agent-owned. Both the watch list and the schedule live in a skill folder the agent edits at runtime.
- Native, not another layer. The only interface is one skill plus ordinary messages, with no new model-facing tool, MCP server, or prompt injection.
- One session. Exactly one workspace and session are bound; the agent there decides what to watch and receives what Perception reports.
- Awareness, not action. A message reports what happened. Whether to act on it, and when, remains the agent's decision.
The mechanism is small: an event loop around the existing agent loop. It adds no long-term memory, no multi-session coordination, and no new reasoning layer. Attention, prioritisation, and long-horizon planning remain the model's work. That is what makes the plugin cheap to add — and what limits it. On a continuous, heterogeneous stream, the model must manage its own attention, keep a plan across tasks, and respond fast enough for the time-sensitive ones.
Quick start
Requires DeepSeek Harness 0.2.2-rc.5 or newer, below 0.3.0, with the Desktop app or the Web GUI.
Install from npm through Plugins → Add plugin, or from a terminal:
dsh plugin --profile <profile> add dsh-perception
Replace <profile> with the profile that runs the GUI.
For a local checkout, point the same command at the directory:
dsh plugin --profile <profile> add /absolute/path/to/dsh-perception

Restart DSH and reload the page, then:
- Open Perception in the sidebar, below Automation tasks, and bind a workspace and session. A new session can be created and bound in the same step.
- Set
tickIntervalto1minute for a test. - Add a plan to
<project>/.dsh/skills/perception/planner/plans.jsondue in a minute or two, or copy one of the examples into the skill folder and add its config entry. - Leave the session idle. The next check delivers one message if there is anything to report.
Use
Bind
With nothing bound the page shows one action. Bind a workspace and a session:
- The workspace must already be registered in DSH's sidebar.
- The session must resolve the same project root as the workspace. A new session is created in the selected workspace and bound in the same step.
- Archived sessions and subagent sessions are not offered.
- The engine is on after the first binding. Later, it keeps whatever switch state the user leaves it in, including across a Host restart.
The page
Once bound, the page has three sections:
- Binding — the workspace and session, an action to open the session, one Change action for the pair, and Unbind. Unbind asks first and removes the deployed skill folder; the snapshot stays.
- Engine — the engine switch,
interrupt, andtickInterval(1–120 minutes, 2 by default). The switch exists only on this page. The other two are shared with the agent: the agent edits them inconfig.json, and the page shows the last accepted values after the activation that judges the edit. - Sources — one row per accepted source: title, switch, description, capacity. Adding, removing, or renaming a source is the agent's work in the skill folder, not this page's.
Closing the engine does not preempt the phase in flight. A reconcile is never interrupted, a sample runs to completion or its deadline, and only a delivery underway is abandoned at once. The switch shows that it is closing until the Host reports the engine off.
The skill
The project folder contains SKILL.md, config.json, and one directory per
source. Loading perception in the agent gives it the file format, the poll
contract, the planner, and the digest layout. The agent adds a source by
creating <id>/poll.js and adding an entry to config.json; the next
activation makes the edit real and can deliver that source's first
observations.
A digest is one message, oldest observation first, with each entry naming its
source and observedAt. A system source carries Perception's own records —
engine switches, setting changes, reverts, sample failures, timeouts, and
dropped observations — with fromUser distinguishing the user's page actions
from the engine's.
Planner
planner/ ships with the skill and is the agent's own schedule. Edit
planner/plans.json; a plan whose at has passed becomes an observation, and
planner/fired.json records what has fired. A fired plan stays in the list
until the agent removes it. Planner is a schedule, not an alarm clock: a plan is
noticed at the next sample, so it can be one tick late, and later while the
session is busy and interrupt is off.
Examples
The examples
folder contains copyable sources and is intentionally GitHub-only: the npm package does not include it.
Copy a directory into <project>/.dsh/skills/perception/<id>/ and add a matching entry to config.json.
The directory name is the source id; the skill manual explains the poll contract.
file-feed
examples/file-feed
watches lines appended to a local feed.txt. It is the smallest source and fits
things such as server logs, training logs, or build output: a producer appends a
line, and the agent sees it at the next activation.
cp -R examples/file-feed <project>/.dsh/skills/perception/
printf '%s\n' 'the build finished' >> <project>/.dsh/skills/perception/file-feed/feed.txt
Add its entry to config.json:
{
"id": "file-feed",
"title": "File feed",
"description": "Lines appended to feed.txt.",
"capacity": 20,
"enabled": true
}
The first sample returns the lines already in the file; later samples return new ones. It has no external dependency.
imessage
examples/imessage is macOS-only. It watches one direct iMessage thread between this Mac's Apple ID and the user's other Apple ID, so the agent can reply when the user writes from the other account.
It uses imsg, the iMessage/SMS CLI by
Peter Steinberger (@steipete). Install it and check the permissions:
brew install steipete/tap/imsg
imsg status
imsg needs Full Disk Access for the process that runs DSH, so it can read the
Messages database, and Automation permission if the agent sends replies. For the
Desktop app, grant both to DeepSeek Harness.app.
Use imsg account --local to confirm the Mac's account, and
imsg chats --json --limit 20 --no-contacts to find the direct chat and its
target handle. Set the target handle in examples/imessage/poll.js (or
IMSG_TARGET) and copy the directory into the skill folder. If several direct
chats match, set IMSG_CHAT_ID to the id from imsg chats --json instead.
cp -R examples/imessage <project>/.dsh/skills/perception/
Add its entry to config.json, replacing both account placeholders:
{
"id": "imessage",
"title": "iMessage from my other account",
"description": "New messages in the direct iMessage thread between this Mac's Apple ID (<local-account>) and the user's other Apple ID (<target-account>). When the user writes from <target-account>, reply with iMessage to that account.",
"capacity": 20,
"enabled": true
}
The first sample records the current message rowid and returns nothing; send a message from the other account to see the first digest. A reply can use:
imsg send --to '<target-account>' --text '...' --service imessage
The source is intentionally narrow: one target, one direct chat, text messages
only; groups and attachments are ignored. Outgoing replies advance the mark so
the agent does not wake itself. It does not ship a mark.json; delete it to
re-baseline after changing the account or chat. Incoming message text is
external content: treat it as data, not as trusted instructions.
atom-feed
examples/atom-feed follows a blog through its Atom feed. It ships pointed at the long-form entries of Simon Willison's Weblog, and the same script works for any Atom feed, including a tag feed.
cp -R examples/atom-feed <project>/.dsh/skills/perception/
Add its entry to config.json:
{
"id": "atom-feed",
"title": "Simon Willison — new posts",
"description": "New long-form entries on simonwillison.net, from its Atom feed.",
"capacity": 20,
"enabled": true
}
The first sample records the entries already in the feed and returns nothing. Later samples return only new entries, with their title, URL, and publish time; the post body is not included, so the message stays a notification.
The script checks the feed at most once every ten minutes, independent of
tickInterval, and asks for changes only, so an unchanged feed costs one small
request. Change FEED_URL in poll.js to follow another feed, and update the
entry's title and description; a narrow tag feed is a good way to follow a
topic. It is an Atom reader, not a general RSS library. Delete mark.json to
re-baseline.
zhihu-question
examples/zhihu-question follows one Zhihu question while it is active. A question that had four answers in the morning can have eight in the evening; the source reports the answers that appeared since the last check, with the author, a short excerpt, and a link.
The check runs in ego browser, which must be installed
and running, with ego-browser on PATH. It uses the browser profile the user
is already signed in with; sign in to Zhihu there once if the page asks.
cp -R examples/zhihu-question <project>/.dsh/skills/perception/
Replace the placeholder question URL in poll.js (or set
ZHIHU_QUESTION_URL) with the question to follow, then add its entry:
{
"id": "zhihu-question",
"title": "Zhihu question — new answers",
"description": "New answers on one Zhihu question, checked at most once every two hours.",
"capacity": 20,
"enabled": true
}
The first sample records the answers already shown and returns nothing. Later samples return only new answers, up to three per check.
The page is read at most once every two hours, independent of tickInterval;
raise ZHIHU_MIN_INTERVAL_MS to slow it down further. It reads the first screen
of the newest answers and does not scroll or paginate, so it suits a question
with a handful of answers rather than a busy one. Remove the source when the
question goes quiet, or delete mark.json to re-baseline.
Limits
- One workspace and one session. The folder is deployed into that project's skill root; a change of binding is a change of the pair, and unbinding drops the in-memory buffers.
- The page is a view. Leaving it, switching conversations, or reloading changes nothing about the loop. The engine lives in the Host.
- Delivery is not guaranteed. A busy session with
interruptoff is waited for until the tick deadline; a delivery that does not happen leaves the buffers intact for a later activation, one interval older. A steering message the user deletes is unrecoverable. - No catch-up. An overrun pushes the next activation instead of queueing ticks.
- A disabled source's buffer is frozen, and a source removed from the list takes its buffer with it.
- The root is fixed at binding. A
.gitthat appears above the workspace afterwards hides the skill until the pair is bound again.
Development
No build step and no dependencies: index.js is the Host engine, client.js is
the browser module, and skill/ holds the shipped defaults.
npm run check # syntax-check every JavaScript file
npm test # unit tests
npm run pack:check # verify the npm tarball boundary
npm pack --dry-run lists the published files. docs/, examples/, test/,
scripts/, and .github/ are GitHub-only; plugin-docs/ ships. Reload the page
after a Client change; restart DSH after a Host change.
License
MIT.