Kobolds

Kobolds v0.1.1#

First public release of Kobolds, a high-performance messaging broker written in Zig 0.16.0, along with its client ecosystem (Zig client, libkobolds C ABI, and Node.js/TypeScript client). It has been a long journey to get here and the future looks bright for Kobolds. This is a large release and these notes will in no way provide the full detail of all of the changes, features or bugs since the beginning of this iteration of Kobolds in 2026 but I'm gonna try!

Because this is the first release, these notes cover everything since the repository was created. That includes the history imported from GitHub/Codeberg (first commit 11/08/2025) and all GitLab merge requests from !1 (01/04/2026) through !58 (10/04/2026).

Status: Early preview for friendly developers and community members. Expect breaking changes to the protocol, APIs, and config before 1.0.

Release stats#

Since this is such a massive release, I thought it might be fun to include this little table. This doesn't include the dependencies I've also written to support Kobolds but includes the broker, cli, zig client and nodejs/typescript client.

Area Added Deleted Changed
Zig 41,488 8,602 6,618
TypeScript/JavaScript 9,387 661 197

Contributors#

  • https://gitlab.com/@bengarishodge (everything else)
  • https://github.com/JW-Ellis (pre-GitLab https://github.com/kobolds-io/kobolds/pull/28)
  • https://github.com/ignorant05 (pre-GitLab PR https://github.com/kobolds-io/kobolds/pull/26)

Highlights#

  • Pub/sub messaging with topics, publishers, subscribers, subscribe/unsubscribe, and retained messages.
  • Request/reply messaging through advertised services (requestors and repliers).
  • Entity lifecycle operations (create, read, destroy) for topics, services, publishers, subscribers, requestors, and repliers.
  • Session-based authentication (pre-shared keys with hmac256 or none) and policy-based authorization.
  • Multi-threaded broker. Messages move between the router and worker threads through lock-free SPSC queues and ref-counted routing/reclaim envelopes.
  • libkobolds C ABI plus a Node.js/TypeScript client, both published to the GitLab package registry.
  • Built-in message tracing and a span-based tracer for finding bottlenecks.
  • Message v3 format with optional, chunk-backed or dynamic backing memory.
  • MkDocs documentation site covering the protocol, CLI, broker, and clients.

Breaking Changes#

  • kb encoding removed: The broker, clients, and CLI no longer support the custom kb payload encoding or its config options. Use json, cbor, or raw bytes. (#80, !58)
  • Message v3: The wire and in-memory message format changed. Message bodies are now optional and can be backed by chunk or dynamic memory. (#73, !52)
  • trace_id: Trace IDs are now random 64-bit integers instead of time-based IDs. (#55, !27)
  • Auth config: The user authentication strategy was renamed to username_password, and user.secret was renamed to user.password. (#13, !1)
  • Zig 0.16.0: You need Zig 0.16.0 to build. (#52, !23)

Features#

Core Broker and Protocol#

  • Initial project structure, CLI and entrypoints, frame and frame parser, message framing, broker configuration, async I/O, TCP transport, message routing, authentication/authorization, and broker implementation (imported pre-GitLab history) (!3, !4)
  • Broker session handling: session_init, auth_success/auth_failure, broker identity, and broker connection groups (#5, !1)
  • Topics: create and delete topics; request/reply plumbing via correlation_id (renamed from transaction_id) (#18, !5)
  • Publish: create publisher and publish messages to topics (#17, !6)
  • Delivery context: optional DeliveryContext on frames, serde support, and new envelope kinds for broker/worker/connection (#28, !7)
  • Subscribe: broker handling for subscribers and published messages (#19, !8)
  • Message tracing: opt-in --trace with a u64 trace ID (#14, !14)
  • Broker native format: encode known payloads as json, cbor, or bytes (#36, !15)
  • Services and request/reply: advertised services, request/reply routing, std.Io.Reader/std.Io.Writer-compatible chunk reader/writer, message body payloads, payload encoding for control messages (#21, #22, #23, #38, !18)
  • Retained messages (#37, !21)
  • Read entity: topics and services (#60, !22)
  • Read entity: subscribers, publishers, requestors, and services (#60, !28)
  • Destroy entity: topics, services, subscribers, publishers, requestors, and repliers (#61, #17, #18, #21, #22, #23, !29)
  • Unsubscribe: subscribers can pause delivery without being destroyed (#71, !43)
  • Configurable magic numbers: broker pool capacities and SPSC queue slots, with documented constants (#68 – partial, !47, !57)

CLI and Clients#

  • cli: initial CLI with broker listen and client commands (imported pre-GitLab history) (!3, !4)
  • cli: argument parsing reworked for the new client config, connection strings, and auth credentials (#3, !1)
  • cli: create-topic, delete-topic, publish, and subscribe commands (#18, #17, #19, !5, !6, !8)
  • cli: --trace flag for message tracing (#14, !14)
  • cli: publish --rate and --count flags (!24)
  • cli: config file path option on commands (#64, !55)
  • zig client: client implementation with connect and timeout, session_init, auth_success/auth_failure, client connection groups, hmac256 pre-shared keys, and connection_string parsing (transport/host/port) (#3, #5, !1)
  • zig client: request/reply (request, requestSync) with correlation_id (#18, !5)
  • zig client: Client.subscribe and handlers for published messages (#19, !8)
  • zig client: services, requestors, and repliers (#21, #22, #23, !18)
  • zig client: read and destroy entities (#60, #61, !22, !28, !29)
  • zig client: unsubscribe (#71, !43)
  • zig client: configurable client pool capacities (#68 – partial, !47, !57)
  • nodejs/typescript client: prototype libkobolds C ABI used by the client (#29, kobolds-ts#1, !12)
  • nodejs/typescript client: libkobolds reaches client parity for core functionality (!32, kobolds-ts!6)
  • nodejs/typescript client: libkobolds published to the GitLab package registry (!34)
  • nodejs/typescript client: client moved into the kobolds repo and published (scoped package) to the GitLab package registry with CI tests (#66, !35)
  • nodejs/typescript client: unsubscribe (#71, !43)

Observability and Performance Tooling#

  • Tracer with span recording across broker, workers, and clients; message pool allocation; tracer analysis scripts (#69, #53, !40)
  • Isolated benchmarking framework: transport-agnostic Pipe abstraction and a mock pipe for in-memory benchmarks (#27, !39)

DevOps and Distribution#

  • GitLab CI/CD pipeline that runs tests before merge (#6, #8, !10)
  • Multi-target builds, deployment to the dev farm, and a systemd service for the broker (!25)
  • Reworked CI/CD so kobolds, libkobolds, and clients are tested, built, and published together; independent build targets (!44)
  • Versioned kobolds binary artifacts uploaded to the GitLab package registry; Ansible/Docker output (#7, !45)

Documentation#

  • MkDocs site: protocol, CLI usage, client usage, build docs, endianness, roadmap (#2, #64, #67, !55)
  • Expanded client docs and separate broker/client installation guides (#67, !56)
  • README updates: dependencies, implemented features, badges, TypeScript client (!16, !26, !42, !48)

Bugfixes#

  • Publisher/subscriber resync when a topic is added or a message is published (#19, !8)
  • zig client: client slept for 1 ms on every tick (!9)
  • Benchmarks made more resilient (!13)
  • Stopping a publisher crashed the broker (#39, !17)
  • Race condition on message deref (!19)
  • cli: a connection string was required for every command (#48, !20)
  • Broker crashes under backpressure and overpressure with fast producers and slow consumers (#63, !33)
  • zig client: client crashes (OOM) under backpressure; publish backpressure handling and corrected recv/send buffer sizes (#63, !33)
  • Zig ChunkWriter stream write error (!35)
  • nodejs/typescript client: broken package export file (!36)
  • Serializer did not recompute the expected size when adding a delivery context, which could overpack the output buffer (!38)
  • Tracer memory leak and memory corruption when publishing many traced messages (#70, !49)
  • Offset bug in the chunk reader/writer (#73, !52)
  • Inter-thread routing queues reduced to 1024 slots (!53)
  • Chunk memory used by default, with fallback to dynamic memory when the chunk pool is exhausted; clearer deserialization errors (#74, !54, !55)
  • Client never received auth_failure because the broker closed the connection before sending it (!56)

Refactors#

  • Renamed authentication strategies (username_password, password) in broker and zig client (#13, !1)
  • Codebase reorganized to make the library more portable (!11)
  • Upgraded to Zig 0.16.0 (#52, !23)
  • trace_id is now a random integer (#55, !27)
  • nodejs/typescript client: libkobolds/C ABI rewritten for the new APIs: src/abi/, opaque kb_context, header/body getters and setters (#62, !30, !31)
  • Inter-thread messaging: RoutingEnvelope/ReclaimEnvelope, ref-counted messages, lock-free SPSC queues, no cross-thread deallocation (#65, !33)
  • nodejs/typescript client: moved from kobolds-ts into the kobolds repo (#66, !35)
  • Message v3: optional, chunk-backed or dynamic memory, FrameReassemblerV2/FrameDisassemblerV2, serializer v2, new header getters/setters (#73, !52)
  • zig client: message creation switched to dynamic memory for message v3 (#73, !52)
  • nodejs/typescript client: libkobolds ABI and tests updated for message v3 (#73, !52)
  • Removed kb encoding from the broker (#80, !58)
  • cli: removed kb encoding options (#80, !58)
  • zig client: removed kb encoding (#80, !58)
  • nodejs/typescript client: removed kb encoding (#80, !58)
  • Dependency update: stdx v0.4.2 for better allocation performance (!46)
  • Tuned broker/client params for benchmarking and idling; removed dead message types (!44, !47, !50)
  • Repository housekeeping: removed Apache license and rewrote git history (#15, #16, !2, !3, !4)

Known Issues#

  • Very large message sizes and volumes can cause a switch on a corrupt value. (#75)
  • Chunk memory appears slower than dynamic memory. (#76)
  • session_join is not implemented yet; clients use session_init only. (#57)
  • Some config parameters are still hard-coded, such as the worker memory pool size and pool pressure. (#68)