Protocol
HAPPI/1.5
Status
Possibilities Paper
Method
Multi-Agent Deliberation Synthesis
Est
April 2026 · Working Paper

HAPPI/1.5 — Possibilities

Protocol, possibilities, and the path to AI as infrastructure.

Download PDF

What HAPPI Actually Is

HAPPI is a request/response protocol operating at the wire level. Every call is one JSON envelope; every response is a stream of NDJSON events.

Core Design

Input — the envelope:

{
  "v": "happi/1.0",
  "id": "req-001",
  "cmd": "anthropic.messages.create",
  "args": [{ "model": "claude-opus-4-7",
             "messages": [{ "role": "user", "content": "Your question" }] }],
  "flags": { "provider": "anthropic/claude-opus-4-7", "max_tokens": 4096 },
  "auth":  { "scheme": "apikey", "token": "env:ANTHROPIC_API_KEY" }
}

Output — the event stream:

{"type":"started",   "request_id":"req-001"}
{"type":"delta",     "request_id":"req-001", "text":"The answer "}
{"type":"delta",     "request_id":"req-001", "text":"continues here..."}
{"type":"completed", "request_id":"req-001"}

Seven Streaming Events

Seven event types carry a dispatch from start to finish, and no eighth has been needed for that job since v1.0. Everything a caller must know while a response is in flight is one of these.

EventMeaning
startedInference began
deltaToken(s) streamed
tool_callModel requested a tool invocation
tool_resultTool execution result returned
sub_requestModel dispatching a child HAPPI envelope
completedResponse finished
errorFailure with classified cause

Three Signed Records — Decided, Believed, Assumed

Three further event types arrived after v1.0 — ten in total, though the extra three never appear mid-stream. They do a different job, and they are best read together rather than one at a time. idr (v1.1) records what was decided; context (v1.1, ratified as the stable memory-chain surface in v1.2) records what was believed. HAPPI/1.5 completes the family with continuity, which records what was assumed — the load-bearing premise an agent is about to act on, named together with the observation that would refute it.

EventPayloadWhat it recordsTerminator
idr (v1.1)idr_refWhat was decided — content hash of the envelope plus its event streamYes
context (v1.1)context_refWhat was believed — content address of the decision body, threading predecessor_contextYes
continuity (v1.4)continuity_refWhat was assumed — a pre-registered falsifiable commitment, or the verdict that settles oneNo
The ordering is the guarantee. A continuity-commit is emitted before the dispatch whose reasoning depends on it, so a reader working from the stream alone can see that the premise and its falsifier predate the outcome. Reasoning recorded after the result can always be fitted to it; reasoning recorded before it cannot. That is why the event is deliberately not a terminator, unlike idr and context, which are. It is not the end of a dispatch — it is the commitment the dispatch is about to be judged against.

Wire shape. This is not a sketch — it is what the reference runtime in happi.md actually printed for the commitment shown further down, hash included. You can check that without taking anyone's word for it: pipe that commitment into the runtime yourself and the ts will differ from this one while the sha256 will not, because the address is taken over the body with the volatile fields removed. The same address appears again in the verdict below, which is what joins the pair. Note that settles and predecessor_continuity are always written, carrying null when they do not apply, so a consumer can read every field positionally without testing for its presence.

{"v":"happi/1.5","id":"commit-1","type":"continuity","ts":0,
 "continuity_ref":{
   "sha256":"sha256:af02d5794d39d3ee89f8da4df8ad666cd0e91d1e4c9831b314ff08dbd0d079d1",
   "kind":"continuity-commit",
   "predecessor_continuity":null,
   "settles":null,
   "model_versions":[]}}
continuity_ref fieldRequiredMeaning
sha256yesContent address of the commitment body — canonical JSON with sorted keys, excluding the volatile id, ts and audit fields. Byte-identical to the context address algorithm, so one implementation serves both.
kindyescontinuity-commit or continuity-verdict — there are only these two
predecessor_continuitynoThe id of the prior continuity node: the backward chain link, null at genesis
settlesverdictsThe sha256 of the commitment this verdict answers. Required on a verdict — a settlement that names no commitment cannot be joined back to a premise, so it proves nothing.
model_versionsyesModel identifiers that produced the record, for the audit chain. Pass it as an array: the reference runtime writes an empty array when the flag is absent, and reduces an object to its keys, so {"anthropic": "claude-opus-4-7"} is recorded as ["anthropic"] and the version is lost.

A commit body carries the premise: claim, falsifier, deps and severity. A verdict body carries the settlement: verdict — exactly one of CONGRUENT, INCONGRUENT or UNVERIFIABLE — plus axis, evidence and verifier. The runtime rejects an unrecognised kind, and rejects a verdict carrying no settles, rather than writing a record that cannot be checked.

The premise is pre-registered first, as its own dispatch, before any of the work whose reasoning depends on it:

{
  "v": "happi/1.5",
  "id": "commit-1",
  "cmd": "continuity.append",
  "args": ["{\"claim\":\"the staging schema matches production\",\"falsifier\":\"a column present in one and absent in the other\",\"deps\":[\"migration-2026-08-14\"],\"severity\":\"high\"}"],
  "flags": {"kind": "continuity-commit"}
}

The work then runs. Afterwards a verdict settles the commitment, naming by content address the exact premise it answers:

{
  "v": "happi/1.5",
  "id": "verdict-1",
  "cmd": "continuity.append",
  "args": ["{\"verdict\":\"INCONGRUENT\",\"axis\":\"schema\",\"evidence\":\"orders.currency absent in staging\",\"verifier\":\"schema-diff\"}"],
  "flags": {"kind": "continuity-verdict",
            "settles": "sha256:af02d5794d39d3ee89f8da4df8ad666cd0e91d1e4c9831b314ff08dbd0d079d1"}
}

Two Checks That Fail Closed

A record nobody can check is worse than no record, because it still looks like evidence. So the runtime refuses to write one. Both refusals below are real output: the envelope was piped into the reference runtime in happi.md and its stdout and exit code copied here unedited.

A verdict that names no commitment cannot be joined back to a premise, so it settles nothing:

$ echo '{"v":"happi/1.5","id":"verdict-2","cmd":"continuity.append",
   "args":["{\"verdict\":\"CONGRUENT\"}"],
   "flags":{"kind":"continuity-verdict"}}' | bash happi.md run

{"v":"happi/1.5","id":"verdict-2","type":"started","ts":0}
{"v":"happi/1.5","id":"verdict-2","type":"error","ts":0,"code":"parse_error",
 "message":"continuity.append: a continuity-verdict must set flags.settles to the
            content address of the commitment it settles"}
$ echo $?
1

And a third kind of continuity record does not exist, so it cannot be invented at the call site:

$ echo '{"v":"happi/1.5","id":"x","cmd":"continuity.append",
   "args":["{\"claim\":\"a\"}"],
   "flags":{"kind":"continuity-guess"}}' | bash happi.md run

{"v":"happi/1.5","id":"x","type":"started","ts":0}
{"v":"happi/1.5","id":"x","type":"error","ts":0,"code":"parse_error",
 "message":"continuity.append: kind must be one of continuity-commit,
            continuity-verdict, got 'continuity-guess'"}
$ echo $?
1

Both emit started before the error, so a consumer reading the stream sees a well-formed dispatch that produced no continuity event — the failure is legible rather than silent, which is the same property the commitment record itself is for.

The protocol carries the record, never the policy. Dependency-contamination closure, settlement worklists, predictor stacks and any braking or halting behaviour built on top of these records live in the harness — exactly the division idr and context already keep. v1.4 is fully backward-compatible: the runtime accepts happi/1.0 through happi/1.5 and emits happi/1.5. Its command roster is now version, cite.verify, compose, echo, spec.describe, envelope.validate, idr.emit, context.append, continuity.append, pr.reference, hypothesis.register and quine.spawn.

Auth Portability

The auth.token field accepts three forms. The auth field is automatically scrubbed from all event stream logs — the same envelope file runs identically on a developer's MacBook and in a GitHub Actions runner.

FormSourceWhen Used
env:VAR_NAMEShell environment variableCI/CD, GitHub Actions
keychain:SERVICE_NAMEmacOS KeychainDeveloper workstation
Literal stringInline valueScripted, short-lived

Transport Layer

HAPPI is transport-agnostic. The reference transport is stdio. No transport adds semantics — a client written for stdio works against HTTP/SSE without modification.

TransportStatusNotes
stdioCanonical (v1.0)Reference implementation
HTTP/SSESupported (v1.0)Server-sent events
Unix socketSupported (v1.0)Low-latency local IPC
WebSocketPlanned (v1.1)Bidirectional streaming
MCPPlanned (v1.1)Claude tool integration

The Meta-Move

A single .happi.md file is simultaneously valid Markdown, executable bash, a HAPPI/1.0 envelope, and an OpenAPI 3.1 schema. This is the design property that changes everything. Achieved via bash heredoc no-op trick:

#!/usr/bin/env bash
# Everything above the heredoc is bash. Everything inside is JSON.
cat <<'HAPPI'
{
  "v": "happi/1.0",
  "id": "summarise-1",
  "cmd": "anthropic.messages.create",
  "args": [{ "model": "claude-opus-4-7",
             "messages": [{ "role": "user", "content": "$1" }] }],
  "auth": { "scheme": "subscription" }
}
HAPPI
# Run: bash summarise.happi.md "Summarise this contract clause: ..."
#       | hal --happi-api
Documentation drift is structurally impossible. In every other protocol — HTTP, SMTP, gRPC — the specification document and the running system are disjoint. HAPPI inverts this. If the spec diverges from the runtime, the boot cycle fails. The morning report tells you.
flowchart TD F["summarise.happi.md\n(one source file)"] F --> MD["Markdown\nHuman-readable documentation"] F --> BASH["Executable Bash\nbash summarise.happi.md <arg>"] F --> ENV["HAPPI/1.0 Envelope\nJSON wire payload"] F --> OA["OpenAPI 3.1 Schema\nMachine-readable contract"] style F fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0 style MD fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style BASH fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style ENV fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style OA fill:#0a0a0a,stroke:#333333,color:#e0e0e0

Version-Controlled AI Behaviour

git log prompts/summarise.happi.md
# commit abc123: switch to gemini-flash for latency
# commit def456: add brand-voice system prompt
# commit 789abc: cap max_tokens 2048 -> 4096 for long clauses

AI behaviour changes are reviewed, diffed, reverted, blamed, and bisected using the same tools as code. Prompt engineering becomes software engineering.

Documentation That Cannot Go Stale

A README can lie. An OpenAPI spec can drift from the code. A HAPPI .md file cannot — it IS the running artifact. The Markdown is not a description of the system; it is the system reading itself aloud.


Orchestration at the Wire Level

HAPPI's sub_request event type makes multi-model orchestration a wire-level property, not an application-level concern.

Sequential Chains

Research, summarise, and critique across different providers:

bash research.happi.md   | hal --happi-api \
  | bash summarise.happi.md | hal --happi-api \
  | bash critique.happi.md  | hal --happi-api \
  > verdict.ndjson
StageRecommended ProviderReason
Researchclaude-opus-4-7High context, deep reasoning
Summarisegroq/llama-3.3-70bFast, cheap, sufficient
Critiquegoogle/gemini-2.5-proDifferent vendor — anti-homogeneity
VerdictCouncil deliberation (§3.3)Stakes justify the cost
flowchart LR IN["Input"] --> R["research.happi.md\nclaude-opus-4-7\n(deep reasoning)"] R --> S["summarise.happi.md\ngroq / llama-3.3-70b\n(fast, cheap)"] S --> C["critique.happi.md\ngemini-2.5-pro\n(cross-vendor)"] C --> V["verdict.ndjson"] style IN fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0 style R fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style S fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style C fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style V fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0

Parallel Fan-Out

Same query dispatched to N providers simultaneously; responses merged:

parallel -j4 "hal --happi-api < {}" \
  ::: claude.json gemini.json llama.json grok.json \
  | jq -s 'group_by(.request_id)'
Pattern A

Quorum voting

Majority verdict before acting on any output.

Pattern B

Diversity sampling

One output per provider; human picks the best.

Pattern C

Latency tournament

First to complete wins; others cancelled.

Pattern D

Benchmarking

Cost-per-token, quality, latency compared in one run.

flowchart TD Q["Query"] --> C["claude.json\nclaude-opus-4-7"] Q --> G["gemini.json\ngemini-2.5-pro"] Q --> L["llama.json\nllama-3.3-70b"] Q --> X["grok.json\ngrok-3"] C --> M["Merge & Group\njq -s 'group_by(.request_id)'"] G --> M L --> M X --> M M --> OUT["Quorum / Tournament / Benchmark"] style Q fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0 style M fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0 style OUT fill:#0a0a0a,stroke:#ea580c,color:#e0e0e0 style C fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style G fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style L fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style X fill:#0a0a0a,stroke:#333333,color:#e0e0e0

Deliberation Councils (Quorum)

{
  "v": "happi/1.0",
  "id": "council-1",
  "cmd": "happi.council",
  "flags": {
    "providers": ["claude-opus-4-7","gemini-2.5-pro","llama-3.3-70b","grok-3","deepseek"],
    "quorum": 3,
    "rule": "majority",
    "security_override": true
  },
  "args": ["Review this PR for security vulnerabilities."]
}

Security issues block on any single provider's report. Other issues require quorum. This is a production deliberation pattern currently in use in the authors' internal review pipelines on every pull request.

Red-Team / Devil's Advocate

# Stage 1: proposal
echo "Design a token refresh strategy for the auth module." \
  | bash propose.happi.md | hal --happi-api > proposal.ndjson

# Stage 2: adversarial review (DIFFERENT vendor mandatory)
cat proposal.ndjson \
  | bash falsify.happi.md | hal --happi-api > critique.ndjson
Why cross-vendor? Same-model-family self-critique suffers from confirmation bias. The falsifier must be a different provider to produce independent signal. This is not a soft recommendation — it is the protocol-enforced invariant in the multi-agent deliberation pattern described above.

Cost-Quality Routing (Triage)

Complexity ClassProviderApprox. Cost
trivialgroq/llama-3.1-8b~$0.00005/query
moderategemini-2.5-flash~$0.001/query
complexclaude-opus-4-7~$0.015/query
criticalCouncil (5 providers)~$0.05/query

Provider Fallback (Sentinel)

{
  "flags": {
    "provider": "anthropic/claude-opus-4-7",
    "fallback": ["google/gemini-2.5-pro", "groq/llama-3.3-70b"],
    "fallback_triggers": ["rate_limit", "timeout", "5xx"]
  }
}

The client sees a continuous stream with a single completed. The provider swap is invisible unless the client reads the provider field on each event. ENTER Konsult's internal runtime (in development and evaluation) implements Sentinel in ~200 LOC. Every application using HAPPI inherits this for free.


A Primitive Library

Small, single-purpose .happi.md files compose into complex pipelines. Each primitive is under 50 lines. Composition is bash. The "agent framework" is /bin/sh.

primitives/
  research.happi.md       # deep investigation, high-context provider
  summarise.happi.md      # compress to N bullets
  critique.happi.md       # adversarial review
  extract.happi.md        # structured data extraction
  classify.happi.md       # route by category
  score.happi.md          # numerical evaluation
  translate.en-za.happi.md # SA English localisation
  compose.happi.md        # creative synthesis

Domain-Specific Overlays

base/
  research.happi.md            # generic template
domains/
  legal/research.happi.md      # + SA POPI/common law compliance prompt
  medical/research.happi.md    # + HIPAA routing policy, local provider only
  financial/research.happi.md  # + audit trail flags, SOX-compatible output

Full Multi-Turn Agent Workflow

#!/usr/bin/env bash
# Due-diligence pipeline: 5-stage cross-provider workflow
TARGET="$1"

# W1: Research (deep, expensive)
echo "Research $TARGET -- financials, litigation, leadership." \
  | bash primitives/research.happi.md \
  | hal --happi-api \
  | tee /tmp/research.ndjson \
  | bash primitives/extract.happi.md \
  | hal --happi-api > /tmp/facts.ndjson

# W2: Red-team the research (different vendor)
cat /tmp/research.ndjson \
  | bash primitives/critique.happi.md \
  | hal --happi-api > /tmp/critique.ndjson

# W3: Legal clause scan
cat /tmp/facts.ndjson \
  | bash domains/legal/clause-check.happi.md \
  | hal --happi-api > /tmp/legal.ndjson

# W4: Council deliberation
cat /tmp/research.ndjson /tmp/critique.ndjson /tmp/legal.ndjson \
  | bash council/deliberate.happi.md \
  | hal --happi-api > /tmp/verdict.ndjson

# W5: Human-readable summary
cat /tmp/verdict.ndjson \
  | bash primitives/summarise.happi.md \
  | hal --happi-api
A five-stage cross-provider multi-model pipeline. No LangChain. No CrewAI. No AutoGen. Bash + HAPPI + a HAPPI-compliant runtime.

Capability Registry (The Marketplace Seed)

happi install @codetonight/legal-review-za     # SA jurisdiction
happi install @openai-community/code-critique  # any vendor's community
happi install @internal/brand-voice            # your org's private primitives
happi run legal-review-za --args "contract.pdf"

Files are shared across organisations without SDK lock-in. An adopting organisation runs any published .happi.md capability — for example, a shared morning-brief.happi.md — via its own runtime against its own provider keys. Zero publisher SDK dependency.


Native Agentic Recursion

sub_request is an event type in the response stream. The model — not the application, not the framework — emits a child HAPPI envelope as part of its response. The runtime dispatches it; child events inline into the parent stream.

{"type":"delta",       "request_id":"main", "text":"I need to verify this claim..."}
{"type":"sub_request", "request_id":"main",
  "envelope": {"v":"happi/1.0","cmd":"gemini.generate",
               "args":["Cross-check: is it true that..."]}}
{"type":"started",     "request_id":"sub-1"}
{"type":"delta",       "request_id":"sub-1", "text":"Cross-model result:"}
{"type":"completed",   "request_id":"sub-1"}
{"type":"delta",       "request_id":"main",  "text":"Confirmed. Therefore..."}
{"type":"completed",   "request_id":"main"}

Why This Dissolves Orchestration Frameworks

Every "agent framework" that exists today (LangGraph, AutoGen, CrewAI, Agno, PydanticAI) exists to answer one question: how does one LLM call trigger another LLM call with shared state? sub_request answers that at the wire level.

FrameworkRecursionCross-languageCross-provider
LangGraphPython-onlyNoVia adapters
AutoGenPython-onlyNoVia adapters
CrewAIPython-onlyNoVia adapters
HAPPI sub_requestProtocol-levelYesNative

Recursive Agent Hierarchies

main-request
  └── sub_request: research (claude-opus-4-7)
        └── sub_request: fact-check (gemini-2.5-pro)
              └── sub_request: citation-verify (llama-3.3-70b)

Depth cap prevents infinite recursion. The runtime enforces at the envelope parser. Tree-of-Thought is native: N parallel sub_requests at each branch; parent aggregates verdicts. No library needed. The protocol carries it.

flowchart TD M["main-request\nany provider"] M --> R["sub_request: research\nclaude-opus-4-7"] R --> FC["sub_request: fact-check\ngemini-2.5-pro"] FC --> CV["sub_request: citation-verify\nllama-3.3-70b"] CV --> CV2["completed (sub-3)"] FC --> FC2["completed (sub-2)"] R --> R2["completed (sub-1)"] M --> M2["completed (main)"] style M fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0 style R fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style FC fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style CV fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style CV2 fill:#0a0a0a,stroke:#333333,color:#ea580c style FC2 fill:#0a0a0a,stroke:#333333,color:#ea580c style R2 fill:#0a0a0a,stroke:#333333,color:#ea580c style M2 fill:#1e1e1e,stroke:#ea580c,color:#ea580c

Cross-Language Agent Communication

python3 research_agent.py     # Python agent builds research envelope
  | hal --happi-api           # runtime dispatches
  | go run summarise_agent.go # Go agent parses NDJSON
  | hal --happi-api           # runtime again
  | node critique_agent.js    # Node.js agent
  > verdict.ndjson

Each agent is in a different language. Each speaks HAPPI. No cross-language RPC. The wire format is the interface.


Legal, Medical, and Financial AI

Legal AI

legal-review/
  base.happi.md
  jurisdictions/
    za/clause-check.happi.md          # SA POPI + common law
    eu/gdpr-check.happi.md            # GDPR Article 44 residency
    us/ccpa-check.happi.md            # California privacy law
  handlers/
    conflict-of-laws.happi.md
    citation-verify.happi.md
    council-review.happi.md           # quorum deliberation for high-stakes

Audit trail by design. Envelope flag audit: true captures the full event stream to the compliance store. Every tool_call is logged. Every provider response is retained. Subpoena-ready without additional instrumentation.

for CLAUSE in $(pdfextract contract.pdf --clauses); do
  echo "$CLAUSE" \
    | bash legal-review/jurisdictions/za/clause-check.happi.md \
    | hal --happi-api \
    >> clause-review.ndjson
done

Medical AI (HIPAA-Safe Routing)

{
  "flags": {
    "provider": "$ROUTE",
    "data_class": "phi",
    "routing_policy": "$HIPAA_POLICY"
  },
  "args": ["Analyse patient chart..."]
}

The routing policy maps data_class: phi to approved on-premises providers only. Cloud providers are rejected at the envelope layer — no application bug can leak PHI. The guardrail is in the protocol, not in application code that can be bypassed.

Financial AI (SOX-Compatible Audit)

The NDJSON event stream IS the audit log:

EventSOX-Relevant Field
startedWho queried, when, which provider
deltaFull token-level model output
tool_callEvery external call (price feed, order entry, risk API)
tool_resultFull payload of each call
completedFinal verdict, total cost, latency

Protocol-Level Governance

Provider Failover Without Code Changes

{
  "flags": {
    "provider": "anthropic/claude-opus-4-7",
    "fallback": ["google/gemini-2.5-pro", "groq/llama-3.3-70b"],
    "fallback_triggers": ["rate_limit", "timeout", "5xx"]
  }
}

Incident response: edit the config file, SIGHUP the runtime. Deployment is unnecessary. Application is untouched.

Data Residency

{ "flags": { "data_residency": "eu-west" } }

Runtime routes to providers with EU-only inference. Every inference logs provider region in the event stream. GDPR Article 44 compliance becomes a config rule, not an application audit.

Multi-Tenancy and Cost Governance

{
  "auth": { "scheme": "keychain", "token": "keychain:tenant-acme-claude-key" },
  "flags": {
    "max_tokens": 2048,
    "max_cost_usd": 0.05,
    "budget_id": "team-legal-2026-q2"
  }
}

Per-request credential routing at protocol level — Tenant A's keys never touch Tenant B's requests. Runtime rejects if budget exceeded. Monthly reports aggregate completed events across one policy file, all providers.

Pre-registered Reasoning as an Audit Artefact

The continuity event (v1.4) gives compliance a property the event stream could not previously offer: evidence that a stated premise predates the outcome it is used to justify. A reviewer reading the stream finds the continuity-commit — the claim, the falsifier, the dependencies, the severity — sitting before the dispatch, and the later continuity-verdict that settles it as CONGRUENT, INCONGRUENT or UNVERIFIABLE. Post-hoc justification becomes visible as post-hoc, because the ordering is part of the record rather than part of the narration.

Minimum Viable Observability Stack

HAPPI event stream -> Kafka -> ClickHouse -> Grafana

Every runtime produces this for free. Zero instrumentation overhead. The structured event stream IS the telemetry.


Any Language Is an AI Application

If you can write and read JSON, you can speak HAPPI. A 1977 awk script is an AI client:

BEGIN {
  print "{\"v\":\"happi/1.0\",\"cmd\":\"anthropic.messages.create\",\
\"args\":[{\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}]}" \
    | "hal --happi-api"
  while (("hal --happi-api" | getline line) > 0) print line
}

COBOL, Fortran, Lua, Tcl, Pascal — all become AI-capable without vendor involvement. This is the syscall property: you do not need a provider to support your language; you need read().

Testability — Mock the Wire, Not the SDK

def test_clause_review():
    with mock_happi_stream([
        {"type": "started",   "request_id": "r1"},
        {"type": "delta",     "request_id": "r1", "text": "Ambiguous liability in §4.2."},
        {"type": "completed", "request_id": "r1"}
    ]):
        result = run_clause_review(test_clause)
    assert "§4.2" in result.findings

No provider involved. No rate limits. No network. One mock format works for all providers.

Onboarding — One Command

cat spec.happi.md | hal --happi-api

The spec demonstrates itself. New engineer. Day one. Full system behaviour, live, in thirty seconds.


The Long Arc

Unix read(fd, buf, len) does not know whether it reads from SSD, NVMe, RAM, network socket, or /dev/null. The application calls one primitive; the kernel dispatches. HAPPI proposes AI inference as this primitive.

Unix syscallHAPPI equivalent
read(fd, buf, len)hal --happi-api < envelope.json
File descriptorProvider identifier in envelope
BufferNDJSON event stream
Kernel VFS layerHAPPI runtime
Block device driverProvider adapter
Physical diskThe actual model (Claude, Gemini, Llama)

/dev/ai — The Concrete Proof-of-Concept

echo '{"v":"happi/1.0","cmd":"anthropic.messages.create","args":["Hello"]}' \
  > /dev/ai
cat /dev/ai     # NDJSON events stream out

Implementation: ~500-line FUSE module. Not a 10-year arc — this is a weekend project once HAPPI v1.0 runtime adoption reaches critical mass.

AI as a Unix Pipe Stage

git log --oneline -20 \
  | hal chat --provider groq/llama-3.3-70b "Summarise these commits:" \
  | tee weekly-update.md

AI reasoning takes its place alongside grep, awk, sed, jq as a standard Unix primitive. Falsified if cost remains above $0.001/query or latency above 500ms for small queries in 2030.

IoT and Embedded Systems

An ESP32 microcontroller (32 KB RAM, no Python runtime) emits HAPPI envelopes over MQTT to a local HAPPI gateway. The ESP32 code is ~200 lines of C. It has no provider SDK. It speaks HAPPI. AI is now accessible from hardware that cannot run any existing AI SDK.


Protocol-Led Ecosystem

Runtime Proliferation

ENTER Konsult's internal runtime (in development and evaluation) is the reference. Community runtimes emerge the way HTTP clients emerged after RFC 2616:

LanguagePackageEstimated Availability
Pythonhal-py3–6 months
Node.js / Deno / Bunhal-js3–6 months
Gohal-go6–12 months
Rubyhal-rb6–12 months
Java / Kotlinhal-jvm12–18 months
Swifthal-swift12–18 months

HAPPI Routers — The DNS Analogy

happi-resolve "legal-review-za"
# -> @codetonight/legal-review-za@1.2.3
# -> preferred-provider: ollama/gemma4:26b (on-premises, data residency)
# -> fallback: anthropic/claude-opus-4-7 (if local unavailable)

HAPPI routers are to AI capabilities what DNS is to IP addresses: capability-resolution infrastructure that the application never sees.


Precision Matters

CategoryExamplesDistinction from HAPPI
Application frameworkLangChain, LlamaIndex, AutoGenLive inside your application; language-specific
Provider SDKOpenAI SDK, Anthropic SDK, LiteLLMLanguage-specific library; normalise to one format
Proxy serverLiteLLM proxy, OpenRouter, PortkeyTranslation layer in network path; not a protocol
ModelClaude, GPT-4, Gemini, LlamaThe inference artifact; HAPPI is what speaks to it
RuntimeHAL (ENTER Konsult internal, in evaluation)Reference implementation; not the protocol itself
The precise LiteLLM comparison. LiteLLM is requests (the Python HTTP library). HAPPI is HTTP. requests is excellent software — it did not make HTTP redundant. They operate at different levels of the stack. LiteLLM could implement HAPPI as its wire format. A HAPPI gateway could accept LiteLLM-proxy traffic via adapter. They are not competitors — they occupy adjacent layers.

Where the Protocol Breaks Down

Limitation 1

Long-running stateful sessions

HAPPI is request/response-oriented. Applications needing persistent multi-turn conversation must encode state in envelopes — which works but adds verbosity. Mitigation: session_id flag + runtime-level session store.

Limitation 2

Bidirectional real-time streaming

Low-latency voice agents require WebSocket bidirectional streams. HAPPI v1.0 handles unidirectional well. Addressed in planned v1.1 WebSocket transport.

Limitation 3

High-throughput batch

Processing millions of rows via envelope-per-query has overhead. Batch APIs process at 50% cost discount. v1.1 may introduce a batch envelope type.

Limitation 4

Provider-specific capabilities

Anthropic prompt caching, OpenAI structured outputs, Gemini context caching — HAPPI's common abstraction can hide these. Mitigation: flags.provider_specific passed opaquely to adapter.

Falsification of the TCP/IP Analogy

The central claim — that HAPPI will do for AI what TCP/IP did for networking — is falsified if:

  1. Provider-specific SDK market share is growing, not shrinking, by 2030
  2. Major cloud providers block protocol-level interop and succeed
  3. HAPPI adoption stalls at fewer than 5 production runtimes outside CodeTonight within 18 months
  4. Semantic incompatibility between providers proves irreducible
  5. Regulatory action mandates provider-specific attestation incompatible with protocol-level neutrality
Current probability assessment: 30–40% the TCP/IP analogy fully holds; 30–40% partial hold; 20–30% it fails (SDK lock-in persists). HAPPI is under 6 months old. All falsifiability is prospective.

Open Protocol Questions for v1.1

QuestionCouncil VoteNotes
state as first-class event type?5 yes / 5 no / 2 neutralEnables cross-runtime state; risks scope creep
ensemble_synthesis at protocol level?3 protocol / 7 applicationKeep application-level until canonical algorithm exists
Dedicated batch envelope type?8 yes / 3 noStrong signal
WebSocket elevated to normative?9 yes / 2 noVoice agents demand it
provider.<id>.<key> convention?10 yes / 1 noNear-consensus
Signing/provenance in envelope?4 yes / 7 ecosystemSecurity-conscious ecosystem over baked-in complexity

Five Phases to Primitive

PhaseTimelineMilestones
SeedNow – 6 monthsReference runtime; happi.md domain live; 3 community runtime seeds (Python, Go, Node)
Ecosystem6–18 months20+ provider adapters; capability marketplace seed (100+ .happi.md files); first non-CodeTonight production adoption
Enterprise18–36 monthsCommercial runtime with SLAs; HAPPI certification programme; HIPAA/GDPR/SOX compliance profiles
Standard3–5 yearsProtocol-level new-project market share exceeds SDK market share; HAPPI-native IDEs, linters, CI integrations
Primitive5–10 years/dev/ai proof-of-concept; AI reasoning as a Unix toolkit member
flowchart LR P0["Seed\nNow – 6 months\nReference runtime\nhappi.md live\n3 community seeds"] P1["Ecosystem\n6–18 months\n20+ adapters\nCapability marketplace\nFirst production adoption"] P2["Enterprise\n18–36 months\nCommercial runtime + SLAs\nCompliance profiles\nCertification"] P3["Standard\n3–5 years\nProtocol > SDK market share\nNative IDEs & linters"] P4["Primitive\n5–10 years\n/dev/ai proof-of-concept\nAI as Unix utility"] P0 --> P1 --> P2 --> P3 --> P4 style P0 fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0 style P1 fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style P2 fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style P3 fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style P4 fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0

MESH Council Synthesis

This paper documents the full possibility space of HAPPI/1.0 as established by a twelve-agent MESH deliberation council. A MESH deliberation council is a multi-agent review pattern in which each agent analyses the problem from a distinct specialist perspective, and the outputs are synthesised into a consolidated finding. The use of multiple agents reduces single-model blind spots and surfaces a broader range of considerations than any individual analysis would produce. All prospective claims carry explicit falsification conditions. Vote records are preserved in §12.

Council
12 specialist agents
Deliberation level
MESH
Dimensions
10 covered
Canonical reference
flowchart TD H["Hypothesis / Question"] H --> A1["Agent 1\nProtocol Design"] H --> A2["Agent 2\nSecurity"] H --> A3["Agent 3\nCompliance"] H --> A4["Agent 4\nDeveloper Experience"] H --> A5["Agent 5\nEcosystem Dynamics"] H --> A6["... 7 more specialists"] A1 --> S["Synthesis\n(outputs consolidated)"] A2 --> S A3 --> S A4 --> S A5 --> S A6 --> S S --> V["Consolidated Verdict\n(blind spots minimised)"] style H fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0 style S fill:#1e1e1e,stroke:#ea580c,color:#e0e0e0 style V fill:#0a0a0a,stroke:#ea580c,color:#ea580c style A1 fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style A2 fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style A3 fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style A4 fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style A5 fill:#0a0a0a,stroke:#333333,color:#e0e0e0 style A6 fill:#0a0a0a,stroke:#333333,color:#e0e0e0

Download PDF

This paper is a living document. The protocol is stable; the possibilities are not.
Canonical reference: happi.md