filesystem-context
できること
このスキルは、長い出力、計画、メモをファイルに保存し、必要なときだけ読み戻す方法を示します。AIのコンテキストウィンドウを空けておけます。長いタスクを回すエージェントや、エージェント間で作業を共有するエージェントを作る人向けです。
使う場面
- ✓ツールの出力やログがエージェントのコンテキストウィンドウを埋めているとき。
- ✓エージェントが、長いタスクを通じて計画や作業メモを保つ必要があるとき。
- ✓複数のエージェントが、直接のメッセージではなくファイルを通じて情報を共有する必要があるとき。
スキルのリンク
https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/filesystem-context/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“エージェントが長いコマンドの出力をファイルに保存し、必要な部分だけを読むように設定してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは結果をファイルに書き、必要に応じて関連する部分を探し直します。すべてをプロンプトに残すのではありません。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Filesystem-Based Context Engineering
Use the filesystem as the primary overflow layer for agent context because context windows are limited while tasks often require more information than fits in a single window. Files let agents store, retrieve, and update an effectively unlimited amount of context through a single interface.
Prefer dynamic context discovery -- pulling relevant context on demand -- over static inclusion, because static context consumes tokens regardless of relevance and crowds out space for task-specific information.
When to Activate
Activate this skill when:
- Tool outputs are bloating the context window
- Agents need to persist state across long trajectories
- Sub-agents must share information without direct message passing
- Tasks require more context than fits in the window
- Building agents that learn and update their own instructions
- Implementing scratch pads for intermediate results
- Terminal outputs or logs need to be accessible to agents
Do not activate this skill for adjacent work owned by other skills:
- Semantic cross-session memory, entity tracking, or temporal knowledge graphs:
memory-systems. - Conversation summarization, compaction, or durable handoff wording:
context-compression. - Token-efficiency tactics that do not require file-backed storage:
context-optimization. - Multi-agent topology or handoff protocol design:
multi-agent-patterns. - Model edits that evict content from the live window itself:
self-managed-context.
Core Concepts
Diagnose context failures against these four modes, because each requires a different filesystem remedy:
- Missing context -- needed information is absent from the total available context. Fix by persisting tool outputs and intermediate results to files so nothing is lost.
- Under-retrieved context -- retrieved content fails to encapsulate what the agent needs. Fix by structuring files for targeted retrieval (grep-friendly formats, clear section headers).
- Over-retrieved context -- retrieved content far exceeds what is needed, wasting tokens and degrading attention. Fix by offloading bulk content to files and returning compact references.
- Buried context -- niche information is hidden across many files. Fix by combining glob and grep for structural search alongside semantic search for conceptual queries.
Use the filesystem as the persistent layer that addresses all four: write once, store durably, retrieve selectively.
Detailed Topics
The Static vs Dynamic Context Trade-off
Treat static context (system instructions, tool definitions, critical rules) as expensive real estate -- it consumes tokens on every turn regardless of relevance. As agents accumulate capabilities, static context grows and crowds out dynamic information.
Use dynamic context discovery instead: include only minimal static pointers (names, one-line descriptions, file paths) and load full content with search tools when relevant. This is more token-efficient and often improves response quality by reducing contradictory or irrelevant information in the window.
Accept the trade-off: dynamic discovery requires the model to recognize when it needs more context. Current frontier models handle this well, but less capable models may fail to trigger loads. When in doubt, err toward including critical safety or correctness constraints statically.
Pattern 1: Filesystem as Scratch Pad
Redirect large tool outputs to files instead of returning them directly to context, because a single web search or database query can dump thousands of tokens into message history where they persist for the entire conversation.
Write the output to a scratch file, extract a compact summary, and return a file reference. The agent then uses targeted retrieval (grep for patterns, read with line ranges) to access only what it needs.
def handle_tool_output(output: str, threshold: int = 2000) -> str:
if len(output) < threshold:
return output
file_path = f"scratch/{tool_name}_{timestamp}.txt"
write_file(file_path, output)
key_summary = extract_summary(output, max_tokens=200)
return f"[Output written to {file_path}. Summary: {key_summary}]"
Use grep to search the offloaded file and read_file with line ranges to retrieve targeted sections, because this preserves full output for later reference while keeping only ~100 tokens in the active context.
Pattern 2: Plan Persistence
Write plans to the filesystem be
よくある質問
なぜコンテキストをファイルに保存するのですか?
ファイルはコンテキストウィンドウよりはるかに多くの情報を保持でき、エージェントは必要なものだけを読み込むためです。
長期メモリと同じですか?
いいえ。セッションをまたぐ長期メモリは別に扱われており、これはタスク中に使うファイルに焦点を当てています。
古いファイルは片付けられますか?
スキルは、プロンプトの外に保存されたコンテキストの整理方針にも触れています。
詳細
作者による元の説明
This skill should be used when agent work needs file-backed context: durable scratchpads, tool-output offloading, just-in-time discovery, cross-agent handoff files, filesystem memory, or cleanup policies for context stored outside the prompt.
人気
- GitHubのスター
- 18k
- ランキング
- #10642
- ライセンス
- MIT
- 更新日
- 2026/10/11
コメント
- …
このリポジトリの他のスキル
context-engineering-collection
18kエージェントが、AIモデルのコンテキストウィンドウに何を入れるかを管理するよう支援します。メモリやツールから、マルチエージェントの構成、評価までを扱います。
advanced-evaluation
18kエージェントが、スコアリング、並べての比較、バイアスの確認を使って、別のAIによりAIの回答を判定する方法を教えます。
bdi-mental-states
18kエージェントが、BDIの方法を使って信念、目標、計画をモデル化するよう教えます。そのため、各決定を追跡して説明できます。
context-compression
18kエージェントが、長いAIのセッションを、決定、ファイル、リスク、次のステップを残した要約に短縮するよう支援します。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。