ZapStream — Continuous Kapnet Education Production Loop

ZapStream is an autonomous education factory. It ingests ALL Kapnet data feeds and continuously produces structured learning content. Not a wiki. Not a blog. A living curriculum that grows itself. ```

ZapStream — Continuous Kapnet Education Production Loop

Concept

ZapStream is an autonomous education factory. It ingests ALL Kapnet data feeds and continuously produces structured learning content. Not a wiki. Not a blog. A living curriculum that grows itself.

Data Feeds (Inputs)

FEED 1: Activity Braid (kapnetd IPC)
  -> TXXM submissions, reviews, governance proposals
  -> New concepts appearing in real-time
  
FEED 2: Theory Docs (wiki-on-Nostr, kind-30023)
  -> 58 wiki pages, updated continuously
  -> Concepts, protocols, architecture

FEED 3: Codebase (shared-ro/kapnet-source/)
  -> 100+ Rust crates, 1000+ source files
  -> Implementation patterns, API surfaces

FEED 4: Nostr Public Surface
  -> Our 73+ events on relay
  -> Replies, engagement, questions from community
  
FEED 5: Repo Deep Dives (n0-space, nvk, marmot)
  -> 12 cloned repos, licenses, architectures
  -> External knowledge feeding Kapnet theory
  
FEED 6: Churn KOR (txxm-churn.kor)
  -> Slot lottery bids, weakwork templates
  -> Live coordination data

FEED 7: Operator Sessions (this conversation)
  -> Questions asked, decisions made, designs explored
  -> The elder context in action

Output Streams

Stream A: Daily Explainer (kind-1, #kapnet-explainers)

One 200-word note explaining a concept drawn from the feeds. Triggered by: new TXXM in braid, new wiki page, new question in replies.

Stream B: Weekly Deep Dive (kind-30023, #kapnet-study)

One 2000-word article connecting multiple concepts. Triggered by: 5+ related explainers published, or major braid event.

Stream C: Code Walkthrough (kind-1 thread, #kapnet-builds)

One thread explaining a specific code pattern from the codebase. Triggered by: new commit, new crate, significant refactor.

Stream D: Curriculum Module (kind-30023 series, #kapnet-curriculum)

A structured learning path — 10-15 articles that build on each other. Each module = one “course” with prerequisites, lessons, exercises. Triggered by: accumulated explainers forming a coherent topic cluster.

Stream E: Live Q&A (kind-1, #kapnet-qa)

Direct answer to a question from the community. Triggered by: reply to our events, mention with question mark, search for “how do I” questions.

Production Loop Architecture

┌─────────────────────────────────────────────────────────────┐
│                    ZAPSTREAM ENGINE                          │
│                                                              │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │ INGESTER │  │ CURATOR  │  │ COMPOSER │  │ PUBLISHER│   │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘  └────┬─────┘   │
│       │             │             │             │           │
│       ▼             ▼             ▼             ▼           │
│  Feeds ──→ Queue ──→ Draft ──→ Review ──→ Relay            │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐   │
│  │                 STATE STORE (SSD)                     │   │
│  │  shared-rw/zapstream/                                 │   │
│  │  ├── queue.json        (pending items)                 │   │
│  │  ├── curriculum.json   (learning paths)               │   │
│  │  ├── published.json    (event IDs, metrics)           │   │
│  │  ├── engagement.json   (reply counts, scores)         │   │
│  │  └── topics.json       (topic graph, clusters)        │   │
│  └──────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

Loop Types

Loop 1: Reactive (event-driven)

Event arrives (new TXXM, reply, commit)
  -> Classify event type
  -> Extract key concepts
  -> Check if concepts are known (topic graph)
  -> If new: create explainer draft
  -> If known: update related content
  -> Queue for review/publish

Loop 2: Scheduled (time-driven)

Every hour: check queue, publish highest-priority item
Every day: generate daily explainer from accumulated feeds
Every week: generate deep dive from daily explainers
Every month: generate curriculum module from explainers

Loop 3: Engagement-driven (feedback-driven)

Track engagement on each published item
  -> High engagement -> produce follow-up / deeper dive
  -> Questions in replies -> produce Q&A item
  -> Cross-reference -> connect to other topics
  -> Update topic graph with new relationships

Loop 4: Curriculum-driven (structure-driven)

Maintain topic graph
  -> Identify topic clusters ready for curriculum
  -> Order articles by dependency
  -> Publish as kind-30023 series with naddr links
  -> Each article references previous via NIP-21 links

ZapStream State Store

shared-rw/zapstream/
├── config.json           # Loop configuration
├── queue.json            # Draft items waiting for review
├── published.json        # Published item metrics
├── curriculum.json       # Active learning paths
├── topics.json           # Topic knowledge graph
├── engagement.json       # Per-item engagement scores
├── feeds/
│   ├── braid.jsonl       # Ingested TXXM events
│   ├── wiki.jsonl        # Wiki page updates
│   ├── codebase.jsonl    # Code changes
│   └── nostr.jsonl       # Incoming replies/mentions
├── drafts/
│   ├── draft-001.json
│   ├── draft-002.json
│   └── ...
└── archive/
    └── ...               # Old drafts, superseded content

Topic Graph

The topic graph tracks what we’ve taught and how concepts connect:

{
  "topics": {
    "txxm-envelope": {
      "title": "TXXM Envelope",
      "known": true,
      "depth": "explained",
      "published": ["event-id-001", "event-id-005"],
      "prerequisites": [],
      "related": ["weakwork", "braid", "knot", "kor-namespace"],
      "engagement_score": 0.8,
      "questions_asked": 3,
      "clarity_score": 0.9
    },
    "weakwork": {
      "title": "Weakwork",
      "known": true,
      "depth": "explained",
      "published": ["event-id-002"],
      "prerequisites": [],
      "related": ["txxm-envelope", "slot-lottery", "braid"],
      "engagement_score": 0.6,
      "questions_asked": 5,
      "clarity_score": 0.5
    }
  },
  "clusters": {
    "coordination-layer": ["txxm-envelope", "weakwork", "braid", "knot", "kor-namespace"],
    "settlement-layer": ["bitcoin-settlement", "merge-mining", "lightning", "coinjoin"],
    "identity-layer": ["npub-auth", "session-management", "kor-scope"]
  }
}

Composer Logic

Input: Feed Event → Output: Draft

1. EXTRACT: What is this about?
   - Parse TXXM type, tags, content
   - Identify key terms and concepts
   
2. CLASSIFY: Which stream does this feed?
   - New concept? → Explainer
   - Code change? → Code Walkthrough
   - Question? → Q&A
   
3. CONNECT: What does this relate to?
   - Check topic graph for related topics
   - Find prerequisite topics
   
4. COMPOSE: Generate the draft
   - Use template appropriate for stream
   - Fill in from knowledge base (wiki, code, feeds)
   - Add links to related content
   
5. SCORE: Priority and quality
   - Novelty: is this new? (higher = better)
   - Demand: are people asking? (engagement data)
   - Dependency: does this unblock other content?
   - Timeliness: tied to recent event?

6. QUEUE: Add to output queue

Quality Gates

Before publishing, each draft passes:

  1. Novelty Check: Has this exact content been published? (dedup against topic graph)
  2. Prerequisites Check: Are prerequisite topics already explained?
  3. Link Check: Do all internal links resolve to published content?
  4. Accuracy Check: Does code match codebase? (grep verification)
  5. Tone Check: No hype, no price mentions, technical precision

Automation Modes

Mode 1: Assisted (Current)

  • ZapStream produces drafts
  • Queue is populated automatically
  • Human reviews and approves before publishing
  • Best for: initial launch, quality control

Mode 2: Semi-Auto (After 2 weeks)

  • High-confidence drafts auto-publish (novelty + accuracy pass)
  • Low-confidence drafts go to queue for review
  • Human handles Q&A and curriculum structure

Mode 3: Full Auto (After quality proven)

  • All drafts auto-pass quality gates
  • Human only handles exceptional cases
  • Curriculum structure is maintained by topic graph analysis

Key Implementation: zapstream-engine.mjs

The core engine:

  1. Polls feeds (braid, wiki, codebase, nostr) every N minutes
  2. Extracts and classifies new information
  3. Checks topic graph for novelty/completeness
  4. Composes drafts using templates + knowledge base
  5. Scores and queues drafts
  6. Publishes approved items via nostr-tools

This runs as a background process alongside:

  • kapnet-listener.cjs (relay subscriber)
  • publicity-loop.cjs (content publisher)
  • courier-bridge.mjs (TXXM bimap)

Success Metrics (30-day)

Metric Target
Daily explainers 7/week
Weekly deep dives 4/month
Curriculum modules 1/month
Q&A responses 100% of questions answered within 48h
Topic coverage 80% of core concepts explained
Engagement rate >25% reply rate on explainers
Follower growth >100 new followers

Write a comment
No comments yet.