filesystem-context
This skill should be used when the user asks to "offload context to files", "implement dynamic context discovery", "use filesystem for agent memory", "reduce…
Skill by hcb2019
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/hcb2019-filesystem-context
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/filesystem-context
What's inside
- Skill name
filesystem-context- Description
- This skill should be used when the user asks to "offload context to files", "implement dynamic context discovery", "use filesystem for agent memory", "reduce context window bloat", or mentions file-based context management, tool output persistence, agent scratch pads, or just-in-time context loading.
- License
- MIT
- Instructions
- 318 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Agent Skills spec issues
- name: "filesystem-context" does not match folder "contexto-em-arquivos"
Files (2)
- SKILL.md
- filesystem_context.py · scripts/
SKILL.md (first lines)
# Filesystem-Based Context Engineering
The filesystem provides a single interface through which agents can flexibly store, retrieve, and update an effectively unlimited amount of context. This pattern addresses the fundamental constraint that context windows are limited while tasks often require more information than fits in a single window.
The core insight is that files enable dynamic context discovery: agents pull relevant context on demand rather than carrying everything in the context window. This contrasts with static context, which is always included regardless of relevance.
## 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
## Core Concepts
Context engineering can fail in four predictable ways. First, when the context an agent needs is not in the total available context. Second, when retrieved context fails to encapsulate needed context. Third, when retrieved context far exceeds needed context, wasting tokens and degrading performance. Fourth, when agents cannot discover niche information buried in many files.
The filesystem addresses these failures by providing a persistent layer where agents write once and read selectively, offloading bulk content while preserving the ability to retrieve specific information through search tools.
## Detailed Topics
### The Static vs Dynamic Context Trade-off
**Static Context**
Static context is always included in the prompt: system instructions, tool definitions, and critical rules. Static context consumes tokens regardless of task relevance. As agents accumulate more capabilities (tools, skills, instructions), static context grows and crowds out space for dynamic information.
**Dynamic Context Discovery**
Dynamic context is loaded on-demand when relevant to the current task. The agent receives minimal static pointers (names, descriptions, file paths) and uses search tools to load full content when needed.
Dynamic discovery is more token-efficient because only necessary data enters the context window. It can also improve response quality by reducing potentially confusing or contradictory information.
The trade-off: dynamic discovery requires the model to correctly identify when to load additional context. This works well with current frontier models but may fail with less capable models that do not recognize when they need more information.
### Pattern 1: Filesystem as Scratch Pad
**The Problem**
Tool calls can return massive outputs. A web search may return 10k tokens of raw content. A database query may return hundreds of rows. If this content enters the message history, it remains for the entire conversation, inflating token costs and potentially degrading attention to more relevant information.
**The Solution**
Write large tool outputs to files instead of returning them directly to the context. The agent then uses targeted retrieval (grep, line-specific reads) to extract only the relevant portions.
**Implementation**
```python
def handle_tool_output(output: str, threshold: int = 2000) -> str:
if len(output) < threshold:
return output
# Write to scratch pad
file_path = f"scratch/{tool_name}_{timestamp}.txt"
write_file(file_path, output)
# Return reference instead of content
key_summary = extract_summary(output, max_tokens=200)
return f"[Output written to {file_path}. Summary: {key_summary}]"
```
The agent can then use `grep` to search for specific patterns or `read_file` with line ranges to retrieve targeted sections.
**Benefits**
- Reduces token accumulation over long conversations
- Preserves full output for later reference
- Enables targeted retrieval instead of carrying everything
### Pattern 2: Plan Persistence
**The Problem**
Long-horizon tasks require agents to make plans and follow them. But as conversations extend, plans can fall out of attention or be lost to summarization. The agent loses track of what it was supposed to do.
**The Solution**
Write plans to the filesystem. The agent can re-read its plan at any point, reminding itself of the current objective and progress. This is sometimes called "manipulating attention through recitation."
**Implementation**
Store plans in structured format:
```yaml
# scratch/current_plan.yaml
objective: "Refactor authentication module"
status: in_progress
steps:
- id: 1
description: "Audit current auth endpoints"
status: completed
- id: 2
description: "Design new token validation flow"
status: in_progress
- id: 3
description: "Implement and test changes"
status: pending
```
The agent reads this file at the start of each turn or when it needs to re-orient.
### Pattern 3: Sub-Agent Communication via Filesystem
**The Problem**
In multi-agent systems, sub-agents typically report findings to a coordinator agent through message passing. This creates a "game of telephone" where information degrades through summarization at each hop.
**The Solution**
Sub-agents write their findings directly to the filesystem. The coordinator reads these files directly, bypassing intermediate message passing. This preserves fidelity and reduces context accumulation in the coordinator.
**Implementation**
```
workspace/
agents/
research_agent/
findings.md # Research agent writes here
sources.jsonl # Source tracking
code_agent/
changes.md # Code agent writes here
test_results.txt # Test output
coordinator/
synthesis.md # Coordinator reads agent outputs, writes synthesis
```
Each agent operates in relative isolation but shares state through the filesystem.From hcb2019/claude-code-skills, MIT.
More from hcb2019/claude-code-skills
- 0.498score
diagnose
hcb2019
Loop disciplinado de diagnóstico para bugs difíceis e regressões de performance.
SkillCFreshness: C★ 1Claude Code +9 - 0.495score
git-guardrails-claude-code
hcb2019
Configura hooks do Claude Code para bloquear comandos git perigosos (push, reset --hard, clean, branch -D, etc.) antes que sejam executados.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
setup-pre-commit
hcb2019
Configura hooks de pre-commit com Husky, lint-staged (Prettier), verificação de tipos e testes no repositório atual.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
humanizador-pt-br
hcb2019
Remove traços de escrita de IA de textos em português brasileiro, preservando a voz e expertise do autor.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
tdd
hcb2019
Desenvolvimento orientado a testes com loop red-green-refactor.
SkillCFreshness: C★ 1Claude Code +9 - 0.493score
prototype
hcb2019
Constrói um protótipo descartável para explorar um design antes de se comprometer com ele.
SkillCFreshness: C★ 1Claude Code +9 - 0.493score
improve-codebase-architecture
hcb2019
Encontra oportunidades de aprofundamento em um código, informado pela linguagem de domínio no CONTEXT.md e pelas decisões em docs/adr/.
SkillCFreshness: C★ 1Claude Code +9 - 0.490score
to-prd
hcb2019
Transforma o contexto atual da conversa em um PRD (Documento de Requisitos do Produto) e publica no tracker de issues do projeto.
SkillCFreshness: C★ 1Claude Code +9 - 0.490score
grill-with-docs
hcb2019
Sessão de sabatina que desafia seu plano contra o modelo de domínio existente, afia a terminologia e atualiza a documentação (CONTEXT.md, ADRs) inline…
SkillCFreshness: C★ 1Claude Code +9 - 0.490score
caveman
hcb2019
Modo de comunicação ultra-comprimido.
SkillCFreshness: C★ 1Claude Code +9 - 0.490score
to-issues
hcb2019
Quebra um plano, spec ou PRD em issues independentes no tracker de issues do projeto usando fatias verticais tracer-bullet.
SkillCFreshness: C★ 1Claude Code +9 - 0.490score
triage
hcb2019
Triagem de issues através de uma máquina de estados guiada por papéis de triagem.
SkillCFreshness: C★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jun 8, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/hcb2019/claude-code-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.234score
filesystem-context
dldnwls07
This skill should be used when the user asks to "offload context to files", "implement dynamic context discovery", "use filesystem for agent memory", "reduce…
SkillDFreshness: DClaude Code +9 - 0.231score
filesystem-context
illogical
This skill should be used when the user asks to "offload context to files", "implement dynamic context discovery", "use filesystem for agent memory", "reduce…
SkillDFreshness: DClaude Code +9
More from hcb2019
- 0.498score
diagnose
hcb2019
Loop disciplinado de diagnóstico para bugs difíceis e regressões de performance.
SkillCFreshness: C★ 1Claude Code +9 - 0.495score
git-guardrails-claude-code
hcb2019
Configura hooks do Claude Code para bloquear comandos git perigosos (push, reset --hard, clean, branch -D, etc.) antes que sejam executados.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
tdd
hcb2019
Desenvolvimento orientado a testes com loop red-green-refactor.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
humanizador-pt-br
hcb2019
Remove traços de escrita de IA de textos em português brasileiro, preservando a voz e expertise do autor.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
setup-pre-commit
hcb2019
Configura hooks de pre-commit com Husky, lint-staged (Prettier), verificação de tipos e testes no repositório atual.
SkillCFreshness: C★ 1Claude Code +9 - 0.493score
prototype
hcb2019
Constrói um protótipo descartável para explorar um design antes de se comprometer com ele.
SkillCFreshness: C★ 1Claude Code +9
Cite this page
filesystem-context skill. Agent Mart. https://agentmart.dev/skills/hcb2019-filesystem-context (last updated 2026-10-24)