| name | teamfuse-add-agent |
| description | Add a new agent to the teamfuse company. Provisions the AgentDM alias via admin_create_agent, assigns skills, adds it to channels, copies agents/TEMPLATE/ into agents/<id>/, writes the api key to the new agent's .env, and updates agents.config.json. Trigger on /teamfuse-add-agent, "add a new agent", "provision a new role". |
| trigger_keywords | ["teamfuse-add-agent","/teamfuse-add-agent","add agent","new agent","provision agent","add role"] |
teamfuse-add-agent
How to run this skill
Start immediately. Your first reply must be (1) the banner, then (2)
the precondition check, then (3) the first AskUserQuestion in
Step 1.
Do not explore the repo. Do not summarise the skill back. Do not run
Glob, Grep, Bash ls, or Task agents. Everything you need is in
this file.
Banner
Print verbatim:
teamfuse ยท add agent
โโโโโโโโโโโโโโโโโโโโโ
Preconditions
admin_create_agent is a callable tool. Otherwise: tell the
operator to install and authorise the AgentDM plugin and stop.
agents.config.json exists at the repo root. If not, the operator
has not run /teamfuse-init yet. Stop and say so.
agents/TEMPLATE/ exists at the repo root.
Flow
Step 1: gather inputs
Use AskUserQuestion one question at a time.
- Agent id. Lowercase, 3 to 32 chars, alphanumeric + hyphen,
matches AgentDM alias rules. Used as the directory name under
agents/ and as the id in agents.config.json. Reject ids that
already appear in agents.config.json.agents[].id.
- Alias. Default:
@<id>. The AgentDM alias. Reject aliases that
already appear in agents.config.json.agents[].alias.
- Role title. Free text. Example: "Data Engineer", "Support".
- Runtime.
claude (default) or copilot. Claude agents use the
Claude Code CLI with a persistent stream-json session and CLAUDE.md.
Copilot agents use the GitHub Copilot CLI (stateless per-tick) with
AGENTS.md as the instruction file.
- Chrome flag. Only applies to
claude runtime. true or false.
Default false. If true, the wrapper launches claude --chrome for
this agent. Only one agent at a time should have this. Warn if another
agent already has chrome: true.
- Skills list. Comma-separated. Example:
postgres-readonly, sql-auditor, etl.
- Channel memberships. Pick zero or more from the existing channels
(read via
list_channels). Default: none.
- Additional env vars. Optional. Any role-specific env var names
the operator wants stubbed in
agents/<id>/.env.
Step 2: create the agent on AgentDM
admin_create_agent({
alias: "@<alias>",
visibility: "private",
accessPolicy: "auto_approve",
description: "<role> for <company name from agents.config.json>"
})
Capture api_key. Do not echo it.
On alias_taken: stop, tell the operator the alias exists on AgentDM
but is not in agents.config.json. Offer two options: rename the
alias, or manually paste the existing api_key.
Step 3: assign skills
admin_set_agent_skills({
alias: "@<alias>",
skills: [{ name, description } for each skill]
})
For description, use the role title plus the skill name
(e.g. Data Engineer: etl) unless the operator provided richer text.
Step 4: copy the skeleton
cp -R agents/TEMPLATE agents/<id>
(Via the file tools. Do not actually exec cp.)
- Read
.mcp.json.example, substitute ${AGENTDM_TOKEN} with the real
api_key captured from admin_create_agent, write the result to
.mcp.json (live, gitignored). Leave any other ${...} placeholders
alone โ they're resolved later from .env. Verify the written file
has zero occurrences of ${AGENTDM_TOKEN}; if one remains, stop and
report the path. Keep the .mcp.json.example in place as a reference.
- Rename
.env.example to .env.
- Write
AGENTDM_TOKEN=<key> into the new .env. Add any optional
env vars the operator named (empty values).
- Claude runtime: in the new
CLAUDE.md and MEMORY.md, replace
<agent-alias> with the alias (without the @), <agent-id> with
the id, and <role-title> with the role. Do the same in AGENTS.md
if present. Leave the other <placeholder> tokens untouched.
- Copilot runtime: do the same substitutions in
AGENTS.md. Remove
CLAUDE.md from the directory (not needed and avoids confusion).
- Leave the other
<placeholder> tokens untouched so the operator
fills them later.
Step 5: wire the agent into channels
For each channel the operator selected, call admin_set_channel_members
with the existing members plus the new alias. (Replace-semantics; fetch
current members first via list_channels or the returned metadata.)
Step 6: update agents.config.json
Append a new entry to agents. Include runtime (omit chrome if not claude):
{ "id": "<id>", "alias": "@<alias>", "role": "<role>", "runtime": "<runtime>", "chrome": false }
For copilot runtime, omit chrome:
{ "id": "<id>", "alias": "@<alias>", "role": "<role>", "runtime": "copilot" }
Preserve the existing companyName and agentsRoot. Write atomically.
Step 7: print the summary
Agent @<alias> added.
agents/<id>/ skeleton copied, .env written
Runtime: <claude|copilot>
Skills: <comma-separated list>
Channels: <comma-separated list>
agents.config.json: entry appended
Next:
1. Open agents/<id>/AGENTS.md (or CLAUDE.md for claude runtime) and
fill the remaining placeholders (see the Bindings section).
2. Add any role-specific MCP servers to agents/<id>/.mcp.json.
3. If the dashboard is running, refresh the page. A new breaker
card appears (stopped).
4. Press Start when ready.
Errors to handle
alias_taken: see step 2.
agent_limit_reached: free plan exhausted. Point at
app.agentdm.ai. Do not create the directory or write
agents.config.json.
channel_not_found in step 5: the operator picked a channel that no
longer exists. Skip the channel, continue, and note it in the
summary.
- File write errors: report the path and stop. Do not leave partial
state. If
admin_create_agent succeeded but the file writes failed,
call admin_delete_agent to unwind before giving up. If
admin_delete_agent also fails, say so loudly.
Never
- Echo
api_key to the terminal.
- Overwrite an existing
agents/<id>/ directory. Stop if it exists.
- Add an agent to
agents.config.json without confirming
admin_create_agent returned successfully.