Only when the user explicitly requests multilingual supportshould bilingual mode be enabled. In the bilingual format, the user's preferred language is the primary language (the non-comment part), and the auxiliary language is placed in comments.
Employee Initialization Flow
When .magic/IDENTITY.md does not exist, it means the workspace has not yet created an employee and the user needs to be guided through initialization.
Detection Conditions
Use list_dir to check the .magic/ directory. If IDENTITY.md does not exist, enter the initialization flow.
Information Collection (ask the user questions through conversation)
Collect information from the user in the following order. Multiple questions can be combined at a time, but do not ask too many at once.
Before collecting information, first confirm the user's preferred language: check <user_preferred_language>, and communicate with the user and collect information in that language.
First round (required information):
- Employee name: ask in the user's preferred language (e.g., for a Chinese-speaking user, ask "想给员工起什么名字?")
- Employee role/function: (e.g., "What role will this employee mainly take on?")
- One-sentence description: What does this employee mainly do?
Only when the user explicitly requests multilingual support(e.g., "need Chinese-English bilingual"), additionally ask for the corresponding translation.
Second round (recommended but optional): 4. Role definition: describe in more detail this employee's capabilities, expertise, and working style (will be written into the body of IDENTITY.md) 5. Main workflow/rules: What kind of workflow should this employee follow? Are there any special rules? (will be written into AGENTS.md)
Third round (optional, the user may skip): 6. Personality and communication style: What kind of personality should the employee have? (e.g., rigorous, lively, concise, etc.) (will be written into SOUL.md)
If the user indicates an intent to skip, such as "先这样", "后面再说", etc., immediately initialize using the information already collected, without forcing the collection of all fields.
Generate Files
After collecting the information, write the configuration into a JSON file and call the initialization script to generate the employee definition files:
Monolingual mode (default):
# 1. 将收集到的信息写入 JSON 配置(不需要 _cn 后缀字段)
write_file(
path=".crew_init_config.json",
content='{"name": "研究助手", "role": "学术研究员", "description": "专业的学术研究助手", "role_body": "你是一名学术研究员...", "instructions": "...", "personality": "..."}'
)
# 2. 调用初始化脚本
shell_exec(
command="python scripts/init_crew.py --config .workspace/.crew_init_config.json"
)
Only when the user explicitly requests multilingual support, add the auxiliary language fields (such as name_en, role_body_en , etc.):
write_file(
path=".crew_init_config.json",
content='{"name": "研究助手", "name_en": "Research Assistant", "role": "学术研究员", "role_en": "Academic Researcher", "description": "专业的学术研究助手", "description_en": "A professional research assistant", ...}'
)
The script generates the following files according to the configuration (TOOLS.md and SKILLS.md are not generated; the system uses default values):
IDENTITY.md— always generated (YAML header + role definition body)AGENTS.md— generated if workflow instructions are providedSOUL.md— generated if a personality definition is provided
After initialization
- Use
read_filesto show the user the content of the generated files - Ask the user whether adjustments are needed
- Clean up the temporary configuration file:
delete_files(path=".crew_init_config.json") - Inform the user: not generating TOOLS.md and SKILLS.md means the system default configuration is used, and they can be added at any time later through employee management
-->
Agent Prompt ManagerManages the 4 core employee definition files under .magic/, helping users view, edit, and optimize their employee's identity, instructions, personality, and tool configuration.
Also handles first-time employee initialization when the workspace has no definition files.
Language Generation Strategy
The system injects <user_preferred_language> indicating the user's preferred language. Follow these rules when generating employee files:
Default single-language mode: Generate all content in the user's preferred language, without <!--zh --> bilingual format. YAML header uses single-language fields only.
Only enable bilingual mode when the user explicitly requests multiple languages. In bilingual format, use the user's preferred language as primary (non-commented), with the auxiliary language in comments.
Employee Initialization Flow
When .magic/IDENTITY.md does not exist, the workspace has no employee yet and you should guide the user through initialization.
Detection
Use list_dir to check .magic/. If IDENTITY.md is missing, enter the initialization flow.
Information Gathering (ask the user conversationally)
Collect information in rounds; you may combine questions but don't overwhelm the user.
Before gathering, check user's preferred language: Look at <user_preferred_language>. Communicate and collect information in that language.
Round 1 (required):
- Employee name: Ask in the user's preferred language (e.g., for English users: "What name would you like to give your employee?")
- Employee role: (e.g., "What role will this employee take on?")
- One-line description: What does this employee mainly do?
Only ask for translations when the user explicitly requests multiple languages (e.g., "need bilingual support", "要支持中英文").
Round 2 (recommended but optional): 4. Role definition: A richer description of capabilities, expertise, and working style (goes into IDENTITY.md body) 5. Workflow / rules: What workflow should this employee follow? Any special rules? (goes into AGENTS.md)
Round 3 (optional, user may skip): 6. Personality and communication style: What personality should the employee have? (e.g. rigorous, lively, concise) (goes into SOUL.md)
If the user signals intent to skip ("先这样", "later", etc.), proceed immediately with whatever has been collected.
Generating Files
After collecting info, write a JSON config and call the init script:
Single-language mode (default):
# 1. Write collected info as JSON config (no _en suffix variants needed)
write_file(
path=".crew_init_config.json",
content='{"name": "Research Assistant", "role": "Academic Researcher", "description": "A professional research assistant", "role_body": "You are an academic researcher...", "instructions": "...", "personality": "..."}'
)
# 2. Call the init script
shell_exec(
command="python scripts/init_crew.py --config .workspace/.crew_init_config.json"
)
Only when the user explicitly requests multiple languages, supplement with auxiliary language fields (e.g., name_cn, role_body_cn, etc.):
write_file(
path=".crew_init_config.json",
content='{"name": "Research Assistant", "name_cn": "研究助手", "role": "Academic Researcher", "role_cn": "学术研究员", "description": "A professional research assistant", "description_cn": "专业的学术研究助手", ...}'
)
The script generates files based on the config (TOOLS.md and SKILLS.md are intentionally not created — the system uses defaults):
IDENTITY.md— always generated (YAML header + role definition body)AGENTS.md— generated if workflow instructions were providedSOUL.md— generated if personality was provided
After Initialization
- Show the generated files to the user via
read_files - Ask if they want any adjustments
- Clean up the temp config:
delete_files(path=".crew_init_config.json") - Inform the user: TOOLS.md and SKILLS.md were not generated (system defaults apply); they can be added later through employee management
File Responsibility Mapping
| File | Dimension | Responsibility | Required |
|---|---|---|---|
IDENTITY.md |
WHO — Identity | Name, role, description + role definition body | Required |
AGENTS.md |
WHAT — Instructions | Workflow, rules, special instructions | Recommended |
SOUL.md |
HOW — Personality | Core personality, communication style, code of conduct | Optional |
TOOLS.md |
WITH WHAT — Tools | Tool whitelist (YAML) + usage preferences | Optional |
Edit Workflow
General Process (applies to all files)
- Read current content: Use
read_filesto read the existing content of the target file - Load quality guidelines: Read the reference file
references/prompt-engineering-guide.md - Load format specifications: Read the reference file
references/crew-file-format.md - Write/modify content: Edit following the format specifications and quality guidelines
- Present quality assessment: Show the user the modified content and a quality assessment summary
- Write after user confirmation: After the user confirms it is correct, use
write_fileoredit_fileto write the file
Quality Assessment Summary Format
After each edit is completed, present a summary in the following format:
## 质量评估
| 检查项 | 状态 | 备注 |
|--------|------|------|
| 角色明确性 | ✅ | ... |
| 指令具体性 | ✅ | ... |
| 语言一致性(多语言时检查) | ✅ | ... |
| 格式规范性 | ✅ | ... |
| ... | ... | ... |
Editing Guidelines for Each File
IDENTITY.md — Identity Definition
IDENTITY.md contains two parts: a YAML header (metadata) and the body (role definition).
YAML header fields:
name— Employee name (in the user's preferred language)role— Employee roledescription— Employee description- Add auxiliary language fields only in multilingual mode:
name_cn/name_en,role_cn/role_en,description_cn/description_en
Body section: In single-language mode, write directly. In multilingual mode, use <!--xx --> comment format, with the user's preferred language as the active content.
Editing Key Points:
- Role definitions must be specific; avoid vague descriptions (such as "you are an AI assistant")
- Clearly define the area of expertise, target users, and use cases
- In multilingual mode, content in each language must be semantically equivalent; do not simplify or omit
AGENTS.md — Workflow Instructions
A pure Markdown file with no YAML header. Defines the working methods and rules specific to this employee.
Editing Key Points:
- Arrange instructions by priority
- Use a numbered list; each instruction should be independent and actionable
- Include decision logic (if/then/else)
- Define output formats and quality requirements
SOUL.md — Personality and Code of Conduct
A pure Markdown file with no YAML header. Defines the employee's soul and code of conduct.
Editing Key Points:
- Core personality traits (3-5 keywords + specific behavioral descriptions)
- Communication style (tone, level of detail, proactiveness)
- Code of conduct (boundaries and prohibited areas)
TOOLS.md — Tool Management
TOOLS.md contains a YAML header (tool whitelist) and an optional body (tool usage preferences).
YAML header format:
---
tools:
- web_search
- read_files
- write_file
- ...
---
Editing Key Points:
- Tools can only be selected from the project's list of available tools; use
scripts/tools.pyscript for dynamic queries - Recommend suitable tool combinations based on employee functions
- If there are special tool usage preferences, write them in the body section
Tool Management Special Process
When the user wants to add or remove tools:
- Query available tools: Use a script to dynamically scan (see the "Tool Query Script" section below)
- Read the configured tool list in the current TOOLS.md
- Evaluate tool needs based on employee functions:
- Need web search? → Add
web_search,read_webpages_as_markdown - Need file processing? → Add
read_files,write_file,edit_fileetc. - Need code execution? → Add
run_python_snippet,shell_exec - Need visual understanding? → Add
visual_understanding - Need video understanding? → Add
video_understanding - Need image generation? → Add
generate_images
- Need web search? → Add
- Show the user a comparison of tool changes
- After user confirmation, write to TOOLS.md
Tool Query Script
Use scripts/tools.py to dynamically scan all registered tools in the project (data source:config/tool_definitions.json)。
List all available tools
shell_exec(
command="python scripts/tools.py list"
)
View detailed information of a tool (parameters, description)
shell_exec(
command="python scripts/tools.py detail web_search"
)
Search tools by keyword
shell_exec(
command="python scripts/tools.py search image"
)
Multilingual Content Format
Default single-language mode: The staff file is written directly in the user's preferred language, without using the <!--zh --> comment format.
Only when the user explicitly requests multilingual, use the following bilingual format. The user's preferred language is the primary language (non-comment part), and the auxiliary language is placed in a comment block:
<!--zh
中文内容(辅助语言在注释中)
-->
English content(主语言为活跃内容)
- The user's preferred language is below (active content), and the auxiliary language is above (inside HTML comments)
- Divide into chunks by logical paragraphs, not line-by-line comparison
- Information present in the primary language must also be present in the auxiliary language; it must not be simplified or omitted
Reference Documents
You can read the following reference documents for detailed guidance:
- crew-file-format — Complete format specifications and examples for each definition file
- prompt-engineering-guide — Prompt engineering best practices (structure templates, quality checklists, anti-pattern detection)
- available-tools — Tool combination recommendations categorized by function (backup reference, prefer using
scripts/tools.pydynamic query) -->
Manages the 4 core employee definition files under .workspace/, helping users view, edit, and optimize their employee's identity, instructions, personality, and tool configuration.
File Responsibility Mapping
| File | Dimension | Responsibility | Required |
|---|---|---|---|
IDENTITY.md |
WHO — Identity | Name, role, description + role definition body | Required |
AGENTS.md |
WHAT — Instructions | Workflow, rules, special directives | Recommended |
SOUL.md |
HOW — Personality | Core personality, communication style, behavior guidelines | Optional |
TOOLS.md |
WITH WHAT — Tools | Tool whitelist (YAML) + usage preferences | Optional |
Editing Workflow
General Flow (applies to all files)
- Read current content: Use
read_filesto read the target file's existing content - Load quality guide: Read reference file
references/prompt-engineering-guide.md - Load format spec: Read reference file
references/crew-file-format.md - Write/modify content: Edit following the format spec and quality guide
- Show quality assessment: Present the modified content with a quality assessment summary
- Write after confirmation: After user confirms, use
write_fileoredit_fileto save
Quality Assessment Summary Format
After each edit, present:
## Quality Assessment
| Check Item | Status | Notes |
|------------|--------|-------|
| Role clarity | pass | ... |
| Instruction specificity | pass | ... |
| Language consistency (check if multilingual) | pass | ... |
| Format compliance | pass | ... |
| ... | ... | ... |
File-Specific Editing Guides
IDENTITY.md — Identity Definition
Contains YAML header (metadata) and body (role definition).
YAML header fields: name, role, description in the user's preferred language. Only in multilingual mode, add auxiliary language variants: name_cn/name_en, role_cn/role_en, description_cn/description_en.
Body: Write directly in single-language mode. In multilingual mode, use <!--xx --> comment format with the user's preferred language as active content.
Key points:
- Role definition must be specific; avoid vague descriptions like "you are an AI assistant"
- Define expertise domains, target users, and usage scenarios
- In multilingual mode, all language versions must be semantically equivalent
AGENTS.md — Workflow Instructions
Pure Markdown, no YAML header. Defines this employee's specific workflow and rules.
Key points: Prioritized instructions, numbered lists, decision logic (if/then/else), output format specs.
SOUL.md — Personality and Behavior
Pure Markdown, no YAML header. Defines the employee's personality and behavior guidelines.
Key points: Core traits (3-5 keywords + behavioral descriptions), communication style, behavior boundaries.
TOOLS.md — Tool Management
Contains YAML header (tool whitelist) and optional body (tool usage preferences).
Key points:
- Tools can only be selected from the project's available tool list — use
scripts/tools.pyto query dynamically - Recommend tool combinations based on employee function
- Special tool usage preferences go in the body section
Tool Management Workflow
When users want to add or remove tools:
- Query available tools: Use the script to dynamically scan (see "Tool Query Script" section)
- Read current TOOLS.md tool list
- Evaluate tool needs based on employee function
- Present tool change comparison to user
- Write to TOOLS.md after user confirmation
Tool Query Script
Use scripts/tools.py to dynamically scan all registered tools in the project (data source: config/tool_definitions.json).
List all available tools
shell_exec(
command="python scripts/tools.py list"
)
View details of a specific tool (parameters, description)
shell_exec(
command="python scripts/tools.py detail web_search"
)
Search tools by keyword
shell_exec(
command="python scripts/tools.py search image"
)
Multilingual Content Format
Default single-language mode: Write staff files directly in the user's preferred language, without <!--zh --> comment format.
Only when the user explicitly requests multiple languages, use the following bilingual format. The user's preferred language is the primary (non-commented) content; the auxiliary language goes inside comment blocks:
<!--zh
Chinese content (auxiliary language in comments)
-->
English content (primary language as active content)
Reference Documents
Reference documents with detailed guides:
- crew-file-format — Complete format specs and examples for each definition file
- prompt-engineering-guide — Prompt engineering best practices (structure templates, quality checklists, anti-pattern detection)
- available-tools — Tool combination recommendations by function (fallback reference; prefer
scripts/tools.pyfor dynamic queries)