@tea-agent/loop-agent 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/AGENTS.md +121 -0
- package/CHANGELOG.md +37 -0
- package/README.md +144 -0
- package/bin/loop-agent.js +21 -0
- package/dist/adapters/aimax.js +91 -0
- package/dist/adapters/context.js +32 -0
- package/dist/adapters/index.js +28 -0
- package/dist/adapters/loop-agent.js +98 -0
- package/dist/adapters/types.js +1 -0
- package/dist/cli/catalog.js +259 -0
- package/dist/cli/help.js +55 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/program.js +505 -0
- package/dist/cli.js +12 -0
- package/dist/commands/closeout.js +13 -0
- package/dist/commands/coverage-audit.js +14 -0
- package/dist/commands/cursor-prompt.js +222 -0
- package/dist/commands/cursor-worker.js +43 -0
- package/dist/commands/dag-approve.js +102 -0
- package/dist/commands/dag-final-verification.js +76 -0
- package/dist/commands/dag-init-hybrid.js +56 -0
- package/dist/commands/dag-reconcile-tasks.js +51 -0
- package/dist/commands/dag-reject.js +91 -0
- package/dist/commands/dag-report.js +177 -0
- package/dist/commands/dag-resume.js +34 -0
- package/dist/commands/dag-run-task.js +470 -0
- package/dist/commands/dag-validate.js +186 -0
- package/dist/commands/dag-workflow-compile.js +91 -0
- package/dist/commands/dag-workflow-plan.js +130 -0
- package/dist/commands/dag-workflow-validate.js +66 -0
- package/dist/commands/delegate.js +132 -0
- package/dist/commands/docs-archive.js +5 -0
- package/dist/commands/docs-audit.js +5 -0
- package/dist/commands/doctor.js +50 -0
- package/dist/commands/goal.js +92 -0
- package/dist/commands/handoff-check.js +5 -0
- package/dist/commands/harvest.js +44 -0
- package/dist/commands/inspect.js +11 -0
- package/dist/commands/instructions.js +195 -0
- package/dist/commands/knowledge.js +64 -0
- package/dist/commands/loop-benchmark.js +72 -0
- package/dist/commands/loop.js +241 -0
- package/dist/commands/new-task.js +5 -0
- package/dist/commands/pi-prompt.js +181 -0
- package/dist/commands/pi-reuse-benchmark.js +153 -0
- package/dist/commands/plan-list.js +5 -0
- package/dist/commands/promote-run.js +29 -0
- package/dist/commands/reference-index.js +16 -0
- package/dist/commands/run-dag.js +184 -0
- package/dist/commands/spine.js +38 -0
- package/dist/commands/stats.js +84 -0
- package/dist/commands/status.js +56 -0
- package/dist/commands/study-init.js +192 -0
- package/dist/commands/workflow.js +259 -0
- package/dist/commands/worktree-create.js +31 -0
- package/dist/commands/worktree-list.js +5 -0
- package/dist/commands/worktree-remove.js +26 -0
- package/dist/cursor-worker-entry.js +8 -0
- package/dist/executors/config-core.js +55 -0
- package/dist/executors/config.js +2 -0
- package/dist/executors/cursor-artifacts.js +33 -0
- package/dist/executors/cursor-execution-log.js +81 -0
- package/dist/executors/cursor-executor-artifacts.js +135 -0
- package/dist/executors/cursor-executor.js +468 -0
- package/dist/executors/cursor-run.js +115 -0
- package/dist/executors/cursor-tool.js +94 -0
- package/dist/executors/cursor-worker-client.js +213 -0
- package/dist/executors/cursor-worker-protocol.js +18 -0
- package/dist/executors/cursor-worker-server.js +54 -0
- package/dist/executors/cursor-worker.js +3 -0
- package/dist/executors/cursor.js +6 -0
- package/dist/executors/dag-cursor-executor.js +88 -0
- package/dist/executors/dag-pi-executor.js +322 -0
- package/dist/executors/dag-static-executor.js +45 -0
- package/dist/executors/dag.js +4 -0
- package/dist/executors/index.js +8 -0
- package/dist/executors/model-routing.js +60 -0
- package/dist/executors/pi-event-serializer.js +43 -0
- package/dist/executors/pi-executor.js +606 -0
- package/dist/executors/pi-reuse-benchmark.js +316 -0
- package/dist/executors/pi-runtime-reuse.js +29 -0
- package/dist/executors/pi-sdk-executor.js +255 -0
- package/dist/executors/pi-sdk.js +1 -0
- package/dist/executors/pi.js +3 -0
- package/dist/executors/shell-executor.js +300 -0
- package/dist/executors/shell-presets.js +47 -0
- package/dist/executors/shell-verification.js +251 -0
- package/dist/executors/shell-write-guard.js +126 -0
- package/dist/executors/shell.js +3 -0
- package/dist/executors/static.js +1 -0
- package/dist/governance/checks.js +434 -0
- package/dist/governance/harness.js +9 -0
- package/dist/governance/index.js +3 -0
- package/dist/governance/manifest-types.js +128 -0
- package/dist/governance/manifest.js +2 -0
- package/dist/governance/path-guard.js +69 -0
- package/dist/governance/path-guards.js +2 -0
- package/dist/governance/profiles.js +3 -0
- package/dist/governance/requirement-coverage.js +425 -0
- package/dist/governance/skill-safety.js +135 -0
- package/dist/governance/spine-audit.js +152 -0
- package/dist/records/closeout.js +2 -0
- package/dist/records/harvest.js +236 -0
- package/dist/records/index.js +3 -0
- package/dist/records/one-shot-runs.js +421 -0
- package/dist/records/promotion.js +199 -0
- package/dist/shared/artifacts-core.js +88 -0
- package/dist/shared/artifacts.js +2 -0
- package/dist/shared/context-files.js +32 -0
- package/dist/shared/context.js +2 -0
- package/dist/shared/copy-dir.js +17 -0
- package/dist/shared/git-progress.js +165 -0
- package/dist/shared/index.js +5 -0
- package/dist/shared/logger.js +23 -0
- package/dist/shared/one-shot-prompt-args.js +98 -0
- package/dist/shared/path-refs.js +31 -0
- package/dist/shared/prompts.js +26 -0
- package/dist/shared/reference-context.js +238 -0
- package/dist/shared/timeout-policy.js +19 -0
- package/dist/shared/timeout.js +1 -0
- package/dist/shared/types.js +5 -0
- package/dist/task/config-types.js +97 -0
- package/dist/task/config.js +2 -0
- package/dist/task/delegate.js +220 -0
- package/dist/task/goal-audit.js +51 -0
- package/dist/task/goal-policy.js +8 -0
- package/dist/task/goal.js +3 -0
- package/dist/task/ids.js +1 -0
- package/dist/task/index.js +9 -0
- package/dist/task/lifecycle.js +1 -0
- package/dist/task/paths.js +1 -0
- package/dist/task/read-model.js +149 -0
- package/dist/task/runtime.js +699 -0
- package/dist/task/source-state.js +1 -0
- package/dist/task/state.js +55 -0
- package/dist/task/subagent-guidance.js +1 -0
- package/dist/task/workflow-state-types.js +92 -0
- package/dist/task/worktree-cleanup.js +140 -0
- package/dist/task/worktree.js +171 -0
- package/dist/workflows/dag/authoring.js +8 -0
- package/dist/workflows/dag/authority-surface.js +138 -0
- package/dist/workflows/dag/canvas-observer.js +474 -0
- package/dist/workflows/dag/decision-envelope.js +502 -0
- package/dist/workflows/dag/decision-evidence.js +153 -0
- package/dist/workflows/dag/decision-gates.js +1 -0
- package/dist/workflows/dag/executor-registry.js +25 -0
- package/dist/workflows/dag/facts.js +4 -0
- package/dist/workflows/dag/failure-category.js +111 -0
- package/dist/workflows/dag/final-verification.js +180 -0
- package/dist/workflows/dag/governance-constants.js +5 -0
- package/dist/workflows/dag/governance-profile.js +405 -0
- package/dist/workflows/dag/index.js +6 -0
- package/dist/workflows/dag/init-hybrid.js +855 -0
- package/dist/workflows/dag/knowledge-curator.js +162 -0
- package/dist/workflows/dag/lifecycle.js +484 -0
- package/dist/workflows/dag/prompt-source.js +88 -0
- package/dist/workflows/dag/prompt.js +130 -0
- package/dist/workflows/dag/reconcile-tasks.js +404 -0
- package/dist/workflows/dag/recovery-recommendation.js +226 -0
- package/dist/workflows/dag/repair-artifact.js +136 -0
- package/dist/workflows/dag/report.js +1019 -0
- package/dist/workflows/dag/runner.js +1677 -0
- package/dist/workflows/dag/runtime.js +5 -0
- package/dist/workflows/dag/skill-instructions.js +471 -0
- package/dist/workflows/dag/skills.js +41 -0
- package/dist/workflows/dag/spec.js +3 -0
- package/dist/workflows/dag/topo.js +30 -0
- package/dist/workflows/dag/types.js +275 -0
- package/dist/workflows/dag/upstream-artifacts.js +95 -0
- package/dist/workflows/dag/validate.js +527 -0
- package/dist/workflows/dynamic/artifacts.js +65 -0
- package/dist/workflows/dynamic/compile.js +360 -0
- package/dist/workflows/dynamic/compileTypes.js +1 -0
- package/dist/workflows/dynamic/errors.js +5 -0
- package/dist/workflows/dynamic/index.js +7 -0
- package/dist/workflows/dynamic/profiles.js +156 -0
- package/dist/workflows/dynamic/spec.js +114 -0
- package/dist/workflows/dynamic/validate.js +275 -0
- package/dist/workflows/loop/actions.js +1334 -0
- package/dist/workflows/loop/benchmark.js +510 -0
- package/dist/workflows/loop/closeout.js +134 -0
- package/dist/workflows/loop/context.js +48 -0
- package/dist/workflows/loop/events.js +25 -0
- package/dist/workflows/loop/hash.js +32 -0
- package/dist/workflows/loop/index.js +8 -0
- package/dist/workflows/loop/paths.js +17 -0
- package/dist/workflows/loop/rounds.js +81 -0
- package/dist/workflows/loop/signals.js +55 -0
- package/dist/workflows/loop/state.js +116 -0
- package/dist/workflows/loop/templates.js +54 -0
- package/dist/workflows/loop/types.js +28 -0
- package/docs/README.md +62 -0
- package/docs/agent-dag-recovery-playbook.md +158 -0
- package/docs/agent-dag-runner.md +40 -0
- package/docs/cursor-executor-usage.md +25 -0
- package/docs/decisions/README.md +3 -0
- package/docs/design/README.md +36 -0
- package/docs/development-principles.md +71 -0
- package/docs/dynamic-workflow-dag-engine-roadmap.md +1749 -0
- package/docs/exec-plans/README.md +6 -0
- package/docs/exec-plans/active/README.md +5 -0
- package/docs/exec-plans/completed/README.md +5 -0
- package/docs/feature-workflow.md +184 -0
- package/docs/harness-methodology-debugging.md +153 -0
- package/docs/harness-methodology-tdd.md +130 -0
- package/docs/harness-methodology-verification.md +27 -0
- package/docs/loop-agent-harness.md +42 -0
- package/docs/progress/README.md +3 -0
- package/docs/reports/README.md +3 -0
- package/docs/templates/adr.md +60 -0
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -0
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -0
- package/docs/templates/agent-dag-decision-gate-dogfood-report.md +117 -0
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -0
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -0
- package/docs/templates/agent-dag-report.schema.json +423 -0
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -0
- package/docs/templates/agent-dag.base.json +195 -0
- package/docs/templates/agent-dag.final-verification.json +190 -0
- package/docs/templates/agent-dag.schema.json +316 -0
- package/docs/templates/agent-dag.supervised-implementation.json +500 -0
- package/docs/templates/exec-plan.md +64 -0
- package/docs/templates/feature-spec.md +53 -0
- package/docs/templates/hybrid-dag.json +193 -0
- package/docs/templates/progress-log.md +17 -0
- package/docs/templates/project-start-checklist.md +9 -0
- package/docs/templates/qa-report.md +42 -0
- package/docs/templates/sprint-contract.md +29 -0
- package/docs/verification-matrix.md +30 -0
- package/examples/decision-gate-agent-dag.json +123 -0
- package/examples/example-dag.json +51 -0
- package/examples/hybrid-loop-agent-dag.json +194 -0
- package/harness.json +92 -0
- package/package.json +61 -0
- package/skills/ai-engineering-context/SKILL.md +48 -0
- package/skills/loop-agent/SKILL.md +260 -0
- package/skills/loop-agent/references/README.md +63 -0
- package/skills/loop-agent/references/command-reference.md +315 -0
- package/skills/loop-agent/references/harness-policy.md +258 -0
- package/skills/loop-agent/references/hybrid-dag.md +216 -0
- package/skills/loop-agent/references/learned/README.md +21 -0
- package/skills/loop-agent/references/model-routing.md +36 -0
- package/skills/loop-agent/references/multi-worktree.md +54 -0
- package/skills/loop-agent/references/one-shot-runs.md +85 -0
- package/skills/loop-agent/references/orchestrator-and-interventions.md +169 -0
- package/skills/loop-agent/references/pi-prompt.md +23 -0
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +83 -0
- package/skills/loop-agent/references/post-implementation-and-patterns.md +44 -0
- package/skills/loop-agent/references/task-workflow.md +84 -0
- package/skills/loop-agent/references/verification-and-failure-handling.md +74 -0
- package/skills/requesting-code-review/SKILL.md +101 -0
- package/skills/requesting-code-review/code-reviewer.md +168 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/verification-before-completion/SKILL.md +154 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Pi Subagent Assisted Mode
|
|
2
|
+
|
|
3
|
+
loop-agent task 启用 `piSubagentMode`、在 analyze/plan/spec/retrospective 内需要 read-only scout/planner/reviewer subagents,或配置 project-local agents/prompts 时使用本文。
|
|
4
|
+
|
|
5
|
+
## Pi Subagent Assisted Mode
|
|
6
|
+
|
|
7
|
+
`task.json` 支持可选字段 `piSubagentMode`,用于 step 级 `subagent` tool delegation:
|
|
8
|
+
|
|
9
|
+
| Mode | analyze | plan | spec | implement | retrospective | verify |
|
|
10
|
+
|------|---------|------|------|-----------|----------------|--------|
|
|
11
|
+
| `off`(默认) | read only | read only | read only | +write/edit/bash | read only | read only |
|
|
12
|
+
| `analyze-plan` | **+subagent** | **+subagent** | **+subagent** | 同 off | 同 off | 同 off |
|
|
13
|
+
| `full` | **+subagent** | **+subagent** | **+subagent** | 同 off | **+subagent** | 同 off |
|
|
14
|
+
|
|
15
|
+
### 何时启用
|
|
16
|
+
|
|
17
|
+
在 `task.json` 设 `piSubagentMode: "analyze-plan"` 或 `piSubagentMode: "full"` 当:
|
|
18
|
+
- task 涉及大规模 codebase 阅读,适合 parallel scout agents
|
|
19
|
+
- analysis 或 planning 需多角度调查(如跨模块比较实现)
|
|
20
|
+
- retrospective review 适合独立 reviewer subagent(`full` mode)
|
|
21
|
+
|
|
22
|
+
### step 内使用 `subagent` 的指引
|
|
23
|
+
|
|
24
|
+
subagent 可用时,**仅用于 read-only task**:
|
|
25
|
+
- **Parallel scout**:dispatch 多个 subagent 同时搜索/阅读不同区域
|
|
26
|
+
- **Chain**:一个 subagent scout,另一个基于发现 planning
|
|
27
|
+
- **Reviewer**:用 subagent 在定稿前 review analysis/plan
|
|
28
|
+
|
|
29
|
+
**不要**用 subagent 做 writing、editing 或执行命令。subagent 输出仅 advisory;务必 verify 并将发现并入自己的输出。**不要**把 subagent 结果当作权威 state 或 artifact source。
|
|
30
|
+
|
|
31
|
+
### 前置条件
|
|
32
|
+
|
|
33
|
+
- Pi runtime 环境须有 `subagent` tool(经 Pi subagent extension 加载)
|
|
34
|
+
- 推荐用 Pi 自带 example 文件安装:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
mkdir -p ~/.pi/agent/extensions/subagent ~/.pi/agent/agents ~/.pi/agent/prompts
|
|
38
|
+
|
|
39
|
+
ln -sf /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/index.ts ~/.pi/agent/extensions/subagent/index.ts
|
|
40
|
+
ln -sf /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/agents.ts ~/.pi/agent/extensions/subagent/agents.ts
|
|
41
|
+
|
|
42
|
+
for f in /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/agents/*.md; do
|
|
43
|
+
ln -sf "$f" ~/.pi/agent/agents/$(basename "$f")
|
|
44
|
+
done
|
|
45
|
+
|
|
46
|
+
for f in /usr/local/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/prompts/*.md; do
|
|
47
|
+
ln -sf "$f" ~/.pi/agent/prompts/$(basename "$f")
|
|
48
|
+
done
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- 最小 smoke check:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pi -p --no-session --no-context-files --no-skills --tools subagent "Reply with exactly OK."
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
预期输出:`OK`
|
|
58
|
+
- mode 按 task opt-in;默认 `off` 保持向后兼容
|
|
59
|
+
- 任何 mode 下 `implement` 都不给 `subagent`(防止 nested multi-writer)
|
|
60
|
+
|
|
61
|
+
### 内置 Project-Local Agents 与 Prompts
|
|
62
|
+
|
|
63
|
+
本 repo 提供 `.pi/agents/` 与 `.pi/prompts/` 模板,供 `piSubagentMode` 使用:
|
|
64
|
+
|
|
65
|
+
**Agents**(`.pi/agents/`)
|
|
66
|
+
|
|
67
|
+
| Agent | Role | Model |
|
|
68
|
+
|-------|------|-------|
|
|
69
|
+
| `loop-agent-scout` | Read-only recon:code、tests、docs、governance | `cursor/composer-2.5` |
|
|
70
|
+
| `loop-agent-planner` | Implementation planning:最小可执行 plan | `cursor/composer-2.5` |
|
|
71
|
+
| `loop-agent-reviewer` | Strict review:scope drift、verification gap、contract break | `cursor/composer-2.5` |
|
|
72
|
+
| `loop-agent-worker` | General execution:bounded implementation 与 fix | `cursor/composer-2.5` |
|
|
73
|
+
|
|
74
|
+
**Prompt Templates**(`.pi/prompts/`):输入 `/loop-agent-*` 调用
|
|
75
|
+
|
|
76
|
+
| Template | Flow |
|
|
77
|
+
|----------|------|
|
|
78
|
+
| `loop-agent-scout-and-plan` | scout → planner chain |
|
|
79
|
+
| `loop-agent-analyze-wide` | 3 parallel scouts → analysis |
|
|
80
|
+
| `loop-agent-review-only` | 独立 review plan/implementation/verification |
|
|
81
|
+
| `loop-agent-implement-and-review` | worker → reviewer → worker loop |
|
|
82
|
+
|
|
83
|
+
传 `agentScope: "both"` + `confirmProjectAgents: false` 以访问 repo-local agents。
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# 实现后处理与常见模式
|
|
2
|
+
|
|
3
|
+
用于 post-verify handoff、多 item PRD 处理、fast bounded task、快速 status 检查与 Pi timeout 处理。
|
|
4
|
+
|
|
5
|
+
## 实现后处理
|
|
6
|
+
|
|
7
|
+
DAG run、promotion、closeout 和最终验证完成后:
|
|
8
|
+
1. 检查 git diff 确认预期变更
|
|
9
|
+
2. 用 git commit 并 push
|
|
10
|
+
3. 用户说「继续」时,跑 `status` 看 task 是否 `completed`,再创建下一个 task
|
|
11
|
+
|
|
12
|
+
## 常见模式
|
|
13
|
+
|
|
14
|
+
### 处理多 item PRD
|
|
15
|
+
```
|
|
16
|
+
1. new-task <id>-r1 → 准备 source → dag run-task → dag validate → run-dag → promote/closeout
|
|
17
|
+
2. new-task <id>-r2 → 重复
|
|
18
|
+
3. ...
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Bounded task 路径
|
|
22
|
+
```
|
|
23
|
+
1. new-task <id>
|
|
24
|
+
2. 写 source/需求.md + source/执行约束.md
|
|
25
|
+
3. dag run-task <id> --profile auto --strict-models --output <temp-dir>/<id>-dag.json
|
|
26
|
+
4. dag validate --dag <temp-dir>/<id>-dag.json --strict-models --strict-governance
|
|
27
|
+
5. run-dag --dag <temp-dir>/<id>-dag.json --cwd <repo-root>
|
|
28
|
+
6. promote-run / closeout / final verification
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`<temp-dir>` 表示平台原生临时目录;实际命令中使用 macOS/Windows 本机路径。
|
|
32
|
+
|
|
33
|
+
**关键**:实现 work 由 DAG node 和 executor 执行;main session 负责审 DAG、审 writeSet、跑验证和 handoff。
|
|
34
|
+
|
|
35
|
+
### 跨所有 task 快速 status
|
|
36
|
+
```bash
|
|
37
|
+
loop-agent stats
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 处理 pi timeout
|
|
41
|
+
- 默认每 step timeout 现为 30 分钟 — 通常足够
|
|
42
|
+
- pi step 仍 timeout 时,用 `stats` 看 duration 分布
|
|
43
|
+
- Bash tool call 应用宽松 timeout:analyze/plan 300s,implement 480s+,verify/retrospective 240s+
|
|
44
|
+
- 失败时优先读 `dag report` / `dag doctor`,再决定 repair DAG、bounded Cursor fix 或暂停
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Task Workflow 规则
|
|
2
|
+
|
|
3
|
+
本文只保留 legacy task 目录和 source material 的读取规则。历史顺序式 `run analyze|plan|spec|implement|verify|auto|loop|continue` 工作流已经移除,不再作为 micro、fallback 或 compatibility 执行路径。
|
|
4
|
+
|
|
5
|
+
## 当前执行入口
|
|
6
|
+
|
|
7
|
+
所有需要可恢复、可验证、可交接的实现工作都走 DAG 路径:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
loop-agent new-task <task-id> "Task Title"
|
|
11
|
+
loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
|
|
12
|
+
loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
|
|
13
|
+
loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`<temp-dir>` 表示平台原生临时目录。实际文件路径必须兼容 macOS 和 Windows;只有 repo refs、JSON/Markdown 证据 refs 和 glob 约定默认使用 `/`。
|
|
17
|
+
|
|
18
|
+
当目标仓库是 loop-agent 本仓库时,`loop-agent` 命令必须来自 npm 上已发布的安装包。首次安装或有意升级可用 `@tea-agent/loop-agent@latest`,但一次自举任务启动后不要中途升级控制器,并记录 `npm list -g @tea-agent/loop-agent --depth=0` 显示的实际版本。不要用当前工作区的 `npm link` 或 `npm run dev` 控制会改动 CLI、DAG runtime、executor、package metadata 或 build output 的任务;源码开发和 focused debugging 才使用 `npm run dev -- <args>`。
|
|
19
|
+
|
|
20
|
+
低风险的一行修正文档或配置时,可以由 main session 做 surgical patch,但仍必须记录 scope 并运行对应验证命令。
|
|
21
|
+
|
|
22
|
+
## Source Materials
|
|
23
|
+
|
|
24
|
+
`new-task` 后至少维护:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
.harness/tasks/<task-id>/
|
|
28
|
+
source/
|
|
29
|
+
需求.md
|
|
30
|
+
执行约束.md
|
|
31
|
+
task.json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- `需求.md` 写清目标、验收标准和非目标。
|
|
35
|
+
- `执行约束.md` 写清允许文件、禁止改动、硬约束和验证命令。
|
|
36
|
+
- 若 `docs/` 已有权威 plan/spec/PRD,应在 `需求.md` 引用或摘要,避免 task source 与 repo status source 分叉。
|
|
37
|
+
|
|
38
|
+
## Task State
|
|
39
|
+
|
|
40
|
+
当前 task 状态由 DAG-oriented read model 推导:
|
|
41
|
+
|
|
42
|
+
- source readiness
|
|
43
|
+
- DAG draft
|
|
44
|
+
- latest DAG run
|
|
45
|
+
- promotion
|
|
46
|
+
- closeout
|
|
47
|
+
- loop state
|
|
48
|
+
- legacy workflow snapshot
|
|
49
|
+
|
|
50
|
+
旧 `.workflow_state.json` 只能作为兼容读取输入,不是新任务 next action 或完成状态的权威来源。
|
|
51
|
+
|
|
52
|
+
## Repo Adapters
|
|
53
|
+
|
|
54
|
+
loop-agent 自动检测所在 repo,并按目标 repo 的 `harness.json` 与治理根目录选择验证入口。跨目录操作时显式传入目标仓库:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
loop-agent --repo-root /path/to/target-repo <command>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Task Config
|
|
61
|
+
|
|
62
|
+
新任务不应写入旧 `flow` 字段。常用字段是:
|
|
63
|
+
|
|
64
|
+
- `taskId`
|
|
65
|
+
- `title`
|
|
66
|
+
- `complexity`
|
|
67
|
+
- `allowedPaths`
|
|
68
|
+
- `forbiddenPaths`
|
|
69
|
+
- `hardConstraints`
|
|
70
|
+
- `verifyCommands` / adapter verification settings
|
|
71
|
+
- `dagFallbackReason`,仅用于记录为何某个长期 loop 缺少 DAG round evidence
|
|
72
|
+
|
|
73
|
+
## Verification
|
|
74
|
+
|
|
75
|
+
完成声明必须来自新鲜验证证据。按目标 repo 的 `docs/verification-matrix.md` 选择最小证明命令;loop-agent 自身常用:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm run typecheck
|
|
79
|
+
npm test
|
|
80
|
+
bash scripts/check-repo.sh
|
|
81
|
+
bash scripts/ci.sh
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Windows 上通过 Git Bash 或配置好的兼容 Bash 运行 `scripts/*.sh`;不要把 POSIX 路径假设写入 CLI、模板或 task source。
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Verification 与失败处理
|
|
2
|
+
|
|
3
|
+
选择 verify strategy knobs、解读 verify 结果、决定失败后是否继续,或 closeout workflow/runtime/docs/skill 变更时使用本文。
|
|
4
|
+
|
|
5
|
+
## Verify strategy 与 completion audit
|
|
6
|
+
|
|
7
|
+
### Verify 始终在本地跑
|
|
8
|
+
`verify` step 跑确定性命令(check-repo.sh + tests + typecheck)。**不**调用 pi。因此快且可靠。
|
|
9
|
+
|
|
10
|
+
### Verify strategy knobs
|
|
11
|
+
需要更紧的 verify 控制时,用 task-level config:
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"verifyPreset": "auto",
|
|
15
|
+
"verifyMode": "parallel",
|
|
16
|
+
"verifyRetryCount": 0,
|
|
17
|
+
"verifyFailFast": false
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- `verifyPreset`:`auto | quick | standard | full`
|
|
22
|
+
- `auto`:`small -> quick`,`medium -> standard`,`large -> full`
|
|
23
|
+
- 默认 `parallel`
|
|
24
|
+
- 命令争抢共享资源时用 `serial`
|
|
25
|
+
- `verifyFailFast` 仅在 `serial` mode 有意义
|
|
26
|
+
- retry 保持小;用于 flaky 环境问题,不要掩盖真实失败
|
|
27
|
+
|
|
28
|
+
### Verify 后的 goal completion audit
|
|
29
|
+
- 有 active task goal 且 `verify` 通过时,loop-agent 跑 goal completion audit。
|
|
30
|
+
- 若 `source/需求.md` 仍有未勾 checklist(`- [ ]`),task **不会**以 completed 结束。
|
|
31
|
+
- 若确定性 requirement coverage audit 发现未覆盖需求,task **不会**以 completed 结束。
|
|
32
|
+
- `explicitly_out_of_scope` 需求(如 `## 非目标` 下)**不算** coverage gap。
|
|
33
|
+
- 独立 audit 报告用 `handoff coverage <task-id> [--json|--markdown]`。
|
|
34
|
+
- task status、source/artifacts、DAG outcome、verification 记录可能 drift 时用 `dag reconcile-tasks --glob '<pattern>' [--json|--markdown]`。默认仅报告;`--patch` 不能伪造 verification evidence。
|
|
35
|
+
|
|
36
|
+
### Verify 默认保存进度
|
|
37
|
+
`verify` 成功后,loop-agent 默认:
|
|
38
|
+
|
|
39
|
+
1. 在当前 task scope 内选文件
|
|
40
|
+
2. 跑 `git add`
|
|
41
|
+
3. 创建 commit 保存已验证进度
|
|
42
|
+
|
|
43
|
+
默认行为:
|
|
44
|
+
|
|
45
|
+
- `autoCommitAfterVerify: true`
|
|
46
|
+
- commit message:`chore(task): save verified progress for <taskId>`
|
|
47
|
+
|
|
48
|
+
`task.json` 可选覆盖:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"autoCommitAfterVerify": false,
|
|
53
|
+
"autoCommitMessage": "docs(workflow): save verified progress"
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
最佳实践:保持 `allowedPaths` 准确。auto-commit 用 task path 约束,避免把无关 dirty 文件扫进 progress commit。
|
|
58
|
+
|
|
59
|
+
### 失败处理
|
|
60
|
+
|
|
61
|
+
child agent 失败时:
|
|
62
|
+
|
|
63
|
+
- **业务/测试失败**:让 child agent 在同一 task bounds 内修复
|
|
64
|
+
- **Workflow runtime 失败**(如 `loop-agent` runtime 问题、部分 artifact 生成、输出聚合 crash):保持 task contract,但允许 main agent 或 child agent 在同一 scoped implementation 内手动完成,仍跑 `verify`
|
|
65
|
+
- **意外残留**(tmp 文件、探索性 mock、scratch 输出):handoff 前删除
|
|
66
|
+
|
|
67
|
+
### Closeout 规则
|
|
68
|
+
workflow/runtime/docs/skill 变更结束时:
|
|
69
|
+
```bash
|
|
70
|
+
loop-agent docs audit
|
|
71
|
+
loop-agent handoff check <task-id>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
active exec plan 实质完成时,用 `docs archive` 归档并更新 active/completed 索引,勿留 stale active status。
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requesting-code-review
|
|
3
|
+
description: Use when completing tasks, implementing major features, or before merging to verify work meets requirements
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requesting Code Review
|
|
7
|
+
|
|
8
|
+
Dispatch a code reviewer subagent to catch issues before they cascade. The reviewer gets precisely crafted context for evaluation — never your session's history. This keeps the reviewer focused on the work product, not your thought process, and preserves your own context for continued work.
|
|
9
|
+
|
|
10
|
+
**Core principle:** Review early, review often.
|
|
11
|
+
|
|
12
|
+
## When to Request Review
|
|
13
|
+
|
|
14
|
+
**Mandatory:**
|
|
15
|
+
- After each task in subagent-driven development
|
|
16
|
+
- After completing major feature
|
|
17
|
+
- Before merge to main
|
|
18
|
+
|
|
19
|
+
**Optional but valuable:**
|
|
20
|
+
- When stuck (fresh perspective)
|
|
21
|
+
- Before refactoring (baseline check)
|
|
22
|
+
- After fixing complex bug
|
|
23
|
+
|
|
24
|
+
## How to Request
|
|
25
|
+
|
|
26
|
+
**1. Get git SHAs:**
|
|
27
|
+
```bash
|
|
28
|
+
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
|
|
29
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**2. Use the code reviewer template** (`code-reviewer.md` in this skill directory):
|
|
33
|
+
|
|
34
|
+
**Placeholders:**
|
|
35
|
+
- `{DESCRIPTION}` - Brief summary of what you built
|
|
36
|
+
- `{PLAN_OR_REQUIREMENTS}` - What it should do (contract, exec plan, or requirements)
|
|
37
|
+
- `{BASE_SHA}` - Starting commit
|
|
38
|
+
- `{HEAD_SHA}` - Ending commit
|
|
39
|
+
|
|
40
|
+
**3. Act on feedback:**
|
|
41
|
+
- Fix Critical issues immediately
|
|
42
|
+
- Fix Important issues before proceeding
|
|
43
|
+
- Note Minor issues for later
|
|
44
|
+
- Push back if reviewer is wrong (with reasoning)
|
|
45
|
+
|
|
46
|
+
## Example
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
[Just completed Task 2: Add verification function]
|
|
50
|
+
|
|
51
|
+
You: Let me request code review before proceeding.
|
|
52
|
+
|
|
53
|
+
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
|
|
54
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
55
|
+
|
|
56
|
+
[Dispatch code reviewer subagent]
|
|
57
|
+
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
|
|
58
|
+
PLAN_OR_REQUIREMENTS: Task 2 from docs/exec-plans/active/deployment-plan.md
|
|
59
|
+
BASE_SHA: a7981ec
|
|
60
|
+
HEAD_SHA: 3df7661
|
|
61
|
+
|
|
62
|
+
[Subagent returns]:
|
|
63
|
+
Strengths: Clean architecture, real tests
|
|
64
|
+
Issues:
|
|
65
|
+
Important: Missing progress indicators
|
|
66
|
+
Minor: Magic number (100) for reporting interval
|
|
67
|
+
Assessment: Ready to proceed
|
|
68
|
+
|
|
69
|
+
You: [Fix progress indicators]
|
|
70
|
+
[Continue to Task 3]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Integration with Harness Workflow
|
|
74
|
+
|
|
75
|
+
**After each work chunk (Plan → Contract → Implement → Verify → Handoff):**
|
|
76
|
+
- Review after Implement, before Verify
|
|
77
|
+
- Catch issues before they compound
|
|
78
|
+
- Fix before moving to next task
|
|
79
|
+
|
|
80
|
+
**Before merge / Handoff:**
|
|
81
|
+
- Review before declaring complete
|
|
82
|
+
- Verify against contract acceptance criteria
|
|
83
|
+
|
|
84
|
+
**Ad-Hoc Development:**
|
|
85
|
+
- Review before merge
|
|
86
|
+
- Review when stuck
|
|
87
|
+
|
|
88
|
+
## Red Flags
|
|
89
|
+
|
|
90
|
+
**Never:**
|
|
91
|
+
- Skip review because "it's simple"
|
|
92
|
+
- Ignore Critical issues
|
|
93
|
+
- Proceed with unfixed Important issues
|
|
94
|
+
- Argue with valid technical feedback
|
|
95
|
+
|
|
96
|
+
**If reviewer wrong:**
|
|
97
|
+
- Push back with technical reasoning
|
|
98
|
+
- Show code/tests that prove it works
|
|
99
|
+
- Request clarification
|
|
100
|
+
|
|
101
|
+
See template at: requesting-code-review/code-reviewer.md
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Code Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching a code reviewer subagent.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Review completed work against requirements and code quality standards before it cascades into more work.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Task tool (general-purpose):
|
|
9
|
+
description: "Review code changes"
|
|
10
|
+
prompt: |
|
|
11
|
+
You are a Senior Code Reviewer with expertise in software architecture,
|
|
12
|
+
design patterns, and best practices. Your job is to review completed work
|
|
13
|
+
against its plan or requirements and identify issues before they cascade.
|
|
14
|
+
|
|
15
|
+
## What Was Implemented
|
|
16
|
+
|
|
17
|
+
{DESCRIPTION}
|
|
18
|
+
|
|
19
|
+
## Requirements / Plan
|
|
20
|
+
|
|
21
|
+
{PLAN_OR_REQUIREMENTS}
|
|
22
|
+
|
|
23
|
+
## Git Range to Review
|
|
24
|
+
|
|
25
|
+
**Base:** {BASE_SHA}
|
|
26
|
+
**Head:** {HEAD_SHA}
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git diff --stat {BASE_SHA}..{HEAD_SHA}
|
|
30
|
+
git diff {BASE_SHA}..{HEAD_SHA}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What to Check
|
|
34
|
+
|
|
35
|
+
**Plan alignment:**
|
|
36
|
+
- Does the implementation match the plan / requirements?
|
|
37
|
+
- Are deviations justified improvements, or problematic departures?
|
|
38
|
+
- Is all planned functionality present?
|
|
39
|
+
|
|
40
|
+
**Code quality:**
|
|
41
|
+
- Clean separation of concerns?
|
|
42
|
+
- Proper error handling?
|
|
43
|
+
- Type safety where applicable?
|
|
44
|
+
- DRY without premature abstraction?
|
|
45
|
+
- Edge cases handled?
|
|
46
|
+
|
|
47
|
+
**Architecture:**
|
|
48
|
+
- Sound design decisions?
|
|
49
|
+
- Reasonable scalability and performance?
|
|
50
|
+
- Security concerns?
|
|
51
|
+
- Integrates cleanly with surrounding code?
|
|
52
|
+
|
|
53
|
+
**Testing:**
|
|
54
|
+
- Tests verify real behavior, not mocks?
|
|
55
|
+
- Edge cases covered?
|
|
56
|
+
- Integration tests where they matter?
|
|
57
|
+
- All tests passing?
|
|
58
|
+
|
|
59
|
+
**Production readiness:**
|
|
60
|
+
- Migration strategy if schema changed?
|
|
61
|
+
- Backward compatibility considered?
|
|
62
|
+
- Documentation complete?
|
|
63
|
+
- No obvious bugs?
|
|
64
|
+
|
|
65
|
+
## Calibration
|
|
66
|
+
|
|
67
|
+
Categorize issues by actual severity. Not everything is Critical.
|
|
68
|
+
Acknowledge what was done well before listing issues — accurate praise
|
|
69
|
+
helps the implementer trust the rest of the feedback.
|
|
70
|
+
|
|
71
|
+
If you find significant deviations from the plan, flag them specifically
|
|
72
|
+
so the implementer can confirm whether the deviation was intentional.
|
|
73
|
+
If you find issues with the plan itself rather than the implementation,
|
|
74
|
+
say so.
|
|
75
|
+
|
|
76
|
+
## Output Format
|
|
77
|
+
|
|
78
|
+
### Strengths
|
|
79
|
+
[What's well done? Be specific.]
|
|
80
|
+
|
|
81
|
+
### Issues
|
|
82
|
+
|
|
83
|
+
#### Critical (Must Fix)
|
|
84
|
+
[Bugs, security issues, data loss risks, broken functionality]
|
|
85
|
+
|
|
86
|
+
#### Important (Should Fix)
|
|
87
|
+
[Architecture problems, missing features, poor error handling, test gaps]
|
|
88
|
+
|
|
89
|
+
#### Minor (Nice to Have)
|
|
90
|
+
[Code style, optimization opportunities, documentation polish]
|
|
91
|
+
|
|
92
|
+
For each issue:
|
|
93
|
+
- File:line reference
|
|
94
|
+
- What's wrong
|
|
95
|
+
- Why it matters
|
|
96
|
+
- How to fix (if not obvious)
|
|
97
|
+
|
|
98
|
+
### Recommendations
|
|
99
|
+
[Improvements for code quality, architecture, or process]
|
|
100
|
+
|
|
101
|
+
### Assessment
|
|
102
|
+
|
|
103
|
+
**Ready to merge?** [Yes | No | With fixes]
|
|
104
|
+
|
|
105
|
+
**Reasoning:** [1-2 sentence technical assessment]
|
|
106
|
+
|
|
107
|
+
## Critical Rules
|
|
108
|
+
|
|
109
|
+
**DO:**
|
|
110
|
+
- Categorize by actual severity
|
|
111
|
+
- Be specific (file:line, not vague)
|
|
112
|
+
- Explain WHY each issue matters
|
|
113
|
+
- Acknowledge strengths
|
|
114
|
+
- Give a clear verdict
|
|
115
|
+
|
|
116
|
+
**DON'T:**
|
|
117
|
+
- Say "looks good" without checking
|
|
118
|
+
- Mark nitpicks as Critical
|
|
119
|
+
- Give feedback on code you didn't actually read
|
|
120
|
+
- Be vague ("improve error handling")
|
|
121
|
+
- Avoid giving a clear verdict
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Placeholders:**
|
|
125
|
+
- `{DESCRIPTION}` — brief summary of what was built
|
|
126
|
+
- `{PLAN_OR_REQUIREMENTS}` — what it should do (plan file path, task text, or requirements)
|
|
127
|
+
- `{BASE_SHA}` — starting commit
|
|
128
|
+
- `{HEAD_SHA}` — ending commit
|
|
129
|
+
|
|
130
|
+
**Reviewer returns:** Strengths, Issues (Critical / Important / Minor), Recommendations, Assessment
|
|
131
|
+
|
|
132
|
+
## Example Output
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
### Strengths
|
|
136
|
+
- Clean database schema with proper migrations (db.ts:15-42)
|
|
137
|
+
- Comprehensive test coverage (18 tests, all edge cases)
|
|
138
|
+
- Good error handling with fallbacks (summarizer.ts:85-92)
|
|
139
|
+
|
|
140
|
+
### Issues
|
|
141
|
+
|
|
142
|
+
#### Important
|
|
143
|
+
1. **Missing help text in CLI wrapper**
|
|
144
|
+
- File: index-conversations:1-31
|
|
145
|
+
- Issue: No --help flag, users won't discover --concurrency
|
|
146
|
+
- Fix: Add --help case with usage examples
|
|
147
|
+
|
|
148
|
+
2. **Date validation missing**
|
|
149
|
+
- File: search.ts:25-27
|
|
150
|
+
- Issue: Invalid dates silently return no results
|
|
151
|
+
- Fix: Validate ISO format, throw error with example
|
|
152
|
+
|
|
153
|
+
#### Minor
|
|
154
|
+
1. **Progress indicators**
|
|
155
|
+
- File: indexer.ts:130
|
|
156
|
+
- Issue: No "X of Y" counter for long operations
|
|
157
|
+
- Impact: Users don't know how long to wait
|
|
158
|
+
|
|
159
|
+
### Recommendations
|
|
160
|
+
- Add progress reporting for user experience
|
|
161
|
+
- Consider config file for excluded projects (portability)
|
|
162
|
+
|
|
163
|
+
### Assessment
|
|
164
|
+
|
|
165
|
+
**Ready to merge: With fixes**
|
|
166
|
+
|
|
167
|
+
**Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
|
|
168
|
+
```
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Creation Log: Systematic Debugging Skill
|
|
2
|
+
|
|
3
|
+
Reference example of extracting, structuring, and bulletproofing a critical skill.
|
|
4
|
+
|
|
5
|
+
## Source Material
|
|
6
|
+
|
|
7
|
+
Extracted debugging framework from `~/.claude/CLAUDE.md`:
|
|
8
|
+
- 4-phase systematic process (Investigation → Pattern Analysis → Hypothesis → Implementation)
|
|
9
|
+
- Core mandate: ALWAYS find root cause, NEVER fix symptoms
|
|
10
|
+
- Rules designed to resist time pressure and rationalization
|
|
11
|
+
|
|
12
|
+
## Extraction Decisions
|
|
13
|
+
|
|
14
|
+
**What to include:**
|
|
15
|
+
- Complete 4-phase framework with all rules
|
|
16
|
+
- Anti-shortcuts ("NEVER fix symptom", "STOP and re-analyze")
|
|
17
|
+
- Pressure-resistant language ("even if faster", "even if I seem in a hurry")
|
|
18
|
+
- Concrete steps for each phase
|
|
19
|
+
|
|
20
|
+
**What to leave out:**
|
|
21
|
+
- Project-specific context
|
|
22
|
+
- Repetitive variations of same rule
|
|
23
|
+
- Narrative explanations (condensed to principles)
|
|
24
|
+
|
|
25
|
+
## Structure Following skill-creation/SKILL.md
|
|
26
|
+
|
|
27
|
+
1. **Rich when_to_use** - Included symptoms and anti-patterns
|
|
28
|
+
2. **Type: technique** - Concrete process with steps
|
|
29
|
+
3. **Keywords** - "root cause", "symptom", "workaround", "debugging", "investigation"
|
|
30
|
+
4. **Flowchart** - Decision point for "fix failed" → re-analyze vs add more fixes
|
|
31
|
+
5. **Phase-by-phase breakdown** - Scannable checklist format
|
|
32
|
+
6. **Anti-patterns section** - What NOT to do (critical for this skill)
|
|
33
|
+
|
|
34
|
+
## Bulletproofing Elements
|
|
35
|
+
|
|
36
|
+
Framework designed to resist rationalization under pressure:
|
|
37
|
+
|
|
38
|
+
### Language Choices
|
|
39
|
+
- "ALWAYS" / "NEVER" (not "should" / "try to")
|
|
40
|
+
- "even if faster" / "even if I seem in a hurry"
|
|
41
|
+
- "STOP and re-analyze" (explicit pause)
|
|
42
|
+
- "Don't skip past" (catches the actual behavior)
|
|
43
|
+
|
|
44
|
+
### Structural Defenses
|
|
45
|
+
- **Phase 1 required** - Can't skip to implementation
|
|
46
|
+
- **Single hypothesis rule** - Forces thinking, prevents shotgun fixes
|
|
47
|
+
- **Explicit failure mode** - "IF your first fix doesn't work" with mandatory action
|
|
48
|
+
- **Anti-patterns section** - Shows exactly what shortcuts look like
|
|
49
|
+
|
|
50
|
+
### Redundancy
|
|
51
|
+
- Root cause mandate in overview + when_to_use + Phase 1 + implementation rules
|
|
52
|
+
- "NEVER fix symptom" appears 4 times in different contexts
|
|
53
|
+
- Each phase has explicit "don't skip" guidance
|
|
54
|
+
|
|
55
|
+
## Testing Approach
|
|
56
|
+
|
|
57
|
+
Created 4 validation tests following skills/meta/testing-skills-with-subagents:
|
|
58
|
+
|
|
59
|
+
### Test 1: Academic Context (No Pressure)
|
|
60
|
+
- Simple bug, no time pressure
|
|
61
|
+
- **Result:** Perfect compliance, complete investigation
|
|
62
|
+
|
|
63
|
+
### Test 2: Time Pressure + Obvious Quick Fix
|
|
64
|
+
- User "in a hurry", symptom fix looks easy
|
|
65
|
+
- **Result:** Resisted shortcut, followed full process, found real root cause
|
|
66
|
+
|
|
67
|
+
### Test 3: Complex System + Uncertainty
|
|
68
|
+
- Multi-layer failure, unclear if can find root cause
|
|
69
|
+
- **Result:** Systematic investigation, traced through all layers, found source
|
|
70
|
+
|
|
71
|
+
### Test 4: Failed First Fix
|
|
72
|
+
- Hypothesis doesn't work, temptation to add more fixes
|
|
73
|
+
- **Result:** Stopped, re-analyzed, formed new hypothesis (no shotgun)
|
|
74
|
+
|
|
75
|
+
**All tests passed.** No rationalizations found.
|
|
76
|
+
|
|
77
|
+
## Iterations
|
|
78
|
+
|
|
79
|
+
### Initial Version
|
|
80
|
+
- Complete 4-phase framework
|
|
81
|
+
- Anti-patterns section
|
|
82
|
+
- Flowchart for "fix failed" decision
|
|
83
|
+
|
|
84
|
+
### Enhancement 1: TDD Reference
|
|
85
|
+
- Added link to skills/testing/test-driven-development
|
|
86
|
+
- Note explaining TDD's "simplest code" ≠ debugging's "root cause"
|
|
87
|
+
- Prevents confusion between methodologies
|
|
88
|
+
|
|
89
|
+
## Final Outcome
|
|
90
|
+
|
|
91
|
+
Bulletproof skill that:
|
|
92
|
+
- ✅ Clearly mandates root cause investigation
|
|
93
|
+
- ✅ Resists time pressure rationalization
|
|
94
|
+
- ✅ Provides concrete steps for each phase
|
|
95
|
+
- ✅ Shows anti-patterns explicitly
|
|
96
|
+
- ✅ Tested under multiple pressure scenarios
|
|
97
|
+
- ✅ Clarifies relationship to TDD
|
|
98
|
+
- ✅ Ready for use
|
|
99
|
+
|
|
100
|
+
## Key Insight
|
|
101
|
+
|
|
102
|
+
**Most important bulletproofing:** Anti-patterns section showing exact shortcuts that feel justified in the moment. When Claude thinks "I'll just add this one quick fix", seeing that exact pattern listed as wrong creates cognitive friction.
|
|
103
|
+
|
|
104
|
+
## Usage Example
|
|
105
|
+
|
|
106
|
+
When encountering a bug:
|
|
107
|
+
1. Load skill: skills/debugging/systematic-debugging
|
|
108
|
+
2. Read overview (10 sec) - reminded of mandate
|
|
109
|
+
3. Follow Phase 1 checklist - forced investigation
|
|
110
|
+
4. If tempted to skip - see anti-pattern, stop
|
|
111
|
+
5. Complete all phases - root cause found
|
|
112
|
+
|
|
113
|
+
**Time investment:** 5-10 minutes
|
|
114
|
+
**Time saved:** Hours of symptom-whack-a-mole
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
*Created: 2025-10-03*
|
|
119
|
+
*Purpose: Reference example for skill extraction and bulletproofing*
|