nano---Openclaw: Skill for Claude Code

.claude/skills/add-compact/SKILL.md

add-compact is a skill for Claude Code from ShinyStar307/nano---Openclaw. It costs 40 tokens per session (1,590 once invoked), scanned A, a copy of add-compact, MIT.

A session command that manually shortens a long conversation while keeping its summarized context and session running.

In plain words
What is it for?
Use it to compact the conversation during a long-running session. Only the main group or an approved sender can run the command.
Why use it?
Long coding-agent sessions can accumulate outdated or distracting context. This gives trusted users a way to reduce that buildup without starting over.

Skill for Claude Code

Written for Claude Code: PreCompact hook event.

This is ShinyStar307/nano---Openclaw's own configuration. It tells Claude Code how to work on nano---Openclaw itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything nano---Openclaw configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is ./container/build.sh.

Reuse

Borrowing it

Nothing to install: this file belongs to ShinyStar307/nano---Openclaw. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ShinyStar307/nano---Openclaw/main/.claude/skills/add-compact/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ShinyStar307/nano---Openclaw

Made for: Claude Code.

Wrote 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.

agentmods badge for add-compact

README.md
[![agentmods](https://agentmods.dev/badge/skills/shinystar307/nano---openclaw/add-compact.svg)](https://agentmods.dev/skills/shinystar307/nano---openclaw/add-compact)
Your own site
<a href="https://agentmods.dev/skills/shinystar307/nano---openclaw/add-compact"><img src="https://agentmods.dev/badge/skills/shinystar307/nano---openclaw/add-compact.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,590 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 94% copy Near-identical to another mod 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.1 $0.00040 $0.01590
Opus 5 $0.00020 $0.00795
Sonnet 5 $0.00008 $0.00318
Haiku 4.5 $0.00004 $0.00159

Measured 7d ago against content hash 06c2a6545069, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

add-compact 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 7d 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.

Origin

This is a copy

94% identical to add-compact — 22 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/skills/add-compact/SKILL.md · 136 lines

How it starts

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

Add /compact Command

Adds a /compact session command that compacts conversation history to fight context rot in long-running sessions. Uses the Claude Agent SDK's built-in /compact slash command — no synthetic system prompts.

Session contract: /compact keeps the same logical session alive. The SDK returns a new session ID after compaction (via the init system message), which the agent-runner forwards to the orchestrator as newSessionId. No destructive reset occurs — the agent retains summarized context.

Phase 1: Pre-flight

Check if src/session-commands.ts exists:

test -f src/session-commands.ts && echo "Already applied" || echo "Not applied"

If already applied, skip to Phase 3 (Verify).

Phase 2: Apply Code Changes

Merge the skill branch:

git fetch upstream skill/compact
git merge upstream/skill/compact

Note: upstream is the remote pointing to qwibitai/nanoclaw. If using a different remote name, substitute accordingly.

This adds:

  • src/session-commands.ts (extract and authorize session commands)
  • src/session-commands.test.ts (unit tests for command parsing and auth)
  • Session command interception in src/index.ts (both processGroupMessages and startMessageLoop)
  • Slash command handling in container/agent-runner/src/index.ts

Validate

npm test
npm run build

Rebuild container

./container/build.sh

Restart service

launchctl kickstart -k gui/$(id -u)/com.nanoclaw  # macOS
# Linux: systemctl --user restart nanoclaw

Phase 3: Verify

Integration Test

  1. Start NanoClaw in dev mode: npm run dev
  2. From the main group (self-chat), send exactly: /compact
  3. Verify:
    • The agent acknowledges compaction (e.g., "Conversation compacted.")
    • The session continues — send a follow-up message and verify the agent responds coherently
    • A conversation archive is written to groups/{folder}/conversations/ (by the PreCompact hook)
    • Container logs show Compact boundary observed (confirms SDK actually compacted)
    • If compact_boundary was NOT observed, the response says "compact_boundary was not observed"
  4. From a non-main group as a non-admin user, send: @<assistant> /compact
  5. Verify:
    • The bot responds with "Session commands require admin access."
    • No compaction occurs, no container is spawned for the command
  6. From a non-main group as the admin (device owner / is_from_me), send: @<assistant> /compact
  7. Verify:
    • Compaction proceeds normally (same behavior as main group)
  8. While an active container is running for the main group, send /compact
  9. Verify:
    • The active container is signaled to close (authorized senders only — untrusted senders cannot kill in-flight work)
    • Compaction proceeds via a new container once the active one exits
    • The command is not dropped (no cursor race)
  10. Send a normal message, then /compact, then another normal message in quick succession (same polling batch):
  11. Verify:
    • Pre-compact messages are sent to the agent first (check container logs for two runAgent calls)
    • Compaction proceeds after pre-compact messages are processed
    • Messages after /compact in the batch are preserved (cursor advances to /compact's timestamp only) and processed on the next poll cycle
  12. From a non-main group as a non-admin user, send @<assistant> /compact:
  13. Verify:
    • Denial message is sent ("Session commands require admin access.")
    • The /compact is consumed (cursor advanced) — it does NOT replay on future polls
    • Other messages in the same batch are also consumed (cursor is a high-water mark — this is an accepted tradeoff for the narrow edge case of denied /compact + other messages in the same polling interval)
    • No container is killed or interrupted
  14. From a non-main group (with requiresTrigger enabled) as a non-admin user, send bare /compact (no trigger prefix):
  15. Verify:
    • No denial message is sent (trigger policy prevents untrusted bot responses)
    • The /compact is consumed silently
    • Note: in groups where requiresTrigger is false, a denial message IS sent because the sender is considered reachable
  16. After compaction, verify no auto-compaction behavior — only manual /compact triggers it

Read the full file on GitHub · 136 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. 7d ago First seen · 136 lines · 40 tokens per session scan A 06c2a6545069

Subscribe to this mod's changes

add-compact is a skill published in the GitHub repository ShinyStar307/nano---Openclaw (5 stars, last pushed 5mo ago), licensed MIT. It adds 40 tokens to every session and 1,590 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 94% identical to add-compact, differing in 22 lines, and is treated as a copy.

Related

Other skills, from other repositories

media-ingest

Ingest video, audio, PDF, book, screenshot, and GitHub repo content into the brain. Multi-format handling with entity extraction and backlink propagation. Covers video-ingest, youtube-ingest, and book-ingest subtypes.

garrytan/gbrain · 52 tokens

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…

mem0ai/mem0 · 273 tokens

Cortex

Operate Cortex, the LifeOS memory system — the typed Knowledge Archive (People, Companies, Ideas, Research with typed related: links) plus recall of prior work sessions, ISAs, and conversations. Search, add, harvest, develop, ingest, distill, graph-navigate, recall. USE WHEN cortex, knowledge, knowledge base, search…

danielmiessler/LifeOS · 196 tokens

memory

Use when the user asks to remember, recall, forget, update, search, or inspect durable OpenSquilla memory, including profile facts in USER.md and long-term notes in MEMORY.md or memory//.md.

opensquilla/opensquilla · 44 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

establishing-project-context

Use when the user asks to establish shared project language, or project work exposes a conflicting, renamed, or deprecated domain term that needs active semantic modeling. Routine small tasks stay on the fast path.

GanyuanRan/Aegis · 45 tokens