Skip to content

Laptop transcript sync: agent hooks install + agent session sync#23

Draft
ellipsis-dev[bot] wants to merge 2 commits into
mainfrom
laptop-hooks-sync
Draft

Laptop transcript sync: agent hooks install + agent session sync#23
ellipsis-dev[bot] wants to merge 2 commits into
mainfrom
laptop-hooks-sync

Conversation

@ellipsis-dev

@ellipsis-dev ellipsis-dev Bot commented Jul 4, 2026

Copy link
Copy Markdown

Client half of laptop ingestion + handoff (documents/eng/LOCAL_CLAUDE_CODE.md §7.1–7.2 in ellipsis-dev/ellipsis). Server half: ellipsis-dev/ellipsis#5578.

  • agent hooks install|uninstall|status|enroll|unenroll — writes Stop + SessionEnd hooks into ~/.claude/settings.json (idempotent, preserves other hooks; Stop is async: true so uploads never block the developer's session, SessionEnd is synchronous with a 60s timeout since the CC process is exiting) and manages the per-repo enrollment set in the CLI config — consent is per-repo opt-in, never account-wide. install enrolls the current repo by default (--no-enroll to skip).
  • agent session sync [--hook] — resolves the cwd's repo from its git origin remote → silent no-op unless enrolled → reads the on-disk JSONL transcript → redacts client-side (GitHub/AWS/sk-/Slack/GitLab/npm token shapes, JWTs, PEM private-key blocks, Authorization headers) → gzip+base64 → POST /v1/sessions/sync. Hook mode always exits 0 (problems go to stderr → CC debug log) so a sync failure can never disturb the session.
  • agent session handoff "<instructions>"git stash create captures the dirty tree as a commit without disturbing it (clean tree hands off HEAD), pushes it to refs/ellipsis/handoff/<cc-session-short>, runs a final transcript sync (handoff is itself the consent action — no enrollment gate), then POST /v1/sessions/handoff with the instructions as the session prompt. Prints the dashboard session link.
  • Spool-and-retry — network-class failures spool the snapshot (one file per CC session, latest-wins, capped at 50) under ~/.config/ellipsis/spool/ and drain after the next successful sync. 4xx rejections are never spooled.
  • Tests for the pure logic (remote-URL parsing, enrollment set, redaction); tsc --noEmit + full vitest suite green.

Notes:

  • Deliberately does not touch src/commands/run.tsx/urls.ts — the run→session rename (cutover tail) is in flight separately; this adds the new session/hooks command groups only, so the two changes should merge cleanly.
  • Known limitation: git stash create doesn't capture untracked files; follow-up if it bites.

ellipsis-dev Bot added 2 commits July 4, 2026 20:48
Client half of laptop ingestion (ellipsis-dev/ellipsis
documents/eng/LOCAL_CLAUDE_CODE.md section 7.1):

- agent hooks install|uninstall|status|enroll|unenroll: writes Stop +
  SessionEnd hooks into ~/.claude/settings.json (Stop async so uploads never
  block the session; SessionEnd synchronous with a timeout) and manages the
  per-repo enrollment set in the CLI config (consent is per-repo opt-in,
  never account-wide).
- agent session sync [--hook]: resolves the cwd's repo from its git remote,
  silently no-ops unless enrolled, reads the on-disk JSONL transcript,
  redacts client-side (GitHub/AWS/sk-/Slack/GitLab/npm tokens, JWTs, PEM
  blocks, Authorization headers), gzips+base64s, POSTs to /v1/sessions/sync.
  Hook mode always exits 0 so a sync problem can never disturb the session.
- Spool-and-retry: network-class failures write the snapshot to
  ~/.config/ellipsis/spool (one file per CC session, capped at 50) and are
  drained after the next successful sync; 4xx rejections are never spooled.
Laptop -> cloud handoff (LOCAL_CLAUDE_CODE.md section 7.2): git stash create
captures the dirty tree as a commit without disturbing it (clean tree hands
off HEAD), pushed to refs/ellipsis/handoff/<cc-session-short> so the sandbox
can fetch it; then a final transcript sync (handoff is itself the consent
action, so no enrollment gate) and POST /v1/sessions/handoff with the
instructions as the session prompt. Prints the dashboard session link.
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.

0 participants