Introduction¶
When using Hindsight for local memory in DSH, the common practice is to select the daemon mode: memory is stored locally (embedded PostgreSQL + pg0), and only the step of extracting facts utilizes your configured LLM, ensuring data does not leave the machine. The official integration has two practical obstacles in daemon mode: the LLM detection only reads DSH process environment variables and fails to read the gateway configured in ~/.hindsight/profiles/<profile>.env; and the session cold start only waits for about 12 seconds, while the daemon cold start often takes much longer (loading torch and sentence_transformers on the Python side alone can take over ten seconds), easily resulting in daemon mode needs an LLM for fact extraction in the logs or the service failing to become ready in time.
Below is the introduction to the community plugin dsh-hindsight-daemon (Maintainer: FYTXY, Category: Memory). It starts the Hindsight daemon earlier within DSH’s Cordis tree and cleans up along with the embedded PostgreSQL when DSH exits. The goal is to leave no persistent processes, nor require boot auto-start or background monitors. Additionally, it provides an independent page under “Settings → Hindsight Memory” for status viewing, dependency installation, start/stop, and configuration, while supporting the creation, switching, and deletion of memory repositories (profiles). It supports Windows 10/11 and Linux (x86_64).
What is this¶
dsh-hindsight-daemon is a Hindsight local memory daemon lifecycle plugin designed for DSH Desktop. When DSH starts, the plugin executes hindsight-embed -p <profile> daemon start in the background, and the daemon listens on a local port (default 127.0.0.1:9077). When DSH exits, it performs idempotent cleanup via Cordis disposers, process exit hooks, or signal hooks (depending on the host environment): first terminating the detached CLI, then terminating the daemon process by port, and finally closing the database with pg_ctl stop -m fast. The README states that apply() returns in about 2 ms, not blocking DSH startup; cleanup takes about 500–600 ms; and cold start to healthy state takes about 20 seconds when dependencies and models are ready (as reported in Linux tests).
The current npm package version of the plugin is 0.3.0 (MIT). You can check the introduction and category on the SkillHub Directory Page; for GitHub repository star counts, please refer to the directory page (the clue at the time of writing was 2).
Core Features¶
Lifecycle and Zero Residue¶
- DSH Startup: Registers
/hindsight-daemon/api/*for the settings page to call and spawns the daemon; pg0 starts the embedded PostgreSQL. - DSH Exit: Any of the three channels (Cordis dispose,
exit, SIGTERM/SIGHUP/SIGINT) triggers the execution of the same cleanup segment to avoid duplicate execution. - Design Goal: Produce no persistent processes; cleanup on the Windows side involves
taskkill, while the Linux side involvespg_ctl/pkill.
Settings Page (Settings → Hindsight Memory)¶
The README divides the page into six sections, all available after installation and DSH restart:
- Service Status: Stage (Stopped / Starting / Running / Installing / Error), address, uptime, start/stop buttons, refreshed approximately every 2 seconds.
- Environment Detection:
uv,hindsight-embed, PostgreSQL, database directory; one-click installation when missing; detection order is Settings Path > Environment Variables > PATH > Common Installation Locations. - One-Click Install: Idempotent five phases (check → packages → profile → models → verify);
uv tool install hindsight-embed --with hindsight-api --forceinstalls the API and tools into the same venv to prevent the daemon from falling back touvxfor redundant downloads. - Current Memory: Read-only display of database directory, disk usage, and node/relationship/document counts for each memory repository; one code repository corresponds to one memory repository (default named by repository name), and the location is determined by “Advanced” and other configurations.
- Memory Repositories (Profiles): Lists local profiles, marks the currently active one, and allows creating, switching, and deleting; switching stops the current daemon and restarts it with the new profile (takes about 30 seconds); deletion is irrecoverable, and the currently active item must be switched to another repository first.
- Model Services: OI compatible protocol (select
openaias Provider), model name, Base URL, API Key; supports “Test Connectivity”; keys are saved to disk in plaintext and displayed as dots in the interface.
Advanced items include: read-only current Profile name, memory repository naming template (default empty implies coding-agent::{gitProject}), local port (default 9077, changes require DSH restart), HF mirror, and PyPI mirror (mainly affecting initial downloads and installation).
Environment Requirements (Excerpted from README)¶
| Item | Requirement |
|---|---|
| System | Windows 10/11 or Linux (x86_64) |
| DSH Desktop | 2.0.x (Cordis 4, apply() returns disposer) |
| Node.js | ≥ 22 |
| uv | Checked during installation process; prompts for installation method if missing |
| Disk | Approx. 3 GB (Python dependencies, local models, database) |
| Model Service | OI compatible LLM interface (used for fact extraction only) |
Installation and Activation¶
The README explicitly states that only one of the three mounting methods can be chosen; duplicate mounting will cause /hindsight-daemon/api routes to be registered twice, resulting in webserver: duplicate prefix route error during DSH startup.
Method 1: npm (Suitable for users already using DSH plugin commands)¶
Execute under the target profile (the original source uses desktop as an example):
dsh plugin --profile desktop add dsh-hindsight-daemon
The package includes dsh.bundle.patch, which is automatically mounted by cordis.patch.yml after installation. Restart DSH after installation, open Settings → Hindsight Memory, and configure the model service; Python dependencies and models can be completed via “One-Click Install” on the settings page.
Method 2: Installation Script (Windows / Linux)¶
Windows (PowerShell, within the plugin repository directory):
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1
Optional parameters: -Profile, -DshHome, -SkipDeps (only mount the plugin, leave dependencies for the settings page).
Linux:
chmod +x ./scripts/install.sh
./scripts/install.sh
./scripts/install.sh --profile desktop
The script idempotently appends an insert block to the profile’s cordis.patch.yml; dependencies can also be installed on the settings page. The script writes a path pointing to the local lib/index.js absolute path, so simply git pull after upgrading the repository will take effect (as stated in README).
Method 3: Manual Mounting¶
Append the following to the end of <DSH home>/profiles/<profile>/cordis.patch.yml:
- insert:
- id: hindsight-daemon
name: '/absolute/path/to/dsh-hindsight-daemon/lib/index.js'
The name uses forward slashes (even on Windows), pointing to lib/index.js. Then use “One-Click Install” on the settings page to complete dependencies.
Typical Usage¶
- Mount the plugin using any of the methods above and restart DSH.
- Open Settings → Hindsight Memory, fill in the Provider, model name, Base URL, and API Key under “Model Services”. You can Test Connectivity before Saving Configuration.
- If environment detection finds missing items, click One-Click Install to complete
uv, hindsight-embed, profile, models, and verify. - Click Start for the daemon in “Service Status”. Once the status is Running, set the Hindsight integration mode to
daemonin DSH to use local memory. - For multi-environment or multi-key scenarios: create or switch profiles in “Memory Repositories (Profiles)”; each profile has an independent database, env, and logs. Enabling a switch will restart the daemon.
The default memory repository name is derived from the template: if the template is unchanged, it is coding-agent::{gitProject}, where {gitProject} is the root directory name of the git repository; for non-git workspaces, it takes the current directory name. Switching to a different git repository workspace will write to another repository, ensuring they do not mix.
Main Paths (README Summary):
| Content | Path |
|---|---|
| Plugin Config | <DSH home>/hindsight-daemon/config.json |
| Profile Env | ~/.hindsight/profiles/<profile>.env |
| Database | ~/.pg0/instances/hindsight-embed-<profile>/data |
To uninstall, use scripts/uninstall.ps1 (Windows) or scripts/uninstall.sh (Linux) in the repository; refer to the README for specific profile parameters.
Use Cases and Notes¶
Who it is for: Developers who need to use Hindsight daemon mode in DSH long-term, want memory and database to start/stop with DSH, and accept local disk usage of about 3 GB plus using an OI compatible LLM for fact extraction.
Permissions and Security: The plugin runs with the current DSH process. Before installation, you should read the source code and MIT license on GitHub to confirm that the behavior of cordis.patch.yml and the installation script complies with your policies; according to the README, API Keys are saved to disk in plaintext, so you must take care of ~/.hindsight/profiles/<profile>.env and the settings page configuration yourself.
Ecosystem Note: DSH emphasizes “Everything is a plugin”; SkillHub is a community plugin directory and has no official affiliation with DeepSeek / High-Flyer.
Conclusion¶
dsh-hindsight-daemon bridges the gap in timing and cleanup found in the official daemon integration by taking over “starting daemon + clearing PostgreSQL on exit” and centralizing the management of dependencies, profiles, and model gateways via a settings page. For further details on implementation and uninstallation steps, see the repository README: https://github.com/FYTXY/dsh-hindsight-daemon; for installation and category information, see the SkillHub Directory Page.