From f44a96b0d1e39748ec904ddab5f84b6f9792ec78 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Mon, 1 Jun 2026 19:26:31 -0700 Subject: [PATCH] feat(save): refresh worked-on wiki article before sync /save now refreshes the client/project wiki article (refresh-only: live Syncro fields, sources, last_compiled -- never narrative/Patterns/History) before sync.sh, so the article + index ship in the same commit as the session log. Skips root/general scope; suggests /wiki-compile seed when no article exists; softfails so a wiki hiccup never blocks the save. Folds in the old post-sync unseeded-wiki check. /scc inherits via /save logic. Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude/commands/save.md | 46 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/.claude/commands/save.md b/.claude/commands/save.md index 2384240..9fb0084 100644 --- a/.claude/commands/save.md +++ b/.claude/commands/save.md @@ -59,7 +59,30 @@ When in doubt, include MORE detail — future sessions search these logs to reco --- -## Phase 3 — Sync +## Phase 3 — Wiki Refresh (before sync) + +Keep the worked-on wiki article current so it ships in the **same commit** as the session log. This runs before sync. **Refresh only** — it never re-synthesizes narrative (that is `/wiki-compile --full`, run on demand). + +1. Derive the slug from the session-log path written in Phase 2: + - `clients//session-logs/...` → client `` + - `projects//session-logs/...` → project article slug (e.g. `guru-rmm`, `guru-connect`) + - Root `session-logs/...` → **skip this phase entirely** (no single article is implied) + +2. **Article exists** (`wiki/clients/.md` or `wiki/projects/.md`) → apply the surgical refresh from `/wiki-compile` Phase 4 "Refresh Mode": + - Frontmatter: set `last_compiled` (today) and `compiled_by` (`/claude-main`); append the new session-log path to `sources:` (dedupe). + - **Clients only:** refresh "Hours remaining" and the "Active Work" ticket list from live Syncro (read-only GET; customer id from the article frontmatter). Softfail if Syncro is unreachable — still bump `last_compiled` + `sources`. + - **Never** touch Patterns, History, or Summary — those require `--full` or human review. + +3. **No article yet** → do not auto-seed here (seeding is a full Ollama synthesis, too heavy for every save). Emit: + ``` + [INFO] No wiki article for '' yet. Run /wiki-compile client: to seed it. + ``` + +**Softfail:** a wiki-refresh failure must NEVER block the save. Log it and continue to sync. The refreshed article + `wiki/index.md` are picked up by `sync.sh`'s `git add -A` and committed alongside the session log. + +--- + +## Phase 4 — Sync ```bash bash .claude/scripts/sync.sh @@ -81,27 +104,6 @@ Wiki updates (if any): articles updated (clients/projects/systems/patter --- -## Phase 4 — Unseeded Wiki Check - -After sync completes, check whether the session log was written for a client or project that has no wiki article yet. - -**Logic:** -- Determine the slug from the session log path (e.g., `clients/kittle/session-logs/...` → slug = `kittle`) -- Check: does `wiki/clients/.md` (or `wiki/projects/.md`) exist? -- If YES → no action needed -- If NO → emit after the post-commit summary: - -``` -[INFO] No wiki article for '' yet. - Session log saved to clients//session-logs/. - Run /wiki-compile client: to seed the wiki article. -``` - -For general (root) session logs, skip this check — no specific client/project is implied. - -This check is informational only — do not block the save or prompt for confirmation. - ---- ## Cross-user note handling (CRITICAL)