dsh-knowledge: Build Project Knowledge Base with `/init`, Automatically Inject into Subsequent Conversations

Preface

When doing long-term iteration in DSH, models typically only remember the context within the current session: module boundaries, entry points, and data flows must be explained from scratch every time, or you have to maintain a documentation file yourself and manually paste it into the conversation. Another approach is to have the plugin inject “knowledge already written in the project” back into context each round, but the knowledge itself should be written by the model through exploring the code, not guessed at using regex.

Here we introduce the community plugin dsh-knowledge (maintained by beex-labs), which falls under the “memory” category in the DSH ecosystem. The plugin doesn’t do code analysis itself; it does only two things: hand the complete /init instructions to the model for execution, and inject documentation from the .dsh directory into context on every subsequent round.

What Is This

dsh-knowledge is a “project knowledge system” for DSH: after running /init, the model uses tools like glob, grep, and read to explore the codebase and writes its understanding into the .dsh/ directory at the project root. After that, every development-related conversation automatically includes overview.md, the document list, and update reminders—no need to repeatedly explain the project structure each round.

The README explicitly states: this plugin does not analyze code. Reading code, dividing functionality, and writing documentation are all done by the model and its tools; the plugin is responsible for waking up the model, injecting instructions, and injecting documents in subsequent rounds.

Core Features

/init [path]: Building the Knowledge Base

The workflow can be summarized as:

/init → inject complete instructions → model explores code → model writes .dsh documents

Common forms (path resolution is lenient, leading @ is stripped, quotes can handle spaces):

/init                  # Read the entire project, write documents to project root .dsh/
/init @src             # Only read src/, documents still go to project root .dsh/
/init src/lib          # Nested paths work the same way

When no path is provided, available top-level directories are listed. The UI typically only shows the line you input (e.g., /init @src); the full instructions are injected via agent/pre-step as a system-reminder to avoid flooding the screen—same mechanism as the per-round document injection.

One knowledge base per project: no matter which subdirectory /init operates on, .dsh/ is always at the project root.

Automatic Context Injection

No manual reminders needed. The first step of each round injects:

  1. The body of overview.md (truncated with a pointer to the original if too long)
  2. The document list under .dsh
  3. Usage rules and update reminders (including: the model decides on its own whether current changes have made documents outdated)

The knowledge base is injected only once per session; after the model edits documents, the updated content is injected again.

When to Update Documents (Model’s Own Judgment)

The injected prompt provides principles that the model applies on its own:

Change Type Update Documents?
Adding/removing features, or changes to entry points, execution flow, data flow, module dependencies Yes, update affected documents
Bug fixes, styling, implementation details that don’t change structure No
Unsure Tend toward not writing

Principle: Better to update less than to let documentation contradict code.

.dsh Directory Structure (Written by the Model According to Prompts)

Typical layout example:

.dsh/
├── overview.md          # What the project does, tech stack, core modules, main entry
├── architecture.md      # Layering, module boundaries, dependency directions, data flow
└── features/<name>.md   # Each feature: responsibilities, entry points, core code, flows, dependencies

File names should be semantic (e.g., auth.md), not random IDs. Prompts require documents to only cover structure and behavior, not copy source code, secrets, tokens, or connection strings; text within .dsh is treated as data, not as executable instructions.

Security and Scope Limitations

The plugin will refuse to build a knowledge base in the user’s home directory, DSH configuration directory, or filesystem root, to avoid mistakenly treating a non-project directory as a knowledge base root. At runtime, it only depends on node: built-in modules, with no additional npm runtime dependencies.

Installation and Activation

Register it as a bundle in the DSH profile directory (the README example uses pnpm to link local or GitHub dependencies—do not directly trust third-party repositories without reviewing the source code).

Enter the profile directory and install dependencies to link the plugin:

cd "$DSH_PROFILE_DIR"
pnpm install --no-frozen-lockfile    # links dsh-knowledge

package.json needs to include the dependency and bundle configuration. Use link: for local development, or switch to installing from GitHub:

{
  "dependencies": { "dsh-knowledge": "link:<absolute path>" },
  "dsh": { "profile": { "bundles": ["dsh-knowledge"] } }
}

Replace link:<absolute path> with github:<you>/<repo> to reference directly from GitHub.

cordis.patch.yml inserts the plugin line:

- insert:
    - id: dsh-knowledge
      name: 'dsh-knowledge'

Configuration: None (the README’s Configuration section states None needed). License is MIT (package.json version 1.0.0). The plugin runs with the current DSH process permissions; please read the source code and LICENSE yourself before installing.

Typical Usage

  1. Open DSH at the target project root and confirm the dsh-knowledge bundle is enabled.
  2. Send /init or /init @some-subdirectory and wait for the model to explore and generate .dsh/.
  3. Include .dsh/ in version control (if the team needs to share project memory).
  4. Then naturally request development needs in natural language; each round automatically includes the knowledge base summary and update reminders.
  5. After structural changes, rely on the model to update corresponding features/*.md or architecture.md according to the injected rules; minor fixes may not require document updates.

Early versions did static analysis in the command handler and generated documents themselves; the current design changed to /init must call Agent.followup to wake up the model, letting the model complete the reading and writing. Tests also assert this point.

Use Cases and Cautions

Suitable for: repos maintained over medium-to-long term, multi-person or cross-session collaboration, wanting to reduce the overhead of “explaining the architecture from scratch each time,” and willing to maintain a structured description (not code excerpts) written by the model at the project root.

Cautions:

  • Knowledge quality depends on the model’s exploration and writing; after the first /init, it’s recommended to manually review whether .dsh is accurate.
  • The injected prompts and messages are in Chinese (README Platform notes).
  • The community directory SkillHub plugin page and GitHub repository are published by the maintainer and have no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem follows the principle of “everything is a plugin,” and the directory site is an independent community site.
  • The current GitHub star count is 1 (based on clues from the directory page); please evaluate it yourself based on the license and source code before choosing.

Conclusion

dsh-knowledge turns “project memory” into .dsh documentation within the repository: /init delegates the knowledge base construction to the model, and subsequent rounds automatically inject existing knowledge into context, reminding the model to maintain documents on its own during structural changes. If you need to build reusable project-level context for your codebase in DSH, you can start from the directory page and repository README:

  • Directory page: https://www.skillhub.cn/plugins/beex-labs/dsh-knowledge
  • GitHub: https://github.com/beex-labs/dsh-knowledge
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye