team-save
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese团队配置保存
Team Configuration Save
将当前运行中的团队配置保存为快照,写入项目目录的 ,供 复用。
.team-profiles//team-loadSave the configuration of the currently running team as a snapshot, which is written to in the project directory for reuse with .
.team-profiles//team-load与 team-init 自动保存的区别
Differences from team-init Auto-Save
| team-init 自动保存 | team-save 快照 | |
|---|---|---|
| 格式 | 模板格式(team_type + role 代号) | 快照格式(完整 prompt) |
| 内容 | 初始配置,引用角色定义文件 | 当前实际状态,自包含 |
| 用途 | 从角色模板重建团队 | 精确还原修改过的团队 |
| 标识 | | |
| team-init Auto-Save | team-save Snapshot | |
|---|---|---|
| Format | Template format (team_type + role code) | Snapshot format (full prompt) |
| Content | Initial configuration, references role definition files | Current actual state, self-contained |
| Purpose | Reconstruct team from role templates | Precisely restore modified teams |
| Identifier | | |
保存流程
Save Process
步骤 1: 确定要保存的团队
Step 1: Identify the Team to Save
如果 的第一个参数非空,使用它作为团队名称。
否则,扫描 目录,列出现有团队供用户选择。
$ARGUMENTS~/.claude/teams/如果目录不存在或为空,输出友好提示后结束:
当前没有运行中的团队。
- 使用 /team-init 创建新团队如果有团队,列出供用户选择:
AskUserQuestion:
question: "选择要保存的团队"
header: "选择团队"
options:
- label: "{team_name_1}"
description: "{description_1}"
- label: "{team_name_2}"
description: "{description_2}"
# ... 最多 4 个
multiSelect: falseIf the first parameter of is not empty, use it as the team name.
Otherwise, scan the directory and list existing teams for the user to select.
$ARGUMENTS~/.claude/teams/If the directory does not exist or is empty, output a friendly prompt and exit:
There are no running teams currently.
- Use /team-init to create a new teamIf there are teams, list them for selection:
AskUserQuestion:
question: "Select the team to save"
header: "Select Team"
options:
- label: "{team_name_1}"
description: "{description_1}"
- label: "{team_name_2}"
description: "{description_2}"
# ... up to 4
multiSelect: false步骤 2: 读取团队配置
Step 2: Read Team Configuration
读取 ,提取:
~/.claude/teams/{team_name}/config.json- : 团队名称
name - : 团队描述
description - : 成员列表,每个成员提取:
members[]- : 成员名称
name - : agent 类型
agentType - : 完整 prompt(如果有)
prompt - : 模型
model - : 如果为 true 则 mode 为 "plan",否则为 "bypassPermissions"
planModeRequired - : 工作目录
cwd - : 颜色标识
color
提取 team_type:
尝试从以下来源推断团队类型(按优先级):
- 检查项目目录 下是否有同名的 template 格式配置文件,如果有则读取其
.team-profiles/team_type - 从成员 prompt 中的 块提取
<project_context>字段团队类型: - 从 description 中匹配关键词("软件开发"→dev, "测试"→testing, "逆向"→reverse, "调试"→debug, "安全"→security, "CTF"→ctf, "运维"→ops, "讨论"→discuss)
- 以上都无法确定则设为空字符串
过滤规则:
- 跳过 的成员(team-lead 由系统自动创建,不需要保存 prompt)
agentType: "team-lead" - 只保存有 字段的成员
prompt
Read and extract:
~/.claude/teams/{team_name}/config.json- : Team name
name - : Team description
description - : List of members, extract the following for each member:
members[]- : Member name
name - : Agent type
agentType - : Full prompt (if available)
prompt - : Model
model - : If true, mode is "plan"; otherwise, "bypassPermissions"
planModeRequired - : Working directory
cwd - : Color identifier
color
Extract team_type:
Attempt to infer the team type from the following sources (in priority order):
- Check if there is a template-format configuration file with the same name in the project directory's ; if so, read its
.team-profiles/team_type - Extract the field from the
团队类型:block in the member prompt<project_context> - Match keywords from the description ("软件开发"→dev, "测试"→testing, "逆向"→reverse, "调试"→debug, "安全"→security, "CTF"→ctf, "运维"→ops, "讨论"→discuss)
- If none of the above can determine it, set it to an empty string
Filter Rules:
- Skip members with (team-lead is automatically created by the system, no need to save the prompt)
agentType: "team-lead" - Only save members with the field
prompt
步骤 2.5: 采集任务进度
Step 2.5: Collect Task Progress
使用 TaskList 工具获取当前团队的所有任务。对每个任务使用 TaskGet 获取完整信息。
提取每个任务的:
- : 任务 ID(仅用于记录依赖关系,加载时会重新分配)
id - : 任务标题
subject - : 详细描述
description - : 进行时描述
activeForm - : 状态(pending / in_progress / completed)
status - : 负责人名称(对应成员的 name)
owner - : 依赖的任务 ID 列表
blockedBy
注意:如果 TaskList 返回为空(没有任务),则 段为空数组,这是正常的。
tasksUse the TaskList tool to get all tasks of the current team. Use TaskGet to obtain complete information for each task.
Extract the following for each task:
- : Task ID (only used to record dependencies, will be reassigned during loading)
id - : Task title
subject - : Detailed description
description - : In-progress description
activeForm - : Status (pending / in_progress / completed)
status - : Owner name (corresponds to the member's name)
owner - : List of dependent task IDs
blockedBy
Note: If TaskList returns empty (no tasks), the section will be an empty array, which is normal.
tasks步骤 3: 确定保存名称
Step 3: Determine Save Name
如果 的第二个参数非空,使用它作为保存名称。
否则默认使用团队名称。
$ARGUMENTSAskUserQuestion:
question: "保存配置的名称?(将保存到 .team-profiles/{name}.yaml)"
header: "保存名称"
options:
- label: "{team_name}"
description: "使用团队名称"
- label: "自定义名称"
description: "在「其他」中输入"
multiSelect: falseIf the second parameter of is not empty, use it as the save name.
Otherwise, use the team name by default.
$ARGUMENTSAskUserQuestion:
question: "Name for saving the configuration? (Will be saved to .team-profiles/{name}.yaml)"
header: "Save Name"
options:
- label: "{team_name}"
description: "Use team name"
- label: "Custom name"
description: "Enter in 'Other'"
multiSelect: false步骤 4: 展示摘要并确认
Step 4: Display Summary and Confirm
团队快照摘要
--------------------
团队名称: {team_name}
团队类型: {team_type_name}(如果有)
团队描述: {description}
工作目录: {cwd}
成员列表 ({N} 个):
- {member_name} ({agentType}) [{model}]
- ...
任务进度 ({M} 个):
- [completed] #{id} {subject} → {owner}
- [in_progress] #{id} {subject} → {owner}
- [pending] #{id} {subject} → {owner 或 "未分配"}
...
保存到: .team-profiles/{save_name}.yaml
--------------------AskUserQuestion:
question: "确认保存?"
header: "确认"
options:
- label: "保存"
description: "保存团队快照"
- label: "取消"
description: "放弃保存"
multiSelect: falseTeam Snapshot Summary
--------------------
Team Name: {team_name}
Team Type: {team_type_name} (if available)
Team Description: {description}
Working Directory: {cwd}
Member List ({N} members):
- {member_name} ({agentType}) [{model}]
- ...
Task Progress ({M} tasks):
- [completed] #{id} {subject} → {owner}
- [in_progress] #{id} {subject} → {owner}
- [pending] #{id} {subject} → {owner or "Unassigned"}
...
Save to: .team-profiles/{save_name}.yaml
--------------------AskUserQuestion:
question: "Confirm save?"
header: "Confirmation"
options:
- label: "Save"
description: "Save team snapshot"
- label: "Cancel"
description: "Abandon save"
multiSelect: false步骤 5: 写入配置文件
Step 5: Write Configuration File
确保目录存在:
使用 Bash 工具执行:
bash
mkdir -p "{当前工作目录}/.team-profiles"覆盖保护:如果 已存在:
.team-profiles/{save_name}.yaml- 读取旧文件,提取成员数和任务数
- 在确认步骤中显示差异摘要:
⚠ 文件已存在,将覆盖: 旧配置: {old_member_count} 个成员, {old_task_count} 个任务 新配置: {new_member_count} 个成员, {new_task_count} 个任务 旧文件将备份为: .team-profiles/{save_name}.yaml.bak - 写入前将旧文件重命名为 (使用 Bash:
.team-profiles/{save_name}.yaml.bak命令)mv - 如果 文件也已存在,直接覆盖
.bak.bak
使用 Write 工具创建 :
.team-profiles/{save_name}.yamlyaml
undefinedEnsure directory exists:
Execute using the Bash tool:
bash
mkdir -p "{current working directory}/.team-profiles"Overwrite Protection: If already exists:
.team-profiles/{save_name}.yaml- Read the old file and extract the number of members and tasks
- Display a difference summary in the confirmation step:
⚠ File already exists, will overwrite: Old configuration: {old_member_count} members, {old_task_count} tasks New configuration: {new_member_count} members, {new_task_count} tasks Old file will be backed up as: .team-profiles/{save_name}.yaml.bak - Rename the old file to before writing (use Bash:
.team-profiles/{save_name}.yaml.bakcommand)mv - If the file also exists, directly overwrite the
.bak.bak
Use the Write tool to create :
.team-profiles/{save_name}.yamlyaml
undefined团队快照 - 由 /team-save 保存
Team Snapshot - Saved by /team-save
使用 /team-load {save_name} 可直接加载此配置创建团队
Use /team-load {save_name} to directly load this configuration to create a team
保存时间: {ISO 8601 时间戳}
Save Time: {ISO 8601 timestamp}
format: snapshot
name: "{team_name}"
description: "{description}"
team_type: "{team_type}" # 如果能从成员 prompt 中提取到则填写,否则为空字符串
team_type_name: "{team_type_name}" # 同上
members:
-
name: "{member_name}" agent_type: "{agentType}" model: "{model}" mode: "{mode}" # bypassPermissions / plan / default,默认 bypassPermissions cwd: "{cwd}" color: "{color}" prompt: | {完整的 prompt 内容,使用 YAML 多行字符串}
-
name: "{member_name_2}" agent_type: "{agentType}" model: "{model}" mode: "{mode}" cwd: "{cwd}" color: "{color}" prompt: | {完整的 prompt 内容}
... 所有非 team-lead 成员
tasks:
-
original_id: "{原始任务 ID,仅用于依赖关系映射}" subject: "{任务标题}" description: | {任务详细描述} active_form: "{进行时描述}" status: "{pending / in_progress / completed}" owner: "{负责人名称,对应 members 中的 name,空字符串表示未分配}" blocked_by: ["{依赖的 original_id}", ...] # 空数组表示无依赖
-
original_id: "2" subject: "..." description: | ... active_form: "..." status: "pending" owner: "" blocked_by: ["1"]
... 所有任务(包括已完成的,用于记录完整历史)
undefinedformat: snapshot
name: "{team_name}"
description: "{description}"
team_type: "{team_type}" # Fill if extractable from member prompt, otherwise empty string
team_type_name: "{team_type_name}" # Same as above
members:
-
name: "{member_name}" agent_type: "{agentType}" model: "{model}" mode: "{mode}" # bypassPermissions / plan / default, default is bypassPermissions cwd: "{cwd}" color: "{color}" prompt: | {full prompt content, using YAML multi-line string}
-
name: "{member_name_2}" agent_type: "{agentType}" model: "{model}" mode: "{mode}" cwd: "{cwd}" color: "{color}" prompt: | {full prompt content}
... All non team-lead members
tasks:
-
original_id: "{original task ID, only used for dependency mapping}" subject: "{task title}" description: | {detailed task description} active_form: "{in-progress description}" status: "{pending / in_progress / completed}" owner: "{owner name, corresponds to name in members, empty string means unassigned}" blocked_by: ["{dependent original_id}", ...] # Empty array means no dependencies
-
original_id: "2" subject: "..." description: | ... active_form: "..." status: "pending" owner: "" blocked_by: ["1"]
... All tasks (including completed ones, to record full history)
undefined步骤 6: 输出结果
Step 6: Output Result
团队快照已保存到: .team-profiles/{save_name}.yaml
包含 {N} 个成员配置(不含 team-lead)、{M} 个任务记录。
使用 /team-load {save_name} 可直接加载此团队。Team snapshot saved to: .team-profiles/{save_name}.yaml
Contains configuration for {N} members (excluding team-lead) and {M} task records.
Use /team-load {save_name} to directly load this team.注意事项
Notes
- prompt 可能很长(几百行),使用 YAML 多行字符串格式保存
| - 大文件写入策略:snapshot 文件可能超过 150 行(Write 工具单次上限)。应先用 Write 写入文件头部和前几个成员(约 100-120 行),再用 Edit 工具追加剩余成员和 tasks 段
- 如果目标文件已存在,自动备份为 后再覆盖,并在确认步骤中显示差异摘要
.bak - team-lead 不保存 prompt,因为加载时由系统自动创建
- cwd 路径保存绝对路径,加载时可由用户覆盖
- color 字段:仅作记录保留,Task tool 不支持设置颜色,加载时不生效
- 任务的 original_id 仅用于保存时记录依赖关系,加载时会重新分配新 ID 并映射依赖
- 已完成的任务也会保存,加载时直接标记为 completed,让团队知道哪些工作已经做过
- mode 检测局限:config.json 中只有 布尔值,
planModeRequired统一映射为 "bypassPermissions",无法区分原始创建时使用的是 "default" 还是 "bypassPermissions"。如需精确保留 "default" 模式,需在加载后手动编辑 snapshot 文件false
- Prompts may be very long (hundreds of lines), use YAML multi-line string format for saving
| - Large File Writing Strategy: Snapshot files may exceed 150 lines (single limit of the Write tool). First use Write to write the file header and first few members (about 100-120 lines), then use the Edit tool to append the remaining members and tasks section
- If the target file already exists, automatically back it up as before overwriting, and display a difference summary in the confirmation step
.bak - Do not save the prompt for team-lead, as it is automatically created by the system during loading
- Save the absolute path for cwd, which can be overwritten by the user during loading
- Color Field: Only retained for records, the Task tool does not support setting colors, so it will not take effect during loading
- The original_id of tasks is only used to record dependencies during saving; new IDs will be reassigned during loading and dependencies will be mapped
- Completed tasks are also saved, and will be marked as completed directly during loading so the team knows which work has been done
- Mode Detection Limitation: The config.json only has the boolean value;
planModeRequiredis uniformly mapped to "bypassPermissions", and it is impossible to distinguish whether "default" or "bypassPermissions" was used during original creation. To precisely retain the "default" mode, manually edit the snapshot file after loadingfalse