@agentwhy/cli 0.0.0-dev

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 (400) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +181 -0
  4. package/THIRD_PARTY_NOTICES.md +31 -0
  5. package/dist/adapter/claude-code/contract/assumptions.js +208 -0
  6. package/dist/adapter/claude-code/contract/denials.js +15 -0
  7. package/dist/adapter/claude-code/contract/entry-points.js +15 -0
  8. package/dist/adapter/claude-code/contract/fields.js +73 -0
  9. package/dist/adapter/claude-code/contract/hooks.js +96 -0
  10. package/dist/adapter/claude-code/contract/identifiers.js +15 -0
  11. package/dist/adapter/claude-code/contract/layout.js +29 -0
  12. package/dist/adapter/claude-code/contract/line-types.js +26 -0
  13. package/dist/adapter/claude-code/contract/projects.js +23 -0
  14. package/dist/adapter/claude-code/contract/recognition.js +14 -0
  15. package/dist/adapter/claude-code/contract/session-title.js +20 -0
  16. package/dist/adapter/claude-code/contract/settings.js +27 -0
  17. package/dist/adapter/claude-code/contract/task-notifications.js +33 -0
  18. package/dist/adapter/claude-code/contract/tools.js +37 -0
  19. package/dist/adapter/claude-code/contract/version.js +51 -0
  20. package/dist/adapter/claude-code/discovery/claude-code-project-catalogue.js +129 -0
  21. package/dist/adapter/claude-code/discovery/claude-code-recognition.js +46 -0
  22. package/dist/adapter/claude-code/discovery/claude-code-session-catalogue.js +100 -0
  23. package/dist/adapter/claude-code/discovery/claude-code-session-discovery.js +61 -0
  24. package/dist/adapter/claude-code/discovery/claude-code-session-titles.js +28 -0
  25. package/dist/adapter/claude-code/discovery/discovered-session.js +1 -0
  26. package/dist/adapter/claude-code/discovery/session-entries.js +41 -0
  27. package/dist/adapter/claude-code/discovery/transcript-tail.js +81 -0
  28. package/dist/adapter/claude-code/events/claude-code-session-source.js +197 -0
  29. package/dist/adapter/claude-code/events/delegation-index.js +15 -0
  30. package/dist/adapter/claude-code/events/transcript-scan.js +179 -0
  31. package/dist/adapter/claude-code/hooks/hook-output.js +42 -0
  32. package/dist/adapter/claude-code/hooks/pre-tool-use-input.js +23 -0
  33. package/dist/adapter/claude-code/hooks/stop-input.js +25 -0
  34. package/dist/adapter/claude-code/hooks/subagent-stop-input.js +26 -0
  35. package/dist/adapter/claude-code/policy/deny-rules.js +46 -0
  36. package/dist/adapter/claude-code/probe/claude-code-probe.js +86 -0
  37. package/dist/adapter/claude-code/probe/collectors/agent-tool-input-key-collector.js +24 -0
  38. package/dist/adapter/claude-code/probe/collectors/denial-kind-collector.js +20 -0
  39. package/dist/adapter/claude-code/probe/collectors/denied-call-collector.js +11 -0
  40. package/dist/adapter/claude-code/probe/collectors/identifier-collector.js +19 -0
  41. package/dist/adapter/claude-code/probe/collectors/line-collector.js +1 -0
  42. package/dist/adapter/claude-code/probe/collectors/line-type-collector.js +29 -0
  43. package/dist/adapter/claude-code/probe/collectors/sidechain-collector.js +20 -0
  44. package/dist/adapter/claude-code/probe/collectors/task-notification-collector.js +51 -0
  45. package/dist/adapter/claude-code/probe/collectors/tool-result-reference-collector.js +31 -0
  46. package/dist/adapter/claude-code/probe/collectors/tool-use-collector.js +24 -0
  47. package/dist/adapter/claude-code/probe/collectors/tool-version-collector.js +14 -0
  48. package/dist/adapter/claude-code/probe/collectors/top-level-key-collector.js +14 -0
  49. package/dist/adapter/claude-code/probe/collectors/unknown-line-type-key-collector.js +24 -0
  50. package/dist/adapter/claude-code/probe/collectors/working-directory-collector.js +28 -0
  51. package/dist/adapter/claude-code/probe/doctor-report.js +1 -0
  52. package/dist/adapter/claude-code/probe/meta-tally.js +42 -0
  53. package/dist/adapter/claude-code/probe/session-probe.js +1 -0
  54. package/dist/adapter/claude-code/probe/session-tally.js +41 -0
  55. package/dist/adapter/claude-code/probe/transcript-line.js +30 -0
  56. package/dist/adapter/claude-code/probe/transcript-tally.js +74 -0
  57. package/dist/adapter/claude-code/settings/deny-entries.js +65 -0
  58. package/dist/adapter/claude-code/settings/hook-entries.js +303 -0
  59. package/dist/adapter/codex/contract/actions.js +69 -0
  60. package/dist/adapter/codex/contract/assumptions.js +55 -0
  61. package/dist/adapter/codex/contract/capabilities.js +24 -0
  62. package/dist/adapter/codex/contract/delegations.js +30 -0
  63. package/dist/adapter/codex/contract/deliveries.js +25 -0
  64. package/dist/adapter/codex/contract/envelope.js +33 -0
  65. package/dist/adapter/codex/contract/hook-refusals.js +14 -0
  66. package/dist/adapter/codex/contract/hooks.js +46 -0
  67. package/dist/adapter/codex/contract/messages.js +47 -0
  68. package/dist/adapter/codex/contract/permissions.js +27 -0
  69. package/dist/adapter/codex/contract/reviews.js +13 -0
  70. package/dist/adapter/codex/contract/session.js +31 -0
  71. package/dist/adapter/codex/contract/turns.js +23 -0
  72. package/dist/adapter/codex/contract/version.js +15 -0
  73. package/dist/adapter/codex/discovery/codex-conversations.js +44 -0
  74. package/dist/adapter/codex/discovery/codex-project-catalogue.js +49 -0
  75. package/dist/adapter/codex/discovery/codex-recognition.js +20 -0
  76. package/dist/adapter/codex/discovery/codex-session-catalogue.js +28 -0
  77. package/dist/adapter/codex/discovery/codex-session-discovery.js +115 -0
  78. package/dist/adapter/codex/discovery/codex-session-index.js +21 -0
  79. package/dist/adapter/codex/discovery/codex-session-titles.js +135 -0
  80. package/dist/adapter/codex/discovery/session-header.js +86 -0
  81. package/dist/adapter/codex/discovery/session-owners.js +11 -0
  82. package/dist/adapter/codex/discovery/session-roots.js +49 -0
  83. package/dist/adapter/codex/events/action-items.js +138 -0
  84. package/dist/adapter/codex/events/capability-records.js +26 -0
  85. package/dist/adapter/codex/events/codex-session-source.js +121 -0
  86. package/dist/adapter/codex/events/hook-refusals.js +27 -0
  87. package/dist/adapter/codex/events/rollout-scan.js +614 -0
  88. package/dist/adapter/codex/events/turn-permissions.js +60 -0
  89. package/dist/adapter/codex/hooks/pre-tool-use-input.js +24 -0
  90. package/dist/adapter/codex/hooks/stop-refusals.js +57 -0
  91. package/dist/adapter/codex/probe/codex-doctor-report.js +1 -0
  92. package/dist/adapter/codex/probe/codex-probe.js +268 -0
  93. package/dist/adapter/codex/settings/codex-hooks.js +83 -0
  94. package/dist/cli/cli-command.js +1 -0
  95. package/dist/cli/command-router.js +42 -0
  96. package/dist/cli/commands/check-cli-command.js +128 -0
  97. package/dist/cli/commands/codex-stop-cli-command.js +27 -0
  98. package/dist/cli/commands/doctor-arguments.js +32 -0
  99. package/dist/cli/commands/doctor-cli-command.js +31 -0
  100. package/dist/cli/commands/doctor-usage.js +14 -0
  101. package/dist/cli/commands/init-cli-command.js +123 -0
  102. package/dist/cli/commands/menu-cli-command.js +58 -0
  103. package/dist/cli/commands/notify-cli-command.js +158 -0
  104. package/dist/cli/commands/refuse-cli-command.js +79 -0
  105. package/dist/cli/commands/report-arguments.js +62 -0
  106. package/dist/cli/commands/report-cli-command.js +36 -0
  107. package/dist/cli/commands/report-usage.js +41 -0
  108. package/dist/cli/commands/sessions-cli-command.js +184 -0
  109. package/dist/cli/commands/start-cli-command.js +83 -0
  110. package/dist/cli/commands/watch-cli-command.js +142 -0
  111. package/dist/cli/exit-codes.js +13 -0
  112. package/dist/cli/project-switches.js +46 -0
  113. package/dist/cli.js +80 -0
  114. package/dist/composition-root.js +411 -0
  115. package/dist/core/access/command-line.js +454 -0
  116. package/dist/core/access/listing.js +58 -0
  117. package/dist/core/access/path-shape.js +59 -0
  118. package/dist/core/access/path-tokens.js +37 -0
  119. package/dist/core/access/protected-access.js +310 -0
  120. package/dist/core/access/protected-values.js +102 -0
  121. package/dist/core/access/recorded-effect.js +67 -0
  122. package/dist/core/access/returns.js +173 -0
  123. package/dist/core/access/search-output.js +34 -0
  124. package/dist/core/access/search-reach.js +268 -0
  125. package/dist/core/access/uses.js +143 -0
  126. package/dist/core/access/words-before.js +52 -0
  127. package/dist/core/agent.js +1 -0
  128. package/dist/core/capability.js +11 -0
  129. package/dist/core/combined-project-catalogue.js +36 -0
  130. package/dist/core/combined-session-catalogue.js +25 -0
  131. package/dist/core/completeness.js +10 -0
  132. package/dist/core/context.js +1 -0
  133. package/dist/core/correlation/correlate.js +329 -0
  134. package/dist/core/delegation.js +1 -0
  135. package/dist/core/detector/prompt-signals.js +78 -0
  136. package/dist/core/entry-point.js +1 -0
  137. package/dist/core/event.js +1 -0
  138. package/dist/core/evidence.js +9 -0
  139. package/dist/core/late-message.js +32 -0
  140. package/dist/core/message.js +1 -0
  141. package/dist/core/nearest-project.js +28 -0
  142. package/dist/core/policy/default-policy.js +32 -0
  143. package/dist/core/policy/glob.js +56 -0
  144. package/dist/core/policy/parse-policy.js +70 -0
  145. package/dist/core/policy/policy.js +20 -0
  146. package/dist/core/policy/resolve-policy.js +16 -0
  147. package/dist/core/project-catalogue.js +1 -0
  148. package/dist/core/project-root.js +133 -0
  149. package/dist/core/provider-titles.js +10 -0
  150. package/dist/core/redaction/entropy.js +46 -0
  151. package/dist/core/redaction/redacted.js +4 -0
  152. package/dist/core/redaction/redactor.js +339 -0
  153. package/dist/core/redaction/secret-patterns.js +22 -0
  154. package/dist/core/redaction/value-shapes.js +81 -0
  155. package/dist/core/redaction/value-trace.js +110 -0
  156. package/dist/core/review.js +1 -0
  157. package/dist/core/session-catalogue.js +19 -0
  158. package/dist/core/session-filter.js +42 -0
  159. package/dist/core/session-format.js +27 -0
  160. package/dist/core/session-model.js +1 -0
  161. package/dist/core/session-reader.js +22 -0
  162. package/dist/core/session-records.js +1 -0
  163. package/dist/core/session-source.js +1 -0
  164. package/dist/core/session-titles.js +21 -0
  165. package/dist/core/turn.js +1 -0
  166. package/dist/doctor/codex-doctor.js +14 -0
  167. package/dist/doctor/doctor-use-case.js +1 -0
  168. package/dist/doctor/format-selecting-doctor.js +28 -0
  169. package/dist/doctor/render/attention/attention-rule.js +1 -0
  170. package/dist/doctor/render/attention/doctor-attention-rules.js +28 -0
  171. package/dist/doctor/render/attention/rules/damaged-meta-files-rule.js +8 -0
  172. package/dist/doctor/render/attention/rules/damaged-transcripts-rule.js +9 -0
  173. package/dist/doctor/render/attention/rules/incomplete-subagent-pairs-rule.js +6 -0
  174. package/dist/doctor/render/attention/rules/missing-main-transcript-rule.js +5 -0
  175. package/dist/doctor/render/attention/rules/missing-spilled-results-rule.js +6 -0
  176. package/dist/doctor/render/attention/rules/multiple-working-directories-rule.js +15 -0
  177. package/dist/doctor/render/attention/rules/unknown-denial-kinds-rule.js +5 -0
  178. package/dist/doctor/render/attention/rules/unknown-line-types-rule.js +6 -0
  179. package/dist/doctor/render/attention/rules/unrecognised-entries-rule.js +6 -0
  180. package/dist/doctor/render/attention/rules/unusable-directories-rule.js +12 -0
  181. package/dist/doctor/render/attention/transcript-scopes.js +6 -0
  182. package/dist/doctor/render/codex-text-doctor-renderer.js +97 -0
  183. package/dist/doctor/render/doctor-renderers.js +1 -0
  184. package/dist/doctor/render/json-doctor-renderer.js +7 -0
  185. package/dist/doctor/render/output-format.js +1 -0
  186. package/dist/doctor/render/text-doctor-renderer.js +124 -0
  187. package/dist/doctor/session-doctor.js +16 -0
  188. package/dist/infrastructure/clack-asker.js +24 -0
  189. package/dist/infrastructure/clack-chooser.js +40 -0
  190. package/dist/infrastructure/clack-multi-chooser.js +31 -0
  191. package/dist/infrastructure/file-alert-store.js +120 -0
  192. package/dist/infrastructure/file-checked-store.js +55 -0
  193. package/dist/infrastructure/file-mark-store.js +67 -0
  194. package/dist/infrastructure/file-onboarding-store.js +93 -0
  195. package/dist/infrastructure/folder-window.js +26 -0
  196. package/dist/infrastructure/node-agentwhy-invocation.js +99 -0
  197. package/dist/infrastructure/node-browser.js +40 -0
  198. package/dist/infrastructure/node-file-system.js +111 -0
  199. package/dist/infrastructure/node-local-server.js +115 -0
  200. package/dist/infrastructure/node-text-input.js +26 -0
  201. package/dist/infrastructure/os-notifier.js +21 -0
  202. package/dist/infrastructure/osascript-folder-chooser.js +53 -0
  203. package/dist/infrastructure/powershell-folder-chooser.js +78 -0
  204. package/dist/infrastructure/real-directory.js +18 -0
  205. package/dist/infrastructure/stream-printer.js +11 -0
  206. package/dist/infrastructure/terminal-banner.js +19 -0
  207. package/dist/ports/agentwhy-invocation.js +1 -0
  208. package/dist/ports/alert-store.js +1 -0
  209. package/dist/ports/asker.js +1 -0
  210. package/dist/ports/browser.js +1 -0
  211. package/dist/ports/checked-store.js +1 -0
  212. package/dist/ports/chooser.js +1 -0
  213. package/dist/ports/directory-reader.js +1 -0
  214. package/dist/ports/file-access-error.js +11 -0
  215. package/dist/ports/file-reader.js +1 -0
  216. package/dist/ports/file-tail-reader.js +1 -0
  217. package/dist/ports/file-writer.js +1 -0
  218. package/dist/ports/folder-chooser.js +1 -0
  219. package/dist/ports/local-server.js +1 -0
  220. package/dist/ports/mark-store.js +10 -0
  221. package/dist/ports/multi-chooser.js +1 -0
  222. package/dist/ports/notifier.js +1 -0
  223. package/dist/ports/onboarding-store.js +1 -0
  224. package/dist/ports/printer.js +1 -0
  225. package/dist/ports/text-input.js +1 -0
  226. package/dist/refuse/command-reach.js +135 -0
  227. package/dist/refuse/command-refusal.js +88 -0
  228. package/dist/refuse/render/codex-stop-words.js +21 -0
  229. package/dist/refuse/render/refusal-words.js +34 -0
  230. package/dist/report/build-report.js +1037 -0
  231. package/dist/report/check/actions-digest.js +73 -0
  232. package/dist/report/check/check-lines.js +83 -0
  233. package/dist/report/check/mark-request.js +90 -0
  234. package/dist/report/check/marks.js +84 -0
  235. package/dist/report/check/render/text-digest-renderer.js +332 -0
  236. package/dist/report/check/session-actions.js +90 -0
  237. package/dist/report/check/session-check.js +91 -0
  238. package/dist/report/choose-policy.js +61 -0
  239. package/dist/report/flow-reads.js +18 -0
  240. package/dist/report/private-files/tell-lists.js +84 -0
  241. package/dist/report/project-rules.js +33 -0
  242. package/dist/report/render/home-relative.js +18 -0
  243. package/dist/report/render/html-head.js +26 -0
  244. package/dist/report/render/html-report-components.js +48 -0
  245. package/dist/report/render/html-report-styles.js +500 -0
  246. package/dist/report/render/html-sidebar.js +42 -0
  247. package/dist/report/render/path-tail.js +14 -0
  248. package/dist/report/render/report-copy.js +1177 -0
  249. package/dist/report/render/report-page/advanced-view.js +167 -0
  250. package/dist/report/render/report-page/file-story.js +114 -0
  251. package/dist/report/render/report-page/files-view.js +381 -0
  252. package/dist/report/render/report-page/files.js +77 -0
  253. package/dist/report/render/report-page/fix-wizard-script.js +269 -0
  254. package/dist/report/render/report-page/fix-wizard.js +310 -0
  255. package/dist/report/render/report-page/helpers-view.js +383 -0
  256. package/dist/report/render/report-page/helpers.js +51 -0
  257. package/dist/report/render/report-page/item-names.js +63 -0
  258. package/dist/report/render/report-page/protect-patterns.js +13 -0
  259. package/dist/report/render/report-page/providers.js +208 -0
  260. package/dist/report/render/report-page/record-view.js +367 -0
  261. package/dist/report/render/report-page/report-page-renderer.js +129 -0
  262. package/dist/report/render/report-page/report-views.js +31 -0
  263. package/dist/report/render/report-page/story-window.js +356 -0
  264. package/dist/report/render/report-page/times.js +25 -0
  265. package/dist/report/render/report-page/to-do-view.js +299 -0
  266. package/dist/report/render/report-page/to-do.js +152 -0
  267. package/dist/report/render/report-page.js +1 -0
  268. package/dist/report/render/session-view.js +250 -0
  269. package/dist/report/render/text-report-renderer.js +981 -0
  270. package/dist/report/render/ui/add-file-popup.js +122 -0
  271. package/dist/report/render/ui/app-sidebar.js +78 -0
  272. package/dist/report/render/ui/ask-panel.js +80 -0
  273. package/dist/report/render/ui/avatar.js +19 -0
  274. package/dist/report/render/ui/backdrop.js +29 -0
  275. package/dist/report/render/ui/brand-mark.js +4 -0
  276. package/dist/report/render/ui/button.js +67 -0
  277. package/dist/report/render/ui/callout.js +20 -0
  278. package/dist/report/render/ui/chat-example.js +17 -0
  279. package/dist/report/render/ui/checklist.js +50 -0
  280. package/dist/report/render/ui/confirm-dialog.js +34 -0
  281. package/dist/report/render/ui/data-table.js +49 -0
  282. package/dist/report/render/ui/drawer.js +25 -0
  283. package/dist/report/render/ui/file-chip.js +37 -0
  284. package/dist/report/render/ui/fold-line.js +22 -0
  285. package/dist/report/render/ui/guide-card.js +25 -0
  286. package/dist/report/render/ui/hero.js +37 -0
  287. package/dist/report/render/ui/labelled-select.js +10 -0
  288. package/dist/report/render/ui/live-script.js +222 -0
  289. package/dist/report/render/ui/local-date.js +58 -0
  290. package/dist/report/render/ui/mode-icon.js +6 -0
  291. package/dist/report/render/ui/page-shell.js +101 -0
  292. package/dist/report/render/ui/pill-tabs.js +47 -0
  293. package/dist/report/render/ui/popup.js +77 -0
  294. package/dist/report/render/ui/progress.js +35 -0
  295. package/dist/report/render/ui/project-list.js +284 -0
  296. package/dist/report/render/ui/scope-choice.js +19 -0
  297. package/dist/report/render/ui/stats.js +21 -0
  298. package/dist/report/render/ui/status-icon.js +30 -0
  299. package/dist/report/render/ui/status-look.js +21 -0
  300. package/dist/report/render/ui/switch.js +11 -0
  301. package/dist/report/render/ui/tag.js +19 -0
  302. package/dist/report/render/ui/task-list.js +56 -0
  303. package/dist/report/render/ui/tokens.js +46 -0
  304. package/dist/report/render/ui/update-notice.js +146 -0
  305. package/dist/report/render/ui/words/app-words.js +163 -0
  306. package/dist/report/render/ui/words/conversations-words.js +457 -0
  307. package/dist/report/render/ui/words/month-words.js +59 -0
  308. package/dist/report/render/ui/words/onboarding-words.js +446 -0
  309. package/dist/report/render/ui/words/projects-words.js +217 -0
  310. package/dist/report/render/ui/words/report-words.js +2099 -0
  311. package/dist/report/render/ui/words/settings-words.js +611 -0
  312. package/dist/report/render/ui/words/to-fix-words.js +287 -0
  313. package/dist/report/report-model.js +2 -0
  314. package/dist/report/report-use-case.js +1 -0
  315. package/dist/report/rule-names.js +20 -0
  316. package/dist/report/session-report.js +163 -0
  317. package/dist/report/start/app-nav.js +37 -0
  318. package/dist/report/start/conversations/calendar-view.js +104 -0
  319. package/dist/report/start/conversations/conversation-columns.js +187 -0
  320. package/dist/report/start/conversations/conversations-renderer.js +54 -0
  321. package/dist/report/start/conversations/empty-week.js +120 -0
  322. package/dist/report/start/conversations/files-window.js +166 -0
  323. package/dist/report/start/conversations/period-section.js +280 -0
  324. package/dist/report/start/conversations/periods-script.js +440 -0
  325. package/dist/report/start/conversations/periods.js +110 -0
  326. package/dist/report/start/conversations/week-view.js +30 -0
  327. package/dist/report/start/conversations/weeks.js +17 -0
  328. package/dist/report/start/month/month-renderer.js +50 -0
  329. package/dist/report/start/month/month-view.js +135 -0
  330. package/dist/report/start/month/months.js +17 -0
  331. package/dist/report/start/onboarding/done.js +171 -0
  332. package/dist/report/start/onboarding/finish-onboarding.js +93 -0
  333. package/dist/report/start/onboarding/intro.js +100 -0
  334. package/dist/report/start/onboarding/onboarding-changes.js +40 -0
  335. package/dist/report/start/onboarding/onboarding-renderer.js +195 -0
  336. package/dist/report/start/onboarding/onboarding-script.js +400 -0
  337. package/dist/report/start/onboarding/onboarding-view.js +98 -0
  338. package/dist/report/start/onboarding/project-step.js +210 -0
  339. package/dist/report/start/onboarding/steps.js +239 -0
  340. package/dist/report/start/onboarding/welcome.js +66 -0
  341. package/dist/report/start/page-notice.js +10 -0
  342. package/dist/report/start/projects/index-projects.js +43 -0
  343. package/dist/report/start/projects/moved-page.js +82 -0
  344. package/dist/report/start/projects/project-switch.js +138 -0
  345. package/dist/report/start/projects/projects-window.js +67 -0
  346. package/dist/report/start/projects/temporary-space.js +18 -0
  347. package/dist/report/start/render/air-datepicker-vendor.js +27 -0
  348. package/dist/report/start/render/session-status.js +41 -0
  349. package/dist/report/start/render/start-words.js +84 -0
  350. package/dist/report/start/repository.js +28 -0
  351. package/dist/report/start/serve/index-handler.js +372 -0
  352. package/dist/report/start/serve/onboarding-request.js +50 -0
  353. package/dist/report/start/serve/settings-request.js +1 -0
  354. package/dist/report/start/serve/settings-setup.js +193 -0
  355. package/dist/report/start/session-index.js +1 -0
  356. package/dist/report/start/session-start.js +974 -0
  357. package/dist/report/start/settings/alerts-tab.js +104 -0
  358. package/dist/report/start/settings/files-tab.js +169 -0
  359. package/dist/report/start/settings/general-tab.js +71 -0
  360. package/dist/report/start/settings/settings-renderer.js +254 -0
  361. package/dist/report/start/settings/settings-script.js +161 -0
  362. package/dist/report/start/settings/settings-view.js +240 -0
  363. package/dist/report/start/settings/settings-windows.js +334 -0
  364. package/dist/report/start/settings-files.js +43 -0
  365. package/dist/report/start/to-fix/done-list.js +45 -0
  366. package/dist/report/start/to-fix/file-window.js +110 -0
  367. package/dist/report/start/to-fix/to-fix-list.js +70 -0
  368. package/dist/report/start/to-fix/to-fix-renderer.js +237 -0
  369. package/dist/report/start/to-fix/to-fix-script.js +94 -0
  370. package/dist/report/start/to-fix/to-fix-view.js +124 -0
  371. package/dist/report/watch/agent-alert.js +72 -0
  372. package/dist/report/watch/notice-choices.js +35 -0
  373. package/dist/report/watch/notice-settings.js +65 -0
  374. package/dist/report/watch/preferences.js +100 -0
  375. package/dist/report/watch/render/instruction-words.js +54 -0
  376. package/dist/report/watch/render/notice-words.js +182 -0
  377. package/dist/report/watch/subagent-watch.js +345 -0
  378. package/dist/report/watch/watch-notice.js +1 -0
  379. package/dist/setup/behind.js +18 -0
  380. package/dist/setup/codex-mirror.js +171 -0
  381. package/dist/setup/not-a-project.js +19 -0
  382. package/dist/setup/project-setup.js +644 -0
  383. package/dist/setup/protected-patterns.js +30 -0
  384. package/dist/shared/colour.js +23 -0
  385. package/dist/shared/compare.js +4 -0
  386. package/dist/shared/content-version.js +13 -0
  387. package/dist/shared/counter.js +11 -0
  388. package/dist/shared/file-stamp.js +4 -0
  389. package/dist/shared/json.js +13 -0
  390. package/dist/shared/label.js +13 -0
  391. package/dist/shared/package-name.js +6 -0
  392. package/dist/shared/plain-invocation.js +44 -0
  393. package/dist/shared/plain-version.js +21 -0
  394. package/dist/shared/printable.js +25 -0
  395. package/dist/shared/renderer.js +1 -0
  396. package/dist/shared/sentence.js +20 -0
  397. package/dist/shared/terminal-logo.js +41 -0
  398. package/dist/shared/text-table.js +15 -0
  399. package/dist/shared/wrap.js +29 -0
  400. package/package.json +70 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ agentwhy
2
+ Copyright 2026 Nessprim Karol Kozer
package/README.md ADDED
@@ -0,0 +1,181 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/lockup-dark.svg">
4
+ <img src="docs/lockup-light.svg" alt="agentwhy" width="340">
5
+ </picture>
6
+ </p>
7
+
8
+ <h3 align="center">Your AI agent reads your files. Find out which ones, and why.</h3>
9
+
10
+ <p align="center">
11
+ agentwhy reads the conversations Claude Code and Codex already save on your computer and shows which of your private files
12
+ (<code>.env</code>, keys, secrets) an agent opened, the task that led to it, and which key to change.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <code>npx @agentwhy/cli</code><br>
17
+ One command · runs on your computer · sends nothing anywhere · <a href="LICENSE">Apache 2.0</a>
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## What you see
23
+
24
+ You run one command in your project. A page opens in your browser. Most days it says there is nothing to do.
25
+ When there is, it looks like this:
26
+
27
+ ```
28
+ the session itself · 4 actions · 1 file reached · wrote the value into files
29
+ └─ Agent 1 · Explore · 2 actions · 1 file reached · 1 refused · gave the value back
30
+
31
+ Agent 1 · Explore, asked to "Find why the webhook returns 500"
32
+ ● apps/web/.env.development in a result reached
33
+ ○ apps/web/.env.local named refused
34
+ ↩ its answer to the session itself carried a value from apps/web/.env.development
35
+ ```
36
+
37
+ Read it top to bottom:
38
+
39
+ 1. **Your agent started a helper** (`Agent 1`) and gave it a task: find why the webhook fails.
40
+ 2. **It tried to open `.env.local`.** A rule stopped it (`○ refused`).
41
+ 3. **A search got through anyway.** It printed lines from `.env.development`, and the secret came along
42
+ (`● reached`, `in a result`). No command named that file, so no rule applied.
43
+ 4. **The helper handed the secret back** to your main agent (`↩`), which wrote it into a file.
44
+
45
+ **What to do:** change that key at the service that issued it. agentwhy tells you which one. It never shows the
46
+ value itself.
47
+
48
+ ## Why you need this
49
+
50
+ You ask Claude Code something ordinary: *"Find out why our Stripe webhook started failing."* It starts a helper
51
+ agent, and the helper goes looking for the webhook secret. Three things make this hard to notice:
52
+
53
+ - **Your rules don't reach the helper.** Your `AGENTS.md` says "never read `.env` files". The helper only gets
54
+ its task, not your rules, and the task says to find the secret.
55
+ - **A search names no file.** `grep -rn STRIPE .` prints the key without ever opening `.env` by name, so no
56
+ rule that blocks `.env` can stop it.
57
+ - **Nothing tells you.** There is no prompt, no warning, no log you would look at. The key is now in the chat,
58
+ in the saved conversation on your disk, and with the model provider. Deleting the log does not bring it back.
59
+ Only changing the key does.
60
+
61
+ ## What agentwhy shows you
62
+
63
+ **The cause, not only the file.** Other tools can say "a file was read". agentwhy shows the task that led
64
+ there: which agent asked which helper to do what, and where the value went next.
65
+
66
+ **Conversations from before you installed it.** It reads the records Claude Code and Codex already keep, weeks
67
+ back. There is nothing to set up first.
68
+
69
+ **The routes no rule catches.** Secrets that came in through a search result, and reads a rule refused. Claude
70
+ Code records neither as an event you would see.
71
+
72
+ ## How it works
73
+
74
+ 1. **Run it in your project folder:** `npx @agentwhy/cli`. Needs Node 22 or later.
75
+ 2. **It reads your saved conversations** from the last 7 days, on your computer, by fixed rules. No AI model,
76
+ no account, no internet.
77
+ 3. **A page opens** with a short list: which private files were reached, by whom, and what to change.
78
+ 4. **Optional: protect the project from now on.** `npx @agentwhy/cli init` adds rules to Claude Code that refuse
79
+ the obvious reads - and to Codex, in a project that uses it - and a one-line notice in the chat when a secret gets
80
+ into the conversation. It shows exactly what it
81
+ will write and asks first.
82
+
83
+ By default it treats these as private: `.env*`, `*.env`, `.npmrc`, `secrets/`, `.ssh/`, `id_rsa*`. Add your own
84
+ with `init --protect "config/*.pem"`.
85
+
86
+ ## Can you trust it?
87
+
88
+ A tool that reads your conversations and knows where your keys are should not be taken on faith. Each claim below
89
+ can be checked without reading the source.
90
+
91
+ | Claim | How to check it |
92
+ |---|---|
93
+ | **Nothing goes over the internet.** The only socket it opens is a small server on `127.0.0.1`, so the page can save what you mark as done. `--no-serve` skips even that. | Turn off Wi-Fi and run it: it behaves the same. Or, while it runs, `lsof -nP -iTCP -a -c node` lists only a `127.0.0.1` listener. |
94
+ | **Your secrets never reach the report.** Values are replaced before the report is built, and the code's types forbid a raw value there. | Open a report and search it for a key you know is in your `.env`. |
95
+ | **No AI model is called.** Every finding comes from reading the records, by rules. | Run it offline with no API key set: the result is the same. |
96
+ | **One dependency, pinned.** Only [`@clack/prompts`](https://www.npmjs.com/package/@clack/prompts), for the questions `init` asks. 6 small packages in total. | `npm ls --omit=dev --all` in the installed package. |
97
+ | **The package is what this repository built.** Every release after the first is published from a tagged commit by GitHub Actions, with [npm provenance](https://docs.npmjs.com/generating-provenance-statements). The first is published by hand, because npm lets a trusted publisher be set up only for a package that already exists. | The *Provenance* badge on npmjs.com, or `npm audit signatures`. |
98
+
99
+ ## Questions
100
+
101
+ **Does it stop my agent from reading secrets?**
102
+ In Claude Code, it stops the obvious routes: `init` adds rules for Claude Code's own file tools, and a check that
103
+ refuses shell commands like `cat .env` or `grep -r` over a private file. It is not a sandbox. A path in a variable or a
104
+ script can still get through, and that is why the main job is telling you what actually happened. In Codex the same
105
+ check runs as a Codex hook, with the same list of files. When it blocks a command, a second hook asks Codex to explain
106
+ the block in its reply in the terminal or code editor, without asking you to paste a secret. Codex runs new or changed
107
+ hooks only after you approve them there: until then, it skips them without a word.
108
+
109
+ **Which agents does it work with?**
110
+ Claude Code, in the terminal and in code editors, and Codex. Not Cursor's own AI, Windsurf or chats on claude.ai. Each
111
+ conversation on the page is marked with the AI that had it.
112
+
113
+ Codex writes down less than Claude Code does, so a Codex report can answer fewer questions:
114
+
115
+ | What the report tells you | Claude Code | Codex |
116
+ |---|---|---|
117
+ | Which private files the AI opened, and with which command | yes | yes, where its record shows the file was opened - a command that finished is not enough |
118
+ | What a command or a search printed | yes | yes |
119
+ | Whether the AI was handed what was printed | yes | on version 0.157.0; on other versions, it says it doesn't know |
120
+ | Every step the AI took | yes | no: some steps leave no trace, so a Codex report never says there is nothing to fix |
121
+ | A read a rule stopped | yes | yes, when agentwhy's own refusal is recorded in a code cell |
122
+ | Which helper was asked to do what, and what it gave back | yes | yes |
123
+ | Which files the AI changed | yes | yes; a change that failed is not counted |
124
+ | What Codex was allowed to do at the time | - | yes, shown apart from your own rules |
125
+ | Blocking a file | yes | yes, the same files, once you approve agentwhy's hook in Codex (measured on 0.159.2) |
126
+ | A message in the chat after agentwhy blocks a command | yes | yes, in the terminal and code editor once both hooks are approved |
127
+ | A warning when a value reached the chat, and `check` | yes | no |
128
+
129
+ Older Codex files keep the commands only inside the code that ran them, so their reports show no commands and say so.
130
+ What Codex writes down was measured on `codex exec` 0.157.0 on macOS. Other versions and computers are read too, and
131
+ their reports say what could not be checked.
132
+
133
+ **What if it finds something?**
134
+ It names the file and the key to change, worst first. Changing the key at the service that issued it is the only
135
+ step that undoes a leak. Mark it done and it leaves your list.
136
+
137
+ **Does it look at all my projects?**
138
+ One project at a time: the folder you run it in. The page lists your other projects so you can switch.
139
+
140
+ **What does it cost?**
141
+ Nothing, for any use except selling it, or something like it, as a competing product. See [License](#license).
142
+
143
+ ## How well it works
144
+
145
+ Measured on 28 scripted sessions, each one a route by which a secret can reach an agent, including the routes it
146
+ misses ([docs/detection.md](docs/detection.md), re-run with `npm run measure:detection`):
147
+
148
+ - when a private file's value came into the conversation, it said to change the key in **13 of 17**;
149
+ - it named the task a helper agent was given in **5 of 5**;
150
+ - no part of a secret reached a report in **28 of 28**.
151
+
152
+ The misses are listed there, with why: an interpreter or a library that opens the file, a glob, an MCP tool, a
153
+ pasted key. These are routes written by the author, not a rate on real machines. How often each happens in real
154
+ work is not measured yet.
155
+
156
+ **Status: pre-MVP.** The reader, the report and the link between a main conversation and its helpers are built and
157
+ tested, for Claude Code and for Codex. The 28 sessions above are Claude Code's.
158
+
159
+ ## Commands
160
+
161
+ ```bash
162
+ npx @agentwhy/cli # every conversation in one page, start here
163
+ npx @agentwhy/cli check # the short answer, in the terminal
164
+ npx @agentwhy/cli report --open # the newest conversation, in the browser
165
+ npx @agentwhy/cli init # protect this project and add the chat notice
166
+ npx @agentwhy/cli notify # what you are told when a turn ends, and where
167
+ ```
168
+
169
+ Every command, flag and hook, and what each word on the page means: [docs/reference.md](docs/reference.md).
170
+
171
+ ## License
172
+
173
+ Open source, under the [Apache License 2.0](LICENSE). Use it, change it and share it for any purpose, commercial
174
+ use included. When you pass on a copy, keep the license, the copyright and [NOTICE](NOTICE) with it. The license
175
+ does not cover the name agentwhy. The full terms are in [LICENSE](LICENSE); this summary does not replace them.
176
+
177
+ ## More
178
+
179
+ [docs/reference.md](docs/reference.md): every command and flag, the full report, and the limits of what it can
180
+ tell you · [CONTRIBUTING.md](CONTRIBUTING.md): how to work on it · [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md):
181
+ bundled third-party code · © 2026 Nessprim Karol Kozer.
@@ -0,0 +1,31 @@
1
+ # Third-party notices
2
+
3
+ agentwhy copies one MIT-licensed library into its own source, so that the pages it writes open from disk and
4
+ fetch nothing. Its licence requires that the notice below travels with every copy.
5
+
6
+ | Library | Version | Where it is copied | Upstream |
7
+ |---|---|---|---|
8
+ | Air Datepicker | 3.6.0 | `src/report/start/render/air-datepicker-vendor.ts` | <https://github.com/t1m0n/air-datepicker> |
9
+
10
+ The rest of agentwhy is licensed under the Apache License 2.0; see `LICENSE` and `NOTICE`.
11
+ This third-party component retains its own license.
12
+
13
+ ## Air Datepicker
14
+
15
+ The MIT License (MIT)
16
+
17
+ Copyright (c) Timofey Marochkin
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
20
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation
21
+ the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
22
+ to permit persons to whom the Software is furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of
25
+ the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
28
+ THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
30
+ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31
+ IN THE SOFTWARE.
@@ -0,0 +1,208 @@
1
+ // `verified` means checked across every instance in the measured session, not a sample of them. The measured session
2
+ // is the Claude Code 2.1.268 session that the corpus, tests/fixtures/redacted/, is a redacted copy of.
3
+ export const ASSUMPTIONS = [
4
+ {
5
+ id: 'main-transcript-path',
6
+ statement: 'The main transcript of a session is <project>/<session-id>.jsonl.',
7
+ status: 'verified',
8
+ evidence: 'spec §4.0; every session inspected on 2026-09-12',
9
+ },
10
+ {
11
+ id: 'session-directory',
12
+ statement: 'Subagent files and spilled results live under <project>/<session-id>/; a session with neither has no such directory.',
13
+ status: 'verified',
14
+ evidence: 'spec §4.0; present for the session with subagents, absent for the sessions without',
15
+ },
16
+ {
17
+ id: 'subagent-file-pair',
18
+ statement: 'Each subagent has agent-<id>.jsonl and agent-<id>.meta.json in subagents/, sharing <id>.',
19
+ status: 'verified',
20
+ evidence: '15 of 15 pairs in the measured session',
21
+ },
22
+ {
23
+ id: 'spilled-tool-results',
24
+ statement: 'Large tool results are spilled to <project>/<session-id>/tool-results/<id>.txt.',
25
+ status: 'verified',
26
+ evidence: '2 of 2 files in the measured session',
27
+ },
28
+ {
29
+ id: 'tool-result-reference',
30
+ statement: 'A spilled result is referenced from a tool result — the toolUseResult field or a tool_result content block — through a tool-results/<id>.txt path.',
31
+ status: 'verified',
32
+ evidence: 'doctor counts references in result positions only: 2 referenced and 0 missing against the 2 spilled files, before redaction and in the corpus alike (2026-09-13)',
33
+ },
34
+ {
35
+ id: 'tool-result-reference-converse',
36
+ statement: 'The converse does NOT hold: not every tool-results/<id>.txt path inside a result is a spill reference. A result that merely quotes one - grep output, say - reads as a reference to a file that is missing.',
37
+ status: 'unverified',
38
+ evidence: 'no instance either way in the measured session; raised by the M1 review (2026-09-13). The error runs toward UNKNOWN, which is the safe direction, and M2 measures how often it fires before anything is tightened',
39
+ },
40
+ {
41
+ id: 'tool-result-block',
42
+ statement: 'A tool result sits in a message content block of type tool_result that carries tool_use_id and content.',
43
+ status: 'verified',
44
+ evidence: '373 of 373 result lines of the corpus carry one (208 main, 165 subagent), and every tool_use_id in them joins to a call (2026-09-13)',
45
+ },
46
+ {
47
+ id: 'assistant-text-block',
48
+ statement: 'What an agent writes sits in a message content block of type text, carrying the words under text, on an assistant line that holds no tool_use block.',
49
+ status: 'verified',
50
+ evidence: '149 of 149 assistant text blocks in the corpus carry a string text field - 129 main, 20 subagent - and none shares its line with a tool_use. User lines carry text blocks as well, 69 on 55 main lines, and are not an agent\'s words (2026-09-15)',
51
+ },
52
+ {
53
+ id: 'assistant-reasoning-block',
54
+ statement: 'What an agent works out before it calls sits in a message content block of type thinking, carrying the words under thinking, one block to a line, beside a signature.',
55
+ status: 'verified',
56
+ evidence: '249 of 249 reasoning blocks in the corpus carry a string thinking field, one to a line, with the keys type, thinking and signature. In an unredacted session the block sits on the line immediately before a call in 276 of 276 calls that have any words before them, and one block precedes a run of up to four calls. **The field may be empty**: in the measured session before redaction, all 249 of its reasoning blocks are - 160 main, 89 subagent - while its text blocks carry words. The committed corpus cannot show that, since redaction replaces content with a marker (2026-09-15)',
57
+ },
58
+ {
59
+ id: 'delegating-result-text-blocks',
60
+ statement: 'The result of a delegating call is a list of text blocks, and nothing else: its words are the text of those blocks.',
61
+ status: 'verified',
62
+ evidence: '15 of 15 delegating results in the measured session, counted before redaction, none holding a block of another type (2026-09-15). The committed corpus cannot show it: the block type inside a result is replaced by a marker there',
63
+ },
64
+ {
65
+ id: 'delivered-task-notification',
66
+ statement: 'An agent started in the background reports on a user line of its own that holds no tool_result: its words carry a <task-notification> whose tool-use-id tag is the id of the delegating call. A queue-operation line queues the same words first, and is not the delivery.',
67
+ status: 'verified',
68
+ evidence: '6 of 6 task notifications in the measured session were queued by a queue-operation line and delivered on a user line, as a string; tool-use-id equals a delegating call id on 6 of 6, and task-id that call\'s agent on 6 of 6, counted before redaction (2026-09-15). The committed corpus cannot show it: the words are replaced by a marker there',
69
+ },
70
+ {
71
+ id: 'file-writing-input',
72
+ statement: 'Edit carries file_path, old_string, new_string and replace_all, and old_string is the text it takes out; Write carries file_path and content. NotebookEdit and MultiEdit are not profiled as writing a file.',
73
+ status: 'verified',
74
+ evidence: '45 of 45 Edit calls and 7 of 7 Write calls in the corpus carry exactly those keys (2026-09-15). No NotebookEdit or MultiEdit call occurs there, so their inputs are unmeasured and a value in them is counted as a use in another call',
75
+ },
76
+ {
77
+ id: 'launch-notice-status',
78
+ statement: 'A delegating result whose payload status is async_launched is a launch notice - the agent was started, and its report is not in the result. A result whose status is completed carries the report.',
79
+ status: 'verified',
80
+ evidence: '6 of 15 delegating results in the measured session carry status async_launched and an isAsync key, and no content, and a report was delivered for each; the other 9 carry status completed and content, counted before redaction (2026-09-15). None of the 15 calls sets run_in_background to true, so what was asked does not say which',
81
+ },
82
+ {
83
+ id: 'result-join-field',
84
+ statement: 'The tool_use_id of the tool_result block is the join from a result to its call. toolUseResult is the payload, not a join: it is on 208 of 208 main result lines but only 10 of 165 subagent ones.',
85
+ status: 'verified',
86
+ evidence: '373 of 373 result lines join by it; measured on the corpus (2026-09-13). Corrects spec §4.3 rule 1',
87
+ },
88
+ {
89
+ id: 'one-call-per-assistant-line',
90
+ statement: 'An assistant line carries exactly one tool_use block, which is what makes sourceToolAssistantUUID unambiguous as a call reference.',
91
+ status: 'unverified',
92
+ evidence: 'true for all 373 assistant lines of the measured session (2026-09-13), but it is a property of this session, not of the format: nothing forbids two calls on one line. The model joins by tool_use_id and never relies on this',
93
+ },
94
+ {
95
+ id: 'line-types',
96
+ statement: 'Every parsable line has a type among 11 known values; only user and assistant carry the conversation.',
97
+ status: 'verified',
98
+ evidence: 'all 1571 main-session and 711 subagent lines (2026-09-12, 10 types); all 1573 main-session and 711 subagent lines a day later (2026-09-13), where bridge-session is the eleventh',
99
+ },
100
+ {
101
+ id: 'bridge-session-line',
102
+ statement: 'A bridge-session line carries only bridgeSessionId, lastSequenceNum, ownerAccountUuid, ownerOrganizationUuid, sessionId and type; with no message it carries no conversation and is skipped.',
103
+ status: 'verified',
104
+ evidence: '1 of 1 line in the measured session (2026-09-13); keys measured by doctor per unknown line type before classifying. It has no version, uuid or isSidechain key',
105
+ },
106
+ {
107
+ id: 'history-suppression-and-mode-lines',
108
+ statement: 'history-suppression and mode lines are not classified; doctor reports them as unknown line types.',
109
+ status: 'unverified',
110
+ evidence: 'seen only in another session (Claude Code 2.1.268-2.1.270, 2026-09-13), absent from the measured one; classify after doctor measures their keys on a session that has them',
111
+ },
112
+ {
113
+ id: 'version-per-line',
114
+ statement: 'The Claude Code version belongs to each line, not to the file, and not every line type carries it.',
115
+ status: 'verified',
116
+ evidence: 'another session spans 2.1.268, 2.1.269 and 2.1.270 (2026-09-13); in the measured session 1142 main-session lines carry version and 431 do not, bridge-session among them',
117
+ },
118
+ {
119
+ id: 'working-directory-per-line',
120
+ statement: 'The session working directory is carried by cwd on the lines that hold the conversation, not by every line. One session can carry more than one value; the one that names the project is the value matching the project directory\'s name.',
121
+ status: 'verified',
122
+ evidence: 'presence measured before redaction (2026-09-14): 1142 of 1573 main-session lines and 711 of 711 subagent lines, the same lines that carry version, gitBranch and userType. The committed corpus cannot measure the values: it was redacted before the redactor aliased working directories, so all 1853 of its cwd values are one flattened marker and doctor reports distinct 1 as an artefact of the fixture. Corrected 2026-09-28 (contract v12, which-project VB5): over the last megabyte of 244 real transcripts, cwd is in every one and a value matching the project directory\'s name is in every one, and 14 carry more than one value - so "one session carries one value", stated here until then, is false. Corrects 2026-09-13-agentwhy-plan.md §5 item 3, which recorded cwd as present on every line',
123
+ },
124
+ {
125
+ id: 'entry-point-per-session',
126
+ statement: 'The lines that hold a conversation carry entrypoint, which way into Claude Code the session was started by, and one session carries one value: cli, claude-vscode or sdk-cli. Any other value is unknown, never the nearest of these.',
127
+ status: 'verified',
128
+ evidence: 'which-project VB5 (2026-09-28): the last megabyte of each of 244 transcripts carries it - claude-vscode 180, cli 62, sdk-cli 2 - and no transcript, tail or whole, carries two values. The same values the hooks are given as CLAUDE_CODE_ENTRYPOINT (the-agent-tells-you B9e2). The committed corpus holds a canary marker in its place, which reads as unknown',
129
+ },
130
+ {
131
+ id: 'sidechain-discriminator',
132
+ statement: 'isSidechain is false on main-session lines and true on subagent lines, wherever it is present.',
133
+ status: 'verified',
134
+ evidence: '1142 of 1142 and 711 of 711 lines (2026-09-12); the same a day later (2026-09-13)',
135
+ },
136
+ {
137
+ id: 'denial-marker',
138
+ statement: 'A blocked call is marked by toolDenialKind on its result line; the only observed value is permission-rule.',
139
+ status: 'verified',
140
+ evidence: '5 of 5 denials',
141
+ },
142
+ {
143
+ id: 'meta-keys',
144
+ statement: 'Each meta.json carries agentType, description, toolUseId, spawnDepth, requestShape and requestNonInteractive.',
145
+ status: 'verified',
146
+ evidence: '15 of 15 files',
147
+ },
148
+ {
149
+ id: 'agent-tool-input',
150
+ statement: 'The Agent tool_use input carries description, prompt and subagent_type on every call, and optionally run_in_background.',
151
+ status: 'verified',
152
+ evidence: 'reconnaissance inspected 6 of 15 calls (2026-09-12); doctor, before redaction, counted the three keys on 15 of 15 calls and run_in_background on 9 (2026-09-13)',
153
+ },
154
+ {
155
+ id: 'delegation-join',
156
+ statement: 'Where a subagent was started by the Agent tool, meta.json toolUseId equals that call id. It is NOT universal: a subagent started another way has no toolUseId at all.',
157
+ status: 'verified',
158
+ evidence: '15 of 15 meta files join to one of the 15 Agent calls (2026-09-13). But another session has 3 subagents of type general-purpose, spawned through the Skill tool, whose meta files carry agentType and spawnDepth and no toolUseId, and whose main transcript holds no Agent call at all (2026-09-14)',
159
+ },
160
+ {
161
+ id: 'delegation-routes',
162
+ statement: 'An agent can be delegated to by routes other than the Agent tool - a Skill spawns one - and only the Agent route records which call started it.',
163
+ status: 'verified',
164
+ evidence: '3 of 3 subagents of a session that delegated through a Skill (2026-09-14). The consequence is that a count of Agent calls is not a count of delegations: an agent whose start is unrecorded must be reported as such, never left out',
165
+ },
166
+ {
167
+ id: 'file-id-matches-line-agent-id',
168
+ statement: 'The <id> in a subagent file name equals the agentId field on the lines inside that file.',
169
+ status: 'verified',
170
+ evidence: '15 of 15 transcripts carry exactly one agentId and it equals the file id; no line lacks it (2026-09-13, measured on the corpus, which keeps agentId since contract v3)',
171
+ },
172
+ {
173
+ id: 'session-title-shape',
174
+ statement: 'An ai-title line is {type, aiTitle, sessionId}, and aiTitle is a string.',
175
+ status: 'verified',
176
+ evidence: '82 of 82 ai-title lines in the corpus (2026-09-15)',
177
+ },
178
+ {
179
+ id: 'handback-shape',
180
+ statement: 'A subagent may deliver its report as a SubagentHandback call on its own transcript, whose input is {message: string}. The call names no delegation; the report answers the call that started the agent whose transcript it is on.',
181
+ status: 'verified',
182
+ evidence: '2 of 2 SubagentHandback calls in a later session, both on sidechain lines, each with the single input key message holding a string (2026-09-19). The measured session predates the tool and has none, so both shapes are carried: a report delivered as a task-notification and one handed back through a call',
183
+ },
184
+ {
185
+ id: 'line-timestamp',
186
+ statement: 'The lines that hold a conversation carry timestamp, when the line was written, as a string of ISO 8601 in UTC with milliseconds. Time does not follow the record: a line can be earlier than the one before it.',
187
+ status: 'verified',
188
+ evidence: 'three sessions of Claude Code 2.1.280 (2026-09-23): 1826 of 1826, 596 of 596 and 1598 of 1598 lines of the types that carry it, main and subagent alike, all matching the shape and all parsing; 23 of 1825, 14 of 595 and 17 of 1600 consecutive pairs run backwards. Read for display only (the report page spec M4); a line without it, or with a value that does not parse, has no time - never a guessed one',
189
+ },
190
+ {
191
+ id: 'hook-input-cwd',
192
+ statement: 'Every hook input carries cwd, the directory the session is running in.',
193
+ status: 'verified',
194
+ evidence: '5 of 5 Stop inputs (2026-09-17, the-agent-nobody-watches B8b) and every SubagentStop input of B4 (2026-09-16). Read by `watch` to decide which project a person\'s notification choices were made for, before any of the session has been read',
195
+ },
196
+ {
197
+ id: 'session-title-latest-near-end',
198
+ statement: 'The title a session has now is its last ai-title line, and that line lies within the last megabyte of the transcript.',
199
+ status: 'unverified',
200
+ evidence: 'In the corpus the last ai-title line ends 17 KB before the end of the file and no two are more than 30 KB apart (2026-09-15). Redaction changes the length of content, so the distances are indicative, and marker values cannot show whether a later title differs from an earlier one. A session that breaks this shows no title, never a wrong one',
201
+ },
202
+ {
203
+ id: 'recognition-by-first-line',
204
+ statement: "A main transcript's first non-blank line is a JSON object with a string `type` and a string `sessionId` equal to the file's name, and no `payload`.",
205
+ status: 'verified',
206
+ evidence: '257 of 257 main transcripts (2026-09-29, contract v13), counted as fixed labels only. The type was a listed one in 193; so recognition rests on the id, and accepts a listed type without one for the hand-built fixtures. Tells a transcript from a Codex rollout (`2026-09-27-what-codex-wrote.md` X2)',
207
+ },
208
+ ];
@@ -0,0 +1,15 @@
1
+ export const KNOWN_DENIAL_KINDS = ['permission-rule'];
2
+ // An unrecognised denial kind must surface as unknown, never be folded into a known one.
3
+ export function isKnownDenialKind(value) {
4
+ return typeof value === 'string' && KNOWN_DENIAL_KINDS.includes(value);
5
+ }
6
+ /**
7
+ * What the Read tool itself answers when a deny rule covers the file. Measured 2026-09-24 on a real session: a Read of
8
+ * `.env` under a deny rule for every `.env` file came back as an error result holding these words, and the record carried no
9
+ * `toolDenialKind` - that marker is written for a shell command a rule refuses, not for this. Without these words the
10
+ * refusal read as a call that failed, and the page said "only saw a name" of a file a rule had kept out. Matched only
11
+ * inside a result marked as an error, so a file that merely quotes the sentence is not a refusal.
12
+ */
13
+ export const RULE_REFUSED_READ = 'File is in a directory that is denied by your permission settings.';
14
+ /** The kind a refusal recognised by its words is recorded as: the same rule, reached through another tool. */
15
+ export const RULE_REFUSED_READ_KIND = 'permission-rule';