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.
| Agent | Use it to |
|---|---|
| build | Do the work. The default. It edits files and runs shell commands, and asks before network access, destructive commands, git changes and sensitive files. |
| auto | Work 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. |
| plan | Think 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. |
| ultraplan | Plan, 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).
| Subagent | Does |
|---|---|
| general | Multi-step work that may end in changes: reproducing a bug, making a contained change, running an investigation to a conclusion. |
| explore | Fast, 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.
---
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
{
"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
descriptionstringoptionalmode"primary" | "subagent" | "all"optionaldefault all@ and started by other agents; all is both.promptstringoptionalmodelstringoptionalprovider/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.variantstringoptionalhigh. Only applies while the agent uses its own model.permissionobjectoptionalstepsintegeroptionaltemperaturenumberoptionaltop_pnumberoptionalcolorstringoptional#FF5733, or a theme color: primary, secondary, accent, success, warning, error, info.hiddenbooleanoptionaldefault false@ menu and the tab cycle.disablebooleanoptionaldefault falsememory"user" | "project" | "local"optionaluser 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 listPrints every agent with its mode and permission rules. latentcode debug agent <name> shows one agent's full configuration.