Skip to content

feat(memory): sync onboarding — sync init, opt-in auto pull/push, one-time nudge - #179

Merged
sandstream merged 1 commit into
mainfrom
claude/headroom-kit-integration-cmjw7t
Jun 30, 2026
Merged

sandstream merged 1 commit into
mainfrom
claude/headroom-kit-integration-cmjw7t

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Description

Closes the three onboarding gaps in gap #4 (#176/#178) — confirmed missing in review: you had to hand-write ~/.kit/sync.toml, there was no setup command, no upgrade hint, and nothing pulled/pushed automatically (which made the ephemeral-container flow a manual chore).

Type of Change

  • New feature (non-breaking change that adds functionality)

Changes Made

A — kit memory sync init writes the LOCAL ~/.kit/sync.toml template:

  • --remote <url> (git, default) or --command with --push-cmd/--pull-cmd; --auto turns on the hooks; --force overwrites.
  • Won't clobber an existing config; prints next steps (set KIT_MEMORY_PASSPHRASE, and create the private repo — kit makes the branch + blob, not the repo).

B — opt-in auto-sync wired into the memory hooks:

  • [memory.sync] pull_on_start = true → pull+merge at SessionStart, before the "where you left off" recovery (so it reflects the merged store).
  • [memory.sync] push_on_end = true → index+push at SessionEnd — the missing piece for ephemeral containers (memory reaches your durable store before the box is reclaimed).
  • Both are fail-soft (tryAutoPull/tryAutoPush never throw): a session is never blocked by sync. Notes go to stderr; the injected recovery stays on stdout.

C — one-time upgrade nudge: when sync isn't configured but a non-trivial memory store exists, suggest kit memory sync init once (a ~/.kit marker suppresses it thereafter).

New exports in remote-sync.ts: initSyncConfig, tryAutoPull, tryAutoPush, maybeSyncNudge; SyncConfig gains pullOnStart/pushOnEnd.

Testing

Test Coverage

  • Added new tests (init round-trip + no-clobber + flag round-trip; auto-sync gating; push_on_end via command transport; nudge shows-once)
  • All tests pass (npm test) — 1952 pass, 0 fail

Manual Testing

  1. kit memory sync init --remote … --auto writes a config with pull_on_start/push_on_end; re-run without --force → no clobber.
  2. tryAutoPush with push_on_end + a cp-based command transport deposits the encrypted blob (the ephemeral path).
  3. tryAutoPull/tryAutoPush are no-ops (never throw) without the flags.
  4. maybeSyncNudge returns the tip once for a non-trivial store, then null; null once configured.

🤖 Generated with Claude Code

https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg


Generated by Claude Code

…ne-time nudge

Closes the usability gaps in gap #4 (#176/#178): you had to hand-write
~/.kit/sync.toml and nothing synced automatically — which made the
ephemeral-container flow (push before the box is reclaimed) a manual chore.

A. `kit memory sync init` — writes the LOCAL ~/.kit/sync.toml template
   (--remote <url> for git, or --command with --push-cmd/--pull-cmd; --auto
   enables the hooks; --force overwrites). Won't clobber an existing config;
   reminds you to set KIT_MEMORY_PASSPHRASE and to create the private repo
   (kit makes the branch + blob, not the repo).

B. Opt-in auto-sync wired into the memory hooks:
   - [memory.sync] pull_on_start = true  → pull+merge at SessionStart, BEFORE
     the "where you left off" recovery, so it reflects the merged store.
   - [memory.sync] push_on_end = true    → index+push at SessionEnd — the
     missing piece for ephemeral containers.
   Both fail-soft (tryAutoPull/tryAutoPush never throw): a session is never
   blocked by sync. Notes go to stderr; the injected recovery stays on stdout.

C. One-time upgrade nudge: when sync isn't configured but a non-trivial memory
   store exists, suggest `kit memory sync init` once (a ~/.kit marker suppresses
   it thereafter).

New exports in remote-sync.ts: initSyncConfig, tryAutoPull, tryAutoPush,
maybeSyncNudge; SyncConfig gains pullOnStart/pushOnEnd. `sync init` routed in
the memory dispatcher; auto-pull/push + nudge wired into memHook. 4 new tests
(init round-trip, auto-sync gating, command push_on_end, nudge once). 1952 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 7901f5c into main Jun 30, 2026
17 checks passed
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