-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Feature Request: Expose appendAssistantMessageToSessionTranscript in Plugin Runtime API #73274
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.
Type
Fields
Priority
None yet
Problem
Plugins that hook
agent_end(e.g. for cron output injection) need to persist messages into other sessions' transcripts. Currently, the only cross-session injection API available to plugins isenqueueSystemEvent, which is in-memory only and ephemeral.This creates a fundamental limitation:
enqueueSystemEventqueues events in memory, consumed only when the target session is activatedannouncedelivery) are never activated — no user messages, no heartbeat targeting themUse Case: Cron Output → Channel Session Context
OpenClaw cron jobs with
sessionTarget: "isolated"produce output delivered to Discord channels viaannouncemode. This delivery sends a Discord message but does not enter the target channel's persistent session context. The channel session never "remembers" what its cron jobs produced.A plugin hooking
agent_endcan detect cron completions, extract the output, and should be able to persist it into the target channel's session transcript — so that when the session is eventually activated, the cron output is already in its conversation history.Proposed Solution
Expose
appendAssistantMessageToSessionTranscript(or a similar write API) throughapi.runtime.agent.sessionin the plugin runtime:This would allow plugins to:
Alternatives Considered
enqueueSystemEvent— in-memory only, lost on restart, requires session activation to consumecallGatewaywithsessions.send— triggers a full agent turn, expensive and side-effect heavyContext
appendAssistantMessageToSessionTranscriptfunction already exists insrc/config/sessions/transcript.tsoutbound-send-service.tsanddeliver.tsfor delivery mirroringconfig/sessions/transcript.runtime.tsbut not wired into the plugin runtime surfaceEnvironment