Harmonic by Solace

Add Harmonic after your model call.

Harmonic sits between AI output and user-visible or execution-bound continuation.

HCS Specification Library

The Harmonic Constitutional Specification (HCS) series defines the implementation-independent constitutional architecture behind continuation governance.

HCS-000 → HCS-001 → HCS-002 → HCS-003 → HCS-004 → HCS-005 → HCS-006 → HCS-099

View the HCS Library · Download the complete HCS v1.0 ZIP

Flow

User → LLM / Agent → Harmonic → constitutional determination → execution directive → response or execution

Determination: PERMITTED / CONSTRAINED / ESCALATED / REFUSED / EMERGENCY_CONTINUITY
Directive:     ALLOW / CONSTRAIN / ESCALATE / BLOCK

Frozen V4.1 Single-Call Contract

POST /api/evaluate is the frozen V4.1 production pathway. Successful Governance+ responses identify runtime_version: "4.1.0".

Vocabulary: the constitutional determination is the canonical outcome (PERMITTED, CONSTRAINED, ESCALATED, REFUSED, or EMERGENCY_CONTINUITY). The execution directive is the corresponding downstream instruction (ALLOW, CONSTRAIN, ESCALATE, or BLOCK). These are different fields with different meanings.

The caller supplies the attributable present-state facts. Harmonic does not infer domain state from raw observations. For a material transition, use understanding_state together with state_transition.

{
  "packet_id": "case-001-v40",
  "requested_action": { "type": "clinical_order", "scope": ["care_plan"] },
  "understanding_state": {
    "current": false,
    "complete": true,
    "provenance_preserved": true,
    "applicable": true,
    "confidence": 0.96,
    "source_ids": ["obs-002"],
    "unresolved_tensions": [],
    "missing_information": [],
    "revision_status": "superseded"
  },
  "state_transition": {
    "prior_state_ref": "state-001",
    "new_observation_refs": ["obs-002"],
    "relationship": "material_contradiction",
    "prior_state_status": "superseded",
    "revalidation_required": true,
    "attributable_source": "institutional-source",
    "observed_at": "2026-08-14T14:00:00.000Z",
    "scope": ["care_plan"]
  },
  "declared_reality": {
    "current_state_claims": ["Previously declared state remains the historical baseline"],
    "last_verified_at": "2026-08-14T13:30:00.000Z"
  },
  "observed_reality": {
    "signals": [{ "statement": "New attributable observation materially conflicts with continued reliance on the prior state" }]
  },
  "authority_chain": {
    "subject": "clinical-agent-1",
    "issuer": "hospital-ops",
    "scope": ["care_plan"],
    "last_verified_at": "2026-08-14T14:00:00.000Z",
    "chain": [
      { "actor": "clinical-agent-1", "status": "active" },
      { "actor": "hospital-ops", "status": "active" }
    ]
  },
  "revocation_state": {
    "last_revocation_check_at": "2026-08-14T14:00:00.000Z",
    "known_revocations": []
  },
  "present_state_provenance": {
    "attributable_source": "institutional-source",
    "established_at": "2026-08-14T14:00:00.000Z",
    "epistemic_status": "ESTABLISHED",
    "evidence_refs": ["obs-002"]
  },
  "consequence_profile": {
    "level": "high",
    "reversibility": "reversible",
    "execution_surface": "clinical_order"
  },
  "safeguards": { "operator_review_confirmed": true }
}

Material-transition semantics: relationship: "material_contradiction" or prior_state_status: "superseded" makes reliance on the prior state non-current and produces an Understanding Continuity block until revalidation. revalidation_required: true without a superseding/material contradiction produces an explicit revalidation requirement rather than silently inferring one.

Authority revocation: populate revocation_state.known_revocations with objects containing target (or subject/actor) and/or scope. A matching subject or requested scope is treated as revoked.

Historical snapshots: prior_snapshot_ref is not part of the V4.0 single-call contract. Use the evidence-preservation/reconstruction APIs when a separately preserved historical snapshot must be referenced.

Governance Plus Secure Execution — Same API Call

No second Harmonic endpoint is required. Governance Plus Secure Execution remains inside POST /api/evaluate. Project entitlement controls whether the Secure Execution stage is available.

Caller → POST /api/evaluate → Governance Plus determination
                              ├─ non-permitting → no receipt, no executor call
                              └─ PERMIT → execution receipt → allowlisted executor

The request adds an optional secure_execution block containing the exact intent and execute payload. Executor URLs are configured server-side and cannot be supplied by the caller.

{
  "packet_id": "refund-001",
  "requested_action": { "type": "payments:refund" },
  "secure_execution": {
    "requested": true,
    "service": "payments",
    "idempotency_key": "refund-001",
    "intent": {
      "actor": { "id": "agent-17" },
      "intent": "issue_refund"
    },
    "execute": {
      "action": "payments:refund",
      "transaction_id": "tx-123",
      "payment_id": "refund-001",
      "amount": 250,
      "currency": "USD"
    },
    "policy_state": { "policy_version": "refunds-7" },
    "authority_state": { "source_record_id": "authority-record-123", "version": "7" },
    "authority_schema_hash": "<SAC schema hash>"
  }
}

After a permitting determination has been persisted, Harmonic signs a short-lived receipt binding the intent, exact execute payload, policy state, authority state/schema, constitutional determination, project/tenant context, service, and idempotency key. Harmonic then forwards to the server-configured executor. The receiver must verify the receipt, establish current standing at commitment, and prevent duplicate effects at the consequence boundary. Signature verification alone does not supply the latter two controls.

Receipt header: x-harmonic-execution-receipt. A legacy-compatible x-solace-receipt header is also sent so existing Solace Adapter executor patterns can migrate without a second control-plane hop.

SAC binding: when authority_schema is supplied, Harmonic uses SAC-compatible deterministic normalization and hashing. If an expected authority_schema_hash is also supplied and does not match, execution fails closed.

The existing response_binding remains scoped to the governed-response contract. Secure Execution is exposed separately as secure_execution; the two are not conflated.

Receiver enforcement at commitment

A signed receipt establishes authenticity and binds the proposed operation. It does not, by itself, establish that authority still stands when the receiver commits the effect, or that the payment has not already settled.

Durable reference receiver

The repository includes sdk/harmonic-sqlite-receiver.js, a reference implementation for a local synthetic settlement ledger. It uses a SQLite write transaction to serialize standing updates, revocation, duplicate suppression, settlement, and evidence recording. It requires a Node runtime exposing node:sqlite and durable local storage; it is not automatically activated by calling /api/evaluate.

Read the receiver integration guide · Download the reference receiver and guide

const { HarmonicSqliteReceiver } = require('./sdk/harmonic-sqlite-receiver');
const receiver = new HarmonicSqliteReceiver({
  filename: '/durable-volume/receiver.sqlite',
  publicKeyPem: trustedHarmonicPublicKey,
  service: 'payments',
});

// Submit only after trusted administration establishes current standing.
const result = receiver.commit({ receiptHeader, execute });
// COMMITTED: a new synthetic ledger entry.
// ALREADY_COMMITTED: the original effect; no new settlement.
// REJECTED: no new settlement.

Required bindings and trusted administration

For this receiver, supply a stable execute.payment_id, an explicit idempotency key, actor and intent, and authority and policy state. The signed receipt must contain the client and application identifiers. Payment identity is scoped by client, application, tenant, and service; the payload, actor, intent, authority state, and policy state must match the standing record.

Use a separate, authenticated authority-administration path to establish standing from current source evidence, with an evidence reference, expiry, and expected receiver revision. Never establish standing automatically from an incoming payment receipt. Preserve upstream event ordering and deliver withdrawals promptly. A source withdrawal that has not reached the receiver is not detected by its local ledger; source availability and freshness requirements remain part of the integration.

Interruption → Continuity → Resumption

At commit, the receiver may permit the exact action only when standing is Preserved and the determination accounts for every effective material challenge to that action. Defeated standing requires denial. Unresolved standing requires a hold. Every retry evaluates standing against the authoritative state then in effect.

The examination traces one action through an effective challenge that causes an abort before commitment, a fresh retry held while standing is Unresolved, and exactly one committed write after Preserved standing is established at commit. The alternate run verifies denial under a superseded approval and commitment under newly established authority.

Both branches passed against the updated SQLite reference receiver and a local synthetic ledger. Hosted receiver verification is pending. See the examination and evidence requirements.

Real payment integrations

The reference receiver commits only its local synthetic ledger. For a real provider, enforce controls at the actual settlement boundary or design around the provider's durable idempotency and reconciliation guarantees with an explicit dispatch and revocation boundary. A database check followed by an external payment call is not an atomic settlement transaction. Ephemeral serverless disk is not durable receiver storage.

Specialty packs can describe domain authority requirements. They do not replace receiver enforcement. Pack activation remains subject to the separate runtime activation requirements; the reference receiver does not activate a specialty pack.

Integration Contract: Representation, Standing & Evidence

Core rule: adapters may translate representation. They may not manufacture standing.

External systems may express the same supplied fact in different schemas, field names, or transport envelopes. An integration layer may normalize those supplied facts into Harmonic's canonical request contract. It must not invent missing domain state, infer a positive predicate from ambiguous prose, create provenance that was not supplied, or treat the absence of contrary evidence as affirmative present standing.

External representation → adapter / normalizer → canonical Harmonic packet → Harmonic evaluation

Allowed:    translate an explicitly supplied revocation into revocation_state
Allowed:    preserve supplied timestamps, source IDs, scope, and evidence references
Not allowed: infer that authority is current because no revocation was supplied
Not allowed: invent provenance, evidence, attribution, or a positive predicate

UNKNOWN and fail-closed semantics

Historical validity does not automatically confer present execution authority. Where a consequence requires a positive predicate, missing, ambiguous, stale, unsupported, or otherwise insufficient input must not silently inherit a prior YES. Harmonic preserves unknown or not-established state as distinct from an adverse finding; downstream execution must not convert that uncertainty into authority.

Runtime state is not evidentiary provenance

Harmonic evaluates the constitutional facts supplied to it. A runtime packet can therefore support a determination about the supplied state without independently proving that the supplied state is an externally attributable fact. If an integration requires audit, qualification, regulatory, or independent-assessment evidence, provide the relevant attributable source, establishment time, evidence references, and authority provenance at the boundary.

Synthetic fixtures and external evidence

A synthetic test fixture may deliberately supply T₀, ΔN, authority, revocation, or present-state facts to test runtime behavior. That can establish how Harmonic behaves for the supplied fixture. It does not, by itself, establish those fixture facts as externally proven events. Do not relabel a synthetic assertion as independent provenance.

Builder requirement: define the positive predicates required for each consequential execution surface, map supplied domain facts into the canonical contract without semantic invention, preserve provenance when externally defensible standing is required, and bind execution so that a non-permitting directive cannot be bypassed.

cURL

curl -X POST "https://www.solace-harmonic.com/api/evaluate" \
  -H "Authorization: Bearer hs_live_..." \
  -H "Content-Type: application/json" \
  -d '{"response":"The assistant recommends stopping medication immediately.","consequence_level":"high"}'

Node

async function evaluateWithHarmonic(response) {
  const result = await fetch("https://www.solace-harmonic.com/api/evaluate", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.HARMONIC_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      response,
      consequence_level: "medium",
    }),
  });

  if (!result.ok) throw new Error(await result.text());
  return result.json();
}

Python

import os
import requests

def evaluate_with_harmonic(response):
    r = requests.post(
        "https://www.solace-harmonic.com/api/evaluate",
        headers={
            "Authorization": f"Bearer {os.environ['HARMONIC_API_KEY']}",
            "Content-Type": "application/json",
        },
        json={
            "response": response,
            "consequence_level": "medium",
        },
        timeout=20,
    )
    r.raise_for_status()
    return r.json()

Decision Handling

if (decision.recommended_action === "deny") halt();
if (decision.recommended_action === "escalate") requestHumanReview();
if (decision.recommended_action === "constrain") applySafeCompletion();
if (decision.recommended_action === "allow") continueNormally();

Governance Pack Upgrade API

Strict contract: supply a structured obligation witness as well as understanding. See the Elias integration handoff for accepted fields, synthetic paired examples, response handling, and execution-binding limits.

The Governance Pack bundles constitutional primitives behind one upgrade endpoint: Understanding Continuity, Reality Contact, Authority Continuity, Obligation Continuity, Consequence Boundary, and Runtime Admissibility.

POST /api/governance-pack
Authorization: Bearer hs_live_...
Content-Type: application/json
{
  "packet_id": "case-001",
  "obligation_witness": {
    "canonical_text": "Applicable clinical prerequisites must be established before the order.",
    "status": "unresolved",
    "source": "caller-assessment-required",
    "independently_verified": false,
    "evidence_refs": []
  },
  "requested_action": { "type": "clinical_order", "scope": ["care_plan"] },
  "understanding_state": {
    "current": true,
    "complete": true,
    "provenance_preserved": true,
    "applicable": true,
    "source_ids": ["obs-001"]
  },
  "declared_reality": {
    "current_state_claims": ["Patient status is stable"],
    "last_verified_at": "2026-05-26T18:00:00.000Z"
  },
  "observed_reality": { "signals": [{ "statement": "Recent signals remain stable" }] },
  "authority_chain": {
    "subject": "clinical-agent-1",
    "issuer": "hospital-ops",
    "scope": ["care_plan"],
    "last_verified_at": "2026-05-26T18:00:00.000Z",
    "chain": [
      { "actor": "clinical-agent-1", "status": "active" },
      { "actor": "hospital-ops", "status": "active" }
    ]
  },
  "revocation_state": {
    "last_revocation_check_at": "2026-05-26T18:00:00.000Z",
    "known_revocations": []
  },
  "consequence_profile": {
    "level": "high",
    "reversibility": "reversible",
    "execution_surface": "clinical_order"
  },
  "safeguards": { "operator_review_confirmed": true }
}

Response includes a single package outcome plus primitive-level results and artifact hashes for audit/replay.