@bonesofspring/ai-rules 0.2.66 → 0.2.67

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 (183) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +2 -0
  3. package/bin/cli.js +9 -1
  4. package/bin/lib/engine-scripts.js +0 -4
  5. package/bin/lib/seed-ai-local-team.js +26 -0
  6. package/docs/OPENCODE-COMPATIBILITY.md +1 -0
  7. package/docs/OPENCODE.md +14 -1
  8. package/docs/TEAM-DB.md +2 -1
  9. package/docs/TOKEN-ECONOMY.md +32 -1
  10. package/docs/openapi/team-db.v1.json +5 -5
  11. package/package.json +10 -2
  12. package/presets/_shared/ai-local/scripts/dump-output.mjs +63 -12
  13. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +3 -3
  14. package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +2 -0
  15. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +9 -2
  16. package/presets/_shared/hooks/list-ai-local.mjs +17 -0
  17. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +9 -2
  18. package/presets/claude/android-kotlin/hooks/list-ai-local.mjs +17 -0
  19. package/presets/claude/go/hooks/chain-team-phases.sh +9 -2
  20. package/presets/claude/go/hooks/list-ai-local.mjs +17 -0
  21. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +9 -2
  22. package/presets/claude/ios-swift/hooks/list-ai-local.mjs +17 -0
  23. package/presets/claude/java/hooks/chain-team-phases.sh +9 -2
  24. package/presets/claude/java/hooks/list-ai-local.mjs +17 -0
  25. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +9 -2
  26. package/presets/claude/mcp-ts/hooks/list-ai-local.mjs +17 -0
  27. package/presets/claude/mol/hooks/chain-team-phases.sh +9 -2
  28. package/presets/claude/mol/hooks/list-ai-local.mjs +17 -0
  29. package/presets/claude/next/agents/ci-investigator.md +5 -2
  30. package/presets/claude/next/agents/debugger.md +5 -2
  31. package/presets/claude/next/agents/feature-developer.md +5 -2
  32. package/presets/claude/next/hooks/chain-team-phases.sh +9 -2
  33. package/presets/claude/next/hooks/list-ai-local.mjs +17 -0
  34. package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +4 -0
  35. package/presets/claude/nuxt/hooks/chain-team-phases.sh +9 -2
  36. package/presets/claude/nuxt/hooks/list-ai-local.mjs +17 -0
  37. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  38. package/presets/claude/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  39. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +9 -2
  40. package/presets/claude/php-laravel/hooks/list-ai-local.mjs +17 -0
  41. package/presets/claude/svelte/hooks/chain-team-phases.sh +9 -2
  42. package/presets/claude/svelte/hooks/list-ai-local.mjs +17 -0
  43. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +9 -2
  44. package/presets/cursor/android-kotlin/hooks/list-ai-local.mjs +17 -0
  45. package/presets/cursor/go/hooks/chain-team-phases.sh +9 -2
  46. package/presets/cursor/go/hooks/list-ai-local.mjs +17 -0
  47. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +9 -2
  48. package/presets/cursor/ios-swift/hooks/list-ai-local.mjs +17 -0
  49. package/presets/cursor/java/hooks/chain-team-phases.sh +9 -2
  50. package/presets/cursor/java/hooks/list-ai-local.mjs +17 -0
  51. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +9 -2
  52. package/presets/cursor/mcp-ts/hooks/list-ai-local.mjs +17 -0
  53. package/presets/cursor/mol/hooks/chain-team-phases.sh +9 -2
  54. package/presets/cursor/mol/hooks/list-ai-local.mjs +17 -0
  55. package/presets/cursor/next/hooks/chain-team-phases.sh +9 -2
  56. package/presets/cursor/next/hooks/list-ai-local.mjs +17 -0
  57. package/presets/cursor/next/rules/feature-delivery-workflow.mdc +4 -0
  58. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +9 -2
  59. package/presets/cursor/nuxt/hooks/list-ai-local.mjs +17 -0
  60. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  61. package/presets/cursor/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  62. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +9 -2
  63. package/presets/cursor/php-laravel/hooks/list-ai-local.mjs +17 -0
  64. package/presets/cursor/svelte/hooks/chain-team-phases.sh +9 -2
  65. package/presets/cursor/svelte/hooks/list-ai-local.mjs +17 -0
  66. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  67. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +9 -2
  68. package/presets/mavis/android-kotlin/hooks/list-ai-local.mjs +17 -0
  69. package/presets/mavis/go/adapter-map.json +1 -1
  70. package/presets/mavis/go/hooks/chain-team-phases.sh +9 -2
  71. package/presets/mavis/go/hooks/list-ai-local.mjs +17 -0
  72. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  73. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +9 -2
  74. package/presets/mavis/ios-swift/hooks/list-ai-local.mjs +17 -0
  75. package/presets/mavis/java/adapter-map.json +1 -1
  76. package/presets/mavis/java/hooks/chain-team-phases.sh +9 -2
  77. package/presets/mavis/java/hooks/list-ai-local.mjs +17 -0
  78. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  79. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +9 -2
  80. package/presets/mavis/mcp-ts/hooks/list-ai-local.mjs +17 -0
  81. package/presets/mavis/mol/adapter-map.json +1 -1
  82. package/presets/mavis/mol/hooks/chain-team-phases.sh +9 -2
  83. package/presets/mavis/mol/hooks/list-ai-local.mjs +17 -0
  84. package/presets/mavis/next/adapter-map.json +1 -1
  85. package/presets/mavis/next/agents/ci-investigator.md +5 -2
  86. package/presets/mavis/next/agents/debugger.md +5 -2
  87. package/presets/mavis/next/agents/feature-developer.md +5 -2
  88. package/presets/mavis/next/hooks/chain-team-phases.sh +9 -2
  89. package/presets/mavis/next/hooks/list-ai-local.mjs +17 -0
  90. package/presets/mavis/next/rules/feature-delivery-workflow.md +4 -0
  91. package/presets/mavis/nuxt/adapter-map.json +1 -1
  92. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +9 -2
  93. package/presets/mavis/nuxt/hooks/list-ai-local.mjs +17 -0
  94. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  95. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  96. package/presets/mavis/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  97. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  98. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +9 -2
  99. package/presets/mavis/php-laravel/hooks/list-ai-local.mjs +17 -0
  100. package/presets/mavis/svelte/adapter-map.json +1 -1
  101. package/presets/mavis/svelte/hooks/chain-team-phases.sh +9 -2
  102. package/presets/mavis/svelte/hooks/list-ai-local.mjs +17 -0
  103. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  104. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +9 -2
  105. package/presets/opencode/android-kotlin/hooks/list-ai-local.mjs +17 -0
  106. package/presets/opencode/go/adapter-map.json +1 -1
  107. package/presets/opencode/go/hooks/chain-team-phases.sh +9 -2
  108. package/presets/opencode/go/hooks/list-ai-local.mjs +17 -0
  109. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  110. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +9 -2
  111. package/presets/opencode/ios-swift/hooks/list-ai-local.mjs +17 -0
  112. package/presets/opencode/java/adapter-map.json +1 -1
  113. package/presets/opencode/java/hooks/chain-team-phases.sh +9 -2
  114. package/presets/opencode/java/hooks/list-ai-local.mjs +17 -0
  115. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  116. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +9 -2
  117. package/presets/opencode/mcp-ts/hooks/list-ai-local.mjs +17 -0
  118. package/presets/opencode/mol/adapter-map.json +1 -1
  119. package/presets/opencode/mol/hooks/chain-team-phases.sh +9 -2
  120. package/presets/opencode/mol/hooks/list-ai-local.mjs +17 -0
  121. package/presets/opencode/next/adapter-map.json +1 -1
  122. package/presets/opencode/next/agents/ci-investigator.md +5 -2
  123. package/presets/opencode/next/agents/debugger.md +5 -2
  124. package/presets/opencode/next/agents/feature-developer.md +5 -2
  125. package/presets/opencode/next/hooks/chain-team-phases.sh +9 -2
  126. package/presets/opencode/next/hooks/list-ai-local.mjs +17 -0
  127. package/presets/opencode/next/rules/feature-delivery-workflow.md +4 -0
  128. package/presets/opencode/nuxt/adapter-map.json +1 -1
  129. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +9 -2
  130. package/presets/opencode/nuxt/hooks/list-ai-local.mjs +17 -0
  131. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  132. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  133. package/presets/opencode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  134. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  135. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +9 -2
  136. package/presets/opencode/php-laravel/hooks/list-ai-local.mjs +17 -0
  137. package/presets/opencode/plugins/output-guard/README.md +43 -0
  138. package/presets/opencode/plugins/output-guard/index.ts +300 -0
  139. package/presets/opencode/plugins/output-guard/package.json +9 -0
  140. package/presets/opencode/plugins/output-guard/rewrite.ts +149 -0
  141. package/presets/opencode/plugins/task-status/task-view.ts +58 -20
  142. package/presets/opencode/plugins/task-status/tui.tsx +5 -3
  143. package/presets/opencode/svelte/adapter-map.json +1 -1
  144. package/presets/opencode/svelte/hooks/chain-team-phases.sh +9 -2
  145. package/presets/opencode/svelte/hooks/list-ai-local.mjs +17 -0
  146. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  147. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +9 -2
  148. package/presets/zcode/android-kotlin/hooks/list-ai-local.mjs +17 -0
  149. package/presets/zcode/go/adapter-map.json +1 -1
  150. package/presets/zcode/go/hooks/chain-team-phases.sh +9 -2
  151. package/presets/zcode/go/hooks/list-ai-local.mjs +17 -0
  152. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  153. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +9 -2
  154. package/presets/zcode/ios-swift/hooks/list-ai-local.mjs +17 -0
  155. package/presets/zcode/java/adapter-map.json +1 -1
  156. package/presets/zcode/java/hooks/chain-team-phases.sh +9 -2
  157. package/presets/zcode/java/hooks/list-ai-local.mjs +17 -0
  158. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  159. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +9 -2
  160. package/presets/zcode/mcp-ts/hooks/list-ai-local.mjs +17 -0
  161. package/presets/zcode/mol/adapter-map.json +1 -1
  162. package/presets/zcode/mol/hooks/chain-team-phases.sh +9 -2
  163. package/presets/zcode/mol/hooks/list-ai-local.mjs +17 -0
  164. package/presets/zcode/next/adapter-map.json +1 -1
  165. package/presets/zcode/next/agents/ci-investigator.md +5 -2
  166. package/presets/zcode/next/agents/debugger.md +5 -2
  167. package/presets/zcode/next/agents/feature-developer.md +5 -2
  168. package/presets/zcode/next/hooks/chain-team-phases.sh +9 -2
  169. package/presets/zcode/next/hooks/list-ai-local.mjs +17 -0
  170. package/presets/zcode/next/rules/feature-delivery-workflow.md +4 -0
  171. package/presets/zcode/nuxt/adapter-map.json +1 -1
  172. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +9 -2
  173. package/presets/zcode/nuxt/hooks/list-ai-local.mjs +17 -0
  174. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  175. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +9 -2
  176. package/presets/zcode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
  177. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  178. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +9 -2
  179. package/presets/zcode/php-laravel/hooks/list-ai-local.mjs +17 -0
  180. package/presets/zcode/svelte/adapter-map.json +1 -1
  181. package/presets/zcode/svelte/hooks/chain-team-phases.sh +9 -2
  182. package/presets/zcode/svelte/hooks/list-ai-local.mjs +17 -0
  183. package/scripts/report-context-cost.mjs +432 -0
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -1283,11 +1283,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1283
1283
  }
1284
1284
  } catch {}
1285
1285
  }
1286
+ // Five entries is enough to resume; a longer list is a status dump, not a
1287
+ // pointer. The line budget below still bounds a single entry with many paths.
1288
+ const MAX_FOCUS_ENTRIES = 5;
1289
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1286
1290
  const pathLines = [];
1287
1291
  if (incomplete.length === 0) pathLines.push(' - (none)');
1288
1292
  else {
1289
- for (let index = 0; index < incomplete.length; index += 1) {
1290
- const item = incomplete[index];
1293
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1294
+ const item = shownIncomplete[index];
1291
1295
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1292
1296
  else {
1293
1297
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1295,6 +1299,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1295
1299
  }
1296
1300
  }
1297
1301
  }
1302
+ if (incomplete.length > shownIncomplete.length) {
1303
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1304
+ }
1298
1305
  }
1299
1306
  let readyLine = '- decomposition ready set: (none)';
1300
1307
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "android-kotlin",
5
5
  "semanticSource": "cursor/android-kotlin",
6
- "sourceRevision": "8f8534d89a35c657254267b7eef7730f5336a1b9b59ef29b70cbc89d099c72df",
6
+ "sourceRevision": "994ba1bdd785a6551055abbe78f146711e0d4c61748a4b5f744ac8545f65cf78",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -1283,11 +1283,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1283
1283
  }
1284
1284
  } catch {}
1285
1285
  }
1286
+ // Five entries is enough to resume; a longer list is a status dump, not a
1287
+ // pointer. The line budget below still bounds a single entry with many paths.
1288
+ const MAX_FOCUS_ENTRIES = 5;
1289
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1286
1290
  const pathLines = [];
1287
1291
  if (incomplete.length === 0) pathLines.push(' - (none)');
1288
1292
  else {
1289
- for (let index = 0; index < incomplete.length; index += 1) {
1290
- const item = incomplete[index];
1293
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1294
+ const item = shownIncomplete[index];
1291
1295
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1292
1296
  else {
1293
1297
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1295,6 +1299,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1295
1299
  }
1296
1300
  }
1297
1301
  }
1302
+ if (incomplete.length > shownIncomplete.length) {
1303
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1304
+ }
1298
1305
  }
1299
1306
  let readyLine = '- decomposition ready set: (none)';
1300
1307
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "go",
5
5
  "semanticSource": "cursor/go",
6
- "sourceRevision": "859d7db7999e9e386bbbb0a52911754a239a66b5055321f1aa8967420f4f98a2",
6
+ "sourceRevision": "d47408424812fff73722b380f6ee6530f6c89088260ad094474a32c4ac9e51d2",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -1282,11 +1282,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1282
1282
  }
1283
1283
  } catch {}
1284
1284
  }
1285
+ // Five entries is enough to resume; a longer list is a status dump, not a
1286
+ // pointer. The line budget below still bounds a single entry with many paths.
1287
+ const MAX_FOCUS_ENTRIES = 5;
1288
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1285
1289
  const pathLines = [];
1286
1290
  if (incomplete.length === 0) pathLines.push(' - (none)');
1287
1291
  else {
1288
- for (let index = 0; index < incomplete.length; index += 1) {
1289
- const item = incomplete[index];
1292
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1293
+ const item = shownIncomplete[index];
1290
1294
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1291
1295
  else {
1292
1296
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1294,6 +1298,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1294
1298
  }
1295
1299
  }
1296
1300
  }
1301
+ if (incomplete.length > shownIncomplete.length) {
1302
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1303
+ }
1297
1304
  }
1298
1305
  let readyLine = '- decomposition ready set: (none)';
1299
1306
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "ios-swift",
5
5
  "semanticSource": "cursor/ios-swift",
6
- "sourceRevision": "26439f8a92d191750d214b6763deba39cb9340276b5ce1bbeac816efbaf072b2",
6
+ "sourceRevision": "2ccc97fbc9cfcda17c06b3b49304e1f0a4b2efa7633eb05ab41874ac3f5acd76",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -1283,11 +1283,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1283
1283
  }
1284
1284
  } catch {}
1285
1285
  }
1286
+ // Five entries is enough to resume; a longer list is a status dump, not a
1287
+ // pointer. The line budget below still bounds a single entry with many paths.
1288
+ const MAX_FOCUS_ENTRIES = 5;
1289
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1286
1290
  const pathLines = [];
1287
1291
  if (incomplete.length === 0) pathLines.push(' - (none)');
1288
1292
  else {
1289
- for (let index = 0; index < incomplete.length; index += 1) {
1290
- const item = incomplete[index];
1293
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1294
+ const item = shownIncomplete[index];
1291
1295
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1292
1296
  else {
1293
1297
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1295,6 +1299,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1295
1299
  }
1296
1300
  }
1297
1301
  }
1302
+ if (incomplete.length > shownIncomplete.length) {
1303
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1304
+ }
1298
1305
  }
1299
1306
  let readyLine = '- decomposition ready set: (none)';
1300
1307
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "java",
5
5
  "semanticSource": "cursor/java",
6
- "sourceRevision": "bf437520f76a975ad3de4343abd6c9b0b626d7924c4bc58decc6eb2c8e53d343",
6
+ "sourceRevision": "71288da6b6d831ff65f7643d7a9aadade8b48939a2572853405ee5137225f2a6",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -1282,11 +1282,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1282
1282
  }
1283
1283
  } catch {}
1284
1284
  }
1285
+ // Five entries is enough to resume; a longer list is a status dump, not a
1286
+ // pointer. The line budget below still bounds a single entry with many paths.
1287
+ const MAX_FOCUS_ENTRIES = 5;
1288
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1285
1289
  const pathLines = [];
1286
1290
  if (incomplete.length === 0) pathLines.push(' - (none)');
1287
1291
  else {
1288
- for (let index = 0; index < incomplete.length; index += 1) {
1289
- const item = incomplete[index];
1292
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1293
+ const item = shownIncomplete[index];
1290
1294
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1291
1295
  else {
1292
1296
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1294,6 +1298,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1294
1298
  }
1295
1299
  }
1296
1300
  }
1301
+ if (incomplete.length > shownIncomplete.length) {
1302
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1303
+ }
1297
1304
  }
1298
1305
  let readyLine = '- decomposition ready set: (none)';
1299
1306
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "mcp-ts",
5
5
  "semanticSource": "cursor/mcp-ts",
6
- "sourceRevision": "2ffd4c64ab4c37c04dfdb7a7ea73d0bd2a0774be6d936e099558c5095a87b431",
6
+ "sourceRevision": "4c1d96d715f8498ce64cda62057e19e836a08e9742f2aed30d98a2564eea421b",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -1270,11 +1270,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1270
1270
  }
1271
1271
  } catch {}
1272
1272
  }
1273
+ // Five entries is enough to resume; a longer list is a status dump, not a
1274
+ // pointer. The line budget below still bounds a single entry with many paths.
1275
+ const MAX_FOCUS_ENTRIES = 5;
1276
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1273
1277
  const pathLines = [];
1274
1278
  if (incomplete.length === 0) pathLines.push(' - (none)');
1275
1279
  else {
1276
- for (let index = 0; index < incomplete.length; index += 1) {
1277
- const item = incomplete[index];
1280
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1281
+ const item = shownIncomplete[index];
1278
1282
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1279
1283
  else {
1280
1284
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1282,6 +1286,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1282
1286
  }
1283
1287
  }
1284
1288
  }
1289
+ if (incomplete.length > shownIncomplete.length) {
1290
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1291
+ }
1285
1292
  }
1286
1293
  let readyLine = '- decomposition ready set: (none)';
1287
1294
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "mol",
5
5
  "semanticSource": "cursor/mol",
6
- "sourceRevision": "b78430fe11e2dab97a2a3b9304bd63b931f79898e5460203e7110f6635b1ac85",
6
+ "sourceRevision": "76d63b970b2bea94a367837b133ebcc0caa0d097b784090c6ca253af451a73fb",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -1283,11 +1283,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1283
1283
  }
1284
1284
  } catch {}
1285
1285
  }
1286
+ // Five entries is enough to resume; a longer list is a status dump, not a
1287
+ // pointer. The line budget below still bounds a single entry with many paths.
1288
+ const MAX_FOCUS_ENTRIES = 5;
1289
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1286
1290
  const pathLines = [];
1287
1291
  if (incomplete.length === 0) pathLines.push(' - (none)');
1288
1292
  else {
1289
- for (let index = 0; index < incomplete.length; index += 1) {
1290
- const item = incomplete[index];
1293
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1294
+ const item = shownIncomplete[index];
1291
1295
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1292
1296
  else {
1293
1297
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1295,6 +1299,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1295
1299
  }
1296
1300
  }
1297
1301
  }
1302
+ if (incomplete.length > shownIncomplete.length) {
1303
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1304
+ }
1298
1305
  }
1299
1306
  let readyLine = '- decomposition ready set: (none)';
1300
1307
  try {
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import fs from 'node:fs';
16
16
  import path from 'node:path';
17
+ import crypto from 'node:crypto';
17
18
  import { fileURLToPath } from 'node:url';
18
19
 
19
20
  export const OUTPUT_CAP = 4096;
@@ -29,6 +30,15 @@ const isRealDirectory = (target) => {
29
30
  }
30
31
  };
31
32
 
33
+ /** First 8 hex of the file body; a session-local re-read gate, not a security hash. */
34
+ const shortHash = (file) => {
35
+ try {
36
+ return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').slice(0, 8);
37
+ } catch {
38
+ return '????????';
39
+ }
40
+ };
41
+
32
42
  const insideRoot = (root, abs) => {
33
43
  const relative = path.relative(root, abs);
34
44
  return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
@@ -168,6 +178,13 @@ export const renderReport = (root, inputs) => {
168
178
  }
169
179
  if (blocks.length === 0) return { text: 'overlays=0', chains: [], read: [] };
170
180
  const lines = [`overlays=${overlaySet.size}`, ...blocks.flatMap((block) => block.lines)];
181
+ const readSet = new Set(read);
182
+ if (readSet.size > 0) {
183
+ lines.push('hashes:');
184
+ for (const file of [...readSet].sort()) {
185
+ lines.push(`${file} ${shortHash(path.join(root, file))}`);
186
+ }
187
+ }
171
188
  return {
172
189
  text: lines.join('\n'),
173
190
  chains: blocks.map((block) => ({ for: block.for, overlays: block.overlays })),
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "next",
5
5
  "semanticSource": "cursor/next",
6
- "sourceRevision": "6963e095bbe461e77686e65987ac2c358052146e129d7c32d79275c3eaf54c06",
6
+ "sourceRevision": "bce4518e7bde886b712cc7cb83cdf8017b4261b7032d39670a7b5b4ec4aba392",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -8,10 +8,13 @@ This subagent runs standalone (`mcode exec --file`) and inherits no global conte
8
8
  - `.mavis/rules/ai-local-overlay.md`
9
9
  - `.mavis/rules/architecture-boundaries.md` — layer boundaries and allowed imports
10
10
  - `.mavis/rules/feature-delivery-workflow.md` — layer order, mockup gate, ux-design gate
11
- - `.mavis/rules/reference-features.md` — analog files first
12
- - `.mavis/rules/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
13
11
  - `.mavis/rules/anti-hallucination-contract.md` — do not invent signatures, imports, schemas, or evidence
14
12
  - `.mavis/rules/post-change-lint.md` — lint/type-check after code edits
13
+
14
+ Read when the task reaches the matching zone:
15
+
16
+ - `.mavis/rules/reference-features.md` — analog files first
17
+ - `.mavis/rules/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
15
18
  - `.mavis/rules/mcp-usage.md` — when verifying third-party APIs (Context7)
16
19
  - `.mavis/rules/public-imports.md` — @/types, @/api barrels
17
20
  - `.mavis/rules/react-ui.md` — UI component style (no FC, no spread, decomposition)
@@ -8,10 +8,13 @@ This subagent runs standalone (`mcode exec --file`) and inherits no global conte
8
8
  - `.mavis/rules/ai-local-overlay.md`
9
9
  - `.mavis/rules/architecture-boundaries.md` — layer boundaries and allowed imports
10
10
  - `.mavis/rules/feature-delivery-workflow.md` — layer order, mockup gate, ux-design gate
11
- - `.mavis/rules/reference-features.md` — analog files first
12
- - `.mavis/rules/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
13
11
  - `.mavis/rules/anti-hallucination-contract.md` — do not invent signatures, imports, schemas, or evidence
14
12
  - `.mavis/rules/post-change-lint.md` — lint/type-check after code edits
13
+
14
+ Read when the task reaches the matching zone:
15
+
16
+ - `.mavis/rules/reference-features.md` — analog files first
17
+ - `.mavis/rules/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
15
18
  - `.mavis/rules/mcp-usage.md` — when verifying third-party APIs (Context7)
16
19
  - `.mavis/rules/public-imports.md` — @/types, @/api barrels
17
20
  - `.mavis/rules/react-ui.md` — UI component style (no FC, no spread, decomposition)
@@ -8,10 +8,13 @@ This subagent runs standalone (`mcode exec --file`) and inherits no global conte
8
8
  - `.mavis/rules/ai-local-overlay.md`
9
9
  - `.mavis/rules/architecture-boundaries.md` — layer boundaries and allowed imports
10
10
  - `.mavis/rules/feature-delivery-workflow.md` — layer order, mockup gate, ux-design gate
11
- - `.mavis/rules/reference-features.md` — analog files first
12
- - `.mavis/rules/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
13
11
  - `.mavis/rules/anti-hallucination-contract.md` — do not invent signatures, imports, schemas, or evidence
14
12
  - `.mavis/rules/post-change-lint.md` — lint/type-check after code edits
13
+
14
+ Read when the task reaches the matching zone:
15
+
16
+ - `.mavis/rules/reference-features.md` — analog files first
17
+ - `.mavis/rules/anti-sycophancy-discipline.md` — procedural anti-sycophancy rules
15
18
  - `.mavis/rules/mcp-usage.md` — when verifying third-party APIs (Context7)
16
19
  - `.mavis/rules/public-imports.md` — @/types, @/api barrels
17
20
  - `.mavis/rules/react-ui.md` — UI component style (no FC, no spread, decomposition)
@@ -1283,11 +1283,15 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1283
1283
  }
1284
1284
  } catch {}
1285
1285
  }
1286
+ // Five entries is enough to resume; a longer list is a status dump, not a
1287
+ // pointer. The line budget below still bounds a single entry with many paths.
1288
+ const MAX_FOCUS_ENTRIES = 5;
1289
+ const shownIncomplete = incomplete.slice(0, MAX_FOCUS_ENTRIES);
1286
1290
  const pathLines = [];
1287
1291
  if (incomplete.length === 0) pathLines.push(' - (none)');
1288
1292
  else {
1289
- for (let index = 0; index < incomplete.length; index += 1) {
1290
- const item = incomplete[index];
1293
+ for (let index = 0; index < shownIncomplete.length; index += 1) {
1294
+ const item = shownIncomplete[index];
1291
1295
  if (item.paths.length === 0) pathLines.push(' - ' + item.id + ': (none)');
1292
1296
  else {
1293
1297
  for (let pathIndex = 0; pathIndex < item.paths.length; pathIndex += 1) {
@@ -1295,6 +1299,9 @@ function focusDigestMarkdown(dir, statusSnapshot) {
1295
1299
  }
1296
1300
  }
1297
1301
  }
1302
+ if (incomplete.length > shownIncomplete.length) {
1303
+ pathLines.push(' - (+' + String(incomplete.length - shownIncomplete.length) + ' more incomplete entries)');
1304
+ }
1298
1305
  }
1299
1306
  let readyLine = '- decomposition ready set: (none)';
1300
1307
  try {