Orchestrata Ultimate / Specs / 004-cxp

004-cxp: CXP Protocol (Cross-agent eXchange Protocol)

The Cross-agent eXchange Protocol (CXP) is the structured communication protocol for all agent-to-agent messaging in Orchestrata. It defines an 11-field packet format with deterministic headers, delivery tracking, work status state machines, and Prolog fact integration.

At a glance

Item Value
Spec directory specs/004-cxp/
Status line in the spec Complete
Requirement IDs defined 273
With a @traces citation in src/ 203 (74.4%)
With a @traces citation in tests/ 2 (0.7%)
Tracked files 9
RTM page 004-cxp

Reading this spec

The Cross-agent eXchange Protocol (CXP) is the structured protocol for all agent-to-agent messaging in Orchestrata. It defines an 11-field packet format with deterministic headers, delivery tracking, work status state machines and integration with Prolog facts, so that message passing is deterministic and traceable.

The scope is a set of user stories: packet format and structure, header management, payload handling, delivery status tracking, packet serialization and deserialization (all critical), then work status tracking, validation and schema, thread management and correlation, and priority and ordering (high), and further stories after those. Requirement IDs use the REQ-004- prefix.

The key decisions are a standardized packet with required headers; JSON and binary serialization; thread-based correlation of messages; priority-based ordering; and protocol versioning for backward compatibility. Delivery status moves through queued, delivered and acknowledged. Work status moves through pending, in progress, resolved and archived.

In the code, the packet model is in orchestrata_ultimate/core/packet/packet, the largest tracer. The cxp package holds orchestrata_ultimate/cxp/interfaces, orchestrata_ultimate/cxp/headers, orchestrata_ultimate/cxp/validator and orchestrata_ultimate/cxp/json_serializer. The per-requirement view is on the RTM page.

The spec's status line reads Complete. It tracks 9 files and defines 273 requirement IDs. The full text follows below.

Measured coverage is 203 of 273 requirements cited by at least one @traces in src/ (74.4%), spread over 31 modules; the module citing the most of them is orchestrata_ultimate/core/packet/packet (46 requirements). In tests/, 2 requirements are cited by a test-side @traces.

Coverage gaps: 70 requirements have no citing symbol. The largest untraced groups are REQ-004-US-010 (10), REQ-004-US-005 (9), REQ-004-US-001 (7). Untraced means no @traces names the ID; the behaviour may still exist in code that was never annotated. Test-side citations are thinner than code-side ones (2 against 203).

Requirements

Checkbox is the state recorded in the requirements checklist; Traced by is the count of src/ symbols whose @traces names the ID.

ID Done Requirement Traced by
REQ-004-US-001-001 yes Define CXPPacket base class with all required fields 2
REQ-004-US-001-002 yes Implement message_id as UUID string 4
REQ-004-US-001-003 yes Implement from_agent as Volk alias string 3
REQ-004-US-001-004 yes Implement to_agent as Volk alias string 3
REQ-004-US-001-005 yes Implement thread_id as string identifier 3
REQ-004-US-001-006 yes Implement subject as string (max 200 chars) 3
REQ-004-US-001-007 yes Implement payload as generic object (dict or bytes) 3
REQ-004-US-001-008 yes Implement timestamp as ISO8601 string 3
REQ-004-US-001-009 yes Implement priority as integer (0-10 range) 4
REQ-004-US-001-010 yes Implement delivery_status enum (queued, delivered, acknowledged, failed) 3
REQ-004-US-001-011 yes Implement work_status enum (pending, in_progress, resolved, archived) 3
REQ-004-US-001-012 yes Implement protocol_version as semver string 3
REQ-004-US-001-013 yes Validate message_id is valid UUID 1
REQ-004-US-001-014 yes Validate from_agent matches Volk alias pattern (U:[A-Z][a-z]) 2
REQ-004-US-001-015 yes Validate to_agent matches Volk alias pattern 2
REQ-004-US-001-016 yes Validate thread_id is non-empty string none
REQ-004-US-001-017 yes Validate subject is non-empty string 2
REQ-004-US-001-018 yes Validate subject length ≤200 characters 1
REQ-004-US-001-019 yes Validate payload is valid JSON or bytes 1
REQ-004-US-001-020 yes Validate timestamp is valid ISO8601 none
REQ-004-US-001-021 yes Validate priority is integer 0-10 none
REQ-004-US-001-022 yes Validate delivery_status is valid enum value none
REQ-004-US-001-023 yes Validate work_status is valid enum value none
REQ-004-US-001-024 yes Validate protocol_version is valid semver 1
REQ-004-US-001-025 yes Add type hints to all packet fields 1
REQ-004-US-001-026 yes Use Pydantic for runtime validation none
REQ-004-US-001-027 yes Implement init with field validation 1
REQ-004-US-001-028 yes Implement repr for debugging 1
REQ-004-US-001-029 yes Implement eq for comparison 1
REQ-004-US-001-030 yes Implement hash for dict keys none
REQ-004-US-002-001 yes Implement get_headers() method returning dict 6
REQ-004-US-002-002 yes Extract message_id to header 2
REQ-004-US-002-003 yes Extract from_agent to header 2
REQ-004-US-002-004 yes Extract to_agent to header 2
REQ-004-US-002-005 yes Extract thread_id to header 2
REQ-004-US-002-006 yes Extract subject to header 2
REQ-004-US-002-007 yes Extract timestamp to header 2
REQ-004-US-002-008 yes Extract priority to header 2
REQ-004-US-002-009 yes Extract delivery_status to header 1
REQ-004-US-002-010 yes Extract work_status to header 1
REQ-004-US-002-011 yes Extract protocol_version to header 1
REQ-004-US-002-012 yes Header extraction completes in <1ms 1
REQ-004-US-002-013 yes Validate all required headers present 2
REQ-004-US-002-014 yes Validate header types are correct 1
REQ-004-US-002-015 yes Validate header values are non-empty 2
REQ-004-US-002-016 yes Reject packets with missing headers 1
REQ-004-US-002-017 yes Reject packets with invalid header types 2
REQ-004-US-002-018 yes Provide detailed error messages for invalid headers 1
REQ-004-US-002-019 yes Implement set_delivery_status() method 1
REQ-004-US-002-020 yes Implement set_work_status() method 1
REQ-004-US-002-021 yes Implement set_priority() method 1
REQ-004-US-002-022 yes Validate new status values 2
REQ-004-US-002-023 yes Prevent modification of immutable headers (message_id, from_agent, to_agent) none
REQ-004-US-002-024 yes Update timestamp on header modification none
REQ-004-US-003-001 yes Support JSON object payloads 1
REQ-004-US-003-002 yes Support JSON array payloads 1
REQ-004-US-003-003 yes Support nested JSON structures 1
REQ-004-US-003-004 yes Validate JSON schema when provided 1
REQ-004-US-003-005 yes Handle JSON serialization errors gracefully 2
REQ-004-US-003-006 yes Support Unicode in JSON payloads none
REQ-004-US-003-007 yes Limit JSON payload size to 10MB 2
REQ-004-US-003-008 yes Support binary payloads (bytes) 2
REQ-004-US-003-009 yes Encode binary as base64 for transport 2
REQ-004-US-003-010 yes Decode base64 to binary on receipt 2
REQ-004-US-003-011 yes Validate binary payload size ≤100MB 2
REQ-004-US-003-012 yes Support content-type metadata for binary 2
REQ-004-US-003-013 yes Handle binary encoding errors gracefully 2
REQ-004-US-003-014 yes Validate payload is not None none
REQ-004-US-003-015 yes Validate payload type (dict or bytes) 1
REQ-004-US-003-016 yes Validate JSON payload structure 1
REQ-004-US-003-017 yes Validate binary payload encoding 1
REQ-004-US-003-018 yes Reject oversized payloads 2
REQ-004-US-003-019 yes Provide detailed error messages 1
REQ-004-US-003-020 yes Implement get_payload() method 2
REQ-004-US-003-021 yes Implement get_payload_json() for JSON extraction 1
REQ-004-US-003-022 yes Implement get_payload_binary() for binary extraction 1
REQ-004-US-003-023 yes Raise error if payload type mismatch 2
REQ-004-US-003-024 yes Support payload type checking (is_json, is_binary) 3
REQ-004-US-004-001 yes Define DeliveryStatus enum 1
REQ-004-US-004-002 yes Implement QUEUED status 1
REQ-004-US-004-003 yes Implement DELIVERED status 1
REQ-004-US-004-004 yes Implement ACKNOWLEDGED status 1
REQ-004-US-004-005 yes Implement FAILED status 1
REQ-004-US-004-006 yes Validate status transitions 3
REQ-004-US-004-007 yes Allow QUEUED → DELIVERED transition 2
REQ-004-US-004-008 yes Allow DELIVERED → ACKNOWLEDGED transition 2
REQ-004-US-004-009 yes Allow QUEUED → FAILED transition 2
REQ-004-US-004-010 yes Allow DELIVERED → FAILED transition 2
REQ-004-US-004-011 yes Prevent invalid transitions (e.g., ACKNOWLEDGED → QUEUED) 3
REQ-004-US-004-012 yes Record timestamp for each transition 1
REQ-004-US-004-013 yes Log status transitions none
REQ-004-US-004-014 yes Implement is_queued() method none
REQ-004-US-004-015 yes Implement is_delivered() method none
REQ-004-US-004-016 yes Implement is_acknowledged() method none
REQ-004-US-004-017 yes Implement is_failed() method none
REQ-004-US-004-018 yes Implement get_delivery_history() method 4
REQ-004-US-004-019 yes Support filtering packets by status none
REQ-004-US-004-020 yes Record failure reason for FAILED status 4
REQ-004-US-004-021 yes Support retry count tracking 4
REQ-004-US-004-022 yes Implement max retry limit 4
REQ-004-US-004-023 yes Log delivery failures none
REQ-004-US-004-024 yes Notify sender on delivery failure 1
REQ-004-US-005-001 yes Define WorkStatus enum 1
REQ-004-US-005-002 yes Implement PENDING status 1
REQ-004-US-005-003 yes Implement IN_PROGRESS status 1
REQ-004-US-005-004 yes Implement RESOLVED status 1
REQ-004-US-005-005 yes Implement ARCHIVED status 1
REQ-004-US-005-006 yes Validate status transitions 2
REQ-004-US-005-007 yes Allow PENDING → IN_PROGRESS transition 3
REQ-004-US-005-008 yes Allow IN_PROGRESS → RESOLVED transition 3
REQ-004-US-005-009 yes Allow RESOLVED → ARCHIVED transition 3
REQ-004-US-005-010 yes Allow IN_PROGRESS → PENDING transition (re-queue) 3
REQ-004-US-005-011 yes Prevent invalid transitions (e.g., ARCHIVED → PENDING) 3
REQ-004-US-005-012 yes Record timestamp for each transition 2
REQ-004-US-005-013 yes Log status transitions none
REQ-004-US-005-014 yes Implement is_pending() method none
REQ-004-US-005-015 yes Implement is_in_progress() method none
REQ-004-US-005-016 yes Implement is_resolved() method none
REQ-004-US-005-017 yes Implement is_archived() method none
REQ-004-US-005-018 yes Implement get_work_history() method 1
REQ-004-US-005-019 yes Support filtering packets by work status none
REQ-004-US-005-020 yes Track assigned_to Volk for IN_PROGRESS none
REQ-004-US-005-021 yes Track resolution result for RESOLVED none
REQ-004-US-005-022 yes Track resolution timestamp 2
REQ-004-US-005-023 yes Track time_in_progress duration 1
REQ-004-US-005-024 yes Support work notes/comments none
REQ-004-US-006-001 yes Implement to_json() method 5
REQ-004-US-006-002 yes Serialize all packet fields to JSON 4
REQ-004-US-006-003 yes Handle datetime serialization (ISO8601) 5
REQ-004-US-006-004 yes Handle enum serialization (string values) 5
REQ-004-US-006-005 yes Handle UUID serialization (string) none
REQ-004-US-006-006 yes Handle binary payload (base64) 2
REQ-004-US-006-007 yes Serialize in <10ms for typical packet none
REQ-004-US-006-008 yes Validate JSON output is valid none
REQ-004-US-006-009 yes Implement from_json() class method 5
REQ-004-US-006-010 yes Deserialize all packet fields from JSON 4
REQ-004-US-006-011 yes Parse datetime from ISO8601 6
REQ-004-US-006-012 yes Parse enum from string values 2
REQ-004-US-006-013 yes Parse UUID from string none
REQ-004-US-006-014 yes Decode binary payload from base64 1
REQ-004-US-006-015 yes Deserialize in <10ms for typical packet 1
REQ-004-US-006-016 yes Validate all required fields present 1
REQ-004-US-006-017 yes Implement to_bytes() method using MessagePack 3
REQ-004-US-006-018 yes Serialize all packet fields to binary 2
REQ-004-US-006-019 yes Binary serialization in <5ms 1
REQ-004-US-006-020 yes Support compression for large payloads none
REQ-004-US-006-021 yes Implement from_bytes() class method 3
REQ-004-US-006-022 yes Deserialize all packet fields from binary 2
REQ-004-US-006-023 yes Binary deserialization in <5ms 1
REQ-004-US-006-024 yes Support decompression for compressed payloads 1
REQ-004-US-006-025 yes Support pretty-print JSON for debugging 3
REQ-004-US-006-026 yes Support compact JSON for production 1
REQ-004-US-006-027 yes Support serialization with/without payload none
REQ-004-US-006-028 yes Support partial serialization (headers only) none
REQ-004-US-007-001 yes Validate all required fields present 2
REQ-004-US-007-002 yes Validate field types match specification 3
REQ-004-US-007-003 yes Validate field value constraints 2
REQ-004-US-007-004 yes Validate enum values 1
REQ-004-US-007-005 yes Validate string lengths 3
REQ-004-US-007-006 yes Validate numeric ranges 2
REQ-004-US-007-007 yes Define JSON schema for CXP packets 1
REQ-004-US-007-008 yes Implement validate() method 4
REQ-004-US-007-009 yes Validate packet against JSON schema 4
REQ-004-US-007-010 yes Validate payload against custom schema (if provided) 4
REQ-004-US-007-011 yes Schema validation in <5ms 1
REQ-004-US-007-012 yes Provide detailed validation errors 3
REQ-004-US-007-013 yes Validate delivery_status consistency with timestamps none
REQ-004-US-007-014 yes Validate work_status consistency with timestamps none
REQ-004-US-007-015 yes Validate from_agent ≠ to_agent 1
REQ-004-US-007-016 yes Validate thread_id format none
REQ-004-US-007-017 yes Validate protocol_version compatibility 2
REQ-004-US-007-018 yes Support custom validator functions 3
REQ-004-US-007-019 yes Register validators per field 2
REQ-004-US-007-020 yes Support validator chains 1
REQ-004-US-007-021 yes Provide validator error messages 2
REQ-004-US-008-001 yes Generate thread_id for new conversations 1
REQ-004-US-008-002 yes Use UUID format for thread_id 1
REQ-004-US-008-003 yes Validate thread_id format none
REQ-004-US-008-004 yes Support thread_id inheritance (replies use same thread_id) 1
REQ-004-US-008-005 yes Implement get_thread_packets(thread_id) method 3
REQ-004-US-008-006 yes Return packets in chronological order 2
REQ-004-US-008-007 yes Support filtering by sender none
REQ-004-US-008-008 yes Support filtering by recipient none
REQ-004-US-008-009 yes Support filtering by status none
REQ-004-US-008-010 yes Thread correlation in <2ms 1
REQ-004-US-008-011 yes Track thread creation timestamp 2
REQ-004-US-008-012 yes Track thread participants (from_agent, to_agent) 3
REQ-004-US-008-013 yes Track thread message count 2
REQ-004-US-008-014 yes Track thread status (active, resolved, archived) 3
REQ-004-US-008-015 yes Support thread subject tracking 2
REQ-004-US-008-016 yes Create new thread on first message 2
REQ-004-US-008-017 yes Add message to existing thread 3
REQ-004-US-008-018 yes Close thread when work_status = ARCHIVED 2
REQ-004-US-008-019 yes Support thread re-opening 2
REQ-004-US-008-020 yes Archive old threads after 30 days 1
REQ-004-US-009-001 yes Define priority range 0-10 1
REQ-004-US-009-002 yes Implement priority constants (LOW=3, NORMAL=5, HIGH=7, URGENT=10) 2
REQ-004-US-009-003 yes Default priority = 5 (NORMAL) 1
REQ-004-US-009-004 yes Validate priority range 3
REQ-004-US-009-005 yes Sort packets by priority (descending) 3
REQ-004-US-009-006 yes Sort packets by timestamp (ascending) within same priority 3
REQ-004-US-009-007 yes Implement compare_priority() method none
REQ-004-US-009-008 yes Support priority queue operations 2
REQ-004-US-009-009 yes Implement set_priority() method 1
REQ-004-US-009-010 yes Allow priority increase (escalation) 1
REQ-004-US-009-011 yes Allow priority decrease (demotion) 1
REQ-004-US-009-012 yes Log priority changes none
REQ-004-US-009-013 yes Prevent priority manipulation attacks 2
REQ-004-US-009-014 yes System messages have URGENT priority 1
REQ-004-US-009-015 yes Error messages have HIGH priority 1
REQ-004-US-009-016 yes User requests have NORMAL priority 1
REQ-004-US-009-017 yes Background tasks have LOW priority 1
REQ-004-US-009-018 yes Support custom priority policies per Volk none
REQ-004-US-010-001 yes Use semantic versioning (major.minor.patch) 4
REQ-004-US-010-002 yes Current version = 1.0.0 1
REQ-004-US-010-003 yes Validate version format 2
REQ-004-US-010-004 yes Store version in protocol_version field 1
REQ-004-US-010-005 yes Implement check_compatibility(version) method 1
REQ-004-US-010-006 yes Support same major version compatibility 2
REQ-004-US-010-007 yes Reject incompatible major versions 2
REQ-004-US-010-008 yes Support backward compatibility (older clients, newer server) 2
REQ-004-US-010-009 yes Warn on minor version mismatch 2
REQ-004-US-010-010 yes Support protocol version negotiation 1
REQ-004-US-010-011 yes Return supported versions in handshake 1
REQ-004-US-010-012 yes Select highest compatible version 1
REQ-004-US-010-013 yes Fallback to older version if needed 1
REQ-004-US-010-014 yes Log version negotiation results none
REQ-004-US-010-015 yes Support packet migration from v1.0.0 to v2.0.0 none
REQ-004-US-010-016 yes Implement upgrade_packet() method none
REQ-004-US-010-017 yes Preserve all existing fields none
REQ-004-US-010-018 yes Add new fields with defaults none
REQ-004-US-010-019 yes Log packet upgrades none
REQ-004-US-010-020 yes Document breaking changes in CHANGELOG.md none
REQ-004-US-010-021 yes Document migration guides none
REQ-004-US-010-022 yes Document version compatibility matrix none
REQ-004-US-010-023 yes Document deprecation timeline none
REQ-004-PERF-001 yes JSON serialization: <10ms for typical packet (1KB payload) 3
REQ-004-PERF-002 yes JSON deserialization: <10ms for typical packet 1
REQ-004-PERF-003 yes Binary serialization: <5ms for typical packet 1
REQ-004-PERF-004 yes Binary deserialization: <5ms for typical packet 1
REQ-004-PERF-005 yes Large payload (10MB JSON): <100ms serialization none
REQ-004-PERF-006 yes Field validation: <1ms per packet none
REQ-004-PERF-007 yes Schema validation: <5ms per packet 3
REQ-004-PERF-008 yes Cross-field validation: <2ms per packet 1
REQ-004-PERF-009 yes Thread correlation: <2ms per lookup 1
REQ-004-PERF-010 yes Packet memory footprint: <10KB (excluding payload) none
REQ-004-PERF-011 yes Thread metadata: <1KB per thread 1
REQ-004-PERF-012 yes Validation cache: <100KB total none
REQ-004-PERF-013 yes Support 10,000 packets in memory simultaneously 1
REQ-004-INTG-001 yes Store packet facts in Prolog (Article II) 5
REQ-004-INTG-002 yes Query packets by message_id none
REQ-004-INTG-003 yes Query packets by thread_id 5
REQ-004-INTG-004 yes Query packets by sender/recipient none
REQ-004-INTG-005 yes Query packets by status 4
REQ-004-INTG-006 yes Isolate packets per session (Article III) 5
REQ-004-INTG-007 yes Load packets on session resume none
REQ-004-INTG-008 yes Archive packets on session end none
REQ-004-INTG-009 yes Support cross-session thread continuation none
REQ-004-INTG-010 yes Postman accepts CXP packets for delivery 5
REQ-004-INTG-011 yes Postman updates delivery_status 3
REQ-004-INTG-012 yes Postman manages packet queues 6
REQ-004-INTG-013 yes Postman handles delivery failures 3
REQ-004-INTG-014 yes All Volks send CXP packets none
REQ-004-INTG-015 yes All Volks receive CXP packets none
REQ-004-INTG-016 yes Volks validate received packets 1
REQ-004-INTG-017 yes Volks acknowledge received packets 2
REQ-004-SUCC-001 yes All 250+ checkboxes in this file are marked none
REQ-004-SUCC-002 yes All 10 user stories (US-001 to US-010) implemented none
REQ-004-SUCC-003 yes All performance requirements met none
REQ-004-SUCC-004 yes All integration requirements satisfied none
REQ-004-SUCC-005 yes Unit tests passing for all user stories 1
REQ-004-SUCC-006 yes Integration tests passing with Postman and Volks 1
REQ-004-SUCC-007 yes Documentation complete none

Code that traces this spec

Module Symbols Requirements
orchestrata_ultimate/core/packet/compat 4 13
orchestrata_ultimate/core/packet/enums 3 15
orchestrata_ultimate/core/packet/exceptions 2 3
orchestrata_ultimate/core/packet/packet 27 46
orchestrata_ultimate/core/packet/results 4 2
orchestrata_ultimate/core/protocols/components 1 2
orchestrata_ultimate/cxp/binary_serializer 5 9
orchestrata_ultimate/cxp/delivery_status 7 11
orchestrata_ultimate/cxp/deterministic_ids 1 1
orchestrata_ultimate/cxp/dispatcher 2 2
orchestrata_ultimate/cxp/exceptions 6 8
orchestrata_ultimate/cxp/headers 11 31
orchestrata_ultimate/cxp/interfaces 34 33
orchestrata_ultimate/cxp/json_serializer 10 17
orchestrata_ultimate/cxp/payload 13 16
orchestrata_ultimate/cxp/postman_adapter 9 8
orchestrata_ultimate/cxp/priority 6 9
orchestrata_ultimate/cxp/prolog_bridge 8 3
orchestrata_ultimate/cxp/proto_codec 1 1
orchestrata_ultimate/cxp/schema 10 10
orchestrata_ultimate/cxp/serializer 3 3
orchestrata_ultimate/cxp/session_adapter 5 1
orchestrata_ultimate/cxp/threads 7 16
orchestrata_ultimate/cxp/types 4 6
orchestrata_ultimate/cxp/validator 12 22
orchestrata_ultimate/cxp/version 7 7
orchestrata_ultimate/cxp/version_compat 4 10
orchestrata_ultimate/cxp/work_status 9 10
orchestrata_ultimate/gateway/cli 2 2
orchestrata_ultimate/postman/postman 1 4
orchestrata_ultimate/postman/sync_router 2 3

Checklists

checklists/README.md

CXP Protocol Checklists

Project: Orchestrator-AI CXP Protocol (Spec 004)
Component: Cross-agent eXchange Protocol
Version: 1.0.0
Status: Planning


Overview

The CXP Protocol (Cross-agent eXchange Protocol) is the communication standard for Orchestrata that enables structured, deterministic agent-to-agent messaging with complete delivery and work status tracking.

Core Responsibilities

The CXP Protocol provides:

  1. Structured Packet Format - Standardized message structure with headers and payload
  2. Deterministic Headers - Required fields: TO, FROM, THREAD_ID, SUBJECT
  3. Delivery Status Tracking - queued, delivered, acknowledged, failed
  4. Work Status Tracking - pending, in_progress, resolved, archived
  5. Packet Serialization - JSON and binary serialization with <10ms performance
  6. Packet Validation - Schema validation with <5ms performance
  7. Thread Management - Message correlation and conversation tracking
  8. Priority Ordering - Message prioritization and delivery ordering
  9. Protocol Versioning - Backward compatibility and version negotiation

Checklist Summary
Checklist Purpose Checkboxes Status
requirements.md Functional requirements (US-001 to US-010) ~250 Not Started
constitutional.md Constitutional compliance (11 Articles) ~250 Not Started
testing.md Comprehensive testing plan ~200 Not Started
TOTAL Complete CXP Protocol implementation ~700 Not Started

CXP Packet Structure
Core Packet Fields
Field Type Required Description
message_id string Yes Unique identifier (UUID)
from_agent string Yes Sender Volk alias (e.g., "U:Ox")
to_agent string Yes Recipient Volk alias (e.g., "U:Vz")
thread_id string Yes Conversation thread identifier
subject string Yes Message subject line
payload object Yes Message content (JSON or binary)
timestamp ISO8601 Yes Message creation time
priority int No Priority level (0-10, default 5)
delivery_status enum Yes queued, delivered, acknowledged, failed
work_status enum Yes pending, in_progress, resolved, archived
protocol_version string Yes CXP protocol version (e.g., "1.0.0")
Example CXP Packet
{
  "message_id": "550e8400-e29b-41d4-a716-446655440000",
  "from_agent": "U:Ox",
  "to_agent": "U:Vz",
  "thread_id": "thread-001",
  "subject": "Generate UserService Implementation",
  "payload": {
    "task": "generate_code",
    "spec": "UserService with CRUD operations",
    "language": "Python"
  },
  "timestamp": "2026-01-15T10:30:00Z",
  "priority": 8,
  "delivery_status": "delivered",
  "work_status": "in_progress",
  "protocol_version": "1.0.0"
}

Performance Requirements
Operation Target Measurement
Packet Serialization <10ms JSON encoding of full packet
Packet Deserialization <10ms JSON decoding to object
Packet Validation <5ms Schema validation
Header Extraction <1ms Parse headers from packet
Thread Correlation <2ms Match thread_id in history

Usage Guidelines
For Developers
  1. Start with Requirements - Read requirements.md to understand all user stories (US-001 to US-010)
  2. Review Constitutional Compliance - Check constitutional.md for governance rules
  3. Plan Testing - Review testing.md for comprehensive test coverage
  4. Track Progress - Mark checkboxes as you complete each item
  5. Verify Performance - Ensure all performance targets are met
For Reviewers
  1. Completeness Check - Verify all checkboxes are marked
  2. Constitutional Compliance - Ensure all 11 Articles are satisfied
  3. Test Coverage - Confirm 310+ tests are implemented
  4. Performance Validation - Verify all performance targets achieved
  5. Integration Verification - Test with Postman and Volks

Dependencies
Core Dependencies
Integration Points

Checkpoint Strategy
Git Checkpoints

Create checkpoints after completing:

  1. Requirements Phase - All 10 user stories implemented
  2. Constitutional Phase - All 11 Articles satisfied
  3. Testing Phase - 100+ unit tests passing
  4. Integration Phase - 70+ integration tests passing
  5. Contract Phase - 60 contract tests passing
  6. Performance Phase - All performance targets met
  7. Interoperability Phase - 30+ version compatibility tests passing
Verification Commands
# Run all CXP tests
uv run pytest tests/test_cxp*.py -v

# Test packet serialization performance
uv run pytest tests/test_cxp_performance.py -v

# Test protocol compliance
uv run pytest tests/test_cxp_contract.py -v

# Test version compatibility
uv run pytest tests/test_cxp_interop.py -v

Success Criteria

The CXP Protocol is complete when:



Last Updated: 2026-01-15
Next Review: After Requirements Phase

checklists/SUMMARY.md

CXP Protocol Checklists Summary

Created: 2026-01-15
Status: Complete - All 4 checklist files created


File Statistics
File Size Checkboxes Purpose
README.md 6.4 KB 9 Overview and usage guidelines
requirements.md 15 KB 273 Functional requirements (US-001 to US-010)
constitutional.md 12 KB 205 Constitutional compliance (11 Articles)
testing.md 19 KB 340 Comprehensive testing plan (310+ tests)
TOTAL 52.4 KB 827 Complete CXP Protocol implementation

Checkbox Breakdown by File
requirements.md (273 checkboxes)
constitutional.md (205 checkboxes)
testing.md (340 checkboxes)

Implementation Phases
Phase 1: Requirements (requirements.md)

Goal: Implement all 10 user stories
Checkboxes: 273
Estimated: 2-3 weeks

Key deliverables:

Phase 2: Constitutional Compliance (constitutional.md)

Goal: Satisfy all 11 Articles
Checkboxes: 205
Estimated: 1-2 weeks

Key deliverables:

Phase 3: Testing (testing.md)

Goal: Implement 310+ tests
Checkboxes: 340
Estimated: 2-3 weeks

Key deliverables:


Success Metrics

The CXP Protocol is complete when:


Quick Reference
Key Performance Targets
Operation Target Test File
JSON Serialization <10ms test_cxp_performance.py
Binary Serialization <5ms test_cxp_performance.py
Validation <5ms test_cxp_performance.py
Thread Correlation <2ms test_cxp_performance.py
Header Extraction <1ms test_cxp_headers.py
Core Packet Fields
Field Type Required Description
message_id UUID Yes Unique identifier
from_agent string Yes Sender Volk alias
to_agent string Yes Recipient Volk alias
thread_id string Yes Conversation thread
subject string Yes Message subject
payload object Yes Message content
timestamp ISO8601 Yes Creation time
priority int No Priority level (0-10)
delivery_status enum Yes Delivery state
work_status enum Yes Work state
protocol_version semver Yes Protocol version
Test Execution Commands
# All tests
uv run pytest tests/test_cxp*.py -v

# Unit tests only
uv run pytest tests/test_cxp_packet.py tests/test_cxp_serialization.py tests/test_cxp_validation.py -v

# Integration tests
uv run pytest tests/test_cxp_integration.py -v

# Performance tests
uv run pytest tests/test_cxp_performance.py -v

# With coverage
uv run pytest tests/test_cxp*.py --cov=src/cxp --cov-report=html -v


Last Updated: 2026-01-15
Next Review: After Phase 1 completion

checklists/constitutional.md

CXP Protocol Constitutional Compliance Checklist

Project: Orchestrator-AI CXP Protocol (Spec 004)
Component: Cross-agent eXchange Protocol
Version: 1.0.0


Overview

This checklist ensures the CXP Protocol implementation complies with all 11 Articles of the Orchestrata Constitution. Each Article includes specific compliance checks for packet structure, serialization, validation, and integration.

Total Articles: 11
Total Checkboxes: ~250


Article I: Sessions Are Unit Of Work

Principle: All packet operations are scoped to sessions.

Session Isolation
Session Lifecycle
Session Context
Session Testing

Article II: Prolog Is Source Of Truth

Principle: All CXP packet facts are stored in Prolog.

Packet Facts
Fact Assertions
Fact Queries
Fact Persistence
Prolog Testing

Article III: Sessions Isolate State

Principle: Packet state is isolated per session.

State Boundaries
State Transitions
State Carryover
State Testing

Article IV: Adapters Abstract LLMs

Principle: CXP Protocol is LLM-agnostic.

LLM Independence
Adapter Integration
Multi-LLM Support
Adapter Testing

Article V: Volks Embody Personas

Principle: CXP packets enforce Volk identities.

Volk Identification
Volk Authorization
Volk Routing
Volk Testing

Article VI: CXP Governs Exchange

Principle: CXP is the sole communication protocol.

Protocol Enforcement
Protocol Compliance
Protocol Monitoring
Protocol Testing

Article VII: No Mocking In Tests

Principle: Test with real CXP serialization and delivery.

Real Serialization
Real Validation
Real Delivery
Real Integration
Testing Standards

Article VIII: Dependency Injection

Principle: CXP components are injectable.

Injectable Components
DI Container
DI Testing

Article IX: Logging Is Mandatory

Principle: All CXP operations are logged.

Packet Logging
Status Logging
Error Logging
Performance Logging
Logging Compliance

Article X: Governance Via PAM++

Principle: CXP respects PAM++ ownership rules.

Ownership Validation
Escalation Handling
Component Boundaries
Governance Testing

Article XI: Container Native

Principle: CXP Protocol works in containerized environments.

Container Deployment
Network Communication
State Persistence
Container Testing

Constitutional Success Criteria

All Articles are satisfied when:


Last Updated: 2026-01-15
Next Review: After Testing Phase

checklists/requirements.md

The requirement list above comes from this file; 273 of 273 checkbox items are ticked.

checklists/testing.md

CXP Protocol Testing Checklist

Project: Orchestrator-AI CXP Protocol (Spec 004)
Component: Cross-agent eXchange Protocol
Version: 1.0.0


Overview

This checklist tracks all testing requirements for the CXP Protocol. Tests are organized by category: Unit, Integration, Contract, Performance, and Interoperability.

Total Test Categories: 5
Total Tests: 310+
Total Checkboxes: ~200


Test File Structure
tests/
├── test_cxp_packet.py           # Unit tests for CXPPacket class (30 tests)
├── test_cxp_serialization.py    # Unit tests for serialization (25 tests)
├── test_cxp_validation.py       # Unit tests for validation (25 tests)
├── test_cxp_headers.py          # Unit tests for header management (20 tests)
├── test_cxp_status.py           # Unit tests for status tracking (20 tests)
├── test_cxp_threads.py          # Unit tests for thread management (20 tests)
├── test_cxp_integration.py      # Integration tests with Postman/Volks (70 tests)
├── test_cxp_contract.py         # Contract tests for protocol compliance (60 tests)
├── test_cxp_performance.py      # Performance tests (50 tests)
└── test_cxp_interop.py          # Interoperability tests (30 tests)

Unit Tests (140 tests)
test_cxp_packet.py (30 tests)
Packet Creation
Packet Validation
Packet Comparison
Packet Representation
Edge Cases
test_cxp_serialization.py (25 tests)
JSON Serialization
JSON Deserialization
Binary Serialization
Serialization Options
test_cxp_validation.py (25 tests)
Field Validation
Schema Validation
Cross-Field Validation
Custom Validators
Edge Cases
test_cxp_headers.py (20 tests)
Header Extraction
Header Modification
Header Validation
test_cxp_status.py (20 tests)
Delivery Status
Work Status
test_cxp_threads.py (20 tests)
Thread Management
Thread Metadata
Thread Lifecycle
Edge Cases

Integration Tests (70 tests)
test_cxp_integration.py (70 tests)
Postman Integration
Volk Integration
Prolog Integration
Session Integration
Adapter Integration
Thread Integration
Priority Integration
Error Integration
Performance Integration
End-to-End Scenarios

Contract Tests (60 tests)
test_cxp_contract.py (60 tests)
Schema Compliance
Protocol Version Compliance
Header Contract
Payload Contract
Status Contract
Serialization Contract
Validation Contract
Threading Contract
Priority Contract
Interoperability Contract
Backward Compatibility Contract

Performance Tests (50 tests)
test_cxp_performance.py (50 tests)
Serialization Performance
Deserialization Performance
Validation Performance
Thread Performance
Query Performance
Throughput Performance
Memory Performance
Latency Performance
Stress Tests

Interoperability Tests (30 tests)
test_cxp_interop.py (30 tests)
Cross-Language Interop
Version Compatibility
Protocol Negotiation
Encoding Compatibility
Timestamp Compatibility
Enum Compatibility
Edge Cases

Test Execution
Run All Tests
uv run pytest tests/test_cxp*.py -v
Run Unit Tests
uv run pytest tests/test_cxp_packet.py tests/test_cxp_serialization.py tests/test_cxp_validation.py tests/test_cxp_headers.py tests/test_cxp_status.py tests/test_cxp_threads.py -v
Run Integration Tests
uv run pytest tests/test_cxp_integration.py -v
Run Contract Tests
uv run pytest tests/test_cxp_contract.py -v
Run Performance Tests
uv run pytest tests/test_cxp_performance.py -v
Run Interoperability Tests
uv run pytest tests/test_cxp_interop.py -v
Run with Coverage
uv run pytest tests/test_cxp*.py --cov=src/cxp --cov-report=html -v

Testing Success Criteria

All testing is complete when:


Last Updated: 2026-01-15
Next Review: After Test Implementation

Other tracked files

Full spec text

Verbatim from specs/004-cxp/spec.md; headings are pushed down two levels.

SPEC-004: CXP Protocol (Cross-agent eXchange Protocol)

Metadata


Overview

What

The Cross-agent eXchange Protocol (CXP) is the structured communication protocol for all agent-to-agent messaging in Orchestrata. It defines an 11-field packet format with deterministic headers, delivery tracking, work status state machines, and Prolog fact integration.

Why
How

User Scenarios & Stories

US-001: Packet Format and Structure (Critical)

As a developer I want to a standardized packet format So that all agents communicate consistently

Acceptance Criteria:


US-002: Header Management (Critical)

As a Postman agent I want to efficient header extraction So that I can route messages quickly

Acceptance Criteria:


US-003: Payload Handling (Critical)

As a Volk agent I want to flexible payload formats So that I can send various data types

Acceptance Criteria:


US-004: Delivery Status Tracking (Critical)

As a Postman agent I want to delivery status tracking So that I can monitor message delivery

Acceptance Criteria:


US-005: Work Status Tracking (High)

As a recipient Volk I want to work status tracking So that I can manage task progress

Acceptance Criteria:


US-006: Packet Serialization/Deserialization (Critical)

As a developer I want to efficient serialization So that packets transmit quickly

Acceptance Criteria:


US-007: Packet Validation and Schema (High)

As a developer I want to comprehensive validation So that invalid packets are rejected

Acceptance Criteria:


US-008: Thread Management and Correlation (High)

As a developer I want to thread correlation So that related messages are grouped

Acceptance Criteria:


US-009: Priority and Ordering (High)

As a Postman agent I want to priority-based ordering So that urgent messages processed first

Acceptance Criteria:


US-010: CXP Protocol Versioning (High)

As a developer I want to protocol versioning So that backward compatibility maintained

Acceptance Criteria:


US-011: fix_issues Subject for Code Review (Critical)

As a U:Qa (QA) agent I want to send code review findings to U:Vz (VizInt) So that issues can be fixed iteratively

Acceptance Criteria:


US-011: fix_issues Subject for Code Review (Critical)

As a U:Qa (QA) agent I want to send code review findings to U:Vz (VizInt) So that issues can be fixed iteratively

Acceptance Criteria:


Functional Requirements

Performance Requirements
Operation Target
JSON serialization <10ms (1KB payload)
JSON deserialization <10ms
Binary serialization <5ms
Binary deserialization <5ms
Field validation <1ms
Schema validation <5ms
Thread correlation <2ms
Memory Requirements
Subject Requirements
Subject Requirements

Technical Design

CXP Packet Structure
class CXPPacket(BaseModel):
    # Identity
    message_id: UUID
    from_agent: str              # Volk alias (U:[A-Z][a-z])
    to_agent: str                # Volk alias
    thread_id: str               # Conversation ID
    
    # Content
    subject: str                 # Max 200 chars
    payload: Union[Dict, bytes]  # Message body
    
    # Metadata
    timestamp: datetime          # ISO8601
    priority: int                # 0-10
    protocol_version: str        # Semver
    
    # Status
    delivery_status: DeliveryStatus  # queued, delivered, acknowledged, failed
    work_status: WorkStatus          # pending, in_progress, resolved, archived
Status Enums
class DeliveryStatus(Enum):
    QUEUED = "queued"
    DELIVERED = "delivered"
    ACKNOWLEDGED = "acknowledged"
    FAILED = "failed"

class WorkStatus(Enum):
    PENDING = "pending"
    IN_PROGRESS = "in_progress"
    RESOLVED = "resolved"
    ARCHIVED = "archived"

Integration Points

Component Integration
orchestrata-kernel Packet routing, recursive routing for fix_issues
orchestrata-postman Packet delivery
orchestrata-governance Prolog fact storage
orchestrata-session Session-scoped packets
orchestrata-qa fix_issues subject consumption, MAX_REVIEW_CYCLES config
orchestrata-vizint fix_issues subject handling
orchestrata-qa fix_issues subject consumption, MAX_REVIEW_CYCLES config
orchestrata-vizint fix_issues subject handling

Revision History

Date Version Author Changes
2026-03-07 1.0 Mohamed Initial specification
2026-03-07 1.1 Mohamed Added fix_issues CXP subject for U:Qa code review loop and MAX_REVIEW_CYCLES configuration
2026-03-07 1.1 Mohamed Added fix_issues CXP subject for U:Qa code review loop and MAX_REVIEW_CYCLES configuration
Prolog Integration
% CXP facts stored in Prolog (Article II)
cxp_packet(MessageID, From, To, ThreadID, Subject, Timestamp).
cxp_delivery_status(MessageID, Status, Timestamp).
cxp_work_status(MessageID, Status, Timestamp).
fix_issues Subject Specification

The fix_issues subject enables the U:Qa code review loop functionality by allowing QA agents to send code review findings back to VizInt agents for remediation.

Subject Values
Subject From To Purpose
review_code U:Cx, U:Ox, U:Vz U:Qa Request code review
fix_issues U:Qa U:Vz Send review findings for remediation
review_complete U:Qa U:Ox Notify orchestrator of review completion
fix_issues Packet Format
CXP Packet(
    subject="fix_issues",
    from_agent="U:Qa",
    to_agent="U:Vz",
    payload={
        "review_id": "rev_123",
        "file_path": "packages/.../kernel.py",
        "issues": [
            {
                "type": "style",
                "rule": "E501",
                "line": 42,
                "message": "Line too long (92 > 88 chars)",
                "severity": "warning"
            },
            {
                "type": "complexity",
                "rule": "C101",
                "line": 156,
                "function": "handle_packet",
                "message": "Function too long (67 > 40 lines)",
                "severity": "warning"
            }
        ],
        "summary": {
            "total_issues": 5,
            "errors": 0,
            "warnings": 4,
            "infos": 1
        },
        "auto_fixable": True
    }
)
Review-Fix Loop Flow
1. U:Cx receives user requirement
2. U:Cx → U:Vz: "build feature X"
3. U:Vz generates code
4. U:Vz → U:Qa: "review_code" with file_path
5. U:Qa analyzes code → finds issues
6. U:Qa → U:Vz: "fix_issues" with issue list
7. U:Vz applies fixes → sends back to U:Qa
8. Loop back to step 5 until MAX_REVIEW_CYCLES (default: 3)
9. If issues remain after MAX cycles → escalate to U:Ox
10. U:Qa → U:Ox: "review_complete" with final status
MAX_REVIEW_CYCLES Configuration
# In orchestrata-qa configuration
MAX_REVIEW_CYCLES: int = 3  # Maximum review-fix iterations
REVIEW_TIMEOUT_SECONDS: int = 300  # 5 minutes per cycle
ESCALATE_ON_MAX_CYCLES: bool = True
Recursive Routing in Kernel

The Kernel must support recursive routing for review cycles:


Success Criteria

  1. All 11 fields present and validated
  2. Serialization: JSON <10ms, Binary <5ms
  3. Validation: <5ms per packet
  4. Compatibility: Backward compatible versioning
  5. Reliability: Zero packet corruption in transit

Dependencies