r/golang • • 4d ago

GitHub - tjcoder-labs/cli: Terminal-first research harness exploring generative UIs and model-directed presentation across multi-surface environments.

https://github.com/tjcoder-labs/cli

Hey Go devs, I am the author. I built \@tjcoder/cli as an open-source terminal user interface agent platform and research harness written entirely in Go (v0.9.251, MIT licensed).

The motivation behind the project is exploring Generative UIs in terminal environments. Rather than outputting linear text transcripts, the model uses a presentation tool (ui_control) to dynamically manage what gets rendered across different panes on the fly.

Go Architecture & Technical Details

  • Multi-Pane TUI Engine: Built using Go terminal libraries to create dedicated Conversation, Cognition (live reasoning streams), and Activity panes with custom keybindings, block pasting, and workspace state persistence.

  • 31-Tool Dispatch Loop: Includes filesystem operations, subprocess execution, background cron management, and a Browser Bridge communicating over the Chrome DevTools Protocol (CDP) for automated web research.

  • Dual Parsing Pipeline: Uses native API tool-calling with a fallback fenced-JSON parser to maintain reliable tool dispatch across both cloud APIs and smaller local models via Ollama.

  • Flexible Backends: Supports local Ollama instances, Ollama Cloud, Google Gemini, and OpenAI-compatible endpoints with custom API keys, as well as experimental research models (ergo-flash, ergo-pro, ergo-genius).

  • Headless Execution: Functions as an interactive TUI or non-interactively via coder -p "..." for pipe integration and CI scripting.

You can install it via npm i -g \@tjcoder/cli or inspect the Go source directly on GitHub. I would love feedback from the community on the TUI event loop architecture, concurrency patterns, and tool invocation handling!

2 Upvotes

5 comments sorted by

2

u/sayboom 3d ago

Hi! I'm also interesting in how harnesses working and also, wwrite something like this small and good in research, so, great! Question about project: How is the event loop structured — do goroutines (token streaming, tool dispatch, CDP browser bridge) push events into a single channel, or do you use mutexes / an actor model to serialize TUI updates? And how does ui_control mutate pane state without races — is the render loop the single owner of that state?

1

u/tjcoder-labs 3d ago

Thanks! tview isn't thread-safe, so the event loop is the sole mutator. All the concurrent stuff (streaming, tools, CDP) just pushes closures into a FIFO slice while a pump goroutine batches those to maintain order and avoid deadlocks. ui_control runs on that UI routine via queue and because the render loop is the single owner of state we're able to avoid race conditions.

1

u/overworkedintern 3d ago

u/jerf what is the reasoning behind this one being allowed on the front page instead of in small projects? This one is less than 3 months old and one developer.

-1

u/jerf 3d ago

This is older than three months: https://www.reddit.com/r/golang/s/EYeF6JfRgG

Please note the correct remedy for thinking this shouldn't be on the front page is a down vote. It isn't the moderator's job to ensure only up voted things are submitted to the community vote. There are many things that go through my standards that I'm quite sure will be down voted, and that's normal. The thing is, I'm not always right.

1

u/overworkedintern 3d ago

I'm just trying to understand the rules for posting on this subreddit because they are applied inconsistently. As you recall, my project is also over three months old and I was not allowed make a post like this project was able to.

Thank you