project-tiny-context-harness 0.2.80 → 0.2.81

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 (30) hide show
  1. package/README.md +8 -8
  2. package/assets/README.md +7 -7
  3. package/assets/README.zh-CN.md +8 -0
  4. package/assets/github/harness.yml +1 -1
  5. package/assets/skills/composite-long-task-workflow/SKILL.md +8 -2
  6. package/assets/skills/composite-long-task-workflow/assets/execution-binding.template.md +2 -0
  7. package/assets/skills/composite-long-task-workflow/assets/goal-objective.template.md +6 -2
  8. package/assets/skills/composite-long-task-workflow/references/composite-long-task-workflow-protocol.md +22 -11
  9. package/dist/lib/composite-long-task-renderer.js +18 -62
  10. package/dist/lib/superpowers-task-assertion-normalizers.d.ts +3 -0
  11. package/dist/lib/superpowers-task-assertion-normalizers.js +67 -0
  12. package/dist/lib/superpowers-task-assertions.d.ts +20 -0
  13. package/dist/lib/superpowers-task-assertions.js +242 -0
  14. package/dist/lib/superpowers-task-compile-diagnostics.d.ts +5 -0
  15. package/dist/lib/superpowers-task-compile-diagnostics.js +20 -0
  16. package/dist/lib/superpowers-task-compile-guards.d.ts +2 -0
  17. package/dist/lib/superpowers-task-compile-guards.js +66 -0
  18. package/dist/lib/superpowers-task-compile.js +25 -5
  19. package/dist/lib/superpowers-task-conformance.d.ts +2 -0
  20. package/dist/lib/superpowers-task-conformance.js +24 -0
  21. package/dist/lib/superpowers-task-derive.js +60 -4
  22. package/dist/lib/superpowers-task-gates.js +57 -3
  23. package/dist/lib/superpowers-task-source-compile.js +49 -11
  24. package/dist/lib/superpowers-task-source-parser.js +12 -16
  25. package/dist/lib/superpowers-task-state-schema.d.ts +61 -1
  26. package/dist/lib/superpowers-task-state.js +19 -3
  27. package/dist/lib/superpowers-task-status.d.ts +2 -0
  28. package/dist/lib/superpowers-task-status.js +14 -0
  29. package/dist/lib/superpowers-task-validator.js +14 -1
  30. package/package.json +5 -5
package/README.md CHANGED
@@ -94,19 +94,19 @@ For ordinary target-mode preparation, a two-document upstream input remains enou
94
94
 
95
95
  The ordinary long-task path uses `/normal-long-task`. It is the non-Superpowers acceptance pass: it can generate or reuse the full acceptance checklist and can produce a generic target-mode prompt.
96
96
 
97
- The Composite Long-Task Workflow path uses `/composite-long-task-workflow` when three inputs already exist: `Product / Architecture Source`, `Technical Realization Plan` and `Acceptance Checklist`. The product/architecture source preserves original intent and scope; the technical realization plan is the execution blueprint and plan-conformance source; the checklist is the acceptance authority. The Skill does not perform complexity routing: invocation means Superpowers-backed composite execution was already selected. Two-document compatibility is allowed only when the first document clearly contains both product/architecture source and technical realization plan sections. If only a product/architecture source and checklist exist, the Skill stops with a Missing Fields Report for a missing `Technical Realization Plan` instead of generating one. The technical realization plan must already satisfy the required Superpowers-ready Markdown implementation plan fields. When it does, the Skill freezes the package-managed workflow into `workflow-protocol.md`, writes task-local `execution-binding.md`, and renders `goal-objective.txt` as a thin Codex Goal objective instead of packing the full workflow into goal text. This is intentional: the Goal objective stays small enough to preserve the persistent completion contract, while the complete executable workflow lives in the protocol snapshot and the task-specific binding. The expected runtime effect is explicit fusion rather than agent improvisation: Tiny Context Workflow Contract first, then three-input authority, state compilation, Superpowers implementation slices, canonical evidence/state updates, generated views, slice/epoch gates and final-gate completion. The workflow is Tiny Context's composite adapter layer, aligned to the official Superpowers skills while remaining a Tiny Context-owned adapter rather than an upstream-owned schema; it is not the Tiny Context Workflow Contract itself, not a business fact source, not a generic prompt generator and not a Superpowers fork. It may wrap Superpowers with Tiny Context authority, conformance and acceptance gates, but it must not redefine or fork Superpowers execution mechanics. It requires parent-level `Product Context Delta` and `Technical Context Delta` checks before implementation and uses a canonical state kernel under `tmp/ty-context/plan-acceptance/<plan-slug>/`: `task-state.json` is the only execution state source, `events.ndjson` is append-only and `derived/**` contains generated local audit, plan-conformance matrix, final acceptance verdict, progress ledger, evidence index, context alignment and final summary views. Complete acceptance rows are externally reviewable evidence claims derived from `task-state.evidence[]`: the checklist supplies the proof chain, fresh reviewable evidence must satisfy every required layer, and material drift, missing layers or unapproved sibling substitution prevent `complete`. Goal-mode wording separates `audit_task_complete`, `acceptance_target_status` and computed `product_goal_complete`: implementation / execution goals complete only when `ty-context composite-long-task final-gate` computes `product_goal_complete=true`; read-only audit goals may end at `audit_task_complete`, but a non-accepted verdict says `Audit workflow completed; acceptance target not complete.` and does not use unqualified `Goal achieved` or `update_goal(status="complete")` as acceptance of the user target.
97
+ The Composite Long-Task Workflow path uses `/composite-long-task-workflow` when three inputs already exist: `Product / Architecture Source`, `Technical Realization Plan` and `Acceptance Checklist`. The product/architecture source preserves original intent and scope; the technical realization plan is the execution blueprint and plan-conformance source; the checklist is the acceptance authority. The Skill does not perform complexity routing: invocation means Superpowers-backed composite execution was already selected. Two-document compatibility is allowed only when the first document clearly contains both product/architecture source and technical realization plan sections. If only a product/architecture source and checklist exist, the Skill stops with a Missing Fields Report for a missing `Technical Realization Plan` instead of generating one. The technical realization plan must already satisfy the required Superpowers-ready Markdown implementation plan fields. When it does, the Skill freezes the package-managed workflow into `workflow-protocol.md`, writes task-local `execution-binding.md`, and renders `goal-objective.txt` as a thin Codex Goal objective instead of packing the full workflow into goal text. This is intentional: the Goal objective stays small enough to preserve the persistent completion contract, while the complete executable workflow lives in the protocol snapshot and the task-specific binding. The expected runtime effect is explicit fusion rather than agent improvisation: Tiny Context Workflow Contract first, then three-input authority, state compilation, Superpowers implementation slices, canonical evidence/state updates, generated views, slice/epoch gates and final-gate completion. The workflow is Tiny Context's composite adapter layer, aligned to the official Superpowers skills while remaining a Tiny Context-owned adapter rather than an upstream-owned schema; it is not the Tiny Context Workflow Contract itself, not a business fact source, not a generic prompt generator and not a Superpowers fork. It may wrap Superpowers with Tiny Context authority, conformance and acceptance gates, but it must not redefine or fork Superpowers execution mechanics. It requires parent-level `Product Context Delta` and `Technical Context Delta` checks before implementation and uses a canonical state kernel under `tmp/ty-context/plan-acceptance/<plan-slug>/`: `task-state.json` is the only execution state source, `events.ndjson` is append-only and `derived/**` contains generated local audit, plan-conformance matrix, final acceptance verdict, progress ledger, evidence index, context alignment and final summary views. Complete acceptance rows are externally reviewable evidence claims derived from `task-state.evidence[]`: the checklist supplies the proof chain, fresh reviewable evidence must satisfy every required layer, and machine-verifiable layers such as UI/browser/runtime/API/data/integration/test require passed assertion results, zero command/assertion exit codes, target AC/layer coverage, passed positive and negative assertions and no negative evidence contradiction. Screenshot-only proof, component screenshots, viewmodels, diagnostic pages, API-only proof for a UI Path AC, final cards, matrix/verdict rows, validator passes and prose summaries are invalid as completion proof for those layers. Material drift, missing layers, failed/stale assertion reports, failed negative evidence scans or unapproved sibling substitution prevent `complete`. Goal-mode wording separates `audit_task_complete`, `acceptance_target_status` and computed `product_goal_complete`: implementation / execution goals complete only when `ty-context composite-long-task final-gate` computes `product_goal_complete=true`; read-only audit goals may end at `audit_task_complete`, but a non-accepted verdict says `Audit workflow completed; acceptance target not complete.` and does not use unqualified `Goal achieved` or `update_goal(status="complete")` as acceptance of the user target.
98
98
 
99
99
  The three inputs also carry capability-first delivery boundaries. Product / Architecture Source declares `delivery_scope`, `full_population_required`, samples that validate the claim, samples that do not validate it and out-of-scope backlog. Each Technical Realization Plan item declares delivery scope, capability target, representative samples, full-population boundary and non-required population. Each Acceptance Checklist item declares acceptance scope, what it validates and does not validate, sample boundary and full-population requirement. `scope_conflict_requires_decision` blocks completion when source, plan and checklist disagree between system capability build, representative sample validation and full-population operation. Sample evidence or framework-only implementation cannot prove all-provider, all-interface, all-platform or full-population completion unless the AC explicitly allows it; when full population is not explicitly required, generated views report it as `not_in_scope`.
100
100
 
101
101
  `ty-context composite-long-task compile` uses a strict heading-based grammar for that packet. Product / Architecture Source is one document-level object with fixed fields. Technical Realization Plan items are definitions only when written as Markdown headings such as `## PI-001: ...`; Acceptance Checklist items are definitions only when written as headings such as `## AC-001: ...`. Fields inside those sections must use fixed `key: value`, indented-list or `key: |` syntax. Plain prose, tables, mapping previews and ordinary lists that mention `PI-001` or `AC-001` are references, not definitions; old list-style definitions such as `- PI-001: ...` followed by delivery fields now fail at compile time with file and line guidance.
102
102
 
103
- For non-trivial Superpowers-backed slices, the workflow protocol requires a structured `slice-delta.json`. The executor applies it with `ty-context composite-long-task apply-slice-delta <workdir> <slice-delta.json>`, then runs `ty-context composite-long-task derive` and `ty-context composite-long-task slice-gate`. Each delta records touched plan items/ACs, code changes, closed and remaining proof layers, blockers, cleanup assertions, `progress_value` and canonical evidence records with `proves`, `does_not_prove`, freshness, redaction and reviewability. Default slice guidance is to group 2-4 strongly related missing layers that share an AC, runtime scenario, proof environment or verification path, while single-gap slices are reserved for blockers, contradictions or small metadata cleanup. The protocol also asks executors to classify missing layers, reuse DB/API/Browser environments only with unique proof prefixes and cleanup assertions, and run a stale/overclaim scan after deriving artifacts.
103
+ For non-trivial Superpowers-backed slices, the workflow protocol requires a structured `slice-delta.json`. The executor applies it with `ty-context composite-long-task apply-slice-delta <workdir> <slice-delta.json>`, then runs `ty-context composite-long-task derive` and `ty-context composite-long-task slice-gate`. Each delta records touched plan items/ACs, code changes, closed and remaining proof layers, blockers, cleanup assertions, `progress_value` and canonical evidence records with `proves`, `does_not_prove`, freshness, redaction, reviewability, command exit code when applicable, assertion result and negative evidence scan. Default slice guidance is to group 2-4 strongly related missing layers that share an AC, runtime scenario, proof environment or verification path, while single-gap slices are reserved for blockers, contradictions or small metadata cleanup. The protocol also asks executors to classify missing layers, reuse DB/API/Browser environments only with unique proof prefixes and cleanup assertions, and run a stale/overclaim scan after deriving artifacts.
104
104
 
105
105
  The generated Superpowers prompt uses Slice Gate / Epoch Gate / Final Gate cadence instead of running a full final gate after every slice. Progress Accounting tracks AC acceptance completion, engineering implementation progress, runtime/proof progress, system capability progress, representative sample progress, real object coverage, full population operation progress, artifact budget, proof-layer milestone status and workflow overhead in state and generated `derived/progress-ledger.*`. Workflow overhead backpressure asks executors to batch shared provider/browser/runtime/security epoch proof environments, prune stale artifacts and choose the Next 3-5 high-value clusters that close the most blocking AC/proof-layer gaps.
106
106
 
107
- The recommended Superpowers layer is the specific [obra/Superpowers](https://github.com/obra/superpowers) plugin/workflow, not a generic planning substitute. After `/composite-long-task-workflow` accepts the input packet, prefer `superpowers:subagent-driven-development` when subagents are available and `superpowers:executing-plans` otherwise. Behavior changes should use `superpowers:test-driven-development`. Final gate order is derive all views, `superpowers:verification-before-completion`, `ty-context validate-superpowers-state <dir>`, `ty-context validate-plan-acceptance <dir>`, read-only auditor when available, rederive/revalidate if auditor fixes changed state or evidence, final stale/overclaim scan, then `ty-context composite-long-task final-gate <dir>` computes completion. The auditor reconstructs AC proof chains with a fixed auditor checklist and finds gaps, but does not become proof. Superpowers review and verification remain useful execution checks, but they cannot override Tiny Context gates: passing Superpowers review does not by itself prove plan conformance or checklist acceptance.
107
+ The recommended Superpowers layer is the specific [obra/Superpowers](https://github.com/obra/superpowers) plugin/workflow, not a generic planning substitute. After `/composite-long-task-workflow` accepts the input packet, prefer `superpowers:subagent-driven-development` when subagents are available and `superpowers:executing-plans` otherwise. Behavior changes should use `superpowers:test-driven-development`. Final gate order is derive all views, `superpowers:verification-before-completion`, `ty-context validate-superpowers-state <dir>`, `ty-context validate-plan-acceptance <dir>`, read-only auditor when available, rederive/revalidate if auditor fixes changed state or evidence, final stale/overclaim scan, AC Evidence Assertion Gate, Negative Evidence Scan Gate, then `ty-context composite-long-task final-gate <dir>` computes completion. The auditor reconstructs AC proof chains with a fixed auditor checklist and finds gaps, but does not become proof. Superpowers review and verification remain useful execution checks, but they cannot override Tiny Context gates: passing Superpowers review does not by itself prove plan conformance or checklist acceptance.
108
108
 
109
- Hallucination guard: do not register `workflow-protocol.md` in `project_context/context.toml`, treat it as business Context, let `derived/**` rewrite Product / Plan / Checklist, use local audit or Superpowers review as quality proof, use sample evidence as full-population proof, claim full alignment while Source-to-Context Coverage or Context-to-Implementation Binding has unresolved required gaps, handwrite `product_goal_complete`, or complete an implementation Goal before final-gate passes.
109
+ Hallucination guard: do not register `workflow-protocol.md` in `project_context/context.toml`, treat it as business Context, let `derived/**` rewrite Product / Plan / Checklist, use local audit or Superpowers review as quality proof, use screenshots/final cards/matrix/verdict/validator pass/prose as machine-verifiable proof, use sample evidence as full-population proof, claim full alignment while Source-to-Context Coverage or Context-to-Implementation Binding has unresolved required gaps, handwrite `product_goal_complete`, or complete an implementation Goal before final-gate passes.
110
110
 
111
111
  The reason is drift control. The workflow contract plus Context layer is intentionally a soft constraint. It works well for short tasks, and Context can still capture the expected facts for long tasks, but long execution makes the Context-to-code step drift as the context window grows, work is handed off, subagents split scope or validation loops multiply. The extra Tiny Context gates exist because Superpowers alone can still drift under long-running execution pressure: it strengthens execution discipline, but it does not by itself preserve source authority, prevent scope shrinkage, prove full conformance to the Technical Realization Plan or enforce AC-by-AC evidence against the Acceptance Checklist. A product/architecture source, technical realization plan, acceptance checklist, explicit long-task Skill invocation, target-mode prompt, canonical task state, generated derived views and optional Superpowers execution layer make implementation conformance and completion evidence recoverable without restoring a phase-gated workflow.
112
112
 
@@ -163,7 +163,7 @@ npm ci
163
163
  npm run smoke:quickstart
164
164
  npm run preview:pack
165
165
  cd /path/to/your/test-repo
166
- npm install -D /path/to/project-tiny-context-harness/tmp/ty-context/source-preview/package/project-tiny-context-harness-0.2.80.tgz
166
+ npm install -D /path/to/project-tiny-context-harness/tmp/ty-context/source-preview/package/project-tiny-context-harness-0.2.81.tgz
167
167
  npx --no-install ty-context init --adopt
168
168
  make validate-context
169
169
  ```
@@ -278,7 +278,7 @@ Use `npx --no-install ty-context ...` only when you explicitly want the already
278
278
  | Full project context export Skill | `<harnessRoot>/skills/context_full_project_export/SKILL.md` | Handles explicit full-project, project-overall, Source Pack or code-level export requests and uses `export-context --source-pack`, `--code-index`, `--task-context`, `--all`, `--full` or `--code` to create temporary artifacts under `tmp/ty-context/context-exports/**`. |
279
279
  | Harness upgrade Skill | `<harnessRoot>/skills/context_harness_upgrade/SKILL.md` | Handles explicit Tiny Context / Project Tiny Context Harness upgrade requests such as “upgrade Tiny Context” and “use the Tiny Context upgrade skill to upgrade this project”; it runs the canonical `upgrade` path, handles only migration-scoped `manual_required` / `blocked` follow-up, then runs diagnostics. |
280
280
  | Ordinary long-task Skill | `<harnessRoot>/skills/normal-long-task/SKILL.md` | Invoke as `/normal-long-task` to turn a referenced plan, RFC, implementation proposal or two-document upstream input into a falsifiable acceptance checklist and optional generic paste-ready goal/target-mode prompt under `tmp/ty-context/plan-acceptance/**`; if the plan already contains an explicit concrete checklist, the Skill reuses it verbatim in the separate full-checklist file; compact summaries are only navigation/priority, but the Skill does not execute the plan or prove completion. |
281
- | Composite long-task workflow Skill | `<harnessRoot>/skills/composite-long-task-workflow/SKILL.md` | Invoke as `/composite-long-task-workflow` when Product / Architecture Source, Technical Realization Plan and Acceptance Checklist exist and Superpowers-backed execution is needed. It freezes `workflow-protocol.md`, writes `execution-binding.md`, renders `goal-objective.txt`, binds official workflow skill names, capability-first delivery scope fields, plan-conformance matrix, final acceptance verdict and externally reviewable evidence discipline, and stops when required input fields are missing. It does not generate the technical plan, checklist or execute the plan. |
281
+ | Composite long-task workflow Skill | `<harnessRoot>/skills/composite-long-task-workflow/SKILL.md` | Invoke as `/composite-long-task-workflow` when Product / Architecture Source, Technical Realization Plan and Acceptance Checklist exist and Superpowers-backed execution is needed. It freezes `workflow-protocol.md`, writes `execution-binding.md`, renders `goal-objective.txt`, binds official workflow skill names, capability-first delivery scope fields, plan-conformance matrix, final acceptance verdict, assertion-backed machine-verifiable evidence discipline and negative evidence scan, and stops when required input fields are missing. It does not generate the technical plan, checklist or execute the plan. |
282
282
  | Project-local Skills | `<harnessRoot>/skills/<role>/SKILL.md` | Optional local product/design/development Skills created by the project, such as `product_plan`, `uiux_design` or `development_engineer`. They supersede package-managed default Skills when more specific, are not overwritten by `sync`, and should keep front matter trigger keywords aligned with the project `AGENTS.md` role-trigger rule. |
283
283
  | Managed file sync | `make ty-context-sync` or `npx --yes --package project-tiny-context-harness@latest ty-context sync` | Refreshes package-managed guidance, default Skills, Makefile include, context templates, tools and workflow YAML. It does not run migrations or perform semantic Context generation; it may block only direct asset-refresh safety issues such as invalid managed blocks or deprecated managed Skill overrides. |
284
284
  | Upgrade | `make ty-context-upgrade` or `npx --yes --package project-tiny-context-harness@latest ty-context upgrade` | Use for releases marked `upgrade-required` or `manual-required`. Builds an upgrade plan, stops before writes when `blocked` items exist, otherwise applies `safe_pending` migrations, runs `sync` and `doctor`, and exits non-zero when manual follow-up or diagnostics remain. |
@@ -294,8 +294,8 @@ Use `npx --no-install ty-context ...` only when you explicitly want the already
294
294
  | Harness validation | `make validate-harness` | Composite gate for `validate-context` and `validate-code-modularity`. |
295
295
  | Context validation | `npx --yes --package project-tiny-context-harness@latest ty-context validate-context`, `make validate-context` | Checks required project recovery fields, Context graph metadata, declared paths/roles and fake test-execution claims. |
296
296
  | Plan contract validation | `npx --yes --package project-tiny-context-harness@latest ty-context validate-plan-contract <plan.md\|dir>` | Checks Source-to-Context Coverage and Context-to-Implementation Binding for structural consistency, referenced path existence and weak-proof complete/bound contradictions. |
297
- | Superpowers state validation | `npx --yes --package project-tiny-context-harness@latest ty-context validate-superpowers-state <dir>` | Checks canonical Superpowers-backed `task-state.json`, source hashes, graph references, delivery scope fields/conflicts, evidence/proof-layer consistency, stale evidence, sibling substitution, auditor blockers, derived drift and final completion rules. |
298
- | Plan acceptance validation | `npx --yes --package project-tiny-context-harness@latest ty-context validate-plan-acceptance <dir>` | Checks legacy matrix/verdict artifacts when no state exists; when `task-state.json` exists, validates state-backed derived artifacts. It rejects contradictory complete claims, dangling evidence references, weak-proof complete rows, missing proof layers, material/critical drift, unapproved sibling substitution, blocking auditor findings, raw secrets/tokens/cookies, generated active-count drift, missing plan/AC cross-references and declared surface/architecture binding gaps. `errors` block; `warnings` / `hygiene` report cleanup. |
297
+ | Superpowers state validation | `npx --yes --package project-tiny-context-harness@latest ty-context validate-superpowers-state <dir>` | Checks canonical Superpowers-backed `task-state.json`, source hashes, graph references, delivery scope fields/conflicts, evidence/proof-layer consistency, assertion-backed machine-verifiable evidence, negative evidence contradictions, stale evidence, sibling substitution, auditor blockers, derived drift and final completion rules. |
298
+ | Plan acceptance validation | `npx --yes --package project-tiny-context-harness@latest ty-context validate-plan-acceptance <dir>` | Checks legacy matrix/verdict artifacts when no state exists; when `task-state.json` exists, validates state-backed derived artifacts. It rejects contradictory complete claims, dangling evidence references, weak-proof complete rows, missing proof layers, missing/failed assertion-backed evidence for machine-verifiable layers, negative evidence contradictions, material/critical drift, unapproved sibling substitution, blocking auditor findings, raw secrets/tokens/cookies, generated active-count drift, missing plan/AC cross-references and declared surface/architecture binding gaps. `errors` block; `warnings` / `hygiene` report cleanup. |
299
299
  | Composite long-task state helpers | `npx --yes --package project-tiny-context-harness@latest ty-context composite-long-task <subcommand>` | Explicit `/composite-long-task-workflow` state helper for `init`, `compile`, `apply-slice-delta`, `derive`, `slice-gate`, `epoch-gate`, `final-gate`, `next-slices` and `render-goal` under `tmp/ty-context/plan-acceptance/**`. |
300
300
  | Diagnostics | `make ty-context-doctor` or `npx --yes --package project-tiny-context-harness@latest ty-context doctor` | Reports Harness root, package version, schema version and required Minimal Context paths. |
301
301
  | Package source checks | `ty-context package sync-source`, `ty-context package check-source` | Maintainer-only commands for keeping package canonical assets aligned with the source workspace. |
package/assets/README.md CHANGED
@@ -94,7 +94,7 @@ That smoke packs the local workspace, installs it into a disposable repo, runs `
94
94
  ```sh
95
95
  npm run preview:pack
96
96
  cd /path/to/your/test-repo
97
- npm install -D /path/to/project-tiny-context-harness/tmp/ty-context/source-preview/package/project-tiny-context-harness-0.2.80.tgz
97
+ npm install -D /path/to/project-tiny-context-harness/tmp/ty-context/source-preview/package/project-tiny-context-harness-0.2.81.tgz
98
98
  npx --no-install ty-context init --adopt
99
99
  make validate-context
100
100
  ```
@@ -138,17 +138,17 @@ For ordinary target-mode preparation, a two-document upstream input remains enou
138
138
 
139
139
  The ordinary long-task path uses `/normal-long-task`. It is the non-Superpowers acceptance pass: it can generate or reuse the full acceptance checklist and can produce a generic target-mode prompt.
140
140
 
141
- The Composite Long-Task Workflow path uses `/composite-long-task-workflow` when three inputs already exist: `Product / Architecture Source`, `Technical Realization Plan` and `Acceptance Checklist`. The product/architecture source preserves original intent and scope; the technical realization plan is the execution blueprint and plan-conformance source; the checklist is the acceptance authority. The Skill does not perform complexity routing: invocation means Superpowers-backed composite execution was already selected. Two-document compatibility is allowed only when the first document clearly contains both product/architecture source and technical realization plan sections. If only a product/architecture source and checklist exist, the Skill stops with a Missing Fields Report for a missing `Technical Realization Plan` instead of generating one. The technical realization plan must already satisfy the required Superpowers-ready Markdown implementation plan fields. When it does, the Skill freezes the package-managed workflow into `workflow-protocol.md`, writes task-local `execution-binding.md`, and renders `goal-objective.txt` as a thin Codex Goal objective instead of packing the full workflow into goal text. This is intentional: the Goal objective stays small enough to preserve the persistent completion contract, while the complete executable workflow lives in the protocol snapshot and the task-specific binding. The expected runtime effect is explicit fusion rather than agent improvisation: Tiny Context Workflow Contract first, then three-input authority, state compilation, Superpowers implementation slices, canonical evidence/state updates, generated views, slice/epoch gates and final-gate completion. The workflow is Tiny Context's composite adapter layer, aligned to the official Superpowers skills while remaining a Tiny Context-owned adapter rather than an upstream-owned schema; it is not the Tiny Context Workflow Contract itself, not a business fact source, not a generic prompt generator and not a Superpowers fork. It may wrap Superpowers with Tiny Context authority, conformance and acceptance gates, but it must not redefine or fork Superpowers execution mechanics. It requires parent-level `Product Context Delta` and `Technical Context Delta` checks before implementation and uses a canonical state kernel under `tmp/ty-context/plan-acceptance/<plan-slug>/`: `task-state.json` is the only execution state source, `events.ndjson` is append-only and `derived/**` contains generated local audit, plan-conformance matrix, final acceptance verdict, progress ledger, evidence index, context alignment and final summary views. Complete acceptance rows are externally reviewable evidence claims derived from `task-state.evidence[]`: the checklist supplies the proof chain, fresh reviewable evidence must satisfy every required layer, and material drift, missing layers or unapproved sibling substitution prevent `complete`. Goal-mode wording separates `audit_task_complete`, `acceptance_target_status` and computed `product_goal_complete`: implementation / execution goals complete only when `ty-context composite-long-task final-gate` computes `product_goal_complete=true`; read-only audit goals may end at `audit_task_complete`, but a non-accepted verdict says `Audit workflow completed; acceptance target not complete.` and does not use unqualified `Goal achieved` or `update_goal(status="complete")` as acceptance of the user target.
141
+ The Composite Long-Task Workflow path uses `/composite-long-task-workflow` when three inputs already exist: `Product / Architecture Source`, `Technical Realization Plan` and `Acceptance Checklist`. The product/architecture source preserves original intent and scope; the technical realization plan is the execution blueprint and plan-conformance source; the checklist is the acceptance authority. The Skill does not perform complexity routing: invocation means Superpowers-backed composite execution was already selected. Two-document compatibility is allowed only when the first document clearly contains both product/architecture source and technical realization plan sections. If only a product/architecture source and checklist exist, the Skill stops with a Missing Fields Report for a missing `Technical Realization Plan` instead of generating one. The technical realization plan must already satisfy the required Superpowers-ready Markdown implementation plan fields. When it does, the Skill freezes the package-managed workflow into `workflow-protocol.md`, writes task-local `execution-binding.md`, and renders `goal-objective.txt` as a thin Codex Goal objective instead of packing the full workflow into goal text. This is intentional: the Goal objective stays small enough to preserve the persistent completion contract, while the complete executable workflow lives in the protocol snapshot and the task-specific binding. The expected runtime effect is explicit fusion rather than agent improvisation: Tiny Context Workflow Contract first, then three-input authority, state compilation, Superpowers implementation slices, canonical evidence/state updates, generated views, slice/epoch gates and final-gate completion. The workflow is Tiny Context's composite adapter layer, aligned to the official Superpowers skills while remaining a Tiny Context-owned adapter rather than an upstream-owned schema; it is not the Tiny Context Workflow Contract itself, not a business fact source, not a generic prompt generator and not a Superpowers fork. It may wrap Superpowers with Tiny Context authority, conformance and acceptance gates, but it must not redefine or fork Superpowers execution mechanics. It requires parent-level `Product Context Delta` and `Technical Context Delta` checks before implementation and uses a canonical state kernel under `tmp/ty-context/plan-acceptance/<plan-slug>/`: `task-state.json` is the only execution state source, `events.ndjson` is append-only and `derived/**` contains generated local audit, plan-conformance matrix, final acceptance verdict, progress ledger, evidence index, context alignment and final summary views. Complete acceptance rows are externally reviewable evidence claims derived from `task-state.evidence[]`: the checklist supplies the proof chain, fresh reviewable evidence must satisfy every required layer, and machine-verifiable layers such as UI/browser/runtime/API/data/integration/test require passed assertion results, zero command/assertion exit codes, target AC/layer coverage, passed positive and negative assertions and no negative evidence contradiction. Screenshot-only proof, component screenshots, viewmodels, diagnostic pages, API-only proof for a UI Path AC, final cards, matrix/verdict rows, validator passes and prose summaries are invalid as completion proof for those layers. Material drift, missing layers, failed/stale assertion reports, failed negative evidence scans or unapproved sibling substitution prevent `complete`. Goal-mode wording separates `audit_task_complete`, `acceptance_target_status` and computed `product_goal_complete`: implementation / execution goals complete only when `ty-context composite-long-task final-gate` computes `product_goal_complete=true`; read-only audit goals may end at `audit_task_complete`, but a non-accepted verdict says `Audit workflow completed; acceptance target not complete.` and does not use unqualified `Goal achieved` or `update_goal(status="complete")` as acceptance of the user target.
142
142
 
143
143
  The three inputs also carry capability-first delivery boundaries. Product / Architecture Source declares `delivery_scope`, `full_population_required`, samples that validate the claim, samples that do not validate it and out-of-scope backlog. Each Technical Realization Plan item declares delivery scope, capability target, representative samples, full-population boundary and non-required population. Each Acceptance Checklist item declares acceptance scope, what it validates and does not validate, sample boundary and full-population requirement. `scope_conflict_requires_decision` blocks completion when source, plan and checklist disagree between system capability build, representative sample validation and full-population operation. Sample evidence or framework-only implementation cannot prove all-provider, all-interface, all-platform or full-population completion unless the AC explicitly allows it; when full population is not explicitly required, generated views report it as `not_in_scope`.
144
144
 
145
145
  `ty-context composite-long-task compile` uses a strict heading-based grammar for that packet. Product / Architecture Source is one document-level object with fixed fields. Technical Realization Plan items are definitions only when written as Markdown headings such as `## PI-001: ...`; Acceptance Checklist items are definitions only when written as headings such as `## AC-001: ...`. Fields inside those sections must use fixed `key: value`, indented-list or `key: |` syntax. Plain prose, tables, mapping previews and ordinary lists that mention `PI-001` or `AC-001` are references, not definitions; old list-style definitions such as `- PI-001: ...` followed by delivery fields now fail at compile time with file and line guidance.
146
146
 
147
- For non-trivial Superpowers-backed slices, the workflow protocol requires a structured `slice-delta.json`. The executor applies it with `ty-context composite-long-task apply-slice-delta <workdir> <slice-delta.json>`, then runs `ty-context composite-long-task derive` and `ty-context composite-long-task slice-gate`. Each delta records touched plan items/ACs, code changes, closed and remaining proof layers, blockers, cleanup assertions, `progress_value` and canonical evidence records with `proves`, `does_not_prove`, freshness, redaction and reviewability. Default slice guidance is to group 2-4 strongly related missing layers that share an AC, runtime scenario, proof environment or verification path, while single-gap slices are reserved for blockers, contradictions or small metadata cleanup. The protocol also asks executors to classify missing layers, reuse DB/API/Browser environments only with unique proof prefixes and cleanup assertions, and run a stale/overclaim scan after deriving artifacts.
147
+ For non-trivial Superpowers-backed slices, the workflow protocol requires a structured `slice-delta.json`. The executor applies it with `ty-context composite-long-task apply-slice-delta <workdir> <slice-delta.json>`, then runs `ty-context composite-long-task derive` and `ty-context composite-long-task slice-gate`. Each delta records touched plan items/ACs, code changes, closed and remaining proof layers, blockers, cleanup assertions, `progress_value` and canonical evidence records with `proves`, `does_not_prove`, freshness, redaction, reviewability, command exit code when applicable, assertion result and negative evidence scan. Default slice guidance is to group 2-4 strongly related missing layers that share an AC, runtime scenario, proof environment or verification path, while single-gap slices are reserved for blockers, contradictions or small metadata cleanup. The protocol also asks executors to classify missing layers, reuse DB/API/Browser environments only with unique proof prefixes and cleanup assertions, and run a stale/overclaim scan after deriving artifacts.
148
148
 
149
149
  The generated Superpowers prompt uses Slice Gate / Epoch Gate / Final Gate cadence instead of running a full final gate after every slice. Progress Accounting tracks AC acceptance completion, engineering implementation progress, runtime/proof progress, system capability progress, representative sample progress, real object coverage, full population operation progress, artifact budget, proof-layer milestone status and workflow overhead in state and generated `derived/progress-ledger.*`. Workflow overhead backpressure asks executors to batch shared provider/browser/runtime/security epoch proof environments, prune stale artifacts and choose the Next 3-5 high-value clusters that close the most blocking AC/proof-layer gaps.
150
150
 
151
- The recommended Superpowers layer is the specific [obra/Superpowers](https://github.com/obra/superpowers) plugin/workflow, not a generic planning substitute. After `/composite-long-task-workflow` accepts the input packet, prefer `superpowers:subagent-driven-development` when subagents are available and `superpowers:executing-plans` otherwise. Behavior changes should use `superpowers:test-driven-development`. Final gate order is derive all views, `superpowers:verification-before-completion`, `ty-context validate-superpowers-state <dir>`, `ty-context validate-plan-acceptance <dir>`, read-only auditor when available, rederive/revalidate if auditor fixes changed state or evidence, final stale/overclaim scan, then `ty-context composite-long-task final-gate <dir>` computes completion. The auditor reconstructs AC proof chains with a fixed auditor checklist and finds gaps, but does not become proof. Superpowers review and verification remain useful execution checks, but they cannot override Tiny Context gates: passing Superpowers review does not by itself prove plan conformance or checklist acceptance.
151
+ The recommended Superpowers layer is the specific [obra/Superpowers](https://github.com/obra/superpowers) plugin/workflow, not a generic planning substitute. After `/composite-long-task-workflow` accepts the input packet, prefer `superpowers:subagent-driven-development` when subagents are available and `superpowers:executing-plans` otherwise. Behavior changes should use `superpowers:test-driven-development`. Final gate order is derive all views, `superpowers:verification-before-completion`, `ty-context validate-superpowers-state <dir>`, `ty-context validate-plan-acceptance <dir>`, read-only auditor when available, rederive/revalidate if auditor fixes changed state or evidence, final stale/overclaim scan, AC Evidence Assertion Gate, Negative Evidence Scan Gate, then `ty-context composite-long-task final-gate <dir>` computes completion. The auditor reconstructs AC proof chains with a fixed auditor checklist and finds gaps, but does not become proof. Superpowers review and verification remain useful execution checks, but they cannot override Tiny Context gates: passing Superpowers review does not by itself prove plan conformance or checklist acceptance.
152
152
 
153
153
  The reason is drift control. The workflow contract plus Context layer is intentionally a soft constraint. It works well for short tasks, and Context can still capture the expected facts for long tasks, but long execution makes the Context-to-code step drift as the context window grows, work is handed off, subagents split scope or validation loops multiply. The extra Tiny Context gates exist because Superpowers alone can still drift under long-running execution pressure: it strengthens execution discipline, but it does not by itself preserve source authority, prevent scope shrinkage, prove full conformance to the Technical Realization Plan or enforce AC-by-AC evidence against the Acceptance Checklist. A product/architecture source, technical realization plan, acceptance checklist, explicit long-task Skill invocation, target-mode prompt, canonical task state, generated derived views and optional Superpowers execution layer make implementation conformance and completion evidence recoverable without restoring a phase-gated workflow.
154
154
 
@@ -325,9 +325,9 @@ For long-running plans, RFCs or implementation proposals, invoke `/normal-long-t
325
325
 
326
326
  When the next step explicitly needs Superpowers-backed long-task execution, invoke `/composite-long-task-workflow` on the Product / Architecture Source, Technical Realization Plan and Acceptance Checklist. It emits `workflow-protocol.md`, `execution-binding.md` and `goal-objective.txt` so the future executor sees which inputs feed Context Delta assessment, `superpowers:subagent-driven-development`, `superpowers:executing-plans`, TDD, `superpowers:verification-before-completion`, canonical `task-state.json`, append-only `events.ndjson`, generated `derived/**` views, proof-chain evidence and optional auditor review. This is Tiny Context's composite adapter layer for Superpowers-backed workflows, aligned to the official Superpowers skills while remaining a Tiny Context-owned adapter rather than an upstream-owned schema. It may wrap Superpowers with authority, conformance and acceptance gates, but it must not redefine, duplicate or fork Superpowers execution mechanics; if a future Tiny Context-added step would conflict with, duplicate or override a Superpowers responsibility, stop and surface the boundary conflict instead of silently merging workflows. It cannot replace `/normal-long-task` for ordinary checklist preparation, does not route complexity, and does not derive a technical plan from a product plan; the Technical Realization Plan must already be a Superpowers-ready Markdown implementation plan or the Skill stops before rendering entry artifacts. A two-document packet is accepted only when the first document explicitly contains both product/architecture source and technical realization plan sections. Product / Architecture Source, Technical Realization Plan and Acceptance Checklist remain the upstream authorities, while state/derived views/validator/auditor artifacts cannot rewrite them. Capability-first delivery scope stays inside those same three inputs: source, plan items and ACs must explicitly distinguish reusable system capability build, representative sample validation, full population operation and out-of-scope backlog; `scope_conflict_requires_decision` blocks completion, and sample/framework evidence cannot prove full population unless the AC says so. The generated Goal objective also disambiguates `audit_task_complete`, `acceptance_target_status` and computed `product_goal_complete`; implementation / execution goals finish only when `product_goal_complete=true`, while a read-only audit goal can end at `audit_task_complete` only with a non-accepted verdict reported as `Audit workflow completed; acceptance target not complete.`, not as `Goal achieved`.
327
327
 
328
- Important usage note: Minimal Context intentionally keeps Context read order, Context/code priority and drift checks as agent-level soft constraints rather than machine-enforced gates. That tradeoff works well for short tasks, but long tasks with large context windows, multiple handoffs or many verification loops are expected to drift unless product intent, technical implementation target and acceptance target are externalized. Superpowers alone can still drift under this pressure: it strengthens execution discipline, but it does not by itself preserve source authority, prevent scope shrinkage, prove full conformance to the Technical Realization Plan or enforce AC-by-AC evidence against the Acceptance Checklist. Use `/normal-long-task` before long-running execution when ordinary checklist preparation is needed; use `/composite-long-task-workflow` when the three upstream inputs already exist and Superpowers-backed execution is desired. Treat `task-state.json` as the only execution state source, `events.ndjson` as append-only, `derived/**` as generated reading views and `task-state.evidence[]` as the canonical evidence ledger. `validate-superpowers-state` and state-backed `validate-plan-acceptance` are still artifact/state-consistency validators, not product-quality proof; a subagent auditor is an extra gap-finding pass on top of executor self-evidence and validator checks, not a replacement for either. Passing Superpowers review or verification does not bypass incomplete state rows, weak evidence, missing proof layers or blocking auditor findings.
328
+ Important usage note: Minimal Context intentionally keeps Context read order, Context/code priority and drift checks as agent-level soft constraints rather than machine-enforced gates. That tradeoff works well for short tasks, but long tasks with large context windows, multiple handoffs or many verification loops are expected to drift unless product intent, technical implementation target and acceptance target are externalized. Superpowers alone can still drift under this pressure: it strengthens execution discipline, but it does not by itself preserve source authority, prevent scope shrinkage, prove full conformance to the Technical Realization Plan or enforce AC-by-AC evidence against the Acceptance Checklist. Use `/normal-long-task` before long-running execution when ordinary checklist preparation is needed; use `/composite-long-task-workflow` when the three upstream inputs already exist and Superpowers-backed execution is desired. Treat `task-state.json` as the only execution state source, `events.ndjson` as append-only, `derived/**` as generated reading views and `task-state.evidence[]` as the canonical evidence ledger. `validate-superpowers-state` and state-backed `validate-plan-acceptance` are still artifact/state-consistency validators, not product-quality proof; they now also reject missing/failed assertion-backed evidence for machine-verifiable layers and negative evidence contradictions. A subagent auditor is an extra gap-finding pass on top of executor self-evidence and validator checks, not a replacement for either. Passing Superpowers review or verification does not bypass incomplete state rows, weak evidence, missing proof layers, failed assertion gates or blocking auditor findings.
329
329
 
330
- Hallucination guard: do not register `workflow-protocol.md` in `project_context/context.toml`, treat it as business Context, let `derived/**` rewrite Product / Plan / Checklist, use local audit or Superpowers review as quality proof, use sample evidence as full-population proof, claim full alignment while Source-to-Context Coverage or Context-to-Implementation Binding has unresolved required gaps, handwrite `product_goal_complete`, or complete an implementation Goal before final-gate passes.
330
+ Hallucination guard: do not register `workflow-protocol.md` in `project_context/context.toml`, treat it as business Context, let `derived/**` rewrite Product / Plan / Checklist, use local audit or Superpowers review as quality proof, use screenshots/final cards/matrix/verdict/validator pass/prose as machine-verifiable proof, use sample evidence as full-population proof, claim full alignment while Source-to-Context Coverage or Context-to-Implementation Binding has unresolved required gaps, handwrite `product_goal_complete`, or complete an implementation Goal before final-gate passes.
331
331
 
332
332
  For Product Surface work, `context_surface_contract` turns broad product/page/UI principles into project-owned surface responsibilities. A Product Surface can be a Web page, mobile screen, desktop window, game UI/HUD/menu, CLI/TUI output, extension UI or embedded/device interface. Cross-surface contracts use the existing `contract` role; area-owned screen facts stay in `area` or `subdomain`; repeatable validation paths use `verification`. The Harness does not add a new surface-specific role or create business surface contracts during `init` or `upgrade`. Product Surface Context authoring is not a default product-quality validator; plan validators only check declared temporary surface bindings for structural consistency. Projects that want mandatory task blocks should add a separate project-local Skill, while `product-surface-contract.md` is only a compact managed template for optional Context authoring.
333
333
 
@@ -405,7 +405,7 @@ Use `npx --no-install ty-context ...` only when you explicitly want the already
405
405
  | `npx --yes --package project-tiny-context-harness@latest ty-context check-modularity --touched [--limit 300] [--fail-on-warning]` | Reports selected handwritten source files over the physical line-count limit; `--file <path>` and `--base <ref>` select explicit files or branch changes, and config waivers are reported distinctly. |
406
406
  | `npx --yes --package project-tiny-context-harness@latest ty-context validate-context` | Checks minimum project recovery fields, Context graph metadata, declared paths/roles and fake test-execution claims. |
407
407
  | `npx --yes --package project-tiny-context-harness@latest ty-context validate-plan-contract <plan.md\|dir>` | Checks Source-to-Context Coverage and Context-to-Implementation Binding for structural consistency, referenced path existence and weak-proof complete/bound contradictions. |
408
- | `npx --yes --package project-tiny-context-harness@latest ty-context validate-superpowers-state <dir>` | Checks canonical Superpowers-backed `task-state.json`, source hashes, graph references, delivery scope fields/conflicts, evidence/proof-layer consistency, stale evidence, sibling substitution, auditor blockers, derived drift and final completion rules. |
408
+ | `npx --yes --package project-tiny-context-harness@latest ty-context validate-superpowers-state <dir>` | Checks canonical Superpowers-backed `task-state.json`, source hashes, graph references, delivery scope fields/conflicts, evidence/proof-layer consistency, assertion-backed machine-verifiable evidence, negative evidence contradictions, stale evidence, sibling substitution, auditor blockers, derived drift and final completion rules. |
409
409
  | `npx --yes --package project-tiny-context-harness@latest ty-context validate-plan-acceptance <dir>` | Checks legacy matrix/verdict artifacts when no state exists; when `task-state.json` exists, validates state-backed derived artifacts. It rejects contradictory complete claims, dangling evidence references, weak-proof complete rows, missing proof layers, material/critical drift, unapproved sibling substitution, blocking auditor findings, raw secrets/tokens/cookies, generated active-count drift, missing plan/AC cross-references and declared surface/architecture binding gaps. `errors` block; `warnings` / `hygiene` report cleanup. |
410
410
  | `npx --yes --package project-tiny-context-harness@latest ty-context composite-long-task <subcommand>` | Explicit `/composite-long-task-workflow` state helper for `init`, `compile`, `apply-slice-delta`, `derive`, `slice-gate`, `epoch-gate`, `final-gate`, `next-slices` and `render-goal` under `tmp/ty-context/plan-acceptance/**`. |
411
411
  | `make validate-context` | Makefile wrapper for `validate-context`. |
@@ -56,18 +56,26 @@ Tiny Context 有两个核心层。Minimal Context 是长期事实源层:说明
56
56
 
57
57
  Composite Long-Task Workflow Skill 用 `/composite-long-task-workflow`。如果下一步明确要 Superpowers-backed 目标模式执行,推荐在三份输入都存在后调用:`Product / Architecture Source`(产品/架构原始意图源)、`Technical Realization Plan`(具体技术实现方案)和 `Acceptance Checklist`(验收清单)。它不做复杂度分流;调用它表示上游已经决定使用 composite long-task execution。它不要求先跑 `/normal-long-task`,但也不会把产品方案现场翻译成技术方案;如果只有产品/架构方案和验收清单,Skill 会用 Missing Fields Report 停止并报告缺少 `Technical Realization Plan`。两份输入兼容只限第一份明确包含产品/架构源和技术实现方案两个章节。`Technical Realization Plan` 必须已经满足 Superpowers-ready Markdown implementation plan 的必填字段;满足时它跳过方案生成,直接绑定 Superpowers 执行,不满足时直接中断并报告缺失字段,不生成 prompt。它输出 `workflow-protocol.md`、`execution-binding.md` 和可直接用于 Codex Goal mode 的薄 `goal-objective.txt`,不是把完整 workflow 塞进 4000 字 Goal:Goal 只保留持续完成契约,完整可执行流程放在 protocol snapshot 和 task-specific binding。预期运行效果是显式融合而不是让 agent 自行发挥:先 Tiny Context 流程契约,再三份输入权威,再编译 task-state,再进入 Superpowers implementation slice,每个 slice 更新 canonical state/evidence,derive 出阅读视图,经过 slice/epoch gate,最后 final-gate 计算完成。这个 workflow 是面向 Superpowers execution 的 Tiny Context 适配层,对齐官方 Superpowers skills,但不是上游维护的 schema;它不是 Tiny Context 流程契约本身、不是业务事实源、不是普通 prompt generator、也不是 Superpowers fork。它可以在 Superpowers 外层增加 Tiny Context 的权威、对图纸和验收门禁,但不能重新定义、重复或分叉 Superpowers 执行机制。如果未来改动让 Tiny Context 新增步骤和官方 Superpowers 职责冲突、重复或覆盖,应停止修改并提示边界冲突,不要静默合并两套流程。它不生成技术方案或验收清单、不执行计划、不证明完成,也不会把临时 state、derived views 或 verdict 注册成 `project_context/**`。三输入是上游权威,state / derived views / validator / auditor 不能改写它们。`task-state.json` 是唯一执行状态源,`events.ndjson` 追加记录状态变更,`derived/**` 只生成 local audit、plan-conformance matrix、final acceptance verdict、progress ledger、evidence index、context alignment 和 final summary 等阅读视图。完整验收行按外部审计证据处理:proof chain 来自验收清单,fresh evidence 必须通过 `task-state.evidence[]` 满足每个 required layer,存在 material drift、缺 required layer 或未批准 sibling substitution 时不能标 `complete`。Goal mode 表述必须区分 `audit_task_complete`、`acceptance_target_status` 和 computed `product_goal_complete`:实现/执行目标只在 `ty-context composite-long-task final-gate` 计算出 `product_goal_complete=true` 时完成;只读审计目标可在 `audit_task_complete` 时结束,但 verdict 不是 accepted/complete 时,回复写 `Audit workflow completed; acceptance target not complete.`,不能用未限定的 `Goal achieved` 或 `update_goal(status="complete")` 表示用户验收目标已完成。
58
58
 
59
+ Machine-verifiable proof layer(如 UI/browser、runtime、API/schema、data artifact、integration、test)不能靠截图、final card、validator pass、matrix/verdict 行或 prose evidence 完成;必须有 `assertion_result.status=passed`、命令和 assertion exit code 为 0、target AC/layer 匹配、positive/negative assertions 通过、reviewable artifacts,且没有 failed/stale `negative_evidence_scan`。UI Path AC 不能用 component screenshot、storybook、viewmodel、mock/unit、diagnostic page 或 API-only evidence 替代 owner page/browser 主路径;`未验证`、`不可用`、`暂不可用`、`页面无明显变化` 等 owner-surface forbidden state 会使 AC/layer 失效。
60
+
59
61
  三份输入还必须承载 capability-first delivery 边界。Product / Architecture Source 声明 `delivery_scope`、`full_population_required`、哪些 representative samples 能验证 claim、哪些不能验证、以及 `out_of_scope_backlog`。每个 Technical Realization Plan item 声明 delivery scope、capability target、representative samples、full-population boundary 和 non-required population。每个 Acceptance Checklist item 声明 acceptance scope、`ac_validates`、`ac_does_not_validate`、sample boundary 和 full-population requirement。source / plan / checklist 在 system capability build、representative sample validation、full population operation 之间冲突时,`scope_conflict_requires_decision` 阻塞完成。sample evidence 或 framework-only implementation 不能证明 all-provider、all-interface、all-platform 或 full-population 完成,除非 AC 明确批准;未显式要求 full population 时,generated views 必须报告 `not_in_scope`。
60
62
 
61
63
  `ty-context composite-long-task compile` 对这三份输入使用严格的 heading-based grammar。Product / Architecture Source 是一个文档级对象,只读固定字段。Technical Realization Plan 里的 PI 只有写成 `## PI-001: ...` 这类 Markdown heading 才是正式定义;Acceptance Checklist 里的 AC 也只有 `## AC-001: ...` 这类 heading 才是正式定义。heading section 内字段必须使用固定 `key: value`、缩进列表或 `key: |` 多行块。正文、表格、mapping preview、`related_acs` / `related_plan_items` 和普通列表里出现的 `PI-001` / `AC-001` 都只是引用;旧式 `- PI-001: ...` 或 `- AC-001: ...` 后面跟字段的写法会在 compile 阶段带文件和行号报错。
62
64
 
63
65
  对于非平凡 slice,生成的 composite workflow prompt 要求使用结构化 `slice-delta.json`。executor 通过 `ty-context composite-long-task apply-slice-delta <workdir> <slice-delta.json>` 应用 delta,然后运行 `ty-context composite-long-task derive` 和 `ty-context composite-long-task slice-gate`。每个 delta 记录 touched plan items / ACs、code changes、closed / remaining proof layers、blockers、cleanup assertions、`progress_value`,以及带有 `proves`、`does_not_prove`、freshness、redaction 和 reviewability 的 canonical evidence records。默认 slice 策略是把同一 AC、runtime 场景、proof 环境或验证路径下的 2-4 个强相关 missing layers 合并处理;单 gap slice 只留给 blocker、contradiction 或小型 metadata cleanup。prompt 还会要求先分类 missing layer、复用 DB/API/Browser 环境时使用唯一 proof prefix 和 cleanup assertion,并在生成 derived artifacts 后做 stale/overclaim scan。
64
66
 
67
+ 当 slice 声称关闭 machine-verifiable layer 时,`slice-delta.json` 的 evidence record 还应包含 `command_exit_code`、`assertion_result`,UI/browser 等需要时还应包含 `negative_evidence_scan`;derived matrix/verdict 只展示 assertion status 和 blocker,不能替代 assertion 执行。
68
+
65
69
  生成的 composite workflow prompt 使用 Slice Gate / Epoch Gate / Final Gate 分层节奏,而不是每个 slice 后都跑完整 final gate。Progress Accounting 在 state 和 generated `derived/progress-ledger.*` 中记录 AC acceptance completion、engineering implementation progress、runtime/proof progress、system capability progress、representative sample progress、real object coverage、full population operation progress、artifact budget 和 workflow overhead。每个 slice 需要声明 artifact budget、proof-layer milestone 状态和 cleanup expectation。workflow overhead backpressure 要求 executor 批处理共享的 provider/browser/runtime/security epoch proof environment,清理 stale artifact,并选择 Next 3-5 high-value clusters 来优先关闭最多阻塞 AC / proof-layer gap。
66
70
 
67
71
  重要使用提示:Minimal Context 有意把 Context 读取顺序、Context / 代码优先级和漂移检查保持为 agent 级软约束,而不是机器强制 edit-order gate。这个取舍适合短任务,但长任务、大上下文、多次交接或多轮验证时预期会漂移。单靠 Superpowers 在这类压力下仍可能漂移:它能增强执行纪律,但本身不负责保留上游 source authority、防止 scope shrinkage、证明完整符合 Technical Realization Plan,或按 Acceptance Checklist 逐 AC 强制证据成立。普通 checklist 准备需要 `/normal-long-task`;已有产品/架构原始意图源、具体技术实现方案和验收清单且需要 Superpowers-backed execution 时,可直接用 `/composite-long-task-workflow`。`Product Context Delta` 判断产品逻辑、页面职责、信息架构和验收语义是否需要写入 Context;`Technical Context Delta` 判断 API/schema、模块边界、runtime/state、验证/部署路径和稳定技术取舍是否需要写入 Context。`task-state.json` 是唯一执行状态源,`events.ndjson` 追加记录状态变化,`derived/**` 是生成阅读视图,`task-state.evidence[]` 是 canonical evidence ledger;local audit 只是 generated progress/recovery view,不能裁判完成;审计流程完成也不等于被验收目标完成。使用目标模式执行方案时,目标结束条件对齐 computed `product_goal_complete=true`,只读审计目标才可把 `audit_task_complete` 当元任务结束。最终顺序是 derive all views -> verification-before-completion -> `validate-superpowers-state` -> state-backed `validate-plan-acceptance` -> read-only auditor -> stale/overclaim scan -> `ty-context composite-long-task final-gate` 计算 completion;若审计后修改 state/evidence,需 rederive 并重跑两个 validator。`validate-plan-contract`、`validate-superpowers-state` 和 `validate-plan-acceptance` 只检查临时 artifact/state 自洽、引用存在、弱证据 complete 行、缺 required proof layer、material/critical drift、sibling substitution 和已声明的 surface/architecture binding 一致性,不证明产品质量。有 subagent 能力时,composite workflow prompt 会把 subagent 作为只读 auditor 加在主 agent 自证和 validator 之后;auditor 用固定 auditor checklist 找 gap,不是 proof source。Superpowers review 和 verification 仍然有价值,但不能覆盖 Tiny Context gates;通过 Superpowers review 不等于证明 plan conformance 或 checklist acceptance。
68
72
 
73
+ 最终顺序中的 final-gate 还包含 AC Evidence Assertion Gate 和 Negative Evidence Scan Gate;`validate-superpowers-state` / state-backed `validate-plan-acceptance` 会拒绝缺少或失败的 assertion-backed machine proof、negative evidence contradiction、target AC/layer 不匹配和 stale assertion evidence。它们仍只验证 assertion report 与 proof layer 的绑定、freshness、reviewability、redaction、negative contradiction 和 state/derived consistency,不执行项目测试本身,也不证明产品质量。
74
+
69
75
  错误融合防线:不得把 `workflow-protocol.md` 注册进 `project_context/context.toml`,不得把它当业务 Context,不得让 `derived/**` 反向改写 Product / Plan / Checklist,不得把 local audit 或 Superpowers review 当质量证明,不得把 sample evidence 当 full population proof,不得在 Source-to-Context Coverage 或 Context-to-Implementation Binding 仍有 unresolved required gap 时声称完整对齐,不得手写 `product_goal_complete`,final-gate 未通过前不得把实现 Goal 标成 complete。
70
76
 
77
+ 额外的 machine-proof 防线:不得把 screenshot-only、final card、validator pass、matrix/verdict 行、prose evidence、component/storybook/viewmodel/mock/unit/diagnostic page 或 API-only path 当成 UI/browser/runtime/integration/test AC 的完成证明。
78
+
71
79
  ## 当前最佳实践
72
80
 
73
81
  短程任务直接使用流程契约和 Context 层:
@@ -22,7 +22,7 @@ jobs:
22
22
  harness:
23
23
  runs-on: ubuntu-latest
24
24
  steps:
25
- - uses: actions/checkout@v6
25
+ - uses: actions/checkout@v7
26
26
  with:
27
27
  fetch-depth: 0
28
28
  - uses: actions/setup-node@v6
@@ -62,9 +62,9 @@ The runtime effect is one temporary Codex Goal workflow that combines:
62
62
  - Three upstream authorities: Product / Architecture Source, Technical Realization Plan and Acceptance Checklist.
63
63
  - Workflow entry artifacts: `workflow-protocol.md`, `execution-binding.md` and `goal-objective.txt`.
64
64
  - Official Superpowers execution layer: `superpowers:subagent-driven-development`, `superpowers:executing-plans`, `superpowers:test-driven-development` and `superpowers:verification-before-completion`.
65
- - State and audit kernel: `task-state.json`, `events.ndjson`, generated `derived/**`, `task-state.evidence[]`, and slice / epoch / final gates.
65
+ - State and audit kernel: `task-state.json`, `events.ndjson`, generated `derived/**`, `task-state.evidence[]`, assertion results / negative evidence scans, and slice / epoch / final gates.
66
66
 
67
- This Skill is not the Tiny Context Workflow Contract itself, not a business fact source, not a normal target-mode prompt generator, and not a Superpowers fork. Superpowers manages efficient implementation execution; Tiny Context gates check source authority, plan conformance, acceptance evidence, state consistency and final completion.
67
+ This Skill is not the Tiny Context Workflow Contract itself, not a business fact source, not a normal target-mode prompt generator, and not a Superpowers fork. Superpowers manages efficient implementation execution; Tiny Context gates check source authority, plan conformance, assertion-backed acceptance evidence, state consistency and final completion.
68
68
 
69
69
  ## Required Three-Input Packet
70
70
 
@@ -95,6 +95,7 @@ Strict input grammar:
95
95
  - `events.ndjson` is append-only.
96
96
  - `derived/**` is generated and must not be hand-edited as authority.
97
97
  - State, generated views, validator output and auditor reports cannot narrow, rewrite or replace the upstream sources.
98
+ - Machine-verifiable proof layers require passed assertion reports and no negative evidence contradiction; derived matrix/verdict rows can summarize those results but cannot replace them.
98
99
 
99
100
  Capability-first delivery boundaries stay inside the same three inputs. Source, PI items and ACs must distinguish reusable system capability build, representative sample validation, full population operation and out-of-scope backlog. `scope_conflict_requires_decision` blocks completion.
100
101
 
@@ -162,6 +163,7 @@ Superpowers review and verification remain useful execution checks, but they can
162
163
  - `execution-binding.md` as task binding.
163
164
  - `product_goal_complete` only by final gate.
164
165
  - `audit_task_complete` not equal to product acceptance.
166
+ - assertion-backed machine-verifiable proof layers and negative evidence scan.
165
167
  - forbidden shortcuts.
166
168
  - blocker protocol.
167
169
 
@@ -169,6 +171,8 @@ Superpowers review and verification remain useful execution checks, but they can
169
171
 
170
172
  Agents must not hand-set `product_goal_complete`. Implementation / execution goals complete only when final gate computes `product_goal_complete=true`.
171
173
 
174
+ For UI/browser/API/runtime/worker/data/integration/security/test/all-provider/cleanup proof layers, do not mark ACs complete from screenshots, final cards, validator passes, matrix/verdict rows or prose evidence. Required machine-verifiable layers need passed `assertion_result`, zero command/assertion exit codes, target AC/layer coverage, passed positive and negative assertions and no failed/stale `negative_evidence_scan`.
175
+
172
176
  If `audit_task_complete` is true but `acceptance_target_status` is not complete, report:
173
177
 
174
178
  ```text
@@ -195,6 +199,8 @@ Do not treat Superpowers review as plan conformance or AC acceptance.
195
199
 
196
200
  Do not treat sample evidence as full-population proof.
197
201
 
202
+ Do not treat screenshots, final cards, validator passes, matrix/verdict rows or prose as proof for machine-verifiable layers without assertion-backed evidence.
203
+
198
204
  Do not continue claiming full implementation when `Context Delta: required` is unresolved.
199
205
 
200
206
  Do not claim full alignment while Source-to-Context Coverage or Context-to-Implementation Binding has unresolved gaps.
@@ -29,3 +29,5 @@ required_commands:
29
29
  completion_gate:
30
30
  product_goal_complete_source: final_gate
31
31
  cannot_hand_set_product_goal_complete: true
32
+ includes_ac_evidence_assertion_gate: true
33
+ includes_negative_evidence_scan_gate: true
@@ -11,12 +11,16 @@ First read and obey:
11
11
  Persistent contract:
12
12
  Product / Architecture Source owns intent, scope and boundaries. Technical Realization Plan owns PI implementation and plan conformance. Acceptance Checklist owns AC completion semantics and proof layers. task-state.json is the only execution state source; events.ndjson is append-only; derived/** is generated and must not be hand-edited as authority.
13
13
 
14
- Use workflow-protocol.md to combine Tiny Context gates with official Superpowers execution. Do not redefine, duplicate or fork Superpowers mechanics. Prefer superpowers:subagent-driven-development when subagents are available, otherwise use superpowers:executing-plans. Use TDD for behavior gaps and superpowers:verification-before-completion before completion claims.
14
+ Use workflow-protocol.md to combine Tiny Context gates with official Superpowers execution. It is not business Context and must not be registered in project_context/context.toml. Do not redefine, duplicate or fork Superpowers mechanics. Prefer superpowers:subagent-driven-development when subagents are available, otherwise use superpowers:executing-plans. Use TDD for behavior gaps and superpowers:verification-before-completion before completion claims.
15
15
 
16
16
  Work in slices. Each slice must update state through slice-delta.json, canonical evidence records, derive, and slice-gate. Run epoch-gate for shared provider/browser/runtime/security proof environments. Preserve Context Delta, plan conformance, acceptance proof layers, redaction, reviewability and sample/full-population boundaries.
17
17
 
18
+ Forbidden shortcuts:
19
+ Do not mark UI/runtime/API/data/integration/test ACs complete from screenshots, final cards, validator passes, matrix/verdict rows or prose. Required machine-verifiable layers need assertion_result.status=passed, zero command/assertion exit codes, target AC/layer coverage, passed positive and negative assertions, reviewable artifacts and no failed/stale negative_evidence_scan.
20
+ Tests alone do not prove plan conformance. Superpowers review does not override Tiny Context gates. Sample evidence does not prove full population unless AC allows. Manual edits under derived/** are not authority. Local audit cannot mark final completion. Do not claim full implementation while Context Delta is required but Context is not updated, or while Source-to-Context Coverage / Context-to-Implementation Binding has unresolved required gaps.
21
+
18
22
  Completion:
19
- Do not hand-set product_goal_complete. Only complete after derive, verification-before-completion, validate-superpowers-state, validate-plan-acceptance, auditor/stale-overclaim checks when applicable, and final-gate compute product_goal_complete=true. If audit_task_complete is true but acceptance_target_status is not complete, report "Audit workflow completed; acceptance target not complete." and continue or stop with blockers; do not say Goal achieved.
23
+ Do not hand-set product_goal_complete. Only complete after derive, verification-before-completion, validate-superpowers-state, validate-plan-acceptance, auditor/stale-overclaim checks when applicable, AC Evidence Assertion Gate, Negative Evidence Scan Gate, and final-gate compute product_goal_complete=true. If audit_task_complete is true but acceptance_target_status is not complete, report "Audit workflow completed; acceptance target not complete." and continue or stop with blockers; do not say Goal achieved.
20
24
 
21
25
  Blocked:
22
26
  Maximize safe autonomous progress using repo tools, local app/browser sessions, CLI auth and authorized elevation. Stop only for locally unsatisfiable blockers such as MFA, missing permission, external approval or unavailable credentials, and return the minimal user action list plus next agent step.
@@ -35,11 +35,13 @@ Implementation advances through coherent slices. Each slice selects related PI /
35
35
 
36
36
  ## Evidence Protocol
37
37
 
38
- Evidence is canonical state, not prose. Every proof record enters `task-state.evidence[]` with evidence id, slice id, type, command or artifact paths, `proves`, `does_not_prove`, freshness, redaction and reviewability / reproduction data. Evidence must be fresh, reviewable and free of secrets, raw credentials, tokens, cookies and long raw payloads.
38
+ Evidence is canonical state, not prose. Every proof record enters `task-state.evidence[]` with evidence id, slice id, type, command or artifact paths, command exit code when applicable, `proves`, `does_not_prove`, freshness, redaction, reviewability / reproduction data and, for machine-verifiable layers, an `assertion_result`. Evidence must be fresh, reviewable and free of secrets, raw credentials, tokens, cookies and long raw payloads.
39
+
40
+ Machine-verifiable layers such as `ui_browser`, `api_schema`, `runtime`, `worker_runtime`, `data_artifact`, `integration`, `security_redaction`, `test`, `all_provider_all_runner` and `cleanup_stale_scan` are not complete from descriptions, screenshots, final cards, validator passes, matrix rows or verdict rows. They require `assertion_result.schema_version=assertion-result-v1`, `assertion_result.status=passed`, assertion exit code `0`, command exit code `0` when present, target AC/layer coverage, passed positive and negative assertions and reviewable artifacts. UI/browser layers also require owner surface, route/path, user action, browser/playwright/UI assertion evidence and a passed `negative_evidence_scan`.
39
41
 
40
42
  ## Derived Views
41
43
 
42
- `derived/**` contains generated reading views only: local audit, plan-conformance matrix, final acceptance verdict, progress ledger, evidence index, context alignment and final summary. These files help recovery and review, but never rewrite Product / Architecture Source, Technical Realization Plan, Acceptance Checklist or `task-state.json`.
44
+ `derived/**` contains generated reading views only: local audit, plan-conformance matrix, final acceptance verdict, progress ledger, evidence index, context alignment and final summary. Matrix and verdict views may summarize `assertion_status`, blocking assertion failures and negative evidence findings, but they never replace assertion execution and never rewrite Product / Architecture Source, Technical Realization Plan, Acceptance Checklist or `task-state.json`.
43
45
 
44
46
  ## Gates
45
47
 
@@ -67,11 +69,11 @@ Final completion always runs in fixed order: derive all views, run `superpowers:
67
69
 
68
70
  ## Forbidden Shortcuts
69
71
 
70
- Tests alone do not prove plan conformance. Superpowers review does not prove AC acceptance. Sample evidence does not prove full population unless the AC allows it. Derived files, local audit, validator output and auditor reports cannot rewrite Product / Plan / Checklist. Local audit cannot mark product completion. Agents must not handwrite `product_goal_complete`.
72
+ Tests alone do not prove plan conformance. Superpowers review does not prove AC acceptance. Sample evidence does not prove full population unless the AC allows it. Browser screenshots, final cards, validator passes, matrix/verdict rows and prose evidence are auxiliary only for machine-verifiable ACs unless a passed assertion report is bound to the target AC/layer. Derived files, local audit, validator output and auditor reports cannot rewrite Product / Plan / Checklist. Local audit cannot mark product completion. Agents must not handwrite `product_goal_complete`.
71
73
 
72
74
  ## Hallucination Guard
73
75
 
74
- The protocol must prevent false fusion: do not interpret the composite workflow as the Tiny Context Workflow Contract itself; do not register `workflow-protocol.md` in `project_context/context.toml`; do not treat it as a business fact source; do not use local audit, tests, Superpowers review, sampled evidence or final-gate failure as product completion; do not claim full alignment with unresolved Source-to-Context Coverage or Context-to-Implementation Binding gaps; and do not call a Codex implementation Goal complete before final-gate passes.
76
+ The protocol must prevent false fusion: do not interpret the composite workflow as the Tiny Context Workflow Contract itself; do not register `workflow-protocol.md` in `project_context/context.toml`; do not treat it as a business fact source; do not use local audit, tests, Superpowers review, sampled evidence, screenshots, final cards, matrix/verdict rows, validator passes or final-gate failure as product completion; do not claim full alignment with unresolved Source-to-Context Coverage or Context-to-Implementation Binding gaps; and do not call a Codex implementation Goal complete before final-gate passes.
75
77
 
76
78
  ## Blocker Protocol
77
79
 
@@ -374,6 +376,8 @@ Slice gate checks:
374
376
  ```text
375
377
  - whether the slice closed a real PI/AC/proof-layer gap;
376
378
  - whether fresh reviewable evidence exists;
379
+ - whether required machine-verifiable proof layers have passed assertion results;
380
+ - whether negative evidence findings invalidate the layer or AC;
377
381
  - whether evidence entered task-state.evidence[];
378
382
  - whether closed_layers are actually proved;
379
383
  - whether remaining_layers were not falsely closed;
@@ -440,16 +444,21 @@ AC completion requires:
440
444
  1. Every required proof layer has fresh reviewable evidence.
441
445
  2. evidence.proves explicitly covers that layer.
442
446
  3. evidence.does_not_prove does not expose a scope substitution problem.
443
- 4. No missing required layers.
444
- 5. No material drift.
445
- 6. No stale artifact.
446
- 7. No raw secret/token/cookie/payload leak.
447
- 8. No sibling surface / sample object / mock substitution for owner surface or full population.
448
- 9. When full_population_required=true, sample evidence cannot replace full-population evidence.
447
+ 4. Machine-verifiable required layers have assertion_result.status=passed and exit code 0.
448
+ 5. Positive and negative assertions passed for the target AC/layer.
449
+ 6. Negative evidence scan has no forbidden owner-surface state.
450
+ 7. No missing required layers.
451
+ 8. No material drift.
452
+ 9. No stale artifact.
453
+ 10. No raw secret/token/cookie/payload leak.
454
+ 11. No sibling surface / sample object / mock substitution for owner surface or full population.
455
+ 12. When full_population_required=true, sample evidence cannot replace full-population evidence.
449
456
  ```
450
457
 
451
458
  This gate enables an external reviewer to follow the evidence chain. Auditor subagents may find gaps but are not proof sources.
452
459
 
460
+ Invalid evidence for UI/browser AC completion includes screenshot-only proof, component screenshots, storybook pages, viewmodels, mocks, unit-only proof, API-only proof, diagnostic pages, final cards, matrix/verdict rows, validator passes and prose summaries. Forbidden final owner-surface states such as `未验证`, `不可用`, `暂不可用` or `页面无明显变化` invalidate the relevant AC/layer.
461
+
453
462
  ## 12. Phase Eleven: Delivery Scope And Full Population Stay Separate
454
463
 
455
464
  The workflow always distinguishes:
@@ -469,6 +478,7 @@ Typical forbidden claims:
469
478
  - several objects succeeded does not mean automation capability complete;
470
479
  - sample provider succeeded does not mean all-provider complete;
471
480
  - UI screenshot exists does not mean owner surface primary path is closed;
481
+ - final card, matrix, verdict or validator pass does not mean a machine-verifiable AC has assertion-backed evidence;
472
482
  - tests passed does not mean AC accepted;
473
483
  - local audit passed does not mean product_goal_complete.
474
484
  ```
@@ -492,7 +502,8 @@ Before final completion, the order is fixed:
492
502
  4. ty-context validate-plan-acceptance <workdir>
493
503
  5. read-only auditor / stale-overclaim scan when applicable
494
504
  6. if auditor findings changed state/evidence, derive and validate again
495
- 7. ty-context composite-long-task final-gate <workdir>
505
+ 7. AC Evidence Assertion Gate and Negative Evidence Scan Gate
506
+ 8. ty-context composite-long-task final-gate <workdir>
496
507
  ```
497
508
 
498
509
  Legacy/internal compatibility may exist as:
@@ -26,10 +26,10 @@ export async function renderCompositeLongTaskGoal(workdir) {
26
26
  ].join("\n") + "\n";
27
27
  const protocolPath = path.join(resolvedWorkdir, "workflow-protocol.md");
28
28
  await writeTextIfChanged(protocolPath, protocolSnapshot);
29
- const executionBinding = renderExecutionBinding(resolvedWorkdir, protocolSha256);
29
+ const executionBinding = await renderExecutionBinding(resolvedWorkdir, protocolSha256);
30
30
  const executionBindingPath = path.join(resolvedWorkdir, "execution-binding.md");
31
31
  await writeTextIfChanged(executionBindingPath, executionBinding);
32
- const goalObjective = renderGoalObjective(workdirForPrompt(resolvedWorkdir));
32
+ const goalObjective = await renderGoalObjective(workdirForPrompt(resolvedWorkdir));
33
33
  if (goalObjective.length > 3850) {
34
34
  throw new Error(`goal-objective.txt exceeds 3850 characters (${goalObjective.length})`);
35
35
  }
@@ -65,67 +65,16 @@ async function assertReadyWorkdir(workdir) {
65
65
  throw new Error("render-goal requires compiled task-state.json; run ty-context composite-long-task compile before render-goal");
66
66
  }
67
67
  }
68
- function renderExecutionBinding(workdir, protocolSha256) {
69
- return `# Composite Long-Task Execution Binding
70
-
71
- workdir: ${path.normalize(workdir)}
72
- protocol: workflow-protocol.md
73
- protocol_sha256: ${protocolSha256}
74
- goal_objective: goal-objective.txt
75
-
76
- authorities:
77
- product_architecture_source: product-architecture-source.md
78
- technical_realization_plan: technical-realization-plan.md
79
- acceptance_checklist: acceptance-checklist.md
80
-
81
- canonical_state:
82
- task_state: task-state.json
83
- events: events.ndjson
84
- derived_dir: derived/
85
-
86
- required_commands:
87
- init: ty-context composite-long-task init <workdir>
88
- compile: ty-context composite-long-task compile <workdir>
89
- derive: ty-context composite-long-task derive <workdir>
90
- apply_slice_delta: ty-context composite-long-task apply-slice-delta <workdir> <slice-delta.json>
91
- slice_gate: ty-context composite-long-task slice-gate <workdir> --slice <id>
92
- epoch_gate: ty-context composite-long-task epoch-gate <workdir> --epoch <id>
93
- state_validator: ty-context validate-superpowers-state <workdir>
94
- acceptance_validator: ty-context validate-plan-acceptance <workdir>
95
- final_gate: ty-context composite-long-task final-gate <workdir>
96
-
97
- completion_gate:
98
- product_goal_complete_source: final_gate
99
- cannot_hand_set_product_goal_complete: true
100
- `;
68
+ async function renderExecutionBinding(workdir, protocolSha256) {
69
+ return renderTemplateAsset(["skills", "composite-long-task-workflow", "assets", "execution-binding.template.md"], {
70
+ workdir: path.normalize(workdir),
71
+ protocol_sha256: protocolSha256
72
+ });
101
73
  }
102
- function renderGoalObjective(workdir) {
103
- return `/goal Execute the composite long-task workflow in ${workdir}.
104
-
105
- First read and obey:
106
- - workflow-protocol.md
107
- - execution-binding.md
108
- - product-architecture-source.md
109
- - technical-realization-plan.md
110
- - acceptance-checklist.md
111
- - task-state.json and generated derived/** views
112
-
113
- Persistent contract:
114
- Product / Architecture Source owns intent, scope and boundaries. Technical Realization Plan owns PI implementation and plan conformance. Acceptance Checklist owns AC completion semantics and proof layers. task-state.json is the only execution state source; events.ndjson is append-only; derived/** is generated and must not be hand-edited as authority.
115
-
116
- Use workflow-protocol.md to combine Tiny Context gates with official Superpowers execution. It is not business Context and must not be registered in project_context/context.toml. Do not redefine, duplicate or fork Superpowers mechanics. Prefer superpowers:subagent-driven-development when subagents are available, otherwise use superpowers:executing-plans. Use TDD for behavior gaps and superpowers:verification-before-completion before completion claims.
117
-
118
- Work in slices. Each slice must update state through slice-delta.json, canonical evidence records, derive, and slice-gate. Run epoch-gate for shared provider/browser/runtime/security proof environments. Preserve Context Delta, plan conformance, acceptance proof layers, redaction, reviewability and sample/full-population boundaries.
119
-
120
- Forbidden shortcuts:
121
- Tests alone do not prove plan conformance. Superpowers review does not override Tiny Context gates. Sample evidence does not prove full population unless AC allows. Manual edits under derived/** are not authority. Local audit cannot mark final completion. Do not claim full implementation while Context Delta is required but Context is not updated, or while Source-to-Context Coverage / Context-to-Implementation Binding has unresolved required gaps.
122
-
123
- Completion:
124
- Do not hand-set product_goal_complete. Only complete after derive, verification-before-completion, validate-superpowers-state, validate-plan-acceptance, auditor/stale-overclaim checks when applicable, and final-gate compute product_goal_complete=true. If audit_task_complete is true but acceptance_target_status is not complete, report "Audit workflow completed; acceptance target not complete." and continue or stop with blockers; do not say Goal achieved.
125
-
126
- Blocked:
127
- Maximize safe autonomous progress using repo tools, local app/browser sessions, CLI auth and authorized elevation. Stop only for locally unsatisfiable blockers such as MFA, missing permission, external approval or unavailable credentials, and return the minimal user action list plus next agent step.
128
- `;
74
+ async function renderGoalObjective(workdir) {
75
+ return renderTemplateAsset(["skills", "composite-long-task-workflow", "assets", "goal-objective.template.md"], {
76
+ workdir
77
+ });
129
78
  }
130
79
  async function packageVersion() {
131
80
  const packageJson = JSON.parse(await readText(path.join(packageRoot(), "package.json")));
@@ -145,6 +94,13 @@ function normalizeNewlines(value) {
145
94
  function ensureTrailingNewline(value) {
146
95
  return `${value.trimEnd()}\n`;
147
96
  }
97
+ async function renderTemplateAsset(segments, values) {
98
+ let rendered = normalizeNewlines(await readText(packageAssetPath(...segments)));
99
+ for (const [key, value] of Object.entries(values)) {
100
+ rendered = rendered.replaceAll(`{{${key}}}`, value);
101
+ }
102
+ return ensureTrailingNewline(rendered);
103
+ }
148
104
  function sha256(value) {
149
105
  return createHash("sha256").update(value).digest("hex");
150
106
  }
@@ -0,0 +1,3 @@
1
+ import { type AssertionResult, type NegativeEvidenceScan } from "./superpowers-task-state-schema.js";
2
+ export declare function normalizeAssertionResult(value: unknown): AssertionResult | undefined;
3
+ export declare function normalizeNegativeEvidenceScan(value: unknown): NegativeEvidenceScan | undefined;
@@ -0,0 +1,67 @@
1
+ import { isRecord } from "./superpowers-task-state-schema.js";
2
+ export function normalizeAssertionResult(value) {
3
+ if (!isRecord(value)) {
4
+ return undefined;
5
+ }
6
+ return {
7
+ schema_version: String(value.schema_version ?? ""),
8
+ status: String(value.status ?? ""),
9
+ runner: String(value.runner ?? ""),
10
+ exit_code: numberValue(value.exit_code),
11
+ target_ac_ids: stringArray(value.target_ac_ids),
12
+ target_proof_layers: stringArray(value.target_proof_layers),
13
+ owner_surface: value.owner_surface === undefined ? undefined : String(value.owner_surface),
14
+ route: value.route === undefined ? undefined : String(value.route),
15
+ action: value.action === undefined ? undefined : String(value.action),
16
+ positive_assertions: checkArray(value.positive_assertions),
17
+ negative_assertions: checkArray(value.negative_assertions),
18
+ artifacts: stringArray(value.artifacts)
19
+ };
20
+ }
21
+ export function normalizeNegativeEvidenceScan(value) {
22
+ if (!isRecord(value)) {
23
+ return undefined;
24
+ }
25
+ return {
26
+ schema_version: String(value.schema_version ?? ""),
27
+ status: String(value.status ?? ""),
28
+ target_ac_ids: stringArray(value.target_ac_ids),
29
+ owner_surface: value.owner_surface === undefined ? undefined : String(value.owner_surface),
30
+ route: value.route === undefined ? undefined : String(value.route),
31
+ forbidden_findings: findingArray(value.forbidden_findings),
32
+ required_findings: checkArray(value.required_findings),
33
+ artifacts: stringArray(value.artifacts)
34
+ };
35
+ }
36
+ function checkArray(value) {
37
+ if (!Array.isArray(value)) {
38
+ return [];
39
+ }
40
+ return value.filter(isRecord).map((item) => ({
41
+ id: String(item.id ?? ""),
42
+ status: String(item.status ?? ""),
43
+ actual: item.actual === undefined ? undefined : String(item.actual),
44
+ expected: item.expected === undefined ? undefined : String(item.expected),
45
+ forbidden_text: item.forbidden_text === undefined ? undefined : String(item.forbidden_text)
46
+ }));
47
+ }
48
+ function findingArray(value) {
49
+ if (!Array.isArray(value)) {
50
+ return [];
51
+ }
52
+ return value.filter(isRecord).map((item) => ({
53
+ id: String(item.id ?? ""),
54
+ status: String(item.status ?? ""),
55
+ forbidden_text: item.forbidden_text === undefined ? undefined : String(item.forbidden_text),
56
+ actual: item.actual === undefined ? undefined : String(item.actual)
57
+ }));
58
+ }
59
+ function stringArray(value) {
60
+ if (!Array.isArray(value)) {
61
+ return [];
62
+ }
63
+ return value.map((item) => String(item)).filter(Boolean);
64
+ }
65
+ function numberValue(value) {
66
+ return typeof value === "number" && Number.isFinite(value) ? value : Number.NaN;
67
+ }