rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:sANDzER0/dsh-hippocampus
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A self-managing cross-session project memory layer for DeepSeek Harness (DSH) — the Capture / Consolidate / Recall loop of cortexkit/magic-context, reimplemented as a native DSH plugin.
Status: feature-complete and verified against real workloads. Memory tools, prompt injection, event-driven auto-capture, consolidation subagents, CJK-tokenized keyword search, optional semantic search (local Ollama or OpenAI-compatible), compaction checkpoints + memory-aware compaction summaries, a signal-gated retrospective capture pass, and a settings page inside the DSH web UI.
DeepSeek Harness (DSH) is a
Cordis-based agent harness: every capability is a plugin row in a cordis.yml
composition, services/events/slots are the extension primitives, and dsh web
serves the GUI. This project ships as one host-composition row, so every session
of every preset gets the memory layer — no per-session mounting.
magic-context is an excellent memory system for OpenCode/Pi-style harnesses. This project is a from-scratch native reimplementation of its ideas on DSH primitives — none of its code is used.
| magic-context | dsh-hippocampus | |
|---|---|---|
| Scope | Memory layer plus context management (historian compartments, m[0]/m[1] cache-stable transform, byte-exact replay) | Memory layer only — DSH owns compaction and context shaping |
| Storage | SQLite (context.db, FTS5, vector BLOBs) |
DSH storageDomain JSON snapshots (whole-snapshot RMW, serialized writes) |
| Retrieval | sqlite-vec / local ONNX / remote embeddings | Intl.Segmenter CJK tokenization + scored ranking; optional local Ollama or any OpenAI-compatible /embeddings; in-JS cosine |
| Capture | Historian fact promotion tied to its compartment engine; dreamer cron tasks | Regex heuristics + a signal-gated retrospective pass whose child writes through idempotent tool calls; pre-compaction trigger slot |
| Compaction | Replaces the host's compaction entirely | Observes and enriches DSH's native compaction (checkpoint capture + memory-aware summaries) without touching ownership |
| Packaging | Multi-package monorepo (TS + Rust) | Two plain-JS function bodies (src/host.js, src/client.js) derived to deployable ESM by one script — zero build dependencies |
The full design rationale — scope boundary, pipeline details, and platform
implementation notes — lives in DESIGN.md.
ctx_memory (write / list / delete) across five curated
categories plus auto-managed CHECKPOINT entries; scoped to a stable project
identity so memory follows the project, not the session.ctx_search over memories and notes: CJK-aware token scoring,
verbatim-substring strong hits, optional semantic cosine, plus cross-session
history search when the deployment enables session-query-sqlite./ctx-retro scans buffered recent user messages;
correction/restatement signals dispatch one subagent that distills durable facts
and writes them itself via idempotent ctx_memory calls. Timer and pre-compaction
triggers included, with cooldown and single-flight latches./ctx-dream spawns a continuable subagent that
dedupes/curates memories and reports back into the session.dsh web). The plugin targets the
Node runtime DSH ships (v24-class); no extra dependencies.ollama pull bge-m3, ~1.2 GB). Without it the
plugin runs fully keyword-only — every failure path degrades silently.node sync.mjs # derive index.mjs + client.mjs + package manifest into the profile
# (~/.dsh/profiles/web/node_modules/@local/dsh-hippocampus/)
then register one insert row in the same profile's patch layer
(~/.dsh/profiles/web/cordis.patch.yml):
- insert:
- id: dsh-hippocampus
name: '@local/dsh-hippocampus'
and restart dsh web (ESM is cached per process). sync.mjs validates both halves
(node --check + import smoke test) before writing anything.
Why a derived file? The loader imports the row as a real ES module while
src/host.js/src/client.jsare written as plain function bodies (also valid as dynamic-plugincode.host/code.clientdefinitions). Never bare-copy the sources — a top-levelreturnis fatal under ESM.
Open Settings → Magic Context in the web UI. Everything applies live:
| Group | Knobs |
|---|---|
| Semantic search | enable · provider (Ollama / OpenAI-compatible) · endpoint · model · API key · connection probe · index rebuild |
| Local Ollama | status detection (reachable / installed / missing) · start background service |
| Injection & capture | injection count cap · character budget · auto-capture toggle · retrospective auto-trigger toggle |
Settings persist in the memory domain (mc:cfg) and are merged over defaults at
read time. The API key never appears in GET responses, and write routes only accept
loopback peers.
dsh-hippocampus/
├── DESIGN.md # Design doc: scope, pipelines, compaction integration,
│ # config model, DSH static-plugin implementation notes
├── src/
│ ├── host.js # Host half (plain JS function body): tools, injection,
│ │ # capture listeners, retrospective, /mc-api bridge, T1 wrap
│ └── client.js # Client half (plain JS function body): Magic Context settings page
├── sync.mjs # Derives deployable ESM for both halves + package manifest; validates
├── package.json
├── LICENSE # MIT
└── README.md
Exercised against real workloads rather than mocks:
/compact produced a checkpoint memory end-to-end; the summarizer's own
output confirmed the injected memory block was present in its input.bge-m3; the request pins keep_alive: 30m so idle gaps don't re-pay the ~41 s
cold load). Timeouts are split per scenario (query 8 s / probe 60 s / sweep 120 s).session-query-sqlite in the
profile patch layer (shipped opt-in with openAt: never).ctx_memory delete if one ever slips through.valueSchema (only .parse/.safeParse are
called), so the plugin body needs no zod dependency.MIT — see LICENSE.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。