npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cogineai/mafs-core

v0.1.0-alpha.0

Published

A Unified Virtual Filesystem For AI Agents

Downloads

179

Readme

@cogineai/mafs-core

npm version License

Runtime-agnostic primitives for MAFS — A Unified Virtual File System for AI Agents.

This is the engine: the Workspace class, the Resource interface, the ops/commands registry, the shell parser and executor, the cache abstractions, and reusable resource implementations that don't need Node-specific I/O (RAM, S3 over fetch, Slack/Discord/GitHub HTTP transports, …). It runs anywhere modern JavaScript runs — Node ≥ 20, browsers, edge runtimes, Bun, Deno, Pyodide.

Most consumers should depend on @cogineai/mafs-node or @cogineai/mafs-browser — both re-export everything here and add runtime-specific pieces. Reach for mafs-core only when:

  • You're authoring a new resource or runtime adapter,
  • You're embedding MAFS into a non-standard environment (Pyodide, a custom edge worker), or
  • You want the smallest possible bundle and only need RAM-level functionality.

Install

npm install @cogineai/mafs-core

Optional peer:

npm install pyodide   # only if you'll execute Python inside the workspace

Quick start

import { MountMode, RAMResource, Workspace } from '@cogineai/mafs-core'

const ws = new Workspace({ '/data': new RAMResource() }, { mode: MountMode.WRITE })

await ws.fs.writeFile('/data/hello.txt', 'hello mafs\n')
const result = await ws.execute('cat /data/hello.txt | wc -l')
console.log(result.stdoutText) //=> "       1\n"

await ws.close()

What lives here

  • Workspace — the unified VFS façade: ws.fs.* for direct file ops, ws.execute(cmd) to run a shell pipeline across mounts, ws.snapshot() for portability.
  • Resource — the abstract contract every backend implements (readdir, read, write, stat, unlink, glob, …). RAMResource, DevResource, and HTTP-only resources (Slack, GitHub, GCS via fetch, …) live here; native-binding resources (FUSE, postgres-driver, sherpa-onnx) live in @cogineai/mafs-node.
  • OpsRegistry — the registry that maps shell commands (cat, grep, sort, find, jq, …) to per-resource implementations. ~80 builtin RAM ops plus per-resource overrides (S3, Slack, GitHub, …).
  • Shell layercreateShellParser, executeNode, expansion, jobs, redirects, control flow. The full POSIX-ish shell that powers ws.execute().
  • Cache layerIndexCacheStore + FileCache mixin, with RAM-backed implementations. Redis-backed implementations live in mafs-node; consumers can plug their own.
  • Session, SessionManager, ExecutionHistory — multi-turn agent state.
  • Snapshot / clone — tar-based portable workspace export/import.

Extending MAFS

Adding a new backend means implementing Resource. Once registered, every shell command, agent adapter, and CLI inherits filesystem semantics for free:

import { type Resource, throwUnsupported } from '@cogineai/mafs-core'

export class MyResource implements Resource {
  async readdir(path: string): Promise<string[]> {
    /* … */
  }
  async read(path: string): Promise<Uint8Array> {
    /* … */
  }
  async stat(path: string) {
    /* … */
  }
  // The base interface marks unimplemented methods with throwUnsupported()
  // until you fill them in — useful for read-only or partial backends.
}

The same applies to ops (OpsRegistry.register({ kind: 'cat', resource: 'my', impl })) and shell builtins.

API surface

@cogineai/mafs-core exports ~1000 named symbols — far too many to list here. Browse the full surface in packages/mafs/typescript/packages/core/src/index.ts or rely on your IDE's import suggestions; everything is typed.

The most-used groupings:

  • Top-level typesWorkspace, Resource, MountMode, FileStat, FileType, PathSpec, ResourceName.
  • ResourcesRAMResource, DevResource, S3Resource, SlackResource, GitHubResource, LinearResource, NotionResource, GDocsResource, GSheetsResource, GmailResource, … (40+ resources).
  • OpsRAM_OPS, S3_OPS, GITHUB_VFS_OPS, … (one per resource).
  • CacheRAMFileCacheStore, RAMIndexCacheStore, IndexCacheStore, IndexEntry.
  • Cache parts of resources — most resource modules export *_PROMPT and per-tool helpers (featherCat, parquetGrep, …) you can compose into your own backends.

Companion packages

License & attribution

Apache-2.0. MAFS is a fork of Mirage; see the project-level NOTICE for attribution and the relationship to upstream.