project-tiny-context-harness 0.8.0 → 0.8.2

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 (119) hide show
  1. package/README.md +40 -32
  2. package/assets/README.md +141 -60
  3. package/assets/README.zh-CN.md +48 -40
  4. package/assets/agents/AGENTS_CORE.md +16 -12
  5. package/assets/context_templates/architecture.md +5 -5
  6. package/assets/context_templates/area.md +5 -5
  7. package/assets/context_templates/global.md +6 -6
  8. package/assets/context_templates/screen-contract.md +18 -18
  9. package/assets/github/harness.yml +2 -2
  10. package/assets/skills/context_development_engineer/SKILL.md +7 -5
  11. package/assets/skills/context_full_project_export/SKILL.md +42 -42
  12. package/assets/skills/context_uiux_design/SKILL.md +27 -13
  13. package/assets/skills/design-resource-authoring/SKILL.md +7 -7
  14. package/assets/skills/design-resource-authoring/references/downstream-handoff.md +12 -12
  15. package/assets/skills/design-resource-authoring/references/open-design-provider.md +21 -21
  16. package/assets/skills/design-resource-authoring/references/resource-selection.md +3 -3
  17. package/assets/skills/long-task-workflow/SKILL.md +17 -17
  18. package/assets/skills/long-task-workflow/agents/openai.yaml +4 -4
  19. package/assets/skills/long-task-workflow/references/authority-lifecycle.md +11 -9
  20. package/assets/skills/long-task-workflow/references/contract-authoring.md +19 -15
  21. package/assets/skills/long-task-workflow/references/evidence-design.md +18 -17
  22. package/assets/skills/long-task-workflow/references/source-authoring.md +15 -12
  23. package/assets/skills/normal-long-task/SKILL.md +12 -12
  24. package/dist/commands/design-resource.js +2 -2
  25. package/dist/commands/index.js +26 -26
  26. package/dist/commands/long-task-authoring.js +83 -9
  27. package/dist/commands/long-task.js +15 -15
  28. package/dist/lib/context-graph-snapshot.js +7 -0
  29. package/dist/lib/design-md.js +5 -4
  30. package/dist/lib/design-resource-handoff-shape-evidence.js +3 -0
  31. package/dist/lib/design-resource-handoff-shape-primitives.js +1 -3
  32. package/dist/lib/design-resource-handoff-types.d.ts +2 -0
  33. package/dist/lib/design-resource-handoff-validation-coverage.js +1 -0
  34. package/dist/lib/design-resource-handoff-validation-structure.js +2 -0
  35. package/dist/lib/doctor.js +2 -2
  36. package/dist/lib/execution-target-capabilities.d.ts +2 -0
  37. package/dist/lib/execution-target-capabilities.js +31 -0
  38. package/dist/lib/long-task-acceptance-shape.js +81 -20
  39. package/dist/lib/long-task-applicability-shape.d.ts +4 -0
  40. package/dist/lib/long-task-applicability-shape.js +54 -0
  41. package/dist/lib/long-task-assertions-v2.js +8 -0
  42. package/dist/lib/long-task-authoring-preflight-diagnostics.js +5 -0
  43. package/dist/lib/long-task-authoring-preflight-repair-order.js +3 -0
  44. package/dist/lib/long-task-authoring-preflight.js +12 -8
  45. package/dist/lib/long-task-authority-materials.js +46 -4
  46. package/dist/lib/long-task-authority-policy.d.ts +54 -0
  47. package/dist/lib/long-task-authority-policy.js +61 -0
  48. package/dist/lib/long-task-authority-types.d.ts +12 -2
  49. package/dist/lib/long-task-authority.js +9 -2
  50. package/dist/lib/long-task-check-shape.js +6 -1
  51. package/dist/lib/long-task-claim-definitions.js +27 -42
  52. package/dist/lib/long-task-claims.js +275 -146
  53. package/dist/lib/long-task-contract-types.d.ts +42 -8
  54. package/dist/lib/long-task-control-fields.d.ts +12 -0
  55. package/dist/lib/long-task-control-fields.js +66 -0
  56. package/dist/lib/long-task-control-types.d.ts +1 -0
  57. package/dist/lib/long-task-control-types.js +1 -0
  58. package/dist/lib/long-task-counterfactual-claim-policy.js +7 -0
  59. package/dist/lib/long-task-counterfactual-sandbox.js +1 -2
  60. package/dist/lib/long-task-counterfactual-types.d.ts +12 -0
  61. package/dist/lib/long-task-delivery-compiler.js +1 -0
  62. package/dist/lib/long-task-delivery-preflight.js +24 -0
  63. package/dist/lib/long-task-delivery-shape.d.ts +1 -0
  64. package/dist/lib/long-task-delivery-shape.js +1 -0
  65. package/dist/lib/long-task-delivery-types.d.ts +1 -0
  66. package/dist/lib/long-task-delivery-types.js +1 -0
  67. package/dist/lib/long-task-delivery-validation.js +46 -0
  68. package/dist/lib/long-task-design-resource-handoff.js +48 -7
  69. package/dist/lib/long-task-evidence-capability-codec.js +37 -0
  70. package/dist/lib/long-task-evidence-capability-policy.js +80 -38
  71. package/dist/lib/long-task-evidence-capability-runtime.js +36 -0
  72. package/dist/lib/long-task-evidence-capability-types.d.ts +13 -1
  73. package/dist/lib/long-task-evidence-findings.js +3 -0
  74. package/dist/lib/long-task-evidence-sensitivity-policy.js +38 -0
  75. package/dist/lib/long-task-evidence-v2.js +7 -1
  76. package/dist/lib/long-task-final-integrity.d.ts +16 -0
  77. package/dist/lib/long-task-final-integrity.js +98 -0
  78. package/dist/lib/long-task-final-v2.js +17 -34
  79. package/dist/lib/long-task-outcome-parser.js +22 -4
  80. package/dist/lib/long-task-playwright-case-evidence.d.ts +2 -0
  81. package/dist/lib/long-task-playwright-case-evidence.js +10 -2
  82. package/dist/lib/long-task-playwright-evidence.d.ts +1 -0
  83. package/dist/lib/long-task-playwright-evidence.js +32 -0
  84. package/dist/lib/long-task-product-shape.d.ts +3 -1
  85. package/dist/lib/long-task-product-shape.js +100 -4
  86. package/dist/lib/long-task-requirement-shape.js +3 -0
  87. package/dist/lib/long-task-root-shape.js +12 -6
  88. package/dist/lib/long-task-runner-freeze.js +16 -0
  89. package/dist/lib/long-task-runtime-types.d.ts +11 -2
  90. package/dist/lib/long-task-semantic-assurance-policy.d.ts +4 -0
  91. package/dist/lib/long-task-semantic-assurance-policy.js +52 -0
  92. package/dist/lib/long-task-semantic-contract-types.d.ts +18 -1
  93. package/dist/lib/long-task-semantic-drift-migration.js +33 -2
  94. package/dist/lib/long-task-semantic-mutation.d.ts +7 -0
  95. package/dist/lib/long-task-semantic-mutation.js +81 -0
  96. package/dist/lib/long-task-shape-primitives.d.ts +1 -1
  97. package/dist/lib/long-task-shape-primitives.js +1 -0
  98. package/dist/lib/long-task-source-authority-types.d.ts +2 -0
  99. package/dist/lib/long-task-source-item-parser.d.ts +1 -1
  100. package/dist/lib/long-task-source-item-parser.js +150 -104
  101. package/dist/lib/long-task-source-markers.d.ts +12 -0
  102. package/dist/lib/long-task-source-markers.js +146 -0
  103. package/dist/lib/long-task-source-target-continuity.d.ts +1 -1
  104. package/dist/lib/long-task-source-target-continuity.js +80 -55
  105. package/dist/lib/long-task-source-target-index.js +7 -29
  106. package/dist/lib/long-task-status-v2.d.ts +1 -0
  107. package/dist/lib/long-task-status-v2.js +2 -2
  108. package/dist/lib/long-task-target-policy.js +20 -0
  109. package/dist/lib/long-task-ui-design-policy.js +27 -1
  110. package/dist/lib/long-task-ui-surface-shape.js +21 -1
  111. package/dist/lib/long-task-ui-surface-types.d.ts +7 -0
  112. package/dist/lib/long-task-verification-preview.d.ts +10 -0
  113. package/dist/lib/long-task-verifier-dependency-closure.d.ts +3 -0
  114. package/dist/lib/long-task-verifier-dependency-closure.js +179 -0
  115. package/dist/lib/long-task-verifier-v2.js +12 -2
  116. package/dist/lib/long-task-workspace.js +5 -1
  117. package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +99 -25
  118. package/migrations/README.md +8 -8
  119. package/package.json +84 -84
@@ -11,9 +11,9 @@ Do not create a Source Plan schema, CLI, Preflight, Compile, Receipt, cache, aut
11
11
  ## Input inventory
12
12
 
13
13
  1. Assign every proposal, selected design resource, screenshot, document, diagram, table and other attachment a stable input ID.
14
- 2. Inspect all material pages/frames/screens/tables/visible states; never silently sample a multi-part artifact.
15
- 3. Classify each input as user instruction, product requirement, technical constraint, existing proposal, selected target, repository/Context evidence, constraint, inspiration or background.
16
- 4. For visual resources, preserve selection basis, classification (`exact-target`, `constraint` or `inspiration`), stable resource/surface/control/state/target keys, declared platform/viewport/mode/state/content applicability, source profile/canonical entry/dependency set, provider/project/run/entry provenance and immutable digest/snapshot, plus typed locators. A mutable link, metadata-only response, partial file set or prose locator is incomplete. Unselected candidates authorize no fidelity.
14
+ 2. Inspect all pages/frames/screens/tables/visible states; never silently sample a multi-part artifact. Every non-empty line in a declared Markdown Source file must ultimately belong to exactly one Material Source Item, one keyed and reasoned non-authoritative `ty-source-background:start/end` block, or the one validated `design-resource-handoff-v1` formal block.
15
+ 3. Classify each input as user instruction, product requirement, technical constraint, existing proposal, selected target, repository/Context evidence, constraint, inspiration or background. Background is a closed grammar: `markdown-structure` contains only text-free anchors or horizontal rules, and `provenance` contains only `ty-source-provenance input=<key> mode=<direct|derived|delegated|evidence-backed> [source=<key>] [sha256=<64-lowercase-hex>]` comments; non-direct modes require `source`. Text-bearing headings, free-form provenance and explanatory prose are material or unclassified even when intended as non-authoritative; background must never hide a qualifier, requirement, acceptance fact, architecture meaning, design meaning or other delivery authority.
16
+ 4. For visual resources, preserve selection basis, classification (`exact-target`, `constraint` or `inspiration`), stable resource/surface/control/state/target keys, declared platform/viewport/mode/state/content applicability, source profile/canonical entry/dependency set, provider/project/run/entry provenance and immutable digest/snapshot, plus typed locators. A mutable link, metadata-only response, partial file set or prose locator is incomplete. Unselected candidates authorize no fidelity.
17
17
  5. Record incorporated meaning and every unreadable, conflicting or intentionally unused part. Higher authority and user-stated precedence win; unresolved conflicts remain decisions.
18
18
 
19
19
  ## Preference and research gate
@@ -68,13 +68,15 @@ Use only applicable semantic types:
68
68
 
69
69
  ## UI and control completeness
70
70
 
71
- For each in-scope surface, record purpose, entry/exit/navigation, regions/overlays and included Control keys. For every material interactive control, independently preserve applicable:
71
+ For each in-scope surface, record purpose, entry/exit/navigation, regions/overlays and included Control keys. For every real material interactive Control, close every canonical field independently:
72
72
 
73
- `surface`, `region`, `control type`, `label/content`, `location`, `user task`, `visibility`, `availability`, `trigger`, `input`, `validation`, `default`, `interaction`, `navigation/result`, `loading`, `empty`, `success`, `failure`, `recovery`, `permission`, `feedback` and `accessibility`.
73
+ `surface`, `region`, `location`, `control type`, `label/content`, `user task`, `visibility`, `availability`, `trigger`, `input`, `validation`, `default`, `interaction`, `navigation/result`, `loading`, `empty`, `success`, `failure`, `recovery`, `permission`, `feedback` and `accessibility`.
74
+
75
+ For each field record concrete `specified` meaning, an explicit justified `not_applicable` statement, or blocking `unresolved`; omission is not non-applicability. Also preserve every material cross-Control and system relation—including shared state, ordering/dependency, mutual exclusion, navigation, permission, recovery, validation and feedback chains—and explicitly close the Outcome as `not_applicable` only when no such relation exists. Each specified or not-applicable fact, including relation closure, must name its actual target, atomic condition/input/state dimensions and Given/When journey applicability.
74
76
 
75
77
  Do not invent controls for a non-interface delivery. A coarse frame or configured design system does not supply unshown states. Selected design resources and product/technical Source remain parallel: visuals cannot invent business/data/permission/algorithmic rules.
76
78
 
77
- For every selected exact/constraint target, preserve the declared platform/viewport/mode/state/content conditions and identify which surface and Control keys it governs. Separately record any design-resource acceptance blocker supplied by the Source. File identity, hashes, provider/export success, registry membership and resource counts are integrity facts only; they do not state that a production owner, real-user journey or rendered interaction conforms.
79
+ For every selected exact/constraint target, preserve the declared platform/viewport/mode/state/content conditions and identify which surface and Control keys it governs. Separately record any design-resource acceptance blocker supplied by the Source, including its exact Source items, verification methods and non-empty runtime-observation `required_capabilities`. Do not weaken a physical-device, sensor, camera, orientation, haptic, assistive-technology, pixel-density, safe-area or other target-local need into a generic browser/runtime label merely because the proxy is available. File identity, hashes, provider/export success, registry membership and resource counts are integrity facts only; they do not state that a production owner, real-user journey or rendered interaction conforms.
78
80
 
79
81
  ## Acceptance and risk
80
82
 
@@ -87,15 +89,16 @@ Use the Runtime's exact risk Fact names when marking risk. Data migration is `da
87
89
  Before Preflight/Compile confirm:
88
90
 
89
91
  1. Every material original statement and qualifier is preserved.
90
- 2. Every supplied input is incorporated or has an explicit unreadable/unused/conflict disposition.
92
+ 2. Every supplied input is incorporated or has an explicit unreadable/unused/conflict disposition, and every non-empty Source line is owned by a Material Item, closed-grammar structure/provenance background block or validated formal block.
91
93
  3. Distinct requirements and independently decidable Outcomes were not collapsed.
92
- 4. Every material UI surface/control/state is explicit or marked not applicable/unresolved.
93
- 5. Every REQ and material CTRL state has acceptance, external confirmation, decision or explicit exception.
94
+ 4. Every real Control has all 22 canonical fields closed as specified, justified not applicable or unresolved; every material cross-Control/shared-state/navigation/permission/recovery relation is specified or the Outcome explicitly declares that no such relation exists.
95
+ 5. Every REQ, specified/not-applicable CTRL field and Control relation has exact applicability plus acceptance, external confirmation, decision or explicit exception; unresolved coverage blocks.
94
96
  6. Derived/delegated/evidence-backed items have traceable basis and no hidden product expansion.
95
97
  7. Non-goals, forbidden shortcuts, risks and recovery are concrete.
96
98
  8. No unsupported number, threshold, metric or external claim appears.
97
99
  9. Selected design resources retain stable identity and exact declared coverage; candidates remain non-authoritative.
98
- 10. Every material UI surface/control can be mapped to a production target/owner, real-user entry journey and acceptance route, while every declared design blocker has an explicit machine or target-blocking external-confirmation disposition. Removing one from scope requires an explicit Source revision; Contract prose cannot waive it.
99
- 11. The Source is self-contained enough to own every mapped Draft semantic and names every still-required external artifact.
100
+ 10. Every material UI surface/control can be mapped to a production target/owner, real-user entry journey and acceptance route, while every declared design blocker has an explicit machine or target-blocking external-confirmation disposition. Removing one from scope requires an explicit Source revision; Contract prose cannot waive it.
101
+ 11. The Source is self-contained enough to own every mapped Draft semantic and names every still-required external artifact.
102
+ 12. At least one marked `technical_obligation` carries `aspect=architecture`, preserves the selected owner/dependency/debt conclusion, and maps to an independently falsifiable architecture obligation rather than only a Result Claim.
100
103
 
101
- Complete non-rendering `ty-source-item:start/end` markers in the real Markdown Source without rewriting direct text, and finish the corresponding Contract mapping in the same loop. Neither markers nor this audit delay opening the Draft; all are fail-closed convergence requirements before Preflight/Compile.
104
+ Complete non-rendering `ty-source-item:start/end` markers in the real Markdown Source without rewriting direct text, wrap only recognized Markdown structure or structured provenance in uniquely keyed and reasoned `ty-source-background:start/end` blocks, retain at most one schema-valid `design-resource-handoff-v1` formal block, and finish the corresponding Contract mapping in the same loop. Unclassified text, arbitrary prose inside background, a background block used to hide material meaning, unresolved Control coverage or missing applicability blocks Preflight/Compile. Neither markers nor this audit delay opening the Draft.
@@ -1,12 +1,12 @@
1
- ---
2
- name: normal-long-task
3
- description: Retired compatibility pointer for users who explicitly invoke /normal-long-task. Direct them to /long-task-workflow and do not create legacy checklist, prompt, audit, matrix, verdict, or plan artifacts.
4
- ---
5
-
6
- # Retired: Normal Long Task
7
-
8
- `/normal-long-task` no longer defines a second long-task artifact workflow.
9
-
10
- Use `/long-task-workflow` for one Canonical Delivery Contract, the current platform-native Goal, rolling implementation in the current workspace, targeted repair verification, a same-snapshot Final Gate and Stop freshness.
11
-
12
- Do not create a preserved-source/checklist pair, target-mode prompt, Local Audit, matrix, verdict or second plan from this compatibility invocation.
1
+ ---
2
+ name: normal-long-task
3
+ description: Retired compatibility pointer for users who explicitly invoke /normal-long-task. Direct them to /long-task-workflow and do not create legacy checklist, prompt, audit, matrix, verdict, or plan artifacts.
4
+ ---
5
+
6
+ # Retired: Normal Long Task
7
+
8
+ `/normal-long-task` no longer defines a second long-task artifact workflow.
9
+
10
+ Use `/long-task-workflow` for one Canonical Delivery Contract, the current platform-native Goal, rolling implementation in the current workspace, targeted repair verification, a same-snapshot Final Gate and Stop freshness.
11
+
12
+ Do not create a preserved-source/checklist pair, target-mode prompt, Local Audit, matrix, verdict or second plan from this compatibility invocation.
@@ -26,7 +26,7 @@ export async function designResource(args) {
26
26
  console.log(`Acceptance blockers: ${result.counts.acceptance_blockers}`);
27
27
  }
28
28
  function help() {
29
- console.log(`ty-context design-resource commands:
30
- preflight <handoff.md> [--json]
29
+ console.log(`ty-context design-resource commands:
30
+ preflight <handoff.md> [--json]
31
31
  Validate one selected implementation handoff`);
32
32
  }
@@ -36,32 +36,32 @@ export const commands = {
36
36
  package: packageSource,
37
37
  };
38
38
  export function help() {
39
- console.log(`ty-context commands:
40
- init [--adopt] [--harness-folder <path>]
41
- Initialize/adopt a project; without --harness-folder, choose target agent first
42
- enable long-task Install Long-Task Skill, Source Plan pointer, Stop Hook and templates
43
- disable long-task Remove only package-owned long-task profile assets
44
- sync Refresh managed assets; does not run migrations
45
- upgrade [--check] [--json]
46
- Run safe migrations, sync managed assets and doctor
47
- doctor Diagnose project configuration and drift
48
- check-modularity --touched|--file <path>|--base <ref> [--limit 300] [--fail-on-warning]
49
- Warn when selected handwritten source files exceed a line-count limit
50
- export-context --full|--code|--all|--source-pack|--code-index|--task-context
51
- Export temporary Context, code snapshot or bounded Source Pack artifacts
52
- validate <gate> Run a Harness validation gate
53
- validate-context Validate Minimal Context fact-source recoverability
54
- validate-code-modularity
55
- Enforce touched handwritten source file modularity
56
- validate-harness Run validate-context and validate-code-modularity
57
- design-resource <subcommand>
58
- Validate a selected design-resource implementation handoff
59
- long-task <subcommand>
60
- Manage one Canonical Delivery Contract in the current workspace
61
- delivery-set <subcommand>
62
- Retired; use one complete Contract with semantic Outcomes
63
- composite-long-task Retired command; use ty-context long-task
64
- composite-campaign Retired command; use ty-context long-task
39
+ console.log(`ty-context commands:
40
+ init [--adopt] [--harness-folder <path>]
41
+ Initialize/adopt a project; without --harness-folder, choose target agent first
42
+ enable long-task Install Long-Task Skill, Source Plan pointer, Stop Hook and templates
43
+ disable long-task Remove only package-owned long-task profile assets
44
+ sync Refresh managed assets; does not run migrations
45
+ upgrade [--check] [--json]
46
+ Run safe migrations, sync managed assets and doctor
47
+ doctor Diagnose project configuration and drift
48
+ check-modularity --touched|--file <path>|--base <ref> [--limit 300] [--fail-on-warning]
49
+ Warn when selected handwritten source files exceed a line-count limit
50
+ export-context --full|--code|--all|--source-pack|--code-index|--task-context
51
+ Export temporary Context, code snapshot or bounded Source Pack artifacts
52
+ validate <gate> Run a Harness validation gate
53
+ validate-context Validate Minimal Context fact-source recoverability
54
+ validate-code-modularity
55
+ Enforce touched handwritten source file modularity
56
+ validate-harness Run validate-context and validate-code-modularity
57
+ design-resource <subcommand>
58
+ Validate a selected design-resource implementation handoff
59
+ long-task <subcommand>
60
+ Manage one Canonical Delivery Contract in the current workspace
61
+ delivery-set <subcommand>
62
+ Retired; use one complete Contract with semantic Outcomes
63
+ composite-long-task Retired command; use ty-context long-task
64
+ composite-campaign Retired command; use ty-context long-task
65
65
  package <subcommand> Maintain package canonical source`);
66
66
  }
67
67
  async function withLongTaskProfile(args, handler) {
@@ -39,8 +39,10 @@ task:
39
39
  role: product
40
40
  runtime_family: process
41
41
  root_entrypoint: tests/replace-oracle.mjs
42
+ capabilities: [process-runtime, cold-start, production-root]
42
43
  source_paths: [plans/replace-me.md]
43
44
  context_refs: [project_context/areas/replace-me.md]
45
+ context_snapshot_mode: full
44
46
  source_claims:
45
47
  - key: replace-requirement
46
48
  source_ref: plans/replace-me.md#replace-requirement
@@ -48,6 +50,12 @@ source_claims:
48
50
  disposition:
49
51
  type: claim
50
52
  refs: [replace-outcome.requirement.replace-requirement]
53
+ - key: replace-architecture
54
+ source_ref: plans/replace-me.md#replace-architecture
55
+ statement: Preserve the declared owner, dependency direction, verifier boundary and architecture conformance.
56
+ disposition:
57
+ type: claim
58
+ refs: [replace-outcome.obligation.architecture]
51
59
  stages:
52
60
  - key: delivery
53
61
  title: Delivery
@@ -55,13 +63,22 @@ stages:
55
63
  gate_outcome: replace-outcome
56
64
  risk:
57
65
  facts: {}
58
- global: {}
66
+ global:
67
+ applicability: []
59
68
  outcomes:
60
69
  - key: replace-outcome
61
70
  title: Replace outcome
62
71
  stage: delivery
72
+ applicability:
73
+ - key: root-success
74
+ target_ref: replace-runtime
75
+ journey_role: success
76
+ dimensions: [{key: delivery-state, value: ready}]
77
+ given_refs: [source-ready]
78
+ when_refs: [inspect-result]
63
79
  product:
64
80
  observable_result: Describe what a user or system can observe.
81
+ result_applicability_refs: [root-success]
65
82
  success_path_required: true
66
83
  degradation_path_required: false
67
84
  owner:
@@ -72,7 +89,17 @@ outcomes:
72
89
  - key: replace-requirement
73
90
  statement: Preserve one atomic source requirement.
74
91
  required_proof_surfaces: [runtime_behavior]
92
+ applicability_refs: [root-success]
93
+ control_relation_closure:
94
+ state: not_applicable
95
+ statement: This Outcome declares no user-visible Controls.
96
+ applicability_refs: [root-success]
75
97
  technical:
98
+ obligations:
99
+ - key: architecture
100
+ statement: Preserve the declared owner, dependency direction, verifier boundary and architecture conformance.
101
+ required_proof_surfaces: [runtime_behavior]
102
+ applicability_refs: [root-success]
76
103
  expected_change_paths: ["src/**"]
77
104
  bindings:
78
105
  - key: replace-carrier
@@ -97,21 +124,68 @@ outcomes:
97
124
  input_paths: [src/replace-me.ts]
98
125
  expected_output_paths: [src/replace-me.ts]
99
126
  positive_assertions:
100
- - key: replace-success
101
- criterion: The declared outcome and requirement are observable.
102
- claims: [result, requirement.replace-requirement]
127
+ - key: replace-result
128
+ criterion: The declared outcome is observable.
129
+ claims: [result]
130
+ applicability_ref: root-success
103
131
  observation: result
104
132
  evidence_capabilities: [state_delta, target_runtime]
105
133
  operator: equals
106
134
  expected: true
135
+ - key: replace-requirement
136
+ criterion: The atomic Source requirement is observable.
137
+ claims: [requirement.replace-requirement]
138
+ applicability_ref: root-success
139
+ observation: requirement_result
140
+ evidence_capabilities: [state_delta, target_runtime]
141
+ operator: equals
142
+ expected: true
143
+ - key: replace-architecture
144
+ criterion: The declared architecture obligation remains conformant.
145
+ claims: [obligation.architecture]
146
+ applicability_ref: root-success
147
+ observation: architecture_result
148
+ evidence_capabilities: [state_delta, target_runtime]
149
+ operator: equals
150
+ expected: true
151
+ - key: replace-liveness
152
+ criterion: The declared target remains live under semantic mutation.
153
+ claims: []
154
+ observation: target_live
155
+ evidence_capabilities: [target_runtime]
156
+ operator: equals
157
+ expected: true
158
+ negative_assertions:
159
+ - key: replace-relations-na
160
+ criterion: Cross-Control relations remain inapplicable when no Controls are declared.
161
+ claims: [control_relation_closure]
162
+ applicability_ref: root-success
163
+ observation: relations_applicable
164
+ evidence_capabilities: [state_delta, target_runtime]
165
+ operator: equals
166
+ expected: false
107
167
  counterfactual_controls:
108
- - key: remove-replace-carrier
168
+ - key: replace-semantic-carrier
169
+ binding_key: replace-carrier
170
+ claims: [result, requirement.replace-requirement, obligation.architecture]
171
+ check_key: replace-check
172
+ mutation:
173
+ type: replace_text
174
+ path: src/replace-me.ts
175
+ match: IMPLEMENTED_STATE
176
+ replacement: SEMANTIC_FAILURE_STATE
177
+ expected_assertion_failures: [replace-result, replace-requirement, replace-architecture]
178
+ preserved_assertions: [replace-liveness]
179
+ - key: replace-relation-applicability
109
180
  binding_key: replace-carrier
110
- claims: [result, requirement.replace-requirement]
181
+ claims: [control_relation_closure]
111
182
  check_key: replace-check
112
183
  mutation:
113
- type: remove_paths
114
- paths: [src/replace-me.ts]
115
- expected_assertion_failures: [replace-success]
184
+ type: replace_text
185
+ path: src/replace-me.ts
186
+ match: NO_CROSS_CONTROL_RELATIONS
187
+ replacement: CROSS_CONTROL_RELATIONS_APPLY
188
+ expected_assertion_failures: [replace-relations-na]
189
+ preserved_assertions: [replace-liveness]
116
190
  `;
117
191
  }
@@ -124,20 +124,20 @@ async function finalGate(workdir, args) {
124
124
  process.exitCode = 1;
125
125
  }
126
126
  function help() {
127
- console.log(`ty-context long-task commands:
128
- init <workdir>
129
- preflight <workdir>
130
- compile <workdir>
131
- compile <workdir> --revise
132
- diagnose-revision <workdir> [--outcome <key>] [--check <key>]
133
- approve-authority-revision <workdir> --revision <sha>
134
- explain <workdir>
135
- verify <workdir> [--outcome <key>] [--check <key>] [--explain]
136
- status <workdir>
137
- resume <workdir>
138
- doctor <workdir>
139
- final-gate <workdir>
140
- stop-check <workdir> [--message <text>]
141
- close <workdir>
127
+ console.log(`ty-context long-task commands:
128
+ init <workdir>
129
+ preflight <workdir>
130
+ compile <workdir>
131
+ compile <workdir> --revise
132
+ diagnose-revision <workdir> [--outcome <key>] [--check <key>]
133
+ approve-authority-revision <workdir> --revision <sha>
134
+ explain <workdir>
135
+ verify <workdir> [--outcome <key>] [--check <key>] [--explain]
136
+ status <workdir>
137
+ resume <workdir>
138
+ doctor <workdir>
139
+ final-gate <workdir>
140
+ stop-check <workdir> [--message <text>]
141
+ close <workdir>
142
142
  abandon <workdir> [--force-corrupt-state]`);
143
143
  }
@@ -15,6 +15,13 @@ export async function captureContextGraphSnapshot(repositoryRoot, contextRefs, m
15
15
  const explicitlySelected = new Set();
16
16
  if (mode === "full") {
17
17
  allFiles.forEach((file) => selected.add(file));
18
+ for (const contextRef of contextRefs) {
19
+ const normalized = normalizeRepoPath(contextRef);
20
+ if (!available.has(normalized)) {
21
+ throw new Error(`context_ref_invalid:${contextRef}`);
22
+ }
23
+ explicitlySelected.add(normalized);
24
+ }
18
25
  }
19
26
  else {
20
27
  for (const required of [
@@ -124,8 +124,9 @@ function designMdTemplate() {
124
124
  "",
125
125
  "- Authored exact-value token source: not selected.",
126
126
  "- Generation direction and generated token targets: not selected.",
127
- "- Durable design references: none selected.",
128
- "- For each selected reference, record a stable id, surface/route/component, `exact-target` / `constraint` / `inspiration` interpretation, viewport/theme/state coverage, a readable immutable adopted path/URI plus digest, and the editable upstream owner/locator/update route (or an explicit manual/external-update boundary).",
127
+ "- Canonical project/system/component-family target records: none selected.",
128
+ "- Every adopted target has exactly one canonical record. Record project/system/component-family targets here; for a screen-specific target record only its stable id plus owning Screen Contract anchor.",
129
+ "- A canonical record owns interpretation, selection basis, declared condition coverage, a readable immutable adopted path/URI plus digest, and the editable upstream owner/locator/update route (or an explicit manual/external-update boundary). Do not duplicate that metadata in both `DESIGN.md` and a Screen Contract.",
129
130
  "- Relevant product/design/development work must open affected selected exact targets/constraints; an index entry alone is not resource consumption.",
130
131
  "",
131
132
  "## Colors",
@@ -141,7 +142,7 @@ function designMdTemplate() {
141
142
  "## Layout",
142
143
  "",
143
144
  "- This scaffold declares no production page composition, information hierarchy or responsive layout.",
144
- "- Put durable screen responsibility and interaction structure in `project_context/**`; reference selected visual targets in the Design Authority Index.",
145
+ "- Put durable screen responsibility, interaction structure and screen-specific canonical target records in `project_context/**`; keep project/system/component-family target records in this Design Authority Index.",
145
146
  "",
146
147
  "## Components",
147
148
  "",
@@ -161,7 +162,7 @@ function designMdTemplate() {
161
162
  "- Read this file before creating design drafts, redesigning UI, changing visual systems or implementing material production UI.",
162
163
  "- When there is a scan target such as UI source, page files, build output or a local/remote URL, run `npx impeccable detect <target>` before finalizing design changes.",
163
164
  "- Treat Impeccable findings as design-review signals: fix issues that affect clarity, consistency, accessibility or trust, and note when there is no suitable scan target.",
164
- "- After design decisions stabilize, replace the unconfigured marker, index the selected targets and authored token source/generation direction, and record durable tokens, component rules and do/don't guidance.",
165
+ "- After design decisions stabilize, replace the unconfigured marker, record the authored token source/generation direction and each selected target at its exactly-one canonical owner, and record durable tokens, component rules and do/don't guidance.",
165
166
  "- Change an adopted target through its recorded upstream route, create or approve a new immutable version/digest, and update its index entry; never overwrite the adopted baseline in place.",
166
167
  "",
167
168
  ].join("\n");
@@ -1,6 +1,7 @@
1
1
  import { DESIGN_RESOURCE_DIMENSIONS, DESIGN_RESOURCE_EVIDENCE_KINDS, DESIGN_RESOURCE_LOCATOR_KINDS, } from "./design-resource-handoff-types.js";
2
2
  import { contractKey, contractKeys, sourceItemKeys, stableKey, stableKeys, verificationMethods, } from "./design-resource-handoff-shape-primitives.js";
3
3
  import { array, literal, object, string, } from "./long-task-shape-primitives.js";
4
+ import { EXECUTION_TARGET_CAPABILITIES } from "./execution-target-capabilities.js";
4
5
  export function parseDesignResourceHandoffEvidence(value) {
5
6
  return array(value, "design_resource_handoff.evidence").map((item, index) => {
6
7
  const label = `design_resource_handoff.evidence[${index}]`;
@@ -69,6 +70,7 @@ export function parseDesignResourceHandoffBlockers(value) {
69
70
  "dimensions",
70
71
  "source_item_refs",
71
72
  "verification_methods",
73
+ "required_capabilities",
72
74
  "description",
73
75
  ]);
74
76
  return {
@@ -78,6 +80,7 @@ export function parseDesignResourceHandoffBlockers(value) {
78
80
  dimensions: array(row.dimensions, `${label}.dimensions`).map((dimension, itemIndex) => literal(dimension, DESIGN_RESOURCE_DIMENSIONS, `${label}.dimensions[${itemIndex}]`)),
79
81
  source_item_refs: sourceItemKeys(row.source_item_refs, `${label}.source_item_refs`),
80
82
  verification_methods: verificationMethods(row.verification_methods, `${label}.verification_methods`),
83
+ required_capabilities: array(row.required_capabilities, `${label}.required_capabilities`).map((capability, capabilityIndex) => literal(capability, EXECUTION_TARGET_CAPABILITIES, `${label}.required_capabilities[${capabilityIndex}]`)),
81
84
  description: string(row.description, `${label}.description`),
82
85
  };
83
86
  });
@@ -33,9 +33,7 @@ export function verificationMethods(value, label) {
33
33
  return array(value, label).map((item, index) => literal(item, DESIGN_RESOURCE_VERIFICATION_METHODS, `${label}[${index}]`));
34
34
  }
35
35
  export function positiveInteger(value, label) {
36
- if (typeof value !== "number" ||
37
- !Number.isSafeInteger(value) ||
38
- value <= 0)
36
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0)
39
37
  designResourceShapeFail(label, "must be a positive safe integer");
40
38
  return value;
41
39
  }
@@ -1,3 +1,4 @@
1
+ import type { ExecutionTargetCapabilityV2 } from "./execution-target-capabilities.js";
1
2
  export declare const DESIGN_RESOURCE_DIMENSIONS: readonly ["surface_flow", "visual_content", "component_control", "state_interaction", "motion", "adaptation_input", "accessibility", "assets"];
2
3
  export type DesignResourceDimension = (typeof DESIGN_RESOURCE_DIMENSIONS)[number];
3
4
  export declare const DESIGN_RESOURCE_EVIDENCE_KINDS: readonly ["frame", "component_variant", "prototype_state", "prototype_transition", "motion_spec", "motion_capture", "responsive_spec", "input_spec", "accessibility_spec", "semantic_tree", "token_spec", "asset", "annotation"];
@@ -115,6 +116,7 @@ export interface DesignResourceHandoffBlockerV1 {
115
116
  dimensions: DesignResourceDimension[];
116
117
  source_item_refs: string[];
117
118
  verification_methods: DesignResourceVerificationMethod[];
119
+ required_capabilities: ExecutionTargetCapabilityV2[];
118
120
  description: string;
119
121
  }
120
122
  export interface ParsedDesignResourceHandoffV1 {
@@ -80,6 +80,7 @@ export function validateDesignResourceBlockers(handoff, subjects, targets, sourc
80
80
  ["dimensions", blocker.dimensions],
81
81
  ["source_item_refs", blocker.source_item_refs],
82
82
  ["verification_methods", blocker.verification_methods],
83
+ ["required_capabilities", blocker.required_capabilities],
83
84
  ]) {
84
85
  requireNonemptyDesignResourceValues(values, `acceptance_blocker_${name}_required:${blocker.key}`);
85
86
  requireUniqueDesignResourceValues(values, `acceptance_blocker_${name}_duplicate:${blocker.key}`);
@@ -17,6 +17,8 @@ export function validateDesignResourceConditions(handoff) {
17
17
  ]) {
18
18
  requireNonemptyDesignResourceValues(values, `condition_${name}_required:${condition.key}`);
19
19
  requireUniqueDesignResourceValues(values, `condition_${name}_duplicate:${condition.key}`);
20
+ if (values.length !== 1)
21
+ invalidDesignResourceHandoff(`condition_${name}_must_be_atomic`, condition.key);
20
22
  }
21
23
  }
22
24
  }
@@ -49,12 +49,12 @@ export async function runDoctor(projectRoot) {
49
49
  const footprint = await inspectDefaultContextFootprint(projectRoot);
50
50
  report.info.push(`default Context read path: ${footprint.files.length} file(s), ${footprint.total_bytes} bytes`);
51
51
  if (footprint.total_bytes > DEFAULT_CONTEXT_TOTAL_SOFT_BUDGET_BYTES) {
52
- report.warnings.push(`default Context read path is ${footprint.total_bytes} bytes, above the ${DEFAULT_CONTEXT_TOTAL_SOFT_BUDGET_BYTES}-byte soft budget; shorten near-universal facts or move specialized role Context to read_policy=\"on-demand\"`);
52
+ report.warnings.push(`default Context read path is ${footprint.total_bytes} bytes, above the ${DEFAULT_CONTEXT_TOTAL_SOFT_BUDGET_BYTES}-byte soft budget; review duplication or specialized placement only when complete, readable recovery semantics remain intact—required near-universal facts take precedence`);
53
53
  }
54
54
  for (const file of footprint.files) {
55
55
  if (file.bytes <= DEFAULT_CONTEXT_FILE_SOFT_BUDGET_BYTES)
56
56
  continue;
57
- report.warnings.push(`default Context file ${file.path} is ${file.bytes} bytes, above the ${DEFAULT_CONTEXT_FILE_SOFT_BUDGET_BYTES}-byte per-file soft budget`);
57
+ report.warnings.push(`default Context file ${file.path} is ${file.bytes} bytes, above the ${DEFAULT_CONTEXT_FILE_SOFT_BUDGET_BYTES}-byte per-file soft budget; this is advisory only and required readable facts take precedence`);
58
58
  }
59
59
  for (const group of footprint.duplicate_groups) {
60
60
  report.warnings.push(`default Context contains byte-identical files: ${group.join(", ")}; keep one owning fact source and replace duplicates with a short pointer`);
@@ -0,0 +1,2 @@
1
+ export declare const EXECUTION_TARGET_CAPABILITIES: readonly ["browser-runtime", "native-runtime", "desktop-runtime", "service-runtime", "process-runtime", "external-runtime", "cold-start", "production-root", "pointer-input", "keyboard-input", "touch-input", "viewport-control", "pixel-density-observation", "safe-area-observation", "motion-observation", "reduced-motion", "color-scheme-control", "text-scale-control", "assistive-technology", "screen-reader", "physical-device", "device-orientation", "sensor-input", "camera-input", "haptic-output", "thermal-observation", "power-mode-control", "persistent-storage", "network-boundary"];
2
+ export type ExecutionTargetCapabilityV2 = (typeof EXECUTION_TARGET_CAPABILITIES)[number];
@@ -0,0 +1,31 @@
1
+ export const EXECUTION_TARGET_CAPABILITIES = [
2
+ "browser-runtime",
3
+ "native-runtime",
4
+ "desktop-runtime",
5
+ "service-runtime",
6
+ "process-runtime",
7
+ "external-runtime",
8
+ "cold-start",
9
+ "production-root",
10
+ "pointer-input",
11
+ "keyboard-input",
12
+ "touch-input",
13
+ "viewport-control",
14
+ "pixel-density-observation",
15
+ "safe-area-observation",
16
+ "motion-observation",
17
+ "reduced-motion",
18
+ "color-scheme-control",
19
+ "text-scale-control",
20
+ "assistive-technology",
21
+ "screen-reader",
22
+ "physical-device",
23
+ "device-orientation",
24
+ "sensor-input",
25
+ "camera-input",
26
+ "haptic-output",
27
+ "thermal-observation",
28
+ "power-mode-control",
29
+ "persistent-storage",
30
+ "network-boundary",
31
+ ];