magents

io.github.abnegate由 GitHub 帳號 abnegate 發布v0.14.2更新於 Oct 25, 2026

Shared session bus for Claude, Codex, Copilot, Cursor, Gemini, AGY, Grok, and OpenCode.

概覽

AI 產生的概覽

一個本機 MCP 伺服器兼命令列工具,讓一個編碼代理讀取、搜尋、傳訊息並交接給同一台機器上其他代理的 session。

可以做什麼
列出並查找各支援編碼代理的即時與近期 session,可依目錄或分支篩選,讀取精簡逐字稿或摘要,包括其他 session 改動的檔案以及目前連線身分。跨逐字稿全文搜尋,並搜尋、讀取和寫入 Claude、Codex 或 Grok 的記憶筆記,另有依工作目錄共用的草稿筆記。向既有對話傳送使用者訊息,把目前 session 交接進另一個即時對話,並透過信箱收發回覆、等待與確認。為獨立任務啟動新的無頭持久 session,自帶提示詞和工作目錄,並可停止受監管的 session。收集並追蹤學習狀態。
適用情境
適合經常同時執行多個編碼代理(Claude、Codex、Copilot、Cursor、Gemini、Grok、OpenCode 等)且在視窗之間遺失情境的情況:可讓一個代理接續另一個的工作、向指定即時對話傳訊息,或為獨立任務啟動隔離 session。
執行需求
以本機程序執行,需 macOS 或 Linux(Claude 即時注入僅限 Unix);透過 Homebrew、APT、發行版二進位檔、容器或 Cargo 安裝 magents,再向各宿主註冊 MCP 伺服器。它讀取磁碟上各代理自己的 session 儲存,因此這些宿主需已安裝並有 session 紀錄。未宣告 API 金鑰或環境變數。
安裝前請注意
它會讀取本機代理逐字稿和記憶檔案,並可寫入 Claude、Codex 或 Grok 的第一方記憶及共用筆記。它能向即時對話傳訊息、交接 session 並啟動會操作你檔案的新代理 session,使用前請確認目標。被啟動的代理沿用宿主原生審批策略;伺服器聲明不加入任何審批繞過。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 magents,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[magents shared session bus across Claude, Codex, Grok, and Cursor]

[HOL Trust]

Claude Code, Codex, Copilot, Cursor, Gemini, AGY, Grok, and OpenCode already keep transcripts on disk. magents is the shared API over those sessions - an MCP server plus a small CLI - so one agent can pick up where another left off without you recapping, ping a specific live chat when you are not sitting in the middle, or start an independent persisted chat for a complete task.

It is not a second copy of history and not a fire-and-forget council. Existing chats stay the default unit of work; new chats are for independent work that benefits from its own session and working directory.

Install · Plugins · What you can do · Quick start · Tools · CLI · Releases

Why

You already run more than one coding agent. The pain is not "more models" - it is context trapped in another window.

PainWhat magents does
You switched hosts mid-taskRead the live session and continue here
Agent A hit a wall Agent B ownsInject into that live chat without you as the messenger
A subtask can run aloneSpawn a headless persisted session with a complete prompt + reply path

What you can do

1. Handoff without a new thread
You were in Claude on the disaster-recovery branch. Now you are in Grok. Ask Grok what they were doing; it reads the live session and continues. No paste buffer. No "new chat, here's the context."

2. Send when you are not the messenger
Three agents running. Claude hits a wall Codex owns. Claude injects into that Codex thread and keeps going - especially useful when the sender already has the failing query, file, and constraint you would otherwise reconstruct.

3. Spawn independent work
When a task can proceed alone, start a new headless persisted session with a complete prompt, an isolated working directory when files could collide, and a request to reply through magents. Spawned agents keep their host's native approval policy - spawning does not add an approval bypass.

Install

Homebrew (macOS / Linux)

bash
brew install abnegate/tap/magentsmagents install --all

APT (Debian / Ubuntu)

bash
curl -fsSL https://abnegate.github.io/apt-repo/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/abnegate.gpgecho "deb [signed-by=/usr/share/keyrings/abnegate.gpg] https://abnegate.github.io/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/abnegate.listsudo apt update && sudo apt install magentsmagents install --all

Binary

From Releases:

bash
curl -LSsf -o magents \  "https://github.com/abnegate/magents/releases/latest/download/magents-$(uname -m | sed 's/arm64/aarch64/')-$(uname -s | tr 'A-Z' 'a-z' | sed 's/darwin/apple-darwin/;s/linux/unknown-linux-musl/')"chmod +x magents./magents install --all

Assets: magents-x86_64-unknown-linux-musl, magents-aarch64-unknown-linux-musl, magents-aarch64-apple-darwin, magents-x86_64-apple-darwin.

Container

bash
docker pull ghcr.io/abnegate/magents:latestdocker run --rm --user "$(id -u):$(id -g)" \  -v "$HOME:$HOME" -e HOME \  ghcr.io/abnegate/magents list --live

Cargo

bash
cargo install magents --lockedmagents install --all

From source

bash
cargo install --path .magents install --all

Plugins

Host plugins package the magents skill plus an MCP entry that runs magents mcp. Install the CLI first (brew install abnegate/tap/magents), then load the matching folder under plugins/.

HostPath
Claude Codeplugins/claude
Codexplugins/codex
Cursorplugins/cursor
Gemini CLIrepo root (gemini-extension.json)
AGY CLI / Antigravityplugins/agy

Gemini CLI installs the extension straight from this repository:

bash
gemini extensions install https://github.com/abnegate/magents

AGY CLI installs the plugin from plugins/agy (manifest, MCP, and skills):

bash
agy plugin install https://github.com/abnegate/magents/plugins/agy

Details and marketplace notes: plugins/README.md.

Quick start

magents install --all registers the stdio MCP server with each installed host, skipping hosts whose required binaries are unavailable:

  • Grok (grok mcp add magents -- magents mcp)
  • Claude Code (claude mcp add --scope user magents -- magents mcp)
  • Codex (codex mcp add magents -- magents mcp)
  • Cursor (~/.cursor/mcp.json)
  • OpenCode ($XDG_CONFIG_HOME/opencode/opencode.json, default ~/.config/opencode)
  • Gemini CLI (gemini mcp add -s user magents magents mcp)
  • GitHub Copilot CLI (copilot mcp add magents -- magents mcp)
  • AGY CLI (agy mcp add magents magents mcp)

It also writes the magents and learn skills under supported hosts' skills directories (~/.grok/skills/{magents,learn}, ~/.claude/skills/{magents,learn}, ~/.cursor/skills/{magents,learn}, and the OpenCode / Gemini / AGY / Copilot equivalents). /learn reads every local agent's sessions, not only Grok.

For Grok and Codex only, point a host at the binary yourself:

toml
[mcp_servers.magents]command = "/path/to/magents"args = ["mcp"]

For Cline, open MCP Servers → Configure MCP Servers and add this to cline_mcp_settings.json:

json
{  "mcpServers": {    "magents": {      "command": "magents",      "args": ["mcp"]    }  }}

Restart the agent session (or refresh /mcps) so the tools appear.

Try:

bash
magents list --livemagents digest grok:latestmagents handoff grok:latest --reason "continuing in grok"

Tools

ToolPurpose
list_sessionsLive and recent sessions; filter by cwd / branch
get_sessionLookup by id, title, live name, pid, or agent:ref
read_transcriptCompact inert handoff (last request, last action, recent turns)
search_transcriptsFull-text search across those transcripts
search_memoriesPhrase search over Claude / Codex / Grok memory markdown
create_memoryWrite a note into Claude / Codex / Grok first-party memory
spawn_sessionStart a new headless persisted session for independent work
send_messageDeliver a user turn to an existing chat
handoffCompact this session and inject it into another live chat
inbox / ack / await_reply / replyMailbox for cross-session replies
session_digestCompact last request / action / cwd / branch / clipped turns
files_touchedPaths another session edited
stop_sessionStop a magents-supervised spawn or resume
read_memoryRead one Claude / Codex / Grok memory markdown file
get_note / put_noteMagents-owned shared scratch for a working directory
whoamiDetect this connection; resolve session via env, socket, or unique cwd
learn_collectCollect compact records from every local agent's full history for /learn, or estimate a run
learn_stateRead or update /learn state, decisions, and trash

Refs can be prefixed: claude:disaster recovery, grok:latest, codex:<uuid>, cursor:latest, opencode:<id>, gemini:latest, agy:<id>, copilot:<id>.

CLI

bash
magents list --livemagents list --agent grok --query edgemagents get 'claude:disaster recovery'magents read grok:latest -n 20magents digest grok:latestmagents search "dedicated databases" --agent claudemagents spawn codex --prompt-file /path/to/task.md --cwd /path/to/isolated-worktreemagents send grok:latest "handoff: the DR runbook is in docs/RUNBOOK.md"magents handoff grok:latest --reason "continuing in grok"magents whoamimagents learn estimatemagents learn collectmagents learn planmagents learn collect --since-lastmagents learn state

Pass --output json on any command for stable machine-readable stdout.

magents with no args on a piped stdin starts the MCP server.

magents spawn reads the complete task from stdin by default (--prompt-file supported). Prompt text is never a process argument.

How sessions talk

list_sessions / read_transcript / search_transcripts / search_memories are the handoff. create_memory writes into another harness's first-party memory (Claude, Codex, or Grok).

Choose the write path by where the work should happen:

  • spawn_session - new, headless, persisted, independent session. Complete task, verification, reply-through-magents, isolated cwd when edits could collide. Success means launch accepted (accepted: true, status: "starting"), not that the task finished.
  • send_message - existing session. Always records mailbox mail; injects a live user turn where the host supports one.
  • handoff - compact this session into an existing live session so that session continues the same work.

Delivery routes (existing chats)

send_message always appends to the mailbox, then prefers a native live path and otherwise starts a supervised headless resume:

SurfaceDelivery route
Claude DesktopUDS user turn (/tmp/cc-socks/<pid>.sock), then tmux or supervised claude -p --verbose --resume <id>
Claude CLIUDS when available, then tmux or supervised resume
GrokSupervised grok --cwd <cwd> --resume <id> --output-format streaming-json --prompt-file /dev/stdin
Codex Desktop / VS CodeLength-prefixed JSON-RPC on ~/.codex/ipc/ipc.sock, then supervised codex exec ... resume
Codex CLISupervised codex exec --json -C <cwd> resume <id> -
CursorSupervised cursor-agent -p --output-format stream-json --resume <id> --workspace <cwd>
OpenCodeSupervised opencode run --format json --session <id>, started in the session cwd (with PWD set)
Gemini CLISupervised gemini --resume <id> --output-format stream-json
AGY CLI / AntigravitySupervised agy --input-format stream-json --output-format stream-json --conversation <id>
GitHub Copilot CLISupervised copilot --resume=<id> --output-format json

Supervised routes pass the user turn through stdin and do not expose transcript text, tokens, or raw host output in the response. Spawn never adds approval bypasses (--dangerously-skip-permissions, --yolo, --full-auto, etc.).

Session discovery sources: Claude ~/.claude and ~/.claude-* (plus Desktop Claude / Claude-* session dirs), Grok ~/.grok/active_sessions.json, Codex sqlite + rollout JSONL, Cursor agent-transcripts, OpenCode SQLite (opencode.db and channel databases, v1 session and v2 session_v2 / session_message tables), Gemini journals, AGY CLI conversations / brain plus Antigravity desktop conversation_summaries, Copilot session-state. Claude sessions include a profile field when they come from a named home (work for ~/.claude-work). Resume and live inject use that home's CLAUDE_CONFIG_DIR.

Tests

bash
cargo test --locked --all-targetscargo llvm-cov --locked --all-targets --ignore-filename-regex 'src/main.rs|/rustlib/' --fail-under-lines 98

CI runs format, clippy (-D warnings), the full test suite, and a 98% line-coverage gate.

Requirements

  • Rust 1.97+
  • macOS or Linux (Claude UDS inject is Unix-only)

License

MIT

來源:README.md,提交 6a9c7c6

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

5
  1. v0.14.2最新Oct 15, 2026
  2. v0.14.1Oct 14, 2026
  3. v0.13.2Oct 13, 2026
  4. v0.12.0Sep 22, 2026
  5. v0.11.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分