Skip to content

Virtual File System

RTC Agent builds a complete virtual file system in the browser. AI operates on files using tools like ls, read, write, grep, and find, just like working with a local terminal — but all data always stays within the user’s browser.

💡 Core Insight: LLMs are already very good at operating file systems. Instead of making the AI learn custom APIs, give it a file system — it can immediately ls, read, grep, and write.

DirectoryPurposeContent Source
/functions/Function documentationAuto-generated after the host app registers Functions
/scenarios/Scenario documentationMarkdown workflows provided by the business side
/scripts/Executable scriptsSaved by AI via the script tool
/AGENT.mdSystem entry pointAuto-generated template describing directory structure and tools

The virtual file system provides 6 operations covering all file interactions the AI needs:

OperationFunctionKey Parameters
lsList directory contentspath (default /)
readRead file contentspath (required), offset / limit (pagination)
writeCreate or write to filepath, content (required), mode (overwrite / append)
findSearch by file namepattern (glob), path
grepSearch by file contentpattern (regex), path, caseSensitive
removeDelete filepath

⚠️ remove is an internal API of the virtual file system and is not currently exposed to AI as an RTC tool. AI cannot directly delete files.

Large files support paginated reading to avoid loading too much content at once:

RuleDescription
Root directory/
Separator/ (forward slash)
Auto-conversionAll paths are automatically converted to absolute paths
Path traversal.. is rejected directly, without parsing
DirectoriesLogical concept, not stored separately, derived from path prefixes

File types are automatically inferred from the path prefix, no explicit specification needed:

FeatureDescription
Storage EngineIndexedDB (wrapped by Dexie.js)
Primary KeyFile path
Large FilesStored and retrieved as whole, supports paginated reading
Read BehaviorEach read queries the latest data directly, no cache layer
CapacitySubject to browser IndexedDB quota (typically hundreds of MB)

At system startup, /AGENT.md is automatically checked. If it doesn’t exist, a template file is auto-generated to describe the directory structure and available tools to the AI — ensuring the AI knows “what’s in the file system” as soon as it comes online.

ConstraintDescription
🔒 Path traversal protection.. is rejected directly
🔐 Permission controlDetermined by work mode
💾 Capacity limitsSubject to browser IndexedDB quota
🚫 No cross-origin accessFile system is fully isolated within the browser sandbox
  • Remote Tool Calling — Learn how AI calls these file operations
  • Script Engine — Learn how scripts in the /scripts/ directory are executed
  • Skill System — Learn how functions in the /functions/ directory are registered