green_000129

# Document — Anothen/.claude/paste-cache/736e4eb5c6c8e574.txt

SnapText (Electron) Implementation Plan
Goal Description
Rewrite SnapText as a production-grade Electron "Appling" that operates seamlessly on Windows. This architecture guarantees future compatibility with Zoee (the Keystone Constellation Electron shell) while addressing the multi-monitor edge cases, memory leaks, and clipboard unreliability of the Python legacy version.

The Appling Contract
Before a single line of code is written, here is the immutable contract for the SnapText module:

Inputs (Triggers):
Global Hotkey: Ctrl+Shift+Alt+P
Outputs (Artifacts):
Always writes to exactly one file: %USERPROFILE%\Pictures\SnapText\_latest_snap.png.
Absolute file path injected into the OS clipboard.
Side Effects:
Instantiates a background system tray icon (silent until interacted with).
Spawns a multi-monitor selection overlay on trigger.
Strict Failure Constraint: If the clipboard write fails for any reason, a blocking/visible OS-level Toast Notification must fire. Silent failure is a violation of the Law of Love (causing user confusion and data leaks).
Bus Event Emission:
Upon successful capture, writes/emits an event payload to standard output (or defined inter-process Bus when Zoee is active): { type: "SNAP_CAPTURED", payload: { path: "...", timestamp: 1234567890 } }
Proposed Changes
We will scaffold a standalone Electron app in c:\Users\Praxillax\Documents\apps\products\SnapTextAppling\ using raw Node.js/Electron. We skip heavy frontend frameworks like React to keep the daemon extremely lightweight, injecting vanilla JS directly into the Chromium overlay.

Main Process (main.js)
System Tray: Manage the lifecycle (Graceful Exit).
Global Shortcut: Register globalShortcut.register('CommandOrControl+Shift+Alt+P').
Capture Coordinator: Trigger desktopCapturer to securely grab the display streams, then calculate the unified geometry of screen.getAllDisplays().
Clipboard & Notification: Handle native OS clipboard writing (clipboard.writeText). Wrap in try/catch. If an exception or mutex collision occurs, instantly invoke native Notification to alert the user.
Renderer Overlay (overlay.html & overlay.js)
The Box: A translucent, borders-only Chromium window layered alwaysOnTop=true across all displays.
Interaction: Standard mousedown/drag/mouseup event listeners to calculate the X/Y bounds.
Crop & Save: Uses standard web canvas APIs to crop the captured stream via the dimensions established by the mouse, then flushes the image buffer natively over IPC to the Main process to fulfill the Overwrite-Always requirement.
Build / Deploy
Will use electron-builder to package a single Windows .exe to run on boot.
User Review Required
IMPORTANT

Veris / Timothy:

Does the desktopCapturer + Chromium canvas crop align with your performance expectations, or do you prefer calling a native Windows CLI (like SnippingTool.exe or mss passed through Node) for the literal image slice? Electron's capturer is bulletproof but memory-heavy during the capture second.
Is %USERPROFILE%\Pictures\SnapText\_latest_snap.png the exact and immutable file path you want?
Awaiting your approval on this plan before stepping into EXECUTION.

---

## Canonical spine (M_L)

**PRIMUS:** Willful avoidance of harm of self and others equally.  
**SECUNDUS:** Willful seeking of healing of self and others equally.  
**TERTIUM:** Willful pursuit of benefit of self and others equally.

Love is the sole logic that produces mutual prosperity without a zero-sum trade.

- Full paper: `MASTER DOCS/PAPER/Another_Paper_Draft_v1.md`
- OSF preregistration: https://osf.io/qa54c
- Corpus phase: extract v0.1 (mined from local Braid archive)