English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Everything is Context: Agentic File System Abstraction for Context Engineering

Forum topic · ✨步子哥 · 2025-12-11

Summary

This post introduces a file system abstraction for context engineering in generative AI systems, inspired by the Unix philosophy that everything is a file. It argues that current practices such as prompt engineering, RAG, and tool integration remain fragmented, producing ephemeral, untraceable context artifacts. The proposed Agentic File System (AFS) treats all heterogeneous context sources—memory, tools, external knowledge, human input—as files mounted in a unified namespace with metadata, access control, and audit logs. On top of this abstraction, the authors build a verifiable context engineering pipeline with three components: a Context Constructor that selects and compresses context under token budgets and emits a JSON manifest; a Context Loader that assembles context into the prompt buffer in static or streaming modes; and a Context Evaluator that checks model outputs against source context using a consistency confidence score, triggering human review below a threshold and persisting validated knowledge to long-term memory. The architecture is implemented in the open-source AIGNE TypeScript framework and demonstrated with two examples: a memory-capable agent and an MCP-based GitHub assistant. The post concludes with future directions including context governance, efficient retrieval/compression, multimodal context, and human-in-the-loop context curation.

Everything is Context: Agentic File System Abstraction for Context Engineering

Introduction: From Model Fine-Tuning to Context Engineering

Generative AI is reshaping software architecture, with foundation models acting as pre-trained subsystems. The challenge is shifting from model fine-tuning to context engineering—how systems capture, structure, and govern external knowledge, memory, tools, and human input for trustworthy reasoning. Current practices (prompt engineering, RAG, tool integration) remain fragmented, producing context artifacts that are ephemeral, untraceable, and hard to verify.

To address this, the post proposes a file system abstraction for context engineering, inspired by the Unix philosophy "everything is a file." It provides persistent, governable infrastructure for managing heterogeneous context artifacts via unified mounting, metadata, and access control. The architecture is implemented in the open-source AIGNE framework as a verifiable context engineering pipeline, demonstrated with a memory-capable agent and an MCP-based GitHub assistant.

Background: The Rise of Context Engineering

Unlike prompt engineering, which focuses on individual instructions, context engineering addresses the entire information lifecycle: selection, retrieval, filtering, construction, compression, evaluation, and refresh. Industry frameworks like LangChain identify four phases—writing context to shared memory, selecting relevant elements, compressing context to fit model constraints, and isolating the final subset for reasoning. Similar pipelines appear in AutoGen. However, these solutions are ad hoc and implementation-driven, lacking unified architectural foundations for traceability and governance, leading to context rot and knowledge drift.

Related academic work includes the LLM-as-OS paradigm: AIOS applies OS-like primitives (scheduling, memory management) to multi-agent systems; MemGPT introduces memory hierarchies coordinating context windows with external storage. The Model Context Protocol (MCP) standardizes connecting AI assistants to data sources via a client-host-server architecture over JSON-RPC, but focuses on data access rather than in-model context organization, governance, and verification.

The File System Abstraction: Persistent Context Infrastructure

The core contribution treats all heterogeneous context sources as files in a unified namespace, offering:

  • Abstraction and unified interface — memory, tool definitions, and knowledge entries are all accessed via file paths and standard operations (read, search, write, execute). Integrating a new source is as simple as mounting a new file system.
  • Modularity and encapsulation — each context source is an independent namespace joined via mount points, enabling independent evolution.
  • Separation of concerns — models focus on reasoning; context acquisition, organization, and governance live in the file system layer.
  • Traceability and verifiability — all operations are logged, with version control and snapshots supporting rollback and auditing.
  • Composability — one agent's memory can be mounted as a subdirectory of another agent's context.
  • The Agentic File System (AFS) provides core operations (list, read, search, write/update, execute) with structured metadata per file (creation time, owner, permissions, source ID, version) and per-operation audit logs.

    The Context Engineering Pipeline

    Three modules form a closed-loop, auditable context lifecycle:

    Context Constructor

    Selects, prioritizes, and compresses context artifacts from mounted namespaces based on relevance (semantic similarity, recency) under access-control constraints. It enforces a token budget (T_max), summarizing or truncating content as needed, and outputs a JSON manifest listing selected files, their order, and selection rationale.

    Context Loader

    Physically reads and assembles selected context into the prompt buffer, in static mode (one-shot) or streaming mode (incremental, suited to multi-turn dialogue). It monitors token usage continuously and logs every injection/update with session ID, timestamp, and source path.

    Context Evaluator

    After inference, extracts atomic claims from the model output and compares them against the source context referenced in the manifest, producing a consistency confidence score. Below a threshold θ, the system triggers human review. Validated outputs are persisted to long-term memory (e.g., /context/memory/...) with full provenance and appended to a transaction log.

    In short: the constructor ensures *the right context*, the loader ensures *context is used correctly*, and the evaluator ensures *context was used correctly*.

    Implementation: AIGNE Framework and Examples

    The architecture is implemented in AIGNE, a composable, TypeScript-first agent framework with a multi-model adapter (AIGNE Hub). External sources (vector databases, knowledge graphs, MCP servers) mount into the unified namespace.

    Two demonstrations are provided:

    1. Memory-capable agent — memory stored at /context/memory/{agentID}/ (user preferences, dialogue summaries). The pipeline retrieves relevant history, feeds it as context, validates outputs against memory, and updates memory with new information, enabling coherent, personalized multi-turn interactions. 2. MCP-based GitHub assistant — an MCP server exposing GitHub data (code, Issues, PRs) is mounted at /modules/github-mcp, letting the agent query GitHub as files. The evaluator verifies answers against repository data and persists useful conclusions to memory.

    Conclusion and Future Directions

    By treating context as files, the architecture provides persistent, governable infrastructure for context engineering and a foundation for accountable, human-centered AI collaboration. Future work includes:

  • Finer-grained context governance (access control, privacy, compliance auditing)
  • Efficient context retrieval and compression algorithms under token constraints
  • Unified management of multimodal context (text, images, code)
  • Human-AI collaborative context engineering with intuitive curation and verification interfaces

Tags

#context-engineering#agentic-file-system#llm#ai-agents#rag#mcp#aigne-framework#generative-ai

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/176415117