yaaw-se 0.3.11 → 0.3.13

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 (138) hide show
  1. package/dist/installer/migrations/index.d.ts +2 -2
  2. package/dist/installer/migrations/index.js +2 -2
  3. package/dist/installer/migrations/index.js.map +1 -1
  4. package/dist/installer/migrations/project/index.js +2 -1
  5. package/dist/installer/migrations/project/index.js.map +1 -1
  6. package/dist/installer/migrations/project/v2-to-v3.d.ts +2 -0
  7. package/dist/installer/migrations/project/v2-to-v3.js +56 -0
  8. package/dist/installer/migrations/project/v2-to-v3.js.map +1 -0
  9. package/dist/installer/plan.js +98 -268
  10. package/dist/installer/plan.js.map +1 -1
  11. package/dist/installer/project-state.js +3 -13
  12. package/dist/installer/project-state.js.map +1 -1
  13. package/dist/installer/status.js +67 -231
  14. package/dist/installer/status.js.map +1 -1
  15. package/dist/installer/transaction.js +58 -109
  16. package/dist/installer/transaction.js.map +1 -1
  17. package/dist/installer/types.d.ts +5 -2
  18. package/dist/installer/verify.js +27 -27
  19. package/dist/installer/verify.js.map +1 -1
  20. package/dist/payload/bootstrap/claude-code.md +6 -6
  21. package/dist/payload/bootstrap/cline.md +8 -8
  22. package/dist/payload/bootstrap/codex.md +7 -7
  23. package/dist/payload/bootstrap/gemini-cli.md +6 -6
  24. package/dist/payload/payload-files.json +97 -417
  25. package/dist/payload/payload.json +1 -1
  26. package/dist/payload/skills/yaaw-create-spec/SKILL.md +2 -6
  27. package/dist/payload/skills/yaaw-create-ticket/SKILL.md +2 -6
  28. package/dist/payload/skills/yaaw-create-tickets/SKILL.md +2 -6
  29. package/dist/payload/skills/yaaw-implement/SKILL.md +2 -6
  30. package/dist/payload/skills/yaaw-orchestrator/SKILL.md +2 -3
  31. package/dist/payload/skills/yaaw-planner/SKILL.md +2 -6
  32. package/dist/payload/skills/yaaw-planning-review/SKILL.md +2 -6
  33. package/dist/payload/skills/yaaw-prd/SKILL.md +2 -6
  34. package/dist/payload/skills/yaaw-refine-prd/SKILL.md +2 -6
  35. package/dist/payload/skills/yaaw-repair/SKILL.md +2 -6
  36. package/dist/payload/skills/yaaw-review/SKILL.md +2 -6
  37. package/dist/payload/skills/yaaw-revise-prd/SKILL.md +2 -6
  38. package/dist/payload/yaaw-core/registries/skills.json +38 -0
  39. package/dist/payload/yaaw-core/system/SYSTEM.md +121 -0
  40. package/dist/payload/yaaw-core/system/engine/contracts.mjs +147 -0
  41. package/dist/payload/yaaw-core/system/engine/repository-identity.mjs +24 -0
  42. package/dist/payload/yaaw-core/system/engine/routing.mjs +153 -0
  43. package/dist/payload/yaaw-core/system/engine/runtime.mjs +66 -0
  44. package/dist/payload/yaaw-core/system/kernel.yaml +145 -0
  45. package/dist/payload/yaaw-core/system/modules/changeability.md +27 -0
  46. package/dist/payload/yaaw-core/system/roles/implementer.md +16 -12
  47. package/dist/payload/yaaw-core/system/roles/orchestrator.md +24 -14
  48. package/dist/payload/yaaw-core/system/roles/planner.md +37 -11
  49. package/dist/payload/yaaw-core/system/roles/prd.md +26 -18
  50. package/dist/payload/yaaw-core/system/roles/reviewer.md +16 -15
  51. package/dist/payload/yaaw-core/system/schemas/handoff.schema.json +24 -161
  52. package/dist/payload/yaaw-core/system/schemas/intent.schema.json +11 -64
  53. package/dist/payload/yaaw-core/system/schemas/observed-state.schema.json +12 -162
  54. package/dist/payload/yaaw-core/system/schemas/repository-identity.schema.json +12 -39
  55. package/dist/payload/yaaw-core/system/templates/evidence.json +1 -18
  56. package/dist/payload/yaaw-core/system/templates/handoff.json +11 -27
  57. package/dist/payload/yaaw-core/system/templates/intent.json +2 -2
  58. package/dist/payload/yaaw-core/system/templates/observed-state.json +5 -28
  59. package/dist/payload/yaaw-core/system/templates/review.md +2 -2
  60. package/package.json +5 -2
  61. package/dist/payload/yaaw-core/system/core/artifact-model.md +0 -43
  62. package/dist/payload/yaaw-core/system/core/authority.md +0 -21
  63. package/dist/payload/yaaw-core/system/core/context-loading.md +0 -56
  64. package/dist/payload/yaaw-core/system/core/dispatch-execution.md +0 -28
  65. package/dist/payload/yaaw-core/system/core/execution-context.md +0 -61
  66. package/dist/payload/yaaw-core/system/core/framework-integrity.md +0 -60
  67. package/dist/payload/yaaw-core/system/core/invalidation.md +0 -13
  68. package/dist/payload/yaaw-core/system/core/io-contract.md +0 -23
  69. package/dist/payload/yaaw-core/system/core/lifecycle.md +0 -23
  70. package/dist/payload/yaaw-core/system/core/recovery.md +0 -17
  71. package/dist/payload/yaaw-core/system/core/routing.md +0 -21
  72. package/dist/payload/yaaw-core/system/core/state-model.md +0 -14
  73. package/dist/payload/yaaw-core/system/core/transitions.md +0 -36
  74. package/dist/payload/yaaw-core/system/expertise/changeability/MODULE.md +0 -58
  75. package/dist/payload/yaaw-core/system/registries/artifacts.json +0 -99
  76. package/dist/payload/yaaw-core/system/registries/execution-policy.json +0 -169
  77. package/dist/payload/yaaw-core/system/registries/expertise.json +0 -47
  78. package/dist/payload/yaaw-core/system/registries/handoff-policy.json +0 -67
  79. package/dist/payload/yaaw-core/system/registries/paths.json +0 -18
  80. package/dist/payload/yaaw-core/system/registries/reconciliation-policy.json +0 -18
  81. package/dist/payload/yaaw-core/system/registries/role-io.json +0 -30
  82. package/dist/payload/yaaw-core/system/registries/routing-policy.json +0 -74
  83. package/dist/payload/yaaw-core/system/registries/skills.json +0 -110
  84. package/dist/payload/yaaw-core/system/registries/transitions.json +0 -178
  85. package/dist/payload/yaaw-core/system/registries/workflows.json +0 -38
  86. package/dist/payload/yaaw-core/system/rules/artifact-writing.md +0 -10
  87. package/dist/payload/yaaw-core/system/rules/assumption-challenge.md +0 -109
  88. package/dist/payload/yaaw-core/system/rules/changeability.md +0 -38
  89. package/dist/payload/yaaw-core/system/rules/durable-memory.md +0 -9
  90. package/dist/payload/yaaw-core/system/rules/question-format.md +0 -20
  91. package/dist/payload/yaaw-core/system/rules/recovery-evidence.md +0 -9
  92. package/dist/payload/yaaw-core/system/rules/repository-identity.md +0 -42
  93. package/dist/payload/yaaw-core/system/rules/research-admission.md +0 -30
  94. package/dist/payload/yaaw-core/system/rules/review-independence.md +0 -11
  95. package/dist/payload/yaaw-core/system/rules/ticket-sizing.md +0 -9
  96. package/dist/payload/yaaw-core/system/schemas/project-state.schema.json +0 -12
  97. package/dist/payload/yaaw-core/system/templates/project-state.json +0 -13
  98. package/dist/payload/yaaw-core/system/tools/orchestration-engine.mjs +0 -210
  99. package/dist/payload/yaaw-core/system/tools/orchestration-runtime.mjs +0 -46
  100. package/dist/payload/yaaw-core/system/tools/repository-identity.mjs +0 -92
  101. package/dist/payload/yaaw-core/system/workflows/implementation/implement-ticket.md +0 -18
  102. package/dist/payload/yaaw-core/system/workflows/implementation/repair-ticket.md +0 -17
  103. package/dist/payload/yaaw-core/system/workflows/implementation/select-ticket.md +0 -17
  104. package/dist/payload/yaaw-core/system/workflows/implementation/verify-ticket.md +0 -19
  105. package/dist/payload/yaaw-core/system/workflows/orchestration/determine-next-action.md +0 -24
  106. package/dist/payload/yaaw-core/system/workflows/orchestration/dispatch.md +0 -35
  107. package/dist/payload/yaaw-core/system/workflows/orchestration/inspect-state.md +0 -19
  108. package/dist/payload/yaaw-core/system/workflows/orchestration/reconcile-state.md +0 -19
  109. package/dist/payload/yaaw-core/system/workflows/orchestration/recover-interruption.md +0 -32
  110. package/dist/payload/yaaw-core/system/workflows/orchestration/route.md +0 -27
  111. package/dist/payload/yaaw-core/system/workflows/planning/create-spec.md +0 -21
  112. package/dist/payload/yaaw-core/system/workflows/planning/create-tickets.md +0 -50
  113. package/dist/payload/yaaw-core/system/workflows/planning/decision-frontier.md +0 -33
  114. package/dist/payload/yaaw-core/system/workflows/planning/discover.md +0 -21
  115. package/dist/payload/yaaw-core/system/workflows/planning/question-round.md +0 -22
  116. package/dist/payload/yaaw-core/system/workflows/planning/readiness-review.md +0 -33
  117. package/dist/payload/yaaw-core/system/workflows/planning/record-decisions.md +0 -19
  118. package/dist/payload/yaaw-core/system/workflows/planning/replan.md +0 -24
  119. package/dist/payload/yaaw-core/system/workflows/planning/research.md +0 -20
  120. package/dist/payload/yaaw-core/system/workflows/planning/route.md +0 -28
  121. package/dist/payload/yaaw-core/system/workflows/planning/write-understanding.md +0 -26
  122. package/dist/payload/yaaw-core/system/workflows/prd/create.md +0 -22
  123. package/dist/payload/yaaw-core/system/workflows/prd/question-round.md +0 -20
  124. package/dist/payload/yaaw-core/system/workflows/prd/readiness.md +0 -22
  125. package/dist/payload/yaaw-core/system/workflows/prd/record-decisions.md +0 -20
  126. package/dist/payload/yaaw-core/system/workflows/prd/refine.md +0 -15
  127. package/dist/payload/yaaw-core/system/workflows/prd/revise.md +0 -18
  128. package/dist/payload/yaaw-core/system/workflows/prd/route.md +0 -23
  129. package/dist/payload/yaaw-core/system/workflows/review/classify-findings.md +0 -17
  130. package/dist/payload/yaaw-core/system/workflows/review/inspect-change.md +0 -20
  131. package/dist/payload/yaaw-core/system/workflows/review/record-review.md +0 -19
  132. package/dist/payload/yaaw-core/system/workflows/review/review-ticket.md +0 -24
  133. /package/dist/payload/yaaw-core/system/{tools → engine}/frontmatter.mjs +0 -0
  134. /package/dist/payload/yaaw-core/system/{tools/framework-integrity.mjs → engine/integrity.mjs} +0 -0
  135. /package/dist/payload/yaaw-core/system/{expertise/frontend-design/MODULE.md → modules/frontend-design.md} +0 -0
  136. /package/dist/payload/yaaw-core/system/{expertise/python/MODULE.md → modules/python.md} +0 -0
  137. /package/dist/payload/yaaw-core/system/{expertise/security/MODULE.md → modules/security.md} +0 -0
  138. /package/dist/payload/yaaw-core/system/{expertise/testing/MODULE.md → modules/testing.md} +0 -0
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "schema": "yaaw.payload/v1",
3
- "version": "0.3.11"
3
+ "version": "0.3.13"
4
4
  }
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-create-spec
3
- description: Create the next YAAW specification from an engineering frontier whose readiness is currently PASS.
3
+ description: Create the next specification from a ready YAAW engineering frontier.
4
4
  ---
5
5
  # yaaw-create-spec
6
6
  ROLE: `planner`
7
7
  WORKFLOW: `planning.create-spec`
8
8
  INTENT: `CREATE_SPEC`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-create-spec`
13
-
14
- Follow `orchestration.route` until `CURRENT_SPEC_ACCEPTED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute planner semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-create-spec` and follow Orchestrator routing until `CURRENT_SPEC_ACCEPTED`, BLOCKED, or framework stop.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-create-ticket
3
- description: Create bounded YAAW implementation ticket contracts from the current accepted specification.
3
+ description: Create bounded implementation tickets from the current accepted YAAW specification.
4
4
  ---
5
5
  # yaaw-create-ticket
6
6
  ROLE: `planner`
7
7
  WORKFLOW: `planning.create-tickets`
8
8
  INTENT: `CREATE_TICKETS`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-create-ticket`
13
-
14
- Follow `orchestration.route` until `CURRENT_TICKETS_REGISTERED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute planner semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-create-ticket` and follow Orchestrator routing until `CURRENT_TICKETS_REGISTERED`, BLOCKED, or framework stop.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-create-tickets
3
- description: Create dependency-aware bounded YAAW implementation tickets from the current accepted specification.
3
+ description: Create dependency-aware bounded implementation tickets from the current accepted YAAW specification.
4
4
  ---
5
5
  # yaaw-create-tickets
6
6
  ROLE: `planner`
7
7
  WORKFLOW: `planning.create-tickets`
8
8
  INTENT: `CREATE_TICKETS`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-create-tickets`
13
-
14
- Follow `orchestration.route` until `CURRENT_TICKETS_REGISTERED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute planner semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-create-tickets` and follow Orchestrator routing until `CURRENT_TICKETS_REGISTERED`, BLOCKED, or framework stop.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-implement
3
- description: Implement one admitted READY YAAW ticket and produce repository-identity-bound verification evidence.
3
+ description: Implement one admitted READY ticket and produce repository-identity-bound verification evidence.
4
4
  ---
5
5
  # yaaw-implement
6
6
  ROLE: `implementer`
7
7
  WORKFLOW: `implementation.implement-ticket`
8
8
  INTENT: `IMPLEMENT`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-implement`
13
-
14
- Follow `orchestration.route` until `TICKET_REVIEW_REQUIRED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute implementer semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-implement` and follow Orchestrator routing until the selected ticket is `REVIEW_REQUIRED`, BLOCKED, or a framework stop occurs.
@@ -7,8 +7,7 @@ ROLE: `orchestrator`
7
7
  WORKFLOW: `orchestration.route`
8
8
  INTENT: `CONTINUE`
9
9
 
10
- ## Execute
11
10
  Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-orchestrator`
11
+ `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-orchestrator`
13
12
 
14
- Follow `orchestration.route` until `CONTINUE_UNTIL_STOP` is satisfied or a human-input, BLOCKED, or framework stop occurs. A `FRAMEWORK_STOP` is terminal for the current invocation: report it once and do not re-run the unchanged runtime unless the installation version, manifest, or managed framework bytes have changed. Do not execute orchestrator semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
13
+ Follow the Orchestrator `route` operation until `CONTINUE_UNTIL_STOP` is satisfied or a human-input, BLOCKED, terminal, or framework stop occurs. Never execute semantic worker authority directly from this wrapper; every worker execution uses the exact fresh runtime handoff.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-planner
3
- description: Continue repository-backed YAAW engineering planning, challenge material technical assumptions, and advance decisions, readiness, specifications, or tickets.
3
+ description: Continue repository-backed YAAW engineering planning.
4
4
  ---
5
5
  # yaaw-planner
6
6
  ROLE: `planner`
7
7
  WORKFLOW: `planning.route`
8
8
  INTENT: `CONTINUE_PLANNING`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-planner`
13
-
14
- Follow `orchestration.route` until `PLANNING_READY` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute planner semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-planner` and follow Orchestrator routing until `PLANNING_READY`, human input, BLOCKED, or framework stop.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-planning-review
3
- description: Freshly assess whether the current YAAW engineering frontier is ready for implementation without material invention.
3
+ description: Assess whether the current engineering frontier is implementable without material invention.
4
4
  ---
5
5
  # yaaw-planning-review
6
6
  ROLE: `planner`
7
7
  WORKFLOW: `planning.readiness-review`
8
8
  INTENT: `PLANNING_REVIEW`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-planning-review`
13
-
14
- Follow `orchestration.route` until `PLANNING_READINESS_DECIDED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute planner semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-planning-review` and follow Orchestrator routing until `PLANNING_READINESS_DECIDED`, human input, BLOCKED, or framework stop.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-prd
3
- description: Create or continue YAAW product definition, challenge material product assumptions, and route clarification or revision work.
3
+ description: Create or continue YAAW product definition and route clarification or revision work.
4
4
  ---
5
5
  # yaaw-prd
6
6
  ROLE: `prd`
7
7
  WORKFLOW: `prd.route`
8
8
  INTENT: `CONTINUE_PRODUCT`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-prd`
13
-
14
- Follow `orchestration.route` until `PRODUCT_READY` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute prd semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-prd` and follow Orchestrator routing until `PRODUCT_READY`, human input, BLOCKED, or framework stop.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-refine-prd
3
- description: Improve clarity and completeness of a YAAW product artifact without changing accepted product meaning.
3
+ description: Improve product clarity without changing accepted meaning.
4
4
  ---
5
5
  # yaaw-refine-prd
6
6
  ROLE: `prd`
7
7
  WORKFLOW: `prd.refine`
8
8
  INTENT: `REFINE_PRODUCT`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-refine-prd`
13
-
14
- Follow `orchestration.route` until `PRODUCT_REFINED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute prd semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-refine-prd` and follow Orchestrator routing until `PRODUCT_REFINED`, human input, BLOCKED, or framework stop.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-repair
3
- description: Repair a YAAW ticket in REPAIR_REQUIRED state while preserving its accepted product and engineering contract.
3
+ description: Repair one ticket in REPAIR_REQUIRED while preserving the accepted YAAW contract.
4
4
  ---
5
5
  # yaaw-repair
6
6
  ROLE: `implementer`
7
7
  WORKFLOW: `implementation.repair-ticket`
8
8
  INTENT: `REPAIR`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-repair`
13
-
14
- Follow `orchestration.route` until `TICKET_REVIEW_REQUIRED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute implementer semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-repair` and follow Orchestrator routing until the selected ticket returns to `REVIEW_REQUIRED`, BLOCKED, or a framework stop occurs.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-review
3
- description: Independently review actual YAAW implementation and classify PASS, REPAIR, REPLAN, or BLOCKED against current evidence.
3
+ description: Independently review implementation and classify PASS, REPAIR, REPLAN, or BLOCKED.
4
4
  ---
5
5
  # yaaw-review
6
6
  ROLE: `reviewer`
7
7
  WORKFLOW: `review.review-ticket`
8
8
  INTENT: `REVIEW`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-review`
13
-
14
- Follow `orchestration.route` until `TICKET_REVIEW_APPLIED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute reviewer semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-review` and follow Orchestrator routing until the selected review result is applied, BLOCKED, or a framework stop occurs.
@@ -1,14 +1,10 @@
1
1
  ---
2
2
  name: yaaw-revise-prd
3
- description: Change accepted YAAW product intent and invalidate downstream engineering contracts whose basis became stale.
3
+ description: Change accepted YAAW product intent and invalidate stale downstream contracts.
4
4
  ---
5
5
  # yaaw-revise-prd
6
6
  ROLE: `prd`
7
7
  WORKFLOW: `prd.revise`
8
8
  INTENT: `REVISE_PRODUCT`
9
9
 
10
- ## Execute
11
- Resolve the YAAW workspace root, then invoke:
12
- `node .yaaw-core/system/tools/orchestration-runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-revise-prd`
13
-
14
- Follow `orchestration.route` until `PRODUCT_REVISION_ADVANCED` is satisfied or a human-input, BLOCKED, or framework stop occurs. Do not execute prd semantics directly from this wrapper; every semantic execution requires the exact runtime handoff.
10
+ Invoke `node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT> --invoke-skill yaaw-revise-prd` and follow Orchestrator routing until `PRODUCT_REVISION_ADVANCED`, human input, BLOCKED, or framework stop.
@@ -0,0 +1,38 @@
1
+ {
2
+ "yaaw-orchestrator": {
3
+ "description": "Continue or recover by reconstructing reality and dispatching the next safe workflow."
4
+ },
5
+ "yaaw-prd": {
6
+ "description": "Create or continue product definition."
7
+ },
8
+ "yaaw-revise-prd": {
9
+ "description": "Change accepted product intent and invalidate stale downstream contracts."
10
+ },
11
+ "yaaw-refine-prd": {
12
+ "description": "Improve product clarity without changing accepted meaning."
13
+ },
14
+ "yaaw-planner": {
15
+ "description": "Continue repository-backed engineering planning."
16
+ },
17
+ "yaaw-planning-review": {
18
+ "description": "Assess current engineering-frontier readiness."
19
+ },
20
+ "yaaw-create-spec": {
21
+ "description": "Create the next specification from a ready frontier."
22
+ },
23
+ "yaaw-create-ticket": {
24
+ "description": "Create bounded implementation tickets."
25
+ },
26
+ "yaaw-create-tickets": {
27
+ "description": "Create dependency-aware bounded implementation tickets."
28
+ },
29
+ "yaaw-implement": {
30
+ "description": "Implement one READY ticket and produce verification evidence."
31
+ },
32
+ "yaaw-repair": {
33
+ "description": "Repair one REPAIR_REQUIRED ticket."
34
+ },
35
+ "yaaw-review": {
36
+ "description": "Independently review implementation and classify its result."
37
+ }
38
+ }
@@ -0,0 +1,121 @@
1
+ # YAAW system kernel
2
+
3
+ YAAW is an autonomous software-engineering workflow with one compact rule: **persist semantic facts once and derive coordination state**.
4
+
5
+ ## Mental model
6
+
7
+ Agents are disposable. Artifacts are durable. A fresh context must be able to continue from repository and YAAW artifacts without depending on the original conversation.
8
+
9
+ There are five semantic authorities:
10
+
11
+ - **PRD** owns product meaning: goals, users, behavior, scope, constraints, and non-goals.
12
+ - **Planner** owns engineering meaning: repository understanding, architecture decisions, research admission, readiness, specifications, and ticket contracts.
13
+ - **Implementer** owns application changes and implementation evidence for one admitted ticket.
14
+ - **Reviewer** owns independent acceptance and the semantic result `PASS`, `REPAIR`, `REPLAN`, or `BLOCKED`.
15
+ - **Orchestrator** owns observation, deterministic routing, lifecycle adoption, recovery, and dispatch. It never invents product, engineering, implementation, research, or acceptance decisions.
16
+
17
+ `kernel.yaml` is the machine-readable contract. The role documents contain the human-readable workflow operations. Modules are optional expertise loaded only after routing.
18
+
19
+ ## One authority per fact
20
+
21
+ | Fact | Canonical location |
22
+ | --- | --- |
23
+ | Product requirement or accepted product decision | `.yaaw-core/project/product.md` |
24
+ | Engineering decision / frontier / readiness | `.yaaw-core/project/engineering.md` |
25
+ | Bounded external research | `.yaaw-core/project/research/RSH-*.md` |
26
+ | Feature implementation contract | `.yaaw-core/project/specs/SPEC-*.md` |
27
+ | Executable work unit and its lifecycle status | `.yaaw-core/project/tickets/TASK-*.md` |
28
+ | Implementation proof | `.yaaw-core/project/evidence/*.json` |
29
+ | Acceptance judgment | `.yaaw-core/project/reviews/TASK-*-R*.md` |
30
+ | Reusable project-local invariant | `.yaaw-core/project/rules/*.md` |
31
+ | Current user intent / observation / handoff / dispatch failures | `.yaaw-core/runtime/*` |
32
+ | Package ownership and integrity | `.yaaw-core/install/manifest.json` |
33
+
34
+ There is no durable global `state.json`, `memory.md`, conversation log, role summary, or project summary. Product, engineering, specs, tickets, evidence, and reviews **are** project memory.
35
+
36
+ Store conclusions, not cognition. Never persist `User said...`, question transcripts, debate history, or a summary merely because another worker needs context. Reference artifact/decision IDs instead of copying upstream history.
37
+
38
+ ## Durable truth versus derived coordination
39
+
40
+ Ticket frontmatter `status` is the canonical lifecycle state for that ticket. Product and engineering frontmatter carry their own status/revision/readiness metadata. The active accepted specification is derived from current accepted spec metadata. Project completion is derived from current ticket statuses plus Planner-owned `scope_status`.
41
+
42
+ `.yaaw-core/runtime/` is replaceable coordination. `intent.json`, `observed-state.json`, `handoff.json`, and dispatch-failure data may be deleted at any time. The next orchestration invocation must reconstruct the same safe next action from durable artifacts and repository evidence. Runtime deletion must never lose a semantic decision.
43
+
44
+ Lifecycle transitions remain constrained by `kernel.yaml`. When Implementer evidence or Reviewer output authorizes a transition, Orchestrator may update only the ticket frontmatter `status` scalar after deterministic validation. That physical write does not transfer the semantic authority that produced the evidence.
45
+
46
+ Planner may directly create/revise ticket contracts and owns Planner-authorized lifecycle states such as `DRAFT`, `READY`, `REPLAN_REQUIRED`, and `CANCELLED` where the lifecycle contract permits them. A status-only admission change does not require a ticket revision bump; a semantic contract change does.
47
+
48
+ ## Artifact-writing rules
49
+
50
+ - Markdown artifacts use YAML frontmatter for schema/identity/revision/status metadata and Markdown for durable reasoning.
51
+ - Prefer concise durable facts over duplicated upstream content.
52
+ - Product language stays product-focused; engineering decisions stay in engineering artifacts.
53
+ - Distinguish repository observations from assumptions.
54
+ - Record provenance for material product, engineering, repository, research, evidence, and review dependencies.
55
+ - Reviews and implementation evidence are immutable rounds/records. Never rewrite failed evidence or prior reviews into success.
56
+ - Preserve superseded/stale artifacts as history; invalidate authority rather than erasing the record.
57
+ - A fresh context unable to continue from artifacts indicates incomplete durable documentation.
58
+
59
+ ## Execution and progressive disclosure
60
+
61
+ Resolve the workspace root as the consumer directory containing `.yaaw-core/install/manifest.json`. Package-managed `.yaaw-core/system/**` is immutable during semantic work; only installer/update/repair may replace it.
62
+
63
+ Normal orchestration invokes:
64
+
65
+ ```text
66
+ node .yaaw-core/system/engine/runtime.mjs --workspace <WORKSPACE_ROOT>
67
+ ```
68
+
69
+ Public skills use the same command with `--invoke-skill <skill-id>`.
70
+
71
+ Routing is metadata-first. Before exactly one workflow is selected, do not load sibling workflow operations, unrelated role documents, downstream workflow bodies, or optional modules. A dispatched worker receives only:
72
+
73
+ 1. this system contract as needed;
74
+ 2. its role document and selected operation;
75
+ 3. the exact artifact references in the handoff;
76
+ 4. selected optional modules; and
77
+ 5. minimal relevant application/repository context.
78
+
79
+ Workers never privately command or spawn peer YAAW authorities. After every worker result, failure, interruption, or disappearance, Orchestrator discards worker prose as authority and observes durable reality again.
80
+
81
+ ## Framework integrity
82
+
83
+ Before semantic routing, verify the installer manifest and package-managed system bytes. `MODIFIED`, `MISSING`, `LOCAL_OVERRIDE`, unknown integrity, or contract inconsistency fails closed. Semantic workers never edit `.yaaw-core/system/**` to unblock themselves.
84
+
85
+ Dispatch completeness is a framework invariant. A worker dispatch target is the union of non-Orchestrator public-skill requests, deterministic router targets (the values used by router branches), and declared worker handoffs. Other role operations are internal suboperations; root Orchestrator operations do not require worker handoffs. Every target must resolve a workflow, owning role, valid handoff, role-bounded reads/writes, active artifact, authorized existing modules, and the typed worker result protocol. Public skill metadata and completion vocabulary must agree with the kernel. `engine/contracts.mjs` is the canonical validator used by core, distribution, payload generation/verification, and runtime. Missing contracts stop as framework defects, never consumer semantic blockers.
86
+
87
+ Product revision changes the downstream product basis. Orchestrator derives stale ticket authority and performs only legal status reconciliation; Planner owns changed downstream contracts. Engineering readiness based on an older product revision cannot authorize a specification. Clarity-only product refinement preserves semantic revision and downstream source authority.
88
+
89
+ ## Repository identity
90
+
91
+ Repository identity is produced only by `.yaaw-core/system/engine/repository-identity.mjs`; roles do not reimplement it. Runtime caches, ticket lifecycle files, immutable implementation evidence, and immutable reviews are excluded from the application worktree digest because their normal lifecycle writes would otherwise invalidate their own basis. Ticket semantic freshness is instead bound explicitly by ticket revision and ticket content digest in handoffs/evidence/reviews.
92
+
93
+ Exact repository identity is required for executable tickets, implementation, repair, and review. Unversioned projects may be inspected for planning but cannot claim executable identity-dependent admission.
94
+
95
+ ## Assumption challenge and questions
96
+
97
+ PRD and Planner challenge only material assumptions that could change intent, architecture, readiness, scope, failure behavior, or implementation. Establish inspectable facts before asking the human. Do not ask repository-answerable questions. Respect decision dependencies and the current frontier; future-dependent issues remain future fog.
98
+
99
+ Ask at most 10 meaningful questions per round; the maximum is not a target and zero is valid. Options and a recommendation are useful when they expose a real tradeoff, but free-form answers remain first-class. Record accepted conclusions before another question round, then recompute the frontier and downstream invalidation.
100
+
101
+ PRD never chooses engineering implementation unless the human explicitly made a method a product constraint. Planner never invents product meaning and resolves routine reversible engineering choices it owns.
102
+
103
+ ## Research admission
104
+
105
+ Vendor/framework/package/platform research is allowed only when justified by observed repository technology, an accepted product constraint, an accepted `ENG-*` decision, or an explicit current-frontier candidate. Tool or host-skill availability is never an architectural reason. Prefer primary sources and record version/date for version-sensitive facts. Persist only bounded material research that blocks a current decision; do not research future fog.
106
+
107
+ ## Changeability
108
+
109
+ Planner, Implementer, and Reviewer apply the mandatory principle: **make the next correct change easier without expanding the current authorized change**. Keep the main path visible, name by domain meaning, contain external systems behind boundaries, make invalid states harder to represent, separate important decisions from side effects, make failures useful without exposing secrets, and keep changes focused. A preference is not a defect; blocking findings require concrete engineering impact.
110
+
111
+ ## Ticket sizing
112
+
113
+ A ticket is correctly sized when one fresh Implementer can complete one coherent engineering change and verify a concrete outcome without inventing material product or architecture decisions. Avoid both multi-subsystem rediscovery tickets and bookkeeping-only fragments.
114
+
115
+ ## Review independence
116
+
117
+ Reviewer evaluates actual repository work, not Implementer summaries. Every review is tied to exact repository identity, ticket/spec revisions, and current PASS verification evidence. Reviewer must execute in a semantically independent fresh authority context from the Implementer when the host supports it; host fallback never removes the independence requirement. Reviewer may classify `REPLAN`, but Planner owns contract changes.
118
+
119
+ ## Recovery
120
+
121
+ Evidence beats claims. Use current artifact revisions/content, repository identity, implementation evidence, and reviews to identify the last trustworthy boundary. Never rerun full implementation merely because a response disappeared. If the boundary cannot be proven, preserve evidence and return an exact blocker rather than destructive re-execution.
@@ -0,0 +1,147 @@
1
+ import { readFile, lstat, realpath } from 'node:fs/promises';
2
+ import { resolve, relative, isAbsolute, join } from 'node:path';
3
+ // The router uses these values at each branch; there is no separate target inventory.
4
+ export const ROUTES = Object.freeze({product:'prd.route',planning:'planning.route',spec:'planning.create-spec',tickets:'planning.create-tickets',replan:'planning.replan',repair:'implementation.repair-ticket',review:'review.review-ticket',verify:'implementation.verify-ticket',implement:'implementation.implement-ticket'});
5
+ export const ROUTER_DISPATCH_TARGETS = Object.freeze([...new Set(Object.values(ROUTES))]);
6
+ // Typed worker outcomes consumed by the host continuation/lifecycle protocol.
7
+ const RESULTS = {
8
+ 'prd.route':['READY','HUMAN_INPUT_REQUIRED','BLOCKED'],
9
+ 'prd.revise':['READY','HUMAN_INPUT_REQUIRED','BLOCKED'],
10
+ 'prd.refine':['READY','HUMAN_INPUT_REQUIRED','BLOCKED'],
11
+ 'planning.route':['READY','HUMAN_INPUT_REQUIRED','REPLAN','BLOCKED'],
12
+ 'planning.readiness-review':['PASS','MISSING_DECISIONS','PRODUCT_GAP','REPLAN','BLOCKED'],
13
+ 'planning.create-spec':['SUCCESS','PRECONDITION_UNSATISFIED','BLOCKED'],
14
+ 'planning.create-tickets':['SUCCESS','PRECONDITION_UNSATISFIED','BLOCKED'],
15
+ 'planning.replan':['READY','HUMAN_INPUT_REQUIRED','BLOCKED'],
16
+ 'implementation.implement-ticket':['VERIFICATION_PASS','VERIFICATION_FAIL','REPLAN_REQUIRED','PRECONDITION_UNSATISFIED','BLOCKED'],
17
+ 'implementation.verify-ticket':['VERIFICATION_PASS','VERIFICATION_FAIL','IMPLEMENTATION_INCOMPLETE','REPLAN_REQUIRED','BLOCKED'],
18
+ 'implementation.repair-ticket':['VERIFICATION_PASS','VERIFICATION_FAIL','REPLAN_REQUIRED','BLOCKED'],
19
+ 'review.review-ticket':['PASS','REPAIR','REPLAN','BLOCKED']
20
+ };
21
+ // A shortcut's completion must describe the operation it actually requests.
22
+ const INTENTS = {
23
+ CONTINUE:['orchestration.route','CONTINUE_UNTIL_STOP'],
24
+ CONTINUE_PRODUCT:['prd.route','PRODUCT_READY'],
25
+ REVISE_PRODUCT:['prd.revise','PRODUCT_REVISION_ADVANCED'],
26
+ REFINE_PRODUCT:['prd.refine','PRODUCT_REFINED'],
27
+ CONTINUE_PLANNING:['planning.route','PLANNING_READY'],
28
+ PLANNING_REVIEW:['planning.readiness-review','PLANNING_READINESS_DECIDED'],
29
+ CREATE_SPEC:['planning.create-spec','CURRENT_SPEC_ACCEPTED'],
30
+ CREATE_TICKETS:['planning.create-tickets','CURRENT_TICKETS_REGISTERED'],
31
+ IMPLEMENT:['implementation.implement-ticket','TICKET_REVIEW_REQUIRED'],
32
+ REPAIR:['implementation.repair-ticket','TICKET_REVIEW_REQUIRED'],
33
+ REVIEW:['review.review-ticket','TICKET_REVIEW_APPLIED']
34
+ };
35
+ export function dispatchableWorkflows(kernel) {
36
+ return new Set([...ROUTER_DISPATCH_TARGETS,...Object.values(kernel.skills??{}).filter(s=>s.role!=='orchestrator').map(s=>s.requested_workflow),...Object.keys(kernel.handoffs??{})]);
37
+ }
38
+ const managedPath=p=>typeof p==='string'&&p.startsWith('.yaaw-core/system/')&&!p.includes('\\')&&!p.split('/').includes('..')&&p.endsWith('.md');
39
+ async function managedFile(system,path) {
40
+ if(!managedPath(path))throw new Error(`invalid managed system reference ${path}`);
41
+ const target=resolve(system,path.slice('.yaaw-core/system/'.length)),root=await realpath(system),actual=await realpath(target),rel=relative(root,actual);
42
+ if(rel.startsWith('..')||isAbsolute(rel)||!(await lstat(target)).isFile())throw new Error(`invalid managed system file ${path}`);
43
+ return target;
44
+ }
45
+ const operationHeader=(id,w)=>`## Operation: ${w.operation} (\`${id}\`)`;
46
+ export async function validateDispatchFiles(system,k,workflow,expertise=[]) {
47
+ const paths=[k.roles[k.workflows[workflow]?.role]?.document,...expertise],errors=[];
48
+ for(const path of paths)try{await managedFile(system,path)}catch{errors.push(`${workflow}: missing/invalid dispatch file ${path}`)}
49
+ const w=k.workflows[workflow];
50
+ try{const text=await readFile(await managedFile(system,k.roles[w.role].document),"utf8");if(!text.includes(operationHeader(workflow,w)))errors.push(`${workflow}: missing selected role operation`)}catch{}
51
+ return errors;
52
+ }
53
+ const stringList=x=>Array.isArray(x)&&x.every(v=>typeof v==='string'&&v.length>0)&&new Set(x).size===x.length;
54
+ const sameSet=(a,b)=>stringList(a)&&stringList(b)&&a.length===b.length&&a.every(x=>b.includes(x));
55
+ export function validateContracts(k) {
56
+ const errors=[],roles=k.roles??{},workflows=k.workflows??{},artifacts=k.artifacts??{},modules=k.modules??{},handoffs=k.handoffs??{};
57
+ const error=(id,message)=>errors.push(`${id}: ${message}`);
58
+ for(const [id,a] of Object.entries(artifacts)) {
59
+ if(!roles[a.owner]&&!['lifecycle','installer','none'].includes(a.owner))error(id,'unknown artifact owner');
60
+ if(a.embedded_in&&!artifacts[a.embedded_in])error(id,'unknown embedded artifact');
61
+ if(!a.path&&!a.path_pattern&&!a.embedded_in&&!a.virtual)error(id,'artifact has no locator');
62
+ }
63
+ for(const [id,r] of Object.entries(roles)){
64
+ if(!managedPath(r.document))error(id,'invalid role document reference');
65
+ for(const kind of ['reads','writes']) {
66
+ if(!stringList(r[kind]))error(id,`invalid role ${kind}`);
67
+ else for(const a of r[kind])if(!artifacts[a])error(id,`unknown ${kind} artifact ${a}`);
68
+ }
69
+ }
70
+ for(const [id,w] of Object.entries(workflows)) {
71
+ if(!roles[w.role])error(id,`unknown owning role ${w.role}`);
72
+ if(typeof w.operation!=='string'||!w.operation)error(id,'missing operation');
73
+ if(!['NONE','INSPECT','IDENTITY'].includes(w.repository_requirement))error(id,'invalid repository requirement');
74
+ }
75
+ for(const [id,s] of Object.entries(k.skills??{})) {
76
+ const w=workflows[s.requested_workflow];
77
+ if(!w)error(id,`unknown requested workflow ${s.requested_workflow}`);
78
+ else if(w.role!==s.role)error(id,'skill role differs from workflow owner');
79
+ if(!roles[s.role])error(id,'unknown skill role');
80
+ const intent=INTENTS[s.desired_outcome];
81
+ if(!intent||s.requested_workflow!==intent[0]||s.completion_kind!==intent[1])error(id,'shortcut intent/workflow/completion semantics disagree');
82
+ }
83
+ for(const id of dispatchableWorkflows(k)) {
84
+ const w=workflows[id];
85
+ if(!w)error(id,'dispatch target has no workflow');
86
+ if(w?.role==='orchestrator')error(id,'root operation cannot be a worker dispatch target');
87
+ if(!handoffs[id])error(id,'dispatch target has no handoff contract');
88
+ }
89
+ for(const [id,h] of Object.entries(handoffs)) {
90
+ const w=workflows[id],r=roles[w?.role];
91
+ if(!w||!r){error(id,'handoff has no workflow/owning role');continue}
92
+ for(const kind of ['reads','writes']) {
93
+ if(!stringList(h[kind])){error(id,`invalid handoff ${kind}`);continue}
94
+ for(const a of h[kind]) {
95
+ if(!artifacts[a])error(id,`unknown ${kind} artifact ${a}`);
96
+ if(!r[kind]?.includes(a))error(id,`${kind} outside ${w.role} authority: ${a}`);
97
+ }
98
+ }
99
+ if(!artifacts[h.active_artifact])error(id,`unknown active artifact ${h.active_artifact}`);
100
+ else if(!h.reads?.includes(h.active_artifact)&&!h.writes?.includes(h.active_artifact))error(id,'active artifact outside handoff I/O');
101
+ if(!stringList(h.required_modules))error(id,'invalid required modules');
102
+ else for(const m of h.required_modules)if(!modules[m]?.usable_by?.includes(w.role))error(id,`missing/unauthorized module ${m}`);
103
+ if(typeof h.ticket_modules!=='boolean')error(id,'invalid ticket_modules');
104
+ if(typeof h.expected_output!=='string'||!h.expected_output.trim())error(id,'missing expected output');
105
+ if(!sameSet(h.result_vocabulary,RESULTS[id]))error(id,'result vocabulary incompatible with worker protocol');
106
+ }
107
+ for(const [id,m] of Object.entries(modules)) {
108
+ if(!managedPath(m.path))error(id,'invalid module path reference');
109
+ if(!stringList(m.usable_by)||m.usable_by.some(r=>!roles[r]))error(id,'unknown module role');
110
+ }
111
+ for(const row of k.lifecycle?.legal??[]) {
112
+ if(!workflows[row.workflow]||!roles[row.owner])error('lifecycle','unresolved workflow/owner');
113
+ if(row.writer&&!roles[row.writer])error('lifecycle','unknown writer');
114
+ }
115
+ const routing=k.lifecycle?.routing??{};
116
+ for(const [name,value] of Object.entries(routing)) {
117
+ if(name.endsWith('_workflow')&&!ROUTER_DISPATCH_TARGETS.includes(value))error(name,'routing workflow is not a router target');
118
+ }
119
+ for(const row of Object.values(routing.invalidation_routes??{}))if(!ROUTER_DISPATCH_TARGETS.includes(row.workflow))error('invalidation_routes','unknown router target');
120
+ return errors;
121
+ }
122
+ export async function validateSystemContracts(system,skills=null) {
123
+ const k=JSON.parse(await readFile(join(system,'kernel.yaml'),'utf8')),errors=validateContracts(k);
124
+ async function textAt(path,id) {
125
+ try{return await readFile(await managedFile(system,path),'utf8')}catch{errors.push(`${id}: missing/invalid referenced file ${path}`);return ''}
126
+ }
127
+ for(const [id,r] of Object.entries(k.roles??{})) {
128
+ const text=await textAt(r.document,id);
129
+ for(const [wid,w] of Object.entries(k.workflows??{}))if(w.role===id&&!text.includes(operationHeader(wid,w)))errors.push(`${wid}: missing role operation`);
130
+ }
131
+ for(const [id,m] of Object.entries(k.modules??{}))await textAt(m.path,id);
132
+ if(skills) {
133
+ const {readdir}=await import('node:fs/promises');
134
+ const dirs=(await readdir(skills,{withFileTypes:true})).filter(e=>e.isDirectory()).map(e=>e.name);
135
+ if(!sameSet(dirs,Object.keys(k.skills??{})))errors.push('public skill directory/catalog mismatch');
136
+ for(const [id,s] of Object.entries(k.skills??{})) {
137
+ try {
138
+ const text=await readFile(join(skills,id,'SKILL.md'),'utf8');
139
+ for(const marker of [`name: ${id}`,`ROLE: \`${s.role}\``,`WORKFLOW: \`${s.requested_workflow}\``,`INTENT: \`${s.desired_outcome}\``, 'system/engine/runtime.mjs',`--invoke-skill ${id}`])if(!text.includes(marker))errors.push(`${id}: skill metadata/runtime invocation mismatch (${marker})`);
140
+ }catch{errors.push(`${id}: missing public skill`)}
141
+ }
142
+ }
143
+ // Completion and intent enums are already machine contracts; do not duplicate them.
144
+ const schema=JSON.parse(await readFile(join(system,'schemas/intent.schema.json'),'utf8'));
145
+ for(const [id,s] of Object.entries(k.skills??{}))for(const field of ['desired_outcome','completion_kind'])if(!schema.properties[field].enum.includes(s[field]))errors.push(`${id}: invalid ${field}`);
146
+ return errors;
147
+ }
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import { createHash } from "node:crypto";
3
+ import { lstatSync, readFileSync, readlinkSync } from "node:fs";
4
+ import { resolve } from "node:path";
5
+ import { spawnSync } from "node:child_process";
6
+
7
+ const ALGORITHM = "yaaw-worktree-v3";
8
+ const CONTROL_OUTPUT_EXCLUDES = [
9
+ ".yaaw-core/runtime/**",
10
+ ".yaaw-core/project/tickets/**",
11
+ ".yaaw-core/project/evidence/**",
12
+ ".yaaw-core/project/reviews/**"
13
+ ];
14
+ const EXCLUDE_PATHSPECS = CONTROL_OUTPUT_EXCLUDES.map(path => `:(exclude)${path}`);
15
+ const hash = value => createHash("sha256").update(value).digest("hex");
16
+ function stable(value){if(Array.isArray(value))return value.map(stable);if(value&&typeof value==="object")return Object.fromEntries(Object.keys(value).sort().map(k=>[k,stable(value[k])]));return value}
17
+ const canonicalJson=value=>JSON.stringify(stable(value));
18
+ function fail(status,message){process.stdout.write(JSON.stringify({schema:"yaaw.repository-identity/v2",algorithm:null,status,workspace_scope:".",git_root_relation:status==="UNVERSIONED"?"none":"unknown",head_commit:null,dirty:null,worktree_digest:null,components:null,changed_paths:[],error:message})+"\n");process.exitCode=2}
19
+ function git(workspace,args){const r=spawnSync("git",["-C",workspace,...args],{encoding:null,windowsHide:true,maxBuffer:64*1024*1024});if(r.error)throw r.error;if(r.status!==0)throw new Error((r.stderr??Buffer.alloc(0)).toString("utf8").trim()||`git ${args.join(" ")} exited ${r.status}`);return r.stdout??Buffer.alloc(0)}
20
+ const nulPaths=buf=>buf.toString("utf8").split("\0").filter(Boolean).map(p=>p.replaceAll("\\","/")).sort();
21
+ function untrackedRecord(workspace,path){const absolute=resolve(workspace,path),stat=lstatSync(absolute);if(stat.isSymbolicLink())return{path,kind:"symlink",sha256:hash(Buffer.from(readlinkSync(absolute),"utf8"))};if(stat.isFile())return{path,kind:"file",sha256:hash(readFileSync(absolute))};throw new Error(`unsupported untracked filesystem object: ${path}`)}
22
+ const args=process.argv.slice(2);let workspaceArg=".";for(let i=0;i<args.length;i+=1){if(args[i]==="--workspace"&&args[i+1]){workspaceArg=args[i+1];i+=1}else{process.stderr.write("usage: repository-identity.mjs [--workspace <path>]\n");process.exit(2)}}
23
+ const workspace=resolve(workspaceArg);let workspacePrefix;try{const inside=git(workspace,["rev-parse","--is-inside-work-tree"]).toString("utf8").trim();if(inside!=="true")throw new Error("workspace is not inside a Git work tree");workspacePrefix=git(workspace,["rev-parse","--show-prefix"]).toString("utf8").trim().replaceAll("\\","/")}catch(error){fail("UNVERSIONED",error instanceof Error?error.message:String(error))}
24
+ if(workspacePrefix!==undefined){try{const head=git(workspace,["rev-parse","HEAD"]).toString("utf8").trim(),scoped=[".",...EXCLUDE_PATHSPECS],status=git(workspace,["status","--porcelain=v1","-z","--untracked-files=all","--",...scoped]),unstaged=git(workspace,["diff","--binary","--no-ext-diff","--no-textconv","HEAD","--",...scoped]),staged=git(workspace,["diff","--cached","--binary","--no-ext-diff","--no-textconv","HEAD","--",...scoped]),untracked=nulPaths(git(workspace,["ls-files","--others","--exclude-standard","-z","--",...scoped])).map(p=>untrackedRecord(workspace,p)),tracked=new Set([...nulPaths(git(workspace,["diff","--name-only","-z","HEAD","--",...scoped])),...nulPaths(git(workspace,["diff","--cached","--name-only","-z","HEAD","--",...scoped]))]),components={status_sha256:hash(status),unstaged_diff_sha256:hash(unstaged),staged_diff_sha256:hash(staged),untracked_manifest_sha256:hash(Buffer.from(canonicalJson(untracked),"utf8"))},payload={algorithm:ALGORITHM,workspace_scope:".",head_commit:head,excluded:CONTROL_OUTPUT_EXCLUDES,...components,untracked},changed_paths=[...[...tracked].sort().map(path=>({path,kind:"tracked"})),...untracked.map(x=>({path:x.path,kind:"untracked",sha256:x.sha256}))].sort((a,b)=>a.path.localeCompare(b.path));process.stdout.write(JSON.stringify({schema:"yaaw.repository-identity/v2",algorithm:ALGORITHM,status:"READY",workspace_scope:".",git_root_relation:workspacePrefix?"ancestor":"same",head_commit:head,dirty:status.length>0,worktree_digest:"sha256:"+hash(Buffer.from(canonicalJson(payload),"utf8")),components,changed_paths,error:null})+"\n")}catch(error){if(process.exitCode!==2)fail("IDENTITY_FAILED",error instanceof Error?error.message:String(error))}}