Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here
cron-memory logo

cron-memory

easternbloc/openclaw-cron-memory

Otheropenclawby easternbloc

Summary

OpenClaw plugin exposing 0 skills.

Install to Claude Code

openclaw plugin add easternbloc/openclaw-cron-memory

Run in Claude Code. Add the marketplace first with /plugin marketplace add easternbloc/openclaw-cron-memory if you haven't already.

README.md

openclaw-cron-memory

An OpenClaw plugin that gives cron jobs persistent memory. Isolated cron runs normally have zero context about their previous outputs — this plugin captures every cron output into a SQLite database and makes it available for both future cron runs and regular chat sessions.

The Problem

OpenClaw cron jobs with sessionTarget: "isolated" start with a fresh session every run. The agent has no idea what it said last time. If you ask your agent in chat "what did you find in yesterday's daily report?", it has no way to answer.

What This Plugin Does

┌─────────────────────────────────────────────────────┐
│  CRON RUN                                           │
│                                                     │
│  before_agent_start → injects last N run summaries  │
│  agent does its work with prior context             │
│  agent_end → captures output to SQLite              │
└─────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────┐
│  REGULAR CHAT                                       │
│                                                     │
│  User: "from your daily report, what was the        │
│         API error rate?"                            │
│  Agent calls cron_history_search → finds the run    │
│  Agent calls cron_history_get → reads full output   │
│  Agent: "Yesterday's report showed 2.3% error rate" │
└─────────────────────────────────────────────────────┘

Cron-to-cron continuity: Each cron run gets the last N summaries injected as context, so it knows what happened before.

Chat-to-cron recall: Three tools (cron_history_search, cron_history_get, cron_history_list) are available in all sessions. Zero tokens wasted until the agent actually needs the data.

Installation

Prerequisites

  • OpenClaw with plugin support
  • Node.js 20+

Setup

# Clone or create the plugin directory
git clone <this-repo> ~/projects/openclaw-cron-memory
cd ~/projects/openclaw-cron-memory
npm install

Add to your OpenClaw config (~/.openclaw/openclaw.json):

{
  "plugins": {
    "load": {
      "paths": ["~/projects/openclaw-cron-memory"]
    },
    "entries": {
      "cron-memory": {
        "enabled": true
      }
    }
  }
}

Restart the gateway. The plugin will create its database automatically on first use.

Verify It Loaded

openclaw cron-memory stats

You should see the database path and a run count (0 until your first cron job fires).

Configuration

All settings are optional — defaults are sensible for most setups.

{
  "plugins": {
    "entries": {
      "cron-memory": {
        "enabled": true,
        "config": {
          "dbPath": "~/.openclaw/memory/cron-memory.sqlite",
          "maxHistoryPerJob": 50,
          "contextEntries": 3,
          "maxContextChars": 2000,
          "retentionDays": 90
        }
      }
    }
  }
}

| Setting | Default | Description | |---------|---------|-------------| | dbPath | ~/.openclaw/memory/cron-memory.sqlite | SQLite database location | | maxHistoryPerJob | 50 | Max stored runs per cron job (oldest pruned) | | contextEntries | 3 | How many recent runs to inject as context for cron sessions | | maxContextChars | 2000 | Max characters for the injected context block | | retentionDays | 90 | Auto-prune records older than this |

Agent Tools

These tools are available in all sessions (cron, DM, group, web):

cron_history_search

Keyword search across all cron outputs.

Query: "API error rate"
→ Finds runs where output/summary/job name matches

cron_history_get

Fetch full output for a specific run (by ID) or the most recent runs for a job (by job ID).

Job ID: "daily-report", Limit: 3
→ Returns the last 3 full outputs from daily-report

cron_history_list

List all jobs with run counts and last run info. Useful for discovering what jobs exist.

CLI Commands

# Show database stats
openclaw cron-memory stats

# List recent runs (all jobs)
openclaw cron-memory list
openclaw cron-memory list --job daily-report --limit 5

# Search outputs
openclaw cron-memory search "error rate"
openclaw cron-memory search "migration" --job db-check

# Show full output of a specific run
openclaw cron-memory show <run-id>

# Clean up old records
openclaw cron-memory prune --days 30

How It Works

Capture (agent_end hook)

After every agent run, the plugin checks if the session key matches the cron pattern (agent::cron:). If so, it:

1. Extracts the assistant's output from the run messages 2. Parses the job ID from the session key and job name from the cron prompt 3. Generates a summary (first paragraph, up to 500 chars) 4. Stores everything in SQLite 5. Prunes excess runs per job if over the limit

Recall — Cron Sessions (before_agent_start hook)

When a cron job starts, the plugin queries the last N runs for that job and injects them as a <cron-history> context block via prependContext. This is token-efficient:

  • Fixed small context (default 2000 chars max)
  • Only summaries, not full outputs
  • Only injected for cron sessions, not regular chat

Recall — Regular Chat (tools)

The three cron_history_* tools are registered globally. When a user references a cron output in conversation, the agent calls the appropriate tool. Zero tokens wasted until needed.

Maintenance (background service)

A daily background prune removes records older than retentionDays. The pruneExcessPerJob runs after every capture to keep per-job history bounded.

Development

# Run tests
npm test

# Watch mode
npm run test:watch

# Typecheck
npm run typecheck

# Both
npm run check

Testing

  • DB tests (src/db.test.ts): Full CRUD, search, and pruning coverage using temporary SQLite files
  • Helper tests (index.test.ts): Session key parsing, message extraction, summary generation, context formatting, config validation

Token Budget

| Session Type | Token Cost | |-------------|-----------| | Cron run | ~200-500 tokens (injected context block with last 3 summaries) | | Regular chat (no cron reference) | 0 tokens | | Regular chat (user asks about cron) | Variable — only the tool result payload |

Security

Cron outputs may contain sensitive data (API keys in error traces, internal hostnames, user data). Keep this in mind:

  • The SQLite database lives at ~/.openclaw/memory/cron-memory.sqlite by default — ensure the directory has appropriate permissions (chmod 700 ~/.openclaw/memory)
  • Set retentionDays to match your data retention policies — shorter is safer
  • The pruneExcessPerJob cap prevents unbounded storage growth
  • Cron outputs are stored as-is; no redaction is applied. If your cron jobs handle secrets, consider filtering them at the job prompt level

Compatibility

Tested with OpenClaw 2026.2.x+. Requires plugin hook support (agent_end, before_agent_start, registerTool, registerCli, registerService).

License

MIT

Related plugins

Browse all →