@mindfoldhq/trellis 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -11
- package/dist/.claude/agents/check.md +98 -0
- package/dist/.claude/agents/debug.md +109 -0
- package/dist/{templates/agents/dispatch.txt → .claude/agents/dispatch.md} +20 -12
- package/dist/.claude/agents/implement.md +101 -0
- package/dist/.claude/agents/plan.md +396 -0
- package/dist/.claude/agents/research.md +120 -0
- package/dist/{templates/commands/common/check-cross-layer.txt → .claude/commands/check-cross-layer.md} +29 -29
- package/dist/{templates/commands/common/onboard-developer.txt → .claude/commands/onboard-developer.md} +2 -2
- package/dist/.claude/commands/parallel.md +199 -0
- package/dist/{templates/commands/common/record-agent-flow.txt → .claude/commands/record-agent-flow.md} +1 -1
- package/dist/.claude/commands/start.md +192 -0
- package/dist/{templates → .claude}/hooks/inject-subagent-context.py +63 -0
- package/dist/.cursor/commands/before-backend-dev.md +13 -0
- package/dist/.cursor/commands/before-frontend-dev.md +13 -0
- package/dist/.cursor/commands/break-loop.md +107 -0
- package/dist/.cursor/commands/check-backend.md +13 -0
- package/dist/.cursor/commands/check-cross-layer.md +153 -0
- package/dist/.cursor/commands/check-frontend.md +13 -0
- package/dist/.cursor/commands/create-command.md +154 -0
- package/dist/.cursor/commands/finish-work.md +129 -0
- package/dist/.cursor/commands/integrate-skill.md +219 -0
- package/dist/.cursor/commands/onboard-developer.md +355 -0
- package/dist/.cursor/commands/record-agent-flow.md +62 -0
- package/dist/.cursor/commands/start.md +157 -0
- package/dist/{templates/markdown/agent-traces-index.md.txt → .trellis/agent-traces/index.md} +8 -9
- package/dist/{templates/scripts/add-session.sh.txt → .trellis/scripts/add-session.sh} +14 -14
- package/dist/{templates/scripts/common/developer.sh.txt → .trellis/scripts/common/developer.sh} +13 -13
- package/dist/{templates/scripts/common/git-context.sh.txt → .trellis/scripts/common/git-context.sh} +8 -8
- package/dist/{templates/scripts/common/paths.sh.txt → .trellis/scripts/common/paths.sh} +4 -4
- package/dist/.trellis/scripts/common/phase.sh +150 -0
- package/dist/.trellis/scripts/common/worktree.sh +138 -0
- package/dist/{templates/scripts/feature.sh.txt → .trellis/scripts/feature.sh} +297 -0
- package/dist/.trellis/scripts/multi-agent/cleanup.sh +416 -0
- package/dist/.trellis/scripts/multi-agent/create-pr.sh +241 -0
- package/dist/.trellis/scripts/multi-agent/plan.sh +232 -0
- package/dist/.trellis/scripts/multi-agent/start.sh +344 -0
- package/dist/.trellis/scripts/multi-agent/status.sh +695 -0
- package/dist/.trellis/structure/backend/database-guidelines.md +51 -0
- package/dist/.trellis/structure/backend/directory-structure.md +209 -0
- package/dist/.trellis/structure/backend/error-handling.md +278 -0
- package/dist/.trellis/structure/backend/index.md +38 -0
- package/dist/.trellis/structure/backend/logging-guidelines.md +266 -0
- package/dist/.trellis/structure/backend/quality-guidelines.md +313 -0
- package/dist/.trellis/structure/frontend/component-guidelines.md +59 -0
- package/dist/.trellis/structure/frontend/directory-structure.md +54 -0
- package/dist/.trellis/structure/frontend/hook-guidelines.md +51 -0
- package/dist/.trellis/structure/frontend/index.md +39 -0
- package/dist/.trellis/structure/frontend/quality-guidelines.md +51 -0
- package/dist/.trellis/structure/frontend/state-management.md +51 -0
- package/dist/.trellis/structure/frontend/type-safety.md +51 -0
- package/dist/.trellis/structure/guides/code-reuse-thinking-guide.md +92 -0
- package/dist/.trellis/structure/guides/cross-layer-thinking-guide.md +94 -0
- package/dist/.trellis/structure/guides/index.md +79 -0
- package/dist/{templates/markdown/workflow.md.txt → .trellis/workflow.md} +6 -6
- package/dist/.trellis/worktree.yaml +49 -0
- package/dist/cli/index.js +1 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +29 -15
- package/dist/commands/init.js.map +1 -1
- package/dist/configurators/claude.d.ts +17 -17
- package/dist/configurators/claude.d.ts.map +1 -1
- package/dist/configurators/claude.js +29 -59
- package/dist/configurators/claude.js.map +1 -1
- package/dist/configurators/cursor.d.ts +3 -3
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +11 -15
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/opencode.d.ts +25 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +54 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/workflow.d.ts +9 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +32 -72
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/templates/extract.d.ts +73 -8
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +149 -10
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/markdown/{agents.md.txt → agents.md} +1 -1
- package/dist/templates/markdown/index.d.ts +5 -1
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +54 -26
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/{init-agent.md.txt → init-agent.md} +8 -8
- package/dist/templates/markdown/structure/backend/directory-structure.md.txt +6 -6
- package/dist/templates/markdown/structure/backend/error-handling.md.txt +8 -8
- package/dist/templates/markdown/structure/backend/index.md.txt +5 -5
- package/dist/templates/markdown/structure/backend/logging-guidelines.md.txt +8 -8
- package/dist/templates/markdown/structure/frontend/index.md.txt +6 -6
- package/dist/templates/markdown/structure/guides/cross-layer-thinking-guide.md.txt +5 -5
- package/dist/templates/markdown/structure/guides/index.md.txt +7 -7
- package/dist/templates/markdown/worktree.yaml.txt +58 -0
- package/dist/types/ai-tools.d.ts +2 -2
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +4 -0
- package/dist/types/ai-tools.js.map +1 -1
- package/package.json +1 -1
- package/dist/configurators/templates.d.ts +0 -40
- package/dist/configurators/templates.d.ts.map +0 -1
- package/dist/configurators/templates.js +0 -67
- package/dist/configurators/templates.js.map +0 -1
- package/dist/templates/agents/check.txt +0 -120
- package/dist/templates/agents/debug.txt +0 -121
- package/dist/templates/agents/implement.txt +0 -114
- package/dist/templates/agents/index.d.ts +0 -35
- package/dist/templates/agents/index.d.ts.map +0 -1
- package/dist/templates/agents/index.js +0 -71
- package/dist/templates/agents/index.js.map +0 -1
- package/dist/templates/agents/research.txt +0 -258
- package/dist/templates/commands/claude/start.md.txt +0 -127
- package/dist/templates/commands/cursor/start.md.txt +0 -94
- package/dist/templates/commands/index.d.ts +0 -46
- package/dist/templates/commands/index.d.ts.map +0 -1
- package/dist/templates/commands/index.js +0 -151
- package/dist/templates/commands/index.js.map +0 -1
- package/dist/templates/hooks/index.d.ts +0 -33
- package/dist/templates/hooks/index.d.ts.map +0 -1
- package/dist/templates/hooks/index.js +0 -53
- package/dist/templates/hooks/index.js.map +0 -1
- package/dist/templates/markdown/gitignore.txt +0 -3
- package/dist/templates/scripts/index.d.ts +0 -25
- package/dist/templates/scripts/index.d.ts.map +0 -1
- package/dist/templates/scripts/index.js +0 -28
- package/dist/templates/scripts/index.js.map +0 -1
- /package/dist/{templates/commands/common/before-backend-dev.txt → .claude/commands/before-backend-dev.md} +0 -0
- /package/dist/{templates/commands/common/before-frontend-dev.txt → .claude/commands/before-frontend-dev.md} +0 -0
- /package/dist/{templates/commands/common/break-loop.txt → .claude/commands/break-loop.md} +0 -0
- /package/dist/{templates/commands/common/check-backend.txt → .claude/commands/check-backend.md} +0 -0
- /package/dist/{templates/commands/common/check-frontend.txt → .claude/commands/check-frontend.md} +0 -0
- /package/dist/{templates/commands/common/create-command.txt → .claude/commands/create-command.md} +0 -0
- /package/dist/{templates/commands/common/finish-work.txt → .claude/commands/finish-work.md} +0 -0
- /package/dist/{templates/commands/common/integrate-skill.txt → .claude/commands/integrate-skill.md} +0 -0
- /package/dist/{templates/hooks → .claude}/settings.json +0 -0
- /package/dist/{templates/scripts/create-bootstrap.sh.txt → .trellis/scripts/create-bootstrap.sh} +0 -0
- /package/dist/{templates/scripts/get-context.sh.txt → .trellis/scripts/get-context.sh} +0 -0
- /package/dist/{templates/scripts/get-developer.sh.txt → .trellis/scripts/get-developer.sh} +0 -0
- /package/dist/{templates/scripts/init-developer.sh.txt → .trellis/scripts/init-developer.sh} +0 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan
|
|
3
|
+
description: |
|
|
4
|
+
Multi-Agent Pipeline planner. Analyzes requirements and produces a fully configured feature directory ready for dispatch.
|
|
5
|
+
tools: Read, Bash, Glob, Grep, Task
|
|
6
|
+
model: opus
|
|
7
|
+
---
|
|
8
|
+
# Plan Agent
|
|
9
|
+
|
|
10
|
+
You are the Plan Agent in the Multi-Agent Pipeline.
|
|
11
|
+
|
|
12
|
+
**Your job**: Evaluate requirements and, if valid, transform them into a fully configured feature directory.
|
|
13
|
+
|
|
14
|
+
**You have the power to reject** - If a requirement is unclear, incomplete, unreasonable, or potentially harmful, you MUST refuse to proceed and clean up.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Step 0: Evaluate Requirement (CRITICAL)
|
|
19
|
+
|
|
20
|
+
Before doing ANY work, evaluate the requirement:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
PLAN_REQUIREMENT = <the requirement from environment>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Reject If:
|
|
27
|
+
|
|
28
|
+
1. **Unclear or Vague**
|
|
29
|
+
- "Make it better" / "Fix the bugs" / "Improve performance"
|
|
30
|
+
- No specific outcome defined
|
|
31
|
+
- Cannot determine what "done" looks like
|
|
32
|
+
|
|
33
|
+
2. **Incomplete Information**
|
|
34
|
+
- Missing critical details to implement
|
|
35
|
+
- References unknown systems or files
|
|
36
|
+
- Depends on decisions not yet made
|
|
37
|
+
|
|
38
|
+
3. **Out of Scope for This Project**
|
|
39
|
+
- Requirement doesn't match the project's purpose
|
|
40
|
+
- Requires changes to external systems
|
|
41
|
+
- Not technically feasible with current architecture
|
|
42
|
+
|
|
43
|
+
4. **Potentially Harmful**
|
|
44
|
+
- Security vulnerabilities (intentional backdoors, data exfiltration)
|
|
45
|
+
- Destructive operations without clear justification
|
|
46
|
+
- Circumventing access controls
|
|
47
|
+
|
|
48
|
+
5. **Too Large / Should Be Split**
|
|
49
|
+
- Multiple unrelated features bundled together
|
|
50
|
+
- Would require touching too many systems
|
|
51
|
+
- Cannot be completed in a reasonable scope
|
|
52
|
+
|
|
53
|
+
### If Rejecting:
|
|
54
|
+
|
|
55
|
+
1. **Update feature.json status to "rejected"**:
|
|
56
|
+
```bash
|
|
57
|
+
jq '.status = "rejected"' "$PLAN_FEATURE_DIR/feature.json" > "$PLAN_FEATURE_DIR/feature.json.tmp" \
|
|
58
|
+
&& mv "$PLAN_FEATURE_DIR/feature.json.tmp" "$PLAN_FEATURE_DIR/feature.json"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. **Write rejection reason to a file** (so user can see it):
|
|
62
|
+
```bash
|
|
63
|
+
cat > "$PLAN_FEATURE_DIR/REJECTED.md" << 'EOF'
|
|
64
|
+
# Plan Rejected
|
|
65
|
+
|
|
66
|
+
## Reason
|
|
67
|
+
<category from above>
|
|
68
|
+
|
|
69
|
+
## Details
|
|
70
|
+
<specific explanation of why this requirement cannot proceed>
|
|
71
|
+
|
|
72
|
+
## Suggestions
|
|
73
|
+
- <what the user should clarify or change>
|
|
74
|
+
- <how to make the requirement actionable>
|
|
75
|
+
|
|
76
|
+
## To Retry
|
|
77
|
+
|
|
78
|
+
1. Delete this directory:
|
|
79
|
+
rm -rf $PLAN_FEATURE_DIR
|
|
80
|
+
|
|
81
|
+
2. Run with revised requirement:
|
|
82
|
+
./.trellis/scripts/multi-agent/plan.sh --name "<name>" --type "<type>" --requirement "<revised requirement>"
|
|
83
|
+
EOF
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
3. **Print summary to stdout** (will be captured in .plan-log):
|
|
87
|
+
```
|
|
88
|
+
=== PLAN REJECTED ===
|
|
89
|
+
|
|
90
|
+
Reason: <category>
|
|
91
|
+
Details: <brief explanation>
|
|
92
|
+
|
|
93
|
+
See: $PLAN_FEATURE_DIR/REJECTED.md
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
4. **Exit immediately** - Do not proceed to Step 1.
|
|
97
|
+
|
|
98
|
+
**The feature directory is kept** with:
|
|
99
|
+
- `feature.json` (status: "rejected")
|
|
100
|
+
- `REJECTED.md` (full explanation)
|
|
101
|
+
- `.plan-log` (execution log)
|
|
102
|
+
|
|
103
|
+
This allows the user to review why it was rejected.
|
|
104
|
+
|
|
105
|
+
### If Accepting:
|
|
106
|
+
|
|
107
|
+
Continue to Step 1. The requirement is:
|
|
108
|
+
- Clear and specific
|
|
109
|
+
- Has a defined outcome
|
|
110
|
+
- Is technically feasible
|
|
111
|
+
- Is appropriately scoped
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Input
|
|
116
|
+
|
|
117
|
+
You receive input via environment variables (set by plan.sh):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
PLAN_FEATURE_NAME # Feature name (e.g., "user-auth")
|
|
121
|
+
PLAN_DEV_TYPE # Development type: backend | frontend | fullstack
|
|
122
|
+
PLAN_REQUIREMENT # Requirement description from user
|
|
123
|
+
PLAN_FEATURE_DIR # Pre-created feature directory path
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Read them at startup:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
echo "Feature: $PLAN_FEATURE_NAME"
|
|
130
|
+
echo "Type: $PLAN_DEV_TYPE"
|
|
131
|
+
echo "Requirement: $PLAN_REQUIREMENT"
|
|
132
|
+
echo "Directory: $PLAN_FEATURE_DIR"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Output (if accepted)
|
|
136
|
+
|
|
137
|
+
A complete feature directory containing:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
${PLAN_FEATURE_DIR}/
|
|
141
|
+
├── feature.json # Updated with branch, scope, dev_type
|
|
142
|
+
├── prd.md # Requirements document
|
|
143
|
+
├── implement.jsonl # Implement phase context
|
|
144
|
+
├── check.jsonl # Check phase context
|
|
145
|
+
└── debug.jsonl # Debug phase context
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Workflow (After Acceptance)
|
|
151
|
+
|
|
152
|
+
### Step 1: Initialize Context Files
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
./.trellis/scripts/feature.sh init-context "$PLAN_FEATURE_DIR" "$PLAN_DEV_TYPE"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This creates base jsonl files with standard specs for the dev type.
|
|
159
|
+
|
|
160
|
+
### Step 2: Analyze Codebase with Research Agent
|
|
161
|
+
|
|
162
|
+
Call research agent to find relevant specs and code patterns:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Task(
|
|
166
|
+
subagent_type: "research",
|
|
167
|
+
prompt: "Analyze what specs and code patterns are needed for this task.
|
|
168
|
+
|
|
169
|
+
Task: ${PLAN_REQUIREMENT}
|
|
170
|
+
Dev Type: ${PLAN_DEV_TYPE}
|
|
171
|
+
|
|
172
|
+
Instructions:
|
|
173
|
+
1. Search .trellis/structure/ for relevant spec files
|
|
174
|
+
2. Search the codebase for related modules and patterns
|
|
175
|
+
3. Identify files that should be added to jsonl context
|
|
176
|
+
|
|
177
|
+
Output format (use exactly this format):
|
|
178
|
+
|
|
179
|
+
## implement.jsonl
|
|
180
|
+
- path: <relative file path>, reason: <why needed>
|
|
181
|
+
- path: <relative file path>, reason: <why needed>
|
|
182
|
+
|
|
183
|
+
## check.jsonl
|
|
184
|
+
- path: <relative file path>, reason: <why needed>
|
|
185
|
+
|
|
186
|
+
## debug.jsonl
|
|
187
|
+
- path: <relative file path>, reason: <why needed>
|
|
188
|
+
|
|
189
|
+
## Suggested Scope
|
|
190
|
+
<single word for commit scope, e.g., auth, api, ui>
|
|
191
|
+
|
|
192
|
+
## Technical Notes
|
|
193
|
+
<any important technical considerations for prd.md>",
|
|
194
|
+
model: "opus"
|
|
195
|
+
)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Step 3: Add Context Entries
|
|
199
|
+
|
|
200
|
+
Parse research agent output and add entries to jsonl files:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# For each entry in implement.jsonl section:
|
|
204
|
+
./.trellis/scripts/feature.sh add-context "$PLAN_FEATURE_DIR" implement "<path>" "<reason>"
|
|
205
|
+
|
|
206
|
+
# For each entry in check.jsonl section:
|
|
207
|
+
./.trellis/scripts/feature.sh add-context "$PLAN_FEATURE_DIR" check "<path>" "<reason>"
|
|
208
|
+
|
|
209
|
+
# For each entry in debug.jsonl section:
|
|
210
|
+
./.trellis/scripts/feature.sh add-context "$PLAN_FEATURE_DIR" debug "<path>" "<reason>"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Step 4: Write prd.md
|
|
214
|
+
|
|
215
|
+
Create the requirements document:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
cat > "$PLAN_FEATURE_DIR/prd.md" << 'EOF'
|
|
219
|
+
# Feature: ${PLAN_FEATURE_NAME}
|
|
220
|
+
|
|
221
|
+
## Overview
|
|
222
|
+
[Brief description of what this feature does]
|
|
223
|
+
|
|
224
|
+
## Requirements
|
|
225
|
+
- [Requirement 1]
|
|
226
|
+
- [Requirement 2]
|
|
227
|
+
- ...
|
|
228
|
+
|
|
229
|
+
## Acceptance Criteria
|
|
230
|
+
- [ ] [Criterion 1]
|
|
231
|
+
- [ ] [Criterion 2]
|
|
232
|
+
- ...
|
|
233
|
+
|
|
234
|
+
## Technical Notes
|
|
235
|
+
[Any technical considerations from research agent]
|
|
236
|
+
|
|
237
|
+
## Out of Scope
|
|
238
|
+
- [What this feature does NOT include]
|
|
239
|
+
EOF
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Guidelines for prd.md**:
|
|
243
|
+
- Be specific and actionable
|
|
244
|
+
- Include acceptance criteria that can be verified
|
|
245
|
+
- Add technical notes from research agent
|
|
246
|
+
- Define what's out of scope to prevent scope creep
|
|
247
|
+
|
|
248
|
+
### Step 5: Configure Feature Metadata
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Set branch name
|
|
252
|
+
./.trellis/scripts/feature.sh set-branch "$PLAN_FEATURE_DIR" "feature/${PLAN_FEATURE_NAME}"
|
|
253
|
+
|
|
254
|
+
# Set scope (from research agent suggestion)
|
|
255
|
+
./.trellis/scripts/feature.sh set-scope "$PLAN_FEATURE_DIR" "<scope>"
|
|
256
|
+
|
|
257
|
+
# Update dev_type in feature.json
|
|
258
|
+
jq --arg type "$PLAN_DEV_TYPE" '.dev_type = $type' \
|
|
259
|
+
"$PLAN_FEATURE_DIR/feature.json" > "$PLAN_FEATURE_DIR/feature.json.tmp" \
|
|
260
|
+
&& mv "$PLAN_FEATURE_DIR/feature.json.tmp" "$PLAN_FEATURE_DIR/feature.json"
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Step 6: Validate Configuration
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
./.trellis/scripts/feature.sh validate "$PLAN_FEATURE_DIR"
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
If validation fails, fix the invalid paths and re-validate.
|
|
270
|
+
|
|
271
|
+
### Step 7: Output Summary
|
|
272
|
+
|
|
273
|
+
Print a summary for the caller:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
echo "=== Plan Complete ==="
|
|
277
|
+
echo "Feature Directory: $PLAN_FEATURE_DIR"
|
|
278
|
+
echo ""
|
|
279
|
+
echo "Files created:"
|
|
280
|
+
ls -la "$PLAN_FEATURE_DIR"
|
|
281
|
+
echo ""
|
|
282
|
+
echo "Context summary:"
|
|
283
|
+
./.trellis/scripts/feature.sh list-context "$PLAN_FEATURE_DIR"
|
|
284
|
+
echo ""
|
|
285
|
+
echo "Ready for: ./.trellis/scripts/multi-agent/start.sh $PLAN_FEATURE_DIR"
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Key Principles
|
|
291
|
+
|
|
292
|
+
1. **Reject early, reject clearly** - Don't waste time on bad requirements
|
|
293
|
+
2. **Research before configure** - Always call research agent to understand the codebase
|
|
294
|
+
3. **Validate all paths** - Every file in jsonl must exist
|
|
295
|
+
4. **Be specific in prd.md** - Vague requirements lead to wrong implementations
|
|
296
|
+
5. **Include acceptance criteria** - Check agent needs to verify something concrete
|
|
297
|
+
6. **Set appropriate scope** - This affects commit message format
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Error Handling
|
|
302
|
+
|
|
303
|
+
### Research Agent Returns No Results
|
|
304
|
+
|
|
305
|
+
If research agent finds no relevant specs:
|
|
306
|
+
- Use only the base specs from init-context
|
|
307
|
+
- Add a note in prd.md that this is a new area without existing patterns
|
|
308
|
+
|
|
309
|
+
### Path Not Found
|
|
310
|
+
|
|
311
|
+
If add-context fails because path doesn't exist:
|
|
312
|
+
- Skip that entry
|
|
313
|
+
- Log a warning
|
|
314
|
+
- Continue with other entries
|
|
315
|
+
|
|
316
|
+
### Validation Fails
|
|
317
|
+
|
|
318
|
+
If final validation fails:
|
|
319
|
+
- Read the error output
|
|
320
|
+
- Remove invalid entries from jsonl files
|
|
321
|
+
- Re-validate
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Examples
|
|
326
|
+
|
|
327
|
+
### Example: Accepted Requirement
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
Input:
|
|
331
|
+
PLAN_FEATURE_NAME = "add-rate-limiting"
|
|
332
|
+
PLAN_DEV_TYPE = "backend"
|
|
333
|
+
PLAN_REQUIREMENT = "Add rate limiting to API endpoints using a sliding window algorithm. Limit to 100 requests per minute per IP. Return 429 status when exceeded."
|
|
334
|
+
|
|
335
|
+
Result: ACCEPTED - Clear, specific, has defined behavior
|
|
336
|
+
|
|
337
|
+
Output:
|
|
338
|
+
.trellis/agent-traces/xxx/features/17-add-rate-limiting/
|
|
339
|
+
├── feature.json # branch: feature/add-rate-limiting, scope: api
|
|
340
|
+
├── prd.md # Detailed requirements with acceptance criteria
|
|
341
|
+
├── implement.jsonl # Backend specs + existing middleware patterns
|
|
342
|
+
├── check.jsonl # Quality guidelines + API testing specs
|
|
343
|
+
└── debug.jsonl # Error handling specs
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Example: Rejected - Vague Requirement
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
Input:
|
|
350
|
+
PLAN_REQUIREMENT = "Make the API faster"
|
|
351
|
+
|
|
352
|
+
Result: REJECTED
|
|
353
|
+
|
|
354
|
+
=== PLAN REJECTED ===
|
|
355
|
+
|
|
356
|
+
Reason: Unclear or Vague
|
|
357
|
+
|
|
358
|
+
Details:
|
|
359
|
+
"Make the API faster" does not specify:
|
|
360
|
+
- Which endpoints need optimization
|
|
361
|
+
- Current performance baseline
|
|
362
|
+
- Target performance metrics
|
|
363
|
+
- Acceptable trade-offs (memory, complexity)
|
|
364
|
+
|
|
365
|
+
Suggestions:
|
|
366
|
+
- Identify specific slow endpoints with response times
|
|
367
|
+
- Define target latency (e.g., "GET /users should respond in <100ms")
|
|
368
|
+
- Specify if caching, query optimization, or architecture changes are acceptable
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### Example: Rejected - Too Large
|
|
372
|
+
|
|
373
|
+
```
|
|
374
|
+
Input:
|
|
375
|
+
PLAN_REQUIREMENT = "Add user authentication, authorization, password reset, 2FA, OAuth integration, and audit logging"
|
|
376
|
+
|
|
377
|
+
Result: REJECTED
|
|
378
|
+
|
|
379
|
+
=== PLAN REJECTED ===
|
|
380
|
+
|
|
381
|
+
Reason: Too Large / Should Be Split
|
|
382
|
+
|
|
383
|
+
Details:
|
|
384
|
+
This requirement bundles 6 distinct features that should be implemented separately:
|
|
385
|
+
1. User authentication (login/logout)
|
|
386
|
+
2. Authorization (roles/permissions)
|
|
387
|
+
3. Password reset flow
|
|
388
|
+
4. Two-factor authentication
|
|
389
|
+
5. OAuth integration
|
|
390
|
+
6. Audit logging
|
|
391
|
+
|
|
392
|
+
Suggestions:
|
|
393
|
+
- Start with basic authentication first
|
|
394
|
+
- Create separate features for each capability
|
|
395
|
+
- Consider dependencies (auth before authz, etc.)
|
|
396
|
+
```
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research
|
|
3
|
+
description: |
|
|
4
|
+
Code and tech search expert. Pure research, no code modifications. Finds files, patterns, and tech solutions.
|
|
5
|
+
tools: Read, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa
|
|
6
|
+
model: haiku
|
|
7
|
+
---
|
|
8
|
+
# Research Agent
|
|
9
|
+
|
|
10
|
+
You are the Research Agent in the Trellis workflow.
|
|
11
|
+
|
|
12
|
+
## Core Principle
|
|
13
|
+
|
|
14
|
+
**You do one thing: find and explain information.**
|
|
15
|
+
|
|
16
|
+
You are a documenter, not a reviewer. Your job is to help get the information needed.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Core Responsibilities
|
|
21
|
+
|
|
22
|
+
### 1. Internal Search (Project Code)
|
|
23
|
+
|
|
24
|
+
| Search Type | Goal | Tools |
|
|
25
|
+
|-------------|------|-------|
|
|
26
|
+
| **WHERE** | Locate files/components | Glob, Grep |
|
|
27
|
+
| **HOW** | Understand code logic | Read, Grep |
|
|
28
|
+
| **PATTERN** | Discover existing patterns | Grep, Read |
|
|
29
|
+
|
|
30
|
+
### 2. External Search (Tech Solutions)
|
|
31
|
+
|
|
32
|
+
Use web search for best practices and code examples.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Strict Boundaries
|
|
37
|
+
|
|
38
|
+
### Only Allowed
|
|
39
|
+
|
|
40
|
+
- Describe **what exists**
|
|
41
|
+
- Describe **where it is**
|
|
42
|
+
- Describe **how it works**
|
|
43
|
+
- Describe **how components interact**
|
|
44
|
+
|
|
45
|
+
### Forbidden (unless explicitly asked)
|
|
46
|
+
|
|
47
|
+
- Suggest improvements
|
|
48
|
+
- Criticize implementation
|
|
49
|
+
- Recommend refactoring
|
|
50
|
+
- Modify any files
|
|
51
|
+
- Execute git commands
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Workflow
|
|
56
|
+
|
|
57
|
+
### Step 1: Understand Search Request
|
|
58
|
+
|
|
59
|
+
Analyze the query, determine:
|
|
60
|
+
|
|
61
|
+
- Search type (internal/external/mixed)
|
|
62
|
+
- Search scope (global/specific directory)
|
|
63
|
+
- Expected output (file list/code patterns/tech solutions)
|
|
64
|
+
|
|
65
|
+
### Step 2: Execute Search
|
|
66
|
+
|
|
67
|
+
Execute multiple independent searches in parallel for efficiency.
|
|
68
|
+
|
|
69
|
+
### Step 3: Organize Results
|
|
70
|
+
|
|
71
|
+
Output structured results in report format.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Report Format
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
## Search Results
|
|
79
|
+
|
|
80
|
+
### Query
|
|
81
|
+
|
|
82
|
+
{original query}
|
|
83
|
+
|
|
84
|
+
### Files Found
|
|
85
|
+
|
|
86
|
+
| File Path | Description |
|
|
87
|
+
|-----------|-------------|
|
|
88
|
+
| `src/services/xxx.ts` | Main implementation |
|
|
89
|
+
| `src/types/xxx.ts` | Type definitions |
|
|
90
|
+
|
|
91
|
+
### Code Pattern Analysis
|
|
92
|
+
|
|
93
|
+
{Describe discovered patterns, cite specific files and line numbers}
|
|
94
|
+
|
|
95
|
+
### Related Spec Documents
|
|
96
|
+
|
|
97
|
+
- `.trellis/structure/xxx.md` - {description}
|
|
98
|
+
|
|
99
|
+
### Not Found
|
|
100
|
+
|
|
101
|
+
{If some content was not found, explain}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Guidelines
|
|
107
|
+
|
|
108
|
+
### DO
|
|
109
|
+
|
|
110
|
+
- Provide specific file paths and line numbers
|
|
111
|
+
- Quote actual code snippets
|
|
112
|
+
- Distinguish "definitely found" and "possibly related"
|
|
113
|
+
- Explain search scope and limitations
|
|
114
|
+
|
|
115
|
+
### DON'T
|
|
116
|
+
|
|
117
|
+
- Don't guess uncertain info
|
|
118
|
+
- Don't omit important search results
|
|
119
|
+
- Don't add improvement suggestions in report (unless explicitly asked)
|
|
120
|
+
- Don't modify any files
|
|
@@ -35,21 +35,20 @@ Based on your change type, execute relevant checks below:
|
|
|
35
35
|
|
|
36
36
|
**Trigger**: Changes involve 3 or more layers
|
|
37
37
|
|
|
38
|
-
| Layer |
|
|
39
|
-
|
|
40
|
-
| API
|
|
41
|
-
| Service | `services/`, `lib/` |
|
|
42
|
-
| Database | `db/`, `
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
| Utility | `utils/`, `lib/` |
|
|
38
|
+
| Layer | Common Locations |
|
|
39
|
+
|-------|------------------|
|
|
40
|
+
| API/Routes | `routes/`, `api/`, `handlers/`, `controllers/` |
|
|
41
|
+
| Service/Business Logic | `services/`, `lib/`, `core/`, `domain/` |
|
|
42
|
+
| Database/Storage | `db/`, `models/`, `repositories/`, `schema/` |
|
|
43
|
+
| UI/Presentation | `components/`, `views/`, `templates/`, `pages/` |
|
|
44
|
+
| Utility | `utils/`, `helpers/`, `common/` |
|
|
46
45
|
|
|
47
46
|
**Checklist**:
|
|
48
|
-
- [ ] Read flow: Database -> Service -> API ->
|
|
49
|
-
- [ ] Write flow:
|
|
50
|
-
- [ ] Types correctly passed between layers?
|
|
51
|
-
- [ ] Errors properly propagated to
|
|
52
|
-
- [ ] Loading states handled at each layer?
|
|
47
|
+
- [ ] Read flow: Database -> Service -> API -> UI
|
|
48
|
+
- [ ] Write flow: UI -> API -> Service -> Database
|
|
49
|
+
- [ ] Types/schemas correctly passed between layers?
|
|
50
|
+
- [ ] Errors properly propagated to caller?
|
|
51
|
+
- [ ] Loading/pending states handled at each layer?
|
|
53
52
|
|
|
54
53
|
**Detailed Guide**: `.trellis/structure/guides/cross-layer-thinking-guide.md`
|
|
55
54
|
|
|
@@ -67,7 +66,8 @@ Based on your change type, execute relevant checks below:
|
|
|
67
66
|
**Checklist**:
|
|
68
67
|
- [ ] Search first: How many places define this value?
|
|
69
68
|
```bash
|
|
70
|
-
|
|
69
|
+
# Search in source files (adjust extensions for your project)
|
|
70
|
+
grep -r "value-to-change" src/
|
|
71
71
|
```
|
|
72
72
|
- [ ] If 2+ places define same value -> Should extract to shared constant
|
|
73
73
|
- [ ] After modification, all usage sites updated?
|
|
@@ -84,7 +84,7 @@ Based on your change type, execute relevant checks below:
|
|
|
84
84
|
**Checklist**:
|
|
85
85
|
- [ ] Search for existing similar utilities first
|
|
86
86
|
```bash
|
|
87
|
-
grep -r "functionNamePattern"
|
|
87
|
+
grep -r "functionNamePattern" src/
|
|
88
88
|
```
|
|
89
89
|
- [ ] If similar exists, can you extend it instead?
|
|
90
90
|
- [ ] If creating new, is it in the right location (shared vs domain-specific)?
|
|
@@ -98,37 +98,37 @@ Based on your change type, execute relevant checks below:
|
|
|
98
98
|
**Checklist**:
|
|
99
99
|
- [ ] Did you check ALL files with similar patterns?
|
|
100
100
|
```bash
|
|
101
|
-
grep -r "patternYouChanged"
|
|
101
|
+
grep -r "patternYouChanged" src/
|
|
102
102
|
```
|
|
103
103
|
- [ ] Any files missed that should also be updated?
|
|
104
104
|
- [ ] Should this pattern be abstracted to prevent future duplication?
|
|
105
105
|
|
|
106
106
|
---
|
|
107
107
|
|
|
108
|
-
## Dimension C: Import Paths (Required when creating new files)
|
|
108
|
+
## Dimension C: Import/Dependency Paths (Required when creating new files)
|
|
109
109
|
|
|
110
|
-
**Trigger**: Creating new
|
|
110
|
+
**Trigger**: Creating new source files
|
|
111
111
|
|
|
112
112
|
**Checklist**:
|
|
113
|
-
- [ ] Using correct
|
|
114
|
-
- [ ] No circular
|
|
115
|
-
- [ ]
|
|
113
|
+
- [ ] Using correct import paths (relative vs absolute)?
|
|
114
|
+
- [ ] No circular dependencies?
|
|
115
|
+
- [ ] Consistent with project's module organization?
|
|
116
116
|
|
|
117
117
|
---
|
|
118
118
|
|
|
119
119
|
## Dimension D: Same-Layer Consistency
|
|
120
120
|
|
|
121
121
|
**Trigger**:
|
|
122
|
-
- Modifying display logic
|
|
123
|
-
- Same domain concept used in multiple
|
|
122
|
+
- Modifying display logic or formatting
|
|
123
|
+
- Same domain concept used in multiple places
|
|
124
124
|
|
|
125
125
|
**Checklist**:
|
|
126
|
-
- [ ] Search for other
|
|
126
|
+
- [ ] Search for other places using same concept
|
|
127
127
|
```bash
|
|
128
|
-
grep -r "ConceptName"
|
|
128
|
+
grep -r "ConceptName" src/
|
|
129
129
|
```
|
|
130
|
-
- [ ] Are these
|
|
131
|
-
- [ ] Should they share configuration?
|
|
130
|
+
- [ ] Are these usages consistent?
|
|
131
|
+
- [ ] Should they share configuration/constants?
|
|
132
132
|
|
|
133
133
|
---
|
|
134
134
|
|
|
@@ -138,8 +138,8 @@ Based on your change type, execute relevant checks below:
|
|
|
138
138
|
|-------|------------|------------|
|
|
139
139
|
| Changed one place, missed others | Didn't search impact scope | `grep` before changing |
|
|
140
140
|
| Data lost at some layer | Didn't check data flow | Trace data source to destination |
|
|
141
|
-
| Type mismatch | Cross-layer types inconsistent | Use shared
|
|
142
|
-
| UI inconsistent | Same concept in multiple places | Extract shared constants |
|
|
141
|
+
| Type/schema mismatch | Cross-layer types inconsistent | Use shared type definitions |
|
|
142
|
+
| UI/output inconsistent | Same concept in multiple places | Extract shared constants |
|
|
143
143
|
| Similar utility exists | Didn't search first | Search before creating |
|
|
144
144
|
| Batch fix incomplete | Didn't verify all occurrences | grep after fixing |
|
|
145
145
|
|
|
@@ -72,7 +72,7 @@ Even after injecting guidelines, AI has limited context window. As conversation
|
|
|
72
72
|
| \-- {developer}/ # Per-developer directory
|
|
73
73
|
| |-- index.md # Personal progress index
|
|
74
74
|
| |-- features/ # Active feature tracking
|
|
75
|
-
| \--
|
|
75
|
+
| \-- traces-N.md # Session records (max 2000 lines)
|
|
76
76
|
|-- structure/ # "AI Training Data" - project knowledge
|
|
77
77
|
| |-- frontend/ # Frontend conventions
|
|
78
78
|
| |-- backend/ # Backend conventions
|
|
@@ -196,7 +196,7 @@ The `/check-*` commands focus on code quality within a single layer. But real ch
|
|
|
196
196
|
All the context AI built during this session will be lost when session ends. The next session's `/start` needs this information.
|
|
197
197
|
|
|
198
198
|
**WHAT IT ACTUALLY DOES**:
|
|
199
|
-
1. Records session summary to `agent-traces/{developer}/
|
|
199
|
+
1. Records session summary to `agent-traces/{developer}/traces-N.md`
|
|
200
200
|
2. Captures what was done, learned, and what's remaining
|
|
201
201
|
3. Updates index files for quick lookup
|
|
202
202
|
|