Combining tmux and Claude to Build an Automated AI Agent System (for Mac & Linux)

1. Introduction

With the rapid growth of AI, multi-agent systems are attracting more attention due to their ability to coordinate, split tasks, and handle complex automation. An “agent” can be an independent AI responsible for a specific role or task.

In this article, I’ll show you how to combine tmux (a powerful terminal multiplexer) with Claude (Anthropic’s AI model) to build a virtual organization. Here, AI agents can communicate, collaborate, and work together automatically via the terminal.

 

2. What is tmux?

tmux lets you split your terminal into multiple windows or sessions, each running its own process independently. Even if you disconnect, these sessions stay alive. This is super useful when you want to run several agents in parallel, each in their own terminal, without interfering with each other.

 

3. What is Claude?

Claude is an advanced language AI model developed by Anthropic. It can understand and respond to text requests, and it’s easy to integrate into automated systems—acting as a “virtual employee” taking on part of your workflow.

 

4. Why combine tmux and Claude?

Parallel & Distributed: Each agent is an independent Claude instance running in its own tmux session.

Workflow Automation: Easily simulate complex workflows between virtual departments or roles.

Easy Debug & Management: You can observe each agent’s logs in separate panes or sessions.

 

5. System Architecture

Let’s imagine a simple company structure:

PRESIDENT: Project Director (sets direction, gives instructions)

boss1: Team Leader (splits up tasks)

worker1, worker2, worker3: Team members (do the work)

Each agent has its own instruction file so it knows its role when starting up.

Agents communicate using a script:

./agent-send.sh [recipient] “[message]”

Workflow:

PRESIDENT → boss1 → workers → boss1 → PRESIDENT

 

6. Installation

Since the code is a bit long, I’ll just share the GitHub link to keep things short.

tmux:
Install guide: tmux Installing Guide

Claude:
Install guide: Claude Setup Guide

Git:
Install guide: Git Download

Clone the project:

bash
git clone https://github.com/mhieupham1/claudecliagent

 

Inside, you’ll find the main folders and files:

CLAUDE.md: Describes the agent architecture, communication, and workflows.

instructions/: Contains guidance for each role.

.claude/: JSON files to manage permissions for bash scripts.

setup.sh: Launches tmux sessions for PRESIDENT, boss1, worker1, worker2, worker3 so agents can talk to each other.

agent-send.sh: Script for sending messages between agents.

 

7. Deployment

Run the setup script:

bash
./setup.sh
This will create tmux sessions for PRESIDENT and the agents (boss1, worker1, worker2, worker3) in the background.

To access the PRESIDENT session:

bash
tmux attach-session -t president


To access the multiagent session:

bash
tmux attach-session -t multiagent


In the PRESIDENT session, run the claude command to set up the Claude CLI.

Do the same for the other agents.

Now, in the PRESIDENT window, try entering a request like:

you are president. create a todo list website now
PRESIDENT will start the to-do list. PRESIDENT will send instructions to boss1, boss1 will assign tasks to worker1, worker2, and worker3.

You can watch boss1 and the workers do their jobs, approve commands to create code files, and wait for them to finish.

Result:

8. Conclusion

Combining tmux and Claude lets you create a multi-agent AI system that simulates a real company: communicating, collaborating, and automating complex workflows. Having each agent in its own session makes it easy to manage, track progress, and debug.

This system is great for AI research, testing, or even real-world workflow automation, virtual team assistants, or teamwork simulations.

If you’re interested in developing multi-agent AI systems, try deploying this model, customize roles and workflows to your needs, and feel free to contribute or suggest improvements to the original repo!

Introducing Claude 4 and Its Capabilities

Claude 4 refers to the latest generation of AI models developed by Anthropic, a company founded by former OpenAI researchers. The most powerful model in this family as of June 2024 is Claude 3.5 Opus, often informally called “Claude 4” due to its leap in performance.

Claude Opus 4 is powerful model yet and the best coding model in the world, leading on SWE-bench (72.5%) and Terminal-bench (43.2%). It delivers sustained performance on long-running tasks that require focused effort and thousands of steps, with the ability to work continuously for several hours—dramatically outperforming all Sonnet models and significantly expanding what AI agents can accomplish.

Claude Opus 4 excels at coding and complex problem-solving, powering frontier agent products. Cursor calls it state-of-the-art for coding and a leap forward in complex codebase understanding. Replit reports improved precision and dramatic advancements for complex changes across multiple files. Block calls it the first model to boost code quality during editing and debugging in its agent, codename goose, while maintaining full performance and reliability. Rakuten validated its capabilities with a demanding open-source refactor running independently for 7 hours with sustained performance. Cognition notes Opus 4 excels at solving complex challenges that other models can’t, successfully handling critical actions that previous models have missed.

Claude Sonnet 4 significantly improves on Sonnet 3.7’s industry-leading capabilities, excelling in coding with a state-of-the-art 72.7% on SWE-bench. The model balances performance and efficiency for internal and external use cases, with enhanced steerability for greater control over implementations. While not matching Opus 4 in most domains, it delivers an optimal mix of capability and practicality.

GitHub says Claude Sonnet 4 soars in agentic scenarios and will introduce it as the model powering the new coding agent in GitHub Copilot. Manus highlights its improvements in following complex instructions, clear reasoning, and aesthetic outputs. iGent reports Sonnet 4 excels at autonomous multi-feature app development, as well as substantially improved problem-solving and codebase navigation—reducing navigation errors from 20% to near zero. Sourcegraph says the model shows promise as a substantial leap in software development—staying on track longer, understanding problems more deeply, and providing more elegant code quality. Augment Code reports higher success rates, more surgical code edits, and more careful work through complex tasks, making it the top choice for their primary model.

These models advance our customers’ AI strategies across the board: Opus 4 pushes boundaries in coding, research, writing, and scientific discovery, while Sonnet 4 brings frontier performance to everyday use cases as an instant upgrade from Sonnet 3.7.

 

 


Key Strengths of Claude 4

 1. Superior Reasoning and Intelligence

Claude 4 ranks at the top in benchmark evaluations such as:

  • MMLU (Massive Multitask Language Understanding)

  • GSM8k (math problem solving)

  • HumanEval (coding)
    It rivals or exceeds OpenAI’s GPT-4-turbo and Google Gemini 1.5 Pro in complex reasoning, long-context understanding, and task execution.

 2. Massive Context Window (Up to 200K Tokens)

Claude 4 can read and reason over hundreds of pages at once, making it perfect for:

  • Analyzing lengthy legal or scientific documents

  • Comparing large codebases

  • Summarizing long texts or reports

 3. Advanced Coding Support

Claude 4 excels in:

  • Writing and explaining code in multiple languages (Python, JS, Java, etc.)

  • Debugging and understanding large code repositories

  • Pair programming and iterative development tasks

 4. Natural and Helpful Communication

  • Responses are clear, polite, and structured

  • Especially strong in creative writing, professional emails, and educational explanations

  • Can follow complex instructions and maintain context over long conversations


Safe and Aligned by Design

Claude is built with safety and alignment in mind:

  • It avoids generating harmful or unethical content

  • It is more cautious and transparent than most models

 


 How to Access or Use Claude 4

Claude is a cloud-based AI model, so you don’t install it like software — instead, you access it via the web or API.

1. Use Claude via Web App

 Steps:

  1. Go to: https://claude.ai

  2. Sign up or log in (you need a US/UK/Canada/EU phone number).

  3. Choose from free or paid plan (Claude 3.5 Opus is available only in Claude Pro – $20/month).

 Claude Pro Includes:

  • Claude 3.5 Opus (latest, most powerful)

  • Larger context

  • Priority access during high demand

 Currently, Claude is only available in select countries. If you’re outside the US/UK/Canada/EU, you may need to use a VPN and a virtual phone number to sign up (unofficial workaround).


2.  Use Claude via API (For Developers)

 API Access:

  1. Go to: https://console.anthropic.com

  2. Sign up and get an API key

  3. Use the API with tools like Python, cURL, or Postman

 Example (Python):

import anthropic

client = anthropic.Anthropic(api_key="your_api_key")

response = client.messages.create(
model="claude-3.5-opus-20240620",
max_tokens=1024,
messages=[
{"role": "user", "content": "Explain quantum computing in simple terms"}
]
)

print(response.content)


Can I Install Claude Locally?

No. Like ChatGPT or Gemini, Claude is not open-source or downloadable. It’s only available via:

 

Feature Claude 4 (Claude 3.5 Opus)
Developer Anthropic
Model Type Large Language Model (LLM)
Reasoning & Math Top-tier performance
Context Length Up to 200,000 tokens
Code Assistance Strong support for multiple languages
Language Style Human-like, calm, professional
Best Use Cases Analysis, writing, coding, dialogue
Access claude.ai or API

A Step-by-Step Guide to Integrating and Using Claude Code Action on GitHub

Investigate how Claude Code Action is great. Just create an issue and put  a mention to Claude  like @claude, Claude can write the code automatically

Introduction

In the current era of rapidly evolving technology, artificial intelligence (AI) 

stands out as one of the most significant and transformative breakthroughs on a global scale. Among the various AI-driven tools, Claude — particularly the Claude Action Code — represents a powerful integration that can be embedded into user’s GitHub repositories to address raised issues with remarkable accuracy and efficiency. This paper aims to explore the capabilities and applications of Claude Action Code in modern software development workflows.

Body content

Claude Code Action is a extension categorized as a “Action” and made available on the GitHub Marketplace by Anthropic. Users can search for and utilize it by following the provided setup instructions outlined in the README documentation. Below is a summary of the basic setup steps for integrating Claude Code Action into user’s GitHub repository: 

1.Create a workflow folder:

On GitHub: In user’s GitHub repository, click “Add file”:

insert the configuration into the path:“.git/workflows/[file_name].yml”. For instance: 

Next, insert the appropriate workflow configuration for this extension, depending on your intended use:

For example: 

name: Claude PR Assistant

on:

  issue_comment:

    types: [created]

  pull_request_review_comment:

    types: [created]

  issues:

    types: [opened, assigned]

  pull_request_review:

    types: [submitted]

 

jobs:

  claude-code-action:

    if: |

      (github.event_name == ‘issue_comment’ && 

contains(github.event.comment.body, ‘@claude’)) ||

      (github.event_name == ‘pull_request_review_comment’ && contains(github.event.comment.body, ‘@claude’)) ||

      (github.event_name == ‘pull_request_review’ && 

contains(github.event.review.body, ‘@claude’)) ||

      (github.event_name == ‘issues’ && contains(github.event.issue.body, ‘@claude’))

    runs-on: ubuntu-latest

    permissions:

      contents: write

      pull-requests: read

      issues: read

      id-token: write

    steps:

      – name: Checkout repository

        uses: actions/checkout@v4

        with:

          fetch-depth: 1

 

      – name: Run Claude PR Action

        uses: anthropics/claude-code-action@beta

        with:

          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

          timeout_minutes: “60”

Then, click “Commit changes” to successfully add the configuration to your repository.

On the user’s local machine: If a folder in VScode has already  been connected to the GitHub repository, the user can manually create a workflow directory and a .yml file to store the Claude configuration. Then, file can be pushed to the GitHub repository

2.API key:

  • After that, the API key should be added to the repository’s Secrets under the Setting tab, rather than being hard-coded directly into workflow file to prevent unauthorized access

 

Find Action in Secret and variables

Create a new repository secret

Add your API key to Secret’s description

Name secret as key’s name in the workflow file

✅Correct

❌Never do it

3. Using Claude Code Action

User creates a new issue within repository where Claude is intended to be used: 

The user describes the issue to be resolved – such as feature creation, bug fixing, code review, …  – in the issue’s description. You can tag “@claude” directly in the description or in a comment after the issue is created, in order trigger Claude to process the request

Ex: Ask Claude to generate complete login and registration pages based on the initial files in the repo

Claude is invoked via API to address the issue described, with the response time depending on the complexity of the request. It uses the token associated with your API key to read the issue content as well as to create or modify code within the repository

Claude’s response will appear in the comments section of the issue.

Here, Claude generates additional files, for example register.html and dashboard.html, as part of the requested implementation and show what changes are made to each file — including which parts are added, modified, or deleted.

At this point, Claude has created a separate branch in the repository containing the proposed changes. The user can then review and consider merging these updates into the main branch via a pull request.

After successfully merging into the main branch

 

Following a successful merge, the issue may be closed. At this point, Claude has been effectively utilized to generate complete, functional demo pages for user login and registration.

 

4.Result:

Registration page

Login screen

Dashboard screen

In summary, Claude Code Action proves to be a highly effective tool for streamlining development tasks, making it easier for both individuals and teams to enhance productivity.