Maintenance Runbook
[!lexery-hero] Maintenance runbook !_assets/brand/lexery-wordmark-dark-bg.svg|200 !_assets/brand/lexery-icon.svg|46
How the second brain stays aligned with repos and reality. Lexery - Automation Architecture|Automation · Lexery - Wiki Quality Contract|Quality · Lexery - Log|Log · Lexery - Source Map|Sources
Brand SVG:
apps/portal/public/→_assets/brand/.
Lexery - Maintenance Runbook
Operational guide for keeping the Lexery second brain aligned with repos, Linear, and production reality — without boiling the ocean every week.
Cost guardrails: Lexery - Cost Ledger. What we ingest: Lexery - Source Registry. Automation design (target state): Lexery - Automation Architecture.
Principles
- Delta-first: summarize what changed, not the entire monorepo, unless a monthly audit demands it.
- Human gate for P0: production, security, and customer-facing claims need eyes — Tier 2 models propose, humans confirm.
- Single chronology: every automated pass leaves a trace in Lexery - Log.
Tier 1 — Daily (automated, no model)
Goal: catch motion early; cost ~$0.
Steps
- Per tracked repo (see Lexery - Source Registry), run:
git fetch --all --prune(if network allowed)git log --oneline --since="1 day ago"
- If new commits exist:
- Append a one-line digest per repo to Lexery - Log (date, branch, hash prefix, author if useful).
- Branch inventory:
git branch -a(or scripted equivalent) — flag new remote branches for human review in Lexery - Drift Radar or Lexery - GitHub History.
Outputs
- Updated Lexery - Log.
- Optional: JSON/CSV drop under
_system/state/with last-seenHEADper repo (implementation detail).
Failure modes
- Fetch blocked: log "offline pass" and use local-only
git log. - Dirty worktree: note in Log — may explain skew in Lexery - Branch Divergence.
macOS LaunchAgent (щодня, поки Mac увімкнений)
- З кореня vault:
bash _system/scripts/install-schedule.sh— згенеруєcom.lexery.wiki-maintenance.plistі завантажить LaunchAgent у~/Library/LaunchAgents/. - Розклад: після логіну (
RunAtLoad) + щодня о ~09:10 (StartCalendarIntervalуcom.lexery.wiki-maintenance.plist.example). Для іншого часу — зміни plist і перезапустиinstall-schedule.sh. - Секрети тільки в
~/.lexery-wiki-env(wrapper уже робитьsource). - Логи агента:
_system/logs/launchd-stdout.log,launchd-stderr.log. - Пайплайн:
run-maintenance-launchd.sh→run-maintenance.mjs(повний ланцюг скриптів; кожен 4-й прогін — deep з link-metrics + rollup). Перед дописом у Lexery - Log виконуєтьсяrepair-log-structure.mjs(канонічний H1 після frontmatter). Машинні тренди:truth-history.jsonl,karpathy-history.jsonl, дашборди Lexery - Executive Ops Dashboard / Lexery - Data Integrity Dashboard. Примусовий deep:WIKI_MAINTENANCE_MODE=deep node _system/scripts/run-maintenance.mjs(див. README vault § «Довгий прогін»).
Граф Obsidian
- Налаштування для читабельного графа: Lexery - Graph Hygiene та
.obsidian/graph.jsonу репозиторії.
Tier 2 — Weekly (automated, cheap model via OpenRouter)
Goal: structured delta for maintainers; target cost pennies per run (see Lexery - Cost Ledger).
Steps
- Monorepo stat delta:
git diff HEAD~20..HEAD --stat(adjust window by velocity).
- GitHub PRs (if
ghauthenticated):gh pr list --state all --limit 10
- Linear (via MCP or export):
- New/changed issues touching Brain, Portal, LLDBI.
- Model pass (cheap model):
- Input: the above artifacts + previous week's Lexery - Log tail.
- Output: bullet summary: themes, risks, suggested wiki page updates (file names only).
- Human or scripted patch:
- Apply edits to canon pages: Lexery - Current State, Lexery - Linear Roadmap, stage notes if behavior changed.
- Drift:
- Append any new contradictions to Lexery - Drift Radar; do not duplicate resolved items.
Outputs
- Short "week in Lexery" block in Lexery - Log.
- Targeted wiki patches + unresolved link list (if any).
Tier 3 — Monthly (manual or premium model)
Goal: consistency and architecture refresh; budget in Lexery - Cost Ledger.
Steps
- Full consistency audit:
- Orphan wikilinks, pages with
status: inferredthat should graduate toobserved, duplicated narratives between Lexery - Open Questions and Drift and Lexery - Drift Radar.
- Orphan wikilinks, pages with
- Lexery - Current State rewrite pass — one screen executive truth.
- Canvases (Lexery - Master Map.canvas, Lexery - Runtime Graph.canvas, etc.) if repo topology or pipeline edges changed.
- Lexery - Cost Ledger — reconcile estimated vs actual spend if bills available.
- Drift retirement:
- Move fixed items out of Lexery - Drift Radar into Lexery - Log or archive section.
Outputs
- Updated
updated:frontmatter on touched pages. - Explicit list of new unknowns for Lexery - Unknowns Queue.
File system conventions (planned)
| Path | Purpose |
|---|---|
_system/scripts/ |
Cron-friendly shell/TS for Tier 1–2 |
_system/state/ |
Last-processed SHAs, hashes, dedupe keys |
_system/exports/ |
Optional Linear/JSON snapshots |
If these folders do not exist yet, create them when first script lands — document the addition in Lexery - Log.
Escalation
- Security or credential exposure in logs → stop automation, rotate secrets, fix redaction before next Tier 2 run.
- Contradiction between prod behavior and docs → P0 row in Lexery - Drift Radar + owner in Lexery - Team and Operating Model.
Links
- Lexery - Automation Architecture
- Lexery - Cost Ledger
- Lexery - Log
- Lexery - Index
- Lexery - Source Registry