What the agent does
The agent reads how commands are declared and loaded before converting any. In a bot laid out like Der-Eddy/discord_bot, requirements.txt pins discord.py==2.7.1, main.py subclasses commands.AutoShardedBot with command_prefix=loadconfig.__prefix__, which config/config.example.py defaults to :, and loads the extensions from config/cogs.py inside on_ready, which also starts a presence loop; on_message refuses direct messages and calls process_commands, on_command counts each command's use, and on_command_error posts an embed to the owner. cogs/utility.py declares status, ping, about, log, invite, whois, emoji, emojis, server, timer, source, games and spoiler with @commands.command, several with aliases and cooldowns, whois taking a discord.Member, timer taking a custom TimeParser converter, and log taking a variadic *limit: int. No file in the repository mentions app_commands, so the bot has no slash commands at all, and the tests.py sketch at the root constructs the bot without its required argument, while tests/test_send.py refers to a client it never defines.
Conversion starts with the utility cog, because its commands are public and read-only. Each @commands.command becomes @commands.hybrid_command with the same name and aliases, so :ping keeps working and /ping appears, and each parameter gets an app_commands.describe so the slash picker shows what it takes. Two signatures cannot be hybrid as they are: timer's TimeParser becomes an app_commands.Transformer that wraps the same parsing, and log's *limit becomes one optional limit: int, since a slash command has no variadic arguments. Commands that fetch history or many emojis call await ctx.defer() first, because an interaction must be answered within seconds where a prefix command could take its time. cog_command_error and the cooldowns keep working, since hybrid commands run through the same Context.
Registration moves to where discord.py expects it. The extension loading leaves on_ready, which runs again on every reconnect, for setup_hook, and the same hook copies the global commands to the server named by __botserverid__ with tree.copy_global_to and syncs that guild, so the commands show up there at once. Global sync is left to a new owner-only :sync command in cogs/admin.py beside shutdown and restart, because syncing globally on every start is rate limited and takes up to an hour to show. The admin cog's own commands stay prefix-only and hidden, as they are today. loadconfig.py and the Docker environment are unchanged, since the server id already comes from DISCORD_BOTSERVERID.
The proof does not need a token. tests/test_tree.py under pytest and pytest-asyncio constructs ShinobuBot(docker=False), loads cogs.utility and cogs.admin with await bot.load_extension, and asserts the tree lists ping, about, whois, server, timer and the rest with a description on every parameter, that shutdown is absent from the tree, and that :ping still resolves through bot.get_command. The two existing sketches are left alone and named in the pull request as not runnable. python -m pytest tests/test_tree.py and python -c 'import cogs.utility' end the run, and the README's command table gets a column noting which commands are available as slash commands.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add slash commands to this discord.py bot without dropping the prefix commands. Read main.py, loadconfig.py, config/config.example.py, config/cogs.py, cogs/utility.py, cogs/admin.py, cogs/help.py, requirements.txt, tests.py and tests/test_send.py first. In cogs/utility.py convert each public commands.command to commands.hybrid_command with the same name and aliases, add app_commands.describe for every parameter, turn the TimeParser converter into an app_commands.Transformer for timer, replace log's variadic limit with one optional int, and defer in commands that fetch history or list emojis. Move extension loading from on_ready to setup_hook, and there copy the global commands to the guild from the configured bot server id and sync that guild. Add an owner-only sync command to cogs/admin.py for global sync and keep the admin commands prefix-only. Add pytest and pytest-asyncio to the requirements and write tests/test_tree.py that builds the bot, loads the two cogs and asserts the tree's command names, parameter descriptions and the absence of admin commands, without connecting to Discord. Note which slash commands exist in the README's command table. Run the tests and open a pull request with the output.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The pull request changes main.py, cogs/utility.py, cogs/admin.py, requirements.txt and README.md, adds tests/test_tree.py, and leaves cogs/fun.py, cogs/anime.py, cogs/forum.py and cogs/mod.py prefix-only, each named in the description as the next cog to convert. The description pastes the pytest run and the tree listing the test printed, so a reviewer sees every slash command and its parameters before the bot ever connects.
On the next start the bot's server shows the utility commands in the slash picker, with descriptions, while :ping and :whois @someone keep answering as before. Members who type / discover commands they never read the README for, and a slash invocation does not need the message content intent that the prefix path still uses.
Before merging, a reviewer runs the bot once against the server, checks that timer's transformer accepts the same inputs as the prefix form, and decides when to run :sync for a global rollout, since that takes effect across servers over the following hour.
Run it on every Linear issue labelled agent
Label the issue that names the cog to convert, and an automation in the Project with a linear trigger on linear.issue.labeled and the label agent starts one run per labelled issue, with the issue's text after the automation's prompt. The prompt asks for the same shape every time: hybrid commands with descriptions, converters turned into transformers, deferred answers where a command is slow, and a tree test with no token. A run whose issue names a cog that is already hybrid opens no pull request and says so on the issue.
Each run opens its own pull request that links the issue, so the person who labelled it reviews the diff and the test output there. The automation's max_runs_per_hour caps a burst of labels, and a label added twice is deduplicated on Linear's delivery id.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
Slash commands fail in ways a prefix bot never did: a converter the interaction system cannot call, a variadic argument, an answer that comes after the interaction expired, a sync in the wrong place that hits a rate limit on every restart. The agent reads every signature in the cog and where the bot registers extensions before converting, and proves the registered tree in its sandbox without a bot token.
The run keeps every command and its output, so the reviewer reads the tree listing and the test run without installing discord.py or inviting a test bot. Several bots can be converted at once, each in its own sandbox, and one that already uses hybrid commands gets only the descriptions and the test.
Frequently asked questions
Will the prefix commands stop working?
No. A hybrid command is registered both as a prefix command and as a slash command, so :ping and /ping run the same function. The test asserts bot.get_command('ping') still resolves.
Why sync to one guild in setup_hook and not globally?
A guild sync shows the commands on that server at once, while a global sync is rate limited and can take up to an hour to appear, so doing it on every start is both slow and risky. The owner-only :sync command runs the global sync when the person wants it.
What about the timer command's custom converter?
TimeParser is a prefix-command converter that the interaction system cannot call. The agent wraps the same parsing in an app_commands.Transformer, so /timer accepts the same strings as :timer, and the reviewer checks a few inputs on the real server.
Can the test run without a Discord token?
Yes. Loading extensions and reading bot.tree.get_commands() needs no connection, so the test constructs the bot, loads two cogs and inspects the tree. Anything that needs the gateway, such as the presence loop in on_ready, never runs.
More discord.py jobs
The same job on other stacks
- Add a Slash Command With a Modal to a Slack Bolt App (Slack Bolt)
- Add a Slash Command to a discord.js Bot (discord.js)