@private.me/xcontinuity
v2.1.3
Published
Cryptographic state continuity for AI agents — Reverse-XorIDA with trust substrate, provenance, and enforcement
Maintainers
Readme
@private.me/xcontinuity
Cryptographic state continuity for AI agents — Reverse-XorIDA with trust substrate, provenance, and enforcement.
Features
- Reverse-XorIDA — incremental state updates at O(delta) cost exploiting GF(2) linearity
- XorIDA threshold sharing — k-of-n split for fault-tolerant state persistence
- TLV serialization — compact binary state encoding with SHA-256 integrity
- SessionManager — lifecycle controller (active/suspended/closed) combining all layers
- Chronicle — ordered state history with contradiction detection
- Runtime memory — ephemeral in-process key-value store with LRU eviction
- Session memory — XorIDA-persisted state layer with incremental updates
- Trust substrate (v2.0.0) — provenance, trust tiers, adjudication, ratification
- Mission & enforcement (v2.0.0) — human-anchored goals with constraint checking
- 7 algebraic extensions (v2.0.0) — undo, branching, squashing, blind updates, share refresh, blind equality, network-coded sync
- TTL decay (v2.0.0) — ratified entries auto-downgrade after configurable maxAge
- Event hooks (v2.0.0) — reactive onChange, onContradiction, onTierChange, onEscalation
- Cascade / sub-agent architecture (v2.1.0) — parent-child session hierarchies with trust delegation
- SubAgentCoordinator (v2.1.0) — lifecycle management for spawning, merging, and shutting down sub-agents
- Blind convergence (v2.1.0) — N-way state equality without decryption via pairwise share comparison
- Syndrome detection (v2.1.0) — trial-reconstruction error localization identifying drifted shares
- Self-healing (v2.1.0) —
repairShare()reconstructs from consistent shares and replaces drifted share - Independence monitoring (v2.1.0) — online Welford correlation estimator for sub-agent error streams
- Belief decomposition (v2.1.0) — recursive split into structural (verifiable) and semantic (consensus) claims
- View integrity (v2.1.0) — Ed25519 verification with nonce-based replay prevention
- Merge conflict detection (v2.1.0) — region bookkeeping detects overlapping writes across sub-agents
- Share-space merge primitive (v2.1.0) —
mergeAgentDeltas()for disjoint-region XOR folding with overlap detection - Sparse delta regions (v2.1.0) —
extractDeltaRegions()identifies changed byte ranges between share arrays - Point-in-time state recovery (v2.1.2) —
listCheckpoints()+restoreToCheckpoint(n)for verifiable rollback to any prior checkpoint - 2 internal dependencies — @private.me/shared + @private.me/crypto (no third-party npm packages)
Why xContinuity is different
xContinuity is a cryptographic resilience layer for agent state — it keeps state correct, recoverable, and erasable under failure, tampering, and concurrency. It is not a semantic-retrieval or temporal memory; it complements those by keeping their state resilient and erasable.
| Capability | xContinuity | Typical approaches | |---|---|---| | State integrity | Fail-closed cryptographic (corruption → typed error) | Storage-layer only | | Fault tolerance | Threshold dispersal (survives losing a backend) | Single store / replication | | Erasure | Verifiable crypto-erasure | Standard deletion | | Write efficiency | Incremental delta writes with bounded disk via compaction | Full rewrite | | Multi-agent writes | Conflict-detected merge (overlaps surfaced, not clobbered) | Last-write-wins | | Foundation | Patent-backed dispersal | — |
Compliance-supporting capabilities: verifiable crypto-erasure supports right-to-erasure obligations, and cryptographic provenance provides a tamper-evident audit trail. (Capabilities, not certifications.)
Installation
npm install @private.me/xcontinuityDependencies
Runtime Dependencies:
- @private.me/shared — Result<T,E> error handling primitives
- @private.me/crypto — XorIDA threshold sharing, HMAC, padding, UUID
Platform Dependencies:
- Web Crypto API — crypto.subtle with Ed25519 support (Node.js 16.9+ and modern browsers)
Quick Start
import { SessionManager, MemoryStateStore } from '@private.me/xcontinuity';
// Create session with in-memory store
const store = new MemoryStateStore();
const session = SessionManager.create({ agentId: 'agent-001', store });
// Build up state
session.updateState({ model: 'gpt-4', temperature: 0.7 });
session.updateState({ conversationCount: 42 });
// Snapshot (XorIDA split + persist)
const snap = await session.snapshot('after-training');
if (!snap.ok) throw new Error(snap.error.message);
// Later: restore from snapshot
const restored = await session.restore(snap.value.stateId);
if (restored.ok) {
console.log(restored.value);
// { model: 'gpt-4', temperature: 0.7, conversationCount: 42 }
}
session.close();Quick Start: Trust-Aware Session
import {
SessionManager, MemoryStateStore, TrustStore,
MissionAuthority, MissionGuard, EnforcementLoop,
generateSigningKeyPair, publicKeyToAuthorRef,
} from '@private.me/xcontinuity';
// Set up trust substrate
const trustStore = new TrustStore({ defaultMaxAge: 7 * 24 * 60 * 60 * 1000 }); // 7-day TTL
const authority = new MissionAuthority();
const guard = new MissionGuard(authority);
const enforcement = new EnforcementLoop(guard, { escalationThreshold: 3 });
// Create trust-aware session
const store = new MemoryStateStore();
const session = SessionManager.create({
agentId: 'agent-001',
store,
trustStore,
missionGuard: guard,
enforcementLoop: enforcement,
});
// Subscribe to trust events
trustStore.on('contradiction', (event) => {
console.log(`Contradiction on key "${event.key}"`);
});
trustStore.on('tierChange', (event) => {
console.log(`${event.key}: ${event.oldTier} → ${event.newTier} (${event.reason})`);
});
// Writes now flow through trust substrate
session.updateState({ temperature: 0.8 });API Reference
SessionManager
import { SessionManager, MemoryStateStore } from '@private.me/xcontinuity';
const store = new MemoryStateStore();
const session = SessionManager.create({ agentId: 'agent-1', store });
session.updateState({ key: 'value' }); // Merge patch
session.setState({ newKey: 'newValue' }); // Replace entire state
const snap = await session.snapshot('desc'); // Persist as XorIDA shares
const state = await session.restore(snap.value.stateId);
await session.suspend(); // Auto-snapshot + suspend
const resumed = await session.resume(); // Restore latest + resume
session.close(); // Terminal
// Point-in-time state recovery (v2.1.2)
const checkpoints = session.listCheckpoints(); // All snapshots
const filtered = session.listCheckpoints({ tags: ['deploy'] }); // Filtered
const old = await session.restoreToCheckpoint(2); // Rollback to sequence 2
// Trust substrate accessors (v2.0.0)
session.getTrustStore(); // TrustStore | undefined
session.getMissionGuard(); // MissionGuard | undefined
session.getEnforcementLoop(); // EnforcementLoop | undefinedProvenance (Ed25519 Signing)
import {
generateSigningKeyPair, signEntry, verifyEntry,
publicKeyToAuthorRef, canonicalEntryBytes,
hashProvenance, verifyChainLink,
} from '@private.me/xcontinuity';
const keyPair = await generateSigningKeyPair();
const authorRef = await publicKeyToAuthorRef(keyPair.publicKey);
// Sign an entry
const signed = await signEntry('temperature', 0.7, keyPair.privateKey, keyPair.publicKey);
if (signed.ok) {
const provenance = signed.value; // { author, timestamp, signature }
// Verify signature
const valid = await verifyEntry('temperature', 0.7, provenance, keyPair.publicKey);
console.log(valid.value); // true
}Trust Tiers
import {
baselineTier, effectiveTier, applyDecay, isDecayed,
applyContradictionDowngrade,
} from '@private.me/xcontinuity';
// A provenance record (e.g. produced by signEntry) and a stored entry
const provenance = { author: 'did:example:alice', timestamp: Date.now(), signature: new Uint8Array(64) };
const entry = { key: 'fact', value: 'earth-round', tier: 'ratified', contradictions: [], maxAge: 30 * 24 * 60 * 60 * 1000 };
// Assign tier based on provenance
baselineTier(provenance, true); // 'ratified' (signed + verified)
baselineTier(provenance, false); // 'quarantined' (signed but invalid)
baselineTier(undefined, false); // 'inherited' (no provenance)
// Contradiction downgrade
applyContradictionDowngrade('ratified', 1); // 'inherited'
applyContradictionDowngrade('inherited', 1); // 'quarantined'
// TTL decay
isDecayed(entry, Date.now()); // true if past maxAge
applyDecay(entry); // 'inherited' if decayed, else original tier
effectiveTier(entry); // decay + contradictions combinedTrustStore (Ratification)
import { TrustStore, generateSigningKeyPair } from '@private.me/xcontinuity';
const store = new TrustStore({ defaultMaxAge: 30 * 24 * 60 * 60 * 1000 });
// Write (inherits trust tier from provenance)
store.write('fact', 'The sky is blue');
// Ratify (sign, promoting to 'ratified')
const keys = await generateSigningKeyPair();
await store.ratify('fact', keys.privateKey, keys.publicKey);
// Read with effective tier (applies decay + contradictions)
const entry = store.read('fact');
// Read only if trusted enough
const trusted = store.readAtTier('fact', 'ratified');
// Hypothesis (sandbox for speculative writes)
const hyp = store.hypothesisMode();
hyp.write('speculative', 'maybe true', 'quarantined');
hyp.commit(); // merge into main store
// or: hyp.discard(); // abandon changes
// Event hooks
store.on('change', (e) => console.log(e.key, e.newEntry));
store.on('contradiction', (e) => console.log(e.key));
store.on('tierChange', (e) => console.log(e.oldTier, '→', e.newTier));
store.removeAllListeners();Adjudicator (Conflict Resolution)
import { PolicyAdjudicator, ConsensusAdjudicator, TrustStore, generateSigningKeyPair, publicKeyToAuthorRef } from '@private.me/xcontinuity';
// Create sample entries for demonstration
const keys = await generateSigningKeyPair();
const author = await publicKeyToAuthorRef(keys.publicKey);
const entryA = { key: 'key', value: 'A', tier: 'ratified', provenance: { author, timestamp: Date.now(), signature: new Uint8Array(64) }, contradictions: [] };
const entryB = { key: 'key', value: 'B', tier: 'inherited', provenance: undefined, contradictions: [] };
// Policy: highest tier → newest timestamp → lowest author DID
const policy = new PolicyAdjudicator();
const result = policy.resolve('key', [entryA, entryB]);
if (result.ok) console.log(result.value.winner, result.value.reason);
// Consensus: multi-agent with quorum
const viewProvider = { getView: async (agentId) => ({ agentId, entries: [] }) };
const consensus = new ConsensusAdjudicator(viewProvider);
const async_result = await consensus.resolveAsync('key', [entryA]);Mission & Enforcement
import {
MissionAuthority, MissionGuard, EnforcementLoop,
AlignmentAdjudicator, PolicyAdjudicator,
generateSigningKeyPair, publicKeyToAuthorRef,
} from '@private.me/xcontinuity';
// Generate keys and author reference
const keys = await generateSigningKeyPair();
const authorRef = await publicKeyToAuthorRef(keys.publicKey);
// Helper function to check for PII
const containsPII = (value) => {
const str = typeof value === 'string' ? value : JSON.stringify(value);
return /\b\d{3}-\d{2}-\d{4}\b/.test(str); // Simple SSN check
};
// Set up mission authority
const authority = new MissionAuthority();
authority.loadTrustedMission({
missionId: 'm-1',
goal: 'Analyze customer data without PII exposure',
authority: authorRef,
signature: new Uint8Array(64),
issuedAt: Date.now(),
scopes: ['read:*', 'write:analysis'],
});
// Guard with constraints
const guard = new MissionGuard(authority);
guard.addConstraint({
constraintId: 'no-pii',
description: 'Block writes containing PII',
evaluate: (action) => ({ allowed: !containsPII(action.value) }),
});
// Enforcement loop
const data = 'customer analysis report';
const enforcement = new EnforcementLoop(guard, { escalationThreshold: 3 });
const check = enforcement.check({ author: 'agent-1', type: 'write', key: 'output', value: data });
// check.value.decision: 'allow' | 'reject' | 'rewrite' | 'escalate'
// Alignment adjudicator (wraps any adjudicator with mission checks)
const aligned = new AlignmentAdjudicator(new PolicyAdjudicator(), guard);Cascade / Sub-Agent Architecture (v2.1.0)
import { SessionManager, TrustStore, MemoryStateStore } from '@private.me/xcontinuity';
// Demonstrates multi-session coordination
const parentStore = new MemoryStateStore();
const parentTrust = new TrustStore();
const parent = SessionManager.create({
agentId: 'parent',
store: parentStore,
trustStore: parentTrust,
});
// Parent writes shared context
const writeResult = parentTrust.write('context', 'shared data');
if (writeResult.ok) {
console.log('Parent tier:', writeResult.value.tier);
}
// Child with independent trust store
const childStore = new MemoryStateStore();
const childTrust = new TrustStore();
const child = SessionManager.create({
agentId: 'child',
store: childStore,
trustStore: childTrust,
});
// Child writes independently
const childWrite = childTrust.write('result', 'child data');
if (childWrite.ok) {
console.log('Child tier:', childWrite.value.tier);
}View Integrity (E4 — Nonce-Based Replay Prevention)
import {
generateSigningKeyPair, signEntry, verifyView,
} from '@private.me/xcontinuity';
const keyPair = await generateSigningKeyPair();
const seenNonces = new Set();
// Sign a view submission
const signed = await signEntry('fact', 'earth-round', keyPair.privateKey, keyPair.publicKey);
if (!signed.ok) throw new Error(signed.error.message);
// Verify with nonce tracking
const result = await verifyView('fact', 'earth-round', 'nonce-1', signed.value, keyPair.publicKey, seenNonces);
if (result.ok) {
console.log(result.value.status); // 'accepted'
}
// Replay with same nonce → rejected
const replay = await verifyView('fact', 'earth-round', 'nonce-1', signed.value, keyPair.publicKey, seenNonces);
if (replay.ok) {
console.log(replay.value.status); // 'rejected-replay'
}
// Tampered value → rejected
const tamper = await verifyView('fact', 'earth-flat', 'nonce-2', signed.value, keyPair.publicKey, seenNonces);
if (tamper.ok) {
console.log(tamper.value.status); // 'rejected-tamper'
}Blind Convergence & Syndrome Detection
import {
splitState, serializeState, syndromeLocate, repairShare,
blindCluster, sharesIdentical,
} from '@private.me/xcontinuity';
// Setup: create and split state
const metadata = { agentId: 'a1', sessionId: 's1', sequenceNumber: 0, createdAt: Date.now(), tags: [] };
const serialized = await serializeState({ counter: 42 }, metadata);
const split = await splitState(serialized.value, { k: 2, n: 3 });
const shares = split.value.shares;
// Syndrome detection: locate drifted share via trial reconstruction
const located = await syndromeLocate(shares);
if (located.ok && located.value === null) {
console.log('No drift detected');
}
// Self-healing: repair a drifted share
// (simulate drift by corrupting share 2)
const drifted = [shares[0], shares[1], { ...shares[2], data: new Uint8Array(shares[2].data.length) }];
const syndrome = await syndromeLocate(drifted);
if (syndrome.ok && syndrome.value && syndrome.value.position >= 0) {
const repaired = await repairShare(drifted, syndrome.value.position, syndrome.value.consistent);
if (repaired.ok) console.log('Share repaired, all k-subsets reconstruct');
}
// Blind convergence: check if agents agree without decryption
const agentStates = new Map([['agent-1', split.value], ['agent-2', split.value]]);
const clusters = blindCluster(agentStates);
if (clusters.ok) {
console.log(clusters.value); // [['agent-1', 'agent-2']] — they agree
}Independence Monitoring & Merge Conflict Detection
import {
CascadeSession, SubAgentCoordinator, CorrelationMonitor,
SessionManager, TrustStore, MemoryStateStore,
} from '@private.me/xcontinuity';
// Setup coordinator
const root = new CascadeSession(
SessionManager.create({ agentId: 'root', store: new MemoryStateStore(), trustStore: new TrustStore() }),
new TrustStore(),
);
const coordinator = new SubAgentCoordinator(root);
// E1: Monitor error correlation between agent pairs
for (let i = 0; i < 50; i++) {
const monitor = coordinator.reportErrors('pair-AB', Math.random(), Math.random());
if (monitor.alarm) console.log('Independence violated!');
}
// E2: Check convergence across active agents
const convergence = coordinator.checkConvergence();
if (convergence.ok) {
console.log('Clusters:', convergence.value); // groups of agents with identical state
}
// Merge conflict detection: mergeChild now tracks regions
// After merging, check: root.getMergeConflicts()
// Returns MergeConflict[] with key, firstChildId, secondChildId, valuesShare-Space Merge Primitive
import { extractDeltaRegions, mergeAgentDeltas } from '@private.me/xcontinuity';
// Types available for TypeScript users: SparseDeltaRegion, AgentDelta
// Extract changed byte regions between old and new share arrays
const oldShares = [new Uint8Array(100), new Uint8Array(100)];
const newShares = [new Uint8Array(100), new Uint8Array(100)];
// (modify newShares bytes 10-19 on share 0)
const regions = extractDeltaRegions(oldShares, newShares);
if (regions.ok) {
// regions.value: SparseDeltaRegion[] with shareIndex, offset, length, deltaBytes
}
// Merge disjoint delta regions from multiple agents
const baseShares = [new Uint8Array(100), new Uint8Array(100)];
const agentDeltas = [
{ agentId: 'agent-a', stateId: 's1', regions: [/* disjoint regions */] },
{ agentId: 'agent-b', stateId: 's2', regions: [/* disjoint regions */] },
];
const merged = mergeAgentDeltas(baseShares, agentDeltas);
if (merged.ok) {
// merged.value.mergedSharesData: Uint8Array[] with all deltas applied
// merged.value.conflicts: [] (empty for disjoint regions)
} else {
// merged.error.code === 'MERGE_CONFLICT' if regions overlap
}Limitation: Share-level multi-agent merge requires agents to operate on pre-assigned disjoint byte regions. When using
incrementalUpdate(), XorIDA's per-split randomness changes ~100% of share bytes on every delta, making independent agents' regions overlap. Multi-agent merge for full-state updates is handled at the trust-store level viaCascadeSession.mergeChild().
Belief Decomposition (E5)
import { DecompositionAdjudicator } from '@private.me/xcontinuity';
// Type available for TypeScript users: DecompositionRule
// Define rules for extracting structural claims
const rules = [{
name: 'file-exists',
matches: (desc) => desc.includes('file'),
decompose: (desc) => ({
structural: [{
type: 'structural',
description: `Check: ${desc}`,
verifier: () => true, // replace with actual check
}],
residue: null,
}),
}];
const adjudicator = new DecompositionAdjudicator(rules, 5);
const result = adjudicator.decompose('The config file contains valid JSON');
console.log(result.structuralFraction); // 1.0 (fully decomposed)
console.log(result.consensusResidual); // 0.0 (no consensus needed)Memory Layers
import { RuntimeMemory, SessionMemory, MemoryStateStore } from '@private.me/xcontinuity';
// Ephemeral in-process memory with LRU eviction
const runtime = new RuntimeMemory({ maxEntries: 1000 });
runtime.set('key', 'value');
const val = runtime.get('key');
// Session-persisted memory backed by XorIDA shares
const store = new MemoryStateStore();
const sessionMem = new SessionMemory(store);
await sessionMem.save({ counter: 42 });
const restored = await sessionMem.load();Error Handling
import { ok, err, continuityError, ERROR_DETAILS } from '@private.me/xcontinuity';
// Result<T, E> pattern — all fallible functions return Result
const success = ok({ data: 'value' });
const failure = err(continuityError('SESSION_CLOSED'));
if (!success.ok) {
console.log(success.error.code); // error code
}
// Error details lookup
const details = ERROR_DETAILS['HMAC_FAILURE'];
console.log(details); // { family: 'Split', description: 'HMAC verification failed' }Hypothesis Mode (Speculative Writes)
import { TrustStore, Hypothesis } from '@private.me/xcontinuity';
const store = new TrustStore();
store.write('fact', 'known value');
// Hypothesis: sandbox for speculative writes
const hyp = store.hypothesisMode();
hyp.write('speculative', 'maybe true', 'quarantined');
hyp.write('fact', 'override attempt', 'quarantined');
// Inspect without affecting main store
const specVal = hyp.read('speculative'); // { value: 'maybe true', ... }
// Commit merges into main store
hyp.commit();
// Or: hyp.discard() to abandon changesReverse-XorIDA Extensions (v2.0.0)
import {
undoDelta, branchState, squashDeltas,
blindUpdateShare, refreshShares,
blindEqual, networkCodeShares, networkDecodeShare,
splitState, serializeState, MemoryStateStore,
} from '@private.me/xcontinuity';
// Setup: create split state for demonstrations
const metadata = { agentId: 'a1', sessionId: 's1', sequenceNumber: 0, createdAt: Date.now(), tags: [] };
const serialized = await serializeState({ counter: 42 }, metadata);
const splitResult = await splitState(serialized.value, { k: 2, n: 3 });
const splitStateVal = splitResult.value;
const shares = splitStateVal.shares;
// Undo: XOR is self-inverse
const deltaShares = [new Uint8Array(32), new Uint8Array(32), new Uint8Array(32)];
const integrityHash = new Uint8Array(32);
const undoResult = undoDelta(shares, deltaShares, 'prev-state', integrityHash);
// Branch: independent copy of split state
const branch = branchState(splitStateVal, 'branch-1');
// Squash: combine sequential deltas
const delta1 = { fromStateId: 's1', toStateId: 's2', deltaBytes: new Uint8Array(32), fromChecksum: new Uint8Array(32), toChecksum: new Uint8Array(32) };
const delta2 = { fromStateId: 's2', toStateId: 's3', deltaBytes: new Uint8Array(32), fromChecksum: new Uint8Array(32), toChecksum: new Uint8Array(32) };
const squashed = squashDeltas([delta1, delta2]);
// Blind update: update share without seeing plaintext
const share = shares[0];
const deltaData = new Uint8Array(32);
const newIntegrityHash = new Uint8Array(32);
const blindResult = blindUpdateShare(share, deltaData, 'new-state', newIntegrityHash);
// Refresh: re-randomize shares preserving plaintext
const refreshed = await refreshShares(splitStateVal);
// Blind equality: compare states without decryption
const stateA = splitStateVal;
const stateB = branch;
const equal = blindEqual(stateA, stateB);
// Network coding: combine shares for bandwidth efficiency
const share1 = shares[0];
const share2 = shares[1];
const coded = networkCodeShares([share1, share2]);
if (coded.ok) {
const decoded = networkDecodeShare(coded.value, share1);
}State Serialization
import { serializeState, deserializeState, statesEqual } from '@private.me/xcontinuity';
const metadata = { agentId: 'a1', sessionId: 's1', sequenceNumber: 0, createdAt: Date.now(), tags: [] };
const snapResult = await serializeState({ counter: 42 }, metadata);
const desResult = await deserializeState(snapResult.value);
const equal = statesEqual({ a: 1 }, { a: 1 }); // trueChronicle (with Contradiction Detection)
import { Chronicle, detectContradiction } from '@private.me/xcontinuity';
const chronicle = new Chronicle();
// Create a chronicle entry
const entry = {
stateId: 'state-1',
sessionId: 'session-1',
sequence: 0,
timestamp: Date.now(),
tags: ['checkpoint'],
};
// Append with contradiction check
const contradictions = chronicle.appendWithContradictionCheck(
entry, 'temperature', 0.8, 0.7 // old value was 0.7, new is 0.8
);
if (contradictions.length > 0) {
console.log('Contradictions:', contradictions);
}
// Query
const results = chronicle.query({ tags: ['checkpoint'], limit: 10 });
const forKey = chronicle.getContradictionsForKey('temperature');Constants
import {
VERSION, DEFAULT_SPLIT_CONFIG, DEFAULT_MAX_AGE,
DEFAULT_ENFORCEMENT_CONFIG, TRUST_TIER_RANK,
} from '@private.me/xcontinuity';
console.log(VERSION); // '2.1.3'
console.log(DEFAULT_SPLIT_CONFIG); // { n: 3, k: 2 }
console.log(DEFAULT_MAX_AGE); // 2592000000 (30 days ms)
console.log(DEFAULT_ENFORCEMENT_CONFIG); // { escalationThreshold: 3 }
console.log(TRUST_TIER_RANK); // { ratified: 3, inherited: 2, quarantined: 1 }Reverse-XorIDA
The novel contribution: exploiting split(A XOR B) = split(A) XOR split(B) over GF(2).
When updating state, instead of re-splitting the entire state:
- Compute
delta = oldPadded XOR newPadded - Split only the delta:
deltaShares = split(delta) - XOR each old share with the delta share:
newShares[i] = oldShares[i] XOR deltaShares[i]
Cost: O(delta) instead of O(state). HMAC is recomputed fresh for integrity.
Trust Substrate (v2.0.0)
Six-layer architecture for trust-annotated state management:
┌─────────────────────────────────────┐
│ SubAgentCoordinator (v2.1.0) │ Multi-agent lifecycle
├─────────────────────────────────────┤
│ CascadeSession (v2.1.0) │ Parent-child trust delegation
├─────────────────────────────────────┤
│ SessionManager (Public API) │ Optional trust integration
├─────────────────────────────────────┤
│ Mission + Enforcement │ Human-anchored goals
├─────────────────────────────────────┤
│ TrustStore (Ratification) │ Write/ratify/restore + events
├─────────────────────────────────────┤
│ Adjudicator │ Policy or consensus resolution
├─────────────────────────────────────┤
│ Trust Tiers + Chronicle │ Tier management + history
├─────────────────────────────────────┤
│ Provenance (Ed25519) │ Signed entries + chain links
└─────────────────────────────────────┘State Store
import { MemoryStateStore, splitState, reconstructState, serializeState } from '@private.me/xcontinuity';
// In-memory store (async interface for future backends)
const store = new MemoryStateStore();
// Manual split/reconstruct cycle
const metadata = { agentId: 'a1', sessionId: 's1', sequenceNumber: 0, createdAt: Date.now(), tags: [] };
const serialized = await serializeState({ model: 'gpt-4', temp: 0.7 }, metadata);
if (serialized.ok) {
const split = await splitState(serialized.value, { k: 2, n: 3 });
if (split.ok) {
// Reconstruct from any 2-of-3 shares
const restored = await reconstructState([split.value.shares[0], split.value.shares[2]]);
}
}TLV Constants
import { CONTINUITY_TLV, VALUE_TYPE } from '@private.me/xcontinuity';
// TLV type tags for binary serialization
console.log(CONTINUITY_TLV); // { STATE_ENTRY: 0x01, CHECKSUM: 0x02, ... }
console.log(VALUE_TYPE); // { STRING: 0x01, NUMBER: 0x02, BOOLEAN: 0x03, ... }Session Lifecycle
create() → active → snapshot()/restore() → suspend() → resume() → close()- active — accepting state updates and snapshots
- suspended — state persisted, no updates allowed
- closed — terminal, no further operations
Error Reference
All fallible functions return Result<T, ContinuityError> with structured error codes.
| Error Code | Family | Description |
|---|---|---|
| SERIALIZE_FAILED | Serialization | State serialization failed |
| DESERIALIZE_FAILED | Serialization | TLV data corrupt or unsupported |
| CHECKSUM_MISMATCH | Serialization | SHA-256 verification failed |
| SPLIT_FAILED | Split | XorIDA threshold split failed |
| RECONSTRUCT_FAILED | Split | Share reconstruction failed |
| HMAC_FAILURE | Split | HMAC verification failed |
| INSUFFICIENT_SHARES | Split | Not enough shares for threshold |
| SESSION_CLOSED | Session | Operation on closed session |
| SESSION_SUSPENDED | Session | Operation on suspended session |
| NO_SNAPSHOTS | Session | No snapshots to restore |
| SNAPSHOT_NOT_FOUND | Session | State ID not in store |
| INVALID_SIGNATURE | Provenance | Ed25519 verification failed |
| MISSING_AUTHOR | Provenance | No author in provenance record |
| HASH_CHAIN_BREAK | Provenance | Parent hash chain gap |
| CONTRADICTION_DETECTED | Trust | Incompatible value for same key |
| TRUST_DECAY_EXPIRED | Trust | Entry past maxAge TTL |
| CONSENSUS_FAILED | Adjudicator | Multi-agent consensus failed |
| QUORUM_NOT_MET | Adjudicator | Insufficient views for quorum |
| CONSTRAINT_VIOLATION | Mission | Action violates hard constraint |
| AUTHORITY_EXPIRED | Mission | Mission signature expired |
| SCOPE_EXCEEDED | Mission | Action outside mission scope |
| ACTION_REJECTED | Enforcement | Action rejected by enforcement |
| ESCALATION_TRIGGERED | Enforcement | Repeated violations, human review |
| MERGE_CONFLICT | Cascade | Overlapping regions from different agents |
| REGION_OVERLAP | Cascade | Byte-range overlap in share-space merge |
Export Control Notice
This package uses cryptographic algorithms (XorIDA threshold sharing, HMAC-SHA256, SHA-256, Ed25519) implemented via the Web Crypto API. Export, re-export, and transfer of cryptographic software may be subject to regulation under the Export Administration Regulations (EAR) and the International Traffic in Arms Regulations (ITAR). Users are responsible for compliance with all applicable export control laws.
Security
See SECURITY.md for vulnerability reporting and security architecture.
Purchasing
Subscribe via the platform:
curl -X POST https://private.me/aci/purchase \
-H 'Content-Type: application/json' \
-d '{"product":"xcontinuity","tier":"pro"}'Response (success):
{ "checkoutUrl": "https://checkout.stripe.com/..." }Response (error — RFC 7807):
{
"type": "https://private.me/errors/invalid-tier",
"title": "Invalid tier",
"status": 400,
"detail": "Tier must be one of: free, pro"
}| Tier | Operations | Price | |------|-----------|-------| | Free | 100K/month | No credit card required | | Pro | Unlimited | See pricing |
Pricing
Subscription Model: Direct — integrate xcontinuity into your applications and pay based on usage. Billed monthly.
How operations are counted:
- Each
snapshot()call = 1 operation - Each
restore()call = 1 operation - State updates (
updateState()) are free between snapshots
Tiers:
Free Tier: 100,000 operations/month
- No credit card required
- Full platform access
- All features included
- Grace buffer: 20,000 operations (120K hard cap)
Pro Tier: Unlimited operations for production use
- SLA guarantees
- Priority support
- No operation limits
See pricing details or internal reference.
Upgrade path: Start free, upgrade automatically when you exceed 100K operations/month.
See pricing details or internal reference.
Legal
- Terms of Service: https://private.me/terms
- Privacy Policy: https://private.me/privacy
License
Proprietary — Copyright © 2024-2026 Standard Clouds, Inc. (Private.Me) All rights reserved.
