Authors
PromptWareOS Core
Abstract
This RFC defines a platform‑agnostic, continuous event transport model that enables AI coding agents to participate as first‑class capability actors in a pure CQRS + Event‑Driven Architecture (EDA) system.
The design preserves CQRS/EDA purity while enabling low‑latency, reactive agent workflows across heterogeneous AI coding agent platforms (wake‑capable, polling‑only, or future systems). It introduces promise‑first semantics, continuous transport sessions, watcher/digestor behavior, and explicit wake signaling—without coupling to any specific agent runtime, UI, or tool execution mechanism.
1. Motivation
Modern AI coding agents are fundamentally turn‑based, while real systems are event‑driven. Naïve integrations force the system to wait for human or agent turns, introducing latency, reducing UX quality, and breaking the mental model of reactive systems.
This RFC resolves that tension by:
- Making the transport continuous, not the model
- Treating agents as capability actors under CQRS
- Defining promise‑first semantics for all operations
- Allowing hosts to schedule model invocations when actionable events occur
The result is a system that feels real‑time when possible, and degrades gracefully when not.
2. Non‑Goals
This RFC does not:
- Specify UI behavior or terminal tooling
- Require any specific AI agent platform features
- Define concrete scheduling or threading implementations
- Replace existing PromptWareOS CQRS or transport RFCs
3. Terminology
- CQRS: Command Query Responsibility Segregation
- EDA: Event‑Driven Architecture
- Capability Actor: An addressable actor with a serialized mailbox
- Session: A continuous transport context
- Promise‑like: An operation whose result resolves in the future
- Watcher: A digestor that observes the transport stream
- BlobPointer: An immutable reference to encrypted, stored payloads
4. Design Principles & Invariants
- Everything is an event or derived from events
- All operations are promise‑like by default
- Commands describe intent; events describe facts
- At‑least‑once delivery + idempotent handlers
- Strict serialization per capability actor
- Single join rule:
metadata.causation === request.metadata.id
- Transport is continuous; model execution is scheduled
- Platform agnosticism is mandatory
5. Session Model
5.1 Session Identity
Each continuous transport context MUST be identified by:
metadata.session groups messages belonging to the same transport context. It MUST NOT overload metadata.id or causation fields.
5.2 Session Lifecycle
Sessions follow the PromptWareOS lifecycle:
BOOTING → READY → QUIESCENT → SHUTTING_DOWN → STOPPED
6. Promise Semantics
6.1 Promise‑First Rule
All commands and queries are promise‑like.
There is no synchronous semantic in the protocol. Operations that complete immediately are considered promises resolved immediately.
6.2 Resolution Rules
-
Commands
response indicates acceptance or rejection only
- Terminal resolution MUST occur via events
-
Queries
- Terminal resolution MUST occur via response
This rule is normative.
7. CQRS Message Semantics
Each message envelope includes:
kind: command | query | response | event
metadata.id (unique per message)
metadata.causation (join rule)
metadata.session
metadata.origin
No additional join or correlation rules are defined.
8. Capability: System.Shell
8.1 Definition
System.Shell is a capability command representing execution within the system environment. The environment is implementation‑defined and MAY include local, remote, sandboxed, or simulated execution.
8.2 Semantics
- Always promise‑like
- Initial
response MAY return a handle
- Output, progress, completion, and failure are delivered as events
No synchronous blocking behavior is defined.
9. Continuous Transport Model
The transport MUST support:
- Streaming of CQRS envelopes
- Session‑scoped ordering
- At‑least‑once delivery
Transport framing (NDJSON, streams, sockets, etc.) is implementation‑defined.
10. Watcher & Digestor Behavior
10.1 Role
A Watcher observes the continuous transport stream and produces digests suitable for agent consumption.
The watcher:
- Batches messages
- Prioritizes faults and causation‑linked replies
- Emits digests instead of raw streams
- Never issues domain commands
10.2 Compliance
- L2 compliance REQUIRES watcher‑equivalent behavior
- L1 MAY omit watcher behavior
11. Wake Semantics
11.1 Agent.Wake
Agent.Wake is a first‑class event signaling that actionable information is available for an agent.
11.2 Actionable Definition
Actionable events include:
- Messages causally linked to an outstanding agent request
- Faults or execution failures
- Explicit decision‑required signals
12. Backpressure & Flow Control
Backpressure MUST be represented via CQRS messages:
- Credit‑based flow control
- Queue depth / lag telemetry events
Imperative pausing is prohibited.
13. Security & Trust Model
13.1 Trust Posture
AI agents are treated as trusted capability actors.
13.2 Data Protection
Implementations handling sensitive data MUST:
- Encrypt payloads at rest
- Redact secrets before LLM exposure
- Use BlobPointer references for raw data
14. Compliance Levels
| Level |
Description |
| L1 |
Poll‑only, turn‑based |
| L2 |
Continuous transport + watcher |
| L3 |
Wake‑capable scheduling |
15. Extension Points
The following are explicitly extensible:
- Capability namespaces
- Event types
- Wake reasons
- Flow control strategies
Appendix A: Design Invariants Checklist
Appendix B: Capability Author Checklist
Appendix C: Compliance Matrix
See Section 14.
Appendix D: Glossary
- Promise‑like: Resolution via future messages
- Watcher: Transport digestor
- Wake: Scheduling signal
16. Non-Normative Sequence Diagrams
This section is informative, not normative. It illustrates typical flows using the rules defined above.
16.1 Command → Event → Agent.Wake (Promise Resolution via Events)
Agent Transport / System Watcher Host Scheduler
| | | |
| Command (System.Shell) | |
|------------------->| | |
| | Response (accepted) | |
|<-------------------| | |
| | | |
| | Event: OutputChunk | |
| |----------------------->| |
| | Event: Completed | |
| |----------------------->| |
| | | Digest + Wake |
| | |------------------->|
| | | |
| (Agent invoked by host scheduler) |
Notes:
- The command is promise-like.
- Terminal resolution occurs via events.
Agent.Wake is derived from watcher policy.
16.2 Query → Response (Immediate Resolution)
Agent Transport / System
| |
| Query |
|------------------->|
| |
| Response (result) |
|<-------------------|
Notes:
- Queries resolve via responses.
- Still promise-like, even if immediate.
16.3 Backpressure via Credit-Based Flow Control
Watcher / Host Transport
| |
| Flow.Credit.Grant |
|------------------->|
| |
| Event stream (<=N) |
|<-------------------|
| |
End of RFC
Authors
PromptWareOS Core
Abstract
This RFC defines a platform‑agnostic, continuous event transport model that enables AI coding agents to participate as first‑class capability actors in a pure CQRS + Event‑Driven Architecture (EDA) system.
The design preserves CQRS/EDA purity while enabling low‑latency, reactive agent workflows across heterogeneous AI coding agent platforms (wake‑capable, polling‑only, or future systems). It introduces promise‑first semantics, continuous transport sessions, watcher/digestor behavior, and explicit wake signaling—without coupling to any specific agent runtime, UI, or tool execution mechanism.
1. Motivation
Modern AI coding agents are fundamentally turn‑based, while real systems are event‑driven. Naïve integrations force the system to wait for human or agent turns, introducing latency, reducing UX quality, and breaking the mental model of reactive systems.
This RFC resolves that tension by:
The result is a system that feels real‑time when possible, and degrades gracefully when not.
2. Non‑Goals
This RFC does not:
3. Terminology
4. Design Principles & Invariants
metadata.causation === request.metadata.id5. Session Model
5.1 Session Identity
Each continuous transport context MUST be identified by:
metadata.sessionmetadata.sessiongroups messages belonging to the same transport context. It MUST NOT overloadmetadata.idor causation fields.5.2 Session Lifecycle
Sessions follow the PromptWareOS lifecycle:
6. Promise Semantics
6.1 Promise‑First Rule
All commands and queries are promise‑like.
There is no synchronous semantic in the protocol. Operations that complete immediately are considered promises resolved immediately.
6.2 Resolution Rules
Commands
responseindicates acceptance or rejection onlyQueries
This rule is normative.
7. CQRS Message Semantics
Each message envelope includes:
kind: command | query | response | eventmetadata.id(unique per message)metadata.causation(join rule)metadata.sessionmetadata.originNo additional join or correlation rules are defined.
8. Capability:
System.Shell8.1 Definition
System.Shellis a capability command representing execution within the system environment. The environment is implementation‑defined and MAY include local, remote, sandboxed, or simulated execution.8.2 Semantics
responseMAY return a handleNo synchronous blocking behavior is defined.
9. Continuous Transport Model
The transport MUST support:
Transport framing (NDJSON, streams, sockets, etc.) is implementation‑defined.
10. Watcher & Digestor Behavior
10.1 Role
A Watcher observes the continuous transport stream and produces digests suitable for agent consumption.
The watcher:
10.2 Compliance
11. Wake Semantics
11.1
Agent.WakeAgent.Wakeis a first‑class event signaling that actionable information is available for an agent.11.2 Actionable Definition
Actionable events include:
12. Backpressure & Flow Control
Backpressure MUST be represented via CQRS messages:
Imperative pausing is prohibited.
13. Security & Trust Model
13.1 Trust Posture
AI agents are treated as trusted capability actors.
13.2 Data Protection
Implementations handling sensitive data MUST:
14. Compliance Levels
15. Extension Points
The following are explicitly extensible:
Appendix A: Design Invariants Checklist
Appendix B: Capability Author Checklist
Appendix C: Compliance Matrix
See Section 14.
Appendix D: Glossary
16. Non-Normative Sequence Diagrams
16.1 Command → Event → Agent.Wake (Promise Resolution via Events)
Notes:
Agent.Wakeis derived from watcher policy.16.2 Query → Response (Immediate Resolution)
Notes:
16.3 Backpressure via Credit-Based Flow Control
End of RFC