@bonesofspring/ai-rules 0.2.73 → 0.2.74

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 (216) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +1 -1
  3. package/bin/lib/engine-scripts.js +8 -0
  4. package/docs/TEAM-DB.md +86 -5
  5. package/docs/openapi/team-db.v1.json +1164 -224
  6. package/package.json +1 -1
  7. package/presets/_shared/ai-local/scripts/action-signals.mjs +225 -0
  8. package/presets/_shared/ai-local/scripts/actions-report.mjs +210 -0
  9. package/presets/_shared/ai-local/scripts/processes.mjs +5 -4
  10. package/presets/_shared/ai-local/scripts/rr-scheduler-start.mjs +161 -0
  11. package/presets/_shared/ai-local/scripts/team-db-api.mjs +347 -9
  12. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +309 -4
  13. package/presets/_shared/ai-local/scripts/team-db-project.mjs +239 -25
  14. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +86 -1
  15. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +15 -1
  16. package/presets/claude/android-kotlin/commands/README.md +4 -0
  17. package/presets/claude/android-kotlin/commands/rr-scheduler-start.md +32 -0
  18. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +15 -1
  19. package/presets/claude/go/commands/README.md +4 -0
  20. package/presets/claude/go/commands/rr-scheduler-start.md +32 -0
  21. package/presets/claude/go/hooks/chain-team-phases.sh +15 -1
  22. package/presets/claude/ios-swift/commands/README.md +4 -0
  23. package/presets/claude/ios-swift/commands/rr-scheduler-start.md +32 -0
  24. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +15 -1
  25. package/presets/claude/java/commands/README.md +4 -0
  26. package/presets/claude/java/commands/rr-scheduler-start.md +32 -0
  27. package/presets/claude/java/hooks/chain-team-phases.sh +15 -1
  28. package/presets/claude/mcp-ts/commands/README.md +4 -0
  29. package/presets/claude/mcp-ts/commands/rr-scheduler-start.md +32 -0
  30. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +15 -1
  31. package/presets/claude/mol/commands/README.md +4 -0
  32. package/presets/claude/mol/commands/rr-scheduler-start.md +32 -0
  33. package/presets/claude/mol/hooks/chain-team-phases.sh +15 -1
  34. package/presets/claude/next/commands/README.md +4 -0
  35. package/presets/claude/next/commands/rr-scheduler-start.md +32 -0
  36. package/presets/claude/next/hooks/chain-team-phases.sh +15 -1
  37. package/presets/claude/nuxt/commands/README.md +4 -0
  38. package/presets/claude/nuxt/commands/rr-scheduler-start.md +32 -0
  39. package/presets/claude/nuxt/hooks/chain-team-phases.sh +15 -1
  40. package/presets/claude/php-hexagonal/commands/README.md +4 -0
  41. package/presets/claude/php-hexagonal/commands/rr-scheduler-start.md +32 -0
  42. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +15 -1
  43. package/presets/claude/php-laravel/commands/README.md +4 -0
  44. package/presets/claude/php-laravel/commands/rr-scheduler-start.md +32 -0
  45. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +15 -1
  46. package/presets/claude/svelte/commands/README.md +4 -0
  47. package/presets/claude/svelte/commands/rr-scheduler-start.md +32 -0
  48. package/presets/claude/svelte/hooks/chain-team-phases.sh +15 -1
  49. package/presets/cursor/android-kotlin/commands/README.md +4 -0
  50. package/presets/cursor/android-kotlin/commands/rr-scheduler-start.md +32 -0
  51. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +15 -1
  52. package/presets/cursor/go/commands/README.md +4 -0
  53. package/presets/cursor/go/commands/rr-scheduler-start.md +32 -0
  54. package/presets/cursor/go/hooks/chain-team-phases.sh +15 -1
  55. package/presets/cursor/ios-swift/commands/README.md +4 -0
  56. package/presets/cursor/ios-swift/commands/rr-scheduler-start.md +32 -0
  57. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +15 -1
  58. package/presets/cursor/java/commands/README.md +4 -0
  59. package/presets/cursor/java/commands/rr-scheduler-start.md +32 -0
  60. package/presets/cursor/java/hooks/chain-team-phases.sh +15 -1
  61. package/presets/cursor/mcp-ts/commands/README.md +4 -0
  62. package/presets/cursor/mcp-ts/commands/rr-scheduler-start.md +32 -0
  63. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +15 -1
  64. package/presets/cursor/mol/commands/README.md +4 -0
  65. package/presets/cursor/mol/commands/rr-scheduler-start.md +32 -0
  66. package/presets/cursor/mol/hooks/chain-team-phases.sh +15 -1
  67. package/presets/cursor/next/commands/README.md +4 -0
  68. package/presets/cursor/next/commands/rr-scheduler-start.md +32 -0
  69. package/presets/cursor/next/hooks/chain-team-phases.sh +15 -1
  70. package/presets/cursor/nuxt/commands/README.md +4 -0
  71. package/presets/cursor/nuxt/commands/rr-scheduler-start.md +32 -0
  72. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +15 -1
  73. package/presets/cursor/php-hexagonal/commands/README.md +4 -0
  74. package/presets/cursor/php-hexagonal/commands/rr-scheduler-start.md +32 -0
  75. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +15 -1
  76. package/presets/cursor/php-laravel/commands/README.md +4 -0
  77. package/presets/cursor/php-laravel/commands/rr-scheduler-start.md +32 -0
  78. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +15 -1
  79. package/presets/cursor/svelte/commands/README.md +4 -0
  80. package/presets/cursor/svelte/commands/rr-scheduler-start.md +32 -0
  81. package/presets/cursor/svelte/hooks/chain-team-phases.sh +15 -1
  82. package/presets/mavis/android-kotlin/adapter-map.json +9 -1
  83. package/presets/mavis/android-kotlin/commands/README.md +4 -0
  84. package/presets/mavis/android-kotlin/commands/rr-scheduler-start.md +27 -0
  85. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +15 -1
  86. package/presets/mavis/go/adapter-map.json +9 -1
  87. package/presets/mavis/go/commands/README.md +4 -0
  88. package/presets/mavis/go/commands/rr-scheduler-start.md +27 -0
  89. package/presets/mavis/go/hooks/chain-team-phases.sh +15 -1
  90. package/presets/mavis/ios-swift/adapter-map.json +9 -1
  91. package/presets/mavis/ios-swift/commands/README.md +4 -0
  92. package/presets/mavis/ios-swift/commands/rr-scheduler-start.md +27 -0
  93. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +15 -1
  94. package/presets/mavis/java/adapter-map.json +9 -1
  95. package/presets/mavis/java/commands/README.md +4 -0
  96. package/presets/mavis/java/commands/rr-scheduler-start.md +27 -0
  97. package/presets/mavis/java/hooks/chain-team-phases.sh +15 -1
  98. package/presets/mavis/mcp-ts/adapter-map.json +9 -1
  99. package/presets/mavis/mcp-ts/commands/README.md +4 -0
  100. package/presets/mavis/mcp-ts/commands/rr-scheduler-start.md +27 -0
  101. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +15 -1
  102. package/presets/mavis/mol/adapter-map.json +9 -1
  103. package/presets/mavis/mol/commands/README.md +4 -0
  104. package/presets/mavis/mol/commands/rr-scheduler-start.md +27 -0
  105. package/presets/mavis/mol/hooks/chain-team-phases.sh +15 -1
  106. package/presets/mavis/next/adapter-map.json +9 -1
  107. package/presets/mavis/next/commands/README.md +4 -0
  108. package/presets/mavis/next/commands/rr-scheduler-start.md +27 -0
  109. package/presets/mavis/next/hooks/chain-team-phases.sh +15 -1
  110. package/presets/mavis/nuxt/adapter-map.json +9 -1
  111. package/presets/mavis/nuxt/commands/README.md +4 -0
  112. package/presets/mavis/nuxt/commands/rr-scheduler-start.md +27 -0
  113. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +15 -1
  114. package/presets/mavis/php-hexagonal/adapter-map.json +9 -1
  115. package/presets/mavis/php-hexagonal/commands/README.md +4 -0
  116. package/presets/mavis/php-hexagonal/commands/rr-scheduler-start.md +27 -0
  117. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +15 -1
  118. package/presets/mavis/php-laravel/adapter-map.json +9 -1
  119. package/presets/mavis/php-laravel/commands/README.md +4 -0
  120. package/presets/mavis/php-laravel/commands/rr-scheduler-start.md +27 -0
  121. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +15 -1
  122. package/presets/mavis/svelte/adapter-map.json +9 -1
  123. package/presets/mavis/svelte/commands/README.md +4 -0
  124. package/presets/mavis/svelte/commands/rr-scheduler-start.md +27 -0
  125. package/presets/mavis/svelte/hooks/chain-team-phases.sh +15 -1
  126. package/presets/opencode/android-kotlin/adapter-map.json +9 -1
  127. package/presets/opencode/android-kotlin/commands/README.md +4 -0
  128. package/presets/opencode/android-kotlin/commands/rr-scheduler-start.md +35 -0
  129. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +15 -1
  130. package/presets/opencode/go/adapter-map.json +9 -1
  131. package/presets/opencode/go/commands/README.md +4 -0
  132. package/presets/opencode/go/commands/rr-scheduler-start.md +35 -0
  133. package/presets/opencode/go/hooks/chain-team-phases.sh +15 -1
  134. package/presets/opencode/ios-swift/adapter-map.json +9 -1
  135. package/presets/opencode/ios-swift/commands/README.md +4 -0
  136. package/presets/opencode/ios-swift/commands/rr-scheduler-start.md +35 -0
  137. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +15 -1
  138. package/presets/opencode/java/adapter-map.json +9 -1
  139. package/presets/opencode/java/commands/README.md +4 -0
  140. package/presets/opencode/java/commands/rr-scheduler-start.md +35 -0
  141. package/presets/opencode/java/hooks/chain-team-phases.sh +15 -1
  142. package/presets/opencode/mcp-ts/adapter-map.json +9 -1
  143. package/presets/opencode/mcp-ts/commands/README.md +4 -0
  144. package/presets/opencode/mcp-ts/commands/rr-scheduler-start.md +35 -0
  145. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +15 -1
  146. package/presets/opencode/mol/adapter-map.json +9 -1
  147. package/presets/opencode/mol/commands/README.md +4 -0
  148. package/presets/opencode/mol/commands/rr-scheduler-start.md +35 -0
  149. package/presets/opencode/mol/hooks/chain-team-phases.sh +15 -1
  150. package/presets/opencode/next/adapter-map.json +9 -1
  151. package/presets/opencode/next/commands/README.md +4 -0
  152. package/presets/opencode/next/commands/rr-scheduler-start.md +35 -0
  153. package/presets/opencode/next/hooks/chain-team-phases.sh +15 -1
  154. package/presets/opencode/nuxt/adapter-map.json +9 -1
  155. package/presets/opencode/nuxt/commands/README.md +4 -0
  156. package/presets/opencode/nuxt/commands/rr-scheduler-start.md +35 -0
  157. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +15 -1
  158. package/presets/opencode/php-hexagonal/adapter-map.json +9 -1
  159. package/presets/opencode/php-hexagonal/commands/README.md +4 -0
  160. package/presets/opencode/php-hexagonal/commands/rr-scheduler-start.md +35 -0
  161. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +15 -1
  162. package/presets/opencode/php-laravel/adapter-map.json +9 -1
  163. package/presets/opencode/php-laravel/commands/README.md +4 -0
  164. package/presets/opencode/php-laravel/commands/rr-scheduler-start.md +35 -0
  165. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +15 -1
  166. package/presets/opencode/plugins/output-guard/README.md +42 -1
  167. package/presets/opencode/plugins/output-guard/actions.ts +201 -0
  168. package/presets/opencode/plugins/output-guard/index.ts +147 -6
  169. package/presets/opencode/svelte/adapter-map.json +9 -1
  170. package/presets/opencode/svelte/commands/README.md +4 -0
  171. package/presets/opencode/svelte/commands/rr-scheduler-start.md +35 -0
  172. package/presets/opencode/svelte/hooks/chain-team-phases.sh +15 -1
  173. package/presets/zcode/android-kotlin/adapter-map.json +9 -1
  174. package/presets/zcode/android-kotlin/commands/README.md +4 -0
  175. package/presets/zcode/android-kotlin/commands/rr-scheduler-start.md +35 -0
  176. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +15 -1
  177. package/presets/zcode/go/adapter-map.json +9 -1
  178. package/presets/zcode/go/commands/README.md +4 -0
  179. package/presets/zcode/go/commands/rr-scheduler-start.md +35 -0
  180. package/presets/zcode/go/hooks/chain-team-phases.sh +15 -1
  181. package/presets/zcode/ios-swift/adapter-map.json +9 -1
  182. package/presets/zcode/ios-swift/commands/README.md +4 -0
  183. package/presets/zcode/ios-swift/commands/rr-scheduler-start.md +35 -0
  184. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +15 -1
  185. package/presets/zcode/java/adapter-map.json +9 -1
  186. package/presets/zcode/java/commands/README.md +4 -0
  187. package/presets/zcode/java/commands/rr-scheduler-start.md +35 -0
  188. package/presets/zcode/java/hooks/chain-team-phases.sh +15 -1
  189. package/presets/zcode/mcp-ts/adapter-map.json +9 -1
  190. package/presets/zcode/mcp-ts/commands/README.md +4 -0
  191. package/presets/zcode/mcp-ts/commands/rr-scheduler-start.md +35 -0
  192. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +15 -1
  193. package/presets/zcode/mol/adapter-map.json +9 -1
  194. package/presets/zcode/mol/commands/README.md +4 -0
  195. package/presets/zcode/mol/commands/rr-scheduler-start.md +35 -0
  196. package/presets/zcode/mol/hooks/chain-team-phases.sh +15 -1
  197. package/presets/zcode/next/adapter-map.json +9 -1
  198. package/presets/zcode/next/commands/README.md +4 -0
  199. package/presets/zcode/next/commands/rr-scheduler-start.md +35 -0
  200. package/presets/zcode/next/hooks/chain-team-phases.sh +15 -1
  201. package/presets/zcode/nuxt/adapter-map.json +9 -1
  202. package/presets/zcode/nuxt/commands/README.md +4 -0
  203. package/presets/zcode/nuxt/commands/rr-scheduler-start.md +35 -0
  204. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +15 -1
  205. package/presets/zcode/php-hexagonal/adapter-map.json +9 -1
  206. package/presets/zcode/php-hexagonal/commands/README.md +4 -0
  207. package/presets/zcode/php-hexagonal/commands/rr-scheduler-start.md +35 -0
  208. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +15 -1
  209. package/presets/zcode/php-laravel/adapter-map.json +9 -1
  210. package/presets/zcode/php-laravel/commands/README.md +4 -0
  211. package/presets/zcode/php-laravel/commands/rr-scheduler-start.md +35 -0
  212. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +15 -1
  213. package/presets/zcode/svelte/adapter-map.json +9 -1
  214. package/presets/zcode/svelte/commands/README.md +4 -0
  215. package/presets/zcode/svelte/commands/rr-scheduler-start.md +35 -0
  216. package/presets/zcode/svelte/hooks/chain-team-phases.sh +15 -1
@@ -17,6 +17,14 @@
17
17
 
18
18
  // The run-reason vocabulary is the scheduler's own list: one source, no drift.
19
19
  import { REASON_CODES } from './team-db-scheduler.mjs';
20
+ // The action vocabularies are the signal module's own lists: one source, no drift.
21
+ import {
22
+ ACTION_ERROR_CLASSES,
23
+ ACTION_INTENTS,
24
+ ACTION_SIGNAL_NAMES,
25
+ ATTRIBUTION_RUNGS,
26
+ SIGNAL_SEVERITIES,
27
+ } from './action-signals.mjs';
20
28
  // The tracker vocabularies are the engine's own lists: one source, no drift.
21
29
  import {
22
30
  EFFECTIVE_ENTRY_STATUSES,
@@ -731,8 +739,151 @@ const schemas = {
731
739
  },
732
740
  ['from', 'to', 'items', 'totals', 'otherCalls'],
733
741
  ),
734
- EfficiencyDistribution: object(
742
+ EfficiencyActionAttribution: object(
743
+ {
744
+ sessions: { type: 'integer', minimum: 0 },
745
+ mappedSessions: { type: 'integer', minimum: 0 },
746
+ unmappedCalls: { type: 'integer', minimum: 0 },
747
+ unmappedTurns: {
748
+ type: 'integer',
749
+ minimum: 0,
750
+ description:
751
+ 'Unmapped turns in the window. `usage_turns` carries no intent and no agent, so this figure honours the window and the task filter only; it is the one key of this block that `intent` and `agent` cannot narrow. `/signals` accepts no `includeAbsent`, so on that route `unmappedCalls`, `byRung.unmapped` and this figure are structurally `0` and `coverage` is `1` or `null`.',
752
+ },
753
+ byRung: object(
754
+ {
755
+ lease: { type: 'integer', minimum: 0 },
756
+ window: { type: 'integer', minimum: 0 },
757
+ 'dir-mtime': { type: 'integer', minimum: 0 },
758
+ unmapped: { type: 'integer', minimum: 0 },
759
+ },
760
+ ['lease', 'window', 'dir-mtime', 'unmapped'],
761
+ ),
762
+ coverage: {
763
+ ...nullable('number'),
764
+ description:
765
+ 'Mapped share of the rows this block counts. A per-task read is `1` by construction, because an `unmapped` row carries no task slug; only a window-wide read with `includeAbsent=1` can report less. `/signals` accepts no `includeAbsent`, so its `coverage` is `1` or, at a zero denominator, `null`.',
766
+ },
767
+ },
768
+ ['sessions', 'mappedSessions', 'unmappedCalls', 'unmappedTurns', 'byRung', 'coverage'],
769
+ ),
770
+ EfficiencyActions: object(
771
+ {
772
+ window: object({ from: { type: 'string' }, to: { type: 'string' } }, ['from', 'to']),
773
+ task: nullable('string'),
774
+ totals: object(
775
+ {
776
+ actions: { type: 'integer', minimum: 0 },
777
+ turns: { type: 'integer', minimum: 0 },
778
+ changedFiles: { type: 'integer', minimum: 0 },
779
+ errorRate: nullable('number'),
780
+ repeatRatio: nullable('number'),
781
+ guardHits: { type: 'integer', minimum: 0 },
782
+ wallMs: nullable('integer'),
783
+ busyMs: { type: 'integer', minimum: 0 },
784
+ },
785
+ ['actions', 'turns', 'changedFiles', 'errorRate', 'repeatRatio', 'guardHits', 'wallMs', 'busyMs'],
786
+ ),
787
+ byIntent: {
788
+ type: 'array',
789
+ items: object(
790
+ {
791
+ intent: { type: 'string', enum: ACTION_INTENTS },
792
+ actions: { type: 'integer', minimum: 0 },
793
+ },
794
+ ['intent', 'actions'],
795
+ ),
796
+ },
797
+ byAgent: {
798
+ type: 'array',
799
+ items: object(
800
+ {
801
+ agent: nullable('string'),
802
+ actions: { type: 'integer', minimum: 0 },
803
+ },
804
+ ['agent', 'actions'],
805
+ ),
806
+ },
807
+ coverage: {
808
+ type: 'array',
809
+ items: object(
810
+ {
811
+ rung: { type: 'string', enum: ATTRIBUTION_RUNGS },
812
+ actions: { type: 'integer', minimum: 0 },
813
+ },
814
+ ['rung', 'actions'],
815
+ ),
816
+ },
817
+ items: {
818
+ type: 'array',
819
+ items: object(
820
+ {
821
+ at: { type: 'string' },
822
+ task: nullable('string'),
823
+ tool: { type: 'string' },
824
+ intent: { type: 'string', enum: ACTION_INTENTS },
825
+ agent: nullable('string'),
826
+ errorClass: { type: ['string', 'null'], enum: [...ACTION_ERROR_CLASSES, null] },
827
+ durationMs: nullable('integer'),
828
+ gapMs: nullable('integer'),
829
+ exitCode: nullable('integer'),
830
+ repeatIndex: nullable('integer'),
831
+ },
832
+ ['at', 'task', 'tool', 'intent', 'agent', 'errorClass', 'durationMs', 'gapMs', 'exitCode', 'repeatIndex'],
833
+ ),
834
+ },
835
+ limit: { type: 'integer', minimum: 1 },
836
+ offset: { type: 'integer', minimum: 0 },
837
+ total: { type: 'integer', minimum: 0 },
838
+ nextOffset: nullable('integer'),
839
+ attribution: ref('EfficiencyActionAttribution'),
840
+ generatedAt: { type: 'string' },
841
+ },
842
+ [
843
+ 'window',
844
+ 'task',
845
+ 'totals',
846
+ 'byIntent',
847
+ 'byAgent',
848
+ 'coverage',
849
+ 'items',
850
+ 'limit',
851
+ 'offset',
852
+ 'total',
853
+ 'nextOffset',
854
+ 'attribution',
855
+ 'generatedAt',
856
+ ],
857
+ ),
858
+ EfficiencySignals: object(
735
859
  {
860
+ window: object({ from: { type: 'string' }, to: { type: 'string' } }, ['from', 'to']),
861
+ task: nullable('string'),
862
+ items: {
863
+ type: 'array',
864
+ items: object(
865
+ {
866
+ task: { type: 'string' },
867
+ signal: { type: 'string', enum: ACTION_SIGNAL_NAMES },
868
+ severity: { type: 'string', enum: SIGNAL_SEVERITIES },
869
+ value: { type: 'integer', minimum: 0 },
870
+ // B-3: the rule that fired travels with the row, so the interface
871
+ // never re-derives a threshold of its own.
872
+ rule: { type: 'string' },
873
+ },
874
+ ['task', 'signal', 'severity', 'value', 'rule'],
875
+ ),
876
+ },
877
+ limit: { type: 'integer', minimum: 1 },
878
+ offset: { type: 'integer', minimum: 0 },
879
+ total: { type: 'integer', minimum: 0 },
880
+ nextOffset: nullable('integer'),
881
+ attribution: ref('EfficiencyActionAttribution'),
882
+ generatedAt: { type: 'string' },
883
+ },
884
+ ['window', 'task', 'items', 'limit', 'offset', 'total', 'nextOffset', 'attribution', 'generatedAt'],
885
+ ),
886
+ EfficiencyDistribution: object( {
736
887
  metric: { type: 'string', enum: ['rawBytes'] },
737
888
  from: { type: 'string' },
738
889
  to: { type: 'string' },
@@ -1665,8 +1816,10 @@ const schemas = {
1665
1816
  ),
1666
1817
  TrackerQueueEntry: object(
1667
1818
  {
1668
- entryId: { type: 'string', pattern: RUN_ID_PATTERN },
1669
- itemId: { type: 'integer', minimum: 1 },
1819
+ // Null on a derived row: a holding task with no queue file has no entry id,
1820
+ // and no tracker link means there is no item id either.
1821
+ entryId: { type: ['string', 'null'], pattern: RUN_ID_PATTERN },
1822
+ itemId: { type: ['integer', 'null'], minimum: 1 },
1670
1823
  taskSlug: { type: 'string', pattern: SLUG_PATTERN },
1671
1824
  linkId: nullable('string'),
1672
1825
  // The derived effective entry status; `active`/`done` are never stored.
@@ -2077,6 +2230,93 @@ const efficiencyToolBreakdownExample = {
2077
2230
  otherCalls: 0,
2078
2231
  };
2079
2232
 
2233
+ const efficiencyActionsExample = {
2234
+ window: { from: '2026-11-01T00:00:00.000Z', to: '2026-11-17T00:00:00.000Z' },
2235
+ task: 'agent-action-telemetry',
2236
+ totals: {
2237
+ actions: 62,
2238
+ turns: 40,
2239
+ changedFiles: 4,
2240
+ errorRate: 0.1613,
2241
+ repeatRatio: 0.5,
2242
+ guardHits: 3,
2243
+ wallMs: 3600000,
2244
+ busyMs: 1200000,
2245
+ },
2246
+ byIntent: [
2247
+ { intent: 'explore', actions: 40 },
2248
+ { intent: 'mutate', actions: 22 },
2249
+ ],
2250
+ byAgent: [{ agent: 'feature-developer', actions: 62 }],
2251
+ coverage: [
2252
+ { rung: 'lease', actions: 62 },
2253
+ { rung: 'window', actions: 0 },
2254
+ { rung: 'dir-mtime', actions: 0 },
2255
+ { rung: 'unmapped', actions: 0 },
2256
+ ],
2257
+ items: [
2258
+ {
2259
+ at: '2026-11-17T09:12:03.412Z',
2260
+ task: 'agent-action-telemetry',
2261
+ tool: 'edit',
2262
+ intent: 'mutate',
2263
+ agent: 'feature-developer',
2264
+ errorClass: null,
2265
+ durationMs: 412,
2266
+ gapMs: 97,
2267
+ exitCode: 0,
2268
+ repeatIndex: null,
2269
+ },
2270
+ ],
2271
+ limit: 50,
2272
+ offset: 0,
2273
+ total: 62,
2274
+ nextOffset: 50,
2275
+ attribution: {
2276
+ sessions: 2,
2277
+ mappedSessions: 2,
2278
+ unmappedCalls: 0,
2279
+ unmappedTurns: 0,
2280
+ byRung: { lease: 62, window: 0, 'dir-mtime': 0, unmapped: 0 },
2281
+ coverage: 1,
2282
+ },
2283
+ generatedAt: '2026-11-17T12:00:00.000Z',
2284
+ };
2285
+
2286
+ const efficiencySignalsExample = {
2287
+ window: { from: '2026-11-01T00:00:00.000Z', to: '2026-11-17T00:00:00.000Z' },
2288
+ task: 'agent-action-telemetry',
2289
+ items: [
2290
+ {
2291
+ task: 'agent-action-telemetry',
2292
+ signal: 'error_rate',
2293
+ severity: 'warn',
2294
+ value: 10,
2295
+ rule: 'a fifth or more of the actions failed',
2296
+ },
2297
+ {
2298
+ task: 'agent-action-telemetry',
2299
+ signal: 'guard_pressure',
2300
+ severity: 'info',
2301
+ value: 3,
2302
+ rule: 'a quarter or more of the results needed the guard rewrite',
2303
+ },
2304
+ ],
2305
+ limit: 50,
2306
+ offset: 0,
2307
+ total: 2,
2308
+ nextOffset: null,
2309
+ attribution: {
2310
+ sessions: 2,
2311
+ mappedSessions: 2,
2312
+ unmappedCalls: 0,
2313
+ unmappedTurns: 0,
2314
+ byRung: { lease: 62, window: 0, 'dir-mtime': 0, unmapped: 0 },
2315
+ coverage: 1,
2316
+ },
2317
+ generatedAt: '2026-11-17T12:00:00.000Z',
2318
+ };
2319
+
2080
2320
  const efficiencyDistributionExample = {
2081
2321
  metric: 'rawBytes',
2082
2322
  from: '2026-11-01T00:00:00.000Z',
@@ -2293,6 +2533,8 @@ const EXAMPLES = {
2293
2533
  EfficiencySummary: [efficiencySummaryExample],
2294
2534
  EfficiencySeries: [efficiencySeriesExample],
2295
2535
  EfficiencyToolBreakdown: [efficiencyToolBreakdownExample],
2536
+ EfficiencyActions: [efficiencyActionsExample],
2537
+ EfficiencySignals: [efficiencySignalsExample],
2296
2538
  EfficiencyDistribution: [efficiencyDistributionExample],
2297
2539
  EfficiencyAbRun: [efficiencyAbRunExample],
2298
2540
  EfficiencyAbRunList: [{ items: [efficiencyAbRunRowExample], total: 1, limit: 50, offset: 0, nextOffset: null }],
@@ -3043,6 +3285,27 @@ const efficiencyRunKeyParameter = {
3043
3285
  description: 'The bench run directory stamp, `YYYYMMDDTHHMMSSZ`.',
3044
3286
  schema: { type: 'string', pattern: EFFICIENCY_RUN_KEY_PATTERN },
3045
3287
  };
3288
+ const actionIntentParameter = {
3289
+ name: 'intent',
3290
+ in: 'query',
3291
+ description: csvParameterDescription('action intents', ACTION_INTENTS),
3292
+ required: false,
3293
+ schema: { type: 'string', enum: ACTION_INTENTS },
3294
+ };
3295
+ const actionSeverityParameter = {
3296
+ name: 'severity',
3297
+ in: 'query',
3298
+ description: csvParameterDescription('signal severities', SIGNAL_SEVERITIES),
3299
+ required: false,
3300
+ schema: { type: 'string', enum: SIGNAL_SEVERITIES },
3301
+ };
3302
+ const actionAgentParameter = {
3303
+ name: 'agent',
3304
+ in: 'query',
3305
+ description: 'Restrict to the actions of one agent.',
3306
+ required: false,
3307
+ schema: { type: 'string', pattern: AGENT_PATTERN, maxLength: 64 },
3308
+ };
3046
3309
 
3047
3310
  export const OPENAPI_DOCUMENT = {
3048
3311
  openapi: OPENAPI_VERSION,
@@ -3376,7 +3639,7 @@ export const OPENAPI_DOCUMENT = {
3376
3639
  'TrackerQueueList',
3377
3640
  TRACKER_QUEUE_LIST_PARAMETERS,
3378
3641
  {},
3379
- '`status` matches the derived effective entry status (`active` and `done` are computed from the task row, never stored); `itemId` narrows to one item.',
3642
+ '`status` matches the derived effective entry status (`active` and `done` are computed from the task row, never stored); `itemId` narrows to one item. A task in a holding state (`in_progress`, `awaiting_artifact_receipt`, `blocked`) that has no non-terminal queue entry is included as a derived row: `entryId` is null, `itemId` is null when the task has no tracker link, `status` is `active`. The row is not a queue file and cannot be cancelled.',
3380
3643
  ),
3381
3644
  post: operation({
3382
3645
  tags: ['tracker'],
@@ -3577,6 +3840,48 @@ export const OPENAPI_DOCUMENT = {
3577
3840
  },
3578
3841
  }),
3579
3842
  },
3843
+ '/api/v1/efficiency/actions': {
3844
+ get: operation({
3845
+ tags: ['efficiency'],
3846
+ summary: 'The action rollup and its paged rows',
3847
+ description:
3848
+ 'Counts, ratios and the per-rung attribution coverage of the measured agent actions. `totals.actions` and `totals.turns` are the sample sizes a reader needs: a ratio whose sample is below its own floor is the consumer\'s decision, so a zero denominator is `null` here and never `0`. `coverage` is the rung split of the returned page only — the attribution chip reads `attribution.byRung`, which is window-wide. `attribution` extends the shipped block with `byRung` and `coverage`; its four original keys keep their meaning inside the same filter, except `unmappedTurns`, which a turn can only filter by window and task.',
3849
+ operationId: 'getEfficiencyActions',
3850
+ parameters: [
3851
+ efficiencyFromParameter,
3852
+ efficiencyToParameter,
3853
+ efficiencyTaskParameter,
3854
+ efficiencyIncludeAbsentParameter,
3855
+ actionIntentParameter,
3856
+ actionAgentParameter,
3857
+ ...paginationParameters,
3858
+ ],
3859
+ responses: {
3860
+ 200: jsonResponse('EfficiencyActions', 'The rollup, the breakdowns and one page of actions'),
3861
+ ...commonErrorResponses,
3862
+ },
3863
+ }),
3864
+ },
3865
+ '/api/v1/efficiency/signals': {
3866
+ get: operation({
3867
+ tags: ['efficiency'],
3868
+ summary: 'The flagged action signals of one task or the whole window',
3869
+ description:
3870
+ 'One row per fired signal, worst severity first and then by signal name, with the task slug as the final tiebreak, so a window-wide array is ordered like a single task\'s; the array order is the contract, so a consumer renders it verbatim. `rule` carries the one-line rule that fired, so no consumer re-derives a threshold. `items` is paged by `limit` and `offset`, `total` counts the fired signals before the page, and `nextOffset` is the next `offset` or `null` on the last page. Two clocks meet here: `items[].value` is the task\'s all-time numerator, because the rollup behind this route is per task and the window selects tasks by their last action rather than filtering a selected task\'s rows, while `attribution` is window-filtered — the two are not meant to be divided by each other. The route declares `task`, `from`, `to`, `severity`, `limit` and `offset` only: `intent`, `agent` and `includeAbsent` answer `422 E_VALIDATION` naming the parameter, because binding any of them would describe half of the block through one filter and half through another.',
3871
+ operationId: 'getEfficiencySignals',
3872
+ parameters: [
3873
+ efficiencyFromParameter,
3874
+ efficiencyToParameter,
3875
+ efficiencyTaskParameter,
3876
+ actionSeverityParameter,
3877
+ ...paginationParameters,
3878
+ ],
3879
+ responses: {
3880
+ 200: jsonResponse('EfficiencySignals', 'The fired signals with their severity and their rule'),
3881
+ ...commonErrorResponses,
3882
+ },
3883
+ }),
3884
+ },
3580
3885
  '/api/v1/efficiency/distribution': {
3581
3886
  get: operation({
3582
3887
  tags: ['efficiency'],