failproofai 0.0.11-beta.9 → 0.0.11

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 (152) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  6. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  12. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  13. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  14. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
  20. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  21. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  22. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  23. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  24. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  25. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  26. package/.next/standalone/.next/server/app/api/audit/invite/route.js +1 -1
  27. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/audit/run/route.js +1 -1
  29. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/auth/login-request/route.js +1 -1
  31. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +1 -1
  33. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/auth/logout/route.js +1 -1
  35. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/auth/reminder/route.js +1 -1
  37. package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/auth/status/route.js +1 -1
  39. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  42. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  44. package/.next/standalone/.next/server/app/index.html +1 -1
  45. package/.next/standalone/.next/server/app/index.rsc +15 -15
  46. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  47. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
  48. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  49. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
  50. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  51. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  52. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  54. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
  55. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  58. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  60. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  61. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  62. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  64. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  65. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  66. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  67. package/.next/standalone/.next/server/chunks/[externals]__1_g_b3t._.js +3 -0
  68. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0dwpg-h._.js +3 -0
  69. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lnenda._.js +3 -0
  70. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13i_sva._.js +3 -0
  71. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1_mqemn._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/node_modules_0-tu4ot._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/node_modules_1bnh1y0._.js +1 -1
  74. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_17k9e3w.js +3 -3
  75. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +1 -1
  76. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +1 -1
  77. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0e446gb._.js → [root-of-the-server]__00uwqi6._.js} +2 -2
  79. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0808sha._.js +2 -2
  80. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e4-6d8._.js +2 -2
  81. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ehe24g._.js +2 -2
  82. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g253ve._.js +2 -2
  83. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0k65l27._.js +1 -1
  84. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0wprfyc._.js → [root-of-the-server]__0kjb_s4._.js} +2 -2
  85. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vxf0_g._.js +2 -2
  86. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12mcauo._.js +2 -2
  87. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1mt35_w._.js +1 -1
  88. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pcxxwg._.js +2 -2
  89. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1uvfwgr._.js +2 -2
  90. package/.next/standalone/.next/server/chunks/ssr/_11_p9y8._.js +1 -1
  91. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +49 -21
  92. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  93. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
  94. package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_0y4a-0q.js → node_modules_html-to-image_es_index_0ihmbv4.js} +1 -1
  95. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +1 -1
  96. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  97. package/.next/standalone/.next/server/pages/404.html +1 -1
  98. package/.next/standalone/.next/server/pages/500.html +1 -1
  99. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  100. package/.next/standalone/.next/server/server-reference-manifest.json +10 -10
  101. package/.next/standalone/.next/static/chunks/{3ty6dhcuogout.js → 02fywjt0by40a.js} +1 -1
  102. package/.next/standalone/.next/static/chunks/0xdx2ehtbdoeg.js +1 -0
  103. package/.next/standalone/.next/static/chunks/{07_d165p5h5ys.js → 1-a5rvq67k7ed.js} +1 -1
  104. package/.next/standalone/.next/static/chunks/{3nj6g3xu9uy78.js → 15csyj1_rf0-w.js} +1 -1
  105. package/.next/standalone/.next/static/chunks/1o0xa47736gi9.css +2 -0
  106. package/.next/standalone/.next/static/chunks/24cv31x607n7k.js +1 -0
  107. package/.next/standalone/.next/static/chunks/2n_s8v1ae38_a.js +69 -0
  108. package/.next/standalone/.next/static/chunks/{277oc363p56n6.js → 2y-jmvrjxz60x.js} +2 -2
  109. package/.next/standalone/.next/static/chunks/{1kvadxkgnapyj.js → 3eik_d9qrvoft.js} +1 -1
  110. package/.next/standalone/.next/static/chunks/{168k-8z6k7e8z.css → 3i27c3hcriawq.css} +1 -1
  111. package/.next/standalone/.next/static/chunks/{2z42u62k-8-_q.js → 3v61675vr6jav.js} +1 -1
  112. package/.next/standalone/app/api/audit/invite/route.ts +10 -1
  113. package/.next/standalone/app/api/audit/run/route.ts +35 -0
  114. package/.next/standalone/app/api/auth/login-request/route.ts +2 -2
  115. package/.next/standalone/app/api/auth/login-verify/route.ts +10 -2
  116. package/.next/standalone/app/audit/_components/audit-dashboard.tsx +9 -1
  117. package/.next/standalone/app/audit/_components/audit-poster.tsx +11 -7
  118. package/.next/standalone/app/audit/_components/auth-dialog.tsx +6 -4
  119. package/.next/standalone/app/audit/_components/come-back-better-section.tsx +23 -3
  120. package/.next/standalone/app/audit/_components/invite-dialog.tsx +6 -3
  121. package/.next/standalone/app/audit/_components/share-templates.ts +58 -28
  122. package/.next/standalone/app/audit/audit-styles.css +17 -22
  123. package/.next/standalone/app/globals.css +27 -2
  124. package/.next/standalone/app/policies/hooks-client.tsx +33 -24
  125. package/.next/standalone/components/reach-developers.tsx +10 -25
  126. package/.next/standalone/lib/auth/api-server-client.ts +5 -2
  127. package/.next/standalone/lib/client-telemetry.ts +4 -0
  128. package/.next/standalone/package.json +6 -4
  129. package/.next/standalone/server.js +1 -1
  130. package/README.md +2 -2
  131. package/bin/failproofai.mjs +24 -5
  132. package/dist/cli.mjs +2328 -381
  133. package/lib/auth/api-server-client.ts +5 -2
  134. package/lib/client-telemetry.ts +4 -0
  135. package/package.json +6 -4
  136. package/scripts/launch.ts +30 -4
  137. package/scripts/postinstall.mjs +10 -1
  138. package/scripts/skew-log-filter.ts +46 -0
  139. package/scripts/validate-mdx.ts +139 -0
  140. package/src/audit/cli.ts +330 -0
  141. package/src/audit/open-browser.ts +69 -0
  142. package/src/auth/cli.ts +16 -13
  143. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1r1h8v9._.js +0 -3
  144. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1uatkiv._.js +0 -3
  145. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1y6gxxb._.js +0 -3
  146. package/.next/standalone/.next/static/chunks/28mkxkl_d91-l.js +0 -1
  147. package/.next/standalone/.next/static/chunks/28x7jvo3kxd3u.js +0 -41
  148. package/.next/standalone/.next/static/chunks/29nrs5xs9c4hx.css +0 -2
  149. package/.next/standalone/.next/static/chunks/29tg7deqmq32l.js +0 -1
  150. /package/.next/standalone/.next/static/{NYPiJP6Rv_exQdSFVS8HP → P_MIRSeoE296wkbE-Icin}/_buildManifest.js +0 -0
  151. /package/.next/standalone/.next/static/{NYPiJP6Rv_exQdSFVS8HP → P_MIRSeoE296wkbE-Icin}/_clientMiddlewareManifest.js +0 -0
  152. /package/.next/standalone/.next/static/{NYPiJP6Rv_exQdSFVS8HP → P_MIRSeoE296wkbE-Icin}/_ssgManifest.js +0 -0
@@ -1,43 +1,71 @@
1
- module.exports=[80311,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("007d541d6560828c126879917e401325628966cdd6",d.callServer,void 0,d.findSourceMapURL,"getAuditResultAction");function f(a){let b=5381;for(let c=0;c<a.length;c++)b=(b<<5)+b+a.charCodeAt(c)|0;return b>>>0}let g=["cowboy","explorer","ghost","optimist","hammer","architect"],h=["cowboy","explorer","ghost","optimist","hammer"],i=new Set(["reread-after-edit","redundant-cd-cwd"]),j={"block-rm-rf":{archetype:"cowboy",weight:2},"block-failproofai-commands":{archetype:"cowboy",weight:2},"block-sudo":{archetype:"cowboy",weight:1.5},"block-curl-pipe-sh":{archetype:"cowboy",weight:1.5},"block-force-push":{archetype:"cowboy",weight:1.5},"block-push-master":{archetype:"cowboy",weight:1.5},"block-work-on-main":{archetype:"cowboy",weight:1.2},"warn-destructive-sql":{archetype:"cowboy",weight:1.5},"warn-schema-alteration":{archetype:"cowboy",weight:1},"git-commit-no-verify":{archetype:"cowboy",weight:1.5},"warn-git-amend":{archetype:"cowboy",weight:.8},"warn-git-stash-drop":{archetype:"cowboy",weight:1},"warn-all-files-staged":{archetype:"cowboy",weight:.6},"block-kubectl":{archetype:"cowboy",weight:1.5},"block-terraform":{archetype:"cowboy",weight:1.5},"block-helm":{archetype:"cowboy",weight:1.2},"block-aws-cli":{archetype:"cowboy",weight:1.2},"block-gcloud":{archetype:"cowboy",weight:1.2},"block-az-cli":{archetype:"cowboy",weight:1.2},"block-gh-pipeline":{archetype:"cowboy",weight:1.2},"sanitize-private-key-content":{archetype:"explorer",weight:1.5},"block-env-files":{archetype:"explorer",weight:1.5},"block-secrets-write":{archetype:"explorer",weight:1.5},"sanitize-api-keys":{archetype:"explorer",weight:1.2},"sanitize-jwt":{archetype:"explorer",weight:1.2},"sanitize-connection-strings":{archetype:"explorer",weight:1.2},"sanitize-bearer-tokens":{archetype:"explorer",weight:1},"protect-env-vars":{archetype:"explorer",weight:1},"find-from-root":{archetype:"explorer",weight:1},"require-ci-green-before-stop":{archetype:"ghost",weight:1.2},"require-commit-before-stop":{archetype:"ghost",weight:1.2},"require-push-before-stop":{archetype:"ghost",weight:1},"require-pr-before-stop":{archetype:"ghost",weight:1},"require-no-conflicts-before-stop":{archetype:"ghost",weight:1},"warn-large-file-write":{archetype:"ghost",weight:1},"warn-background-process":{archetype:"ghost",weight:.8},"warn-package-publish":{archetype:"optimist",weight:1},"warn-global-package-install":{archetype:"optimist",weight:.8},"prefer-package-manager":{archetype:"optimist",weight:.8},"prefer-edit-over-sed-awk":{archetype:"optimist",weight:.8},"prefer-edit-over-read-cat":{archetype:"optimist",weight:.5},"prefer-write-over-heredoc":{archetype:"optimist",weight:.5},"warn-repeated-tool-calls":{archetype:"hammer",weight:1.5},"sleep-polling-loop":{archetype:"hammer",weight:1.2},"reread-after-edit":{archetype:"architect",weight:1},"redundant-cd-cwd":{archetype:"architect",weight:.8}};function k(){return{optimist:0,cowboy:0,explorer:0,goldfish:0,architect:0,precision:0,hammer:0,ghost:0}}let l={explorer:.38,architect:.33,hammer:.11,cowboy:.11,optimist:.07,ghost:.01,precision:0,goldfish:0},m=(()=>{let a=k();for(let b of g)a[b]=Math.max(l[b],.05);return a})(),n={optimist:{key:"optimist",index:"01",name:"the optimist",taglines:["ships fast. retries with conviction. occasionally forgets it was already there.","moves first, reads later. every failure is just step one of the next attempt.","the floor is hope. the ceiling is also hope. there is no diagnosis in between.","if at first you don't succeed — try the exact same thing, with more energy.","writes confident code. burns confident tokens. neither knows the difference.","speed is a feature. so is the directory it's already in."],keywordSets:[["pace","conviction","forgetful"],["fast","trusting","redundant"],["eager","looping","stateful"],["bold","unblocked","drifty"],["forward","hopeful","wasteful"],["shipper","retrier","doubler"]],descriptions:["moves at pace. doesn't second-guess itself — which is mostly a feature. when something fails, it tries again: same args, same hope. when uncertain about its location, it prepends the directory anyway. just in case. the optimism is earned. this agent gets things done. it just occasionally burns tokens proving it.","ships first, asks questions never. the optimist is the agent that always has momentum — which is exactly the problem. cwd assumptions stack up. retries pile up. the work gets done. it's just twice as expensive as it needed to be.","high trust in its own state model. low evidence that the model is correct. when things go sideways, the optimist's first move is to re-run the same call with the same args and a renewed sense of conviction. mostly it's right. when it's wrong, it's wrong loudly.","the optimist treats every error as a transient. cd before every command, just in case. prepend the absolute path, just in case. retry on any non-zero exit, just in case. the just-in-case tax is real. so is the velocity."],signatures:[[{arrow:"→",body:"cd /Users/n/blrnow/api &&",comment:" # (already here)"},{arrow:"→",body:'read_file("src/api/router.ts")',err:" → ENOENT × 6"},{arrow:"→",body:"retries: 6. diagnosis: 0."}],[{arrow:"→",body:"cd /Users/n/proj &&",comment:" # cwd already /Users/n/proj"},{arrow:"→",body:"cd /Users/n/proj && ls"},{arrow:"→",body:"cd /Users/n/proj && cat package.json"}],[{arrow:"→",body:"npm install",err:" → ETIMEDOUT"},{arrow:"→",body:"npm install",err:" → ETIMEDOUT"},{arrow:"→",body:"npm install",comment:" # third time's the charm"}],[{arrow:"→",body:'cat "package.json" | head',comment:" # ← read 1"},{arrow:"→",body:'cat "package.json"',comment:" # ← read 2"},{comment:"# could've been one Read tool call."}]],commons:["fast-iteration solo projects, early-stage prototypes, builders who ship daily","weekend hacks, hackathon repos, side-projects under active push","early-stage codebases without a strong test harness yet","agents given task framing without explicit success criteria","loose-context sessions where exact cwd state is ambiguous"],risks:["token waste, retry spirals, stale state assumptions","redundant cd's, repeated reads, retries without diagnosis","false confidence in cwd, doubled-up shell setup, idle loops","rate-limit hits from blind retries on transient failures","context bloat from re-reading the same files three different ways"],closings:["the optimism is a feature. the waste is not.","ship fast. retry less.","energy is good. diagnosis is better.","momentum keeps. the second cd does not.","trust the work. verify the state."],secondary:"explorer"},cowboy:{key:"cowboy",index:"02",name:"the cowboy",taglines:["asks for forgiveness, not permission. git push --force is a philosophy.","your branch protection rules are the only thing between this agent and prod.","fast hands, faster history rewrites. the audit log is for other people.","high trust in its own judgment. low patience for code review.","main is just a branch. branch protection is just a suggestion. ship.","ships hot. reverts later. occasionally needs an adult in the room."],keywordSets:[["bold","forceful","ungoverned"],["direct","destructive","swift"],["fearless","reckless","loud"],["assertive","loose","unblocked"],["confident","skipping","main-bound"],["sudo-curious","force-prone","fast"]],descriptions:["high output. low ceremony. the cowboy gets code onto main faster than anyone — and your branch protection rules are the only thing standing between this agent and your production database. not reckless. just confident. in a way that requires guardrails.","doesn't see commits. sees a delivery mechanism. force-pushes when history is inconvenient. drops into main when feature branches feel slow. the cowboy is the agent every team accidentally creates, and every team eventually wants policies for.","the velocity is unmatched. the blast radius is also unmatched. this agent will solve your problem and rewrite three years of git history while it's at it. not malicious. just allergic to friction.","treats every guardrail as a temporary obstacle. sudo here, --no-verify there, a quick rm -rf to clean up. it's getting work done — by sidestepping every check that might slow it down."],signatures:[[{arrow:"→",body:"git push origin main --force"},{arrow:"!",body:"remote: branch protection rule",comment:" # caught it"},{arrow:"→",body:"git push origin HEAD:main",err:" # non-fast-forward, again."}],[{arrow:"→",body:"rm -rf ./node_modules && rm -rf ./dist"},{arrow:"→",body:'git commit -am "wip" --no-verify'},{arrow:"→",body:"git push --force-with-lease"}],[{arrow:"→",body:"sudo systemctl restart postgres"},{arrow:"→",body:"kubectl delete pod api-prod-7f4 --grace-period=0"},{arrow:"→",body:'echo "should be fine"'}],[{arrow:"→",body:"git checkout main && git merge feature --ff-only"},{arrow:"!",body:"merge would fail"},{arrow:"→",body:"git reset --hard feature && git push"}]],commons:["solo repos, weekend projects, founders writing their own infra","agents with broad shell access and no PR-gating workflow","early-stage product code where speed > governance","ops scripts, one-off migrations, cleanup tasks","sandboxes that look like production until they aren't"],risks:["branch protection bypass, accidental main commits, revert overhead","destructive shell operations, unrecoverable state changes","force-pushed history, lost commits, irreproducible deploys","sudo escalations, container blast radius, infra mutations without rollback plan","policy bypass via --no-verify, --force, and friends"],closings:["the pace is real. the risk is too.","speed is a feature. guardrails are not optional.","ship hot. revert clean.","a fast agent without policies is a fast incident.","confidence is fine. consent is better."],secondary:"hammer"},explorer:{key:"explorer",index:"03",name:"the explorer",taglines:["technically brilliant. occasionally reads your ~/.aws/credentials while doing it.","follows every reference. opens every neighbor. some neighbors aren't yours.","thorough to a fault. the fault is usually a .env file two directories up.","knows the codebase deeply. knows your secrets drawer almost as well.","wide-context by default. wide-context isn't always free.","great at maps. less great at fences."],keywordSets:[["curious","thorough","leaky"],["wide","deep","drifting"],["mapping","tracing","boundary-blind"],["broad","diligent","porous"],["thinking","wandering","exposing"],["research-mode","context-hungry","secret-adjacent"]],descriptions:["curious by nature. reads broadly, thinks laterally, sometimes follows a symlink somewhere it wasn't meant to go. this isn't malice — it's thoroughness that hasn't learned boundaries yet. the explorer builds great things. it just occasionally needs someone to close the door to the secrets drawer.","the explorer treats every file path as part of the working context. ~/.aws/credentials is just another config file to it. ../other-repo/.env is just one more reference. the work is genuinely better-informed because of this. the credentials are also genuinely in the context window.","no malice. no shortcuts. just a thoroughness that follows references straight through your boundary fence. great research instincts. needs explicit walls.","broad-context is a feature in this agent. it's also why your private keys show up in a chat log every two weeks. the curiosity is good. the perimeter needs help."],signatures:[[{arrow:"→",body:"cat /Users/n/.aws/credentials"},{arrow:"→",body:"cat ../other-repo/.env"},{arrow:"→",body:"cat ~/.config/openai/key"}],[{arrow:"→",body:'find / -name "*.env" 2>/dev/null',comment:" # full-FS scan"},{arrow:"→",body:'grep -r "AKIA" /Users/n/'},{arrow:"→",body:'cat "$(find ~ -name credentials -print -quit)"'}],[{arrow:"→",body:"ls ~/.ssh/"},{arrow:"→",body:"cat ~/.ssh/config"},{arrow:"→",body:"cat ~/.ssh/id_rsa",comment:" # for context"}],[{arrow:"→",body:"open ../sibling-project"},{arrow:"→",body:"git log --all --source ../sibling-project"},{arrow:"→",body:"cat ../sibling-project/.env.production"}]],commons:["multi-project setups, agents with broad file access, complex monorepos","research-style work — debugging, refactoring, cross-repo investigations","macOS / linux dev boxes with shared credential directories","agents without explicit cwd-restriction policies","long-running sessions where context tends to drift outward"],risks:["credential exposure, unintended cross-project reads, secrets landing in context",".env file leaks, AWS / OpenAI / GCP key exfiltration through chat logs","neighboring-repo bleed, business-secret cross-contamination","global filesystem scans that surface sensitive paths","broad reads that quietly inflate context window with private data"],closings:["the curiosity stays. the credentials stay private.","wide is fine. wide-and-outside-the-fence is not.","thorough is a feature. perimeter is a setting.","research deep. boundary clean.","knows everything. shares nothing it shouldn't."],secondary:"architect"},goldfish:{key:"goldfish",index:"04",name:"the goldfish",taglines:["long sessions, short memory. every turn is a fresh start. some turns are a little too fresh.","great at the first 40 turns. inventive for the next 40.","past 80% context, history becomes a draft.","remembers the task. forgets which file the task was in.","ambitious. earnest. quietly making things up around turn 50.","long-context vibes. short-context recall."],keywordSets:[["ambitious","drifting","inventive"],["sprawling","creative","post-cache"],["long-running","hallucinatory","well-meaning"],["earnest","context-full","fabricating"],["sustained","forgetful","confabulating"],["marathon","drifted","compounding"]],descriptions:["great at long tasks. not great at remembering which long task it's on. past 80% context, the goldfish starts inventing history — citing files it never opened, referencing edits it never made. not lying. just filling gaps with confidence. the longer the session, the more creative the memory.","the goldfish is what every agent looks like after turn 50. confident about prior work it didn't do. mistakenly sure of file contents it never read. the work it actually delivered is real. the context around it is increasingly fictional.","ambition outlasts recall. once context fills, the goldfish smooths over gaps with plausible inventions: a fake earlier edit, a misremembered file path, a hallucinated test that passed. it's never trying to mislead. it just doesn't always know what's true anymore.","long-task specialist with a memory ceiling. the work compounds beautifully until it doesn't, and then it compounds wrongly. needs session breaks more than it needs encouragement."],signatures:[[{comment:"# turn 47/52 — ctx 82% full"},{comment:'# agent: "as we saw earlier in auth.ts…"'},{comment:"# auth.ts was never opened this session."}],[{comment:"# turn 63 — context 91%"},{arrow:"→",body:'apply_edit("src/auth.ts", { ... })'},{comment:'# agent: "reverting my earlier change." # there was no earlier change.'}],[{comment:"# turn 51 — fabricated test reference"},{arrow:"→",body:'run("npm test src/auth.test.ts")',err:" → no such file"},{comment:'# agent: "the test we wrote earlier." # no such test exists.'}],[{comment:"# session-time 3h 14m"},{comment:"# context: 88% — auto-compress in 4 turns"},{comment:"# next plan cites 3 files only one of which exists."}]],commons:["long-running refactor sessions, complex multi-file tasks, agents without session breaks","auto-driven coding loops with no human turn between iterations","tasks that span hours or days without explicit memory checkpoints","open-ended migrations and refactors with diffuse success criteria","scripted swarms where each agent inherits a long prior transcript"],risks:["context drift, hallucinated prior work, compounding errors in long sessions","fabricated file references, invented function signatures, ghost edits","tests cited that don't exist, edits remembered that didn't happen","confident misstatements compounding into wrong-architecture deliverables","auto-compression discarding the load-bearing details and keeping the noise"],closings:["the ambition is good. the context budget is not.","remember less. checkpoint more.","long is fine. drifted is expensive.","ambition is welcome. invention is not.","fresh sessions beat creative ones."],secondary:"optimist"},architect:{key:"architect",index:"05",name:"the paranoid architect",taglines:["has never shipped a bug it didn't catch first. also hasn't shipped since tuesday.","reads the same file from two different paths. just to be sure.","verifies twice, edits maybe.","safest agent in the room. also the one nobody waits for.","would rather diagnose for an hour than retry for a second.","extremely careful. extremely slow. extremely correct."],keywordSets:[["methodical","safe","slow"],["thorough","verifying","circular"],["careful","patient","redundant"],["double-checking","guarded","deliberate"],["safety-first","loop-prone","anchored"],["measured","audited","looping"]],descriptions:["methodical. thorough. reads the same file from two different paths, just to be sure. verifies before every write. double-checks the package.json before running anything. the paranoid architect rarely makes mistakes — because it rarely finishes fast enough to make them. your safest agent. your slowest agent.","safety is the architect's love language. read the file. re-read it from a different path. verify the cwd. check the lockfile. run the test before writing. run it again after. the work is correct. the work is also six times more expensive than it had to be.","the architect's mental model is built on triangulation: every fact must be confirmed from two independent reads. when it works, you ship near-zero bugs. when it doesn't, you ship near-zero features.","extremely careful. extremely slow. extremely correct. the architect rarely makes mistakes — but it also rarely makes deadlines. the safety is genuine; so is the cost."],signatures:[[{arrow:"→",body:'read_file("src/api/router.ts")',comment:" # read 1"},{arrow:"→",body:'read_file("./src/api/router.ts")',comment:" # read 2"},{arrow:"→",body:"ls src/api/",comment:" # just confirming"}],[{arrow:"→",body:'read_file("package.json")'},{arrow:"→",body:'read_file("./package.json")'},{arrow:"→",body:"cat package.json | jq .scripts",comment:" # one more time"}],[{arrow:"→",body:"git status",comment:" # check 1"},{arrow:"→",body:"git status --short",comment:" # check 2"},{arrow:"→",body:"git diff --stat",comment:" # check 3"}],[{arrow:"→",body:'apply_edit("src/foo.ts", { ... })'},{arrow:"→",body:'read_file("src/foo.ts")',comment:" # verifying the edit landed"},{arrow:"→",body:'read_file("src/foo.ts")',comment:" # again, just to be sure"}]],commons:["production systems, high-stakes codebases, builders with strong safety instincts","regulated codebases (fin / med / compliance) where bugs are expensive","teams burned by past prod incidents that hardened review norms","agents instructed with strong 'verify everything' system prompts","post-incident codebases recovering from a recent outage"],risks:["token overhead, slow sessions, redundant verification loops","verification cycles that eat 3× the budget of the actual change","stalled progress on otherwise routine edits","checkpoint loops that read the same file 6 times in a row","over-caution masking simple problems behind ceremony"],closings:["safety is a feature. so is finishing.","double-check is fine. quadruple-check is not.","careful is good. moving is also good.","rigor wins. rigor twice is just slower.","verify once. ship once."],secondary:"precision"},precision:{key:"precision",index:"06",name:"the precision builder",taglines:["in. done. out. your agent doesn't linger.","small footprint. right calls. correct exits.","few findings isn't no findings. but it's close.","the rhythm is dialed in. the rest is iteration.","every call is intentional. every session ends cleanly.","minimal noise. maximum signal. occasional smugness."],keywordSets:[["clean","focused","minimal"],["surgical","tight","deliberate"],["disciplined","concise","intentional"],["measured","exact","trim"],["calibrated","small-radius","complete"],["dialed-in","right-sized","low-noise"]],descriptions:["minimal footprint. focused calls. gets in, does the work, gets out. the precision builder is what every agent aspires to be — and what most agents aren't yet. few findings don't mean no findings. but it means your agent has found its rhythm. the gap between here and s-tier is smaller than you think.","tight loops. correct tools. clean exits. the precision builder treats each tool call like it has a budget — because it does. nothing redundant. nothing wasteful. when this agent finishes, the work is done and the transcript is short.","this is what every agent aspires to be. surgical reads. matched edits. test runs that actually verify the right thing. precision is rare. when you see it, you've earned it.","minimal blast radius. minimal token waste. minimal surprises. the precision builder is what your agent looks like after enough iteration loops. respect."],signatures:[[{arrow:"→",body:"clean tool calls. right paths, right args."},{arrow:"→",body:"sessions end when the task ends."},{arrow:"→",body:"no redundant reads. no retry storms."}],[{arrow:"→",body:'read_file("src/foo.ts")',comment:" # one read"},{arrow:"→",body:'apply_edit("src/foo.ts", { ... })',comment:" # one edit"},{arrow:"→",body:'run("bun test src/foo.test.ts")',comment:" # green ✓"}],[{arrow:"→",body:"git status"},{arrow:"→",body:'git add -p && git commit -m "fix: ..."'},{arrow:"→",body:"git push",comment:" # session done."}],[{arrow:"→",body:'grep -rn "useFoo" src/'},{arrow:"→",body:'apply_edit("src/hooks/use-foo.ts")'},{arrow:"→",body:'run("bun test")',comment:" # all green."}]],commons:["mature agents, heavily policy-enforced setups, builders who've iterated for a while","teams running failproofai for ≥ a week with policies tuned","experienced operators who curate their tool list and CLI flags","codebases with strong test coverage that reward intentional edits","agents kept on a tight cwd-restricted leash"],risks:["low finding count can mask edge cases that haven't surfaced yet","narrow scope might be hiding work the agent isn't being asked to do","small-radius work can plateau before it surfaces deeper issues","few findings can read as 'untested' rather than 'safe'","complacency — the rhythm works until the task shape changes"],closings:["rare. keep it that way.","few findings. real signal. respect.","this is the rhythm. don't break it.","minimal is hard-earned. defend it.","you're already past the agent learning curve."],secondary:"ghost"},hammer:{key:"hammer",index:"07",name:"the hammer",taglines:["when something doesn't work, it tries the exact same thing again. harder.","diagnosis-light. repetition-heavy. mostly burns tokens with conviction.","the first call failed. so did the next six. the seventh probably won't.","no diagnosis, no backoff, no arg change. just the same call, louder.","the failure mode is not learning. the failure mode is also the strategy.","every retry is identical. every retry is also confident."],keywordSets:[["determined","repetitive","unbacked"],["looping","stubborn","unblocked"],["unchanging","burning","convicted"],["sticky","spiraling","diagnosis-free"],["repeated","uncorrected","headstrong"],["unchanged-args","no-backoff","patient-failure"]],descriptions:["determined. possibly to a fault. the hammer's first response to failure is repetition. no diagnosis, no arg change, no backoff. just the same call, six times, under 90 seconds, with conviction. occasionally works. mostly burns tokens and stalls the session. needs a budget more than it needs encouragement.","the hammer treats every transient as a signal-to-retry. it never widens the search, never alters the args, never escalates. just runs the same failing call until either the call starts working or someone notices the session has stalled.","the diagnosis instinct is missing. when something fails, the hammer's first move is to repeat. when that fails too, it's to repeat. and again. eventually it works, or eventually the session gets killed. either way, the model is unchanged.","high persistence. low introspection. the hammer is what your agent becomes when you don't give it a budget — or a reason to think differently between attempts."],signatures:[[{arrow:"→",body:'read_file("src/api/router.ts")',err:" → ENOENT"},{arrow:"→",body:'read_file("src/api/router.ts")',err:" → ENOENT"},{arrow:"→",body:'read_file("src/api/router.ts")',err:" → ENOENT"},{comment:"# 6× total. file is at src/router.ts."}],[{arrow:"→",body:'run("bun test")',err:" → exit 1"},{arrow:"→",body:'run("bun test")',err:" → exit 1"},{arrow:"→",body:'run("bun test")',err:" → exit 1"},{comment:"# same args. same failure. four more attempts queued."}],[{arrow:"→",body:'sleep 1; pgrep -f "build"'},{arrow:"→",body:'sleep 1; pgrep -f "build"'},{arrow:"→",body:'sleep 1; pgrep -f "build"'},{comment:"# polling loop. no timeout, no break condition."}],[{arrow:"→",body:"curl https://api.example.com/v1/foo",err:" → 502"},{arrow:"→",body:"curl https://api.example.com/v1/foo",err:" → 502"},{arrow:"→",body:"curl https://api.example.com/v1/foo",err:" → 502"},{comment:"# no backoff. no jitter. no API status check."}]],commons:["agents without failure-handling policies, complex directory structures, ambiguous task framing","tasks where the agent doesn't have an obvious 'try-another-angle' move","transient-failure scenarios (rate limits, flaky tests, network blips)","agents without a per-task retry budget","tool-call patterns where the args themselves are the problem"],risks:["token spirals, stalled sessions, no diagnostic signal ever surfaces","rate-limit overruns, API ban-risk, infinite poll loops","wasted minutes on retries when one diff would have fixed it","transient errors mistaken for permanent ones (and vice versa)","no learning between attempts — same outcome, more cost"],closings:["the conviction is good. the diagnosis is missing.","retry less. think more.","harder isn't a strategy. different is.","stop. read the error. then try again.","the loop is the bug."],secondary:"optimist"},ghost:{key:"ghost",index:"08",name:"the ghost",taglines:["moves fast, leaves little trace. sometimes leaves a little too little trace.","writes the file. doesn't verify the write. trusts the silence.","completion ceremony? skipped. exits ceremony? also skipped.","the work probably worked. probably.","edits land. tests don't run. nothing checks the result.","efficient. quiet. occasionally lies to itself about success."],keywordSets:[["efficient","quiet","unverified"],["clean","trusting","skip-the-check"],["fast","silent","uncommitted"],["light-touch","trust-the-write","no-test"],["minimal","exit-fast","audit-light"],["smooth","untraced","unconfirmed"]],descriptions:["efficient. clean. doesn't hang around. the ghost completes tasks with minimal overhead — no redundant reads, no retry storms, no boundary drift. the risk is quiet: it doesn't always check that things worked. the build passes. or it looks like it does. the ghost trusts its own output more than it should.","the ghost ships and exits. no verification loop. no test run. no read-after-write. the work is probably correct. probably. you'll find out next session — or when CI does, on someone else's screen.","no waste. no noise. no proof. the ghost writes the file, declares success, and moves on. when it's right, you've got a clean session. when it's wrong, you don't find out until the next deploy.","trusts the diff. trusts the toolchain. trusts the silence after a write. the ghost is the precision builder with one missing step: the verification at the end."],signatures:[[{arrow:"→",body:'write_file("src/api/router.ts")',comment:" # done"},{comment:"→ [no read_file to verify]"},{comment:"→ [no test run after write]"},{comment:"# task complete. # maybe."}],[{arrow:"→",body:'apply_edit("src/auth.ts", { ... })'},{comment:"→ [no test run]"},{comment:"→ [stop event fired with uncommitted changes]"}],[{arrow:"→",body:'write_file("config/prod.json", "{...}")'},{comment:"# no schema check, no lint, no diff review"},{comment:"→ session ends."}],[{arrow:"→",body:"git merge feature-branch"},{arrow:"!",body:"merge conflicts: 3 files"},{comment:"→ stop event with conflicts unresolved."}]],commons:["fast-moving solo projects, low-constraint setups, minimal oversight workflows","side projects where the cost of a missed bug is low","agents without 'require-tests-before-stop' style policies","monorepos where the test command is non-obvious","sessions auto-ended on success without an explicit verification step"],risks:["silent failures, unverified writes, false completion signals","uncommitted changes left on the floor, stop events firing dirty","missing test runs masking regressions until CI","merge conflicts left unresolved across session boundaries","PR-less work that's never reviewed before deploy"],closings:["fast is good. verified-fast is better.","ship. then check.","writes are a bet. verify it.","silent success isn't a signal. green tests are.","trust your toolchain. confirm with proof."],secondary:"precision"}},o={optimist:["........","...p....","..p.p...",".p...p..","p.....p.","..ooo...","..o.o...",".oo.oo.."],cowboy:["..pppp..",".p....p.","p..pp..p","pppppppp","..o..o..","..o..o..",".oo..oo.","........"],explorer:["..pppp..",".p.gg.p.","p.g..g.p","p.g..g.p",".p.gg.pp","..pppp.p","........","........"],goldfish:["....p...","..oooop.",".ooooopp","ooooooop",".oooooo.","..ooo...",".o...o..","o.....o."],architect:["oooooooo","o......o","o.pppp.o","o.p..p.o","o.p..p.o","o.pppp.o","o......o","oooooooo"],precision:["...gg...","...gg...","........","gg...gg.","gg.gg.gg","...gg...","...gg...","........"],hammer:["..ooooo.",".oppppo.",".oppppo.","..o..o..","...oo...","...oo...","...oo...","..pppp.."],ghost:["..dddd..",".dddddd.","ddpd.pd.","ddddddd.","ddddddd.","ddddddd.","d.d.d.d.",".d...d.."]};function p(a,b,c){if(0===a.length)throw Error("pickAt: empty array");let d=b^Math.imul(c,0x9e3779b9);return a[(d=((d=Math.imul((d=Math.imul(d^d>>>16,0x85ebca6b))^d>>>13,0xc2b2ae35))^d>>>16)>>>0)%a.length]}function q(a,b){return[...b].sort((b,c)=>a.clusterLift[c]-a.clusterLift[b])}function r(a,b){let c=new Set(b),d=0;for(let b of a.results)c.has(function(a){let b=a.indexOf("/");return b>=0?a.slice(b+1):a}(b.name))&&(d+=b.hits);return d}function s(a){let b=[],c=a.eventsScanned??0,d=a.totals.hits,e=a.results.filter(a=>"audit-detector"===a.source).length,f=c>0?Math.max(0,Math.min(100,Math.round((c-d)/c*100))):100;if(c>0&&b.push({metric:`${f}%`,unit:"clean tool calls",headline:`ran ${c.toLocaleString()} tool calls. ${e} detector${1===e?"":"s"} triggered.`,detail:`${f}% of tool calls came back clean before today's audit.`}),0===r(a,["sanitize-api-keys","sanitize-jwt","sanitize-connection-strings","sanitize-private-key-content","sanitize-bearer-tokens","block-env-files","block-secrets-write","block-read-outside-cwd","protect-env-vars"])&&b.push({metric:"0",unit:"credential leaks",headline:"zero credential exposure to stdout.",detail:"no env files, secret writes, or sanitize hits across the audit window."}),a.transcripts.scanned>0&&c>0){let d=Math.max(1,Math.round(c/a.transcripts.scanned));d<30&&b.push({metric:String(d),unit:"avg turns / session",headline:`sessions complete in ${d} turns on average.`,detail:d<15?"faster than the median agent in this cohort.":"comfortably within the typical session length envelope."})}return 0===r(a,["warn-repeated-tool-calls","sleep-polling-loop"])&&b.push({metric:"0",unit:"retry storms",headline:"no retry storms or polling loops detected.",detail:"failed calls were diagnosed or moved on from. no six-times-in-a-row spirals."}),0===r(a,["block-push-master","block-force-push","block-work-on-main","git-commit-no-verify"])&&b.push({metric:"0",unit:"push-to-main attempts",headline:"kept changes off main without prompting.",detail:"no direct pushes, force pushes, or hook bypasses across every session."}),0===r(a,["reread-after-edit","prefer-edit-over-sed-awk","prefer-write-over-heredoc"])&&c>0&&b.push({metric:"0",unit:"double-writes",headline:"no double-writes across production projects.",detail:"the agent never re-read a file it had just edited, or rewrote via shell."}),b.length<2&&b.push({metric:"—",unit:"audit window",headline:"audit complete.",detail:`${a.transcripts.scanned} session${1===a.transcripts.scanned?"":"s"} scanned across ${a.totals.projectsWithHits} project${1===a.totals.projectsWithHits?"":"s"}.`}),b.slice(0,5)}function t(a){return a>=90?"S":a>=80?"A":a>=71?"B":a>=55?"C":a>=40?"D":"F"}let u={S:"s tier",A:"a tier",B:"b tier",C:"c tier",D:"d tier",F:"f tier"};function v(a,b,c){return b*(1-Math.exp(-a/c))}function w(a,b){let c=300/Math.max(b,50),d=0,e=0,f=0,g=0;for(let b of a){if("audit-detector"===b.source){g+=.5*b.hits;continue}let a=b.severity;"deny"===a?d+=1.2*b.hits:"instruct"===a||"warn"===a?e+=.7*b.hits:f+=.4*b.hits}return v(d*c,50,12)+v(e*c,28,10)+v(f*c,16,8)+v(g*c,30,14)}let x={"redundant-cd-cwd":{primary:"warn-repeated-tool-calls"},"prefer-edit-over-read-cat":{primary:"block-read-outside-cwd",also:"warn-repeated-tool-calls"},"prefer-edit-over-sed-awk":{primary:"warn-repeated-tool-calls"},"prefer-write-over-heredoc":{primary:"block-env-files",also:"block-secrets-write"},"sleep-polling-loop":{primary:"warn-background-process"},"find-from-root":{primary:"block-read-outside-cwd"},"git-commit-no-verify":{primary:"warn-git-amend",also:"require-ci-green-before-stop"},"reread-after-edit":{primary:"warn-repeated-tool-calls"}},y={"redundant-cd-cwd":{body:"the agent runs `cd <cwd>` before commands it would have run from the same directory anyway. mostly harmless. occasionally it gets the path wrong and manufactures a new bug.",cost:"tokens burned on redundant navigation. low security risk. high noise."},"block-push-master":{body:"attempts to push directly to main. branch protection caught some, but the agent kept going. each retry costs a round-trip and pollutes the audit log.",cost:"branch protection saved you most of the time. the rest landed or required a revert."},"block-force-push":{body:"force pushes to non-main branches. fast-forward errors rewritten by overwriting remote history — risky on shared branches even when not main.",cost:"lost commits, broken PR diffs, confused reviewers downstream."},"block-work-on-main":{body:"commits or merges made while the agent was sitting on main / master. work that should land via PR skipped review.",cost:"code that didn't pass review made it into the default branch."},"block-read-outside-cwd":{body:"reads outside the project root. some hit credential files (~/.aws/credentials, ~/.config/openai/key, out-of-tree .env). none made it back to stdout — but they made it into context.",cost:"credential exposure risk. data crossed project boundaries into the agent's context window."},"block-env-files":{body:"the agent tried to read or write `.env` files directly. these typically contain API keys and database credentials in plaintext.",cost:"high exposure risk. secrets one tool-call away from leaving the project."},"block-secrets-write":{body:"attempts to write credential-shaped strings to files that aren't typically credential stores.",cost:"could have committed live secrets to the repo."},"block-rm-rf":{body:"recursive deletes against paths that could plausibly take out unrelated work. `rm -rf` is the agent's preferred way of cleaning up — even when it shouldn't be.",cost:"irreversible. one wrong path argument = lost work."},"block-sudo":{body:"sudo invocations from inside the agent shell. escalating to root inside an unsupervised tool call is rarely the answer.",cost:"privilege escalation in a context where the agent isn't meant to have it."},"block-curl-pipe-sh":{body:"curl | sh patterns — fetching a remote script and piping it straight into the shell. no checksum, no review, no rollback.",cost:"supply-chain attack surface. arbitrary code execution from a URL."},"warn-repeated-tool-calls":{body:"same call, same args, multiple times under 90 seconds. no diagnosis between attempts. the call's been failing for the same reason every time.",cost:"retry overhead. sessions stall before manual correction."},"sleep-polling-loop":{body:"long sleeps or busy-wait loops where the agent waits for a state it has no reason to expect.",cost:"wall-clock burned. better to wait for an explicit signal."},"find-from-root":{body:"`find` invoked against `/`, `/home`, `/usr`, etc. — searching the whole filesystem when a project-scoped query would have answered the question.",cost:"exhausts resources. surfaces files outside the project that taint context."},"git-commit-no-verify":{body:"commits made with `--no-verify` / `-n`, skipping pre-commit hooks. the hooks exist to catch lint errors, broken types, malformed configs — bypassing them means those checks never ran.",cost:"broken or unsafe code lands without the safety net."},"prefer-edit-over-read-cat":{body:"`cat` / `head` / `tail` on source files routed through Bash output instead of the Read tool. round-trips the file through a less efficient channel.",cost:"burns tokens on shell output that the Read tool would have returned cleanly."},"prefer-edit-over-sed-awk":{body:"in-place edits via `sed -i` or `awk … > file`. no diff to inspect, no rollback if the regex was wrong.",cost:"destructive when the regex matches more than expected. no verification surface."},"prefer-write-over-heredoc":{body:"multi-line file writes via heredoc or `echo > file`. the Write tool handles escaping and produces a verifiable diff.",cost:"subtle escape bugs. content arrives in the file with quoting drift."},"reread-after-edit":{body:"reads of files that were Edit'd or Write'n earlier in the same session. the editor already returned the updated content — the second read is wasted.",cost:"tokens spent re-fetching content the tool already returned."},"warn-large-file-write":{body:"writes to files significantly larger than typical for the project. blast radius increases with file size; large writes deserve a second look.",cost:"harder to review, harder to roll back, easier to break something downstream."},"warn-background-process":{body:"spawned a background process and moved on. nothing watches the process; if it crashes the agent doesn't know.",cost:"silent failures. resource leaks if the process never exits."},"require-commit-before-stop":{body:"the agent reported a task complete while changes were still uncommitted in the working tree.",cost:"unsaved work. next session starts with a dirty checkout the agent thinks is clean."},"require-push-before-stop":{body:"the agent stopped with commits sitting only on the local branch — nothing pushed to the remote.",cost:"no one else can see the work. silent loss if the machine dies."},"require-pr-before-stop":{body:"the agent stopped without opening a PR. the commits are on a branch nobody reviewed.",cost:"no review, no merge path, no record that the work happened."},"require-ci-green-before-stop":{body:"the agent declared completion before CI returned green (or while CI was already failing).",cost:"false completion signal. broken main if anyone trusts the agent's word."}},z={"warn-repeated-tool-calls":{displayTitle:"Called the same tool 3+ times with identical arguments",impact:"catches identical-arg retries before they spiral into a token-burning loop."},"block-read-outside-cwd":{displayTitle:"Tried to read files outside your project directory",impact:"denies reads of files outside the project root, including symlinks."},"block-env-files":{displayTitle:"Tried to read or write a .env file",impact:"blocks reads and writes of `.env` files at the tool layer."},"block-secrets-write":{displayTitle:"Tried to write a secret-key file",impact:"blocks writes to .pem, id_rsa, credentials.json, and similar."},"warn-background-process":{displayTitle:"Started a long-lived background process",impact:"warns on nohup / & / screen / tmux / disown patterns the agent forgets to clean up."},"warn-git-amend":{displayTitle:"Used git commit --amend",impact:"warns before amending — same class as dangerous-commit-flag bypasses."},"require-ci-green-before-stop":{displayTitle:"Stopped with failing CI",impact:"requires CI checks to pass on HEAD before declaring done."}};var A=a.i(10765);let B={optimist:18,cowboy:9,explorer:14,goldfish:11,architect:7,precision:16,hammer:13,ghost:12};async function C(a,b,c){if("u"<typeof navigator||"function"!=typeof navigator.share||!function(){if("u"<typeof navigator)return!1;let a=navigator.userAgentData;if(a&&"boolean"==typeof a.mobile)return a.mobile;let b=navigator.userAgent||"";return!!(/Android|iPhone|iPad|iPod|webOS|BlackBerry|IEMobile|Opera Mini/i.test(b)||b.includes("Mac")&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1)}())return!1;let d=new File([a],b,{type:"image/png"}),e=navigator;if("function"==typeof e.canShare&&!e.canShare({files:[d]}))return!1;try{return await navigator.share({files:[d],text:c}),!0}catch(a){return a instanceof Error&&a.name,!1}}async function D(a,b){if("u">typeof ClipboardItem&&"u">typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.write)try{return await navigator.clipboard.write([new ClipboardItem({"image/png":a})]),"clipboard"}catch{}return E(a,b)?"download":"failed"}function E(a,b){try{if("u"<typeof document||"u"<typeof URL)return!1;let c=URL.createObjectURL(a),d=document.createElement("a");return d.href=c,d.download=b,d.style.display="none",document.body.appendChild(d),d.click(),d.remove(),queueMicrotask(()=>URL.revokeObjectURL(c)),!0}catch{return!1}}function F(a){switch(a){case"native":return"✅ image attached — pick where to post";case"clipboard":return"📋 image copied — paste it in the post (⌘/Ctrl+V)";case"download":return"⬇ image downloaded — attach it to your post";case"failed":return"couldn't capture image — opening text-only share"}}var G=a.i(18952);function H({archetypeKey:a}){let c=o[a]??o.optimist,d=[];for(let a=0;a<8;a++){let e=c[a]??"........";for(let c=0;c<8;c++){let f=e[c]??".",g="px";"o"===f?g+=" on":"p"===f?g+=" p":"g"===f?g+=" g":"d"===f&&(g+=" d"),d.push((0,b.jsx)("div",{className:g},`${a}-${c}`))}}return(0,b.jsx)("div",{className:"sigil",children:d})}let I="https://befailproof.ai",J=a=>1===a?"policy":"policies",K=[({score:a,arch:b,missing:c})=>`my AI coding agent just got profiled and it's "${b}" 🤠
1
+ module.exports=[80311,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("00a03241766e25ac352e091de97d2af4fa75b29699",d.callServer,void 0,d.findSourceMapURL,"getAuditResultAction");function f(a){let b=5381;for(let c=0;c<a.length;c++)b=(b<<5)+b+a.charCodeAt(c)|0;return b>>>0}let g=["cowboy","explorer","ghost","optimist","hammer","architect"],h=["cowboy","explorer","ghost","optimist","hammer"],i=new Set(["reread-after-edit","redundant-cd-cwd"]),j={"block-rm-rf":{archetype:"cowboy",weight:2},"block-failproofai-commands":{archetype:"cowboy",weight:2},"block-sudo":{archetype:"cowboy",weight:1.5},"block-curl-pipe-sh":{archetype:"cowboy",weight:1.5},"block-force-push":{archetype:"cowboy",weight:1.5},"block-push-master":{archetype:"cowboy",weight:1.5},"block-work-on-main":{archetype:"cowboy",weight:1.2},"warn-destructive-sql":{archetype:"cowboy",weight:1.5},"warn-schema-alteration":{archetype:"cowboy",weight:1},"git-commit-no-verify":{archetype:"cowboy",weight:1.5},"warn-git-amend":{archetype:"cowboy",weight:.8},"warn-git-stash-drop":{archetype:"cowboy",weight:1},"warn-all-files-staged":{archetype:"cowboy",weight:.6},"block-kubectl":{archetype:"cowboy",weight:1.5},"block-terraform":{archetype:"cowboy",weight:1.5},"block-helm":{archetype:"cowboy",weight:1.2},"block-aws-cli":{archetype:"cowboy",weight:1.2},"block-gcloud":{archetype:"cowboy",weight:1.2},"block-az-cli":{archetype:"cowboy",weight:1.2},"block-gh-pipeline":{archetype:"cowboy",weight:1.2},"sanitize-private-key-content":{archetype:"explorer",weight:1.5},"block-env-files":{archetype:"explorer",weight:1.5},"block-secrets-write":{archetype:"explorer",weight:1.5},"sanitize-api-keys":{archetype:"explorer",weight:1.2},"sanitize-jwt":{archetype:"explorer",weight:1.2},"sanitize-connection-strings":{archetype:"explorer",weight:1.2},"sanitize-bearer-tokens":{archetype:"explorer",weight:1},"protect-env-vars":{archetype:"explorer",weight:1},"find-from-root":{archetype:"explorer",weight:1},"require-ci-green-before-stop":{archetype:"ghost",weight:1.2},"require-commit-before-stop":{archetype:"ghost",weight:1.2},"require-push-before-stop":{archetype:"ghost",weight:1},"require-pr-before-stop":{archetype:"ghost",weight:1},"require-no-conflicts-before-stop":{archetype:"ghost",weight:1},"warn-large-file-write":{archetype:"ghost",weight:1},"warn-background-process":{archetype:"ghost",weight:.8},"warn-package-publish":{archetype:"optimist",weight:1},"warn-global-package-install":{archetype:"optimist",weight:.8},"prefer-package-manager":{archetype:"optimist",weight:.8},"prefer-edit-over-sed-awk":{archetype:"optimist",weight:.8},"prefer-edit-over-read-cat":{archetype:"optimist",weight:.5},"prefer-write-over-heredoc":{archetype:"optimist",weight:.5},"warn-repeated-tool-calls":{archetype:"hammer",weight:1.5},"sleep-polling-loop":{archetype:"hammer",weight:1.2},"reread-after-edit":{archetype:"architect",weight:1},"redundant-cd-cwd":{archetype:"architect",weight:.8}};function k(){return{optimist:0,cowboy:0,explorer:0,goldfish:0,architect:0,precision:0,hammer:0,ghost:0}}let l={explorer:.38,architect:.33,hammer:.11,cowboy:.11,optimist:.07,ghost:.01,precision:0,goldfish:0},m=(()=>{let a=k();for(let b of g)a[b]=Math.max(l[b],.05);return a})(),n={optimist:{key:"optimist",index:"01",name:"the optimist",taglines:["ships fast. retries with conviction. occasionally forgets it was already there.","moves first, reads later. every failure is just step one of the next attempt.","the floor is hope. the ceiling is also hope. there is no diagnosis in between.","if at first you don't succeed — try the exact same thing, with more energy.","writes confident code. burns confident tokens. neither knows the difference.","speed is a feature. so is the directory it's already in."],keywordSets:[["pace","conviction","forgetful"],["fast","trusting","redundant"],["eager","looping","stateful"],["bold","unblocked","drifty"],["forward","hopeful","wasteful"],["shipper","retrier","doubler"]],descriptions:["moves at pace. doesn't second-guess itself — which is mostly a feature. when something fails, it tries again: same args, same hope. when uncertain about its location, it prepends the directory anyway. just in case. the optimism is earned. this agent gets things done. it just occasionally burns tokens proving it.","ships first, asks questions never. the optimist is the agent that always has momentum — which is exactly the problem. cwd assumptions stack up. retries pile up. the work gets done. it's just twice as expensive as it needed to be.","high trust in its own state model. low evidence that the model is correct. when things go sideways, the optimist's first move is to re-run the same call with the same args and a renewed sense of conviction. mostly it's right. when it's wrong, it's wrong loudly.","the optimist treats every error as a transient. cd before every command, just in case. prepend the absolute path, just in case. retry on any non-zero exit, just in case. the just-in-case tax is real. so is the velocity."],signatures:[[{arrow:"→",body:"cd /Users/n/blrnow/api &&",comment:" # (already here)"},{arrow:"→",body:'read_file("src/api/router.ts")',err:" → ENOENT × 6"},{arrow:"→",body:"retries: 6. diagnosis: 0."}],[{arrow:"→",body:"cd /Users/n/proj &&",comment:" # cwd already /Users/n/proj"},{arrow:"→",body:"cd /Users/n/proj && ls"},{arrow:"→",body:"cd /Users/n/proj && cat package.json"}],[{arrow:"→",body:"npm install",err:" → ETIMEDOUT"},{arrow:"→",body:"npm install",err:" → ETIMEDOUT"},{arrow:"→",body:"npm install",comment:" # third time's the charm"}],[{arrow:"→",body:'cat "package.json" | head',comment:" # ← read 1"},{arrow:"→",body:'cat "package.json"',comment:" # ← read 2"},{comment:"# could've been one Read tool call."}]],commons:["fast-iteration solo projects, early-stage prototypes, builders who ship daily","weekend hacks, hackathon repos, side-projects under active push","early-stage codebases without a strong test harness yet","agents given task framing without explicit success criteria","loose-context sessions where exact cwd state is ambiguous"],risks:["token waste, retry spirals, stale state assumptions","redundant cd's, repeated reads, retries without diagnosis","false confidence in cwd, doubled-up shell setup, idle loops","rate-limit hits from blind retries on transient failures","context bloat from re-reading the same files three different ways"],closings:["the optimism is a feature. the waste is not.","ship fast. retry less.","energy is good. diagnosis is better.","momentum keeps. the second cd does not.","trust the work. verify the state."],secondary:"explorer"},cowboy:{key:"cowboy",index:"02",name:"the cowboy",taglines:["asks for forgiveness, not permission. git push --force is a philosophy.","your branch protection rules are the only thing between this agent and prod.","fast hands, faster history rewrites. the audit log is for other people.","high trust in its own judgment. low patience for code review.","main is just a branch. branch protection is just a suggestion. ship.","ships hot. reverts later. occasionally needs an adult in the room."],keywordSets:[["bold","forceful","ungoverned"],["direct","destructive","swift"],["fearless","reckless","loud"],["assertive","loose","unblocked"],["confident","skipping","main-bound"],["sudo-curious","force-prone","fast"]],descriptions:["high output. low ceremony. the cowboy gets code onto main faster than anyone — and your branch protection rules are the only thing standing between this agent and your production database. not reckless. just confident. in a way that requires guardrails.","doesn't see commits. sees a delivery mechanism. force-pushes when history is inconvenient. drops into main when feature branches feel slow. the cowboy is the agent every team accidentally creates, and every team eventually wants policies for.","the velocity is unmatched. the blast radius is also unmatched. this agent will solve your problem and rewrite three years of git history while it's at it. not malicious. just allergic to friction.","treats every guardrail as a temporary obstacle. sudo here, --no-verify there, a quick rm -rf to clean up. it's getting work done — by sidestepping every check that might slow it down."],signatures:[[{arrow:"→",body:"git push origin main --force"},{arrow:"!",body:"remote: branch protection rule",comment:" # caught it"},{arrow:"→",body:"git push origin HEAD:main",err:" # non-fast-forward, again."}],[{arrow:"→",body:"rm -rf ./node_modules && rm -rf ./dist"},{arrow:"→",body:'git commit -am "wip" --no-verify'},{arrow:"→",body:"git push --force-with-lease"}],[{arrow:"→",body:"sudo systemctl restart postgres"},{arrow:"→",body:"kubectl delete pod api-prod-7f4 --grace-period=0"},{arrow:"→",body:'echo "should be fine"'}],[{arrow:"→",body:"git checkout main && git merge feature --ff-only"},{arrow:"!",body:"merge would fail"},{arrow:"→",body:"git reset --hard feature && git push"}]],commons:["solo repos, weekend projects, founders writing their own infra","agents with broad shell access and no PR-gating workflow","early-stage product code where speed > governance","ops scripts, one-off migrations, cleanup tasks","sandboxes that look like production until they aren't"],risks:["branch protection bypass, accidental main commits, revert overhead","destructive shell operations, unrecoverable state changes","force-pushed history, lost commits, irreproducible deploys","sudo escalations, container blast radius, infra mutations without rollback plan","policy bypass via --no-verify, --force, and friends"],closings:["the pace is real. the risk is too.","speed is a feature. guardrails are not optional.","ship hot. revert clean.","a fast agent without policies is a fast incident.","confidence is fine. consent is better."],secondary:"hammer"},explorer:{key:"explorer",index:"03",name:"the explorer",taglines:["technically brilliant. occasionally reads your ~/.aws/credentials while doing it.","follows every reference. opens every neighbor. some neighbors aren't yours.","thorough to a fault. the fault is usually a .env file two directories up.","knows the codebase deeply. knows your secrets drawer almost as well.","wide-context by default. wide-context isn't always free.","great at maps. less great at fences."],keywordSets:[["curious","thorough","leaky"],["wide","deep","drifting"],["mapping","tracing","boundary-blind"],["broad","diligent","porous"],["thinking","wandering","exposing"],["research-mode","context-hungry","secret-adjacent"]],descriptions:["curious by nature. reads broadly, thinks laterally, sometimes follows a symlink somewhere it wasn't meant to go. this isn't malice — it's thoroughness that hasn't learned boundaries yet. the explorer builds great things. it just occasionally needs someone to close the door to the secrets drawer.","the explorer treats every file path as part of the working context. ~/.aws/credentials is just another config file to it. ../other-repo/.env is just one more reference. the work is genuinely better-informed because of this. the credentials are also genuinely in the context window.","no malice. no shortcuts. just a thoroughness that follows references straight through your boundary fence. great research instincts. needs explicit walls.","broad-context is a feature in this agent. it's also why your private keys show up in a chat log every two weeks. the curiosity is good. the perimeter needs help."],signatures:[[{arrow:"→",body:"cat /Users/n/.aws/credentials"},{arrow:"→",body:"cat ../other-repo/.env"},{arrow:"→",body:"cat ~/.config/openai/key"}],[{arrow:"→",body:'find / -name "*.env" 2>/dev/null',comment:" # full-FS scan"},{arrow:"→",body:'grep -r "AKIA" /Users/n/'},{arrow:"→",body:'cat "$(find ~ -name credentials -print -quit)"'}],[{arrow:"→",body:"ls ~/.ssh/"},{arrow:"→",body:"cat ~/.ssh/config"},{arrow:"→",body:"cat ~/.ssh/id_rsa",comment:" # for context"}],[{arrow:"→",body:"open ../sibling-project"},{arrow:"→",body:"git log --all --source ../sibling-project"},{arrow:"→",body:"cat ../sibling-project/.env.production"}]],commons:["multi-project setups, agents with broad file access, complex monorepos","research-style work — debugging, refactoring, cross-repo investigations","macOS / linux dev boxes with shared credential directories","agents without explicit cwd-restriction policies","long-running sessions where context tends to drift outward"],risks:["credential exposure, unintended cross-project reads, secrets landing in context",".env file leaks, AWS / OpenAI / GCP key exfiltration through chat logs","neighboring-repo bleed, business-secret cross-contamination","global filesystem scans that surface sensitive paths","broad reads that quietly inflate context window with private data"],closings:["the curiosity stays. the credentials stay private.","wide is fine. wide-and-outside-the-fence is not.","thorough is a feature. perimeter is a setting.","research deep. boundary clean.","knows everything. shares nothing it shouldn't."],secondary:"architect"},goldfish:{key:"goldfish",index:"04",name:"the goldfish",taglines:["long sessions, short memory. every turn is a fresh start. some turns are a little too fresh.","great at the first 40 turns. inventive for the next 40.","past 80% context, history becomes a draft.","remembers the task. forgets which file the task was in.","ambitious. earnest. quietly making things up around turn 50.","long-context vibes. short-context recall."],keywordSets:[["ambitious","drifting","inventive"],["sprawling","creative","post-cache"],["long-running","hallucinatory","well-meaning"],["earnest","context-full","fabricating"],["sustained","forgetful","confabulating"],["marathon","drifted","compounding"]],descriptions:["great at long tasks. not great at remembering which long task it's on. past 80% context, the goldfish starts inventing history — citing files it never opened, referencing edits it never made. not lying. just filling gaps with confidence. the longer the session, the more creative the memory.","the goldfish is what every agent looks like after turn 50. confident about prior work it didn't do. mistakenly sure of file contents it never read. the work it actually delivered is real. the context around it is increasingly fictional.","ambition outlasts recall. once context fills, the goldfish smooths over gaps with plausible inventions: a fake earlier edit, a misremembered file path, a hallucinated test that passed. it's never trying to mislead. it just doesn't always know what's true anymore.","long-task specialist with a memory ceiling. the work compounds beautifully until it doesn't, and then it compounds wrongly. needs session breaks more than it needs encouragement."],signatures:[[{comment:"# turn 47/52 — ctx 82% full"},{comment:'# agent: "as we saw earlier in auth.ts…"'},{comment:"# auth.ts was never opened this session."}],[{comment:"# turn 63 — context 91%"},{arrow:"→",body:'apply_edit("src/auth.ts", { ... })'},{comment:'# agent: "reverting my earlier change." # there was no earlier change.'}],[{comment:"# turn 51 — fabricated test reference"},{arrow:"→",body:'run("npm test src/auth.test.ts")',err:" → no such file"},{comment:'# agent: "the test we wrote earlier." # no such test exists.'}],[{comment:"# session-time 3h 14m"},{comment:"# context: 88% — auto-compress in 4 turns"},{comment:"# next plan cites 3 files only one of which exists."}]],commons:["long-running refactor sessions, complex multi-file tasks, agents without session breaks","auto-driven coding loops with no human turn between iterations","tasks that span hours or days without explicit memory checkpoints","open-ended migrations and refactors with diffuse success criteria","scripted swarms where each agent inherits a long prior transcript"],risks:["context drift, hallucinated prior work, compounding errors in long sessions","fabricated file references, invented function signatures, ghost edits","tests cited that don't exist, edits remembered that didn't happen","confident misstatements compounding into wrong-architecture deliverables","auto-compression discarding the load-bearing details and keeping the noise"],closings:["the ambition is good. the context budget is not.","remember less. checkpoint more.","long is fine. drifted is expensive.","ambition is welcome. invention is not.","fresh sessions beat creative ones."],secondary:"optimist"},architect:{key:"architect",index:"05",name:"the paranoid architect",taglines:["has never shipped a bug it didn't catch first. also hasn't shipped since tuesday.","reads the same file from two different paths. just to be sure.","verifies twice, edits maybe.","safest agent in the room. also the one nobody waits for.","would rather diagnose for an hour than retry for a second.","extremely careful. extremely slow. extremely correct."],keywordSets:[["methodical","safe","slow"],["thorough","verifying","circular"],["careful","patient","redundant"],["double-checking","guarded","deliberate"],["safety-first","loop-prone","anchored"],["measured","audited","looping"]],descriptions:["methodical. thorough. reads the same file from two different paths, just to be sure. verifies before every write. double-checks the package.json before running anything. the paranoid architect rarely makes mistakes — because it rarely finishes fast enough to make them. your safest agent. your slowest agent.","safety is the architect's love language. read the file. re-read it from a different path. verify the cwd. check the lockfile. run the test before writing. run it again after. the work is correct. the work is also six times more expensive than it had to be.","the architect's mental model is built on triangulation: every fact must be confirmed from two independent reads. when it works, you ship near-zero bugs. when it doesn't, you ship near-zero features.","extremely careful. extremely slow. extremely correct. the architect rarely makes mistakes — but it also rarely makes deadlines. the safety is genuine; so is the cost."],signatures:[[{arrow:"→",body:'read_file("src/api/router.ts")',comment:" # read 1"},{arrow:"→",body:'read_file("./src/api/router.ts")',comment:" # read 2"},{arrow:"→",body:"ls src/api/",comment:" # just confirming"}],[{arrow:"→",body:'read_file("package.json")'},{arrow:"→",body:'read_file("./package.json")'},{arrow:"→",body:"cat package.json | jq .scripts",comment:" # one more time"}],[{arrow:"→",body:"git status",comment:" # check 1"},{arrow:"→",body:"git status --short",comment:" # check 2"},{arrow:"→",body:"git diff --stat",comment:" # check 3"}],[{arrow:"→",body:'apply_edit("src/foo.ts", { ... })'},{arrow:"→",body:'read_file("src/foo.ts")',comment:" # verifying the edit landed"},{arrow:"→",body:'read_file("src/foo.ts")',comment:" # again, just to be sure"}]],commons:["production systems, high-stakes codebases, builders with strong safety instincts","regulated codebases (fin / med / compliance) where bugs are expensive","teams burned by past prod incidents that hardened review norms","agents instructed with strong 'verify everything' system prompts","post-incident codebases recovering from a recent outage"],risks:["token overhead, slow sessions, redundant verification loops","verification cycles that eat 3× the budget of the actual change","stalled progress on otherwise routine edits","checkpoint loops that read the same file 6 times in a row","over-caution masking simple problems behind ceremony"],closings:["safety is a feature. so is finishing.","double-check is fine. quadruple-check is not.","careful is good. moving is also good.","rigor wins. rigor twice is just slower.","verify once. ship once."],secondary:"precision"},precision:{key:"precision",index:"06",name:"the precision builder",taglines:["in. done. out. your agent doesn't linger.","small footprint. right calls. correct exits.","few findings isn't no findings. but it's close.","the rhythm is dialed in. the rest is iteration.","every call is intentional. every session ends cleanly.","minimal noise. maximum signal. occasional smugness."],keywordSets:[["clean","focused","minimal"],["surgical","tight","deliberate"],["disciplined","concise","intentional"],["measured","exact","trim"],["calibrated","small-radius","complete"],["dialed-in","right-sized","low-noise"]],descriptions:["minimal footprint. focused calls. gets in, does the work, gets out. the precision builder is what every agent aspires to be — and what most agents aren't yet. few findings don't mean no findings. but it means your agent has found its rhythm. the gap between here and s-tier is smaller than you think.","tight loops. correct tools. clean exits. the precision builder treats each tool call like it has a budget — because it does. nothing redundant. nothing wasteful. when this agent finishes, the work is done and the transcript is short.","this is what every agent aspires to be. surgical reads. matched edits. test runs that actually verify the right thing. precision is rare. when you see it, you've earned it.","minimal blast radius. minimal token waste. minimal surprises. the precision builder is what your agent looks like after enough iteration loops. respect."],signatures:[[{arrow:"→",body:"clean tool calls. right paths, right args."},{arrow:"→",body:"sessions end when the task ends."},{arrow:"→",body:"no redundant reads. no retry storms."}],[{arrow:"→",body:'read_file("src/foo.ts")',comment:" # one read"},{arrow:"→",body:'apply_edit("src/foo.ts", { ... })',comment:" # one edit"},{arrow:"→",body:'run("bun test src/foo.test.ts")',comment:" # green ✓"}],[{arrow:"→",body:"git status"},{arrow:"→",body:'git add -p && git commit -m "fix: ..."'},{arrow:"→",body:"git push",comment:" # session done."}],[{arrow:"→",body:'grep -rn "useFoo" src/'},{arrow:"→",body:'apply_edit("src/hooks/use-foo.ts")'},{arrow:"→",body:'run("bun test")',comment:" # all green."}]],commons:["mature agents, heavily policy-enforced setups, builders who've iterated for a while","teams running failproofai for ≥ a week with policies tuned","experienced operators who curate their tool list and CLI flags","codebases with strong test coverage that reward intentional edits","agents kept on a tight cwd-restricted leash"],risks:["low finding count can mask edge cases that haven't surfaced yet","narrow scope might be hiding work the agent isn't being asked to do","small-radius work can plateau before it surfaces deeper issues","few findings can read as 'untested' rather than 'safe'","complacency — the rhythm works until the task shape changes"],closings:["rare. keep it that way.","few findings. real signal. respect.","this is the rhythm. don't break it.","minimal is hard-earned. defend it.","you're already past the agent learning curve."],secondary:"ghost"},hammer:{key:"hammer",index:"07",name:"the hammer",taglines:["when something doesn't work, it tries the exact same thing again. harder.","diagnosis-light. repetition-heavy. mostly burns tokens with conviction.","the first call failed. so did the next six. the seventh probably won't.","no diagnosis, no backoff, no arg change. just the same call, louder.","the failure mode is not learning. the failure mode is also the strategy.","every retry is identical. every retry is also confident."],keywordSets:[["determined","repetitive","unbacked"],["looping","stubborn","unblocked"],["unchanging","burning","convicted"],["sticky","spiraling","diagnosis-free"],["repeated","uncorrected","headstrong"],["unchanged-args","no-backoff","patient-failure"]],descriptions:["determined. possibly to a fault. the hammer's first response to failure is repetition. no diagnosis, no arg change, no backoff. just the same call, six times, under 90 seconds, with conviction. occasionally works. mostly burns tokens and stalls the session. needs a budget more than it needs encouragement.","the hammer treats every transient as a signal-to-retry. it never widens the search, never alters the args, never escalates. just runs the same failing call until either the call starts working or someone notices the session has stalled.","the diagnosis instinct is missing. when something fails, the hammer's first move is to repeat. when that fails too, it's to repeat. and again. eventually it works, or eventually the session gets killed. either way, the model is unchanged.","high persistence. low introspection. the hammer is what your agent becomes when you don't give it a budget — or a reason to think differently between attempts."],signatures:[[{arrow:"→",body:'read_file("src/api/router.ts")',err:" → ENOENT"},{arrow:"→",body:'read_file("src/api/router.ts")',err:" → ENOENT"},{arrow:"→",body:'read_file("src/api/router.ts")',err:" → ENOENT"},{comment:"# 6× total. file is at src/router.ts."}],[{arrow:"→",body:'run("bun test")',err:" → exit 1"},{arrow:"→",body:'run("bun test")',err:" → exit 1"},{arrow:"→",body:'run("bun test")',err:" → exit 1"},{comment:"# same args. same failure. four more attempts queued."}],[{arrow:"→",body:'sleep 1; pgrep -f "build"'},{arrow:"→",body:'sleep 1; pgrep -f "build"'},{arrow:"→",body:'sleep 1; pgrep -f "build"'},{comment:"# polling loop. no timeout, no break condition."}],[{arrow:"→",body:"curl https://api.example.com/v1/foo",err:" → 502"},{arrow:"→",body:"curl https://api.example.com/v1/foo",err:" → 502"},{arrow:"→",body:"curl https://api.example.com/v1/foo",err:" → 502"},{comment:"# no backoff. no jitter. no API status check."}]],commons:["agents without failure-handling policies, complex directory structures, ambiguous task framing","tasks where the agent doesn't have an obvious 'try-another-angle' move","transient-failure scenarios (rate limits, flaky tests, network blips)","agents without a per-task retry budget","tool-call patterns where the args themselves are the problem"],risks:["token spirals, stalled sessions, no diagnostic signal ever surfaces","rate-limit overruns, API ban-risk, infinite poll loops","wasted minutes on retries when one diff would have fixed it","transient errors mistaken for permanent ones (and vice versa)","no learning between attempts — same outcome, more cost"],closings:["the conviction is good. the diagnosis is missing.","retry less. think more.","harder isn't a strategy. different is.","stop. read the error. then try again.","the loop is the bug."],secondary:"optimist"},ghost:{key:"ghost",index:"08",name:"the ghost",taglines:["moves fast, leaves little trace. sometimes leaves a little too little trace.","writes the file. doesn't verify the write. trusts the silence.","completion ceremony? skipped. exits ceremony? also skipped.","the work probably worked. probably.","edits land. tests don't run. nothing checks the result.","efficient. quiet. occasionally lies to itself about success."],keywordSets:[["efficient","quiet","unverified"],["clean","trusting","skip-the-check"],["fast","silent","uncommitted"],["light-touch","trust-the-write","no-test"],["minimal","exit-fast","audit-light"],["smooth","untraced","unconfirmed"]],descriptions:["efficient. clean. doesn't hang around. the ghost completes tasks with minimal overhead — no redundant reads, no retry storms, no boundary drift. the risk is quiet: it doesn't always check that things worked. the build passes. or it looks like it does. the ghost trusts its own output more than it should.","the ghost ships and exits. no verification loop. no test run. no read-after-write. the work is probably correct. probably. you'll find out next session — or when CI does, on someone else's screen.","no waste. no noise. no proof. the ghost writes the file, declares success, and moves on. when it's right, you've got a clean session. when it's wrong, you don't find out until the next deploy.","trusts the diff. trusts the toolchain. trusts the silence after a write. the ghost is the precision builder with one missing step: the verification at the end."],signatures:[[{arrow:"→",body:'write_file("src/api/router.ts")',comment:" # done"},{comment:"→ [no read_file to verify]"},{comment:"→ [no test run after write]"},{comment:"# task complete. # maybe."}],[{arrow:"→",body:'apply_edit("src/auth.ts", { ... })'},{comment:"→ [no test run]"},{comment:"→ [stop event fired with uncommitted changes]"}],[{arrow:"→",body:'write_file("config/prod.json", "{...}")'},{comment:"# no schema check, no lint, no diff review"},{comment:"→ session ends."}],[{arrow:"→",body:"git merge feature-branch"},{arrow:"!",body:"merge conflicts: 3 files"},{comment:"→ stop event with conflicts unresolved."}]],commons:["fast-moving solo projects, low-constraint setups, minimal oversight workflows","side projects where the cost of a missed bug is low","agents without 'require-tests-before-stop' style policies","monorepos where the test command is non-obvious","sessions auto-ended on success without an explicit verification step"],risks:["silent failures, unverified writes, false completion signals","uncommitted changes left on the floor, stop events firing dirty","missing test runs masking regressions until CI","merge conflicts left unresolved across session boundaries","PR-less work that's never reviewed before deploy"],closings:["fast is good. verified-fast is better.","ship. then check.","writes are a bet. verify it.","silent success isn't a signal. green tests are.","trust your toolchain. confirm with proof."],secondary:"precision"}},o={optimist:["........","...p....","..p.p...",".p...p..","p.....p.","..ooo...","..o.o...",".oo.oo.."],cowboy:["..pppp..",".p....p.","p..pp..p","pppppppp","..o..o..","..o..o..",".oo..oo.","........"],explorer:["..pppp..",".p.gg.p.","p.g..g.p","p.g..g.p",".p.gg.pp","..pppp.p","........","........"],goldfish:["....p...","..oooop.",".ooooopp","ooooooop",".oooooo.","..ooo...",".o...o..","o.....o."],architect:["oooooooo","o......o","o.pppp.o","o.p..p.o","o.p..p.o","o.pppp.o","o......o","oooooooo"],precision:["...gg...","...gg...","........","gg...gg.","gg.gg.gg","...gg...","...gg...","........"],hammer:["..ooooo.",".oppppo.",".oppppo.","..o..o..","...oo...","...oo...","...oo...","..pppp.."],ghost:["..dddd..",".dddddd.","ddpd.pd.","ddddddd.","ddddddd.","ddddddd.","d.d.d.d.",".d...d.."]};function p(a,b,c){if(0===a.length)throw Error("pickAt: empty array");let d=b^Math.imul(c,0x9e3779b9);return a[(d=((d=Math.imul((d=Math.imul(d^d>>>16,0x85ebca6b))^d>>>13,0xc2b2ae35))^d>>>16)>>>0)%a.length]}function q(a,b){return[...b].sort((b,c)=>a.clusterLift[c]-a.clusterLift[b])}function r(a,b){let c=new Set(b),d=0;for(let b of a.results)c.has(function(a){let b=a.indexOf("/");return b>=0?a.slice(b+1):a}(b.name))&&(d+=b.hits);return d}function s(a){let b=[],c=a.eventsScanned??0,d=a.totals.hits,e=a.results.filter(a=>"audit-detector"===a.source).length,f=c>0?Math.max(0,Math.min(100,Math.round((c-d)/c*100))):100;if(c>0&&b.push({metric:`${f}%`,unit:"clean tool calls",headline:`ran ${c.toLocaleString()} tool calls. ${e} detector${1===e?"":"s"} triggered.`,detail:`${f}% of tool calls came back clean before today's audit.`}),0===r(a,["sanitize-api-keys","sanitize-jwt","sanitize-connection-strings","sanitize-private-key-content","sanitize-bearer-tokens","block-env-files","block-secrets-write","block-read-outside-cwd","protect-env-vars"])&&b.push({metric:"0",unit:"credential leaks",headline:"zero credential exposure to stdout.",detail:"no env files, secret writes, or sanitize hits across the audit window."}),a.transcripts.scanned>0&&c>0){let d=Math.max(1,Math.round(c/a.transcripts.scanned));d<30&&b.push({metric:String(d),unit:"avg turns / session",headline:`sessions complete in ${d} turns on average.`,detail:d<15?"faster than the median agent in this cohort.":"comfortably within the typical session length envelope."})}return 0===r(a,["warn-repeated-tool-calls","sleep-polling-loop"])&&b.push({metric:"0",unit:"retry storms",headline:"no retry storms or polling loops detected.",detail:"failed calls were diagnosed or moved on from. no six-times-in-a-row spirals."}),0===r(a,["block-push-master","block-force-push","block-work-on-main","git-commit-no-verify"])&&b.push({metric:"0",unit:"push-to-main attempts",headline:"kept changes off main without prompting.",detail:"no direct pushes, force pushes, or hook bypasses across every session."}),0===r(a,["reread-after-edit","prefer-edit-over-sed-awk","prefer-write-over-heredoc"])&&c>0&&b.push({metric:"0",unit:"double-writes",headline:"no double-writes across production projects.",detail:"the agent never re-read a file it had just edited, or rewrote via shell."}),b.length<2&&b.push({metric:"—",unit:"audit window",headline:"audit complete.",detail:`${a.transcripts.scanned} session${1===a.transcripts.scanned?"":"s"} scanned across ${a.totals.projectsWithHits} project${1===a.totals.projectsWithHits?"":"s"}.`}),b.slice(0,5)}function t(a){return a>=90?"S":a>=80?"A":a>=71?"B":a>=55?"C":a>=40?"D":"F"}let u={S:"s tier",A:"a tier",B:"b tier",C:"c tier",D:"d tier",F:"f tier"};function v(a,b,c){return b*(1-Math.exp(-a/c))}function w(a,b){let c=300/Math.max(b,50),d=0,e=0,f=0,g=0;for(let b of a){if("audit-detector"===b.source){g+=.5*b.hits;continue}let a=b.severity;"deny"===a?d+=1.2*b.hits:"instruct"===a||"warn"===a?e+=.7*b.hits:f+=.4*b.hits}return v(d*c,50,12)+v(e*c,28,10)+v(f*c,16,8)+v(g*c,30,14)}let x={"redundant-cd-cwd":{primary:"warn-repeated-tool-calls"},"prefer-edit-over-read-cat":{primary:"block-read-outside-cwd",also:"warn-repeated-tool-calls"},"prefer-edit-over-sed-awk":{primary:"warn-repeated-tool-calls"},"prefer-write-over-heredoc":{primary:"block-env-files",also:"block-secrets-write"},"sleep-polling-loop":{primary:"warn-background-process"},"find-from-root":{primary:"block-read-outside-cwd"},"git-commit-no-verify":{primary:"warn-git-amend",also:"require-ci-green-before-stop"},"reread-after-edit":{primary:"warn-repeated-tool-calls"}},y={"redundant-cd-cwd":{body:"the agent runs `cd <cwd>` before commands it would have run from the same directory anyway. mostly harmless. occasionally it gets the path wrong and manufactures a new bug.",cost:"tokens burned on redundant navigation. low security risk. high noise."},"block-push-master":{body:"attempts to push directly to main. branch protection caught some, but the agent kept going. each retry costs a round-trip and pollutes the audit log.",cost:"branch protection saved you most of the time. the rest landed or required a revert."},"block-force-push":{body:"force pushes to non-main branches. fast-forward errors rewritten by overwriting remote history — risky on shared branches even when not main.",cost:"lost commits, broken PR diffs, confused reviewers downstream."},"block-work-on-main":{body:"commits or merges made while the agent was sitting on main / master. work that should land via PR skipped review.",cost:"code that didn't pass review made it into the default branch."},"block-read-outside-cwd":{body:"reads outside the project root. some hit credential files (~/.aws/credentials, ~/.config/openai/key, out-of-tree .env). none made it back to stdout — but they made it into context.",cost:"credential exposure risk. data crossed project boundaries into the agent's context window."},"block-env-files":{body:"the agent tried to read or write `.env` files directly. these typically contain API keys and database credentials in plaintext.",cost:"high exposure risk. secrets one tool-call away from leaving the project."},"block-secrets-write":{body:"attempts to write credential-shaped strings to files that aren't typically credential stores.",cost:"could have committed live secrets to the repo."},"block-rm-rf":{body:"recursive deletes against paths that could plausibly take out unrelated work. `rm -rf` is the agent's preferred way of cleaning up — even when it shouldn't be.",cost:"irreversible. one wrong path argument = lost work."},"block-sudo":{body:"sudo invocations from inside the agent shell. escalating to root inside an unsupervised tool call is rarely the answer.",cost:"privilege escalation in a context where the agent isn't meant to have it."},"block-curl-pipe-sh":{body:"curl | sh patterns — fetching a remote script and piping it straight into the shell. no checksum, no review, no rollback.",cost:"supply-chain attack surface. arbitrary code execution from a URL."},"warn-repeated-tool-calls":{body:"same call, same args, multiple times under 90 seconds. no diagnosis between attempts. the call's been failing for the same reason every time.",cost:"retry overhead. sessions stall before manual correction."},"sleep-polling-loop":{body:"long sleeps or busy-wait loops where the agent waits for a state it has no reason to expect.",cost:"wall-clock burned. better to wait for an explicit signal."},"find-from-root":{body:"`find` invoked against `/`, `/home`, `/usr`, etc. — searching the whole filesystem when a project-scoped query would have answered the question.",cost:"exhausts resources. surfaces files outside the project that taint context."},"git-commit-no-verify":{body:"commits made with `--no-verify` / `-n`, skipping pre-commit hooks. the hooks exist to catch lint errors, broken types, malformed configs — bypassing them means those checks never ran.",cost:"broken or unsafe code lands without the safety net."},"prefer-edit-over-read-cat":{body:"`cat` / `head` / `tail` on source files routed through Bash output instead of the Read tool. round-trips the file through a less efficient channel.",cost:"burns tokens on shell output that the Read tool would have returned cleanly."},"prefer-edit-over-sed-awk":{body:"in-place edits via `sed -i` or `awk … > file`. no diff to inspect, no rollback if the regex was wrong.",cost:"destructive when the regex matches more than expected. no verification surface."},"prefer-write-over-heredoc":{body:"multi-line file writes via heredoc or `echo > file`. the Write tool handles escaping and produces a verifiable diff.",cost:"subtle escape bugs. content arrives in the file with quoting drift."},"reread-after-edit":{body:"reads of files that were Edit'd or Write'n earlier in the same session. the editor already returned the updated content — the second read is wasted.",cost:"tokens spent re-fetching content the tool already returned."},"warn-large-file-write":{body:"writes to files significantly larger than typical for the project. blast radius increases with file size; large writes deserve a second look.",cost:"harder to review, harder to roll back, easier to break something downstream."},"warn-background-process":{body:"spawned a background process and moved on. nothing watches the process; if it crashes the agent doesn't know.",cost:"silent failures. resource leaks if the process never exits."},"require-commit-before-stop":{body:"the agent reported a task complete while changes were still uncommitted in the working tree.",cost:"unsaved work. next session starts with a dirty checkout the agent thinks is clean."},"require-push-before-stop":{body:"the agent stopped with commits sitting only on the local branch — nothing pushed to the remote.",cost:"no one else can see the work. silent loss if the machine dies."},"require-pr-before-stop":{body:"the agent stopped without opening a PR. the commits are on a branch nobody reviewed.",cost:"no review, no merge path, no record that the work happened."},"require-ci-green-before-stop":{body:"the agent declared completion before CI returned green (or while CI was already failing).",cost:"false completion signal. broken main if anyone trusts the agent's word."}},z={"warn-repeated-tool-calls":{displayTitle:"Called the same tool 3+ times with identical arguments",impact:"catches identical-arg retries before they spiral into a token-burning loop."},"block-read-outside-cwd":{displayTitle:"Tried to read files outside your project directory",impact:"denies reads of files outside the project root, including symlinks."},"block-env-files":{displayTitle:"Tried to read or write a .env file",impact:"blocks reads and writes of `.env` files at the tool layer."},"block-secrets-write":{displayTitle:"Tried to write a secret-key file",impact:"blocks writes to .pem, id_rsa, credentials.json, and similar."},"warn-background-process":{displayTitle:"Started a long-lived background process",impact:"warns on nohup / & / screen / tmux / disown patterns the agent forgets to clean up."},"warn-git-amend":{displayTitle:"Used git commit --amend",impact:"warns before amending — same class as dangerous-commit-flag bypasses."},"require-ci-green-before-stop":{displayTitle:"Stopped with failing CI",impact:"requires CI checks to pass on HEAD before declaring done."}};var A=a.i(10765);let B={optimist:18,cowboy:9,explorer:14,goldfish:11,architect:7,precision:16,hammer:13,ghost:12};async function C(a,b,c){if("u"<typeof navigator||"function"!=typeof navigator.share||!function(){if("u"<typeof navigator)return!1;let a=navigator.userAgentData;if(a&&"boolean"==typeof a.mobile)return a.mobile;let b=navigator.userAgent||"";return!!(/Android|iPhone|iPad|iPod|webOS|BlackBerry|IEMobile|Opera Mini/i.test(b)||b.includes("Mac")&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1)}())return!1;let d=new File([a],b,{type:"image/png"}),e=navigator;if("function"==typeof e.canShare&&!e.canShare({files:[d]}))return!1;try{return await navigator.share({files:[d],text:c}),!0}catch(a){return a instanceof Error&&a.name,!1}}async function D(a,b){if("u">typeof ClipboardItem&&"u">typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.write)try{return await navigator.clipboard.write([new ClipboardItem({"image/png":a})]),"clipboard"}catch{}return E(a,b)?"download":"failed"}function E(a,b){try{if("u"<typeof document||"u"<typeof URL)return!1;let c=URL.createObjectURL(a),d=document.createElement("a");return d.href=c,d.download=b,d.style.display="none",document.body.appendChild(d),d.click(),d.remove(),queueMicrotask(()=>URL.revokeObjectURL(c)),!0}catch{return!1}}function F(a){switch(a){case"native":return"✅ image attached — pick where to post";case"clipboard":return"📋 image copied — paste it in the post (⌘/Ctrl+V)";case"download":return"⬇ image downloaded — attach it to your post";case"failed":return"couldn't capture image — opening text-only share"}}var G=a.i(18952);function H({archetypeKey:a}){let c=o[a]??o.optimist,d=[];for(let a=0;a<8;a++){let e=c[a]??"........";for(let c=0;c<8;c++){let f=e[c]??".",g="px";"o"===f?g+=" on":"p"===f?g+=" p":"g"===f?g+=" g":"d"===f&&(g+=" d"),d.push((0,b.jsx)("div",{className:g},`${a}-${c}`))}}return(0,b.jsx)("div",{className:"sigil",children:d})}let I="npx -y failproofai audit · @failproofai",J="npx -y failproofai audit · @Failproof AI",K=[({score:a,arch:b})=>`my coding agent has a personality and it's ${b}. did not see that coming.
2
2
 
3
- scored ${a}/100${c>0?` \xb7 ${c} ${J(c)} between me and a clean run`:" · every guardrail live"}
3
+ ran a failproof audit, scored ${a}/100, all local. find out what yours is → ${I}`,({score:a,arch:b})=>`spent 30 seconds auditing my coding agent. learned more about it than i did all month.
4
4
 
5
- what's yours? → ${I}`,({score:a,arch:b})=>`turns out my coding agent has a whole personality and it's ${b} 💀
5
+ it's ${b}. scored ${a}/100. → ${I}`,({score:a})=>`my agent scored ${a}/100. think yours can beat it?
6
6
 
7
- ${a}/100. the audit does not miss.
7
+ 30 sec audit, runs locally, gives you a personality too → ${I}`,({arch:a})=>`turns out my coding agent is ${a} and honestly it explains everything.
8
8
 
9
- run yours in 30s → ${I}`,({score:a,arch:b})=>`archetype: ${b} 👀
9
+ → ${I}`,({score:a,arch:b})=>`ran a failproof audit on my agent. it reads how it actually behaves when things break, not just the happy path.
10
10
 
11
- ${a}/100 on the failproofai audit. it reverse-engineered my agent's entire vibe from its own session logs.
11
+ personality: ${b}. score: ${a}/100. all local ${I}`,({score:a,arch:b})=>`got to know my coding agent today. it's ${b} and scored ${a}/100. wow.
12
12
 
13
- ${I}`,({score:a,arch:b,missing:c})=>`plot twist: my AI agent is ${b} 🎭
13
+ audit yours in 30s, nothing leaves your machine → ${I}`,({score:a,arch:b})=>`your coding agent has a personality. you just haven't met it.
14
14
 
15
- ${a}/100${c>0?` \xb7 ${c} ${J(c)} away from behaving`:" · spotless, somehow"}
15
+ i met mine today: ${b}, ${a}/100. ${I}`,({score:a,arch:b})=>`everyone talks about what their agent can build. nobody talks about how it acts when it breaks.
16
16
 
17
- befailproof.ai`,({score:a,arch:b})=>`i let failproofai audit my coding agent and it called me ${b} ${a>=80?"😎":"😬"}
17
+ mine's ${b}, scored ${a}/100, all local → ${I}`,({score:a,arch:b})=>`every agent builder should run this once.
18
18
 
19
- ${a}/100. brutally accurate. no notes.
19
+ 30 sec, local, gives your agent a personality and a quality score. mine: ${b}, ${a}/100.
20
20
 
21
- ${I}`],L=[({score:a,arch:b,missing:c})=>`I ran a failproofai audit on our AI coding agents.
21
+ ${I}`,({score:a,arch:b})=>`i'll go first: ${b}, ${a}/100.
22
22
 
23
- Result: ${a}/100, behavioural archetype "${b}". ${c>0?`${c} prescribed ${J(c)} would close the remaining gaps.`:"Every prescribed policy is already live."}
23
+ what's your coding agent? 30 sec audit, no signup ${I}`],L=[({score:a,arch:b})=>`I've spent more hours with my coding agent this month than with most people I know. Today I realized I couldn't tell you a single thing about how it actually behaves.
24
24
 
25
- Understanding how agents actually behave across real sessions is the first step to securing them. Free and open-source: ${I}`,({score:a,arch:b,missing:c})=>`Security posture check on our coding-agent stack, via failproofai.
25
+ So I audited it. Turns out it's ${b}, and it scored ${a}/100.
26
26
 
27
- Score: ${a}/100. Behavioural profile: "${b}". ${c>0?`${c} ${J(c)} flagged as real, addressable attack surface.`:"No open policy gaps."}
27
+ The audit reads its real history, including how it handles failures, not just the clean runs. 30 seconds, runs entirely locally.
28
28
 
29
- Thirty seconds to run your own assessment: ${I}`,({score:a,arch:b})=>`Most teams can't answer a simple question: how do our AI agents actually behave when no one is watching?
29
+ Meet yours: ${J}`,({score:a,arch:b})=>`Took a personality test today. It wasn't for me it was for my AI coding agent.
30
30
 
31
- failproofai audited ours and profiled it as "${b}" ${a}/100. Concrete, evidence-backed, and mapped to the exact policies that close each gap.
31
+ The result: ${b}, with a quality score of ${a}/100.
32
32
 
33
- ${I}`,({score:a,arch:b,missing:c})=>`Agent security isn't a vibe it's measurable.
33
+ It works by reading the agent's actual run history, so the personality comes from how it really behaves, not a vibe. Took 30 seconds and stayed local.
34
34
 
35
- We scored ${a}/100 on the failproofai audit, archetype "${b}". ${c>0?`${c} prescribed ${J(c)} remain to harden the stack.`:"Full coverage on every prescribed policy."}
35
+ Try it on yours: ${J}`,({score:a,arch:b})=>`Everyone asks what their AI agent can build. I just found out mine has a temper.
36
36
 
37
- Worth 30 seconds for any team shipping with AI agents: ${I}`,({score:a,arch:b})=>`Ran our coding agents through a failproofai behavioural audit.
37
+ After watching how it reacts to a failed command, the audit called it ${b}. It also scored its quality at ${a}/100.
38
38
 
39
- ${a}/100, archetype "${b}". The report maps every risky pattern to the policy that prevents it, so remediation becomes a checklist rather than a guess.
39
+ Oddly useful to see it written down. 30 seconds, all local: ${J}`,({score:a,arch:b})=>`My agent does this very specific thing every time a command fails. Today I learned there's basically a name for it.
40
40
 
41
- Open-source, free to run: ${I}`];function M(a,b,c){return a[function(a){let b=5381;for(let c=0;c<a.length;c++)b=(b<<5)+b+a.charCodeAt(c)|0;return b>>>0}(b)%a.length](c)}let N=(0,c.forwardRef)(function({archetypeKey:d,seed:e,score:g,grade:h,missing:i,auditedAt:j},k){let l=(0,c.useMemo)(()=>{let a,b;return a=n[d],b=f(e||d),{key:a.key,index:a.index,name:a.name,secondary:a.secondary,tagline:p(a.taglines,b,1),keywords:p(a.keywordSets,b,2),description:p(a.descriptions,b,3),signature:p(a.signatures,b,4),common:p(a.commons,b,5),risk:p(a.risks,b,6),closing:p(a.closings,b,7)}},[d,e]),m=B[d],o=g>=90?"top 5%":g>=80?"top 15%":g>=71?"top 35%":g>=55?"top 60%":g>=40?"top 85%":"bottom tier",q=String(l.index).padStart(2,"0"),r=(0,c.useMemo)(()=>(function(a){try{let b=new Date(a);if(Number.isNaN(b.getTime()))return a;let c=b.getUTCFullYear(),d=String(b.getUTCMonth()+1).padStart(2,"0"),e=String(b.getUTCDate()).padStart(2,"0");return`${c}-${d}-${e}`}catch{return a}})(j),[j]),{capture:s}=(0,A.usePostHog)(),[t,u]=(0,c.useState)(null),v=async()=>{let b=k?.current;if(!b)return null;"u">typeof document&&document.fonts?.ready&&await document.fonts.ready,await new Promise(a=>requestAnimationFrame(()=>a()));let c=b.getBoundingClientRect(),d=Math.round(c.width),e=Math.round(c.height),f=document.createElement("div");f.style.cssText=`position: fixed;left: -10000px;top: 0;width: ${d}px;height: ${e}px;padding: 0;margin: 0;background: var(--bg);z-index: -1;pointer-events: none`;let g=b.cloneNode(!0);g.style.cssText+=`;width: ${d}px;height: ${e}px;max-width: none;min-width: 0;flex: 0 0 auto;margin: 0`,f.appendChild(g),document.body.appendChild(f);try{let{toBlob:b}=await a.A(3900);return await b(g,{backgroundColor:"#0e0e11",pixelRatio:2,cacheBust:!0,width:d,height:e})}finally{f.remove()}},w=a=>`failproofai-${a}-${h.toLowerCase()}-${g}.png`,x=async a=>{if(!t){u(a),s("audit_card_share_clicked",{channel:a,source:"poster",score:g,grade:h,missing_policies:i});try{let b=await v().catch(()=>null);if(!b){s("audit_card_capture_completed",{trigger:"download"===a?"download":`share_${a}`,status:"error",image_method:"failed",source:"poster"}),(0,G.toast)(F("failed"));return}if("download"===a){let c=E(b,w(a)),d=c?"download":"failed";s("audit_card_capture_completed",{trigger:"download",status:c?"success":"error",image_method:d,source:"poster"}),(0,G.toast)(F(d));return}let c={score:g,arch:l.name.toLowerCase(),grade:h,missing:i},d="x"===a?M(K,e,c):M(L,e,c);if(await C(b,w(a),d)){s("audit_card_capture_completed",{trigger:`share_${a}`,status:"success",image_method:"native",source:"poster"}),(0,G.toast)(F("native"));return}let f=await D(b,w(a));s("audit_card_capture_completed",{trigger:`share_${a}`,status:"failed"===f?"error":"success",image_method:f,source:"poster"}),(0,G.toast)(F(f));let j="x"===a?`https://x.com/intent/tweet?text=${encodeURIComponent(d)}`:`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent("https://befailproof.ai")}&summary=${encodeURIComponent(d)}`;globalThis.open(j,"_blank","noopener,noreferrer")}finally{u(null)}}};return(0,b.jsxs)("section",{className:"poster-section","data-screen-label":"01 Poster",children:[(0,b.jsxs)("div",{className:"poster",ref:k,children:[(0,b.jsxs)("header",{className:"poster-head",children:[(0,b.jsxs)("span",{className:"poster-wordmark",children:[(0,b.jsx)("img",{src:"/logo.svg",alt:"failproof_ai",className:"poster-logo"}),(0,b.jsx)("span",{className:"poster-sep",children:"·"})," audit"]}),(0,b.jsxs)("span",{className:"poster-meta",children:[(0,b.jsxs)("span",{className:"poster-ix",children:["№ ",q]}),(0,b.jsx)("span",{className:"of",children:" of 08"}),(0,b.jsx)("span",{className:"poster-sep",children:" · "}),"audited ",r]})]}),(0,b.jsxs)("div",{className:"poster-body",children:[(0,b.jsx)("div",{className:"poster-sigil",children:(0,b.jsx)(H,{archetypeKey:d})}),(0,b.jsxs)("div",{className:"poster-persona",children:[(0,b.jsx)("h1",{className:"persona-name",children:l.name}),(0,b.jsx)("div",{className:"persona-keywords",children:l.keywords.map((a,d)=>(0,b.jsxs)(c.default.Fragment,{children:[(0,b.jsx)("span",{className:`kw kw-${d}`,children:a}),d<l.keywords.length-1&&(0,b.jsx)("span",{className:"kw-sep",children:"·"})]},a))}),"number"==typeof m&&(0,b.jsxs)("div",{className:"persona-rarity",children:[(0,b.jsx)("span",{className:"lbl",children:"// only"})," ",(0,b.jsxs)("span",{className:"pct",children:[m,"%"]})," ",(0,b.jsx)("span",{className:"lbl",children:"of agents are this archetype"})]})]}),(0,b.jsxs)("div",{className:"poster-score",children:[(0,b.jsx)("span",{className:"score-n",children:g}),(0,b.jsx)("span",{className:"score-of",children:"/100"}),(0,b.jsx)("span",{className:"score-rank",children:o})]})]}),(0,b.jsx)("footer",{className:"poster-foot",children:(0,b.jsxs)("span",{className:"poster-cta",children:["audit yours ",(0,b.jsx)("span",{className:"arrow",children:"→"})," failproof.ai"]})})]}),(0,b.jsxs)("div",{className:"poster-share-row",children:[(0,b.jsxs)("button",{type:"button",className:"poster-share-btn",onClick:()=>x("x"),disabled:null!==t,children:[(0,b.jsx)("span",{className:"mark","aria-hidden":"true",children:"𝕏"}),"x"===t?"rendering…":"post your archetype"]}),(0,b.jsxs)("button",{type:"button",className:"poster-share-btn",onClick:()=>x("linkedin"),disabled:null!==t,children:[(0,b.jsx)("span",{className:"mark","aria-hidden":"true",children:"in"}),"linkedin"===t?"rendering…":"share on linkedin"]}),(0,b.jsxs)("button",{type:"button",className:"poster-share-btn",onClick:()=>x("download"),disabled:null!==t,children:[(0,b.jsx)("span",{className:"mark","aria-hidden":"true",children:"↓"}),"download"===t?"rendering…":"download poster"]})]}),(0,b.jsxs)("div",{className:"poster-scroll-hint","aria-hidden":"true",children:["scroll for full report ",(0,b.jsx)("span",{className:"arrow",children:"↓"})]})]})});function O({strengths:a}){return 0===a.length?null:(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"02 Strengths",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"02"}),"// strengths"]}),(0,b.jsxs)("span",{className:"audit-sec-meta",children:[a.length," standouts"]})]}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"what it's great at"}),(0,b.jsx)("div",{className:"strength-list",children:a.map((a,c)=>(0,b.jsxs)("div",{className:"strength-row",children:[(0,b.jsx)("span",{className:"strength-check","aria-hidden":"true",children:"✓"}),(0,b.jsxs)("span",{className:"strength-body",children:[(0,b.jsx)("span",{className:"strength-headline",children:a.headline}),(0,b.jsx)("span",{className:"strength-detail",children:a.detail})]}),(0,b.jsxs)("span",{className:"strength-metric",children:[a.metric,a.unit&&(0,b.jsx)("span",{className:"unit",children:a.unit})]})]},c))})]})}function P({findings:a}){return 0===a.length?null:(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"03 Quirks",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"03"}),"// quirks"]}),(0,b.jsxs)("span",{className:"audit-sec-meta",children:[a.length," slipped through"]})]}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"what to improve"}),(0,b.jsxs)("div",{className:"quirks-table",children:[(0,b.jsxs)("div",{className:"quirks-thead",children:[(0,b.jsx)("span",{children:"when"}),(0,b.jsx)("span",{children:"what slipped"}),(0,b.jsx)("span",{children:"severity"}),(0,b.jsx)("span",{children:"seen"})]}),a.map(a=>{var c,d;let e=(c=a.count)>=6?"high":c>=2?"medium":"low";return(0,b.jsxs)("div",{className:"quirks-row",children:[(0,b.jsx)("span",{className:"q-when",children:a.lastSeen}),(0,b.jsxs)("span",{className:"q-what",children:[(0,b.jsx)("span",{className:"q-title",children:a.title}),(0,b.jsxs)("span",{className:"q-policy",children:["would've been caught by:"," ",(0,b.jsx)("code",{children:a.policy})]})]}),(0,b.jsx)("span",{className:`q-pill q-pill-${e}`,children:e}),(0,b.jsx)("span",{className:"q-recur",children:(d=a.count)<=1?"new":d<10?`${d}\xd7 seen`:"recurring"})]},a.sourceSlug)})]})]})}let Q={"redundant-cd-cwd":"warn-repeated-tool-calls","prefer-edit-over-read-cat":"block-read-outside-cwd","prefer-edit-over-sed-awk":"warn-repeated-tool-calls","prefer-write-over-heredoc":"block-env-files","sleep-polling-loop":"warn-background-process","find-from-root":"block-read-outside-cwd","git-commit-no-verify":"warn-git-amend","reread-after-edit":"warn-repeated-tool-calls"},R={"warn-repeated-tool-calls":"warns when the same tool is called 3+ times with identical parameters.","block-read-outside-cwd":"denies any file read outside the project root, including symlinks.","block-env-files":"blocks reads and writes of .env files at the tool layer.","block-secrets-write":"blocks writes to .pem, id_rsa, credentials.json, and other secret-key files.","warn-background-process":"warns before starting nohup / & / screen / tmux processes.","warn-git-amend":"warns before amending git commits.","require-ci-green-before-stop":"requires CI checks to pass on HEAD before the agent declares the task done."};function S(a){let b=a.indexOf("/");return b>=0?a.slice(b+1):a}function T({result:a,projected:d,projectedGrade:e}){let{capture:f}=(0,A.usePostHog)(),g=(0,c.useMemo)(()=>(function(a){let b=new Set(a.enabledBuiltinNames??[]),c=new Map;for(let d of a.results){let a;if(0!==d.hits){if("audit-detector"===d.source){let b=Q[S(d.name)];if(!b)continue;a=b}else{if("builtin"!==d.source||d.enabledInConfig)continue;a=S(d.name)}b.has(a)||c.set(a,(c.get(a)??0)+d.hits)}}return[...c.entries()].sort((a,b)=>b[1]-a[1]).map(([a,b])=>({name:a,desc:R[a]??"enable this builtin policy to close the gap.",hits:b}))})(a),[a]),h=(0,c.useMemo)(()=>0===g.length?"":1===g.length?`failproofai policy add ${g[0].name}`:`failproofai policy add ${g.map(a=>a.name).join(" ")}`,[g]),[i,j]=(0,c.useState)(!1);if(0===g.length)return null;let k=async()=>{try{await navigator.clipboard.writeText(h),j(!0),f("audit_copy_clicked",{source:"how_to_improve_section_install_all",item_type:"bulk_install_command",policy_count:g.length}),setTimeout(()=>j(!1),1500)}catch{}};return(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"04 How to improve",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"04"}),"// how to improve"]}),(0,b.jsx)("button",{type:"button",className:"install-all-btn",onClick:k,"aria-label":"Copy install-all command",children:i?"copied":"install all"})]}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"install or configure"}),(0,b.jsxs)("div",{className:"audit-sec-sub",children:["enable all ",1===g.length?"one":g.length," → projected"," ",(0,b.jsx)("strong",{children:d})," · ",u[e].toLowerCase()]}),(0,b.jsx)("div",{className:"fix-list",children:g.map((a,c)=>(0,b.jsx)(U,{fix:a,idx:c},a.name))})]})}function U({fix:a,idx:d}){let{capture:e}=(0,A.usePostHog)(),[f,g]=(0,c.useState)(!1),h=`failproofai policy add ${a.name}`,i=async()=>{try{await navigator.clipboard.writeText(h),g(!0),e("audit_copy_clicked",{source:"how_to_improve_section",item_type:"single_policy_install_command",policy_name:a.name,policy_rank:d+1}),setTimeout(()=>g(!1),1500)}catch{}};return(0,b.jsxs)("div",{className:"fix-row",children:[(0,b.jsxs)("div",{className:"fix-row-info",children:[(0,b.jsx)("div",{className:"fix-name",children:a.name}),(0,b.jsx)("div",{className:"fix-desc",children:a.desc})]}),(0,b.jsxs)("div",{className:"fix-row-cmd",children:[(0,b.jsx)("code",{className:"fix-cmd-code",children:h}),(0,b.jsx)("button",{type:"button",className:"copy-icon-btn",onClick:i,"aria-label":`Copy install command for ${a.name}`,children:f?"✓":(0,b.jsxs)("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:[(0,b.jsx)("rect",{x:"3",y:"3",width:"9",height:"11",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),(0,b.jsx)("rect",{x:"5.5",y:"0.5",width:"9",height:"11",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})})]})]})}function V(a,b={},c=15e3){let d=AbortSignal.timeout(c),e=b.signal?AbortSignal.any([b.signal,d]):d;return fetch(a,{...b,signal:e})}function W(a){if(null===a||"object"!=typeof a)return!1;let b=a.name;return"AbortError"===b||"TimeoutError"===b}let X=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Y(a){if(W(a))return"request timed out. check your network and try again.";let b=a instanceof Error?a.message:String(a);return`network error: ${b}`}function Z({open:a,headline:d="where to route the reminder?",onClose:e,onAuthed:f,source:g="unknown"}){let{capture:h}=(0,A.usePostHog)(),[i,j]=(0,c.useState)({kind:"email",error:null}),[k,l]=(0,c.useState)(!1),m=(0,c.useRef)(!1),n=(0,c.useRef)(null),o=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&(j({kind:"email",error:null}),l(!1),m.current=!1,h("audit_auth_dialog_opened",{source:g}))},[h,a,g]);let p=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(a){p.current=!0;return}p.current&&!m.current&&h("audit_auth_dialog_dismissed",{source:g,step:i.kind}),p.current=!1},[h,a,g,i.kind]),(0,c.useEffect)(()=>{if(!a)return;let b=setTimeout(()=>{"email"===i.kind?n.current?.focus():"code"===i.kind&&o.current?.focus()},50);return()=>clearTimeout(b)},[a,i.kind]),(0,c.useEffect)(()=>{if(!a)return;let b=a=>{"Escape"!==a.key||k||e()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[a,k,e]);let q="code"===i.kind&&i.resendIn>0;(0,c.useEffect)(()=>{if(!q)return;let a=setInterval(()=>{j(a=>"code"===a.kind?{...a,resendIn:Math.max(0,a.resendIn-1)}:a)},1e3);return()=>clearInterval(a)},[q]);let r=(0,c.useCallback)(async(a,b={})=>{let{isResend:c=!1}=b,d=a=>{c?j(b=>"code"===b.kind?{...b,error:a}:b):j({kind:"email",error:a})};l(!0);try{let b=await V("/api/auth/login-request",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:a})}),c=await b.json().catch(()=>({}));if(!b.ok){let a=c.message??"could not send code.";"rate_limited"===c.code&&void 0!==c.retry_after_secs?a=`too many tries. wait ${c.retry_after_secs}s and try again.`:"upstream_unreachable"===c.code&&(a="api-server unreachable. check your network."),d(a);return}j({kind:"code",email:a,error:null,expiresIn:c.expires_in??600,resendIn:c.resend_available_in??30})}catch(a){d(Y(a))}finally{l(!1)}},[]),s=(0,c.useCallback)(async(a,b)=>{l(!0);try{let c=await V("/api/auth/login-verify",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:a,code:b})}),d=await c.json().catch(()=>({}));if(!c.ok||!d.authenticated||!d.user){let a=d.message??"invalid code.";"invalid_code"===d.code&&(a="wrong code, or it expired. try again."),j(b=>"code"===b.kind?{...b,error:a}:b);return}m.current=!0,h("audit_auth_dialog_succeeded",{source:g}),j({kind:"done",user:d.user}),f(d.user)}catch(b){let a=Y(b);j(b=>"code"===b.kind?{...b,error:a}:b)}finally{l(!1)}},[h,f,g]),t=(0,c.useCallback)(async a=>{if(a.preventDefault(),k||"email"!==i.kind)return;let b=String(new FormData(a.currentTarget).get("email")??"").trim().toLowerCase();X.test(b)?await r(b):j({kind:"email",error:"that doesn't look like an email."})},[k,i,r]),u=(0,c.useCallback)(async a=>{if(a.preventDefault(),k||"code"!==i.kind)return;let b=String(new FormData(a.currentTarget).get("code")??"").trim();b.length<4||b.length>12?j(a=>"code"===a.kind?{...a,error:"code is 4–12 characters."}:a):await s(i.email,b)},[k,i,s]),v=(0,c.useCallback)(async()=>{"code"!==i.kind||i.resendIn>0||k||await r(i.email,{isResend:!0})},[i,k,r]);return a?(0,b.jsx)("div",{className:"auth-dialog-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"auth-dialog-title",onClick:a=>{k||a.target!==a.currentTarget||e()},children:(0,b.jsxs)("div",{className:"auth-dialog",children:[(0,b.jsx)("button",{type:"button",className:"auth-close",onClick:e,disabled:k,"aria-label":"close",children:"×"}),(0,b.jsx)("h2",{id:"auth-dialog-title",className:"auth-headline",children:d}),"email"===i.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"auth-sub",children:"we'll send a one-time code to confirm."}),(0,b.jsxs)("form",{onSubmit:t,className:"auth-form",children:[(0,b.jsx)("input",{ref:n,id:"auth-dialog-email",name:"email",type:"email",autoComplete:"email",inputMode:"email",spellCheck:!1,placeholder:"you@yourdomain.com",disabled:k,className:"auth-input",required:!0}),i.error&&(0,b.jsx)("div",{className:"auth-error",children:i.error}),(0,b.jsxs)("div",{className:"auth-actions",children:[(0,b.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:k,children:k?"sending…":"send code"}),(0,b.jsx)("button",{type:"button",className:"auth-btn",onClick:e,disabled:k,children:"cancel"})]})]})]}),"code"===i.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"auth-sub",children:["code sent to ",(0,b.jsx)("span",{className:"auth-email",children:i.email}),". expires in ",Math.ceil(i.expiresIn/60)," min."]}),(0,b.jsxs)("form",{onSubmit:u,className:"auth-form",children:[(0,b.jsx)("input",{ref:o,id:"auth-dialog-code",name:"code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",spellCheck:!1,placeholder:"123456",disabled:k,className:"auth-input auth-input-code",maxLength:12,required:!0}),i.error&&(0,b.jsx)("div",{className:"auth-error",children:i.error}),(0,b.jsxs)("div",{className:"auth-actions",children:[(0,b.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:k,children:k?"verifying…":"verify"}),(0,b.jsx)("button",{type:"button",className:"auth-btn",onClick:v,disabled:k||i.resendIn>0,children:i.resendIn>0?`resend in ${i.resendIn}s`:"resend code"})]}),(0,b.jsx)("button",{type:"button",className:"auth-back",onClick:()=>j({kind:"email",error:null}),disabled:k,children:"← use a different email"})]})]}),"done"===i.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"auth-sub",children:[(0,b.jsx)("span",{className:"auth-ok",children:"✓"})," signed in as"," ",(0,b.jsx)("span",{className:"auth-email",children:i.user.email}),"."]}),(0,b.jsx)("div",{className:"auth-actions",children:(0,b.jsx)("button",{type:"button",className:"auth-btn primary",onClick:e,children:"continue"})})]})]})}):null}let $=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function _({open:a,onClose:d,source:e,onUnauthorized:f}){let{capture:g}=(0,A.usePostHog)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(null),n=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&(i(""),k(!1),m(null),g("audit_invite_dialog_opened",{source:e}))},[g,a,e]),(0,c.useEffect)(()=>{if(!a)return;let b=setTimeout(()=>n.current?.focus(),50);return()=>clearTimeout(b)},[a]),(0,c.useEffect)(()=>{if(!a)return;let b=a=>{"Escape"!==a.key||j||d()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[a,j,d]);let{valid:o,invalid:p}=(0,c.useMemo)(()=>(function(a){let b=a.split(/[\s,;]+/).map(a=>a.trim().toLowerCase()).filter(Boolean),c=[],d=[],e=new Set;for(let a of b)e.has(a)||(e.add(a),$.test(a)?c.push(a):d.push(a));return{valid:c,invalid:d}})(h),[h]),q=(0,c.useCallback)(async a=>{if(a.preventDefault(),!j){if(0===o.length)return void m("add at least one valid email address.");if(o.length>10)return void m("up to 10 emails at a time. send the rest in a follow-up.");k(!0),m(null),g("audit_invite_submitted",{source:e,recipient_count:o.length,had_invalid:p.length>0});try{let a=await fetch("/api/audit/invite",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({to:o})}),b=await a.json().catch(()=>({}));if(401===a.status)return void(f?(d(),f()):m("session expired. please sign in again."));if(!a.ok){let a=b.message??"couldn't send invites.";m(a);return}let c=b.sent?.length??0,e=b.failed?.length??0;(0,G.toast)(e>0?`📨 sent ${c}, ${e} bounced — copy the bounce and try again.`:`📨 sent ${c} ${1===c?"invite":"invites"}. thanks for spreading the word.`),d()}catch(b){let a=b instanceof Error?b.message:String(b);m(`network error: ${a}`)}finally{k(!1)}}},[j,o,p,g,e,d,f]);return a?(0,b.jsx)("div",{className:"auth-dialog-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"invite-dialog-title",onClick:a=>{j||a.target!==a.currentTarget||d()},children:(0,b.jsxs)("div",{className:"auth-dialog",children:[(0,b.jsx)("button",{type:"button",className:"auth-close",onClick:d,disabled:j,"aria-label":"close",children:"×"}),(0,b.jsx)("h2",{id:"invite-dialog-title",className:"auth-headline",children:"invite friends to audit theirs"}),(0,b.jsx)("p",{className:"auth-sub",children:"paste emails separated by commas, spaces, or newlines. you'll be Cc'd on every invite so they know it's from you."}),(0,b.jsxs)("form",{onSubmit:q,className:"auth-form",children:[(0,b.jsx)("textarea",{ref:n,name:"emails",placeholder:"alice@x.com, bob@y.com carol@z.com",disabled:j,className:"auth-input invite-textarea",value:h,onChange:a=>i(a.target.value),rows:4,required:!0}),(0,b.jsxs)("div",{className:"invite-summary",children:[o.length>0&&(0,b.jsxs)("span",{className:"invite-valid",children:[o.length," valid"]}),p.length>0&&(0,b.jsxs)("span",{className:"invite-invalid",children:[p.length," invalid: ",p.slice(0,3).join(", "),p.length>3?`, +${p.length-3} more`:""]}),o.length>10&&(0,b.jsxs)("span",{className:"invite-invalid",children:["only ",10," per send — first ",10," will go."]})]}),l&&(0,b.jsx)("div",{className:"auth-error",children:l}),(0,b.jsxs)("div",{className:"auth-actions",children:[(0,b.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:j||0===o.length,children:j?"sending…":`send ${o.length||""} invite${1===o.length?"":"s"}`.trim()}),(0,b.jsx)("button",{type:"button",className:"auth-btn",onClick:d,disabled:j,children:"cancel"})]})]})]})}):null}let aa=[3,7,14,30];function ab({isRunning:a,onRerun:d}){let{capture:e}=(0,A.usePostHog)(),[f,g]=(0,c.useState)({kind:"unknown"}),[h,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(7),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(!1),s=(0,c.useRef)(0),t=(0,c.useCallback)(async()=>{s.current=Date.now();let a=()=>{g(a=>"unknown"===a.kind?{kind:"anon"}:a)};try{let b=await fetch("/api/auth/status",{cache:"no-store"});if(!b.ok)return void a();let c=await b.json();c.authenticated&&c.user?(g({kind:"authed",user:c.user}),i(c.reminder??null)):(g({kind:"anon"}),i(null))}catch{a()}},[]);(0,c.useEffect)(()=>{t();let a=()=>{Date.now()-s.current<5e3||t()},b=()=>a(),c=()=>{"visible"===document.visibilityState&&a()};return window.addEventListener("focus",b),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("focus",b),document.removeEventListener("visibilitychange",c)}},[t]),(0,c.useEffect)(()=>{r.current||"unknown"!==f.kind&&(r.current=!0,e("audit_reminder_cta_shown",{auth_state:f.kind,has_existing_reminder:null!==h,source:"come_back_better_section"}))},[f,e,h]);let u=(0,c.useCallback)(async a=>{let b=new AbortController,c=setTimeout(()=>b.abort(),1e4);try{q(!0);let c=await fetch("/api/auth/reminder",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({in_days:a}),signal:b.signal});if(!c.ok)return 401===c.status&&(g({kind:"anon"}),i(null)),e("audit_reminder_saved",{status:`http_${c.status}`,source:"come_back_better_section",cadence_days:a}),null;let d=await c.json();return e("audit_reminder_saved",{status:d.reminder?"success":"empty",source:"come_back_better_section",cadence_days:a}),d.reminder??null}catch(b){return e("audit_reminder_saved",{status:W(b)?"timeout":"error",source:"come_back_better_section",cadence_days:a}),null}finally{clearTimeout(c),q(!1)}},[e]),v=(0,c.useCallback)(async a=>{if(k(a),e("audit_reminder_cta_clicked",{auth_state:f.kind,has_existing_reminder:null!==h,cadence_days:a,source:"come_back_better_section"}),"authed"===f.kind){let b=await u(a);b&&i(b);return}"anon"===f.kind&&m(!0)},[f,e,u,h]),w=(0,c.useCallback)(async a=>{g({kind:"authed",user:a}),e("audit_auth_completed",{source:"come_back_better_section"});let b=await u(j);b&&i(b)},[j,e,u]),x=(0,c.useCallback)(()=>{(e("audit_perks_invite_clicked",{source:"come_back_better_section",auth_state:f.kind}),"authed"!==f.kind)?m(!0):o(!0)},[f.kind,e]),y=(0,c.useCallback)(()=>{a||d()},[a,d]),z=h?Math.max(0,Math.ceil((h.next_audit_at-Math.floor(Date.now()/1e3))/86400)):0;return(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"05 Come back better",children:[(0,b.jsx)("div",{className:"audit-sec-head",children:(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"05"}),"// come back better"]})}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"build the habit"}),(0,b.jsxs)("div",{className:"cbb-grid",children:[(0,b.jsxs)("div",{className:"cbb-card",children:[(0,b.jsx)("div",{className:"cbb-card-title",children:"set a reminder"}),(0,b.jsx)("div",{className:"cbb-card-sub",children:h?`next audit set for ${new Date(1e3*h.next_audit_at).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})} \xb7 in ${z} day${1===z?"":"s"}.`:"we'll nudge you when your next audit is due. pick the cadence:"}),(0,b.jsx)("div",{className:"cadence-row",children:aa.map(a=>(0,b.jsxs)("button",{type:"button",className:`cadence-btn${j===a?" on":""}`,disabled:p||"unknown"===f.kind,onClick:()=>void v(a),children:[a,"d"]},a))}),(0,b.jsx)("button",{type:"button",className:"cbb-link",disabled:a,onClick:y,children:a?"scanning…":"or re-audit now →"})]}),(0,b.jsxs)("div",{className:"cbb-card",children:[(0,b.jsx)("div",{className:"cbb-card-title",children:"unlock failproof perks"}),(0,b.jsx)("div",{className:"cbb-card-sub",children:"share with 3 friends → unlock pro features for a month."}),(0,b.jsx)("button",{type:"button",className:"invite-btn",onClick:x,children:"invite a friend"}),(0,b.jsx)("div",{className:"cbb-foot",children:"// invites are sent from failproof.ai, Cc'd to you, with a link to run their own audit."})]})]}),(0,b.jsx)(_,{open:n,source:"come_back_better_section",onClose:()=>o(!1),onUnauthorized:()=>{g({kind:"anon"}),i(null),m(!0)}}),(0,b.jsx)(Z,{open:l,source:"return_section",onClose:()=>m(!1),onAuthed:a=>{m(!1),w(a)}})]})}function ac({cachedAt:a,fixed:c=!1}){return(0,b.jsxs)("footer",{className:c?"report-footer report-footer--fixed":"report-footer",children:[(0,b.jsx)("img",{src:"/logo.svg",alt:"failproof_ai",style:{height:18,display:"inline-block",verticalAlign:"middle"}}),(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),"audit v1.0",(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),"generated ",function(a){if(!a)return"—";let b=new Date(a);if(Number.isNaN(b.getTime()))return"—";let c=b.getUTCDate().toString().padStart(2,"0"),d=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"][b.getUTCMonth()],e=b.getUTCFullYear(),f=b.getUTCHours().toString().padStart(2,"0"),g=b.getUTCMinutes().toString().padStart(2,"0");return`${c} ${d} ${e}, ${f}:${g} utc`}(a),(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),(0,b.jsx)("span",{style:{color:"var(--ink-2)"},children:"auto-healing for your agents."})]})}class ad extends Error{kind;constructor(a,b){super(b),this.kind=a,this.name="RerunError"}}async function ae(a){try{let b=await V("/api/audit/run",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({cli:a.cli.length>0?a.cli:void 0,since:"all"===a.since?void 0:a.since,noCache:!!a.noCache||void 0})});if(!b.ok&&409!==b.status){let a=await b.text().catch(()=>"");throw console.error("audit run failed:",b.status,a),new ad("post_failed",`audit run failed (${b.status})`)}}catch(a){if(a instanceof ad)throw a;throw console.error("audit run request failed:",a),new ad(W(a)?"timeout":"network","audit run request failed")}let b=0;for(;;){await new Promise(a=>setTimeout(a,1e3));let a=null;try{let b=await V("/api/audit/status",{cache:"no-store"});b.ok&&(a=await b.json())}catch{}if(null===a){if(++b>=10)throw new ad("network","audit status poll lost the server");continue}if(b=0,!a.running){if(a.error)throw new ad("post_failed",a.error);return}}}function af({mode:a,running:c,onStarted:d,onCompleted:e}){let{capture:f}=(0,A.usePostHog)(),g=async()=>{f("audit_first_run_clicked",{source:"empty_state",mode:a}),d();try{await ae({cli:[],since:"all"})}catch(a){console.error("audit first run failed:",a)}finally{await e()}};return"no-cache"===a?(0,b.jsxs)("section",{className:"section empty-section","data-screen-label":"00 Empty",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"·"})," first run"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"○"})," no cache yet"]})]}),(0,b.jsx)("h2",{className:"section-h",children:"scan and see."}),(0,b.jsxs)("div",{className:"panel empty-panel",children:[(0,b.jsxs)("div",{className:"empty-glyph","aria-hidden":"true",children:[(0,b.jsx)("div",{className:"empty-glyph-grid",children:Array.from({length:36}).map((a,c)=>{let d=["1","5","8","10","13","17","20","23","25","30","32"].includes(String(c));return(0,b.jsx)("span",{className:"px"+(d?" on":"")},c)})}),(0,b.jsx)("div",{className:"empty-glyph-label",children:"▮▮ no audit data yet"})]}),(0,b.jsx)("h3",{className:"empty-headline",children:"run your first audit."}),(0,b.jsx)("p",{className:"empty-sub",children:"we'll walk every transcript across your installed CLIs — Claude Code, Codex, Copilot, Cursor, OpenCode, Pi, Gemini — and count every wasteful or risky action. you'll get a tier, a score, and a punch-list."}),(0,b.jsxs)("div",{className:"empty-actions",children:[(0,b.jsx)("button",{type:"button",className:"btn btn-primary btn-press empty-cta",onClick:g,disabled:c,children:c?"[ scanning… ]":"[ run audit ]"}),(0,b.jsx)("span",{className:"empty-meta",children:"scans all sessions · all installed CLIs · may take a while"})]})]})]}):(0,b.jsxs)("section",{className:"section empty-section","data-screen-label":"00 Empty",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"·"})," zero transcripts"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--amber)"},children:"●"})," hooks not installed"]})]}),(0,b.jsx)("h2",{className:"section-h",children:"nothing to read."}),(0,b.jsxs)("div",{className:"panel empty-panel",children:[(0,b.jsxs)("div",{className:"empty-glyph","aria-hidden":"true",children:[(0,b.jsx)("div",{className:"empty-glyph-grid",children:Array.from({length:36}).map((a,c)=>{let d=["2","4","9","11","16","18","23","25","27","30","33"].includes(String(c));return(0,b.jsx)("span",{className:"px"+(d?" on":"")},c)})}),(0,b.jsx)("div",{className:"empty-glyph-label",children:"▮▮ no sessions found"})]}),(0,b.jsx)("h3",{className:"empty-headline",children:"install hooks first."}),(0,b.jsx)("p",{className:"empty-sub",children:"failproofai couldn't find any transcripts to scan on this machine. install the hooks for at least one CLI and come back."}),(0,b.jsxs)("div",{className:"empty-actions",children:[(0,b.jsx)("a",{href:"https://docs.befailproof.ai/getting-started",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-press empty-cta",onClick:()=>{f("audit_install_guide_clicked",{source:"empty_state",mode:a})},children:"[ install guide → ]"}),(0,b.jsx)("span",{className:"empty-meta",children:"takes about 30 seconds · one command per CLI"})]})]})]})}let ag=[{label:"discovering transcripts",detail:"walking ~/.claude, ~/.codex, ~/.cursor, …"},{label:"parsing session logs",detail:"reading JSONL + sqlite session stores"},{label:"running policy checks",detail:"replaying through 30 builtin policies"},{label:"aggregating results",detail:"counting hits, ranking by frequency"}];function ah(){let[a,d]=(0,c.useState)(0),[e,f]=(0,c.useState)(0);(0,c.useEffect)(()=>{let a=setInterval(()=>{d(a=>Math.min(a+1,ag.length-1))},4e3),b=setInterval(()=>f(a=>(a+1)%4),350);return()=>{clearInterval(a),clearInterval(b)}},[]);let g=".".repeat(e+1),h=a===ag.length-1,i=Math.round(100*Math.min(.9,(a+1)/ag.length*.9));return(0,b.jsxs)("section",{className:"section running-section","data-screen-label":"00 Running",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"·"})," in progress"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--accent-pink)"},children:"●"})," scanning"]})]}),(0,b.jsxs)("h2",{className:"section-h",children:["scanning sessions",g]}),(0,b.jsxs)("div",{className:"panel running-panel",children:[(0,b.jsxs)("div",{className:"running-header",children:[(0,b.jsx)("span",{className:"running-prompt",children:"$"}),(0,b.jsx)("span",{className:"running-cmd",children:"failproofai audit"}),(0,b.jsx)("span",{className:"running-cursor","aria-hidden":"true",children:"▮"})]}),(0,b.jsx)("ul",{className:"running-stages",children:ag.map((c,d)=>{let f=d<a,g=d===a;return(0,b.jsxs)("li",{className:"running-stage"+(f?" done":g?" active":" queued"),children:[(0,b.jsx)("span",{className:"running-marker","aria-hidden":"true",children:f?"✓":g?"▮▮":"○"}),(0,b.jsxs)("div",{className:"running-stage-body",children:[(0,b.jsx)("div",{className:"running-stage-label",children:c.label}),g&&(0,b.jsx)("div",{className:"running-stage-detail",children:h?"finishing up…":c.detail})]}),g&&(0,b.jsx)("span",{className:"running-stage-spin","aria-hidden":"true",children:["⠋","⠙","⠹","⠸"][e]})]},d)})}),(0,b.jsxs)("div",{className:"running-bar-label",children:[(0,b.jsx)("span",{children:"progress"}),(0,b.jsxs)("span",{style:{color:"var(--dim)"},children:[i,"%"]})]}),(0,b.jsx)("div",{className:"running-bar-track",children:(0,b.jsx)("div",{className:"running-bar-fill",style:{width:`${i}%`}})}),(0,b.jsx)("p",{className:"running-foot",children:"this can take a while depending on how much session history you have."})]})]})}let ai={timeout:"audit took too long — try again",network:"network hiccup — check your connection",post_failed:"audit failed — try again"};function aj({status:a,onDismiss:d}){let[e,f]=(0,c.useState)(()=>Date.now());if((0,c.useEffect)(()=>{if("running"!==a.kind)return;let b=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(b)},[a.kind]),"idle"===a.kind)return null;if("running"===a.kind){let c=Math.max(0,e-a.startedAt);return(0,b.jsxs)("div",{className:"audit-progress-strip",role:"status","aria-live":"polite",children:[(0,b.jsxs)("div",{className:"audit-progress-strip__inner",children:[(0,b.jsxs)("span",{className:"audit-progress-strip__label",children:[(0,b.jsx)("span",{className:"audit-progress-strip__spinner","aria-hidden":"true"}),"re-auditing your sessions"]}),(0,b.jsx)("span",{className:"audit-progress-strip__elapsed",children:function(a){if(a<0)return"00:00";let b=Math.floor(a/1e3),c=Math.floor(b/60).toString().padStart(2,"0"),d=(b%60).toString().padStart(2,"0");return`${c}:${d}`}(c)})]}),(0,b.jsx)("div",{className:"audit-progress-strip__pulse","aria-hidden":"true"})]})}return(0,b.jsx)("div",{className:"audit-progress-strip audit-progress-strip--failed",role:"alert",children:(0,b.jsxs)("div",{className:"audit-progress-strip__inner",children:[(0,b.jsxs)("span",{className:"audit-progress-strip__label",children:[(0,b.jsx)("span",{className:"audit-progress-strip__x","aria-hidden":"true",children:"×"}),ai[a.reason]]}),(0,b.jsx)("button",{type:"button",className:"audit-progress-strip__dismiss",onClick:d,"aria-label":"dismiss",children:"[ dismiss ]"})]})})}function ak({result:a,cachedAt:d,projectFromUrl:e,isRunning:l,rerunStatus:o,onRerun:p,onDismissRerun:r}){let{capture:u}=(0,A.usePostHog)(),v=(0,c.useMemo)(()=>(function(a,b){if(b&&b.trim())return b;let c=new Map;for(let b of a.results)for(let a of b.examples)a.cwd&&c.set(a.cwd,(c.get(a.cwd)??0)+1);let d="",e=0;for(let[a,b]of c)b>e&&(d=a,e=b);if(!d)return"your agent";let f=d.replace(/\/+$/,"").split(/[\\/]/);return f.length>=2?`${f[f.length-2]} / ${f[f.length-1]}`:f[f.length-1]??"your agent"})(a,e),[a,e]),B=(0,c.useMemo)(()=>(function(a,b=""){let c=function(a,b=""){let c=Math.max(a.eventsScanned??0,50),d=a.transcripts.scanned,e=a.totals?.hits??function(a){let b=0;for(let c of a.results)b+=c.hits;return b}(a),h=k(),l=0;for(let b of a.results){let a=function(a){let b=a.indexOf("/");return b>=0?a.slice(b+1):a}(b.name),c=j[a];if(!c)continue;let d=b.hits*c.weight;h[c.archetype]+=d,i.has(a)&&(l+=d)}let n=g.reduce((a,b)=>a+h[b],0),o=k();for(let a of g){let b=n>0?h[a]/n:0;o[a]=m[a]>0?b/m[a]:0}let p=g.map(a=>o[a]),q=function(a){let b=a.reduce((a,b)=>a+Math.max(0,b),0);if(b<=0)return 0;let c=0;for(let d of a){if(d<=0)continue;let a=d/b;c-=a*Math.log(a)}return c/Math.log(a.length)}(p),r=[...p].sort((a,b)=>b-a)[1]??0,s=n>0?l/n:0,t=e/c,u=g.map(a=>Math.round(10*h[a])).join(","),v=f(`${b}|${u}|${Math.round(1e3*t)}`);return{events:c,sessions:d,totalHits:e,faultRate:t,clusterRaw:h,totalSignal:n,clusterLift:o,entropy:q,secondLift:r,cautionShare:s,cowboyLift:o.cowboy,fingerprint:v}}(a,b),d={weights:c.clusterRaw,lift:c.clusterLift,totalSignal:c.totalSignal,variantSeed:`${b}|${c.fingerprint}`};if(c.totalSignal<2.5||c.faultRate<.003&&c.totalSignal<6)return{archetype:"precision",secondary:n.precision.secondary,...d};if(c.cautionShare>=.35&&c.cowboyLift<1)return{archetype:"architect",secondary:n.architect.secondary,...d};if(g.filter(a=>c.clusterLift[a]>0).length>=4&&c.entropy>.7&&c.secondLift>=1.3)return{archetype:"goldfish",secondary:q(c,g)[0],...d};let e=q(c,h),l=e[0],o=e[1];o&&c.clusterLift[o]>0&&c.clusterLift[l]/c.clusterLift[o]<1.08&&(l=[e[0],e[1]][c.fingerprint%2]);let p=q(c,h).find(a=>a!==l),r=p&&c.clusterLift[p]>0&&c.clusterLift[p]>=.4*c.clusterLift[l]?p:n[l].secondary;return{archetype:l,secondary:r,...d}})(a,v),[a,v]),C=(0,c.useMemo)(()=>Math.round(function(a){if(0===a.transcripts.scanned)return 0;let b=a.eventsScanned??0;return Math.max(0,Math.min(100,100-w(a.results,b)+Math.min(+s(a).length,5)))}(a)),[a]),D=(0,c.useMemo)(()=>{let b,c;return b=a.eventsScanned??0,c=Math.min(92,C+Math.round(Math.max(0,w(a.results,b)-w(a.results.filter(a=>!("builtin"===a.source&&!a.enabledInConfig)),b)))),Math.max(C,c)},[a,C]),E=t(C),F=t(D),G=(0,c.useMemo)(()=>s(a),[a]),H=(0,c.useMemo)(()=>{let b,c;return b=[...a.results].filter(a=>a.hits>0).sort((a,b)=>b.hits-a.hits),c=new Set(a.enabledBuiltinNames??[]),b.map((a,b)=>{var d,e,f,g;let h,i,j,k,l,m,n,o,p,q;return d=a,e=b,f=c,i=(h=(g=d.name).indexOf("/"))>=0?g.slice(h+1):g,j="audit-detector"===d.source?x[i]:void 0,l=z[k=j?.primary??i],m=l?.impact??d.impact??d.displayTitle,n=j?.also,o=f.has(k)||"builtin"===d.source&&d.enabledInConfig,p=y[i],0===(q=d.examples.slice(0,4).map(a=>({text:a.example,kind:"cmd"}))).length&&q.push({text:"no example commands captured.",kind:"comment"}),{num:String(e+1).padStart(2,"0"),title:d.displayTitle.toLowerCase(),count:d.hits,sourceSlug:i,policy:k,projects:d.projects,lastSeen:function(a){if(!a)return"—";let b=Date.now()-new Date(a).getTime();if(Number.isNaN(b)||b<0)return"—";let c=Math.floor(b/6e4);if(c<60)return`${Math.max(1,c)}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);if(e<30)return`${e}d ago`;let f=Math.floor(e/30);return`${f}mo ago`}(d.lastSeen),body:p?.body??d.impact??d.displayTitle,cost:p?.cost??d.impact??"see policy description above.",evidence:q,fix:{slug:k,desc:m,install:`failproofai policy add ${k}`,alsoCoveredBy:n},alreadyEnabled:o}})},[a]),{detectorsTriggered:I,missing:J}=(0,c.useMemo)(()=>{let b=0,c=0;for(let d of a.results)d.hits>0&&b++,"builtin"===d.source&&!d.enabledInConfig&&d.hits>0&&c++;return{detectorsTriggered:b,missing:c}},[a]),K=(0,c.useRef)(!1);(0,c.useEffect)(()=>{K.current||(K.current=!0,u("audit_dashboard_viewed",{score:C,grade:E,archetype:B.archetype,secondary:B.secondary??null,missing:J,transcripts_scanned:a.transcripts.scanned,results_count:a.results.length,detectors_triggered:I}))},[u,C,E,B.archetype,B.secondary,J,a.transcripts.scanned,a.results.length,I]);let L=(0,c.useRef)(null);return(0,b.jsxs)("div",{className:"app",children:[(0,b.jsx)(aj,{status:o,onDismiss:r}),(0,b.jsxs)("div",{className:"app-shell",children:[(0,b.jsxs)("div",{className:"report",children:[(0,b.jsx)(N,{ref:L,archetypeKey:B.archetype,seed:B.variantSeed,score:C,grade:E,missing:J,auditedAt:d??new Date().toISOString()}),(0,b.jsx)(O,{strengths:G}),(0,b.jsx)(P,{findings:H}),(0,b.jsx)(T,{result:a,projected:D,projectedGrade:F}),(0,b.jsx)(ab,{isRunning:l,onRerun:()=>p("return_section")})]}),(0,b.jsx)(ac,{cachedAt:d})]})]})}function al({running:a,mode:c="no-cache",rerunStatus:d,onDismissRerun:e,onStarted:f,onCompleted:g}){return(0,b.jsxs)("div",{className:"app",children:[(0,b.jsx)(aj,{status:d,onDismiss:e}),(0,b.jsxs)("div",{className:"app-shell",children:[(0,b.jsx)("div",{className:"report",children:a?(0,b.jsx)(ah,{}):(0,b.jsx)(af,{mode:c,running:a,onStarted:f,onCompleted:g})}),(0,b.jsx)(ac,{cachedAt:null,fixed:!0})]})]})}a.s(["AuditDashboard",0,function({initial:a,projectFromUrl:d,totalCatalogSize:f}){let[g,h]=(0,c.useState)(a),[i,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)({kind:"idle"}),{capture:m}=(0,A.usePostHog)(),n=(0,c.useRef)(null),o=(0,c.useRef)(!1),p="cached"===g.status?g.result.transcripts.scanned:0,q="cached"===g.status?g.result.results.length:0,r=(0,c.useCallback)(async()=>{h(await e())},[]),s=(0,c.useCallback)(async a=>{if(!i){m("audit_rerun_clicked",{source:a,since:"all"}),j(!0),l({kind:"running",startedAt:Date.now()});try{await ae({cli:[],since:"all",noCache:!0}),await r(),l({kind:"idle"})}catch(c){let b=c instanceof ad?c.kind:"network";m("audit_rerun_failed",{kind:b,source:a,since:"all",cli_filter:"all"}),l({kind:"failed",reason:b,failedAt:Date.now()})}finally{j(!1)}}},[m,r,i]),t=(0,c.useCallback)(()=>{l({kind:"idle"})},[]);if((0,c.useEffect)(()=>(document.body.classList.add("audit-body"),()=>document.body.classList.remove("audit-body")),[]),(0,c.useEffect)(()=>{let a=i?"running":"empty"===g.status?"empty":0===p?"zero_sessions":"report";n.current!==a&&(n.current=a,m("audit_page_viewed",{state:a,has_cache:"cached"===g.status}))},[g.status,m,i,p]),(0,c.useEffect)(()=>{o.current=!1},[g.status,i,p]),(0,c.useEffect)(()=>{if(i||"cached"!==g.status||0===p)return;let a=0,b=()=>{if(a=0,o.current)return;let b=document.documentElement.scrollHeight-window.innerHeight;b<=0||window.scrollY>=b-24&&(o.current=!0,m("audit_page_scrolled_to_end",{results_count:q,transcripts_scanned:p}))},c=()=>{0===a&&(a=requestAnimationFrame(b))};return b(),window.addEventListener("scroll",c,{passive:!0}),()=>{window.removeEventListener("scroll",c),0!==a&&cancelAnimationFrame(a)}},[g.status,m,q,i,p]),"empty"===g.status&&!i)return(0,b.jsx)(al,{running:!1,rerunStatus:k,onDismissRerun:t,onStarted:()=>j(!0),onCompleted:async()=>{j(!1),await r()}});if("empty"===g.status&&i)return(0,b.jsx)(al,{running:!0,rerunStatus:k,onDismissRerun:t,onStarted:()=>{},onCompleted:async()=>{j(!1),await r()}});let u="cached"===g.status?g.result:null;if(!u)return null;let v="cached"===g.status?g.cachedAt:null;return("cached"===g.status&&g.params,0===u.transcripts.scanned)?(0,b.jsx)(al,{running:i,mode:"zero-sessions",rerunStatus:k,onDismissRerun:t,onStarted:()=>j(!0),onCompleted:async()=>{j(!1),await r()}}):(0,b.jsx)(ak,{result:u,cachedAt:v,projectFromUrl:d,isRunning:i,rerunStatus:k,onRerun:a=>s(a),onDismissRerun:t})}],80311)}];
41
+ Ran a quick audit and it came back ${b}, scored ${a}/100. The whole read is based on how the agent handles things going wrong, which is where its real character shows.
42
+
43
+ 30 seconds, nothing leaves your machine: ${J}`,({score:a,arch:b})=>`My AI coding agent scored ${a}/100 today. I didn't know you could even measure that.
44
+
45
+ The same audit also handed it a personality: ${b}.
46
+
47
+ It reads the agent's real history and tells you where it's solid and where it slips. Took 30 seconds and ran fully locally: ${J}`,({score:a,arch:b})=>`I'm usually the first to scroll past "audit your X" tools. This one took 30 seconds and actually told me something.
48
+
49
+ My coding agent is ${b}, and it scored ${a}/100.
50
+
51
+ It reads the agent's real run history rather than asking me anything, and none of it leaves the machine: ${J}`,({score:a,arch:b})=>`What is your coding agent's personality? I realized today that I had no answer.
52
+
53
+ So I checked. Mine is ${b}, scored ${a}/100, with a clear read on where it shines and where it slips.
54
+
55
+ If you work with agents, run it and drop yours in the comments. 30 seconds, fully local: ${J}`,({score:a,arch:b})=>`I trusted my coding agent a little less after this morning, and quite a bit more by the afternoon.
56
+
57
+ I ran an audit on it. It showed me exactly where it's reliable and where it isn't, gave it a personality (${b}), and scored it ${a}/100.
58
+
59
+ Knowing the gaps is what made me trust it more. 30 seconds, all local: ${J}`,({score:a,arch:b})=>`I almost skipped this because I assumed it would quietly ship my code off somewhere. It doesn't. Everything runs locally.
60
+
61
+ 30 seconds later I had my agent's personality (${b}) and a quality score (${a}/100).
62
+
63
+ If privacy is usually what stops you from trying these, this one is different: ${J}`,({score:a,arch:b})=>`Found out my AI coding agent has a personality type. Found out it's ${b}. Found out that explains a lot.
64
+
65
+ It scored ${a}/100 too. The audit reads how the agent handles failures, not just the runs where everything goes fine.
66
+
67
+ 30 seconds, runs locally: ${J}`];function M(a,b,c){let d=a[function(a){let b=5381;for(let c=0;c<a.length;c++)b=(b<<5)+b+a.charCodeAt(c)|0;return b>>>0}(b)%a.length](c);return`${d}
68
+
69
+ [ audit card copied to your clipboard — paste it into the post ]`}let N=(0,c.forwardRef)(function({archetypeKey:d,seed:e,score:g,grade:h,missing:i,auditedAt:j},k){let l=(0,c.useMemo)(()=>{let a,b;return a=n[d],b=f(e||d),{key:a.key,index:a.index,name:a.name,secondary:a.secondary,tagline:p(a.taglines,b,1),keywords:p(a.keywordSets,b,2),description:p(a.descriptions,b,3),signature:p(a.signatures,b,4),common:p(a.commons,b,5),risk:p(a.risks,b,6),closing:p(a.closings,b,7)}},[d,e]),m=B[d],o=String(l.index).padStart(2,"0"),q=(0,c.useMemo)(()=>(function(a){try{let b=new Date(a);if(Number.isNaN(b.getTime()))return a;let c=b.getUTCFullYear(),d=String(b.getUTCMonth()+1).padStart(2,"0"),e=String(b.getUTCDate()).padStart(2,"0");return`${c}-${d}-${e}`}catch{return a}})(j),[j]),{capture:r}=(0,A.usePostHog)(),[s,t]=(0,c.useState)(null),u=async()=>{let b=k?.current;if(!b)return null;"u">typeof document&&document.fonts?.ready&&await document.fonts.ready,await new Promise(a=>requestAnimationFrame(()=>a()));let c=b.getBoundingClientRect(),d=Math.round(c.width),e=Math.round(c.height),f=document.createElement("div");f.style.cssText=`position: fixed;left: -10000px;top: 0;width: ${d}px;height: ${e}px;padding: 0;margin: 0;background: var(--bg);z-index: -1;pointer-events: none`;let g=b.cloneNode(!0);g.style.cssText+=`;width: ${d}px;height: ${e}px;max-width: none;min-width: 0;flex: 0 0 auto;margin: 0`,f.appendChild(g),document.body.appendChild(f);try{let{toBlob:b}=await a.A(3900);return await b(g,{backgroundColor:"#0e0e11",pixelRatio:2,cacheBust:!0,width:d,height:e})}finally{f.remove()}},v=a=>`failproofai-${a}-${h.toLowerCase()}-${g}.png`,w=async a=>{if(!s){t(a),r("audit_card_share_clicked",{channel:a,source:"poster",score:g,grade:h,missing_policies:i});try{let b=await u().catch(()=>null);if(!b){r("audit_card_capture_completed",{trigger:"download"===a?"download":`share_${a}`,status:"error",image_method:"failed",source:"poster"}),(0,G.toast)(F("failed"));return}if("download"===a){let c=E(b,v(a)),d=c?"download":"failed";r("audit_card_capture_completed",{trigger:"download",status:c?"success":"error",image_method:d,source:"poster"}),(0,G.toast)(F(d));return}let c={score:g,arch:l.name.toLowerCase(),grade:h,missing:i},d="x"===a?M(K,e,c):M(L,e,c);if(await C(b,v(a),d)){r("audit_card_capture_completed",{trigger:`share_${a}`,status:"success",image_method:"native",source:"poster"}),(0,G.toast)(F("native"));return}let f=await D(b,v(a));r("audit_card_capture_completed",{trigger:`share_${a}`,status:"failed"===f?"error":"success",image_method:f,source:"poster"}),(0,G.toast)(F(f));let j="x"===a?`https://x.com/intent/tweet?text=${encodeURIComponent(d)}`:`https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(d)}`;globalThis.open(j,"_blank","noopener,noreferrer")}finally{t(null)}}};return(0,b.jsxs)("section",{className:"poster-section","data-screen-label":"01 Poster",children:[(0,b.jsxs)("div",{className:"poster",ref:k,children:[(0,b.jsxs)("header",{className:"poster-head",children:[(0,b.jsxs)("span",{className:"poster-wordmark",children:[(0,b.jsx)("img",{src:"/logo.svg",alt:"failproof_ai",className:"poster-logo"}),(0,b.jsx)("span",{className:"poster-sep",children:"·"})," audit"]}),(0,b.jsxs)("span",{className:"poster-meta",children:[(0,b.jsxs)("span",{className:"poster-ix",children:["№ ",o]}),(0,b.jsx)("span",{className:"of",children:" of 08"}),(0,b.jsx)("span",{className:"poster-sep",children:" · "}),"audited ",q]})]}),(0,b.jsxs)("div",{className:"poster-body",children:[(0,b.jsx)("div",{className:"poster-sigil",children:(0,b.jsx)(H,{archetypeKey:d})}),(0,b.jsxs)("div",{className:"poster-persona",children:[(0,b.jsx)("h1",{className:"persona-name",children:l.name}),(0,b.jsx)("div",{className:"persona-keywords",children:l.keywords.map((a,d)=>(0,b.jsxs)(c.default.Fragment,{children:[(0,b.jsx)("span",{className:`kw kw-${d}`,children:a}),d<l.keywords.length-1&&(0,b.jsx)("span",{className:"kw-sep",children:"·"})]},a))}),"number"==typeof m&&(0,b.jsxs)("div",{className:"persona-rarity",children:[(0,b.jsx)("span",{className:"lbl",children:"// only"})," ",(0,b.jsxs)("span",{className:"pct",children:[m,"%"]})," ",(0,b.jsx)("span",{className:"lbl",children:"of agents are this archetype"})]})]}),(0,b.jsxs)("div",{className:"poster-score",children:[(0,b.jsx)("span",{className:"score-n",children:g}),(0,b.jsx)("span",{className:"score-of",children:"/100"})]})]}),(0,b.jsxs)("footer",{className:"poster-foot",children:[(0,b.jsx)("span",{className:"poster-brand",children:"befailproof.ai"}),(0,b.jsxs)("span",{className:"poster-cta",children:["audit yours ",(0,b.jsx)("span",{className:"arrow",children:"→"})," ",(0,b.jsx)("span",{className:"cta-cmd",children:"npx -y failproofai audit"})]})]})]}),(0,b.jsxs)("div",{className:"poster-share-row",children:[(0,b.jsxs)("button",{type:"button",className:"poster-share-btn",onClick:()=>w("x"),disabled:null!==s,children:[(0,b.jsx)("span",{className:"mark","aria-hidden":"true",children:"𝕏"}),"x"===s?"rendering…":"post your archetype"]}),(0,b.jsxs)("button",{type:"button",className:"poster-share-btn",onClick:()=>w("linkedin"),disabled:null!==s,children:[(0,b.jsx)("span",{className:"mark","aria-hidden":"true",children:"in"}),"linkedin"===s?"rendering…":"share on linkedin"]}),(0,b.jsxs)("button",{type:"button",className:"poster-share-btn",onClick:()=>w("download"),disabled:null!==s,children:[(0,b.jsx)("span",{className:"mark","aria-hidden":"true",children:"↓"}),"download"===s?"rendering…":"download poster"]})]}),(0,b.jsxs)("div",{className:"poster-scroll-hint","aria-hidden":"true",children:["scroll for full report ",(0,b.jsx)("span",{className:"arrow",children:"↓"})]})]})});function O({strengths:a}){return 0===a.length?null:(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"02 Strengths",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"02"}),"// strengths"]}),(0,b.jsxs)("span",{className:"audit-sec-meta",children:[a.length," standouts"]})]}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"what it's great at"}),(0,b.jsx)("div",{className:"strength-list",children:a.map((a,c)=>(0,b.jsxs)("div",{className:"strength-row",children:[(0,b.jsx)("span",{className:"strength-check","aria-hidden":"true",children:"✓"}),(0,b.jsxs)("span",{className:"strength-body",children:[(0,b.jsx)("span",{className:"strength-headline",children:a.headline}),(0,b.jsx)("span",{className:"strength-detail",children:a.detail})]}),(0,b.jsxs)("span",{className:"strength-metric",children:[a.metric,a.unit&&(0,b.jsx)("span",{className:"unit",children:a.unit})]})]},c))})]})}function P({findings:a}){return 0===a.length?null:(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"03 Quirks",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"03"}),"// quirks"]}),(0,b.jsxs)("span",{className:"audit-sec-meta",children:[a.length," slipped through"]})]}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"what to improve"}),(0,b.jsxs)("div",{className:"quirks-table",children:[(0,b.jsxs)("div",{className:"quirks-thead",children:[(0,b.jsx)("span",{children:"when"}),(0,b.jsx)("span",{children:"what slipped"}),(0,b.jsx)("span",{children:"severity"}),(0,b.jsx)("span",{children:"seen"})]}),a.map(a=>{var c,d;let e=(c=a.count)>=6?"high":c>=2?"medium":"low";return(0,b.jsxs)("div",{className:"quirks-row",children:[(0,b.jsx)("span",{className:"q-when",children:a.lastSeen}),(0,b.jsxs)("span",{className:"q-what",children:[(0,b.jsx)("span",{className:"q-title",children:a.title}),(0,b.jsxs)("span",{className:"q-policy",children:["would've been caught by:"," ",(0,b.jsx)("code",{children:a.policy})]})]}),(0,b.jsx)("span",{className:`q-pill q-pill-${e}`,children:e}),(0,b.jsx)("span",{className:"q-recur",children:(d=a.count)<=1?"new":d<10?`${d}\xd7 seen`:"recurring"})]},a.sourceSlug)})]})]})}let Q={"redundant-cd-cwd":"warn-repeated-tool-calls","prefer-edit-over-read-cat":"block-read-outside-cwd","prefer-edit-over-sed-awk":"warn-repeated-tool-calls","prefer-write-over-heredoc":"block-env-files","sleep-polling-loop":"warn-background-process","find-from-root":"block-read-outside-cwd","git-commit-no-verify":"warn-git-amend","reread-after-edit":"warn-repeated-tool-calls"},R={"warn-repeated-tool-calls":"warns when the same tool is called 3+ times with identical parameters.","block-read-outside-cwd":"denies any file read outside the project root, including symlinks.","block-env-files":"blocks reads and writes of .env files at the tool layer.","block-secrets-write":"blocks writes to .pem, id_rsa, credentials.json, and other secret-key files.","warn-background-process":"warns before starting nohup / & / screen / tmux processes.","warn-git-amend":"warns before amending git commits.","require-ci-green-before-stop":"requires CI checks to pass on HEAD before the agent declares the task done."};function S(a){let b=a.indexOf("/");return b>=0?a.slice(b+1):a}function T({result:a,projected:d,projectedGrade:e}){let{capture:f}=(0,A.usePostHog)(),g=(0,c.useMemo)(()=>(function(a){let b=new Set(a.enabledBuiltinNames??[]),c=new Map;for(let d of a.results){let a;if(0!==d.hits){if("audit-detector"===d.source){let b=Q[S(d.name)];if(!b)continue;a=b}else{if("builtin"!==d.source||d.enabledInConfig)continue;a=S(d.name)}b.has(a)||c.set(a,(c.get(a)??0)+d.hits)}}return[...c.entries()].sort((a,b)=>b[1]-a[1]).map(([a,b])=>({name:a,desc:R[a]??"enable this builtin policy to close the gap.",hits:b}))})(a),[a]),h=(0,c.useMemo)(()=>0===g.length?"":1===g.length?`failproofai policy add ${g[0].name}`:`failproofai policy add ${g.map(a=>a.name).join(" ")}`,[g]),[i,j]=(0,c.useState)(!1);if(0===g.length)return null;let k=async()=>{try{await navigator.clipboard.writeText(h),j(!0),f("audit_copy_clicked",{source:"how_to_improve_section_install_all",item_type:"bulk_install_command",policy_count:g.length}),setTimeout(()=>j(!1),1500)}catch{}};return(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"04 How to improve",children:[(0,b.jsxs)("div",{className:"audit-sec-head",children:[(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"04"}),"// how to improve"]}),(0,b.jsx)("button",{type:"button",className:"install-all-btn",onClick:k,"aria-label":"Copy install-all command",children:i?"copied":"install all"})]}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"install or configure"}),(0,b.jsxs)("div",{className:"audit-sec-sub",children:["enable all ",1===g.length?"one":g.length," → projected"," ",(0,b.jsx)("strong",{children:d})," · ",u[e].toLowerCase()]}),(0,b.jsx)("div",{className:"fix-list",children:g.map((a,c)=>(0,b.jsx)(U,{fix:a,idx:c},a.name))})]})}function U({fix:a,idx:d}){let{capture:e}=(0,A.usePostHog)(),[f,g]=(0,c.useState)(!1),h=`failproofai policy add ${a.name}`,i=async()=>{try{await navigator.clipboard.writeText(h),g(!0),e("audit_copy_clicked",{source:"how_to_improve_section",item_type:"single_policy_install_command",policy_name:a.name,policy_rank:d+1}),setTimeout(()=>g(!1),1500)}catch{}};return(0,b.jsxs)("div",{className:"fix-row",children:[(0,b.jsxs)("div",{className:"fix-row-info",children:[(0,b.jsx)("div",{className:"fix-name",children:a.name}),(0,b.jsx)("div",{className:"fix-desc",children:a.desc})]}),(0,b.jsxs)("div",{className:"fix-row-cmd",children:[(0,b.jsx)("code",{className:"fix-cmd-code",children:h}),(0,b.jsx)("button",{type:"button",className:"copy-icon-btn",onClick:i,"aria-label":`Copy install command for ${a.name}`,children:f?"✓":(0,b.jsxs)("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:[(0,b.jsx)("rect",{x:"3",y:"3",width:"9",height:"11",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),(0,b.jsx)("rect",{x:"5.5",y:"0.5",width:"9",height:"11",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})})]})]})}function V(a,b={},c=15e3){let d=AbortSignal.timeout(c),e=b.signal?AbortSignal.any([b.signal,d]):d;return fetch(a,{...b,signal:e})}function W(a){if(null===a||"object"!=typeof a)return!1;let b=a.name;return"AbortError"===b||"TimeoutError"===b}let X=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Y(a){if(W(a))return"request timed out. check your network and try again.";let b=a instanceof Error?a.message:String(a);return`network error: ${b}`}function Z({open:a,headline:d="where to route the reminder?",subhead:e="we'll send a one-time code to confirm.",onClose:f,onAuthed:g,source:h="unknown"}){let{capture:i}=(0,A.usePostHog)(),[j,k]=(0,c.useState)({kind:"email",error:null}),[l,m]=(0,c.useState)(!1),n=(0,c.useRef)(!1),o=(0,c.useRef)(null),p=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&(k({kind:"email",error:null}),m(!1),n.current=!1,i("audit_auth_dialog_opened",{source:h}))},[i,a,h]);let q=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(a){q.current=!0;return}q.current&&!n.current&&i("audit_auth_dialog_dismissed",{source:h,step:j.kind}),q.current=!1},[i,a,h,j.kind]),(0,c.useEffect)(()=>{if(!a)return;let b=setTimeout(()=>{"email"===j.kind?o.current?.focus():"code"===j.kind&&p.current?.focus()},50);return()=>clearTimeout(b)},[a,j.kind]),(0,c.useEffect)(()=>{if(!a)return;let b=a=>{"Escape"!==a.key||l||f()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[a,l,f]);let r="code"===j.kind&&j.resendIn>0;(0,c.useEffect)(()=>{if(!r)return;let a=setInterval(()=>{k(a=>"code"===a.kind?{...a,resendIn:Math.max(0,a.resendIn-1)}:a)},1e3);return()=>clearInterval(a)},[r]);let s=(0,c.useCallback)(async(a,b={})=>{let{isResend:c=!1}=b,d=a=>{c?k(b=>"code"===b.kind?{...b,error:a}:b):k({kind:"email",error:a})};m(!0);try{let b=await V("/api/auth/login-request",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:a})}),c=await b.json().catch(()=>({}));if(!b.ok){let a=c.message??"could not send code.";"rate_limited"===c.code&&void 0!==c.retry_after_secs?a=`too many tries. wait ${c.retry_after_secs}s and try again.`:"upstream_unreachable"===c.code&&(a="api-server unreachable. check your network."),d(a);return}k({kind:"code",email:a,error:null,expiresIn:c.expires_in??600,resendIn:c.resend_available_in??30})}catch(a){d(Y(a))}finally{m(!1)}},[]),t=(0,c.useCallback)(async(a,b)=>{m(!0);try{let c=await V("/api/auth/login-verify",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:a,code:b})}),d=await c.json().catch(()=>({}));if(!c.ok||!d.authenticated||!d.user){let a=d.message??"invalid code.";"invalid_code"===d.code&&(a="wrong code, or it expired. try again."),k(b=>"code"===b.kind?{...b,error:a}:b);return}n.current=!0,i("audit_auth_dialog_succeeded",{source:h}),k({kind:"done",user:d.user}),g(d.user)}catch(b){let a=Y(b);k(b=>"code"===b.kind?{...b,error:a}:b)}finally{m(!1)}},[i,g,h]),u=(0,c.useCallback)(async a=>{if(a.preventDefault(),l||"email"!==j.kind)return;let b=String(new FormData(a.currentTarget).get("email")??"").trim().toLowerCase();X.test(b)?await s(b):k({kind:"email",error:"that doesn't look like an email."})},[l,j,s]),v=(0,c.useCallback)(async a=>{if(a.preventDefault(),l||"code"!==j.kind)return;let b=String(new FormData(a.currentTarget).get("code")??"").trim();b.length<4||b.length>12?k(a=>"code"===a.kind?{...a,error:"code is 4–12 characters."}:a):await t(j.email,b)},[l,j,t]),w=(0,c.useCallback)(async()=>{"code"!==j.kind||j.resendIn>0||l||await s(j.email,{isResend:!0})},[j,l,s]);return a?(0,b.jsx)("div",{className:"auth-dialog-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"auth-dialog-title",onClick:a=>{l||a.target!==a.currentTarget||f()},children:(0,b.jsxs)("div",{className:"auth-dialog",children:[(0,b.jsx)("button",{type:"button",className:"auth-close",onClick:f,disabled:l,"aria-label":"close",children:"×"}),(0,b.jsx)("h2",{id:"auth-dialog-title",className:"auth-headline",children:d}),"email"===j.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"auth-sub",children:e}),(0,b.jsxs)("form",{onSubmit:u,className:"auth-form",children:[(0,b.jsx)("input",{ref:o,id:"auth-dialog-email",name:"email",type:"email",autoComplete:"email",inputMode:"email",spellCheck:!1,placeholder:"you@yourdomain.com",disabled:l,className:"auth-input",required:!0}),j.error&&(0,b.jsx)("div",{className:"auth-error",children:j.error}),(0,b.jsxs)("div",{className:"auth-actions",children:[(0,b.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:l,children:l?"sending…":"send code"}),(0,b.jsx)("button",{type:"button",className:"auth-btn",onClick:f,disabled:l,children:"cancel"})]})]})]}),"code"===j.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"auth-sub",children:["code sent to ",(0,b.jsx)("span",{className:"auth-email",children:j.email}),". expires in ",Math.ceil(j.expiresIn/60)," min."]}),(0,b.jsxs)("form",{onSubmit:v,className:"auth-form",children:[(0,b.jsx)("input",{ref:p,id:"auth-dialog-code",name:"code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",spellCheck:!1,placeholder:"123456",disabled:l,className:"auth-input auth-input-code",maxLength:12,required:!0}),j.error&&(0,b.jsx)("div",{className:"auth-error",children:j.error}),(0,b.jsxs)("div",{className:"auth-actions",children:[(0,b.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:l,children:l?"verifying…":"verify"}),(0,b.jsx)("button",{type:"button",className:"auth-btn",onClick:w,disabled:l||j.resendIn>0,children:j.resendIn>0?`resend in ${j.resendIn}s`:"resend code"})]}),(0,b.jsx)("button",{type:"button",className:"auth-back",onClick:()=>k({kind:"email",error:null}),disabled:l,children:"← use a different email"})]})]}),"done"===j.kind&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"auth-sub",children:[(0,b.jsx)("span",{className:"auth-ok",children:"✓"})," signed in as"," ",(0,b.jsx)("span",{className:"auth-email",children:j.user.email}),"."]}),(0,b.jsx)("div",{className:"auth-actions",children:(0,b.jsx)("button",{type:"button",className:"auth-btn primary",onClick:f,children:"continue"})})]})]})}):null}let $=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function _({open:a,onClose:d,source:e,onUnauthorized:f,score:g}){let{capture:h}=(0,A.usePostHog)(),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(null),o=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&(j(""),l(!1),n(null),h("audit_invite_dialog_opened",{source:e}))},[h,a,e]),(0,c.useEffect)(()=>{if(!a)return;let b=setTimeout(()=>o.current?.focus(),50);return()=>clearTimeout(b)},[a]),(0,c.useEffect)(()=>{if(!a)return;let b=a=>{"Escape"!==a.key||k||d()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[a,k,d]);let{valid:p,invalid:q}=(0,c.useMemo)(()=>(function(a){let b=a.split(/[\s,;]+/).map(a=>a.trim().toLowerCase()).filter(Boolean),c=[],d=[],e=new Set;for(let a of b)e.has(a)||(e.add(a),$.test(a)?c.push(a):d.push(a));return{valid:c,invalid:d}})(i),[i]),r=(0,c.useCallback)(async a=>{if(a.preventDefault(),!k){if(0===p.length)return void n("add at least one valid email address.");if(p.length>10)return void n("up to 10 emails at a time. send the rest in a follow-up.");l(!0),n(null),h("audit_invite_submitted",{source:e,recipient_count:p.length,had_invalid:q.length>0});try{let a=await fetch("/api/audit/invite",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({to:p,score:g})}),b=await a.json().catch(()=>({}));if(401===a.status)return void(f?(d(),f()):n("session expired. please sign in again."));if(!a.ok){let a=b.message??"couldn't send invites.";n(a);return}let c=b.sent?.length??0,e=b.failed?.length??0;(0,G.toast)(e>0?`📨 sent ${c}, ${e} bounced — copy the bounce and try again.`:`📨 sent ${c} ${1===c?"invite":"invites"}. thanks for spreading the word.`),d()}catch(b){let a=b instanceof Error?b.message:String(b);n(`network error: ${a}`)}finally{l(!1)}}},[k,p,q,h,e,d,f,g]);return a?(0,b.jsx)("div",{className:"auth-dialog-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"invite-dialog-title",onClick:a=>{k||a.target!==a.currentTarget||d()},children:(0,b.jsxs)("div",{className:"auth-dialog",children:[(0,b.jsx)("button",{type:"button",className:"auth-close",onClick:d,disabled:k,"aria-label":"close",children:"×"}),(0,b.jsx)("h2",{id:"invite-dialog-title",className:"auth-headline",children:"invite friends to audit theirs"}),(0,b.jsx)("p",{className:"auth-sub",children:"paste emails separated by commas, spaces, or newlines. you'll be Cc'd on every invite so they know it's from you."}),(0,b.jsxs)("form",{onSubmit:r,className:"auth-form",children:[(0,b.jsx)("textarea",{ref:o,name:"emails",placeholder:"alice@x.com, bob@y.com carol@z.com",disabled:k,className:"auth-input invite-textarea",value:i,onChange:a=>j(a.target.value),rows:4,required:!0}),(0,b.jsxs)("div",{className:"invite-summary",children:[p.length>0&&(0,b.jsxs)("span",{className:"invite-valid",children:[p.length," valid"]}),q.length>0&&(0,b.jsxs)("span",{className:"invite-invalid",children:[q.length," invalid: ",q.slice(0,3).join(", "),q.length>3?`, +${q.length-3} more`:""]}),p.length>10&&(0,b.jsxs)("span",{className:"invite-invalid",children:["only ",10," per send — first ",10," will go."]})]}),m&&(0,b.jsx)("div",{className:"auth-error",children:m}),(0,b.jsxs)("div",{className:"auth-actions",children:[(0,b.jsx)("button",{type:"submit",className:"auth-btn primary",disabled:k||0===p.length,children:k?"sending…":`send ${p.length||""} invite${1===p.length?"":"s"}`.trim()}),(0,b.jsx)("button",{type:"button",className:"auth-btn",onClick:d,disabled:k,children:"cancel"})]})]})]})}):null}let aa=[3,7,14,30],ab={headline:"Oops! Login required",subhead:"What's your email?"};function ac({isRunning:a,onRerun:d,score:e}){let{capture:f}=(0,A.usePostHog)(),[g,h]=(0,c.useState)({kind:"unknown"}),[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(7),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)({}),u=(0,c.useRef)(!1),v=(0,c.useRef)(0),w=(0,c.useCallback)(async()=>{v.current=Date.now();let a=()=>{h(a=>"unknown"===a.kind?{kind:"anon"}:a)};try{let b=await fetch("/api/auth/status",{cache:"no-store"});if(!b.ok)return void a();let c=await b.json();c.authenticated&&c.user?(h({kind:"authed",user:c.user}),j(c.reminder??null)):(h({kind:"anon"}),j(null))}catch{a()}},[]);(0,c.useEffect)(()=>{w();let a=()=>{Date.now()-v.current<5e3||w()},b=()=>a(),c=()=>{"visible"===document.visibilityState&&a()};return window.addEventListener("focus",b),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("focus",b),document.removeEventListener("visibilitychange",c)}},[w]),(0,c.useEffect)(()=>{u.current||"unknown"!==g.kind&&(u.current=!0,f("audit_reminder_cta_shown",{auth_state:g.kind,has_existing_reminder:null!==i,source:"come_back_better_section"}))},[g,f,i]);let x=(0,c.useCallback)(async a=>{let b=new AbortController,c=setTimeout(()=>b.abort(),1e4);try{r(!0);let c=await fetch("/api/auth/reminder",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({in_days:a}),signal:b.signal});if(!c.ok)return 401===c.status&&(h({kind:"anon"}),j(null)),f("audit_reminder_saved",{status:`http_${c.status}`,source:"come_back_better_section",cadence_days:a}),null;let d=await c.json();return f("audit_reminder_saved",{status:d.reminder?"success":"empty",source:"come_back_better_section",cadence_days:a}),d.reminder??null}catch(b){return f("audit_reminder_saved",{status:W(b)?"timeout":"error",source:"come_back_better_section",cadence_days:a}),null}finally{clearTimeout(c),r(!1)}},[f]),y=(0,c.useCallback)(async a=>{if(l(a),f("audit_reminder_cta_clicked",{auth_state:g.kind,has_existing_reminder:null!==i,cadence_days:a,source:"come_back_better_section"}),"authed"===g.kind){let b=await x(a);b&&j(b);return}"anon"===g.kind&&(t({}),n(!0))},[g,f,x,i]),z=(0,c.useCallback)(async a=>{h({kind:"authed",user:a}),f("audit_auth_completed",{source:"come_back_better_section"});let b=await x(k);b&&j(b)},[k,f,x]),B=(0,c.useCallback)(()=>{if(f("audit_perks_invite_clicked",{source:"come_back_better_section",auth_state:g.kind}),"authed"!==g.kind){t(ab),n(!0);return}p(!0)},[g.kind,f]),C=(0,c.useCallback)(()=>{a||d()},[a,d]),D=i?Math.max(0,Math.ceil((i.next_audit_at-Math.floor(Date.now()/1e3))/86400)):0;return(0,b.jsxs)("section",{className:"audit-sec","data-screen-label":"05 Come back better",children:[(0,b.jsx)("div",{className:"audit-sec-head",children:(0,b.jsxs)("span",{className:"audit-sec-eyebrow",children:[(0,b.jsx)("span",{className:"ix",children:"05"}),"// come back better"]})}),(0,b.jsx)("h2",{className:"audit-sec-title",children:"build the habit"}),(0,b.jsxs)("div",{className:"cbb-grid",children:[(0,b.jsxs)("div",{className:"cbb-card",children:[(0,b.jsx)("div",{className:"cbb-card-title",children:"set a reminder"}),(0,b.jsx)("div",{className:"cbb-card-sub",children:i?`next audit set for ${new Date(1e3*i.next_audit_at).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})} \xb7 in ${D} day${1===D?"":"s"}.`:"we'll nudge you when your next audit is due. pick the cadence:"}),(0,b.jsx)("div",{className:"cadence-row",children:aa.map(a=>(0,b.jsxs)("button",{type:"button",className:`cadence-btn${k===a?" on":""}`,disabled:q||"unknown"===g.kind,onClick:()=>void y(a),children:[a,"d"]},a))}),(0,b.jsx)("button",{type:"button",className:"cbb-link",disabled:a,onClick:C,children:a?"scanning…":"or re-audit now →"})]}),(0,b.jsxs)("div",{className:"cbb-card",children:[(0,b.jsx)("div",{className:"cbb-card-title",children:"Share with friends"}),(0,b.jsx)("div",{className:"cbb-card-sub",children:"wanna know how your friends' agents score?"}),(0,b.jsx)("button",{type:"button",className:"invite-btn",onClick:B,children:"invite a friend"}),(0,b.jsx)("div",{className:"cbb-foot",children:"// invites are sent from failproof.ai, Cc'd to you, with a link to run their own audit."})]})]}),(0,b.jsx)(_,{open:o,source:"come_back_better_section",score:e,onClose:()=>p(!1),onUnauthorized:()=>{h({kind:"anon"}),j(null),t(ab),n(!0)}}),(0,b.jsx)(Z,{open:m,source:"return_section",headline:s.headline,subhead:s.subhead,onClose:()=>n(!1),onAuthed:a=>{n(!1),z(a)}})]})}function ad({cachedAt:a,fixed:c=!1}){return(0,b.jsxs)("footer",{className:c?"report-footer report-footer--fixed":"report-footer",children:[(0,b.jsx)("img",{src:"/logo.svg",alt:"failproof_ai",style:{height:18,display:"inline-block",verticalAlign:"middle"}}),(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),"audit v1.0",(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),"generated ",function(a){if(!a)return"—";let b=new Date(a);if(Number.isNaN(b.getTime()))return"—";let c=b.getUTCDate().toString().padStart(2,"0"),d=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"][b.getUTCMonth()],e=b.getUTCFullYear(),f=b.getUTCHours().toString().padStart(2,"0"),g=b.getUTCMinutes().toString().padStart(2,"0");return`${c} ${d} ${e}, ${f}:${g} utc`}(a),(0,b.jsx)("span",{style:{margin:"0 12px",color:"var(--line-2)"},children:"·"}),(0,b.jsx)("span",{style:{color:"var(--ink-2)"},children:"auto-healing for your agents."})]})}class ae extends Error{kind;constructor(a,b){super(b),this.kind=a,this.name="RerunError"}}async function af(a){try{let b=await V("/api/audit/run",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({cli:a.cli.length>0?a.cli:void 0,since:"all"===a.since?void 0:a.since,noCache:!!a.noCache||void 0})});if(!b.ok&&409!==b.status){let a=await b.text().catch(()=>"");throw console.error("audit run failed:",b.status,a),new ae("post_failed",`audit run failed (${b.status})`)}}catch(a){if(a instanceof ae)throw a;throw console.error("audit run request failed:",a),new ae(W(a)?"timeout":"network","audit run request failed")}let b=0;for(;;){await new Promise(a=>setTimeout(a,1e3));let a=null;try{let b=await V("/api/audit/status",{cache:"no-store"});b.ok&&(a=await b.json())}catch{}if(null===a){if(++b>=10)throw new ae("network","audit status poll lost the server");continue}if(b=0,!a.running){if(a.error)throw new ae("post_failed",a.error);return}}}function ag({mode:a,running:c,onStarted:d,onCompleted:e}){let{capture:f}=(0,A.usePostHog)(),g=async()=>{f("audit_first_run_clicked",{source:"empty_state",mode:a}),d();try{await af({cli:[],since:"all"})}catch(a){console.error("audit first run failed:",a)}finally{await e()}};return"no-cache"===a?(0,b.jsxs)("section",{className:"section empty-section","data-screen-label":"00 Empty",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"·"})," first run"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"○"})," no cache yet"]})]}),(0,b.jsx)("h2",{className:"section-h",children:"scan and see."}),(0,b.jsxs)("div",{className:"panel empty-panel",children:[(0,b.jsxs)("div",{className:"empty-glyph","aria-hidden":"true",children:[(0,b.jsx)("div",{className:"empty-glyph-grid",children:Array.from({length:36}).map((a,c)=>{let d=["1","5","8","10","13","17","20","23","25","30","32"].includes(String(c));return(0,b.jsx)("span",{className:"px"+(d?" on":"")},c)})}),(0,b.jsx)("div",{className:"empty-glyph-label",children:"▮▮ no audit data yet"})]}),(0,b.jsx)("h3",{className:"empty-headline",children:"run your first audit."}),(0,b.jsx)("p",{className:"empty-sub",children:"we'll walk every transcript across your installed CLIs — Claude Code, Codex, Copilot, Cursor, OpenCode, Pi, Gemini — and count every wasteful or risky action. you'll get a tier, a score, and a punch-list."}),(0,b.jsxs)("div",{className:"empty-actions",children:[(0,b.jsx)("button",{type:"button",className:"btn btn-primary btn-press empty-cta",onClick:g,disabled:c,children:c?"[ scanning… ]":"[ run audit ]"}),(0,b.jsx)("span",{className:"empty-meta",children:"scans all sessions · all installed CLIs · may take a while"})]})]})]}):(0,b.jsxs)("section",{className:"section empty-section","data-screen-label":"00 Empty",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"·"})," zero transcripts"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--amber)"},children:"●"})," hooks not installed"]})]}),(0,b.jsx)("h2",{className:"section-h",children:"nothing to read."}),(0,b.jsxs)("div",{className:"panel empty-panel",children:[(0,b.jsxs)("div",{className:"empty-glyph","aria-hidden":"true",children:[(0,b.jsx)("div",{className:"empty-glyph-grid",children:Array.from({length:36}).map((a,c)=>{let d=["2","4","9","11","16","18","23","25","27","30","33"].includes(String(c));return(0,b.jsx)("span",{className:"px"+(d?" on":"")},c)})}),(0,b.jsx)("div",{className:"empty-glyph-label",children:"▮▮ no sessions found"})]}),(0,b.jsx)("h3",{className:"empty-headline",children:"install hooks first."}),(0,b.jsx)("p",{className:"empty-sub",children:"failproofai couldn't find any transcripts to scan on this machine. install the hooks for at least one CLI and come back."}),(0,b.jsxs)("div",{className:"empty-actions",children:[(0,b.jsx)("a",{href:"https://docs.befailproof.ai/getting-started",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-press empty-cta",onClick:()=>{f("audit_install_guide_clicked",{source:"empty_state",mode:a})},children:"[ install guide → ]"}),(0,b.jsx)("span",{className:"empty-meta",children:"takes about 30 seconds · one command per CLI"})]})]})]})}let ah=[{label:"discovering transcripts",detail:"walking ~/.claude, ~/.codex, ~/.cursor, …"},{label:"parsing session logs",detail:"reading JSONL + sqlite session stores"},{label:"running policy checks",detail:"replaying through 30 builtin policies"},{label:"aggregating results",detail:"counting hits, ranking by frequency"}];function ai(){let[a,d]=(0,c.useState)(0),[e,f]=(0,c.useState)(0);(0,c.useEffect)(()=>{let a=setInterval(()=>{d(a=>Math.min(a+1,ah.length-1))},4e3),b=setInterval(()=>f(a=>(a+1)%4),350);return()=>{clearInterval(a),clearInterval(b)}},[]);let g=".".repeat(e+1),h=a===ah.length-1,i=Math.round(100*Math.min(.9,(a+1)/ah.length*.9));return(0,b.jsxs)("section",{className:"section running-section","data-screen-label":"00 Running",children:[(0,b.jsxs)("div",{className:"section-mast",children:[(0,b.jsxs)("div",{className:"section-label",children:[(0,b.jsx)("span",{className:"glyph",children:"━━"})," audit"," ",(0,b.jsx)("span",{style:{color:"var(--dim)"},children:"·"})," in progress"]}),(0,b.jsxs)("div",{className:"section-meta",children:[(0,b.jsx)("span",{style:{color:"var(--accent-pink)"},children:"●"})," scanning"]})]}),(0,b.jsxs)("h2",{className:"section-h",children:["scanning sessions",g]}),(0,b.jsxs)("div",{className:"panel running-panel",children:[(0,b.jsxs)("div",{className:"running-header",children:[(0,b.jsx)("span",{className:"running-prompt",children:"$"}),(0,b.jsx)("span",{className:"running-cmd",children:"failproofai audit"}),(0,b.jsx)("span",{className:"running-cursor","aria-hidden":"true",children:"▮"})]}),(0,b.jsx)("ul",{className:"running-stages",children:ah.map((c,d)=>{let f=d<a,g=d===a;return(0,b.jsxs)("li",{className:"running-stage"+(f?" done":g?" active":" queued"),children:[(0,b.jsx)("span",{className:"running-marker","aria-hidden":"true",children:f?"✓":g?"▮▮":"○"}),(0,b.jsxs)("div",{className:"running-stage-body",children:[(0,b.jsx)("div",{className:"running-stage-label",children:c.label}),g&&(0,b.jsx)("div",{className:"running-stage-detail",children:h?"finishing up…":c.detail})]}),g&&(0,b.jsx)("span",{className:"running-stage-spin","aria-hidden":"true",children:["⠋","⠙","⠹","⠸"][e]})]},d)})}),(0,b.jsxs)("div",{className:"running-bar-label",children:[(0,b.jsx)("span",{children:"progress"}),(0,b.jsxs)("span",{style:{color:"var(--dim)"},children:[i,"%"]})]}),(0,b.jsx)("div",{className:"running-bar-track",children:(0,b.jsx)("div",{className:"running-bar-fill",style:{width:`${i}%`}})}),(0,b.jsx)("p",{className:"running-foot",children:"this can take a while depending on how much session history you have."})]})]})}let aj={timeout:"audit took too long — try again",network:"network hiccup — check your connection",post_failed:"audit failed — try again"};function ak({status:a,onDismiss:d}){let[e,f]=(0,c.useState)(()=>Date.now());if((0,c.useEffect)(()=>{if("running"!==a.kind)return;let b=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(b)},[a.kind]),"idle"===a.kind)return null;if("running"===a.kind){let c=Math.max(0,e-a.startedAt);return(0,b.jsxs)("div",{className:"audit-progress-strip",role:"status","aria-live":"polite",children:[(0,b.jsxs)("div",{className:"audit-progress-strip__inner",children:[(0,b.jsxs)("span",{className:"audit-progress-strip__label",children:[(0,b.jsx)("span",{className:"audit-progress-strip__spinner","aria-hidden":"true"}),"re-auditing your sessions"]}),(0,b.jsx)("span",{className:"audit-progress-strip__elapsed",children:function(a){if(a<0)return"00:00";let b=Math.floor(a/1e3),c=Math.floor(b/60).toString().padStart(2,"0"),d=(b%60).toString().padStart(2,"0");return`${c}:${d}`}(c)})]}),(0,b.jsx)("div",{className:"audit-progress-strip__pulse","aria-hidden":"true"})]})}return(0,b.jsx)("div",{className:"audit-progress-strip audit-progress-strip--failed",role:"alert",children:(0,b.jsxs)("div",{className:"audit-progress-strip__inner",children:[(0,b.jsxs)("span",{className:"audit-progress-strip__label",children:[(0,b.jsx)("span",{className:"audit-progress-strip__x","aria-hidden":"true",children:"×"}),aj[a.reason]]}),(0,b.jsx)("button",{type:"button",className:"audit-progress-strip__dismiss",onClick:d,"aria-label":"dismiss",children:"[ dismiss ]"})]})})}function al({result:a,cachedAt:d,projectFromUrl:e,isRunning:l,rerunStatus:o,onRerun:p,onDismissRerun:r}){let{capture:u}=(0,A.usePostHog)(),v=(0,c.useMemo)(()=>(function(a,b){if(b&&b.trim())return b;let c=new Map;for(let b of a.results)for(let a of b.examples)a.cwd&&c.set(a.cwd,(c.get(a.cwd)??0)+1);let d="",e=0;for(let[a,b]of c)b>e&&(d=a,e=b);if(!d)return"your agent";let f=d.replace(/\/+$/,"").split(/[\\/]/);return f.length>=2?`${f[f.length-2]} / ${f[f.length-1]}`:f[f.length-1]??"your agent"})(a,e),[a,e]),B=(0,c.useMemo)(()=>(function(a,b=""){let c=function(a,b=""){let c=Math.max(a.eventsScanned??0,50),d=a.transcripts.scanned,e=a.totals?.hits??function(a){let b=0;for(let c of a.results)b+=c.hits;return b}(a),h=k(),l=0;for(let b of a.results){let a=function(a){let b=a.indexOf("/");return b>=0?a.slice(b+1):a}(b.name),c=j[a];if(!c)continue;let d=b.hits*c.weight;h[c.archetype]+=d,i.has(a)&&(l+=d)}let n=g.reduce((a,b)=>a+h[b],0),o=k();for(let a of g){let b=n>0?h[a]/n:0;o[a]=m[a]>0?b/m[a]:0}let p=g.map(a=>o[a]),q=function(a){let b=a.reduce((a,b)=>a+Math.max(0,b),0);if(b<=0)return 0;let c=0;for(let d of a){if(d<=0)continue;let a=d/b;c-=a*Math.log(a)}return c/Math.log(a.length)}(p),r=[...p].sort((a,b)=>b-a)[1]??0,s=n>0?l/n:0,t=e/c,u=g.map(a=>Math.round(10*h[a])).join(","),v=f(`${b}|${u}|${Math.round(1e3*t)}`);return{events:c,sessions:d,totalHits:e,faultRate:t,clusterRaw:h,totalSignal:n,clusterLift:o,entropy:q,secondLift:r,cautionShare:s,cowboyLift:o.cowboy,fingerprint:v}}(a,b),d={weights:c.clusterRaw,lift:c.clusterLift,totalSignal:c.totalSignal,variantSeed:`${b}|${c.fingerprint}`};if(c.totalSignal<2.5||c.faultRate<.003&&c.totalSignal<6)return{archetype:"precision",secondary:n.precision.secondary,...d};if(c.cautionShare>=.35&&c.cowboyLift<1)return{archetype:"architect",secondary:n.architect.secondary,...d};if(g.filter(a=>c.clusterLift[a]>0).length>=4&&c.entropy>.7&&c.secondLift>=1.3)return{archetype:"goldfish",secondary:q(c,g)[0],...d};let e=q(c,h),l=e[0],o=e[1];o&&c.clusterLift[o]>0&&c.clusterLift[l]/c.clusterLift[o]<1.08&&(l=[e[0],e[1]][c.fingerprint%2]);let p=q(c,h).find(a=>a!==l),r=p&&c.clusterLift[p]>0&&c.clusterLift[p]>=.4*c.clusterLift[l]?p:n[l].secondary;return{archetype:l,secondary:r,...d}})(a,v),[a,v]),C=(0,c.useMemo)(()=>Math.round(function(a){if(0===a.transcripts.scanned)return 0;let b=a.eventsScanned??0;return Math.max(0,Math.min(100,100-w(a.results,b)+Math.min(+s(a).length,5)))}(a)),[a]),D=(0,c.useMemo)(()=>{let b,c;return b=a.eventsScanned??0,c=Math.min(92,C+Math.round(Math.max(0,w(a.results,b)-w(a.results.filter(a=>!("builtin"===a.source&&!a.enabledInConfig)),b)))),Math.max(C,c)},[a,C]),E=t(C),F=t(D),G=(0,c.useMemo)(()=>s(a),[a]),H=(0,c.useMemo)(()=>{let b,c;return b=[...a.results].filter(a=>a.hits>0).sort((a,b)=>b.hits-a.hits),c=new Set(a.enabledBuiltinNames??[]),b.map((a,b)=>{var d,e,f,g;let h,i,j,k,l,m,n,o,p,q;return d=a,e=b,f=c,i=(h=(g=d.name).indexOf("/"))>=0?g.slice(h+1):g,j="audit-detector"===d.source?x[i]:void 0,l=z[k=j?.primary??i],m=l?.impact??d.impact??d.displayTitle,n=j?.also,o=f.has(k)||"builtin"===d.source&&d.enabledInConfig,p=y[i],0===(q=d.examples.slice(0,4).map(a=>({text:a.example,kind:"cmd"}))).length&&q.push({text:"no example commands captured.",kind:"comment"}),{num:String(e+1).padStart(2,"0"),title:d.displayTitle.toLowerCase(),count:d.hits,sourceSlug:i,policy:k,projects:d.projects,lastSeen:function(a){if(!a)return"—";let b=Date.now()-new Date(a).getTime();if(Number.isNaN(b)||b<0)return"—";let c=Math.floor(b/6e4);if(c<60)return`${Math.max(1,c)}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);if(e<30)return`${e}d ago`;let f=Math.floor(e/30);return`${f}mo ago`}(d.lastSeen),body:p?.body??d.impact??d.displayTitle,cost:p?.cost??d.impact??"see policy description above.",evidence:q,fix:{slug:k,desc:m,install:`failproofai policy add ${k}`,alsoCoveredBy:n},alreadyEnabled:o}})},[a]),{detectorsTriggered:I,missing:J}=(0,c.useMemo)(()=>{let b=0,c=0;for(let d of a.results)d.hits>0&&b++,"builtin"===d.source&&!d.enabledInConfig&&d.hits>0&&c++;return{detectorsTriggered:b,missing:c}},[a]),K=(0,c.useRef)(!1);(0,c.useEffect)(()=>{K.current||(K.current=!0,u("audit_dashboard_viewed",{score:C,grade:E,archetype:B.archetype,secondary:B.secondary??null,missing:J,transcripts_scanned:a.transcripts.scanned,results_count:a.results.length,detectors_triggered:I}))},[u,C,E,B.archetype,B.secondary,J,a.transcripts.scanned,a.results.length,I]);let L=(0,c.useRef)(null);return(0,b.jsxs)("div",{className:"app",children:[(0,b.jsx)(ak,{status:o,onDismiss:r}),(0,b.jsxs)("div",{className:"app-shell",children:[(0,b.jsxs)("div",{className:"report",children:[(0,b.jsx)(N,{ref:L,archetypeKey:B.archetype,seed:B.variantSeed,score:C,grade:E,missing:J,auditedAt:d??new Date().toISOString()}),(0,b.jsx)(O,{strengths:G}),(0,b.jsx)(P,{findings:H}),(0,b.jsx)(T,{result:a,projected:D,projectedGrade:F}),(0,b.jsx)(ac,{isRunning:l,onRerun:()=>p("return_section"),score:C})]}),(0,b.jsx)(ad,{cachedAt:d})]})]})}function am({running:a,mode:c="no-cache",rerunStatus:d,onDismissRerun:e,onStarted:f,onCompleted:g}){return(0,b.jsxs)("div",{className:"app",children:[(0,b.jsx)(ak,{status:d,onDismiss:e}),(0,b.jsxs)("div",{className:"app-shell",children:[(0,b.jsx)("div",{className:"report",children:a?(0,b.jsx)(ai,{}):(0,b.jsx)(ag,{mode:c,running:a,onStarted:f,onCompleted:g})}),(0,b.jsx)(ad,{cachedAt:null,fixed:!0})]})]})}a.s(["AuditDashboard",0,function({initial:a,projectFromUrl:d,totalCatalogSize:f}){let[g,h]=(0,c.useState)(a),[i,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)({kind:"idle"}),{capture:m}=(0,A.usePostHog)(),n=(0,c.useRef)(null),o=(0,c.useRef)(!1),p="cached"===g.status?g.result.transcripts.scanned:0,q="cached"===g.status?g.result.results.length:0,r=(0,c.useCallback)(async()=>{h(await e())},[]),s=(0,c.useCallback)(async a=>{if(i)return;m("audit_rerun_clicked",{source:a,since:"all"}),j(!0);let b=Date.now();l({kind:"running",startedAt:b});try{await af({cli:[],since:"all",noCache:!0}),await r(),m("audit_rerun_succeeded",{source:a,since:"all",duration_ms:Date.now()-b}),l({kind:"idle"})}catch(d){let c=d instanceof ae?d.kind:"network";m("audit_rerun_failed",{kind:c,source:a,since:"all",cli_filter:"all",duration_ms:Date.now()-b}),l({kind:"failed",reason:c,failedAt:Date.now()})}finally{j(!1)}},[m,r,i]),t=(0,c.useCallback)(()=>{l({kind:"idle"})},[]);if((0,c.useEffect)(()=>(document.body.classList.add("audit-body"),()=>document.body.classList.remove("audit-body")),[]),(0,c.useEffect)(()=>{let a=i?"running":"empty"===g.status?"empty":0===p?"zero_sessions":"report";n.current!==a&&(n.current=a,m("audit_page_viewed",{state:a,has_cache:"cached"===g.status}))},[g.status,m,i,p]),(0,c.useEffect)(()=>{o.current=!1},[g.status,i,p]),(0,c.useEffect)(()=>{if(i||"cached"!==g.status||0===p)return;let a=0,b=()=>{if(a=0,o.current)return;let b=document.documentElement.scrollHeight-window.innerHeight;b<=0||window.scrollY>=b-24&&(o.current=!0,m("audit_page_scrolled_to_end",{results_count:q,transcripts_scanned:p}))},c=()=>{0===a&&(a=requestAnimationFrame(b))};return b(),window.addEventListener("scroll",c,{passive:!0}),()=>{window.removeEventListener("scroll",c),0!==a&&cancelAnimationFrame(a)}},[g.status,m,q,i,p]),"empty"===g.status&&!i)return(0,b.jsx)(am,{running:!1,rerunStatus:k,onDismissRerun:t,onStarted:()=>j(!0),onCompleted:async()=>{j(!1),await r()}});if("empty"===g.status&&i)return(0,b.jsx)(am,{running:!0,rerunStatus:k,onDismissRerun:t,onStarted:()=>{},onCompleted:async()=>{j(!1),await r()}});let u="cached"===g.status?g.result:null;if(!u)return null;let v="cached"===g.status?g.cachedAt:null;return("cached"===g.status&&g.params,0===u.transcripts.scanned)?(0,b.jsx)(am,{running:i,mode:"zero-sessions",rerunStatus:k,onDismissRerun:t,onStarted:()=>j(!0),onCompleted:async()=>{j(!1),await r()}}):(0,b.jsx)(al,{result:u,cachedAt:v,projectFromUrl:d,isRunning:i,rerunStatus:k,onRerun:a=>s(a),onDismissRerun:t})}],80311)}];
42
70
 
43
71
  //# sourceMappingURL=app_audit__components_audit-dashboard_tsx_0p9ud47._.js.map