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.
- package/.claude/agents/check.md +122 -0
- package/.claude/agents/debug.md +106 -0
- package/.claude/agents/dispatch.md +214 -0
- package/.claude/agents/implement.md +96 -0
- package/.claude/agents/plan.md +396 -0
- package/.claude/agents/research.md +120 -0
- package/.claude/commands/evolve/merge.md +80 -0
- package/.claude/commands/trellis/before-backend-dev.md +13 -0
- package/.claude/commands/trellis/before-frontend-dev.md +13 -0
- package/.claude/commands/trellis/break-loop.md +107 -0
- package/.claude/commands/trellis/check-backend.md +13 -0
- package/.claude/commands/trellis/check-cross-layer.md +153 -0
- package/.claude/commands/trellis/check-frontend.md +13 -0
- package/.claude/commands/trellis/create-command.md +154 -0
- package/.claude/commands/trellis/finish-work.md +129 -0
- package/.claude/commands/trellis/integrate-skill.md +219 -0
- package/.claude/commands/trellis/onboard.md +358 -0
- package/.claude/commands/trellis/parallel.md +193 -0
- package/.claude/commands/trellis/record-session.md +62 -0
- package/.claude/commands/trellis/start.md +280 -0
- package/.claude/commands/trellis/update-spec.md +213 -0
- package/.claude/hooks/inject-subagent-context.py +758 -0
- package/.claude/hooks/ralph-loop.py +374 -0
- package/.claude/hooks/session-start.py +126 -0
- package/.claude/settings.json +41 -0
- package/.claude/skills/deepagents-guide/SKILL.md +428 -0
- package/.cursor/commands/trellis-before-backend-dev.md +13 -0
- package/.cursor/commands/trellis-before-frontend-dev.md +13 -0
- package/.cursor/commands/trellis-break-loop.md +107 -0
- package/.cursor/commands/trellis-check-backend.md +13 -0
- package/.cursor/commands/trellis-check-cross-layer.md +153 -0
- package/.cursor/commands/trellis-check-frontend.md +13 -0
- package/.cursor/commands/trellis-create-command.md +154 -0
- package/.cursor/commands/trellis-finish-work.md +129 -0
- package/.cursor/commands/trellis-integrate-skill.md +219 -0
- package/.cursor/commands/trellis-onboard.md +358 -0
- package/.cursor/commands/trellis-record-session.md +62 -0
- package/.cursor/commands/trellis-start.md +156 -0
- package/.cursor/commands/trellis-update-spec.md +213 -0
- package/.env.example +11 -0
- package/.husky/pre-commit +1 -0
- package/.mcp.json +8 -0
- package/.trellis/.template-hashes.json +65 -0
- package/.trellis/.version +1 -0
- package/.trellis/scripts/add-session.sh +384 -0
- package/.trellis/scripts/common/developer.sh +129 -0
- package/.trellis/scripts/common/git-context.sh +263 -0
- package/.trellis/scripts/common/paths.sh +208 -0
- package/.trellis/scripts/common/phase.sh +150 -0
- package/.trellis/scripts/common/registry.sh +247 -0
- package/.trellis/scripts/common/task-queue.sh +142 -0
- package/.trellis/scripts/common/task-utils.sh +151 -0
- package/.trellis/scripts/common/worktree.sh +128 -0
- package/.trellis/scripts/create-bootstrap.sh +299 -0
- package/.trellis/scripts/get-context.sh +7 -0
- package/.trellis/scripts/get-developer.sh +15 -0
- package/.trellis/scripts/init-developer.sh +34 -0
- package/.trellis/scripts/multi-agent/cleanup.sh +396 -0
- package/.trellis/scripts/multi-agent/create-pr.sh +241 -0
- package/.trellis/scripts/multi-agent/plan.sh +207 -0
- package/.trellis/scripts/multi-agent/start.sh +310 -0
- package/.trellis/scripts/multi-agent/status.sh +828 -0
- package/.trellis/scripts/task.sh +1118 -0
- package/.trellis/spec/backend/deepagents-guide.md +337 -0
- package/.trellis/spec/backend/directory-structure.md +126 -0
- package/.trellis/spec/backend/examples/skills/deepagents-guide/README.md +11 -0
- package/.trellis/spec/backend/examples/skills/deepagents-guide/agent.js.template +20 -0
- package/.trellis/spec/backend/examples/skills/deepagents-guide/skills-config.js.template +13 -0
- package/.trellis/spec/backend/examples/skills/deepagents-guide/subagent.js.template +19 -0
- package/.trellis/spec/backend/hook-guidelines.md +178 -0
- package/.trellis/spec/backend/index.md +36 -0
- package/.trellis/spec/backend/quality-guidelines.md +201 -0
- package/.trellis/spec/backend/state-management.md +76 -0
- package/.trellis/spec/backend/tool-guidelines.md +144 -0
- package/.trellis/spec/backend/type-safety.md +71 -0
- package/.trellis/spec/guides/code-reuse-thinking-guide.md +92 -0
- package/.trellis/spec/guides/cross-layer-thinking-guide.md +94 -0
- package/.trellis/spec/guides/index.md +79 -0
- package/.trellis/tasks/archive/02-02-evolving-skills/prd.md +61 -0
- package/.trellis/tasks/archive/02-02-evolving-skills/task.json +29 -0
- package/.trellis/tasks/archive/2026-02/00-bootstrap-guidelines/prd.md +86 -0
- package/.trellis/tasks/archive/2026-02/00-bootstrap-guidelines/task.json +27 -0
- package/.trellis/tasks/archive/2026-02/02-02-skills-system/check.jsonl +3 -0
- package/.trellis/tasks/archive/2026-02/02-02-skills-system/debug.jsonl +2 -0
- package/.trellis/tasks/archive/2026-02/02-02-skills-system/implement.jsonl +5 -0
- package/.trellis/tasks/archive/2026-02/02-02-skills-system/prd.md +33 -0
- package/.trellis/tasks/archive/2026-02/02-02-skills-system/task.json +41 -0
- package/.trellis/workflow.md +407 -0
- package/.trellis/workspace/index.md +123 -0
- package/.trellis/workspace/pony/index.md +40 -0
- package/.trellis/workspace/pony/journal-1.md +7 -0
- package/.trellis/worktree.yaml +47 -0
- package/AGENTS.md +18 -0
- package/CLAUDE.md +292 -0
- package/README.md +134 -0
- package/agents/deepspider.md +142 -0
- package/docs/DEBUG.md +42 -0
- package/docs/GUIDE.md +334 -0
- package/docs/PROMPT.md +60 -0
- package/docs/USAGE.md +226 -0
- package/eslint.config.js +51 -0
- package/package.json +78 -0
- package/requirements-crypto.txt +14 -0
- package/src/agent/index.js +97 -0
- package/src/agent/logger.js +164 -0
- package/src/agent/middleware/filterTools.js +64 -0
- package/src/agent/middleware/report.js +79 -0
- package/src/agent/prompts/system.js +315 -0
- package/src/agent/run.js +575 -0
- package/src/agent/skills/anti-detect/SKILL.md +28 -0
- package/src/agent/skills/anti-detect/evolved.md +12 -0
- package/src/agent/skills/captcha/SKILL.md +37 -0
- package/src/agent/skills/captcha/evolved.md +12 -0
- package/src/agent/skills/config.js +30 -0
- package/src/agent/skills/crawler/SKILL.md +9 -0
- package/src/agent/skills/crawler/evolved.md +16 -0
- package/src/agent/skills/dynamic-analysis/SKILL.md +91 -0
- package/src/agent/skills/dynamic-analysis/evolved.md +12 -0
- package/src/agent/skills/env/SKILL.md +72 -0
- package/src/agent/skills/env/evolved.md +12 -0
- package/src/agent/skills/evolve.js +79 -0
- package/src/agent/skills/general/SKILL.md +12 -0
- package/src/agent/skills/general/evolved.md +12 -0
- package/src/agent/skills/js2python/SKILL.md +30 -0
- package/src/agent/skills/js2python/evolved.md +13 -0
- package/src/agent/skills/report/SKILL.md +21 -0
- package/src/agent/skills/report/evolved.md +12 -0
- package/src/agent/skills/sandbox/SKILL.md +22 -0
- package/src/agent/skills/sandbox/evolved.md +16 -0
- package/src/agent/skills/static-analysis/SKILL.md +93 -0
- package/src/agent/skills/static-analysis/evolved.md +12 -0
- package/src/agent/skills/xpath/SKILL.md +119 -0
- package/src/agent/subagents/anti-detect.js +45 -0
- package/src/agent/subagents/captcha.js +51 -0
- package/src/agent/subagents/crawler.js +138 -0
- package/src/agent/subagents/dynamic.js +64 -0
- package/src/agent/subagents/env-agent.js +82 -0
- package/src/agent/subagents/index.js +37 -0
- package/src/agent/subagents/js2python.js +72 -0
- package/src/agent/subagents/sandbox.js +55 -0
- package/src/agent/subagents/static.js +66 -0
- package/src/agent/tools/analysis.js +135 -0
- package/src/agent/tools/analyzer.js +85 -0
- package/src/agent/tools/anti-detect.js +89 -0
- package/src/agent/tools/antidebug.js +64 -0
- package/src/agent/tools/async.js +43 -0
- package/src/agent/tools/browser.js +324 -0
- package/src/agent/tools/captcha.js +223 -0
- package/src/agent/tools/capture.js +179 -0
- package/src/agent/tools/correlate.js +303 -0
- package/src/agent/tools/crawler.js +116 -0
- package/src/agent/tools/cryptohook.js +80 -0
- package/src/agent/tools/debug.js +246 -0
- package/src/agent/tools/deobfuscator.js +90 -0
- package/src/agent/tools/env.js +83 -0
- package/src/agent/tools/envdump.js +92 -0
- package/src/agent/tools/evolve.js +164 -0
- package/src/agent/tools/extract.js +114 -0
- package/src/agent/tools/extractor.js +54 -0
- package/src/agent/tools/file.js +224 -0
- package/src/agent/tools/hook.js +84 -0
- package/src/agent/tools/hookManager.js +178 -0
- package/src/agent/tools/index.js +137 -0
- package/src/agent/tools/nodejs.js +101 -0
- package/src/agent/tools/patch.js +46 -0
- package/src/agent/tools/preprocess.js +71 -0
- package/src/agent/tools/profile.js +122 -0
- package/src/agent/tools/python.js +627 -0
- package/src/agent/tools/report.js +124 -0
- package/src/agent/tools/runtime.js +132 -0
- package/src/agent/tools/sandbox.js +79 -0
- package/src/agent/tools/store.js +73 -0
- package/src/agent/tools/trace.js +74 -0
- package/src/agent/tools/tracing.js +201 -0
- package/src/agent/tools/utils.js +51 -0
- package/src/agent/tools/verify.js +184 -0
- package/src/agent/tools/webcrack.js +109 -0
- package/src/analyzer/ASTAnalyzer.js +387 -0
- package/src/analyzer/CallStackAnalyzer.js +379 -0
- package/src/analyzer/Deobfuscator.js +289 -0
- package/src/analyzer/EncryptionAnalyzer.js +99 -0
- package/src/analyzer/index.js +22 -0
- package/src/browser/EnvBridge.js +186 -0
- package/src/browser/cdp.js +168 -0
- package/src/browser/client.js +197 -0
- package/src/browser/collector.js +444 -0
- package/src/browser/collectors/RequestCryptoLinker.js +109 -0
- package/src/browser/collectors/ResponseSearcher.js +107 -0
- package/src/browser/collectors/ScriptCollector.js +158 -0
- package/src/browser/collectors/index.js +26 -0
- package/src/browser/defaultHooks.js +932 -0
- package/src/browser/hooks/crypto.js +55 -0
- package/src/browser/hooks/index.js +64 -0
- package/src/browser/hooks/native.js +9 -0
- package/src/browser/hooks/network.js +33 -0
- package/src/browser/index.js +42 -0
- package/src/browser/interceptors/NetworkInterceptor.js +116 -0
- package/src/browser/interceptors/ScriptInterceptor.js +76 -0
- package/src/browser/interceptors/index.js +6 -0
- package/src/browser/ui/analysisPanel.js +1782 -0
- package/src/browser/ui/confirmDialog.js +158 -0
- package/src/browser/ui/panel.html +152 -0
- package/src/browser/ui/selector.js +170 -0
- package/src/config/index.js +5 -0
- package/src/config/paths.js +71 -0
- package/src/config/patterns/crypto.js +36 -0
- package/src/config/profiles/chrome.json +71 -0
- package/src/config/profiles/firefox.json +44 -0
- package/src/config/profiles/safari.json +38 -0
- package/src/core/EnvMonitor.js +200 -0
- package/src/core/PatchGenerator.js +278 -0
- package/src/core/Sandbox.js +181 -0
- package/src/env/AntiAntiDebug.js +111 -0
- package/src/env/AsyncHook.js +68 -0
- package/src/env/BrowserAPIList.js +265 -0
- package/src/env/CookieHook.js +48 -0
- package/src/env/CryptoHook.js +205 -0
- package/src/env/EnvCodeGenerator.js +157 -0
- package/src/env/EnvDumper.js +356 -0
- package/src/env/EnvExtractor.js +220 -0
- package/src/env/HookBase.js +618 -0
- package/src/env/NetworkHook.js +159 -0
- package/src/env/modules/bom/history.js +29 -0
- package/src/env/modules/bom/location.js +26 -0
- package/src/env/modules/bom/navigator.js +70 -0
- package/src/env/modules/bom/screen.js +26 -0
- package/src/env/modules/bom/storage.js +23 -0
- package/src/env/modules/dom/document.js +110 -0
- package/src/env/modules/dom/event.js +51 -0
- package/src/env/modules/index.js +34 -0
- package/src/env/modules/webapi/fetch.js +46 -0
- package/src/env/modules/webapi/url.js +47 -0
- package/src/env/modules/webapi/xhr.js +48 -0
- package/src/index.js +27 -0
- package/src/mcp/server.js +89 -0
- package/src/store/DataStore.js +708 -0
- package/src/store/Store.js +158 -0
- package/src/store/Validator.js +24 -0
- package/test/analyze.test.js +90 -0
- package/test/envdump.test.js +74 -0
- package/test/flow.test.js +90 -0
- package/test/hooks.test.js +138 -0
- package/test/plugin.test.js +35 -0
- package/test/refactor-full.test.js +30 -0
- package/test/refactor.test.js +21 -0
- package/test/samples/obfuscated.js +61 -0
- package/test/samples/original.js +66 -0
- package/test/samples/v10_eval_chain.js +52 -0
- package/test/samples/v11_bytecode_vm.js +81 -0
- package/test/samples/v12_polymorphic.js +69 -0
- package/test/samples/v1_ob_basic.js +98 -0
- package/test/samples/v2_ob_advanced.js +99 -0
- package/test/samples/v3_jjencode.js +77 -0
- package/test/samples/v4_aaencode.js +73 -0
- package/test/samples/v5_control_flow.js +86 -0
- package/test/samples/v6_string_encryption.js +71 -0
- package/test/samples/v7_jsvmp.js +83 -0
- package/test/samples/v8_anti_debug.js +79 -0
- package/test/samples/v9_proxy_trap.js +49 -0
- package/test/samples.test.js +96 -0
- package/test/webcrack.test.js +55 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: check
|
|
3
|
+
description: |
|
|
4
|
+
Code quality check expert. Reviews code changes against specs and self-fixes issues.
|
|
5
|
+
tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa
|
|
6
|
+
model: opus
|
|
7
|
+
---
|
|
8
|
+
# Check Agent
|
|
9
|
+
|
|
10
|
+
You are the Check Agent in the Trellis workflow.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
Before checking, read:
|
|
15
|
+
- `.trellis/spec/` - Development guidelines
|
|
16
|
+
- Pre-commit checklist for quality standards
|
|
17
|
+
|
|
18
|
+
## Core Responsibilities
|
|
19
|
+
|
|
20
|
+
1. **Get code changes** - Use git diff to get uncommitted code
|
|
21
|
+
2. **Check against specs** - Verify code follows guidelines
|
|
22
|
+
3. **Self-fix** - Fix issues yourself, not just report them
|
|
23
|
+
4. **Run verification** - typecheck and lint
|
|
24
|
+
|
|
25
|
+
## Important
|
|
26
|
+
|
|
27
|
+
**Fix issues yourself**, don't just report them.
|
|
28
|
+
|
|
29
|
+
You have write and edit tools, you can modify code directly.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Workflow
|
|
34
|
+
|
|
35
|
+
### Step 1: Get Changes
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git diff --name-only # List changed files
|
|
39
|
+
git diff # View specific changes
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 2: Check Against Specs
|
|
43
|
+
|
|
44
|
+
Read relevant specs in `.trellis/spec/` to check code:
|
|
45
|
+
|
|
46
|
+
- Does it follow directory structure conventions
|
|
47
|
+
- Does it follow naming conventions
|
|
48
|
+
- Does it follow code patterns
|
|
49
|
+
- Are there missing types
|
|
50
|
+
- Are there potential bugs
|
|
51
|
+
|
|
52
|
+
### Step 3: Self-Fix
|
|
53
|
+
|
|
54
|
+
After finding issues:
|
|
55
|
+
|
|
56
|
+
1. Fix the issue directly (use edit tool)
|
|
57
|
+
2. Record what was fixed
|
|
58
|
+
3. Continue checking other issues
|
|
59
|
+
|
|
60
|
+
### Step 4: Run Verification
|
|
61
|
+
|
|
62
|
+
Run project's lint and typecheck commands to verify changes.
|
|
63
|
+
|
|
64
|
+
If failed, fix issues and re-run.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Completion Markers (Ralph Loop)
|
|
69
|
+
|
|
70
|
+
**CRITICAL**: You are in a loop controlled by the Ralph Loop system.
|
|
71
|
+
The loop will NOT stop until you output ALL required completion markers.
|
|
72
|
+
|
|
73
|
+
Completion markers are generated from `check.jsonl` in the task directory.
|
|
74
|
+
Each entry's `reason` field becomes a marker: `{REASON}_FINISH`
|
|
75
|
+
|
|
76
|
+
For example, if check.jsonl contains:
|
|
77
|
+
```json
|
|
78
|
+
{"file": "...", "reason": "TypeCheck"}
|
|
79
|
+
{"file": "...", "reason": "Lint"}
|
|
80
|
+
{"file": "...", "reason": "CodeReview"}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
You MUST output these markers when each check passes:
|
|
84
|
+
- `TYPECHECK_FINISH` - After typecheck passes
|
|
85
|
+
- `LINT_FINISH` - After lint passes
|
|
86
|
+
- `CODEREVIEW_FINISH` - After code review passes
|
|
87
|
+
|
|
88
|
+
If check.jsonl doesn't exist or has no reasons, output: `ALL_CHECKS_FINISH`
|
|
89
|
+
|
|
90
|
+
**The loop will block you from stopping until all markers are present in your output.**
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Report Format
|
|
95
|
+
|
|
96
|
+
```markdown
|
|
97
|
+
## Self-Check Complete
|
|
98
|
+
|
|
99
|
+
### Files Checked
|
|
100
|
+
|
|
101
|
+
- src/components/Feature.tsx
|
|
102
|
+
- src/hooks/useFeature.ts
|
|
103
|
+
|
|
104
|
+
### Issues Found and Fixed
|
|
105
|
+
|
|
106
|
+
1. `<file>:<line>` - <what was fixed>
|
|
107
|
+
2. `<file>:<line>` - <what was fixed>
|
|
108
|
+
|
|
109
|
+
### Issues Not Fixed
|
|
110
|
+
|
|
111
|
+
(If there are issues that cannot be self-fixed, list them here with reasons)
|
|
112
|
+
|
|
113
|
+
### Verification Results
|
|
114
|
+
|
|
115
|
+
- TypeCheck: Passed TYPECHECK_FINISH
|
|
116
|
+
- Lint: Passed LINT_FINISH
|
|
117
|
+
|
|
118
|
+
### Summary
|
|
119
|
+
|
|
120
|
+
Checked X files, found Y issues, all fixed.
|
|
121
|
+
ALL_CHECKS_FINISH
|
|
122
|
+
```
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug
|
|
3
|
+
description: |
|
|
4
|
+
Issue fixing expert. Understands issues, fixes against specs, and verifies fixes. Precise fixes only.
|
|
5
|
+
tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa
|
|
6
|
+
model: opus
|
|
7
|
+
---
|
|
8
|
+
# Debug Agent
|
|
9
|
+
|
|
10
|
+
You are the Debug Agent in the Trellis workflow.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
Before debugging, read:
|
|
15
|
+
- `.trellis/spec/` - Development guidelines
|
|
16
|
+
- Error messages or issue descriptions provided
|
|
17
|
+
|
|
18
|
+
## Core Responsibilities
|
|
19
|
+
|
|
20
|
+
1. **Understand issues** - Analyze error messages or reported issues
|
|
21
|
+
2. **Fix against specs** - Fix issues following dev specs
|
|
22
|
+
3. **Verify fixes** - Run typecheck to ensure no new issues
|
|
23
|
+
4. **Report results** - Report fix status
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
### Step 1: Understand Issues
|
|
30
|
+
|
|
31
|
+
Parse the issue, categorize by priority:
|
|
32
|
+
|
|
33
|
+
- `[P1]` - Must fix (blocking)
|
|
34
|
+
- `[P2]` - Should fix (important)
|
|
35
|
+
- `[P3]` - Optional fix (nice to have)
|
|
36
|
+
|
|
37
|
+
### Step 2: Research if Needed
|
|
38
|
+
|
|
39
|
+
If you need additional info:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Check knowledge base
|
|
43
|
+
ls .trellis/big-question/
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Step 3: Fix One by One
|
|
47
|
+
|
|
48
|
+
For each issue:
|
|
49
|
+
|
|
50
|
+
1. Locate the exact position
|
|
51
|
+
2. Fix following specs
|
|
52
|
+
3. Run typecheck to verify
|
|
53
|
+
|
|
54
|
+
### Step 4: Verify
|
|
55
|
+
|
|
56
|
+
Run project's lint and typecheck commands to verify fixes.
|
|
57
|
+
|
|
58
|
+
If fix introduces new issues:
|
|
59
|
+
|
|
60
|
+
1. Revert the fix
|
|
61
|
+
2. Use a more complete solution
|
|
62
|
+
3. Re-verify
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Report Format
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
## Fix Report
|
|
70
|
+
|
|
71
|
+
### Issues Fixed
|
|
72
|
+
|
|
73
|
+
1. `[P1]` `<file>:<line>` - <what was fixed>
|
|
74
|
+
2. `[P2]` `<file>:<line>` - <what was fixed>
|
|
75
|
+
|
|
76
|
+
### Issues Not Fixed
|
|
77
|
+
|
|
78
|
+
- `<file>:<line>` - <reason why not fixed>
|
|
79
|
+
|
|
80
|
+
### Verification
|
|
81
|
+
|
|
82
|
+
- TypeCheck: Pass
|
|
83
|
+
- Lint: Pass
|
|
84
|
+
|
|
85
|
+
### Summary
|
|
86
|
+
|
|
87
|
+
Fixed X/Y issues. Z issues require discussion.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Guidelines
|
|
93
|
+
|
|
94
|
+
### DO
|
|
95
|
+
|
|
96
|
+
- Precise fixes for reported issues
|
|
97
|
+
- Follow specs
|
|
98
|
+
- Verify each fix
|
|
99
|
+
|
|
100
|
+
### DON'T
|
|
101
|
+
|
|
102
|
+
- Don't refactor surrounding code
|
|
103
|
+
- Don't add new features
|
|
104
|
+
- Don't modify unrelated files
|
|
105
|
+
- Don't use non-null assertion (`x!` operator)
|
|
106
|
+
- Don't execute git commit
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dispatch
|
|
3
|
+
description: |
|
|
4
|
+
Multi-Agent Pipeline main dispatcher. Pure dispatcher. Only responsible for calling subagents and scripts in phase order.
|
|
5
|
+
tools: Read, Bash, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa
|
|
6
|
+
model: opus
|
|
7
|
+
---
|
|
8
|
+
# Dispatch Agent
|
|
9
|
+
|
|
10
|
+
You are the Dispatch Agent in the Multi-Agent Pipeline (pure dispatcher).
|
|
11
|
+
|
|
12
|
+
## Working Directory Convention
|
|
13
|
+
|
|
14
|
+
Current Task is specified by `.trellis/.current-task` file, content is the relative path to task directory.
|
|
15
|
+
|
|
16
|
+
Task directory path format: `.trellis/workspace/{developer}/tasks/{MM}-{DD}-{name}/`
|
|
17
|
+
|
|
18
|
+
This directory contains all context files for the current task:
|
|
19
|
+
|
|
20
|
+
- `task.json` - Task configuration
|
|
21
|
+
- `prd.md` - Requirements document
|
|
22
|
+
- `info.md` - Technical design (optional)
|
|
23
|
+
- `implement.jsonl` - Implement context
|
|
24
|
+
- `check.jsonl` - Check context
|
|
25
|
+
- `debug.jsonl` - Debug context
|
|
26
|
+
|
|
27
|
+
## Core Principles
|
|
28
|
+
|
|
29
|
+
1. **You are a pure dispatcher** - Only responsible for calling subagents and scripts in order
|
|
30
|
+
2. **You don't read specs/requirements** - Hook will auto-inject all context to subagents
|
|
31
|
+
3. **You don't need resume** - Hook injects complete context on each subagent call
|
|
32
|
+
4. **You only need simple commands** - Tell subagent "start working" is enough
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Startup Flow
|
|
37
|
+
|
|
38
|
+
### Step 1: Determine Current Task Directory
|
|
39
|
+
|
|
40
|
+
Read `.trellis/.current-task` to get current task directory path:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
TASK_DIR=$(cat .trellis/.current-task)
|
|
44
|
+
# e.g.: .trellis/workspace/taosu/tasks/12-my-feature
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Step 2: Read Task Configuration
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cat ${TASK_DIR}/task.json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Get the `next_action` array, which defines the list of phases to execute.
|
|
54
|
+
|
|
55
|
+
### Step 3: Execute in Phase Order
|
|
56
|
+
|
|
57
|
+
Execute each step in `phase` order.
|
|
58
|
+
|
|
59
|
+
> **Note**: You do NOT need to manually update `current_phase`. The Hook automatically updates it when you call Task with a subagent.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Phase Handling
|
|
64
|
+
|
|
65
|
+
> Hook will auto-inject all specs, requirements, and technical design to subagent context.
|
|
66
|
+
> Dispatch only needs to issue simple call commands.
|
|
67
|
+
|
|
68
|
+
### action: "implement"
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Task(
|
|
72
|
+
subagent_type: "implement",
|
|
73
|
+
prompt: "Implement the feature described in prd.md in the task directory",
|
|
74
|
+
model: "opus",
|
|
75
|
+
run_in_background: true
|
|
76
|
+
)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Hook will auto-inject:
|
|
80
|
+
|
|
81
|
+
- All spec files from implement.jsonl
|
|
82
|
+
- Requirements document (prd.md)
|
|
83
|
+
- Technical design (info.md)
|
|
84
|
+
|
|
85
|
+
Implement receives complete context and autonomously: read → understand → implement.
|
|
86
|
+
|
|
87
|
+
### action: "check"
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Task(
|
|
91
|
+
subagent_type: "check",
|
|
92
|
+
prompt: "Check code changes, fix issues yourself",
|
|
93
|
+
model: "opus",
|
|
94
|
+
run_in_background: true
|
|
95
|
+
)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Hook will auto-inject:
|
|
99
|
+
|
|
100
|
+
- finish-work.md
|
|
101
|
+
- check-cross-layer.md
|
|
102
|
+
- check-backend.md
|
|
103
|
+
- check-frontend.md
|
|
104
|
+
- All spec files from check.jsonl
|
|
105
|
+
|
|
106
|
+
### action: "debug"
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
Task(
|
|
110
|
+
subagent_type: "debug",
|
|
111
|
+
prompt: "Fix the issues described in the task context",
|
|
112
|
+
model: "opus",
|
|
113
|
+
run_in_background: true
|
|
114
|
+
)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Hook will auto-inject:
|
|
118
|
+
|
|
119
|
+
- All spec files from debug.jsonl
|
|
120
|
+
- Error context if available
|
|
121
|
+
|
|
122
|
+
### action: "finish"
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Task(
|
|
126
|
+
subagent_type: "check",
|
|
127
|
+
prompt: "[finish] Execute final completion check before PR",
|
|
128
|
+
model: "opus",
|
|
129
|
+
run_in_background: true
|
|
130
|
+
)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Important**: The `[finish]` marker in prompt triggers different context injection:
|
|
134
|
+
- Lighter context focused on final verification
|
|
135
|
+
- finish-work.md checklist
|
|
136
|
+
- prd.md for verifying requirements are met
|
|
137
|
+
|
|
138
|
+
This is different from regular "check" which has full specs for self-fix loop.
|
|
139
|
+
|
|
140
|
+
### action: "create-pr"
|
|
141
|
+
|
|
142
|
+
This action creates a Pull Request from the feature branch. Run it via Bash:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
./.trellis/scripts/multi-agent/create-pr.sh
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
This will:
|
|
149
|
+
1. Stage and commit all changes (excluding workspace)
|
|
150
|
+
2. Push to origin
|
|
151
|
+
3. Create a Draft PR using `gh pr create`
|
|
152
|
+
4. Update task.json with status="review", pr_url, and current_phase
|
|
153
|
+
|
|
154
|
+
**Note**: This is the only action that performs git commit, as it's the final step after all implementation and checks are complete.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Calling Subagents
|
|
159
|
+
|
|
160
|
+
### Basic Pattern
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
task_id = Task(
|
|
164
|
+
subagent_type: "implement", // or "check", "debug"
|
|
165
|
+
prompt: "Simple task description",
|
|
166
|
+
model: "opus",
|
|
167
|
+
run_in_background: true
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
// Poll for completion
|
|
171
|
+
for i in 1..N:
|
|
172
|
+
result = TaskOutput(task_id, block=true, timeout=300000)
|
|
173
|
+
if result.status == "completed":
|
|
174
|
+
break
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Timeout Settings
|
|
178
|
+
|
|
179
|
+
| Phase | Max Time | Poll Count |
|
|
180
|
+
|-------|----------|------------|
|
|
181
|
+
| implement | 30 min | 6 times |
|
|
182
|
+
| check | 15 min | 3 times |
|
|
183
|
+
| debug | 20 min | 4 times |
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Error Handling
|
|
188
|
+
|
|
189
|
+
### Timeout
|
|
190
|
+
|
|
191
|
+
If a subagent times out, notify the user and ask for guidance:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
"Subagent {phase} timed out after {time}. Options:
|
|
195
|
+
1. Retry the same phase
|
|
196
|
+
2. Skip to next phase
|
|
197
|
+
3. Abort the pipeline"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Subagent Failure
|
|
201
|
+
|
|
202
|
+
If a subagent reports failure, read the output and decide:
|
|
203
|
+
|
|
204
|
+
- If recoverable: call debug agent to fix
|
|
205
|
+
- If not recoverable: notify user and ask for guidance
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Key Constraints
|
|
210
|
+
|
|
211
|
+
1. **Do not read spec/requirement files directly** - Let Hook inject to subagents
|
|
212
|
+
2. **Only commit via create-pr action** - Use `multi-agent/create-pr.sh` at the end of pipeline
|
|
213
|
+
3. **All subagents should use opus model for complex tasks**
|
|
214
|
+
4. **Keep dispatch logic simple** - Complex logic belongs in subagents
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: implement
|
|
3
|
+
description: |
|
|
4
|
+
Code implementation expert. Understands specs and requirements, then implements features. No git commit allowed.
|
|
5
|
+
tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa
|
|
6
|
+
model: opus
|
|
7
|
+
---
|
|
8
|
+
# Implement Agent
|
|
9
|
+
|
|
10
|
+
You are the Implement Agent in the Trellis workflow.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
Before implementing, read:
|
|
15
|
+
- `.trellis/workflow.md` - Project workflow
|
|
16
|
+
- `.trellis/spec/` - Development guidelines
|
|
17
|
+
- Task `prd.md` - Requirements document
|
|
18
|
+
- Task `info.md` - Technical design (if exists)
|
|
19
|
+
|
|
20
|
+
## Core Responsibilities
|
|
21
|
+
|
|
22
|
+
1. **Understand specs** - Read relevant spec files in `.trellis/spec/`
|
|
23
|
+
2. **Understand requirements** - Read prd.md and info.md
|
|
24
|
+
3. **Implement features** - Write code following specs and design
|
|
25
|
+
4. **Self-check** - Ensure code quality
|
|
26
|
+
5. **Report results** - Report completion status
|
|
27
|
+
|
|
28
|
+
## Forbidden Operations
|
|
29
|
+
|
|
30
|
+
**Do NOT execute these git commands:**
|
|
31
|
+
|
|
32
|
+
- `git commit`
|
|
33
|
+
- `git push`
|
|
34
|
+
- `git merge`
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Workflow
|
|
39
|
+
|
|
40
|
+
### 1. Understand Specs
|
|
41
|
+
|
|
42
|
+
Read relevant specs based on task type:
|
|
43
|
+
|
|
44
|
+
- Backend: `.trellis/spec/backend/`
|
|
45
|
+
- Frontend: `.trellis/spec/frontend/`
|
|
46
|
+
- Shared: `.trellis/spec/shared/`
|
|
47
|
+
|
|
48
|
+
### 2. Understand Requirements
|
|
49
|
+
|
|
50
|
+
Read the task's prd.md and info.md:
|
|
51
|
+
|
|
52
|
+
- What are the core requirements
|
|
53
|
+
- Key points of technical design
|
|
54
|
+
- Which files to modify/create
|
|
55
|
+
|
|
56
|
+
### 3. Implement Features
|
|
57
|
+
|
|
58
|
+
- Write code following specs and technical design
|
|
59
|
+
- Follow existing code patterns
|
|
60
|
+
- Only do what's required, no over-engineering
|
|
61
|
+
|
|
62
|
+
### 4. Verify
|
|
63
|
+
|
|
64
|
+
Run project's lint and typecheck commands to verify changes.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Report Format
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
## Implementation Complete
|
|
72
|
+
|
|
73
|
+
### Files Modified
|
|
74
|
+
|
|
75
|
+
- `src/components/Feature.tsx` - New component
|
|
76
|
+
- `src/hooks/useFeature.ts` - New hook
|
|
77
|
+
|
|
78
|
+
### Implementation Summary
|
|
79
|
+
|
|
80
|
+
1. Created Feature component...
|
|
81
|
+
2. Added useFeature hook...
|
|
82
|
+
|
|
83
|
+
### Verification Results
|
|
84
|
+
|
|
85
|
+
- Lint: Passed
|
|
86
|
+
- TypeCheck: Passed
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Code Standards
|
|
92
|
+
|
|
93
|
+
- Follow existing code patterns
|
|
94
|
+
- Don't add unnecessary abstractions
|
|
95
|
+
- Only do what's required, no over-engineering
|
|
96
|
+
- Keep code readable
|