Borrowing it
Nothing to install: this file belongs to liuyingxuvka/Khaos-Brain. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/liuyingxuvka/Khaos-Brain/main/.agents/skills/kb-sleep-maintenance/SKILL.mdgit clone --depth 1 https://github.com/liuyingxuvka/Khaos-BrainWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/liuyingxuvka/khaos-brain/kb-sleep-maintenance)<a href="https://agentmods.dev/skills/liuyingxuvka/khaos-brain/kb-sleep-maintenance"><img src="https://agentmods.dev/badge/skills/liuyingxuvka/khaos-brain/kb-sleep-maintenance/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/liuyingxuvka/khaos-brain/kb-sleep-maintenance"><img src="https://agentmods.dev/badge/skills/liuyingxuvka/khaos-brain/kb-sleep-maintenance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00037 | $0.01431 |
| Opus 5 | $0.00018 | $0.00715 |
| Sonnet 5 | $0.00007 | $0.00286 |
| Haiku 4.5 | $0.00004 | $0.00143 |
Grade A, and why
kb-sleep-maintenance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 49 lines — stays where its author put it; the contents beside it link to each section on GitHub.
KB Sleep Maintenance
Sleep is the sole knowledge-decision and canonical model-generation owner. The scheduled local task is one serialized cycle: Sleep freezes and publishes first; only after an unblocked completed Sleep terminal does the same task run the existing immutable Dream simulation. Dream never publishes authority. Readable cards and the active index are deterministic projections of Sleep's authority.
Authority and entrypoint
Work from the repository root. Read PROJECT_SPEC.md, docs/maintenance_agent_worldview.md, docs/maintenance_runbook.md, and .agents/skills/local-kb-retrieve/MAINTENANCE_PROMPT.md. Current user instructions override repository defaults.
Run:
python .agents/skills/local-kb-retrieve/scripts/kb_sleep.py --json
The native lifecycle implementation owns all mutation, terminal validation, and its immutable run receipt. Do not create a parallel Sleep implementation or a second model writer.
Required behavior
- Acquire the independent local-cycle task lease and preserve the same run id through closure. The wrapper owns the complete local cycle; do not launch a separate Dream automation. Acquire the sole global KB writer only around mutation phases, delegate its exact token to the child phase, and release it promptly so the independent organization task can continue.
- Resume the exact open frozen batch before admitting later work. If no batch is open, freeze one finite ordered
batch_planwith immutable item identities, input watermark and digest, current-generation identity, prior convergence streak, and tested batch-size bounds. The persistentbatch_headbinds the exact plan and checkpoint digests. Later arrivals never expand that batch. - Give every settled frozen item exactly one verified completed disposition or one explicit blocked disposition with a named owner and executable reopen condition. Persist each item result and the batch checkpoint before continuing so a later Sleep reuses verified work and reprocesses at most the incomplete item.
- Create or reuse one stable candidate only when a bounded scenario-action-result relation and sufficient evidence exist. Represent it immediately as a LogicGuard model revision with a root Claim, explicit Context and Method, typed support or challenge nodes, and explicit gaps. Never invent Evidence, Warrant, Assumption, Rebuttal, or Limitation merely to fill the model.
- Keep trusted promotion evidence-dependent. Require current independent validation; weak or duplicated evidence never satisfies promotion.
- Park unresolved candidates with a machine-evaluable reopen condition and a seven-day decision boundary. Reopen exactly once only after a material qualifying evidence delta.
- Immediately exclude strong contradictory trusted knowledge and complete its downgrade review in this Sleep pass.
- Consume each typed Dream model-gap handoff exactly once, record one acknowledgement, and let Dream remain an immutable simulation owner only. Dream runs as the second phase of this task only after Sleep publishes cleanly; blocked or progress-saved Sleep leaves Dream
not_run. - Assemble exact model revisions into physically separated public, private, and candidate ModelMeshes. Admit a canonical cross-model relation only when qualifying non-AI provenance supports it. Co-use, lexical similarity, and retired
related_cardsvalues remain unresolved grounding proposals, never edges. - Audit each important model for missing context, action, evidence, warrant, assumption, opposition/rebuttal, and boundary conditions. Give every absence one stable open disposition, required grounded input, and machine-readable reopen condition; never invent the missing content.
- Stage models, meshes, deterministic readable projections, the exact active index, and generation manifests away from the current generation. Validate the complete staged generation before one atomic pointer switch written last. Ordinary planning,
progress_saved, timeout, or pre-activation failure keeps the prior validated generation readable and never treats pending work as current-generation corruption. - Exclude rejected, merged, superseded, parked, retired, deprecated, history-only, provenance-incomplete, and contradicted records from retrieval projection.
- Commit the new watermark only after every frozen item is settled and dispositions, model/mesh publication, lifecycle review, handoff acknowledgements, exact index validation, and the final pointer switch are durable.
progress_savedand failure keep the previous committed watermark unchanged. - Do not require a human to read files, choose cards, or approve ordinary maintenance decisions. Escalate only a real safety or authority boundary.
- Stop starting new items at the 660-second native soft deadline, durably seal the checkpoint, release every delegated/global writer token, and return
progress_savedbefore the outer hard timeout. The complete Sleep plus Dream cycle uses a 2400-second native timeout inside a 2700-second owner timeout, with larger aggregate and installer owners; timeout never means success and requires confirmed zero-descendant cleanup. One malformed item may settle as blocked only with a named owner and executable reopen condition; publish completed siblings ascompleted_with_blocks, never repeat them, and record only the Dream phase asnot_run. The independent organization task is never cancelled or rewritten by local failure. The target-owned wrapper owns same-run terminalization; do not invoke a status helper or retry the child.
What ships with it
4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 12d ago First seen · 49 lines · 37 tokens per session scan A 9d7f1f42b328
kb-sleep-maintenance is a skill published in the GitHub repository liuyingxuvka/Khaos-Brain (37 stars, last pushed 1mo ago), licensed MIT. It adds 37 tokens to every session and 1,431 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
knowledge-base
Skill "knowledge-base" from Pinvou/pinvou-agent, covering ima knowledge base, operations, routing rules, examples and file upload guard.
notes
Skill "notes" from Pinvou/pinvou-agent, covering ima notes, operations, write rules, examples and response handling.
shodh-memory
Persistent memory system for AI agents. Use this skill to remember context across conversations, recall relevant information, and build long-term knowledge. Activate when you need to store decisions, learnings, errors, or context that should persist beyond the current session.
vault
Search, read, write, and manage files in the Kept conversation vault. Use when the user asks about past conversations, wants to save notes, needs to find specific content, or wants to organize their vault.
knowledge-ingestion
A skill for saving links, social posts, videos, podcasts, screenshots, PDFs, local files, or text into an Obsidian knowledge base, a personal collection of searchable notes. The ingestion tools analyse and format the material for storage.
personal-knowledge-ingestion
A skill for saving links, videos, social posts, local files, screenshots, PDFs, or text into an Obsidian vault, a folder used for personal notes and knowledge. It uses connected knowledge tools to process and format the saved item.