thefakezach. Work With Me →

Non-Linear
Stream Renderer.

NLSR renders text from several agents on one fixed character grid. One agent streams forward while others revise earlier text, at the same time, without blocking.

npm install nlsr

Open source · npm · MIT · All free tools

● Grid · 72×22 · 60fpswriter → · ↩ editor

The renderer streams text into a fixed grid while a second agent revises earlier phrases in real time▍

// both run at once; neither blocks the other

The
problem.

Most text renderers only append.

Multi-agent systems need to write and rewrite: one agent drafts forward while others fix what's already on screen. NLSR gives them a shared grid, flushed at 60fps, that every agent can read and write.

What it
does.

Forward streaming

A primary agent streams text into a fixed character grid, token by token.

Concurrent revision

Revision agents go back and edit earlier phrases at the same time. Neither blocks the other.

Shared grid

The grid is how agents coordinate. It's flushed at a steady 60fps.

Stream adapters

Pipe a ReadableStream, SSE or async iterable straight into the renderer.

Agent messaging

A built-in message board lets agents post and read coordination messages.

Any model

No LLM calls inside. Bring Claude, GPT, Gemini, LangGraph or your own loop.

Quick
start.

Peer dependencies: react and react-dom 18 or newer.

App.jsx
import { useRef, useEffect } from "react"; import { NLSRRenderer, createCoordinator } from "nlsr"; function App() { const renderer = useRef(null); const coordinator = useRef(null); useEffect(() => { coordinator.current = createCoordinator(renderer); coordinator.current.registerAgent("writer", "primary"); coordinator.current.registerAgent("editor", "revision"); }, []); const write = () => coordinator.current.write("writer", "Hello world. "); const revise = () => coordinator.current.revise("editor", "Hello world", "Hello NLSR", "branding"); return <NLSRRenderer ref={renderer} cols={72} rows={22} />; }

Core
API.

A coordinator, a renderer and an optional stream adapter.

  • createCoordinator(rendererRef) Creates a coordinator that owns the text buffer and routes operations to the renderer.
  • coordinator.write(agentId, text) Append text. Primary agents only.
  • coordinator.revise(agentId, old, new, reason) Replace a phrase. Revision agents only.
  • streamAdapter(coordinator, source, options) Pipe a streaming model response into write() calls.
  • coordinator.messageBoard.post / read Messaging between writer and revision agents.
  • <NLSRRenderer cols rows /> The viewport component. Exposes write() and revise() via ref.

NLSR never calls a model API. Wire any model or agent loop into the coordinator with write() and revise(). Integration examples are in docs/integration.md.

Got something
to build?

Work With Me → zach@takedetroit.com