@attalabs/vinaya 0.39.0 → 0.40.0

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 (151) hide show
  1. package/README.md +9 -9
  2. package/aeg-root/contracts/planner-developer.md +1 -1
  3. package/aeg-root/enforcement.md +22 -22
  4. package/aeg-root/process.md +1 -1
  5. package/aeg-root/roles/archivist.md +1 -1
  6. package/aeg-root/roles/developer/reference.md +4 -1
  7. package/aeg-root/roles/developer.md +1 -1
  8. package/aeg-root/roles/planner/reference.md +18 -5
  9. package/aeg-root/roles/principal.md +1 -1
  10. package/aeg-root/roles/reviewer.md +3 -3
  11. package/aeg-root/roles/security.md +4 -4
  12. package/aeg-root/roles/tranche-archivist.md +2 -2
  13. package/aeg-root/skills/aeg/SKILL.md +1 -1
  14. package/aeg-root/state-machine.md +8 -13
  15. package/aeg-root/templates/brief-template.md +4 -1
  16. package/aeg-root/templates/decision-record-template.md +38 -0
  17. package/aeg-root/templates/issue-rationale-template.md +1 -1
  18. package/aeg-root/tranche-model.md +1 -1
  19. package/dist/checks/bin/check-body-bare-digits.js +1867 -347
  20. package/dist/checks/bin/check-branch-topology.js +1181 -237
  21. package/dist/checks/bin/check-brief-shape.js +1911 -433
  22. package/dist/checks/bin/check-changeset-coverage.js +2144 -517
  23. package/dist/checks/bin/check-ci-shard-coverage.js +12133 -11
  24. package/dist/checks/bin/check-closes-n.js +1181 -237
  25. package/dist/checks/bin/check-coherence.js +1785 -1126
  26. package/dist/checks/bin/check-dead-branch-push.js +1154 -225
  27. package/dist/checks/bin/check-dispatch-readiness.js +2068 -436
  28. package/dist/checks/bin/check-doc-claims.js +2104 -231
  29. package/dist/checks/bin/check-doc-coverage-push.js +2181 -515
  30. package/dist/checks/bin/check-doc-coverage.js +2181 -519
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +1668 -345
  32. package/dist/checks/bin/check-doctrine-portability.js +2143 -516
  33. package/dist/checks/bin/check-evidence-fresh.js +2080 -465
  34. package/dist/checks/bin/check-exec-bits.js +2130 -503
  35. package/dist/checks/bin/check-first-push-dispatch.js +1845 -371
  36. package/dist/checks/bin/check-issue-assignment.js +712 -170
  37. package/dist/checks/bin/check-issue-milestone-attach.js +1145 -225
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +1661 -338
  39. package/dist/checks/bin/check-issue-parts-coverage.js +1145 -225
  40. package/dist/checks/bin/check-issue-surface-globs.js +1787 -369
  41. package/dist/checks/bin/check-issue-title-grammar.js +1145 -225
  42. package/dist/checks/bin/check-issue-tranche-label.js +702 -170
  43. package/dist/checks/bin/check-main-branch-refusal.js +1157 -227
  44. package/dist/checks/bin/check-no-disk-state.js +1145 -225
  45. package/dist/checks/bin/check-pr-premise-reassert.js +1661 -338
  46. package/dist/checks/bin/check-pr-report-density.js +1145 -225
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +2379 -249
  48. package/dist/checks/bin/check-quoted-command.js +2128 -501
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +2170 -517
  50. package/dist/checks/bin/check-registry-gates.js +1228 -272
  51. package/dist/checks/bin/check-retired-vocabulary.js +2153 -507
  52. package/dist/checks/bin/check-review-gate.js +1932 -350
  53. package/dist/checks/bin/check-single-plan-pr.js +1208 -229
  54. package/dist/checks/bin/check-surface-scope.js +1414 -244
  55. package/dist/checks/bin/check-test-plan.js +2381 -252
  56. package/dist/checks/bin/check-token-collection-wired.js +1145 -225
  57. package/dist/checks/bin/check-workspace-escape.js +2141 -514
  58. package/dist/checks/bin/verify-coherence.js +493 -86
  59. package/dist/checks/bin/verify-dispatch.js +512 -132
  60. package/dist/checks/bin/verify-docs.js +549 -124
  61. package/dist/index.js +22702 -17900
  62. package/dist/lib/pre-push-cache-test-run.js +1026 -233
  63. package/dist/lib/pre-push-select-tests.js +922 -173
  64. package/package.json +12 -1
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +13 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +55 -26
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +12 -1
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +22 -1
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -1
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/entry-point.ts +27 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +2 -1
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +19 -2
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +593 -55
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +1 -0
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +6 -4
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +19 -2
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +32 -13
  78. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  79. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  80. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  81. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  82. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  83. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  84. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  85. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  86. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  87. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  88. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  89. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  90. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  91. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  92. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  93. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  95. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +1 -1
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +2 -2
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0sxadt2._.js +13 -0
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +57 -0
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1ug9syi._.js → [root-of-the-server]__1wzfiav._.js} +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  143. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{06_55xbp7rcbi.js → 1p3vr9qts86_b.js} +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2brkwv169ygep.js → 21tunzmxjvm2a.js} +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{33rszkngkuoko.js → 38kom-9c-oi65.js} +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__04adkz-._.js +0 -57
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__19jyp3m._.js +0 -13
  149. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_buildManifest.js +0 -0
  150. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_clientMiddlewareManifest.js +0 -0
  151. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_ssgManifest.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attalabs/vinaya",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "description": "Vinaya — Agentic Engineering Harness. Deterministic checks every AI coding agent must satisfy before merge.",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-ALv2",
@@ -51,14 +51,25 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "gray-matter": "^4.0.3",
54
+ "safe-regex2": "5.1.1",
54
55
  "zod": "3.25.76"
55
56
  },
56
57
  "devDependencies": {
58
+ "@atta/adapter-langgraph": "file:tests/fixtures/atta-engine/atta-adapter-langgraph-0.0.1.tgz",
59
+ "@atta/agents": "file:tests/fixtures/atta-engine/atta-agents-0.1.0.tgz",
60
+ "@atta/engine": "file:tests/fixtures/atta-engine/atta-engine-0.0.1.tgz",
61
+ "@atta/models": "file:tests/fixtures/atta-engine/atta-models-0.1.0.tgz",
57
62
  "@attalabs/aeg-core": "workspace:*",
58
63
  "@attalabs/aeg-forge-state": "workspace:*",
59
64
  "@atta/typescript-config": "workspace:*",
60
65
  "@attalabs/vinaya-sources": "workspace:*",
61
66
  "@types/bun": "latest",
67
+ "@types/react": "^19.0.0",
62
68
  "typescript": "^5.5.0"
69
+ },
70
+ "overrides": {
71
+ "@atta/agents": "file:tests/fixtures/atta-engine/atta-agents-0.1.0.tgz",
72
+ "@atta/engine": "file:tests/fixtures/atta-engine/atta-engine-0.0.1.tgz",
73
+ "@atta/models": "file:tests/fixtures/atta-engine/atta-models-0.1.0.tgz"
63
74
  }
64
75
  }
@@ -52,13 +52,24 @@
52
52
  import { maskCode } from '@attalabs/aeg-forge-state/strip-code'
53
53
 
54
54
  /**
55
- * The six gate-read fields with an anchored home. A `TOKENS` entry belonged
55
+ * The gate-read fields with an anchored home. `BEYOND-SURFACE`, like
56
+ * `EVIDENCE`, is never hand-typed: the review-loop driver rewrites it on every
57
+ * pull-request body write with each changed path the task's Surface does not
58
+ * cover, and the `surface-scope` check reads it. A `TOKENS` entry belonged
56
59
  * here while a pull-request body carried a token table; that table is retired
57
60
  * — token use is recorded as the Vinaya log's own `usage` event — so nothing
58
61
  * writes or reads that anchor any more. An older body that still carries the
59
62
  * pair keeps it: no reader here resolves it, and no writer touches it.
60
63
  */
61
- export const ANCHOR_FIELDS = ['CLOSES', 'PROJECT', 'TIER', 'PREMISE', 'TEST-PLAN', 'EVIDENCE'] as const
64
+ export const ANCHOR_FIELDS = [
65
+ 'CLOSES',
66
+ 'PROJECT',
67
+ 'TIER',
68
+ 'PREMISE',
69
+ 'TEST-PLAN',
70
+ 'EVIDENCE',
71
+ 'BEYOND-SURFACE'
72
+ ] as const
62
73
 
63
74
  export type AnchorField = (typeof ANCHOR_FIELDS)[number]
64
75
 
@@ -351,7 +351,12 @@ export type BriefFacts = {
351
351
  export type LocalGateCommands = {
352
352
  /** e.g. `bun packages/aeg-core/bin/verify-dispatch.ts`, or `null`. */
353
353
  dispatchReadiness: string | null
354
- /** e.g. `bun packages/aeg-core/bin/verify-docs.ts`, or `null`. */
354
+ /**
355
+ * e.g. `bun packages/aeg-core/bin/verify-docs.ts`, or `null`. No longer
356
+ * rendered: the documentation gate is the controller's (`run_checks`, CI),
357
+ * so §12 names no hand-run pre-open command. Still a fact the caller
358
+ * states, so the caller's own shape is unchanged.
359
+ */
355
360
  docCoverage: string | null
356
361
  }
357
362
 
@@ -459,8 +464,8 @@ function renderSection2(facts: BriefFacts): string {
459
464
  const branch = developerBranchForFacts(facts)
460
465
  const identityLine =
461
466
  facts.trancheSlug !== null
462
- ? `- **Tranche:** \`${facts.trancheSlug}\`, task ${facts.taskId}, Issue #${facts.issue}. Branch \`${branch}\`. \`Depends-on: ${depends}\`, \`Conflicts-with: ${conflicts}\`. Confirm dispatch readiness at your own Step 0, with the command §5 names.`
463
- : `- **Backlog Issue:** #${facts.issue}, no tranche. Branch \`${branch}\`. \`Depends-on: ${depends}\`, \`Conflicts-with: ${conflicts}\`. Confirm dispatch readiness at your own Step 0, with the command §5 names.`
467
+ ? `- **Tranche:** \`${facts.trancheSlug}\`, task ${facts.taskId}, Issue #${facts.issue}. Branch \`${branch}\`. \`Depends-on: ${depends}\`, \`Conflicts-with: ${conflicts}\`.`
468
+ : `- **Backlog Issue:** #${facts.issue}, no tranche. Branch \`${branch}\`. \`Depends-on: ${depends}\`, \`Conflicts-with: ${conflicts}\`.`
464
469
  const lines = [
465
470
  '## 2. Context — read before doing anything',
466
471
  '',
@@ -508,8 +513,18 @@ export function extractSourceRevision(briefText: string): string | null {
508
513
  return m ? (m[1] as string) : null
509
514
  }
510
515
 
516
+ /**
517
+ * The line §3 carries for a single-fix Issue — one with no tranche — that
518
+ * declares no Dependency rationale: a single fix has no siblings to relate to,
519
+ * so the render states the absence of edges rather than refusing for prose the
520
+ * Issue gate no longer asks of it.
521
+ */
522
+ export const SINGLE_FIX_NO_EDGES_LINE =
523
+ '**Dependency rationale** — none: this single-fix Issue declares no `Depends-on` or `Conflicts-with` edge.'
524
+
511
525
  function renderSection3(facts: BriefFacts): string {
512
- return ['## 3. Technical dependencies', '', `${facts.rationale.dependencyRationale}`].join('\n')
526
+ const dependencies = facts.rationale.dependencyRationale ?? SINGLE_FIX_NO_EDGES_LINE
527
+ return ['## 3. Technical dependencies', '', dependencies].join('\n')
513
528
  }
514
529
 
515
530
  // O6: the nearest ancestor directory of `path` that is itself
@@ -543,6 +558,14 @@ function nearestTestDir(path: string): string {
543
558
  return path
544
559
  }
545
560
 
561
+ /**
562
+ * Appended to §4's out-of-surface line: what happens to a change the Surface
563
+ * does not cover. Names no path, so the consumer-tests scan of §4 never reads
564
+ * a package in it.
565
+ */
566
+ export const BEYOND_SURFACE_RECORDING_RULE =
567
+ " — a change there, or to any path no Surface `in:` glob covers, is still published: the review-loop driver records each such path in the pull request body's beyond-Surface block, and the reviewers judge it like any change."
568
+
546
569
  function renderSection4(facts: BriefFacts): string {
547
570
  const created = facts.surfaceFiles.filter((f) => f.sha256 === null).map((f) => f.path)
548
571
  const modified = facts.surfaceFiles.filter((f) => f.sha256 !== null).map((f) => f.path)
@@ -578,11 +601,15 @@ function renderSection4(facts: BriefFacts): string {
578
601
  : '- (none named)'
579
602
 
580
603
  const createdBlock = created.length > 0 ? bulletList(created) : '- (none — every surface file already exists)'
604
+ // The recording rule rides on the same line: a change beyond the Surface is
605
+ // published, never refused — the driver records it in the pull request
606
+ // body and the reviewers judge it like any change.
581
607
  const outOfSurfaceLine =
582
608
  '**Out of surface:** ' +
583
609
  (facts.surface.out.length > 0
584
610
  ? facts.surface.out.join(', ')
585
- : "(none named — the Issue's `## Surface` `out:` line is empty)")
611
+ : "(none named — the Issue's `## Surface` `out:` line is empty)") +
612
+ BEYOND_SURFACE_RECORDING_RULE
586
613
  const premisePinsBlock = bulletList(
587
614
  facts.surfaceFiles
588
615
  .filter((f): f is SurfaceFileFact & { sha256: string } => f.sha256 !== null)
@@ -716,6 +743,20 @@ const RENDER_CHECK_NAME_RE = /\bcheck-[a-z0-9-]+(?:\.ts)?\b/
716
743
  const RENDER_FORGE_WRITE_COMMAND_RE =
717
744
  /\bgh\s+(?:pr|issue)\s+(?:create|merge|close|comment|edit|review)\b|\bgit\s+push\b|\bvinaya\s+pr\s+(?:create|report\s+--write)\b/i
718
745
 
746
+ /**
747
+ * The one publication rule the brief states, in §6's heading and in full in
748
+ * §12. A publication is one `publish_changes` call: a single commit of the
749
+ * whole worktree plus the push that runs the affected suite
750
+ * (`developer-publication.ts`, `apps/cli`) — so publishing per Part would run
751
+ * that suite once per Part, where §6's own Part lines already speak of one push.
752
+ * The driver's own re-ask prompts (no commit yet, pushed with no pull request,
753
+ * a refused push, a merge conflict) each ask for exactly the publication this
754
+ * rule already allows.
755
+ */
756
+ const PUBLICATION_RULE_HEADING = 'publish once with `publish_changes` when every Part is done, then `open_pull_request`'
757
+ const PUBLICATION_RULE =
758
+ '- Publish once, with `publish_changes`, when every Part is done; then open the pull request with `open_pull_request`. Publish again only to answer review findings or a red gate — a refused hook, a failing check, a merge conflict.'
759
+
719
760
  /**
720
761
  * §6 — one numbered Part per `IssuePart` (facts.parts), citation
721
762
  * reconstructed verbatim per `renderPartCitation`. Files stay grouped by
@@ -778,11 +819,7 @@ function renderSection6(facts: BriefFacts): string {
778
819
  return lines.join('\n')
779
820
  })
780
821
 
781
- return [
782
- '## 6. Numbered parts — call `publish_changes` after EACH part; `open_pull_request` once the first part is published',
783
- '',
784
- ...rendered
785
- ].join('\n')
822
+ return [`## 6. Numbered parts — ${PUBLICATION_RULE_HEADING}`, '', ...rendered].join('\n')
786
823
  }
787
824
 
788
825
  function renderSection7(section7Pointers: string[]): string {
@@ -797,19 +834,6 @@ function renderSection7(section7Pointers: string[]): string {
797
834
  return lines.join('\n')
798
835
  }
799
836
 
800
- /**
801
- * The pre-open documentation gate, as one command the reader can run — cited
802
- * by both §8 and §12, so it is written once. `check doc-coverage` is the
803
- * portable form; the authoring repository's fuller `--pr` derivation is
804
- * appended only when `facts` says that repository ships one.
805
- */
806
- function docGateCommand(facts: BriefFacts): string {
807
- const portable = `\`PR_BODY="$(cat <body-file>)" ${facts.cliInvocation} check doc-coverage\` green`
808
- return facts.localGateCommands.docCoverage !== null
809
- ? `${portable} (this repository also ships \`PR_BODY="$(cat <body-file>)" ${facts.localGateCommands.docCoverage} --pr\`, which additionally evaluates the spec-status and code-requires-docs contracts)`
810
- : portable
811
- }
812
-
813
837
  function renderSection8(facts: BriefFacts): string {
814
838
  return [
815
839
  '## 8. Verification before claiming done',
@@ -914,9 +938,10 @@ function renderSection12(facts: BriefFacts): string {
914
938
  '',
915
939
  `- PR title (exact): \`${prTitle}\``,
916
940
  '- Open the PR only via the `open_pull_request` tool (title and body); publish your commits with `publish_changes` and update the body with `update_pull_request_body`/`refresh_evidence` — you hold no `gh`/`git push` credential.',
917
- `- PR body = the Developer's PR report (print it with \`${facts.cliInvocation} doctrine --template pr-report --print\`), with this entire brief pasted as the reference copy inside a collapsed \`<details>\` block, and \`Closes #${facts.issue}\` at the top of the header block.`,
918
- `- Pre-open gate: tier checklist satisfied, and ${docGateCommand(facts)}.`,
919
- "- Include `git diff origin/main...HEAD --stat` as context only; Surface is judged by the driver's `surface-scope` check, never by this hand-run diff. Include a token report (if unavailable, state so).",
941
+ PUBLICATION_RULE,
942
+ `- PR body = the Developer's PR report (print it with \`${facts.cliInvocation} doctrine --template pr-report --print\`), with \`Closes #${facts.issue}\` at the top of the header block. This brief stays frozen on the task Issue and never rides in the body.`,
943
+ "- Pre-open: tier checklist satisfied. The documentation gate is the controller's — `run_checks` and CI run it.",
944
+ "- Include `git diff origin/main...HEAD --stat` as context only; Surface is judged by the driver's `surface-scope` check, never by this hand-run diff. Token use needs no report — the Vinaya log records it.",
920
945
  '- Then STOP. Review and Verification are separate invocations.'
921
946
  ].join('\n')
922
947
  }
@@ -1002,6 +1027,10 @@ export function renderBrief(facts: BriefFacts, template: string): RenderResult {
1002
1027
  if (!facts.dispatchReady) missing.push(...facts.dispatchBlockers)
1003
1028
 
1004
1029
  for (const key of Object.keys(RATIONALE_FIELD_PATTERNS) as RationaleFieldKey[]) {
1030
+ // A single-fix Issue (no tranche) may omit its Dependency rationale;
1031
+ // `renderSection3` then writes `SINGLE_FIX_NO_EDGES_LINE`. A tranche task
1032
+ // still needs the field to render.
1033
+ if (key === 'dependencyRationale' && facts.trancheSlug === null) continue
1005
1034
  if (!facts.rationale[key]) missing.push(RATIONALE_FIELD_NAMES[key])
1006
1035
  }
1007
1036
 
@@ -62,7 +62,8 @@ export type FindingObservation = {
62
62
  /**
63
63
  * Set only when the round set this finding aside rather than let it block
64
64
  * (O2/O3): `'unchanged-line'` (round 2 on, a line that did not change) or
65
- * `'outside-surface'` (any round, a file the Surface `in:` does not cover).
65
+ * `'outside-surface'` (any round, a file the Surface `in:` does not cover
66
+ * and the task branch did not change).
66
67
  * Absent means the finding was NOT deferred — it blocked, or was below
67
68
  * threshold. `policyTreatment` reads `non_blocking` whenever this is set.
68
69
  */
@@ -229,6 +230,15 @@ export type Observations =
229
230
  * `assessRound` from the clock its caller reads (this module has none of its
230
231
  * own); `detail` names the budget, the active time spent, and the active phases
231
232
  * that time was summed from.
233
+ *
234
+ * `'sandbox_refused'`: a dispatch was refused before the agent started
235
+ * because the agent's own sandbox could not run a probe command on this host
236
+ * — a capability refusal, not a transient: the host does not change by
237
+ * itself, so the driver never retries it. Driver-decided from the dispatch's
238
+ * typed probe result, addressed to the Operator; `detail` carries the
239
+ * probe's own error. It is outside the automatic-recovery set and spends no
240
+ * infrastructure retry; once the host is repaired, the ordinary start
241
+ * continues the task from it, recording the pause's resolution once.
232
242
  */
233
243
  export type PauseReason =
234
244
  | 'escalation'
@@ -246,6 +256,7 @@ export type PauseReason =
246
256
  | 'stale_driver'
247
257
  | 'brief_superseded'
248
258
  | 'policy_changed'
259
+ | 'sandbox_refused'
249
260
 
250
261
  export type Decision =
251
262
  | { type: 'dispatch_developer'; reason?: 'confidence' }
@@ -18,6 +18,27 @@
18
18
  * line per failure, naming the exact task/Issue/PR involved.
19
19
  */
20
20
 
21
+ import { edgesNameEachOther } from './issue-validation'
22
+
23
+ /** The one edge reader both gates use — the write gate's own function, re-exposed so a test can assert identity. */
24
+ export const conflictEdgeReader = edgesNameEachOther
25
+
26
+ /** One task Issue reduced to what an edge reader needs: its reference and its parsed `Conflicts-with` ids. */
27
+ export type ConflictEdgeParty = { ref: string; conflictsWith: string[] }
28
+
29
+ /**
30
+ * The dispatch gate's edge reader: the same `edgesNameEachOther` the Issue
31
+ * write gate uses, so a `Conflicts-with` edge is present when EITHER task
32
+ * names the other. Returns the siblings sharing an edge with `subject`,
33
+ * whichever side declared it. `Depends-on` is directed and never read here.
34
+ */
35
+ export function siblingsSharingConflictEdge<S extends ConflictEdgeParty>(
36
+ subject: ConflictEdgeParty,
37
+ siblings: S[]
38
+ ): S[] {
39
+ return siblings.filter((s) => s.ref !== subject.ref && conflictEdgeReader(subject, s))
40
+ }
41
+
21
42
  import type { Task } from './types'
22
43
  import { isPrincipal, PRINCIPAL_ALLOWLIST } from './waiver-label'
23
44
 
@@ -245,7 +266,7 @@ export function checkDispatchReadiness(input: DispatchGateInput): DispatchResult
245
266
  if (input.issue !== null && !input.issueRationalePass) {
246
267
  push(
247
268
  'rationale',
248
- `dispatch-gate rationale: Issue #${input.issue.number} for ${taskLabel} fails the rationale gate (checkIssueRationale) — the Planner must complete the eight-field rationale before this task is dispatchable.`
269
+ `dispatch-gate rationale: Issue #${input.issue.number} for ${taskLabel} fails the rationale gate (checkIssueRationale) — the Planner must complete the rationale (all eight fields for a tranche task; a single-fix Issue omits only Sizing, Project(s) + blast radius and Dependency rationale) before this task is dispatchable.`
249
270
  )
250
271
  }
251
272
 
@@ -83,7 +83,12 @@ const STATIC_PORTABLE_PREFIXES: readonly string[] = [
83
83
  // genuinely has — adopter-owned by construction, the same class as
84
84
  // `.github/`/`.vinaya/`/`.claude/` above.
85
85
  '.git/',
86
- '.husky/'
86
+ '.husky/',
87
+ // The per-role entry points `vinaya init` writes into every adopter — the
88
+ // shared agent-skills directory and a second host's command directory —
89
+ // adopter-owned by construction, the same class as `.claude/` above.
90
+ '.agents/',
91
+ '.gemini/'
87
92
  ]
88
93
 
89
94
  /**
@@ -0,0 +1,27 @@
1
+ import { realpathSync } from 'node:fs'
2
+ import { basename, extname } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ /**
6
+ * Whether the module at `moduleUrl` (pass `import.meta.url`) is the script
7
+ * named `scriptName` (its file name without extension) the runtime was started
8
+ * on. Bundled bins use this instead of `import.meta.main`, which the CLI build
9
+ * rewrites to a CommonJS `__require.main` check that throws on load under ESM
10
+ * when no `__require` shim is emitted. Both paths are resolved through
11
+ * `realpathSync` because the installed CLI is reached through a symlinked bin.
12
+ * `scriptName` is needed because a bundle that inlines this module into another
13
+ * entry (the CLI's own `index.js`) gives every inlined module that entry's URL.
14
+ */
15
+ export function isEntryPoint(
16
+ moduleUrl: string,
17
+ scriptName: string,
18
+ startedOn: string | undefined = process.argv[1]
19
+ ): boolean {
20
+ if (!startedOn) return false
21
+ try {
22
+ const started = realpathSync(startedOn)
23
+ return basename(started, extname(started)) === scriptName && realpathSync(fileURLToPath(moduleUrl)) === started
24
+ } catch {
25
+ return false
26
+ }
27
+ }
@@ -126,7 +126,7 @@ export const CLI_CHECK_RING: Readonly<Record<string, 0 | 1 | 2>> = {
126
126
  'dispatch-readiness': 0,
127
127
  'closes-n': 1,
128
128
  'single-plan-pr': 0,
129
- 'surface-scope': 0,
129
+ 'surface-scope': 1,
130
130
  'test-plan': 1,
131
131
  'principal-test-plan-wait': 1,
132
132
  'body-bare-digits': 1,
@@ -140,6 +140,7 @@ export const CLI_CHECK_RING: Readonly<Record<string, 0 | 1 | 2>> = {
140
140
  'issue-assignment': 0,
141
141
  'evidence-fresh': 1,
142
142
  'reader-resolvable-prose': 0,
143
+ 'doc-claims': 0,
143
144
  'retired-vocabulary': 0,
144
145
  'doctrine-no-procedures': 0,
145
146
  'doctrine-portability': 0,
@@ -1,3 +1,4 @@
1
+ export { isEntryPoint } from './entry-point'
1
2
  export * from './types'
2
3
  export type { StateSource } from './state-source'
3
4
  export type { DoctrineContent, DoctrineSource } from './doctrine-source'
@@ -272,19 +273,25 @@ export {
272
273
  checkIssueObjectives,
273
274
  checkIssuePremises,
274
275
  checkIssueRationale,
276
+ type IssueRationaleOptions,
275
277
  checkIssueType,
276
278
  checkIntroducedCommandsCovered,
277
279
  checkIntroducedConfigKeysCovered,
278
280
  checkMilestoneAttach,
279
281
  checkNoBriefContent,
280
282
  checkNoForeignTaskOwnership,
283
+ checkProseAllowsBeyondSurfaceEdit,
284
+ checkCrossTaskValuesPinned,
281
285
  checkObjectivesRespectBoundary,
282
286
  checkPartsCiteDefinedObjectives,
283
287
  checkPartsCoverageAndSequence,
284
288
  checkPinnedFileImportersCovered,
289
+ decidePinnedFileImporters,
290
+ surfaceForcedSet,
285
291
  checkNewTestFilesCoverShards,
286
292
  checkNewLoopFilesCoverInvariantMap,
287
293
  checkDocumentationReadable,
294
+ checkDocumentationPathsExist,
288
295
  isNonPublicHost,
289
296
  documentationUrls,
290
297
  type DocumentationProbe,
@@ -297,7 +304,12 @@ export {
297
304
  checkSurfaceGlobsResolve,
298
305
  checkSurfaceOverlap,
299
306
  checkTrancheLabelPresence,
307
+ checkTestPlanDeveloperRunnable,
300
308
  checkSurfaceScope,
309
+ beyondSurfacePaths,
310
+ recordedBeyondSurfacePaths,
311
+ renderBeyondSurfaceBlock,
312
+ withBeyondSurfaceBlock,
301
313
  declaredProjects,
302
314
  edgesNameEachOther,
303
315
  frozenSectionsChanged,
@@ -328,8 +340,12 @@ export type {
328
340
  IssueSurface,
329
341
  IssueTestPlan,
330
342
  PinnedFileImporters,
343
+ PinnedImporterDecision,
344
+ PinnedFileDecisions,
345
+ SurfaceForcedSet,
346
+ ForcedCompanion,
347
+ BeyondSurfacePath,
331
348
  SurfaceScopeResult,
332
- SurfaceScopeViolation,
333
349
  ProjectPath,
334
350
  TaskFileFacts,
335
351
  TaskIssueFacts,
@@ -436,7 +452,8 @@ export type {
436
452
  LocalAnchorCoverageOptions,
437
453
  LocalAnchorCoverageResult
438
454
  } from './local-anchor-coverage'
439
- export { checkDispatchReadiness } from './dispatch-gate'
455
+ export { checkDispatchReadiness, siblingsSharingConflictEdge } from './dispatch-gate'
456
+ export type { ConflictEdgeParty } from './dispatch-gate'
440
457
  export type {
441
458
  DispatchBlocker,
442
459
  DispatchBlockerClass,