Introduction¶
In the DeepSeek Harness (DSH) ecosystem, the AGENTS.md file defines the behavioral specifications, build commands, and code style for agents. Manually maintaining this file is time-consuming and can easily fall behind as the project changes. The dsh-init-command plugin uses the /init slash command to leverage a large model to analyze the current project’s directory structure and context, automatically generating or updating AGENTS.md. It adopts a two-stage invocation strategy: first determine the project type and toolchain, then embed the determination result into a prompt to generate the document.
Core Features¶
The core of this plugin is a structured two-stage process that ensures the generated documentation is based on actual project content rather than model guesses.
- Two-stage LLM generation: In the first stage, it collects the project’s two-level directory structure and sends a prompt to the model, requiring structured output of the project type and toolchain (language, framework, build tools, etc.). In the second stage, the determination result and directory structure are embedded into a prompt to generate
AGENTS.md. - Stage two visibility control: By default, the generation stage displays only the model’s reasoning stream blocks (thought process), while the main content is written directly to the file without entering the session. When using
--dry-run, all content is fully streamed for preview. - Stage one thinking mode: Project analysis tasks are relatively simple, so thinking mode (
reasoningEffort: 'off') is disabled by default to save tokens. Use the--thinkparameter to enable thinking when more rigorous analysis is needed. - Two-level directory structure collection: Automatically collects entries in the root directory and subdirectories (filtering noise such as
.gitandnode_modules). Supports--depthto set depth (-1for unlimited) and--ignoreto skip specified entries. - Empty directory handling: When the directory is empty (the project has not yet been implemented), the plugin does not blindly generate. It asks the user about the project content in the session, or uses
--desc <text>to provide a description and generate a planning draft marked as “not yet implemented”. - Git initialization: Provides the
--gitparameter to automatically rungit initafter generating documentation, rename the default branch frommastertomain, and download the corresponding.gitignoretemplate from GitHub based on the project type. - Initial commit: Use the
--commitparameter (implicitly enabling--git) to create an initial commit. - Model routing fallback: Model invocation priority is: plugin configuration -> most recent session request -> agent options.
- Zero dependencies: Uses only built-in Node.js modules and requires no build.
Installation and Enabling¶
The plugin is installed as a bundle and automatically registered to the specified profile.
Run in the path containing the plugin directory:
dsh plugin --profile <profile-name> add ./dsh-init-command
After installation, DSH adds the plugin to dsh.profile.bundles. Verify that the installation succeeded:
dsh --profile <profile-name> --dump-config
# 应输出包含 "# == dsh-init-command" 的配置层
Configuration¶
The /init command requires available model routing. Plugin configuration has the highest priority, session configuration is second, and agent options are lowest. If none are available, the command returns an error.
Configure in cordis.patch.yml or the profile patch layer:
- insert:
- id: init
name: dsh-init-command
config:
provider: deepseek
model: deepseek-chat
Usage¶
In the DSH Web UI or command adapter input box, use the following commands.
| Command | Behavior |
|---|---|
/init |
Calls the model in two stages and generates or replaces AGENTS.md at the workspace root. Stage two displays reasoning by default and hides the main content, which is written directly to the file. |
/init --dry-run |
Generates content but does not write to the file, providing a fully streamed preview (including reasoning and final output). |
/init --think |
Enables the model’s thinking mode in stage one (project analysis). |
/init --git |
Initializes a Git repository after generating AGENTS.md, renames the branch, and downloads .gitignore. |
/init --commit |
Creates an initial Git commit after generation (implicitly enabling --git). |
/init --depth <n> |
Sets the directory tree collection depth. 1 is top-level, 2 is two levels (default), and -1 is unlimited. |
/init --ignore <pattern> |
Additionally skips entries matching the names (supports comma-separated values or repeated use). |
/init --desc <text> |
Provides a project description for an empty directory and generates a planning draft. |
/init --git --dry-run |
Uses them together; it only previews the operations that would be performed (initialization, downloading templates, etc.) and does not execute writes. |
Note: When the directory is empty,
/initdoes not automatically generate. You must use/init --desc "<description>"to provide a description, or create files first before running.
Notes¶
- Thinking mode disabled by default: Stage one does not enable thinking by default to improve speed and save tokens. Use
--thinkif deeper project analysis is needed. - Empty directory behavior: The plugin does not blindly generate for an empty directory; a description must be provided via
--desc. - Model routing priority: Ensure that at least a provider and model are specified in the configuration, session, or agent options; otherwise, the command cannot be executed.
- Zero dependencies: The plugin uses only Node built-in modules, ensuring it can run without additional environment setup.
- Manual review: The generated
AGENTS.mdis an initial draft produced by the model, and its commands and structure are based on the collected directory results. Manual review and adjustment according to the actual project conventions are required before use.
Conclusion¶
dsh-init-command provides DSH users with an automated way to define project agent guidelines from scratch. Through two-stage invocation and structured input, it lowers the barrier to maintaining AGENTS.md and is suitable for scenarios that require quickly setting up a project AI development environment.
For more details and source code, please visit: GitHub Repository | Community Directory