This document provides comprehensive API documentation for all lane-to-lane interactions in the 4-lane Rosetta Stone system.
Each lane has a unique RSA-2048 key pair for message signing:
Key Identification:
{
"key_id": "<md5_hash_of_DER_encoded_SPKI>",
"algorithm": "RS256",
"public_key_pem": "-----BEGIN PUBLIC KEY-----\n..."
}Lane Keys:
| Lane | Key ID | Purpose |
|---|---|---|
| Archivist | 45a318fe5e226407 |
Governance root signing |
| Library | b1eba056729bbe9a |
Verification authority |
| SwarmMind | ecb12bdacf826701 |
Task execution signing |
| Kernel | 6d220ff8f1ef5b05 |
Artifact attestation |
Signature Format (JWS RS256):
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...<signature>
Verification Process:
- Extract
key_idfrom JWS header - Look up public key in
trust-store.json - Verify signature using RSA-PKCS1-v1_5
- Validate payload integrity
{
"schema_version": "1.3",
"task_id": "unique-uuid",
"idempotency_key": "sha256-hash",
"from": "source-lane",
"to": "target-lane",
"timestamp": "2026-04-28T12:00:00-04:00",
"signature": "<JWS-RS256>",
"key_id": "<matching-key-id>"
}| Field | Type | Required | Description |
|---|---|---|---|
schema_version |
string | Yes | Must be "1.3" |
task_id |
string | Yes | UUID format |
idempotency_key |
string | Yes | SHA-256 hash |
from |
string | Yes | Source lane ID |
to |
string | Yes | Target lane ID |
type |
enum | Yes | task, response, heartbeat, escalation, handoff |
task_kind |
enum | Yes | proposal, review, amendment, ratification |
priority |
enum | Yes | P0, P1, P2, P3 |
subject |
string | Yes | One-line summary |
body |
string | Yes | Full content |
timestamp |
ISO-8601 | Yes | Message creation time |
requires_action |
boolean | Yes | Whether action needed |
{
"payload": {
"mode": "inline|path|chunked",
"compression": "none|gzip",
"path": null,
"chunk": {
"index": 0,
"count": 1,
"group_id": null
}
}
}{
"execution": {
"mode": "manual|session_task|watcher",
"engine": "kilo|opencode|other",
"actor": "lane|subagent|watcher",
"session_id": null,
"parent_id": null
}
}{
"lease": {
"owner": "lane-id",
"acquired_at": "ISO-8601",
"expires_at": null,
"renew_count": 0,
"max_renewals": 3
}
}{
"evidence": {
"required": true,
"evidence_path": null,
"verified": false,
"verified_by": null,
"verified_at": null
},
"evidence_exchange": {
"artifact_path": null,
"artifact_type": "log|artifact|report",
"delivered_at": null
}
}{
"heartbeat": {
"interval_seconds": 300,
"last_heartbeat_at": "ISO-8601",
"timeout_seconds": 900,
"status": "pending|in_progress|done|failed|escalated|timed_out"
}
}{
"convergence_gate": {
"claim": "Single sentence",
"evidence": "path/to/evidence",
"verified_by": "archivist|library|swarmmind|kernel|self|user",
"contradictions": [],
"status": "proven|unproven|conflicted|blocked"
}
}Source Lane (Sender):
lanes/<lane-id>/
├── outbox/ # Messages to send
│ └── <message-id>.json
Target Lane (Receiver):
lanes/<lane-id>/
├── inbox/
│ ├── action-required/ # P0 items
│ ├── in-progress/ # Currently processing
│ ├── processed/ # Completed
│ ├── blocked/ # Rejected
│ └── quarantine/ # Suspicious
1. Sender creates message M
2. Sign M with sender's private key
3. Write M to sender's outbox/
4. Copy M to target's inbox/action-required/ (if P0) or inbox/
5. Target validates signature
6. Target validates schema
7. Target processes M
8. Target moves M to inbox/processed/
9. Target creates response R
10. Target sends R via same flow
| Priority | Directory | SLA |
|---|---|---|
| P0 | action-required/ | Immediate (< 5 min) |
| P1 | inbox/ | Same day |
| P2 | inbox/ | 3 days |
| P3 | inbox/ | 7 days |
Idempotency Key Generation:
const idempotencyKey = crypto.createHash('sha256')
.update(taskId + from + to + subject)
.digest('hex');Deduplication:
- Check
idempotency_keyagainst processed messages - Return cached response if duplicate detected
- Log duplicate attempts for audit
Endpoint Type: File-based (no HTTP)
Request Format:
{
"schema_version": "1.3",
"task_id": "task-12345",
"type": "task",
"task_kind": "review",
"from": "kernel",
"to": "library",
"priority": "P0",
"subject": "Review optimization artifact",
"body": "Please review the attached artifact...",
"timestamp": "2026-04-28T12:00:00-04:00",
"requires_action": true,
"evidence": {
"required": true,
"evidence_path": "lanes/kernel/outbox/artifact.json"
}
}Response Format:
{
"schema_version": "1.3",
"task_id": "task-12345",
"type": "response",
"from": "library",
"to": "kernel",
"subject": "Re: Review optimization artifact",
"body": "Artifact reviewed and approved",
"convergence_gate": {
"claim": "Artifact meets requirements",
"evidence": "lanes/library/outbox/review-result.json",
"status": "proven"
}
}Request Format:
{
"schema_version": "1.3",
"task_id": "heartbeat-<lane>",
"type": "heartbeat",
"from": "<lane>",
"to": "<lane>",
"priority": "P3",
"subject": "Heartbeat from <lane>",
"body": "{\"lane\":\"<lane>\",\"status\":\"alive\"}",
"timestamp": "2026-04-28T12:00:00-04:00",
"heartbeat": {
"interval_seconds": 300,
"status": "done"
}
}Validation Rules:
- Must arrive within
interval_seconds + timeout_seconds - Missing 3 consecutive heartbeats = lane considered stale
- Stale lanes reported to Archivist
Request Format:
{
"schema_version": "1.3",
"task_id": "escalation-123",
"type": "escalation",
"task_kind": "review",
"from": "library",
"to": "archivist",
"priority": "P0",
"subject": "Escalation: Unresolved contradiction",
"body": "Description of issue...",
"contradictions": [
{
"from": "library",
"claim": "...",
"evidence": "..."
}
]
}Response Requirements:
- Archivist must respond within 24 hours
- Response must include resolution plan
- If rejected, must provide justification
Required Checks:
const requiredFields = [
'schema_version', 'task_id', 'idempotency_key',
'from', 'to', 'type', 'task_kind', 'priority',
'subject', 'body', 'timestamp'
];
function validateSchema(message) {
for (const field of requiredFields) {
if (!message.hasOwnProperty(field)) {
return { valid: false, error: `Missing field: ${field}` };
}
}
if (message.schema_version !== '1.3') {
return { valid: false, error: 'Unsupported schema version' };
}
return { valid: true };
}function verifySignature(message, publicKey) {
const { signature, key_id, ...payload } = message;
// Verify key_id matches registered key
if (key_id !== publicKey.key_id) {
return { valid: false, error: 'Key ID mismatch' };
}
// Verify JWS signature
const verified = jws.verify(signature, 'RS256', publicKey.pem);
return {
valid: verified,
error: verified ? null : 'Invalid signature'
};
}function validateDomain(message) {
// Check if execution artifact is observable
if (message.evidence && message.evidence.evidence_path) {
const observable = fs.existsSync(message.evidence.evidence_path);
if (!observable) {
return {
valid: false,
error: 'artifact not observable',
domain: 'INVALID_DOMAIN'
};
}
}
return { valid: true };
}| Code | Category | Description |
|---|---|---|
| 1000 | Schema | Invalid message structure |
| 1001 | Signature | Cryptographic verification failed |
| 1002 | Domain | Post-execution validation failed |
| 1003 | Quarantine | Suspicious content |
| 1004 | Rejection | Business rule violation |
Messages are quarantined when:
- Invalid schema (cannot be parsed)
- Suspicious content patterns detected
- Failed multiple validation attempts
- Unknown sender
Messages are blocked when:
- Valid schema but business rule violation
- Missing required evidence
- Invalid signature
- Expired timestamp
Queue Metrics:
inbox_depth: Messages pending processingprocessing_time: Average time to processerror_rate: Failed validations / totalthroughput: Messages per minute
Health Metrics:
heartbeat_status: alive/stale/deadlast_message_time: ISO-8601 timestampcontradiction_count: Active contradictionsdrift_score: CPS convergence metric
Required Log Fields:
{
"timestamp": "ISO-8601",
"lane": "<lane-id>",
"message_id": "<task-id>",
"operation": "receive|process|send|error",
"status": "success|failure",
"duration_ms": 123,
"error_code": null,
"trace_id": "<correlation-id>"
}Level 1 (Local Development):
- Single operator
- Full cross-lane read access
- Relaxed permission checks
Level 2 (Multi-Operator):
- Multiple operators
- Restricted cross-lane access
- Enforced permission boundaries
Level 3 (Production):
- Hardened environment
- Hardware-backed keys
- Full audit logging
- Network segmentation
Key Rotation:
- Generate new key pair
- Add to trust store with new key_id
- Phase out old key (grace period)
- Remove old key from trust store
- Update all lane references
Key Revocation:
- Immediate: Remove from trust store
- Notify all lanes
- Reject messages signed with revoked key
- Generate incident report
| Vector | Mitigation |
|---|---|
| Replay Attack | Timestamp validation + nonce |
| Man-in-the-Middle | Certificate pinning |
| Key Compromise | Hardware security module |
| Path Traversal | Canonical path resolution |
| Command Injection | Input sanitization + allowlist |
Constitution (Highest)
↓
User Mandate
↓
Governance Rules
↓
Operational Procedures (Lowest)
All messages must include:
- Cryptographic proof of origin
- Timestamp
- Evidence chain
- Verification status
Retention:
- Messages: 7 years
- Audit logs: 10 years
- Keys: Until rotated + 1 year
const { signMessage } = require('./identity-enforcer');
const LaneDiscovery = require('./lane-discovery');
async function sendTask(targetLane, taskData) {
const discovery = new LaneDiscovery();
const targetInbox = discovery.getInbox(targetLane);
const message = {
schema_version: '1.3',
task_id: `task-${Date.now()}`,
type: 'task',
task_kind: 'review',
from: 'kernel',
to: targetLane,
priority: 'P0',
subject: 'Optimization review',
body: JSON.stringify(taskData),
timestamp: new Date().toISOString(),
requires_action: true
};
// Sign message
const signed = await signMessage(message, 'kernel');
// Write to target inbox
const fs = require('fs').promises;
const targetPath = path.join(targetInbox, `${signed.task_id}.json`);
await fs.writeFile(targetPath, JSON.stringify(signed, null, 2));
return signed;
}const InboxWatcher = require('./inbox-watcher');
const watcher = new InboxWatcher({
laneName: 'library',
inboxPath: '/path/to/inbox'
});
watcher.on('message', async (message) => {
try {
// Validate
const validation = await validateMessage(message);
if (!validation.valid) {
await quarantine(message, validation.error);
return;
}
// Process
const result = await processTask(message);
// Respond
const response = createResponse(message, result);
await sendResponse(response);
// Archive
await archive(message, 'processed');
} catch (error) {
await archive(message, 'quarantine');
logError(error);
}
});
watcher.start();| Issue | Cause | Solution |
|---|---|---|
| Signature verification fails | Key mismatch | Sync trust store across lanes |
| Messages not processing | Invalid path | Use LaneDiscovery for paths |
| Stale heartbeats | Clock skew | Sync system time |
| Permission errors | File ownership | Check directory permissions |
| Schema validation fails | Version mismatch | Update to schema v1.3 |
# Verify trust store
node scripts/verify-trust-store.js
# Check lane health
node scripts/check-lane-health.js
# Validate message
node scripts/validate-message.js <message-file>
# Sync all lanes
node scripts/sync-all-lanes.js| Version | Date | Changes |
|---|---|---|
| 1.3 | 2026-04-28 | Current version - Full validation |
| 1.2 | 2026-04-27 | Added convergence gate |
| 1.1 | 2026-04-26 | Enhanced evidence exchange |
| 1.0 | 2026-04-25 | Initial release |
- BOOTSTRAP.md - System entry point
- GOVERNANCE.md - Operational rules
- COVENANT.md - Foundational values
- Paper F: Failure Modes - Implementation learnings
Primary Contact: Governance Root (Archivist)
Authority Level: 100
Escalation: Constitutional Council
Issue Tracking:
- Code review:
lanes/broadcast/system-code-review-20260428.json - Phase 1 status:
lanes/broadcast/phase1-ack-scoreboard.json
© 2026 Rosetta Stone System - Internal Use Only
Document Classification: Governance
Distribution: All Lanes
End of Document