Repository navigation
Description
Summary
Let users define reusable subagents as Markdown files with YAML frontmatter. This is the format Claude Code (.claude/agents/*.md) and Gemini CLI (.gemini/agents/*.md) already use, so an existing agent file can be copied into .infer/agents/ unchanged. The frontmatter sets the agent's name, when to use it, its model and which tools it may use. The Markdown body is its system prompt.
Markdown agents are not our preferred format, but other orchestrators have standardized on it. We follow it for portability instead of inventing our own YAML schema.
Most of the plumbing already exists. The Agent tool (internal/agent/tools/agent.go) already spawns infer headless subagents with a per-task system_prompt, model and type (ReadOnly/ReadWrite). A named agent is a saved preset for those arguments plus a tool allowlist. The allowlist is the only new runtime capability.
Format
---
name: code-reviewer
description: Reviews a diff for correctness bugs. Use after making code changes.
model: deepseek/deepseek-v4-pro # optional, default: inherit
tools: Read, Grep, Tree # optional, default: inherit
---
You are a senior reviewer. Read the changed files and report ...name(required): lowercase letters, digits,-and_, max 64 chars. It doesn't have to match the filename (Claude Code doesn't require that either).description(required): shown to the main agent so it knows when to delegate.model(optional):provider/modelorinherit. A value without a provider prefix (Claude aliases likesonnet, or bare model IDs) logs a warning and falls back to inherit, so Claude Code files still load.tools(optional): a YAML list (Gemini CLI) or a comma-separated string (Claude Code). If omitted, the agent gets the parent's tools. Unknown names (e.g. Claude'sGlob) log a warning and are dropped.disallowedTools(optional, Claude Code): same format astools, removed from the resolved list. We honor it in v1: silently ignoring a deny list would give the agent more tools than its author intended.- Other keys (
color,temperature,max_turns,maxTurns,mcpServers,permissionMode, ...) are accepted and ignored.
Locations
First match wins on a name collision:
- Project:
.infer/agents/<name>.md - User-global:
~/.infer/agents/<name>.md
So a project can override a personal agent with the same name, as with skills. These files are separate from .infer/agents.yaml, the A2A registry.
Proposal (v1)
- Loader: scan both directories once at session start. Reuse the skills frontmatter parser in
internal/skills/skills.go.parseFrontmattercurrently drops the body and only readsname/description, so generalize it to return the body instead of adding a second parser. - Agent tool: add an optional
agentproperty, both per task and in the single-task form. When it is set:system_promptcomes from the file body.modelcomes from the frontmatter. The file wins over the per-taskmodelargument. If the file sets no model, the existingresolveModelapplies.typeis derived from the resolved tools: ReadOnly if every tool is inagentdomain.ReadOnlyTools, otherwise ReadWrite (mutations still need approval).- An unknown
agentname returns an error that lists the available names.
- Discovery: append an
Available agents:list (name: description) to theAgenttool description. Agents are loaded once per session, so the tool definitions stay stable for the provider's prompt cache. - Tool allowlist: pass the resolved list to the child in a new
INFER_SUBAGENT_TOOLSenv var. Set it in bothsubagentExtraEnv(headless) andbuildChatPaneCommand(tmux), next toINFER_SUBAGENT_SYSTEM_PROMPT. The child enforces it inLLMToolService.isToolEnabled(internal/agent/llm_tool_service.go). That one check gates both what is offered to the model andExecuteTool, so the model can't call a disallowed tool even by naming it.
Acceptance Criteria
-
.infer/agents/*.mdand~/.infer/agents/*.mdare loaded at session start. The project file wins on a name collision. - A file with broken frontmatter, a missing or invalid
name/description, or atoolslist that resolves to no known tool is skipped with a warning naming the file and the reason. An empty allowlist never falls back to all tools, and an invalid file never fails startup. - A Claude Code agent file (comma-separated
tools,model: sonnet,disallowedTools,color) and a Gemini CLI agent file (listtools,temperature,max_turns) both load unchanged. - The
Agenttool acceptsagent: <name>per task and in the single-task form. The subagent runs with the file body as its system prompt and with the frontmatter model, or the inherited model if none is set. - When
tools/disallowedToolsare set, the subagent is only offered the resolved tools, and calling any other tool fails. This holds in both headless and interactive (tmux) mode. -
typeis derived as described above. Withtoolsomitted, the subagent gets the parent's tools and runs as ReadWrite. - The
Agenttool description lists the loaded agents. With no agents loaded it is unchanged. - The existing depth guard (
tools.agent.max_depth) still applies: a named agent that listsAgentcannot recurse past the limit. - Unit tests cover frontmatter parsing (list and comma-separated
tools,disallowedTools,inherit, unknown keys), precedence, and the allowlist gate inLLMToolService. - Docs: a new
docs/subagents.mdcovers the format, locations, precedence and compatibility notes for Claude Code and Gemini CLI.docs/directory-structure.mdlists.infer/agents/and~/.infer/agents/.
Out of scope (follow-ups)
- Reading
.claude/agents/or.gemini/agents/directly. For now, copy or symlink the files. - Hot reload when agent files change mid-session.
@namemention syntax and a/agentspicker in the chat UI.- CLI commands to list or create Markdown agents.
infer agentsalready manages A2A agents, so this needs a naming decision first. - Per-agent
mcpServers,temperature,max_turns,permissionMode, and tool wildcards such asmcp_*. - Agents shipped by plugins, and built-in agent files seeded on
infer init.
References
- Claude Code subagents: https://code.claude.com/docs/en/sub-agents
- Gemini CLI subagents: https://github.com/google-gemini/gemini-cli/blob/main/docs/core/subagents.md
- cli:
internal/agent/tools/agent.go,internal/agent/llm_tool_service.go,internal/agent/domain/tools.go(ReadOnlyTools),internal/skills/skills.go,cmd/runtime/state.go(INFER_SUBAGENT_SYSTEM_PROMPT)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][FEATURE] Implement Markdown agents as any other orchestrator[/-][+][FEATURE] Markdown subagent definitions in .infer/agents/<name>.md[/+]edenreich commentedon Sep 26, 2026
@infer Can you work on this? use /ponytail:ponytail
inference-gateway-maintainer commentedon Sep 26, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#1348
The agent hit the job's time limit before finishing, so it was stopped to salvage its work. Its committed changes were pushed; the draft pull request is linked above.
Table replaced with the bullet list. Re-running lint to confirm it's clean now.
Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 24m 6sTokens: 9,954,206 in · 66,213 out · 10,020,419 total (85 requests)
Tool calls: 112 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
fix: resolve #1343
inference-gateway-releaser commentedon Sep 27, 2026
🎉 This issue has been resolved in version 0.214.0 🎉
The release is available on:
Your semantic-release bot 📦🚀