LatentCodeUsing LatentCode

Agents

An agent is a role: a system prompt, a set of permissions and optionally its own model. Primary agents are the ones you talk to; subagents are helpers they hand work to.

Primary agents

Press tab to move to the next primary agent and shift+tab to go back, or pick one from the list with ctrl+x a or /agents. The current agent is shown under the prompt.

AgentUse it to
buildDo the work. The default. It edits files and runs shell commands, and asks before network access, destructive commands, git changes and sensitive files.
autoWork with fewer interruptions. Like Build, but network commands, web access, git changes and files outside the project are allowed too. Destructive commands and secrets still ask.
planThink before changing anything. Read-only: it explores the code and writes a plan. When the plan is ready it can offer to switch to Build.
ultraplanPlan, then have a second model check the plan against the code before you approve it. Appears only when your organization has it turned on.

The exact rules for each are on the Permissions page. Start in a different agent with latentcode --agent plan, or make it the default with "default_agent" in your config.

Subagents

A primary agent can start subagents to work on part of a task in their own context, which keeps its own context small, and can run several at once. Each runs in a child session you can open (see The TUI).

SubagentDoes
generalMulti-step work that may end in changes: reproducing a bug, making a contained change, running an investigation to a conclusion.
exploreFast, read-only searching and answering questions about the code. It can read and search files and run commands, but not edit.

The agent decides when to use them, or you can ask directly by mentioning one: @explore where do we validate webhook signatures?. Subagents can't start further subagents unless you raise subagent_depth.

Create an agent

With the wizard

$latentcode agent create
  • Choose where to save it: the current project or global (asked only inside a git repository).
  • Describe what the agent should do. A model writes its name, description and system prompt.
  • Choose which permissions to allow. Everything you leave unticked is denied.
  • Choose the mode: All, Primary or Subagent.

The agent is saved to .latentcode/agents/<name>.md or ~/.config/latentcode/agents/<name>.md. Edit the file to refine it. For scripts, pass --path, --description, --mode and --permissions to skip the questions (see the CLI reference).

As a Markdown file

Put a Markdown file in .latentcode/agents/ in your project, or ~/.config/latentcode/agents/ to use it everywhere. The file name is the agent's name, the front matter configures it and the body is its system prompt.

.latentcode/agents/migrations.md
---
description: Writes and reviews database migrations. Use for any schema change.
mode: subagent
model: latentrouter/bedrock-anthropic/anthropic/claude-sonnet-5
permission:
  bash:
    "*": ask
    "npm run db:migrate:dry*": allow
---
You write PostgreSQL migrations for this project.

- Every migration must be reversible; write the down step.
- Never drop a column in the same release that stops using it.
- Run the dry-run command and include its output in your answer.

Files in subfolders are named by their path: agents/db/migrations.md is db/migrations. You can use {file:…} and {env:…} in values, as in config.

In latentcode.json

JSONC
{
  "agent": {
    "docs": {
      "description": "Writes and updates user documentation.",
      "mode": "subagent",
      "prompt": "{file:./prompts/docs-writer.md}",
      "permission": { "bash": "deny" }
    },
    "build": {
      "model": "latentrouter/bedrock-anthropic/anthropic/claude-opus-5"
    },
    "auto": { "disable": true }
  }
}

The same keys change built-in agents: here Build gets a different model and Auto is removed.

Agent options

descriptionstringoptional
When to use the agent. Primary agents show it in the agent list; for subagents it's how other agents decide to call them, so be specific.
mode"primary" | "subagent" | "all"optionaldefault all
Primary agents appear in the tab cycle; subagents can be mentioned with @ and started by other agents; all is both.
promptstringoptional
The system prompt. In a Markdown file, the body.
modelstringoptional
Model to use, as provider/model. Without it, primary agents use the session's model and subagents use the model of the agent that started them, unless your organization assigns one.
variantstringoptional
Default reasoning effort, such as high. Only applies while the agent uses its own model.
permissionobjectoptional
Rules for this agent, applied after the top-level ones. See Permissions.
stepsintegeroptional
Maximum tool-using steps per request. When reached, the agent must answer in text.
temperaturenumberoptional
Sampling temperature, where the model supports it. Lower is more focused.
top_pnumberoptional
Nucleus sampling, where the model supports it.
colorstringoptional
A hex color such as #FF5733, or a theme color: primary, secondary, accent, success, warning, error, info.
hiddenbooleanoptionaldefault false
Keep the agent out of the @ menu and the tab cycle.
disablebooleanoptionaldefault false
Remove the agent, including a built-in one.
memory"user" | "project" | "local"optional
Give the agent its own memory. user follows you across projects; project is stored in .latentcode/agent-memory and committed; local in .latentcode/agent-memory-local, not committed.

Check your agents

$latentcode agent list

Prints every agent with its mode and permission rules. latentcode debug agent <name> shows one agent's full configuration.