Logo: Ring:Instrumenting Streaming Events

Ring:Instrumenting Streaming Events

Organisatioun
LerianStudio
ring:instrumenting-streaming-events

Instrumenting streaming events: wires lib-streaming event emission end-to-end into a Lerian Go service via a 13-gate cycle (catalog, Builder bootstrap, Emit sites, outbox, HTTP manifest, NoopEmitter fallback, integration and chaos tests), dispatching ring:backend-go under TDD. Consumes the validated instrumentation-map.json from ring:mapping-streaming-events. Use after that map exists. Skip for non-Go or when no map is present.

Iwwersiicht

EditeurLerianStudio
Repositoryring
Skill-Nummring:instrumenting-streaming-events
Stären
215
Forks
28
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    LerianStudio huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Ring:Instrumenting Streaming Events an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/LerianStudio/ring/tree/main/dev-team/skills/instrumenting-streaming-events
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/LerianStudio/ring.git /tmp/ring
mkdir -p .claude/skills
cp -r /tmp/ring/dev-team/skills/instrumenting-streaming-events .claude/skills/lerianstudio-ring-instrumenting-streaming-events
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Ring:Instrumenting Streaming Events an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Ring:Instrumenting Streaming Events automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Ring:Instrumenting Streaming Events net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Streaming Instrumentation (lib-streaming)

When to use

  • User requests streaming instrumentation for a Go service with a validated docs/streaming/instrumentation-map.json from ring:mapping-streaming-events
  • Task mentions "wire lib-streaming", "instrument streaming events", "implement event emission", "add streaming.NewBuilder", "Emit business events", "lib-streaming bootstrap"

Skip when

  • Service is not a Go project
  • No instrumentation-map.json present (run ring:mapping-streaming-events first)

You orchestrate. Agents implement. NEVER use Edit/Write/Bash on Go source files. All code changes go through Task(subagent_type="ring:backend-go"). TDD mandatory for all implementation gates (RED → GREEN → REFACTOR).

Streaming Architecture

lib-streaming: producer-only event-emission library. Three-step lifecycle:

  1. streaming.NewCatalog(definitions ...EventDefinition) (Catalog, error) — declare every event up-front (immutable)
  2. streaming.NewBuilder().Source(...).Catalog(catalog).Routes(...).Target(...).Logger(...).MetricsFactory(...).Tracer(...).CircuitBreakerManager(...).OutboxRepository(...).Build(ctx) — Builder pattern returns (Emitter, error). There is NO NewProducer constructor; *streaming.Producer is reachable only by type-asserting the Emitter returned from Build(ctx), and only when lifecycle methods (Run, RunContext, RegisterOutboxRelay) are needed.
  3. emitter.Emit(ctx, EmitRequest{DefinitionKey, TenantID, Subject, Payload}) from handlers/workers

The Emitter interface has THREE methods — Emit(ctx, EmitRequest) error, Close() error, Healthy(ctx) error. Mocks and adapters MUST implement all three.

Wire format: CloudEvents 1.0 binary mode. Each RouteDefinition picks a transport: Kafka (topic lerian.streaming.<resource>.<event>[.vN]), SQS (queue URL), RabbitMQ (exchange + routing key), EventBridge (bus name), or Custom. Tenant carried on ce-tenantid header for CloudEvents-binary transports.

WebFetch URLs (include in every gate dispatch):

  • https://raw.githubusercontent.com/LerianStudio/lib-streaming/main/doc.go
  • https://raw.githubusercontent.com/LerianStudio/lib-streaming/main/AGENTS.md
  • https://raw.githubusercontent.com/LerianStudio/lib-streaming/main/CHANGELOG.md

Three delivery postures:

PostureDirectOutboxDLQUse when
CRITICALskipalwayson_routable_failureLoss is correctness/compliance breach
IMPORTANTdirectfallback_on_circuit_openon_routable_failureDirect normally; survives broker outage
OBSERVATIONALdirectneverneverAnalytics-grade; loss acceptable
CUSTOMper-eventper-eventper-eventNone of the above fits

Canonical import paths:

AliasImport PathPurpose
streaminggithub.com/LerianStudio/lib-streamingProducer, Emitter, NewCatalog, EventDefinition
streamingtestgithub.com/LerianStudio/lib-streaming/streamingtestMockEmitter (test-only)
outboxgithub.com/LerianStudio/lib-commons/v5/commons/outboxOnly when Gate 5 active

Emitter implementations:

ImplementationWhenConstruction
*streaming.Producer (returned as Emitter)STREAMING_ENABLED=truestreaming.NewBuilder().Catalog(catalog).Source(src).Routes(routes...).Target(target).Logger(log).MetricsFactory(mf).Tracer(tr).Build(ctx)
NoopEmitterSTREAMING_ENABLED=falsestreaming.NewNoopEmitter()
*streamingtest.MockEmitterTestsstreamingtest.NewMockEmitter()

Service code depends on streaming.Emitter INTERFACE. MUST NOT type-assert to *Producer except in bootstrap to wire Run(launcher) / RunContext(ctx, launcher) / RegisterOutboxRelay(registry). All three implementations satisfy the full three-method interface (Emit, Close, Healthy).

Mandatory agent instruction (include in EVERY dispatch):

WebFetch https://raw.githubusercontent.com/LerianStudio/lib-streaming/main/doc.go and AGENTS.md. docs/streaming/instrumentation-map.json is the canonical contract — every EventDefinition, Emit site, DeliveryPolicy MUST match exactly. Tenant from tmcore.GetTenantIDContext(ctx) — NEVER hardcode. TDD: RED → GREEN → REFACTOR for every gate.

Gate Overview

GateNameConditionAgent
0Stack Detection + JSON Validation + Compliance AuditAlwaysOrchestrator
1Codebase AnalysisAlwaysring:codebase-explorer
1.5Visual Implementation PreviewAlways; user must approvering:visualizing
2lib-streaming Dependency + Non-Canonical RemovalSkip only if lib-streaming pinned AND zero non-canonical detectedring:backend-go
3Catalog Construction + Builder BootstrapAlwaysring:backend-go
4Emit Instrumentation per Eventable PointAlwaysring:backend-go
5Outbox WiringRequired if any event has outbox != "never"ring:backend-go
6Manifest HTTP MountRequired unless service has zero HTTP surfacering:backend-go
7Wiring + Lifecycle + Backward CompatAlways — NEVER skippablering:backend-go
8TestsAlwaysring:backend-go
9Code ReviewAlways9 defaults + triggered specialists in parallel
10User ValidationAlwaysUser
11Activation GuideAlwaysOrchestrator

Gates execute sequentially. Gate 5 skip: only if zero events have outbox != "never". Gate 6 skip: only if service has zero HTTP surface (justify in report).

Gate 0: Stack Detection

Orchestrator executes directly. Runs 3 phases:

Phase 1: Stack Detection

bash
grep "lib-streaming" go.mod
grep "lib-commons" go.mod
grep -rn "postgresql\|pgx" internal/ go.mod
grep -rn "outbox" go.mod
grep -rn "fiber\|gin\|echo\|net/http" internal/
# Existing lib-streaming code:
grep -rn "streaming.NewBuilder\|streaming.NewCatalog\|streaming.NewNoopEmitter\|streaming.Emitter\|streaming.Producer" internal/
# Non-canonical (must remove):
grep -rn "sarama\|watermill\|segmentio/kafka-go\|amqp091.Publish\|franz-go" internal/

Phase 2: instrumentation-map.json Validation

Read docs/streaming/instrumentation-map.json
Validate: JSON well-formed, required fields present (service_name, events[])
Each event must have: definition_key, resource, event_type, delivery_policy
delivery_policy must have: direct (bool), outbox (enum), dlq (string)
CRITICAL events must have outbox = "always"

Phase 3: Existing Compliance Audit (if lib-streaming code detected)

  • Construction uses streaming.NewBuilder()...Build(ctx) — NOT a hand-rolled NewProducer shim
  • .Catalog(catalog) builder method invoked before .Build(ctx)
  • .Source(...), .Routes(...), .Target(...) configured (Builder fails fast on missing required wiring)
  • Target names contain no control characters and are ≤256 bytes (Builder validates; service must construct safe names)
  • STREAMING_ENABLED feature flag present
  • commons.Launcher.Add (or Run/RunContext) lifecycle wiring; Close() on shutdown
  • Healthy(ctx) wired into readiness probe
  • No non-canonical alternatives

State Management

State: docs/ring:instrumenting-streaming-events/current-cycle.json

Write state after EVERY gate. If write fails → STOP.

json
{
  "service_name": "",
  "started_at": "",
  "gates_completed": [],
  "detected": { "lib_streaming_pinned": false, "has_http": false, "outbox_required": false },
  "instrumentation_map_path": "docs/streaming/instrumentation-map.json",
  "tasks": []
}

Severity Reference

SeverityCriteria
CRITICALBuilder without .Catalog(); CRITICAL event with outbox=never; manifest unauthenticated; pre-commit emission; service code type-asserting *Producer outside bootstrap
HIGHNo Launcher.Add / Run / RunContext; no Close(); Healthy() not wired to readiness; non-canonical code present; STREAMING_ENABLED missing; target name with control chars or >256 bytes
MEDIUMMissing .Logger() / .Tracer() / .MetricsFactory() on Builder; no MockEmitter unit tests; no chaos coverage when outbox required
LOWDocumentation gaps, missing comments

Heefeg gestallte Froen

Wat mécht de KI-Skill Ring:Instrumenting Streaming Events?

Instrumenting streaming events: wires lib-streaming event emission end-to-end into a Lerian Go service via a 13-gate cycle (catalog, Builder bootstrap, Emit sites, outbox, HTTP manifest, NoopEmitter fallback, integration and chaos tests), dispatching ring:backend-go under TDD. Consumes the validated instrumentation-map.json from ring:mapping-streaming-events. Use after that map exists. Skip for non-Go or when no map is present.

Firwat Ring:Instrumenting Streaming Events op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Ring:Instrumenting Streaming Events besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Ring:Instrumenting Streaming Events an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/LerianStudio/ring/tree/main/dev-team/skills/instrumenting-streaming-events an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Ring:Instrumenting Streaming Events benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Ring:Instrumenting Streaming Events benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Ring:Instrumenting Streaming Events domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Ring:Instrumenting Streaming Events gratis?

Jo. LerianStudio huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇