# The single bundled Codex preset. Its complete operating prompt, including
# the working principles, is editable from Settings > Plugins.

- id: persona
  name: '@deepseek-ai/dsh-persona'
  config:
    # Keep identity, model, cwd, and runtime context in one persona section.
    prefix: >-
      You are Codex, a coding agent based on the {{model}} model. Your working directory is {{cwd}}.
    includeRuntimeContext: true

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

# The editable Codex operating prompt and its four core tools are available
# only inside this preset. Global request enhancements are mounted by the
# bundle row and must not be installed twice in this agent scope.
- id: codex-tools
  name: '@shuind/dsh-codex-harness'
  config:
    globalEnhancements: false
    codexCore: true

# Background-job guidance and completion delivery belong to the official
# dsh-tool-jobs plugin. Use wakeup delivery so an idle agent also learns about
# a completed job without needing a separate user/tool wake.
- id: codex-jobs
  name: '@deepseek-ai/dsh-tool-jobs'
  config:
    completionDelivery: wakeup

# The generic DSH pi-ai adapter still owns the user's configured provider,
# endpoint, API key, and model. The global Codex capability layer owns the
# optional remote-first transport wrapper and falls back to the generic path.

# Keep the local tool mounted as the fallback. Codex rewrites the final GPT
# Responses request to a hosted web_search tool first; a failed remote request
# is retried through this unchanged local function-tool path.
- id: codex-web-search
  name: '@deepseek-ai/dsh-tool-web'
  config:
    search: true
    fetch: false

# PTY execution is optional. Pipe-backed exec_command remains available on all
# platforms through the shell capability consumed by the Codex tool layer.
- id: codex-terminal
  name: cordis:group
  group: true
  isolate:
    terminals: true
  config:
    - id: terminals
      name: '@deepseek-ai/dsh-terminal'

    - id: terminal-bash
      name: '@deepseek-ai/dsh-terminal-bash'
      disabled: !!js process.platform === 'win32'
      config:
        timeoutMs: 300000

# Context compaction is agent-scoped in Web. The token meter stays on the host
# plane, while this group owns the backend, `/compact`, and optional tool-result
# pruning for Codex sessions.
- id: compaction
  name: cordis:group
  group: true
  isolate:
    compaction: true
    toolResultPruner: true
  config:
    - id: compaction-basic
      name: '@shuind/dsh-codex-harness/compaction'
      config:
        thresholdRatio: 0.95

    - id: command-compact
      name: '@shuind/dsh-codex-harness/compact-command'

    - id: tool-result-pruner
      name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
      config:
        thresholdChars: 8192
        headChars: 4096
        tailChars: 1024

# Skills are the dsh extensibility seam and do not change the four Codex core
# tool names.
- id: skill-filesystem
  name: '@deepseek-ai/dsh-skill-filesystem'

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

# Goal state remains host-owned and session-keyed. This row adds the official
# model-facing goal lifecycle without moving the goal service into the preset.
- id: tool-goal
  name: '@deepseek-ai/dsh-tool-goal'

# Official plan mode supplies the reviewed exit_plan_mode flow. Keep the
# Codex update_plan and todo_write tools out of this planning phase.
- 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 later tool descriptions or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use update_plan or 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.

# Continuable delegation and workflow execution are official model-facing
# capabilities. Their registries and providers stay in the host composition.
- 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

    # Optional providers remain disabled until their matching Bundle is
    # installed in the host profile.
    - 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-worker-thread
      name: '@deepseek-ai/dsh-workflow-worker-thread'
      config:
        provider: spawn

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

    - id: tool-ralph
      name: '@deepseek-ai/dsh-tool-ralph'
      config:
        subagentProvider: spawn
        maxRounds: 64

# These official tools provide the interactive question surface and the
# durable whole-list task view alongside Codex-compatible update_plan.
- id: tool-ask-user
  name: '@deepseek-ai/dsh-tool-ask-user'

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