Skip to content

feat(ambient): MVP ambient daemon — git+terminal sources, rule-based triggers (#743) - #917

Merged
AmitoVrito merged 2 commits into
mainfrom
Abhay-Mmmm/v2.1-ambient-agent-system-daemon-that-proactivel
Aug 16, 2026
Merged

AmitoVrito merged 2 commits into
mainfrom
Abhay-Mmmm/v2.1-ambient-agent-system-daemon-that-proactivel

Conversation

@Abhay-Mmmm

Copy link
Copy Markdown
Collaborator

Summary

Scopes down issue #743 ("v2.1: Ambient Agent — system daemon that proactively offers help based on observed activity") to a shippable MVP that proves the core mechanism end-to-end: a background daemon that watches a git repo for dirty state and a terminal for risky commands, and fires a Windows notification when both line up.

  • synapsekit.ambient package: AmbientDaemon mirroring MeshDaemon's start/stop/status lifecycle (signal handling, PID-based cross-process stop)
  • Two source plugins: git (polls git status --porcelain --branch), terminal (tails PSReadLine history, best-effort — after-the-fact, not true pre-exec)
  • Rule-based (non-ML) trigger policy: destructive delete / git reset --hard / force-push-or-clean, gated on the repo being dirty
  • Windows Toast notifications via plyer (new optional extra: pip install -e ".[ambient]")
  • Audit trail reusing AuditLog (jsonl backend), privacy opt-out file (~/.synapsekit/ambient.ignore)
  • New CLI: synapsekit ambient start|stop|status|log

Explicitly out of scope (follow-ups, not oversights)

The full issue asks for 5 source plugins, an ML intent classifier + labeled false-positive-rate test set, 3-OS notification adapters, systemd/launchd units, and a privacy dashboard UI — a multi-week epic. This PR deliberately ships only the slice needed to demonstrate the issue's canonical example. Deferred:

  • editor, browser, screen source plugins
  • ML-based intent classifier / labeled FPR test set
  • macOS/Linux notification adapters, systemd/launchd units
  • Privacy dashboard UI (ignore-file + startup notice cover MVP consent needs)
  • True pre-exec terminal interception ($PROFILE hook)

Test plan

  • pytest tests/ambient tests/cli/test_ambient.py -q — 33 passed
  • pytest tests/plugins tests/cli/test_mesh.py -q — no regressions
  • synapsekit ambient --help / start --help — CLI wiring verified
  • Manual: pip install -e ".[ambient]", run synapsekit ambient start in a dirty repo, run a risky command in the same PowerShell session, confirm a real toast fires (needs an interactive Windows session — not run in this sandbox)

🤖 Generated with Claude Code

Abhay-Mmmm and others added 2 commits August 4, 2026 20:31
…triggers, Windows toast (#743)

Scopes issue #743 down to a shippable slice: one daemon polling git status
and PowerShell history, a rule table for risky commands against a dirty
repo, Windows Toast notifications via plyer, an audit trail, and a privacy
opt-out file. Editor/browser/screen sources, the ML classifier, macOS/Linux
notifiers, and the privacy dashboard UI are deferred as follow-ups.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…atting

Satisfies the async-blocking gate (open() in async poll() must be
offloaded via asyncio.to_thread) and ruff format --check.
@Abhay-Mmmm
Abhay-Mmmm marked this pull request as ready for review August 13, 2026 14:07
@AmitoVrito
AmitoVrito merged commit 6948743 into main Aug 16, 2026
13 checks passed
AmitoVrito added a commit that referenced this pull request Aug 16, 2026
Background daemon watching a git repo + terminal for risky commands,
firing Windows toasts. Includes review fixes: offload toast/audit/status
IO off the event loop, pid-liveness in stop()/status(), secret redaction
in the audit log, and a shell-history disclosure notice.

Closes #917. Part of #743.

# Conflicts:
#	src/synapsekit/cli/main.py
@AmitoVrito

Copy link
Copy Markdown
Collaborator

Merged into main 🎉 Thanks, @Abhay-Mmmm — clean MVP that proves the mechanism end-to-end, and I appreciated the honest "explicitly out of scope" section.

Applied a few review fixes on the way in (all with regression tests):

  • Async-first offloading — the toast, jsonl audit write, and status read/write all ran on the event loop (nested in sync helpers, so the static gate couldn't see them). Now offloaded via asyncio.to_thread.
  • Lifecycle correctness — stop() no longer marks a still-alive daemon "stopped" (which orphaned it and dropped the pid), and status() reconciles against process liveness so a kill -9'd daemon isn't reported as running.
  • Privacy — command text is redacted (mesh secret filter) before it hits the audit log, and startup prints an explicit shell-history disclosure notice.

Closes the MVP slice of #743; the deferred sources/notifiers/ML-classifier remain tracked there. Shipped in the v2.1 [Unreleased] changelog. 🙏

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.

2 participants