filesystem-context
Skill này làm gì
Hệ thống này giúp AI quản lý thông tin quan trọng mà không làm quá tải bộ nhớ ngắn hạn. Nó lưu dữ liệu vào các tệp để AI truy cập khi cần, thay vì cố nhớ mọi thứ cùng một lúc.
Khi nào nên dùng
- ✓Khi AI nhận quá nhiều thông tin cùng lúc.
- ✓Khi AI cần ghi nhớ điều quan trọng trong thời gian dài.
- ✓Khi các phần khác nhau của AI cần chia sẻ thông tin.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/filesystem-context/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Lưu kết quả tìm kiếm này vào một tệp để tôi có thể tham khảo sau.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI ghi thông tin quan trọng vào các tệp. Khi cần dùng lại thông tin đó, nó tìm và chỉ đọc những gì cần thiết, thay vì tải toàn bộ vào bộ nhớ.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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 Use
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
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
…
Câu hỏi thường gặp
Tại sao tôi không thể đưa hết thông tin cho AI cùng một lúc?
AI có 'bộ nhớ ngắn hạn' giới hạn (gọi là cửa sổ ngữ cảnh). Nếu bạn đưa quá nhiều thông tin, nó có thể quên những điều quan trọng nhất hoặc bị rối.
AI biết thông tin nào quan trọng để lưu bằng cách nào?
AI được huấn luyện để nhận diện thông tin có vẻ quan trọng cho tác vụ hiện tại hoặc có thể hữu ích sau này, rồi quyết định lưu nó vào các tệp.
Đây có giống như một 'sổ ghi chú' cho AI không?
Đúng vậy, khá giống. AI dùng các tệp như sổ ghi chú hoặc tủ hồ sơ để lưu trữ và lấy lại thông tin quan trọng khi cần.
Chi tiết
Mô tả gốc của tác giả
Use for file-based context management, dynamic context discovery, and reducing context window bloat. Offload context to files for just-in-time loading.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #4614
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
technical-documentation
394kGiúp agent của bạn viết và rà soát tài liệu kỹ thuật cùng file hướng dẫn cho agent, rõ ràng để mọi người và công cụ AI đều dễ làm theo.
architecture-decision-records
280kGiúp agent của bạn ghi lại các quyết định quan trọng về cấu trúc dự án, giúp hiểu lý do đằng sau các lựa chọn và giữ lịch sử thay đổi rõ ràng.
code-tour
280kGiúp agent của bạn tạo các hướng dẫn đọc code từng bước, có tham chiếu chính xác đến file và dòng, hữu ích cho phần giới thiệu, giải thích và rà soát.