Skip to content
Back to skills

Compacting Context

ASecurity

Use when told to compact or shrink your own context, especially at the end of a task ("implement the plan, afterwards compact your context"), or when the context window is filling.

  • 93 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 9, 2026
ai-agentsshellapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 9, 2026

npx -y skills add inoio/agents-sandbox --skill compacting-context --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Compacting Context?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Compacting Context
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/inoio-compacting-context/badge)](https://www.skillsdirectory.com/skills/inoio-compacting-context)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: compacting-context
description: Use when told to compact or shrink your own context, especially at the end of a task ("implement the plan, afterwards compact your context"), or when the context window is filling.
---

# Compacting Your Own Context

There is no built-in "compact" tool — request the compaction with the opencode2 CLI:

```sh
opencode2 api session.compact --param sessionID="$OPENCODE_SESSION_ID" -d '{}'
```

- `$OPENCODE_SESSION_ID` (set in your shell) is your own session.
- Delivery is `steer`: it fires at the next step boundary. Run it as your **last** action, after any final answer or handoff.
- Exit 0 with a `"type":"compaction"` body means the request was admitted; the summary replaces the conversation afterwards.
- No `--server` needed — the CLI's background service shares the session database. If it reports the session missing, target the live server explicitly: `opencode2 --server http://127.0.0.1:4096 api session.compact --param sessionID="$OPENCODE_SESSION_ID" -d '{}'`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.