ctxtop 0.0.0-stage → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/.antigravity-plugin/plugin.json +36 -0
  2. package/.claude-plugin/plugin.json +18 -0
  3. package/CHECKSUMS.sha256 +166 -0
  4. package/LICENSE +27 -0
  5. package/README.md +350 -2
  6. package/SECURITY.md +22 -0
  7. package/agents/ah-flash-scout.md +25 -0
  8. package/assets/advanced_view_loaded_420px.png +0 -0
  9. package/assets/hero-demo.svg +188 -0
  10. package/assets/logo.svg +19 -0
  11. package/assets/simple_view_lean_420px.png +0 -0
  12. package/assets/simple_view_loaded_420px.png +0 -0
  13. package/assets/social-preview.svg +72 -0
  14. package/assets/zone_c_step3_shield_full.png +0 -0
  15. package/bin/ah-statusline.mjs +175 -0
  16. package/bin/cli.mjs +3 -0
  17. package/bin/ctxtop.mjs +1799 -0
  18. package/commands/cost-radar.md +11 -0
  19. package/commands/evolve.md +10 -0
  20. package/commands/handoff.md +10 -0
  21. package/commands/horizon.md +10 -0
  22. package/commands/inspect.md +10 -0
  23. package/commands/precheck.md +10 -0
  24. package/config/default_flightcheck.json +133 -0
  25. package/config/modelCatalog.json +785 -0
  26. package/config/platformQuirks.json +19 -0
  27. package/hooks/handlers/compact-lifecycle.mjs +577 -0
  28. package/hooks/handlers/config-change.mjs +402 -0
  29. package/hooks/handlers/hookIo.mjs +311 -0
  30. package/hooks/handlers/hookIpcClient.mjs +83 -0
  31. package/hooks/handlers/post-model-switch.mjs +111 -0
  32. package/hooks/handlers/post-tool-use.mjs +366 -0
  33. package/hooks/handlers/pre-model-switch.mjs +1048 -0
  34. package/hooks/handlers/pre-tool-use.mjs +632 -0
  35. package/hooks/handlers/stop-gate.mjs +526 -0
  36. package/hooks/handlers/user-prompt-submit.mjs +367 -0
  37. package/hooks/hooks.json +131 -0
  38. package/hooks/post_invocation.mjs +13 -0
  39. package/hooks/post_tool_use.mjs +25 -0
  40. package/hooks/pre_invocation.mjs +14 -0
  41. package/hooks/pre_tool_use.mjs +97 -0
  42. package/hooks/register.js +726 -0
  43. package/hooks/session_start.mjs +24 -0
  44. package/hooks/stop.mjs +23 -0
  45. package/hooks.json +56 -0
  46. package/package.json +110 -4
  47. package/packages/antigravity/package.json +14 -0
  48. package/packages/antigravity/src/index.mjs +1 -0
  49. package/packages/claude-code/package.json +14 -0
  50. package/packages/claude-code/src/index.mjs +2 -0
  51. package/packages/core/package.json +14 -0
  52. package/packages/core/src/index.mjs +1 -0
  53. package/packages/engine-node/package.json +14 -0
  54. package/packages/engine-node/src/index.mjs +1 -0
  55. package/packages/mcp/package.json +17 -0
  56. package/packages/mcp/src/server.mjs +396 -0
  57. package/packages/pro/LICENSE-COMMERCIAL.md +19 -0
  58. package/packages/pro/README-SIGNING.md +30 -0
  59. package/packages/pro/package.json +16 -0
  60. package/packages/pro/src/index.mjs +3 -0
  61. package/packages/pro/src/team_finops_pack.mjs +241 -0
  62. package/packages/pro/workers/polar_webhook_worker.mjs +215 -0
  63. package/plugin.json +36 -0
  64. package/rules/AGENTS.md +10 -0
  65. package/sidecars/horizon-daemon/ipcServer.mjs +24 -0
  66. package/sidecars/horizon-daemon/server.mjs +2038 -0
  67. package/sidecars/horizon-daemon/sidecar.json +19 -0
  68. package/skills/cost-radar/SKILL.md +21 -0
  69. package/skills/evolve/SKILL.md +21 -0
  70. package/skills/handoff/SKILL.md +50 -0
  71. package/skills/horizon/SKILL.md +17 -0
  72. package/skills/inspect/SKILL.md +18 -0
  73. package/skills/precheck/SKILL.md +44 -0
  74. package/src/adapters/antigravity/index.mjs +109 -0
  75. package/src/adapters/claude-code/index.mjs +194 -0
  76. package/src/cli/cost_radar.mjs +70 -0
  77. package/src/cli/doctor.mjs +351 -0
  78. package/src/cli/horizon_hud.mjs +888 -0
  79. package/src/cli/init.mjs +425 -0
  80. package/src/cli/postmortem.mjs +515 -0
  81. package/src/coach/cacheGravityRouter.mjs +12 -0
  82. package/src/config/modelCatalog.json +704 -0
  83. package/src/config/platformQuirks.json +19 -0
  84. package/src/core/action_queue.mjs +264 -0
  85. package/src/core/ag_bridge.mjs +346 -0
  86. package/src/core/atomic_io.mjs +124 -0
  87. package/src/core/baseline.mjs +607 -0
  88. package/src/core/blindspot_sensors.mjs +399 -0
  89. package/src/core/bucket_b_runtime.mjs +1200 -0
  90. package/src/core/classifier.mjs +1757 -0
  91. package/src/core/coach/circuit_breakers.mjs +650 -0
  92. package/src/core/coach/contradiction_auditor.mjs +239 -0
  93. package/src/core/coach/effort_advisor.mjs +143 -0
  94. package/src/core/coach/handoff_hydrator.mjs +483 -0
  95. package/src/core/coach/progressive_checkpointer.mjs +551 -0
  96. package/src/core/coach/prompt_decomposer_coach.mjs +141 -0
  97. package/src/core/coach/reflector_queue.mjs +505 -0
  98. package/src/core/coach/saved_quota_ledger.mjs +615 -0
  99. package/src/core/coach/subagent_ipi_sanitizer.mjs +200 -0
  100. package/src/core/coach/subagent_phantom_auditor.mjs +261 -0
  101. package/src/core/coach/task_quota_router.mjs +955 -0
  102. package/src/core/coach/turn_zero_gate.mjs +574 -0
  103. package/src/core/compaction_coach.mjs +1126 -0
  104. package/src/core/config.mjs +214 -0
  105. package/src/core/constants.mjs +1987 -0
  106. package/src/core/detectors_det01_to_16.mjs +1523 -0
  107. package/src/core/doc_indexer.mjs +338 -0
  108. package/src/core/episodic_memory.mjs +135 -0
  109. package/src/core/fts5_output_compressor.mjs +359 -0
  110. package/src/core/git_ledger.mjs +189 -0
  111. package/src/core/handoff_audit.mjs +558 -0
  112. package/src/core/history.mjs +221 -0
  113. package/src/core/hook_diagnostics.mjs +158 -0
  114. package/src/core/horizon_classifier.mjs +326 -0
  115. package/src/core/horizon_config.mjs +802 -0
  116. package/src/core/host_watchdog.mjs +200 -0
  117. package/src/core/layer5_hygiene.mjs +1084 -0
  118. package/src/core/log_resolver.mjs +231 -0
  119. package/src/core/mcp_auditor.mjs +138 -0
  120. package/src/core/micro_skills_store.mjs +91 -0
  121. package/src/core/offenders.mjs +161 -0
  122. package/src/core/parser.mjs +1997 -0
  123. package/src/core/path_canonicalizer.mjs +73 -0
  124. package/src/core/paths.mjs +311 -0
  125. package/src/core/prefix_cache_shield.mjs +386 -0
  126. package/src/core/pro_license.mjs +385 -0
  127. package/src/core/prompt_rubric.mjs +518 -0
  128. package/src/core/pruner.mjs +433 -0
  129. package/src/core/quota.mjs +1860 -0
  130. package/src/core/rsi_instinct_engine.mjs +1197 -0
  131. package/src/core/rsl_clash_auditor.mjs +423 -0
  132. package/src/core/rsl_distiller.mjs +372 -0
  133. package/src/core/rsl_ledger.mjs +969 -0
  134. package/src/core/rsl_triage.mjs +909 -0
  135. package/src/core/sanitizer.mjs +121 -0
  136. package/src/core/session_auditor.mjs +658 -0
  137. package/src/core/session_forensics.mjs +303 -0
  138. package/src/core/session_timeline.mjs +358 -0
  139. package/src/core/settings.mjs +99 -0
  140. package/src/core/shared/detectors.mjs +1342 -0
  141. package/src/core/shared/fnv1a64.mjs +85 -0
  142. package/src/core/shared/handoff_schema.mjs +123 -0
  143. package/src/core/shared/index.mjs +5 -0
  144. package/src/core/shared/ipi_sanitizer.mjs +165 -0
  145. package/src/core/shared/micro_skills.mjs +1 -0
  146. package/src/core/shared/plugin_validator.mjs +202 -0
  147. package/src/core/shared/prompt_hygiene_governor.mjs +1 -0
  148. package/src/core/shield_manager.mjs +1417 -0
  149. package/src/core/sidecar_store.mjs +302 -0
  150. package/src/core/sprint_metrics.mjs +366 -0
  151. package/src/core/sqlite_client.mjs +283 -0
  152. package/src/core/storage_doctor.mjs +358 -0
  153. package/src/core/subagents.mjs +609 -0
  154. package/src/core/swarm_topology.mjs +360 -0
  155. package/src/core/task_quota_router.mjs +1656 -0
  156. package/src/core/telemetry/cache_ttl_watchdog.mjs +284 -0
  157. package/src/core/telemetry/scope_lock_registry.mjs +578 -0
  158. package/src/core/telemetry/shadow_file_detector.mjs +291 -0
  159. package/src/core/telemetry/trajectory_watcher.mjs +259 -0
  160. package/src/core/timeline_svg.mjs +236 -0
  161. package/src/core/tool_surgeon.mjs +305 -0
  162. package/src/core/trajectory_stitcher.mjs +645 -0
  163. package/src/core/u_shaped_optimizer.mjs +789 -0
  164. package/src/core/wal_hygiene.mjs +233 -0
  165. package/src/core-isomorphic/catalog/detectorCatalog.mjs +558 -0
  166. package/src/core-isomorphic/catalog/index.mjs +1 -0
  167. package/src/core-isomorphic/coach/cacheGravityRouter.mjs +1547 -0
  168. package/src/core-isomorphic/coach/microSkills.mjs +1 -0
  169. package/src/core-isomorphic/coach/promptHygieneGovernor.mjs +1 -0
  170. package/src/core-isomorphic/coach/repoCalibration.mjs +254 -0
  171. package/src/core-isomorphic/coach/resumeToolsetAuditor.mjs +321 -0
  172. package/src/core-isomorphic/coach/savedQuotaLedger.mjs +527 -0
  173. package/src/core-isomorphic/coach/smartCompactAdvisor.mjs +305 -0
  174. package/src/core-isomorphic/coach/stateBatonHydrator.mjs +810 -0
  175. package/src/core-isomorphic/coach/ttlWatchdog.mjs +464 -0
  176. package/src/core-isomorphic/config/anthropicModelCatalog.json +606 -0
  177. package/src/core-isomorphic/config/catalogLoader.mjs +1268 -0
  178. package/src/core-isomorphic/config/horizonConfig.mjs +1055 -0
  179. package/src/core-isomorphic/control/callTree.mjs +338 -0
  180. package/src/core-isomorphic/control/coachLatches.mjs +126 -0
  181. package/src/core-isomorphic/control/controlStateMachine.mjs +205 -0
  182. package/src/core-isomorphic/control/index.mjs +49 -0
  183. package/src/core-isomorphic/control/swarmWorktree.mjs +109 -0
  184. package/src/core-isomorphic/control/toolSuspension.mjs +197 -0
  185. package/src/core-isomorphic/diagnostics/drift_guard.mjs +382 -0
  186. package/src/core-isomorphic/diagnostics/index.mjs +9 -0
  187. package/src/core-isomorphic/diagnostics/micro_skills.mjs +471 -0
  188. package/src/core-isomorphic/diagnostics/prompt_hygiene_governor.mjs +888 -0
  189. package/src/core-isomorphic/economics/billingBlocks.mjs +251 -0
  190. package/src/core-isomorphic/economics/cacheGravity.mjs +369 -0
  191. package/src/core-isomorphic/economics/cliffBreaker.mjs +256 -0
  192. package/src/core-isomorphic/economics/driftLatency.mjs +433 -0
  193. package/src/core-isomorphic/economics/dualTtl.mjs +198 -0
  194. package/src/core-isomorphic/economics/index.mjs +47 -0
  195. package/src/core-isomorphic/economics/retentionRadar.mjs +348 -0
  196. package/src/core-isomorphic/guards/bucketBAlphaBeta.mjs +860 -0
  197. package/src/core-isomorphic/guards/bucketBGamma.mjs +442 -0
  198. package/src/core-isomorphic/guards/bucketBHeuristics.mjs +37 -0
  199. package/src/core-isomorphic/guards/circuitBreakers.mjs +1202 -0
  200. package/src/core-isomorphic/guards/det01_03_shell_secret.mjs +1184 -0
  201. package/src/core-isomorphic/guards/det04_12_thrash_rot.mjs +572 -0
  202. package/src/core-isomorphic/guards/det13_20_mcp_scope.mjs +913 -0
  203. package/src/core-isomorphic/guards/docIndexCore.mjs +446 -0
  204. package/src/core-isomorphic/guards/losslessPostSanitizer.mjs +317 -0
  205. package/src/core-isomorphic/guards/slopsquatGate.mjs +551 -0
  206. package/src/core-isomorphic/index.js +27 -0
  207. package/src/core-isomorphic/telemetry/otelExporter.mjs +187 -0
  208. package/src/core-isomorphic/telemetry/scopeLockRegistry.mjs +522 -0
  209. package/src/core-isomorphic/telemetry/sprintMetrics.mjs +327 -0
  210. package/src/core-isomorphic/telemetry/swarmTopology.mjs +152 -0
  211. package/src/core-isomorphic/telemetry/telemetryBridge.mjs +1156 -0
  212. package/src/core-isomorphic/ui/brailleSparkline.mjs +142 -0
  213. package/src/core-isomorphic/ui/costRadarSvg.mjs +276 -0
  214. package/src/core-isomorphic/ui/horizonGrid.mjs +475 -0
  215. package/src/core-isomorphic/ui/horizonPanelHtml.mjs +1237 -0
  216. package/src/core-isomorphic/ui/modViews.mjs +1504 -0
  217. package/src/core-isomorphic/ui/pdfReceiptGenerator.mjs +329 -0
  218. package/src/core-isomorphic/ustf/index.mjs +7 -0
  219. package/src/core-isomorphic/ustf/normalizer.mjs +512 -0
  220. package/src/core-isomorphic/ustf/schema.mjs +186 -0
  221. package/src/core-isomorphic/utils/runtime.mjs +962 -0
  222. package/src/demo/synthetic_states.mjs +661 -0
  223. package/src/diagnostics/bugReportGenerator.mjs +253 -0
  224. package/src/diagnostics/claudeHookCapabilities.mjs +396 -0
  225. package/src/diagnostics/doctorEngine.mjs +295 -0
  226. package/src/engine-node/db/index.mjs +58 -0
  227. package/src/engine-node/db/jsonl_fallback.mjs +184 -0
  228. package/src/engine-node/db/probe.mjs +342 -0
  229. package/src/engine-node/db/sqlite_wrapper.mjs +122 -0
  230. package/src/engine-node/index.mjs +12 -0
  231. package/src/engine-node/ipc/client.mjs +447 -0
  232. package/src/engine-node/ipc/index.mjs +22 -0
  233. package/src/engine-node/ipc/protocol.mjs +177 -0
  234. package/src/engine-node/ipc/server.mjs +445 -0
  235. package/src/engine-node/offloader/index.mjs +6 -0
  236. package/src/engine-node/offloader/tool_offloader.mjs +241 -0
  237. package/src/engine-node/sensors/blindspots.mjs +376 -0
  238. package/src/engine-node/sensors/git_merge_tree.mjs +223 -0
  239. package/src/engine-node/sensors/index.mjs +7 -0
  240. package/src/hooks/antigravity_rsl_hook.mjs +250 -0
  241. package/src/hooks/claude_rsl_hook.mjs +288 -0
  242. package/src/hooks/portfolio_runtime.mjs +858 -0
  243. package/src/hooks/post_invocation.mjs +611 -0
  244. package/src/hooks/pre_invocation.mjs +1725 -0
  245. package/src/hooks/session_start.mjs +199 -0
  246. package/src/shims/agy_cli_compressor.mjs +705 -0
  247. package/src/shims/agy_git_guard.mjs +749 -0
  248. package/src/shims/ah_log_query.mjs +39 -0
  249. package/src/ui/costRadarSvg.mjs +6 -0
  250. package/src/ui/horizonGrid.mjs +1 -0
  251. package/src/ui/horizonPanelHtml.mjs +1 -0
  252. package/src/ui/horizon_panel.css +167 -0
  253. package/src/ui/horizon_panel.js +212 -0
  254. package/src/ui/modViews.mjs +1 -0
  255. package/src/utils/modelSwitchTelemetry.mjs +308 -0
  256. package/src/utils/nodeIo.mjs +59 -0
  257. package/src/utils/runtime.mjs +1 -0
  258. package/src/utils/sessionCalibration.mjs +657 -0
  259. package/src/webview/advanced_view.html +1808 -0
  260. package/src/webview/horizon_panel.html +12397 -0
  261. package/src/webview/registry.mjs +80 -0
  262. package/src/webview/simple_view.html +1370 -0
package/SECURITY.md ADDED
@@ -0,0 +1,22 @@
1
+ # Security & Zero-Trust Open-Source Manifest (`attention-horizon-antigravity`)
2
+
3
+ ## 1. Zero-Trust Network Profile (100% Local In-Memory Telemetry)
4
+
5
+ **Highbeam** (`attention-horizon-antigravity` / `agy-horizon-flightcheck`) inspects sensitive local engineering artifacts (conversation transcripts, file paths, and tool usage). To guarantee enterprise and individual security for the Antigravity and Hacker News developer community:
6
+
7
+ 1. **100% In-Memory Local Telemetry Parsing:** All session token accounting, U-shaped attention curve modeling, and waste classification are computed 100% in-memory from local SQLite (`conversations/*.db`, `conversation_summaries.db`) and JSONL (`transcript_full.jsonl`) reads.
8
+ 2. **Zero Outbound Network Connections:** Neither the CLI HUD (`src/cli/horizon_hud.mjs`), the lifecycle hooks (`src/hooks/*.mjs`), nor the sidecar daemon (`sidecars/horizon-daemon/server.mjs`) opens any external HTTP, HTTPS, WebSocket, or DNS connections. There are **zero telemetry pings**, **zero analytics endpoints**, and **zero external LLM API keys required**.
9
+ 3. **Loopback-Only Binding (`127.0.0.1`):** The Edward Tufte WebView server binds exclusively to `127.0.0.1` (`BIND_HOST = '127.0.0.1'`) and rejects oversized POST payloads (`>4096` bytes). Optional local quota probes communicate strictly over `127.0.0.1` loopback with the local Antigravity `language_server` process.
10
+ 4. **Zero Third-Party npm Dependencies:** The runtime uses only built-in Node.js standard library modules (`node:fs`, `node:path`, `node:os`, `node:http`, `node:crypto`, `node:child_process`, `node:sqlite`, `node:url`), eliminating transitive npm supply-chain risk.
11
+
12
+ ## 2. Read-Only Filesystem Locks (`SQLITE_OPEN_READONLY`)
13
+
14
+ To eliminate any risk of database lock contention or corruption while Google Antigravity is actively streaming turns:
15
+
16
+ 1. **Strict `SQLITE_OPEN_READONLY` Database Access:** Every connection to Antigravity's active session databases (`~/.gemini/<surface>/conversations/*.db` and `conversation_summaries.db`) is opened with `SQLITE_OPEN_READONLY_OPTIONS` (`{ readOnly: true }`, mapping to `SQLITE_OPEN_READONLY`) and closed immediately in a `finally` block.
17
+ 2. **Read-Only JSONL File Descriptors (`'r'`):** Incremental transcript slicing (`transcript_full.jsonl` and `transcript.jsonl`) opens log files strictly with read-only flag `'r'` (`fs.openSync(filePath, 'r')`) and never acquires write locks on active Antigravity session databases.
18
+ 3. **Atomic Sidecar & Backup I/O:** Any optional user-triggered state (such as `docs/HANDOFF_<timestamp>.md` generation or `.bak` transcript backups prior to surgical pruning) is written atomically via PID-scoped temporary files and rename operations.
19
+
20
+ ## 3. Reporting a Vulnerability
21
+
22
+ If you discover a security or path-handling issue, please open a GitHub Security Advisory on the repository or contact `frankmiller@gmail.com`. We respond to security reports within 48 hours.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: ah-flash-scout
3
+ description: Lean Flash repository scout returning <200-token File:Line summaries to protect main-thread Frontier KV cache.
4
+ model: flash
5
+ mainAgent: false
6
+ subagent: true
7
+ excludeDefaultComponents: true
8
+ commandExecutionPolicy: off
9
+ tools:
10
+ - view_file
11
+ - grep_search
12
+ - find_by_name
13
+ - list_dir
14
+ ---
15
+
16
+ # Highbeam Flash Scout (`@ah-flash-scout`)
17
+
18
+ You are a lean, read-only codebase scout running on Gemini Flash so the parent Frontier session (`gemini-4-carbon` / `gemini-4-argon`) preserves its warm implicit KV cache without ingesting raw exploratory search output.
19
+
20
+ ## Strict Operating Contract
21
+ 1. **Read-Only Tools Only:** Use ONLY `grep_search`, `find_by_name`, `list_dir`, and targeted `view_file` (`StartLine`/`EndLine`). Never attempt shell execution or file writes.
22
+ 2. **Hard `< 200`-Token Response Ceiling:** Return ONLY exact `File:StartLine-EndLine` coordinates and 1-line symbol descriptions. Never paste raw multi-line file dumps back to the coordinator.
23
+ 3. **Output Format:**
24
+ - `path/to/file.mjs:L10-L42` — Symbol / invariant summary
25
+ - `path/to/other.mjs:L88-L105` — Call-site / dependency note
@@ -0,0 +1,188 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 520" width="100%" height="100%">
2
+ <defs>
3
+ <linearGradient id="bgGrad" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0%" stop-color="#090d16"/>
5
+ <stop offset="100%" stop-color="#0f172a"/>
6
+ </linearGradient>
7
+ <linearGradient id="cardGrad" x1="0" y1="0" x2="0" y2="1">
8
+ <stop offset="0%" stop-color="#131c2e"/>
9
+ <stop offset="100%" stop-color="#0b1120"/>
10
+ </linearGradient>
11
+ <style>
12
+ .mono { font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace; }
13
+ .sans { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif; }
14
+ @keyframes blinkAmber {
15
+ 0%, 100% { fill-opacity: 1; stroke: #facc15; stroke-width: 1.5px; }
16
+ 50% { fill-opacity: 0.35; stroke-width: 0px; }
17
+ }
18
+ @keyframes pulseDanger {
19
+ 0%, 100% { filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.85)); }
20
+ 50% { filter: drop-shadow(0 0 0px rgba(239, 68, 68, 0)); }
21
+ }
22
+ .blink-amber { animation: blinkAmber 1.4s infinite ease-in-out; }
23
+ .pulse-danger { animation: pulseDanger 1.8s infinite ease-in-out; }
24
+ </style>
25
+ </defs>
26
+
27
+ <!-- Outer Window Frame -->
28
+ <rect width="960" height="520" rx="12" fill="url(#bgGrad)" stroke="#1e293b" stroke-width="2"/>
29
+ <rect x="1" y="1" width="958" height="38" rx="11" fill="#111827"/>
30
+ <circle cx="22" cy="20" r="6" fill="#ef4444"/>
31
+ <circle cx="42" cy="20" r="6" fill="#f59e0b"/>
32
+ <circle cx="62" cy="20" r="6" fill="#22c55e"/>
33
+ <text x="480" y="25" text-anchor="middle" fill="#94a3b8" font-size="13" font-weight="600" class="mono">
34
+ Highbeam (ctxtop v3.4.0) — 40-Cell Context Telemetry HUD &amp; PreInvocation Flight Check
35
+ </text>
36
+
37
+ <!-- Section 1: Turn 50 Prefix Amputation & Sludge Crisis -->
38
+ <g transform="translate(24, 54)">
39
+ <rect width="912" height="205" rx="8" fill="url(#cardGrad)" stroke="#ef4444" stroke-opacity="0.55" stroke-width="1.5"/>
40
+
41
+ <!-- Top Status Strip -->
42
+ <rect x="16" y="14" width="218" height="22" rx="4" fill="#ef4444" fill-opacity="0.18" stroke="#ef4444" stroke-width="1"/>
43
+ <text x="26" y="29" fill="#fca5a5" font-size="11.5" font-weight="700" class="mono">🚨 AMPUTATION CRISIS (TURN 50)</text>
44
+ <text x="250" y="29" fill="#e2e8f0" font-size="12" font-weight="600" class="mono"><tspan fill="#f87171">145k / 200k · 73%</tspan> | Cache Hit: <tspan fill="#fbbf24">41.2%</tspan> | Waste: <tspan fill="#f87171">84k tok</tspan> | TTL: <tspan fill="#f87171">0s (5m)</tspan> | <tspan fill="#38bdf8">[Mode: Read-Heavy Audit]</tspan></text>
45
+
46
+ <!-- Amputation Bracket Label -->
47
+ <path d="M 16 54 L 16 47 L 188 47 L 188 54" fill="none" stroke="#ef4444" stroke-width="1.8"/>
48
+ <text x="102" y="44" text-anchor="middle" fill="#f87171" font-size="10" font-weight="700" class="mono">![ CELLS 1-8: AGENTS.md AT RISK ]!</text>
49
+
50
+ <!-- 40-Cell Chronological Bar -->
51
+ <g>
52
+ <rect x="16" y="58" width="19.5" height="26" rx="3" fill="#00d7ff" fill-opacity="1" class="pulse-danger" />
53
+ <rect x="38" y="58" width="19.5" height="26" rx="3" fill="#00d7ff" fill-opacity="1" class="pulse-danger" />
54
+ <rect x="60" y="58" width="19.5" height="26" rx="3" fill="#00d7ff" fill-opacity="1" class="pulse-danger" />
55
+ <rect x="82" y="58" width="19.5" height="26" rx="3" fill="#ff0087" fill-opacity="1" class="pulse-danger" />
56
+ <rect x="104" y="58" width="19.5" height="26" rx="3" fill="#ffaf00" fill-opacity="0.95" class="pulse-danger" />
57
+ <rect x="126" y="58" width="19.5" height="26" rx="3" fill="#ffaf00" fill-opacity="0.95" class="pulse-danger" />
58
+ <rect x="148" y="58" width="19.5" height="26" rx="3" fill="#ffaf00" fill-opacity="0.95" class="pulse-danger" />
59
+ <rect x="170" y="58" width="19.5" height="26" rx="3" fill="#ffaf00" fill-opacity="0.95" class="pulse-danger" />
60
+ <rect x="192" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
61
+ <rect x="214" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
62
+ <rect x="236" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
63
+ <rect x="258" y="58" width="19.5" height="26" rx="3" fill="#ef4444" fill-opacity="0.95" class="" />
64
+ <rect x="280" y="58" width="19.5" height="26" rx="3" fill="#ef4444" fill-opacity="0.95" class="" />
65
+ <rect x="302" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
66
+ <rect x="324" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
67
+ <rect x="346" y="58" width="19.5" height="26" rx="3" fill="#f97316" fill-opacity="1" class="blink-amber" />
68
+ <rect x="368" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
69
+ <rect x="390" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
70
+ <rect x="412" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
71
+ <rect x="434" y="58" width="19.5" height="26" rx="3" fill="#ef4444" fill-opacity="0.95" class="" />
72
+ <rect x="456" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
73
+ <rect x="478" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
74
+ <rect x="500" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
75
+ <rect x="522" y="58" width="19.5" height="26" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
76
+ <rect x="544" y="58" width="19.5" height="26" rx="3" fill="#22c55e" fill-opacity="1" class="" />
77
+ <rect x="566" y="58" width="19.5" height="26" rx="3" fill="#22c55e" fill-opacity="1" class="" />
78
+ <rect x="588" y="58" width="19.5" height="26" rx="3" fill="#22c55e" fill-opacity="1" class="" />
79
+ <rect x="610" y="58" width="19.5" height="26" rx="3" fill="#22c55e" fill-opacity="1" class="" />
80
+ <rect x="632" y="58" width="19.5" height="26" rx="3" fill="#22c55e" fill-opacity="1" class="" />
81
+ <rect x="654" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
82
+ <rect x="676" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
83
+ <rect x="698" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
84
+ <rect x="720" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
85
+ <rect x="742" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
86
+ <rect x="764" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
87
+ <rect x="786" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
88
+ <rect x="808" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
89
+ <rect x="830" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
90
+ <rect x="852" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
91
+ <rect x="874" y="58" width="19.5" height="26" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
92
+ </g>
93
+
94
+ <!-- Cell Zone Annotations -->
95
+ <text x="16" y="100" fill="#00d7ff" font-size="10.5" class="mono">█ Anchor Rules</text>
96
+ <text x="122" y="100" fill="#ff0087" font-size="10.5" class="mono">▓ Foreign KI Bleed</text>
97
+ <text x="255" y="100" fill="#f59e0b" font-size="10.5" class="mono">▒ 58k Duplicate File Reads</text>
98
+ <text x="442" y="100" fill="#ef4444" font-size="10.5" class="mono">▓ Dead Stack Traces</text>
99
+ <text x="585" y="100" fill="#f97316" font-size="10.5" class="mono">▒ Dirty Disk Snapshot</text>
100
+ <text x="735" y="100" fill="#22c55e" font-size="10.5" class="mono">█ Active Working Set</text>
101
+
102
+ <!-- 4-Line Flight Check Scorecard Box -->
103
+ <rect x="16" y="112" width="880" height="80" rx="6" fill="#090d16" stroke="#334155" stroke-width="1"/>
104
+ <text x="28" y="130" fill="#38bdf8" font-size="11.5" font-weight="700" class="mono">╭── Flight Check v3.1 PreInvocation Router (4.2ms) ── State: HALT_HYGIENE_OR_SAFETY ──────────────────╮</text>
105
+ <text x="28" y="146" fill="#cbd5e1" font-size="11.5" class="mono">│ 1. SENSORS: <tspan fill="#f87171">AMPUTATION_RISK (&gt;140k)</tspan> • <tspan fill="#fbbf24">DIRTY_SNAP (src/routes.mjs)</tspan> • <tspan fill="#f472b6">UNSEEN_CALLER (src/app.mjs)</tspan></text>
106
+ <text x="28" y="162" fill="#cbd5e1" font-size="11.5" class="mono">│ 2. ACTION : <tspan fill="#4ade80" font-weight="700">Type /compact in chat (or run Surgical Pruner) to reclaim 84,000 sludge tokens</tspan></text>
107
+ <text x="28" y="178" fill="#cbd5e1" font-size="11.5" class="mono">╰── Bypass once: prefix with <tspan fill="#fbbf24">!</tspan> • Lock model/effort: <tspan fill="#fbbf24">!lock</tspan> • Force scorecard rewrite: <tspan fill="#38bdf8">#check</tspan> ───────╯</text>
108
+ </g>
109
+
110
+ <!-- Section 2: Post-Compact & Surgical Pruner Recovery + Tufte Telemetry Strip -->
111
+ <g transform="translate(24, 274)">
112
+ <rect width="912" height="222" rx="8" fill="url(#cardGrad)" stroke="#22c55e" stroke-opacity="0.5" stroke-width="1.5"/>
113
+
114
+ <rect x="16" y="14" width="235" height="22" rx="4" fill="#22c55e" fill-opacity="0.16" stroke="#22c55e" stroke-width="1"/>
115
+ <text x="26" y="29" fill="#86efac" font-size="11.5" font-weight="700" class="mono">✓ AFTER /compact + SURGICAL PRUNE</text>
116
+ <text x="268" y="29" fill="#e2e8f0" font-size="12.5" font-weight="600" class="mono">Tokens: <tspan fill="#4ade80">64k / 200k (-81k reclaimed)</tspan> | Purity: <tspan fill="#4ade80">91%</tspan> | Sludge Tax: <tspan fill="#4ade80">$0.00/turn</tspan></text>
117
+
118
+ <!-- Recovered 40-Cell Bar -->
119
+ <g>
120
+ <rect x="16" y="48" width="19.5" height="24" rx="3" fill="#00d7ff" fill-opacity="1" class="" />
121
+ <rect x="38" y="48" width="19.5" height="24" rx="3" fill="#00d7ff" fill-opacity="1" class="" />
122
+ <rect x="60" y="48" width="19.5" height="24" rx="3" fill="#00d7ff" fill-opacity="1" class="" />
123
+ <rect x="82" y="48" width="19.5" height="24" rx="3" fill="#a855f7" fill-opacity="0.95" class="" />
124
+ <rect x="104" y="48" width="19.5" height="24" rx="3" fill="#f59e0b" fill-opacity="0.75" class="" />
125
+ <rect x="126" y="48" width="19.5" height="24" rx="3" fill="#22c55e" fill-opacity="1" class="" />
126
+ <rect x="148" y="48" width="19.5" height="24" rx="3" fill="#22c55e" fill-opacity="1" class="" />
127
+ <rect x="170" y="48" width="19.5" height="24" rx="3" fill="#22c55e" fill-opacity="1" class="" />
128
+ <rect x="192" y="48" width="19.5" height="24" rx="3" fill="#22c55e" fill-opacity="1" class="" />
129
+ <rect x="214" y="48" width="19.5" height="24" rx="3" fill="#22c55e" fill-opacity="1" class="" />
130
+ <rect x="236" y="48" width="19.5" height="24" rx="3" fill="#22c55e" fill-opacity="1" class="" />
131
+ <rect x="258" y="48" width="19.5" height="24" rx="3" fill="#22c55e" fill-opacity="1" class="" />
132
+ <rect x="280" y="48" width="19.5" height="24" rx="3" fill="#22c55e" fill-opacity="1" class="" />
133
+ <rect x="302" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
134
+ <rect x="324" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
135
+ <rect x="346" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
136
+ <rect x="368" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
137
+ <rect x="390" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
138
+ <rect x="412" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
139
+ <rect x="434" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
140
+ <rect x="456" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
141
+ <rect x="478" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
142
+ <rect x="500" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
143
+ <rect x="522" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
144
+ <rect x="544" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
145
+ <rect x="566" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
146
+ <rect x="588" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
147
+ <rect x="610" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
148
+ <rect x="632" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
149
+ <rect x="654" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
150
+ <rect x="676" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
151
+ <rect x="698" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
152
+ <rect x="720" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
153
+ <rect x="742" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
154
+ <rect x="764" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
155
+ <rect x="786" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
156
+ <rect x="808" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
157
+ <rect x="830" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
158
+ <rect x="852" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
159
+ <rect x="874" y="48" width="19.5" height="24" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
160
+ </g>
161
+
162
+ <!-- Bottom 3 Small-Multiple Tufte Panels -->
163
+ <!-- Panel A: U-Shaped Attention Curve -->
164
+ <rect x="16" y="86" width="282" height="122" rx="6" fill="#090d16" stroke="#1e293b" stroke-width="1"/>
165
+ <text x="28" y="105" fill="#94a3b8" font-size="11" font-weight="700" class="mono">U-SHAPED ATTENTION RECALL CURVE</text>
166
+ <path d="M 32 120 Q 155 188 282 118" fill="none" stroke="#38bdf8" stroke-width="2.5"/>
167
+ <circle cx="42" cy="126" r="4" fill="#00d7ff"/>
168
+ <circle cx="155" cy="154" r="4" fill="#f59e0b"/>
169
+ <circle cx="268" cy="124" r="4" fill="#22c55e"/>
170
+ <text x="32" y="196" fill="#64748b" font-size="10" class="mono">Turn 0 Anchors (96%) Middle (42%) Tail (98%)</text>
171
+
172
+ <!-- Panel B: Top Token Offenders Pruned -->
173
+ <rect x="314" y="86" width="292" height="122" rx="6" fill="#090d16" stroke="#1e293b" stroke-width="1"/>
174
+ <text x="326" y="105" fill="#94a3b8" font-size="11" font-weight="700" class="mono">SURGICAL PRUNER LEDGER (SAVED 81k)</text>
175
+ <text x="326" y="128" fill="#cbd5e1" font-size="11" class="mono">1. src/core/router.mjs (x6) <tspan fill="#4ade80">-34.2k</tspan></text>
176
+ <text x="326" y="148" fill="#cbd5e1" font-size="11" class="mono">2. Dead test stack traces (x3)<tspan fill="#4ade80">-22.8k</tspan></text>
177
+ <text x="326" y="168" fill="#cbd5e1" font-size="11" class="mono">3. Stale chat turns (&gt;25 old) <tspan fill="#4ade80">-17.2k</tspan></text>
178
+ <text x="326" y="188" fill="#cbd5e1" font-size="11" class="mono">4. Unused MCP cold schemas <tspan fill="#4ade80"> -6.8k</tspan></text>
179
+
180
+ <!-- Panel C: Instant CLI Quickstart -->
181
+ <rect x="622" y="86" width="274" height="122" rx="6" fill="#090d16" stroke="#1e293b" stroke-width="1"/>
182
+ <text x="634" y="105" fill="#94a3b8" font-size="11" font-weight="700" class="mono">ZERO-CONFIG CLI (NODE 22.5+)</text>
183
+ <text x="634" y="129" fill="#38bdf8" font-size="10.5" class="mono">$ npx attention-horizon-antigravity --demo</text>
184
+ <text x="634" y="151" fill="#4ade80" font-size="10.5" class="mono">$ npx attention-horizon-antigravity init</text>
185
+ <text x="634" y="173" fill="#f472b6" font-size="11" class="mono">$ npx ctxtop --roast</text>
186
+ <text x="634" y="195" fill="#64748b" font-size="10" class="mono">0 deps • &lt;15ms hooks • 100% local</text>
187
+ </g>
188
+ </svg>
@@ -0,0 +1,19 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128">
2
+ <rect width="128" height="128" rx="24" fill="#090d16" />
3
+ <circle cx="64" cy="64" r="52" fill="none" stroke="#1e293b" stroke-width="2" stroke-dasharray="4 4" />
4
+ <path d="M 20 44 Q 64 96 108 44" fill="none" stroke="#38bdf8" stroke-width="3" stroke-linecap="round" />
5
+ <g transform="translate(18, 58)">
6
+ <rect x="0" y="0" width="8" height="12" rx="2" fill="#00d7ff" />
7
+ <rect x="10" y="0" width="8" height="12" rx="2" fill="#00d7ff" />
8
+ <rect x="20" y="0" width="8" height="12" rx="2" fill="#af5fff" />
9
+ <rect x="30" y="0" width="8" height="12" rx="2" fill="#ffaf00" />
10
+ <rect x="40" y="0" width="8" height="12" rx="2" fill="#ffaf00" />
11
+ <rect x="50" y="0" width="8" height="12" rx="2" fill="#ff0000" />
12
+ <rect x="60" y="0" width="8" height="12" rx="2" fill="#ff0000" />
13
+ <rect x="70" y="0" width="8" height="12" rx="2" fill="#00ff00" />
14
+ <rect x="80" y="0" width="8" height="12" rx="2" fill="#00ff00" />
15
+ </g>
16
+ <text x="64" y="94" font-family="system-ui, -apple-system, sans-serif" font-size="11" font-weight="700" fill="#f8fafc" text-anchor="middle" letter-spacing="1.5">HORIZON</text>
17
+ <circle cx="20" cy="44" r="4" fill="#38bdf8" />
18
+ <circle cx="108" cy="44" r="4" fill="#38bdf8" />
19
+ </svg>
@@ -0,0 +1,72 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 640" width="1280" height="640">
2
+ <defs>
3
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0%" stop-color="#070a12"/>
5
+ <stop offset="100%" stop-color="#0f172a"/>
6
+ </linearGradient>
7
+ <style>
8
+ .mono { font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; }
9
+ .sans { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
10
+ </style>
11
+ </defs>
12
+ <rect width="1280" height="640" fill="url(#bg)"/>
13
+ <rect x="36" y="36" width="1208" height="568" rx="20" fill="#0b1120" stroke="#1e293b" stroke-width="3"/>
14
+
15
+ <!-- Top Pill -->
16
+ <rect x="84" y="82" width="460" height="38" rx="19" fill="#00d7ff" fill-opacity="0.12" stroke="#00d7ff" stroke-width="1.5"/>
17
+ <text x="314" y="107" text-anchor="middle" fill="#38bdf8" font-size="18" font-weight="700" class="mono">⚡ Highbeam (ctxtop v3.3)</text>
18
+
19
+ <!-- Main Headline -->
20
+ <text x="84" y="185" fill="#f8fafc" font-size="52" font-weight="800" class="sans">htop for AI Coding Agent</text>
21
+ <text x="84" y="248" fill="#38bdf8" font-size="52" font-weight="800" class="sans">Context Windows.</text>
22
+ <text x="84" y="302" fill="#94a3b8" font-size="24" class="sans">Stop silent AGENTS.md prefix amputation, stale-file overwrites, and 5-hour quota burn.</text>
23
+
24
+ <!-- 40-Cell Visual Bar -->
25
+ <g transform="translate(68, 340) scale(1.28)">
26
+ <rect x="12" y="0" width="19.5" height="32" rx="3" fill="#00d7ff" fill-opacity="1" class="pulse-danger" />
27
+ <rect x="34" y="0" width="19.5" height="32" rx="3" fill="#00d7ff" fill-opacity="1" class="pulse-danger" />
28
+ <rect x="56" y="0" width="19.5" height="32" rx="3" fill="#00d7ff" fill-opacity="1" class="pulse-danger" />
29
+ <rect x="78" y="0" width="19.5" height="32" rx="3" fill="#ff0087" fill-opacity="1" class="pulse-danger" />
30
+ <rect x="100" y="0" width="19.5" height="32" rx="3" fill="#ffaf00" fill-opacity="0.95" class="pulse-danger" />
31
+ <rect x="122" y="0" width="19.5" height="32" rx="3" fill="#ffaf00" fill-opacity="0.95" class="pulse-danger" />
32
+ <rect x="144" y="0" width="19.5" height="32" rx="3" fill="#ffaf00" fill-opacity="0.95" class="pulse-danger" />
33
+ <rect x="166" y="0" width="19.5" height="32" rx="3" fill="#ffaf00" fill-opacity="0.95" class="pulse-danger" />
34
+ <rect x="188" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
35
+ <rect x="210" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
36
+ <rect x="232" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
37
+ <rect x="254" y="0" width="19.5" height="32" rx="3" fill="#ef4444" fill-opacity="0.95" class="" />
38
+ <rect x="276" y="0" width="19.5" height="32" rx="3" fill="#ef4444" fill-opacity="0.95" class="" />
39
+ <rect x="298" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
40
+ <rect x="320" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
41
+ <rect x="342" y="0" width="19.5" height="32" rx="3" fill="#f97316" fill-opacity="1" class="blink-amber" />
42
+ <rect x="364" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
43
+ <rect x="386" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
44
+ <rect x="408" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
45
+ <rect x="430" y="0" width="19.5" height="32" rx="3" fill="#ef4444" fill-opacity="0.95" class="" />
46
+ <rect x="452" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
47
+ <rect x="474" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
48
+ <rect x="496" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
49
+ <rect x="518" y="0" width="19.5" height="32" rx="3" fill="#f59e0b" fill-opacity="0.88" class="" />
50
+ <rect x="540" y="0" width="19.5" height="32" rx="3" fill="#22c55e" fill-opacity="1" class="" />
51
+ <rect x="562" y="0" width="19.5" height="32" rx="3" fill="#22c55e" fill-opacity="1" class="" />
52
+ <rect x="584" y="0" width="19.5" height="32" rx="3" fill="#22c55e" fill-opacity="1" class="" />
53
+ <rect x="606" y="0" width="19.5" height="32" rx="3" fill="#22c55e" fill-opacity="1" class="" />
54
+ <rect x="628" y="0" width="19.5" height="32" rx="3" fill="#22c55e" fill-opacity="1" class="" />
55
+ <rect x="650" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
56
+ <rect x="672" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
57
+ <rect x="694" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
58
+ <rect x="716" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
59
+ <rect x="738" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
60
+ <rect x="760" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
61
+ <rect x="782" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
62
+ <rect x="804" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
63
+ <rect x="826" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
64
+ <rect x="848" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
65
+ <rect x="870" y="0" width="19.5" height="32" rx="3" fill="#1e293b" fill-opacity="0.65" class="" />
66
+ </g>
67
+
68
+ <!-- Bottom Metrics Strip -->
69
+ <rect x="84" y="445" width="1112" height="108" rx="12" fill="#111827" stroke="#334155" stroke-width="1.5"/>
70
+ <text x="116" y="490" fill="#4ade80" font-size="24" font-weight="700" class="mono">$ npx attention-horizon-antigravity init</text>
71
+ <text x="116" y="528" fill="#cbd5e1" font-size="19" class="mono">40-Cell ANSI HUD • Edward Tufte Webview • 6 Blind-Spot Sensors • 0 Dependencies • &lt;15ms SLA</text>
72
+ </svg>
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @file bin/ah-statusline.mjs
4
+ * Standalone `statusLine` JSON bridge for Claude Code Highbeam.
5
+ *
6
+ * Reads Claude Code's `statusLine` JSON payload from `stdin`, updates the atomic
7
+ * bridge snapshot at `.claude/cache/ah_live_state_<sessionId>.json`, and prints
8
+ * a responsive single-line ANSI status bar adapting to terminal column width
9
+ * (80 / 110 / 144 columns).
10
+ */
11
+
12
+ import { fs, path, url } from '../src/utils/nodeIo.mjs';
13
+ import { readStdinJsonAsync } from '../hooks/handlers/hookIo.mjs';
14
+ import {
15
+ createInitialTelemetryState,
16
+ readLiveStateSnapshot,
17
+ ingestStatusLinePayload,
18
+ writeLiveStateSnapshot
19
+ } from '../src/core-isomorphic/telemetry/telemetryBridge.mjs';
20
+ import { renderStatusLine } from '../src/core-isomorphic/ui/modViews.mjs';
21
+ import { inspectClaudeBinaryCapabilities } from '../src/diagnostics/claudeHookCapabilities.mjs';
22
+ import { getRslLedgerPath, getRslSummary } from '../src/core/rsl_ledger.mjs';
23
+
24
+ /**
25
+ * Programmatic entrypoint for the `statusLine` bridge.
26
+ *
27
+ * @param {object} [payload={}] - Parsed `statusLine` stdin JSON payload
28
+ * @param {object} [options={}]
29
+ * @param {number} [options.columns]
30
+ * @param {boolean} [options.ansi=true]
31
+ * @param {string} [options.cwd]
32
+ * @param {number} [options.nowMs]
33
+ * @returns {{
34
+ * line: string,
35
+ * plainLine: string,
36
+ * visibleLength: number,
37
+ * columns: number,
38
+ * layoutTier: string,
39
+ * state: object,
40
+ * sessionPath: string
41
+ * }}
42
+ */
43
+ export function executeStatusLineBridge(payload = {}, options = {}) {
44
+ const sessionId = payload.session_id || payload.sessionId || 'default';
45
+ const currentState = readLiveStateSnapshot(sessionId, options);
46
+ const nextState = ingestStatusLinePayload(currentState, payload, options);
47
+ if (!currentState.hostCapabilities && options.checkCapabilities !== false) {
48
+ const cap = inspectClaudeBinaryCapabilities({
49
+ cwd: payload.cwd || options.cwd,
50
+ claudeBinPath: options.claudeBinPath,
51
+ probeVersion: false
52
+ });
53
+ nextState.hostCapabilities = cap.found
54
+ ? {
55
+ found: true,
56
+ claudeVersion: cap.claudeVersion,
57
+ preModelSwitchSupported: cap.preModelSwitchSupported,
58
+ supportsAskDecision: cap.supportsAskDecision,
59
+ preEffortChangeSupported: cap.preEffortChangeSupported,
60
+ contractValid: cap.contractValid,
61
+ warning: cap.warning
62
+ }
63
+ : { found: false };
64
+ }
65
+ const rslCwd = payload.cwd || options.cwd;
66
+ if (options.rsl) {
67
+ nextState.rsl = options.rsl;
68
+ } else if (rslCwd && (options.includeRsl === true || fs.existsSync(getRslLedgerPath(rslCwd)))) {
69
+ try {
70
+ nextState.rsl = getRslSummary(rslCwd, options);
71
+ } catch {
72
+ // Fail open for statusline
73
+ }
74
+ }
75
+ const persisted = writeLiveStateSnapshot(nextState.sessionId, nextState, options);
76
+
77
+ const envCols = Number(globalThis.process?.env?.AH_COLUMNS || 0);
78
+ const stdoutCols = Number(globalThis.process?.stdout?.columns || 0);
79
+ const payloadCols = Number(payload.terminal?.columns || payload.columns || 0);
80
+
81
+ const columns =
82
+ options.columns ||
83
+ (payloadCols > 0 ? payloadCols : envCols > 0 ? envCols : stdoutCols > 0 ? stdoutCols : 110);
84
+
85
+ const rendered = renderStatusLine(nextState, {
86
+ ...options,
87
+ columns,
88
+ ansi: options.ansi !== false
89
+ });
90
+
91
+ return {
92
+ ...rendered,
93
+ state: nextState,
94
+ sessionPath: persisted.sessionPath
95
+ };
96
+ }
97
+
98
+ /**
99
+ * Symlink-safe CLI main guard (`ISS-014`).
100
+ * Resolves `node_modules/.bin/ah-statusline` symlinks via `realpathSync`
101
+ * with a `path.resolve` fallback when `realpathSync` is unavailable.
102
+ *
103
+ * @param {string} [argv1=globalThis.process?.argv?.[1]]
104
+ * @param {string} [metaUrl=import.meta.url]
105
+ * @param {{ realpathSync?: Function }} [fsImpl=fs]
106
+ * @returns {boolean}
107
+ */
108
+ export function isCliMain(
109
+ argv1 = globalThis.process?.argv?.[1],
110
+ metaUrl = import.meta.url,
111
+ fsImpl = fs
112
+ ) {
113
+ if (!argv1 || !metaUrl) return false;
114
+ try {
115
+ return fsImpl.realpathSync(argv1) === fsImpl.realpathSync(url.fileURLToPath(metaUrl));
116
+ } catch {
117
+ try {
118
+ return path.resolve(String(argv1)) === path.resolve(url.fileURLToPath(metaUrl));
119
+ } catch {
120
+ return false;
121
+ }
122
+ }
123
+ }
124
+
125
+ /**
126
+ * CLI runner when invoked directly as `node bin/ah-statusline.mjs` or symlinked `ah-statusline`.
127
+ */
128
+ export async function runStatusLineCli(args = globalThis.process?.argv?.slice(2) || []) {
129
+ try {
130
+ const colIdx = Array.isArray(args)
131
+ ? (args.indexOf('--columns') !== -1 ? args.indexOf('--columns') : args.indexOf('--cols'))
132
+ : -1;
133
+ const cliCols = colIdx !== -1 && args[colIdx + 1] ? Number(args[colIdx + 1]) : null;
134
+ const columns = (cliCols && Number.isFinite(cliCols) && cliCols > 0)
135
+ ? cliCols
136
+ : Number(globalThis.process?.env?.AH_COLUMNS || globalThis.process?.stdout?.columns || 80);
137
+
138
+ if (Array.isArray(args) && args.includes('--demo')) {
139
+ const demoState = createInitialTelemetryState('demo', 'claude-sonnet-5-5');
140
+ demoState.contextWindow.totalInputTokens = 64000;
141
+ demoState.contextWindow.cachedTokens = 56000;
142
+ demoState.contextWindow.cacheReadTokens = 56000;
143
+ demoState.contextWindow.systemAndMcpTokens = 8000;
144
+ demoState.promptCache.warm = true;
145
+ demoState.promptCache.ttlSeconds = 252;
146
+ const demoRendered = renderStatusLine(demoState, {
147
+ columns,
148
+ includeDiskLedger: false,
149
+ savedUSD: 1.84
150
+ });
151
+ globalThis.process?.stdout?.write?.(`${demoRendered.line}\n`);
152
+ return demoRendered;
153
+ }
154
+ const payload = await readStdinJsonAsync(1500);
155
+ const result = executeStatusLineBridge(payload, cliCols ? { columns: cliCols } : {});
156
+ globalThis.process?.stdout?.write?.(`${result.line}\n`);
157
+ return result;
158
+ } catch (_err) {
159
+ // Graceful statusLine fallback
160
+ return null;
161
+ }
162
+ }
163
+
164
+ export const main = runStatusLineCli;
165
+
166
+ if (isCliMain()) {
167
+ runStatusLineCli();
168
+ }
169
+
170
+ export default {
171
+ executeStatusLineBridge,
172
+ runStatusLineCli,
173
+ isCliMain,
174
+ main
175
+ };
package/bin/cli.mjs ADDED
@@ -0,0 +1,3 @@
1
+ export * from './ctxtop.mjs';
2
+ import ctxtop from './ctxtop.mjs';
3
+ export default ctxtop;