@weave_protocol/domere
v1.2.12
Published
The Judge Protocol - Thread identity, intent verification, and blockchain anchoring
Downloads
262
Maintainers
Readme
⚖️ Dōmere - Judge Protocol
Enterprise-grade verification, orchestration, compliance, and audit infrastructure for AI agents.
Part of the Weave Protocol Security Suite.
✨ Features
| Category | Features | |----------|----------| | Verification | Intent tracking, drift detection, execution replay, multi-agent handoff | | Orchestration | Task scheduler, agent registry, shared state with locks | | Compliance | SOC2, HIPAA, PCI-DSS, ISO27001 checkpoints & reporting | | Blockchain | Solana & Ethereum anchoring for immutable audit trails |
📦 Installation
npm install @weave_protocol/domere🚀 Quick Start: Multi-Agent Orchestration
import { Orchestrator } from '@weave_protocol/domere';
// Configure agent limit as needed (no hard maximum)
const orch = new Orchestrator({ max_agents: 10 });
await orch.start();
// Register agents
for (let i = 0; i < 10; i++) {
await orch.registerAgent({
name: `agent-${i}`,
capabilities: ['research', 'analysis', 'coding'][i % 3],
max_concurrent_tasks: 3
});
}
// Submit tasks with dependencies
const task1 = await orch.submitTask({
intent: 'Fetch Q3 data',
priority: 'high'
});
const task2 = await orch.submitTask({
intent: 'Analyze Q3 trends',
dependencies: [task1.id] // Waits for task1
});
// Get stats
const stats = orch.getStats();
console.log(`${stats.agents.ready} agents ready, ${stats.tasks.queued} tasks queued`);📊 Task Scheduler
Priority queue with dependencies, retries, and load balancing.
import { TaskScheduler } from '@weave_protocol/domere';
const scheduler = new TaskScheduler();
const task = await scheduler.createTask({
intent: 'Analyze Q3 data',
priority: 'high',
dependencies: ['fetch-data-task'],
constraints: {
required_capabilities: ['data-analysis'],
max_duration_ms: 300000,
exclusive_resources: ['gpu-1']
},
retry_policy: {
max_retries: 3,
backoff: 'exponential'
}
});
// Auto-assign to best agent
const assignment = await scheduler.assignTask(task.id);
// Track progress
scheduler.onTaskProgress(task.id, (p) => console.log(`${p.percent}%`));
// Handle completion
scheduler.onTaskComplete(task.id, (result) => {
console.log(`Completed in ${result.duration_ms}ms`);
});🤖 Agent Registry
Agent lifecycle, heartbeat monitoring, and failover.
import { AgentRegistry } from '@weave_protocol/domere';
const registry = new AgentRegistry({
heartbeat_interval_ms: 5000,
heartbeat_timeout_ms: 15000
});
// Register agent
const agent = await registry.register({
agent_id: 'agent-7',
capabilities: ['code-generation', 'testing'],
max_concurrent_tasks: 3
});
await registry.setReady('agent-7');
// Process heartbeats
await registry.heartbeat({
agent_id: 'agent-7',
current_tasks: ['task_1', 'task_2']
});
// Handle failures
registry.onAgentDown((agent, tasks) => {
console.log(`${agent.id} down with ${tasks.length} tasks`);
// Reassign tasks...
});
// Find best agent
const best = registry.getBestAgent({
capabilities: ['code-generation'],
prefer_lowest_load: true
});🗃️ State Manager
Shared state with locking, branching, and conflict resolution.
import { StateManager } from '@weave_protocol/domere';
const state = new StateManager({
conflict_resolution: 'last-write-wins'
});
// Lock before writing
const lock = await state.acquireLock({
key: 'customer-db',
holder: 'agent-3',
duration_ms: 30000,
type: 'exclusive'
});
if (lock.acquired) {
await state.set('customer-db', { updated: true });
await state.releaseLock('customer-db', 'agent-3');
}
// Git-style branching
await state.createBranch('experiment', { parent: 'main' });
await state.set('config', newConfig, { branch: 'experiment' });
// Merge with conflict detection
const result = await state.merge('experiment', 'main');
if (result.conflicts.length > 0) {
// Resolve conflicts
}
// Snapshots for rollback
const snap = await state.createSnapshot();
// ... later ...
await state.restoreSnapshot(snap.id);🔄 Execution Replay
Tamper-proof audit trail with cryptographic verification.
import { ExecutionReplayManager } from '@weave_protocol/domere';
const replay = new ExecutionReplayManager('encryption-key');
// Record actions
await replay.recordAction({
thread_id: 'thr_xxx',
agent_id: 'gpt-4-agent',
agent_type: 'llm',
action_type: 'inference',
action_name: 'generate_report',
input: { prompt: '...' },
output: { response: '...' },
latency_ms: 1250,
cost_usd: 0.03,
tokens_in: 500,
tokens_out: 1000
});
// Get trail
const trail = await replay.getExecutionTrail('thr_xxx');
console.log(trail.integrity_valid); // true
console.log(trail.merkle_root); // For blockchain
// Generate report
const report = await replay.generateAuditReport({
start_time: new Date('2026-01-01'),
end_time: new Date('2026-01-31')
});🤝 Multi-Agent Handoff
Secure delegation with permission inheritance.
import { HandoffManager } from '@weave_protocol/domere';
const handoff = new HandoffManager('signing-key', {
max_delegation_depth: 5
});
// Create handoff token
const token = await handoff.createHandoff({
thread_id: 'thr_xxx',
from_agent: 'orchestrator',
to_agent: 'researcher',
delegated_intent: 'Find Q3 data',
constraints: ['read-only'],
permissions: [{ resource: 'database', actions: ['read'] }],
max_actions: 10,
expires_in_ms: 300000
});
// Verify before acting
const v = await handoff.verifyHandoff(token.token, 'researcher');
if (v.valid) {
console.log(`${v.remaining_actions} actions left`);
}
// Track chain
const chain = await handoff.getDelegationChain('thr_xxx');
console.log(`Depth: ${chain.depth}, Valid: ${chain.integrity_valid}`);📋 Compliance (SOC2/HIPAA/PCI-DSS/ISO27001)
Automated compliance tracking and reporting for multiple frameworks.
import { ComplianceManager } from '@weave_protocol/domere';
const compliance = new ComplianceManager('signing-key');
// HIPAA: Log PHI access
await compliance.logPHIAccess({
thread_id: 'thr_xxx',
agent_id: 'medical-ai',
patient_id: 'patient_123',
access_reason: 'Treatment',
data_accessed: ['diagnosis'],
legal_basis: 'treatment'
});
// SOC2: Log access control
await compliance.logAccessControl({
thread_id: 'thr_xxx',
agent_id: 'admin-bot',
resource: 'reports',
action: 'grant',
success: true
});
// PCI-DSS: Log cardholder data access
await compliance.logCardholderDataAccess({
thread_id: 'thr_xxx',
agent_id: 'payment-processor',
data_type: 'pan',
action: 'access',
masked: true,
encrypted: true,
business_justification: 'Process refund'
});
// ISO27001: Log security incident
await compliance.logSecurityIncident({
thread_id: 'thr_xxx',
agent_id: 'security-monitor',
incident_id: 'INC-001',
incident_type: 'unauthorized_access',
severity: 'high',
status: 'investigating',
affected_assets: ['db-prod-1'],
description: 'Unusual access pattern detected'
});
// ISO27001: Log asset management
await compliance.logAssetEvent({
thread_id: 'thr_xxx',
agent_id: 'asset-manager',
asset_id: 'srv-prod-5',
asset_type: 'hardware',
action: 'classify',
classification: 'confidential'
});
// Generate report
const report = await compliance.generateReport({
framework: 'PCI-DSS',
period_start: new Date('2026-01-01'),
period_end: new Date('2026-03-31')
});
console.log(`Score: ${report.compliance_score}`);⛓️ Blockchain Anchoring
Immutable proof on Solana and Ethereum.
import { EthereumAnchor } from '@weave_protocol/domere';
const anchor = new EthereumAnchor({
contract_address: '0xAA8b52adD3CEce6269d14C6335a79df451543820'
});
await anchor.anchorThread({
thread_id: 'thr_xxx',
merkle_root: trail.merkle_root,
intent_hash: 'abc123...',
compliant: true
});| Chain | Network | Address |
|-------|---------|---------|
| Solana | Mainnet | 6g7raTAHU2h331VKtfVtkS5pmuvR8vMYwjGsZF1CUj2o |
| Solana | Devnet | BeCYVJYfbUu3k2TPGmh9VoGWeJwzm2hg2NdtnvbdBNCj |
| Ethereum | Mainnet | 0xAA8b52adD3CEce6269d14C6335a79df451543820 |
📚 API Reference
Orchestrator
| Method | Description |
|--------|-------------|
| start() | Start orchestrator |
| registerAgent(params) | Register new agent |
| submitTask(params) | Submit task to queue |
| heartbeat(agentId, tasks) | Process agent heartbeat |
| taskCompleted(agentId, taskId, result) | Report completion |
| getStats() | Get orchestrator stats |
TaskScheduler
| Method | Description |
|--------|-------------|
| createTask(params) | Create task with dependencies |
| assignTask(taskId, agentId?) | Assign to agent |
| completeTask(taskId, agentId, result) | Mark complete |
| failTask(taskId, agentId, error) | Mark failed (auto-retry) |
| reassignFromAgent(agentId) | Reassign failed agent's tasks |
AgentRegistry
| Method | Description |
|--------|-------------|
| register(params) | Register agent |
| heartbeat(payload) | Process heartbeat |
| findAgents(query) | Find matching agents |
| drain(agentId) | Stop accepting tasks |
| deregister(agentId) | Remove agent |
StateManager
| Method | Description |
|--------|-------------|
| get(key) / set(key, value) | Basic operations |
| acquireLock(request) | Acquire lock |
| releaseLock(key, holder) | Release lock |
| createBranch(name) | Create branch |
| merge(source, target) | Merge branches |
| createSnapshot() | Create snapshot |
🔗 Related Packages
| Package | Description | |---------|-------------| | @weave_protocol/witan | Consensus, communication & governance | | @weave_protocol/mund | Secret & threat scanning | | @weave_protocol/hord | Secure vault & sandbox | | @weave_protocol/api | Universal REST API |
📄 License
Apache 2.0
Made with ❤️ for AI Safety
