
TL;DR
An agent CLI plus a cron schedule turns recurring dev chores into background work: dependency bumps, doc freshness checks, morning briefs. The pattern, the guardrails, and where to run it - your own hardware or a cloud host.
Most of what an AI coding agent does for you interactively is stuff you asked for twice this month already. Check whether the docs drifted from the code. Bump the dependency and run the tests. Summarize what changed this week. The moment a task is recurring and has a verifiable output, it does not need you in the loop - it needs a schedule.
The pattern is old and boring on purpose: cron fires, a script gives an agent one job in a fresh checkout, the output arrives as a pull request you review with your coffee. We run a version of this for parts of this site, and the mechanics below are the distilled, portable core of it. OpenCode is the agent CLI used throughout because it is open source, scriptable, and model-agnostic - swap in your harness of choice and the shape survives.
| Resource | Description |
|---|---|
| OpenCode Docs | Install, models, and the opencode run non-interactive mode |
| OpenCode GitHub | Source, issues, releases |
| Railway Cron Jobs | Scheduled services on Railway |
| crontab.guru | Sanity-check your cron expressions |
This guide is a complete start-to-finish build: seven steps, from a bare machine to a small fleet of scheduled agents opening PRs. Each step ends in something you can run.
Install with the official one-liner from the OpenCode docs:
curl -fsSL https://opencode.ai/install | bash
Authenticate a provider (opencode auth login), then confirm non-interactive mode works - this single capability is what makes the whole pattern possible:
opencode run --model opencode/deepseek-v4-flash "print the current directory tree, two levels deep"
If that returns and exits cleanly, you have everything the schedule needs. On model choice: scheduled work is where cheap models shine - narrow tasks, high volume, a gate catching misses. This week's DeepSeek V4 Flash 0731 release is the current sweet spot at $0.14/$0.28 per million tokens with agent benchmarks that pass much larger models. The fleet economics post covers when a task deserves a stronger model; rule of thumb, escalate the judge, not the worker.
One script, four moves. Fresh clone, one prompt, a gate, a PR:
#!/bin/bash
# ~/bin/agent-chore.sh <name> "<prompt>"
set -eu
NAME="$1"; PROMPT="$2"
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
git clone --depth=20 git@github.com:you/your-repo.git "$WORK"
cd "$WORK"
git checkout -b "auto/${NAME}-$(date +%Y%m%d-%H%M%S)"
# One job, bounded time, no interactive session
timeout 1800 opencode run --model opencode/deepseek-v4-flash "$PROMPT"
# Nothing changed? Exit quietly - most runs should.
git diff --quiet && git diff --cached --quiet && exit 0
# Gate before anything leaves the machine
npm test
git add -A && git commit -m "auto: ${NAME}"
git push -u origin HEAD
gh pr create --fill
Save it as ~/bin/agent-chore.sh, chmod +x it, and test it once by hand with a trivial prompt before any schedule touches it. A runner you have never watched succeed interactively is not ready to run unattended.
From the archive
Jul 31, 2026 • 7 min read
Jul 31, 2026 • 6 min read
Jul 31, 2026 • 12 min read
Jul 31, 2026 • 7 min read
One crontab entry per chore (crontab -e; check expressions on crontab.guru):
# Every weekday at 07:10: check docs against the code they describe
10 7 * * 1-5 ~/bin/agent-chore.sh docs-drift "Read README.md and docs/. Compare every documented command and flag against the actual CLI source in src/cli/. Fix any doc that drifted. Change nothing else."
That is the whole trick working end to end: cron fires, the agent does one bounded job in a clean checkout, and the result is a PR in your queue by breakfast. Everything from here strengthens the loop.
Pick tasks with a verifiable output and low blast radius:
Notice the shape: three of the five produce issues, not code. Start there - an agent that files a wrong issue costs you a click; an agent that merges wrong code costs you an evening.
Running agents unattended is a different sport from running them interactively. The failure mode is not one bad run, it is bad runs on a schedule. From production experience:
timeout on the agent call. An agent stuck in a loop at 3am should die at the bound you set, not at sunrise.mkdir /tmp/lock-$NAME fails if the previous run is still going; skip instead of stacking.Your own hardware is the cheapest and simplest start: any always-on box - a mini PC, a homelab node, the old laptop in the drawer - runs cron and OpenCode happily. Full control, no egress rules, hardware cost already sunk. The tradeoffs are the obvious ones: your power, your uptime, your problem.
A cloud host buys you uptime and a clean blast radius - scheduled agents on a $5 instance stay far away from your laptop's SSH keys and your production database. Railway is the low-friction option here: it has cron jobs as a first-class feature, so a service holding your runner script plus a schedule expression replaces the crontab entirely, and logs land in the dashboard instead of a file you forget to rotate. Any VPS works the same way with plain cron if you prefer raw hardware.
Either way, treat the box as disposable: a git remote, an API key with a spend cap, and nothing else you would miss.
The mistake is scheduling five agents on day one. Schedule the morning brief - read-only, useful immediately - and live with it for a week. You will learn how your prompts behave unattended, what the logs need to capture, and whether the output earns its place in your morning. Then add the second chore, and the third. The end state this guide points at: a handful of named chores, each a one-line schedule and a one-paragraph prompt, producing a short stack of reviewable PRs and issues every morning. The compounding is real, but it compounds from working loops, not from ambition.
Yes: opencode run --model <model> "<prompt>" executes one task and exits, which is what makes it cron-able. See the OpenCode docs for models and flags.
Task-dependent, but with a budget model like DeepSeek V4 Flash at $0.14/$0.28 per million tokens, a bounded daily chore typically lands in cents per day. The risk is not the per-run cost, it is unbounded loops - set timeouts and spend alerts.
Let it commit to branches, never to main. The safety comes from the pipeline around the agent - fresh clones, test gates, PRs with review - not from trusting the model.
Either. Any always-on machine with cron works. A small cloud instance like Railway adds uptime, isolation from your personal credentials, and dashboard logs, with cron scheduling built in.
| Source | URL |
|---|---|
| OpenCode Docs | https://opencode.ai/docs/ |
| OpenCode GitHub | https://github.com/sst/opencode |
| Railway Cron Jobs reference | https://docs.railway.com/reference/cron-jobs |
| DeepSeek API Change Log | https://api-docs.deepseek.com/updates/ |
Some links to tools above are referral links - see our affiliate disclosure.
Last updated: July 31, 2026
Read next
OpenCode is the fastest-growing open-source AI coding agent - 160K GitHub stars, 7.5M monthly users, 75+ model providers. Here is how to set it up, configure models, and use it effectively in your workflow.
11 min readDeepSeek shipped the official V4 Flash release on July 31, 2026. The re-post-trained 0731 build beats V4-Pro-Preview on agent benchmarks at $0.14/$0.28 per million tokens. Here is what changed and how to run it through OpenCode today.
7 min readA long-running coding agent is only useful if the environment around it can queue tasks, capture logs, checkpoint state, verify behavior, limit cost, and recover from failure.
9 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Open-source AI coding agent for terminal, desktop, and IDE. Works with 75+ LLM providers including Claude, GPT, Gemini,...
View ToolWorkflow automation platform with native AI agent building. Visual editor plus JavaScript/Python code nodes, 500+ integr...
View ToolAI-powered terminal built in Rust with GPU rendering. Block-based output, natural language commands, Agent Mode for auto...
View ToolA hosted infinite canvas your headless AI agents drive over MCP. Any MCP-speaking agent - Claude Code, Codex, Cursor, or...
View ToolSchedule jobs in plain English. See what ran, what broke, what's next.
View AppDo a task once with AI, get a reusable agent forever.
View AppDefine AI-assisted business automations without locking the workflow to one vendor.
View AppConfigure Claude Code for maximum productivity -- CLAUDE.md, sub-agents, MCP servers, and autonomous workflows.
AI AgentsWhat MCP servers are, how they work, and how to build your own in 5 minutes.
AI AgentsInstall Ollama and LM Studio, pull your first model, and run AI locally for coding, chat, and automation - with zero cloud dependency.
Getting Started
No-Code AI Automation with VectorShift: Integrations, Pipelines, and Chatbots In this video, I introduce VectorShift, a no-code AI automation platform that enables you to create AI solutions...

Build Anything with Vercel, the Agentic Infrastructure Stack Check out Vercel: https://vercel.plug.dev/cwBLgfW The video shows a behind-the-scenes walkthrough of how the creator rapidly builds and d...

Check out Replit: https://replit.com/refer/DevelopersDiges The video demos Replit’s Agent 4, explaining how Replit evolved from a cloud IDE into a platform where users can build, deploy, and scale ap

OpenCode is the fastest-growing open-source AI coding agent - 160K GitHub stars, 7.5M monthly users, 75+ model providers...

DeepSeek shipped the official V4 Flash release on July 31, 2026. The re-post-trained 0731 build beats V4-Pro-Preview on...

A long-running coding agent is only useful if the environment around it can queue tasks, capture logs, checkpoint state,...

One expensive orchestrator plus many cheap workers beats an all-frontier fleet for most workloads. Here is the decision-...

Five managed-agent providers, five pricing models, zero unified cost attribution. If you're running agents overnight, yo...

A companion guide to the Loop Engineering video: the shift from repeatedly prompting an LLM to building long-running loo...

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.