# Migrate Slack Agents

Migrate a classic single-bot Slack install to one provisioned Slack app per existing...

- Repository: https://github.com/nanocoai/nanoclaw (31069 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add nanocoai/nanoclaw --skill migrate-slack-agents -g -a claude-code -y`
Codex: `npx skills add nanocoai/nanoclaw --skill migrate-slack-agents -g -a codex -y`
Cursor: `npx skills add nanocoai/nanoclaw --skill migrate-slack-agents -g -a cursor -y`
Gemini CLI: `npx skills add nanocoai/nanoclaw --skill migrate-slack-agents -g -a gemini-cli -y`

## Description

Migrate a classic single-bot Slack install to one provisioned Slack app per existing agent group while preserving agent identities, workspaces, memory, and wiring behavior, or record the operator's choice to stay on classic, which remains supported. Use when /update-nanoclaw surfaces the Slack agents requirement, or standalone any time later.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Migrate classic Slack agents

Turn every agent group wired through the classic `instance='slack'` adapter into
a named `slack-<slug>` bot without replacing the agent group. This is an
operator-guided, resumable data migration. It never creates an agent group and
never edits an agent workspace.

Migration is optional. Classic single-bot Slack remains fully supported; this
skill first offers the choice, and staying on classic is a valid outcome that
also satisfies the update requirement.

Hard invariants:

- Never call `create_agent` or `ncl groups create`.
- Never change an `agent_groups.id` or write under `groups/<folder>/`.
- Never merge the `channels` branch; fetch and copy skill-owned files only.
- Never print token values. Show key names and masked presence only.
- Keep classic rows, credentials, and the shared Slack app available for
  rollback until the operator explicitly approves cutover.

## Phase 1: Detect classic state

Run from the NanoClaw project root. Read the central DB only through the
sanctioned wrapper.

Classic state requires all four signals:

1. `src/channels/index.ts` contains the Slack barrel import
   `import './slack.js';`.
2. `.env` has a non-empty unsuffixed `SLACK_BOT_TOKEN` and either a non-empty
   `SLACK_APP_TOKEN` or `SLACK_SIGNING_SECRET`. Check presence without echoing
   values.
3. This query returns at least one row:

   ```bash
   pnpm exec tsx scripts/q.ts data/v2.db "SELECT mg.id, mga.id, mga.agent_group_id FROM messaging_groups mg JOIN messaging_group_agents mga ON mga.messaging_group_id=mg.id WHERE mg.channel_type='slack' AND mg.instance='slack' ORDER BY mg.id, mga.agent_group_id"
   ```

4. At least one wired group does not yet have complete named-instance coverage:
   a stable slug, both `SLACK_BOT_TOKEN_<SUFFIX>` and
   `SLACK_APP_TOKEN_<SUFFIX>`, that slug in `SLACK_INSTANCES`, and the expected
   `slack-<slug>` messaging-group/wiring rows.

The rest: https://github.com/nanocoai/nanoclaw/blob/HEAD/.claude/skills/migrate-slack-agents/SKILL.md
