dic-workflow-kit 1.1.3 → 1.1.4

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 (65) hide show
  1. package/.codex-plugin/plugin.json +14 -10
  2. package/CHANGELOG.md +56 -1
  3. package/INSTRUCTION.md +108 -29
  4. package/README.md +234 -134
  5. package/README.zh-CN.md +280 -194
  6. package/adapters/bitfun/README.md +2 -2
  7. package/agents/adversarial-challenger.md +23 -0
  8. package/agents/code-repairer.md +1 -1
  9. package/agents/contract-oracle.md +1 -1
  10. package/agents/evidence-auditor.md +23 -0
  11. package/agents/final-reviewer.md +13 -2
  12. package/agents/flow-auditor.md +1 -1
  13. package/agents/impact-analyst.md +21 -0
  14. package/agents/impl-inspector.md +1 -1
  15. package/agents/profile-builder.md +7 -3
  16. package/agents/repair-planner.md +1 -1
  17. package/agents/semantic-conflict-auditor.md +21 -0
  18. package/agents/spec-reader.md +1 -1
  19. package/agents/validation-runner.md +1 -1
  20. package/dist/dic-workflow-kit.mjs +17 -13
  21. package/package.json +5 -2
  22. package/schemas/final-result.schema.json +16 -1
  23. package/schemas/harness-plan.schema.json +143 -0
  24. package/schemas/harness-run.schema.json +75 -0
  25. package/schemas/ontology-action.schema.json +9 -1
  26. package/schemas/ontology-snapshot.schema.json +75 -1
  27. package/schemas/project-profile.schema.json +42 -0
  28. package/skills/knowledge-bdd/SKILL.md +1 -1
  29. package/skills/knowledge-change-impact/SKILL.md +43 -0
  30. package/skills/knowledge-change-impact/agents/openai.yaml +4 -0
  31. package/skills/knowledge-openspec/SKILL.md +1 -1
  32. package/skills/knowledge-repair-distill/SKILL.md +1 -1
  33. package/skills/quality-adversarial-challenge/SKILL.md +42 -0
  34. package/skills/quality-adversarial-challenge/agents/openai.yaml +4 -0
  35. package/skills/quality-ci-gate/SKILL.md +45 -0
  36. package/skills/quality-ci-gate/agents/openai.yaml +4 -0
  37. package/skills/quality-ci-gate/references/ci-gate.md +22 -0
  38. package/skills/quality-code-review/SKILL.md +32 -0
  39. package/skills/quality-code-review/agents/openai.yaml +4 -0
  40. package/skills/quality-code-review/references/code-review.md +13 -0
  41. package/skills/quality-cross-spec-consistency/SKILL.md +45 -0
  42. package/skills/quality-cross-spec-consistency/agents/openai.yaml +4 -0
  43. package/skills/quality-dt-review/SKILL.md +32 -0
  44. package/skills/quality-dt-review/agents/openai.yaml +4 -0
  45. package/skills/quality-dt-review/references/dt-review.md +14 -0
  46. package/skills/quality-evidence-audit/SKILL.md +41 -0
  47. package/skills/quality-evidence-audit/agents/openai.yaml +4 -0
  48. package/skills/quality-repository-gate/SKILL.md +38 -0
  49. package/skills/quality-repository-gate/agents/openai.yaml +4 -0
  50. package/skills/quality-repository-gate/references/repository-gate.md +13 -0
  51. package/skills/quality-review-orchestrator/SKILL.md +100 -0
  52. package/skills/quality-review-orchestrator/agents/openai.yaml +4 -0
  53. package/skills/quality-review-orchestrator/references/quality-model.md +73 -0
  54. package/skills/quality-spec-review/SKILL.md +40 -0
  55. package/skills/quality-spec-review/agents/openai.yaml +4 -0
  56. package/skills/quality-spec-review/references/spec-review.md +14 -0
  57. package/skills/quality-sr-ar-review/SKILL.md +32 -0
  58. package/skills/quality-sr-ar-review/agents/openai.yaml +4 -0
  59. package/skills/quality-sr-ar-review/references/sr-ar-review.md +14 -0
  60. package/skills/workflow-core/SKILL.md +49 -2
  61. package/skills/workflow-harness/SKILL.md +73 -0
  62. package/skills/workflow-harness/agents/openai.yaml +4 -0
  63. package/skills/workflow-intake/SKILL.md +8 -2
  64. package/skills/workflow-profile/SKILL.md +16 -1
  65. package/skills/workflow-repair/SKILL.md +7 -4
package/README.md CHANGED
@@ -1,43 +1,132 @@
1
- # Design-Implementation Consistency Workflow Kit
1
+ # QIHENG — Design Integrity Control Plane
2
2
 
3
- Version: `1.1.3`
3
+ Version: `1.1.4`
4
4
 
5
- [Changelog](CHANGELOG.md)
5
+ [中文](README.zh-CN.md) · [Operating contract](INSTRUCTION.md) · [Ontology](docs/ONTOLOGY.md) · [FAQ](docs/FAQ.md) · [Changelog](CHANGELOG.md)
6
6
 
7
- Design-Implementation Consistency Workflow Kit, or DIC Workflow Kit, is a portable agentic workflow package for checking and repairing whether implementation matches design intent.
7
+ **Every design promise, proven in code.**
8
8
 
9
- It is designed for teams that use OpenSpec, design documents, API contracts, schemas, or product requirements before asking Coding Agents to implement code. The kit turns that process into an auditable workflow: read source truth, map design to implementation, inspect gaps, plan small repairs, validate evidence, and produce final consistency reports.
9
+ QIHENG (契衡) is a portable design integrity control plane for proving that code still matches
10
+ authoritative design intent. It supports Codex, Claude Code, OpenCode, MiMo Code,
11
+ and BitFun, with OpenSpec, design documents, API contracts, schemas, product
12
+ requirements, or Gherkin features as design sources.
10
13
 
11
- The kit is not tied to one contest, one repository, one language stack, or one agent host. It can be installed into OpenCode, referenced by Claude Code, used from Codex, or adapted by another coding-agent runner.
14
+ ## What makes it different
12
15
 
13
- > The differentiator is not the number of agents. DIC Workflow Kit uses design intent, typed handoffs, project profiles, validation evidence, and residual-risk reporting to prove that implementation remains aligned with its design contract.
16
+ - **An executable Harness, not a checklist.** A cryptographic Candidate
17
+ Passport, typed gate graph, dependency closure, explicit applicability, and
18
+ content-addressed evidence compute delivery readiness.
19
+ - **A shared ontology, not isolated Agent summaries.** Requirements, scenarios,
20
+ implementation units, gaps, repairs, validations, and evidence form one
21
+ traceable semantic graph.
22
+ - **Governed mutations.** Role-bounded Actions and action-specific patches are
23
+ recorded in an append-only, SHA-256-linked Ledger before reconciliation.
24
+ - **Evidence that fails closed.** Source, implementation, and evidence artifacts
25
+ are content-addressed; changed or missing bytes block PASS.
26
+ - **Validation causality.** A green result binds the exact DesignSource and
27
+ ImplementationUnit hashes it consumed, so an old log cannot approve new code.
28
+ - **Portable final proof.** Reports and Attestations bind the terminal decision
29
+ to the snapshot revision, Ledger, artifacts, invariants, and residual risks.
30
+ - **Executive visibility without evidence loss.** The Assurance Cockpit shows
31
+ one decision, coverage, Digital Thread, risk blockers, and drill-down IDs
32
+ derived directly from machine state.
33
+
34
+ The differentiator is therefore not the number of Agents. It is the governed,
35
+ inspectable evidence chain between design, implementation, validation, and the
36
+ final decision.
37
+
38
+ QIHENG groups roles by evidence responsibility, not by headcount:
39
+
40
+ - **Lens** establishes authority, obligations, semantic conflicts, and impact.
41
+ - **Forge** inspects, repairs, and validates source-backed gaps.
42
+ - **Tribunal** challenges high-risk claims, audits proof freshness, and makes
43
+ candidate-bound consistency and admission decisions.
44
+
45
+ The orchestrator assembles the smallest applicable panel for the current risk.
46
+ Adding more Agents without a distinct hypothesis, artifact, consumer, and
47
+ decision right does not add assurance.
48
+
49
+ ## Three-minute quick start
50
+
51
+ Requires Node.js 20 or later.
52
+
53
+ ```text
54
+ npx dic-workflow-kit@1.1.4 install
55
+ ```
56
+
57
+ The published package names remain `dic-workflow-kit` and
58
+ `@tonyclaw/dic-workflow-kit` for compatibility. A global install exposes the
59
+ preferred `qiheng` command as well as the legacy `dic-workflow-kit` command.
60
+
61
+ Restart the Coding Agent in the target repository, then ask:
62
+
63
+ ```text
64
+ Use QIHENG with quality-review-orchestrator to audit this delivery.
65
+ Treat the imported Spec/change as the entry. Check the Spec and applicable
66
+ design gates before implementation, inspect and repair design-implementation
67
+ inconsistency after implementation, re-run gates invalidated by each repair,
68
+ then apply the frozen-candidate pre-commit gate. Report consistency, quality,
69
+ admission, and residual risk separately.
70
+ Do not modify code unless I explicitly approve it.
71
+ ```
72
+
73
+ Start with `reports/final-consistency-report.md`, `reports/FINAL_RESULT.json`,
74
+ and `reports/ontology-report.md`. A valid terminal result is `PASS`, `PARTIAL`,
75
+ `BLOCKED`, or `FAIL`; green tests alone do not imply PASS.
76
+
77
+ After the project profile exists, operate the executable Harness:
78
+
79
+ ```text
80
+ qiheng harness-init --root .
81
+ qiheng harness-check --root . --json
82
+ qiheng harness-report --root .
83
+ ```
84
+
85
+ The generated `reports/harness-report.md` is the executive-facing Assurance
86
+ Cockpit: one decision, a cryptographic candidate passport, assurance coverage,
87
+ a visual design-to-delivery Digital Thread, gate decisions, and exact blockers.
88
+
89
+ ## Documentation
90
+
91
+ | Document | Purpose |
92
+ | --- | --- |
93
+ | [Operating contract](INSTRUCTION.md) | Full workflow, evidence, handoff, and terminal-state rules |
94
+ | [Ontology model](docs/ONTOLOGY.md) | Objects, links, Actions, Ledger, gates, and Attestations |
95
+ | [Delivery Assurance Harness](docs/HARNESS.md) | Candidate passport, executable gate graph, Digital Thread, evidence recording, and executive cockpit |
96
+ | [FAQ](docs/FAQ.md) | Multi-Agent communication, mounted knowledge, BDD, and defense questions |
97
+ | [Code-evidence guide](docs/答辩引导-项目特点与代码证据.md) | Project claims mapped to implementation evidence |
98
+ | [Release guide](docs/RELEASING.md) | Maintainer-only dual npm release procedure |
99
+ | [Changelog](CHANGELOG.md) | Version history |
14
100
 
15
101
  ## Install with npm
16
102
 
17
- The npm package contains all seven Skills and all nine Subagents and installs them with host-native directory layouts for Codex, Claude Code, OpenCode, MiMo Code, and BitFun.
103
+ Both `dic-workflow-kit` and `@tonyclaw/dic-workflow-kit` publish the same version
104
+ and runtime payload. The package contains all 19 Skills and all thirteen
105
+ Subagents and installs them with host-native directory layouts for Codex,
106
+ Claude Code, OpenCode, MiMo Code, and BitFun.
18
107
 
19
108
  Codex remains the default, so the original command is backward compatible:
20
109
 
21
110
  ```text
22
- npx dic-workflow-kit@1.1.3 install
111
+ npx dic-workflow-kit@1.1.4 install
23
112
  ```
24
113
 
25
114
  Select another host explicitly:
26
115
 
27
116
  ```text
28
- npx dic-workflow-kit@1.1.3 install --host claude-code
29
- npx dic-workflow-kit@1.1.3 install --host opencode
30
- npx dic-workflow-kit@1.1.3 install --host mimo-code
31
- npx dic-workflow-kit@1.1.3 install --host bitfun
117
+ npx dic-workflow-kit@1.1.4 install --host claude-code
118
+ npx dic-workflow-kit@1.1.4 install --host opencode
119
+ npx dic-workflow-kit@1.1.4 install --host mimo-code
120
+ npx dic-workflow-kit@1.1.4 install --host bitfun
32
121
  ```
33
122
 
34
123
  User scope is the default. To install into the current repository instead, use `--scope project`:
35
124
 
36
125
  ```text
37
- npx dic-workflow-kit@1.1.3 install --host claude-code --scope project
38
- npx dic-workflow-kit@1.1.3 install --host opencode --scope project
39
- npx dic-workflow-kit@1.1.3 install --host mimo-code --scope project
40
- npx dic-workflow-kit@1.1.3 install --host bitfun --scope project
126
+ npx dic-workflow-kit@1.1.4 install --host claude-code --scope project
127
+ npx dic-workflow-kit@1.1.4 install --host opencode --scope project
128
+ npx dic-workflow-kit@1.1.4 install --host mimo-code --scope project
129
+ npx dic-workflow-kit@1.1.4 install --host bitfun --scope project
41
130
  ```
42
131
 
43
132
  The host mappings are:
@@ -57,15 +146,15 @@ For BitFun, the installer emits its native custom-agent schema. Inspection and p
57
146
  You can also install the CLI globally:
58
147
 
59
148
  ```text
60
- npm install --global @tonyclaw/dic-workflow-kit@1.1.3
61
- dic-workflow-kit install --host opencode
149
+ npm install --global @tonyclaw/dic-workflow-kit@1.1.4
150
+ qiheng install --host opencode
62
151
  ```
63
152
 
64
153
  The same CLI can also be installed directly from the repository:
65
154
 
66
155
  ```text
67
156
  npm install --global git+ssh://git@gitcode.com/TonyClaw/DICWorkflowKit.git
68
- dic-workflow-kit install
157
+ qiheng install
69
158
  ```
70
159
 
71
160
  Use `--dry-run` to preview the resolved destination, `--install-root <path>` for an isolated host root, or the backward-compatible Codex-only `--marketplace-root <path>`. The Codex installer preserves unrelated marketplace entries and replaces only the entry with the same plugin name. Restart or reload the target coding-agent session after its first Skills/agents directory is created.
@@ -75,14 +164,14 @@ Use `--dry-run` to preview the resolved destination, `--install-root <path>` for
75
164
  Every successful installation writes `.dic-workflow-kit-install.json` with the package version, resolved host roots, managed files, and SHA-256 hashes. Use `doctor` to verify that no managed file is missing or modified:
76
165
 
77
166
  ```text
78
- dic-workflow-kit doctor --host bitfun --scope project
79
- dic-workflow-kit doctor --host opencode
167
+ qiheng doctor --host bitfun --scope project
168
+ qiheng doctor --host opencode
80
169
  ```
81
170
 
82
171
  Remove only files managed by this installation:
83
172
 
84
173
  ```text
85
- dic-workflow-kit uninstall --host bitfun --scope project
174
+ qiheng uninstall --host bitfun --scope project
86
175
  ```
87
176
 
88
177
  Install refuses to overwrite an unmanaged or locally modified file. Uninstall likewise refuses to remove a modified managed file. Review the reported paths first; use `--force` only when those changes may be discarded. Use `--json` with `install`, `doctor`, or `uninstall` for machine-readable CI output.
@@ -102,17 +191,18 @@ cd /path/to/your-project
102
191
  This prompt works across all five hosts:
103
192
 
104
193
  ```text
105
- Use DIC Workflow Kit to check design-implementation consistency in this project.
106
- First identify authoritative design sources and protected paths, then build the
107
- project profile. Map source-backed obligations to implementation, inspect gaps,
108
- plan repairs only where design evidence exists, run project-declared validation,
109
- and report the final consistency status and residual risks.
194
+ Use QIHENG with quality-review-orchestrator to review this project.
195
+ Treat the imported Spec/change as the entry. Select risk-applicable gates,
196
+ check design before implementation, repair source-backed consistency gaps after
197
+ implementation, invalidate and re-run affected gates, then decide pre-commit
198
+ admission for the frozen candidate. Report consistency, quality, admission, and
199
+ residual risk separately.
110
200
  ```
111
201
 
112
202
  For an audit that must not modify code:
113
203
 
114
204
  ```text
115
- Use DIC Workflow Kit to audit this project without modifying files.
205
+ Use QIHENG to audit this project without modifying files.
116
206
  Report design obligations, implementation gaps, evidence locations,
117
207
  recommended repairs, and residual risks.
118
208
  ```
@@ -120,7 +210,7 @@ recommended repairs, and residual risks.
120
210
  For an evidence-bounded repair:
121
211
 
122
212
  ```text
123
- Use DIC Workflow Kit to inspect and repair this project.
213
+ Use QIHENG to inspect and repair this project.
124
214
  Repair only gaps traceable to authoritative design sources. Run relevant
125
215
  validation after each change; stop expanding changes when validation fails
126
216
  and record the blocker.
@@ -131,7 +221,7 @@ and record the blocker.
131
221
  Provide the Change ID explicitly to reduce search scope and avoid treating historical changes as current truth:
132
222
 
133
223
  ```text
134
- Use DIC Workflow Kit to check the OpenSpec Change
224
+ Use QIHENG to check the OpenSpec Change
135
225
  2026-06-09-add-ts-local-skill-source.
136
226
  Start from its proposal, design, tasks, and delta specs. Cross-check the current
137
227
  stable specs, implementation, and tests. Produce an obligation matrix,
@@ -155,7 +245,7 @@ Use workflow-core, workflow-intake, workflow-profile, and
155
245
  knowledge-openspec to inspect the current OpenSpec change.
156
246
  ```
157
247
 
158
- You do not need to start all nine Subagents manually. The primary Agent should select roles according to evidence dependencies and require every delegation to produce an artifact consumed by a downstream step.
248
+ You do not need to start all thirteen Subagents manually. The primary Agent should select roles according to evidence dependencies and require every delegation to produce an artifact consumed by a downstream step.
159
249
 
160
250
  ### 5. Read the results
161
251
 
@@ -167,11 +257,15 @@ Start with these outputs:
167
257
  | `reports/contract-obligations.md` | Human-readable design obligations with source anchors |
168
258
  | `reports/implementation-gaps.md` | Confirmed implementation gaps |
169
259
  | `reports/repair-plan.md` | Source-backed repair plan with stop conditions |
260
+ | `reports/quality/` | Applicability plan, gate run history, invalidation reasons, and candidate-bound decisions |
170
261
  | `reports/final-consistency-report.md` | Final consistency conclusion and residual risks |
171
262
  | `reports/FINAL_RESULT.json` | Machine-readable terminal status |
172
263
  | `logs/trace/` | Intake, delegation, change, and validation evidence |
173
264
 
174
- Terminal status is always `PASS`, `PARTIAL`, `BLOCKED`, or `FAIL`. `PASS` means the evidence chain and validation gates are satisfied, not merely that visible tests happen to pass.
265
+ DIC terminal status is `PASS`, `PARTIAL`, `BLOCKED`, or `FAIL`. Read it
266
+ separately from specialist quality and repository admission. A DIC `PASS`
267
+ means the consistency evidence chain is satisfied, not merely that visible
268
+ tests happen to pass and not that the candidate is automatically admitted.
175
269
 
176
270
  ### Troubleshooting
177
271
 
@@ -184,25 +278,7 @@ Terminal status is always `PASS`, `PARTIAL`, `BLOCKED`, or `FAIL`. `PASS` means
184
278
  - **A validation tool is unavailable:** record the missing command and environment evidence, and finish as `BLOCKED` or `PARTIAL`; do not claim success.
185
279
  - **Do green tests prove consistency:** no. Requirements, branches, state transitions, side effects, and integration flows must also match the design.
186
280
 
187
- ### Dual npm release
188
-
189
- Every release publishes the same version and payload under both npm names:
190
-
191
- - `@tonyclaw/dic-workflow-kit`
192
- - `dic-workflow-kit`
193
-
194
- `package.json` is the canonical version source. Set a new version once; the helper propagates it to the Codex plugin manifest, workflow runtime, all Skills, all Subagents, and both READMEs:
195
-
196
- ```text
197
- npm run release:set-version -- 1.1.3
198
- npm run release:plan
199
- npm run release:dual:dry-run
200
- npm run release:dual
201
- ```
202
-
203
- npm cannot provide an atomic transaction across two package names. The coordinator therefore uses a convergent release: it completes all local checks first, publishes both packages from temporary staging directories, skips a package when the exact version already exists, and can be safely rerun to publish only the missing side after a partial failure.
204
-
205
- For a defense-oriented walkthrough of the project claims and their code evidence, see [答辩引导:项目特点与代码证据](docs/答辩引导-项目特点与代码证据.md).
281
+ Maintainers: see [the dual npm release guide](docs/RELEASING.md).
206
282
 
207
283
  ## Why This Exists
208
284
 
@@ -210,7 +286,7 @@ Coding Agents are good at changing code, but they often optimize for local green
210
286
 
211
287
  > Does the implementation still match the design contract?
212
288
 
213
- DIC Workflow Kit answers that question with a repeatable workflow:
289
+ QIHENG answers that question with a repeatable workflow:
214
290
 
215
291
  1. Identify authoritative design sources.
216
292
  2. Build a project profile.
@@ -228,85 +304,102 @@ DIC Workflow Kit answers that question with a repeatable workflow:
228
304
  | `skills/` | Installable Skills: workflow controls and reusable knowledge packs. |
229
305
  | `agents/` | Installable Agent prompts: bounded roles for evidence production and repair flow. |
230
306
  | `adapters/` | Optional adapters for OpenSpec, generic repos, contests, and stack-specific environments. |
231
- | `schemas/` | Stable JSON schemas for project profile, handoff, and final evidence artifacts. |
307
+ | `runtime/` | Source implementation of ontology evaluation, Actions, Ledger, integrity checks, reports, and Attestations. |
308
+ | `schemas/` | Stable JSON schemas for profiles, ontology state, Actions, handoffs, Attestations, and final results. |
232
309
  | `scripts/` | Portable Python standard-library helpers. |
310
+ | `docs/` | Ontology reference, FAQ, release guide, presentations, and code-evidence walkthroughs. |
233
311
  | `examples/` | Small examples showing how to apply the kit to different project styles. |
234
312
 
235
- ## Skills in Workflow Order
313
+ ## Skills by First Activation
236
314
 
237
- Skills are listed by the point at which they first participate in the default workflow. Knowledge Skills are conditional: load them only when repository evidence or the current stage requires them.
315
+ This table is an index, not a mandatory serial pipeline. Skills are listed by
316
+ their earliest normal activation point. Knowledge and specialist quality Skills
317
+ are conditional, may run more than once, and become stale when their consumed
318
+ artifacts or candidate bytes change.
238
319
 
239
320
  | Order | Skill | Type | Workflow Position | Core Role |
240
321
  | --- | --- | --- | --- | --- |
241
- | 00 | `workflow-core` | Workflow mechanism | Entire run | Defines source priority, evidence rules, typed handoffs, final statuses, and durable output contracts. |
242
- | 01 | `workflow-intake` | Workflow method | Before Subagents | Finds design sources, implementation roots, test roots, protected paths, validation commands, and adapter hints. |
243
- | 02 | `workflow-profile` | Workflow method | Before Subagents | Normalizes intake evidence into the project profile consumed by every downstream role. |
244
- | 03 | `knowledge-openspec` | Knowledge pack | During source reading, if OpenSpec is detected | Interprets proposals, designs, specs, scenarios, tasks, active changes, and archived capabilities. |
245
- | 04 | `knowledge-bdd` | Knowledge pack | When `.feature` files or behavioral coverage are in scope | Interprets mounted Gherkin contracts or derives source-bounded Given-When-Then scenarios. |
246
- | 05 | `workflow-repair` | Workflow method | Audit through final review | Controls source-backed inspection, repair planning, minimal code changes, validation loops, and evidence updates. |
247
- | 06 | `knowledge-repair-distill` | Knowledge pack | During repair planning or when execution drifts | Supplies gap taxonomy, convergence guidance, model-steering hints, and validation gates. |
248
-
249
- ## Subagents in Execution Order
250
-
251
- Each Subagent appears in its default execution order. A stage may be skipped only with evidence, and a Subagent is useful only when its output is consumed by the next decision.
322
+ | 00 | `quality-review-orchestrator` | Quality control | Imported Spec through pre-commit admission | Maintains the applicability plan, gate dependencies, invalidation, reruns, and distinct delivery outcomes. |
323
+ | 01 | `workflow-core` | Workflow mechanism | Entire DIC run | Defines source priority, ontology, evidence rules, typed handoffs, final statuses, and durable outputs. |
324
+ | 02 | `workflow-harness` | Executable control plane | Profile creation through admission | Freezes candidate identity, materializes the gate graph, records evidence-backed decisions, propagates invalidation, and computes readiness. |
325
+ | 03 | `workflow-intake` | Workflow method | Before Subagents | Finds design sources, implementation roots, test roots, protected paths, validation commands, and adapter hints. |
326
+ | 04 | `workflow-profile` | Workflow method | Before Subagents | Normalizes intake evidence into the project profile consumed by every downstream role. |
327
+ | 05 | `knowledge-openspec` | Knowledge pack | During source reading, if OpenSpec is detected | Interprets proposals, designs, specs, scenarios, tasks, active changes, and archived capabilities. |
328
+ | 06 | `knowledge-bdd` | Knowledge pack | When `.feature` files or behavioral coverage are in scope | Interprets mounted Gherkin contracts or derives source-bounded Given-When-Then scenarios. |
329
+ | 07 | `knowledge-change-impact` | Knowledge pack | After intake, drift, or repair | Traces semantic impact and invalidates only dependent evidence and gates. |
330
+ | 08 | `quality-cross-spec-consistency` | Design quality gate | After authority discovery; before implementation | Audits direct related baselines and ranked semantic candidates for incompatible current rules. |
331
+ | 09 | `quality-spec-review` | Design quality gate | After Spec import; before implementation | Checks specification completeness, consistency, testability, traceability, and unsupported claims; reruns after governing Spec changes. |
332
+ | 10 | `quality-sr-ar-review` | Architecture quality gate | Before architecture-affecting implementation | Checks requirement-to-design coverage, ownership, interfaces, data/state, quality attributes, and realizability. |
333
+ | 11 | `quality-ci-gate` | Delivery quality gate | PLAN before implementation; VERIFY before admission | Defines mandatory candidate checks, runtime/flake policy, evidence retention, and candidate-bound verification. |
334
+ | 12 | `workflow-repair` | Workflow method | Post-implementation DIC loop | Controls source-backed consistency inspection, minimal repair, validation, and convergence. |
335
+ | 13 | `knowledge-repair-distill` | Knowledge pack | During repair planning or when execution drifts | Supplies gap taxonomy, convergence guidance, model-steering hints, and validation gates. |
336
+ | 14 | `quality-code-review` | Implementation quality gate | Whenever changed implementation risk applies | Reviews semantic contract impact, architecture, security, performance, reliability, and maintainability. |
337
+ | 15 | `quality-dt-review` | Test quality gate | Whenever changed behavior or test risk applies | Checks requirement/risk coverage, negative paths, assertion strength, determinism, and mutation sensitivity. |
338
+ | 16 | `quality-adversarial-challenge` | Independent challenge gate | After ordinary review for high-risk claims | Runs a minimal risk-selected challenge set and records reproducible counterexamples. |
339
+ | 17 | `quality-evidence-audit` | Evidence integrity gate | Before final review and after candidate drift | Verifies that claims are current, reproducible, content-addressed, and candidate-bound. |
340
+ | 18 | `quality-repository-gate` | Pre-commit admission gate | After DIC Attestation and affected-gate reruns | Freezes candidate identity and decides ADMIT, ADMIT WITH FOLLOW-UP, or REJECT from current evidence. |
341
+
342
+ ## Subagents in the DIC Consistency Loop
343
+
344
+ These Subagents implement the post-implementation consistency loop. Their
345
+ dependency order does not imply that the surrounding quality gates execute once
346
+ or that unrelated work must be serialized.
252
347
 
253
348
  | Step | Subagent | Phase | Consumes | Produces |
254
349
  | --- | --- | --- | --- | --- |
255
- | 01 | `spec-reader` | Source truth | Project profile and authoritative design sources | Source-backed requirement brief, source anchors, protected paths, unresolved questions |
256
- | 02 | `profile-builder` | Project profile confirmation | Intake evidence and repository structure | `reports/project-profile.json` |
257
- | 03 | `contract-oracle` | Obligation mapping | Confirmed requirements, scenarios, and feedback hypotheses | Source-confirmed obligation queue |
258
- | 04 | `flow-auditor` | Flow completeness | Obligation queue and optional BDD scenarios | Lifecycle, transition, branch, side-effect, and integration-flow audit |
259
- | 05 | `impl-inspector` | Implementation inspection | Confirmed obligations and flow audit | Source-backed implementation gap report; no code edits |
260
- | 06 | `repair-planner` | Repair planning | Gap report, protected paths, and available validation commands | Small repair slices with source anchors, stop conditions, and fallback routes |
261
- | 07 | `code-repairer` | Code repair | Approved repair slices | Minimal code changes, changed-file evidence, and repair notes |
262
- | 08 | `validation-runner` | Validation | Project-declared commands and changed implementation | Evaluator-readable validation logs and summaries under `logs/trace/validation/` |
263
- | 09 | `final-reviewer` | Final gate | All prior evidence, changed files, validation, and output artifacts | Final consistency decision, residual risks, and result recommendation |
264
-
265
- ## Default Workflow
350
+ | 01 | `profile-builder` | Project profile confirmation | Intake evidence and repository structure | `reports/project-profile.json`, authority scope, and semantic candidates |
351
+ | 02 | `spec-reader` | Source truth | Project profile and authoritative design sources | Source-backed requirement brief, source anchors, protected paths, unresolved questions |
352
+ | 03 | `semantic-conflict-auditor` | Cross-Spec challenge | Direct related baselines, semantic candidates, and authority roots | Source-paired conflict and refinement findings; no edits |
353
+ | 04 | `contract-oracle` | Obligation mapping | Confirmed requirements, scenarios, and conflict findings | Source-confirmed obligation queue |
354
+ | 05 | `impact-analyst` | Change impact | Candidate change surface, obligations, repository and ontology dependencies | Invalidated decisions and minimal safe rerun plan |
355
+ | 06 | `flow-auditor` | Flow completeness | Obligation queue and optional BDD scenarios | Lifecycle, transition, branch, side-effect, and integration-flow audit |
356
+ | 07 | `impl-inspector` | Implementation inspection | Confirmed obligations and flow audit | Source-backed implementation gap report; no code edits |
357
+ | 08 | `repair-planner` | Repair planning | Gap report, protected paths, and available validation commands | Small repair slices with source anchors, stop conditions, and fallback routes |
358
+ | 09 | `code-repairer` | Code repair | Approved repair slices | Minimal code changes, changed-file evidence, and repair notes |
359
+ | 10 | `validation-runner` | Validation | Project-declared commands and changed implementation | Evaluator-readable validation logs and summaries under `logs/trace/validation/` |
360
+ | 11 | `adversarial-challenger` | Independent challenge | Frozen candidate, high-risk claims, policies, and evidence | Falsifiable challenges and reproducible counterexamples; no edits |
361
+ | 12 | `evidence-auditor` | Evidence integrity | Candidate, claims, gate runs, validation, and content hashes | Claim-to-evidence matrix and stale or unsupported claim findings |
362
+ | 13 | `final-reviewer` | DIC consistency gate | Current DIC evidence, conflicts, impact, validation, and output artifacts | Candidate-bound consistency decision and Attestation; not repository admission |
363
+
364
+ ## Default Gate Lifecycle
266
365
 
267
366
  ```text
268
- workflow-core
269
- -> workflow-intake
270
- -> workflow-profile
271
- -> [knowledge-openspec, when detected]
272
- -> spec-reader
273
- -> profile-builder
274
- -> contract-oracle
275
- -> [knowledge-bdd, when behavior coverage is needed]
276
- -> workflow-repair
277
- -> flow-auditor
278
- -> impl-inspector
279
- -> [knowledge-repair-distill, when planning or drift requires it]
280
- -> repair-planner
281
- -> code-repairer
282
- -> validation-runner
283
- -> final-reviewer
367
+ IMPORT SPEC
368
+ -> Intake + Profile
369
+ -> Cross-Spec Consistency
370
+ -> Spec Review
371
+ -> [SR/AR Review when architecture or realization is affected]
372
+ -> CI Gate [PLAN]
373
+
374
+ IMPLEMENT
375
+ -> implementation from confirmed obligations
376
+ -> [risk-applicable specialist gates]*
377
+
378
+ DIC CONSISTENCY LOOP
379
+ -> inspect design-implementation gaps
380
+ -> [plan repair -> apply repair -> validate]*
381
+ -> analyze impact and stale dependent evidence
382
+ -> [invalidate and re-run affected gates]*
383
+
384
+ PRE-COMMIT
385
+ -> CI Gate [VERIFY frozen candidate]
386
+ -> [Adversarial Challenge when material hypotheses apply]
387
+ -> Evidence Audit [candidate-bound claim freshness]
388
+ -> Final Reviewer [DIC consistency + Attestation]
389
+ -> Repository Gate [ADMIT / ADMIT WITH FOLLOW-UP / REJECT]
284
390
  ```
285
391
 
286
- The same flow can be read as four evidence gates:
287
-
288
- ```text
289
- DISCOVER
290
- workflow-intake
291
- -> workflow-profile
292
-
293
- UNDERSTAND
294
- -> spec-reader
295
- -> profile-builder
296
- -> contract-oracle
297
-
298
- INSPECT + REPAIR
299
- -> flow-auditor
300
- -> impl-inspector
301
- -> repair-planner
302
- -> code-repairer
303
-
304
- VERIFY
305
- -> validation-runner
306
- -> final-reviewer
307
- ```
392
+ `*` means zero or more risk-driven iterations. This is a gate graph with
393
+ feedback loops, not a fixed one-pass Agent chain. A skipped gate needs an
394
+ applicability reason. A changed Spec, architecture, implementation, test,
395
+ fixture, pipeline, policy, or candidate invalidates dependent decisions, which
396
+ must be re-run from the earliest affected boundary.
308
397
 
309
- This chain is intentionally evidence-first. Skills provide workflow controls or stage-specific knowledge; Subagents consume bounded inputs and produce typed evidence. A workflow with fewer strong handoffs is better than a decorative chain of agents with no consumed evidence.
398
+ Keep three outcomes distinct: DIC `consistencyStatus`, specialist
399
+ `qualityStatus`, and repository `admissionStatus`. DIC `PASS` proves
400
+ design-implementation consistency; it does not by itself prove every quality
401
+ domain or grant `ADMIT`. Retain the applicability plan, gate run history,
402
+ invalidation reasons, and decisions under `reports/quality/`.
310
403
 
311
404
  ## Ontology-Driven Consistency
312
405
 
@@ -326,24 +419,27 @@ requiring a graph database; SQLite or a graph service can be added later as an
326
419
  index without changing the semantic contract.
327
420
 
328
421
  The published, bundled CLI validates and records actions without publishing the
329
- runtime source:
422
+ runtime source. These ontology commands expect the workflow to have already
423
+ created `reports/ontology-snapshot.json`, `reports/project-profile.json`, and,
424
+ for Ledger operations, `reports/ontology-actions.jsonl`. They are integrity and
425
+ governance commands, not a replacement for the initial Agent-driven intake:
330
426
 
331
427
  ```text
332
- dic-workflow-kit ontology-check --root . --status PASS
333
- dic-workflow-kit action-check --root . --action reports/actions/repair.json
334
- dic-workflow-kit action-record --root . --action reports/actions/repair.json
335
- dic-workflow-kit ontology-reconcile --root .
336
- dic-workflow-kit ontology-ledger-check --root . --json
337
- dic-workflow-kit ontology-evidence-check --root . --json
338
- dic-workflow-kit ontology-validation-check --root . --json
339
- dic-workflow-kit ontology-implementation-check --root . --json
340
- dic-workflow-kit ontology-query --root . --query impact --id <object-id>
341
- dic-workflow-kit ontology-drift --root .
342
- dic-workflow-kit ontology-plan --root . --json
343
- dic-workflow-kit ontology-explain --root . --id <object-id> --json
344
- dic-workflow-kit ontology-report --root . --status PASS
345
- dic-workflow-kit ontology-attest --root . --status PASS --summary "Verified"
346
- dic-workflow-kit ontology-attestation-check --root .
428
+ qiheng ontology-check --root . --status PASS
429
+ qiheng action-check --root . --action reports/actions/repair.json
430
+ qiheng action-record --root . --action reports/actions/repair.json
431
+ qiheng ontology-reconcile --root .
432
+ qiheng ontology-ledger-check --root . --json
433
+ qiheng ontology-evidence-check --root . --json
434
+ qiheng ontology-validation-check --root . --json
435
+ qiheng ontology-implementation-check --root . --json
436
+ qiheng ontology-query --root . --query impact --id <object-id>
437
+ qiheng ontology-drift --root .
438
+ qiheng ontology-plan --root . --json
439
+ qiheng ontology-explain --root . --id <object-id> --json
440
+ qiheng ontology-report --root . --status PASS
441
+ qiheng ontology-attest --root . --status PASS --summary "Verified"
442
+ qiheng ontology-attestation-check --root .
347
443
  ```
348
444
 
349
445
  `action-record` writes an append-only, SHA-256-addressed audit entry to
@@ -508,4 +604,8 @@ Adapters can change or extend this contract. For example, a contest adapter may
508
604
 
509
605
  ## Status
510
606
 
511
- This repository currently contains the first generalized scaffold extracted from a contest-specific design-implementation repair workflow. It is intended to become the reusable upstream kit for future OpenSpec and design-first Coding Agent workflows.
607
+ QIHENG is a released, cross-host workflow package with safe
608
+ installation lifecycle management, OpenSpec and BDD intake, ontology-governed
609
+ Actions, content-addressed validation, tamper-evident Ledgers, generated reports,
610
+ and final Attestations. New work should preserve these contracts while extending
611
+ adapters, storage backends, and CI trust anchors.