@codyswann/lisa 6.0.10 → 6.1.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 (132) hide show
  1. package/all/copy-overwrite/scripts/lib/work-item-estimate-check.mjs +162 -0
  2. package/all/copy-overwrite/scripts/lib/work-item-estimate-config.d.mts +58 -0
  3. package/all/copy-overwrite/scripts/lib/work-item-estimate-config.mjs +210 -0
  4. package/all/copy-overwrite/scripts/lib/work-item-estimate.mjs +313 -0
  5. package/all/copy-overwrite/scripts/lisa-estimate.mjs +178 -0
  6. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  7. package/dist/core/lisa-owned-hash-ledger.js +42 -0
  8. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  9. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  10. package/dist/core/nightly-e2e-guard-behavior-certificate.js.map +1 -1
  11. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  12. package/dist/core/upstream-evidence-manifest.js +32 -8
  13. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  14. package/dist/sync/registry.d.ts.map +1 -1
  15. package/dist/sync/registry.js +2 -0
  16. package/dist/sync/registry.js.map +1 -1
  17. package/dist/sync/work-item-estimate-setting.d.ts +3 -0
  18. package/dist/sync/work-item-estimate-setting.d.ts.map +1 -0
  19. package/dist/sync/work-item-estimate-setting.js +24 -0
  20. package/dist/sync/work-item-estimate-setting.js.map +1 -0
  21. package/package.json +4 -4
  22. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  23. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  24. package/plugins/lisa/.codex-plugin/skills/lisa-github-validate-issue/SKILL.md +17 -1
  25. package/plugins/lisa/.codex-plugin/skills/lisa-jira-validate-ticket/SKILL.md +17 -1
  26. package/plugins/lisa/.codex-plugin/skills/lisa-linear-validate-issue/SKILL.md +16 -0
  27. package/plugins/lisa/.codex-plugin/skills/lisa-usage-accounting/SKILL.md +7 -0
  28. package/plugins/lisa/.codex-plugin/skills/lisa-usage-accounting/references/estimate.md +71 -0
  29. package/plugins/lisa/rules/reference/config-resolution.md +1 -0
  30. package/plugins/lisa/rules/reference/work-item-definition-of-ready.md +18 -0
  31. package/plugins/lisa/skills/lisa-github-validate-issue/SKILL.md +17 -1
  32. package/plugins/lisa/skills/lisa-jira-validate-ticket/SKILL.md +17 -1
  33. package/plugins/lisa/skills/lisa-linear-validate-issue/SKILL.md +16 -0
  34. package/plugins/lisa/skills/lisa-usage-accounting/SKILL.md +7 -0
  35. package/plugins/lisa/skills/lisa-usage-accounting/references/estimate.md +71 -0
  36. package/plugins/lisa-agy/plugin.json +1 -1
  37. package/plugins/lisa-agy/skills/lisa-github-validate-issue/SKILL.md +17 -1
  38. package/plugins/lisa-agy/skills/lisa-jira-validate-ticket/SKILL.md +17 -1
  39. package/plugins/lisa-agy/skills/lisa-linear-validate-issue/SKILL.md +16 -0
  40. package/plugins/lisa-agy/skills/lisa-usage-accounting/SKILL.md +7 -0
  41. package/plugins/lisa-agy/skills/lisa-usage-accounting/references/estimate.md +71 -0
  42. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  44. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  45. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  49. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-copilot/rules/reference/config-resolution.md +1 -0
  51. package/plugins/lisa-copilot/rules/reference/work-item-definition-of-ready.md +18 -0
  52. package/plugins/lisa-copilot/skills/lisa-github-validate-issue/SKILL.md +17 -1
  53. package/plugins/lisa-copilot/skills/lisa-jira-validate-ticket/SKILL.md +17 -1
  54. package/plugins/lisa-copilot/skills/lisa-linear-validate-issue/SKILL.md +16 -0
  55. package/plugins/lisa-copilot/skills/lisa-usage-accounting/SKILL.md +7 -0
  56. package/plugins/lisa-copilot/skills/lisa-usage-accounting/references/estimate.md +71 -0
  57. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +1 -0
  59. package/plugins/lisa-cursor/rules/work-item-definition-of-ready-reference.mdc +18 -0
  60. package/plugins/lisa-cursor/skills/lisa-github-validate-issue/SKILL.md +17 -1
  61. package/plugins/lisa-cursor/skills/lisa-jira-validate-ticket/SKILL.md +17 -1
  62. package/plugins/lisa-cursor/skills/lisa-linear-validate-issue/SKILL.md +16 -0
  63. package/plugins/lisa-cursor/skills/lisa-usage-accounting/SKILL.md +7 -0
  64. package/plugins/lisa-cursor/skills/lisa-usage-accounting/references/estimate.md +71 -0
  65. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  67. package/plugins/lisa-devin/rules/reference/config-resolution.md +1 -0
  68. package/plugins/lisa-devin/rules/reference/work-item-definition-of-ready.md +18 -0
  69. package/plugins/lisa-devin/skills/lisa-github-validate-issue/SKILL.md +17 -1
  70. package/plugins/lisa-devin/skills/lisa-jira-validate-ticket/SKILL.md +17 -1
  71. package/plugins/lisa-devin/skills/lisa-linear-validate-issue/SKILL.md +16 -0
  72. package/plugins/lisa-devin/skills/lisa-usage-accounting/SKILL.md +7 -0
  73. package/plugins/lisa-devin/skills/lisa-usage-accounting/references/estimate.md +71 -0
  74. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  76. package/plugins/lisa-expo-agy/plugin.json +1 -1
  77. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  81. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  83. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  84. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  86. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  88. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  90. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  91. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  93. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  95. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  96. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  97. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  98. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  100. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  101. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  102. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  104. package/plugins/lisa-rails-agy/plugin.json +1 -1
  105. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  106. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  107. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  108. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  109. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  110. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  111. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  112. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  113. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  114. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  115. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  116. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  117. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  118. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  119. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  120. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  121. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  122. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  123. package/plugins/src/base/rules/reference/config-resolution.md +1 -0
  124. package/plugins/src/base/rules/reference/work-item-definition-of-ready.md +18 -0
  125. package/plugins/src/base/skills/lisa-github-validate-issue/SKILL.md +17 -1
  126. package/plugins/src/base/skills/lisa-jira-validate-ticket/SKILL.md +17 -1
  127. package/plugins/src/base/skills/lisa-linear-validate-issue/SKILL.md +16 -0
  128. package/plugins/src/base/skills/lisa-usage-accounting/SKILL.md +7 -0
  129. package/plugins/src/base/skills/lisa-usage-accounting/references/estimate.md +71 -0
  130. package/scripts/lisa-estimate.mjs +9 -0
  131. package/scripts/two-channel-couplings.json +1 -1
  132. package/typescript/copy-overwrite/.prettierignore +4 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -142,6 +142,7 @@ Per-type content requirements are defined once in the vendor-neutral `work-item-
142
142
  | S18 Stateless-pickup dry-run | `product-clarity` | true |
143
143
  | S19 Branch Plan derivation | `technical` | false |
144
144
  | S20 Named-control reachability | `acceptance-criteria` | true |
145
+ | S21 Token estimate (ready time) | `technical` | false |
145
146
  | F1 Issue type label exists in repo | `structural` | false |
146
147
  | F2 Parent sub-issue exists and is the right type | `structural` | false |
147
148
  | F3 Linked issues exist | `structural` | false |
@@ -397,6 +398,20 @@ Remediation: `"Name the input or field that makes <test> reach the code this wor
397
398
 
398
399
  `product_relevant: true` — an unfalsifiable stopping rule is a specification defect, and whoever wrote the issue is who can repair it. `lisa-github-write-issue` renders the marker; `control-reachability` carries the implementer-side counterpart, which forbids acting on the stopping rule before the cause of an unmoved control is established.
399
400
 
401
+ #### S21 — Token estimate (ready time)
402
+
403
+ Enforces the token-estimate part of the vendor-neutral `work-item-definition-of-ready` rule. The contract (section shape, pricing, config) is in the `lisa-usage-accounting` skill's `references/estimate.md`.
404
+
405
+ **When the gate applies.** On every build-ready leaf (the S15 classification) when `workItem.estimate.required` resolves to `true`, which it does when the key is absent. `N/A` for containers, for items that are not build-ready, and whenever the project sets `workItem.estimate.required: false`; then nothing about estimates blocks.
406
+
407
+ **How to run it.** Write the item's body (or the proposed spec's body) to a file and run `node scripts/lisa-estimate.mjs check --body-file <file>`. Report its verdict line and reasons verbatim: exit 0 is PASS or N/A, exit 1 is FAIL, exit 2 means the config or the call is broken, which fails the gate with the error.
408
+
409
+ **What it checks.** An item with **no** `## Lisa Estimate` section PASSes: an estimate is not required at creation or at ready, because deterministic sources (Sentry, New Relic, monitors) cannot produce one, and the claiming agent writes it before any work begins. A section that **is** present FAILs when its `<!-- lisa:estimate ... -->` token is missing or unparseable, the token range is inverted, the recommended model is not in `workItem.estimate.models`, or the dollar range disagrees with the price table the token names. There is never more than one section.
410
+
411
+ Remediation: re-render the section with `node scripts/lisa-estimate.mjs render --tokens-low <n> --tokens-high <n> --model <allowed value> --body-file <file>` and write the result back. Never ask a person for the estimate.
412
+
413
+ `product_relevant: false` — the estimate is produced by agents, not by whoever wrote the item.
414
+
400
415
  ### Feasibility Gates (require GitHub lookups; skip in `--spec-only`)
401
416
 
402
417
  #### F1 — Issue type label exists in repo
@@ -559,6 +574,7 @@ Output is a single fenced text block. Callers parse it; do not add free-form pro
559
574
  - [PASS|FAIL|N/A] S18 Stateless-pickup dry-run — <one-line reason>
560
575
  - [PASS|FAIL|N/A] S19 Branch Plan derivation — <one-line reason>
561
576
  - [PASS|FAIL|N/A] S20 Named-control reachability — <one-line reason>
577
+ - [PASS|FAIL|N/A] S21 Token estimate (ready time) — <one-line reason>
562
578
 
563
579
  ### Feasibility Gates (omit this section when --spec-only)
564
580
  - [PASS|FAIL|N/A] F1 Issue type label exists in repo — <one-line reason>
@@ -585,7 +601,7 @@ The verdict is `PASS` if every applicable gate is `PASS`. Any `FAIL` makes the v
585
601
 
586
602
  Same shape and meaning as `lisa-jira-validate-ticket` so downstream PRD-intake skills (Notion, Confluence, Linear, GitHub) can format comments uniformly:
587
603
 
588
- - **gate**: the gate ID (`S1`–`S20`, `F1`–`F5`).
604
+ - **gate**: the gate ID (`S1`–`S21`, `F1`–`F5`).
589
605
  - **category**: the gate's fixed category from the table.
590
606
  - **product_relevant**: matches the gate's table entry. `false` means the failure is an internal data-quality problem the caller should fix without bothering product.
591
607
  - **what**: plain-language, product-readable.
@@ -139,6 +139,7 @@ Per-type content requirements are defined once in the vendor-neutral `work-item-
139
139
  | S18 Stateless-pickup dry-run | `product-clarity` | true |
140
140
  | S19 Branch Plan derivation | `technical` | false |
141
141
  | S20 Named-control reachability | `acceptance-criteria` | true |
142
+ | S21 Token estimate (ready time) | `technical` | false |
142
143
  | F1 Issue type valid in project | `structural` | false |
143
144
  | F2 Epic parent exists and is an Epic | `structural` | false |
144
145
  | F3 Linked tickets exist | `structural` | false |
@@ -399,6 +400,20 @@ Remediation: `"Name the input or field that makes <test> reach the code this wor
399
400
 
400
401
  `product_relevant: true` — an unfalsifiable stopping rule is a specification defect, and whoever wrote the ticket is who can repair it. `lisa-jira-write-ticket` renders the marker; `control-reachability` carries the implementer-side counterpart, which forbids acting on the stopping rule before the cause of an unmoved control is established.
401
402
 
403
+ #### S21 — Token estimate (ready time)
404
+
405
+ Enforces the token-estimate part of the vendor-neutral `work-item-definition-of-ready` rule. The contract (section shape, pricing, config) is in the `lisa-usage-accounting` skill's `references/estimate.md`.
406
+
407
+ **When the gate applies.** On every build-ready leaf (the S15 classification) when `workItem.estimate.required` resolves to `true`, which it does when the key is absent. `N/A` for containers, for items that are not build-ready, and whenever the project sets `workItem.estimate.required: false`; then nothing about estimates blocks.
408
+
409
+ **How to run it.** Write the item's body (or the proposed spec's body) to a file and run `node scripts/lisa-estimate.mjs check --body-file <file>`. Report its verdict line and reasons verbatim: exit 0 is PASS or N/A, exit 1 is FAIL, exit 2 means the config or the call is broken, which fails the gate with the error.
410
+
411
+ **What it checks.** An item with **no** `## Lisa Estimate` section PASSes: an estimate is not required at creation or at ready, because deterministic sources (Sentry, New Relic, monitors) cannot produce one, and the claiming agent writes it before any work begins. A section that **is** present FAILs when its `<!-- lisa:estimate ... -->` token is missing or unparseable, the token range is inverted, the recommended model is not in `workItem.estimate.models`, or the dollar range disagrees with the price table the token names. There is never more than one section.
412
+
413
+ Remediation: re-render the section with `node scripts/lisa-estimate.mjs render --tokens-low <n> --tokens-high <n> --model <allowed value> --body-file <file>` and write the result back. Never ask a person for the estimate.
414
+
415
+ `product_relevant: false` — the estimate is produced by agents, not by whoever wrote the item.
416
+
402
417
  ### Feasibility Gates (require JIRA lookups; skip in dry-run if requested)
403
418
 
404
419
  #### F1 — Issue type valid in project
@@ -488,6 +503,7 @@ Output is a single fenced text block. Callers parse it; do not add free-form pro
488
503
  - [PASS|FAIL|N/A] S18 Stateless-pickup dry-run — <one-line reason>
489
504
  - [PASS|FAIL|N/A] S19 Branch Plan derivation — <one-line reason>
490
505
  - [PASS|FAIL|N/A] S20 Named-control reachability — <one-line reason>
506
+ - [PASS|FAIL|N/A] S21 Token estimate (ready time) — <one-line reason>
491
507
 
492
508
  ### Feasibility Gates (omit this section when --spec-only)
493
509
  - [PASS|FAIL|N/A] F1 Issue type valid in project — <one-line reason>
@@ -513,7 +529,7 @@ The verdict is `PASS` if and only if every applicable gate is `PASS`. Any `FAIL`
513
529
 
514
530
  ### Failure-detail fields
515
531
 
516
- - **gate**: the gate ID (`S1`–`S20`, `F1`–`F5`).
532
+ - **gate**: the gate ID (`S1`–`S21`, `F1`–`F5`).
517
533
  - **category**: the gate's fixed category from the table above. Callers use this to label or filter comments — `product-clarity`, `acceptance-criteria`, `design-ux`, `scope`, `dependency`, `data`, `technical`, or `structural`.
518
534
  - **product_relevant**: matches the gate's table entry. `false` means the failure is an internal data-quality problem (e.g., the agent built a malformed spec, an issue type is invalid in the project) and the caller should fix it without bothering the product team. `true` means the PRD needs product input to resolve.
519
535
  - **what**: plain-language description of the issue. No gate IDs, no JIRA jargon, no engineering shorthand. A product owner reading this on a Notion comment should understand what is unclear and why.
@@ -123,6 +123,7 @@ Per-type content requirements are defined once in the vendor-neutral `work-item-
123
123
  | S18 Stateless-pickup dry-run | `product-clarity` | true |
124
124
  | S19 Branch Plan derivation | `technical` | false |
125
125
  | S20 Named-control reachability | `acceptance-criteria` | true |
126
+ | S21 Token estimate (ready time) | `technical` | false |
126
127
  | F1 Issue type valid in team | `structural` | false |
127
128
  | F2 Project parent exists and is in same team | `structural` | false |
128
129
  | F3 Linked items exist | `structural` | false |
@@ -384,6 +385,20 @@ Remediation: `"Name the input or field that makes <test> reach the code this wor
384
385
 
385
386
  `product_relevant: true` — an unfalsifiable stopping rule is a specification defect, and whoever wrote the Issue is who can repair it. `lisa-linear-write-issue` renders the marker; `control-reachability` carries the implementer-side counterpart, which forbids acting on the stopping rule before the cause of an unmoved control is established.
386
387
 
388
+ #### S21 — Token estimate (ready time)
389
+
390
+ Enforces the token-estimate part of the vendor-neutral `work-item-definition-of-ready` rule. The contract (section shape, pricing, config) is in the `lisa-usage-accounting` skill's `references/estimate.md`.
391
+
392
+ **When the gate applies.** On every build-ready leaf (the S15 classification) when `workItem.estimate.required` resolves to `true`, which it does when the key is absent. `N/A` for containers, for items that are not build-ready, and whenever the project sets `workItem.estimate.required: false`; then nothing about estimates blocks.
393
+
394
+ **How to run it.** Write the item's body (or the proposed spec's body) to a file and run `node scripts/lisa-estimate.mjs check --body-file <file>`. Report its verdict line and reasons verbatim: exit 0 is PASS or N/A, exit 1 is FAIL, exit 2 means the config or the call is broken, which fails the gate with the error.
395
+
396
+ **What it checks.** An item with **no** `## Lisa Estimate` section PASSes: an estimate is not required at creation or at ready, because deterministic sources (Sentry, New Relic, monitors) cannot produce one, and the claiming agent writes it before any work begins. A section that **is** present FAILs when its `<!-- lisa:estimate ... -->` token is missing or unparseable, the token range is inverted, the recommended model is not in `workItem.estimate.models`, or the dollar range disagrees with the price table the token names. There is never more than one section.
397
+
398
+ Remediation: re-render the section with `node scripts/lisa-estimate.mjs render --tokens-low <n> --tokens-high <n> --model <allowed value> --body-file <file>` and write the result back. Never ask a person for the estimate.
399
+
400
+ `product_relevant: false` — the estimate is produced by agents, not by whoever wrote the item.
401
+
387
402
  ### Feasibility Gates (require Linear lookups; skip in dry-run if requested)
388
403
 
389
404
  #### F1 — Issue type valid in team
@@ -477,6 +492,7 @@ Output is a single fenced text block. Callers parse it; do not add free-form pro
477
492
  - [PASS|FAIL|N/A] S18 Stateless-pickup dry-run — <one-line reason>
478
493
  - [PASS|FAIL|N/A] S19 Branch Plan derivation — <one-line reason>
479
494
  - [PASS|FAIL|N/A] S20 Named-control reachability — <one-line reason>
495
+ - [PASS|FAIL|N/A] S21 Token estimate (ready time) — <one-line reason>
480
496
 
481
497
  ### Feasibility Gates (omit when --spec-only)
482
498
  - [PASS|FAIL|N/A] F1 Issue type valid in team — <one-line reason>
@@ -190,6 +190,13 @@ token parsing or markdown rendering in each caller.
190
190
  If the host write fails, preserve the exact error text in `error.message`. Do not collapse write
191
191
  failures into a generic "usage update failed."
192
192
 
193
+ ## Work-item estimates
194
+
195
+ A work item's token estimate and recommended model live in their own managed `## Lisa Estimate`
196
+ section, beside this ledger, never inside it. The contract, config (`workItem.estimate`) and
197
+ pricing are in the [estimate reference](references/estimate.md); render and check the section
198
+ with `node scripts/lisa-estimate.mjs`.
199
+
193
200
  ## Rules
194
201
 
195
202
  - Never invent a per-flow usage format. All usage-ledger writes go through this skill and the
@@ -0,0 +1,71 @@
1
+ # Work-item token estimate
2
+
3
+ Every work item carries a **token estimate** and a **recommended model** before work begins, and,
4
+ once done, the actual tokens and dollar cost from the usage ledger next to that estimate
5
+ (CodySwannGT/lisa#4952). This reference is the contract; `scripts/lisa-estimate.mjs` (shipped to
6
+ every host and run the same way by every agent) renders and checks it.
7
+
8
+ ## Config
9
+
10
+ `workItem.estimate` in `.lisa.config.json` (`.lisa.config.local.json` overrides per key):
11
+
12
+ | Key | Default | Meaning |
13
+ |---|---|---|
14
+ | `required` | `true` | Whether an estimate is required. An absent key is `true`; a non-boolean value fails safe to `true`. `false` turns every estimate gate off. |
15
+ | `models` | `claude-fable-5-2`, `claude-opus-5-5`, `claude-sonnet-5-5`, `claude-haiku-5-5`, `fable`, `opus`, `sonnet`, `haiku` | Allowed recommended-model values: exact ids or families, from any vendor. A project on another runtime lists its own. |
16
+ | `tokenMix` | `input` 0.1, `cachedInput` 0.85, `output` 0.05 | Shares of an estimate billed at each rate, used to turn tokens into dollars. An assumption about agent work (it rereads far more than it writes), not a measurement. |
17
+
18
+ `lisa sync` writes `required` and `models` into the host config and refuses invalid values.
19
+ `node scripts/lisa-estimate.mjs config` prints the effective settings.
20
+
21
+ ## Pricing
22
+
23
+ Dollar ranges use `usage.pricing.models` (the existing usage-accounting pricing key, keyed
24
+ `<provider>/<model>`) when it prices the model. Otherwise they use the shipped default table in
25
+ `scripts/lib/work-item-estimate-config.mjs`: Anthropic's first-party API list prices as published
26
+ in the Claude API reference on 2026-11-03 (USD per million tokens; a family is priced as its
27
+ current model). A model neither table prices gets `pricing_status=missing` and no dollar range —
28
+ never a guessed price.
29
+
30
+ ## The section
31
+
32
+ One managed section per item, rewritten in place, never appended twice:
33
+
34
+ ```markdown
35
+ ## Lisa Estimate
36
+
37
+ _Managed by Lisa. Rewritten in place on each estimate or tally; do not edit by hand._
38
+
39
+ | Row | Tokens | Cost | Model |
40
+ |---|---:|---:|---|
41
+ | Estimate | 2M–4M | $3.14–$6.28 USD | claude-opus-5-5 |
42
+
43
+ Basis: no calibration history
44
+
45
+ <!-- lisa:estimate tokens_low=2000000 tokens_high=4000000 cost_low=3.14 cost_high=6.28 currency=USD pricing_status=estimated pricing_source=anthropic-api-list-prices%402026-11-03 model=claude-opus-5-5 basis=no%20calibration%20history -->
46
+ ```
47
+
48
+ The token sits on its own line outside the table, for the same reason the usage ledger's do:
49
+ hosts that re-serialize tables drop anything that is not a cell. String fields are
50
+ percent-encoded. Render it, never hand-write it:
51
+
52
+ ```bash
53
+ node scripts/lisa-estimate.mjs render --tokens-low 2M --tokens-high 4M \
54
+ --model claude-opus-5-5 --basis "<one line>" --body-file <body.md>
55
+ ```
56
+
57
+ With `--body-file` it prints the whole body with the section replaced or appended; without it,
58
+ just the section. After writing the body back, read it back from the host and run the check on the
59
+ stored bytes.
60
+
61
+ ## When it is required
62
+
63
+ - **Creation and ready time:** not required. Deterministic sources (Sentry, New Relic, monitors)
64
+ file items they cannot estimate. Validator gate S21 (`lisa-estimate.mjs check`) refuses only an
65
+ estimate that is present and wrong: no parseable token, an inverted range, a model outside
66
+ `models`, or a dollar range that disagrees with the price table the token names.
67
+ - **Before work begins:** required. The claiming agent estimates a claimed item that lacks one and
68
+ writes it before doing any work. It never asks a person.
69
+ - **When the config is off:** nothing about estimates blocks; the check reports `N/A`.
70
+
71
+ The recommended model is recorded only. It does not choose which model or agent runs the work.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "AWS CDK-specific Lisa plugin.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -284,6 +284,7 @@ fi
284
284
  | `learnings.file` | no | `.lisa/PROJECT_LEARNINGS.md` | Safe repo-relative Markdown path for the machine-managed learnings ledger, overriding the `.lisa/` default. Rejected if it resolves inside any auto-loaded rules tree (`.claude/rules`, `.cursor/rules`, `.github/instructions`, `.agents/rules`) — the ledger must stay out of eager context. |
285
285
  | `learnings.lowConfidence` | no | `auto-merge` (`human-triage` when `humanGate.mode` is `"strict"`) | How `lisa-persist-learning` submits a low-confidence learning PR. `human-triage` keeps auto-merge off and labels it `learning:needs-triage` for a human to merge or close. `auto-merge` submits it like a high-confidence PR, merging through the project's normal gates, labeled `learning:low-confidence`; `lisa-learnings-audit` then re-reviews those entries first. Any other value is rejected by `lisa apply`; the session's `lisa-resolved-config` block reports it as invalid and treats it as `human-triage`, the stricter option. |
286
286
  | `health.schedule` | no | `off` | Health cadence contract: `off`, `daily`, or `weekly`. `lisa sync` populates the default with `_lisaSync.populated` provenance and rejects values outside this closed vocabulary. Runtime results live only at the gitignored `.lisa/health/latest.json`, never in either config file. |
287
+ | `workItem.estimate` | no | `{ "required": true, "models": [...] }` | Work-item token estimates. `required` (default `true`; a non-boolean value fails safe to `true`) makes every leaf carry a `## Lisa Estimate` section — token range, dollar range, recommended model — before work begins; `false` turns every estimate gate off. `models` lists the allowed recommended-model values, exact ids or families from any vendor (default: `claude-fable-5-2`, `claude-opus-5-5`, `claude-sonnet-5-5`, `claude-haiku-5-5`, `fable`, `opus`, `sonnet`, `haiku`). Optional `tokenMix` (`input`, `cachedInput`, `output` shares adding up to 1; default `0.1` / `0.85` / `0.05`) converts a token range to dollars. `lisa sync` writes the default and rejects invalid values. Dollar ranges use `usage.pricing` when it prices the model, else the shipped Anthropic list-price table in `scripts/lib/work-item-estimate-config.mjs`. See the `lisa-usage-accounting` skill's `references/estimate.md`. |
287
288
  | `usage` | no | — | Optional token/cost pricing metadata consumed by the `usage-accounting` rule. Missing pricing never blocks a lifecycle flow; Lisa records token counts with `estimated_cost: null` when no trustworthy price source is configured. |
288
289
  | `dependencies.humanSignOff` | no | `"none"` (`"default"` when `humanGate.mode` is `"strict"`) | Whether dependency decisions wait on a person. `"default"` keeps every ratification requirement in `dependency-trust-classes`; `"none"` has the agent ratify instead and record its reasoning in the dependency's entry — the trust class and its per-class evidence are still required, and credential, paid-account, and license approvals are unaffected. Any other value is reported as invalid (in `lisa apply` output and the session's `lisa-resolved-config` block) and treated as `"default"`, the stricter option. |
289
290
  | `humanGate.mode` | no | `"access-only"` | How wide the human gate is. `"access-only"`: an agent performs every act it has access to perform, and only an act it lacks access to (an interactive login, a credential it cannot create or reach, spending money, a legal signature, an action only a person's account can take, or a hold the operator asked for) is a human gate. `"strict"` restores the older, wider gate: a compliance sign-off, naming an accountable person, and the calls Lisa's policy used to reserve for a person (learnings promotion, harness interventions, automation retirement, exploratory-QA findings) count as human gates again, and the defaults of `dependencies.humanSignOff` and `learnings.lowConfidence` become `"default"` and `"human-triage"`. A value either key sets explicitly always wins over the mode. A value that is present but invalid fails safe: it is reported and treated as the stricter option (an invalid local value first falls back to a valid value in `.lisa.config.json`); an absent value gets the mode's default. An invalid `humanGate.mode` is therefore treated as `"strict"`. Read by `scripts/human-gate-act.mjs`; see `ready-role-filing`, "What a human gate is". |
@@ -175,6 +175,24 @@ ledger adds nothing, and a ledger it cannot read prints one warning naming the
175
175
  error. Neither fails the gate. A worker that stops anyway is the signal this gate missed something,
176
176
  and the loop turns that stop into the next item's question.
177
177
 
178
+ ## Token estimate (gate S21)
179
+
180
+ When `workItem.estimate.required` is `true` (the default; an absent key means
181
+ `true`, and a non-boolean value fails safe to `true`), every leaf carries one
182
+ managed `## Lisa Estimate` section before work begins: a token range, the
183
+ matching dollar range, and a recommended model, either an exact id or a family,
184
+ from any vendor, taken from `workItem.estimate.models`. The model is recorded,
185
+ not enforced for dispatch. The section shape, pricing and config live in the
186
+ `lisa-usage-accounting` skill's `references/estimate.md`; the shipped
187
+ `scripts/lisa-estimate.mjs` renders and checks it for every agent.
188
+
189
+ The estimate is **not** a write-time or ready-time requirement. Deterministic
190
+ sources (Sentry, New Relic, monitors) file items they cannot estimate, and a
191
+ missing estimate never forces a human question, because the claiming agent
192
+ writes one. So S21 at ready time refuses only an estimate that is present and
193
+ wrong. It is `N/A` when the project turns the requirement off. Nobody is ever
194
+ asked for an estimate.
195
+
178
196
  ## Relationship to the lifecycle
179
197
 
180
198
  - **Write time** — `*-write-*` runs the applicable pre-write gates; a spec
@@ -142,6 +142,7 @@ Per-type content requirements are defined once in the vendor-neutral `work-item-
142
142
  | S18 Stateless-pickup dry-run | `product-clarity` | true |
143
143
  | S19 Branch Plan derivation | `technical` | false |
144
144
  | S20 Named-control reachability | `acceptance-criteria` | true |
145
+ | S21 Token estimate (ready time) | `technical` | false |
145
146
  | F1 Issue type label exists in repo | `structural` | false |
146
147
  | F2 Parent sub-issue exists and is the right type | `structural` | false |
147
148
  | F3 Linked issues exist | `structural` | false |
@@ -397,6 +398,20 @@ Remediation: `"Name the input or field that makes <test> reach the code this wor
397
398
 
398
399
  `product_relevant: true` — an unfalsifiable stopping rule is a specification defect, and whoever wrote the issue is who can repair it. `lisa-github-write-issue` renders the marker; `control-reachability` carries the implementer-side counterpart, which forbids acting on the stopping rule before the cause of an unmoved control is established.
399
400
 
401
+ #### S21 — Token estimate (ready time)
402
+
403
+ Enforces the token-estimate part of the vendor-neutral `work-item-definition-of-ready` rule. The contract (section shape, pricing, config) is in the `lisa-usage-accounting` skill's `references/estimate.md`.
404
+
405
+ **When the gate applies.** On every build-ready leaf (the S15 classification) when `workItem.estimate.required` resolves to `true`, which it does when the key is absent. `N/A` for containers, for items that are not build-ready, and whenever the project sets `workItem.estimate.required: false`; then nothing about estimates blocks.
406
+
407
+ **How to run it.** Write the item's body (or the proposed spec's body) to a file and run `node scripts/lisa-estimate.mjs check --body-file <file>`. Report its verdict line and reasons verbatim: exit 0 is PASS or N/A, exit 1 is FAIL, exit 2 means the config or the call is broken, which fails the gate with the error.
408
+
409
+ **What it checks.** An item with **no** `## Lisa Estimate` section PASSes: an estimate is not required at creation or at ready, because deterministic sources (Sentry, New Relic, monitors) cannot produce one, and the claiming agent writes it before any work begins. A section that **is** present FAILs when its `<!-- lisa:estimate ... -->` token is missing or unparseable, the token range is inverted, the recommended model is not in `workItem.estimate.models`, or the dollar range disagrees with the price table the token names. There is never more than one section.
410
+
411
+ Remediation: re-render the section with `node scripts/lisa-estimate.mjs render --tokens-low <n> --tokens-high <n> --model <allowed value> --body-file <file>` and write the result back. Never ask a person for the estimate.
412
+
413
+ `product_relevant: false` — the estimate is produced by agents, not by whoever wrote the item.
414
+
400
415
  ### Feasibility Gates (require GitHub lookups; skip in `--spec-only`)
401
416
 
402
417
  #### F1 — Issue type label exists in repo
@@ -559,6 +574,7 @@ Output is a single fenced text block. Callers parse it; do not add free-form pro
559
574
  - [PASS|FAIL|N/A] S18 Stateless-pickup dry-run — <one-line reason>
560
575
  - [PASS|FAIL|N/A] S19 Branch Plan derivation — <one-line reason>
561
576
  - [PASS|FAIL|N/A] S20 Named-control reachability — <one-line reason>
577
+ - [PASS|FAIL|N/A] S21 Token estimate (ready time) — <one-line reason>
562
578
 
563
579
  ### Feasibility Gates (omit this section when --spec-only)
564
580
  - [PASS|FAIL|N/A] F1 Issue type label exists in repo — <one-line reason>
@@ -585,7 +601,7 @@ The verdict is `PASS` if every applicable gate is `PASS`. Any `FAIL` makes the v
585
601
 
586
602
  Same shape and meaning as `lisa-jira-validate-ticket` so downstream PRD-intake skills (Notion, Confluence, Linear, GitHub) can format comments uniformly:
587
603
 
588
- - **gate**: the gate ID (`S1`–`S20`, `F1`–`F5`).
604
+ - **gate**: the gate ID (`S1`–`S21`, `F1`–`F5`).
589
605
  - **category**: the gate's fixed category from the table.
590
606
  - **product_relevant**: matches the gate's table entry. `false` means the failure is an internal data-quality problem the caller should fix without bothering product.
591
607
  - **what**: plain-language, product-readable.
@@ -139,6 +139,7 @@ Per-type content requirements are defined once in the vendor-neutral `work-item-
139
139
  | S18 Stateless-pickup dry-run | `product-clarity` | true |
140
140
  | S19 Branch Plan derivation | `technical` | false |
141
141
  | S20 Named-control reachability | `acceptance-criteria` | true |
142
+ | S21 Token estimate (ready time) | `technical` | false |
142
143
  | F1 Issue type valid in project | `structural` | false |
143
144
  | F2 Epic parent exists and is an Epic | `structural` | false |
144
145
  | F3 Linked tickets exist | `structural` | false |
@@ -399,6 +400,20 @@ Remediation: `"Name the input or field that makes <test> reach the code this wor
399
400
 
400
401
  `product_relevant: true` — an unfalsifiable stopping rule is a specification defect, and whoever wrote the ticket is who can repair it. `lisa-jira-write-ticket` renders the marker; `control-reachability` carries the implementer-side counterpart, which forbids acting on the stopping rule before the cause of an unmoved control is established.
401
402
 
403
+ #### S21 — Token estimate (ready time)
404
+
405
+ Enforces the token-estimate part of the vendor-neutral `work-item-definition-of-ready` rule. The contract (section shape, pricing, config) is in the `lisa-usage-accounting` skill's `references/estimate.md`.
406
+
407
+ **When the gate applies.** On every build-ready leaf (the S15 classification) when `workItem.estimate.required` resolves to `true`, which it does when the key is absent. `N/A` for containers, for items that are not build-ready, and whenever the project sets `workItem.estimate.required: false`; then nothing about estimates blocks.
408
+
409
+ **How to run it.** Write the item's body (or the proposed spec's body) to a file and run `node scripts/lisa-estimate.mjs check --body-file <file>`. Report its verdict line and reasons verbatim: exit 0 is PASS or N/A, exit 1 is FAIL, exit 2 means the config or the call is broken, which fails the gate with the error.
410
+
411
+ **What it checks.** An item with **no** `## Lisa Estimate` section PASSes: an estimate is not required at creation or at ready, because deterministic sources (Sentry, New Relic, monitors) cannot produce one, and the claiming agent writes it before any work begins. A section that **is** present FAILs when its `<!-- lisa:estimate ... -->` token is missing or unparseable, the token range is inverted, the recommended model is not in `workItem.estimate.models`, or the dollar range disagrees with the price table the token names. There is never more than one section.
412
+
413
+ Remediation: re-render the section with `node scripts/lisa-estimate.mjs render --tokens-low <n> --tokens-high <n> --model <allowed value> --body-file <file>` and write the result back. Never ask a person for the estimate.
414
+
415
+ `product_relevant: false` — the estimate is produced by agents, not by whoever wrote the item.
416
+
402
417
  ### Feasibility Gates (require JIRA lookups; skip in dry-run if requested)
403
418
 
404
419
  #### F1 — Issue type valid in project
@@ -488,6 +503,7 @@ Output is a single fenced text block. Callers parse it; do not add free-form pro
488
503
  - [PASS|FAIL|N/A] S18 Stateless-pickup dry-run — <one-line reason>
489
504
  - [PASS|FAIL|N/A] S19 Branch Plan derivation — <one-line reason>
490
505
  - [PASS|FAIL|N/A] S20 Named-control reachability — <one-line reason>
506
+ - [PASS|FAIL|N/A] S21 Token estimate (ready time) — <one-line reason>
491
507
 
492
508
  ### Feasibility Gates (omit this section when --spec-only)
493
509
  - [PASS|FAIL|N/A] F1 Issue type valid in project — <one-line reason>
@@ -513,7 +529,7 @@ The verdict is `PASS` if and only if every applicable gate is `PASS`. Any `FAIL`
513
529
 
514
530
  ### Failure-detail fields
515
531
 
516
- - **gate**: the gate ID (`S1`–`S20`, `F1`–`F5`).
532
+ - **gate**: the gate ID (`S1`–`S21`, `F1`–`F5`).
517
533
  - **category**: the gate's fixed category from the table above. Callers use this to label or filter comments — `product-clarity`, `acceptance-criteria`, `design-ux`, `scope`, `dependency`, `data`, `technical`, or `structural`.
518
534
  - **product_relevant**: matches the gate's table entry. `false` means the failure is an internal data-quality problem (e.g., the agent built a malformed spec, an issue type is invalid in the project) and the caller should fix it without bothering the product team. `true` means the PRD needs product input to resolve.
519
535
  - **what**: plain-language description of the issue. No gate IDs, no JIRA jargon, no engineering shorthand. A product owner reading this on a Notion comment should understand what is unclear and why.
@@ -123,6 +123,7 @@ Per-type content requirements are defined once in the vendor-neutral `work-item-
123
123
  | S18 Stateless-pickup dry-run | `product-clarity` | true |
124
124
  | S19 Branch Plan derivation | `technical` | false |
125
125
  | S20 Named-control reachability | `acceptance-criteria` | true |
126
+ | S21 Token estimate (ready time) | `technical` | false |
126
127
  | F1 Issue type valid in team | `structural` | false |
127
128
  | F2 Project parent exists and is in same team | `structural` | false |
128
129
  | F3 Linked items exist | `structural` | false |
@@ -384,6 +385,20 @@ Remediation: `"Name the input or field that makes <test> reach the code this wor
384
385
 
385
386
  `product_relevant: true` — an unfalsifiable stopping rule is a specification defect, and whoever wrote the Issue is who can repair it. `lisa-linear-write-issue` renders the marker; `control-reachability` carries the implementer-side counterpart, which forbids acting on the stopping rule before the cause of an unmoved control is established.
386
387
 
388
+ #### S21 — Token estimate (ready time)
389
+
390
+ Enforces the token-estimate part of the vendor-neutral `work-item-definition-of-ready` rule. The contract (section shape, pricing, config) is in the `lisa-usage-accounting` skill's `references/estimate.md`.
391
+
392
+ **When the gate applies.** On every build-ready leaf (the S15 classification) when `workItem.estimate.required` resolves to `true`, which it does when the key is absent. `N/A` for containers, for items that are not build-ready, and whenever the project sets `workItem.estimate.required: false`; then nothing about estimates blocks.
393
+
394
+ **How to run it.** Write the item's body (or the proposed spec's body) to a file and run `node scripts/lisa-estimate.mjs check --body-file <file>`. Report its verdict line and reasons verbatim: exit 0 is PASS or N/A, exit 1 is FAIL, exit 2 means the config or the call is broken, which fails the gate with the error.
395
+
396
+ **What it checks.** An item with **no** `## Lisa Estimate` section PASSes: an estimate is not required at creation or at ready, because deterministic sources (Sentry, New Relic, monitors) cannot produce one, and the claiming agent writes it before any work begins. A section that **is** present FAILs when its `<!-- lisa:estimate ... -->` token is missing or unparseable, the token range is inverted, the recommended model is not in `workItem.estimate.models`, or the dollar range disagrees with the price table the token names. There is never more than one section.
397
+
398
+ Remediation: re-render the section with `node scripts/lisa-estimate.mjs render --tokens-low <n> --tokens-high <n> --model <allowed value> --body-file <file>` and write the result back. Never ask a person for the estimate.
399
+
400
+ `product_relevant: false` — the estimate is produced by agents, not by whoever wrote the item.
401
+
387
402
  ### Feasibility Gates (require Linear lookups; skip in dry-run if requested)
388
403
 
389
404
  #### F1 — Issue type valid in team
@@ -477,6 +492,7 @@ Output is a single fenced text block. Callers parse it; do not add free-form pro
477
492
  - [PASS|FAIL|N/A] S18 Stateless-pickup dry-run — <one-line reason>
478
493
  - [PASS|FAIL|N/A] S19 Branch Plan derivation — <one-line reason>
479
494
  - [PASS|FAIL|N/A] S20 Named-control reachability — <one-line reason>
495
+ - [PASS|FAIL|N/A] S21 Token estimate (ready time) — <one-line reason>
480
496
 
481
497
  ### Feasibility Gates (omit when --spec-only)
482
498
  - [PASS|FAIL|N/A] F1 Issue type valid in team — <one-line reason>
@@ -190,6 +190,13 @@ token parsing or markdown rendering in each caller.
190
190
  If the host write fails, preserve the exact error text in `error.message`. Do not collapse write
191
191
  failures into a generic "usage update failed."
192
192
 
193
+ ## Work-item estimates
194
+
195
+ A work item's token estimate and recommended model live in their own managed `## Lisa Estimate`
196
+ section, beside this ledger, never inside it. The contract, config (`workItem.estimate`) and
197
+ pricing are in the [estimate reference](references/estimate.md); render and check the section
198
+ with `node scripts/lisa-estimate.mjs`.
199
+
193
200
  ## Rules
194
201
 
195
202
  - Never invent a per-flow usage format. All usage-ledger writes go through this skill and the
@@ -0,0 +1,71 @@
1
+ # Work-item token estimate
2
+
3
+ Every work item carries a **token estimate** and a **recommended model** before work begins, and,
4
+ once done, the actual tokens and dollar cost from the usage ledger next to that estimate
5
+ (CodySwannGT/lisa#4952). This reference is the contract; `scripts/lisa-estimate.mjs` (shipped to
6
+ every host and run the same way by every agent) renders and checks it.
7
+
8
+ ## Config
9
+
10
+ `workItem.estimate` in `.lisa.config.json` (`.lisa.config.local.json` overrides per key):
11
+
12
+ | Key | Default | Meaning |
13
+ |---|---|---|
14
+ | `required` | `true` | Whether an estimate is required. An absent key is `true`; a non-boolean value fails safe to `true`. `false` turns every estimate gate off. |
15
+ | `models` | `claude-fable-5-2`, `claude-opus-5-5`, `claude-sonnet-5-5`, `claude-haiku-5-5`, `fable`, `opus`, `sonnet`, `haiku` | Allowed recommended-model values: exact ids or families, from any vendor. A project on another runtime lists its own. |
16
+ | `tokenMix` | `input` 0.1, `cachedInput` 0.85, `output` 0.05 | Shares of an estimate billed at each rate, used to turn tokens into dollars. An assumption about agent work (it rereads far more than it writes), not a measurement. |
17
+
18
+ `lisa sync` writes `required` and `models` into the host config and refuses invalid values.
19
+ `node scripts/lisa-estimate.mjs config` prints the effective settings.
20
+
21
+ ## Pricing
22
+
23
+ Dollar ranges use `usage.pricing.models` (the existing usage-accounting pricing key, keyed
24
+ `<provider>/<model>`) when it prices the model. Otherwise they use the shipped default table in
25
+ `scripts/lib/work-item-estimate-config.mjs`: Anthropic's first-party API list prices as published
26
+ in the Claude API reference on 2026-11-03 (USD per million tokens; a family is priced as its
27
+ current model). A model neither table prices gets `pricing_status=missing` and no dollar range —
28
+ never a guessed price.
29
+
30
+ ## The section
31
+
32
+ One managed section per item, rewritten in place, never appended twice:
33
+
34
+ ```markdown
35
+ ## Lisa Estimate
36
+
37
+ _Managed by Lisa. Rewritten in place on each estimate or tally; do not edit by hand._
38
+
39
+ | Row | Tokens | Cost | Model |
40
+ |---|---:|---:|---|
41
+ | Estimate | 2M–4M | $3.14–$6.28 USD | claude-opus-5-5 |
42
+
43
+ Basis: no calibration history
44
+
45
+ <!-- lisa:estimate tokens_low=2000000 tokens_high=4000000 cost_low=3.14 cost_high=6.28 currency=USD pricing_status=estimated pricing_source=anthropic-api-list-prices%402026-11-03 model=claude-opus-5-5 basis=no%20calibration%20history -->
46
+ ```
47
+
48
+ The token sits on its own line outside the table, for the same reason the usage ledger's do:
49
+ hosts that re-serialize tables drop anything that is not a cell. String fields are
50
+ percent-encoded. Render it, never hand-write it:
51
+
52
+ ```bash
53
+ node scripts/lisa-estimate.mjs render --tokens-low 2M --tokens-high 4M \
54
+ --model claude-opus-5-5 --basis "<one line>" --body-file <body.md>
55
+ ```
56
+
57
+ With `--body-file` it prints the whole body with the section replaced or appended; without it,
58
+ just the section. After writing the body back, read it back from the host and run the check on the
59
+ stored bytes.
60
+
61
+ ## When it is required
62
+
63
+ - **Creation and ready time:** not required. Deterministic sources (Sentry, New Relic, monitors)
64
+ file items they cannot estimate. Validator gate S21 (`lisa-estimate.mjs check`) refuses only an
65
+ estimate that is present and wrong: no parseable token, an inverted range, a model outside
66
+ `models`, or a dollar range that disagrees with the price table the token names.
67
+ - **Before work begins:** required. The claiming agent estimates a claimed item that lacks one and
68
+ writes it before doing any work. It never asks a person.
69
+ - **When the config is off:** nothing about estimates blocks; the check reports `N/A`.
70
+
71
+ The recommended model is recorded only. It does not choose which model or agent runs the work.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "6.0.10",
3
+ "version": "6.1.0",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -289,6 +289,7 @@ fi
289
289
  | `learnings.file` | no | `.lisa/PROJECT_LEARNINGS.md` | Safe repo-relative Markdown path for the machine-managed learnings ledger, overriding the `.lisa/` default. Rejected if it resolves inside any auto-loaded rules tree (`.claude/rules`, `.cursor/rules`, `.github/instructions`, `.agents/rules`) — the ledger must stay out of eager context. |
290
290
  | `learnings.lowConfidence` | no | `auto-merge` (`human-triage` when `humanGate.mode` is `"strict"`) | How `lisa-persist-learning` submits a low-confidence learning PR. `human-triage` keeps auto-merge off and labels it `learning:needs-triage` for a human to merge or close. `auto-merge` submits it like a high-confidence PR, merging through the project's normal gates, labeled `learning:low-confidence`; `lisa-learnings-audit` then re-reviews those entries first. Any other value is rejected by `lisa apply`; the session's `lisa-resolved-config` block reports it as invalid and treats it as `human-triage`, the stricter option. |
291
291
  | `health.schedule` | no | `off` | Health cadence contract: `off`, `daily`, or `weekly`. `lisa sync` populates the default with `_lisaSync.populated` provenance and rejects values outside this closed vocabulary. Runtime results live only at the gitignored `.lisa/health/latest.json`, never in either config file. |
292
+ | `workItem.estimate` | no | `{ "required": true, "models": [...] }` | Work-item token estimates. `required` (default `true`; a non-boolean value fails safe to `true`) makes every leaf carry a `## Lisa Estimate` section — token range, dollar range, recommended model — before work begins; `false` turns every estimate gate off. `models` lists the allowed recommended-model values, exact ids or families from any vendor (default: `claude-fable-5-2`, `claude-opus-5-5`, `claude-sonnet-5-5`, `claude-haiku-5-5`, `fable`, `opus`, `sonnet`, `haiku`). Optional `tokenMix` (`input`, `cachedInput`, `output` shares adding up to 1; default `0.1` / `0.85` / `0.05`) converts a token range to dollars. `lisa sync` writes the default and rejects invalid values. Dollar ranges use `usage.pricing` when it prices the model, else the shipped Anthropic list-price table in `scripts/lib/work-item-estimate-config.mjs`. See the `lisa-usage-accounting` skill's `references/estimate.md`. |
292
293
  | `usage` | no | — | Optional token/cost pricing metadata consumed by the `usage-accounting` rule. Missing pricing never blocks a lifecycle flow; Lisa records token counts with `estimated_cost: null` when no trustworthy price source is configured. |
293
294
  | `dependencies.humanSignOff` | no | `"none"` (`"default"` when `humanGate.mode` is `"strict"`) | Whether dependency decisions wait on a person. `"default"` keeps every ratification requirement in `dependency-trust-classes`; `"none"` has the agent ratify instead and record its reasoning in the dependency's entry — the trust class and its per-class evidence are still required, and credential, paid-account, and license approvals are unaffected. Any other value is reported as invalid (in `lisa apply` output and the session's `lisa-resolved-config` block) and treated as `"default"`, the stricter option. |
294
295
  | `humanGate.mode` | no | `"access-only"` | How wide the human gate is. `"access-only"`: an agent performs every act it has access to perform, and only an act it lacks access to (an interactive login, a credential it cannot create or reach, spending money, a legal signature, an action only a person's account can take, or a hold the operator asked for) is a human gate. `"strict"` restores the older, wider gate: a compliance sign-off, naming an accountable person, and the calls Lisa's policy used to reserve for a person (learnings promotion, harness interventions, automation retirement, exploratory-QA findings) count as human gates again, and the defaults of `dependencies.humanSignOff` and `learnings.lowConfidence` become `"default"` and `"human-triage"`. A value either key sets explicitly always wins over the mode. A value that is present but invalid fails safe: it is reported and treated as the stricter option (an invalid local value first falls back to a valid value in `.lisa.config.json`); an absent value gets the mode's default. An invalid `humanGate.mode` is therefore treated as `"strict"`. Read by `scripts/human-gate-act.mjs`; see `ready-role-filing`, "What a human gate is". |
@@ -180,6 +180,24 @@ ledger adds nothing, and a ledger it cannot read prints one warning naming the
180
180
  error. Neither fails the gate. A worker that stops anyway is the signal this gate missed something,
181
181
  and the loop turns that stop into the next item's question.
182
182
 
183
+ ## Token estimate (gate S21)
184
+
185
+ When `workItem.estimate.required` is `true` (the default; an absent key means
186
+ `true`, and a non-boolean value fails safe to `true`), every leaf carries one
187
+ managed `## Lisa Estimate` section before work begins: a token range, the
188
+ matching dollar range, and a recommended model, either an exact id or a family,
189
+ from any vendor, taken from `workItem.estimate.models`. The model is recorded,
190
+ not enforced for dispatch. The section shape, pricing and config live in the
191
+ `lisa-usage-accounting` skill's `references/estimate.md`; the shipped
192
+ `scripts/lisa-estimate.mjs` renders and checks it for every agent.
193
+
194
+ The estimate is **not** a write-time or ready-time requirement. Deterministic
195
+ sources (Sentry, New Relic, monitors) file items they cannot estimate, and a
196
+ missing estimate never forces a human question, because the claiming agent
197
+ writes one. So S21 at ready time refuses only an estimate that is present and
198
+ wrong. It is `N/A` when the project turns the requirement off. Nobody is ever
199
+ asked for an estimate.
200
+
183
201
  ## Relationship to the lifecycle
184
202
 
185
203
  - **Write time** — `*-write-*` runs the applicable pre-write gates; a spec