intentdna 1.9.0-rc.2 → 1.9.1

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 (130) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +275 -125
  4. package/dist/cli/commands/run-lifecycle.d.ts +61 -11
  5. package/dist/cli/commands/run-lifecycle.js +184 -50
  6. package/dist/cli/commands/run-observer.d.ts +15 -0
  7. package/dist/cli/commands/run-observer.js +210 -0
  8. package/dist/cli/commands/run.d.ts +16 -20
  9. package/dist/cli/commands/run.js +461 -659
  10. package/dist/cli/commands/sync.js +16 -12
  11. package/dist/cli/index.js +14 -5
  12. package/dist/compiler/compile.d.ts +1 -0
  13. package/dist/compiler/compile.js +1 -1
  14. package/dist/compiler/controller.d.ts +16 -0
  15. package/dist/compiler/controller.js +693 -0
  16. package/dist/compiler/input-resolver.d.ts +2 -0
  17. package/dist/compiler/input-resolver.js +22 -6
  18. package/dist/hooks/cli.d.ts +45 -0
  19. package/dist/hooks/cli.js +263 -31
  20. package/dist/hooks/host-event.d.ts +57 -0
  21. package/dist/hooks/host-event.js +187 -0
  22. package/dist/hooks/index.d.ts +1 -0
  23. package/dist/hooks/index.js +1 -0
  24. package/dist/hooks/protocol.d.ts +7 -0
  25. package/dist/hooks/schema.d.ts +1 -0
  26. package/dist/hooks/schema.js +89 -1
  27. package/dist/hooks/state.d.ts +23 -1
  28. package/dist/hooks/state.js +9 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +1 -0
  31. package/dist/mcp/index.js +2 -0
  32. package/dist/mcp/tools-run.d.ts +4 -0
  33. package/dist/mcp/tools-run.js +419 -0
  34. package/dist/mcp/tools-state.d.ts +1 -1
  35. package/dist/mcp/tools-state.js +13 -241
  36. package/dist/runtime/artifact-store.d.ts +146 -0
  37. package/dist/runtime/artifact-store.js +1436 -0
  38. package/dist/runtime/canonical-attempt-outcome.d.ts +12 -0
  39. package/dist/runtime/canonical-attempt-outcome.js +195 -0
  40. package/dist/runtime/canonical-json.d.ts +10 -0
  41. package/dist/runtime/canonical-json.js +105 -0
  42. package/dist/runtime/canonical-run-application.d.ts +93 -0
  43. package/dist/runtime/canonical-run-application.js +229 -0
  44. package/dist/runtime/canonical-run-service.d.ts +454 -0
  45. package/dist/runtime/canonical-run-service.js +4760 -0
  46. package/dist/runtime/canonical-runtime-composition.d.ts +22 -0
  47. package/dist/runtime/canonical-runtime-composition.js +34 -0
  48. package/dist/runtime/canonical-runtime-projection.d.ts +3 -0
  49. package/dist/runtime/canonical-runtime-projection.js +4 -0
  50. package/dist/runtime/canonical-target-compiler.d.ts +46 -0
  51. package/dist/runtime/canonical-target-compiler.js +514 -0
  52. package/dist/runtime/claude-agent-identity.d.ts +2 -0
  53. package/dist/runtime/claude-agent-identity.js +21 -0
  54. package/dist/runtime/executable-run-plan.d.ts +328 -0
  55. package/dist/runtime/executable-run-plan.js +1485 -0
  56. package/dist/runtime/execution-authority.d.ts +83 -0
  57. package/dist/runtime/execution-authority.js +98 -0
  58. package/dist/runtime/handoff-resolver.js +4 -1
  59. package/dist/runtime/harness-pull-adapter.d.ts +146 -0
  60. package/dist/runtime/harness-pull-adapter.js +315 -0
  61. package/dist/runtime/index.d.ts +39 -14
  62. package/dist/runtime/index.js +29 -7
  63. package/dist/runtime/local-execution-authority.d.ts +194 -0
  64. package/dist/runtime/local-execution-authority.js +2877 -0
  65. package/dist/runtime/local-execution-reconciliation.d.ts +20 -0
  66. package/dist/runtime/local-execution-reconciliation.js +107 -0
  67. package/dist/runtime/local-execution-supervisor-script.d.ts +7 -0
  68. package/dist/runtime/local-execution-supervisor-script.js +793 -0
  69. package/dist/runtime/local-provider-sandbox.d.ts +42 -0
  70. package/dist/runtime/local-provider-sandbox.js +154 -0
  71. package/dist/runtime/local-verifier-execution.d.ts +24 -0
  72. package/dist/runtime/local-verifier-execution.js +290 -0
  73. package/dist/runtime/local-windows-execution-supervisor-script.d.ts +6 -0
  74. package/dist/runtime/local-windows-execution-supervisor-script.js +771 -0
  75. package/dist/runtime/plan-store.d.ts +30 -0
  76. package/dist/runtime/plan-store.js +231 -0
  77. package/dist/runtime/process-tree.d.ts +9 -0
  78. package/dist/runtime/process-tree.js +97 -24
  79. package/dist/runtime/push-driver.d.ts +184 -0
  80. package/dist/runtime/push-driver.js +1002 -0
  81. package/dist/runtime/result-store.d.ts +34 -3
  82. package/dist/runtime/result-store.js +1073 -2
  83. package/dist/runtime/run-binding.d.ts +68 -0
  84. package/dist/runtime/run-binding.js +278 -0
  85. package/dist/runtime/run-contracts.d.ts +575 -0
  86. package/dist/runtime/run-contracts.js +58 -7
  87. package/dist/runtime/run-controller.d.ts +1 -6
  88. package/dist/runtime/run-controller.js +0 -41
  89. package/dist/runtime/run-store.d.ts +85 -7
  90. package/dist/runtime/run-store.js +2528 -186
  91. package/dist/runtime/skill-adapter.d.ts +18 -7
  92. package/dist/runtime/skill-adapter.js +100 -742
  93. package/dist/runtime/structured-output-validator.d.ts +44 -0
  94. package/dist/runtime/structured-output-validator.js +171 -0
  95. package/dist/runtime/verifier-command-binding.d.ts +22 -0
  96. package/dist/runtime/verifier-command-binding.js +162 -0
  97. package/dist/runtime/verifier.d.ts +46 -6
  98. package/dist/runtime/verifier.js +355 -53
  99. package/dist/runtime/windows-job-keeper.d.ts +47 -0
  100. package/dist/runtime/windows-job-keeper.js +231 -0
  101. package/dist/runtime/worker-executor.d.ts +17 -1
  102. package/dist/runtime/worker-executor.js +26 -5
  103. package/dist/runtime/workflow-plan-adapter.d.ts +19 -0
  104. package/dist/runtime/workflow-plan-adapter.js +502 -6
  105. package/dist/runtime/workflow-runtime-manifest.d.ts +1 -0
  106. package/dist/runtime/workflow-runtime-manifest.js +5 -0
  107. package/dist/runtime/workspace-isolation.d.ts +29 -2
  108. package/dist/runtime/workspace-isolation.js +488 -11
  109. package/dist/runtime/workspace-observation.d.ts +44 -0
  110. package/dist/runtime/workspace-observation.js +216 -0
  111. package/dist/schema/controller-registry.d.ts +0 -7
  112. package/dist/schema/controller-registry.js +0 -8
  113. package/dist/schema/types.d.ts +84 -10
  114. package/dist/schema/types.js +2 -0
  115. package/dist/schema/validate.js +151 -1
  116. package/dist/schema/validators/controllers.d.ts +1 -1
  117. package/dist/schema/validators/controllers.js +126 -41
  118. package/dist/schema/workflow-authoring-contract.js +2 -0
  119. package/dist/schema/yaml-parser.js +1 -1
  120. package/dist/templates/flutter-rewrite-new.dna.yaml +1 -0
  121. package/dist/templates/flutter-rewrite.dna.yaml +87 -60
  122. package/dist/templates/safe-refactoring.dna.yaml +1 -0
  123. package/native/windows-job-keeper/README.md +80 -0
  124. package/native/windows-job-keeper/bin/aarch64/intentdna-windows-job-keeper.exe +0 -0
  125. package/native/windows-job-keeper/bin/x86_64/intentdna-windows-job-keeper.exe +0 -0
  126. package/native/windows-job-keeper/keeper.c +979 -0
  127. package/native/windows-job-keeper/manifest.json +33 -0
  128. package/package.json +5 -1
  129. package/scripts/build-windows-job-keeper.mjs +172 -0
  130. package/scripts/verify-windows-job-keeper.mjs +184 -0
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "name": "intentdna",
11
11
  "description": "Declarative policy layer for AI agent behavior with plugin-managed hook runtime for Claude Code.",
12
- "version": "1.9.0-rc.2",
12
+ "version": "1.9.1",
13
13
  "author": {
14
14
  "name": "Samuel"
15
15
  },
@@ -25,5 +25,5 @@
25
25
  ]
26
26
  }
27
27
  ],
28
- "version": "1.9.0-rc.2"
28
+ "version": "1.9.1"
29
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.9.0-rc.2",
3
+ "version": "1.9.1",
4
4
  "description": "Declarative policy layer for AI agent behavior",
5
5
  "author": {
6
6
  "name": "Samuel"
package/README.md CHANGED
@@ -1,201 +1,351 @@
1
1
  # IntentDNA
2
2
 
3
- **Governed AI work system for turning repeated AI work methods into reviewed, distributable, locally executable workflow assets.**
3
+ **面向 Codex CLI、Claude Code AI 编程环境的声明式工作流资产、同步与运行工具。**
4
4
 
5
- IntentDNA helps teams describe how useful AI work should happen, convert that method into a governed workflow asset, install it into local AI harnesses, collect evidence, review rollout, and improve the asset without moving runtime authority into a web dashboard.
5
+ [English](#english) | [路线转换文章](https://wanglushan.cn/blog/intentdna-route-reset-from-platform-to-workflow-cli) | [历史 Online 看板](https://online-plum-one.vercel.app)
6
6
 
7
- The product contract is:
7
+ > **项目状态 / Project status:** 本项目后续不再进行独立扩展;新的研发自动化能力将以独立 CLI 等工具的形式在其他仓库开发。 / This project will not be expanded independently; new engineering automation capabilities will be developed in other repositories as standalone CLIs and related tools.
8
+
9
+ IntentDNA 把一套可重复的 AI 工作方法描述为版本化的 `.dna.yaml` 资产,并提供确定性的校验、编译、同步、运行和证据能力。你可以用它定义步骤、角色、权限、交接、检查点、重试和验证规则,再把工作流同步到本地 Harness 中执行。
10
+
11
+ ## 它解决什么问题
12
+
13
+ AI 编程工作流经常散落在 Prompt、对话、个人经验和临时脚本中。IntentDNA 将这些方法变成可以审查和复用的工程资产:
14
+
15
+ - 用 YAML 明确适用场景、输入、输出、角色、步骤和边界;
16
+ - 在执行前确定性校验结构、引用、权限和工作流约束;
17
+ - 同步为 Codex Skills、Claude agents/skills/hooks 等 Harness 资产;
18
+ - 用 Controller 支持持久运行、并行步骤、检查点、审查、重试和恢复;
19
+ - 打包、签名并验证本地运行证据;
20
+ - 从真实 Skills 和源码提炼候选资产,同时保留来源与许可证信息。
21
+
22
+ 核心边界是:
8
23
 
9
24
  ```text
10
- local dna is runtime truth
11
- marketplace distributes workflow assets
12
- online/SaaS manages organization evidence and lifecycle
25
+ .dna.yaml 资产 = 工作流定义
26
+ dna validate / compile / sync = 确定性工具链
27
+ Codex CLI / Claude Code / provider = 实际执行环境
28
+ 本地运行记录与 verifier = 完成证据
29
+ Online = 历史看板与可选投影,不是运行时
13
30
  ```
14
31
 
15
- IntentDNA is not a model company, generic agent framework, prompt library, canvas automation product, or SaaS workflow executor.
32
+ IntentDNA 不重造通用模型循环,不把 Online Supabase 当作本地权限来源,也不接受模型的“已完成”声明替代验证结果。
16
33
 
17
- ## Install or update
34
+ ## 安装
18
35
 
19
36
  ```bash
20
- npm install --global intentdna@1.8.5
37
+ npm install --global intentdna@latest
21
38
  dna --version
22
39
  ```
23
40
 
24
- Version `1.8.5` keeps Claude plugin Hook delivery in `hooks/hooks.json`: plugin sync does not register project `settings.json` Hooks, retracts exact stale bin-mode `dna-hook` entries once, and leaves user settings untouched in steady state. Online generates copyable local commands only; you still run and review them in your own project.
41
+ Claude Code 插件与 npm 包使用相同版本发布:
42
+
43
+ ```bash
44
+ claude plugin marketplace add lushan1314/intentdna-repo
45
+ claude plugin install intentdna@intentdna
46
+ ```
25
47
 
26
- ## Product Shape
48
+ ## 使用现有工作流
27
49
 
28
- IntentDNA has three connected products:
50
+ 先查看内置资产,再在目标项目中初始化和同步:
51
+
52
+ ```bash
53
+ dna templates list
54
+ dna templates show flutter-rewrite
55
+ dna quickstart --asset flutter-rewrite --sync-target codex
56
+
57
+ dna init --template flutter-rewrite
58
+ dna sync --codex --dry-run
59
+ dna sync --codex
60
+ ```
61
+
62
+ `dna quickstart` 只输出指引;`dna sync --dry-run` 预览文件变更;`dna sync` 才会写入 Harness 资产,但不会自动运行工作流。
63
+
64
+ 同步完成后,在对应项目中使用 Codex CLI 或 Claude Code 调用生成的 Skill、agent 或工作流入口。检查同步状态:
65
+
66
+ ```bash
67
+ dna sync status
68
+ dna sync doctor
69
+ ```
70
+
71
+ ## 打造自己的工作流
72
+
73
+ IntentDNA 将“理解人的意图”和“确定性验证”分开:外部 Agent 负责访谈并编写 YAML,`dna` 负责提供完整创作契约并验证结果,人负责确认是否保存和采用。
74
+
75
+ ### 1. 生成创作包
76
+
77
+ ```bash
78
+ dna workflow authoring-packet "描述要沉淀的重复工作方法" \
79
+ --project-dir /path/to/project \
80
+ --json
81
+ ```
29
82
 
30
- | Surface | What it owns | What it must not become |
31
- | --- | --- | --- |
32
- | Local npm foundation | `dna`, `dna-hook`, compiler, adapters, sync, reports, local runtime evidence | A thin demo wrapper or optional afterthought |
33
- | Workflow asset marketplace | Public, personal, `internal_ready`, and later SaaS-backed `org_private` workflow assets | Runtime execution, approval, or policy authority |
34
- | Online/SaaS console | Accounts, organization evidence, receipts, audit, publication lifecycle, readiness projection | A workflow runner or `allow` / `warn` / `block` / `validate` engine |
83
+ 创作包包含字段约束、红线、真实示例、访谈问题、校验循环和交接边界。这个命令不调用模型,也不生成或保存 YAML。
35
84
 
36
- The closed loop is:
85
+ ### 2. Agent 编写候选资产
86
+
87
+ 候选文件放在:
37
88
 
38
89
  ```text
39
- dogfood evidence
40
- -> workflow asset
41
- -> marketplace listing
42
- -> local install/sync
43
- -> harness execution
44
- -> local runtime evidence
45
- -> signed report upload
46
- -> cloud receipt/audit
47
- -> manager review
48
- -> asset improvement
90
+ .dna/authoring/<asset>.candidate.dna.yaml
49
91
  ```
50
92
 
51
- ## Start By Role
93
+ 一个工作流资产通常包括:
52
94
 
53
- ### Developer
95
+ - `id`、`name`、`version`、`purpose`、`maturity`;
96
+ - `fit`、`not_for`、`inputs`、`outputs`;
97
+ - `roles` 及其工具权限和读写范围;
98
+ - `workflow` 或 `workflows` 中的步骤、依赖、交接、检查点和重试;
99
+ - `boundaries`、`evidence` 和 `lineage`。
54
100
 
55
- Use this when you want one governed workflow running locally without waiting for cloud setup:
101
+ ### 3. 校验并修订
56
102
 
57
103
  ```bash
58
- dna quickstart --asset flutter-rewrite --sync-target codex
59
- dna templates list
60
- dna templates show flutter-rewrite
61
- dna init --template flutter-rewrite
62
- dna sync --codex --dry-run
63
- dna sync --codex
64
- # run the synced workflow in Codex CLI or Claude Code
65
- dna report package --json
66
- dna report sign --json
67
- dna report verify <envelope-path> --json
104
+ dna validate .dna/authoring/<asset>.candidate.dna.yaml
68
105
  ```
69
106
 
70
- `dna quickstart` is read-only guidance: it prints the local route without initializing, syncing, running a workflow, packaging reports, signing evidence, uploading evidence, or calling Online/Supabase. Local-only use does not require Supabase. `dna sync` installs, distributes, and injects artifacts only; execution happens in the selected harness. `dna-hook` and local runtime evidence remain runtime truth.
107
+ Agent 只根据校验诊断和已确认的人类意图修改 YAML,直到校验通过。`dna` 不推断目标,也不会自动放宽边界。
108
+
109
+ ### 4. 人工确认并加入项目资产库
71
110
 
72
- ### Team Lead / Manager
111
+ 确认候选内容后,将同一份 YAML 保存为:
73
112
 
74
- Use this when you need to see which workflow assets are active, blocked, stale, or ready to roll out:
113
+ ```text
114
+ .dna/templates/<asset>.dna.yaml
115
+ ```
116
+
117
+ 然后检查资产并预览同步结果:
75
118
 
76
119
  ```bash
77
- dna org intake "<team/project/workflow intent>" --json
78
- dna org review --json
79
- dna org rollout --json
80
- dna org receipt --json
120
+ dna assets show <asset> --project-dir /path/to/project
121
+ dna assets inspect <asset> --project-dir /path/to/project
122
+ dna sync --project-dir /path/to/project --dry-run
123
+ dna sync --project-dir /path/to/project --codex --dry-run
81
124
  ```
82
125
 
83
- Manager review is a read-only decision surface until an explicit local command changes project or organization state. `internal_ready` means adoption candidate, not org-private SaaS visibility. A later `org_private` publication requires auth, RLS, storage, permissions, audit, and live tests.
126
+ 保存、采用和同步是彼此独立的人工决策。校验通过不代表资产已被采用或执行。
84
127
 
85
- ### Template Author
128
+ ## 运行与证据
86
129
 
87
- Use this when a repeated work method should become a reusable workflow asset:
130
+ 工作流可以在同步后的 Harness 中执行,也可以使用 IntentDNA Controller 的运行入口。可用命令以当前 CLI 帮助为准:
88
131
 
89
132
  ```bash
90
- dna workflow authoring-packet "<workflow intent>" --json --project-dir '<local-project-path>'
91
- # an external agent interviews you and writes .dna/authoring/<asset>.candidate.dna.yaml
92
- dna validate '<local-project-path>/.dna/authoring/<asset>.candidate.dna.yaml'
93
- # after explicit human confirmation, save the same YAML under .dna/templates/
94
- dna assets show '<asset>' --project-dir '<local-project-path>'
95
- dna assets inspect '<asset>' --project-dir '<local-project-path>'
96
- dna sync --project-dir '<local-project-path>' --dry-run
97
- dna sync --project-dir '<local-project-path>' --codex --dry-run
133
+ dna run --help
134
+ dna run status <run-id>
135
+ dna run inspect <run-id>
136
+ dna run resume <run-id>
137
+ ```
98
138
 
99
- # after real runs, inspect evidence-backed improvements
100
- dna workflow suggestions '<asset>' --json
101
- dna workflow review-suggestion --from-template '<asset>' --workflow '<workflow-id>' --suggestion '<suggestion-id>' --decision accept --json
102
- dna workflow improve-from-suggestions --from-template '<asset>' --workflow '<workflow-id>' --suggestion '<suggestion-id>' --save-template '<asset-v2>' --json
103
- dna workflow mine '<asset>' --json
139
+ 真实执行后,可打包、签名并验证本地证据:
104
140
 
105
- # legacy/example-assisted entry points remain available
106
- dna workflow intake "<workflow intent>" --json
107
- dna workflow route "<workflow intent>" --json
108
- dna workflow draft "<workflow intent>" --json # optional example-clone scaffold fallback
109
- dna workflow edit-plan "<change>" --from-template <template> --save-template <template-v2>
110
- dna assets governance <asset> --json
141
+ ```bash
142
+ dna report package --json
143
+ dna report sign --package .dna/reports/latest-report-package.json \
144
+ --output .dna/reports/ingest/local-envelope.json \
145
+ --json
146
+ dna report verify .dna/reports/ingest/local-envelope.json --json
111
147
  ```
112
148
 
113
- Authoring starts from a work method, fit, inputs, outputs, roles, boundaries, handoffs, verifiers, and evidence posture. The external agent authors YAML; deterministic `dna validate` checks it; a human decides whether to save it. Captured evidence can produce suggestions, but only a matching human review receipt can open the next reviewable draft route. Adoption, organization binding, rollout, and sync remain separate.
149
+ 云端上传是可选能力,并且必须先通过凭证和部署检查。本地工作流的运行事实不会因为上传而转移到云端。
150
+
151
+ ## 内置工作流类型
152
+
153
+ 仓库包含多种可直接查看和复用的资产,包括:
154
+
155
+ - Flutter 重写、行为锁定、诊断与修复审查;
156
+ - 代码审查、TDD、QA、调试、迁移和发布证据;
157
+ - 并行子 Agent、多角色交接和持久执行;
158
+ - 研究改进、工作流创作和资产提炼;
159
+ - 安全开发、事故响应和组织基线。
160
+
161
+ 使用 `dna templates list` 查看当前安装版本中的完整目录。
162
+
163
+ ## 路线转换与历史
164
+
165
+ IntentDNA 曾优先建设跨 Harness 抽象、组织治理、市场和 Online 控制面。实践表明,这些机制具备工程可行性,但平台优先并不是后续研发自动化最合适的起点。
114
166
 
115
- ### Administrator / Security Buyer
167
+ 完整反思见《[IntentDNA 路线重置:从平台优先到工作流 CLI](https://wanglushan.cn/blog/intentdna-route-reset-from-platform-to-workflow-cli)》。
116
168
 
117
- Use this when you need to verify authority, secrets, audit, and cloud trust boundaries:
169
+ [IntentDNA Online 看板](https://online-plum-one.vercel.app) 作为历史产品证据继续保留,用于展示当时的资产选择、安装指引和证据投影。它不执行工作流。
170
+
171
+ 仓库中的当前文档和历史证据采用两态管理:少量 living docs 描述当前实现,带日期和索引的 `docs/archive/` 保存路线演进;本地会话状态、临时提示词、运行日志和 IDE workspace 不进入版本控制。
172
+
173
+ ## 文档
174
+
175
+ - [快速开始](docs/quickstart.md)
176
+ - [工作流资产格式](docs/architecture/c1-asset-format.md)
177
+ - [工作流创作包契约](docs/architecture/c3-authoring-packet.md)
178
+ - [Controller 与 worker 运行时](docs/architecture/controller-worker-runtime.md)
179
+ - [工作流运行时清单](docs/architecture/workflow-runtime-manifest.md)
180
+ - [本地证据捕获](docs/architecture/c5-evidence-capture.md)
181
+ - [产品重置 ADR](docs/decisions/ADR-001-product-reset.md)
182
+ - [文档与历史档案索引](docs/README.md)
183
+
184
+ ## License
185
+
186
+ Apache-2.0
187
+
188
+ ---
189
+
190
+ <a id="english"></a>
191
+
192
+ ## English
193
+
194
+ **Declarative workflow assets, synchronization, and runtime tooling for AI coding harnesses such as Codex CLI and Claude Code.**
195
+
196
+ [Route reset article (Chinese)](https://wanglushan.cn/blog/intentdna-route-reset-from-platform-to-workflow-cli) | [Historical Online dashboard](https://online-plum-one.vercel.app)
197
+
198
+ IntentDNA describes repeatable AI work methods as versioned `.dna.yaml` assets and provides deterministic validation, compilation, synchronization, runtime, and evidence tooling. A workflow can define steps, roles, permissions, handoffs, checkpoints, retries, and verifiers before being synchronized into a local harness.
199
+
200
+ ### What It Solves
201
+
202
+ AI coding workflows often remain scattered across prompts, conversations, personal experience, and temporary scripts. IntentDNA turns those methods into reviewable engineering assets:
203
+
204
+ - define fit, inputs, outputs, roles, steps, and boundaries in YAML;
205
+ - validate structure, references, permissions, and workflow constraints deterministically;
206
+ - synchronize Codex Skills, Claude agents/skills/hooks, and other harness assets;
207
+ - support durable runs, parallel steps, checkpoints, reviews, retries, and recovery;
208
+ - package, sign, and verify local runtime evidence;
209
+ - refine candidates from real skills and source while retaining provenance and license data.
210
+
211
+ The authority model is:
212
+
213
+ ```text
214
+ .dna.yaml asset = workflow definition
215
+ dna validate / compile / sync = deterministic toolchain
216
+ Codex CLI / Claude Code / provider = execution environment
217
+ local run records and verifiers = completion evidence
218
+ Online = historical dashboard and optional projection, not runtime
219
+ ```
220
+
221
+ IntentDNA does not rebuild the generic model loop, make Online or Supabase the authority for local execution, or accept a model's completion claim as a substitute for verification.
222
+
223
+ ### Install
118
224
 
119
225
  ```bash
120
- dna cloud credential-check --json
121
- dna cloud contract-check --json
122
- dna cloud edge-check --json
123
- dna cloud deploy-plan --json
226
+ npm install --global intentdna@latest
227
+ dna --version
124
228
  ```
125
229
 
126
- Supabase is auth, persistence, storage, transport, and audit. It is not runtime governance authority. Cloud receipts must keep `runtime_authority=false`. Service role keys, secret key JSON, token pepper, Supabase access tokens, user JWTs, raw CLI API tokens, and token hashes must never be browser-facing product inputs or committed examples.
230
+ The Claude Code plugin is released at the same version as the npm package:
127
231
 
128
- ## Quickstart
232
+ ```bash
233
+ claude plugin marketplace add lushan1314/intentdna-repo
234
+ claude plugin install intentdna@intentdna
235
+ ```
129
236
 
130
- The current local quickstart is maintained in [docs/quickstart.md](docs/quickstart.md).
237
+ ### Use An Existing Workflow
131
238
 
132
- Short version:
239
+ Inspect built-in assets, then initialize and synchronize one inside the target project:
133
240
 
134
241
  ```bash
135
- dna quickstart --asset flutter-rewrite --sync-target codex
136
242
  dna templates list
137
243
  dna templates show flutter-rewrite
244
+ dna quickstart --asset flutter-rewrite --sync-target codex
245
+
138
246
  dna init --template flutter-rewrite
139
247
  dna sync --codex --dry-run
140
248
  dna sync --codex
141
- # run in Codex CLI or Claude Code
142
- dna report package --json
143
- dna report sign --json
144
- dna report verify <envelope-path> --json
145
249
  ```
146
250
 
147
- Optional cloud upload is credential-gated and happens only after the signed local envelope verifies:
251
+ `dna quickstart` only prints guidance. `dna sync --dry-run` previews file changes. `dna sync` writes harness assets but does not execute the workflow.
252
+
253
+ Use the generated Skill, agent, or workflow entry point from Codex CLI or Claude Code. Inspect synchronization state with:
254
+
255
+ ```bash
256
+ dna sync status
257
+ dna sync doctor
258
+ ```
259
+
260
+ ### Author A Workflow
261
+
262
+ IntentDNA separates probabilistic intent interpretation from deterministic validation. An external agent interviews the human and authors YAML; `dna` emits the complete authoring contract and validates the result; the human decides whether the candidate is saved and adopted.
263
+
264
+ Generate an authoring packet:
265
+
266
+ ```bash
267
+ dna workflow authoring-packet "describe the repeated work method" \
268
+ --project-dir /path/to/project \
269
+ --json
270
+ ```
271
+
272
+ The packet includes field constraints, red lines, real examples, interview questions, the validation loop, and handoff boundaries. It does not call a model or create YAML.
273
+
274
+ Have the external agent write the candidate to:
275
+
276
+ ```text
277
+ .dna/authoring/<asset>.candidate.dna.yaml
278
+ ```
279
+
280
+ A workflow asset normally describes metadata, fit, inputs and outputs, roles and permissions, steps and dependencies, handoffs, checkpoints, retries, boundaries, evidence, and lineage.
281
+
282
+ Validate and revise it:
283
+
284
+ ```bash
285
+ dna validate .dna/authoring/<asset>.candidate.dna.yaml
286
+ ```
287
+
288
+ After explicit human confirmation, save the same YAML under `.dna/templates/<asset>.dna.yaml`, then inspect it and preview synchronization:
148
289
 
149
290
  ```bash
150
- dna cloud credential-check --json
151
- dna cloud deploy-plan --json
152
- dna report upload <envelope-path> --json
291
+ dna assets show <asset> --project-dir /path/to/project
292
+ dna assets inspect <asset> --project-dir /path/to/project
293
+ dna sync --project-dir /path/to/project --dry-run
294
+ dna sync --project-dir /path/to/project --codex --dry-run
153
295
  ```
154
296
 
155
- ## Core Boundaries
297
+ Saving, adopting, and synchronizing are separate human decisions. Successful validation does not mean the asset has been adopted or executed.
156
298
 
157
- - Local `dna` and `dna-hook` remain runtime truth.
158
- - Online never executes workflows and never performs `allow`, `warn`, `block`, or `validate`.
159
- - `dna sync` installs, distributes, and injects artifacts; it does not execute workflows.
160
- - Marketplace distributes workflow assets and install plans; it does not approve, install, or execute them.
161
- - Supabase persists identity, reports, receipts, storage refs, and audit events; it does not enforce runtime policy.
162
- - Browser-local imports and Online demo states are projection only until trusted upload verifies them.
163
- - MCP is hidden transport, not a product page or auth surface.
164
- - `org_private` must not appear in the static marketplace catalog before SaaS auth/RLS/storage/permission/audit gates exist.
299
+ ### Runtime And Evidence
165
300
 
166
- ## Evidence Model
301
+ Workflows can execute in the synchronized harness or through the IntentDNA Controller. Use the installed CLI help as the command authority:
167
302
 
168
- IntentDNA separates evidence from authority:
303
+ ```bash
304
+ dna run --help
305
+ dna run status <run-id>
306
+ dna run inspect <run-id>
307
+ dna run resume <run-id>
308
+ ```
169
309
 
170
- | Evidence | Meaning |
171
- | --- | --- |
172
- | Local report package | Runtime evidence gathered locally from harness and verifier outputs |
173
- | Signed envelope | Local package hash/signature can be checked before upload |
174
- | Local org review receipt | Manager review and publication readiness handoff; not cloud membership proof |
175
- | Cloud ingest receipt | Trusted upload evidence after Supabase function/storage/audit accepts it |
176
- | Online projection | Human-readable status and lifecycle view; not runtime truth |
310
+ After a real run, package, sign, and verify local evidence:
177
311
 
178
- Trusted cloud ingestion may increase persistence and visibility, but it does not move runtime authority away from local `dna-hook` and local runtime evidence.
312
+ ```bash
313
+ dna report package --json
314
+ dna report sign --package .dna/reports/latest-report-package.json \
315
+ --output .dna/reports/ingest/local-envelope.json \
316
+ --json
317
+ dna report verify .dna/reports/ingest/local-envelope.json --json
318
+ ```
179
319
 
180
- ## Documentation Map
320
+ Cloud upload is optional and credential-gated. Uploading evidence does not move runtime authority away from the local workflow.
181
321
 
182
- - [docs/README.md](docs/README.md) - living docs map and two-state documentation rule.
183
- - [docs/quickstart.md](docs/quickstart.md) - local developer quickstart.
184
- - [docs/foundation-runtime.md](docs/foundation-runtime.md) - durable `dna run` Controller, lifecycle, handoff, isolation, and recovery guide.
185
- - [docs/product/milestone-review-protocol.md](docs/product/milestone-review-protocol.md) - lightweight P-stage review protocol.
186
- - [docs/product/online-product-spec.md](docs/product/online-product-spec.md) - Online IA, K5 boundary, forbidden copy, and acceptance.
187
- - [docs/decisions/ADR-001-product-reset.md](docs/decisions/ADR-001-product-reset.md) - product reset decision record.
188
- - [spec/README.md](spec/README.md) - retained technical spec index.
189
- - [docs/archive/2026H1/INDEX.md](docs/archive/2026H1/INDEX.md) - archived references, insights, historical specs, runbooks, and one-time materials.
322
+ ### Included Workflow Categories
190
323
 
191
- ## Current Maturity
324
+ The repository includes assets for Flutter rewrites and repair reviews, code review, TDD, QA, debugging, migrations, release evidence, parallel subagents, multi-role handoffs, durable execution, research improvement, workflow authoring, asset refinement, secure development, incident response, and organization baselines.
192
325
 
193
- - Local foundation: active.
194
- - Template marketplace: active for public/personal assets; `internal_ready` is a review candidate state.
195
- - Org-private marketplace: SaaS-gated; requires Supabase auth/RLS/storage/permissions/audit and live tests.
196
- - Online console: projection/workbench/readiness surface; not workflow runtime.
197
- - Public release, npm publish, and production SaaS claims require fresh build/test/deploy evidence before being claimed.
326
+ Run `dna templates list` for the complete catalog in the installed version.
198
327
 
199
- ## License
328
+ ### Route Reset And History
329
+
330
+ IntentDNA previously led with cross-harness abstraction, organization governance, a marketplace, and an Online control plane. Those experiments demonstrated engineering feasibility, but platform-first development is not the chosen starting point for the next phase of task-specific automation.
331
+
332
+ The rationale is documented in [IntentDNA Route Reset: From Platform to Workflow CLI](https://wanglushan.cn/blog/intentdna-route-reset-from-platform-to-workflow-cli).
333
+
334
+ The [IntentDNA Online dashboard](https://online-plum-one.vercel.app) remains available as historical product evidence. It demonstrates the earlier asset selection, setup guidance, and evidence projection work; it does not execute workflows.
335
+
336
+ Current documentation and historical evidence follow a two-state model: a small living set describes the implementation, while dated, indexed files under `docs/archive/` preserve route history. Local session state, temporary prompts, runtime logs, and IDE workspace data are excluded from version control.
337
+
338
+ ### Documentation
339
+
340
+ - [Quickstart](docs/quickstart.md)
341
+ - [Workflow asset format](docs/architecture/c1-asset-format.md)
342
+ - [Workflow authoring packet](docs/architecture/c3-authoring-packet.md)
343
+ - [Controller and worker runtime](docs/architecture/controller-worker-runtime.md)
344
+ - [Workflow runtime manifest](docs/architecture/workflow-runtime-manifest.md)
345
+ - [Local evidence capture](docs/architecture/c5-evidence-capture.md)
346
+ - [Product reset ADR](docs/decisions/ADR-001-product-reset.md)
347
+ - [Documentation and archive index](docs/README.md)
348
+
349
+ ### License
200
350
 
201
351
  Apache-2.0
@@ -1,30 +1,42 @@
1
- import type { JsonValue, RunId, TaskState } from "../../runtime/run-contracts.js";
2
- import type { RunController } from "../../runtime/run-controller.js";
3
- import type { DurableRunStore, RunRecord, RunStatus, RunStoreSnapshot } from "../../runtime/run-store.js";
4
- export type RunLifecycleAction = "start" | "status" | "inspect" | "resume" | "cancel";
1
+ import type { CanonicalActivationState, JsonValue, RunId, TaskState } from "../../runtime/run-contracts.js";
2
+ import type { RunAuditView, RunView } from "../../runtime/canonical-run-service.js";
3
+ import { type DurableRunStore, type RunRecord, type RunStatus, type RunStoreSnapshot } from "../../runtime/run-store.js";
4
+ export type RunLifecycleAction = "start" | "status" | "inspect" | "resume" | "cancel" | "close";
5
5
  interface LifecycleOutputOptions {
6
6
  readonly json?: boolean;
7
7
  }
8
- export interface RunLifecycleStartOptions extends LifecycleOutputOptions {
9
- readonly controller: RunController;
10
- readonly run: RunRecord;
11
- }
12
8
  export interface RunLifecycleStatusOptions extends LifecycleOutputOptions {
13
9
  readonly run_store: DurableRunStore;
14
10
  readonly run_id: RunId;
11
+ readonly service?: CanonicalLifecycleService;
12
+ readonly service_factory?: () => Promise<CanonicalLifecycleService>;
15
13
  }
16
14
  export interface RunLifecycleInspectOptions extends LifecycleOutputOptions {
17
15
  readonly run_store: DurableRunStore;
18
16
  readonly run_id: RunId;
17
+ readonly service?: CanonicalLifecycleService;
18
+ readonly service_factory?: () => Promise<CanonicalLifecycleService>;
19
19
  }
20
20
  export interface RunLifecycleResumeOptions extends LifecycleOutputOptions {
21
- readonly controller: RunController;
21
+ readonly run_store: DurableRunStore;
22
22
  readonly run_id: RunId;
23
+ readonly service?: CanonicalLifecycleService;
24
+ readonly service_factory?: () => Promise<CanonicalLifecycleService>;
25
+ readonly drive?: (service: CanonicalLifecycleService, run_id: RunId) => Promise<RunView>;
23
26
  }
24
27
  export interface RunLifecycleCancelOptions extends LifecycleOutputOptions {
25
- readonly controller: RunController;
28
+ readonly run_store: DurableRunStore;
26
29
  readonly run_id: RunId;
27
30
  readonly reason?: string | null;
31
+ readonly service?: CanonicalLifecycleService;
32
+ readonly service_factory?: () => Promise<CanonicalLifecycleService>;
33
+ }
34
+ export type RunLifecycleCloseOptions = RunLifecycleCancelOptions;
35
+ export interface CanonicalLifecycleService {
36
+ inspect(run_id: RunId): Promise<RunView>;
37
+ inspectAudit(run_id: RunId): Promise<RunAuditView>;
38
+ resume(run_id: RunId): Promise<RunView>;
39
+ cancel(run_id: RunId, reason?: string | null): Promise<RunView>;
28
40
  }
29
41
  export interface RunStatusProjection {
30
42
  readonly schema_version: "intentdna.run_status.v1";
@@ -41,6 +53,24 @@ export interface RunStatusProjection {
41
53
  readonly created_at: string;
42
54
  readonly updated_at: string;
43
55
  }
56
+ export interface CanonicalRunStatusProjection {
57
+ readonly schema_version: "intentdna.run_status.v2";
58
+ readonly ledger_schema_version: 2;
59
+ readonly run_id: RunId;
60
+ readonly target: RunView["run"]["target"];
61
+ readonly plan_id: string;
62
+ readonly binding_id: string;
63
+ readonly status: RunStatus;
64
+ readonly record_version: number;
65
+ readonly activation_counts: Readonly<Record<CanonicalActivationState, number>>;
66
+ readonly attempt_count: number;
67
+ readonly result_count: number;
68
+ readonly cancellation: RunView["run"]["cancellation"];
69
+ readonly terminal: RunView["run"]["terminal"];
70
+ readonly created_at: string;
71
+ readonly updated_at: string;
72
+ }
73
+ export type AnyRunStatusProjection = RunStatusProjection | CanonicalRunStatusProjection;
44
74
  export interface DurableHandoffInspection {
45
75
  readonly event_id: string;
46
76
  readonly sequence: number;
@@ -65,9 +95,29 @@ export interface RunInspectionProjection {
65
95
  readonly ledger_created_at: string;
66
96
  readonly ledger_updated_at: string;
67
97
  }
68
- export declare function runLifecycleStart(options: RunLifecycleStartOptions): Promise<number>;
98
+ export interface CanonicalRunInspectionProjection {
99
+ readonly schema_version: "intentdna.run_inspection.v2";
100
+ readonly ledger_schema_version: 2;
101
+ readonly record_version: number;
102
+ readonly run: RunAuditView["run"];
103
+ readonly activations: RunAuditView["activations"];
104
+ readonly attempts: RunAuditView["attempts"];
105
+ readonly claims: RunAuditView["claims"];
106
+ readonly events: RunAuditView["events"];
107
+ readonly result_refs: RunAuditView["results"];
108
+ readonly ledger_created_at: string;
109
+ readonly ledger_updated_at: string;
110
+ }
111
+ interface LifecycleOperationProjection {
112
+ readonly schema_version: "intentdna.run_lifecycle_operation.v1";
113
+ readonly action: Exclude<RunLifecycleAction, "status" | "inspect">;
114
+ readonly status: AnyRunStatusProjection;
115
+ }
116
+ export declare function canonicalViewStatusProjection(view: RunView): CanonicalRunStatusProjection;
117
+ export declare function writeCanonicalOperation(action: LifecycleOperationProjection["action"], view: RunView, json: boolean): void;
69
118
  export declare function runLifecycleStatus(options: RunLifecycleStatusOptions): Promise<number>;
70
119
  export declare function runLifecycleInspect(options: RunLifecycleInspectOptions): Promise<number>;
71
120
  export declare function runLifecycleResume(options: RunLifecycleResumeOptions): Promise<number>;
72
121
  export declare function runLifecycleCancel(options: RunLifecycleCancelOptions): Promise<number>;
122
+ export declare function runLifecycleClose(options: RunLifecycleCloseOptions): Promise<number>;
73
123
  export {};