Skip to content
Abhijeet Maharana, home
All posts

Running Claude Code 24/7 on a Mini PC, with Approvals in Slack

How I run a personal AI agent around the clock on one small machine: scheduled jobs, Slack threads, approval cards before anything leaves the box, and no secrets in the model's reach.

Abhijeet Maharana · 8 min read

  • AI agents
  • Claude Code
  • Node.js
  • Automation

Short version: I run a personal AI agent around the clock on a small mini PC at home. It knows my projects, takes requests in Slack, runs scheduled jobs, and stops for my approval before anything leaves the machine. Under the hood it drives the official Claude Code CLI, claims every cron slot in SQLite so each job runs exactly once, seals approvals with an HMAC, and never puts a secret in the model's environment. It is open source as tara-agent.

Why run an agent all day?

Coding agents like Claude Code are good at real project work. They read the repo, follow its instructions, use tools and write code. But most setups only work while someone sits at a terminal. Close the laptop and the agent stops.

I wanted three things:

  • Work that happens on a schedule, day and night: weekly code reviews of my repos, daily health reports, drafts for me to look at in the morning.
  • One place to talk to it, from my phone. That place is Slack: a message in a project channel starts a session, and replies in the thread continue it.
  • A hard stop before anything leaves the machine. Sending a message, publishing a post or running something as root waits for a person to approve it.

A mini PC is enough for this. The heavy work happens on Anthropic's side; the box only runs Node.js, the CLI, a browser and SQLite.

Why drive the CLI instead of calling the API?

tara-agent never calls a model API directly. Every piece of model work is a headless run of the claude CLI inside the right project folder:

const args = ["-p", "--output-format", "stream-json", "--verbose"];
args.push(resume ? "--resume" : "--session-id", sessionId);

That one choice gives each project its own setup for free. The repo's CLAUDE.md, its skills and its MCP servers all load as they would for a person in a terminal. I don't rebuild tool calling, file editing or context handling. When Claude Code gets better, the agent gets better.

The streamed JSON events become a live task list in the Slack thread, so I can watch a long run from my phone and see where it is.

How scheduled jobs work

Each repo has a .tara/jobs.json. A job is a cron expression, a prompt, the skills to read first, and optionally a cheap script that runs before the agent:

{
  "id": "daily-sla-report",
  "name": "Daily SLA report",
  "cron": "45 10 * * *",
  "prompt": "Check yesterday's late orders and summarise them.",
  "skills": ["order-sla-report"],
  "preScript": "scripts/sla-gate.py",
  "locks": ["chrome"]
}

The pre-run script is the cost saver. It checks whether there is anything to do: new rows in a feed, a changed file, an open item. If its output is empty, the run ends quietly and the model never wakes up. If there is work, its output goes into the prompt, so the agent starts with the facts instead of searching for them.

Named locks such as chrome stop two jobs that need the same browser from running at the same time.

How does a job run exactly once?

A scheduler on a home machine has to survive restarts, updates and power cuts. The rule I wanted: every slot runs at most once, and a slot missed during downtime still runs once if it is recent.

  • Slot claims in SQLite. When a cron slot fires, the scheduler first writes a claim for that job and time. Only the process that wins the claim runs it. After a crash or restart, the claim is still there, so the slot is never run twice.
  • Catch-up. On start, each job runs its most recent missed slot once, if it falls inside a window (six hours by default).
  • Interrupted runs that a restart cut short run again once on the next start.

Sessions, runs, approvals and claims all live in the same SQLite file, so a restart loses nothing.

How do approvals work?

The agent gets its own MCP server with a few tools for working with people: request_approval, propose_item, send_file and request_privileged.

  • Cards, not chat. A draft (an email, a post, a change) becomes a card on a dashboard and in the Slack thread. I can approve it, reject it, edit it, or send it back for a new version. My decision continues the same Claude session, so the agent picks up where it stopped.
  • Queues send approved items later, inside delivery windows, with daily and weekly caps.
  • Sealed approvals. Each approved item carries an HMAC of its kind, ID and approved field values, signed with a key the agent cannot read. The process that actually sends the email or publishes the post checks the seal first. Editing a file by hand, by the agent or anyone else, sends nothing.

This is the part that lets me leave it running. The agent can draft as much as it likes. Nothing goes out unless I approved that exact text.

How do you keep secrets away from the model?

I started from one uncomfortable rule: anyone who can post in a mapped Slack channel can make Claude act on the machine. A prompt injection in a web page it reads is a similar risk. So the defences are about what the agent can reach, not what it is told.

  • Its own OS user, with access only to the project folders, run under systemd.
  • Split users. Claude and the pre-run scripts can run as a second user that cannot read the agent's database or keys.
  • No secrets in the model's environment. Slack tokens and other credentials are removed before the CLI starts. The system prompt goes in a file, so it never shows up in a process list or a sudo log.
  • No sudo. When a job needs root, for example to restart a service after a code change, it asks for one action from a fixed allowlist in a root-owned helper. A person approves it.
  • Dashboard decisions need an unlock cookie set from a different device, so the agent cannot approve its own cards from the same machine.

What I learned running it

  • Make the cheap check first. Most scheduled slots have nothing to do. A ten-line script that says "nothing new" saves far more than any prompt tuning.
  • Put the approval in the data, not the prompt. "Never send without approval" in a prompt is a wish. A seal that the sender verifies is a rule.
  • Let it fix its own instructions, carefully. After a run with trouble, the agent gets one chance to update the skill file it followed, never code. Small fixes such as a changed selector or a renamed button stick, and I review them in the daily digest.
  • Keep the dependency list short. It has five runtime dependencies: the MCP SDK, Slack Bolt, croner, yaml and zod. About 10,000 lines of TypeScript, with 240 Vitest tests over the scheduler, approvals, sessions and security paths.

Should you build one?

If your team already uses Claude Code and has work that repeats (reports, triage, first drafts, checks), the pattern is worth copying even if you never use my code: a scheduler that claims slots, a cheap gate before each run, and a human approval that the sending process verifies.

The code is MIT licensed on GitHub, and the case study has the full design.