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) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 19:28:52 -07:00
parent f44a96b0d1
commit 2a5476f8be

View File

@@ -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/<slug>/session-logs/...` → client `<slug>`
- `projects/<project>/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/<slug>.md` or `wiki/projects/<slug>.md`) → apply the surgical refresh from `/wiki-compile` Phase 4 "Refresh Mode":
- Frontmatter: set `last_compiled` (today) and `compiled_by` (`<MACHINE>/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 <type>:<slug> --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 '<slug>' yet. Run /wiki-compile client:<slug> 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.
---