Academic Research Paper
Everything is Context
Agentic File System Abstraction for Context Engineering
A file-system abstraction for context engineering in GenAI systems. Inspired by the Unix philosophy, we propose persistent, governed infrastructure for managing heterogeneous context artefacts through uniform mounting, metadata, and access control.
Redefining Context as Architecture
Generative AI has reshaped software system design by introducing foundation models as pre-trained subsystems. The emerging challenge is no longer model fine-tuning but context engineering—how systems capture, structure, and govern external knowledge, memory, tools, and human input to enable trustworthy reasoning.
This paper proposes a file-system abstraction for context engineering, inspired by the Unix notion that "everything is a file". The abstraction offers a persistent, governed infrastructure for managing heterogeneous context artefacts through uniform mounting, metadata, and access control.
Unix Wisdom for GenAI
In Unix, everything—devices, processes, network sockets—appears as a file in a unified namespace. We extend this powerful abstraction to GenAI context engineering: memory stores, knowledge graphs, tools, and human inputs become mounted resources under a common file system interface.
Agents and humans operate as OS-like processes, performing standard file operations (read, write, search) on context resources. This architectural pattern transforms context from transient, opaque artefacts into persistent, traceable, and governed first-class citizens.
Built on SE First Principles
Abstraction
A uniform interface hides heterogeneity. Knowledge graphs, memory stores, and APIs appear as files without exposing storage mechanisms.
Modularity
Each context resource is a mounted component with well-defined boundaries. Swapping backends requires no changes to other components.
Encapsulation
Internal logic remains isolated. Only minimal operations are exposed, preventing integration leakage across system boundaries.
Traceability
Every interaction is logged as a transaction. Provenance, timestamps, and lineage metadata enable full audit trails.
Verifiability
Changes and reasoning steps can be audited retrospectively. The pipeline is transparent and accountable.
Composability
Consistent namespace and metadata schema enable context elements to be combined without additional integration code.
From Persistent Memory to Token Window
Context Constructor
- select(relevance, recency)
- prioritize(access_scope)
- compress(token_budget)
- manifest(provenance)
Context Updater
- inject(static_snapshot)
- stream(incremental)
- refresh(adaptive)
- isolate(multi_agent)
Context Evaluator
- verify(consistency)
- detect(hallucination)
- persist(validated)
- trigger(human_review)
Memory Taxonomy
| Memory Type | Temporal Scope | Structural Unit | Representation |
|---|---|---|---|
| Scratchpad | Temporary, task-bounded | Dialogue turns, states | Plain text / embeddings |
| Episodic | Medium-term, session | Session summaries | Summaries / embeddings |
| Fact | Long-term, fine-grained | Atomic statements | Key-value / triples |
| Procedural | Long-term, system-wide | Functions, tools | API / code references |
| Historical | Immutable, full-trace | Raw interaction logs | Plain text + metadata |
AIGNE Framework: AFS in Action
The proposed architecture is implemented within the open-source AIGNE Framework, demonstrating how heterogeneous context sources can be mounted and accessed through a unified file system interface.
import { AIAgent } from "@aigne/core"; import { AFS } from "@aigne/afs"; import { AFSHistory } from "@aigne/afs-history"; import { UserProfileMemory } from "@aigne/afs-user-profile-memory"; // Persistent storage configuration const sharedStorage = { url: "file:./memory.sqlite3" }; // Mount context sources into unified namespace const afs = new AFS() .mount(new AFSHistory({ storage: sharedStorage })) .mount(new UserProfileMemory({ storage: sharedStorage })); // Agent with governed, traceable context const agent = AIAgent.from({ instructions: "You are a context-aware assistant", inputKey: "message", afs, });
// Any MCP server becomes an AFS module const mcpAgent = await MCPAgent.from({ command: "docker", args: ["run", "-i", "ghcr.io/github/github-mcp"], }); // Mounted at /modules/github-mcp const afs = new AFS().mount(mcpAgent); // Agent invokes GitHub tools via file system // afs_exec("/modules/github-mcp/search_repositories")
Research Team
Explore the Framework
AFS is implemented within the open-source AIGNE Framework. Read the paper, explore the code, and join the research.