# Team templates — scoped Telegram bots

Drop-in configs for adding a second (or third, or fourth) Telegram bot to ClaudeClaw, each with a different scope. **Inert until you activate them.**

## What's in each folder

- `agent.yaml` — name, bot-token env-var pointer, default model, optional Obsidian + MCP allowlist + War Room tools allowlist. Matches the schema enforced by `ClaudeClaw/claudeclaw-os/src/agent-config.ts`.
- `CLAUDE.md` — system-prompt overlay loaded by the agent on every spawn. The skill-scoping rules are written *here* (in plain English) because `agent-config.ts` does not yet expose a `skill_allowlist` field. Until that ships, the CLAUDE.md is the binding contract.
- `skill-allowlist.txt` — newline-separated list of slash-command slugs the agent is *intended* to use. Mirrored in `CLAUDE.md`. Treat as a single source of truth that the operator + CI scripts can read; the agent reads it via the `CLAUDE.md`.

## Activation (4 steps)

1. **Create the Telegram bot.** Open `@BotFather` in Telegram → `/newbot` → pick a handle (e.g. `Kawader_Prod_Bot`) → copy the token.
2. **Add the token to `.env`.** Open `/Users/Kawader/ClaudeClaw/claudeclaw-os/.env` and add the matching env line (look at the `telegram_bot_token_env` field in each role's `agent.yaml` to know which var to set):
   ```bash
   PROD_BOT_TOKEN=123456789:AAFxxxx
   RENTALS_BOT_TOKEN=123456789:AAFxxxx
   ACCOUNTING_BOT_TOKEN=123456789:AAFxxxx
   ```
3. **Copy the role folder into `agents/`:**
   ```bash
   cp -r /Users/Kawader/KAWASIST/outputs/claudeclaw-guide/team-templates/production /Users/Kawader/ClaudeClaw/claudeclaw-os/agents/production
   ```
   Same for `rentals`, `accounting`.
4. **Start the bot in a separate process:**
   ```bash
   cd /Users/Kawader/ClaudeClaw/claudeclaw-os
   npm start -- --agent production
   ```
   Or run all four in parallel via `pm2 start ecosystem.config.cjs` after adding a process entry per agent.

## Verification (do this BEFORE giving the bot to a team member)

For each new agent:

1. Open `t.me/<NewBotHandle>` → send `/start` → confirm the bot replies and identifies as that role.
2. Send a skill name NOT on the allowlist (e.g. for Accounting, send `/rental-audit`). The bot should refuse and explain its scope. If it actually runs the skill, the CLAUDE.md scoping is too weak — tighten the language.
3. Send a write-intended request the role should not have (e.g. for Production, "send a WhatsApp message to a customer"). Expect refusal with the scope reason.
4. Open `Dashboard → System → Recent activity` — the new bot's hive-mind entries should appear with `agent_id = <role>`.

## Cost expectations (each agent)

- One agent turn = one Claude API call. Model defaults to `claude-sonnet-4-6` in these templates (~25× cheaper than Opus). Override per chat with `/model claude-opus-4-6` if a turn needs heavy reasoning.
- Idle agents cost zero — the API is only billed on a spawn.
- Telegram bot itself is free.

## What's NOT scaffolded here

- Cron / launchd entries for keeping each agent's process running. Use `pm2` (`pm2 start npm --name claudeclaw-production -- start -- --agent production`).
- Per-agent kill switches in the dashboard. Today the global kill switches affect all agents. Proposed roadmap item #6.
- A skill-allowlist enforcement at the SDK boundary. Today scoping is enforced *only* via the CLAUDE.md system-prompt language. Proposed roadmap item #11.

## Memory sharing

By default all agents share the same memory store (`~/.claude/projects/-Users-Kawader-KAWASIST/memory/`) so the Production bot can recall facts the Main bot learned. If you want isolated memories per role, set `CLAUDECLAW_MEMORY_PATH=/path/to/role-memory` in the agent's process env before `npm start`.
