index.md

HTML wrapper for HTML-only fetchers; content is shown verbatim.

Raw file

Links (extracted)

Clickable list for reviewers; avoids copy/paste line-wrap issues.
# if.swarm demo — S2 simulation (Redis-style bus envelopes; receipt-backed)

**Audience:** external reviewers + operators  
**Reality gate:** deterministic simulation only; no live Redis; no internal access required to review.

---

## Links (HTML-first)

Hosted review page (HTML):
https://infrafabric.io/static/hosted/review/if-swarm-demo/2026-01-10/index.html

if.trace receipt:
https://infrafabric.io/static/trace/BaWuPeiT0t6hCOLL9XjOgg

Pack (HTML view):
https://infrafabric.io/static/pack/BaWuPeiT0t6hCOLL9XjOgg

Pack (raw Markdown):
https://infrafabric.io/static/pack/BaWuPeiT0t6hCOLL9XjOgg.md

Source bundle (tgz):
https://infrafabric.io/static/source/3a8b98af6f485ea5322383bf3346404a38fd2bcf9f813f3467a14659a91824fe.tgz

Offline verifier (browser SHA-256; no uploads):
https://infrafabric.io/static/hosted/iftrace-offline.html

---

## What this proves (black/white)

This demo proves:
- a small swarm can exchange bus envelopes over Redis-style topic channels (simulated pub/sub)
- deterministic transcript generation (same inputs → same output bytes)
- output bytes can be bound to an `if.trace` receipt (hash checks; signatures only where present and verifiable)

This demo does not prove:
- a deployed `if.swarm` runtime on this host
- live Redis, live networking, or any real-world device control

---

## Demo artifacts

Source bundle sha256 (tgz):

    3a8b98af6f485ea5322383bf3346404a38fd2bcf9f813f3467a14659a91824fe

Output transcript sha256:

    8c0ae2d1450f2f58b57ec205e3464d010ace724b31e97d9e1b331b9e407fcf19

---

## How to reproduce (no internal access)

```bash
curl -fsSL -o if-swarm-demo-source.tgz "https://infrafabric.io/static/source/3a8b98af6f485ea5322383bf3346404a38fd2bcf9f813f3467a14659a91824fe.tgz"
sha256sum if-swarm-demo-source.tgz

tar -xzf if-swarm-demo-source.tgz
cd if-swarm-demo
python3 build_swarm_demo.py . > transcript.json
sha256sum transcript.json
```

Expected `sha256sum` (source bundle):

    3a8b98af6f485ea5322383bf3346404a38fd2bcf9f813f3467a14659a91824fe  if-swarm-demo-source.tgz

Expected `sha256sum` (output JSON):

    8c0ae2d1450f2f58b57ec205e3464d010ace724b31e97d9e1b331b9e407fcf19  transcript.json

---

## Output (machine-readable transcript JSON)

```json
{
  "agents": [
    {
      "agent_id": "planner",
      "inbox_topic": "if.bus.demo.dev.swarm.agent.planner",
      "role": "plan"
    },
    {
      "agent_id": "executor",
      "inbox_topic": "if.bus.demo.dev.swarm.agent.executor",
      "role": "execute"
    },
    {
      "agent_id": "critic",
      "inbox_topic": "if.bus.demo.dev.swarm.agent.critic",
      "role": "review"
    }
  ],
  "black_white": {
    "not_verified": [
      "Truth/correctness, safety, compliance, or intent.",
      "Any claim of a deployed if.swarm runtime on this host."
    ],
    "verified": [
      "The output bytes match the receipt hash (when a receipt is published).",
      "The evidence sha256 values correspond to the bytes in the source bundle."
    ]
  },
  "counters": {
    "acked": 5,
    "consumed": 5,
    "dlq": 1,
    "nacked": 1,
    "published": 5
  },
  "created_at": "2026-01-10T00:00:00Z",
  "evidence": [
    {
      "bytes": 9885,
      "evidence_id": "S1",
      "path": "evidence/if.bus.envelope.schema.json",
      "sha256": "79f29e4bcf1c6f0c4c7fbb9d33c38ec4491405a0eb974de11399a18adda98820",
      "title": "IF.BUS envelope schema (reference)"
    },
    {
      "bytes": 241,
      "evidence_id": "S2",
      "path": "evidence/receipt_boundary.md",
      "sha256": "8191686eed3ab898dcc0eb8397964e97bf53c254a56c49b5d1ee376508a2e8c5",
      "title": "Receipt boundary statements (demo corpus)"
    }
  ],
  "notes": {
    "integrity": "see if.trace receipt for output bytes",
    "redis": "simulated pub/sub topics; no Redis server required"
  },
  "scenario_id": "if.swarm.demo.s2.redis_envelopes.v1",
  "schema_id": "if.swarm.demo.transcript",
  "schema_version": "demo.v1",
  "topics": {
    "agent_topics": [
      "if.bus.demo.dev.swarm.agent.planner",
      "if.bus.demo.dev.swarm.agent.executor",
      "if.bus.demo.dev.swarm.agent.critic"
    ],
    "dlq_topic": "if.bus.demo.dev.swarm.dlq",
    "job_topic": "if.bus.demo.dev.swarm.jobs"
  },
  "transcript": [
    {
      "action": "publish",
      "agent": "coordinator",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.job_created"
        },
        "event_id": "0364acea-9d2f-532b-ae1a-1318cd49639a",
        "payload": {
          "goal": "demo swarm envelope exchange",
          "job_id": "job-demo-001"
        },
        "payload_sha256": "3cff82ff2a0b0946f41f7df99d1cfb66bebe3528ae011193bb1b58d7031306b8",
        "producer": {
          "id": "coordinator",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "coordinator",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.jobs",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 1,
      "topic": "if.bus.demo.dev.swarm.jobs"
    },
    {
      "action": "consume",
      "agent": "planner",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.job_created"
        },
        "event_id": "0364acea-9d2f-532b-ae1a-1318cd49639a",
        "payload": {
          "goal": "demo swarm envelope exchange",
          "job_id": "job-demo-001"
        },
        "payload_sha256": "3cff82ff2a0b0946f41f7df99d1cfb66bebe3528ae011193bb1b58d7031306b8",
        "producer": {
          "id": "coordinator",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "coordinator",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.jobs",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 2,
      "topic": "if.bus.demo.dev.swarm.jobs"
    },
    {
      "action": "ack",
      "agent": "planner",
      "event_id": "0364acea-9d2f-532b-ae1a-1318cd49639a",
      "step": 3,
      "topic": "if.bus.demo.dev.swarm.jobs"
    },
    {
      "action": "publish",
      "agent": "planner",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.plan_ready"
        },
        "event_id": "e8d73025-c085-56b3-8113-41b821460314",
        "payload": {
          "job_id": "job-demo-001",
          "plan": [
            "step_a",
            "step_b",
            "step_c"
          ]
        },
        "payload_sha256": "8cac63d463389e55a90c49bdd1f218feb8a10676c79fe9c8d43c78d2050df615",
        "producer": {
          "id": "planner",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "planner",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.agent.planner",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 4,
      "topic": "if.bus.demo.dev.swarm.agent.planner"
    },
    {
      "action": "consume",
      "agent": "executor",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.plan_ready"
        },
        "event_id": "e8d73025-c085-56b3-8113-41b821460314",
        "payload": {
          "job_id": "job-demo-001",
          "plan": [
            "step_a",
            "step_b",
            "step_c"
          ]
        },
        "payload_sha256": "8cac63d463389e55a90c49bdd1f218feb8a10676c79fe9c8d43c78d2050df615",
        "producer": {
          "id": "planner",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "planner",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.agent.planner",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 5,
      "topic": "if.bus.demo.dev.swarm.agent.planner"
    },
    {
      "action": "nack",
      "agent": "executor",
      "event_id": "e8d73025-c085-56b3-8113-41b821460314",
      "reason": "transient_error",
      "step": 6,
      "topic": "if.bus.demo.dev.swarm.agent.planner"
    },
    {
      "action": "consume",
      "agent": "executor",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.plan_ready"
        },
        "event_id": "e8d73025-c085-56b3-8113-41b821460314",
        "payload": {
          "job_id": "job-demo-001",
          "plan": [
            "step_a",
            "step_b",
            "step_c"
          ]
        },
        "payload_sha256": "8cac63d463389e55a90c49bdd1f218feb8a10676c79fe9c8d43c78d2050df615",
        "producer": {
          "id": "planner",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "planner",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.agent.planner",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 7,
      "topic": "if.bus.demo.dev.swarm.agent.planner"
    },
    {
      "action": "ack",
      "agent": "executor",
      "event_id": "e8d73025-c085-56b3-8113-41b821460314",
      "step": 8,
      "topic": "if.bus.demo.dev.swarm.agent.planner"
    },
    {
      "action": "publish",
      "agent": "executor",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.exec_completed"
        },
        "event_id": "d03d34be-b783-5c2a-968c-58b5ee097919",
        "payload": {
          "artifacts": [
            "result.json"
          ],
          "job_id": "job-demo-001",
          "status": "ok"
        },
        "payload_sha256": "d6f9d62930b50b366fa02604e5a92cef505e6b4a2735a4131d2cd669df696ffd",
        "producer": {
          "id": "executor",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "executor",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.agent.executor",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 9,
      "topic": "if.bus.demo.dev.swarm.agent.executor"
    },
    {
      "action": "consume",
      "agent": "critic",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.exec_completed"
        },
        "event_id": "d03d34be-b783-5c2a-968c-58b5ee097919",
        "payload": {
          "artifacts": [
            "result.json"
          ],
          "job_id": "job-demo-001",
          "status": "ok"
        },
        "payload_sha256": "d6f9d62930b50b366fa02604e5a92cef505e6b4a2735a4131d2cd669df696ffd",
        "producer": {
          "id": "executor",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "executor",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.agent.executor",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 10,
      "topic": "if.bus.demo.dev.swarm.agent.executor"
    },
    {
      "action": "ack",
      "agent": "critic",
      "event_id": "d03d34be-b783-5c2a-968c-58b5ee097919",
      "step": 11,
      "topic": "if.bus.demo.dev.swarm.agent.executor"
    },
    {
      "action": "publish",
      "agent": "critic",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.review"
        },
        "event_id": "e21d38f7-5545-55b7-9683-19ebe4be1ee2",
        "payload": {
          "job_id": "job-demo-001",
          "notes": [
            "demo only"
          ],
          "verdict": "ship"
        },
        "payload_sha256": "b70f31227616f655d6c5c7a74f29aad041572e43a3f8305adfd17bd926f5aa1c",
        "producer": {
          "id": "critic",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "critic",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.agent.critic",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 12,
      "topic": "if.bus.demo.dev.swarm.agent.critic"
    },
    {
      "action": "ack",
      "agent": "critic",
      "event_id": "e21d38f7-5545-55b7-9683-19ebe4be1ee2",
      "step": 13,
      "topic": "if.bus.demo.dev.swarm.agent.critic"
    },
    {
      "action": "publish",
      "agent": "coordinator",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.poison"
        },
        "event_id": "cd45d94c-e59c-5ea3-8202-df09496d3aeb",
        "payload": {
          "job_id": "job-demo-002",
          "note": "poison message demo"
        },
        "payload_sha256": "cd29d54f91d601a7c7bbfa6e06cd6b90363346dd7581b1f79657e4c2eb6b0a66",
        "producer": {
          "id": "coordinator",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "coordinator",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.jobs",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 14,
      "topic": "if.bus.demo.dev.swarm.jobs"
    },
    {
      "action": "consume",
      "agent": "planner",
      "envelope": {
        "emitted_utc": "2026-01-10T00:00:00Z",
        "event": {
          "name": "if.swarm.demo.poison"
        },
        "event_id": "cd45d94c-e59c-5ea3-8202-df09496d3aeb",
        "payload": {
          "job_id": "job-demo-002",
          "note": "poison message demo"
        },
        "payload_sha256": "cd29d54f91d601a7c7bbfa6e06cd6b90363346dd7581b1f79657e4c2eb6b0a66",
        "producer": {
          "id": "coordinator",
          "kind": "if.swarm.demo",
          "version": "demo.v1"
        },
        "routing": {
          "partition_key": "coordinator",
          "priority": 5,
          "topic": "if.bus.demo.dev.swarm.jobs",
          "ttl_seconds": 60
        },
        "schema_id": "if.bus.envelope",
        "schema_version": "1.0.0"
      },
      "step": 15,
      "topic": "if.bus.demo.dev.swarm.jobs"
    },
    {
      "action": "dlq",
      "agent": "planner",
      "error_kind": "poison_message",
      "original_event_id": "cd45d94c-e59c-5ea3-8202-df09496d3aeb",
      "step": 16,
      "topic": "if.bus.demo.dev.swarm.dlq"
    },
    {
      "action": "ack",
      "agent": "planner",
      "event_id": "cd45d94c-e59c-5ea3-8202-df09496d3aeb",
      "step": 17,
      "topic": "if.bus.demo.dev.swarm.jobs"
    }
  ]
}
```