Introduction¶
In the memory ecosystem of DeepSeek Harness (DSH), @vectorize-io/hindsight-coding-agents provides long-term memory for each repository, but its bank name defaults to the local directory name. This causes the same repository to fork into disconnected memory banks due to different clone directory names (e.g., payments-app vs. mobile-client).
This plugin, dsh-hindsight-bank-router, maintained by j62268781-alt, is an MIT-licensed open-source plugin. Its core function is to anchor the Hindsight coding plugin’s bank identity to the remote repository name rather than the local directory name, thereby allowing every clone of the same repository to share the same memory bank.
Core Functions¶
By dynamically generating the mapPathToBank configuration, the plugin achieves the following capabilities:
- Anchoring Remote Repository Name: Regardless of the local directory name, it is uniformly resolved to
git::<remote-repo-name>. - Declarative Priority Chain: Supports priority overrides via user-level workspace files, in-repository
.hindsight.json, the git remote name, and the local directory name. - Dual-Switch Enablement Mechanism: It only takes effect when both the user-level
enableBankRouterand the deployment-levelenabledare set totrue. - Never Overwrites User Configuration: The sidecar state file records the managed scope, and the plugin only deletes entries it generated itself.
- Zero Subprocess Overhead: Directly reads
.git/configwithout spawning git processes, avoiding timeouts and load issues. - Chinese Repository Name Support: Correctly handles URL decoding to support mapping of Chinese repository names.
- Fail Open: Any exceptions are only logged and do not block DSH startup.
Routing Rules and Priority Chain¶
When processing bank mappings, the plugin follows a strict priority order. Once a match is found, subsequent lookups stop:
- User-Level Workspace File: The
bankIdin~/.hindsight/workspaces/<dirname>.json(highest priority). - In-Repository Configuration: The
bankIdin<workspace>/.hindsight.json. - Git Remote Repository Name: When a
.gitdirectory is detected and anoriginremote address exists, it generatesgit::<remote-repo-name>. - Local Directory Name: For non-Git directories or repositories without an
origin, it falls back to the default behavior. - Non-Git Directory Default: When allowed by configuration, it generates
workspace::<dirname>for direct subdirectories of the root directory.
Note: Explicit configurations (items 1 and 2) have the highest priority and will override subsequent rules regardless of whether it is a Git repository. This serves as the “escape hatch” for manual user intervention.
Enablement Switches¶
By default, the routing function is disabled and must be explicitly turned on. This requires both switches to be true simultaneously:
* User-Level Master Switch: Set "enableBankRouter": true in ~/.hindsight/coding-agent.json.
* Deployment-Level Switch: Set enabled: true in the config of cordis.patch.yml (usually controlled by the DSH profile).
Installation¶
This plugin is a supplement to Hindsight; the Hindsight coding plugin must be installed first.
dsh plugin --profile desktop add @j62268781-alt/dsh-hindsight-b
Configuration Example¶
The plugin automatically scans and merges configurations upon DSH startup. You can override the default behavior through explicit configuration:
{
"bankId": "custom::my-bank"
}
This configuration will be written to the mapPathToBank field in ~/.hindsight/coding-agent.json.
Security and Limitations¶
- No Recursive Scanning: Only direct subdirectories of the root directory are processed; recursion stops immediately upon encountering a
.gitdirectory. - Non-Git Directory Limitation: The bank name for non-Git directories remains the directory name. Different people with the same directory name might map to the same bank (the plugin does not handle this scenario).
- Corrupted Configuration Protection: If a config file exists but JSON parsing fails, the plugin will skip it with a warning and will not overwrite existing content.
- Handling No origin: Repositories without a remote address do not generate a mapping, leaving it to Hindsight’s default logic.
Summary¶
For developers using DSH, dsh-hindsight-bank-router solves the memory forking problem in Hindsight during multi-terminal collaboration. By anchoring the bank to the objective remote repository name, it ensures that the memories of team members for the same repository are shared and consistent.
- Plugin Directory: dsh-hindsight-bank-router
- Source Code: GitHub