Installing & Using

axon install @axon/discord

Run from your agent directory. The module source lands in modules/discord/, its npm dependencies are added to the agent environment, and the CLI lists any env keys it needs.

Configuring env keys

Modules declare the env keys they require. After install, add them to your agent's .env:

DISCORD_BOT_TOKEN=your-bot-token-here

The CLI prints exactly what's needed and why. Nothing is set automatically — you provide the values.

Configuring options

Modules can expose options that control their behaviour. These are set in axon.config.ts under the module name:

export default defineAgent({
    modules: {
        discord: {
            mentionOnly: true,
            channelIds: "1234567890,0987654321",
        },
    },
})

Options are declared by the module with types and defaults. Run axon prepare after installing to get type declarations — your editor will tell you exactly what's available.

Subscribing to hooks

Most integration modules emit hooks when external events arrive. You subscribe in a server plugin:

// server/plugins/discord.ts
export default defineAxonPlugin(async (axon) => {
    axon.hooks.on("discord:message.received", async ({ content, username, reply }) => {
        const prompt = await axon.prompt("discord/discord", { content, username })
        const result = await axon.request({ prompt })
        await reply(result.text)
    })
})

The hook payload is typed from the module's emits declaration. Your editor knows what fields are available.

Using contributed tools

Modules contribute tools under their namespace. After axon prepare, they are fully typed on axon.tools:

// In a script or route handler
const pr = await github.openPr("fix: auth", body, "feat/auth")
const issues = await kanban.list({ status: "open" })

Run axon prepare any time you install or update a module to regenerate type declarations.

The full install flow

axon install @axon/discord   # fetch source, add deps, print env requirements
# add DISCORD_BOT_TOKEN to .env
axon prepare                 # regenerate types

Then add a plugin to subscribe to hooks, and the agent is live.