Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ CLI AI エージェント間のクロスエージェントメッセージング
# 1. インストール — npxが最速の道、クローン不要
npx agmsg

# 2. Claude Code / Codex / Gemini CLI / Antigravity / OpenCode を再起動して新しいスキルを反映
# 2. Claude Code / Codex / Gemini CLI / Qwen Code / Antigravity / OpenCode を再起動して新しいスキルを反映

# 3. コマンドを実行 — 初回はチーム名とエージェント名を尋ねられる
# Claude Code: /agmsg
# Codex: $agmsg
# Gemini CLI: $agmsg
# Antigravity: $agmsg
# OpenCode: $agmsg
# Qwen Code: /agmsg
```

これだけだ。スラッシュコマンドは初回使用時にチーム名とエージェント名を尋ね、続けて[配信モード](#配信モード)を選ばせる(Claude CodeとCodexのデフォルトは `monitor` — リアルタイムプッシュ。Codexはブリッジ経由で実現する)。その後は自然な言葉でエージェントに話しかければよい — 詳しくは下記の[初回実行](#初回実行)を参照。
Expand Down Expand Up @@ -110,6 +111,7 @@ cd agmsg
./install.sh --cmd m # カスタムコマンド名で非インタラクティブ
./install.sh --agent-type gemini # Gemini向けのSKILL.mdをインストール
./install.sh --agent-type opencode # OpenCode専用: 共有スキルをOpenCodeテンプレートに設定
./install.sh --agent-type qwen # Qwen専用: 共有スキルをQwenテンプレートに設定
```

**コマンド名**が決めるもの:
Expand All @@ -119,7 +121,7 @@ cd agmsg

`--cmd` と `--agent-type` は直接スクリプト経路でのみ利用可能。`npm` とプラグインの経路は常に `agmsg` としてインストールされ、ホストのエージェントタイプを自動検出する。

インストール後、**エージェントを再起動**して(Claude Code / Codex / Gemini CLI / Copilot CLI / Antigravity / OpenCode)新しいスキルを反映させる。
インストール後、**エージェントを再起動**して(Claude Code / Codex / Gemini CLI / Qwen Code / Copilot CLI / Antigravity / OpenCode)新しいスキルを反映させる。

### Windows: Git Bash と Codex

Expand Down Expand Up @@ -210,7 +212,7 @@ codex:
--dangerously-skip-permissions: false # `false`の値はフラグ自体を出力しない
```

9種類のエージェントタイプのうち8つがspawn可能 — `claude-code`、`codex`、`grok-build`、`cursor`、`gemini`、`antigravity`、`copilot`、`opencode`。`hermes` は不可 — そのCLIには初期プロンプトを事前に仕込んだインタラクティブセッションを開始するモードがない(#279)。macOSが主なターゲットで、LinuxとWindowsはベストエフォート(ターミナルが未対応の場合はissueまたはPRを歓迎)。ヘッドレス環境 — tmuxもなく使えるターミナルもない — はエージェントCLIがインタラクティブなターミナルを必要とするためエラーになる。
11種類のエージェントタイプのうち9つがspawn可能 — `claude-code`、`codex`、`grok-build`、`cursor`、`gemini`、`antigravity`、`copilot`、`opencode`、`qwen`。`hermes` と `agmsg-app` はspawn非対応。macOSが主なターゲットで、LinuxとWindowsはベストエフォート(ターミナルが未対応の場合はissueまたはPRを歓迎)。ヘッドレス環境 — tmuxもなく使えるターミナルもない — はエージェントCLIがインタラクティブなターミナルを必要とするためエラーになる。

### spawnしたエージェントを終了する(`despawn`)

Expand All @@ -234,7 +236,7 @@ despawnは指定されたメンバーにのみ作用する — `despawn` を実
| モード | 仕組み | レイテンシ | 向いている相手 |
|---|---|---|---|
| **`monitor`**(Claude Codeのデフォルト。OpenCodeではopencode-sentinel pluginで利用可能) | SessionStartフック → Monitorツール → ブロッキングSQLiteストリーム | 約5秒 | リアルタイムプッシュを望むClaude Codeユーザー |
| **`turn`**(Codex / Copilot CLI / OpenCode(plugin未導入)のデフォルト) | アシスタントのターン間でStopフックが `check-inbox.sh` を発火 | 次のやり取りまで | monitorを実行していないCodex / Copilot CLI / OpenCodeユーザー、より静かなループを好むClaude Codeユーザー |
| **`turn`**(Codex / Qwen / Copilot CLI / OpenCode(plugin未導入)のデフォルト) | アシスタントのターン間でStopフックが `check-inbox.sh` を発火 | 次のやり取りまで | monitorを実行していないCodex / Qwen / Copilot CLI / OpenCodeユーザー、より静かなループを好むClaude Codeユーザー |
| **`both`** | monitorを主に、turnをセッションごとの安全網として | 約5秒。ウォッチャー障害時はturn相当にフォールバック | 二重の保険をかけたい場合 |
| **`off`** | 自動配信なし | 手動の `/agmsg` のみ | ミニマリスト |

Expand Down Expand Up @@ -312,6 +314,15 @@ $agmsg

これによりOpenCodeは、Ollamaのようなローカルプロバイダーを使う構成を含め、ローカルのコーディングエージェントとして役立つ。

### Qwen Code

```
/agmsg
```

`~/.qwen/` が存在する場合、installerはQwen向けSkillを `~/.qwen/skills/` に配置する。Qwenは `mode turn` と `mode off` に対応し、`spawn qwen` は `qwen -i` を使うためboot prompt実行後もTUIが残る。Stop hook時点でメッセージがあればturnを継続できるが、すでにidleになったTUIを後着メッセージだけでwakeすることはできない。最初の仕事は `--boot-prompt` に含める。詳細は [docs/qwen.md](docs/qwen.md) を参照。


完全なセットアップ手順は [docs/opencode.md](docs/opencode.md) を参照。

### シェル(任意のエージェント)
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ In real use it looks like this — Claude Code asking Codex for a code review an
# 1. Install — npx is the fastest path, no clone needed
npx agmsg

# 2. Restart Claude Code / Codex / Gemini CLI / Antigravity / OpenCode to pick up the new skill
# 2. Restart Claude Code / Codex / Gemini CLI / Qwen Code / Antigravity / OpenCode to pick up the new skill

# 3. Run the command — it will prompt for team and agent name on first use
# Claude Code: /agmsg
# Codex: $agmsg
# Gemini CLI: $agmsg
# Antigravity: $agmsg
# OpenCode: $agmsg
# Qwen Code: /agmsg
```

That's it. The slash command prompts you for a team name and an agent name on first use, then asks you to pick a [delivery mode](#delivery-modes) (default on Claude Code and Codex: `monitor` — real-time push; Codex delivers it through a bridge). After that, you talk to your agent naturally — see [First run](#first-run) below.
Expand Down Expand Up @@ -110,6 +111,7 @@ cd agmsg
./install.sh --cmd m # Non-interactive with custom command name
./install.sh --agent-type gemini # Install a Gemini-oriented SKILL.md
./install.sh --agent-type opencode # OpenCode-only: sets shared skill to OpenCode template
./install.sh --agent-type qwen # Qwen-only: sets shared skill to Qwen template
```

The **command name** determines:
Expand All @@ -119,7 +121,7 @@ The **command name** determines:

`--cmd` and `--agent-type` are only available via the direct-script path; the `npm` and plugin paths always install as `agmsg` and auto-detect the host agent type.

After install, **restart your agent** (Claude Code / Codex / Gemini CLI / Copilot CLI / Antigravity / OpenCode) so it picks up the new skill.
After install, **restart your agent** (Claude Code / Codex / Gemini CLI / Qwen Code / Copilot CLI / Antigravity / OpenCode) so it picks up the new skill.

### Windows: Git Bash & Codex

Expand Down Expand Up @@ -211,7 +213,7 @@ codex:
--dangerously-skip-permissions: false # a `false` value suppresses the flag entirely
```

Eight of the nine agent types are spawnable — `claude-code`, `codex`, `grok-build`, `cursor`, `gemini`, `antigravity`, `copilot`, `opencode`. `hermes` is not: its CLI has no mode that starts an interactive session pre-seeded with an initial prompt (#279). macOS is the primary target; Linux and Windows are best-effort (please open an issue/PR if your terminal isn't handled). Headless environments — no tmux **and** no usable terminal — error out, since the agent CLIs need an interactive terminal.
Nine of the eleven agent types are spawnable — `claude-code`, `codex`, `grok-build`, `cursor`, `gemini`, `antigravity`, `copilot`, `opencode`, `qwen`. `hermes` and `agmsg-app` are not spawnable. macOS is the primary target; Linux and Windows are best-effort (please open an issue/PR if your terminal isn't handled). Headless environments — no tmux **and** no usable terminal — error out, since the agent CLIs need an interactive terminal.

### Tear down a spawned agent (`despawn`)

Expand Down Expand Up @@ -248,7 +250,7 @@ How incoming messages reach your agent. Pick one at first join via the prompt, o
| mode | mechanism | latency | who it's for |
|---|---|---|---|
| **`monitor`** (default on Claude Code; on OpenCode with the opencode-sentinel plugin) | SessionStart hook → Monitor tool → blocking SQLite stream | ~5s | Claude Code users wanting real-time push |
| **`turn`** (default on Codex / Copilot CLI / OpenCode without the plugin) | Stop hook fires `check-inbox.sh` between assistant turns | until your next interaction | Codex / Copilot CLI / OpenCode users not running monitor; Claude Code users on a quieter loop |
| **`turn`** (default on Codex / Qwen / Copilot CLI / OpenCode without the plugin) | Stop hook fires `check-inbox.sh` between assistant turns | until your next interaction | Codex / Qwen / Copilot CLI / OpenCode users not running monitor; Claude Code users on a quieter loop |
| **`both`** | monitor primary, turn as per-session safety net | ~5s; falls back to turn-end on watcher failure | belt-and-suspenders |
| **`off`** | no automatic delivery | manual `/agmsg` only | minimalists |

Expand Down Expand Up @@ -326,6 +328,15 @@ Install with `./install.sh` (when `~/.config/opencode/` exists, the OpenCode-typ

This makes OpenCode useful as a local coding agent, including configurations backed by local providers such as Ollama.

### Qwen Code

```
/agmsg
```

When `~/.qwen/` exists, the installer places a Qwen-typed skill under `~/.qwen/skills/`. Qwen supports `mode turn` and `mode off`; `spawn qwen` uses `qwen -i` so the boot prompt runs and the TUI stays open. Turn delivery can continue work when a message is present at the Stop hook, but it does not wake a TUI that was already idle when a later message arrived. Put the first task in `--boot-prompt`. See [docs/qwen.md](docs/qwen.md).


See [docs/opencode.md](docs/opencode.md) for full setup instructions.

### Shell (any agent)
Expand Down
2 changes: 1 addition & 1 deletion docs/agent-types.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Agent types

agmsg supports several agent runtimes — claude-code, codex, gemini, antigravity,
copilot, opencode, hermes, cursor — and each is described by a small **manifest** so that the rest
copilot, opencode, qwen, hermes, cursor — and each is described by a small **manifest** so that the rest
of agmsg (detection, the join whitelist, spawn, and delivery routing) discovers it
from data instead of hardcoded `case` arms.

Expand Down
129 changes: 129 additions & 0 deletions docs/qwen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Qwen Code

Qwen Code can join an agmsg team as a terminal peer. A useful first topology is
to keep Claude Code as the always-listening coordinator and start Qwen for
bounded implementation or research tasks.

## Before connecting it to agmsg

Start Qwen once on its own so authentication, the selected model, and the
approval policy are understood independently of messaging:

```powershell
cd C:\path\to\your\project
qwen
```

In the Qwen TUI:

1. Run `/auth`, select Alibaba ModelStudio, and select the plan attached to
your account.
2. Run `/model` and confirm the intended model.
3. Run `/approval-mode default` for normal interactive use.
4. Give it a read-only orientation task:

```text
Do not change files. Explain this repository's structure, main features,
and test commands.
```

Use `/plan` before a larger change, `/diff` before accepting edits,
`/compress` when the conversation becomes long, and `/recap` before ending
the session.

Resume the most recent session for the current project with:

```powershell
qwen -c
```

## Join an agmsg team

After agmsg has installed its Qwen-oriented skill, start Qwen in the project and
invoke:

```text
/agmsg
```

On first use:

1. Join the existing team or create a new one.
2. Choose a distinct role name such as `qwen-tui`.
3. Use `turn` delivery for the initial integration.

Useful commands:

```text
/agmsg
/agmsg team
/agmsg history
/agmsg send claude-desktop <message>
/agmsg mode turn
```

On Windows, agmsg scripts must use Git Bash, not the WindowsApps WSL `bash`
shim. A typical path is `C:\Program Files\Git\bin\bash.exe`.

## Start Qwen from Claude Code

Qwen's `--prompt-interactive` / `-i` option runs an initial prompt and then
keeps the TUI open. Once the Qwen driver is installed, Claude Code can use:

```text
/agmsg spawn qwen qwen-tui --boot-prompt "Inspect the issue, do not edit files,
and send a concise report to claude-desktop over agmsg."
```

For an implementation task, make ownership and completion explicit:

```text
You own <files or responsibility>. Other agents may be working in the repository;
do not revert their changes. Implement <bounded task>, run <checks>, then send
claude-desktop a summary containing changed paths, test results, and any
remaining risk. Stop after sending the report.
```

Claude Code is the recommended coordinator because its agmsg monitor can receive
the result while idle. Qwen is initially treated as a task worker:

1. Claude starts Qwen with the task in the boot prompt.
2. Qwen works in its own terminal.
3. Qwen sends its result to Claude through agmsg.
4. Claude reviews or assigns a follow-up.

## Idle-session limitation

`turn` delivery checks messages at Qwen lifecycle hooks. It does not by itself
turn an already-idle TUI into a new model turn when a message arrives later.
Therefore, do not rely on sending the first task to an idle Qwen session.

Prefer one of these:

- include the task in `spawn --boot-prompt`;
- type a short prompt in the existing Qwen TUI to trigger the next turn;
- use ACPX for a bounded non-interactive delegation when a persistent TUI is
unnecessary.

## Quota exhaustion

A Token Plan can reject a new run when its rolling quota is exhausted. The error
includes a reset timestamp. Treat that timestamp as the retry boundary:

- do not retry in a loop;
- preserve the task brief;
- continue token-free preparation or use another already-approved agent;
- retry once after the stated reset time.

Quota exhaustion after session creation confirms that the CLI and
authentication route were reached; it is not evidence that agmsg or the local
Qwen installation is broken.

## Safety defaults

- Keep `/approval-mode default` for ordinary work.
- Use `/plan` for read-only analysis before broad changes.
- Do not put API keys or plan credentials in an agmsg message, task brief, or
repository file.
- Check `/diff` and run the repository's normal tests before reporting done.
- Give every cross-agent task an explicit stop condition.
30 changes: 25 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ agmsg_source_version() {
CMD_NAME=""
UPDATE_ONLY=false
INTERACTIVE=true
AGENT_TYPE="" # claude-code, codex, gemini, antigravity — passed via --agent-type, or empty for auto/default
AGENT_TYPE="" # registered agent type passed via --agent-type, or empty for auto/default

configure_codex_sandbox() {
# --- Configure Codex sandbox (if Codex is installed) ---
Expand Down Expand Up @@ -180,7 +180,7 @@ while [[ $# -gt 0 ]]; do
echo "Options:"
echo " --cmd <name> Command & skill folder name (default: agmsg)"
echo " Claude Code: /<cmd>, Codex/Gemini/Antigravity: \$<cmd>"
echo " --agent-type <t> Agent type: claude-code, codex, gemini, antigravity, opencode, hermes, cursor, grok-build"
echo " --agent-type <t> Agent type: claude-code, codex, gemini, antigravity, opencode, qwen, hermes, cursor, grok-build"
echo " Selects which template becomes SKILL.md (matches the"
echo " <type> arg passed to join.sh / whoami.sh)"
echo " --update Update skill scripts only (preserve DB and teams)"
Expand Down Expand Up @@ -250,6 +250,8 @@ if [ "$UPDATE_ONLY" = true ]; then
AGENT_TYPE="antigravity"
elif grep -q "whoami.sh.*gemini" "$SKILL_DIR/SKILL.md" 2>/dev/null; then
AGENT_TYPE="gemini"
elif grep -q "whoami.sh.*qwen" "$SKILL_DIR/SKILL.md" 2>/dev/null; then
AGENT_TYPE="qwen"
elif grep -q "whoami.sh.*grok-build" "$SKILL_DIR/SKILL.md" 2>/dev/null; then
AGENT_TYPE="grok-build"
else
Expand All @@ -261,7 +263,7 @@ if [ "$UPDATE_ONLY" = true ]; then
# shared SKILL.md; their dedicated copies are dropped separately below.)
TPL_TYPE="codex"
case "$AGENT_TYPE" in
gemini|antigravity|opencode|hermes|cursor|grok-build) TPL_TYPE="$AGENT_TYPE" ;;
gemini|antigravity|opencode|qwen|hermes|cursor|grok-build) TPL_TYPE="$AGENT_TYPE" ;;
esac
sed "s/__SKILL_NAME__/$SKILL_NAME/g" "$(agmsg_type_template_path "$TPL_TYPE")" > "$SKILL_DIR/SKILL.md"
# Recursive copy so nested helper dirs (scripts/lib/, scripts/drivers/types/)
Expand Down Expand Up @@ -299,6 +301,13 @@ if [ "$UPDATE_ONLY" = true ]; then
mkdir -p "$OPENCODE_SKILL_DIR"
sed "s/__SKILL_NAME__/$SKILL_NAME/g" "$(agmsg_type_template_path opencode)" > "$OPENCODE_SKILL_DIR/SKILL.md"
fi
# Refresh / install the Qwen Code skill.
QWEN_SKILL_DIR="$HOME/.qwen/skills/$SKILL_NAME"
if [ -d "$HOME/.qwen" ]; then
mkdir -p "$QWEN_SKILL_DIR"
sed "s/__SKILL_NAME__/$SKILL_NAME/g" "$(agmsg_type_template_path qwen)" > "$QWEN_SKILL_DIR/SKILL.md"
fi

# Refresh / install the Hermes Agent skill (same reasoning as Copilot above).
HERMES_SKILL_DIR="$HOME/.hermes/skills/$SKILL_NAME"
if [ -d "$HOME/.hermes" ]; then
Expand Down Expand Up @@ -368,7 +377,7 @@ mkdir -p "$SKILL_DIR"/{scripts,types,db,agents}
# codex template by default; gemini/antigravity/opencode get their own.
TPL_TYPE="codex"
case "$AGENT_TYPE" in
gemini|antigravity|opencode|hermes|cursor|grok-build) TPL_TYPE="$AGENT_TYPE" ;;
gemini|antigravity|opencode|qwen|hermes|cursor|grok-build) TPL_TYPE="$AGENT_TYPE" ;;
esac
sed "s/__SKILL_NAME__/$CMD_NAME/g" "$(agmsg_type_template_path "$TPL_TYPE")" > "$SKILL_DIR/SKILL.md"
# Recursive copy so nested helper dirs (scripts/lib/, scripts/drivers/types/) ship
Expand Down Expand Up @@ -447,6 +456,16 @@ if [ -d "$HOME/.config/opencode" ]; then
echo " + installed \$$CMD_NAME skill to ~/.config/opencode/skills/"
fi

# --- Install Qwen Code skill ---
# Qwen loads personal skills from ~/.qwen/skills/<name>/SKILL.md. Keep this
# type-specific copy separate from the Codex-typed shared skill.
QWEN_SKILL_DIR="$HOME/.qwen/skills/$CMD_NAME"
if [ -d "$HOME/.qwen" ]; then
mkdir -p "$QWEN_SKILL_DIR"
sed "s/__SKILL_NAME__/$CMD_NAME/g" "$(agmsg_type_template_path qwen)" > "$QWEN_SKILL_DIR/SKILL.md"
echo " + installed /$CMD_NAME skill to ~/.qwen/skills/"
fi

# --- Install Hermes Agent skill ---
# Hermes reads skills from ~/.hermes/skills/<name>/SKILL.md. Runtime scripts and
# the shared SQLite store stay in ~/.agents/skills/<name>/ so Hermes shares the
Expand Down Expand Up @@ -483,11 +502,12 @@ echo ""
echo " ✓ Installed to ~/.agents/skills/$CMD_NAME/ (version $INSTALLED_VERSION)"
echo ""
echo " Next steps:"
echo " 1. Restart your agent (Claude Code / Codex / Gemini CLI / Antigravity / OpenCode) to pick up the new skill"
echo " 1. Restart your agent (Claude Code / Codex / Gemini CLI / Qwen Code / Antigravity / OpenCode) to pick up the new skill"
echo " 2. Run the command to join a team:"
echo " Claude Code: /$CMD_NAME"
echo " Codex: \$$CMD_NAME"
echo " Gemini CLI: \$$CMD_NAME"
echo " Qwen Code: /$CMD_NAME"
echo " Antigravity: \$$CMD_NAME"
echo " Copilot CLI: /$CMD_NAME"
echo " OpenCode: \$$CMD_NAME"
Expand Down
Loading
Loading