@codyswann/lisa 2.328.2 → 2.328.3

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 (68) hide show
  1. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  2. package/dist/core/upstream-evidence-manifest.js +5 -2
  3. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  4. package/dist/utils/usage-accounting.d.ts +42 -0
  5. package/dist/utils/usage-accounting.d.ts.map +1 -1
  6. package/dist/utils/usage-accounting.js +116 -3
  7. package/dist/utils/usage-accounting.js.map +1 -1
  8. package/package.json +1 -1
  9. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  10. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  11. package/plugins/lisa/.codex-plugin/skills/lisa-usage-accounting/SKILL.md +16 -2
  12. package/plugins/lisa/rules/reference/usage-accounting.md +37 -4
  13. package/plugins/lisa/skills/lisa-usage-accounting/SKILL.md +16 -2
  14. package/plugins/lisa-agy/plugin.json +1 -1
  15. package/plugins/lisa-agy/skills/lisa-usage-accounting/SKILL.md +16 -2
  16. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  17. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  18. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  19. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  20. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  21. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-copilot/rules/reference/usage-accounting.md +37 -4
  23. package/plugins/lisa-copilot/skills/lisa-usage-accounting/SKILL.md +16 -2
  24. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  25. package/plugins/lisa-cursor/rules/usage-accounting-reference.mdc +37 -4
  26. package/plugins/lisa-cursor/skills/lisa-usage-accounting/SKILL.md +16 -2
  27. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  28. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  29. package/plugins/lisa-expo-agy/plugin.json +1 -1
  30. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  32. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  34. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  35. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  39. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  40. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  44. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  45. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  49. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  50. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  54. package/plugins/lisa-rails-agy/plugin.json +1 -1
  55. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  59. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  60. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  64. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  65. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  67. package/plugins/src/base/rules/reference/usage-accounting.md +37 -4
  68. package/plugins/src/base/skills/lisa-usage-accounting/SKILL.md +16 -2
@@ -94,6 +94,16 @@ export declare function renderLisaUsageRollupToken(rollup: LisaUsageRollup): str
94
94
  * Render the canonical `## Lisa Usage` section body from direct entries and a
95
95
  * rollup token.
96
96
  *
97
+ * Entry tokens are rendered on their own lines BELOW the visible table, never
98
+ * trailing a table row. Hosts that normalize markdown re-serialize a table from
99
+ * its parsed cell model and discard anything that is not a cell — measured
100
+ * against Linear on 2026-08-04, an HTML comment trailing a table row is
101
+ * destroyed on write while the same comment on its own line round-trips
102
+ * byte-identically. Trailing the row therefore produced a silently unreadable
103
+ * ledger whose surviving rollup token named entries no reader could resolve.
104
+ * Parsing has always been position-agnostic, so sections written in the old
105
+ * layout still enumerate and migrate to this layout on their next rewrite.
106
+ *
97
107
  * @param input Section payload containing direct entries and rollup totals.
98
108
  * @param input.entries Direct entries to render in document order.
99
109
  * @param input.rollup Rollup token to end the section with.
@@ -110,6 +120,38 @@ export declare function renderLisaUsageSection(input: {
110
120
  * @returns Parsed direct entries, rollup token, and the located section range.
111
121
  */
112
122
  export declare function parseLisaUsageSection(document: string): ParsedLisaUsageSection;
123
+ /**
124
+ * Describe one way a stored managed usage section fails to be a readable ledger.
125
+ */
126
+ export interface LisaUsageSectionIntegrityIssue {
127
+ code: "missing-entry-token" | "missing-rollup-token" | "missing-section" | "unrecorded-entry";
128
+ entryIds: readonly string[];
129
+ message: string;
130
+ }
131
+ /**
132
+ *
133
+ */
134
+ export interface LisaUsageSectionIntegrityResult {
135
+ issues: readonly LisaUsageSectionIntegrityIssue[];
136
+ ok: boolean;
137
+ }
138
+ /**
139
+ * Verify that a STORED managed usage section is still a readable ledger.
140
+ *
141
+ * This exists because a write surface can accept a section, report success, and
142
+ * silently destroy part of it. Callers must run this against the bytes read back
143
+ * from the host, never against the payload they sent and never against the
144
+ * mutation's return value — trusting the mutation result is precisely what let a
145
+ * Linear description strip every entry token while reporting `success: true`.
146
+ *
147
+ * @param storedDocument Artifact body or comment body as read back from the host.
148
+ * @param expected Optional expectations from the write that was just performed.
149
+ * @param expected.entryIds Entry ids the caller believes it just persisted.
150
+ * @returns Whether the stored ledger is enumerable, plus every issue found.
151
+ */
152
+ export declare function verifyLisaUsageSectionIntegrity(storedDocument: string, expected?: {
153
+ entryIds?: readonly string[];
154
+ }): LisaUsageSectionIntegrityResult;
113
155
  /**
114
156
  * Append or replace the canonical `## Lisa Usage` section in a markdown
115
157
  * artifact while preserving prior entries that are not being refreshed.
@@ -1 +1 @@
1
- {"version":3,"file":"usage-accounting.d.ts","sourceRoot":"","sources":["../../src/utils/usage-accounting.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,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rB,sBAAsB,GACtB,iBAAiB,GACjB,kBAAkB,CAAC;IACvB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,SAAS,8BAA8B,EAAE,CAAC;IAClD,EAAE,EAAE,OAAO,CAAC;CACb;AAiHD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAC7C,cAAc,EAAE,MAAM,EACtB,QAAQ,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC1C,+BAA+B,CA8BjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE;IACL,cAAc,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACnD,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CACjC,GACA,MAAM,CAkCR"}
@@ -370,6 +370,16 @@ export function renderLisaUsageRollupToken(rollup) {
370
370
  * Render the canonical `## Lisa Usage` section body from direct entries and a
371
371
  * rollup token.
372
372
  *
373
+ * Entry tokens are rendered on their own lines BELOW the visible table, never
374
+ * trailing a table row. Hosts that normalize markdown re-serialize a table from
375
+ * its parsed cell model and discard anything that is not a cell — measured
376
+ * against Linear on 2026-08-04, an HTML comment trailing a table row is
377
+ * destroyed on write while the same comment on its own line round-trips
378
+ * byte-identically. Trailing the row therefore produced a silently unreadable
379
+ * ledger whose surviving rollup token named entries no reader could resolve.
380
+ * Parsing has always been position-agnostic, so sections written in the old
381
+ * layout still enumerate and migrate to this layout on their next rewrite.
382
+ *
373
383
  * @param input Section payload containing direct entries and rollup totals.
374
384
  * @param input.entries Direct entries to render in document order.
375
385
  * @param input.rollup Rollup token to end the section with.
@@ -377,9 +387,10 @@ export function renderLisaUsageRollupToken(rollup) {
377
387
  */
378
388
  export function renderLisaUsageSection(input) {
379
389
  const { entries, rollup } = input;
380
- const entryLines = entries.length === 0
390
+ const entryRows = entries.length === 0
381
391
  ? ["| _No direct entries recorded_ | | | | |"]
382
- : entries.map(entry => `| ${entry.flow} | ${entry.source} | ${entry.provider}/${entry.model} | ${formatEntryTokens(entry)} | ${formatCost(entry.cost, entry.currency)} | ${renderLisaUsageEntryToken(entry)}`);
392
+ : entries.map(entry => `| ${entry.flow} | ${entry.source} | ${entry.provider}/${entry.model} | ${formatEntryTokens(entry)} | ${formatCost(entry.cost, entry.currency)} |`);
393
+ const entryTokenLines = entries.length === 0 ? [] : [...entries.map(renderLisaUsageEntryToken), ""];
383
394
  const lines = [
384
395
  LISA_USAGE_HEADING,
385
396
  "",
@@ -387,8 +398,9 @@ export function renderLisaUsageSection(input) {
387
398
  "",
388
399
  "| Flow | Source | Model | Tokens | Cost |",
389
400
  "| --- | --- | --- | ---: | ---: |",
390
- ...entryLines,
401
+ ...entryRows,
391
402
  "",
403
+ ...entryTokenLines,
392
404
  renderLisaUsageRollupToken(rollup),
393
405
  ];
394
406
  return `${lines.join("\n")}\n`;
@@ -471,6 +483,107 @@ export function parseLisaUsageSection(document) {
471
483
  });
472
484
  return { entries, rollup: parseLisaUsageRollup(section), range };
473
485
  }
486
+ /**
487
+ * Sort ids so an integrity report is deterministic regardless of document order.
488
+ *
489
+ * @param ids Entry ids to normalize.
490
+ * @returns The ids in stable sorted order.
491
+ */
492
+ function sortedIds(ids) {
493
+ return [...ids].sort((left, right) => left > right ? 1 : left < right ? -1 : 0);
494
+ }
495
+ /**
496
+ * Emit an issue only when it actually names something, so callers can compose
497
+ * checks by concatenation instead of conditional accumulation.
498
+ *
499
+ * @param code Stable issue code.
500
+ * @param entryIds Entry ids the issue is about.
501
+ * @param message Operator-readable description.
502
+ * @returns A zero- or one-element issue list.
503
+ */
504
+ function reportIssue(code, entryIds, message) {
505
+ return entryIds.length === 0 ? [] : [{ code, entryIds, message }];
506
+ }
507
+ /**
508
+ * Report entries the caller just wrote that the stored surface cannot produce.
509
+ *
510
+ * @param expectedEntryIds Entry ids the caller believes it persisted.
511
+ * @param parsedEntryIds Entry ids actually parseable from the stored section.
512
+ * @returns Zero or one `missing-entry-token` issue.
513
+ */
514
+ function findDroppedExpectedEntries(expectedEntryIds, parsedEntryIds) {
515
+ const missing = sortedIds(expectedEntryIds.filter(entryId => !parsedEntryIds.has(entryId)));
516
+ return reportIssue("missing-entry-token", missing, `Stored section does not contain a parseable lisa:usage-entry token for: ${missing.join(", ")}. The write surface dropped them.`);
517
+ }
518
+ /**
519
+ * Report rollup references that resolve to no direct entry in the same section.
520
+ *
521
+ * @param rollupEntryIds Entry ids named by the stored rollup token.
522
+ * @param parsedEntryIds Entry ids actually parseable from the stored section.
523
+ * @param alreadyReported Ids already reported as dropped caller expectations.
524
+ * @returns Zero or one `missing-entry-token` issue.
525
+ */
526
+ function findUnresolvableRollupReferences(rollupEntryIds, parsedEntryIds, alreadyReported) {
527
+ const unresolvable = sortedIds(rollupEntryIds.filter(entryId => !parsedEntryIds.has(entryId) && !alreadyReported.includes(entryId)));
528
+ return reportIssue("missing-entry-token", unresolvable, `Rollup direct_entry_ids names entries that cannot be parsed from the same section: ${unresolvable.join(", ")}.`);
529
+ }
530
+ /**
531
+ * Report direct entries the stored rollup token fails to account for.
532
+ *
533
+ * @param rollup Stored rollup token, or null when the section carries none.
534
+ * @param parsedEntryIds Entry ids actually parseable from the stored section.
535
+ * @returns Zero or one issue describing the disagreement.
536
+ */
537
+ function findRollupCoverageGaps(rollup, parsedEntryIds) {
538
+ const entryIds = sortedIds(parsedEntryIds);
539
+ if (rollup === null) {
540
+ // Every section Lisa writes carries a rollup token, even a child-only or
541
+ // fully empty ledger, so a missing token is always corruption -- report
542
+ // it unconditionally rather than routing through reportIssue(), which
543
+ // suppresses issues that name zero entries.
544
+ return [
545
+ {
546
+ code: "missing-rollup-token",
547
+ entryIds,
548
+ message: `Stored section has ${entryIds.length} direct entr${entryIds.length === 1 ? "y" : "ies"} but no lisa:usage-rollup token.`,
549
+ },
550
+ ];
551
+ }
552
+ const recorded = new Set(rollup.directEntryIds);
553
+ const unrecorded = entryIds.filter(entryId => !recorded.has(entryId));
554
+ return reportIssue("unrecorded-entry", unrecorded, `Stored section contains direct entries absent from rollup direct_entry_ids: ${unrecorded.join(", ")}.`);
555
+ }
556
+ /**
557
+ * Verify that a STORED managed usage section is still a readable ledger.
558
+ *
559
+ * This exists because a write surface can accept a section, report success, and
560
+ * silently destroy part of it. Callers must run this against the bytes read back
561
+ * from the host, never against the payload they sent and never against the
562
+ * mutation's return value — trusting the mutation result is precisely what let a
563
+ * Linear description strip every entry token while reporting `success: true`.
564
+ *
565
+ * @param storedDocument Artifact body or comment body as read back from the host.
566
+ * @param expected Optional expectations from the write that was just performed.
567
+ * @param expected.entryIds Entry ids the caller believes it just persisted.
568
+ * @returns Whether the stored ledger is enumerable, plus every issue found.
569
+ */
570
+ export function verifyLisaUsageSectionIntegrity(storedDocument, expected) {
571
+ const parsed = parseLisaUsageSection(storedDocument);
572
+ const expectedEntryIds = expected?.entryIds ?? [];
573
+ if (parsed.range === null) {
574
+ const missing = sortedIds(expectedEntryIds);
575
+ const issues = reportIssue("missing-section", missing, `Stored artifact has no ${LISA_USAGE_HEADING} section, but ${missing.length} usage entr${missing.length === 1 ? "y was" : "ies were"} written to it.`);
576
+ return { ok: issues.length === 0, issues };
577
+ }
578
+ const parsedEntryIds = new Set(parsed.entries.map(entry => entry.entryId));
579
+ const droppedExpected = findDroppedExpectedEntries(expectedEntryIds, parsedEntryIds);
580
+ const issues = [
581
+ ...droppedExpected,
582
+ ...findUnresolvableRollupReferences(parsed.rollup?.directEntryIds ?? [], parsedEntryIds, droppedExpected.flatMap(issue => issue.entryIds)),
583
+ ...findRollupCoverageGaps(parsed.rollup, parsedEntryIds),
584
+ ];
585
+ return { ok: issues.length === 0, issues };
586
+ }
474
587
  /**
475
588
  * Append or replace the canonical `## Lisa Usage` section in a markdown
476
589
  * artifact while preserving prior entries that are not being refreshed.
@@ -1 +1 @@
1
- {"version":3,"file":"usage-accounting.js","sourceRoot":"","sources":["../../src/utils/usage-accounting.ts"],"names":[],"mappings":"AAAA,uHAAuH;AAEvH,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AA6DlD,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AAEnE,MAAM,oBAAoB,GACxB,wUAAwU,CAAC;AAE3U,MAAM,mCAAmC,GACvC,qWAAqW,CAAC;AAExW,MAAM,uBAAuB,GAC3B,wFAAwF,CAAC;AAE3F,MAAM,cAAc,GAClB,iPAAiP,CAAC;AAEpP,MAAM,2BAA2B,GAC/B,sEAAsE,CAAC;AAEzE,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,KAAa;IACxC,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,qCAAqC,KAAK,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,2BAA2B,CAAC,KAAa;IAChD,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,KAAa;IACxC,IAAI,KAAK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,MAAM;QACxC,CAAC,CAAC,CAAC,cAAc,IAAI,KAAK,CAAC,MAAM,CAAC;QAClC,CAAC,CAAC,qBAAqB,CACnB,aAAa,EACb,cAAc,EACd,KAAK,CAAC,cAAc,CACrB,CAAC;IACR,MAAM,YAAY,GAAG,sBAAsB,CAAC;QAC1C,OAAO,EAAE,aAAa;QACtB,MAAM;KACP,CAAC,CAAC,OAAO,EAAE,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAE3E,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,YAAY,IAAI,CAAC;IACvE,CAAC;IAED,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,GAAG,MAAM,OAAO,YAAY,IAAI,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,MAAM,OAAO,YAAY,OAAO,KAAK,IAAI,CAAC;AACtD,CAAC;AAED,6EAA6E"}
package/package.json CHANGED
@@ -115,7 +115,7 @@
115
115
  "brace-expansion": ">=5.0.9"
116
116
  },
117
117
  "name": "@codyswann/lisa",
118
- "version": "2.328.2",
118
+ "version": "2.328.3",
119
119
  "description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
120
120
  "main": "dist/index.js",
121
121
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "2.328.2",
3
+ "version": "2.328.3",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "2.328.2",
3
+ "version": "2.328.3",
4
4
  "description": "Universal governance: agents, skills, commands, hooks, and rules for all projects.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -154,12 +154,24 @@ The implementation path should use the shared utility layer (`parseLisaUsageSect
154
154
  `mergeLisaUsageEntries`, `createLisaUsageRollup`, `upsertLisaUsageSection`) rather than duplicating
155
155
  token parsing or markdown rendering in each caller.
156
156
 
157
- ### Step 4 — Persist and report
157
+ ### Step 4 — Persist, verify by read-back, and report
158
158
 
159
159
  1. If the rendered ledger body is byte-identical to the current managed surface, return `outcome:
160
160
  no-op`.
161
161
  2. Otherwise write the body or managed comment through the host adapter.
162
- 3. Return the exact writable surface used, direct entry ids, rolled-up child entry ids, totals, and
162
+ 3. **Read the written surface back from the host and parse it.** Run
163
+ `verifyLisaUsageSectionIntegrity(<stored body>, { entryIds: <ids just written> })`. A write is
164
+ successful only when that returns `ok: true`. The host's mutation result is not evidence — a
165
+ Linear `issueUpdate` returned `success: true` while silently discarding every entry token
166
+ (2026-08-04), which is the defect this step exists to catch.
167
+ 4. If verification fails on the body, retry the identical payload as a managed comment and verify
168
+ that surface the same way. Return `outcome: comment-fallback` with a warning naming the failed
169
+ surface and the issue codes.
170
+ 5. If verification fails on every surface, return `outcome: blocked` with the issue codes in
171
+ `error.message`. **Never leave a rollup token behind whose `direct_entry_ids` names entries that
172
+ cannot be parsed from the same surface** — restore the prior managed content rather than
173
+ reporting success over an unreadable ledger.
174
+ 6. Return the exact writable surface used, direct entry ids, rolled-up child entry ids, totals, and
163
175
  any fallback warning.
164
176
 
165
177
  If the host write fails, preserve the exact error text in `error.message`. Do not collapse write
@@ -179,4 +191,6 @@ failures into a generic "usage update failed."
179
191
  - Never skip rollup dedupe. Child totals are keyed by stable `entry_id`, not by child ref count.
180
192
  - Never silently drop to comments. Return `outcome: comment-fallback` so the caller can surface the
181
193
  writable surface that actually holds the ledger.
194
+ - Never report `updated` on the strength of a mutation's return value. Verification is read-back
195
+ and parse, on every surface, every write.
182
196
  - Never overwrite unrelated artifact body content. Rewrite only the managed usage section/comment.
@@ -75,14 +75,24 @@ cost rollups under the normal pricing and currency rules.
75
75
 
76
76
  ## Machine-readable tokens
77
77
 
78
- Every visible direct entry row contains the backward-compatible 17-field primary token:
78
+ Every visible direct entry row has a corresponding backward-compatible 17-field primary token:
79
79
 
80
80
  ```text
81
81
  <!-- lisa:usage-entry entry_id=<id> flow=<flow> run_id=<run-id> provider=<provider> model=<model> source=<source> input_tokens=<n|null> cached_input_tokens=<n|null> output_tokens=<n|null> reasoning_tokens=<n|null> total_tokens=<n|null> cost=<decimal|null> currency=<code|null> pricing_status=<status> pricing_source=<ref|null> artifact_ref=<ref> parent_artifact_ref=<ref-or-empty> -->
82
82
  ```
83
83
 
84
- The row immediately follows it with a correlated measured-subset extension. Writers serialize an
85
- omitted value as `null` instead of `undefined`:
84
+ **Entry tokens are never rendered inside a table row.** They occupy their own lines below the
85
+ visible table, and they correlate to their rows by `entry_id`, not by position. Hosts that
86
+ normalize markdown re-serialize a table from its parsed cell model and discard anything that is
87
+ not a cell: measured against Linear on 2026-08-04, an HTML comment trailing a table row is
88
+ destroyed on write while the same comment on its own line round-trips byte-identically. The
89
+ row-trailing layout therefore produced a ledger that reported a successful write, rendered
90
+ correctly for humans, and enumerated **zero** entries — with a surviving rollup token still naming
91
+ them. Parsing is position-agnostic and always has been, so sections written in the historical
92
+ row-trailing layout still enumerate, and migrate to the own-line layout on their next rewrite.
93
+
94
+ The primary token is immediately followed on the same line by a correlated measured-subset
95
+ extension. Writers serialize an omitted value as `null` instead of `undefined`:
86
96
 
87
97
  ```text
88
98
  <!-- lisa:usage-entry-measured-subset entry_id=<id> measured_subset_tokens=<n|null> -->
@@ -141,7 +151,9 @@ _Managed by Lisa. Regenerated on each usage update; do not edit by hand._
141
151
 
142
152
  | Flow | Model | Source | Tokens | Cost |
143
153
  |---|---|---|---:|---:|
144
- | ...human-readable rows ending with `lisa-usage-entry` tokens... |
154
+ | ...human-readable rows, cells only, no tokens... |
155
+
156
+ <!-- lisa:usage-entry ... --> <!-- lisa:usage-entry-measured-subset ... -->
145
157
 
146
158
  ### Rollup
147
159
 
@@ -154,8 +166,29 @@ _Managed by Lisa. Regenerated on each usage update; do not edit by hand._
154
166
  <!-- lisa:usage-rollup ... -->
155
167
  ```
156
168
 
169
+ Every machine-readable token sits on its own line, outside every table. One entry contributes one
170
+ token line; multiple entries contribute consecutive token lines in the same order as their visible
171
+ rows.
172
+
157
173
  Writers may add host-specific surrounding prose, but they must preserve the heading, the managed-note line, the direct-entry tokens, and the single rollup token.
158
174
 
175
+ ## Write verification
176
+
177
+ A write surface can accept a section, report success, and silently destroy part of it. **Verify
178
+ every managed write by reading the stored bytes back and parsing them — never by the mutation's
179
+ return value.** A write is successful only when the stored surface satisfies the rollup/entry
180
+ agreement invariant below. A caller that cannot verify a surface must fall back to one it can, or
181
+ fail loudly; it must never report success over an unreadable ledger.
182
+
183
+ - Every `entry_id` in the rollup's `direct_entry_ids` resolves to a parseable direct entry in the
184
+ same section.
185
+ - Every parseable direct entry in the section appears in the rollup's `direct_entry_ids`.
186
+ - Every entry the caller just wrote is parseable from the stored surface.
187
+
188
+ `verifyLisaUsageSectionIntegrity` in the shared utility layer implements exactly these checks and
189
+ returns structured issue codes (`missing-section`, `missing-entry-token`, `missing-rollup-token`,
190
+ `unrecorded-entry`). Callers run it against the read-back body, not against the payload they sent.
191
+
159
192
  ## Rollup and dedupe behavior
160
193
 
161
194
  Rollups aggregate descendant usage from native tracker hierarchy, documented generated-work references, and explicit `parent_artifact_ref` links. Within one artifact rollup:
@@ -154,12 +154,24 @@ The implementation path should use the shared utility layer (`parseLisaUsageSect
154
154
  `mergeLisaUsageEntries`, `createLisaUsageRollup`, `upsertLisaUsageSection`) rather than duplicating
155
155
  token parsing or markdown rendering in each caller.
156
156
 
157
- ### Step 4 — Persist and report
157
+ ### Step 4 — Persist, verify by read-back, and report
158
158
 
159
159
  1. If the rendered ledger body is byte-identical to the current managed surface, return `outcome:
160
160
  no-op`.
161
161
  2. Otherwise write the body or managed comment through the host adapter.
162
- 3. Return the exact writable surface used, direct entry ids, rolled-up child entry ids, totals, and
162
+ 3. **Read the written surface back from the host and parse it.** Run
163
+ `verifyLisaUsageSectionIntegrity(<stored body>, { entryIds: <ids just written> })`. A write is
164
+ successful only when that returns `ok: true`. The host's mutation result is not evidence — a
165
+ Linear `issueUpdate` returned `success: true` while silently discarding every entry token
166
+ (2026-08-04), which is the defect this step exists to catch.
167
+ 4. If verification fails on the body, retry the identical payload as a managed comment and verify
168
+ that surface the same way. Return `outcome: comment-fallback` with a warning naming the failed
169
+ surface and the issue codes.
170
+ 5. If verification fails on every surface, return `outcome: blocked` with the issue codes in
171
+ `error.message`. **Never leave a rollup token behind whose `direct_entry_ids` names entries that
172
+ cannot be parsed from the same surface** — restore the prior managed content rather than
173
+ reporting success over an unreadable ledger.
174
+ 6. Return the exact writable surface used, direct entry ids, rolled-up child entry ids, totals, and
163
175
  any fallback warning.
164
176
 
165
177
  If the host write fails, preserve the exact error text in `error.message`. Do not collapse write
@@ -179,4 +191,6 @@ failures into a generic "usage update failed."
179
191
  - Never skip rollup dedupe. Child totals are keyed by stable `entry_id`, not by child ref count.
180
192
  - Never silently drop to comments. Return `outcome: comment-fallback` so the caller can surface the
181
193
  writable surface that actually holds the ledger.
194
+ - Never report `updated` on the strength of a mutation's return value. Verification is read-back
195
+ and parse, on every surface, every write.
182
196
  - Never overwrite unrelated artifact body content. Rewrite only the managed usage section/comment.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "2.328.2",
3
+ "version": "2.328.3",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -154,12 +154,24 @@ The implementation path should use the shared utility layer (`parseLisaUsageSect
154
154
  `mergeLisaUsageEntries`, `createLisaUsageRollup`, `upsertLisaUsageSection`) rather than duplicating
155
155
  token parsing or markdown rendering in each caller.
156
156
 
157
- ### Step 4 — Persist and report
157
+ ### Step 4 — Persist, verify by read-back, and report
158
158
 
159
159
  1. If the rendered ledger body is byte-identical to the current managed surface, return `outcome:
160
160
  no-op`.
161
161
  2. Otherwise write the body or managed comment through the host adapter.
162
- 3. Return the exact writable surface used, direct entry ids, rolled-up child entry ids, totals, and
162
+ 3. **Read the written surface back from the host and parse it.** Run
163
+ `verifyLisaUsageSectionIntegrity(<stored body>, { entryIds: <ids just written> })`. A write is
164
+ successful only when that returns `ok: true`. The host's mutation result is not evidence — a
165
+ Linear `issueUpdate` returned `success: true` while silently discarding every entry token
166
+ (2026-08-04), which is the defect this step exists to catch.
167
+ 4. If verification fails on the body, retry the identical payload as a managed comment and verify
168
+ that surface the same way. Return `outcome: comment-fallback` with a warning naming the failed
169
+ surface and the issue codes.
170
+ 5. If verification fails on every surface, return `outcome: blocked` with the issue codes in
171
+ `error.message`. **Never leave a rollup token behind whose `direct_entry_ids` names entries that
172
+ cannot be parsed from the same surface** — restore the prior managed content rather than
173
+ reporting success over an unreadable ledger.
174
+ 6. Return the exact writable surface used, direct entry ids, rolled-up child entry ids, totals, and
163
175
  any fallback warning.
164
176
 
165
177
  If the host write fails, preserve the exact error text in `error.message`. Do not collapse write
@@ -179,4 +191,6 @@ failures into a generic "usage update failed."
179
191
  - Never skip rollup dedupe. Child totals are keyed by stable `entry_id`, not by child ref count.
180
192
  - Never silently drop to comments. Return `outcome: comment-fallback` so the caller can surface the
181
193
  writable surface that actually holds the ledger.
194
+ - Never report `updated` on the strength of a mutation's return value. Verification is read-back
195
+ and parse, on every surface, every write.
182
196
  - Never overwrite unrelated artifact body content. Rewrite only the managed usage section/comment.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "2.328.2",
3
+ "version": "2.328.3",
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": "2.328.2",
3
+ "version": "2.328.3",
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": "2.328.2",
3
+ "version": "2.328.3",
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": "2.328.2",
3
+ "version": "2.328.3",
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": "2.328.2",
3
+ "version": "2.328.3",
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": "2.328.2",
3
+ "version": "2.328.3",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -75,14 +75,24 @@ cost rollups under the normal pricing and currency rules.
75
75
 
76
76
  ## Machine-readable tokens
77
77
 
78
- Every visible direct entry row contains the backward-compatible 17-field primary token:
78
+ Every visible direct entry row has a corresponding backward-compatible 17-field primary token:
79
79
 
80
80
  ```text
81
81
  <!-- lisa:usage-entry entry_id=<id> flow=<flow> run_id=<run-id> provider=<provider> model=<model> source=<source> input_tokens=<n|null> cached_input_tokens=<n|null> output_tokens=<n|null> reasoning_tokens=<n|null> total_tokens=<n|null> cost=<decimal|null> currency=<code|null> pricing_status=<status> pricing_source=<ref|null> artifact_ref=<ref> parent_artifact_ref=<ref-or-empty> -->
82
82
  ```
83
83
 
84
- The row immediately follows it with a correlated measured-subset extension. Writers serialize an
85
- omitted value as `null` instead of `undefined`:
84
+ **Entry tokens are never rendered inside a table row.** They occupy their own lines below the
85
+ visible table, and they correlate to their rows by `entry_id`, not by position. Hosts that
86
+ normalize markdown re-serialize a table from its parsed cell model and discard anything that is
87
+ not a cell: measured against Linear on 2026-08-04, an HTML comment trailing a table row is
88
+ destroyed on write while the same comment on its own line round-trips byte-identically. The
89
+ row-trailing layout therefore produced a ledger that reported a successful write, rendered
90
+ correctly for humans, and enumerated **zero** entries — with a surviving rollup token still naming
91
+ them. Parsing is position-agnostic and always has been, so sections written in the historical
92
+ row-trailing layout still enumerate, and migrate to the own-line layout on their next rewrite.
93
+
94
+ The primary token is immediately followed on the same line by a correlated measured-subset
95
+ extension. Writers serialize an omitted value as `null` instead of `undefined`:
86
96
 
87
97
  ```text
88
98
  <!-- lisa:usage-entry-measured-subset entry_id=<id> measured_subset_tokens=<n|null> -->
@@ -141,7 +151,9 @@ _Managed by Lisa. Regenerated on each usage update; do not edit by hand._
141
151
 
142
152
  | Flow | Model | Source | Tokens | Cost |
143
153
  |---|---|---|---:|---:|
144
- | ...human-readable rows ending with `lisa-usage-entry` tokens... |
154
+ | ...human-readable rows, cells only, no tokens... |
155
+
156
+ <!-- lisa:usage-entry ... --> <!-- lisa:usage-entry-measured-subset ... -->
145
157
 
146
158
  ### Rollup
147
159
 
@@ -154,8 +166,29 @@ _Managed by Lisa. Regenerated on each usage update; do not edit by hand._
154
166
  <!-- lisa:usage-rollup ... -->
155
167
  ```
156
168
 
169
+ Every machine-readable token sits on its own line, outside every table. One entry contributes one
170
+ token line; multiple entries contribute consecutive token lines in the same order as their visible
171
+ rows.
172
+
157
173
  Writers may add host-specific surrounding prose, but they must preserve the heading, the managed-note line, the direct-entry tokens, and the single rollup token.
158
174
 
175
+ ## Write verification
176
+
177
+ A write surface can accept a section, report success, and silently destroy part of it. **Verify
178
+ every managed write by reading the stored bytes back and parsing them — never by the mutation's
179
+ return value.** A write is successful only when the stored surface satisfies the rollup/entry
180
+ agreement invariant below. A caller that cannot verify a surface must fall back to one it can, or
181
+ fail loudly; it must never report success over an unreadable ledger.
182
+
183
+ - Every `entry_id` in the rollup's `direct_entry_ids` resolves to a parseable direct entry in the
184
+ same section.
185
+ - Every parseable direct entry in the section appears in the rollup's `direct_entry_ids`.
186
+ - Every entry the caller just wrote is parseable from the stored surface.
187
+
188
+ `verifyLisaUsageSectionIntegrity` in the shared utility layer implements exactly these checks and
189
+ returns structured issue codes (`missing-section`, `missing-entry-token`, `missing-rollup-token`,
190
+ `unrecorded-entry`). Callers run it against the read-back body, not against the payload they sent.
191
+
159
192
  ## Rollup and dedupe behavior
160
193
 
161
194
  Rollups aggregate descendant usage from native tracker hierarchy, documented generated-work references, and explicit `parent_artifact_ref` links. Within one artifact rollup: