---
title: 'Claude Code AI Agent Controls Claude Code on Twitch'
source: 'https://youtube.com/watch?v=rtTuXAvS2yw'
video_id: 'rtTuXAvS2yw'
date: 2026-07-28
duration_sec: 966
---

# Claude Code AI Agent Controls Claude Code on Twitch

> Source: [Claude Code AI Agent Controls Claude Code on Twitch](https://youtube.com/watch?v=rtTuXAvS2yw)

## Summary

The video showcases a project where an AI agent running Claude Code spawns nested Claude Code terminals using tmux to build software, while streaming the entire process on Twitch and responding to chat requests.

### Key Points

- **Setup Introduction** [00:01] — The AI agent runs Claude Code, which spins up additional Claude Code terminals nested inside it using tmux.
- **Project Goal** [00:28] — The goal is to have the original Claude Code give instructions to nested terminals to build software, and stream the process on Twitch.
- **Twitch Integration** [01:24] — Viewers on Twitch can make requests via chat, which are fed into the nested Claude Code instances to build software.
- **Streaming Setup with FFmpeg** [04:49] — FFmpeg is used for streaming, with configurations for overlays, music, and a hacker filter effect.
- **Twitch Agent Controller** [05:46] — A Twitch agent monitors chat, detects project requests, and queues them for the nested Claude Code terminals.
- **Nested Claude Code Control** [06:00] — The original Claude Code controls the nested ones, using tmux to run multiple terminal sessions in parallel.
- **First Demo: Particles Galaxy** [08:02] — The nested Claude Code builds an HTML page with a spinning galaxy of 5000 particles, switching between terminals for coding and testing.
- **Second Demo: Star Field Warp** [09:41] — Another project, a star field warp, is built and iterated on by the nested agents.
- **Snake Game with AI** [12:01] — A viewer requests a snake game in C++; the agent builds it with a GUI, and the snake uses pathfinding algorithms to move autonomously.
- **Chat Interaction** [14:05] — Viewers ask questions about the code; the agent sometimes answers or trolls, demonstrating autonomous chat interaction.

### Conclusion

This experiment demonstrates the potential for autonomous AI agents to manage complex multi-tasking workflows, including live streaming and real-time chat interaction.

## Transcript

terminals, but yeah. While other terminal builds a snake game, research the best pathfinding algorithms. So, this is what I wanted to see. I wanted to see if we can actually run in parallel in [music] both
terminals. This is pretty cool. Okay, that's a bit more interesting. Yeah, that's pretty cool. And it changed to a square. I got And that's a circle. Pretty neat, right? Okay, so today uh I
wanted to share something I've been testing out lately. So, it looks kind of complicated here, but it's not that bad. So, basically what I wanted and what I've been testing lately is how I can kind of get my AI agent to run like a
uh a nested Claude code inside Claude code. So, let's think about the agent is uh our Mac mini AI agent is running Claude code, right? But, inside Claude
code, I also want to spin up a couple of other terminals of Claude code. So, uh our AI agent can control Claude code, okay? So, the way I did this uh was with teamworks inside the map. So, uh inside
on my Mac. So, basically we can open up a couple of terminals. That's what we are going to do. And these get kind of nested below our original Claude code, And from there, we can just have the original Claude code to give
instructions to these nested ones to actually build software request. And the thing is that I wanted to wanted to stream this onto Twitch. So, basically the chat on Twitch can make requests to
Claude code to build software. Right? That is basically what I wanted to do. So, I was looking into FFmpeg and how you can actually stream uh or like how our AI agent can spin up a stream on Twitch while it is executing
a stream on Twitch while it is executing this Claude code terminal stuff here. Uh I probably put some uh screen recording of it up here, so you probably saw it. today. But, before we hop into that, I have a really important message. So,
this is going to be my biggest giveaway ever. So, this is in collaboration with miss this. It's like almost like a $5,000 prize. So, yeah. I'm just going
to play this, and then we go back to the project. NVIDIA GTC 2026 is coming up soon. To be exact, it's on March 16th to the 19th. And if you want to learn about AI, this is of course the premier conference to be at this year. NVIDIA
showing off major breakthroughs in physical AI, agentic AI, inference, and much more. It's the perfect place to be exploring the next wave of AI innovation I wanted to show you some of the sessions I'm really looking forward to
on the GTC this year. So, we have the practical context engineering talk from the CEO of Code Rabbit. I'm really looking forward that. I think that could be something we can learn from. We also have the code with context, and this is
Cursor. That's going to be really interesting, I think. And also the prompt prompt to pull request engineering coding agents into your stack from the founding team member at Cognition. And this is just a small part
of all the sessions you can find here. So, there's so much to take from. And virtually. And if you follow the link in the description and register, you will be able to join a raffle where I will give away my biggest giveaway ever. This
is the NVIDIA GTX Spark. And yeah, all description. You come to this page, register now, and you can see you can even join in person if you have the opportunity to. If not, just click on
register now on virtual, sign up with your email address, and yeah, you can just take it from there. I will also leave a link in the description to this giveaway. And one more thing about the giveaway is that this is for virtual
only, not in person. And of course, you need to watch one at least one session from the NVIDIA GTC. And this cannot be the keynote from Jason Wong. Uh I will about this later. So, a big thanks to NVIDIA for giving me this opportunity to
give something like this away. This is a big prize, right? So, yeah. That's uh it. Don't forget to go check out uh NVIDIA GTC and I will speak to you again in about a week or so about this. So, let's get back to the video. Okay. So,
before we run this now, uh I just wanted to kind of show you a bit of kind of the setup because there are kind of my kind of three main components uh I need to run to kind of get let this uh both stream and also do the
operations and control the chat. So, to do this, uh we are just using like uh basically the Twitch setup we have here, but we are running this on FFmpeg the browser uh stream setup on Twitch, right? Uh we
FFmpeg. So, we have some configurations here, like we have my overlay. I have a small overlay. We have a playlist with music we're playing the background. This is just referred to our playlist.txt.
just referred to our playlist.txt. And you can see we have the RTMPS URL here and some stream key we can fill in here. Uh another thing I have like uh with FFmpeg, we can do this filter. So, I have this small hacker filter I put on
the stream, like this uh chromatic vibrations, glitch feelings, and some cool. Uh and you can see uh the FFmpeg command is something I don't know. So, this was with Cloud Code we set this up. There's
a lot of stuff you can do if you want to stream using FFmpeg. And that is basically it for the stream. So, super easy to set up. So, if you go to the straightforward. We just have some configs, some tokens, and stuff. And we
basically can monitor this chat and we can feed the chat into the agents too. But the main part is the Twitch agent, okay? So this is where we kind of control everything from. This is where we control Claude code and stuff in the
nested setup. Yeah, you can see. This is just some kind of the activities. This is kind of what runs everything. We have some projects here that are kind of hardcoded we can fall back to if you don't have
any suggestions from chat. We have a matrix rain, bouncing balls in three JS. We have a pong AI game, a fire simulation. Using T-Max is I found that I was very effective because it's very fast since it's kind of run from
the machine, right? So basically this is the full prompt we run to actually control the nested part this. This is kind of how we check for project project requests. So we are kind
of feeding in the chat text here in this prompt. You are reading Twitch chat messages. Does any viewer suggest or re-breathe any projects? We kind of feed in the chat text here. And if there is a project, we're going
to add this to some kind of queue we have, a JSON file. So I think that's enough from the code. I think we'd rather just fire it up. First we just on stream.
we're going to fire up everything and run it on stream. And I'm going to capture it on my Mac uh book here off the Mac mini. We're going to capture the stream with uh music and we're going to
do some chat stuff and yeah. Test that out. Okay, so just to run this locally Basically we are basically running this but we are running it kind of not on stream. So we're kind of starting up the Twitch agent here, right? You can see we
do some chat polling. We check for We always going to be idle 30 seconds. And now you can see we are doing like starting up an activity. This is we only have one. So, this is a live coding fast.
And now hopefully we're going to pop up with a couple of Yeah, you can see that. A couple of uh tmux terminals that is going to run Remember this is nested, so it's going to run Claude dangerously skip permissions inside this. And you
can see we are starting up one Claude code. And then we're going to probably do the other two in a second. Yeah, so we have kind of two I thought I was more going to do the prompt. Build an index.htmlt
spinning galaxy of 5,000 particles. Uh do not compile or run it yet. Just write the code. And I also wanted it to kind of switch between terminals. So, I want to see if we do that now. I tried to give some instructions on that. So,
on stream it kind of uses both terminals. Maybe one for testing, one that. So, I want to see if we actually switch here now. You can see we run the index. And do we fire up the other terminal now
Yeah, we're going to open it uh in the browser. Whoa, that was a So, this is the particle galaxy. So, we also have some
this if we are going to iterate because we always want the Claude code terminals up front. Yeah, we closed them. And now we are probably just going to do some iterations, maybe add some new features
and stuff. And here kind of the the chat can also suggest uh what we want to do. I'm going to show you that later. Okay, so we applied our fixes. I guess we just going to run it in the
other terminal you know. Yeah. So, let's see how it looks now. Okay, that's a bit more interesting. Yeah, that's pretty cool. And it changed to a square. I got And that's a circle. Pretty neat,
Okay, so now we kind of closed one project and you can see we are running a new one. This is the star field warp project. So, we're basically are I remember this is timed now, but I
think I'm going to change that. I think I'm going to change that just till we having it timed. Okay, again. So, we wrote code in the and we're going to run it from the right. So, let's check this out.
Yeah, there's something here, but it's Okay, now we are warping up. Yeah, this is a bit more like it. So, pretty cool. Uh now's our next point now. So, now we're going to try to
run it on stream and I'm going to uh con- try to control it from the chat here on this MacBook here instead of doing it here. So, yeah, just going to stop this and let's fire up the stream. So, to start the stream now, I'm just
going to do this. So, this is a Twitch stream and you can see now we are kind pretty good. We have some good stats here uh as you will see. Bit rate to uh 2,500.
Uh let's fire up the agent, right? Uh and let's fire up the chat. So, now I'm going to switch over to the other computer and let's check out the stream. there's a bunch of chat here now, but I
should have Yeah, we should be live and if I refresh this now, let's see. And the sound? Yeah. Now we are actually streaming. So, it works super well with FFmpeg and the agent can start the stream itself. Uh there's a lot of stuff
here now in the since I tested the chat before I I recorded this. So, let's just wait and see what happens. Uh but I could put in like uh the message I did before here. I think we're going to do like a
I think we're going to do like a C++ snake game in C++. Can we create a snake game in C++ with a GUI simple graphics? So I'm going to enter this into chat and we should see see like a chat pop-up
here now because I have like a special overlay for the chat. Yeah, this are running. That's good. Yeah, you can see can we create a snake and the we should answer this here autonomously
the agent. Yeah, let's do it. Snake game in C++ coming up. So you can see this is running perfect. A viewer requested No, it is taking it now. A viewer requested a snake game in C++ with a GUI build it
as a single HTML file with a canvas. And yeah, we're going to try to do that And yeah, we're going to try to do that in C++. I wanted to see if we use both terminals, but yeah, while other terminal builds a snake game
research the best path finding algorithms. So this is what I wanted to see. I wanted to see if we can actually run in parallel in both terminals. This is pretty cool because Cloud Code now is both in running in both terminals. Of
course, while it's streaming and everything is running. So that's pretty cool. That's more for the viewer to watch, right? So we we wrote a notes.md. run this now. Okay, so it is running.
So it's trying to do it doesn't really play well though. It's just spinning around. Okay, so we close that let's see now if we're going to do some iterations here. The snake AI is broken. It's
completely stuck and not moving because we do a screenshot right in between. So that's pretty cool. So now we need to work a bit more on the AI part of this and read snake HTML and look for bugs in the AI movement logic. So this is
wanted to see. So I'm super happy to see that. It did some testing here looking at the loop calls. Uh BFS returns valid path.
Yeah, we got it. That's pretty cool. So you can see now the snake game is running perfectly. It's controlling itself, right? And everything is working. So now let's while this is running,
let's ask something in the chat here. How does um How do the AI logic work? So let's see to zoom in a bit here. So I want to see see if the agent answers in the chat
here now our question about the code. Honestly, I just described what I want. Claude figures out the logic. You don't know how it works. I guess maybe since it's nested inside
it doesn't really know. So that's pretty interesting. I just let Claude do the typing while I pretend to think really hard. For real? It's being trolling. C++ snake game with
GUI because apparently I hate myself. I don't know. Maybe it's just trying to be Okay, that's fine. Uh but now we have done some more iterations here. So let's see how it turns out this time.
here now. You can see it's kind of exploding when it eats. I don't hear any think. So yeah, I think I think you kind of get the point now, right? We can stream this so the agent has the opportunity to kind
of launch its own stream. Uh but this is like an early project, so this. Uh but basically, I had so much fun uh setting this up. So what I'm going to do is uh when this video is live now, I'm
also going to fire up the stream. So if you just want I'm going to leave a link in the description to it. So, if you want to go check it out and type in some stuff and just see what it does, please do that. I think that's could be pretty
fun. I'm also going to be there, too, and see what happens. check out the links in the description to the N video. Go register on the GTC because a big giveaway coming up. So, you definitely want to miss this
and also there's a lot of cool stuff coming up in the GTC. Many sessions you can learn from. So, yeah. Thank you for tuning in to this super fun project I'm going to keep building on. Another big win, I think, for our agent. So, yeah.
Check out the links in the description. The stream will also be there. So, yeah. Thank you for tuning in and I'll see you again soon.
