Skip to content
Crystal CodeDocs
ENEnglish

Child Agents

Child Agents are delegated conversations inside the current session. They are not a third mode. They are off by default. An omitted agents object means off.

Plan and Work both offer task while agents.enabled is true and at least one Agent is available. --agents on|off and --agents-concurrency <n> change only this process. They do not write config.json.

The model uses one task tool. Arguments are agent, a short label, prompt, and an optional sessionId. A call without sessionId creates a new child even when the Agent name matches another child. A call with sessionId continues only that child, and only with the same Agent. The tool cannot select a model or gear.

Agent Role
general Bounded general task. Uses agents/general, and agents/plan when the parent turn is Plan
explore Strictly read-only. Always uses agents/plan
work Work only. Uses agents/work. Not offered during a Plan turn

A custom Agent whose tools exceed Plan is omitted in Plan. Children cannot call question, task, or the background shell tools. They inherit the parent’s approval and directory boundaries. A custom tool list can only narrow the parent catalog.

Children share the workspace. Parallel writers need non-overlapping files. Separate working copies, background completion notifications, and sending text to a child are not implemented.

A child starts from its role prompt, applicable workspace instructions, and the delegated task. It does not receive parent history or pasted images. Its model, thinking, context window, service tier, and speed are resolved when it is created and kept when it is continued. Without a configured model it inherits the parent’s current choices. An explicit model must exist and have credentials. An unavailable Agent is omitted with an English note. Model-specific options without an explicit model are ignored. An invalid gear or slot is diagnosed and falls back. The Agent stays available.

agents.maxConcurrent defaults to 4 and accepts 1 through 8. It limits active child invocations, including several instances of the same Agent. Adjacent task calls may overlap. Other tools stay serial. Cancelling the parent stops running and queued children. Approval prompts are queued and name the source child. A headless call that would ask the operator is denied by the same parent policy. crystal run has no /child. The child summary stays with the task result.

/agents lists definitions and settings. While idle it accepts:

Form Effect
on / off Turns child Agents on or off
concurrency <1-8> Sets active child invocations
limit <model-calls|tool-calls|duration> [value] Sets a per-run bound for each child. Omitting the value clears it. agents.limits in config.json holds the stored bounds
model <name> [provider model] Sets that Agent’s model. Omitting the model clears the choice
compaction <name> model <provider> <model>, then thinking, context, tier, or speed with [value] Gives that Agent its own summary model, under the same rules as its own model. compaction <name> clear returns it to the session compaction setting
thinking, context, tier, or speed with <name> [value] Sets that gear. Omitting the value clears it

Completions for those choices use the Agent’s model. Built-in settings are saved to config.json. Custom settings are saved to that Agent’s agent.json. Changes are refused during a turn or compaction. /agents with no arguments still lists during a turn.

/child opens a filterable picker. /child <unique-id-prefix> inspects one child. /child parent returns. F7 opens the picker from either view. F7 and Esc in the picker dismiss it. The open picker refreshes status and usage and keeps the same child selected when the list reorders.

Inspection works during a turn and is read-only. Text, paste, and submit aimed at the child are ignored. The parent’s composer draft and image attachments stay. Esc returns to the parent at any draft state when no modal owns the key. The read-only composer region shows the child’s short id, Agent, label, and Esc/F7 hints. F7 and /child are unavailable after Agents are disabled. The child view shows that child’s model and usage. Saved-session lists show only parents.

Custom definitions live in ~/.crystal/agents/<name>/ and <workspace>/.crystal/agents/<name>/. Each directory has agent.json and prompt.md.

Field Meaning
description Required
enabled Defaults to false
tools Optional. Can only narrow the parent catalog
provider, model, thinking, context, tier, speed Optional model choices. /agents writes these

A workspace entry replaces the entire Home entry, including when it is disabled or invalid. general, explore, and work are reserved. The directory name starts with a letter and then uses letters, digits, ., _, or -. Symbolic links are skipped. Each file must be at most 64 KiB.

Built-in prompts are separate from the parent Work and Plan prompts. Precedence is the built-in text, the selected prompt set, Home prompts/agents/, then the project prompts/agents/. An attachment appends only the matching agents/ file. A custom Agent keeps prompt.md, then the built-in child safety rules and bound placeholders. Overlays, sets, and attachments do not replace that file.

Named files are agents/general.md, agents/work.md, and agents/plan.md. .txt is also accepted. See Prompts and instructions.

Children keep their archive, compacted context, model choices, usage, todos, and image references inside the parent session file. Resume and fork carry those records and do not add the usage again. Clear drops them. An interrupted process does not restart a child task. Continuing a child rechecks the current mode and directory boundaries and cannot widen the tool ceiling of the parent turn that started it.

Token totals include child model and compaction calls, using provider-reported usage only. Context estimates stay separate and use ~. A text child has no view_image. An image-capable child’s tool images stay in that child. describe_image remains a tool-free side request. Child images use the existing media store, and JSON export inlines available bytes.