Commands, Layers, Agents, and Prompts

Octomind provides four mechanisms for extending AI capabilities beyond the base session.

Layers

Layers execute via ACP (Agent Client Protocol). Model, system prompt, and MCP tool access live in [[roles]] config — layers reference roles via the command field. Layers are workflow building blocks; commands are interactive layer shortcuts.

Configuration

[[layers]]
name = "task_refiner"
description = "Refines and clarifies user requests for better processing"
command = "octomind acp task_refiner"
input_mode = "last"
output_mode = "none"
output_role = "assistant"

Input Modes

How the layer receives conversation input:

ModeDescription
"last"Only the last assistant/message from the session (default for workflow stages)
"all"Entire conversation history from the session
"summary"A summarized version of the conversation history

Output Modes

How the layer's output affects the session:

ModeDescription
"none"Intermediate processing, doesn't modify session (for workflow stages like task_refiner)
"append"Adds output as a new message to the session
"replace"Replaces entire session content with layer output (reducer functionality)
"last"Append only the last response to session (ignore multiple outputs)
"restart"Replace session with only the last response (fresh start with last message)

Built-in Layers

The default configuration includes layers that reference built-in roles:

LayerCommandPurpose
task_refineroctomind acp task_refinerQuery cleanup and initial file guessing
task_researcheroctomind acp task_researcherContext gathering via code analysis

Layer Fields

FieldTypeRequiredDescription
namestringyesLayer identifier
descriptionstringyesHuman-readable purpose (shown in help)
commandstringyesACP command to execute: octomind acp <role_name>
workdirstringnoWorking directory (default: ".")
input_modestringyes"last", "all", or "summary"
output_modestringyes"none", "append", "replace", "last", "restart"
output_rolestringno"assistant" (default) or "user" — role for output messages

Key Architecture: Layers don't contain model/system/mcp config. Those live in [[roles]]. The command field references which role to spawn via ACP.

Example role definition (in config or from taps):

[[roles]]
name = "task_refiner"
model = "openrouter:openai/gpt-4.1-mini"
system = "You are a query processor..."
temperature = 0.3

[roles.mcp]
server_refs = []
allowed_tools = []

Custom Commands

Commands are layers triggered interactively via /run <name>. Same configuration as layers.

[[commands]]
name = "reduce"
description = "Compress session history for cost optimization during ongoing work"
command = "octomind acp reduce"
input_mode = "all"
output_mode = "replace"
output_role = "assistant"

Usage

/run              # List available commands
/run reduce       # Execute the reduce command

Layers vs Commands

FeatureLayerCommand
Triggered byWorkflows, codeUser via /run
Config section[[layers]][[commands]]
InteractiveNoYes
Typical usePipeline stagesUser-initiated actions

Both use identical configuration fields.

Agents

Agents are specialized AI instances that run as separate processes via ACP (Agent Client Protocol). Each agent becomes an MCP tool.

Configuration

[[agents]]
name = "context_gatherer"
description = "Gather detailed context from files and codebase."
command = "octomind acp context_gatherer"
workdir = "."

How Agents Work

  1. Define agent in [[agents]] with name, description, and command
  2. Agent becomes MCP tool agent_<name> (e.g., agent_context_gatherer)
  3. When called, Octomind spawns the command as a child process
  4. Communication happens via JSON-RPC over stdio (ACP protocol)
  5. Agent's final response is returned as the tool result

Agent Fields

FieldTypeRequiredDescription
namestringyesUnique ID. Tool becomes agent_<name>.
descriptionstringyesMCP tool description shown to AI
commandstringyesShell command starting ACP server over stdio
workdirstringnoWorking directory (default: ".")

Agent Tool Parameters

Each agent tool accepts:

  • task (string, required): Task description in human language
  • async (boolean, default: false): Run asynchronously

Async Agents

async: true returns immediately. Result appears as a user message when complete.

Use async when:

  • Task takes 30+ seconds
  • You can continue other work
  • You don't need the result immediately

Max concurrent async jobs is configurable. Jobs cancelled on session exit.

Dynamic Agents

Create agents at runtime using the agent MCP tool:

{"action": "add", "name": "reviewer", "description": "Code reviewer", "system": "You review code..."}
{"action": "enable", "name": "reviewer"}

See MCP Tools Reference.

Prompt Templates

Reusable prompts injected into the session via /prompt <name>.

[[prompts]]
name = "review"
description = "Request code review with focus on best practices"
prompt = """Please review the code above focusing on:
- Code quality and best practices
- Security considerations
- Performance implications"""

[[prompts]]
name = "explain"
description = "Ask for detailed explanation"
prompt = "Please provide a detailed explanation of the code/concept above."

[[prompts]]
name = "test"
description = "Request test cases"
prompt = """Please help create comprehensive tests:
- Unit test cases
- Edge cases and error conditions
- Integration test considerations"""

Usage

/prompt              # List available prompts
/prompt review       # Inject the review prompt