DEV Community

~K¹yle Million
~K¹yle Million

Posted on

How I Built a Fully Autonomous AI Business in 48 Hours with Claude Code

How I Built a Fully Autonomous AI Business in 48 Hours with Claude Code

This is not a tutorial. It's a field report.

Two days ago I had an idea: could I build an entire AI consulting business — content, product delivery, payments, customer communication — that runs itself without me touching it? Not "mostly automated." Fully autonomous.

Here's exactly what I built, how it works, and what I learned.


The Goal: Revenue Without Babysitting

Most "passive income" advice is either vague or manually intensive. I wanted something different: a system that generates income while I'm doing literally anything else. The constraint was Claude Code as the runtime — I wanted to prove that one tool, used correctly, could close the loop from content to cash.

The system had to:

  1. Generate and publish content autonomously
  2. Handle product delivery without my involvement
  3. Accept payments and fulfill orders automatically
  4. Monitor itself and recover from failures

Here's what I built.


Layer 1: The Autonomous Loop

The foundation is a headless Claude Code execution pattern running on a cron schedule:

*/10 7-23 * * * bash ~/intuitek/run_task.sh "Check inbox for tasks. If empty, 
identify highest-leverage action and execute it."
Enter fullscreen mode Exit fullscreen mode

Every 10 minutes, Claude Code wakes up, checks for work, and either executes a task or autonomously selects and completes the next highest-value action. This is the heartbeat. Everything else sits on top of it.

The critical design decision: the agent writes its intent before executing. Every significant action gets logged to outputs/ before the API call happens. If something crashes, the record of intent is preserved. This is what makes recovery possible.


Layer 2: The CLAUDE.md Operating Contract

Every Claude Code session loads CLAUDE.md first. This isn't documentation — it's the operating contract. It defines:

  • What the agent is allowed to do without approval (filesystem, APIs, content creation)
  • What requires Kyle's approval before proceeding (production deploys, irreversible deletes, credential changes)
  • Where results go (outputs/) and how failures are reported (errors.log + Telegram)
  • Model routing rules — Ollama local (Tier 0) → Haiku (Tier 1) → Sonnet (Tier 2) → Opus (Tier 3 only)

Without this file, Claude Code is a capable tool. With it, it's an autonomous agent that makes consistent decisions across sessions.


Layer 3: Product Delivery — ACE License Server

Before content, I needed a product to sell. I built ACE (Agent Commerce Engine) on Railway:

  • FastAPI handles the business logic
  • Stripe webhooks trigger on payment completion
  • Fernet encryption protects license keys in transit
  • Resend delivers the license package to the customer's email within seconds of payment

The whole thing runs on Railway's free tier at zero cost until the first transaction. When a customer buys a skill on ClawMart, the webhook fires, ACE provisions the license, and Resend delivers it. No human in the loop.

Total Claude Code build time: one session.


Layer 4: The Marketplace Presence — ClawMart

I listed 14 skills on ClawMart at shopclawmart.com/@thebrierfox. These are distilled, tested skill definitions for Claude Code — things like:

  • Token optimization protocols that cut API costs 40-60%
  • Agent error recovery patterns with automatic escalation
  • Multi-agent coordination frameworks for parallel builds
  • CLAUDE.md templates for different production scenarios

Pricing runs from $19 (individual skills) to $149 (complete bundles). The listing descriptions are written by the agent, updated by the agent, and linked directly to the Stripe payment links that route to ACE.


Layer 5: Content Flywheel

The content layer is where it gets interesting. The same autonomous loop that checks the inbox also writes and publishes articles.

When the inbox is empty — meaning no explicit tasks — the agent evaluates the current state of the revenue goal and identifies the highest-leverage idle-state action. Right now, that's content creation and distribution. In 48 hours:

  • 19 articles published on dev.to, all tagged claudecode
  • 15 posts on r/ClaudeCode
  • Zero manual writing by me

The agent doesn't just write. It follows a posting strategy derived from Reddit's spam filter behavior (new accounts get filtered if they post external links in the body — so the agent posts full content inline and drops the dev.to URL as the first comment). It checks lock files before posting to avoid race conditions between the cron loop and interactive sessions. It refreshes OAuth tokens automatically when they expire.

The content directly pre-sells the ClawMart skills. An article about model routing cost optimization leads naturally to: "The token optimization skill on ClawMart implements exactly this — $29."


Layer 6: The Shared Mind

Two Claude Code instances run on the same machine. They share a file called SHARED_MIND.md — a joint operational picture that both read at every session start and update after every significant action.

This is what prevents collisions and duplicated work. Before either instance posts to Reddit, it writes a lock file. The other instance sees the lock and skips. When one instance learns something new — a Reddit spam filter behavior, an API quirk, a token refresh flow — it writes that to SHARED_MIND.md and both instances have it on the next run.

Two agents, one operating picture. No central coordinator. No message bus. Just a shared file and a protocol both instances follow.


What Works, What Doesn't

Works well:

  • Headless execution via claude -p "prompt" --allowedTools "..." — reliable, logs cleanly, exits with meaningful codes
  • CLAUDE.md as the operating contract — the agent makes consistent decisions across sessions because the boundaries are explicit
  • Write-before-execute — recording intent in outputs/ before API calls makes recovery trivial
  • Lock file coordination — simple, zero infrastructure, works across processes

Doesn't work yet:

  • Revenue. The funnel is fully built. The content is live. The payment flow works end-to-end. But the distribution reach is still early — 15 Reddit posts at 1 upvote each, articles indexed but not yet surfaced. This is a time variable, not a technical one.

What surprised me:

  • The agent's judgment is actually good. When I give it a goal rather than a task, it picks sensible actions. The approval boundary in CLAUDE.md is what makes this safe — it knows exactly where to ask versus where to act.
  • Context collapse is the real failure mode. When a session runs too long without writing progress to outputs/, partial results get lost. The solution is obsessive logging — write the intent, write the progress, write the result, in that order.
  • Concurrent sessions cause race conditions. When I'm actively working in Claude Code and the cron fires simultaneously, they can conflict. The lock file protocol mostly solves this, but it needs explicit enforcement at every autonomous posting action.

The Stack (All Running Now)

Layer Tool Status
Runtime Claude Code (headless + interactive) Live
Scheduling System crontab → run_task.sh Live
Local inference Ollama qwen2.5:7b Live
Product marketplace ClawMart (14 listings) Live
Payment Stripe (3 payment links) Live
License delivery ACE on Railway Live
Email delivery Resend (intuitek.ai domain) Live
Content dev.to + Reddit (autonomous loop) Live
Shared memory SHARED_MIND.md + Supabase LTM Live
Notifications Telegram bot Live

Total infrastructure cost: $0/month until first sale. Railway free tier, Supabase free tier, ClawMart percentage-based, Resend free tier.


The Skills That Power This

Everything described here is available as distilled, tested skill definitions on my ClawMart shop at shopclawmart.com/@thebrierfox.

The skills aren't theoretical — they're extracted from this exact system. The error recovery patterns, the model routing logic, the CLAUDE.md templates — all of it is packaged and ready to drop into your own Claude Code setup.

If you're building autonomous agents with Claude Code and want to skip the 48 hours of trial and error, the complete bundle at $149 covers the full stack. Individual skills start at $19.


What's Next

The purchase flow is live. The content is running. The monitoring is in place. The next milestone is first sale.

That's not a Claude Code problem — it's a distribution problem. More eyeballs, better SEO, more posts across more communities. The autonomous loop handles that without my involvement.

The machine is running. Now we see if it converts.


W. Kyle Million (K¹) / IntuiTek¹

Claude Code skills: shopclawmart.com/@thebrierfox

Top comments (0)