# dsh-complex-project-preset bundle patch: one insert, mounting the
# 「复杂项目模式」 agent preset into the profile tree.
#
# The preset row mounts @deepseek-ai/dsh-agent-preset, which registers a
# preset (id: complex-project) in the preset registry. Every child row below
# is an official harness plugin resolved from the dsh installation, so this
# package ships configuration only - no host code, no browser code.
#
# This is an insert. Do not also declare a top-level "- id: preset-complex-project"
# row in the same profile patch, or the preset would register twice.
- insert:
    - id: preset-complex-project
      name: '@deepseek-ai/dsh-agent-preset'
      config:
        id: complex-project
        name: 复杂项目模式
        description: 标准模式 + 四文档维护规则 + 文档只写当前状态 + 禁止未授权提交推送 + 谨慎编码准则 + 大白话汇报。适合多人协作、需要长期维护文档的复杂项目。
        order: 2
        plugins:
          - id: persona
            name: '@deepseek-ai/dsh-persona'
            config:
              prefix: |-
                你是一名协作式编码助手，工作语言为中文。请始终遵守以下规则。

                一、项目文档（四文档制度）

                1. 每个项目最多维护四个文档，可以更少（简单项目），但不可以更多：
                   - 项目介绍：这个项目要做什么。
                   - 方案设定：我们选了什么方案、为什么这样选。
                   - 改动记录：历次提交都做了什么（概括即可，不是流水账）。
                   - 现状与下一步执行计划：当前做到哪里、下一步怎么做。

                2. 这些文档面向参与项目的所有人，不是你独享的工作笔记。写文档时用简单易懂的语言，不要堆砌专业名词和术语；必须用的术语，第一次出现时顺带解释一句。

                3. 所有文档和代码注释只描述当前状态：
                   - 不记录任何 AI 历史修改记录、不保留已被推翻的旧决策。
                   - 比如某次开发临时分了阶段 1 到阶段 5，文档里不允许出现这些阶段字样，只按代码和项目的实际现状更新。
                   - 比如旧方案 A 已被新方案 B 取代，文档只记录 B，删除 A 的痕迹。
                   - 更新文档时，不得把尚未经用户确认的实现偏差写成既定的业务规则。

                二、提交与推送的红线

                用户没有自测通过、且没有明确指令时，禁止自行执行 git commit / git push 或创建 PR。写代码、改文档、跑测试都可以主动做；提交和推送必须等用户说"可以提交"（或类似明确指令）之后再做。

                三、谨慎编码准则

                1. 动手前先把问题说清楚：
                   - 复述用户的目标与范围，明确"怎样算完成"（能跑通的命令、通过的测试、可复现的输入输出）。
                   - 列出关键假设与不确定点；无法安全假设时，先提问再写代码。
                   - 只给一个最简单可行的方案；若有多种走法，明确对比取舍，不要默选。

                2. 编码时极简实现、手术式改动：
                   - 只做被要求的内容，不顺手优化、不做"将来可能有用"的抽象。
                   - 只碰必须改的文件和行，不重排代码、不改无关格式、不重构不相关模块。
                   - 与现有代码风格保持一致，即使你个人偏好另一种写法。
                   - 只清理本次改动自己引入的垃圾（未用的 import/变量/函数），历史遗留死代码不删，可提示用户。

                3. 用证据闭环：
                   - 优先用测试定义成功标准：先复现问题，再让测试通过。
                   - 能自动化就自动化；不行就给出明确的手动验证步骤。
                   - 没验证之前，不说"已修复/已完成/已通过"。

                4. 汇报让改动一眼可读：
                   - 先结论，再列关键变更点；每个变更都能对应回用户的某条要求。
                   - 明确写出你跑了什么命令/测试，或建议用户怎么验证。

                四、说大白话

                汇报进度、解释问题、提方案时，对非专业用户说大白话：少用术语和缩写，必须用的术语顺带解释一句。结构是：先一句话结论，再说"这意味着什么"，最后说"下一步要做什么、需要你做什么"。用户说"听不懂/说明白点"时，换一种更通俗的说法重新解释，不要重复同一套措辞。

              # ⚠️ 这里**绝不能**写 `suffix: ... {{cwd}} ...`（2026-10-18 实测事故）。
              #
              # DSH 的提示词变量注册表**只注册了 `provider` 与 `model`** 两个变量，
              # 其它任何 `{{名字}}` 都会在**提示词装配阶段**直接抛错：
              #
              #   unknown prompt variable "{{cwd}}" in section "deployment:persona-suffix";
              #   registered variables: provider, model
              #
              # 后果是**整轮对话失败，且一个网络请求都不会发出**（会话记录里
              # 没有 request/header、没有 system/message，只有 turn/end 报错）。
              # 这会让用户误判成「某个模型的渠道坏了」——事故当时就被误报成
              # 「WorkBuddy 不可用」，其实换成任何 provider 都一样挂。
              #
              # 工作目录无需在此声明：DSH 的运行时上下文已自动注入
              # `Current working directory: "..."`，重复写既是冗余，也是唯一能踩雷的地方。
              # 故此处**刻意不设 suffix**（schema 里 suffix 默认为空字符串）。

          - id: agent-instructions
            name: '@deepseek-ai/dsh-agent-instructions'
            config:
              maxBytes: 65536

          - id: tool-bash
            name: '@deepseek-ai/dsh-tool-bash'
            disabled: !!js process.platform === 'win32'

          - id: tool-pwsh
            name: '@deepseek-ai/dsh-tool-pwsh'
            disabled: !!js process.platform !== 'win32'

          - id: tool-fs
            name: '@deepseek-ai/dsh-tool-fs'

          - id: tool-fs-search
            name: '@deepseek-ai/dsh-tool-fs-search'
            config:
              sampleOverCapGlobResults: false

          - id: tool-jobs
            name: '@deepseek-ai/dsh-tool-jobs'

          - id: skill-filesystem
            name: '@deepseek-ai/dsh-skill-filesystem'

          - id: tool-skill
            name: '@deepseek-ai/dsh-tool-skill'

          - id: command-goal
            name: '@deepseek-ai/dsh-command-goal'

          - id: tool-goal
            name: '@deepseek-ai/dsh-tool-goal'

          - id: planning
            name: cordis:group
            group: true
            isolate:
              planMode: true
            config:
              - id: plan-mode
                name: '@deepseek-ai/dsh-plan-mode'
                config:
                  section: |
                        You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.

                        Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.

                        The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.

                        Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.

                        Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.

                        When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.

          - id: compaction
            name: cordis:group
            group: true
            isolate:
              compaction: true
              toolResultPruner: true
            config:
              - id: compaction-basic
                name: '@deepseek-ai/dsh-compaction-basic'
              - id: command-compact
                name: '@deepseek-ai/dsh-command-compact'
              - id: tool-result-pruner
                name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
                config:
                  thresholdChars: 8192
                  headChars: 4096
                  tailChars: 1024

          - id: delegation
            name: cordis:group
            group: true
            isolate:
              workflowEngine: true
            config:
              - id: tool-subagent-control
                name: '@deepseek-ai/dsh-tool-subagent-control'
              - id: tool-subagent-list-agents
                name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
              - id: tool-subagent
                name: '@deepseek-ai/dsh-tool-subagent'
                config:
                  provider: spawn
                  toolName: subagent
                  modelSelectionSettings: true
                  backgroundMode: continuable
              - id: tool-subagent-fork
                name: '@deepseek-ai/dsh-tool-subagent'
                config:
                  provider: fork
                  toolName: subagent_fork
                  backgroundMode: continuable
              - id: tool-subagent-codex
                name: '@deepseek-ai/dsh-tool-subagent'
                disabled: true
                config:
                  provider: codex
                  toolName: subagent_codex
                  backgroundMode: one-shot
                  maxDepth: provider-managed
              - id: tool-subagent-claude-code
                name: '@deepseek-ai/dsh-tool-subagent'
                disabled: true
                config:
                  provider: claude-code
                  toolName: subagent_claude_code
                  backgroundMode: one-shot
                  maxDepth: provider-managed
              - id: workflow-ptc
                name: '@deepseek-ai/dsh-workflow-ptc'
                config:
                  provider: spawn
              - id: tool-workflow
                name: '@deepseek-ai/dsh-tool-workflow'
              - id: tool-ralph
                name: '@deepseek-ai/dsh-tool-ralph'
                disabled: true
                config:
                  subagentProvider: spawn
                  maxRounds: 64

          - id: tool-ask-user
            name: '@deepseek-ai/dsh-tool-ask-user'

          - id: tool-todo
            name: '@deepseek-ai/dsh-tool-todo'
            config:
              allowParallelInProgress: true

          - id: tool-web
            name: '@deepseek-ai/dsh-tool-web'
            config:
              fetch: true
              searchTimeoutMs: 60000

          - id: present
            name: '@deepseek-ai/dsh-tool-present'

          - id: tool-plugin-manager
            name: '@deepseek-ai/dsh-plugin-manager/tools'
            disabled: true
