메뉴
HN
Hacker News 58일 전

AI 어시스턴트, RAG 대신 가상 파일시스템 도입

IMP
8/10
핵심 요약

문서 검색에 쓰이는 전통적인 RAG 방식의 한계(정확한 문법 누락, 다중 페이지 탐색 불가 등)를 극복하고자 가상 파일시스템인 ChromaFs를 도입한 사례입니다. 이를 통해 샌드박스 컨테이너 생성에 걸리던 46초의 지연 시간을 100밀리초로 단축하고 연간 7만 달러 이상의 인프라 비용을 절감했습니다. 기존 DB 인프라를 재사용해 추가 비용 없이 에이전트가 셸 명령어(ls, grep 등)로 문서를 탐색할 수 있게 한 것이 핵심입니다.

번역된 본문

모든 기사 엔지니어링 / 5분 읽기

우리는 AI 어시스턴트를 위한 가상 파일시스템을 어떻게 구축했는가 2026년 3월 24일 DS Dens Sumesh 엔지니어링 이 기사 공유하기

RAG(검색 증강 생성)는 완벽해 보이지만, 그렇지 않을 때가 있습니다. 우리의 어시스턴트는 쿼리와 일치하는 텍스트 청크만 검색할 수 있었습니다. 정답이 여러 페이지에 걸쳐 있거나, 사용자가 Top-K 결과에 포함되지 않은 정확한 구문이 필요한 경우에는 어시스턴트가 해결할 수 없었습니다. 우리는 어시스턴트가 코드베이스를 탐색하듯 문서를 탐색하기를 원했습니다.

에이전트는 파일시스템을 기본 인터페이스로 수렴하고 있습니다. 왜냐하면 grep, cat, ls, find가 에이전트에 필요한 전부이기 때문입니다. 각 문서 페이지가 파일이고 각 섹션이 디렉토리라면, 에이전트는 정확한 문자열을 검색하고, 전체 페이지를 읽고, 스스로 구조를 탐색할 수 있습니다. 우리는 실시간 문서 사이트를 반영하는 파일시스템이 필요했습니다.

컨테이너 병목 현상 이를 구현하는 가장 명확한 방법은 에이전트에 실제 파일시스템을 제공하는 것입니다. 대부분의 프레임워크는 격리된 샌드박스를 실행하고 리포지토리를 복제하여 이를 해결합니다. 우리는 이미 지연 시간이 크게 중요하지 않은 비동기 백그라운드 에이전트를 위해 샌드박스를 사용하고 있지만, 사용자가 로딩 스피너를 쳐다보고 있는 프론트엔드 어시스턴트의 경우 이 방식은 한계에 부딪힙니다. P90 세션 생성 시간(GitHub 클론 및 기타 설정 포함)은 약 46초였습니다. 지연 시간을 넘어, 정적 문서를 읽기 위해 전용 마이크로 VM을 사용하는 것은 막대한 인프라 비용을 초래했습니다. 월 85만 건의 대화가 발생하는 상황에서 최소한의 설정(1 vCPU, 2GiB RAM, 5분 세션 수명)만으로도 Daytona의 초당 샌드박스 요금 책정에 따라 연간 $70,000 이상의 비용이 듭니다. 세션 시간이 길어지면 비용은 두 배로 증가합니다.(이는 순진한 계산에 기반한 것이며, 실제 프로덕션에서는 웜 풀과 컨테이너 공유를 사용하겠지만, 요점은 동일합니다.)

우리는 파일시스템 워크플로우가 즉각적이고 저렴해야 했고, 이는 파일시스템 자체를 다시 생각해야 함을 의미했습니다.

셸(Shell) 속이기 에이전트는 실제 파일시스템이 필요하지 않습니다. 단지 그럴듯한 환상만 필요할 뿐입니다. 우리의 문서는 이미 검색을 지원하기 위해 Chroma 데이터베이스에 인덱싱, 청킹 및 저장되어 있었습니다. 따라서 UNIX 명령을 가로채어 이를 동일한 데이터베이스에 대한 쿼리로 변환하는 가상 파일시스템인 ChromaFs를 구축했습니다. 세션 생성 시간은 약 46초에서 약 100밀리초로 감소했으며, ChromaFs는 이미 지불한 인프라를 재사용하므로 대화당 추가 컴퓨팅 비용은 0입니다.

ChromaFs는 Vercel Labs의 just-bash(Malte에게 찬사를!) 위에 구축되었습니다. 이는 TypeScript로 재구현된 bash로, grep, cat, ls, find 및 cd를 지원합니다. just-bash는 플러그 가능한 IFileSystem 인터페이스를 노출하므로 모든 구문 분석, 파이핑 및 플래그 논리를 처리하고, ChromaFs는 모든 기본 파일시스템 호출을 Chroma 쿼리로 변환합니다.

작동 방식 디렉토리 트리 부트스트래핑 ChromaFs는 에이전트가 단일 명령을 실행하기 전에 어떤 파일이 존재하는지 알아야 합니다. 우리는 전체 파일 트리를 Chroma 컬렉션 내부의 gzip으로 압축된 JSON 문서(path_tree)로 저장합니다:

{ "auth/oauth": { "isPublic": true, "groups": [] }, "auth/api-keys": { "isPublic": true, "groups": [] }, "internal/billing": { "isPublic": false, "groups": [ "admin", "billing" ] }, "api-reference/endpoints/users": { "isPublic": true, "groups": [] } }

초기화 시 서버는 이 문서를 가져와 압축을 풀고 두 개의 인메모리 구조(파일 경로의 Set과 디렉토리를 하위 항목에 매핑하는 Map<string, string[]>)로 만듭니다. 구축이 완료되면 ls, cd 및 find는 네트워크 호출 없이 로컬 메모리에서 해결됩니다. 트리는 캐시되므로 동일한 사이트에 대한 후속 세션은 건너뜁니다.

원문 보기
원문 보기 (영어)
All articles Engineering / 5 minute s read How we built a virtual filesystem for our Assistant March 24, 2026 DS Dens Sumesh Engineering Share this article RAG is great, until it isn&#x27;t. Our assistant could only retrieve chunks of text that matched a query. If the answer lived across multiple pages, or the user needed exact syntax that didn&#x27;t land in a top-K result, it was stuck. We wanted it to explore docs the way you&#x27;d explore a codebase. Agents are converging on filesystems as their primary interface because grep , cat , ls , and find are all an agent needs. If each doc page is a file and each section is a directory, the agent can search for exact strings, read full pages, and traverse the structure on its own. We just needed a filesystem that mirrored the live docs site. The Container Bottleneck The obvious way to do this is to just give the agent a real filesystem. Most harnesses solve this by spinning up an isolated sandbox and cloning the repo. We already use sandboxes for asynchronous background agents where latency is an afterthought, but for a frontend assistant where a user is staring at a loading spinner, the approach falls apart. Our p90 session creation time (including GitHub clone and other setup) was ~46 seconds . Beyond latency, dedicated micro-VMs for reading static documentation introduced a serious infrastructure bill: $0 $50k $100k $150k $200k 0 3 5 7 10 12 15 Average session duration (minutes) Additional annual compute cost Sandbox ChromaFs At 850,000 conversations a month, even a minimal setup (1 vCPU, 2 GiB RAM, 5-minute session lifetime) would put us north of $70,000 a year based on Daytona&#x27;s per-second sandbox pricing ($0.0504/h per vCPU, $0.0162/h per GiB RAM). Longer session times double that. (This is based on a purely naive approach, a true production workflow would probably have warm pools and container sharing, but the point still stands) We needed the filesystem workflow to be instant and cheap, which meant rethinking the filesystem itself. Faking a Shell The agent doesn&#x27;t need a real filesystem; it just needs the illusion of one. Our documentation was already indexed, chunked, and stored in a Chroma database to power our search, so we built ChromaFs : a virtual filesystem that intercepts UNIX commands and translates them into queries against that same database. Session creation dropped from ~46 seconds to ~100 milliseconds , and since ChromaFs reuses infrastructure we already pay for, the marginal per-conversation compute cost is zero. Metric Sandbox ChromaFs P90 Boot Time ~46 seconds ~100 milliseconds Marginal Compute Cost ~$0.0137 per conversation ~$0 (reuses existing DB) Search Mechanism Linear disk scan (Syscalls) DB Metadata Query Infrastructure Daytona or similar providers Provisioned DB ChromaFs is built on just-bash by Vercel Labs (shoutout Malte !), a TypeScript reimplementation of bash that supports grep , cat , ls , find , and cd . just-bash exposes a pluggable IFileSystem interface, so it handles all the parsing, piping, and flag logic while ChromaFs translates every underlying filesystem call into a Chroma query. View the core ChromaFs implementation How it works Bootstrapping the Directory Tree ChromaFs needs to know what files exist before the agent runs a single command. We store the entire file tree as a gzipped JSON document ( __path_tree__ ) inside the Chroma collection: { "auth/oauth" : { "isPublic" : true , "groups" : [] }, "auth/api-keys" : { "isPublic" : true , "groups" : [] }, "internal/billing" : { "isPublic" : false , "groups" : [ "admin" , "billing" ] }, "api-reference/endpoints/users" : { "isPublic" : true , "groups" : [] } } On init, the server fetches and decompresses this document into two in-memory structures: a Set<string> of file paths and a Map<string, string[]> mapping directories to children. Once built, ls , cd , and find resolve in local memory with no network calls. The tree is cached, so subsequent sessions for the same site skip the Chroma fetch entirely. Access Control Notice the isPublic and groups fields in the path tree. Before building the file tree, ChromaFs prunes slugs using the current user&#x27;s session token and applies a matching filter to all subsequent Chroma queries. If a user lacks access to a file, that file is excluded from the tree entirely, so the agent can&#x27;t access or even reference a path that was pruned. In a real sandbox, this level of per-user access control would require managing Linux user groups, chmod permissions, or maintaining isolated container images per customer tier. In ChromaFs it&#x27;s a few lines of filtering before buildFileTree runs. Public user Billing team Admin Groups: none Path Access Visible / auth/oauth .mdx public ✓ / auth/api-keys .mdx public ✓ / internal/billing .mdx admin, billing ✗ / internal/audit-log .mdx admin ✗ / api-reference/users .mdx public ✓ / api-reference/payments .mdx billing ✗ Reassembling Pages from Chunks Pages in Chroma are split into chunks for embedding, so when the agent runs cat /auth/oauth.mdx , ChromaFs fetches all chunks with a matching page slug, sorts by chunk_index , and joins them into the full page. Results are cached so repeated reads during grep workflows never hit the database twice. Not every file needs to exist in Chroma. We register lazy file pointers that resolve on access for large OpenAPI specs stored in customers&#x27; S3 buckets. The agent sees v2.json in ls /api-specs/ , but the content only fetches when it runs cat . Every write operation throws an EROFS (Read-Only File System) error. The agent explores freely but can never mutate documentation, which makes the system stateless with no session cleanup and no risk of one agent corrupting another&#x27;s view. Optimizing Grep cat and ls are straightforward to virtualize, but grep -r would be far too slow if it naively scanned every file over the network. We intercept just-bash ’s grep , parse the flags with yargs-parser , and translate them into a Chroma query ( $contains for fixed strings, $regex for patterns). Chroma acts as a coarse filter that identifies which files might contain the hit, and we bulkPrefetch those matching chunks into a Redis cache. From there, we rewrite the grep command to target only the matched files and hand it back to just-bash for fine filter in-memory execution, which means large recursive queries complete in milliseconds. View the grep optimization implementation grep -ri "access_token" grep -ri "webhook" grep -ri "billing" 1. Coarse filter (Chroma) /auth/oauth.mdx /auth/api-keys.mdx /api-reference/users.mdx /api-reference/payments.mdx /guides/quickstart.mdx /guides/webhooks.mdx 3 / 6 files match → 2. Fine filter (in-memory regex) /auth/oauth.mdx Use the access_token from the OAuth flow to authenticate API requests. /api-reference/users.mdx The GET /users endpoint returns a list of users. Requires access_token in the Authorization header. /guides/quickstart.mdx Get started by generating an access_token using the OAuth guide. Conclusion ChromaFs powers the documentation assistant for hundreds of thousands of users across 30,000+ conversations a day. By replacing sandboxes with a virtual filesystem over our existing Chroma database, we got instant session creation, zero marginal compute cost, and built-in RBAC without any new infrastructure. Try it on any Mintlify docs site, or at mintlify.com/docs . More blog posts to read Best Practices Docs on autopilot: From zero to self-maintaining with Mintlify How Mintlify&#x27;s auto-generated docs and workflows combine to take documentation from nonexistent to self-maintaining. April 3, 2026 PL Peri Langlois Head of Product Marketing AI Trends The state of agent traffic in documentation (March 2026) An analysis of 30 days of Mintlify documentation traffic, broken down by AI agents, browsers, and other sources. April 3, 2026 HW Han Wang Co-Founder DS Dens Sumesh Engineering Share this article