Repository navigation
Mods: your own interface inside T3 Code, the same with every model - #1
Open
leorivastech wants to merge 1 commit into
Open
leorivastech wants to merge 1 commit into
leorivastech wants to merge 1 commit into
Conversation
A mod is a small folder of local code under ~/.agents/mods that adds interface to T3 Code: a pane beside the chat, a band above the composer, a status line, toasts and slash commands. It belongs to no model or provider and costs no tokens to run. Mods run in a process of their own, so one that loops forever is stopped and restarted without freezing the app. They hear what the agent does (turns and tool calls) the same way for every provider, and agents reach them through three MCP tools: mods_guide, mods_list and mods_run.
Thread transfer impact
This comment will update automatically after the next completed run. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A mod is a small folder of local code that adds interface to the app: a pane beside the chat, a bar above the composer, a status line, a slash command. It belongs to no provider, so the same mod works in a Claude thread, a GPT thread, or a thread where nothing has been sent yet, and running one costs no tokens.
This is built and working. It runs in the app installed on my machine, and the branch sits on upstream
main. It is not a sketch looking for someone to write it.Recording of the real UI, 1:39:
t3-mods-demo-v3.mp4
Why
I kept wanting small things next to the chat that are mine and not the model's: the state of my open pull requests, what is playing, something to do while an agent works. Today that means another window. A provider's own plugin system does not solve it either, because it stops existing the moment I switch models.
What I have working
Three mods I use, all in the recording:
/prsopens a pane with my open-source pull requests, read from a local file I already keep./musicputs a bar above the composer that shows and controls the player on the machine./fightis a one-key real-time game in a pane, against the CPU or against another person through a small server. Escape returns to the chat; the command returns to the game.And the point of it:
Any model, or none. Mod commands appear in the slash menu with every provider and run locally. Nothing is sent to the model.
Any model can write one. Agents get three MCP tools:
mods_guide(how to write a mod),mods_list(what loaded, and the error if one did not) andmods_run. To check that the guide is enough, I asked three different models (Claude Haiku, Gemini and Grok) to write a mod with nothing but it. Each one produced a mod that loaded and worked.How a mod is made
One folder under
~/.agents/mods/, two files:Saving a file reloads it. A mod reaches the outside only through
$: files in the project, running a command, fetching a URL, a small store of its own. For what elements cannot draw, a pane can hold a page of the mod's own in a sandboxed iframe, with a canvas and the keyboard; that is how the game works.How it fits the codebase
packages/mod-engine: the engine, with no dependency on Effect or on the rest of T3 Code. It runs mods in a process of its own, so a mod that loops forever is noticed, killed and restarted without freezing the app. A second freeze turns mods off with a notice.apps/server/src/mods): one session per thread, shut down a few minutes after the last window leaves. It also tells mods what the agent does (a turn starting, a tool running, a turn ending), mapped from the orchestration events, so it is the same for every adapter.mods.subscribe,mods.request), authorized like the rest.McpToolAccesslike the others.It is 61 files and about 9,950 added lines, tests included, on top of upstream
mainas of October 7, 2026.What it does not do
What it costs
Measured against the same commit without mods, in the web app and in the engine process alone:
Not measured: a real GPU (the measurements ran in a headless browser), remote and tunnel connections.
Where the code is
feature/mods: upstreammainplus this change, one commit.mods-telegram: the same plus my Telegram channel, which is what I run.Engine tests 26, server 24, web 329, all passing on this branch.