agent.cordis.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. #
  109. # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
  110. # plane, and the rows here resolve that one instance. It takes no configuration,
  111. # keys every fold by Session, and owns the context-meter projection units the
  112. # browser reads for every session — behind a realm those units would come and go
  113. # with whichever presets happen to be mounted. What a preset chooses is whether
  114. # its agent compacts at all, which is `compact-basic` below.
  115. - id: compaction
  116. name: cordis:group
  117. group: true
  118. isolate:
  119. compact: true
  120. toolResultPrune: true
  121. config:
  122. - id: compact-basic
  123. name: '@deepseek-ai/dsh-compact-basic'
  124. - id: command-compact
  125. name: '@deepseek-ai/dsh-command-compact'
  126. - id: tool-result-prune
  127. name: '@deepseek-ai/dsh-compact-tool-result-prune'
  128. config:
  129. thresholdChars: 8192
  130. headChars: 4096
  131. tailChars: 1024
  132. # ── delegation and workflows ────────────────────────────────────────────────
  133. # The `subagents` registry and its spawn/fork backends live in the HOST
  134. # composition: the registry is a process singleton whose cross-session queries
  135. # the api-proxy serves to the browser, and a provider name may only be
  136. # registered once. This preset contributes the delegation TOOLS, which resolve
  137. # that host registry.
  138. #
  139. # `workflows` is different — nothing outside an agent reads it — so every row
  140. # that reaches it shares one entry-local realm here, and a consumer left
  141. # outside would resolve a host registry this preset does not populate.
  142. - id: delegation
  143. name: cordis:group
  144. group: true
  145. isolate:
  146. workflows: true
  147. config:
  148. - id: tool-subagent-control
  149. name: '@deepseek-ai/dsh-tool-subagent-control'
  150. - id: tool-subagent-list-agents
  151. name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
  152. - id: tool-subagent
  153. name: '@deepseek-ai/dsh-tool-subagent'
  154. config:
  155. provider: spawn
  156. toolName: subagent
  157. backgroundMode: continuable
  158. - id: tool-subagent-fork
  159. name: '@deepseek-ai/dsh-tool-subagent'
  160. config:
  161. provider: fork
  162. toolName: subagent_fork
  163. backgroundMode: continuable
  164. # Product providers are host-plane singletons. Copy this preset, then
  165. # remove `disabled` from either ordinary tool row to expose that product
  166. # only to agents composed from the copy.
  167. - id: tool-subagent-codex
  168. name: '@deepseek-ai/dsh-tool-subagent'
  169. disabled: true
  170. config:
  171. provider: codex
  172. toolName: subagent_codex
  173. enableRunInBackground: false
  174. maxDepth: provider-managed
  175. - id: tool-subagent-claude-code
  176. name: '@deepseek-ai/dsh-tool-subagent'
  177. disabled: true
  178. config:
  179. provider: claude-code
  180. toolName: subagent_claude_code
  181. enableRunInBackground: false
  182. maxDepth: provider-managed
  183. - id: workflow-workerthread
  184. name: '@deepseek-ai/dsh-workflow-workerthread'
  185. config:
  186. provider: spawn
  187. - id: tool-workflow
  188. name: '@deepseek-ai/dsh-tool-workflow'
  189. - id: tool-ralph
  190. name: '@deepseek-ai/dsh-tool-ralph'
  191. config:
  192. subagentProvider: spawn
  193. maxRounds: 64
  194. # ── remaining model-facing rows ─────────────────────────────────────────────
  195. - id: tool-ask-user
  196. name: '@deepseek-ai/dsh-tool-ask-user'
  197. - id: tool-todo
  198. name: '@deepseek-ai/dsh-tool-todo'
  199. config:
  200. allowParallelInProgress: true
  201. # The `web` service and its search provider stay in the host composition; only
  202. # the model-facing tool is per-session.
  203. - id: tool-web
  204. name: '@deepseek-ai/dsh-tool-web'
  205. config:
  206. fetch: false
  207. searchTimeoutMs: 60000
  208. # ── presentation ────────────────────────────────────────────────────────────
  209. # Code Mode for this agent alone. The row waits for the host's `codeRuntime`
  210. # rather than assuming it: a deployment that composes no TypeScript runtime
  211. # fails this preset at mount, naming this id, instead of at the first request.
  212. - id: tool-mode
  213. name: '@deepseek-ai/dsh-agent-tool-mode'
  214. config:
  215. mode: code