harnessed 5.0.4 → 5.0.6

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 (69) hide show
  1. package/CHANGELOG.md +3183 -0
  2. package/README-en.md +24 -3
  3. package/README-zh.md +24 -3
  4. package/README.md +24 -3
  5. package/bin/harnessed-check-docs.mjs +1 -0
  6. package/bin/harnessed-inject-state.mjs +57 -9
  7. package/bin/harnessed-stop-hook.mjs +51 -9
  8. package/bin/harnessed-update-reminder-worker.mjs +2262 -0
  9. package/bin/harnessed-update-reminder.mjs +389 -0
  10. package/dist/cli.mjs +20408 -15727
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/index.mjs.map +1 -1
  14. package/manifests/cc-hooks/update-reminder.yaml +39 -0
  15. package/manifests/optional/codegraph.yaml +2 -0
  16. package/manifests/skill-packs/gsd.yaml +5 -3
  17. package/manifests/skill-packs/mattpocock-skills.yaml +3 -3
  18. package/manifests/skill-packs/planning-with-files.yaml +2 -2
  19. package/manifests/tools/playwright-cli.yaml +4 -0
  20. package/manifests/tools/superpowers.yaml +2 -2
  21. package/messages/en.json +1 -0
  22. package/messages/zh-Hans.json +3 -2
  23. package/package.json +4 -1
  24. package/workflows/auto/SKILL.md +1 -1
  25. package/workflows/auto/SKILL.zh-Hans.md +1 -1
  26. package/workflows/defaults.yaml +12 -0
  27. package/workflows/discuss/phase/SKILL.md +1 -1
  28. package/workflows/discuss/phase/SKILL.zh-Hans.md +1 -1
  29. package/workflows/discuss/subtask/SKILL.md +1 -1
  30. package/workflows/discuss/subtask/SKILL.zh-Hans.md +1 -1
  31. package/workflows/harnessed-update/SKILL.md +106 -0
  32. package/workflows/harnessed-update/SKILL.zh-Hans.md +90 -0
  33. package/workflows/harnessed-update/workflow.yaml +19 -0
  34. package/workflows/plan/ai-integration/SKILL.md +39 -0
  35. package/workflows/plan/ai-integration/SKILL.zh-Hans.md +38 -0
  36. package/workflows/plan/ai-integration/workflow.yaml +12 -0
  37. package/workflows/plan/auto/workflow.yaml +22 -2
  38. package/workflows/plan/phase/SKILL.md +2 -2
  39. package/workflows/plan/phase/SKILL.zh-Hans.md +2 -2
  40. package/workflows/plan/secure/SKILL.md +39 -0
  41. package/workflows/plan/secure/SKILL.zh-Hans.md +38 -0
  42. package/workflows/plan/secure/workflow.yaml +12 -0
  43. package/workflows/plan/spec/SKILL.md +39 -0
  44. package/workflows/plan/spec/SKILL.zh-Hans.md +38 -0
  45. package/workflows/plan/spec/workflow.yaml +12 -0
  46. package/workflows/plan/ui/SKILL.md +39 -0
  47. package/workflows/plan/ui/SKILL.zh-Hans.md +38 -0
  48. package/workflows/plan/ui/workflow.yaml +12 -0
  49. package/workflows/role-prompts.yaml +62 -6
  50. package/workflows/role-prompts.zh-Hans.yaml +60 -6
  51. package/workflows/ship/auto/SKILL.md +2 -1
  52. package/workflows/ship/auto/SKILL.zh-Hans.md +2 -1
  53. package/workflows/ship/preflight/SKILL.md +14 -2
  54. package/workflows/ship/preflight/SKILL.zh-Hans.md +12 -2
  55. package/workflows/ship/preflight/workflow.yaml +9 -3
  56. package/workflows/task/clarify/SKILL.md +2 -2
  57. package/workflows/task/clarify/SKILL.zh-Hans.md +2 -2
  58. package/workflows/task/code/SKILL.md +1 -1
  59. package/workflows/task/code/SKILL.zh-Hans.md +1 -1
  60. package/workflows/task/deliver/SKILL.md +1 -1
  61. package/workflows/task/deliver/SKILL.zh-Hans.md +1 -1
  62. package/workflows/task/test/SKILL.md +1 -1
  63. package/workflows/task/test/SKILL.zh-Hans.md +1 -1
  64. package/workflows/verify/auto/SKILL.md +1 -1
  65. package/workflows/verify/auto/SKILL.zh-Hans.md +1 -1
  66. package/workflows/verify/design/SKILL.md +1 -1
  67. package/workflows/verify/design/SKILL.zh-Hans.md +1 -1
  68. package/workflows/verify/progress/SKILL.md +1 -1
  69. package/workflows/verify/progress/SKILL.zh-Hans.md +1 -1
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var package_default = {
3
- version: "5.0.4"};
3
+ version: "5.0.6"};
4
4
 
5
5
  // src/index.ts
6
6
  var VERSION = package_default.version;
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OA4Gb,CAAA;;;ACzGO,IAAM,UAAU,eAAA,CAAI","file":"index.mjs","sourcesContent":["{\n \"name\": \"harnessed\",\n \"version\": \"5.0.4\",\n \"description\": \"AI coding harness package manager + composition orchestrator\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"author\": \"easyinplay\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/easyinplay/harnessed.git\"\n },\n \"homepage\": \"https://github.com/easyinplay/harnessed#readme\",\n \"bugs\": \"https://github.com/easyinplay/harnessed/issues\",\n \"keywords\": [\n \"claude-code\",\n \"ai-harness\",\n \"package-manager\",\n \"composition\",\n \"skill-pack\",\n \"mcp\",\n \"orchestrator\"\n ],\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"packageManager\": \"pnpm@10.12.0\",\n \"bin\": {\n \"harnessed\": \"./dist/cli.mjs\",\n \"harnessed-inject-state\": \"./bin/harnessed-inject-state.mjs\"\n },\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"default\": \"./dist/index.mjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas/index.d.ts\",\n \"import\": \"./dist/schemas/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"manifests\",\n \"messages\",\n \"workflows\",\n \"routing\",\n \"config-templates\",\n \"schemas\",\n \"README.md\",\n \"README-en.md\",\n \"README-zh.md\",\n \"LICENSE\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.md\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"tsc --noEmit && tsup && node ./scripts/build-hooks.mjs\",\n \"build:hooks\": \"node ./scripts/build-hooks.mjs\",\n \"build:schema\": \"node ./scripts/build-schema.mjs\",\n \"validate:schema\": \"node ./scripts/validate-schema.mjs\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run --passWithNoTests\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage --passWithNoTests\",\n \"test:codex-live\": \"node ./scripts/codex-live/run.mjs\",\n \"bench\": \"vitest bench --run\",\n \"bench:runtime\": \"node scripts/benchmark-runtime.mjs\",\n \"test:runtime-channels\": \"node scripts/runtime-channel-smoke.mjs\",\n \"test:docs\": \"node --test tests/docs/install-channels.contract.mjs\",\n \"lint\": \"biome check .\",\n \"lint:fix\": \"biome check --write .\",\n \"format\": \"biome format --write .\",\n \"build:binary\": \"bun scripts/build-binary.mjs\"\n },\n \"dependencies\": {\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.142\",\n \"@clack/prompts\": \"^0.10.1\",\n \"@sinclair/typebox\": \"^0.34.49\",\n \"ajv\": \"^8.20.0\",\n \"ajv-errors\": \"^3.0.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^13.0.0\",\n \"diff\": \"^9.0.0\",\n \"expr-eval\": \"^2.0.2\",\n \"picocolors\": \"^1.1.1\",\n \"proper-lockfile\": \"^4.1.2\",\n \"undici\": \"^8.12.1\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.0.0\",\n \"@types/node\": \"^22.10.0\",\n \"@types/proper-lockfile\": \"^4.1.4\",\n \"@vitest/coverage-v8\": \"^4.0.0\",\n \"esbuild\": \"0.27.7\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^4.0.0\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\n \"esbuild\"\n ]\n }\n}\n","// Main library entry — re-exports public APIs.\n// phase 1.1 batch 1: skeleton only; schema validator wired in batch 2 (T3+).\n\nimport pkg from '../package.json' with { type: 'json' }\n\nexport const VERSION = pkg.version\n"]}
1
+ {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OA+Gb,CAAA;;;AC5GO,IAAM,UAAU,eAAA,CAAI","file":"index.mjs","sourcesContent":["{\n \"name\": \"harnessed\",\n \"version\": \"5.0.6\",\n \"description\": \"AI coding harness package manager + composition orchestrator\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"author\": \"easyinplay\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/easyinplay/harnessed.git\"\n },\n \"homepage\": \"https://github.com/easyinplay/harnessed#readme\",\n \"bugs\": \"https://github.com/easyinplay/harnessed/issues\",\n \"keywords\": [\n \"claude-code\",\n \"ai-harness\",\n \"package-manager\",\n \"composition\",\n \"skill-pack\",\n \"mcp\",\n \"orchestrator\"\n ],\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"packageManager\": \"pnpm@10.12.0\",\n \"bin\": {\n \"harnessed\": \"./dist/cli.mjs\",\n \"harnessed-inject-state\": \"./bin/harnessed-inject-state.mjs\"\n },\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"default\": \"./dist/index.mjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas/index.d.ts\",\n \"import\": \"./dist/schemas/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"manifests\",\n \"messages\",\n \"workflows\",\n \"routing\",\n \"config-templates\",\n \"schemas\",\n \"CHANGELOG.md\",\n \"README.md\",\n \"README-en.md\",\n \"README-zh.md\",\n \"LICENSE\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.md\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"tsc --noEmit && tsup && node ./scripts/build-hooks.mjs\",\n \"prepack\": \"npm run build\",\n \"build:hooks\": \"node ./scripts/build-hooks.mjs\",\n \"build:schema\": \"node ./scripts/build-schema.mjs\",\n \"validate:schema\": \"node ./scripts/validate-schema.mjs\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run --passWithNoTests\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage --passWithNoTests\",\n \"test:codex-live\": \"node ./scripts/codex-live/run.mjs\",\n \"bench\": \"vitest bench --run\",\n \"bench:runtime\": \"node scripts/benchmark-runtime.mjs\",\n \"test:runtime-channels\": \"node scripts/runtime-channel-smoke.mjs\",\n \"test:docs\": \"node --test tests/docs/install-channels.contract.mjs\",\n \"lint\": \"biome check .\",\n \"lint:fix\": \"biome check --write .\",\n \"format\": \"biome format --write .\",\n \"build:binary\": \"bun scripts/build-binary.mjs\"\n },\n \"dependencies\": {\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.142\",\n \"@clack/prompts\": \"^0.10.1\",\n \"@sinclair/typebox\": \"^0.34.49\",\n \"ajv\": \"^8.20.0\",\n \"ajv-errors\": \"^3.0.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^13.0.0\",\n \"diff\": \"^9.0.0\",\n \"expr-eval\": \"^2.0.2\",\n \"picocolors\": \"^1.1.1\",\n \"proper-lockfile\": \"^4.1.2\",\n \"smol-toml\": \"^1.9.1\",\n \"undici\": \"^8.12.1\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.0.0\",\n \"@types/node\": \"^22.10.0\",\n \"@types/proper-lockfile\": \"^4.1.4\",\n \"@vitest/coverage-v8\": \"^4.0.0\",\n \"esbuild\": \"0.27.7\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^4.0.0\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\n \"esbuild\"\n ]\n }\n}\n","// Main library entry — re-exports public APIs.\n// phase 1.1 batch 1: skeleton only; schema validator wired in batch 2 (T3+).\n\nimport pkg from '../package.json' with { type: 'json' }\n\nexport const VERSION = pkg.version\n"]}
@@ -0,0 +1,39 @@
1
+ apiVersion: harnessed/v1
2
+ kind: Manifest
3
+ metadata:
4
+ name: update-reminder
5
+ display_name: Harnessed Update Reminder
6
+ description: Cache-only SessionStart reminder for available harnessed updates.
7
+ upstream:
8
+ source: update-reminder
9
+ homepage: https://github.com/easyinplay/harnessed
10
+ repository: https://github.com/easyinplay/harnessed.git
11
+ license: Apache-2.0
12
+ notice: First-party harnessed update reminder.
13
+ spec:
14
+ type: cc-hook
15
+ component_type: command
16
+ category: meta
17
+ install_type: hook
18
+ install:
19
+ method: cc-hook-add
20
+ cmd: "node bin/harnessed-update-reminder.mjs"
21
+ hook_event: SessionStart
22
+ hook_command: "node bin/harnessed-update-reminder.mjs"
23
+ idempotent_check: "grep -q harnessed-update-reminder ~/.claude/settings.json"
24
+ verify:
25
+ cmd: "grep -q harnessed-update-reminder ~/.claude/settings.json"
26
+ timeout_ms: 5000
27
+ expected_exit_code: 0
28
+ uninstall:
29
+ cmd: "true"
30
+ upstream_health:
31
+ stability: stable
32
+ last_check: "2026-10-30"
33
+ last_known_good_version: "5.0.5"
34
+ fallback_action: warn
35
+ signed_by: easyinplay
36
+ platforms:
37
+ - linux
38
+ - darwin
39
+ - win32
@@ -41,6 +41,8 @@ spec:
41
41
  timeout_ms: 10000
42
42
  expected_exit_code: 0
43
43
  uninstall:
44
+ # Upstream 1.6.0 documents this command as removing agent wiring and the CLI
45
+ # itself, including npm-global packages, standalone bundles, and launchers.
44
46
  cmd: "codegraph uninstall --yes"
45
47
  upstream_health:
46
48
  stability: stable
@@ -44,9 +44,8 @@ spec:
44
44
  && test -f ~/.claude/agents/gsd-verifier.md
45
45
  timeout_ms: 10000
46
46
  uninstall:
47
- cmd: "npx --yes @opengsd/gsd-core@latest --uninstall --claude"
48
- cleanup_paths:
49
- - ~/.claude/skills/gsd-plan-phase
47
+ cmd: "npx --yes @opengsd/gsd-core@latest --claude --global --uninstall"
48
+ cleanup_paths: []
50
49
  # GSD 1.18.0 on Codex installs skills under ~/.agents/skills; retain the legacy
51
50
  # ~/.codex/skills path for existing installs. Probe files, not empty directories.
52
51
  harness_overrides:
@@ -78,6 +77,9 @@ spec:
78
77
  agents/gsd-verifier.toml;
79
78
  do test -f "$GSD_VERIFY_ROOT/$GSD_VERIFY_RESOURCE" && test -r "$GSD_VERIFY_ROOT/$GSD_VERIFY_RESOURCE" && test -s "$GSD_VERIFY_ROOT/$GSD_VERIFY_RESOURCE" || exit 1; done
80
79
  timeout_ms: 10000
80
+ uninstall:
81
+ cmd: "npx --yes @opengsd/gsd-core@latest --codex --global --uninstall"
82
+ cleanup_paths: []
81
83
  upstream_health:
82
84
  stability: stable
83
85
  # 4.32.3 re-sync (2026-07-15) — gsd-core 1.7.0 GA 已发(npm latest=1.7.0,
@@ -69,9 +69,9 @@ spec:
69
69
  cmd: "test -f ~/.claude/skills/tdd/SKILL.md || test -f ~/.agents/skills/tdd/SKILL.md || test -f ~/.claude/skills/diagnosing-bugs/SKILL.md || test -f ~/.agents/skills/diagnosing-bugs/SKILL.md"
70
70
  timeout_ms: 5000
71
71
  uninstall:
72
- cmd: "rm -rf ~/.claude/skills/mattpocock-skills"
73
- cleanup_paths:
74
- - ~/.claude/skills/mattpocock-skills
72
+ # Skill removal is receipt-driven; upstream installs a flat set of names.
73
+ cmd: "true"
74
+ cleanup_paths: []
75
75
  upstream_health:
76
76
  stability: stable
77
77
  last_check: "2026-09-10"
@@ -29,13 +29,13 @@ spec:
29
29
  # pin 的 2.37.0 在 win32 上 /clear 恢复完全不工作)+ opt-in --autonomous
30
30
  # (省 per-tool 重注入 token)+ PLANNING_DISABLED=1 逃生口(v3.4.0)。
31
31
  git_ref: v3.4.1
32
- idempotent_check: "/plugin list | grep -q planning-with-files"
32
+ idempotent_check: "claude plugin list --json"
33
33
  marketplace_source: # ADR 0005 — third-party marketplace structured metadata
34
34
  source: github
35
35
  repo: OthmanAdi/planning-with-files
36
36
  verify:
37
37
  # Claude plugin payload verification remains a separate installer-channel follow-up.
38
- cmd: "/plugin list | grep -q planning-with-files"
38
+ cmd: "claude plugin list --json"
39
39
  timeout_ms: 5000
40
40
  uninstall:
41
41
  cmd: "/plugin uninstall planning-with-files@planning-with-files"
@@ -61,6 +61,10 @@ spec:
61
61
  expected_exit_code: 0
62
62
  uninstall:
63
63
  cmd: "npm uninstall -g @playwright/cli"
64
+ # Playwright CLI 0.1.22 has no uninstall-browser command. Its ms-playwright
65
+ # cache is shared by every Playwright installation on the host, so harnessed
66
+ # deliberately leaves browser binaries in place rather than deleting data it
67
+ # cannot safely attribute to this component.
64
68
  upstream_health:
65
69
  stability: unstable
66
70
  last_check: "2026-10-23"
@@ -28,9 +28,9 @@ spec:
28
28
  # v6.1.1 Codex `hooks: {}` 修复(不再误注册 Claude SessionStart hook)。
29
29
  # Gemini CLI 支持上游移除(Google EOL)— harnessed 无 gemini 平台面,无涉。
30
30
  git_ref: v6.1.1
31
- idempotent_check: "/plugin list | grep -q superpowers"
31
+ idempotent_check: "claude plugin list --json"
32
32
  verify:
33
- cmd: "/plugin list | grep -q superpowers"
33
+ cmd: "claude plugin list --json"
34
34
  timeout_ms: 5000
35
35
  uninstall:
36
36
  cmd: "/plugin uninstall superpowers@superpowers-marketplace"
package/messages/en.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "setup.step_a_complete": "Step A: {{count}} workflows installed to {{path}}",
8
8
  "setup.step_a_render.complete": " generated {{count}}/{{total}} command files",
9
9
  "setup.step_a_render.warnings_header": " [A.5] warnings — some capability cmds could not be fully resolved:",
10
+ "setup.command_warning": " [A.6] {{message}}",
10
11
  "setup.step_c.created": " [C] created {{path}} + enabled Agent Teams",
11
12
  "setup.step_c.already_enabled": " [C] Agent Teams already enabled ({{path}})",
12
13
  "setup.step_c.enabled_backup": " [C] enabled Agent Teams in {{path}} (backup saved → {{backupPath}})",
@@ -7,14 +7,15 @@
7
7
  "setup.step_a_complete": "Step A: {{count}} workflows installed to {{path}}",
8
8
  "setup.step_a_render.complete": "",
9
9
  "setup.step_a_render.warnings_header": " warnings — some capability cmds could not be fully resolved:",
10
+ "setup.command_warning": " [A.6] {{message}}",
10
11
  "setup.step_c.created": "",
11
12
  "setup.step_c.already_enabled": "",
12
13
  "setup.step_c.enabled_backup": "",
13
- "setup.step_c.skipped": "",
14
+ "setup.step_c.skipped": " [C] Agent Teams 启用已跳过:{{message}}",
14
15
  "setup.step_d.created": "",
15
16
  "setup.step_d.already_set": "",
16
17
  "setup.step_d.enabled_backup": "",
17
- "setup.step_d.skipped": "",
18
+ "setup.step_d.skipped": " [D] 用户语言写入已跳过:{{message}}",
18
19
  "setup.step_b_complete": "Upstream components: {{installed}} installed / {{already}} already-installed / {{skipped}} skipped / {{failed}} failed [{{seconds}}s]",
19
20
  "setup.complete": "setup complete — {{skills}} workflows + {{manifests}} base manifests",
20
21
  "setup.mcp_hint": "Run /mcp in Claude Code to verify MCP server connections.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harnessed",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
4
4
  "description": "AI coding harness package manager + composition orchestrator",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -51,6 +51,7 @@
51
51
  "routing",
52
52
  "config-templates",
53
53
  "schemas",
54
+ "CHANGELOG.md",
54
55
  "README.md",
55
56
  "README-en.md",
56
57
  "README-zh.md",
@@ -61,6 +62,7 @@
61
62
  "scripts": {
62
63
  "dev": "tsup --watch",
63
64
  "build": "tsc --noEmit && tsup && node ./scripts/build-hooks.mjs",
65
+ "prepack": "npm run build",
64
66
  "build:hooks": "node ./scripts/build-hooks.mjs",
65
67
  "build:schema": "node ./scripts/build-schema.mjs",
66
68
  "validate:schema": "node ./scripts/validate-schema.mjs",
@@ -90,6 +92,7 @@
90
92
  "expr-eval": "^2.0.2",
91
93
  "picocolors": "^1.1.1",
92
94
  "proper-lockfile": "^4.1.2",
95
+ "smol-toml": "^1.9.1",
93
96
  "undici": "^8.12.1",
94
97
  "yaml": "^2.9.0"
95
98
  },
@@ -125,7 +125,7 @@ Do NOT pipe to `harnessed run auto` — that is the CI/headless path ({{ host.ha
125
125
  {{ host.teams_step_note.skill }}
126
126
  {{ host.teams_teardown_note }}
127
127
  5. Otherwise, for each fired sub in `order` (serial subs sequentially, parallel subs concurrently):
128
- - **If the entry has `is_master: true`** (a stage master — e.g. `/auto` firing `plan`/`task`/`verify`): do NOT prompt+spawn it. RECURSE: run that master’s own `harnessed facts <sub> --out .harnessed-facts.json` (fill the nulls) → `harnessed gates <sub> --task "<spec>" --context-file .harnessed-facts.json --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → repeat this loop for ITS fired subs.
128
+ - **If the entry has `is_master: true`** (a stage master — e.g. `/auto` firing `plan`/`task`/`verify`): do NOT prompt+spawn it. RECURSE: run that master’s own `harnessed facts <sub> --out .harnessed-facts.json` (fill the nulls) → `harnessed gates <sub> --task "<spec>" --context-file .harnessed-facts.json --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → repeat this loop for ITS fired subs. The nested `checkpoint start` expands that parent entry inside the existing root ledger; it must not replace the root workflow owner, timestamps, checkpoint path, or sibling entries.
129
129
  - **Else (leaf sub):**
130
130
  a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → parse `{prompt, max_iterations, model}`.
131
131
  b. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
@@ -123,7 +123,7 @@ Sister `workflows/capabilities.yaml`:
123
123
  {{ host.teams_step_note.skill }}
124
124
  {{ host.teams_teardown_note }}
125
125
  5. 否则,对 `order` 里每个 fired sub(serial 串行、parallel 并发):
126
- - **若该项 `is_master: true`**(本身是 stage master —— 如 `/auto` fire `plan`/`task`/`verify`):**不要**直接 prompt+spawn。RECURSE:跑该 master 自己的 `harnessed facts <sub> --out .harnessed-facts.json`(填完 null)→ `harnessed gates <sub> --task "<spec>" --context-file .harnessed-facts.json --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → 对它的 fired subs 重复本循环。
126
+ - **若该项 `is_master: true`**(本身是 stage master —— 如 `/auto` fire `plan`/`task`/`verify`):**不要**直接 prompt+spawn。RECURSE:跑该 master 自己的 `harnessed facts <sub> --out .harnessed-facts.json`(填完 null)→ `harnessed gates <sub> --task "<spec>" --context-file .harnessed-facts.json --skip-sub discuss` → `harnessed checkpoint start <sub> --plan '<json>'` → 对它的 fired subs 重复本循环。nested `checkpoint start` 会在现有 root ledger 内展开 parent entry;不得替换 root workflow owner、时间戳、checkpoint path 或 sibling entries。
127
127
  - **否则(leaf sub):**
128
128
  a. Bash: `harnessed prompt <sub> --task "<spec>" --json` → 解析 `{prompt, max_iterations, model}`。
129
129
  b. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
@@ -45,6 +45,18 @@ ralph_max_iterations:
45
45
  plan-architecture:
46
46
  01-plan-eng-review: 3
47
47
 
48
+ plan-spec:
49
+ 01-spec-phase: 5
50
+
51
+ plan-ui:
52
+ 01-ui-phase: 5
53
+
54
+ plan-secure:
55
+ 01-secure-phase: 5
56
+
57
+ plan-ai-integration:
58
+ 01-ai-integration-phase: 5
59
+
48
60
  plan-phase:
49
61
  01-gsd-plan: 5
50
62
  02-persist: 5
@@ -5,7 +5,7 @@ description: |
5
5
  implementation decisions / 跨 phase API contract 不清 / phase scope > 1 day / 灰色地带)。
6
6
  schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
7
7
  (gsd-discuss-phase + planning-with-files) + 2 phases (01-gsd-discuss + 02-persist findings.md
8
- + knowledge.md)。Triggered by harnessed CLI `harnessed discuss-phase --phase <num>` or slash
8
+ + knowledge.md)。Triggered by headless CLI `harnessed run discuss-phase` or slash
9
9
  command `/discuss-phase` after `harnessed setup`.
10
10
  trigger_phrases:
11
11
  - "discuss phase"
@@ -5,7 +5,7 @@ description: |
5
5
  实现决策 / 跨 phase API contract 不清 / phase scope > 1 天 / 灰色地带)。
6
6
  schema_version: harnessed.workflow.v3 with disciplines_applied (6 default) + tools_available
7
7
  (gsd-discuss-phase + planning-with-files) + 2 phases(01-gsd-discuss + 02-persist findings.md
8
- + knowledge.md)。Triggered by harnessed CLI `harnessed discuss-phase --phase <num>` or slash
8
+ + knowledge.md)。Triggered by headless CLI `harnessed run discuss-phase` or slash
9
9
  command `/discuss-phase` after `harnessed setup`.
10
10
  trigger_phrases:
11
11
  - "discuss phase"
@@ -5,7 +5,7 @@ description: |
5
5
  API contract / 错误成本高)。schema_version: harnessed.workflow.v3 with disciplines_applied (6
6
6
  default) + tools_available (superpowers-brainstorming + grill-with-docs + grill-me) + 1 phase
7
7
  (01-brainstorm with conditional invokes_tools for spec_ambiguous + no_docs)。Triggered by
8
- harnessed CLI `harnessed discuss-subtask --task <text>` or slash command `/discuss-subtask`
8
+ headless CLI `harnessed run discuss-subtask` or slash command `/discuss-subtask`
9
9
  after `harnessed setup`.
10
10
  trigger_phrases:
11
11
  - "discuss subtask"
@@ -5,7 +5,7 @@ description: |
5
5
  API contract / 错误成本高)。schema_version: harnessed.workflow.v3 with disciplines_applied (6
6
6
  default) + tools_available (superpowers-brainstorming + grill-with-docs + grill-me) + 1 phase
7
7
  (01-brainstorm,含 spec_ambiguous + no_docs 条件调用 invokes_tools)。Triggered by
8
- harnessed CLI `harnessed discuss-subtask --task <text>` or slash command `/discuss-subtask`
8
+ headless CLI `harnessed run discuss-subtask` or slash command `/discuss-subtask`
9
9
  after `harnessed setup`.
10
10
  trigger_phrases:
11
11
  - "discuss subtask"
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: harnessed-update
3
+ description: |
4
+ Preview, confirm and execute a deterministic harnessed update. Report partial
5
+ outcomes honestly; offer bounded agent repair only after a second confirmation.
6
+ trigger_phrases:
7
+ - "harnessed update"
8
+ - "update harnessed"
9
+ - "更新 harnessed"
10
+ ---
11
+
12
+ # harnessed-update
13
+
14
+ ## Overview
15
+
16
+ One interactive entry point for deterministic self-update, harnessed-owned asset
17
+ refresh and reviewed updates of already-installed third-party components.
18
+ The CLI is the source of truth, not an agent's interpretation of installer logs.
19
+
20
+ ## Process
21
+
22
+ 1. Run `harnessed update --all --dry-run --json` for a read-only preview. Capture
23
+ stdout, stderr and the exit code separately. Read exactly one JSON object from
24
+ stdout even on nonzero exit; stderr contains diagnostics, not result data.
25
+ Validate `schemaVersion=1`, `operation=update`, `mode`, `host` and `runtime`.
26
+ Missing or malformed JSON, `error` or `failed` preview components mean STOP.
27
+ A preview containing `unsupported` is still partial; show those limits.
28
+ 2. Show the proposed changes and ask for explicit confirmation via
29
+ {{ host.ask_user }}. Cancellation, silence or unavailable confirmation means
30
+ STOP without mutation. A delegated subagent without approval must return
31
+ `STATUS: NEEDS_CLARIFICATION` for the main session to ask the user.
32
+ 3. Only after confirmation, run `harnessed update --all --json` exactly once.
33
+ The CLI owns P1 self-update and verified absolute-path P2 continuation; do not
34
+ launch continuation yourself or refresh assets from the replaced runtime.
35
+ 4. Display `status`, `components`, `warnings` and `error`. For every component,
36
+ show `id`, `status`, `before`, `target`, `after`, `reasonCode`, `verified` and
37
+ `restartRequired`. Keep unknown versions as `null`, not inferred `current`.
38
+ 5. `unsupported` and `retained` mean `partial`, never all-success. `unsupported`
39
+ has no reviewed update path. `retained` means refresh failed but the previous
40
+ installation still verifies; it was not updated. `not-installed` remains
41
+ absent, not installed or updated. Preserve the CLI's top-level result.
42
+ 6. Any `restartRequired=true` means STOP and ask the user to restart
43
+ {{ host.native }} before further workflow work, even if the update completed.
44
+ `handoff-failed`, `invalid-continuation`, `error` or nonzero exit means STOP.
45
+ A failed or partial component is not success: preserve the result and
46
+ diagnostics, then continue only to the bounded repair proposal in step 7.
47
+
48
+ 7. If the applied result contains `failed`, `unsupported` or `retained`
49
+ reviewed third-party components, show a second proposal before any repair.
50
+ State that harnessed orchestrates upstream open-source components and that
51
+ repair may read installation state, run upstream installers or verification
52
+ commands, modify the listed skill/plugin/host targets, and invoke the
53
+ selected host agent. State that it does not grant plugin or MCP trust, read
54
+ credentials, expand the host root, or touch components outside the listed
55
+ scope.
56
+ 8. Ask for explicit confirmation bound to the exact component ids in the
57
+ proposal. If confirmed, run exactly once:
58
+ `harnessed update --all --repair --yes --json`.
59
+ `--yes` is the explicit authorization for this bounded repair operation;
60
+ it is not a general future permission. If declined, unavailable or
61
+ non-interactive without `--yes`, do not invoke an agent and preserve the
62
+ deterministic `partial` or `failed` result.
63
+ 9. Treat `agentRepair.status=completed` as advisory only. The CLI must report
64
+ `agentRepair.verified=true` after rerunning the deterministic verifier;
65
+ otherwise report `verification-failed` or `failed`. Never rewrite the
66
+ original component result or claim overall success from an agent response.
67
+
68
+ ## Boundary
69
+
70
+ Phase 79 provides the bounded repair path. Do not start agent repair without the second explicit confirmation. Do not
71
+ install missing third parties, infer update commands from manifests, read
72
+ credentials, grant trust, rewrite ownership or switch host roots. The repair
73
+ runner is bounded to the exact reviewed component list and must finish with a
74
+ deterministic verifier pass.
75
+
76
+ These STOP rules override the generic invoke loop below: do not respawn or retry
77
+ the deterministic update, use `checkpoint --force` or claim COMPLETE after a
78
+ partial, failed or restart-blocked result. The only allowed next action for a
79
+ partial or failed result is the second-confirmation repair path in step 7;
80
+ otherwise report the evidence and return control to the user.
81
+ Only a verified `complete` result with no restart requirement can complete the
82
+ workflow; preview `planned` is not an applied update.
83
+
84
+ ## How to invoke
85
+
86
+ !`harnessed checkpoint intent harnessed-update`
87
+
88
+ > The banner above (when present) means this invocation is REGISTERED with the engine (an intent marker) — not yet compliant: the steps below (prompt → spawn → checkpoint complete) resolve it, and a per-turn `<workflow-intent>` reminder persists until they run.
89
+
90
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
91
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
92
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
93
+ {{ host.native }} {{ host.spawn_subagent }} (keeps the session responsive + lets clarification round-trips reach the user).
94
+
95
+ Do NOT pipe to `harnessed run harnessed-update` — that is the CI/headless path ({{ host.harnessed_run_warning_note.execution_tail }}
96
+
97
+ 1. Bash: `harnessed prompt harnessed-update --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
98
+ 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
99
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete harnessed-update --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
100
+ - if it blocks, run `harnessed checkpoint fail harnessed-update --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
101
+ - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
102
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
103
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete harnessed-update --result-file <path> --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
104
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail harnessed-update --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.
105
+
106
+ <!-- harnessed-generated:v4.12.0 -->
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: harnessed-update
3
+ description: |
4
+ 预览、确认并执行确定性 harnessed 更新。如实展示 partial,
5
+ 只有在第二次确认后才提供有边界的 agent repair。
6
+ trigger_phrases:
7
+ - "harnessed update"
8
+ - "update harnessed"
9
+ - "更新 harnessed"
10
+ ---
11
+
12
+ # harnessed-update
13
+
14
+ ## 概述
15
+
16
+ 为确定性 self-update、harnessed 自有资产刷新及已安装第三方组件的经审查更新,
17
+ 提供统一交互入口。CLI 是结果的唯一依据,不得由 agent 解读安装日志后自行判定成功。
18
+
19
+ ## 执行流程
20
+
21
+ 1. 运行 `harnessed update --all --dry-run --json` 获取只读 preview。
22
+ 分别保留 stdout、stderr 与 exit code。即使 exit 非零,也读取 stdout 中唯一的
23
+ JSON 对象;stderr 是诊断,不是结果数据。验证 `schemaVersion=1`、
24
+ `operation=update`、`mode`、`host` 和 `runtime`。JSON 缺失、格式错误、`error`
25
+ 或 failed 预览组件均 STOP。含 `unsupported` 的 preview 仍为 partial,必须展示限制。
26
+ 2. 展示计划变更,通过 {{ host.ask_user }} 获得明确确认。
27
+ 取消、沉默或无法确认均 STOP,不得修改。被委派且尚无授权的 subagent 必须返回
28
+ `STATUS: NEEDS_CLARIFICATION`,由主 session 询问用户。
29
+ 3. 确认后仅运行一次 `harnessed update --all --json`。P1 self-update 与经验证的
30
+ absolute-path P2 continuation 均由 CLI 管理;不得自行启动 continuation,
31
+ 不得在被替换的 runtime 中刷新资产。
32
+ 4. 展示 `status`、`components`、`warnings` 和 `error`。逐组件展示 `id`、`status`、
33
+ `before`、`target`、`after`、`reasonCode`、`verified` 与 `restartRequired`。
34
+ 未知版本保留 `null`,不得推断为 `current`。
35
+ 5. `unsupported` 与 `retained` 表示 `partial`,不是全部成功。`unsupported` 没有经审查的
36
+ 更新路径。`retained` 表示刷新失败但旧安装仍通过验证,不是已更新。
37
+ `not-installed` 表示保持缺失,不是已安装或已更新。保留 CLI 的顶层结果。
38
+ 6. 任一 `restartRequired=true` 均 STOP,要求用户重启 {{ host.native }} 后再进行其他
39
+ workflow 工作,即使更新已经完成也不能继续旧 session。
40
+ `handoff-failed`、`invalid-continuation`、`error` 或 exit 非零均 STOP。
41
+ failed 或 partial 组件不代表成功:保留结果与诊断,然后只能继续第 7 步的有边界
42
+ repair proposal。
43
+
44
+ 7. 如果应用结果包含 `failed`、`unsupported` 或 `retained` 的已审查第三方组件,
45
+ 在任何 repair 前展示第二份 repair proposal。明确说明 harnessed 编排上游开源组件,
46
+ repair 可能读取安装状态、执行上游安装器或验证命令、修改列出的 skill/plugin/host
47
+ 目标,并启动选定的宿主 agent。明确说明它不会授予 plugin 或 MCP trust、读取凭据、
48
+ 扩大 host root,也不会触碰列表之外的组件。
49
+ 8. 要求用户确认 proposal 中的精确组件 id。确认后只运行一次:
50
+ `harnessed update --all --repair --yes --json`。
51
+ `--yes` 只代表本次有边界的 repair 已获得明确授权,不是未来永久授权。用户拒绝、无法确认,
52
+ 或 non-interactive 且没有 `--yes` 时,不得调用 agent,保留确定性 `partial` 或 `failed` 结果。
53
+ 9. `agentRepair.status=completed` 只能作为过程状态。CLI 必须在重新运行确定性 verifier 后报告
54
+ `agentRepair.verified=true`;否则报告 `verification-failed` 或 `failed`。不得根据 agent 回复
55
+ 改写原组件结果或声称整体成功。
56
+
57
+ ## 边界
58
+
59
+ Phase 79 提供有边界的 repair 路径。没有第二次明确确认不得启动 agent repair。不得安装缺失的第三方组件、从 manifest 推断更新
60
+ 命令、读取凭据、授予 trust、改写所有权或切换 host root。repair runner 只允许处理精确的已
61
+ 审查组件列表,并且必须以确定性 verifier 的结果结束。
62
+
63
+ 上述 STOP 规则优先于下方通用 invoke loop:对于 partial、failed 或 restart 阻塞结果,
64
+ 不得 respawn、重试确定性更新、使用 `checkpoint --force` 或宣称 COMPLETE。partial 或
65
+ failed 结果唯一允许的下一步是第 7 步的二次确认 repair;否则报告证据并将控制权交还用户。
66
+ 只有经验证的 `complete` 且无需 restart 时才能完成 workflow;
67
+ preview 的 `planned` 不代表已执行更新。
68
+
69
+ ## 如何调用
70
+
71
+ !`harnessed checkpoint intent harnessed-update`
72
+
73
+ > 上方 banner(如出现)表示本次调用已在引擎**登记**(intent 标记)——尚未合规:按下方步骤(prompt → spawn → checkpoint complete)完成即解除;在此之前每 turn 会持续注入 `<workflow-intent>` 提醒。
74
+
75
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
76
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
77
+ {{ host.native }} {{ host.spawn_subagent.zh_tool }} spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
78
+
79
+ **不要** pipe 到 `harnessed run harnessed-update` —— 那是 CI/headless 路径({{ host.harnessed_run_warning_note.execution_tail }}
80
+
81
+ 1. Bash: `harnessed prompt harnessed-update --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
82
+ 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
83
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete harnessed-update --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
84
+ - 若被拦下,跑 `harnessed checkpoint fail harnessed-update --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
85
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
86
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
87
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete harnessed-update --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
88
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail harnessed-update --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
89
+
90
+ <!-- harnessed-generated:v4.12.0 -->
@@ -0,0 +1,19 @@
1
+ schema_version: harnessed.workflow.v3
2
+ workflow: harnessed-update
3
+ description: |
4
+ Interactive deterministic update: preview, explicit confirmation, then
5
+ harnessed update --all --json. Report partial results honestly. When the
6
+ deterministic result retains or fails reviewed third-party components, show a
7
+ bounded repair proposal and require a second explicit confirmation before
8
+ harnessed update --all --repair --yes --json.
9
+
10
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
11
+ tools_available: []
12
+
13
+ phases:
14
+ - id: 01-update
15
+ name: Preview, confirm, repair and report the update
16
+ upstream: harnessed
17
+ capability: harnessed update --all --json
18
+ model: sonnet
19
+ max_iterations: 1
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: plan-ai-integration
3
+ description: Run the conditional GSD ai-integration-phase AI-SPEC contract before plan-phase.
4
+ trigger_phrases: ["plan ai integration", "gsd ai integration phase"]
5
+ ---
6
+
7
+ # plan-ai-integration workflow
8
+
9
+ ## Overview
10
+
11
+ Run `harnessed prompt plan-ai-integration --task "$ARGUMENTS" --json`, execute `/gsd-ai-integration-phase`, then complete the registered checkpoint with verifiable output.
12
+
13
+ ## Invocation
14
+
15
+ Fires only when `phase.builds_ai_system == true`.
16
+
17
+ ## How to invoke
18
+
19
+ !`harnessed checkpoint intent plan-ai-integration`
20
+
21
+ > The banner above (when present) means this invocation is REGISTERED with the engine (an intent marker) — not yet compliant: the steps below (prompt → spawn → checkpoint complete) resolve it, and a per-turn `<workflow-intent>` reminder persists until they run.
22
+
23
+ The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
24
+ an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
25
+ evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
26
+ {{ host.native }} {{ host.spawn_subagent }} (keeps the session responsive + lets clarification round-trips reach the user).
27
+
28
+ Do NOT pipe to `harnessed run plan-ai-integration` — that is the CI/headless path ({{ host.harnessed_run_warning_note.execution_tail }}
29
+
30
+ 1. Bash: `harnessed prompt plan-ai-integration --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model}`.
31
+ 2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`, then drive delivery with harnessed's own completion gate:
32
+ - on return, write the subagent's final output to a file and run `harnessed checkpoint complete plan-ai-integration --result-file <path>` — it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
33
+ - if it blocks, run `harnessed checkpoint fail plan-ai-integration --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
34
+ - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
35
+ 3. If the output contains `STATUS: NEEDS_CLARIFICATION` + a question list: STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
36
+ 4. On `<promise>COMPLETE</promise>`: write the subagent’s final output to a file, then Bash `harnessed checkpoint complete plan-ai-integration --result-file <path> --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
37
+ 5. If the complete gate blocked: Bash `harnessed checkpoint fail plan-ai-integration --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.
38
+
39
+ <!-- harnessed-generated:v4.12.0 -->
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: plan-ai-integration
3
+ description: 在 plan-phase 前按条件运行 GSD ai-integration-phase AI-SPEC 契约。
4
+ trigger_phrases: ["plan ai integration", "gsd ai integration phase"]
5
+ ---
6
+
7
+ # plan-ai-integration workflow
8
+
9
+ ## Overview
10
+
11
+ 运行 `harnessed prompt plan-ai-integration --task "$ARGUMENTS" --json`,执行 `/gsd-ai-integration-phase`,再用可验证输出完成已登记 checkpoint。
12
+
13
+ ## Invocation
14
+
15
+ 仅当 `phase.builds_ai_system == true` 时触发。
16
+
17
+ ## 如何调用
18
+
19
+ !`harnessed checkpoint intent plan-ai-integration`
20
+
21
+ > 上方 banner(如出现)表示本次调用已在引擎**登记**(intent 标记)——尚未合规:按下方步骤(prompt → spawn → checkpoint complete)完成即解除;在此之前每 turn 会持续注入 `<workflow-intent>` 提醒。
22
+
23
+ 下面这套编号序列**就是** state machine —— 用 Bash 执行。**不要**从上方 Overview 自行演绎等价流程:
24
+ freestyle 会旁路引擎(无 ledger、无 evidence guard)。harnessed 给你 spawn-ready prompt;**你**用
25
+ {{ host.native }} {{ host.spawn_subagent.zh_tool }} spawn subagent(保持 session 响应 + 让澄清 round-trip 能回到用户)。
26
+
27
+ **不要** pipe 到 `harnessed run plan-ai-integration` —— 那是 CI/headless 路径({{ host.harnessed_run_warning_note.execution_tail }}
28
+
29
+ 1. Bash: `harnessed prompt plan-ai-integration --task "$ARGUMENTS" --json` → 解析 `{prompt, max_iterations, model}`。
30
+ 2. 用 {{ host.native }} subagent({{ host.spawn_subagent.zh_tool }})以该 `prompt` + `model` spawn,然后用 harnessed 自己的完成闸门驱动交付:
31
+ - subagent 返回后,把它的最终输出写入文件,跑 `harnessed checkpoint complete plan-ai-integration --result-file <path>` —— 该命令对声明的产物、TDD boundary、逐字 `<promise>COMPLETE</promise>` 三者 fail-closed。
32
+ - 若被拦下,跑 `harnessed checkpoint fail plan-ai-integration --failing-tests <n>` 记录本次尝试;命中停机条件时它会打印 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP。
33
+ - **仅当**这三者都未触发时才允许重 spawn。任一触发即停:重新收敛子任务范围、修掉阻塞点,或上报用户。绝不越过停机指令继续重 spawn。
34
+ 3. 若输出含 `STATUS: NEEDS_CLARIFICATION` + 问题列表:STOP,用 {{ host.ask_user }} 原样转达,把答案 append 进 spec,再重 spawn。
35
+ 4. 命中 `<promise>COMPLETE</promise>`:把 subagent 最终输出写入文件,再 Bash `harnessed checkpoint complete plan-ai-integration --result-file <path> --summary "<one-line>"`。fail-CLOSED —— 除非声明的 `artifacts_expected` 文件全部存在、TDD boundary 通过(证据非空 / 红绿两侧齐全 / 测试文件未被删除)、且结果含逐字 `<promise>COMPLETE</promise>`(或结构化 COMPLETE 状态),否则拦下。`--result <text>` 是内联变体;`--result-file` 优先且在 Windows 上引号安全。`--force` 记录可审计的覆盖(`evidence_status=overridden`),不是静默放行。
36
+ 5. 若 complete 闸门拦下:Bash `harnessed checkpoint fail plan-ai-integration --failing-tests <n>` 记录本次尝试。命中停机条件时会打印 `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP`。**仅当**三者都未触发时才允许重 spawn;任一触发即 STOP —— 重新收敛子任务范围、修掉阻塞点,或上报用户。
37
+
38
+ <!-- harnessed-generated:v4.12.0 -->
@@ -0,0 +1,12 @@
1
+ schema_version: harnessed.workflow.v3
2
+ workflow: plan-ai-integration
3
+ description: GSD ai-integration-phase AI-SPEC contract before ordinary phase planning.
4
+ disciplines_applied: [karpathy, output-style, language, operational, priority, protocols]
5
+ tools_available: [gsd-ai-integration-phase]
6
+ phases:
7
+ - id: 01-ai-integration-phase
8
+ name: gsd-ai-integration-phase
9
+ upstream: gsd
10
+ capability: '{{ capabilities.gsd-ai-integration-phase.cmd }}'
11
+ model: sonnet
12
+ gate: judgments.stage-phase-gate.gsd-ai-integration-phase.fires