opencrons

module
v0.1.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: MIT

README ยถ

๐ŸŸช๐ŸŸฉ OpenCrons โ€” Automated AI Scheduler

OpenCrons

Automate Claude Code on a schedule.
Chat with Claude from Telegram.
Manage everything from a beautiful TUI.

Build Release License Go Version

Why OpenCrons ยท Install ยท How it works ยท Quick start ยท Telegram bot ยท CLI reference ยท Configuration ยท Security ยท Roadmap


OpenCrons is an open-source scheduler that runs Claude Code (claude -p) jobs on cron schedules. It pairs a terminal-native TUI with a Telegram bot โ€” so you can define, monitor, and chat with your AI jobs from anywhere. Built for developers, researchers, and teams who want structured, repeatable AI automation.

Built with Go ยท Cobra ยท Charmbracelet ยท SQLite ยท Catppuccin Mocha


โš ๏ธ Security

OpenCrons is a young project โ€” security coverage is incomplete. Use it with this in mind.

Agent execution model

Every scheduled job runs claude -p with --permission-mode bypassPermissions. This means:

  • No sandbox โ€” the agent process runs with your full user permissions, in your working directory, with access to your filesystem, network, and any tools Claude Code can invoke
  • No tool restrictions by default โ€” unless you explicitly set disallowed_tools on a job, the agent can read files, write files, run shell commands, and call external services
  • Unattended โ€” jobs trigger on a cron schedule with no human in the loop to approve or reject individual actions

This is intentional for automation โ€” but it means the prompt is the security boundary. A poorly scoped prompt can lead to unintended writes, deletions, or network calls.

Practical guidance:

  • Scope prompts tightly to the task at hand
  • Use disallowed_tools to restrict capabilities where possible (e.g. Bash(rm:*))
  • Set a working_dir that contains only what the job needs access to
  • Review execution logs regularly (opencrons logs)
  • Keep your Claude Code version up to date

Known limitations

  • Prompt files are stored as plain Markdown โ€” no encryption at rest
  • settings.json stores your Telegram bot token in plaintext
  • No audit log beyond the SQLite execution records
  • No rate limiting or circuit breaker on job execution

This project just released and does not yet cover all security aspects. Contributions and issues are welcome.


Why OpenCrons ๐Ÿ’ก

The OAuth lockdown changed the game

In January 2026, Anthropic deployed server-side restrictions that blocked third-party tools from authenticating with Claude Pro and Max subscription OAuth tokens. Tools like OpenCode, OpenClaw, and other Third-party stopped working overnight. The official policy is clear:

OAuth authentication (used with Free, Pro, and Max plans) is intended exclusively for Claude Code and Claude.ai. Using OAuth tokens in any other product, tool, or service is not permitted. โ€” Claude Code Docs โ€” Legal and compliance

But here's the thing โ€” claude -p is Claude Code. It's Anthropic's own CLI, running with your own subscription, exactly as intended. No OAuth hijacking, no third-party token routing, no terms of service violations. Just Claude Code doing what Claude Code was built to do.

OpenCrons wraps claude -p in a structured scheduler. Every job is a direct invocation of Claude Code โ€” the same binary, the same auth, the same process you'd run by hand in your terminal. Nothing in between.

OpenClaw is great, but cron deserves better

OpenClaw is a fantastic personal AI assistant โ€” WhatsApp, Telegram, iMessage, 500+ integrations. But for many developers, 80โ€“90% of what they actually use it for is cron jobs: daily code reviews, morning briefings, CI monitoring, scheduled cleanups.

OpenCrons takes that core use case and gives it the dedicated tooling it deserves:

OpenClaw OpenCrons
๐ŸŽฏ Focus General-purpose AI assistant Purpose-built cron scheduler
๐Ÿ‘๏ธ Visibility Jobs buried in a JSON file Interactive TUI + structured logs
๐Ÿ“Š Tracking Minimal job history SQLite with cost, tokens, status per run
๐Ÿ” Auth Uses Claude Code OAuth Uses Claude Code directly โ€” fully compliant

If you need a Swiss Army knife, use OpenClaw. If you need your cron jobs to just work โ€” with clear visibility, cost tracking, and a beautiful interface โ€” that's OpenCrons.


๐Ÿ“ฆ Install

Requires Go 1.25+ and Claude Code.

go install github.com/DikaVer/opencrons/cmd/opencrons@latest

That's it. The binary lands in $GOPATH/bin โ€” already in your PATH if Go is set up correctly.

๐Ÿ”จ Build from source
git clone https://github.com/DikaVer/opencrons.git
cd opencrons

# Linux / macOS
sudo make install

# Windows
go install ./cmd/opencrons/
๐Ÿ—‘๏ธ Uninstall
# Linux / macOS
sudo make uninstall

# Windows (PowerShell)
Remove-Item "$(go env GOPATH)\bin\opencrons.exe"

Verify:

opencrons --help

โš™๏ธ How it works

OpenCrons has three modes of operation:

Mode What it does
๐Ÿ–ฅ๏ธ Interactive TUI Run opencrons with no args. A full-screen menu for creating, editing, and managing jobs.
โŒจ๏ธ CLI commands Scriptable subcommands โ€” opencrons add, opencrons list, opencrons run, etc.
๐Ÿ’ฌ Telegram bot Runs inside the daemon. Chat with Claude, trigger jobs, and get notifications โ€” all from your phone.

The execution flow

๐Ÿ“ You define a job
  โ†’ โฐ cron schedule triggers it
    โ†’ ๐Ÿ“„ OpenCrons reads the prompt file
      โ†’ ๐Ÿš€ pipes it to `claude -p` with your configured model & effort
        โ†’ ๐Ÿ“Š captures output, cost, and token usage
          โ†’ ๐Ÿ’พ logs everything to SQLite
            โ†’ ๐Ÿ’ฌ (optionally) sends a summary to Telegram

Every job runs as an isolated subprocess with --permission-mode bypassPermissions for unattended operation, and --output-format json for structured result parsing.


๐Ÿš€ Quick start

1. Run the setup wizard

opencrons setup

The wizard walks you through:

  • ๐Ÿ”‘ Provider โ€” detects your Anthropic configuration
  • ๐Ÿ’ฌ Messenger โ€” connect a Telegram bot (optional)
  • ๐Ÿค– Chat defaults โ€” pick a default model and effort level
  • โšก Daemon mode โ€” background process or OS service

2. Create your first job

opencrons add

The interactive wizard asks for a name, cron schedule, working directory, model, and prompt. Or go fully non-interactive:

opencrons add --non-interactive \
  --name "daily-review" \
  --schedule "0 9 * * *" \
  --working-dir "/path/to/project" \
  --prompt-content "Review open PRs and summarize findings." \
  --model sonnet

3. Start the daemon

opencrons start

The daemon runs your cron jobs, watches for config changes (hot-reload), and starts the Telegram bot if configured. Stop it with opencrons stop.

4. Check the logs

opencrons logs                    # all jobs
opencrons logs daily-review       # specific job
opencrons logs daily-review -n 50 # specific job, last 50 entries

๐Ÿ’ฌ Telegram bot

The Telegram integration turns OpenCrons into a remote AI assistant you can reach from your pocket.

Setup

  1. ๐Ÿค– Create a bot via @BotFather on Telegram
  2. ๐Ÿ”ง Run opencrons setup or opencrons settings to configure the bot token
  3. ๐Ÿ” Pair your account:
    • Verification code โ€” OpenCrons generates a code, you send it to your bot to prove ownership

Bot commands

Command Action
/new ๐Ÿ†• Start a fresh chat session
/stop ๐Ÿ›‘ Cancel a running query
/jobs ๐Ÿ“‹ Browse and trigger jobs
/model ๐Ÿง  Switch model (Sonnet, Opus, Haiku)
/effort โšก Adjust effort level
/status ๐Ÿ“Š Daemon and session info
/help โ“ Show all commands

Send any text message to chat with Claude directly. Sessions persist across messages โ€” Claude remembers context until you /new.


๐Ÿ“– CLI reference

๐Ÿ“‹ Job management

opencrons add              # create a job (interactive wizard)
opencrons list             # list all jobs
opencrons edit <name>      # edit a job
opencrons remove <name>    # delete a job (--force to skip confirmation)
opencrons enable <name>    # enable a disabled job
opencrons disable <name>   # disable a job
opencrons validate         # validate all job configs

โ–ถ๏ธ Execution

opencrons run <name>       # run a job immediately
opencrons logs [name]      # view execution logs (-n to set limit)

๐Ÿ”„ Daemon

opencrons start            # start the daemon (foreground)
opencrons start --install  # install as OS service
opencrons stop             # stop the daemon
opencrons status           # check daemon status

๐Ÿ”ง Settings

opencrons setup            # first-time setup wizard
opencrons settings         # manage all settings
opencrons debug [on|off]   # toggle debug logging

๐Ÿณ๏ธ Global flags

opencrons --verbose        # verbose output (any subcommand)
opencrons --help           # help for any command

๐Ÿ—‚๏ธ Configuration

Job config

Each job is a YAML file in schedules/ with a corresponding prompt in prompts/.

Field Description Default
name Unique identifier (alphanumeric, hyphens, underscores) required
schedule Cron expression (0 9 * * *) required
working_dir Project directory for execution required
prompt_file Markdown file with the prompt <name>.md
model sonnet, opus, or haiku provider default
effort low, medium, high, or max high
timeout Seconds before killing the job 300
disallowed_tools Tool restrictions (e.g. Bash(git:*)) none
summary_enabled Generate execution summary false
enabled Whether the job runs on schedule true

๐Ÿ“‚ Directory structure

OpenCrons stores its configuration and data in a platform-specific directory:

Platform Path
๐Ÿง Linux ~/.opencrons/ or $XDG_CONFIG_HOME/opencrons/
๐ŸŽ macOS ~/.opencrons/ or $XDG_CONFIG_HOME/opencrons/
๐ŸชŸ Windows %APPDATA%\opencrons\
~/.opencrons/
โ”œโ”€โ”€ .agents/              # agent config directory (canonical)
โ”‚   โ””โ”€โ”€ skills/           # scheduling skill + plugin skills
โ”œโ”€โ”€ .claude/ โ†’ .agents/   # provider symlink (Anthropic)
โ”œโ”€โ”€ AGENTS.md             # agent instructions (canonical)
โ”œโ”€โ”€ CLAUDE.md โ†’ AGENTS.md # provider symlink (Anthropic)
โ”œโ”€โ”€ schedules/            # job configs (YAML)
โ”œโ”€โ”€ prompts/              # prompt files (Markdown)
โ”œโ”€โ”€ logs/                 # execution stdout/stderr
โ”œโ”€โ”€ summary/              # execution summaries
โ”œโ”€โ”€ data/opencrons.db     # SQLite database
โ”œโ”€โ”€ settings.json         # all settings
โ””โ”€โ”€ opencrons.pid         # daemon lock file

The .agents/ directory and AGENTS.md file are the canonical (real) locations. Provider-specific names like .claude/ and CLAUDE.md are created as symlinks so that each provider's tooling finds what it expects. On Windows without developer mode, junctions and hard links are used as fallbacks.

๐Ÿค– Agent instructions (AGENTS.md)

OpenCrons copies AGENTS.md and .agents/ into your config directory during setup. AGENTS.md is injected into every job as context โ€” it acts as a shared system prompt so Claude understands it's running inside OpenCrons.

You can customize it to add project-wide instructions, coding standards, or constraints that apply to all your scheduled jobs.

A ready-to-use example is included in the repo at .workspace-example/ โ€” it's copied automatically on first run via opencrons setup.

๐Ÿ–ฅ๏ธ Platform support

Linux macOS Windows
CLI & TUI โœ… โœ… โœ…
Daemon โœ… โœ… โœ…
OS service install โœ… โœ… โœ…

๐Ÿ” How jobs execute

When a job triggers, OpenCrons:

  1. ๐Ÿ“„ Reads the prompt file and prepends a task preamble
  2. ๐Ÿ“Ž Optionally appends a summary prompt
  3. ๐Ÿ”’ Pipes everything via stdin to claude -p (avoids argument length limits)
  4. ๐Ÿš€ Passes --effort, --model, --permission-mode bypassPermissions, --output-format json
  5. ๐Ÿ“ Captures stdout/stderr to log files
  6. ๐Ÿ“Š Parses the JSON response for cost, token usage, and result
  7. ๐Ÿ’พ Writes execution records to SQLite

Config changes are picked up automatically โ€” the daemon watches the schedules/ directory with fsnotify and hot-reloads jobs without restart.


๐Ÿ—บ๏ธ Roadmap

OpenCrons is focused on Claude Code today, but the vision is broader.

๐Ÿ”œ Coming soon

  • ๐Ÿง  Anthropic API โ€” run jobs directly with Anthropic API without requiring Claude Code installed โ€” lower overhead, API key auth, usage-based billing
  • ๐Ÿค– OpenAI API โ€” first-class support for the OpenAI API โ€” same scheduling, same TUI, same logs, different provider
  • โŒจ๏ธ Codex CLI support โ€” run OpenAI's Codex CLI alongside Claude Code jobs
  • ๐Ÿ”Œ Plugin system โ€” interactive, controllable integrations:
Plugin What it does
๐Ÿ™ GitHub Auto-review PRs, create issues, merge when checks pass
๐Ÿ“ง Email Morning digest, inbox triage, auto-replies
๐Ÿ“ Linear Create/update issues from job results, sync sprint status
๐Ÿ’ฌ Slack Post summaries, respond to threads, channel notifications
๐Ÿ“Š Custom Bring your own plugin โ€” webhook-based architecture

๐Ÿ”ฎ Future ideas

  • ๐Ÿท๏ธ Job tags and filtering
  • ๐Ÿ“ฑ Push notifications (beyond Telegram)
  • ๐Ÿ”€ Multi-provider jobs โ€” run the same prompt against Claude and GPT in parallel, compare results
  • ๐Ÿง  Agent task memory โ€” persistent per-job memory that survives between runs; agents accumulate context across executions rather than starting cold each time
  • ๐Ÿ”„ Workflow agent pipeline โ€” chain multiple agents into a directed pipeline where each agent's output becomes the next one's input; branch on conditions, fan out in parallel, merge results
  • ๐Ÿ“ฆ Sandbox environment โ€” run agents inside an isolated container or VM with restricted filesystem and network access, so bypassPermissions is safer by construction

Have an idea? Open an issue โ€” contributions are welcome.


๐Ÿ› ๏ธ Development

make build          # build binary
make build-all      # cross-compile (linux + windows)
make test           # run tests
make lint           # golangci-lint
make tidy           # go mod tidy
make clean          # remove build artifacts

Architecture

cmd/opencrons/           โ†’ entry point
internal/
โ”œโ”€โ”€ cmd/                โ†’ Cobra commands + TUI menu
โ”œโ”€โ”€ config/             โ†’ job config, YAML I/O, prompt files
โ”œโ”€โ”€ tui/                โ†’ interactive wizards and menus
โ”œโ”€โ”€ executor/           โ†’ claude -p command builder and runner
โ”œโ”€โ”€ storage/            โ†’ SQLite (execution logs, chat sessions)
โ”œโ”€โ”€ daemon/             โ†’ cron orchestrator, hot-reload, OS service
โ”œโ”€โ”€ platform/           โ†’ cross-platform paths, PID, settings
โ”œโ”€โ”€ provider/           โ†’ AI provider interface
โ”œโ”€โ”€ messenger/telegram/ โ†’ Telegram bot handlers
โ”œโ”€โ”€ chat/               โ†’ chat session manager
โ”œโ”€โ”€ logger/             โ†’ debug logging
โ””โ”€โ”€ ui/                 โ†’ shared styles (Catppuccin Mocha)

Directories ยถ

Path Synopsis
cmd
opencrons command
Package main is the entry point for the opencrons binary.
Package main is the entry point for the opencrons binary.
internal
chat
Package chat provides chat session execution and lifecycle management for interactive conversations with Claude Code via Telegram.
Package chat provides chat session execution and lifecycle management for interactive conversations with Claude Code via Telegram.
cmd
File add.go implements the job creation command.
File add.go implements the job creation command.
config
Package config defines the JobConfig struct and its YAML serialization for scheduled job configuration.
Package config defines the JobConfig struct and its YAML serialization for scheduled job configuration.
daemon
background.go provides RunBackground, which re-spawns the current binary as a detached background process running "start --foreground".
background.go provides RunBackground, which re-spawns the current binary as a detached background process running "start --foreground".
executor
claude.go builds the claude -p command for job execution.
claude.go builds the claude -p command for job execution.
logger
Package logger provides structured logging via log/slog.
Package logger provides structured logging via log/slog.
messenger
Package messenger defines the Messenger interface for pluggable messaging platform integrations.
Package messenger defines the Messenger interface for pluggable messaging platform integrations.
messenger/telegram
Package telegram implements the Telegram messenger integration using go-telegram/bot.
Package telegram implements the Telegram messenger integration using go-telegram/bot.
platform
Package platform provides PID file management and daemon process detection.
Package platform provides PID file management and daemon process detection.
provider
File anthropic.go implements the Provider interface for Anthropic's Claude Code CLI.
File anthropic.go implements the Provider interface for Anthropic's Claude Code CLI.
storage
Package storage provides a SQLite persistence layer using modernc.org/sqlite (pure Go, no CGO).
Package storage provides a SQLite persistence layer using modernc.org/sqlite (pure Go, no CGO).
tui
Package tui provides interactive terminal UI components built on charmbracelet/huh.
Package tui provides interactive terminal UI components built on charmbracelet/huh.
ui
Package ui provides shared formatting, styling, and validation utilities for OpenCron's terminal interface.
Package ui provides shared formatting, styling, and validation utilities for OpenCron's terminal interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL