← Back to PRs

#6801: docs: add token optimization guidance for isolated cron sessions

by ProofOfReach open 2026-02-02 02:29 View on GitHub →
docs
## Summary Adds documentation to help users optimize token usage when scheduling recurring tasks with cron jobs. **Key additions:** 1. **Token optimization section** in `cron-vs-heartbeat.md` explaining: - Main session jobs load full conversation history (50-100K+ tokens) - Isolated sessions start fresh (10-20K tokens) - 80%+ token savings for standalone reports 2. **Payload type clarification**: Isolated sessions require `--message` (agentTurn), not `--system-event` 3. **Troubleshooting entry** in `cron-jobs.md` for the common "agentTurn required" error with fix ## Why this matters Users often default to `--session main` for all cron jobs without realizing the token cost. Standalone reports (weather, summaries, event listings) that do not need conversation history can run isolated and save significant tokens per run. The CLI already enforces the payload type requirement, but the error message alone does not explain *why* or what the alternative is. This PR makes the pattern discoverable before users hit the error. ## Test plan - [x] Verified links work with Mintlify anchor format - [x] Examples are generic (no PII) - [x] Matches existing doc style <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds documentation to reduce token usage for scheduled automation by clarifying when to use `--session main` vs `--session isolated`, and by explaining the required payload type (`--message`/`agentTurn` for isolated sessions). It also adds a troubleshooting entry in `cron-jobs.md` for the common “payload.kind=agentTurn” error and links readers to the new token optimization section in `cron-vs-heartbeat.md`. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge; it’s a docs-only change with a minor anchor/heading robustness concern. - Changes are limited to Markdown documentation and align with existing guidance about main vs isolated cron sessions; the main risk is Mintlify anchor stability due to a quoted heading in Troubleshooting, which could make future deep-links brittle. - docs/automation/cron-jobs.md (Troubleshooting heading anchor robustness) <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs