How to Set Up a Personal AI Agent with OpenClaw and Discor

Published: (February 13, 2026 at 01:27 AM EST)
7 min read
Source: Dev.to

Source: Dev.to

Running Your Own AI Assistant with OpenClaw & Discord

The idea of running your own AI assistant used to sound like something reserved for research labs or large companies. Recently, that barrier has dropped. Tools like OpenClaw make it possible for anyone with a laptop and some curiosity to run a personal AI agent locally.

This guide walks through the process of setting up OpenClaw on your own machine and connecting it to Discord. By the end, you will have an AI agent that lives on your system, remembers conversations, and can interact with you through Discord like a personal assistant that never logs out.


Understanding OpenClaw

OpenClaw began as a small experimental project and quickly grew into one of the fastest‑rising repositories in the open‑source space. It has gone through a few name changes, but the core idea has stayed the same: instead of being just another chatbot that replies to prompts, it behaves like an agent that can take actions.

Once running, OpenClaw can:

  • Browse the web
  • Manage files
  • Run terminal commands
  • Communicate through messaging platforms

It also keeps long‑term memory of conversations and preferences. Everything stays on your own machine, which means you decide what data exists and where it goes.

This local‑first approach is what attracts many developers. Cloud assistants are convenient, but they come with limitations such as usage caps, subscription costs, and questions about data storage. Running an AI agent locally removes most of those concerns.


What You Will Build

By following this guide, you will set up:

  • A self‑hosted OpenClaw AI agent running locally
  • Discord integration for chatting with the agent
  • Persistent memory stored on your system
  • A dashboard to monitor and control the agent

The result is an AI assistant that can respond to you through Discord messages while running quietly in the background on your own hardware.


Why Self‑Hosting an AI Agent Feels Different

Using a cloud chatbot feels temporary—conversations disappear into servers you cannot see. Self‑hosting changes that experience. When OpenClaw runs locally, it becomes part of your environment. It can access local files, remember projects, and respond with context from previous interactions.

The more you use it, the more it behaves like a long‑term collaborator rather than a simple chatbot. With Discord integration, it also becomes accessible from anywhere without exposing your data to external storage.


Prerequisites

Before installing anything, make sure the basics are ready.

  1. Node.js version 22 or higher. Check your version:

    node --version

    If Node.js is not installed or outdated, download the current version from or install through your package manager.

  2. An API key for a language‑model provider. OpenClaw works well with Claude, but other providers or local models can be used.

  3. A Discord account (you’ll need it to create a bot).


Installing OpenClaw

The simplest way to install OpenClaw is globally using npm:

npm install -g openclaw@latest

If you prefer keeping it inside a project folder:

mkdir openclaw
cd openclaw
npm init -y
npm install openclaw@latest

Verify the installation:

openclaw --version

For a local (non‑global) installation you can also run:

npx openclaw --version

If the version number appears, the installation worked correctly.


Building from Source (Optional)

If you want to customize or explore development builds:

git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
pnpm ui:build
pnpm build

This approach is helpful for contributors or anyone who wants deeper control over the code.


Running the Onboarding Wizard

OpenClaw includes a guided setup that configures most things automatically.

Global install

openclaw onboard --install-daemon

Local install

npx openclaw onboard --install-daemon

During onboarding you will:

  • Add your LLM API key
  • Generate a secure gateway token
  • Install OpenClaw as a background service

The daemon option ensures the agent starts automatically when your system boots.


Creating a Discord Bot

To interact with OpenClaw through Discord, create a bot from the Discord Developer Portal.

  1. Open the Discord Developer Portal.
  2. Create a new Application.
  3. Add a Bot to the application.
  4. Copy the Bot Token and store it securely.

Enable these intents in the bot settings:

  • Message Content Intent
  • Server Members Intent

Generate an invite URL with permissions such as Read Messages and Send Messages, then use the link to add the bot to your server.

Enable Developer Mode in Discord settings so you can copy:

  • Server ID
  • Channel ID
  • User ID

These IDs will be needed for configuration.


Configuring OpenClaw for Discord

OpenClaw stores its configuration in:

~/.openclaw/openclaw.json

You can also store sensitive values as environment variables:

export DISCORD_BOT_TOKEN=your_token_here

Example configuration

{
  "llm": {
    "provider": "anthropic",
    "apiKey": "YOUR_ANTHROPIC_API_KEY"
  },
  "channels": {
    "discord": {
      "enabled": true,
      "token": "YOUR_DISCORD_BOT_TOKEN",
      "dm": {
        "enabled": true,
        "policy": "pairing"
      },
      "guilds": {
        "YOUR_GUILD_ID": {
          "channels": {
            "YOUR_CHANNEL_ID": {
              "enabled": true
            }
          }
        }
      }
    }
  },
  "memory": {
    "path": "~/.openclaw/memory.json"
  }
}

Note: Replace the placeholder values (YOUR_...) with the actual IDs and tokens you collected earlier.


Next Steps

  1. Start the daemon (if you didn’t already during onboarding):

    openclaw daemon start
  2. Test the Discord integration by sending a direct message to the bot or posting in a configured channel. The agent should reply.

  3. Explore the dashboard (usually reachable at http://localhost:3000) to monitor logs, memory, and running tasks.

You now have a fully functional, self‑hosted AI assistant that lives on your machine and talks to you via Discord. Enjoy building, iterating, and letting your new collaborator grow alongside your projects!

Configuration Example

{
  "discord": {
    "botToken": "YOUR_BOT_TOKEN",
    "clientId": "YOUR_CLIENT_ID",
    "guildId": "YOUR_SERVER_ID",
    "pairing": {
      "mode": "approval",
      "D_ID": {
        "users": ["YOUR_USER_ID"],
        "requireMention": true,
        "channels": {
          "general": {
            "allow": true,
            "requireMention": true
          }
        }
      }
    }
  }
}

Replace the placeholders (YOUR_BOT_TOKEN, YOUR_CLIENT_ID, YOUR_SERVER_ID, YOUR_USER_ID) with your actual values.

The pairing policy for DMs adds an approval step for security. You can also switch to open or allowlist modes depending on how private you want the bot to be.


Starting the Gateway

Once the configuration is complete, start the gateway:

openclaw gateway --port 18789

Or, if you installed it locally with npm:

npx openclaw gateway --port 18789

Open your browser and go to:

http://localhost:18789

This dashboard lets you monitor activity and manage the agent.

If you installed the daemon earlier, the gateway should start automatically at boot. You can check its status with the appropriate system commands for your OS.


Testing the Discord Integration

  1. Open Discord and go to the server where the bot was added.

  2. Mention the bot in a channel:

    @YourBotName hello

If everything is configured correctly, the bot will reply through OpenClaw.

For direct messages, a pairing code may appear. Approve it using:

openclaw pairing approve discord 

Once paired, you can chat freely through DMs or channels.


Troubleshooting Tips

If the bot connects but stays silent:

  • Confirm Message Content Intent is enabled in the Discord developer portal.
  • Check channel permissions.
  • Make sure you mention the bot if mention mode is enabled.

Run diagnostics:

openclaw doctor
openclaw channels status --probe

These commands help identify configuration or permission issues.


What You Can Do After Setup

With the agent running, it can become part of your daily workflow:

  • Ask for summaries of news or tasks.
  • Organize files and perform quick research.
  • Monitor things and send alerts through Discord.

Over time, its memory builds context around your habits and projects, making the experience feel less like using a tool and more like maintaining a persistent digital assistant that understands your environment.


Conclusion

Self‑hosting an AI agent shifts control back to the user. Instead of relying entirely on cloud services, you get an assistant that lives within your own system and evolves with your usage. The setup requires some technical patience, but the result is a flexible and private AI companion that can be accessed from anywhere through Discord while remaining fully under your control.


Reference

How to Self‑Host OpenClaw for Clawdbot AI Agent

0 views
Back to Blog

Related posts

Read more »