I let Claude Code open its own terminal sessions, and I watch every one of them
I build CLI Manager, a macOS app for running Claude Code, Codex CLI and Gemini CLI side by side. This year I made it free and open source (MIT), and added the feature I now use every day: Claude Code can drive the app it
I build CLI Manager, a macOS app for running Claude Code, Codex CLI and Gemini CLI side by side. This year I made it free and open source (MIT), and added the feature I now use every day: Claude Code can drive the app itself.
In the video, Claude Code loads a skill, opens one Claude session per repo, hands out the tasks, waits for them and reports back in a table. Every session it opens shows up in the sidebar in green, so I can click into any of them and take over.
The idea is easy to copy
You don't need my app for this. It is two pieces:
- A local API that opens real terminal sessions. Not a hidden subprocess, but the same terminals I use, visible on screen.
- A skill that tells the agent how to use that API. Open, type, wait, read, hand back.
The agent gets a way to delegate work. I keep a window into everything it delegated.
How it works in CLI Manager
The API is off by default. You turn it on in Settings › Agents › AI Control API. The app then listens on 127.0.0.1:47821 only and writes the address and a token to ~/.climanager/control-api.json (mode 600, removed when the app quits).
The skill wraps the API in a small CLI that the agent calls:
node "$CLI" open ~/code/my-project --template claude-code \
--name "AI: fix failing test" --prompt "fix the failing test"
node "$CLI" wait last --timeout 300 # wait until idle, print the screen
node "$CLI" read last --tail --lines 120 # include scrollback
node "$CLI" release last # hand it back to me; the session keeps running
The exit codes carry the meaning, so the agent branches on them instead of on wording. 3 means a question or a menu is on screen. 7 means the wait timed out but the session is still running, which is not a failure.
A few rules the skill keeps:
- Menus are answered with keys, never with a blind Enter.
- Once I click Disconnect AI, the agent stops touching that session.
- Everything stays on loopback. Nothing leaves the machine.
If you prefer MCP, the app serves the same actions there too (open_session, send_input, wait_for_idle, read_output and a few more).
How Claude helped
About two thirds of the recent commits in the repo are co-authored with Claude Code, including most of this API.
Try it
- App (free, macOS, MIT): https://github.com/woorichicken/CLI_manager
- Skill:
npx skills add woorichicken/climanager-session@climanager-session
If you build the same pattern on another terminal or OS, I would love to see it.
This post was written with AI assistance and reviewed by me.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.