@tea-agent/loop-agent 0.2.1 → 0.3.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 (33) hide show
  1. package/AGENTS.md +56 -54
  2. package/CHANGELOG.md +22 -10
  3. package/README.md +24 -12
  4. package/dist/application/dag/args.js +6 -0
  5. package/dist/application/dag/generate-task-dag.js +2 -0
  6. package/dist/application/dag/run-dag.js +3 -0
  7. package/dist/application/dag/validate-dag.js +40 -0
  8. package/dist/cli/command-definitions.js +2 -2
  9. package/dist/cli/program.js +24 -4
  10. package/dist/commands/init.js +554 -2
  11. package/dist/workflows/dag/dynamic-runtime/loop-until.js +2 -1
  12. package/dist/workflows/dag/dynamic-runtime/map.js +1 -0
  13. package/dist/workflows/dag/init-hybrid.js +3 -3
  14. package/dist/workflows/dag/skills.js +3 -3
  15. package/dist/workflows/dag/types.js +2 -0
  16. package/dist/workflows/dynamic/compile.js +11 -0
  17. package/dist/workflows/dynamic/spec.js +1 -0
  18. package/docs/README.md +7 -4
  19. package/docs/agent-dag-runner.md +2 -0
  20. package/docs/exec-plans/active/README.md +1 -4
  21. package/docs/exec-plans/completed/README.md +2 -0
  22. package/docs/init-surface.manifest.json +175 -0
  23. package/docs/skills/README.md +6 -0
  24. package/docs/skills/vetted-skill-registry.md +26 -0
  25. package/docs/templates/init-evolution-review.md +33 -0
  26. package/harness.json +5 -3
  27. package/package.json +7 -5
  28. package/skills/code-review-core/SKILL.md +20 -0
  29. package/skills/codebase-scout/SKILL.md +19 -0
  30. package/skills/init-capability-evolution/SKILL.md +69 -0
  31. package/skills/loop-agent/references/command-reference.md +37 -19
  32. package/skills/test-driven-development/SKILL.md +20 -0
  33. package/skills/webapp-testing/SKILL.md +19 -0
@@ -40,6 +40,9 @@ function dagRoleForNode(node) {
40
40
  function executorForAgentLikeNode(node) {
41
41
  return node.executor ?? "pi";
42
42
  }
43
+ function nodeSkillsField(node) {
44
+ return node.skills && node.skills.length > 0 ? { skills: node.skills } : {};
45
+ }
43
46
  function dagWriteFields(spec, node) {
44
47
  if (node?.writePolicy === "none") {
45
48
  return {
@@ -111,6 +114,7 @@ function compileHumanGateNode(spec, node) {
111
114
  executor: "pi",
112
115
  role: "supervisor",
113
116
  ...dagWriteFields(spec, node),
117
+ ...nodeSkillsField(node),
114
118
  decisionGate: { enabled: true, mode: "pause-on-human" },
115
119
  outputContract: node.approvalSchema
116
120
  ? `Workflow approvalSchema:\n${JSON.stringify(node.approvalSchema, null, 2)}`
@@ -172,6 +176,7 @@ function compileLoopBodyTask(spec, node) {
172
176
  dependsOn: node.dependsOn,
173
177
  executor,
174
178
  role: dagRoleForNode(node),
179
+ ...nodeSkillsField(node),
175
180
  complexity: node.type === "reduce_agent" ? "MED" : "LOW",
176
181
  subtaskPromptTemplate: buildAgentPrompt(node),
177
182
  staticResultTemplate: node.staticResultTemplate ?? node.transform?.template ?? undefined,
@@ -189,6 +194,7 @@ function compileLoopUntilNode(spec, node) {
189
194
  executor: "static",
190
195
  role: dagRoleForNode(node),
191
196
  ...dagWriteFields(spec, node),
197
+ ...nodeSkillsField(node),
192
198
  static: {
193
199
  resultMarkdown: `Dynamic loop_until barrier for ${node.id}.`,
194
200
  },
@@ -212,6 +218,7 @@ function compileAgentLikeNode(spec, node) {
212
218
  executor: "static",
213
219
  role: dagRoleForNode(node),
214
220
  ...dagWriteFields(spec, node),
221
+ ...nodeSkillsField(node),
215
222
  static: {
216
223
  resultMarkdown: node.staticResultTemplate ?? `Workflow node ${node.id} completed.`,
217
224
  },
@@ -226,6 +233,7 @@ function compileAgentLikeNode(spec, node) {
226
233
  executor: "pi",
227
234
  role: dagRoleForNode(node),
228
235
  ...dagWriteFields(spec, node),
236
+ ...nodeSkillsField(node),
229
237
  outputContract: stringifyOutputSchema(node.outputSchema),
230
238
  };
231
239
  }
@@ -258,6 +266,7 @@ function compileDynamicExpansionNode(spec, node) {
258
266
  const childTask = {
259
267
  executor: childExecutor,
260
268
  role: dagRoleForNode(node),
269
+ ...nodeSkillsField(node),
261
270
  complexity: "LOW",
262
271
  subtaskPromptTemplate: childPrompt,
263
272
  staticResultTemplate: node.staticResultTemplate,
@@ -273,6 +282,7 @@ function compileDynamicExpansionNode(spec, node) {
273
282
  writePolicy: "none",
274
283
  allowedPaths: [],
275
284
  forbiddenPaths: [],
285
+ ...nodeSkillsField(node),
276
286
  static: {
277
287
  resultMarkdown: `Dynamic ${node.type} expansion barrier for ${node.id}.`,
278
288
  },
@@ -299,6 +309,7 @@ function compileDynamicReductionNode(spec, node) {
299
309
  executor: "static",
300
310
  role: dagRoleForNode(node),
301
311
  ...dagWriteFields(spec, node),
312
+ ...nodeSkillsField(node),
302
313
  static: {
303
314
  resultMarkdown: `Dynamic reducer ${node.reducer?.type ?? "unknown"} for ${node.id}.`,
304
315
  },
@@ -46,6 +46,7 @@ export const workflowNodeSchema = z.object({
46
46
  dependsOn: z.array(z.string()).default([]),
47
47
  executor: z.enum(["pi", "static"]).optional(),
48
48
  role: z.string().optional(),
49
+ skills: z.array(z.string().min(1)).optional(),
49
50
  prompt: z.string().optional(),
50
51
  staticResultTemplate: z.string().optional(),
51
52
  writePolicy: z.enum(["none", "read-only", "exclusive"]).optional(),
package/docs/README.md CHANGED
@@ -14,7 +14,8 @@
14
14
  - `loop-agent-harness.md` — runtime 与 command surface 概览
15
15
  - `agent-dag-runner.md` — Agent DAG runner 指南
16
16
  - `cursor-executor-usage.md` — Cursor executor 用法
17
- - `dynamic-workflow-dag-engine-roadmap.md` — Dynamic Workflow DAG Engine 路线图与适配分析
17
+ - `dynamic-workflow-dag-engine-roadmap.md` — Dynamic Workflow DAG Engine 路线图与适配分析
18
+ - `init-surface.manifest.json` — npm 包范围、目标项目初始化投影与 `init check-update` surface 分类的机器校验契约
18
19
 
19
20
  ## 方法论
20
21
 
@@ -30,6 +31,7 @@
30
31
  - `progress/README.md` — 进度交接日志
31
32
  - `reports/README.md` — 验证与审计报告
32
33
  - `decisions/README.md` — 架构决策
34
+ - `skills/README.md` — repo-local skill registry and vetting notes
33
35
  - `templates/` — 可复用的规划、报告与 DAG 模板
34
36
 
35
37
  ## 仓库 Skills
@@ -44,9 +46,10 @@
44
46
  - `templates/sprint-contract.md` — 实现契约与验收标准
45
47
  - `templates/exec-plan.md` — 非平凡工作的执行计划
46
48
  - `templates/progress-log.md` — 进度与交接日志
47
- - `templates/qa-report.md` — 验证与 QA 证据
48
- - `templates/production-readiness-checklist.md` — 低/中风险单仓库 DAG readiness 检查清单
49
- - `templates/adr.md` — 架构决策记录(ADR)
49
+ - `templates/qa-report.md` — 验证与 QA 证据
50
+ - `templates/production-readiness-checklist.md` — 低/中风险单仓库 DAG readiness 检查清单
51
+ - `templates/init-evolution-review.md` — 初始化能力演化审查报告模板
52
+ - `templates/adr.md` — 架构决策记录(ADR)
50
53
 
51
54
  ## 维护
52
55
 
@@ -23,6 +23,8 @@ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
23
23
 
24
24
  DAG spec 可声明 `defaults.skills`、`skillsByRole` 与节点级 `skills`。Runner 从 `skills/<skill-name>/SKILL.md` 解析本地指令,并在各节点 `skills.json` artifact 中记录解析元数据。
25
25
 
26
+ 执行前可用 `dag validate --strict-skills` 做 opt-in skill audit;该门禁会在 missing/error/truncated skill 或 unresolved reference 出现时失败。默认 role skill 应来自 `docs/skills/vetted-skill-registry.md` 中记录的 repo-local wrapper。
27
+
26
28
  `loop-agent` skill 位于 `skills/loop-agent/SKILL.md`。遗留根路径 `skill/SKILL.md` 仅为旧 worktree 保留兼容 fallback。
27
29
 
28
30
  ## Artifacts
@@ -4,7 +4,4 @@
4
4
 
5
5
  源码仓库可在本 README 旁保留具体 active plan 文件。npm 包只携带本 README 作为目录契约,不复制 loop-agent 源码历史的 active plan;目标仓库自行生成 active plan。
6
6
 
7
- 当前 active plan
8
-
9
- - [2026-07-04-dag-role-skill-alignment.md](2026-07-04-dag-role-skill-alignment.md)
10
- - [2026-07-06-production-readiness-hardening.md](2026-07-06-production-readiness-hardening.md)
7
+ 当前 active plan:无。
@@ -7,3 +7,5 @@ npm 包携带本 README 作为目录契约。具体 completed plan 属于目标
7
7
  - [`2026-07-02-loop-agent-subject-restructure.md`](2026-07-02-loop-agent-subject-restructure.md) — 将原 `tools/code-agent` runtime 提升到仓库根、重命名为 `loop-agent`,移除旧 memory plugin 产品线
8
8
  - [`2026-07-04-remove-level1-fallback.md`](2026-07-04-remove-level1-fallback.md) — 移除历史顺序 Level 1 fallback,runtime、文档与 command surface 收敛到 DAG 执行
9
9
  - [`2026-07-04-runtime-boundary-remediation.md`](2026-07-04-runtime-boundary-remediation.md) — 整合 CLI/skill/runtime 边界,抽出 DAG/Loop runtime seam,集中 harness store/guard 策略
10
+ - [`2026-07-04-dag-role-skill-alignment.md`](2026-07-04-dag-role-skill-alignment.md) — 对齐 DAG/Dynamic Workflow role 与 repo-local vetted skills,新增 strict skill audit
11
+ - [`2026-07-06-production-readiness-hardening.md`](2026-07-06-production-readiness-hardening.md) — 冻结 Production Readiness v0.1,打磨 DAG 主路径 next steps、failure routing、doctor/report/failure handoff 与 dogfood 验证
@@ -0,0 +1,175 @@
1
+ {
2
+ "version": 1,
3
+ "description": "Machine-checked contract for files that must remain available through npm packaging and target-project initialization.",
4
+ "packageRequired": [
5
+ "AGENTS.md",
6
+ "CHANGELOG.md",
7
+ "README.md",
8
+ "harness.json",
9
+ "bin/loop-agent.js",
10
+ "docs/README.md",
11
+ "docs/init-surface.manifest.json",
12
+ "docs/architecture/runtime-boundaries.md",
13
+ "docs/skills/README.md",
14
+ "docs/skills/vetted-skill-registry.md",
15
+ "docs/templates/init-evolution-review.md",
16
+ "docs/templates/production-readiness-checklist.md",
17
+ "docs/templates/agent-dag.schema.json",
18
+ "examples/example-dag.json",
19
+ "skills/loop-agent/SKILL.md",
20
+ "skills/loop-agent/references/command-reference.md",
21
+ "skills/ai-engineering-context/SKILL.md",
22
+ "skills/verification-before-completion/SKILL.md",
23
+ "skills/systematic-debugging/SKILL.md",
24
+ "skills/requesting-code-review/SKILL.md",
25
+ "skills/codebase-scout/SKILL.md",
26
+ "skills/test-driven-development/SKILL.md",
27
+ "skills/code-review-core/SKILL.md",
28
+ "skills/init-capability-evolution/SKILL.md",
29
+ "skills/webapp-testing/SKILL.md"
30
+ ],
31
+ "initFullRequired": [
32
+ "README.md",
33
+ "AGENTS.md",
34
+ "harness.json",
35
+ "docs/README.md",
36
+ "docs/development-principles.md",
37
+ "docs/feature-workflow.md",
38
+ "docs/verification-matrix.md",
39
+ "docs/loop-agent-harness.md",
40
+ "docs/templates/init-evolution-review.md",
41
+ "docs/templates/production-readiness-checklist.md",
42
+ "scripts/check-repo.sh",
43
+ "scripts/ci-governance.sh",
44
+ "scripts/ci-tests.sh",
45
+ "scripts/ci.sh",
46
+ ".harness/prompts/analyze.md",
47
+ ".harness/tasks",
48
+ ".harness/dag-runs/active",
49
+ "skills/loop-agent/SKILL.md",
50
+ "skills/loop-agent/references/command-reference.md",
51
+ "skills/ai-engineering-context/SKILL.md",
52
+ "skills/verification-before-completion/SKILL.md",
53
+ "skills/systematic-debugging/SKILL.md",
54
+ "skills/requesting-code-review/SKILL.md",
55
+ "skills/codebase-scout/SKILL.md",
56
+ "skills/test-driven-development/SKILL.md",
57
+ "skills/code-review-core/SKILL.md",
58
+ "skills/init-capability-evolution/SKILL.md",
59
+ "skills/webapp-testing/SKILL.md"
60
+ ],
61
+ "initSurface": {
62
+ "README.md": "managed-block",
63
+ "AGENTS.md": "managed-block",
64
+ "harness.json": "generated",
65
+ "docs/README.md": "generated",
66
+ "docs/development-principles.md": "generated",
67
+ "docs/feature-workflow.md": "generated",
68
+ "docs/verification-matrix.md": "generated",
69
+ "docs/loop-agent-harness.md": "generated",
70
+ "docs/templates/init-evolution-review.md": "copied",
71
+ "docs/templates/production-readiness-checklist.md": "copied",
72
+ "scripts/check-repo.sh": "generated",
73
+ "scripts/ci-governance.sh": "generated",
74
+ "scripts/ci-tests.sh": "generated",
75
+ "scripts/ci.sh": "generated",
76
+ ".harness/prompts/analyze.md": "generated",
77
+ ".harness/tasks": "directory",
78
+ ".harness/dag-runs/active": "directory",
79
+ ".harness/init-surface.json": "state",
80
+ "skills/loop-agent/SKILL.md": "copied",
81
+ "skills/loop-agent/references/command-reference.md": "copied",
82
+ "skills/ai-engineering-context/SKILL.md": "copied",
83
+ "skills/verification-before-completion/SKILL.md": "copied",
84
+ "skills/systematic-debugging/SKILL.md": "copied",
85
+ "skills/requesting-code-review/SKILL.md": "copied",
86
+ "skills/codebase-scout/SKILL.md": "copied",
87
+ "skills/test-driven-development/SKILL.md": "copied",
88
+ "skills/code-review-core/SKILL.md": "copied",
89
+ "skills/init-capability-evolution/SKILL.md": "copied",
90
+ "skills/webapp-testing/SKILL.md": "copied"
91
+ },
92
+ "packageExcluded": [
93
+ "docs/progress/20*.md",
94
+ "docs/reports/20*.md",
95
+ "docs/exec-plans/active/20*.md",
96
+ "docs/exec-plans/completed/20*.md"
97
+ ],
98
+ "initExcluded": [
99
+ "examples/example-dag.json",
100
+ "docs/skills/vetted-skill-registry.md"
101
+ ],
102
+ "reviewTriggers": [
103
+ "AGENTS.md",
104
+ "README.md",
105
+ "CHANGELOG.md",
106
+ "harness.json",
107
+ "package.json",
108
+ "src/commands/init.ts",
109
+ "src/workflows/dag/skills.ts",
110
+ "src/workflows/dag/init-hybrid.ts",
111
+ "src/workflows/dag/skill-instructions.ts",
112
+ "docs/templates/**",
113
+ "docs/skills/**",
114
+ "skills/**",
115
+ "scripts/**"
116
+ ],
117
+ "evolutionReview": {
118
+ "defaultMode": "advisory",
119
+ "strictReportGlob": "docs/reports/*-init-evolution-review.md",
120
+ "tiers": [
121
+ {
122
+ "name": "model-review",
123
+ "severity": "high",
124
+ "strictRequiresReport": true,
125
+ "description": "Changes that may alter target-project initialization behavior, default DAG role skills, skill resolution, or package/init contracts.",
126
+ "patterns": [
127
+ "src/commands/init.ts",
128
+ "src/workflows/dag/skills.ts",
129
+ "src/workflows/dag/init-hybrid.ts",
130
+ "src/workflows/dag/skill-instructions.ts",
131
+ "src/workflows/dag/prompt.ts",
132
+ "src/workflows/dag/node-execution.ts",
133
+ "docs/init-surface.manifest.json",
134
+ "package.json",
135
+ "harness.json",
136
+ "AGENTS.md",
137
+ "README.md"
138
+ ]
139
+ },
140
+ {
141
+ "name": "surface-check",
142
+ "severity": "medium",
143
+ "strictRequiresReport": false,
144
+ "description": "Asset surface changes that usually need deterministic package/init smoke checks but not a model review when the checks pass.",
145
+ "patterns": [
146
+ "skills/**",
147
+ "docs/templates/**",
148
+ "docs/skills/**",
149
+ "scripts/check-init-surface.sh",
150
+ "scripts/check-repo.sh"
151
+ ]
152
+ },
153
+ {
154
+ "name": "advisory",
155
+ "severity": "low",
156
+ "strictRequiresReport": false,
157
+ "description": "Documentation and user-facing guidance changes that should be considered but should not slow normal iteration.",
158
+ "patterns": [
159
+ "CHANGELOG.md",
160
+ "website/docs/**",
161
+ "docs/*.md",
162
+ "docs/architecture/**"
163
+ ]
164
+ }
165
+ ],
166
+ "modelReviewQuestions": [
167
+ "Does this change alter files or guidance produced by loop-agent init --profile full --merge?",
168
+ "Does a new or changed skill need to be bundled, projected to target projects, or documented as optional only?",
169
+ "Do target-project AGENTS.md, README managed blocks, governance docs, templates, or script matrix need updates?",
170
+ "Does package.json files include every static asset required by the runtime and init projection?",
171
+ "Does docs/init-surface.manifest.json still match the intended package and init surface?",
172
+ "Do older initialized target projects need a migration note, manual copy guidance, or future init audit/update support?"
173
+ ]
174
+ }
175
+ }
@@ -0,0 +1,6 @@
1
+ # Skill Registry
2
+
3
+ This directory records repo-local skill wrappers and vetting notes used by Agent DAG role mapping.
4
+
5
+ - `vetted-skill-registry.md` — supported roles, source inspiration, risk notes, and default/optional usage.
6
+
@@ -0,0 +1,26 @@
1
+ # Vetted Skill Registry
2
+
3
+ This registry records repo-local skills that may be referenced by default DAG role mapping or task/profile-specific `skills`.
4
+
5
+ The entries below are local wrappers or existing local skills. They are not wholesale vendored copies of third-party skill repositories.
6
+
7
+ | Skill | Source / Inspiration | Local Path | Supported Roles | Default Use | Risk Notes |
8
+ |---|---|---|---|---|---|
9
+ | `ai-engineering-context` | local existing | `skills/ai-engineering-context/SKILL.md` | scout, default context | default/scout | Read-only engineering context; not a private platform memory skill. |
10
+ | `loop-agent` | local existing | `skills/loop-agent/SKILL.md` | planner, supervisor, closeout | planner/closeout | Long references may be resolved by strict audit with expanded budget; executor behavior unchanged. |
11
+ | `verification-before-completion` | local wrapper inspired by verification discipline | `skills/verification-before-completion/SKILL.md` | implementer, verifier, closeout | implementer/verifier/closeout | Requires shell evidence before completion claims. |
12
+ | `systematic-debugging` | local wrapper inspired by systematic debugging discipline | `skills/systematic-debugging/SKILL.md` | implementer, verifier | verifier | Advisory prompt guidance only; does not run tools by itself. |
13
+ | `requesting-code-review` | local existing | `skills/requesting-code-review/SKILL.md` | reviewer | reviewer | Review prompt guidance only. |
14
+ | `test-driven-development` | local wrapper inspired by TDD practice | `skills/test-driven-development/SKILL.md` | implementer | implementer | Does not force tests in mechanical-only docs changes; implementer still follows task contract. |
15
+ | `code-review-core` | local wrapper inspired by code review practice | `skills/code-review-core/SKILL.md` | reviewer | reviewer | No external tools or network by default. |
16
+ | `codebase-scout` | local wrapper | `skills/codebase-scout/SKILL.md` | scout | scout | Read-only reconnaissance guidance. |
17
+ | `init-capability-evolution` | local wrapper | `skills/init-capability-evolution/SKILL.md` | supervisor, maintenance | optional | Used only when changes may affect target-project initialization, package surface, or init projection rules. |
18
+ | `webapp-testing` | local wrapper inspired by frontend/browser testing practice | `skills/webapp-testing/SKILL.md` | verifier, reviewer | optional | Only applies when task explicitly involves browser-rendered behavior; no default Playwright/Semgrep execution. |
19
+
20
+ ## Vetting Rules
21
+
22
+ - Default role mappings may reference only repo-local skills that resolve cleanly under `dag validate --strict-skills`.
23
+ - Optional/security/web skills remain task- or profile-specific until their tool, network, credential, and write behavior is reviewed.
24
+ - This registry records source inspiration, not license clearance for vendored third-party content. Vendoring requires a separate license/security review.
25
+ - `SKILL.md` is the entry point. References must be declared in frontmatter and stay within the skill directory.
26
+
@@ -0,0 +1,33 @@
1
+ # Init Evolution Review
2
+
3
+ Date:
4
+ Base:
5
+ Head:
6
+
7
+ ## Changed Surface
8
+
9
+ -
10
+
11
+ ## Decision
12
+
13
+ Choose one:
14
+
15
+ - No init impact
16
+ - Surface check only
17
+ - Init update required
18
+
19
+ Rationale:
20
+
21
+ ## Updates Made
22
+
23
+ -
24
+
25
+ ## Verification
26
+
27
+ ```bash
28
+ # commands and results
29
+ ```
30
+
31
+ ## Residual Risk
32
+
33
+ -
package/harness.json CHANGED
@@ -46,9 +46,11 @@
46
46
  "checkStructure": "scripts/check-engineering-structure.sh",
47
47
  "checkDocIndex": "scripts/check-doc-index.sh",
48
48
  "checkDocLinks": "scripts/check-doc-links.sh",
49
- "checkHarnessRuntimeClean": "scripts/check-harness-runtime-clean.sh",
50
- "ci": "scripts/ci.sh"
51
- },
49
+ "checkHarnessRuntimeClean": "scripts/check-harness-runtime-clean.sh",
50
+ "checkInitEvolutionNeeded": "scripts/check-init-evolution-needed.sh",
51
+ "checkInitSurface": "scripts/check-init-surface.sh",
52
+ "ci": "scripts/ci.sh"
53
+ },
52
54
  "models": {
53
55
  "analyze": {
54
56
  "provider": "wizard-local",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tea-agent/loop-agent",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "loop-agent": "bin/loop-agent.js"
@@ -15,10 +15,12 @@
15
15
  "docs/design/README.md",
16
16
  "docs/exec-plans/README.md",
17
17
  "docs/exec-plans/active/README.md",
18
- "docs/exec-plans/completed/README.md",
19
- "docs/progress/README.md",
20
- "docs/reports/README.md",
21
- "docs/templates/",
18
+ "docs/exec-plans/completed/README.md",
19
+ "docs/init-surface.manifest.json",
20
+ "docs/progress/README.md",
21
+ "docs/reports/README.md",
22
+ "docs/skills/",
23
+ "docs/templates/",
22
24
  "examples/",
23
25
  "harness.json",
24
26
  "skills/",
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: code-review-core
3
+ description: 用于只读 code review 节点,产出带文件与行号引用的优先级 findings。
4
+ ---
5
+
6
+ # Code Review Core
7
+
8
+ 本 skill 用于 reviewer 节点。
9
+
10
+ ## Review 重点
11
+
12
+ - 优先关注 correctness、行为回归、security、数据丢失与缺失验证。
13
+ - findings 须 grounded 在具体文件与行号。
14
+ - 区分 blocking findings 与次要 maintainability 备注。
15
+ - 检查测试是否证明变更行为,文档是否与面向用户的变更一致。
16
+ - 若无 findings,明确说明,并指出 residual test gap(如有)。
17
+
18
+ ## Output
19
+
20
+ 按 severity 排序列出 findings。仅当无 blocking findings 时,才写 `VERDICT: pass`。
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: codebase-scout
3
+ description: 用于只读 scout 节点,在实现前定位现有代码、测试、文档与集成点。
4
+ ---
5
+
6
+ # Codebase Scout
7
+
8
+ 本 skill 用于 scout 节点。
9
+
10
+ ## 规则
11
+
12
+ - 从 repo 指令、task source 与邻近测试入手。
13
+ - 可用时优先 CodeGraph;否则用 `rg` 与聚焦文件阅读。
14
+ - 在提议新抽象前,识别现有 helper 与 ownership 边界。
15
+ - 只返回事实,不做编辑。
16
+
17
+ ## Output
18
+
19
+ 列出相关文件、现有模式、风险,以及实现所需的最小 write surface。
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: init-capability-evolution
3
+ description: 用于 loop-agent 本仓库的初始化能力演化审查,判断代码、skill、模板、包范围或 DAG 默认能力变化是否需要同步更新目标项目 init surface。
4
+ ---
5
+
6
+ # Init Capability Evolution
7
+
8
+ 本 skill 用于 loop-agent 本仓库。当变更可能影响 `loop-agent init` 初始化其他项目的能力时使用。
9
+
10
+ ## Goal
11
+
12
+ 让模型自行判断并维护初始化能力,而不是依赖人工记忆:
13
+
14
+ - 新能力是否应该进入目标项目。
15
+ - 新增/修改的 skill 是否应随 npm 包和 `init --profile full` 投影。
16
+ - 目标项目的 `AGENTS.md`、README managed block、治理 docs、scripts 或 templates 是否需要更新。
17
+ - `package.json files` 与 `docs/init-surface.manifest.json` 是否仍覆盖真实发布范围。
18
+ - 是否需要目标项目 smoke、init doctor、docs audit 或 package dry-run 证据。
19
+
20
+ ## Trigger Tiers
21
+
22
+ 按 `docs/init-surface.manifest.json` 的 `evolutionReview.tiers` 判断成本:
23
+
24
+ - `advisory`:只记录提示,不阻塞。
25
+ - `surface-check`:运行 `bash scripts/check-init-surface.sh`;通过即可。
26
+ - `model-review`:写一份简短 init evolution review,必要时修改 init surface、包范围、文档、skill 或测试。
27
+
28
+ 不要把小改动升级成重流程。只有当变化可能改变目标项目初始化体验、默认 DAG 行为、skill resolution、发布包边界或 init 生成物时,才进入 model-review。
29
+
30
+ ## Review Questions
31
+
32
+ 审查时逐条回答:
33
+
34
+ 1. 本次变更会改变目标项目执行 `loop-agent init --profile full --merge` 后得到的文件、规则或能力吗?
35
+ 2. 是否新增、删除或重命名了 `skills/**`,并且目标项目需要 repo-local 可审计副本?
36
+ 3. 是否改变了默认 DAG role skills、skill resolution、strict skill audit 或 task prompt 注入?
37
+ 4. 是否新增通用治理模板、script matrix、production readiness 或 operator recovery 文档,需要目标项目初始化后可见?
38
+ 5. `package.json files` 是否包含所有 npm 运行和初始化所需静态资料?
39
+ 6. `docs/init-surface.manifest.json` 是否更新了 package / init / exclude / trigger contract?
40
+ 7. 旧目标项目是否只需 advisory、需要手工复制新增文件,还是需要未来 `init audit/update` 迁移能力?
41
+
42
+ ## Output
43
+
44
+ 轻量审查可以只在 handoff 中说明。高影响审查应写入:
45
+
46
+ ```text
47
+ docs/reports/YYYY-MM-DD-init-evolution-review.md
48
+ ```
49
+
50
+ 报告保持短小,包含:
51
+
52
+ - changed surface
53
+ - decision: no init impact / surface check only / init update required
54
+ - files updated
55
+ - verification commands and results
56
+ - residual risk
57
+
58
+ ## Required Verification
59
+
60
+ 按影响面选择最小命令:
61
+
62
+ ```bash
63
+ bash scripts/check-init-surface.sh
64
+ bash scripts/check-repo.sh
65
+ npm test -- init-command dag-skills dag-validate-command
66
+ npm pack --dry-run --ignore-scripts
67
+ ```
68
+
69
+ 如果没有新鲜验证证据,不要宣称 init evolution 已完成。
@@ -14,11 +14,12 @@ loop-agent <command> ...
14
14
 
15
15
  面向自举迭代和日常使用时,全局 CLI 应来自 npm 上已发布的安装包。首次安装或有意升级使用 `@latest`:
16
16
 
17
- ```bash
18
- npm install -g @tea-agent/loop-agent@latest
19
- npm list -g @tea-agent/loop-agent --depth=0
20
- loop-agent doctor
21
- ```
17
+ ```bash
18
+ npm install -g @tea-agent/loop-agent@latest
19
+ npm list -g @tea-agent/loop-agent --depth=0
20
+ loop-agent --version
21
+ loop-agent doctor
22
+ ```
22
23
 
23
24
  一次自举任务启动后不要中途升级控制器;记录 `npm list -g` 显示的实际版本。不要在 DAG 节点中反复用 `npx @latest` 拉取,也不要使用当前工作区的 `npm link` 或 `npm run dev` 作为控制器去修改 loop-agent 本仓库的 CLI、DAG runtime、executor、package metadata 或 build output。`npm run dev -- <command> ...` 只用于源码调试和聚焦 CLI 开发。
24
25
 
@@ -39,7 +40,7 @@ loop-agent doctor
39
40
  loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
40
41
  loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
41
42
  ```
42
- `<temp-dir>` 表示平台原生临时目录;也可以省略 `--output`,再使用命令 JSON 输出里的 `outputPath`。
43
+ `<temp-dir>` 表示平台原生临时目录;也可以省略 `--output`,再使用命令 JSON 输出里的 `outputPath`。主路径 JSON 输出含稳定 summary:`dag run-task` 的 `message` 为 `DAG draft created`,`dag validate` 的 `message` 为 `DAG validation passed` 且含 `checks.writeSets` / `checks.decisionGates`,`run-dag` 的 `message` 为 `DAG run finished`。
43
44
  2. **Operator 工具**,用于 recovery、诊断与 closeout:
44
45
  ```bash
45
46
  loop-agent dag status --run-id <run-id>
@@ -65,10 +66,11 @@ loop-agent doctor
65
66
  ```
66
67
 
67
68
  ### Setup(首次)
68
- ```bash
69
- npm install -g @tea-agent/loop-agent@latest
70
- loop-agent --help
71
- ```
69
+ ```bash
70
+ npm install -g @tea-agent/loop-agent@latest
71
+ loop-agent --version
72
+ loop-agent --help
73
+ ```
72
74
 
73
75
  ### 检查 repo harness
74
76
  ```bash
@@ -76,10 +78,10 @@ loop-agent inspect # 当前 repo(自
76
78
  loop-agent --repo-root /path/to/target-repo inspect # 指定 repo
77
79
  ```
78
80
 
79
- ### 健康检查
80
- ```bash
81
- loop-agent doctor
82
- ```
81
+ ### 健康检查
82
+ ```bash
83
+ loop-agent doctor
84
+ ```
83
85
 
84
86
  `doctor` 报告当前生效的 Pi backend 及 SDK/CLI 可用性。Pi step 默认 SDK-first 执行:
85
87
 
@@ -88,11 +90,26 @@ export CODE_AGENT_PI_BACKEND=sdk-first # 默认:先试 Pi SDK,允许时 fa
88
90
  export CODE_AGENT_PI_BACKEND=cli-only # 紧急回滚:纯 CLI 路径
89
91
  ```
90
92
 
91
- SDK 回归或 SDK 可选依赖不可用时用 `cli-only` 诊断。CLI fallback 路径须与现有 workflow 行为兼容。
92
-
93
- ### 创建新 task
94
- ```bash
95
- loop-agent new-task <task-id> "Task Title"
93
+ SDK 回归或 SDK 可选依赖不可用时用 `cli-only` 诊断。CLI fallback 路径须与现有 workflow 行为兼容。
94
+
95
+ ### 初始化与旧项目更新
96
+ ```bash
97
+ loop-agent init instructions --repo-root <target-repo>
98
+ loop-agent init --repo-root <target-repo> --profile full --merge
99
+ loop-agent init doctor --repo-root <target-repo>
100
+ loop-agent init check-update --repo-root <target-repo> --json
101
+ loop-agent init check-update --repo-root <target-repo> --markdown
102
+ loop-agent init update --repo-root <target-repo> --bootstrap-surface
103
+ loop-agent init update --repo-root <target-repo> --apply-safe
104
+ ```
105
+
106
+ `init check-update` 是只读升级报告,用于发现目标项目是否落后于当前包内初始化 surface。输出会区分 deterministic actions、model merge tasks、human decisions 和 recommended next。`--markdown` 会渲染可直接交给模型执行的合并指引,包含 `allowedPaths`、`forbiddenPaths`、`mergeRules` 和 `verification`。
107
+
108
+ `init update --bootstrap-surface` 为旧项目写入 `.harness/init-surface.json` 的 `inferred-baseline`,不伪装成历史 recorded baseline。`init update --apply-safe` 只执行确定性安全动作:补缺失文件、创建目录、刷新 managed block;已有但无法确认与当前包一致的文件会进入 model merge tasks,不会被覆盖。
109
+
110
+ ### 创建新 task
111
+ ```bash
112
+ loop-agent new-task <task-id> "Task Title"
96
113
  ```
97
114
 
98
115
  创建 `.harness/tasks/<task-id>/`,含 `source/`、`artifacts/`、`logs/` 及初始 state。
@@ -187,6 +204,7 @@ loop-agent goal clear <task-id>
187
204
  loop-agent dag validate --dag <temp-dir>/hybrid-dag.json # 常规 validation;无 .harness/dag-runs 副作用
188
205
  loop-agent dag validate --dag <temp-dir>/hybrid-dag.json --strict-models # 非 canonical executorModels 时失败
189
206
  loop-agent dag validate --dag <temp-dir>/hybrid-dag.json --strict-governance # governance warning 时失败
207
+ loop-agent dag validate --dag <temp-dir>/hybrid-dag.json --strict-skills # missing/error/truncated skill 或 unresolved reference 时失败
190
208
  loop-agent dag validate --dag <temp-dir>/hybrid-dag.json --strict-governance --spine-task <task-id> # 同时消费 minimal spec spine audit
191
209
  loop-agent dag validate --dag docs/templates/agent-dag.supervised-implementation.json --strict-models --strict-governance # role=supervisor + write-set-gate topology
192
210
  cp docs/templates/agent-dag.supervised-implementation.json <temp-dir>/supervised-dag.json
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: test-driven-development
3
+ description: 用于需要回归覆盖的行为变更与 bug 修复。保持小循环:写失败测试 → 变绿 → 仅在 green 后 refactor。
4
+ ---
5
+
6
+ # Test-Driven Development
7
+
8
+ 本 skill 用于会改变 runtime 行为的 implementation 节点。
9
+
10
+ ## 规则
11
+
12
+ - 行为是新增或已损坏时,在 production code 之前写或更新聚焦测试。
13
+ - 运行聚焦测试,确认因预期原因失败。
14
+ - 做最小实现变更使测试变绿。
15
+ - refactor 仅在 green 之后,且仍在同一 bounded write set 内。
16
+ - 能测真实本地 module 时,不要用 broad mock。
17
+
18
+ ## Output
19
+
20
+ 报告 red 命令、green 命令,以及仍需要的 broader verification。