start
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStart Session
启动会话
Initialize your AI development session and begin working on tasks.
初始化你的AI开发会话并开始处理任务。
Operation Types
操作类型
| Marker | Meaning | Executor |
|---|---|---|
| Bash scripts or Task calls executed by AI | You (AI) |
| Slash commands executed by user | User |
| 标记 | 含义 | 执行者 |
|---|---|---|
| 由AI执行的Bash脚本或Task调用 | 你(AI) |
| 用户执行的斜杠命令 | 用户 |
Initialization [AI]
[AI]初始化 [AI]
[AI]Step 1: Understand Development Workflow
步骤1:理解开发工作流
First, read the workflow guide to understand the development process:
bash
cat .trellis/workflow.mdFollow the instructions in workflow.md - it contains:
- Core principles (Read Before Write, Follow Standards, etc.)
- File system structure
- Development process
- Best practices
首先,阅读工作流指南以了解开发流程:
bash
cat .trellis/workflow.md遵循workflow.md中的说明 - 其中包含:
- 核心原则(先读后写、遵循标准等)
- 文件系统结构
- 开发流程
- 最佳实践
Step 2: Get Current Context
步骤2:获取当前上下文
bash
python3 ./.trellis/scripts/get_context.pyThis shows: developer identity, git status, current task (if any), active tasks.
bash
python3 ./.trellis/scripts/get_context.py该命令会显示:开发者身份、git状态、当前任务(如有)、活跃任务。
Step 3: Read Guidelines Index
步骤3:阅读指南索引
bash
cat .trellis/spec/frontend/index.md # Frontend guidelines
cat .trellis/spec/backend/index.md # Backend guidelines
cat .trellis/spec/guides/index.md # Thinking guidesbash
cat .trellis/spec/frontend/index.md # 前端指南
cat .trellis/spec/backend/index.md # 后端指南
cat .trellis/spec/guides/index.md # 思考指南Step 4: Report and Ask
步骤4:汇报并询问
Report what you learned and ask: "What would you like to work on?"
汇报你了解到的内容,并询问:"你想要处理什么任务?"
Task Classification
任务分类
When user describes a task, classify it:
| Type | Criteria | Workflow |
|---|---|---|
| Question | User asks about code, architecture, or how something works | Answer directly |
| Trivial Fix | Typo fix, comment update, single-line change | Direct Edit |
| Simple Task | Clear goal, 1-2 files, well-defined scope | Quick confirm → Implement |
| Complex Task | Vague goal, multiple files, architectural decisions | Brainstorm → Task Workflow |
当用户描述任务时,进行分类:
| 类型 | 判定标准 | 工作流 |
|---|---|---|
| 问题 | 用户询问代码、架构或某功能的工作原理 | 直接回答 |
| 微小修复 | 拼写错误修复、注释更新、单行代码修改 | 直接编辑 |
| 简单任务 | 目标明确,涉及1-2个文件,范围清晰 | 快速确认 → 实现 |
| 复杂任务 | 目标模糊,涉及多个文件,需要架构决策 | 头脑风暴 → 任务工作流 |
Classification Signals
分类信号
Trivial/Simple indicators:
- User specifies exact file and change
- "Fix the typo in X"
- "Add field Y to component Z"
- Clear acceptance criteria already stated
Complex indicators:
- "I want to add a feature for..."
- "Can you help me improve..."
- Mentions multiple areas or systems
- No clear implementation path
- User seems unsure about approach
微小/简单任务指标:
- 用户指定了具体文件和修改内容
- "修复X中的拼写错误"
- "为组件Z添加字段Y"
- 已明确说明验收标准
复杂任务指标:
- "我想添加一个...功能"
- "你能帮我改进...吗"
- 提及多个领域或系统
- 没有明确的实现路径
- 用户似乎对方法不确定
Decision Rule
决策规则
If in doubt, use Brainstorm + Task Workflow.Task Workflow ensures specs are injected to agents, resulting in higher quality code. The overhead is minimal, but the benefit is significant.
如有疑问,使用头脑风暴 + 任务工作流。任务工作流确保规范被注入到Agent中,从而生成更高质量的代码。 其开销极小,但收益显著。
Question / Trivial Fix
问题 / 微小修复
For questions or trivial fixes, work directly:
- Answer question or make the fix
- If code was changed, remind user to run
/trellis:finish-work
对于问题或微小修复,直接处理:
- 回答问题或进行修复
- 如果代码被修改,提醒用户运行
/trellis:finish-work
Simple Task
简单任务
For simple, well-defined tasks:
- Quick confirm: "I understand you want to [goal]. Ready to proceed?"
- If yes, skip to Task Workflow Step 2 (Research)
- If no, clarify and confirm again
对于简单、定义明确的任务:
- 快速确认:"我理解你想要[目标]。可以开始了吗?"
- 如果同意,跳至任务工作流步骤2(调研)
- 如果不同意,澄清并再次确认
Complex Task - Brainstorm First
复杂任务 - 先进行头脑风暴
For complex or vague tasks, use the brainstorm process to clarify requirements.
See for the full process. Summary:
/trellis:brainstorm- Acknowledge and classify - State your understanding
- Create task directory - Track evolving requirements in
prd.md - Ask questions one at a time - Update PRD after each answer
- Propose approaches - For architectural decisions
- Confirm final requirements - Get explicit approval
- Proceed to Task Workflow - With clear requirements in PRD
对于复杂或模糊的任务,使用头脑风暴流程明确需求。
完整流程请查看。摘要:
/trellis:brainstorm- 确认并分类 - 说明你的理解
- 创建任务目录 - 在中跟踪不断演进的需求
prd.md - 逐个提问 - 每次回答后更新PRD
- 提出方案 - 针对架构决策
- 确认最终需求 - 获取明确批准
- 进入任务工作流 - PRD中已有清晰需求
Key Brainstorm Principles
头脑风暴核心原则
| Principle | Description |
|---|---|
| One question at a time | Never overwhelm with multiple questions |
| Update PRD immediately | After each answer, update the document |
| Prefer multiple choice | Easier for users to answer |
| YAGNI | Challenge unnecessary complexity |
| 原则 | 描述 |
|---|---|
| 逐个提问 | 切勿用多个问题让用户应接不暇 |
| 立即更新PRD | 每次回答后更新文档 |
| 优先使用选择题 | 方便用户回答 |
| YAGNI(你不会需要它) | 避免不必要的复杂性 |
Task Workflow (Development Tasks)
任务工作流(开发任务)
Why this workflow?
- Research Agent analyzes what specs are needed
- Specs are configured in jsonl files
- Implement Agent receives specs via Hook injection
- Check Agent verifies against specs
- Result: Code that follows project conventions automatically
为什么使用此工作流?
- 调研Agent分析所需的规范
- 规范配置在jsonl文件中
- 实现Agent通过Hook注入接收规范
- 检查Agent根据规范进行验证
- 结果:自动遵循项目约定的代码
Step 1: Understand the Task [AI]
[AI]步骤1:理解任务 [AI]
[AI]If coming from Brainstorm: Skip this step - requirements are already in PRD.
If Simple Task: Quick confirm understanding:
- What is the goal?
- What type of development? (frontend / backend / fullstack)
- Any specific requirements or constraints?
如果来自头脑风暴: 跳过此步骤 - 需求已在PRD中。
如果是简单任务: 快速确认理解:
- 目标是什么?
- 开发类型?(前端/后端/全栈)
- 有没有特定需求或约束?
Step 2: Research the Codebase [AI]
[AI]步骤2:调研代码库 [AI]
[AI]Call Research Agent to analyze:
Task(
subagent_type: "research",
prompt: "Analyze the codebase for this task:
Task: <user's task description>
Type: <frontend/backend/fullstack>
Please find:
1. Relevant spec files in .trellis/spec/
2. Existing code patterns to follow (find 2-3 examples)
3. Files that will likely need modification
Output:
## Relevant Specs
- <path>: <why it's relevant>
## Code Patterns Found
- <pattern>: <example file path>
## Files to Modify
- <path>: <what change>
## Suggested Task Name
- <short-slug-name>",
model: "opus"
)调用调研Agent进行分析:
Task(
subagent_type: "research",
prompt: "Analyze the codebase for this task:\n\n Task: <user's task description>\n Type: <frontend/backend/fullstack>\n\n Please find:\n 1. Relevant spec files in .trellis/spec/\n 2. Existing code patterns to follow (find 2-3 examples)\n 3. Files that will likely need modification\n\n Output:\n ## Relevant Specs\n - <path>: <why it's relevant>\n\n ## Code Patterns Found\n - <pattern>: <example file path>\n\n ## Files to Modify\n - <path>: <what change>\n\n ## Suggested Task Name\n - <short-slug-name>",
model: "opus"
)Step 3: Create Task Directory [AI]
[AI]步骤3:创建任务目录 [AI]
[AI]Based on research results:
bash
TASK_DIR=$(python3 ./.trellis/scripts/task.py create "<title from research>" --slug <suggested-slug>)基于调研结果:
bash
TASK_DIR=$(python3 ./.trellis/scripts/task.py create "<title from research>" --slug <suggested-slug>)Step 4: Configure Context [AI]
[AI]步骤4:配置上下文 [AI]
[AI]Initialize default context:
bash
python3 ./.trellis/scripts/task.py init-context "$TASK_DIR" <type>初始化默认上下文:
bash
python3 ./.trellis/scripts/task.py init-context "$TASK_DIR" <type>type: backend | frontend | fullstack
type: backend | frontend | fullstack
Add specs found by Research Agent:
```bash
添加调研Agent找到的规范:
```bashFor each relevant spec and code pattern:
针对每个相关规范和代码模式:
python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
undefinedpython3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
undefinedStep 5: Write Requirements [AI]
[AI]步骤5:编写需求 [AI]
[AI]Create in the task directory with:
prd.mdmarkdown
undefined在任务目录中创建,内容如下:
prd.mdmarkdown
undefined<Task Title>
<任务标题>
Goal
目标
<What we're trying to achieve>
<我们要实现的内容>
Requirements
需求
- <Requirement 1>
- <Requirement 2>
- <需求1>
- <需求2>
Acceptance Criteria
验收标准
- <Criterion 1>
- <Criterion 2>
- <标准1>
- <标准2>
Technical Notes
技术说明
<Any technical decisions or constraints>
```
<任何技术决策或约束>
undefinedStep 6: Activate Task [AI]
[AI]步骤6:激活任务 [AI]
[AI]bash
python3 ./.trellis/scripts/task.py start "$TASK_DIR"This sets so hooks can inject context.
.current-taskbash
python3 ./.trellis/scripts/task.py start "$TASK_DIR"此命令会设置,以便Hook可以注入上下文。
.current-taskStep 7: Implement [AI]
[AI]步骤7:实现 [AI]
[AI]Call Implement Agent (specs are auto-injected by hook):
Task(
subagent_type: "implement",
prompt: "Implement the task described in prd.md.
Follow all specs that have been injected into your context.
Run lint and typecheck before finishing.",
model: "opus"
)调用实现Agent(规范会通过Hook自动注入):
Task(
subagent_type: "implement",
prompt: "Implement the task described in prd.md.\n\n Follow all specs that have been injected into your context.\n Run lint and typecheck before finishing.",
model: "opus"
)Step 8: Check Quality [AI]
[AI]步骤8:质量检查 [AI]
[AI]Call Check Agent (specs are auto-injected by hook):
Task(
subagent_type: "check",
prompt: "Review all code changes against the specs.
Fix any issues you find directly.
Ensure lint and typecheck pass.",
model: "opus"
)调用检查Agent(规范会通过Hook自动注入):
Task(
subagent_type: "check",
prompt: "Review all code changes against the specs.\n\n Fix any issues you find directly.\n Ensure lint and typecheck pass.",
model: "opus"
)Step 9: Complete [AI]
[AI]步骤9:完成 [AI]
[AI]- Verify lint and typecheck pass
- Report what was implemented
- Remind user to:
- Test the changes
- Commit when ready
- Run to record this session
/trellis:record-session
- 验证lint和类型检查通过
- 汇报已实现的内容
- 提醒用户:
- 测试更改
- 准备好后提交
- 运行记录本次会话
/trellis:record-session
Continuing Existing Task
继续现有任务
If shows a current task:
get_context.py- Read the task's to understand the goal
prd.md - Check for current status and phase
task.json - Ask user: "Continue working on <task-name>?"
If yes, resume from the appropriate step (usually Step 7 or 8).
如果显示有当前任务:
get_context.py- 阅读任务的以了解目标
prd.md - 查看获取当前状态和阶段
task.json - 询问用户:"继续处理<任务名称>吗?"
如果同意,从相应步骤恢复(通常是步骤7或8)。
Commands Reference
命令参考
User Commands [USER]
[USER]用户命令 [USER]
[USER]| Command | When to Use |
|---|---|
| Begin a session (this command) |
| Clarify vague requirements (called from start) |
| Complex tasks needing isolated worktree |
| Before committing changes |
| After completing a task |
| 命令 | 使用场景 |
|---|---|
| 开始会话(本命令) |
| 明确模糊需求(从start调用) |
| 需要独立工作树的复杂任务 |
| 提交更改前 |
| 完成任务后 |
AI Scripts [AI]
[AI]AI脚本 [AI]
[AI]| Script | Purpose |
|---|---|
| Get session context |
| Create task directory |
| Initialize jsonl files |
| Add spec to jsonl |
| Set current task |
| Clear current task |
| Archive completed task |
| 脚本 | 用途 |
|---|---|
| 获取会话上下文 |
| 创建任务目录 |
| 初始化jsonl文件 |
| 向jsonl添加规范 |
| 设置当前任务 |
| 清除当前任务 |
| 归档已完成任务 |
Sub Agents [AI]
[AI]子Agent [AI]
[AI]| Agent | Purpose | Hook Injection |
|---|---|---|
| research | Analyze codebase | No (reads directly) |
| implement | Write code | Yes (implement.jsonl) |
| check | Review & fix | Yes (check.jsonl) |
| debug | Fix specific issues | Yes (debug.jsonl) |
| Agent | 用途 | Hook注入 |
|---|---|---|
| research | 分析代码库 | 否(直接读取) |
| implement | 编写代码 | 是(implement.jsonl) |
| check | 审核与修复 | 是(check.jsonl) |
| debug | 修复特定问题 | 是(debug.jsonl) |
Key Principle
核心原则
Specs are injected, not remembered.The Task Workflow ensures agents receive relevant specs automatically. This is more reliable than hoping the AI "remembers" conventions.
规范是注入的,而非记忆的。任务工作流确保Agent自动接收相关规范。 这比依赖AI"记住"约定更可靠。