compact

GitHub

用于在对话上下文即将耗尽时,通过调用内核接口压缩历史记录并生成摘要,从而释放上下文空间以支持长时间任务的持续进行。

skills/compact/SKILL.md PrimeIntellect-ai/prime-agent

Trigger Scenarios

上下文使用率过高且仍有大量工作未完成 需要保持会话连续性而不中断任务

Install

npx skills add PrimeIntellect-ai/prime-agent --skill compact -g -y
More Options

Use without installing

npx skills use PrimeIntellect-ai/prime-agent@compact

指定 Agent (Claude Code)

npx skills add PrimeIntellect-ai/prime-agent --skill compact -a claude-code -g -y

安装 repo 全部 skill

npx skills add PrimeIntellect-ai/prime-agent --all -g -y

预览 repo 内 skill

npx skills add PrimeIntellect-ai/prime-agent --list

SKILL.md

Frontmatter
{
    "name": "compact",
    "description": "Check context usage and compact the conversation from the Python REPL. Use when context is filling up and substantial work remains, so the session is summarized and you keep working instead of stopping early."
}

Compact

Compaction replaces older conversation history with a dense summary, freeing context so long-running work can continue. The implementation lives in the host (the same one behind the user's /compact command); this skill is the kernel-side interface to it. Call it directly from the Python REPL:

await compact.status()
await compact.run()
await compact.run("keep the failing test names and the migration checklist")

API

  • await compact.status() — current context usage as a dict: tokens, context_window, and percent (None right after a compaction until the next model response), plus scheduled (whether a requested compaction is already pending).
  • await compact.run(instructions=None) — schedule compaction. Returns {"scheduled": True}, or {"scheduled": False, "reason": ...} when there is nothing to compact yet. Optional instructions focus the summary on what matters for the remaining work.

Rules

  • Compaction never runs mid-cell. A scheduled compaction runs when the current turn ends; the harness then resumes you automatically with the summary plus recent messages, and you continue the task.
  • The Python kernel persists through compaction — variables, imports, and helpers you defined all remain available.
  • Compact at a natural boundary when context usage is high and substantial work remains, instead of becoming terse or returning to the user early. Check await compact.status() when unsure.
  • One request per turn is enough; calling run again before the turn ends only updates the instructions.

Version History

  • 7cbffa7 Current 2026-10-18 17:10

Same Skill Collection

packages/coding-agent/skills/agent-message/SKILL.md
packages/coding-agent/skills/agent-observe/SKILL.md
packages/coding-agent/skills/attach-image/SKILL.md
packages/coding-agent/skills/compact/SKILL.md
packages/coding-agent/skills/edit/SKILL.md
packages/coding-agent/skills/goal/SKILL.md
packages/coding-agent/skills/linear/SKILL.md
packages/coding-agent/skills/mcp/SKILL.md
packages/coding-agent/skills/notion/SKILL.md
packages/coding-agent/skills/prime-intellect/SKILL.md
packages/coding-agent/skills/refine/SKILL.md
packages/coding-agent/skills/rlm-heartbeat/SKILL.md
packages/coding-agent/skills/skill-creator/SKILL.md
packages/coding-agent/skills/websearch/SKILL.md
skills/agent-message/SKILL.md
skills/agent-observe/SKILL.md
skills/attach-image/SKILL.md
skills/edit/SKILL.md
skills/goal/SKILL.md
skills/mcp/SKILL.md
skills/prime-intellect/SKILL.md
skills/refine/SKILL.md
skills/rlm-heartbeat/SKILL.md
skills/skill-creator/SKILL.md
skills/websearch/SKILL.md
packages/coding-agent/examples/extensions/dynamic-resources/SKILL.md

Metadata

Files
0
Version
7cbffa7
Hash
25697c11
Indexed
2026-10-18 17:10

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-19 02:16
浙ICP备14020137号-1