feat(cron): mirror cron delivery output to target session for cross-session awareness - #34631
feat(cron): mirror cron delivery output to target session for cross-session awareness#34631zhangyu921 wants to merge 2 commits into
Conversation
Add mirror_to_session() call after successful cron delivery, so the main agent sees cron outputs in conversation history on next user message. Updates both delivery paths: live adapter and standalone.
…eness Add a new cron.mirror_to_session config option (default: false) that, when enabled, mirrors cron delivery output to the target session's SQLite transcript via mirror_to_session(). The main agent sees these messages prefixed with "[Delivered from cron]" in conversation history on the next user message, enabling cross-session awareness. The config option is read per-delivery at fire time and can be set globally in config.yaml under cron.mirror_to_session. Backward compatible: default is false, preserving original behaviour.
|
+1 — WeChat daily driver, mirror approach is the right fit
|
|
Thanks for the focused implementation and for documenting the WeChat use case in the discussion. Automated hermes-sweeper review found this behavior is already implemented on current
The shipped implementation addresses the requested next-turn awareness while adding session-isolation and message-alternation safeguards, so this PR is now redundant. |
Summary
When cron jobs autonomously deliver messages to a platform (telegram, discord, etc.), the receiving agent has no awareness that the message was sent — the cron output lives in the delivery channel but not in the agent's session transcript. This means the next time the user talks to the agent, it has no context of what cron just told them.
This is particularly impactful in persona-driven / SOUL.md scenarios: when an agent has a defined personality (like Asuka, a custom companion persona), cron-scheduled check-ins, market alerts, and daily briefings are delivered in-character. But when the user follows up on the same platform, the agent starts with a blank conversation — it doesn't know what its own persona just said via cron. The user has to repeat themselves or the agent has to manually call `session_search` to piece together context, breaking the natural flow of a persistent personality.
This PR bridges that gap by adding a `cron.mirror_to_session` option that mirrors cron delivery output into the target session's SQLite transcript, tagged with `mirror: true` and `mirror_source: "cron"`. On the user's next message, the agent sees `[Delivered from cron]` messages in conversation history — the personality stays continuous without manual lookup.
Changes
How it works
Config
```yaml
cron:
mirror_to_session: true # default: false — backward compatible
```
How to test
Platforms tested
Backward compatibility
Defaults to `false` — existing cron behaviour is unchanged. No new dependencies. The mirror function is non-fatal on error (all exceptions caught and logged at DEBUG level).