deepspider 0.1.0

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.
Files changed (261) hide show
  1. package/.claude/agents/check.md +122 -0
  2. package/.claude/agents/debug.md +106 -0
  3. package/.claude/agents/dispatch.md +214 -0
  4. package/.claude/agents/implement.md +96 -0
  5. package/.claude/agents/plan.md +396 -0
  6. package/.claude/agents/research.md +120 -0
  7. package/.claude/commands/evolve/merge.md +80 -0
  8. package/.claude/commands/trellis/before-backend-dev.md +13 -0
  9. package/.claude/commands/trellis/before-frontend-dev.md +13 -0
  10. package/.claude/commands/trellis/break-loop.md +107 -0
  11. package/.claude/commands/trellis/check-backend.md +13 -0
  12. package/.claude/commands/trellis/check-cross-layer.md +153 -0
  13. package/.claude/commands/trellis/check-frontend.md +13 -0
  14. package/.claude/commands/trellis/create-command.md +154 -0
  15. package/.claude/commands/trellis/finish-work.md +129 -0
  16. package/.claude/commands/trellis/integrate-skill.md +219 -0
  17. package/.claude/commands/trellis/onboard.md +358 -0
  18. package/.claude/commands/trellis/parallel.md +193 -0
  19. package/.claude/commands/trellis/record-session.md +62 -0
  20. package/.claude/commands/trellis/start.md +280 -0
  21. package/.claude/commands/trellis/update-spec.md +213 -0
  22. package/.claude/hooks/inject-subagent-context.py +758 -0
  23. package/.claude/hooks/ralph-loop.py +374 -0
  24. package/.claude/hooks/session-start.py +126 -0
  25. package/.claude/settings.json +41 -0
  26. package/.claude/skills/deepagents-guide/SKILL.md +428 -0
  27. package/.cursor/commands/trellis-before-backend-dev.md +13 -0
  28. package/.cursor/commands/trellis-before-frontend-dev.md +13 -0
  29. package/.cursor/commands/trellis-break-loop.md +107 -0
  30. package/.cursor/commands/trellis-check-backend.md +13 -0
  31. package/.cursor/commands/trellis-check-cross-layer.md +153 -0
  32. package/.cursor/commands/trellis-check-frontend.md +13 -0
  33. package/.cursor/commands/trellis-create-command.md +154 -0
  34. package/.cursor/commands/trellis-finish-work.md +129 -0
  35. package/.cursor/commands/trellis-integrate-skill.md +219 -0
  36. package/.cursor/commands/trellis-onboard.md +358 -0
  37. package/.cursor/commands/trellis-record-session.md +62 -0
  38. package/.cursor/commands/trellis-start.md +156 -0
  39. package/.cursor/commands/trellis-update-spec.md +213 -0
  40. package/.env.example +11 -0
  41. package/.husky/pre-commit +1 -0
  42. package/.mcp.json +8 -0
  43. package/.trellis/.template-hashes.json +65 -0
  44. package/.trellis/.version +1 -0
  45. package/.trellis/scripts/add-session.sh +384 -0
  46. package/.trellis/scripts/common/developer.sh +129 -0
  47. package/.trellis/scripts/common/git-context.sh +263 -0
  48. package/.trellis/scripts/common/paths.sh +208 -0
  49. package/.trellis/scripts/common/phase.sh +150 -0
  50. package/.trellis/scripts/common/registry.sh +247 -0
  51. package/.trellis/scripts/common/task-queue.sh +142 -0
  52. package/.trellis/scripts/common/task-utils.sh +151 -0
  53. package/.trellis/scripts/common/worktree.sh +128 -0
  54. package/.trellis/scripts/create-bootstrap.sh +299 -0
  55. package/.trellis/scripts/get-context.sh +7 -0
  56. package/.trellis/scripts/get-developer.sh +15 -0
  57. package/.trellis/scripts/init-developer.sh +34 -0
  58. package/.trellis/scripts/multi-agent/cleanup.sh +396 -0
  59. package/.trellis/scripts/multi-agent/create-pr.sh +241 -0
  60. package/.trellis/scripts/multi-agent/plan.sh +207 -0
  61. package/.trellis/scripts/multi-agent/start.sh +310 -0
  62. package/.trellis/scripts/multi-agent/status.sh +828 -0
  63. package/.trellis/scripts/task.sh +1118 -0
  64. package/.trellis/spec/backend/deepagents-guide.md +337 -0
  65. package/.trellis/spec/backend/directory-structure.md +126 -0
  66. package/.trellis/spec/backend/examples/skills/deepagents-guide/README.md +11 -0
  67. package/.trellis/spec/backend/examples/skills/deepagents-guide/agent.js.template +20 -0
  68. package/.trellis/spec/backend/examples/skills/deepagents-guide/skills-config.js.template +13 -0
  69. package/.trellis/spec/backend/examples/skills/deepagents-guide/subagent.js.template +19 -0
  70. package/.trellis/spec/backend/hook-guidelines.md +178 -0
  71. package/.trellis/spec/backend/index.md +36 -0
  72. package/.trellis/spec/backend/quality-guidelines.md +201 -0
  73. package/.trellis/spec/backend/state-management.md +76 -0
  74. package/.trellis/spec/backend/tool-guidelines.md +144 -0
  75. package/.trellis/spec/backend/type-safety.md +71 -0
  76. package/.trellis/spec/guides/code-reuse-thinking-guide.md +92 -0
  77. package/.trellis/spec/guides/cross-layer-thinking-guide.md +94 -0
  78. package/.trellis/spec/guides/index.md +79 -0
  79. package/.trellis/tasks/archive/02-02-evolving-skills/prd.md +61 -0
  80. package/.trellis/tasks/archive/02-02-evolving-skills/task.json +29 -0
  81. package/.trellis/tasks/archive/2026-02/00-bootstrap-guidelines/prd.md +86 -0
  82. package/.trellis/tasks/archive/2026-02/00-bootstrap-guidelines/task.json +27 -0
  83. package/.trellis/tasks/archive/2026-02/02-02-skills-system/check.jsonl +3 -0
  84. package/.trellis/tasks/archive/2026-02/02-02-skills-system/debug.jsonl +2 -0
  85. package/.trellis/tasks/archive/2026-02/02-02-skills-system/implement.jsonl +5 -0
  86. package/.trellis/tasks/archive/2026-02/02-02-skills-system/prd.md +33 -0
  87. package/.trellis/tasks/archive/2026-02/02-02-skills-system/task.json +41 -0
  88. package/.trellis/workflow.md +407 -0
  89. package/.trellis/workspace/index.md +123 -0
  90. package/.trellis/workspace/pony/index.md +40 -0
  91. package/.trellis/workspace/pony/journal-1.md +7 -0
  92. package/.trellis/worktree.yaml +47 -0
  93. package/AGENTS.md +18 -0
  94. package/CLAUDE.md +292 -0
  95. package/README.md +134 -0
  96. package/agents/deepspider.md +142 -0
  97. package/docs/DEBUG.md +42 -0
  98. package/docs/GUIDE.md +334 -0
  99. package/docs/PROMPT.md +60 -0
  100. package/docs/USAGE.md +226 -0
  101. package/eslint.config.js +51 -0
  102. package/package.json +78 -0
  103. package/requirements-crypto.txt +14 -0
  104. package/src/agent/index.js +97 -0
  105. package/src/agent/logger.js +164 -0
  106. package/src/agent/middleware/filterTools.js +64 -0
  107. package/src/agent/middleware/report.js +79 -0
  108. package/src/agent/prompts/system.js +315 -0
  109. package/src/agent/run.js +575 -0
  110. package/src/agent/skills/anti-detect/SKILL.md +28 -0
  111. package/src/agent/skills/anti-detect/evolved.md +12 -0
  112. package/src/agent/skills/captcha/SKILL.md +37 -0
  113. package/src/agent/skills/captcha/evolved.md +12 -0
  114. package/src/agent/skills/config.js +30 -0
  115. package/src/agent/skills/crawler/SKILL.md +9 -0
  116. package/src/agent/skills/crawler/evolved.md +16 -0
  117. package/src/agent/skills/dynamic-analysis/SKILL.md +91 -0
  118. package/src/agent/skills/dynamic-analysis/evolved.md +12 -0
  119. package/src/agent/skills/env/SKILL.md +72 -0
  120. package/src/agent/skills/env/evolved.md +12 -0
  121. package/src/agent/skills/evolve.js +79 -0
  122. package/src/agent/skills/general/SKILL.md +12 -0
  123. package/src/agent/skills/general/evolved.md +12 -0
  124. package/src/agent/skills/js2python/SKILL.md +30 -0
  125. package/src/agent/skills/js2python/evolved.md +13 -0
  126. package/src/agent/skills/report/SKILL.md +21 -0
  127. package/src/agent/skills/report/evolved.md +12 -0
  128. package/src/agent/skills/sandbox/SKILL.md +22 -0
  129. package/src/agent/skills/sandbox/evolved.md +16 -0
  130. package/src/agent/skills/static-analysis/SKILL.md +93 -0
  131. package/src/agent/skills/static-analysis/evolved.md +12 -0
  132. package/src/agent/skills/xpath/SKILL.md +119 -0
  133. package/src/agent/subagents/anti-detect.js +45 -0
  134. package/src/agent/subagents/captcha.js +51 -0
  135. package/src/agent/subagents/crawler.js +138 -0
  136. package/src/agent/subagents/dynamic.js +64 -0
  137. package/src/agent/subagents/env-agent.js +82 -0
  138. package/src/agent/subagents/index.js +37 -0
  139. package/src/agent/subagents/js2python.js +72 -0
  140. package/src/agent/subagents/sandbox.js +55 -0
  141. package/src/agent/subagents/static.js +66 -0
  142. package/src/agent/tools/analysis.js +135 -0
  143. package/src/agent/tools/analyzer.js +85 -0
  144. package/src/agent/tools/anti-detect.js +89 -0
  145. package/src/agent/tools/antidebug.js +64 -0
  146. package/src/agent/tools/async.js +43 -0
  147. package/src/agent/tools/browser.js +324 -0
  148. package/src/agent/tools/captcha.js +223 -0
  149. package/src/agent/tools/capture.js +179 -0
  150. package/src/agent/tools/correlate.js +303 -0
  151. package/src/agent/tools/crawler.js +116 -0
  152. package/src/agent/tools/cryptohook.js +80 -0
  153. package/src/agent/tools/debug.js +246 -0
  154. package/src/agent/tools/deobfuscator.js +90 -0
  155. package/src/agent/tools/env.js +83 -0
  156. package/src/agent/tools/envdump.js +92 -0
  157. package/src/agent/tools/evolve.js +164 -0
  158. package/src/agent/tools/extract.js +114 -0
  159. package/src/agent/tools/extractor.js +54 -0
  160. package/src/agent/tools/file.js +224 -0
  161. package/src/agent/tools/hook.js +84 -0
  162. package/src/agent/tools/hookManager.js +178 -0
  163. package/src/agent/tools/index.js +137 -0
  164. package/src/agent/tools/nodejs.js +101 -0
  165. package/src/agent/tools/patch.js +46 -0
  166. package/src/agent/tools/preprocess.js +71 -0
  167. package/src/agent/tools/profile.js +122 -0
  168. package/src/agent/tools/python.js +627 -0
  169. package/src/agent/tools/report.js +124 -0
  170. package/src/agent/tools/runtime.js +132 -0
  171. package/src/agent/tools/sandbox.js +79 -0
  172. package/src/agent/tools/store.js +73 -0
  173. package/src/agent/tools/trace.js +74 -0
  174. package/src/agent/tools/tracing.js +201 -0
  175. package/src/agent/tools/utils.js +51 -0
  176. package/src/agent/tools/verify.js +184 -0
  177. package/src/agent/tools/webcrack.js +109 -0
  178. package/src/analyzer/ASTAnalyzer.js +387 -0
  179. package/src/analyzer/CallStackAnalyzer.js +379 -0
  180. package/src/analyzer/Deobfuscator.js +289 -0
  181. package/src/analyzer/EncryptionAnalyzer.js +99 -0
  182. package/src/analyzer/index.js +22 -0
  183. package/src/browser/EnvBridge.js +186 -0
  184. package/src/browser/cdp.js +168 -0
  185. package/src/browser/client.js +197 -0
  186. package/src/browser/collector.js +444 -0
  187. package/src/browser/collectors/RequestCryptoLinker.js +109 -0
  188. package/src/browser/collectors/ResponseSearcher.js +107 -0
  189. package/src/browser/collectors/ScriptCollector.js +158 -0
  190. package/src/browser/collectors/index.js +26 -0
  191. package/src/browser/defaultHooks.js +932 -0
  192. package/src/browser/hooks/crypto.js +55 -0
  193. package/src/browser/hooks/index.js +64 -0
  194. package/src/browser/hooks/native.js +9 -0
  195. package/src/browser/hooks/network.js +33 -0
  196. package/src/browser/index.js +42 -0
  197. package/src/browser/interceptors/NetworkInterceptor.js +116 -0
  198. package/src/browser/interceptors/ScriptInterceptor.js +76 -0
  199. package/src/browser/interceptors/index.js +6 -0
  200. package/src/browser/ui/analysisPanel.js +1782 -0
  201. package/src/browser/ui/confirmDialog.js +158 -0
  202. package/src/browser/ui/panel.html +152 -0
  203. package/src/browser/ui/selector.js +170 -0
  204. package/src/config/index.js +5 -0
  205. package/src/config/paths.js +71 -0
  206. package/src/config/patterns/crypto.js +36 -0
  207. package/src/config/profiles/chrome.json +71 -0
  208. package/src/config/profiles/firefox.json +44 -0
  209. package/src/config/profiles/safari.json +38 -0
  210. package/src/core/EnvMonitor.js +200 -0
  211. package/src/core/PatchGenerator.js +278 -0
  212. package/src/core/Sandbox.js +181 -0
  213. package/src/env/AntiAntiDebug.js +111 -0
  214. package/src/env/AsyncHook.js +68 -0
  215. package/src/env/BrowserAPIList.js +265 -0
  216. package/src/env/CookieHook.js +48 -0
  217. package/src/env/CryptoHook.js +205 -0
  218. package/src/env/EnvCodeGenerator.js +157 -0
  219. package/src/env/EnvDumper.js +356 -0
  220. package/src/env/EnvExtractor.js +220 -0
  221. package/src/env/HookBase.js +618 -0
  222. package/src/env/NetworkHook.js +159 -0
  223. package/src/env/modules/bom/history.js +29 -0
  224. package/src/env/modules/bom/location.js +26 -0
  225. package/src/env/modules/bom/navigator.js +70 -0
  226. package/src/env/modules/bom/screen.js +26 -0
  227. package/src/env/modules/bom/storage.js +23 -0
  228. package/src/env/modules/dom/document.js +110 -0
  229. package/src/env/modules/dom/event.js +51 -0
  230. package/src/env/modules/index.js +34 -0
  231. package/src/env/modules/webapi/fetch.js +46 -0
  232. package/src/env/modules/webapi/url.js +47 -0
  233. package/src/env/modules/webapi/xhr.js +48 -0
  234. package/src/index.js +27 -0
  235. package/src/mcp/server.js +89 -0
  236. package/src/store/DataStore.js +708 -0
  237. package/src/store/Store.js +158 -0
  238. package/src/store/Validator.js +24 -0
  239. package/test/analyze.test.js +90 -0
  240. package/test/envdump.test.js +74 -0
  241. package/test/flow.test.js +90 -0
  242. package/test/hooks.test.js +138 -0
  243. package/test/plugin.test.js +35 -0
  244. package/test/refactor-full.test.js +30 -0
  245. package/test/refactor.test.js +21 -0
  246. package/test/samples/obfuscated.js +61 -0
  247. package/test/samples/original.js +66 -0
  248. package/test/samples/v10_eval_chain.js +52 -0
  249. package/test/samples/v11_bytecode_vm.js +81 -0
  250. package/test/samples/v12_polymorphic.js +69 -0
  251. package/test/samples/v1_ob_basic.js +98 -0
  252. package/test/samples/v2_ob_advanced.js +99 -0
  253. package/test/samples/v3_jjencode.js +77 -0
  254. package/test/samples/v4_aaencode.js +73 -0
  255. package/test/samples/v5_control_flow.js +86 -0
  256. package/test/samples/v6_string_encryption.js +71 -0
  257. package/test/samples/v7_jsvmp.js +83 -0
  258. package/test/samples/v8_anti_debug.js +79 -0
  259. package/test/samples/v9_proxy_trap.js +49 -0
  260. package/test/samples.test.js +96 -0
  261. package/test/webcrack.test.js +55 -0
@@ -0,0 +1,396 @@
1
+ ---
2
+ name: plan
3
+ description: |
4
+ Multi-Agent Pipeline planner. Analyzes requirements and produces a fully configured task 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 task 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 task.json status to "rejected"**:
56
+ ```bash
57
+ jq '.status = "rejected"' "$PLAN_TASK_DIR/task.json" > "$PLAN_TASK_DIR/task.json.tmp" \
58
+ && mv "$PLAN_TASK_DIR/task.json.tmp" "$PLAN_TASK_DIR/task.json"
59
+ ```
60
+
61
+ 2. **Write rejection reason to a file** (so user can see it):
62
+ ```bash
63
+ cat > "$PLAN_TASK_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_TASK_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_TASK_DIR/REJECTED.md
94
+ ```
95
+
96
+ 4. **Exit immediately** - Do not proceed to Step 1.
97
+
98
+ **The task directory is kept** with:
99
+ - `task.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_TASK_NAME # Task name (e.g., "user-auth")
121
+ PLAN_DEV_TYPE # Development type: backend | frontend | fullstack
122
+ PLAN_REQUIREMENT # Requirement description from user
123
+ PLAN_TASK_DIR # Pre-created task directory path
124
+ ```
125
+
126
+ Read them at startup:
127
+
128
+ ```bash
129
+ echo "Task: $PLAN_TASK_NAME"
130
+ echo "Type: $PLAN_DEV_TYPE"
131
+ echo "Requirement: $PLAN_REQUIREMENT"
132
+ echo "Directory: $PLAN_TASK_DIR"
133
+ ```
134
+
135
+ ## Output (if accepted)
136
+
137
+ A complete task directory containing:
138
+
139
+ ```
140
+ ${PLAN_TASK_DIR}/
141
+ ├── task.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/task.sh init-context "$PLAN_TASK_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/spec/ 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/task.sh add-context "$PLAN_TASK_DIR" implement "<path>" "<reason>"
205
+
206
+ # For each entry in check.jsonl section:
207
+ ./.trellis/scripts/task.sh add-context "$PLAN_TASK_DIR" check "<path>" "<reason>"
208
+
209
+ # For each entry in debug.jsonl section:
210
+ ./.trellis/scripts/task.sh add-context "$PLAN_TASK_DIR" debug "<path>" "<reason>"
211
+ ```
212
+
213
+ ### Step 4: Write prd.md
214
+
215
+ Create the requirements document:
216
+
217
+ ```bash
218
+ cat > "$PLAN_TASK_DIR/prd.md" << 'EOF'
219
+ # Task: ${PLAN_TASK_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 Task Metadata
249
+
250
+ ```bash
251
+ # Set branch name
252
+ ./.trellis/scripts/task.sh set-branch "$PLAN_TASK_DIR" "feature/${PLAN_TASK_NAME}"
253
+
254
+ # Set scope (from research agent suggestion)
255
+ ./.trellis/scripts/task.sh set-scope "$PLAN_TASK_DIR" "<scope>"
256
+
257
+ # Update dev_type in task.json
258
+ jq --arg type "$PLAN_DEV_TYPE" '.dev_type = $type' \
259
+ "$PLAN_TASK_DIR/task.json" > "$PLAN_TASK_DIR/task.json.tmp" \
260
+ && mv "$PLAN_TASK_DIR/task.json.tmp" "$PLAN_TASK_DIR/task.json"
261
+ ```
262
+
263
+ ### Step 6: Validate Configuration
264
+
265
+ ```bash
266
+ ./.trellis/scripts/task.sh validate "$PLAN_TASK_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 "Task Directory: $PLAN_TASK_DIR"
278
+ echo ""
279
+ echo "Files created:"
280
+ ls -la "$PLAN_TASK_DIR"
281
+ echo ""
282
+ echo "Context summary:"
283
+ ./.trellis/scripts/task.sh list-context "$PLAN_TASK_DIR"
284
+ echo ""
285
+ echo "Ready for: ./.trellis/scripts/multi-agent/start.sh $PLAN_TASK_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_TASK_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/workspace/xxx/tasks/17-add-rate-limiting/
339
+ ├── task.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, Skill, mcp__chrome-devtools__*
6
+ model: opus
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/spec/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
@@ -0,0 +1,80 @@
1
+ # Evolve Merge - 合并动态经验到静态 Skills
2
+
3
+ 将 evolved.md 中的核心经验合并到 SKILL.md,并进行深度提炼。
4
+
5
+ ## 用法
6
+
7
+ ```
8
+ /evolve:merge <skill-name>
9
+ ```
10
+
11
+ ## 执行步骤
12
+
13
+ ### 1. 读取动态经验
14
+
15
+ ```bash
16
+ cat src/agent/skills/<skill-name>/evolved.md
17
+ ```
18
+
19
+ ### 2. 深度分析(核心步骤)
20
+
21
+ 对每条经验进行第一性原理分析:
22
+
23
+ **2.1 提炼本质**
24
+ - 这条经验的根本原因是什么?
25
+ - 背后的技术原理是什么?
26
+
27
+ **2.2 举一反三**
28
+ - 是否存在类似的场景?
29
+ - 同类问题还有哪些表现形式?
30
+
31
+ **2.3 通用化**
32
+ - 能否提炼成更通用的规则?
33
+ - 是否适用于其他加密库/算法?
34
+
35
+ **示例:**
36
+ ```
37
+ 原始经验: CryptoJS CFB 用 segment_size=128,PyCryptodome 默认 CFB8
38
+
39
+ 第一性原理: 不同库对同一算法的默认参数可能不同
40
+
41
+ 举一反三:
42
+ - CBC 模式的 IV 处理方式
43
+ - PKCS7 vs PKCS5 填充
44
+ - 密钥派生函数差异
45
+
46
+ 通用规则: JS/Python 加密转换时,必须逐一核对:模式、填充、IV、密钥派生、输出编码
47
+ ```
48
+
49
+ ### 3. 合并到 SKILL.md
50
+
51
+ 将提炼后的通用经验追加到 SKILL.md:
52
+ - 优先写通用规则,而非具体案例
53
+ - 用简洁的一句话总结
54
+ - 必要时附带检查清单
55
+
56
+ ### 4. 清理 evolved.md
57
+
58
+ - 保留已合并的核心经验标记
59
+ - 清空近期发现
60
+ - 更新 last_merged 日期
61
+ - 重置 total 计数
62
+
63
+ ### 5. 提交变更
64
+
65
+ ```bash
66
+ git add src/agent/skills/<skill-name>/
67
+ git commit -m "docs: merge evolved experiences to <skill-name>"
68
+ ```
69
+
70
+ ## 可用的 skill 名称
71
+
72
+ - static-analysis
73
+ - dynamic-analysis
74
+ - sandbox
75
+ - env
76
+ - js2python
77
+ - report
78
+ - captcha
79
+ - anti-detect
80
+ - crawler
@@ -0,0 +1,13 @@
1
+ Read the backend development guidelines before starting your development task.
2
+
3
+ Execute these steps:
4
+ 1. Read `.trellis/spec/backend/index.md` to understand available guidelines
5
+ 2. Based on your task, read the relevant guideline files:
6
+ - Database work → `.trellis/spec/backend/database-guidelines.md`
7
+ - Error handling → `.trellis/spec/backend/error-handling.md`
8
+ - Logging → `.trellis/spec/backend/logging-guidelines.md`
9
+ - Type questions → `.trellis/spec/backend/type-safety.md`
10
+ 3. Understand the coding standards and patterns you need to follow
11
+ 4. Then proceed with your development plan
12
+
13
+ This step is **mandatory** before writing any backend code.
@@ -0,0 +1,13 @@
1
+ Read the frontend development guidelines before starting your development task.
2
+
3
+ Execute these steps:
4
+ 1. Read `.trellis/spec/frontend/index.md` to understand available guidelines
5
+ 2. Based on your task, read the relevant guideline files:
6
+ - Component work → `.trellis/spec/frontend/component-guidelines.md`
7
+ - Hook work → `.trellis/spec/frontend/hook-guidelines.md`
8
+ - State management → `.trellis/spec/frontend/state-management.md`
9
+ - Type questions → `.trellis/spec/frontend/type-safety.md`
10
+ 3. Understand the coding standards and patterns you need to follow
11
+ 4. Then proceed with your development plan
12
+
13
+ This step is **mandatory** before writing any frontend code.