Files
claudetools/.claude/commands/sync.md
Mike Swanson 68ad1dbd40 feat(harness): P1+P2+P3 harness optimization complete (VERSION 1.4.0)
Task 5  one-line registry descriptions on the 8 biggest skills (remediation-tool,
        gc-audit, packetdial, memory-dream, human-flow, self-check, impeccable,
        mailprotector); skill-description injection ~3320 -> ~2123 tokens (~36%),
        keyword triggers preserved, frontmatter valid.
Task 7  thinned /save + /sync bodies to point at sync.sh (single source) instead of
        re-documenting internals; Phase 0 save-vs-sync, cross-user notes, exit-75
        reporting kept verbatim; mechanical sync never depends on an LLM step.
Task 10 session-logs/YYYY-MM/ forward convention for new logs (scoped-grep recall,
        no monolithic index); existing flat logs untouched (grep covers both).
Bash    now-phoenix.sh helper (fixed UTC-7 epoch math; replaces unreliable
        TZ=America/Phoenix date that silently returns UTC on Git-Bash).

P0 (1.2.0) + Task 6 CLAUDE split + Task 9 delegation (1.3.0) already shipped.
Spec: specs/claudetools-harness-optimization/plan.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 08:11:03 -07:00

3.4 KiB

Sync the ClaudeTools and vault repos with Gitea.

Phase 0 — Uncommitted Session Log Check

Run this before invoking sync.sh.

git status --porcelain | grep -E '\bsession-logs/.*\.md$' | grep -v '^\s*D '

This finds any untracked (??) or modified ( M, M , AM) session log files across all locations:

  • session-logs/*.md (root general logs)
  • clients/*/session-logs/*.md
  • projects/*/session-logs/*.md

If count == 0: proceed with sync normally (invoke sync.sh).

If count > 0:

Emit:

[WARNING] Found <N> uncommitted session log(s):
  - <path/to/file.md>
  - ...

These contain work context that will be auto-committed with a generic
"sync: auto-sync" message if you proceed. Run /save instead to capture
a proper narrative summary before syncing.

Then ask: "Run /save now, or proceed with plain sync anyway?"

  • If user says save (or doesn't respond / says yes): execute the full /save flow (write session log → sync.sh). Do NOT call sync.sh separately after — /save already calls it.
  • If user says proceed / skip: invoke sync.sh directly and note that the session logs will be auto-committed with generic messages.

The intent: a /sync that finds unsaved work should default toward /save. Auto-committing session logs with "sync: auto-sync" loses the narrative context that makes logs searchable.


What this does

Run it — the script is the single source of truth for all git ops (both /sync and /save invoke it):

bash .claude/scripts/sync.sh

It stages (git add -A, submodule gitlinks unstaged unless --with-submodules), auto-commits, fetch+rebase+push for this repo then the vault repo, deploys .claude/commands/*.md + skills to ~/.claude/, and surfaces incoming ## Note for <user> blocks. Full internals: .claude/CLAUDE_EXTENDED.md / the script header.

Exit 75 = deferred, not a failure. The run is serialized by a per-machine lock (.git/claudetools-sync.lock); if another sync is mid-flight it waits ~120s then exits 75. On a 75, report "sync deferred — another sync is running; it will catch up next run", NOT a success summary. Stale locks (dead owner, or >10 min) auto-reclaim.


Cross-user note handling (CRITICAL)

If sync surfaces a note from another user, display it prominently at the top of the response, before the sync summary, formatted as:

============================================================
MESSAGE FROM <author> (<date>)
============================================================
<full note content>
============================================================

Address each action item or question explicitly before moving on. Do not bury cross-user notes in the sync summary or skip them because other work is in progress.


Output format

Report:

  • Pulled commits — count + authors + one-line summaries
  • Wiki updates — categorized by clients/projects/systems/patterns/meta with status (added/modified/deleted)
  • Pushed commits — count + your commits + outgoing SHAs
  • Vault sync status — pulled/pushed/clean
  • Cross-user notes addressed (if any)
  • Final HEAD + status

Companion: /save

/save writes a comprehensive session log first, then invokes the same sync.sh. Use /save after substantive work to capture context for future sessions. Use /sync for routine repo sync without writing a log (start of day, switching machines, mid-session check-in).