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

View File

@@ -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/<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.
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.
```
**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
bash .claude/scripts/sync.sh bash .claude/scripts/sync.sh
@@ -81,27 +104,6 @@ Wiki updates (if any): <count> 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/<slug>.md` (or `wiki/projects/<slug>.md`) exist?
- If YES → no action needed
- If NO → emit after the post-commit summary:
```
[INFO] No wiki article for '<slug>' yet.
Session log saved to clients/<slug>/session-logs/<file>.
Run /wiki-compile client:<slug> 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) ## Cross-user note handling (CRITICAL)