sleep

A command for an autonomous maintenance and research cycle in a knowledge repository. It can handle queued tasks, explore gaps, maintain files, and build context, with optional task descriptions.

In plain words
What is it for?
Useful for running research tasks, adding findings to knowledge files, reviewing existing knowledge, identifying unexplored topics, updating indexes, and committing completed tasks separately.
Why use it?
It organizes longer improvement work into separate tasks while tracking the repository’s state and saving research results.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/lanzelot1/claw-brain/sleep
Clone the repo
git clone --depth 1 https://github.com/Lanzelot1/claw-brain

Made for: Claude Code.

Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,242 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.01242
Opus 5 $0.00005 $0.00621
Sonnet 5 $0.00002 $0.00248
Haiku 4.5 $0.00001 $0.00124

Measured 2d ago against content hash 983757851eb8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sleep 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 2d 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.

.claude/commands/sleep.md · 109 lines

How it starts

The opening of the file, as written. The whole thing — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Run an autonomous improvement loop. Four phases: queued tasks, exploration & research, maintenance, context building.

Arguments

Optional task descriptions: /sleep "research topic X" "deep-dive into Y"

Setup

  1. Read memory/_index.md, memory/me.md, and memory/lessons.md for full context
  2. git checkout -b sleep-YYYY-MM-DD
  3. Calculate starting health score (same formula as /status)

Phase 1: Queued Tasks

If arguments were provided, execute each one:

  • Research, analyze, or create content as described
  • Save results to knowledge/ with source: frontmatter
  • Update _index.md if new files are created
  • Commit each task separately

If no arguments, skip to Phase 2.

Phase 2: Exploration & Research

Read through the brain and actively grow it. This is the creative phase — not just maintenance, but discovery.

  1. Map the brain — Read _index.md and scan all knowledge files. Build a mental model of what the brain knows, where the depth is, and where the gaps are.

  2. Find threads to pull — Look for:

    • Topics mentioned in passing across multiple files but never explored in depth
    • Questions or unknowns flagged in existing knowledge files
    • Areas where the user's me.md interests intersect with existing knowledge
    • Connections between different knowledge areas that haven't been made explicit
    • Claims that could be verified, updated, or expanded with web research
    • Entities (people, companies, concepts) that appear in 3+ files but lack their own page
  3. Research and deepen — For the most promising threads (max 5):

    • Do web searches to find current, relevant information
    • Read and extract key facts — specific data, quotes, developments
    • Create new source files in knowledge/ with source: frontmatter pointing to the URLs found
    • Set type: source — these are raw facts, not synthesis
  4. Synthesize new wiki pages — After adding new sources, check if any topic now has enough material (3+ source files) to justify a wiki page:

    • Create wiki pages with type: wiki frontmatter following /synthesize conventions
    • Weave together facts from multiple sources into coherent pages
    • Include ## Sources section citing all constituent files
    • Add to the "Wiki Pages" section of _index.md

Read the full file on GitHub · 109 lines

Changes

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.

  1. 2d ago First seen · 109 lines · 10 tokens per session scan A 983757851eb8

Subscribe to this mod's changes

sleep is a command published in the GitHub repository Lanzelot1/claw-brain (11 stars, last pushed 4mo ago), licensed MIT. It adds 10 tokens to every session and 1,242 once invoked, about $0.0001 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.