Preface¶
DSH (DeepSeek Harness) adopts the “everything is a plugin” approach. The community directory is an independent site and does not constitute an official subordinate relationship with DeepSeek/Fangfang. After clarifying requirements, the model sometimes proceeds directly to the coding phase. dsh-code-reference aims to insert an investigation step before this phase: first examining local code, local system profiles, and reusable candidates in open-source platforms, and then presenting the list of candidates and value trade-offs to the user, allowing the user to decide whether to reuse, adapt, or develop directly.
What is it¶
dsh-code-reference is the code reference retrieval and engineering specification plugin for DeepSeek Harness (DSH), maintained by victorzhong0110, and licensed under MIT.
It is not an automatic decision-maker, but a candidate discoverer: match scores and architectural similarity serve only as heuristic candidate signals used to generate the list of candidates. Data models, boundaries, and non-functional requirement compatibility still require manual confirmation.
The plugin is split into three sub-plugins: code-ref-core, code-ref-tools, and code-ref-decision, collaborating via the codeRef service. The current status is a reliable beta, suitable for internal enterprise pilot programs; to reach stable GA (General Availability), it mainly lacks end-to-end testing in a real DSH environment, long-term compatibility verification, and feedback from more actual projects.
Core Features¶
Reuse Survey¶
After clarifying requirements, the plugin investigates reusable code locally and in open source, and presents the list of candidates and value trade-offs to the user, while asking if reuse is needed. Users can choose to reuse a specific candidate, adapt it, or develop directly without reuse. It can also be configured to not ask and prioritize reuse directly.
Architecture-level Reuse¶
The plugin supports architecture-level reuse: scanning existing local business systems to determine if the new system’s overall architecture can be reused directly. It uses a 15-category business capability dictionary and local system profiles for similarity sorting. reuse_survey lists local systems with similarity ≥ 60 as skeleton candidates; adoption still requires manual confirmation.
Tools¶
The plugin provides the following tools:
reuse_surveyarchitecture_reuse_searchlocal_code_reuse_searchgithub_reference_searchgithub_repo_referencegitlab_reference_searchgitee_reference_searchnpm_reference_searchreuse_value_assessmentcode_architecture_review
Reuse Value Decision¶
Reuse value decisions are divided into four tiers:
reuse: Direct reuseadapt: Adapted reusedependency: Introduce dependencyrewrite: Implement from scratch
The plugin provides candidate assessments based on whether the total reuse cost is lower than implementing from scratch.
Remote Retrieval¶
The plugin supports remote retrieval and dependency selection for GitHub, npm, GitLab.com, and Gitee.
Policy Constraints¶
The plugin supports workspace company policies and deployment-level policies:
- Workspace policy:
.code-reference-policy.json - Deployment policy:
DSH_CODE_REFERENCE_POLICY
The workspace .code-reference-policy.json belongs to repository content and is not trusted. The deployment policy DSH_CODE_REFERENCE_POLICY is an unrelaxable ceiling; the workspace policy can only be tightened.
Installation and Enablement¶
Installation of a Fixed Version¶
Do not follow the main branch during installation; it is recommended to pin to a stable Release tag or commit. The following example installs pinned to v4.2.1:
git clone --branch v4.2.1 --depth 1 https://github.com/victorzhong0110/dsh-code-reference.git
dsh plugin --profile web add ./dsh-code-reference
The first command downloads the repository at a fixed version, and the second command adds the local plugin directory to the DSH web profile.
Verifying File Integrity¶
Execute the following command in the repository root to verify file integrity:
shasum -a 256 -c SHA256SUMS
Increasing GitHub API Quota¶
The unauthenticated GitHub search API is approximately 10 requests/minute. Setting environment variables can increase the quota:
export DSH_GITHUB_TOKEN=ghp_xxxxxxxx
# or
export GITHUB_TOKEN=ghp_xxxxxxxx
The token is used to increase the GitHub search quota and is not attached to other domains like npm. Please do not write the token into policy files or commit it to git.
Running Unit Tests¶
Run the following command in the repository:
node --test test/core.test.mjs test/decision.test.mjs
Typical Usage¶
Direct Modification for Small Tasks¶
For small changes like modifying a single button, fixing null pointer or spelling errors, renaming variables, etc., if the estimate is < 50 lines and does not introduce new components/projects, you can skip the survey and questioning and modify directly.
Programmatic Skip of Survey¶
When a programmatic forced skip is required, pass scope=skip to reuse_survey, returning mode=minor-skip, skipping investigation and questioning:
reuse_survey: scope="skip"
Default Asking¶
After reuse_survey investigation, it presents options like system skeleton, local candidates, open-source candidates, and direct development without reuse, letting the user decide.
No-ask Mode¶
You can configure company policy to not ask and prioritize reuse directly:
reuseMode: "auto"
You can also pass ask=false to the tool to skip questioning and directly adopt the assessment recommendation:
reuse_survey: ask=false
Architecture Skeleton Candidates¶
reuse_survey lists local systems with similarity ≥ 60 as skeleton candidates. After selecting a skeleton, you still need to confirm data model, boundaries, and non-functional requirement compatibility.
Applicable Scenarios and Notes¶
Who is it for¶
- Enterprises with existing local codebases or business systems who want to perform reuse surveys first within DSH sessions.
- Users who need to view open-source candidates across GitHub, npm, GitLab.com, and Gitee simultaneously.
- Users who need to constrain policies regarding licenses, languages, testing requirements, and remote retrieval behavior.
Security and Boundaries¶
- The plugin runs with the permissions of the current dsh process. Before installation, check the source code and license, pin the version, and verify file integrity.
- Remote retrieval results are from third-party open-source projects, and reuse must comply with their licenses.
- Remote search sends requirement keywords to GitHub/npm; local source files are not sent to any retrieval platform. However, the hit path, the longest 160-character code snippet, and the system profile will enter the current Agent/Model context.
- The system does not perform forced blocking and will not prevent file writing; the decision to reuse or not is decided through negotiation between the user and the model.
- The maximum wait time for asking is 90 seconds. When
reuse_surveyreturnsanswer.statusasunanswered(unanswered/timeout), the model must not start writing code and must first report the survey results and wait for the user’s decision.
Decision Rules¶
- Unknown license defaults to blocking.
- If the license is not on the whitelist, dependency is excluded.
- If the language is on the blacklist, the candidate is unavailable.
- If testing is required but the candidate has no tests, reuse is downgraded to adaptation + additional tests.
Current Status¶
Currently, it is a reliable beta, suitable for internal enterprise pilot programs. To reach stable GA, it mainly lacks end-to-end testing in a real DSH environment, long-term compatibility verification, and feedback from more actual projects.
Conclusion¶
The value of dsh-code-reference is to turn the “whether to reuse” decision from an on-the-spot judgment into an interpretable process: first investigating local and open-source candidates, then evaluating value trade-offs, and finally letting the user decide on reuse, adaptation, or direct development.
Directory Page: Verified facts but no confirmable links provided; please refer to the community directory or the actual release in the repository.
GitHub: https://github.com/victorzhong0110/dsh-code-reference