# Start Session Initialize your AI development session and begin working on tasks. --- ## Operation Types | Marker | Meaning | Executor | |--------|---------|----------| | `[AI]` | Bash scripts or Task calls executed by AI | You (AI) | | `[USER]` | Slash commands executed by user | User | --- ## Initialization `[AI]` ### Step 1: Understand Development Workflow 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 ### Step 2: Get Current Context ```bash python3 ./.trellis/scripts/get_context.py ``` This shows: developer identity, git status, current task (if any), active tasks. ### Step 3: Read Guidelines Index ```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 cat .trellis/spec/unit-test/index.md # Testing guidelines ``` > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`). > At this step, just read the indexes to understand what's available. > When you start actual development, you MUST go back and read the specific guideline files relevant to your task, as listed in the index's Pre-Development Checklist. ### Step 4: Report and Ask 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** | ### 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 ### Decision Rule > **If in doubt, use Brainstorm + Task Workflow.** > > Task Workflow ensures code-spec context is injected to agents, resulting in higher quality code. > The overhead is minimal, but the benefit is significant. --- ## 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` --- ## Simple Task For simple, well-defined tasks: 1. Quick confirm: "I understand you want to [goal]. Shall I proceed?" 2. If no, clarify and confirm again 3. **If yes: execute ALL steps below without stopping. Do NOT ask for additional confirmation between steps.** - Create task directory (Phase 1 Path B, Step 2) - Write PRD (Step 3) - Research codebase (Phase 2, Step 5) - Configure context (Step 6) - Activate task (Step 7) - Implement (Phase 3, Step 8) - Check quality (Step 9) - Complete (Step 10) --- ## Complex Task - Brainstorm First For complex or vague tasks, **automatically start the brainstorm process** — do NOT skip directly to implementation. 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 > **Subtask Decomposition**: If brainstorm reveals multiple independent work items, > consider creating subtasks using `--parent` flag or `add-subtask` command. > See `/trellis:brainstorm` Step 8 for details. ### 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 | --- ## Task Workflow (Development Tasks) **Why this workflow?** - Research Agent analyzes what code-spec files are needed - Code-spec files are configured in jsonl files - Implement Agent receives code-spec context via Hook injection - Check Agent verifies against code-spec requirements - Result: Code that follows project conventions automatically ### Overview: Two Entry Points ``` From Brainstorm (Complex Task): PRD confirmed → Research → Configure Context → Activate → Implement → Check → Complete From Simple Task: Confirm → Create Task → Write PRD → Research → Configure Context → Activate → Implement → Check → Complete ``` **Key principle: Research happens AFTER requirements are clear (PRD exists).** --- ### Phase 1: Establish Requirements #### Path A: From Brainstorm (skip to Phase 2) PRD and task directory already exist from brainstorm. Skip directly to Phase 2. #### Path B: From Simple Task **Step 1: Confirm Understanding** `[AI]` Quick confirm: - What is the goal? - What type of development? (frontend / backend / fullstack) - Any specific requirements or constraints? **Step 2: Create Task Directory** `[AI]` ```bash TASK_DIR=$(python3 ./.trellis/scripts/task.py create "