agmsg: Cross-Agent Messaging for CLI AI Coding Agents

A local Agent Skill turns Claude Code, Codex, Gemini CLI, Copilot CLI, Antigravity, and OpenCode into peer sessions that exchange short messages through SQLite.

agmsg is a free, open-source, cross-agent messaging tool for CLI AI coding agents.

It allows your Claude Code, Codex, Gemini CLI, and GitHub Copilot CLI to send messages to each other directly through a shared local SQLite database. Just need bash and sqlite3 installed as an Agent Skill.

When you use multiple AI coding agents in the same project, passing context between them usually means copying output from one terminal and pasting it into another.

agmsg replaces that manual relay with direct peer-to-peer messaging. One agent writes a message to a shared SQLite file, and another agent reads it on its next turn or via a real-time monitor stream.

The tool does not compete with MCP or built-in subagent features. It addresses the narrower case where independent, vendor-diverse CLI agents need to coordinate inside the same local workspace.

If you already run Claude Code for architecture planning and Codex for heavy refactoring, agmsg lets them hand off tasks without you as the courier.

Features

  • Sends messages between separate CLI AI agent sessions.
  • Connects Claude Code, Codex, Gemini CLI, GitHub Copilot CLI, Antigravity, OpenCode, and other terminal agents.
  • Keeps agent messages in a shared local room.
  • Preserves message history after sessions end.
  • Lets one project join or create a team during setup.
  • Lets each agent use a clear name inside the team.
  • Supports different delivery modes for real-time, between-turn, fallback, or manual message checks.
  • Lets one project switch between named roles, such as tech-lead or biz-analyst.
  • Uses local storage instead of a hosted messaging service.
  • Sends short handoffs such as review requests, file paths, commit SHAs, issue numbers, and status updates.
  • Connects peer agents instead of creating subagents.
  • Runs separately from MCP servers and MCP tool calls.
agmsg two monitor mode

Use Cases

  • Send a code review request from Claude Code to Codex.
  • Ask another agent to inspect a file path, issue number, or commit SHA.
  • Keep multiple Claude Code sessions in one local team.
  • Split planning, implementation, review, and analysis across different CLI agents.
  • Preserve short agent handoff messages across coding sessions.
  • Run multi-role sessions from one project, such as tech-lead and biz-analyst.
  • Keep local agent coordination separate from MCP tools and hosted automation platforms.

agmsg vs MCP, Subagents, and Message Queues

Comparisonagmsg
MCPagmsg is not an MCP server. It connects peer agent sessions through a local SQLite store.
Subagentsagmsg does not spawn child agents. It links separate agent sessions that already exist.
Message queueagmsg has no broker. SQLite acts as the shared message floor.
Multi-agent manageragmsg does not create isolated workspaces, previews, or PR dashboards. It only moves short messages between agents.

How To Use It

1. Install agmsg with the one-line installer.

    bash <(curl -fsSL https://raw.githubusercontent.com/fujibee/agmsg/main/setup.sh)

    2. Clone the repository first when you want to inspect the code before installation.

      git clone https://github.com/fujibee/agmsg.git
      cd agmsg
      ./install.sh

      3. Restart your CLI coding agent after installation. Claude Code, Codex, Gemini CLI, GitHub Copilot CLI, and Antigravity need a restart before they detect the new skill.

      4. Start agmsg inside your project.

        # Claude Code and GitHub Copilot CLI
        /agmsg
        # Codex, Gemini CLI, and Antigravity
        $agmsg

        5. Enter a team name and an agent name during the first run. The team name creates or joins a room. The agent name identifies the current session inside that room.

        6. Pick a delivery mode during the join flow. Claude Code defaults to monitor mode. Codex defaults to turn mode because it has no Monitor tool.

        7. Talk to your agent in natural language after registration.

          send alice a message saying the deploy is done
          check my messages
          who's on the team

          8. Use short messages for handoffs. Put large diffs, logs, transcripts, or generated files on disk, then send the path or commit SHA through agmsg.

          9. Add a stop condition when you let agents respond to each other. Use prompts such as stop after 5 exchanges or reply DONE when the review is complete.

          10. Use actas only when one workspace needs distinct roles.

            /agmsg actas tech-lead
            /agmsg actas biz-analyst
            /agmsg drop biz-analyst

            Delivery Modes

            ModeMechanismLatencyBest Use
            monitorSessionStart hook, Monitor tool, blocking SQLite stream.Around 5 seconds.Claude Code real-time delivery.
            turnStop hook runs check-inbox.sh between assistant turns.Next interaction.Codex, Copilot CLI, quieter Claude Code sessions.
            bothMonitor delivery with turn-end fallback.Around 5 seconds, with fallback.Claude Code sessions that need a safety net.
            offNo automatic delivery.Manual checks only.Minimal local setup.

            Use these commands to change or inspect delivery mode.

            /agmsg mode monitor
            /agmsg mode turn
            /agmsg mode both
            /agmsg mode off
            /agmsg mode

            monitor mode has one startup detail: the receiving agent must take at least one turn during the current session before it reacts to the first inbound message. A short message such as hi primes the session.

            Quick Reference

            Install Commands

            CommandPurpose
            bash <(curl -fsSL https://raw.githubusercontent.com/fujibee/agmsg/main/setup.sh)Run the one-line installer.
            git clone https://github.com/fujibee/agmsg.git && cd agmsg && ./install.shClone and install after inspection.
            ./install.shRun the interactive installer.
            ./install.sh --cmd mInstall with a custom command name.
            ./install.sh --agent-type geminiInstall a Gemini-oriented SKILL.md.

            The command name controls these paths and command forms.

            ItemResult
            Skill folder~/.agents/skills/<cmd>/
            Claude Code command/<cmd>
            Codex, Gemini CLI, and Antigravity command$<cmd>

            First-Run Commands

            AgentCommand
            Claude Code/agmsg
            GitHub Copilot CLI/agmsg
            Codex$agmsg
            Gemini CLI$agmsg
            Antigravity$agmsg

            Claude Code Commands

            CommandPurpose
            /agmsgCheck inbox across teams.
            /agmsg historyShow message history.
            /agmsg teamList team members.
            /agmsg send <agent> <message>Send a message to another agent.
            /agmsg mode <monitor|turn|both|off>Switch delivery mode.
            /agmsg modeShow current mode.
            /agmsg actas <name>Switch to another role in the project.
            /agmsg drop <name>Remove a role from the project.
            /agmsg hook onLegacy alias for mode turn.
            /agmsg hook offLegacy alias for mode off.
            /agmsg resetClear the current project registration.

            Shell Scripts

            ScriptPurpose
            send.sh <team> <from> <to> "<message>"Insert a message into the database.
            inbox.sh <team> <agent_id>Show unread messages and mark them as read.
            history.sh <team> [agent_id] [limit]Show message history.
            team.sh <team>List team members.
            whoami.sh <project_path> <type>Resolve the current identity.
            delivery.sh set <mode> <type> <project_path>Set the delivery mode.
            delivery.sh status [<type> <project_path>]Show delivery status.
            reset.sh <project_path> <type> [agent_id]Clear registration data.
            hook.sh onLegacy alias for turn delivery.
            hook.sh offLegacy alias for manual delivery.

            send.sh requires exactly four positional arguments.

            ~/.agents/skills/<cmd>/scripts/send.sh <team> <from> <to> "<message>"

            Quote the message as one shell argument.

            ~/.agents/skills/agmsg/scripts/send.sh myteam alice bob "review src/auth.ts before merge"

            Environment Variable

            VariableDefaultPurpose
            AGMSG_STORAGE_PATH<skill>/dbRelocates the SQLite message store directory.

            Run an isolated store with this form.

            AGMSG_STORAGE_PATH=/tmp/agmsg-sandbox ./scripts/send.sh myteam alice bob "hi"

            The override affects the SQLite store only. Team configs remain under the skill’s teams/ directory.

            Update Command

            cd agmsg
            git pull
            ./install.sh --update

            Updates preserve database and team configs.

            Uninstall Commands

            ./uninstall.sh
            ./uninstall.sh --yes
            ./uninstall.sh --keep-data

            The interactive uninstall asks for confirmation. The --yes option removes everything. The --keep-data option removes the skill while keeping the database and teams.

            Test Command

            bats tests/

            The test command requires bats-core.

            Alternatives and Related Tools

            Pros

            • Local SQLite storage.
            • No daemon.
            • No network service.
            • Agent Skill install.
            • Persistent message history.
            • Cross-agent rooms.

            Cons

            • CLI setup required.
            • Plain-text messages only.
            • Codex monitor unavailable.
            • Stop rules need prompts.
            • SQLite writer serialization.

            FAQs

            Q: Is agmsg an MCP server?
            A: No. agmsg is not MCP. It does not expose tools through the Model Context Protocol. It passes plain-text messages between peer CLI agent sessions through a local SQLite database.

            Q: Does agmsg create subagents?
            A: No. agmsg does not spawn child agents or manage background workers. You run the agents yourself, then agmsg lets those sessions message each other.

            Q: Does agmsg send data to the cloud?
            A: agmsg uses local filesystem access and a local SQLite database. Your connected agent may still send prompts, code context, or messages to its own model provider during normal operation.

            Q: Can agmsg handle large files or long outputs?
            A: No. agmsg messages are plain text. Save large outputs, diffs, logs, or artifacts to disk, then send a short message with the file path, commit SHA, or issue link.

            Q: Does agmsg preserve message history?
            A: Yes. Messages remain in the SQLite database after sessions end. The history.sh script can replay room history into a later session.

            Leave a Reply

            Your email address will not be published. Required fields are marked *

            Get the latest & top AI tools sent directly to your email.

            Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!