Skip to content
Nexus
Browse documentation
Docs / Core / Writing Agents

Writing Agents

The agent frontmatter spec, persistent memory scopes, and the agents Nexus ships.

Agent Anatomy

An agent is a single Markdown file in agents/ — YAML frontmatter that tells Claude Code when to delegate, followed by the agent's system prompt.

Code
---
name: code-reviewer
description: >
  Use this agent for senior-level review of a PR, branch, or diff.
  Trigger on "review this PR", "review my branch", "is this safe to merge".
tools: Bash, Read, Grep, Glob
model: inherit
color: red
memory: project
---
You are a senior code reviewer...

Frontmatter Reference

FieldRequiredValuesNotes
nameyeskebab-case identifierHow the agent is referenced and where its memory lives.
descriptionyesfree textDrives delegation — include explicit trigger phrases and what the agent returns.
toolsnocomma-separated tool namesOmit to inherit all tools. List only what the agent needs (e.g. Bash, Read, Grep, Glob for read-only agents).
modelnomodel name or inheritDefault is inherit (uses the conversation's model).
colornored, blue, green, yellow, purple, orange, pink, cyanDisplay color in the UI. Nexus uses it to group agents by domain.
memorynouser, project, localEnables persistent memory at that scope (see below).

Persistent Memory

Every Nexus agent declares a memory scope. The first 200 lines of the agent's MEMORY.md are auto-injected at session start, and Read/Write/Edit are auto-enabled so the agent can maintain its own memory files.

ScopeLivesUse for
userper-user, portable across every repoPersonal preferences, recurring stack choices, review style.
projectper-repo, in .claude/agent-memory/Repo conventions, architecture learnings, known stubs. Shared with the team if committed.
localper-repo, never committedMachine-specific or private context.

Rule of thumb: agents that adapt to you (designers, planners, reviewers of your taste) use user; agents that adapt to a codebase (architecture, database, code review) use project.

Shipped Agents

AgentColorMemoryPurpose
prd-writer-criticpurpleuserWrites 10-section PRDs from rough notes, or critiques PRDs with severity-ranked gaps.
roadmap-plannerpurpleuserExecution-ready roadmaps: scope, sequencing, verify commands, rollback plans.
uiux-reviewerpinkuserRead-only UI/UX review with severity-ranked findings and top-3 fixes.
mobile-ux-designerpinkuserMobile UX design and review for iOS, Android, React Native, Flutter.
system-architecture-reviewerblueprojectArchitecture maps, coupling analysis, GO/NO-GO deployment safety verdicts.
scalability-plannerblueprojectBottleneck-ordered scaling plans with capacity math and cost estimates.
database-architectorangeprojectSchema design, indexing, and migrations with per-step verify and rollback.
event-driven-designerorangeprojectAsync system design: queues, sagas, outbox, DLQs, failure-mode tables.
cloud-cost-optimizeryellowuserCost audits from real billing data with prioritized savings.
iac-engineeryellowprojectDesigns infra and writes Terraform/CDK, or audits IaC with evidence.
codebase-explorergreenprojectToken-efficient repo exploration returning a concise file map.
code-reviewerredprojectSenior PR/branch/diff review with verdict and file:line findings.
docs-app-buildergreenprojectBuilds documentation as a React app with navigation, diagrams, search.
ai-product-engineercyanuserLLM features end-to-end: models, RAG, agents, evals, token economics.

Domain color grouping: Product (purple), Design (pink), Architecture (blue), Data and Events (orange), Cloud (yellow), Code and Docs (green/red), AI (cyan).

Writing A Good Description

The description field is the delegation contract. The shipped agents follow a consistent shape:

  • Start with "Use this agent to/for ..." and the task domain.
  • List literal trigger phrases users actually type.
  • State what the agent returns (verdict, table, plan) so the caller knows the output shape.
  • Declare constraints, e.g. "Read-only — it never edits code."