Add session and RLM heartbeats - #170
Merged
Merged
Conversation
# Conflicts: # packages/coding-agent/src/modes/agent-connection/daemon-agent-connection.ts # packages/coding-agent/src/modes/agent-connection/in-process-agent-connection.ts # packages/coding-agent/src/modes/daemon/daemon-mode.ts
sethkarten
force-pushed
the
feature/rlm-heartbeats
branch
from
June 15, 2026 22:37
2cb9b70 to
c40e97b
Compare
# Conflicts: # packages/coding-agent/src/modes/interactive/interactive-mode.ts # packages/coding-agent/test/slash-commands.test.ts
sethkarten
marked this pull request as ready for review
June 16, 2026 18:35
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 308964e. Configure here.
zhengr
pushed a commit
to zhengr/prime-agent
that referenced
this pull request
Aug 8, 2026
- Parse --version and -v flags in args.ts - Handle version flag early in main.ts (print and exit) - Add flag to help text - Add comprehensive test coverage for CLI arg parsing Co-authored-by: cc-vps <crcatala+vps@gmail.com>
zhengr
pushed a commit
to zhengr/prime-agent
that referenced
this pull request
Aug 8, 2026
* feat(coding-agent): add persistent session heartbeat # Conflicts: # packages/coding-agent/src/modes/agent-connection/daemon-agent-connection.ts # packages/coding-agent/src/modes/agent-connection/in-process-agent-connection.ts # packages/coding-agent/src/modes/daemon/daemon-mode.ts * Add RLM heartbeat skill * Fix RLM heartbeat controller propagation * Make user heartbeats user-controlled * Validate heartbeat get session * fix(coding-agent): rebind heartbeat jobs on daemon restart * fix(coding-agent): clean up stale heartbeat jobs * fix(coding-agent): skip cancelled cron jobs during run * fix(coding-agent): correct cron job persistence error * fix(coding-agent): dedupe daemon session creation * fix(coding-agent): start cron after daemon restore * fix(coding-agent): list paused cron jobs by default * fix(coding-agent): preserve concurrent cron job writes * fix(coding-agent): coalesce heartbeat follow-ups * fix(coding-agent): coalesce queued heartbeat runs * fix(coding-agent): handle duplicate queued heartbeats * fix(coding-agent): preserve queued heartbeat delivery
This was referenced Sep 5, 2026
Merged
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
/heartbeatsupport with/heartbeat,/heartbeat pause,/heartbeat resume, and/heartbeat clearget_heartbeat, but cannot create, update, pause, resume, clear, delete, or replace it through model toolsrlm-heartbeatPython skill exposed asawait rlm_heartbeat.*from IPythonrlm_heartbeat.list/create/update/deletehost requests/heartbeatTesting
npx tsx ../../node_modules/vitest/dist/cli.js --run test/cron-jobs.test.ts test/kernel-rlm-heartbeat-skill.test.ts test/builtin-skills.test.ts test/slash-commands.test.ts test/daemon-command.test.ts test/agent-connection-daemon.test.ts test/main-interactive-routing.test.tsfrompackages/coding-agent— 95 tests passednpx tsgo --noEmit --pretty falsenpx tsx ../../node_modules/vitest/dist/cli.js --runfrompackages/coding-agent— 165 files passed, 1672 tests passed, 6 files skippednpm run checknpm run checkon commitsa3ecfcc1,74a19ec3, and merge commit0d360c06Live validation
pa-heartbeat-testthrough the full Prime Agent CLI/TUI entrypoint:./prime-agent.sh --daemon-socket /tmp/pa-heartbeat-test.sock --provider prime-inference --model glm-5.1ipythonand read-onlyget_heartbeat;create_heartbeatandupdate_heartbeatare not available/heartbeat --every 5m ...created an active user heartbeat,/heartbeat pausechanged it to paused,/heartbeat resumechanged it back to active, and/heartbeat clearcancelled it; daemon queue then reportedNo cron jobsactiveSessionIdscopes: parent lists did not include child heartbeats, child lists did not include parent heartbeats, and cross-scope update/delete attempts returned null/no-opNo cron jobsPR status
mainNote
Add session and RLM heartbeats with daemon-backed cron job scheduling
cron-jobs.jsonand dispatches them against long-running sessions.cron_list,cron_add,cron_cancel,heartbeat_get,heartbeat_set,heartbeat_updateto the protocol and CLI (daemon cron list/add/cancel).rlm-heartbeatPython skill that lets agent code callrlm_heartbeat.create/list/update/deletevia host requests, handled byAgentSessionwhen anrlmHeartbeatControlleris provided.AgentSessionfollow-up queue withqueueKey-based deduplication so repeated heartbeat triggers don't stack up./heartbeatinteractive slash command for setting, pausing, resuming, clearing, and viewing the session heartbeat.agentDiris not configured;cron_cancelomitsactiveSessionIdwhile other cron/heartbeat commands include it.Macroscope summarized b4c99f5.
Note
Medium Risk
Touches long-running daemon session lifecycle, automatic prompt injection, and persisted job state across restarts; incorrect scheduling or queue behavior could surprise users or duplicate work, though scope is localized to coding-agent daemon mode.
Overview
Adds daemon-backed scheduled prompts via a persisted
cron-jobs.jsonstore, anAgentCronScheduler, and CLI/protocol surfaces (daemon cron list|add|cancel, pluscron_*/heartbeat_*daemon commands). Due jobs wake or create the target session and inject prompts, with heartbeat-style jobs using per-job follow-up queue keys so busy sessions coalesce duplicate ticks instead of stacking identical follow-ups.Introduces a user-owned
/heartbeatslash command (set, pause, resume, clear, status) backed by the same cron machinery, with models limited to read-onlyget_heartbeat—no tool path to mutate the user heartbeat.Adds the bundled
rlm-heartbeatIPython skill (rlm_heartbeat.*host bridge) for session-scoped internal recurring checks, separate from/heartbeat, with multiple labeled jobs per session and controllers wired through main and subagent daemon runtimes.AgentSessiongains optionalfollowUpQueueKeycoalescing andremoveQueuedFollowUpfor scheduler integration; session restore/rebind keeps jobs attached to the correct session file and active session id.Reviewed by Cursor Bugbot for commit b4c99f5. Bugbot is set up for automated code reviews on this repo. Configure here.