harnessed 1.0.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 (51) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +20 -0
  3. package/README.md +178 -0
  4. package/config-templates/README.md +21 -0
  5. package/config-templates/hooks/.gitkeep +0 -0
  6. package/dist/cli.d.ts +1 -0
  7. package/dist/cli.mjs +4653 -0
  8. package/dist/cli.mjs.map +1 -0
  9. package/dist/index.d.ts +3 -0
  10. package/dist/index.mjs +10 -0
  11. package/dist/index.mjs.map +1 -0
  12. package/dist/schemas/index.d.ts +47 -0
  13. package/dist/schemas/index.mjs +384 -0
  14. package/dist/schemas/index.mjs.map +1 -0
  15. package/manifests/README.md +23 -0
  16. package/manifests/SCHEMA.md +180 -0
  17. package/manifests/aliases.yaml +14 -0
  18. package/manifests/cc-hooks/dashboard-autospawn.yaml +45 -0
  19. package/manifests/skill-packs/.gitkeep +0 -0
  20. package/manifests/skill-packs/anthropics-skills-pptx.yaml +46 -0
  21. package/manifests/skill-packs/anthropics-skills-slide-deck.yaml +46 -0
  22. package/manifests/skill-packs/frontend-design.yaml +63 -0
  23. package/manifests/skill-packs/gsd.yaml +43 -0
  24. package/manifests/skill-packs/gstack.yaml +40 -0
  25. package/manifests/skill-packs/karpathy-skills.yaml +64 -0
  26. package/manifests/skill-packs/mattpocock-skills.yaml +40 -0
  27. package/manifests/skill-packs/planning-with-files.yaml +45 -0
  28. package/manifests/skill-packs/ui-ux-pro-max.yaml +61 -0
  29. package/manifests/tools/.gitkeep +0 -0
  30. package/manifests/tools/chrome-devtools-mcp.yaml +44 -0
  31. package/manifests/tools/ctx7.yaml +39 -0
  32. package/manifests/tools/exa-mcp.yaml +39 -0
  33. package/manifests/tools/playwright-test.yaml +47 -0
  34. package/manifests/tools/ralph-loop.yaml +46 -0
  35. package/manifests/tools/superpowers.yaml +42 -0
  36. package/manifests/tools/tavily-mcp.yaml +39 -0
  37. package/package.json +96 -0
  38. package/routing/.gitkeep +0 -0
  39. package/routing/README.md +22 -0
  40. package/routing/SCHEMA.md +199 -0
  41. package/routing/decision_rules.yaml +387 -0
  42. package/routing/plan-review-schema.yaml +50 -0
  43. package/schemas/.gitkeep +0 -0
  44. package/schemas/README.md +33 -0
  45. package/schemas/manifest.v1.schema.json +1107 -0
  46. package/workflows/.gitkeep +0 -0
  47. package/workflows/README.md +23 -0
  48. package/workflows/SCHEMA.md +157 -0
  49. package/workflows/execute-task/SKILL.md +70 -0
  50. package/workflows/execute-task/phases.yaml +27 -0
  51. package/workflows/plan-feature/workflow.yaml +40 -0
File without changes
@@ -0,0 +1,23 @@
1
+ # workflows/ — Composition Skill 层(核心 IP)
2
+
3
+ `workflows/` 是 harnessed **80% 价值所在**。每个目录是一个 composition skill — 不写代码,只写"指挥棒"prompt 描述步骤,按 phases schema 编排上游。
4
+
5
+ ## v0.1 MVP Workflows
6
+
7
+ - `research/` — 多源调研路由(Tavily / Exa / ctx7) — v0.1.0
8
+ - `execute-task/` — 子任务执行(superpowers + karpathy + mattpocock + ralph-loop) — v0.2.0
9
+ - `plan-feature/` — 三层栈编排(gstack + GSD + planning-with-files) — v0.3.0(**phases schema reference implementation**)
10
+
11
+ ## Phases Schema
12
+
13
+ 每个 workflow `SKILL.md` 的 frontmatter 必须符合 `workflows/SCHEMA.md` 定义的 phases schema(layer / upstream / invokes / inputs / outputs / pause / on_veto / conditional)。
14
+
15
+ 详细字段定义见:
16
+
17
+ - `PROJECT-SPEC.md` v2.1 § 10(schema 标准定义)
18
+ - `WORKFLOWS-MVP.md` v2.1(每个 workflow 的具体 phases)
19
+ - `workflows/SCHEMA.md`(实现视图)
20
+
21
+ ## 路由感知
22
+
23
+ 每个 workflow 通过 `routing/*.md` SSOT 感知上下文(B+C 混合)。详见 `routing/README.md`。
@@ -0,0 +1,157 @@
1
+ # workflows/ — Phases Schema (v0.1 placeholder spec)
2
+
3
+ > **决策来源**:[`PROJECT-SPEC.md` § 10](../PROJECT-SPEC.md) + [`WORKFLOWS-MVP.md` Workflow 3](../WORKFLOWS-MVP.md)
4
+ > **机器消费 artifact**:**未实现**(v0.1 phase 1.1 仅文档化字段;JSON Schema artifact 由 v0.3 phase 1.4+ 落地,此时 workflows/*.yaml 才进 CI 校验循环)
5
+ > **本文件定位**:phases schema 的标准定义 + plan-feature reference 摘录。校验器实现先于 workflow yaml 落地(v0.3 ship `/harnessed:plan-feature` 时启用)。
6
+
7
+ ---
8
+
9
+ ## 1. workflow yaml 顶层结构
10
+
11
+ 每个 workflow 是一份 `workflows/<name>/SKILL.md`,frontmatter 形如:
12
+
13
+ ```yaml
14
+ ---
15
+ name: <kebab-case> # 必填,与目录名一致
16
+ namespace: /harnessed:<name> # 必填,命令命名空间
17
+ phases: # 必填,至少 1 个 phase
18
+ - id: 01-<name>
19
+ layer: <governance|orchestration|execution>
20
+ upstream: <manifest-name>
21
+ invokes: [<command>, ...]
22
+ inputs: [...]
23
+ outputs: ...
24
+ pause: <human_review|optional_human_review>?
25
+ on_veto: <halt_workflow|rollback_to_phase_N>?
26
+ conditional: {...}?
27
+ ---
28
+
29
+ # Markdown body — 人类可读 workflow 描述
30
+ ```
31
+
32
+ `additionalProperties: false`(v0.3 落地)— 未声明字段被 reject。
33
+
34
+ ---
35
+
36
+ ## 2. phases[*] 字段表
37
+
38
+ | 字段 | 必填 | 类型 | 说明 |
39
+ |------|------|------|------|
40
+ | `id` | ✅ | string | `^[0-9]{2}-[a-z][a-z0-9-]*$`(如 `01-gstack-decision`) |
41
+ | `layer` | ✅ | enum | `governance` / `orchestration` / `execution`(三层栈) |
42
+ | `upstream` | ✅ | string\|string[] | 依赖的上游 manifest 名(必须在 `manifests/` 中存在) |
43
+ | `invokes` | ✅ | string[] | 调用的具体命令 / skill(变量插值如 `{{gstack.command_prefix}}/office-hours`) |
44
+ | `inputs` | ✅ | string[] | 引用前阶段产出(`$NN.outputs` 语法) |
45
+ | `outputs` | ✅ | string\|string[] | 产出文件路径 |
46
+ | `pause` | optional | enum | `human_review` 阻塞等用户 approve;`optional_human_review` 默认放行可手动暂停 |
47
+ | `on_veto` | optional | enum | 用户拒绝时行为:`halt_workflow` / `rollback_to_phase_N` |
48
+ | `conditional` | optional | object | 条件触发(如 `{ if: ui_task_detected, then_also_invoke: [ui-ux-pro-max] }`),来自 `routing/*.md` |
49
+ | `on_demand_invoke` | optional | bool | 仅按需触发(默认 false) |
50
+ | `branch_on` | optional | string | 分支条件名 |
51
+ | `branches` | optional | object[] | 分支定义(v0.3+ 详化) |
52
+
53
+ **约束**:
54
+ - `phases` 至少 1 个 phase(minItems: 1)
55
+ - `id` 全局唯一(同一 workflow 内)
56
+ - `upstream` 引用必须解析到一个真实 manifest(CI 在 phases-resolver 阶段校验)
57
+
58
+ ---
59
+
60
+ ## 3. 三层栈语义(layer enum)
61
+
62
+ | layer | 角色 | 典型上游 | 干什么 |
63
+ |---|---|---|---|
64
+ | `governance` | 决策层 | gstack | CEO / Eng Manager / Designer / Paranoid Staff Engineer 等关卡审查 |
65
+ | `orchestration` | 项目经理 | GSD | discuss-phase / plan-phase / execute-phase / verify-phase 整体流程管理 |
66
+ | `execution` | 资深工程师 | superpowers / planning-with-files / mattpocock-skills / karpathy-skills | brainstorming / TDD / 持久化 / 子任务级动手 |
67
+
68
+ 详细职责映射见用户全局 `CLAUDE.md` § "角色与框架定位"。
69
+
70
+ ---
71
+
72
+ ## 4. plan-feature reference implementation
73
+
74
+ 完整 5-phase 示例(摘录自 `WORKFLOWS-MVP.md` Workflow 3 + `PROJECT-SPEC.md` § 10)。所有其他 workflow 套此范式。
75
+
76
+ ```yaml
77
+ # workflows/plan-feature/SKILL.md
78
+ ---
79
+ name: plan-feature
80
+ namespace: /harnessed:plan-feature
81
+ phases:
82
+ - id: 01-gstack-decision
83
+ layer: governance
84
+ upstream: gstack
85
+ invokes: [/office-hours, /plan-ceo-review, /plan-eng-review]
86
+ inputs: [user_request]
87
+ outputs: .harnessed/checkpoints/01-decision.md
88
+ pause: human_review
89
+ on_veto: halt_workflow
90
+
91
+ - id: 02-brainstorm
92
+ layer: execution
93
+ upstream: superpowers
94
+ invokes: [brainstorming]
95
+ inputs: [user_request, $01.outputs]
96
+ outputs: .harnessed/checkpoints/02-design-memo.md
97
+ conditional:
98
+ if: ui_task_detected # 来自 routing/ui.md
99
+ then_also_invoke: [ui-ux-pro-max]
100
+
101
+ - id: 03-gsd-discuss
102
+ layer: orchestration
103
+ upstream: GSD
104
+ invokes: [/gsd-discuss-phase]
105
+ inputs: [$01.outputs, $02.outputs]
106
+ outputs: gsd_phase_doc
107
+
108
+ - id: 04-gsd-plan
109
+ layer: orchestration
110
+ upstream: GSD
111
+ invokes: [/gsd-plan-phase]
112
+ inputs: [$03.outputs]
113
+ outputs: [PLAN.md, ROADMAP.md, REQUIREMENTS.md]
114
+
115
+ - id: 05-persist
116
+ layer: execution
117
+ upstream: planning-with-files
118
+ inputs: [$04.outputs]
119
+ outputs: [task_plan.md, progress.md, findings.md]
120
+ pause: human_review
121
+ ---
122
+ ```
123
+
124
+ **关键设计点**(决策已敲定,见 WORKFLOWS-MVP § Workflow 3):
125
+
126
+ - gstack 命令前缀通过变量插值 `{{gstack.command_prefix}}/office-hours`,**禁止硬编码** — `harnessed doctor` 探测 plugin 化路径与 git-clone-with-setup 路径,写 `.harnessed/config.json` 供 workflow 引擎读取
127
+ - `01` 阶段 veto → `halt_workflow`,不自动回滚;用户决定是否重新构思
128
+ - `02` 阶段 UI 任务识别完全走 `routing/ui.md` 的 `trigger.keywords` + `file_globs` 规则(B+C 混合)
129
+ - `pause: human_review` 强制 checkpoint compact —— 写 `.harnessed/checkpoints/<id>.md`(≤ 1k token),原文留 `.harnessed/archive/<id>-full.md` 不进后续 context(PROJECT-SPEC § 12)
130
+
131
+ ---
132
+
133
+ ## 5. 收益(schema-driven 设计动机)
134
+
135
+ 每 phase idempotent + 可单步重跑 + session 中断从最近 checkpoint 恢复 + `harnessed status` 可视化当前 phase。
136
+ schema 校验保证 `upstream` 引用在 manifests/ 真实存在(防"引用一个根本没装的上游"),保证 `inputs/$NN.outputs` 引用解析合法。
137
+
138
+ ---
139
+
140
+ ## 6. 当前 status(v0.1 phase 1.1)
141
+
142
+ - ✅ 字段定义已锁定(本文件 + SPEC § 10)
143
+ - ❌ JSON Schema artifact `schemas/workflow.v1.schema.json` **未生成** — 由 v0.3 phase 1.4+ 配 plan-feature 落地时一并实装
144
+ - ❌ workflow yaml fixtures **未起草** — v0.1 phase 1.4 起草 `research`,v0.2 phase 起草 `execute-task`,v0.3 phase 起草 `plan-feature`
145
+ - ❌ workflow validator **未实装** — TypeBox + Ajv 同样模式(参考 `src/manifest/schema/`),落入 `src/workflow/schema.ts` + `src/workflow/validate.ts`
146
+
147
+ 任何字段语义冲突以本文件 + SPEC § 10 为准;机器层级冲突时(v0.3+)以 `schemas/workflow.v1.schema.json` 为准。
148
+
149
+ ---
150
+
151
+ ## 7. 关联
152
+
153
+ - **决策**:`PROJECT-SPEC.md` § 10(字段定义)+ `WORKFLOWS-MVP.md` Workflow 1-3(reference 实例)
154
+ - **三层栈职责**:用户全局 `CLAUDE.md` § "角色与框架定位"
155
+ - **路由 yaml frontmatter SSOT**:`routing/SCHEMA.md`(B+C 共享同一 frontmatter 块)
156
+ - **manifest 上游引用目标**:`manifests/SCHEMA.md`
157
+ - **ROADMAP 落地节奏**:v0.1 = `research` workflow / v0.2 = `execute-task` / v0.3 = `plan-feature`(reference)
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: execute-task
3
+ description: |
4
+ execute-task workflow — 4-phase chain (brainstorming → karpathy → mattpocock → TDD → ralph-loop)
5
+ triggered by harnessed CLI `harnessed execute-task --task <text>`.
6
+ trigger_phrases:
7
+ # forward-looking documentation — auto-invocation 实装推 Phase 2.3 extension category (B-28).
8
+ # Current enforced entry surface is the CLI subcommand below; these phrases are
9
+ # documentation-only hints for the eventual GSD orchestration agent.
10
+ - "execute this task"
11
+ - "implement this feature"
12
+ - "execute-task workflow"
13
+ - "跑 execute-task"
14
+ ---
15
+
16
+ # execute-task workflow
17
+
18
+ ## Overview
19
+
20
+ 4-phase chain mapping the user's CLAUDE.md Execute-phase discipline onto the harnessed
21
+ runtime (ADR 0011 — SDK + ralph-loop integration):
22
+
23
+ | phase | id | upstream | model (intel CD-2 § 第 4 条) | rationale |
24
+ | ----- | -- | -------- | ---------------------------- | --------- |
25
+ | 1 | `01-clarify` | `superpowers brainstorming` | opus | 任务复杂度澄清 |
26
+ | 2 | `02-code` | `karpathy` 心法 always-on | sonnet | small surgical changes |
27
+ | 3 | `03-test` | `superpowers TDD` + mattpocock 招式 | sonnet | conditional TDD red-green-refactor |
28
+ | 4 | `04-deliver` | `ralph-loop` | haiku | 迭代验收循环省 token (关键点) |
29
+
30
+ Per-phase models load from `workflows/execute-task/phases.yaml`; engine.runRouting
31
+ spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+
32
+ (`AgentDefinition` 5-字段 unpack — ADR 0011 § 4).
33
+
34
+ ## CLI invocation (the only enforced entry — B-28)
35
+
36
+ ```bash
37
+ # Dry-run preview — arbitrate-only, never spawns SDK.
38
+ harnessed execute-task --task "<text>" --dry-run --non-interactive
39
+
40
+ # Apply path — real SDK spawn + ralph-loop COMPLETE round-trip.
41
+ harnessed execute-task --task "<text>" --apply
42
+
43
+ # `--model-tier inherit` escape hatch (B-10) — override per-phase models with
44
+ # SDK 'inherit' (parent-thread model resolution).
45
+ harnessed execute-task --task "<text>" --apply --model-tier inherit
46
+ ```
47
+
48
+ H1 gate: `--non-interactive` requires `--apply` or `--dry-run` (exit 2 otherwise);
49
+ sibling install-base.ts L51-56 + research.ts L37-43 pattern.
50
+
51
+ EngineResult three-state → exit code mapping:
52
+ - `0` — ok (ralph-loop returned verbatim `<promise>COMPLETE</promise>` round-trip)
53
+ - `1` — ok:false {phase: arbitrate|install|spawn|verbatim} (typed error)
54
+ - `2` — aborted {reason} (max-iter exceeded OR usage/config error)
55
+
56
+ ## Forward-looking note
57
+
58
+ The `trigger_phrases:` frontmatter is currently **documentation purpose only** —
59
+ auto-invocation by the GSD orchestration agent (skill auto-discovery) is deferred
60
+ to Phase 2.3 extension category. In Phase 2.2 the only enforced entry surface is
61
+ the CLI subcommand above (B-28 single-entry contract).
62
+
63
+ ## References
64
+
65
+ - ADR 0011 — execute-task SDK + ralph-loop integration (phase 2.2 W6 — finalize)
66
+ - `.planning/intel/omc-comparison.md` § CD-2 — per-phase model tier defaults
67
+ - `src/cli/execute-task.ts` — CLI implementation (T5.1)
68
+ - `workflows/execute-task/phases.yaml` — 4-phase config (T3.3)
69
+ - `src/routing/lib/sdkSpawn.ts` — SDK query() consumer (T4.1)
70
+ - `src/routing/lib/ralphLoop.ts` — verbatim COMPLETE round-trip
@@ -0,0 +1,27 @@
1
+ # execute-task workflow — per-phase model tier (ADR 0011 errata / intel CD-2 § 第 4 条).
2
+ # Default table sourced from `.planning/intel/omc-comparison.md` § CD-2 (phase 2.2 W3 — T3.3).
3
+ # Override via CLI: `--model-tier inherit` (B-10 escape hatch).
4
+ workflow: execute-task
5
+ phases:
6
+ - id: 01-clarify
7
+ name: brainstorming
8
+ upstream: superpowers brainstorming
9
+ model: opus # intel 第 4 条: opus / sonnet — 任务复杂度澄清
10
+ skills: ['brainstorming']
11
+ max_iterations: 5
12
+ - id: 02-code
13
+ name: code (karpathy 心法 always-on)
14
+ upstream: karpathy
15
+ model: sonnet
16
+ max_iterations: 20
17
+ - id: 03-test
18
+ name: test (conditional TDD + mattpocock 招式)
19
+ upstream: superpowers TDD
20
+ model: sonnet # intel 第 4 条: sonnet / haiku — TDD red-green-refactor
21
+ skills: ['test-driven-development']
22
+ max_iterations: 15
23
+ - id: 04-deliver
24
+ name: deliver (ralph-loop COMPLETE)
25
+ upstream: ralph-loop
26
+ model: haiku # intel 第 4 条: 04-deliver=haiku (省 token — 迭代验收循环关键点)
27
+ max_iterations: 20
@@ -0,0 +1,40 @@
1
+ # workflows/plan-feature/workflow.yaml — Phase 3.2 W2 T2.4 (D-03 WIRED LOCKED)
2
+ # 5-phase reference implementation; Phase 3.3+ dogfood 时换真 gsd-discuss/plan/execute spawn.
3
+ # R7.1 acceptance: 30 plan-feature 场景跑通 + CEO veto halt_workflow
4
+ # R7.4 acceptance: 用户三种前缀场景任一都跑通 (JINJA `{{ gstack_prefix }}` 插值)
5
+ workflow: plan-feature
6
+ on_veto: halt_workflow # workflow-level (NOT per-phase per RESEARCH § 5.2 DRY) — D-04 PUSH 任 1 phase 转换前 read = vetoed → 全 halt
7
+ phases:
8
+ - id: 01-gstack-decision
9
+ name: gstack-decision (governance gate — CEO/EM/Designer/Paranoid/QA/CSO)
10
+ upstream: gstack
11
+ model: opus # 高层决策 = opus
12
+ invokes: '{{ gstack_prefix }}office-hours' # D-02 JINJA 插值 (gstack-office-hours OR office-hours)
13
+ skills: ['plan-feature-decision']
14
+ max_iterations: 1
15
+ - id: 02-brainstorm
16
+ name: brainstorm (execution + ui-ux-pro-max UI 任务)
17
+ upstream: superpowers
18
+ model: sonnet # 设计澄清 = sonnet
19
+ skills: ['plan-feature-brainstorm']
20
+ max_iterations: 5
21
+ - id: 03-gsd-discuss
22
+ name: gsd-discuss (orchestration — phase discussion)
23
+ upstream: gsd
24
+ model: sonnet
25
+ invokes: 'gsd-discuss-phase' # GSD 命令固定无 prefix
26
+ skills: ['plan-feature-discuss']
27
+ max_iterations: 3
28
+ - id: 04-gsd-plan
29
+ name: gsd-plan (orchestration — phase planning)
30
+ upstream: gsd
31
+ model: sonnet
32
+ invokes: 'gsd-plan-phase'
33
+ skills: ['plan-feature-plan']
34
+ max_iterations: 3
35
+ - id: 05-persist
36
+ name: persist (planning-with-files MD persistence)
37
+ upstream: planning-with-files
38
+ model: haiku # 文档写入 = haiku 省 token (sister Phase 2.2 CD-2 04-deliver=haiku)
39
+ skills: ['plan-feature-persist']
40
+ max_iterations: 5