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.

$ afs mount /context/memory
$ afs mount /context/tools
$ afs mount /context/knowledge
# Context is now traceable, verifiable, and governed
$ agent.reason() _

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.

/ context
/ memory
~ episodic.db
~ facts.kg
~ user_profile.json
/ tools
* github-mcp
* search.py
/ history
~ session_001.log
/ human
~ annotations.md

Built on SE First Principles

<A>

Abstraction

A uniform interface hides heterogeneity. Knowledge graphs, memory stores, and APIs appear as files without exposing storage mechanisms.

[M]

Modularity

Each context resource is a mounted component with well-defined boundaries. Swapping backends requires no changes to other components.

{E}

Encapsulation

Internal logic remains isolated. Only minimal operations are exposed, preventing integration leakage across system boundaries.

#T

Traceability

Every interaction is logged as a transaction. Provenance, timestamps, and lineage metadata enable full audit trails.

~V

Verifiability

Changes and reasoning steps can be audited retrospectively. The pipeline is transparent and accountable.

+C

Composability

Consistent namespace and metadata schema enable context elements to be combined without additional integration code.

From Persistent Memory to Token Window

STAGE 01

Context Constructor

  • select(relevance, recency)
  • prioritize(access_scope)
  • compress(token_budget)
  • manifest(provenance)
STAGE 02

Context Updater

  • inject(static_snapshot)
  • stream(incremental)
  • refresh(adaptive)
  • isolate(multi_agent)
STAGE 03

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.

agent-with-memory.ts TypeScript
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,
});
mcp-github-mount.ts TypeScript
// 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

Xiwei Xu

CSIRO's Data61
University of New South Wales

xiwei.xu@data61.csiro.au

Robert Mao

ArcBlock, Inc
Seattle, USA

rob@arcblock.io

Xuewu Gu

ArcBlock, Inc
Seattle, USA

nate@arcblock.io

Yechao Li

ArcBlock, Inc
Seattle, USA

liyechao@arcblock.io

Quan Bai

University of Tasmania
Australia

quan.bai@utas.edu.au

Liming Zhu

CSIRO's Data61
University of New South Wales

liming.zhu@data61.csiro.au

Explore the Framework

AFS is implemented within the open-source AIGNE Framework. Read the paper, explore the code, and join the research.