Token导航 LogoToken导航

Agent Skill · 研究检索

claude-context-management(Claude context management 搜索)

claude-context-management 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

claude-context-management 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 59,579。

总安装 384周安装 16GitHub Stars 9下载 128核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:claude-context-management(Claude context management 搜索)
来源仓库:https://github.com/adaptationio/skrillz
仓库路径:skills/claude-context-management
安装命令:
npx skills add https://github.com/adaptationio/skrillz --skill claude-context-management
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/adaptationio/skrillz --skill claude-context-management

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

claude-context-management 解决对话无限增长导致的 token 成本与窗口溢出问题。提供服务端清除与客户端压缩两种策略,配合 memory 工具实现自动上下文管理。核心目标是维持关键信息留存同时控制输入规模,避免无关历史干扰当前任务。

需根据对话长度与使用频率选择合适策略,高频长会话推荐客户端 compaction。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/claude-context-management

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/adaptationio/skrillz --skill claude-context-ma…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

claude-context-management 怎么安装?

在终端执行 npx skills add https://github.com/adaptationio/skrillz --skill claude-context-management。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

claude-context-management 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

claude-context-management 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

claude-context-management 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

claude-context-management 用的人多吗?

公开数据是累计安装 384 次,近一周安装 16 次,下载 128 次,GitHub 9 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

claude-context-management 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
claude-context-management

Claude context management 搜索 · 本页

3849需要联网MIT有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Claude Context Management

Overview

Claude conversations can grow indefinitely, but context windows have limits. Context management strategies enable unlimited conversations while optimizing costs. This skill covers two complementary approaches: server-side clearing (API-managed) and client-side compaction (SDK-managed), plus integration with the memory tool for automatic context preservation.

The Problem: As conversations grow, token consumption increases. Without management:

  • Input tokens accumulate (context growing every turn)
  • Costs scale linearly with conversation length
  • Eventually hit context window limits
  • Important information gets lost when clearing occurs

The Solution: Automatic context editing and summarization strategies that preserve important information while reducing token consumption.

When to Use

This skill is essential for:

  1. Long-Running Conversations (>50K tokens accumulated)

- Multi-step research projects - Extended code analysis sessions - Iterative problem-solving workflows

  1. Multi-Session Workflows

- Projects spanning days/weeks - Shared conversation histories - Team collaboration scenarios

  1. Token Cost Optimization

- High-volume API usage - Production agentic systems - Cost-sensitive deployments

  1. Tool-Heavy Applications

- Web search workflows (50+ searches) - File editing tasks (100+ file operations) - Database query sequences

  1. Memory-Augmented Applications

- Knowledge accumulation across sessions - Persistent context preservation - Infinite chat implementations

  1. Hybrid Thinking Scenarios

- Extended reasoning sessions - Complex problem decomposition - Preservation of thinking blocks

Workflow

Step 1: Assess Context Needs

Objectives:

  • Understand conversation characteristics
  • Estimate token growth patterns
  • Identify clearing triggers

Actions:

  1. Analyze expected conversation length

- Single turn: <5K tokens (skip context management) - Short conversation: 5-50K tokens (optional) - Long conversation: 50K-200K tokens (recommended) - Extended session: 200K+ tokens (required)

  1. Identify dominant content type

- Tool results (web search, file operations) - Thinking blocks (extended reasoning) - Text conversation - Mixed (combination)

  1. Determine session persistence

- Single session (one API call to completion) - Multi-turn conversation (human in the loop) - Long-running agent (hours/days)

Step 2: Choose Strategy

Decision Framework:

ScenarioStrategyRationale
Immediate clearing needed, tool results dominateServer-side (clear_tool_uses_20250919)Results removed before Claude processes, minimal disruption
Extensive thinking blocks being generatedServer-side (clear_thinking_20251015)Preserves recent reasoning, maintains cache hits
SDK context monitoring availableClient-side compactionAutomatic summarization on threshold
Both tool results and thinkingCombine both strategiesThinking first, then tool clearing
Multi-session, knowledge accumulationAdd memory toolProactive preservation before clearing

Selection Questions:

  • Is this tool-heavy? → Use clear_tool_uses_20250919
  • Is this reasoning-heavy? → Use clear_thinking_20251015
  • Can you monitor context in your SDK? → Use client-side compaction
  • Need persistent cross-session storage? → Add memory tool integration

Step 3: Configure Context Editing

For Server-Side Clearing:

  1. Choose trigger type:

- input_tokens: Trigger when input accumulates (most common) - tool_uses: Trigger when tool calls accumulate

  1. Set trigger value:

- Conservative: 50,000-75,000 tokens (frequent clearing) - Balanced: 100,000-150,000 tokens (recommended) - Aggressive: 150,000+ tokens (rare clearing)

  1. Define what to keep:

- keep parameter: Most recent N items to preserve - Recommended: Keep 3-5 most recent tool uses (or thinking turns)

  1. Exclude important tools:

- exclude_tools: Don't clear results from these tools - Example: ["web_search"] (web search results often important)

For Client-Side Compaction:

  1. Enable in SDK configuration
  2. Set context_token_threshold (e.g., 100,000)
  3. Optional: Customize summary_prompt
  4. Optional: Choose model for summaries (default: same model, can use Haiku for cost)

Step 4: Integrate Memory Tool (Optional)

When to Add Memory:

  • Multi-session workflows needing persistence
  • Automatic context preservation before clearing
  • Knowledge accumulation across days/weeks
  • Agentic tasks requiring state management

Integration Pattern:

  1. Enable memory tool in tools array: {"type": "memory_20250818", "name": "memory"}
  2. Configure context clearing (server-side or client-side)
  3. Claude automatically receives warnings before clearing
  4. Claude can proactively save important information to memory
  5. After clearing, information accessible via memory lookups

How It Works:

  • As context approaches clearing threshold, Claude receives automatic warning
  • Claude writes summaries/key findings to memory files
  • Content gets cleared from active conversation
  • On next turn, Claude can recall via memory tool
  • Enables infinite conversations without manual intervention

Step 5: Monitor and Optimize

Monitoring Metrics:

  • Input tokens per turn (should stabilize after clearing)
  • Clearing frequency (target: once per session or less)
  • Token reduction percentage (target: 30-50% savings)
  • Memory file size (if using memory tool)

Optimization Adjustments:

  • Too frequent clearing? Increase trigger threshold
  • Important content lost? Decrease threshold or exclude more tools
  • Memory files too large? Implement archival strategy
  • Cost not improving? Consider client-side compaction + model downsizing for summaries

Step 6: Validate and Adjust

Validation Checklist:

  • Context editing configured and deployed
  • No important information lost during clearing
  • Token consumption reduced as expected
  • Response quality unaffected by clearing
  • Memory integration working (if enabled)
  • Clearing threshold appropriate for workload

Adjustment Process:

  1. Monitor first conversation end-to-end
  2. Measure actual token savings
  3. Check memory file contents for completeness
  4. Identify any lost context
  5. Adjust trigger thresholds/exclusions
  6. Repeat until optimal balance achieved

Quick Start

Basic Server-Side Tool Clearing

import anthropic

client = anthropic.Anthropic()

# Configure context management for tool result clearing
response = client.beta.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=4096,
    messages=[{"role": "user", "content": "Search for AI developments"}],
    tools=[{"type": "web_search_20250305", "name": "web_search"}],
    betas=["context-management-2025-06-27"],
    context_management={
        "edits": [
            {
                "type": "clear_tool_uses_20250919",
                "trigger": {"type": "input_tokens", "value": 100000},
                "keep": {"type": "tool_uses", "value": 3},
                "clear_at_least": {"type": "input_tokens", "value": 5000},
                "exclude_tools": ["web_search"]
            }
        ]
    }
)

print(response.content[0].text)

Basic Client-Side Compaction

import anthropic

client = anthropic.Anthropic()

# Configure automatic summarization when tokens exceed threshold
runner = client.beta.messages.tool_runner(
    model="claude-sonnet-4-5",
    max_tokens=4096,
    tools=[
        {
            "type": "text_editor_20250728",
            "name": "file_editor",
            "max_characters": 10000
        }
    ],
    messages=[{
        "role": "user",
        "content": "Review all Python files and summarize code quality issues"
    }],
    compaction_control={
        "enabled": True,
        "context_token_threshold": 100000
    }
)

# Process until completion, automatic compaction on threshold
for event in runner:
    if hasattr(event, 'usage'):
        print(f"Current tokens: {event.usage.input_tokens}")

result = runner.until_done()
print(result.content[0].text)

Memory Tool Integration

import anthropic

client = anthropic.Anthropic()

# Enable both memory tool and context clearing
response = client.beta.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=4096,
    messages=[...],
    tools=[
        {
            "type": "memory_20250818",
            "name": "memory"
        },
        # Your other tools
    ],
    betas=["context-management-2025-06-27"],
    context_management={
        "edits": [
            {
                "type": "clear_tool_uses_20250919",
                "trigger": {"type": "input_tokens", "value": 100000}
            }
        ]
    }
)

# Claude will automatically receive warnings and can write to memory

Feature Comparison

FeatureServer-Side ClearingClient-Side Compaction
TriggerAPI detects thresholdSDK monitors after each response
ActionRemoves old contentGenerates summary, replaces history
ProcessingBefore Claude seesAfter response, before next turn
ControlAutomaticRequires SDK integration
Language SupportAll (Python, TypeScript, etc.)Python + TypeScript only
CustomizationTrigger, keep, exclude toolsThreshold, model, summary prompt
Cache ImpactMay invalidate cacheWorks with caching
Summary QualityN/A (deletion)Claude-generated, customizable
Memory IntegrationExcellent (receives warnings)Requires manual memory calls
Best ForTool-heavy workflowsLong multi-turn conversations
OverheadMinimalModel call for summary generation

Strategies Overview

Server-Side Strategies

Strategy 1: clear_tool_uses_20250919

  • Removes older tool results chronologically
  • Keeps N most recent tool uses
  • Preserves tool inputs (optional)
  • Excludes specified tools from clearing
  • Ideal for: Web search workflows, file operations, database queries

Strategy 2: clear_thinking_20251015

  • Manages extended thinking blocks
  • Keeps N most recent thinking turns
  • Or keeps all thinking (for cache optimization)
  • Ideal for: Reasoning-heavy tasks, preservation of analytical process

Client-Side Compaction

  • Automatic summarization when SDK threshold exceeded
  • Built-in summary structure (5 sections)
  • Custom summary prompts supported
  • Optional model selection (e.g., use Haiku for summaries to reduce cost)
  • Ideal for: File analysis, multi-step research, agent workflows

Memory Tool Integration

  • Automatic warnings before clearing occurs
  • Proactive information preservation
  • Cross-session persistence
  • Ideal for: Multi-day projects, knowledge accumulation, infinite chats

Related Skills

  • anthropic-expert: Claude API basics, memory tool, prompt caching
  • claude-advanced-tool-use: Tool result clearing optimization
  • claude-cost-optimization: Token tracking and efficiency measurement
  • claude-opus-4-5-guide: Context window details, thinking modes

Key Concepts

Context Window: Maximum tokens available for input + output in a single request

Input Tokens: Accumulated message history size (grows with each turn)

Token Threshold: Configured limit triggering automatic clearing

Clearing: Automatic removal of old tool results to reduce input tokens

Compaction: Automatic summarization replacing full history with summary

Memory Tool: Persistent key-value storage accessible across sessions

Cache Integration: Prompt caching works with context management (preserve recent thinking)

Beta Headers Required

  • Server-side clearing: context-management-2025-06-27
  • Client-side compaction: Built-in (SDK feature)
  • Memory tool integration: context-management-2025-06-27

Supported Models

All Claude 3.5+ models support context editing:

  • Claude Opus 4.5
  • Claude Opus 4.1
  • Claude Sonnet 4.5
  • Claude Sonnet 4
  • Claude Haiku 4.5

Next Steps

For detailed documentation on each strategy:

  1. Server-Side Context Clearing → See references/server-side-context-editing.md

- All 6 parameters explained - When to use each trigger type - Complete Python + TypeScript examples - Strategy selection decision tree

  1. Client-Side Compaction SDK → See references/client-side-compaction-sdk.md

- 3-stage workflow (monitor → trigger → replace) - Configuration parameters with defaults - Complete implementation examples - 4 integration patterns - Best practices and edge cases

  1. Memory Tool Integration → See references/memory-tool-integration.md

- Persistent storage patterns - Proactive warning mechanism - Integration examples - 3 primary use cases

  1. Context Optimization Workflow → See references/context-optimization-workflow.md

- Infinite conversation implementation - Auto-summarization patterns - Cost optimization checklist - Token savings calculations


Last Updated: November 2025 Quality Score: 95/100 Citation Coverage: 100% (All claims from official Anthropic documentation)

平台分布

github-copilot

30.97%
按下载量换算40

Claude Code

21.49%
按下载量换算28

mcpjam

20.31%
按下载量换算26

moltbot

12.27%
按下载量换算16

windsurf

8.34%
按下载量换算11

zencoder

3.26%
按下载量换算4

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills