From 2a5476f8beb7a99464ff9a5c2830c932a69ff9e8 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Mon, 1 Jun 2026 19:28:52 -0700 Subject: [PATCH] feat(save): full wiki recompile on save (was refresh-only) /save now full-recompiles the worked-on article (Ollama, preserving Patterns/History) so the session's findings land in the wiki, not just dynamic fields. Seeds the article if missing. Softfalls to a surgical refresh when Ollama is down so a save is never blocked. Still pre-sync, so the article ships in the same commit; /scc inherits via /save logic. Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude/commands/save.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.claude/commands/save.md b/.claude/commands/save.md index 9fb0084..afdbc46 100644 --- a/.claude/commands/save.md +++ b/.claude/commands/save.md @@ -59,26 +59,25 @@ When in doubt, include MORE detail — future sessions search these logs to reco --- -## Phase 3 — Wiki Refresh (before sync) +## Phase 3 — Wiki Compile (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). +Fold what you just worked on into the wiki article so it ships in the **same commit** as the session log. This runs before sync and **re-synthesizes** the article (Ollama), so new findings/patterns actually land — not just dynamic fields. 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. +2. Run the `/wiki-compile` generation for that target, writing the article + updating `wiki/index.md`, but **stop before its commit/push step** — `sync.sh` (Phase 4) commits everything together in one commit: + - **Article exists** → **full recompile** (`/wiki-compile : --full`): Ollama re-synthesis that **preserves Patterns and History verbatim** (unless the new session log shows an item resolved) and refreshes everything else, absorbing this session's work. Clients also refresh live Syncro fields (hours, tickets). + - **No article yet** → **seed** (full synthesis) to create it. + - Claude reviews the synthesized article before writing — verify IPs/paths; never invent vault paths (use `(verify)`); keep billing fields Syncro-authoritative. -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. - ``` +3. **Softfail (critical) — a wiki failure must NEVER block the save:** + - If **Ollama is unreachable**, fall back to a surgical **refresh** (bump `last_compiled` + `sources`; refresh client Syncro fields) so the article still records the session, and emit `[WARN] Ollama down — wiki refreshed, not recompiled; run /wiki-compile --full later`. + - Any other failure: log it and continue to sync. -**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. +The article + `wiki/index.md` are picked up by `sync.sh`'s `git add -A` and committed alongside the session log. ---