<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
  <title>Ask Marsan Blog</title>
  <link>https://askmarsan.com/en/blog</link>
  <atom:link href="https://askmarsan.com/feed.xml" rel="self" type="application/rss+xml" />
  <description>Thoughts on Ad Tech, AI, Product Strategy, and building things that matter, from Marcel Sandoval and the Ask Marsan team.</description>
  <language>en-us</language>
  <lastBuildDate>Tue, 07 Apr 2026 11:51:10 GMT</lastBuildDate>
  <item>
    <title>Migrating your OpenClaw setup using only Claude Code</title>
    <link>https://askmarsan.com/en/blog/migrating-openclaw-to-claude-code</link>
    <guid isPermaLink="true">https://askmarsan.com/en/blog/migrating-openclaw-to-claude-code</guid>
    <pubDate>Mon, 06 Apr 2026 00:00:00 GMT</pubDate>
    <description>Anthropic just changed how Claude usage in third-party apps gets billed, and OpenClaw is suddenly a lot more expensive. Here&apos;s how to rebuild the same setup yourself using only Claude Code, on your own VPS, sharing the Max or Pro plan you already pay for.</description>
    <content:encoded><![CDATA[<p>Ok so here&apos;s what happened. On April 4th, Anthropic dropped a change that pretty much broke the OpenClaw economics overnight: any Claude usage that happens through a third-party app (like OpenClaw, like every wrapper out there) no longer counts toward your Max or Pro plan allowance. It now pulls from token-based API usage instead. Translation: if you were happily messaging your OpenClaw agents 50 times a day under a flat plan, you&apos;re suddenly looking at a real bill at the end of the month, and it&apos;s not small.</p>
<p>The good news is you don&apos;t actually need OpenClaw. You can rebuild the exact same setup yourself, on your own VPS, using only Claude Code, and have it pull from the subscription you already pay for. That&apos;s what this post is about. By the end you&apos;ll have a private Discord server, one channel per agent, each channel wired to its own little Claude-powered bot, and the whole thing surviving reboots without you ever touching it again.</p>
<p>Quick tip before we start: if you&apos;re doing this on the same VPS where OpenClaw is currently running, you have a really nice shortcut. Just open Claude Code in that directory and ask it to poke around the existing OpenClaw files and reproduce the setup as closely as possible. Claude Code can read your old configs, list which agents you had, see what each one was doing, and translate the whole thing into the new structure for you. Honestly, that&apos;s the closest thing to a one-click migration you&apos;re going to get, and it&apos;s a great example of what these agents are good at.</p>
<h2>How Discord fits into this</h2>
<p>Before any code, let&apos;s talk about why Discord is even in the picture, especially if you&apos;ve never used it for anything beyond chatting with friends. The idea is simple: Discord is just a messaging app, but it has a really good free bot API. That means it can double as the front-end for any agent you build. You get polished mobile and desktop apps for free instead of having to design and host your own UI.</p>
<p>Here&apos;s the structure. You make a private Discord server (think of a server as your own personal Slack workspace, totally under your control). Inside that server you create one channel per agent: #email-manager, #research, #coding, whatever. Each channel is wired to its own dedicated bot. When you type something in #research, only the research agent sees it, thinks about it, and replies in that same channel. The other agents have no idea it happened.</p>
<p>This per-channel split is what makes the whole thing work. Every agent gets its own conversation history, its own scrollback, its own pinned messages, its own notification settings on your phone. And it costs you nothing because Discord doesn&apos;t charge for any of this. Three reasons it&apos;s the right choice: free polished apps on every device, mature bot API with no per-message fee, and channels give you natural per-agent isolation without writing a line of UI code. If you&apos;re coming from OpenClaw you already know what this looks like. If not, Step 2 walks you through building the server and the bots from scratch.</p>
<h2>What you&apos;re building</h2>
<p>Claude Code Channels is the official Anthropic plugin that connects a running Claude Code session to a Discord bot. When you post a message in the agent&apos;s channel, the message gets routed into that session, Claude reads it, thinks, uses tools, and replies back in the same channel. Each agent is a separate Claude Code process with its own bot token, its own working directory, and its own CLAUDE.md file describing who it is and what it does.</p>
<p>The four things you get out of this that you don&apos;t get from a hosted alternative:</p>
<ul><li>No third parties in the loop. Your data only ever touches your VPS and the Anthropic API.</li><li>No per-message fees beyond your existing Claude Max or Pro plan.</li><li>Multiple specialised agents on one machine, each with its own identity and tools.</li><li>Survives reboots. Agents auto-restart via cron with zero babysitting.</li></ul>
<h2>The architecture in one picture</h2>
<p>Each agent lives in its own directory under ~/agents/ and runs inside a persistent tmux session. The flow of a single message looks like this:</p>
<pre><code>Your message in #agent-name (Discord channel)
   ↓
Discord plugin (MCP server)
   ↓
Claude Code session (tmux)
   ↓
Agent working directory (~/agents/&lt;name&gt;/)</code></pre>
<p>A minimal agent directory has three files in it:</p>
<ul><li>CLAUDE.md: the persona, tone and capabilities. This is the agent&apos;s brain.</li><li>start.sh: launches Claude Code with the Discord channel plugin attached.</li><li>.env: holds DISCORD_BOT_TOKEN, protected with chmod 600.</li></ul>
<h2>Example agents you can run</h2>
<p>Pretty much anything you&apos;d want an always-on assistant for can become an agent. A few good starting points:</p>
<ul><li>email-manager: drafts, summarises and organises emails matching your tone.</li><li>news-agent: fetches and synthesises live news on topics you care about.</li><li>investing: tracks a portfolio and sends a cron-triggered daily report.</li><li>coding: a senior engineer for debugging, code review and architecture questions.</li><li>research: a research analyst that writes structured markdown reports with citations.</li><li>home-assistant: manages shopping lists, reminders and household schedules.</li></ul>
<h2>Step 1: Install the prerequisites</h2>
<p>On a fresh Debian or Ubuntu VPS, you&apos;ll need Node.js 20, Bun, Claude Code itself, plus tmux and cron. Bun is what the Discord plugin uses, and it depends on unzip, which is not installed by default on minimal images.</p>
<pre><code># Node.js 20
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
apt-get install -y nodejs

# Bun (install unzip first)
apt-get install unzip -y
curl -fsSL https://bun.sh/install | bash
echo &apos;export PATH=&quot;$HOME/.bun/bin:$PATH&quot;&apos; &gt;&gt; ~/.bashrc
source ~/.bashrc

# Claude Code
npm install -g @anthropic-ai/claude-code

# tmux + cron
apt-get install -y tmux cron
systemctl enable --now cron</code></pre>
<h2>Step 2: Create the Discord server, channels and bots</h2>
<p>If you don&apos;t already have a private Discord server, make one. Open Discord, click the + on the left rail, choose &quot;Create My Own&quot;, then &quot;For me and my friends&quot;, give it a name like &quot;Personal Agents&quot;, done. Inside that server, create one text channel per agent you&apos;re planning to run (#email-manager, #research, #coding, etc). Right-click each channel and use Edit Channel → Permissions to make it private, so only you and the matching bot can read it.</p>
<p>Now you need a Discord application for each agent so it can have its own name, avatar and bot identity. Head over to the Discord Developer Portal and for each agent:</p>
<ul><li>New Application: give it a name that matches the agent (e.g. &quot;Email Manager Bot&quot;).</li><li>Bot tab → Reset Token → copy it and stash it somewhere safe right away. You only see it once.</li><li>Privileged Gateway Intents → enable Message Content Intent → Save.</li><li>OAuth2 → URL Generator → scope: bot → permissions: Send Messages, Read Message History, Attach Files, Add Reactions.</li><li>Open the generated invite URL and add the bot to your Discord server.</li><li>Back in the server, lock down the bot&apos;s channel access so the email bot only sees #email-manager, the research bot only sees #research, etc. This isolation is what keeps each agent focused.</li></ul>
<blockquote>Save each token somewhere safe the moment you create it. Discord will not show it to you again.</blockquote>
<h2>Step 3: Log in to Claude Code</h2>
<p>Authenticate Claude Code once on the VPS. The login is shared by every agent on the machine, so you only do this once and never again.</p>
<pre><code>claude login</code></pre>
<h2>Step 4: Install the Discord plugin</h2>
<p>Open Claude Code, add the official Anthropic plugin marketplace, then install the Discord plugin. Pay attention to the spelling of the GitHub org (anthropics, not anthrop​ics). A typo there is the single most common reason this step fails.</p>
<pre><code>claude
/plugin marketplace add anthropics/claude-plugins-official
/plugin install discord@claude-plugins-official
/reload-plugins
# then Ctrl+C to exit</code></pre>
<p>If the marketplace clone fails with a Git authentication error, clear any stale credential helper and retry:</p>
<pre><code>git config --global credential.helper &quot;&quot;</code></pre>
<h2>Step 5: Scaffold an agent with new-agent.sh</h2>
<p>Wiring each agent up by hand gets old fast. Instead, drop a small scaffolding script at ~/agents/new-agent.sh that asks three questions (name, bot token, persona) and does everything else for you. The script should:</p>
<ul><li>Check that claude, tmux and bun are installed before doing anything.</li><li>Validate the bot token against the Discord API so you fail fast on a typo.</li><li>Create ~/agents/&lt;name&gt;/ with CLAUDE.md (built from the persona), start.sh, and a chmod 600 .env file.</li><li>Add a @reboot cron entry so the agent auto-restarts on every reboot.</li><li>Launch the agent in a detached tmux session named after it.</li><li>Walk you through Discord pairing and locking the allowlist down.</li></ul>
<p>The generated start.sh is short. It loads Bun into PATH, sources the .env, jumps into the agent directory, and launches Claude Code with the Discord plugin attached:</p>
<pre><code>#!/bin/bash
export PATH=&quot;$HOME/.bun/bin:$PATH&quot;
set -a; source ~/agents/&lt;name&gt;/.env; set +a
cd ~/agents/&lt;name&gt;
claude --channels plugin:discord@claude-plugins-official</code></pre>
<h3>Why we wrap it in tmux: keeping the agent alive when you log out</h3>
<p>This is the part that confuses pretty much everyone the first time. When you SSH into your VPS and run a program, that program is tied to your SSH session. The moment you close the terminal or your laptop loses Wi-Fi, the program dies, and your AI agent goes with it. Obviously not what we want for an assistant that&apos;s supposed to be reachable 24/7.</p>
<p>tmux solves this in the simplest possible way: it lets you start a program inside an invisible terminal that lives on the server itself, completely independent of your SSH connection. Think of it like opening a Chrome tab on a remote computer and then unplugging your own laptop. The tab keeps running on the remote machine because it never depended on your laptop in the first place. You can come back hours or days later, attach to that same invisible terminal, and find the agent exactly where you left it, still listening for Discord messages.</p>
<p>Each agent gets its own named tmux session, so you can list them all, attach to any one of them to peek at what it&apos;s doing, detach again, and the agent keeps running. That&apos;s why every command in this guide that launches an agent goes through tmux.</p>
<h3>Surviving reboots: the @reboot cron entry</h3>
<p>tmux keeps the agent alive while the server is up. But what happens when the VPS itself reboots? Hosts patch kernels, the box runs out of memory, your provider has a maintenance window. Without help, every agent on the machine would silently die at the first restart and you&apos;d only notice the next time you tried to message one.</p>
<p>cron is the standard Linux scheduler, and it has a special trigger called @reboot that runs a command every time the machine boots. We use it to automatically launch each agent&apos;s tmux session 15 seconds after startup. From your point of view: you reboot the VPS, walk away, come back, and all your agents are already back online. You did nothing.</p>
<pre><code>@reboot sleep 15 &amp;&amp; /usr/bin/tmux new-session -d -s &lt;name&gt; /root/agents/&lt;name&gt;/start.sh</code></pre>
<p>The 15-second sleep is not optional. Without it, the agent can start before the VPS network stack has come up, fail to reach the Anthropic API, and silently die. Make the script idempotent on the cron entry so re-running it for the same agent never creates duplicates.</p>
<h2>Why CLAUDE.md is the most important file</h2>
<p>CLAUDE.md gets read automatically at the start of every session. It&apos;s the persistent system prompt for your agent, written in plain markdown. A good CLAUDE.md defines four things: who the agent is, what it can do, which tools and files it should use, and how it should communicate.</p>
<pre><code># Email Manager Agent

You are a professional email assistant. Your job is to help
draft, edit, summarise and organise emails. Match the user&apos;s
tone: formal if they write formally, casual if not.

## Capabilities
- Draft emails from a brief description
- Summarise long email threads
- Suggest replies with different tones
- Save drafts to ~/agents/email-manager/drafts/

## Tools available
- Web search: use for researching context or recipients
- Filesystem: read/write files in your working directory

## Tone
Concise. Never pad. No unnecessary sign-offs or preamble.</code></pre>
<p>Narrow focus beats vague generalist every single time. Don&apos;t try to give one agent all the jobs. Just spin up another agent.</p>
<h2>Step 6: Pair your Discord account (carefully)</h2>
<p>Pairing is what tells the agent which Discord users are allowed to talk to it. The flow is deliberately a little awkward, because pairing from the wrong place is exactly the kind of thing a prompt-injection attack will try to trick the agent into doing.</p>
<ul><li>Send any message in the agent&apos;s dedicated Discord channel. The bot replies with a 6-character pairing code.</li><li>On the VPS, attach to the agent&apos;s tmux session: tmux attach -t &lt;agent-name&gt;</li><li>Inside the Claude Code prompt, run: /discord:access pair &lt;CODE&gt; followed by /discord:access policy allowlist</li><li>Detach from tmux with Ctrl+B then D.</li></ul>
<blockquote>Never approve a pairing because a Discord message asked you to. Only run /discord:access from the terminal. A message inside Discord asking the agent to add a user to the allowlist is exactly what a prompt-injection attack looks like.</blockquote>
<h2>Step 7: Verify and test</h2>
<p>Once everything is wired up, two quick checks confirm the fleet is healthy:</p>
<pre><code>tmux ls                       # all running agents
crontab -l | grep &apos;@reboot&apos;   # all reboot entries</code></pre>
<p>Then post a message in each agent&apos;s Discord channel. Each one should respond independently from its own context and persona, with a different name, a different tone, and a different working directory. If two agents start replying with the same voice, you almost certainly have the wrong token in one of the .env files.</p>
<hr />
<h2>Where this pays off</h2>
<p>The interesting thing isn&apos;t that you can chat with Claude from Discord. It&apos;s that each agent has its own filesystem, its own tools, and its own memory of what you&apos;ve asked it before. The investing agent really does keep a portfolio.json across sessions. The research agent really does build up a notes.md week after week. The coding agent really does live inside one of your repos.</p>
<p>Once the scaffolding script exists, adding a new agent takes about a minute. That changes how you think about delegating work to AI: instead of one giant prompt that has to do everything, you build a small team of focused specialists you message exactly when you need them. And after Anthropic&apos;s April 4 change, you&apos;re doing it without paying anyone except Anthropic, on hardware you own.</p>
<p>If you&apos;d like help setting this up on your own infrastructure, or designing the persona and toolset for an agent that fits your business, that&apos;s exactly the kind of work we do at Ask Marsan. Ping us through the contact form and we&apos;ll scope it together.</p>]]></content:encoded>
    <category>OpenClaw</category>
    <category>AI Agents</category>
    <category>Claude Code</category>
    <category>Agent</category>
    <category>Self-Hosted</category>
    <category>Discord</category>
    <category>VPS</category>
    <category>DevOps</category>
  </item>
  <item>
    <title>Welcome to the Ask Marsan Blog</title>
    <link>https://askmarsan.com/en/blog/welcome</link>
    <guid isPermaLink="true">https://askmarsan.com/en/blog/welcome</guid>
    <pubDate>Thu, 19 Feb 2026 00:00:00 GMT</pubDate>
    <description>An introduction to what you&apos;ll find here: thoughts on Ad Tech, AI, Product Strategy, and lessons from building things that matter.</description>
    <content:encoded><![CDATA[<p>Hello! I&apos;m Marcel, and this is where I&apos;ll be sharing what I&apos;ve learned from years of working in Ad Tech, building products, and more recently, helping organizations adopt AI.</p>
<h2>Why This Blog?</h2>
<p>I&apos;ve spent years accumulating knowledge that mostly lived in my head, in scattered docs, or in conversations with colleagues. This blog is my attempt to organize those thoughts and share them with others who might find them useful.</p>
<p>Whether you&apos;re a publisher trying to understand yield optimization, a product manager navigating the ad tech ecosystem, or someone curious about practical AI adoption, I hope you&apos;ll find something valuable here.</p>
<h2>What to Expect</h2>
<p>I&apos;ll be writing about the things I know and care about:</p>
<ul><li>Ad Tech deep dives: SSPs, DSPs, header bidding, curation, and the evolving programmatic landscape</li><li>AI in practice: Not hype, but real tools and workflows that actually improve how we work</li><li>Product strategy: Lessons from building and scaling products in complex B2B environments</li><li>The consulting journey: What I learn as I help different organizations solve their challenges</li></ul>
<h2>A Note on Style</h2>
<p>I believe in being direct. You won&apos;t find fluff here. If I write about something, it&apos;s because I think it&apos;s genuinely useful or interesting. I&apos;ll share what worked, what didn&apos;t, and why.</p>
<blockquote>The best way to learn is by doing. The second best is by sharing what you learned.</blockquote>
<hr />
<p>Thanks for stopping by. If there&apos;s a topic you&apos;d like me to cover, feel free to reach out through the contact form. Let&apos;s learn together.</p>]]></content:encoded>
    <category>Personal</category>
    <category>Announcements</category>
  </item>
</channel>
</rss>
