Skip to content

Commit af6df2c

Browse files
committed
feat: migrate Codex from deprecated custom prompts to Skills format
Codex CLI 0.117+ deprecated ~/.codex/prompts/ custom prompts. Migrate to the new Skills system at ~/.codex/skills/squad/SKILL.md with proper name/description frontmatter for $squad invocation.
1 parent 3852e65 commit af6df2c

File tree

3 files changed

+91
-25
lines changed

3 files changed

+91
-25
lines changed

Cargo.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "squad"
3-
version = "0.7.5"
3+
version = "0.7.6"
44
edition = "2021"
55
license = "MIT"
66
description = "Multi-AI-agent terminal collaboration via simple CLI commands"

src/setup.rs

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pub const PLATFORMS: &[Platform] = &[
2727
Platform {
2828
name: "codex",
2929
binary: "codex",
30-
command_path: ".codex/prompts/squad.md",
31-
content: SQUAD_MD_CONTENT,
30+
command_path: ".codex/skills/squad/SKILL.md",
31+
content: SQUAD_CODEX_CONTENT,
3232
},
3333
Platform {
3434
name: "opencode",
@@ -38,7 +38,73 @@ pub const PLATFORMS: &[Platform] = &[
3838
},
3939
];
4040

41-
/// Markdown format for Claude Code, Codex, OpenCode (uses $ARGUMENTS)
41+
/// Codex Skills format (uses $ARGUMENTS, placed in ~/.agents/skills/squad/SKILL.md)
42+
pub const SQUAD_CODEX_CONTENT: &str = r#"---
43+
name: squad
44+
description: Join squad multi-agent collaboration. Usage: $squad <role> [custom-id]
45+
---
46+
47+
You are joining a squad multi-agent collaboration team.
48+
49+
Your join arguments: $ARGUMENTS
50+
51+
**IMPORTANT:** Do NOT run `squad $ARGUMENTS` or treat the arguments as a CLI subcommand. Instead, follow the setup steps below.
52+
53+
## Phase 1: Setup (do this once)
54+
55+
1. Parse your join arguments above.
56+
57+
**If arguments are empty or missing:**
58+
Run `squad roles` to list available roles, then ask the user which role they want to join as. Do NOT proceed until the user picks a role.
59+
60+
**If arguments look like a role name** (1-2 words, e.g. "cto", "worker worker-2"):
61+
- First word is your role — this can be ANY string: "cto", "ceo", "manager", "reviewer", etc. It does NOT need to appear in `squad roles` (that list only shows predefined templates).
62+
- Optional second word is a custom agent ID
63+
- If no custom ID provided, use the role name as your ID
64+
- Examples: "manager" → id=manager, role=manager | "worker worker-2" → id=worker-2, role=worker | "cto" → id=cto, role=cto
65+
66+
**If arguments look like natural language** (e.g. "加入团队,作为管理员", "join as tech lead and review PRs"):
67+
- Extract the intended role from the text. Pick a short English role name (e.g. "manager", "reviewer", "cto").
68+
- Use that as your role and ID.
69+
- If no role can be inferred, ask the user to clarify.
70+
71+
2. Run `squad init` (safe to run — won't overwrite existing workspace).
72+
73+
3. **Clean up stale agents from previous sessions:**
74+
Run `squad agents` and check the output.
75+
- If ALL agents show "stale" (no active agents), tell the user stale squad state was detected and ask the user whether they want to reset squad state with `squad clean` followed by `squad init`. Do NOT clean automatically.
76+
- If some agents are active (a team is already running), skip cleanup and proceed.
77+
78+
4. Run `squad join <id> --role <role> --client __SQUAD_CLIENT__ --protocol-version __SQUAD_PROTOCOL_VERSION__` to register yourself.
79+
- Read the output line that says "Joined as ..." — that confirms your actual agent ID.
80+
- If the ID was taken, squad auto-assigns a suffixed ID (e.g. worker-2). Use that ID for all commands.
81+
- If role instructions are printed (=== Role Instructions ===), follow them.
82+
- If no predefined template exists, interpret the role using your own knowledge.
83+
84+
5. Run `squad agents` to see who else is on the team.
85+
86+
6. **If any squad command returns "Session replaced":** another terminal took your ID. Re-join with a different ID (e.g. `squad join worker-2 --role worker --client __SQUAD_CLIENT__ --protocol-version __SQUAD_PROTOCOL_VERSION__`).
87+
88+
## Phase 2: Enter Receive Mode (MANDATORY)
89+
90+
**Immediately after setup, run `squad receive <your-id> --wait` to start listening for messages.** Do NOT wait for the user to tell you — enter receive mode now.
91+
92+
After receiving a message:
93+
1. Execute the task or respond as appropriate for your role.
94+
2. Report results using `squad send` or `squad task` commands.
95+
3. Run `squad receive <your-id> --wait` again to wait for the next message.
96+
97+
If receive times out with no messages, run it again immediately.
98+
99+
Other useful commands:
100+
- `squad send <your-id> <to> "<message>"` — send a message (use @all to broadcast)
101+
- `squad task create <your-id> <to> --title "<title>"` — create a structured task
102+
- `squad agents` — see who is online
103+
- `squad pending` — check all unread messages
104+
- `squad history` — view message history
105+
"#;
106+
107+
/// Markdown format for Claude Code, OpenCode (uses $ARGUMENTS)
42108
pub const SQUAD_MD_CONTENT: &str = r#"---
43109
description: Join squad multi-agent collaboration. Usage: /squad <role> [custom-id]
44110
---

0 commit comments

Comments
 (0)