agent.cordis.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. # The `code` agent preset: the standard coding agent, presented as Code Mode.
  2. #
  3. # Everything in `standard` is here unchanged. What is added is the `tool-mode`
  4. # row: instead of one tool call per action, the model writes a TypeScript
  5. # program against a generated SDK and `run_code` executes it, so a sequence
  6. # that would be five round trips becomes one.
  7. #
  8. # The registry itself stays on the host plane — the agent loop's scheduler and
  9. # the API proxy's presenters are its consumers — so what this preset owns is
  10. # the PRESENTATION of that registry for this agent alone. Native sessions run
  11. # beside this one in the same process, each seeing its own catalog.
  12. #
  13. # This file is an AGENT-PLANE composition. It is mounted under one agent's
  14. # scope context, so every tool and prompt section it registers belongs to that
  15. # session alone. The host composition (`base.cordis.yml` + `web.cordis.yml`)
  16. # keeps everything a preset must not own: the registries themselves, the
  17. # sandbox and approval stack, persistence, and the model route.
  18. #
  19. # A service row here MUST sit inside a group carrying an `isolate` realm.
  20. # Without one it publishes into the root realm, where it is process-global
  21. # rather than per-session and the second session mounting this preset collides
  22. # with the first; `dsh-agent-presets` rejects that at mount. `true` means an
  23. # entry-local realm — one private instance per mounted session, which is the
  24. # default this deployment wants. A shared label would instead pool one instance
  25. # across every session naming it.
  26. # ── identity ────────────────────────────────────────────────────────────────
  27. # The preset's own persona, shadowing the deployment default for this agent.
  28. # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
  29. - id: persona
  30. name: '@deepseek-ai/dsh-persona'
  31. config:
  32. text: >-
  33. You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
  34. - id: workspace-context
  35. name: '@deepseek-ai/dsh-workspace-context'
  36. config:
  37. maxBytes: 65536
  38. # ── shell ───────────────────────────────────────────────────────────────────
  39. # `bash-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
  40. # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
  41. # the criterion for host-plane ownership — injection resolves before any session
  42. # exists, so there is no agent to key by. Behind a preset realm those variables
  43. # never reached the model's shell at all. `tool-bash` consumes the host registry
  44. # from here; the executor behind it (`bash-sandbox`) is host-plane too, where the
  45. # sandbox policy owns it.
  46. - id: tool-bash
  47. name: '@deepseek-ai/dsh-tool-bash'
  48. # ── filesystem ──────────────────────────────────────────────────────────────
  49. # Both register into the host `tools` registry and provide nothing, so
  50. # they need no realm. The `fs` service and its policy stay in the host.
  51. - id: tool-fs
  52. name: '@deepseek-ai/dsh-tool-fs'
  53. - id: tool-fs-search
  54. name: '@deepseek-ai/dsh-tool-fs-search'
  55. config:
  56. sampleOverCapGlobResults: false
  57. # ── background tasks ────────────────────────────────────────────────────────
  58. # Only the model-facing controls. The task REGISTRY stays on the host plane:
  59. # its producers sit outside any realm this file could put it in — `tool-bash`
  60. # above resolves it with `ctx.get`, and an entry-local realm here is invisible
  61. # to every sibling row, so `run_in_background` would answer "background tasks
  62. # unavailable" while these controls sat in the catalog. The registry is keyed by
  63. # owning agent anyway, so one host instance serves every session. What a preset
  64. # chooses is whether its agent can collect and stop background work at all.
  65. - id: tool-tasks
  66. name: '@deepseek-ai/dsh-tool-tasks'
  67. # ── skills ──────────────────────────────────────────────────────────────────
  68. # The skill REGISTRY lives in the host composition and is layered per scope:
  69. # these rows register into THIS preset's layer of it, so they need no realm.
  70. # `skill-local` contributes local-root discovery for agents on this preset, and
  71. # `tool-skill` gives them the catalog and loader; the merged catalog also
  72. # carries whatever the deployment registered globally (repository plugins).
  73. - id: skill-local
  74. name: '@deepseek-ai/dsh-skill-local'
  75. - id: tool-skill
  76. name: '@deepseek-ai/dsh-tool-skill'
  77. # ── goals ───────────────────────────────────────────────────────────────────
  78. # Only the model-facing tool. The goal SERVICE, its session driver, and the
  79. # `/goal` command stay on the host plane: the Gateway serves the goal domain as
  80. # Remote endpoints whose receiver comes from a generated descriptor, so it
  81. # resolves `goals` on the host and an entry-local realm here would hide it. The
  82. # registry is keyed by session anyway, so one host instance serves every
  83. # session. What a preset chooses is whether its agent can call the goal tool.
  84. - id: tool-goal
  85. name: '@deepseek-ai/dsh-tool-goal'
  86. # ── plan mode ───────────────────────────────────────────────────────────────
  87. # Plan state is per-agent by nature, so an entry-local realm is not a
  88. # workaround here — it is the correct lifetime.
  89. - id: planning
  90. name: cordis:group
  91. group: true
  92. isolate:
  93. planMode: true
  94. config:
  95. - id: plan-mode
  96. name: '@deepseek-ai/dsh-plan-mode'
  97. config:
  98. section: |
  99. 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.
  100. 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.
  101. 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.
  102. 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.
  103. 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.
  104. 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.
  105. # ── compaction ──────────────────────────────────────────────────────────────
  106. # `compact-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
  107. # share this realm rather than sit outside it.
  108. - id: compaction
  109. name: cordis:group
  110. group: true
  111. isolate:
  112. tokenMeter: true
  113. compact: true
  114. toolResultPrune: true
  115. config:
  116. - id: token-meter
  117. name: '@deepseek-ai/dsh-token-meter'
  118. - id: compact-basic
  119. name: '@deepseek-ai/dsh-compact-basic'
  120. - id: command-compact
  121. name: '@deepseek-ai/dsh-command-compact'
  122. - id: tool-result-prune
  123. name: '@deepseek-ai/dsh-compact-tool-result-prune'
  124. config:
  125. thresholdChars: 8192
  126. headChars: 4096
  127. tailChars: 1024
  128. # ── delegation and workflows ────────────────────────────────────────────────
  129. # The `subagents` registry and its spawn/fork backends live in the HOST
  130. # composition: the registry is a process singleton whose cross-session queries
  131. # the api-proxy serves to the browser, and a provider name may only be
  132. # registered once. This preset contributes the delegation TOOLS, which resolve
  133. # that host registry.
  134. #
  135. # `workflows` is different — nothing outside an agent reads it — so every row
  136. # that reaches it shares one entry-local realm here, and a consumer left
  137. # outside would resolve a host registry this preset does not populate.
  138. - id: delegation
  139. name: cordis:group
  140. group: true
  141. isolate:
  142. workflows: true
  143. config:
  144. - id: tool-subagent-control
  145. name: '@deepseek-ai/dsh-tool-subagent-control'
  146. - id: tool-subagent-list-agents
  147. name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
  148. - id: tool-subagent
  149. name: '@deepseek-ai/dsh-tool-subagent'
  150. config:
  151. provider: spawn
  152. toolName: subagent
  153. backgroundMode: continuable
  154. - id: tool-subagent-fork
  155. name: '@deepseek-ai/dsh-tool-subagent'
  156. config:
  157. provider: fork
  158. toolName: subagent_fork
  159. backgroundMode: continuable
  160. # Product providers are host-plane singletons. Copy this preset, then
  161. # remove `disabled` from either ordinary tool row to expose that product
  162. # only to agents composed from the copy.
  163. - id: tool-subagent-codex
  164. name: '@deepseek-ai/dsh-tool-subagent'
  165. disabled: true
  166. config:
  167. provider: codex
  168. toolName: subagent_codex
  169. enableRunInBackground: false
  170. maxDepth: provider-managed
  171. - id: tool-subagent-claude-code
  172. name: '@deepseek-ai/dsh-tool-subagent'
  173. disabled: true
  174. config:
  175. provider: claude-code
  176. toolName: subagent_claude_code
  177. enableRunInBackground: false
  178. maxDepth: provider-managed
  179. - id: workflow-workerthread
  180. name: '@deepseek-ai/dsh-workflow-workerthread'
  181. config:
  182. provider: spawn
  183. - id: tool-workflow
  184. name: '@deepseek-ai/dsh-tool-workflow'
  185. - id: tool-ralph
  186. name: '@deepseek-ai/dsh-tool-ralph'
  187. config:
  188. subagentProvider: spawn
  189. maxRounds: 64
  190. # ── remaining model-facing rows ─────────────────────────────────────────────
  191. - id: tool-ask-user
  192. name: '@deepseek-ai/dsh-tool-ask-user'
  193. - id: tool-todo
  194. name: '@deepseek-ai/dsh-tool-todo'
  195. config:
  196. allowParallelInProgress: true
  197. # The `web` service and its search provider stay in the host composition; only
  198. # the model-facing tool is per-session.
  199. - id: tool-web
  200. name: '@deepseek-ai/dsh-tool-web'
  201. config:
  202. fetch: false
  203. searchTimeoutMs: 60000
  204. # ── presentation ────────────────────────────────────────────────────────────
  205. # Code Mode for this agent alone. The row waits for the host's `codeRuntime`
  206. # rather than assuming it: a deployment that composes no TypeScript runtime
  207. # fails this preset at mount, naming this id, instead of at the first request.
  208. - id: tool-mode
  209. name: '@deepseek-ai/dsh-agent-tool-mode'
  210. config:
  211. mode: code