Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计通过

context-management上下文管理

Agent Skill

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

总安装

593

周安装

24

GitHub Stars

26

下载量

186
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/outfitter-dev/agents --skill context-management

简介

context-management 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于上下文管理策略研究、信息组织方法或 Agent 协作流程设计等场景。
  • 通过关键词检索返回相关文档、工具或实施建议。
  • 安装命令为 npx skills add https://github.com/outfitter-dev/agents --skill context-management。
  • 使用前请确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。

SKILL.md

Context Management

Manage your context window, survive compaction, persist state across turns.

<when_to_use>

  • Planning long-running or multi-step tasks
  • Coordinating multiple subagents
  • Approaching context limits (degraded responses, repetition)
  • Need to preserve state across compaction or sessions
  • Orchestrating complex workflows with handoffs

NOT for: simple single-turn tasks, quick Q&A, tasks completing in one response

</when_to_use>

Claude Code operates in a ~128K token context window that compacts automatically as it fills. When compaction happens:

What survives:

  • Task state (full task list persists)
  • Tool results (summarized)
  • User messages (recent ones)
  • System instructions

What disappears:

  • Your reasoning and analysis
  • Intermediate exploration results
  • File contents you read (unless in tool results)
  • Decisions you made but didn't record

The consequence: Without explicit state management, you "wake up" after compaction with amnesia — you know what to do, but not what you've done or decided.

Tasks: Your Survivable State

Tasks are not just a tracker — they're your persistent memory layer. Use TaskCreate, TaskUpdate, TaskList, and TaskGet to manage state that survives compaction.

What Goes in Tasks

CategoryExample
Current workImplementing auth refresh flow (status: in_progress)
Completed workJWT validation logic added to middleware (status: completed)
Discovered workHandle token expiry edge case (status: pending)
Key decisionsEmbed in task description: "Using RS256 per security review"
Agent handoffs[reviewer] Review auth implementation + metadata: {agentId: "abc123"}
BlockersCreate blocker task, use blockedBy field

Task Discipline

Exactly one in_progress at any time. Call TaskUpdate to mark in_progress before starting.

Mark complete immediately. Don't batch completions — TaskUpdate with completed as you finish.

Include agent IDs for resumable sessions in task metadata.

Expand dynamically. TaskCreate as you discover work; don't front-load everything.

Action-oriented subjects. Use verbs: "Implement X", "Fix Y", "Review Z"

Status Flow

pending → in_progress → completed
                ↓
         (blocked → TaskCreate for blocker, add blockedBy)

If blocked, don't mark complete. Create a new task for the blocker and link with addBlockedBy.

Pre-Compaction Pattern

As context fills, ensure tasks capture progress. Use TaskUpdate to add details to in_progress task description:

Task: Implementing token refresh
Description:
  - Refresh endpoint: POST /api/auth/refresh
  - Token rotation: enabled
  - Refresh window: 5 minutes before expiry
  - Remaining: validation logic

Decisions embedded in completed task descriptions. Current state detailed in active task. Future work queued as pending.

<pre_compaction>

Pre-Compaction Checklist

Run through this when context is filling (you'll notice: slower responses, repetition, degraded reasoning):

  1. Capture progress — What's done? TaskUpdate completed tasks with outcomes in description.
  2. Record decisions — What did you decide? Why? Put in task descriptions.
  3. Note current state — Where exactly are you in the current task? TaskUpdate the in_progress task with specifics.
  4. Queue discovered work — What did you find that needs doing? TaskCreate as pending.
  5. Mark dependencies — What needs what? Use addBlockedBy in TaskUpdate.
  6. Include agent IDs — Any background agents? Record IDs in task metadata.

Example: Before Compaction

Bad (state will be lost):

- [x] Research auth approaches
- [ ] Implement auth
- [ ] Test auth

Good (state survives):

- [x] Research auth approaches → middleware + JWT (see src/auth/README.md)
- [ ] [in_progress] Implement JWT refresh flow
    - Using jose library (already in deps)
    - Endpoint: POST /api/auth/refresh
    - Handler started in src/auth/refresh.ts:15
    - Remaining: validation logic, token rotation
- [ ] Add refresh flow tests (after impl)
- [ ] [reviewer] Security review auth module (after tests)

</pre_compaction>

Delegation for Context Preservation

Main conversation context is precious. Every file you read, every search result, every intermediate thought consumes tokens. Subagents run in isolated contexts — only their final output returns.

Default Stance

If a task can be delegated, delegate it.

Delegation Decision Tree

Task arrives
├── Exploration/research? → Explore agent (always)
├── Multi-file reading? → Subagent (summarizes for you)
├── Independent subtask? → Background agent
├── Specialized expertise? → Domain agent (reviewer, tester, etc.)
└── Simple, focused, single-file? → Main agent (maybe)
Note: Plugin agents require the plugin:agent-name format (e.g., outfitter:reviewer). Built-in agents (Explore, Plan, general-purpose) work without prefix. Use /agents to see available agents.

Context-Saving Patterns

Research delegation — Instead of reading 10 files:

{
  "description": "Find auth implementation",
  "prompt": "Locate authentication-related files, summarize the auth flow",
  "subagent_type": "Explore"
}

Main agent receives: concise summary, not 10 file contents.

Parallel review — Instead of sequential analysis:

// Single message, multiple calls, all run_in_background: true
{ "subagent_type": "outfitter:reviewer", "run_in_background": true, "prompt": "Security review..." }
{ "subagent_type": "outfitter:analyst", "run_in_background": true, "prompt": "Performance review..." }

Main agent: stays lean, collects results when ready.

Background execution — For independent work:

{
  "subagent_type": "outfitter:tester",
  "run_in_background": true,
  "prompt": "Run integration tests for auth module"
}

Continue other work; retrieve with TaskOutput later.

Task Integration

Track delegated work in tasks:

[analyst] Research caching strategies (pending, metadata: {taskId: "def456"})
[engineer] Implement cache layer (pending, blockedBy: analyst task)
[reviewer] Review cache implementation (pending, blockedBy: engineer task)
[tester] Validate cache behavior (pending, blockedBy: reviewer task)

When background agents complete, TaskUpdate status and process results.

What NOT to Delegate

  • Direct user Q&A needing conversation history
  • Simple edits to files already in context
  • Final synthesis requiring your judgment

<cross_session>

Cross-Session Patterns

For work spanning multiple sessions, use episodic memory MCP server.

Prerequisites: Cross-session patterns require an episodic-memory MCP server to be configured. If unavailable, skip this section — Tasks handle single-session persistence.

Saving State

At session end or before long pause:

{
  "tool": "episodic-memory:save",
  "content": {
    "task": "Implementing auth refresh flow",
    "status": "in_progress",
    "completed": ["JWT validation", "Refresh endpoint structure"],
    "remaining": ["Token rotation logic", "Tests", "Security review"],
    "decisions": {
      "library": "jose",
      "algorithm": "RS256",
      "refresh_window": "5 minutes"
    },
    "files_modified": ["src/auth/refresh.ts", "src/auth/middleware.ts"],
    "next_steps": "Implement token rotation in refresh.ts:42"
  }
}

Restoring State

At session start:

{
  "tool": "episodic-memory:search",
  "query": "auth refresh implementation"
}

Then reconstruct tasks from saved state using TaskCreate.

When to Use Cross-Session

  • Multi-day projects
  • Complex refactors with many steps
  • Work that will be interrupted
  • Handing off to future sessions

For single-session work, Tasks alone suffice.

</cross_session>

Workflow Integration

At Task Start

  1. TaskCreate with initial scope
  2. If complex: use Plan subagent to explore, preserve main context
  3. TaskUpdate first task to in_progress

During Execution

  1. TaskUpdate as work progresses
  2. Delegate exploration to subagents
  3. Mark completed immediately (no batching)
  4. TaskCreate for discovered work
  5. Note decisions in completed task descriptions

Approaching Compaction

  1. Run pre-compaction checklist
  2. Ensure current state captured in in_progress task description
  3. Record any background agent IDs in task metadata

After Compaction

  1. TaskList to read task state (it persists)
  2. Resume from in_progress task
  3. Use saved details to continue without re-exploration

At Task Completion

  1. TaskUpdate final tasks to complete with outcomes in description
  2. If multi-session: save to episodic memory
  3. Report summary to user

ALWAYS:

  • Use Tasks for any work over 2-3 steps
  • TaskUpdate before significant actions
  • Mark completed immediately, not batched
  • Include agent IDs in task metadata for resumable sessions
  • Delegate exploration to subagents (preserves main context)
  • Record decisions in completed task descriptions
  • Run pre-compaction checklist when context fills

NEVER:

  • Rely on conversation history surviving compaction
  • Keep large research results in main context (delegate or summarize)
  • Have multiple in_progress tasks simultaneously
  • Stop early due to context concerns (persist state instead)
  • Batch multiple completions together
  • Leave tasks vague ("do the thing" → "Implement refresh endpoint")

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.37%
按下载量换算55

windsurf

25.1%
按下载量换算47

trae

18.85%
按下载量换算35

OpenCode

13.4%
按下载量换算25

Codex

8.21%
按下载量换算15

github-copilot

3.4%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills