Skip to content

Opt-in activity reader and setting (step 1 of #195) - #196

Merged
MehdiMamas merged 8 commits into
mainfrom
activity-optin
Nov 5, 2026
Merged

MehdiMamas merged 8 commits into
mainfrom
activity-optin

Conversation

@MehdiMamas

Copy link
Copy Markdown
Owner

Part of #195

What it does

An opt-in setting, off by default, "Share activity and presence". Step 1 is local only: it reads how long since the last keyboard or mouse input and writes it to <state>/activity.json. Nothing is sent to other machines yet (step 2).

  • crates/core/src/activity.rs: idle_seconds() (Windows GetLastInputInfo, macOS IOKit HIDIdleTime, other systems unknown), a pure Tracker (active below 120 s, idle from 120 s, write on change or every 300 s) and a 30 s loop.
  • choices.rs: activity { share, ts }, set_activity, merged by its own ts.
  • Headless CLI and app binary: activity status|enable|disable [--json]; the daemon and the app run the loop.
  • Settings row with a consent dialog (app/ui/src/activity-consent.ts), Tauri commands get_activity / set_activity, fake backend.
  • AGENTS.md and architecture §22.

Idle cost

One OS call per 30 s, 0 to 12 small local writes per hour, no network. While sharing is off the loop only reads the local choices file.

Checks run (Ubuntu 24 on WSL2)

  • cargo fmt --all -- --check: exit 0
  • cargo clippy -p claude-sync-core -p claude-sync-cli --no-default-features --all-targets -- -D warnings: exit 0
  • cargo test -p claude-sync-core --no-default-features -p claude-sync-cli: exit 0, 534 core tests, 28 cli unit tests and the new tests/activity.rs, 0 failed
  • pnpm -C app/ui test: 30 passed; pnpm -C app/ui build (tsc and vite): exit 0
  • Not run locally: the Tauri app crate (no WebKit libraries on this machine) and the real-reading test on Windows and macOS; CI covers both.

Before: the UI check could not start the window.
Now: it starts the Vite dev server with the fake backend and opens Settings and Groups.
Before: the UI check needed pnpm on the machine.
Now: it runs pnpm 9 through npx.
@MehdiMamas
MehdiMamas merged commit e242da9 into main Nov 5, 2026
3 checks passed
@MehdiMamas
MehdiMamas deleted the activity-optin branch November 5, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opt-in: share activity and presence with your own machines

1 participant