sync: auto-sync from GURU-5070 at 2026-06-08 07:55:26

Author: Mike Swanson
Machine: GURU-5070
Timestamp: 2026-06-08 07:55:26
This commit is contained in:
2026-06-08 07:55:31 -07:00
parent ec0b30d44d
commit f1c6581467
6 changed files with 64 additions and 21 deletions

View File

@@ -342,12 +342,33 @@ If the subagent is unavailable, the main agent writes the article directly using
---
## Phase 5 — Write Article + Update Index
## Phase 5 — Serialize, Stage, Review, Apply (Task 2)
**Write the article:**
- Seed: write `wiki/clients/<slug>.md` from generated content
- Full: overwrite `wiki/clients/<slug>.md`
- Refresh: edits already applied in Phase 4
Wiki writes are SERIALIZED + STAGED so two machines never recompile the same article
into a conflict, and no synthesis lands in the live article without a review.
**5.0 Claim a per-article coord lock** (via the `coord` skill):
`lock claim claudetools wiki/<type>/<slug> "wiki-compile <slug>" --ttl 1`.
- The TTL auto-evicts a dead session's lock (no permanent stranding).
- If the lock is **already held** → emit `[SKIP] wiki/<type>/<slug> is being compiled on
another machine; try again shortly` and exit cleanly.
- If **coord is unreachable** → emit `[WARN] coord down — proceeding without lock` and continue.
- RELEASE the lock in 5.3 — and on ANY error/abort before then.
**5.1 Write the synthesized article to STAGING, not the live tree:**
- Staging path: `.claude/wiki_staging/<type>-<slug>.md` (`mkdir -p .claude/wiki_staging`).
Write the generated/recompiled article THERE. Do NOT touch `wiki/...` yet.
**5.2 Review the staged diff (NO blind merge):**
- `diff -u "<live wiki path>" ".claude/wiki_staging/<type>-<slug>.md" | head -120` (or
`(new article)` if none). The main agent reviews: Patterns/History preserved on full
recompile, IPs/paths/vault-paths accurate, billing Syncro-authoritative, NO structural
corruption or duplicated headers. If the diff looks wrong → STOP, fix the staged file or
abort (release the lock); do not apply.
**5.3 Apply the staged article to the live tree** (then index + commit in Phase 6):
- `cp .claude/wiki_staging/<type>-<slug>.md <live wiki path>` (seed/full); refresh edits
already applied in Phase 4 still go via this staging review.
**Update `wiki/index.md`:**
- Check if `wiki/clients/<slug>.md` is listed in the Clients table
@@ -366,7 +387,11 @@ If the subagent is unavailable, the main agent writes the article directly using
cd "$CLAUDETOOLS_ROOT"
git add "wiki/clients/${SLUG}.md" wiki/index.md
git commit -m "wiki: compile ${SLUG} (${MODE})"
git fetch origin && git rebase origin/main # serialized, but rebase defensively
git push origin main
# Release the per-article lock and clear staging (ALWAYS — even on an earlier abort):
$PY "$CLAUDETOOLS_ROOT/.claude/skills/coord/scripts/coord.py" lock release claudetools "wiki/${TYPE}/${SLUG}" 2>/dev/null || true
rm -f "$CLAUDETOOLS_ROOT/.claude/wiki_staging/${TYPE}-${SLUG}.md"
```
Emit: