start

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Start Session

启动会话

Initialize your AI development session and begin working on tasks.

初始化你的AI开发会话并开始处理任务。

Operation Types

操作类型

MarkerMeaningExecutor
[AI]
Bash scripts or Task calls executed by AIYou (AI)
[USER]
Slash commands executed by userUser

标记含义执行者
[AI]
由AI执行的Bash脚本或Task调用你(AI)
[USER]
用户执行的斜杠命令用户

Initialization
[AI]

初始化
[AI]

Step 1: Understand Development Workflow

步骤1:理解开发工作流

First, read the workflow guide to understand the development process:
bash
cat .trellis/workflow.md
Follow 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.py
This 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 guides
bash
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:
TypeCriteriaWorkflow
QuestionUser asks about code, architecture, or how something worksAnswer directly
Trivial FixTypo fix, comment update, single-line changeDirect Edit
Simple TaskClear goal, 1-2 files, well-defined scopeQuick confirm → Implement
Complex TaskVague goal, multiple files, architectural decisionsBrainstorm → 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:
  1. Answer question or make the fix
  2. If code was changed, remind user to run
    /trellis:finish-work

对于问题或微小修复,直接处理:
  1. 回答问题或进行修复
  2. 如果代码被修改,提醒用户运行
    /trellis:finish-work

Simple Task

简单任务

For simple, well-defined tasks:
  1. Quick confirm: "I understand you want to [goal]. Ready to proceed?"
  2. If yes, skip to Task Workflow Step 2 (Research)
  3. If no, clarify and confirm again

对于简单、定义明确的任务:
  1. 快速确认:"我理解你想要[目标]。可以开始了吗?"
  2. 如果同意,跳至任务工作流步骤2(调研)
  3. 如果不同意,澄清并再次确认

Complex Task - Brainstorm First

复杂任务 - 先进行头脑风暴

For complex or vague tasks, use the brainstorm process to clarify requirements.
See
/trellis:brainstorm
for the full process. Summary:
  1. Acknowledge and classify - State your understanding
  2. Create task directory - Track evolving requirements in
    prd.md
  3. Ask questions one at a time - Update PRD after each answer
  4. Propose approaches - For architectural decisions
  5. Confirm final requirements - Get explicit approval
  6. Proceed to Task Workflow - With clear requirements in PRD
对于复杂或模糊的任务,使用头脑风暴流程明确需求。
完整流程请查看
/trellis:brainstorm
。摘要:
  1. 确认并分类 - 说明你的理解
  2. 创建任务目录 - 在
    prd.md
    中跟踪不断演进的需求
  3. 逐个提问 - 每次回答后更新PRD
  4. 提出方案 - 针对架构决策
  5. 确认最终需求 - 获取明确批准
  6. 进入任务工作流 - PRD中已有清晰需求

Key Brainstorm Principles

头脑风暴核心原则

PrincipleDescription
One question at a timeNever overwhelm with multiple questions
Update PRD immediatelyAfter each answer, update the document
Prefer multiple choiceEasier for users to answer
YAGNIChallenge 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]

步骤1:理解任务
[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]

步骤2:调研代码库
[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]

步骤3:创建任务目录
[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]

步骤4:配置上下文
[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找到的规范:

```bash

For 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>"
undefined
python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>" python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
undefined

Step 5: Write Requirements
[AI]

步骤5:编写需求
[AI]

Create
prd.md
in the task directory with:
markdown
undefined
在任务目录中创建
prd.md
,内容如下:
markdown
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> ```
<任何技术决策或约束>
undefined

Step 6: Activate Task
[AI]

步骤6:激活任务
[AI]

bash
python3 ./.trellis/scripts/task.py start "$TASK_DIR"
This sets
.current-task
so hooks can inject context.
bash
python3 ./.trellis/scripts/task.py start "$TASK_DIR"
此命令会设置
.current-task
,以便Hook可以注入上下文。

Step 7: Implement
[AI]

步骤7:实现
[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]

步骤8:质量检查
[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]

步骤9:完成
[AI]

  1. Verify lint and typecheck pass
  2. Report what was implemented
  3. Remind user to:
    • Test the changes
    • Commit when ready
    • Run
      /trellis:record-session
      to record this session

  1. 验证lint和类型检查通过
  2. 汇报已实现的内容
  3. 提醒用户:
    • 测试更改
    • 准备好后提交
    • 运行
      /trellis:record-session
      记录本次会话

Continuing Existing Task

继续现有任务

If
get_context.py
shows a current task:
  1. Read the task's
    prd.md
    to understand the goal
  2. Check
    task.json
    for current status and phase
  3. Ask user: "Continue working on <task-name>?"
If yes, resume from the appropriate step (usually Step 7 or 8).

如果
get_context.py
显示有当前任务:
  1. 阅读任务的
    prd.md
    以了解目标
  2. 查看
    task.json
    获取当前状态和阶段
  3. 询问用户:"继续处理<任务名称>吗?"
如果同意,从相应步骤恢复(通常是步骤7或8)。

Commands Reference

命令参考

User Commands
[USER]

用户命令
[USER]

CommandWhen to Use
/trellis:start
Begin a session (this command)
/trellis:brainstorm
Clarify vague requirements (called from start)
/trellis:parallel
Complex tasks needing isolated worktree
/trellis:finish-work
Before committing changes
/trellis:record-session
After completing a task
命令使用场景
/trellis:start
开始会话(本命令)
/trellis:brainstorm
明确模糊需求(从start调用)
/trellis:parallel
需要独立工作树的复杂任务
/trellis:finish-work
提交更改前
/trellis:record-session
完成任务后

AI Scripts
[AI]

AI脚本
[AI]

ScriptPurpose
python3 ./.trellis/scripts/get_context.py
Get session context
python3 ./.trellis/scripts/task.py create
Create task directory
python3 ./.trellis/scripts/task.py init-context
Initialize jsonl files
python3 ./.trellis/scripts/task.py add-context
Add spec to jsonl
python3 ./.trellis/scripts/task.py start
Set current task
python3 ./.trellis/scripts/task.py finish
Clear current task
python3 ./.trellis/scripts/task.py archive
Archive completed task
脚本用途
python3 ./.trellis/scripts/get_context.py
获取会话上下文
python3 ./.trellis/scripts/task.py create
创建任务目录
python3 ./.trellis/scripts/task.py init-context
初始化jsonl文件
python3 ./.trellis/scripts/task.py add-context
向jsonl添加规范
python3 ./.trellis/scripts/task.py start
设置当前任务
python3 ./.trellis/scripts/task.py finish
清除当前任务
python3 ./.trellis/scripts/task.py archive
归档已完成任务

Sub Agents
[AI]

子Agent
[AI]

AgentPurposeHook Injection
researchAnalyze codebaseNo (reads directly)
implementWrite codeYes (implement.jsonl)
checkReview & fixYes (check.jsonl)
debugFix specific issuesYes (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"记住"约定更可靠。