Skip to content

Axiom-consensus-protocol/axiom-protocol-openclaw

Repository files navigation

Axiom Protocol — OpenClaw Extension

License Tests Axiom Protocol

Multi-model AI consensus extension for OpenClaw.

Queries multiple LLM models (GPT, Claude, Gemini) simultaneously and achieves verified agreement through phi-convergence — the golden ratio spiral algorithm.

How It Works

Different AI models give different answers. Axiom Protocol resolves this:

  1. Query is sent to N models in parallel
  2. Responses are compared using D-score (divergence metric)
  3. Each iteration narrows disagreement by the golden ratio (1/phi ~ 0.618)
  4. After 7 iterations, only 3.4% disagreement remains
  5. Consensus is mathematically guaranteed
D(n) = D(0) * (1/phi)^n    where phi = 1.618...

Iteration 1: 61.8% disagreement
Iteration 2: 38.2%
Iteration 3: 23.6%
...
Iteration 7:  3.4% — CONSENSUS

Tools

axiom_consensus

Run full multi-model consensus on any query.

axiom_consensus query="What causes inflation?"
axiom_consensus query="SQL vs NoSQL for this use case?" structure="sonata"
axiom_consensus query="Write a haiku about AI" structure="concert" models='["openai/gpt-4o","anthropic/claude-sonnet-4-20250514"]'

Parameters:

Parameter Type Required Default Description
query string yes Question or statement for consensus
models string[] no gpt-4o-mini, claude-3-haiku, gemini-pro Models to query (min 2)
structure string no fugue Consensus structure
max_iterations number no 7 Phi-spiral iterations (1-7)

Structures:

Structure Best for How it works
fugue Complex analytical questions Models build on each other's responses layer by layer
sonata Debates, opposing views Thesis → antithesis → synthesis
concert Creative tasks One model leads, others refine

axiom_verify

Fact-check a specific claim through consensus.

axiom_verify claim="The speed of light is 299,792,458 m/s"
axiom_verify claim="Python was created in 1991"

Parameters:

Parameter Type Required Description
claim string yes Statement to verify
models string[] no Models for verification

D-Score Reference

D-score Level Meaning
0.00 - 0.05 Strong consensus All models agree
0.05 - 0.20 High confidence Models mostly agree
0.20 - 0.40 Moderate Some disagreement
0.40 - 0.60 Low confidence Significant divergence
0.60 - 1.00 No consensus Models disagree

Setup

1. Prerequisites

2. Configuration

In OpenClaw plugin settings:

Setting Required Description
workerUrl yes Your Axiom Protocol Worker endpoint
apiKey yes OpenRouter API key (or set OPENROUTER_API_KEY env var)
defaultModels no Default models array
maxIterations no Max iterations (default: 7)
structure no Default structure (default: fugue)
dThreshold no Consensus threshold (default: 0.05)

Project Structure

axiom-protocol-openclaw/
├── index.ts                     # Plugin entry point
├── openclaw.plugin.json         # Plugin manifest and config schema
├── package.json                 # Package definition
├── src/
│   ├── types.ts                 # Type definitions and constants
│   ├── client.ts                # HTTP client with error handling
│   ├── consensus-tool.ts        # axiom_consensus tool
│   ├── verify-tool.ts           # axiom_verify tool
│   └── __tests__/
│       ├── types.test.ts        # Type and constant tests (11 tests)
│       └── client.test.ts       # Client validation and HTTP tests (12 tests)
├── skills/
│   └── axiom-consensus/
│       └── SKILL.md             # OpenClaw skill prompt
├── vitest.config.ts             # Test configuration
└── tsconfig.json                # TypeScript configuration

Tests

npm install
npm test

23 tests covering:

  • D-score confidence level mapping
  • Phi constant accuracy and convergence math
  • Client input validation (empty query, insufficient models)
  • HTTP error handling (401 auth, 429 rate limit, 500 server error)
  • Network failure handling
  • Request format verification (URL, headers, body)

Error Handling

The extension handles these error cases:

Error Behavior
Missing worker URL Clear error message with setup instructions
Missing API key Prompts to set OPENROUTER_API_KEY
Invalid API key (401) "Invalid API key" message
Rate limited (429) "Rate limited, try again later"
Server error (500) Forwards error details
Network failure Reports connection error
Empty query "Query cannot be empty"
< 2 models "At least 2 models required"

Links

License

BSL 1.1 — see LICENSE. Non-production use permitted. Transitions to Apache 2.0 on 2030-04-09.

About

Axiom Protocol extension for OpenClaw — multi-model AI consensus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors