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/README-en.md CHANGED
@@ -36,6 +36,10 @@ irm https://raw.githubusercontent.com/easyinplay/harnessed/main/install.ps1 | ie
36
36
 
37
37
  The binary installer offers setup with your consent in interactive sessions. Do not repeat it if it completed successfully. If setup was skipped or failed, or you installed noninteractively, run `harnessed setup`.
38
38
 
39
+ `harnessed setup` installs a cache-only **SessionStart update reminder** by default. Its foreground path only reads a bounded local cache: zero network requests, zero filesystem mutation, and fail-soft exit `0`. It only displays a reminder for a cached available update; missing or stale cache may launch a detached background worker to refresh version information, never to install updates. Codex uses a local plugin and may require user trust approval; setup does not grant trust automatically.
40
+
41
+ `harnessed setup --no-update-reminder` persistently disables the reminder; later setup/update runs preserve that choice. To re-enable it, delete the corresponding `update-reminder-preferences.json` and run `harnessed setup` again. Default locations are `~/.claude/harnessed/update-reminder-preferences.json` for Claude Code and `~/.codex/harnessed/update-reminder-preferences.json` for Codex; when using `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `HARNESSED_ROOT_OVERRIDE`, use the corresponding reminder state root instead.
42
+
39
43
  **Via Bun (secondary recommendation; optional)**:
40
44
 
41
45
  ```bash
@@ -307,6 +311,8 @@ graph TD
307
311
  > Master orchestrator auto gate-routes to the right sub (chain-isolation rule — non-firing subs are transparently declared skipped).
308
312
  > Direct sub invocation also bypasses the master to run a single stage, e.g. `/discuss-strategic "new feature X"`.
309
313
 
314
+ **Update workflow:** use `/harnessed-update` in Claude Code or `$harnessed-update` in Codex after setup. It previews with `harnessed update --all --dry-run --json`, asks for explicit confirmation, then runs `harnessed update --all --json` exactly once and reports the structured result. If reviewed third-party components remain `failed`, `unsupported`, or `retained`, it shows a second bounded repair proposal. Only after explicit confirmation for the exact component list may it run `harnessed update --all --repair --yes --json`, which can invoke `claude -p` or `codex exec`. Repair never grants plugin/MCP trust, reads credentials, expands host roots, or declares success without deterministic re-verification.
315
+
310
316
  ---
311
317
 
312
318
  ## ⚡ Usage Flow
@@ -506,7 +512,7 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
506
512
 
507
513
  | Command | Description |
508
514
  | ---- | ---- |
509
- | `harnessed setup` | One-time setup; installs workflow skills to `~/.claude/skills/` + MCP to `~/.claude.json` |
515
+ | `harnessed setup [--no-update-reminder]` | One-time setup; installs workflow skills to `~/.claude/skills/` + MCP to `~/.claude.json`; installs the cache-only SessionStart update reminder by default; `--no-update-reminder` persists an opt-out |
510
516
  | `harnessed gates <master>` | Evaluate which sub-workflows fire for a master stage (JSON: fire/skip/parallelism). Used by slash commands to orchestrate native spawns. |
511
517
  | `harnessed prompt <sub>` | Output a spawn-ready prompt (role + checklist + disciplines + completion/clarification protocols) for a sub-workflow. |
512
518
  | `harnessed checkpoint <action> <sub>` | Record sub-workflow start/complete/fail to `~/.claude/harnessed/checkpoints/`. |
@@ -522,8 +528,8 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
522
528
  | `harnessed resume` | Resume from the most recent checkpoint after a session interruption |
523
529
  | `harnessed status` | Current phase + lock holder |
524
530
  | `harnessed doctor` | Health check (Node / MCP / jq / Win bash / routing / token budget / skill integrity / GateGuard conflict / update-available / stale hooks, etc.). The **stale hooks** check flags orphaned harnessed `Stop`/`UserPromptSubmit` entries in `~/.claude/settings.json` that point at a deleted `bin/*.mjs` — the cause of a `MODULE_NOT_FOUND` error on every prompt after a raw `npm uninstall -g harnessed`. Fix: run `harnessed uninstall` (it strips them) **before** removing the package. |
525
- | `harnessed update [--check\|--rollback [version]\|--upstreams\|--migration-report]` | Self-update, channel-aware: binary installs replace themselves in place from GitHub releases (sha256 + ed25519-signature verified — releases ship `<asset>.sha256.sig`, signed-release contract since 4.32.19; the replaced version is banked for rollback); npm installs run `npm i -g harnessed@latest`. `--check` reports the latest version; `--rollback [version]` (binary installs only) atomically restores a banked previous binary — npm installs are pointed at `npm i -g harnessed@<version>`; `--upstreams` re-runs the base manifests; `--migration-report` is a read-only stale-state inventory |
526
- | `harnessed release-preflight` | Read-only release-readiness gate (CHANGELOG `[Unreleased]` / version / git-clean / tag-absent); exits 1 if not ready. The Ship-stage gate. |
531
+ | `harnessed update [--check\|--dry-run\|--rollback [version]\|--all\|--upstreams\|--migration-report] [--json] [--platform <host>] [--non-interactive] [--repair --yes]` | Self-update, channel-aware: binary installs replace themselves in place from GitHub releases (sha256 + ed25519-signature verified — releases ship `<asset>.sha256.sig`, signed-release contract since 4.32.19; the replaced version is banked for rollback); npm installs run `npm i -g harnessed@latest`. `--check` reports versions without installing; `--dry-run` previews without writing; `--rollback [version]` (binary installs only) atomically restores a banked previous binary — npm installs are pointed at `npm i -g harnessed@<version>`; `--all` (alias `--upstreams`) requests fresh-runtime closure, including owned assets and reviewed third-party updates; `--json` emits one structured result; `--platform <host>` selects `claude` or `codex`; `--non-interactive` skips prompts, and repair automation additionally requires explicit `--repair --yes`; `--repair --yes` invokes a bounded, user-authorized agent repair and then deterministic verification; `--migration-report` is a read-only stale-state inventory |
532
+ | `harnessed release-preflight [--release-version <semver>]` | Read-only release-readiness gate (CHANGELOG `[Unreleased]` / version / git-clean / tag-absent); `--release-version` overrides manifest discovery; exits 1 if not ready. The Ship-stage gate. |
527
533
  | `harnessed retro --done` | Reset the retro-reminder phase counter after running `/retro` (clears the per-turn RETRO-DUE nudge). |
528
534
  | `harnessed install <name>` | Install an upstream manifest |
529
535
  | `harnessed uninstall [name]` | Reverse uninstall — runs the manifest's declared `spec.uninstall` teardown (cmd + `$HOME`-confined, idempotent `cleanup_paths`) for the skill-installing methods (`npm-cli` / `git-clone-with-setup` / `npx-skill-installer`); other methods keep their per-method reverse |
@@ -531,6 +537,21 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
531
537
  | `harnessed rollback <timestamp>` | One-line rollback of a **backup snapshot** (EOL preserve + sha1 verify) — distinct from `update --rollback`, which restores a previous **compiled binary** |
532
538
  | `harnessed gc` | Clean up expired backups |
533
539
  | `harnessed audit-log` | Routing transparency log query (supports `--filter` jq expression) |
540
+ | `harnessed agents-md` | Write or update the marker-delimited harnessed block in `<CODEX_HOME>/AGENTS.md` without changing surrounding prose |
541
+ | `harnessed audit` | Audit manifest and runtime self-consistency (`--skip-runtime` checks the manifest only) |
542
+ | `harnessed check-docs` | Check `.planning/` documentation discipline and return a non-zero exit for advisory or blocking findings |
543
+ | `harnessed eval` | Run the deterministic orchestrator-behavior regression suite; `harnessed eval record` captures a replayable scenario |
544
+ | `harnessed exempt-gateguard` | Persist the `.planning/**` GateGuard exemption that resolves the dual-guard conflict |
545
+ | `harnessed facts <master>` | Emit deterministic and unresolved gate facts for `harnessed gates --context-file` |
546
+ | `harnessed install-base [--dry-run]` | Install the phase 1.3 base profile; `--dry-run` previews without writing |
547
+ | `harnessed manifest-add <upstream>` | Add an upstream adapter through the EE-5 merge gate |
548
+ | `harnessed research --query <text>` | Run the headless research workflow; `--dry-run` previews without spawning |
549
+
550
+ **Fresh-runtime closure (Phase 78):** `harnessed update --all --json` first performs self-update, then hands off to a verified fresh runtime through an absolute executable/package entry path. Only that runtime refreshes harnessed-owned workflow/hook assets and updates already-installed third-party components through reviewed adapters for the selected host. Self-update failure prevents third-party mutation; handoff failure reports incomplete closure even if harnessed itself changed. GSD is the first reviewed adapter, with runtime identity/version verification before and after its upstream-owned update action. Components without a reviewed adapter report `unsupported`; missing third-party components remain `not-installed` and are not installed.
551
+
552
+ `--json` writes exactly one JSON object to stdout (`status`, `components`, `warnings`, `error`, plus schema/operation/mode/host/runtime metadata); diagnostics and child-process output go to stderr. `unsupported` and `retained` produce top-level `partial` and exit `1`, never all-success: `retained` means an update failed but the previous installation still verifies. Completed updates and valid previews (`complete` / `planned`) exit `0`; failed/incomplete execution exits `1`; invalid arguments/protocol exit `2`. Respect each component's `restartRequired` before continuing.
553
+
554
+ Package self-update applies only after proving that the selected npm executable's global `harnessed` package is the running, locked package (including its declared binary entry). The updater probes `npm prefix -g` and `npm root -g --prefix <prefix>`, then pins the same prefix for installation. Unknown/mismatched targets and linked global package slots fail closed with exit `1`, before any installer, fresh-runtime handoff or third-party update. Bun package apply is currently refused as `package-target-unproven`, without npm fallback; version checks, previews and already-current installs remain available.
534
555
 
535
556
  ### Flags
536
557
 
package/README-zh.md CHANGED
@@ -34,6 +34,10 @@ irm https://raw.githubusercontent.com/easyinplay/harnessed/main/install.ps1 | ie
34
34
 
35
35
  二进制安装脚本在交互会话中征得同意后提供 setup。成功完成后无需重复;若跳过、失败或使用非交互安装,请运行 `harnessed setup`。
36
36
 
37
+ `harnessed setup` 默认安装 cache-only **SessionStart 更新提醒**。其 foreground 路径只读取有大小上限的本地 cache:零网络请求、零文件系统 mutation,失败时静默退出 `0`。仅在 cache 表明有可用更新时显示提醒;cache 缺失或过期时可启动 detached background worker 刷新版本信息,不会安装更新。Codex 使用 local plugin,可能需要用户批准 trust;setup 不会自动授予 trust。
38
+
39
+ `harnessed setup --no-update-reminder` 持久禁用提醒,后续 setup/update 会保留该选择。重新启用时,删除对应的 `update-reminder-preferences.json`,再运行 `harnessed setup`。Claude Code 默认路径为 `~/.claude/harnessed/update-reminder-preferences.json`,Codex 默认路径为 `~/.codex/harnessed/update-reminder-preferences.json`;若使用 `CLAUDE_CONFIG_DIR`、`CODEX_HOME` 或 `HARNESSED_ROOT_OVERRIDE`,则使用对应 reminder state root 下的文件。
40
+
37
41
  **通过 Bun 安装 (次要推荐; 可选)**:
38
42
 
39
43
  ```bash
@@ -303,6 +307,8 @@ graph TD
303
307
  > Master orchestrator 自动 gate-route 到合适的 sub (chain-isolation 铁律 —— 不 fire 的 sub 透明声明跳过)。
304
308
  > 直接调用 sub 也可绕过 master 单跑某 stage,例如 `/discuss-strategic "新功能 X"`。
305
309
 
310
+ **更新 workflow:** setup 后,在 Claude Code 中使用 `/harnessed-update`,在 Codex 中使用 `$harnessed-update`。它先运行 `harnessed update --all --dry-run --json` 预览,请求明确确认,再仅执行一次 `harnessed update --all --json` 并展示结构化结果。如果已审查第三方组件仍为 `failed`、`unsupported` 或 `retained`,会展示第二份有边界的 repair proposal。只有用户对精确组件列表再次确认后,才允许执行 `harnessed update --all --repair --yes --json`,该命令可能调用 `claude -p` 或 `codex exec`。repair 不会授予 plugin/MCP trust、读取凭据、扩大 host root,也不会在没有确定性复核时声称成功。
311
+
306
312
  ---
307
313
 
308
314
  ## ⚡ 使用流程
@@ -502,7 +508,7 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
502
508
 
503
509
  | 命令 | 说明 |
504
510
  | ---- | ---- |
505
- | `harnessed setup` | 一次性 setup,装 workflow skills 到 `~/.claude/skills/` + MCP 到 `~/.claude.json` |
511
+ | `harnessed setup [--no-update-reminder]` | 一次性 setup,装 workflow skills 到 `~/.claude/skills/` + MCP 到 `~/.claude.json`;默认安装 cache-only SessionStart 更新提醒;`--no-update-reminder` 持久禁用提醒 |
506
512
  | `harnessed gates <master>` | 评估某 master stage 下哪些 sub-workflow 会 fire (JSON: fire/skip/parallelism)。供 slash command 编排 native spawn |
507
513
  | `harnessed prompt <sub>` | 输出某 sub-workflow 的 spawn-ready prompt (role + checklist + disciplines + completion/clarification 协议) |
508
514
  | `harnessed checkpoint <action> <sub>` | 记录 sub-workflow 的 start/complete/fail 到 `~/.claude/harnessed/checkpoints/` |
@@ -518,8 +524,8 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
518
524
  | `harnessed resume` | session 中断后从最近 checkpoint 恢复 |
519
525
  | `harnessed status` | 当前 phase + lock holder |
520
526
  | `harnessed doctor` | 健康检查 (Node / MCP / jq / Win bash / routing / token budget / skill 完整性 / GateGuard 冲突 / update-available 等) |
521
- | `harnessed update [--check\|--rollback [version]\|--upstreams\|--migration-report]` | 自更新,按安装通道分流:二进制安装从 GitHub releases 原地自替换(sha256 + ed25519 签名双重校验 —— releases 附带 `<asset>.sha256.sig`,4.32.19 起为签名发布契约;被替换的版本存档备回滚);npm 安装执行 `npm i -g harnessed@latest`。`--check` 报告最新版本;`--rollback [version]`(仅二进制安装)原子恢复已存档的上一版二进制 —— npm 安装则被指引执行 `npm i -g harnessed@<version>`;`--upstreams` 重跑基础 manifests;`--migration-report` 为只读陈旧状态盘点 |
522
- | `harnessed release-preflight` | Read-only 发布就绪关卡 (CHANGELOG `[Unreleased]` / version / git-clean / tag-absent);未就绪则 exit 1。即 Ship-stage 关卡 |
527
+ | `harnessed update [--check\|--dry-run\|--rollback [version]\|--all\|--upstreams\|--migration-report] [--json] [--platform <host>] [--non-interactive] [--repair --yes]` | 自更新,按安装通道分流:二进制安装从 GitHub releases 原地自替换(sha256 + ed25519 签名双重校验 —— releases 附带 `<asset>.sha256.sig`,4.32.19 起为签名发布契约;被替换的版本存档备回滚);npm 安装执行 `npm i -g harnessed@latest`。`--check` 报告版本但不安装;`--dry-run` 预览不写盘;`--rollback [version]`(仅二进制安装)原子恢复已存档的上一版二进制 —— npm 安装则被指引执行 `npm i -g harnessed@<version>`;`--all`(别名 `--upstreams`)请求 fresh-runtime closure,包含自有 assets 和 reviewed 第三方更新;`--json` 输出单个结构化结果;`--platform <host>` 选择 `claude` 或 `codex`;`--non-interactive` 跳过 prompt,而 repair 自动化还必须显式使用 `--repair --yes`;`--repair --yes` 启动有边界且经过用户授权的 agent repair,随后执行确定性验证;`--migration-report` 为只读陈旧状态盘点 |
528
+ | `harnessed release-preflight [--release-version <semver>]` | Read-only 发布就绪关卡 (CHANGELOG `[Unreleased]` / version / git-clean / tag-absent);`--release-version` 可覆盖 manifest 自动发现;未就绪则 exit 1。即 Ship-stage 关卡 |
523
529
  | `harnessed retro --done` | 跑完 `/retro` 后重置 retro-reminder phase 计数器 (清掉每轮的 RETRO-DUE 提醒) |
524
530
  | `harnessed install <name>` | 装上游 manifest |
525
531
  | `harnessed uninstall [name]` | 反向卸载 —— 对装 skill 的方法 (`npm-cli` / `git-clone-with-setup` / `npx-skill-installer`) 执行 manifest 声明的 `spec.uninstall` teardown (cmd + 限定 `$HOME` 内、幂等 `cleanup_paths`);其余方法沿用各自的 per-method 反向逻辑 |
@@ -527,6 +533,21 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
527
533
  | `harnessed rollback <timestamp>` | 一行回滚**备份快照** (EOL preserve + sha1 verify) —— 区别于 `update --rollback`:后者恢复的是上一版**编译二进制** |
528
534
  | `harnessed gc` | 清理过期 backup |
529
535
  | `harnessed audit-log` | 路由透明日志 query (支持 `--filter` jq 表达式) |
536
+ | `harnessed agents-md` | 写入或更新 `<CODEX_HOME>/AGENTS.md` 中带 marker 的 harnessed 区块,不改动区块外内容 |
537
+ | `harnessed audit` | 审计 manifest 与 runtime 的自洽性 (`--skip-runtime` 仅检查 manifest) |
538
+ | `harnessed check-docs` | 检查 `.planning/` 文档纪律,发现 advisory 或 blocking 问题时返回非零 exit code |
539
+ | `harnessed eval` | 运行确定性的编排行为回归套件;`harnessed eval record` 可记录可重放场景 |
540
+ | `harnessed exempt-gateguard` | 持久化 `.planning/**` GateGuard 豁免,解决双 guard 冲突 |
541
+ | `harnessed facts <master>` | 输出供 `harnessed gates --context-file` 使用的确定性与待判断 gate facts |
542
+ | `harnessed install-base [--dry-run]` | 安装 phase 1.3 base profile;`--dry-run` 仅预览不写入 |
543
+ | `harnessed manifest-add <upstream>` | 通过 EE-5 merge gate 新增 upstream adapter |
544
+ | `harnessed research --query <text>` | 运行 headless research workflow;`--dry-run` 仅预览不 spawn |
545
+
546
+ **Fresh-runtime closure (Phase 78):** `harnessed update --all --json` 先自更新,再通过可执行文件/package entry 的绝对路径交接到经过验证的 fresh runtime。仅该 runtime 刷新 harnessed-owned workflow/hook assets,并通过 reviewed adapter 更新所选宿主中已安装的第三方组件。自更新失败时不修改第三方组件;handoff 失败时,即使 harnessed 自身已变化也会报告 closure 未完成。GSD 是首个 reviewed adapter,在其 upstream-owned 更新操作前后验证 runtime identity/version。没有 reviewed adapter 的组件报告 `unsupported`;缺失的第三方组件保持 `not-installed`,不会被安装。
547
+
548
+ `--json` 在 stdout 只输出一个 JSON 对象(`status`、`components`、`warnings`、`error`,以及 schema/operation/mode/host/runtime 元数据);诊断和子进程输出写到 stderr。`unsupported` 和 `retained` 产生顶层 `partial` 并退出 `1`,不算全部成功:`retained` 表示更新失败,但旧安装仍通过验证。更新完成或有效预览(`complete` / `planned`)退出 `0`;执行失败或未完成退出 `1`;参数/protocol 无效退出 `2`。继续前需遵守每个组件的 `restartRequired`。
549
+
550
+ Package 自更新仅在证明所选 npm executable 的 global `harnessed` package 与当前运行且已加锁的 package 一致后执行,并验证其声明的 binary entry。更新器探测 `npm prefix -g` 和 `npm root -g --prefix <prefix>`,安装时固定使用同一 prefix。目标无法证明、不匹配或 global package slot 为 symlink/junction 时,以 exit `1` 阻断,不执行 installer、fresh-runtime handoff 或第三方更新。当前 Bun package apply 返回 `package-target-unproven`,不回退 npm;版本检查、预览和已是当前版本的安装不受影响。
530
551
 
531
552
  ### 参数 (Flags)
532
553
 
package/README.md CHANGED
@@ -34,6 +34,10 @@ irm https://raw.githubusercontent.com/easyinplay/harnessed/main/install.ps1 | ie
34
34
 
35
35
  The binary installer offers setup with your consent in interactive sessions. Do not repeat it if it completed successfully. If setup was skipped or failed, or you installed noninteractively, run `harnessed setup`.
36
36
 
37
+ `harnessed setup` installs a cache-only **SessionStart update reminder** by default. Its foreground path only reads a bounded local cache: zero network requests, zero filesystem mutation, and fail-soft exit `0`. It only displays a reminder for a cached available update; missing or stale cache may launch a detached background worker to refresh version information, never to install updates. Codex uses a local plugin and may require user trust approval; setup does not grant trust automatically.
38
+
39
+ `harnessed setup --no-update-reminder` persistently disables the reminder; later setup/update runs preserve that choice. To re-enable it, delete the corresponding `update-reminder-preferences.json` and run `harnessed setup` again. Default locations are `~/.claude/harnessed/update-reminder-preferences.json` for Claude Code and `~/.codex/harnessed/update-reminder-preferences.json` for Codex; when using `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `HARNESSED_ROOT_OVERRIDE`, use the corresponding reminder state root instead.
40
+
37
41
  **Via Bun (secondary recommendation; optional)**:
38
42
 
39
43
  ```bash
@@ -305,6 +309,8 @@ graph TD
305
309
  > Master orchestrator auto gate-routes to the right sub (chain-isolation rule — non-firing subs are transparently declared skipped).
306
310
  > Direct sub invocation also bypasses the master to run a single stage, e.g. `/discuss-strategic "new feature X"`.
307
311
 
312
+ **Update workflow:** use `/harnessed-update` in Claude Code or `$harnessed-update` in Codex after setup. It previews with `harnessed update --all --dry-run --json`, asks for explicit confirmation, then runs `harnessed update --all --json` exactly once and reports the structured result. If reviewed third-party components remain `failed`, `unsupported`, or `retained`, it shows a second bounded repair proposal. Only after explicit confirmation for the exact component list may it run `harnessed update --all --repair --yes --json`, which can invoke `claude -p` or `codex exec`. Repair never grants plugin/MCP trust, reads credentials, expands host roots, or declares success without deterministic re-verification.
313
+
308
314
  ---
309
315
 
310
316
  ## ⚡ Usage Flow
@@ -504,7 +510,7 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
504
510
 
505
511
  | Command | Description |
506
512
  | ---- | ---- |
507
- | `harnessed setup` | One-time setup; installs workflow skills to `~/.claude/skills/` + MCP to `~/.claude.json` |
513
+ | `harnessed setup [--no-update-reminder]` | One-time setup; installs workflow skills to `~/.claude/skills/` + MCP to `~/.claude.json`; installs the cache-only SessionStart update reminder by default; `--no-update-reminder` persists an opt-out |
508
514
  | `harnessed gates <master>` | Evaluate which sub-workflows fire for a master stage (JSON: fire/skip/parallelism). Used by slash commands to orchestrate native spawns. |
509
515
  | `harnessed prompt <sub>` | Output a spawn-ready prompt (role + checklist + disciplines + completion/clarification protocols) for a sub-workflow. |
510
516
  | `harnessed checkpoint <action> <sub>` | Record sub-workflow start/complete/fail to `~/.claude/harnessed/checkpoints/`. |
@@ -520,8 +526,8 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
520
526
  | `harnessed resume` | Resume from the most recent checkpoint after a session interruption |
521
527
  | `harnessed status` | Current phase + lock holder |
522
528
  | `harnessed doctor` | Health check (Node / MCP / jq / Win bash / routing / token budget / skill integrity / GateGuard conflict / update-available / stale hooks, etc.). The **stale hooks** check flags orphaned harnessed `Stop`/`UserPromptSubmit` entries in `~/.claude/settings.json` that point at a deleted `bin/*.mjs` — the cause of a `MODULE_NOT_FOUND` error on every prompt after a raw `npm uninstall -g harnessed`. Fix: run `harnessed uninstall` (it strips them) **before** removing the package. |
523
- | `harnessed update [--check\|--rollback [version]\|--upstreams\|--migration-report]` | Self-update, channel-aware: binary installs replace themselves in place from GitHub releases (sha256 + ed25519-signature verified — releases ship `<asset>.sha256.sig`, signed-release contract since 4.32.19; the replaced version is banked for rollback); npm installs run `npm i -g harnessed@latest`. `--check` reports the latest version; `--rollback [version]` (binary installs only) atomically restores a banked previous binary — npm installs are pointed at `npm i -g harnessed@<version>`; `--upstreams` re-runs the base manifests; `--migration-report` is a read-only stale-state inventory |
524
- | `harnessed release-preflight` | Read-only release-readiness gate (CHANGELOG `[Unreleased]` / version / git-clean / tag-absent); exits 1 if not ready. The Ship-stage gate. |
529
+ | `harnessed update [--check\|--dry-run\|--rollback [version]\|--all\|--upstreams\|--migration-report] [--json] [--platform <host>] [--non-interactive] [--repair --yes]` | Self-update, channel-aware: binary installs replace themselves in place from GitHub releases (sha256 + ed25519-signature verified — releases ship `<asset>.sha256.sig`, signed-release contract since 4.32.19; the replaced version is banked for rollback); npm installs run `npm i -g harnessed@latest`. `--check` reports versions without installing; `--dry-run` previews without writing; `--rollback [version]` (binary installs only) atomically restores a banked previous binary — npm installs are pointed at `npm i -g harnessed@<version>`; `--all` (alias `--upstreams`) requests fresh-runtime closure, including owned assets and reviewed third-party updates; `--json` emits one structured result; `--platform <host>` selects `claude` or `codex`; `--non-interactive` skips prompts, and repair automation additionally requires explicit `--repair --yes`; `--repair --yes` invokes a bounded, user-authorized agent repair and then deterministic verification; `--migration-report` is a read-only stale-state inventory |
530
+ | `harnessed release-preflight [--release-version <semver>]` | Read-only release-readiness gate (CHANGELOG `[Unreleased]` / version / git-clean / tag-absent); `--release-version` overrides manifest discovery; exits 1 if not ready. The Ship-stage gate. |
525
531
  | `harnessed retro --done` | Reset the retro-reminder phase counter after running `/retro` (clears the per-turn RETRO-DUE nudge). |
526
532
  | `harnessed install <name>` | Install an upstream manifest |
527
533
  | `harnessed uninstall [name]` | Reverse uninstall — runs the manifest's declared `spec.uninstall` teardown (cmd + `$HOME`-confined, idempotent `cleanup_paths`) for the skill-installing methods (`npm-cli` / `git-clone-with-setup` / `npx-skill-installer`); other methods keep their per-method reverse |
@@ -529,6 +535,21 @@ planning-with-files /plan (cross-cutting tool) → write artifacts to .planning/
529
535
  | `harnessed rollback <timestamp>` | One-line rollback of a **backup snapshot** (EOL preserve + sha1 verify) — distinct from `update --rollback`, which restores a previous **compiled binary** |
530
536
  | `harnessed gc` | Clean up expired backups |
531
537
  | `harnessed audit-log` | Routing transparency log query (supports `--filter` jq expression) |
538
+ | `harnessed agents-md` | Write or update the marker-delimited harnessed block in `<CODEX_HOME>/AGENTS.md` without changing surrounding prose |
539
+ | `harnessed audit` | Audit manifest and runtime self-consistency (`--skip-runtime` checks the manifest only) |
540
+ | `harnessed check-docs` | Check `.planning/` documentation discipline and return a non-zero exit for advisory or blocking findings |
541
+ | `harnessed eval` | Run the deterministic orchestrator-behavior regression suite; `harnessed eval record` captures a replayable scenario |
542
+ | `harnessed exempt-gateguard` | Persist the `.planning/**` GateGuard exemption that resolves the dual-guard conflict |
543
+ | `harnessed facts <master>` | Emit deterministic and unresolved gate facts for `harnessed gates --context-file` |
544
+ | `harnessed install-base [--dry-run]` | Install the phase 1.3 base profile; `--dry-run` previews without writing |
545
+ | `harnessed manifest-add <upstream>` | Add an upstream adapter through the EE-5 merge gate |
546
+ | `harnessed research --query <text>` | Run the headless research workflow; `--dry-run` previews without spawning |
547
+
548
+ **Fresh-runtime closure (Phase 78):** `harnessed update --all --json` first performs self-update, then hands off to a verified fresh runtime through an absolute executable/package entry path. Only that runtime refreshes harnessed-owned workflow/hook assets and updates already-installed third-party components through reviewed adapters for the selected host. Self-update failure prevents third-party mutation; handoff failure reports incomplete closure even if harnessed itself changed. GSD is the first reviewed adapter, with runtime identity/version verification before and after its upstream-owned update action. Components without a reviewed adapter report `unsupported`; missing third-party components remain `not-installed` and are not installed.
549
+
550
+ `--json` writes exactly one JSON object to stdout (`status`, `components`, `warnings`, `error`, plus schema/operation/mode/host/runtime metadata); diagnostics and child-process output go to stderr. `unsupported` and `retained` produce top-level `partial` and exit `1`, never all-success: `retained` means an update failed but the previous installation still verifies. Completed updates and valid previews (`complete` / `planned`) exit `0`; failed/incomplete execution exits `1`; invalid arguments/protocol exit `2`. Respect each component's `restartRequired` before continuing.
551
+
552
+ Package self-update applies only after proving that the selected npm executable's global `harnessed` package is the running, locked package (including its declared binary entry). The updater probes `npm prefix -g` and `npm root -g --prefix <prefix>`, then pins the same prefix for installation. Unknown/mismatched targets and linked global package slots fail closed with exit `1`, before any installer, fresh-runtime handoff or third-party update. Bun package apply is currently refused as `package-target-unproven`, without npm fallback; version checks, previews and already-current installs remain available.
532
553
 
533
554
  ### Flags
534
555
 
@@ -24,6 +24,7 @@ var en_default = {
24
24
  'setup.step_a_render.complete': ' generated {{count}}/{{total}} command files',
25
25
  'setup.step_a_render.warnings_header':
26
26
  ' [A.5] warnings \u2014 some capability cmds could not be fully resolved:',
27
+ 'setup.command_warning': ' [A.6] {{message}}',
27
28
  'setup.step_c.created': ' [C] created {{path}} + enabled Agent Teams',
28
29
  'setup.step_c.already_enabled': ' [C] Agent Teams already enabled ({{path}})',
29
30
  'setup.step_c.enabled_backup':
@@ -61,8 +61,32 @@ function isHostId(id) {
61
61
  function descriptorFor(id, home = homedir()) {
62
62
  return id === 'codex' ? codexDescriptor(home) : claudeDescriptor(home)
63
63
  }
64
- function descriptorById(id, home) {
65
- return isHostId(id) ? descriptorFor(id, home) : void 0
64
+ function configuredHome(envVar) {
65
+ const value = process.env[envVar]?.trim()
66
+ return value || void 0
67
+ }
68
+ function descriptorForConfiguredHome(id, home = homedir()) {
69
+ const descriptor = descriptorFor(id, home)
70
+ const nativeHome = configuredHome(id === 'codex' ? 'CODEX_HOME' : 'CLAUDE_CONFIG_DIR')
71
+ if (nativeHome === void 0) return descriptor
72
+ if (id === 'codex') {
73
+ return {
74
+ ...descriptor,
75
+ homeDir: nativeHome,
76
+ stateRoot: join(nativeHome, 'harnessed'),
77
+ commandsDir: join(nativeHome, 'prompts'),
78
+ mcpConfigPath: join(nativeHome, 'config.toml'),
79
+ }
80
+ }
81
+ return {
82
+ ...descriptor,
83
+ homeDir: nativeHome,
84
+ stateRoot: join(nativeHome, 'harnessed'),
85
+ settingsPath: join(nativeHome, 'settings.json'),
86
+ skillsDir: join(nativeHome, 'skills'),
87
+ commandsDir: join(nativeHome, 'commands'),
88
+ pluginsRegistry: join(nativeHome, 'plugins', 'installed_plugins.json'),
89
+ }
66
90
  }
67
91
  function detectPlatform(home = homedir()) {
68
92
  const resolved = resolveHost(home)
@@ -74,11 +98,18 @@ function resolveHost(home) {
74
98
  return resolveHostWithReason(home).descriptor
75
99
  }
76
100
  function resolveHostWithReason(home = homedir()) {
77
- const base = claudeDescriptor(home)
101
+ const claudeHome = configuredHome('CLAUDE_CONFIG_DIR')
102
+ const codexHome = configuredHome('CODEX_HOME')
103
+ const envPlatform = process.env.HARNESSED_PLATFORM?.trim()
104
+ const explicitHost = envPlatform !== void 0 && isHostId(envPlatform) ? envPlatform : void 0
105
+ if (explicitHost === void 0 && claudeHome !== void 0 && codexHome !== void 0) {
106
+ throw new Error('both CLAUDE_CONFIG_DIR and CODEX_HOME are set; pass --platform claude|codex')
107
+ }
108
+ const base = descriptorForConfiguredHome('claude', home)
109
+ const codex = descriptorForConfiguredHome('codex', home)
78
110
  const skipped = []
79
- const envPlatform = process.env.HARNESSED_PLATFORM
80
111
  if (envPlatform !== void 0 && envPlatform !== '') {
81
- const d = descriptorById(envPlatform, home)
112
+ const d = isHostId(envPlatform) ? descriptorForConfiguredHome(envPlatform, home) : void 0
82
113
  if (d) {
83
114
  return {
84
115
  descriptor: d,
@@ -88,11 +119,23 @@ function resolveHostWithReason(home = homedir()) {
88
119
  }
89
120
  skipped.push({ kind: 'env-platform-unknown', envVar: 'HARNESSED_PLATFORM', value: envPlatform })
90
121
  }
122
+ if (claudeHome !== void 0 || codexHome !== void 0) {
123
+ const id = claudeHome !== void 0 ? 'claude' : 'codex'
124
+ return {
125
+ descriptor: id === 'claude' ? base : codex,
126
+ reason: {
127
+ kind: 'env-platform',
128
+ envVar: id === 'claude' ? 'CLAUDE_CONFIG_DIR' : 'CODEX_HOME',
129
+ value: id === 'claude' ? claudeHome : codexHome,
130
+ },
131
+ skipped,
132
+ }
133
+ }
91
134
  const inClaude = Boolean(process.env.CLAUDE_CODE_SESSION_ID?.trim())
92
135
  const inCodex = Boolean(process.env.CODEX_SESSION_ID?.trim())
93
136
  if (inClaude !== inCodex) {
94
137
  return {
95
- descriptor: inClaude ? base : codexDescriptor(home),
138
+ descriptor: inClaude ? base : codex,
96
139
  reason: {
97
140
  kind: 'host-session-env',
98
141
  envVar: inClaude ? 'CLAUDE_CODE_SESSION_ID' : 'CODEX_SESSION_ID',
@@ -101,11 +144,11 @@ function resolveHostWithReason(home = homedir()) {
101
144
  }
102
145
  }
103
146
  if (inClaude && inCodex) skipped.push({ kind: 'host-session-env-ambiguous' })
104
- for (const pinRoot of [codexDescriptor(home).stateRoot, base.stateRoot]) {
147
+ for (const pinRoot of [codex.stateRoot, base.stateRoot]) {
105
148
  const pinPath = join(pinRoot, '.platform')
106
149
  try {
107
150
  const value = readFileSync(pinPath, 'utf8').trim()
108
- const d = descriptorById(value, home)
151
+ const d = isHostId(value) ? descriptorForConfiguredHome(value, home) : void 0
109
152
  if (d) return { descriptor: d, reason: { kind: 'platform-pin', pinPath, value }, skipped }
110
153
  skipped.push({ kind: 'platform-pin-unknown', pinPath, value })
111
154
  } catch {}
@@ -118,7 +161,6 @@ function resolveHostWithReason(home = homedir()) {
118
161
  skipped,
119
162
  }
120
163
  }
121
- const codex = codexDescriptor(home)
122
164
  if (existsSync(codex.homeDir)) {
123
165
  return {
124
166
  descriptor: codex,
@@ -415,6 +457,12 @@ function buildWorkflowStateBlock(wf, forward, ledgerAgeMs) {
415
457
  `REOPENED: sub '${next}' was sent back (attempt ${nextEntry.fail_count}${nextEntry.attempt_budget !== void 0 ? `/${nextEntry.attempt_budget}` : ''}) \u2014 ${nextEntry.reason}. Address THAT before re-running it; a repeat of the same attempt burns the budget.`,
416
458
  )
417
459
  }
460
+ for (const e of ledger) {
461
+ if (!e.spawn_failure || isSettled(e)) continue
462
+ lines.push(
463
+ `SPAWN-FAILED: sub '${e.sub}' failed to spawn (${e.spawn_failure}) \u2014 attempt ${e.fail_count ?? 0}; fix the cause before respawning it`,
464
+ )
465
+ }
418
466
  if (!next && forward && (forward.unit.kind === 'phase' || forward.unit.kind === 'task')) {
419
467
  const n = forward.remainingPhases
420
468
  lines.push(
@@ -66,8 +66,32 @@ function isHostId(id) {
66
66
  function descriptorFor(id, home = homedir()) {
67
67
  return id === 'codex' ? codexDescriptor(home) : claudeDescriptor(home)
68
68
  }
69
- function descriptorById(id, home) {
70
- return isHostId(id) ? descriptorFor(id, home) : void 0
69
+ function configuredHome(envVar) {
70
+ const value = process.env[envVar]?.trim()
71
+ return value || void 0
72
+ }
73
+ function descriptorForConfiguredHome(id, home = homedir()) {
74
+ const descriptor = descriptorFor(id, home)
75
+ const nativeHome = configuredHome(id === 'codex' ? 'CODEX_HOME' : 'CLAUDE_CONFIG_DIR')
76
+ if (nativeHome === void 0) return descriptor
77
+ if (id === 'codex') {
78
+ return {
79
+ ...descriptor,
80
+ homeDir: nativeHome,
81
+ stateRoot: join(nativeHome, 'harnessed'),
82
+ commandsDir: join(nativeHome, 'prompts'),
83
+ mcpConfigPath: join(nativeHome, 'config.toml'),
84
+ }
85
+ }
86
+ return {
87
+ ...descriptor,
88
+ homeDir: nativeHome,
89
+ stateRoot: join(nativeHome, 'harnessed'),
90
+ settingsPath: join(nativeHome, 'settings.json'),
91
+ skillsDir: join(nativeHome, 'skills'),
92
+ commandsDir: join(nativeHome, 'commands'),
93
+ pluginsRegistry: join(nativeHome, 'plugins', 'installed_plugins.json'),
94
+ }
71
95
  }
72
96
  function detectPlatform(home = homedir()) {
73
97
  const resolved = resolveHost(home)
@@ -79,11 +103,18 @@ function resolveHost(home) {
79
103
  return resolveHostWithReason(home).descriptor
80
104
  }
81
105
  function resolveHostWithReason(home = homedir()) {
82
- const base = claudeDescriptor(home)
106
+ const claudeHome = configuredHome('CLAUDE_CONFIG_DIR')
107
+ const codexHome = configuredHome('CODEX_HOME')
108
+ const envPlatform = process.env.HARNESSED_PLATFORM?.trim()
109
+ const explicitHost = envPlatform !== void 0 && isHostId(envPlatform) ? envPlatform : void 0
110
+ if (explicitHost === void 0 && claudeHome !== void 0 && codexHome !== void 0) {
111
+ throw new Error('both CLAUDE_CONFIG_DIR and CODEX_HOME are set; pass --platform claude|codex')
112
+ }
113
+ const base = descriptorForConfiguredHome('claude', home)
114
+ const codex = descriptorForConfiguredHome('codex', home)
83
115
  const skipped = []
84
- const envPlatform = process.env.HARNESSED_PLATFORM
85
116
  if (envPlatform !== void 0 && envPlatform !== '') {
86
- const d = descriptorById(envPlatform, home)
117
+ const d = isHostId(envPlatform) ? descriptorForConfiguredHome(envPlatform, home) : void 0
87
118
  if (d) {
88
119
  return {
89
120
  descriptor: d,
@@ -93,11 +124,23 @@ function resolveHostWithReason(home = homedir()) {
93
124
  }
94
125
  skipped.push({ kind: 'env-platform-unknown', envVar: 'HARNESSED_PLATFORM', value: envPlatform })
95
126
  }
127
+ if (claudeHome !== void 0 || codexHome !== void 0) {
128
+ const id = claudeHome !== void 0 ? 'claude' : 'codex'
129
+ return {
130
+ descriptor: id === 'claude' ? base : codex,
131
+ reason: {
132
+ kind: 'env-platform',
133
+ envVar: id === 'claude' ? 'CLAUDE_CONFIG_DIR' : 'CODEX_HOME',
134
+ value: id === 'claude' ? claudeHome : codexHome,
135
+ },
136
+ skipped,
137
+ }
138
+ }
96
139
  const inClaude = Boolean(process.env.CLAUDE_CODE_SESSION_ID?.trim())
97
140
  const inCodex = Boolean(process.env.CODEX_SESSION_ID?.trim())
98
141
  if (inClaude !== inCodex) {
99
142
  return {
100
- descriptor: inClaude ? base : codexDescriptor(home),
143
+ descriptor: inClaude ? base : codex,
101
144
  reason: {
102
145
  kind: 'host-session-env',
103
146
  envVar: inClaude ? 'CLAUDE_CODE_SESSION_ID' : 'CODEX_SESSION_ID',
@@ -106,11 +149,11 @@ function resolveHostWithReason(home = homedir()) {
106
149
  }
107
150
  }
108
151
  if (inClaude && inCodex) skipped.push({ kind: 'host-session-env-ambiguous' })
109
- for (const pinRoot of [codexDescriptor(home).stateRoot, base.stateRoot]) {
152
+ for (const pinRoot of [codex.stateRoot, base.stateRoot]) {
110
153
  const pinPath = join(pinRoot, '.platform')
111
154
  try {
112
155
  const value = readFileSync(pinPath, 'utf8').trim()
113
- const d = descriptorById(value, home)
156
+ const d = isHostId(value) ? descriptorForConfiguredHome(value, home) : void 0
114
157
  if (d) return { descriptor: d, reason: { kind: 'platform-pin', pinPath, value }, skipped }
115
158
  skipped.push({ kind: 'platform-pin-unknown', pinPath, value })
116
159
  } catch {}
@@ -123,7 +166,6 @@ function resolveHostWithReason(home = homedir()) {
123
166
  skipped,
124
167
  }
125
168
  }
126
- const codex = codexDescriptor(home)
127
169
  if (existsSync(codex.homeDir)) {
128
170
  return {
129
171
  descriptor: codex,