This guide walks you through setting up Sleepy Tabs Guardian from scratch, including the Chrome extension, the companion native host, and verification steps.
node -v, npm -v).chrome.debugger sampler attaches. This only occurs when the native companion is offline.cd /home/poly # or your preferred workspace
# git clone <repo-url> sleepy-tabs-ext # once hosted remotely
cd sleepy-tabs-ext
npm install
npm install -w extension
npm install -w companion
Transpile the Playwright companion:
npm run build -w companion
Optionally run linting and type checks to confirm toolchain health:
npm run lint
npm run typecheck
Start Chrome/Chromium with CDP accessible (default 9222):
/opt/google/chrome/chrome --remote-debugging-port=9222 --user-data-dir=/tmp/sleepy-tabs-profile
Adjust the path for your platform or use chromium where appropriate. Using a dedicated profile avoids conflicts with personal browsing.
Create an executable wrapper script to run the compiled companion:
cat <<'EOF' > /home/poly/sleepy-tabs-ext/native-messaging/run-companion.sh
#!/usr/bin/env bash
exec /usr/bin/env node /home/poly/sleepy-tabs-ext/companion/dist/index.js "$@"
EOF
chmod +x /home/poly/sleepy-tabs-ext/native-messaging/run-companion.sh
native-messaging/sleepy-tabs-companion.json:
/ABSOLUTE/PATH/TO/sleepy-tabs-companion with the path to run-companion.sh.REPLACE_WITH_EXTENSION_ID after the extension is loaded (see step 7).~/.config/google-chrome/NativeMessagingHosts/~/.config/chromium/NativeMessagingHosts//Library/Application Support/Google/Chrome/NativeMessagingHosts/%LOCALAPPDATA%\Google\Chrome\User Data\NativeMessagingHosts\CDP_ENDPOINT=http://127.0.0.1:9222 npm run start -w companion
Keep this terminal open; it maintains the CDP connection and streams telemetry back to the extension.
Start Vite in watch mode:
npm run dev
The output appears in extension/dist.
chrome://extensions and enable Developer Mode.extension/dist.side panel) populates entries and memory metrics.chrome:// or PDF pages) you will see a lightweight popup window instead. Only one reminder window opens per tab and it closes automatically once you decide or the countdown expires.Some teams want a richer memory snapshot sourced from measureUserAgentSpecificMemory. You can opt-in per profile:
chrome-extension://<id>/src/pages/options/index.html).Reminders normally bring the impacted tab to the foreground so you can immediately decide whether to pause or reload it. If you prefer to stay on your current tab (for example, while presenting or taking notes), open the Settings page and toggle Switch to the tab when showing reminders. The setting is on by default to match the legacy behavior, but you can disable it at any time without reloading the extension.
Why a new window sometimes appears: Chrome restricts extensions from injecting UI into privileged pages (e.g.,
chrome://,chrome-extension://, PDF viewer, Web Store). When that happens Sleepy Tabs launches a single reminder popup window so the prompt is still visible. The window is recycled per tab and closes gracefully when you act or when the timer finishes.
chrome.debugger to gather Performance.getMetrics samples. Chrome displays an infobar during each quick attach/detach cycle.performance.memory inside each tab when available, providing approximate JS heap totals and usage without any special permissions.chrome.processes API when all other sources are unavailable. These readings match Chrome’s Task Manager and are only recorded after exceeding the Process fallback threshold (MB) slider on the Settings page. Each telemetry record notes which threshold fired so you can trace aggressive policies later. Chrome currently restricts this API to Dev/Beta/Canary builds, so the toggle stays disabled on stable releases to avoid misleading warnings.npm run test / npm run test -w companion: execute unit tests.npm run build: produce a production build and load that folder to replicate release behavior.npm audit to review dependency advisories; follow up with mitigations before publishing.Proceed to docs/usage.md for deeper operational tips, profile management, and troubleshooting, and review docs/contributing.md prior to opening issues or pull requests.