Skip to main content

Lint OpenClaw cron job configurations for risky delivery and prompt patterns.

Project description

openclaw-cron-lint

openclaw-cron-lint is a small CLI that checks OpenClaw cron job configuration quality before a scheduled run causes confusing delivery behavior.

It is intentionally focused on OpenClaw cron jobs. It is not a general JSON linter, cron expression validator, or prompt-quality grader.

Install

From this repository:

python3 -m pip install -e .

Run the CLI:

openclaw-cron-lint /root/.openclaw/cron/jobs.json

You can also run it without installing:

PYTHONPATH=src python3 -m openclaw_cron_lint fixtures/jobs-risky.json

What It Checks

Current rules:

Rule Severity Check
OC001 error sessionTarget: isolated with prompt instructions to use the message tool directly
OC002 error/warning payload kind incompatible or suspicious with the configured session target
OC003 error announce delivery missing channel or to
OC004 warning delivery.mode: none combined with prompt instructions that imply user-visible messaging
OC005 error contradictory prompt instructions such as "use the message tool" and "do not use the message tool"
OC006 warning stateful or periodic jobs missing factKey
OC007 warning suspicious NO_REPLY guidance when content is also supposed to be returned or delivered
OC008 warning expensive-looking agent jobs missing a timeout
OC009 info duplicated or overly similar prompts
OC010 warning isolated jobs assuming a current or main session

Each finding includes the job name, job id, severity, rule id, explanation, and recommended fix.

Examples

Human-readable output:

openclaw-cron-lint fixtures/jobs-risky.json

JSON output:

openclaw-cron-lint fixtures/jobs-risky.json --json

Markdown report:

openclaw-cron-lint fixtures/jobs-risky.json --markdown

Fail CI only on high-severity findings:

openclaw-cron-lint fixtures/jobs-risky.json --fail-on high

high is accepted as an alias for error, because the linter uses the OpenClaw severities info, warning, and error.

Run or skip selected rules:

openclaw-cron-lint fixtures/jobs-risky.json --only OC001 --only OC003
openclaw-cron-lint fixtures/jobs-risky.json --ignore OC009

Directory input is supported for future extension. The linter currently scans *.json files in the directory:

openclaw-cron-lint fixtures/

Configuration Shape

The loader accepts:

  • a JSON array of job objects
  • an object with a jobs array
  • a single job object

Rules are schema-tolerant and look for common OpenClaw fields such as:

  • id, jobId, name
  • prompt, instructions, systemPrompt
  • sessionTarget
  • payload.kind
  • delivery.mode, delivery.channel, delivery.to
  • factKey
  • timeoutSeconds, maxRuntimeSeconds
  • cron, schedule, interval

Limits Of Static Linting

This tool does not execute jobs, connect to OpenClaw, inspect live sessions, or prove delivery will succeed. It flags patterns that are usually risky or contradictory from static configuration alone.

False positives are expected when a deployment uses custom payload kinds, custom delivery adapters, or prompt conventions that the linter does not yet know. Use --ignore RULE for local policy exceptions.

Extending Rules

Rules live in src/openclaw_cron_lint/rules.py.

To add a rule:

  1. Add a function that accepts Sequence[JobContext] and returns List[Finding].
  2. Use the finding(...) helper so output stays consistent.
  3. Register the function in the RULES dictionary with a stable rule id.
  4. Add focused tests under tests/.
  5. Document the rule in this README.

Keep rules specific to OpenClaw cron configuration quality. Avoid adding broad JSON style rules or generic prompt linting unless they directly affect cron delivery behavior.

Development

Run tests:

PYTHONPATH=src python3 -m unittest discover -s tests

Publishing

Releases are published to PyPI by the Publish GitHub Actions workflow. It matches the release pattern used by agent-scope-diff:

  • package version is read from pyproject.toml
  • release tags must be named vX.Y.Z
  • the tag version must match the package version
  • distributions are built with python -m build
  • twine check runs before upload
  • upload uses the repository secret PYPI_API_TOKEN

To release 0.1.0:

git tag v0.1.0
git push origin v0.1.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openclaw_cron_lint-0.1.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openclaw_cron_lint-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file openclaw_cron_lint-0.1.0.tar.gz.

File metadata

  • Download URL: openclaw_cron_lint-0.1.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for openclaw_cron_lint-0.1.0.tar.gz
Algorithm Hash digest
SHA256 87c8ffafa5c8c0316b8642cad815403d283c2261943e5a3d4cb1290fb71fe3ff
MD5 efe8fac4c14f17102323065348edc1e1
BLAKE2b-256 1121406a18550818cf14e5cfb6618c3c4bd1049e874ac4673bd205fec9d8d03c

See more details on using hashes here.

File details

Details for the file openclaw_cron_lint-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openclaw_cron_lint-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc93ab69ba6189b67eb1dbf26dada0b931a5260ad4c5ccb2cc347fb3505e50c6
MD5 0dadbcad60c304da80514c2666edd7ee
BLAKE2b-256 4a7cc7cd9890fd93e795b96452809b96d42d73b7f234b75d254fbb1d94e4f27d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page