teleo-infrastructure/.agents/skills/teleo-reconstruction-recovery/SKILL.md
twentyOne2x 15c30f1fbe
Some checks are pending
CI / lint-and-test (push) Waiting to run
Make Leo skill onboarding clean-context reproducible (#150)
* make Leo skill onboarding clean-context reproducible

* harden Leo clean-context skill acceptance
2026-07-15 03:19:15 +02:00

83 lines
4 KiB
Markdown

---
name: teleo-reconstruction-recovery
description: Use when restoring, rebuilding, recompiling, or incident-recovering Leo's Teleo knowledge database, including snapshot recovery, genesis-plus-ledger replay, source recompilation, parity verification, and honest recovery claim ceilings.
---
# Teleo Reconstruction Recovery
## Job
Choose the smallest recovery path that restores a usable Leo knowledge system
without confusing snapshot restoration, strict ledger replay, and semantic
source recompilation.
## Authority
Read `docs/kb-rebuild-and-recompile.md` first. It is the canonical recovery
contract. Use `docs/reports/leo-working-state-20260709/current-truth-index.md`
only for the newest retained proof point, and refresh live state before making a
current VPS or GCP claim.
PR #146 is merged and owns the deterministic genesis-plus-ledger reconstruction
slice in `ops/run_local_genesis_ledger_rebuild.py`. PR #147 is merged and owns
the current unseen-reasoning verifier in
`scripts/verify_leo_unseen_reasoning_chain.py`. PR #148 is a separate, open GCP
least-privilege candidate; do not treat its branch files or proposed live state
as canonical `main` recovery instructions until it merges.
## Select The Recovery Mode
| Need | Path | Honest result |
|---|---|---|
| Restore the latest verified state quickly | `ops/run_local_canonical_postgres_rebuild.py` | Exact snapshot recovery |
| Prove strict post-genesis applies replay exactly | `ops/run_local_genesis_ledger_rebuild.py` | Isolated insert-only ledger replay |
| Turn one retained source into a reviewed packet | `scripts/compile_kb_source_packet.py` | Deterministic proposal packet, not canonical knowledge |
| Rebuild every row from original sources | Follow the semantic recompilation contract in `docs/kb-rebuild-and-recompile.md` | Partial until every row and receipt is accounted for |
| Diagnose a live incident before recovery | Use `.agents/skills/teleo-vps-runtime-ops/SKILL.md` and `.agents/skills/teleo-infra-provenance/SKILL.md` | Fresh read-only incident map |
## Safe Order
1. Identify the intended source database, snapshot, manifest, commit, and hashes.
2. Keep private dumps, row payloads, source excerpts, and replay material outside
the repository and mode `0600`.
3. Run the selected path in an isolated, network-disabled local container.
4. Verify schema, constraints, roles, counts, row hashes, key queries, and exact
cleanup.
5. Run the relevant focused tests, then the unseen-reasoning verifier when the
restored state is meant to support Leo answers.
6. Separate local reconstruction from VPS restore, GCP restore, service restart,
Telegram delivery, promotion, and production apply. Each is its own proof row.
## Commands
Use the repository virtual environment documented in `README.md`:
```bash
.venv/bin/python ops/run_local_canonical_postgres_rebuild.py --help
.venv/bin/python ops/run_local_genesis_ledger_rebuild.py --help
.venv/bin/python scripts/compile_kb_source_packet.py --help
.venv/bin/python -m pytest -q \
tests/test_run_local_canonical_postgres_rebuild.py \
tests/test_run_local_genesis_ledger_rebuild.py \
tests/test_verify_leo_unseen_reasoning_chain.py
```
The help and focused-test commands are safe local canaries. A real recovery
requires caller-supplied private material and must retain a sanitized receipt
without the material itself.
## Stop Conditions
Stop before any live restore or restart when the source snapshot is not
hash-bound, the source authority is ambiguous, parity fails, private material
would enter Git or logs, cleanup cannot be proved, or the requested operation
would promote GCP or mutate production without exact authorization.
## Claim Ceiling
- Exact snapshot recovery is working when its parity receipt passes.
- The merged genesis-plus-ledger path proves an isolated insert-only slice.
- Semantic source-to-blank-database recompilation remains incomplete until every
canonical row traces to a genesis record or reviewed replay receipt.
- No local receipt proves a live VPS/GCP restore, service restart, Telegram
delivery, production apply, or GCP promotion.