feat(wiki): draft wiki articles with a Sonnet subagent, not Ollama

Seed/full synthesis in /wiki-compile (and the /save Phase 3 recompile) now
delegates the draft to a Sonnet subagent (model: "sonnet") instead of
Ollama qwen3 — better prose quality, no local-Ollama dependency. Refresh
mode unchanged (surgical, no model). Main agent still reviews the draft
before writing (billing/IPs/vault-paths; Patterns/History preserved).
Softfail now keys on subagent unavailability -> surgical refresh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 19:39:17 -07:00
parent 5afb78125b
commit c893d3eebe
2 changed files with 16 additions and 23 deletions

View File

@@ -8,16 +8,16 @@ Seed new wiki articles or refresh existing ones from session logs, client docume
```
/wiki-compile client:<slug> Seed or refresh a client wiki article
/wiki-compile client:<slug> --full Force full Ollama recompile of existing article
/wiki-compile client:<slug> --full Force full recompile of existing article (Sonnet synthesis)
/wiki-compile project:<slug> Compile a project wiki article (no Syncro)
/wiki-compile system:<slug> Compile a system wiki article (no Syncro)
/wiki-compile all Process all missing + stale articles
```
**Mode auto-detection:**
- If `wiki/clients/<slug>.md` **does not exist****Seed mode** (full Ollama synthesis)
- If `wiki/clients/<slug>.md` **exists** and no `--full` flag → **Refresh mode** (surgical update of dynamic fields only)
- `--full` flag → **Full recompile** (Ollama synthesis, preserves existing Patterns/History)
- If `wiki/clients/<slug>.md` **does not exist****Seed mode** (full synthesis, Sonnet subagent)
- If `wiki/clients/<slug>.md` **exists** and no `--full` flag → **Refresh mode** (surgical update of dynamic fields only, no subagent)
- `--full` flag → **Full recompile** (Sonnet synthesis, preserves existing Patterns/History)
---
@@ -35,19 +35,10 @@ case "$USER_ID" in
howard) API_KEY="Tde5174a6e9e312d14-02fd5bfe0f0ee40c87d027507c680e18" ;;
*) echo "[WARNING] Unknown user — Syncro enrichment skipped" ; API_KEY="" ;;
esac
# Ollama endpoint
MACHINE=$(jq -r '.machine // empty' "$CLAUDETOOLS_ROOT/.claude/identity.json")
case "$MACHINE" in
DESKTOP-0O8A1RL|GURU-BEAST-ROG) OLLAMA="http://localhost:11434" ;;
*) OLLAMA="http://100.101.122.4:11434" ;;
esac
if ! curl -s -m 3 "$OLLAMA/api/tags" >/dev/null 2>&1; then
echo "[INFO] Ollama unreachable — synthesis will be Claude-direct"
OLLAMA=""
fi
```
**Synthesis engine:** seed/full article drafting is done by a **Sonnet subagent** (Agent tool, `model: "sonnet"`), not Ollama. The main agent gathers sources + Syncro data, delegates the draft, then reviews it before writing. No Ollama dependency.
---
## Phase 1 — Argument Parsing
@@ -288,11 +279,13 @@ After edits, emit:
- Sources: ${SOURCE_COUNT} files tracked
```
### Seed Mode / Full Recompile — Ollama Synthesis
### Seed Mode / Full Recompile — Claude Synthesis (Sonnet subagent)
Prepare the synthesis context by reading the most relevant source files. For sessions logs, read the full content of client-specific logs and the first 200 lines of root session logs (to avoid overwhelming the prompt). For full recompile, also read the existing article.
Prepare the synthesis context by reading the most relevant source files. For session logs, read the full content of client-specific logs and the first 200 lines of root session logs (to avoid overwhelming the prompt). For full recompile, also read the existing article.
**Ollama prompt:**
Delegate the draft to a **Sonnet subagent** via the Agent tool (`model: "sonnet"`), passing the brief below. The subagent returns the article markdown; the main agent reviews it (billing/IPs/vault-paths accurate, Patterns/History preserved on full recompile) before writing in Phase 5.
**Subagent brief:**
```
You are compiling a wiki article for an MSP (managed service provider) client.
@@ -344,7 +337,7 @@ RULES:
8. Backlinks: list any wiki article slugs (clients/projects/systems) that this client is cross-referenced with
```
If Ollama is unreachable: Claude writes the article directly using the same rules and all collected data.
If the subagent is unavailable, the main agent writes the article directly using the same rules and all collected data.
---