sdk/examples/cron/README.md
This directory contains example automation specs for file-based and event-driven automation in Cline. Use these as templates to set up your own recurring or event-driven tasks.
| Goal | Spec | Schedule | Mode |
|---|---|---|---|
| 🔄 Review code | daily-code-review | Mon-Fri 9 AM | act |
| 📝 Update CHANGELOG | changelog-generator | Friday 6 PM | act |
| 🔒 Check security | dependency-check | Monday 10 AM | act |
| ✅ Verify tests | test-coverage-report | Daily 10 PM | act |
| ⚡ Track performance | performance-baseline | Daily 2 AM | act |
| 🏷️ Check types | type-check-strict | Daily 6 AM | plan |
| 🎨 Audit style | code-style-audit | Wednesday 3 AM | act |
| 🗑️ Find dead code | dead-code-finder | Sunday 4 AM | plan |
| 📚 Check docs | documentation-check | Thursday 5 AM | plan |
| 🎉 Weekly wins | weekly-metrics-summary | Friday 5 PM | act |
| 👀 Review PRs | pr-review | On PR opened | act |
| 📋 Check PR changelog | pr-changelog-check | On PR opened | act |
| 📊 PR coverage | pr-test-coverage | On PR updated | act |
Cline automation supports two types of specs:
.cron.md) — Run on a schedule.event.md) — Run when an event occursBoth can be enabled in .cline/cron/ to be picked up by the hub or SDK.
daily-code-review.cron.mdA production-ready example that runs a code review automation on weekday mornings.
Key fields:
schedule: "0 9 * * MON-FRI" — 9 AM on weekdays (cron format)tools: run_commands,read_files — Restrict tools to specific actionsmode: act — Execute commands (vs. plan or yolo)timeoutSeconds: 1800 — 30-minute timeoutmodelSelection — Override model/provider for this runnotesDirectory — Durable automation notes for multi-run stateUsage:
mkdir -p ~/.cline/cron
cp examples/cron/daily-code-review.cron.md ~/.cline/cron/
# Edit the spec: set workspaceRoot, model, etc.
# Spec is reconciled on startup; next run enqueued automatically
One-off specs:
For one-time tasks, save as .cline/cron/<name>.md (no .cron infix) and omit the schedule field.
changelog-generator.cron.mdAuto-generate changelog from recent commits
Runs every Friday at 6 PM. Reviews commits in a directory (e.g., apps/cli/) and generates a changelog entry summarizing new features, bug fixes, and breaking changes. Updates CHANGELOG.md without bumping the version.
Best for: Projects with frequent releases and manual changelog maintenance overhead.
dependency-check.cron.mdWeekly dependency health check
Runs every Monday at 10 AM. Checks for outdated packages, security vulnerabilities, unused dependencies, and major version upgrades. Generates a prioritized report for action.
Best for: Teams that want proactive dependency maintenance without daily alerts.
test-coverage-report.cron.mdDaily test coverage metrics
Runs every day at 10 PM. Runs the full test suite, generates coverage reports, and identifies files needing more tests. Creates a markdown summary with visual indicators.
Best for: Maintaining code quality standards and tracking coverage trends over time.
performance-baseline.cron.mdTrack performance metrics overnight
Runs daily at 2 AM. Measures build time, bundle size, and cold start performance. Detects regressions and alerts if metrics exceed thresholds.
Best for: CLI tools, libraries, or services where performance is critical.
type-check-strict.cron.mdStrict TypeScript type checking
Runs every morning at 6 AM in plan mode. Reports all type errors with strict compiler options and categorizes them by issue type.
Best for: Gradually improving type safety without blocking development.
code-style-audit.cron.mdCode style and linting audit
Runs every Wednesday at 3 AM. Runs ESLint and Prettier, identifies unused code, detects anti-patterns, and provides a summary of violations.
Best for: Maintaining code consistency across a team.
dead-code-finder.cron.mdFind and report dead code
Runs every Sunday at 4 AM in plan mode. Identifies unused exports, unreachable code, and deprecated patterns. Prioritizes safe removals vs. ones requiring review.
Best for: Regular codebase cleanup and reducing technical debt.
documentation-check.cron.mdDocumentation coverage audit
Runs every Thursday at 5 AM in plan mode. Analyzes documentation completeness, identifies missing JSDoc comments, checks for outdated docs, and evaluates overall documentation structure.
Best for: Improving code maintainability and onboarding of new team members.
weekly-metrics-summary.cron.mdFun weekly metrics summary for the team 🎉
Runs every Friday at 5 PM. Collects a week's worth of data: commits, test coverage, performance, PR activity, and contributor stats. Generates a celebratory markdown report with emojis, top contributors, metrics trends, and fun facts.
Best for: Team morale, tracking velocity, and celebrating wins. Great for Friday morning stand-ups or team channels.
Event-driven specs live in .cline/cron/events/ and trigger when normalized events are ingested.
events/pr-review.event.mdRuns a pull request review whenever a new PR opens on the main branch.
Key fields:
event: github.pull_request.opened — Trigger on this event typefilters — Narrow scope: match repository, branch, labels, etc.debounceSeconds: 30 — Wait 30s for more events before triggeringdedupeWindowSeconds: 600 — Ignore duplicate events within 10 minutescooldownSeconds: 120 — Wait 2 minutes after a run before next triggermaxParallel: 2 — Run at most 2 in parallelUsage:
mkdir -p ~/.cline/cron/events
cp examples/cron/events/pr-review.event.md ~/.cline/cron/events/
# Configure your repository, branch, and workspace
# Wire up GitHub App or webhook to ingest events
Ingesting events: Events are ingested via:
plugins/automation-events.ts)cline.automation.ingestEvent() in the SDKevents/local-manual-test.event.mdLocal test spec for verifying event-driven automation without external services.
Key fields:
event: local.manual_test — Local event type (no external dependency)filters: { topic: cron-feature-2 } — Match on event payload fieldsdebounceSeconds: 0 — Trigger immediatelymaxIterations: 5 — Quick timeout for testingUsage:
mkdir -p ~/.cline/cron/events
cp examples/cron/events/local-manual-test.event.md ~/.cline/cron/events/
# Start the hub with automation enabled
# In another shell, ingest a test event
node -e "
const { HubWebSocketClient } = require('@cline/core');
const client = new HubWebSocketClient('ws://localhost:8000');
client.send('cron.event.ingest', {
eventType: 'local.manual_test',
envelope: { subject: 'test', topic: 'cron-feature-2', message: 'hello' }
});
"
events/local-plugin-event.event.mdTest spec for plugin-emitted events. Pairs with plugins/automation-events.ts.
events/pr-changelog-check.event.mdVerify CHANGELOG updates in PRs
Triggers when a PR opens on main. If the PR modifies source code but doesn't update CHANGELOG, posts a comment suggesting what should be added. If CHANGELOG is updated, verifies the format.
Best for: Maintaining an up-to-date changelog without manual reminders. Reduces reviewer burden.
events/pr-test-coverage.event.mdAnalyze test coverage impact of PRs
Triggers when a PR is opened or updated. Runs test coverage against the PR branch, compares to main, and posts a comment showing:
Best for: Maintaining test coverage standards while being helpful rather than blocking. Guides authors toward better test practices.
Key fields:
event: local.plugin_event — Custom event emitted by the pluginfilters: { topic: plugin-demo } — Match on plugin event attributesUsage:
mkdir -p ~/.cline/cron/events
cp examples/cron/events/local-plugin-event.event.md ~/.cline/cron/events/
# Load the plugin that emits these events
mkdir -p ~/.cline/plugins
cp examples/plugins/automation-events.ts ~/.cline/plugins/
# Run CLI with automation enabled; the plugin emits events
cline --enable-automation -i "Test automation events"
mkdir -p ~/.cline/cron/events
daily-code-review.cron.mdpr-review.event.mdlocal-manual-test.event.mdlocal-plugin-event.event.mdEdit your copied spec:
workspaceRoot to your project pathmodelSelection if using a non-default modelfilters to match your repos/branchesIn the hub:
new HubWebSocketServer({
cronOptions: { workspaceRoot: "/absolute/workspace" }
});
In the SDK:
const cline = await ClineCore.create({
automation: true, // Enable automation
// ... other options
});
In the CLI:
cline --enable-automation
Completed and failed runs are reported to .cline/cron/reports/<run-id>.md with:
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | Unique identifier (alphanumeric, hyphens) |
title | string | yes | Human-readable title |
workspaceRoot | string | yes | Absolute path to the project |
mode | string | no | yolo (default), act, or plan |
tools | string/array | no | Comma-separated tool names; empty disables work tools |
systemPrompt | string | no | Custom system prompt |
modelSelection | object | no | { providerId, modelId } |
maxIterations | number | no | Iteration limit |
timeoutSeconds | number | no | Run timeout |
extensions | array | no | rules, skills, plugins |
tags | array | no | Arbitrary tags for grouping |
metadata | object | no | Custom metadata |
.cron.md)| Field | Type | Notes |
|---|---|---|
schedule | string | Required. Cron expression (5 fields: minute, hour, day, month, day-of-week) |
timezone | string | Optional. IANA timezone (e.g., America/New_York). Defaults to system timezone. |
.event.md)| Field | Type | Notes |
|---|---|---|
event | string | Required. Event type (e.g., github.pull_request.opened, local.manual_test) |
filters | object | Optional. Match event fields (supports dot paths) |
debounceSeconds | number | Optional. Coalesce events within N seconds (default 0) |
dedupeWindowSeconds | number | Optional. Skip duplicates within N seconds (default 0) |
cooldownSeconds | number | Optional. Wait N seconds after a run (default 0) |
maxParallel | number | Optional. Max concurrent runs (default unbounded) |
Available tool names:
read_files — Read file contentssearch_codebase — Search across the projectrun_commands — Execute shell commandsfetch_web_content — Fetch URLsapply_patch — Apply code patcheseditor — Edit filesskills — Call custom skillsask_question — Query the usersubmit_and_exit — Complete the runCombine multiple specs for comprehensive automation:
Monday 10 AM → dependency-check.cron.md (Check dependencies)
Tuesday 3 AM → code-style-audit.cron.md (Lint and format)
Wednesday 5 AM → documentation-check.cron.md (Doc coverage)
Thursday 4 AM → dead-code-finder.cron.md (Find cleanup opportunities)
Friday 6 PM → changelog-generator.cron.md (Auto-generate changelog)
Daily 2 AM → performance-baseline.cron.md (Track metrics)
Daily 10 PM → test-coverage-report.cron.md (Coverage trends)
Daily 6 AM → type-check-strict.cron.md (Type safety)
On every PR:
→ pr-changelog-check.event.md (Verify CHANGELOG)
→ pr-test-coverage.event.md (Coverage impact)
This provides continuous quality monitoring without developers having to remember to run checks manually.
For Team Leads:
dependency-check.cron.md — Weekly security reviewdead-code-finder.cron.md — Quarterly cleanup planningperformance-baseline.cron.md — Monitor system healthFor QA Engineers:
test-coverage-report.cron.md — Track trendspr-test-coverage.event.md — PR-level feedbackFor Backend Teams:
performance-baseline.cron.md — Build time, API response timetype-check-strict.cron.md — Type safetyFor Frontend Teams:
performance-baseline.cron.md — Bundle size, cold startcode-style-audit.cron.md — Consistent styling---
id: daily-security-audit
title: Daily Security Audit
workspaceRoot: /path/to/repo
schedule: "0 2 * * *" # 2 AM daily
tools: read_files,search_codebase
mode: act
timeoutSeconds: 3600
extensions:
- skills
---
Search for hardcoded secrets, outdated dependencies, and insecure patterns.
Report findings to the team.
---
id: pr-security-review
title: Security Review for PRs
workspaceRoot: /path/to/repo
event: github.pull_request.opened
filters:
pullRequest:
baseBranch: main
cooldownSeconds: 300
maxParallel: 3
---
Summarize the changes, check for security risks, and recommend approval or changes.
plugins/automation-events.ts — Plugin event emission