docs: add token optimization guidance for isolated cron sessions#6801
Open
ProofOfReach wants to merge 2 commits intoopenclaw:mainfrom
Open
docs: add token optimization guidance for isolated cron sessions#6801ProofOfReach wants to merge 2 commits intoopenclaw:mainfrom
ProofOfReach wants to merge 2 commits intoopenclaw:mainfrom
Conversation
- Add 'Token optimization for standalone reports' section explaining 80%+ token savings when using isolated vs main sessions - Clarify that --session isolated requires --message (agentTurn), not --system-event - Add troubleshooting entry for common 'agentTurn required' error - Include practical examples showing when to use each pattern
docs/automation/cron-jobs.md
Outdated
| - If you see `telegram:...` prefixes in logs or stored "last route" targets, that's normal; | ||
| cron delivery accepts them and still parses topic IDs correctly. | ||
|
|
||
| ### "isolated cron jobs require payload.kind=agentTurn" |
Contributor
There was a problem hiding this comment.
[P2] Heading contains quotes, which can produce brittle Mintlify anchors
CLAUDE.md recommends avoiding apostrophes/em dashes in headings because Mintlify anchors can break; quotes can similarly create surprising slugs. Since cron-jobs.md:460 links to /automation/cron-vs-heartbeat#token-optimization-for-standalone-reports, it’s worth making the troubleshooting heading link-friendly (e.g., no quotes / simpler text) so it can be referenced reliably.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/automation/cron-jobs.md
Line: 446:446
Comment:
[P2] Heading contains quotes, which can produce brittle Mintlify anchors
CLAUDE.md recommends avoiding apostrophes/em dashes in headings because Mintlify anchors can break; quotes can similarly create surprising slugs. Since `cron-jobs.md:460` links to `/automation/cron-vs-heartbeat#token-optimization-for-standalone-reports`, it’s worth making the troubleshooting heading link-friendly (e.g., no quotes / simpler text) so it can be referenced reliably.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Author
|
Fixed in fd1841e - removed quotes from heading for stable Mintlify anchors. |
bfc1ccb to
f92900f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds documentation to help users optimize token usage when scheduling recurring tasks with cron jobs.
Key additions:
Token optimization section in
cron-vs-heartbeat.mdexplaining:Payload type clarification: Isolated sessions require
--message(agentTurn), not--system-eventTroubleshooting entry in
cron-jobs.mdfor the common "agentTurn required" error with fixWhy this matters
Users often default to
--session mainfor 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
Greptile Overview
Greptile Summary
This PR adds documentation to reduce token usage for scheduled automation by clarifying when to use
--session mainvs--session isolated, and by explaining the required payload type (--message/agentTurnfor isolated sessions). It also adds a troubleshooting entry incron-jobs.mdfor the common “payload.kind=agentTurn” error and links readers to the new token optimization section incron-vs-heartbeat.md.Confidence Score: 4/5
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!