coding-agents
vectorize-io/hindsightHindsight:会学习的 Agent 长期记忆系统,自动召回/保存、知识页、深度反思与按仓库隔离的记忆银行。
A real, installable DSH plugin (DeepSeek Harness / Cordis profile bundle) that gives the agent a focus tool and a durable focus board — a small note file (default .dsh/focus.md) in the session workspace that pins the objective, hard constraints, and decisions across context compaction and across sessions on the same workspace. The todo list tracks what to do next; the focus board tracks why we are doing it and what must not drift.
Tool schemas are validated against the @deepseek-ai/dsh-tools value-schema DSL at plugin load (checked against dsh-tools 0.1.0-rc.6 and 0.1.1-rc.2). Earlier releases used JSON-Schema required at the root of output.schema and closed nested objects without declared properties, which made the host abort the whole profile boot with unsupported JSON schema: schema.required is not supported by the value schema DSL and could reject the tool's own results. Current releases fix both; if an affected version left your DSH unable to start, remove the plugin from the profile (or upgrade) — no data is lost.
| Feature | Status |
|---|---|
focus tool — set / get / append / summary / clear | ✅ stable |
Structured entries — tag notes with kind (objective / constraint / decision / note) and status (open / done), grouped by summary | ✅ stable (v1.1) |
Prompt guidance section (focus:instructions) | ✅ stable |
| Automatic injection — board is re-injected into model context at every turn start and whenever it changes | ✅ stable |
Archive on clear — clear moves the old board to .dsh/focus.md.bak (accumulates) | ✅ stable |
focusBoard session projection for UIs | ✅ stable |
| Read-only web panel (composer dock) | 🧪 experimental (loader-format client bundle, not verified against a running web instance) |
get renders newest-first with a configurable character cap (the file is never trimmed by rendering).lib/index.js) registers the tool, the projection, and the auto-injection; the browser face (lib/client.js) renders the panel. The same composition row covers both faces via the package's dsh.bundle + dsh.client manifest sections.ctx.fs service, and every resolved path is containment-checked against the agent's session workspace — the board can never escape it.dsh-time-context mechanism: an agent/pre-step waterfall listener appends a plugin snapshot message carrying the board text (step 1 of every turn, plus mid-turn whenever the text changes). Resumed sessions get the board back on their first step.The package declares "dsh": { "bundle": { "patch": "./cordis.patch.yml" } }, so it goes through DSH's official plugin management:
# from a local checkout (equivalent to pnpm add <path> + auto-reconcile of the bundles list)
dsh plugin --profile <profile> add /path/to/dsh-plugin-focus
# or after publishing to npm
dsh plugin --profile <profile> add dsh-plugin-focus
Restart DSH. The focus tool is registered host-wide; the read-only panel appears in the web UI on a web profile.
$DSH_HOME/.agent-presets/<id>/ (never edit the deployment's own preset — an upgrade overwrites it).agent.cordis.yml:- id: focus
name: 'dsh-plugin-focus'
config:
file: '.dsh/focus.md'
dsh-plugin-focus resolves (installed in the profile's node_modules or the module fallback directory).| action | args | behavior |
|---|---|---|
set | note (required) | append an entry pinning the current focus / constraints |
append | note (required) | append a log entry (decision, discovery, reversal) |
get | — | read the whole board (newest first, capped, omitted-count footer) |
clear | — | empty the board; the old board is archived to the archive file |
The plugin also injects a focus:instructions prompt section (disable with personaSection: false) and re-injects the board into context automatically (disable with autoInject: false).
All optional, on the composition row's config:
| key | default | meaning |
|---|---|---|
file | .dsh/focus.md | board path, relative to the session workspace; cannot escape it (runtime-enforced) |
archiveFile | .dsh/focus.md.bak | archive path for clear |
archive | true | whether clear archives first |
maxEntries | 60 | max entries kept on disk (oldest dropped) |
maxChars | 8000 | render cap for get / auto-injection (view truncation only) |
autoInject | true | inject the board into model context at turn start / on change |
personaSection | true | register the prompt-guidance section |
sectionOrder | 5 | prompt section order (persona is 0, ascending) |
# Focus Board
## [2026-08-14T23:12:00.000Z] set
<note, may span lines>
## [2026-08-14T23:13:00.000Z] append
<another note>
Clearing appends an archive block (stamped with the clear time) to the archive file, so history accumulates.
lib/board.js has zero DSH/Cordis imports (parse / render / mutate / archive) and is unit-tested in isolation; lib/index.js is the Cordis plugin.ctx.fs and is containment-checked with ctx.fs.contains against the session workspace.., the browser loader imports ./client (via the dsh.client manifest). The focusBoard session projection (event focus/write) is the data seam any future UI can read with useProjection('focusBoard').node --test test/
dsh plugin --profile <profile> remove dsh-plugin-focus
turn/start events for explicit snapshot semantics.MIT
focus set in a session whose workspace already has a .dsh/focus.md reads the existing entries. Each agent session resolves the board from its own session.header.cwd.maxChars. An empty board injects nothing.ctx.fs and containment-checked against the session workspace; a configured path outside it fails loud.npm publish (a prepublishOnly test run is wired in). Then dsh plugin add dsh-plugin-focus installs it without a build step.