Skip to main content

A CLI-driven virtual filesystem for AI agents

Project description

agent-clifs

A virtual filesystem for AI agents. Unix commands they already know. Zero dependencies.


Load documents, codebases, or any text into an in-memory filesystem and let your AI agent explore it with ls, grep, find, tree, and more.

Install

pip install agent-clifs

Quick Start

from agent_clifs import AgentCLI

cli = AgentCLI()

# Load your documentation
cli.execute("mkdir -p /docs/api")
cli.execute("write /docs/api/users.md '# Users API\nGET /users\nPOST /users'")
cli.execute("write /docs/api/auth.md '# Auth API\nPOST /auth/login'")

# An agent explores just like a developer would
cli.execute("tree /docs")              # See the structure
cli.execute("grep -rn 'POST' /docs")   # Search for patterns
cli.execute("view /docs/api/users.md 1 5")  # Read specific lines

Bulk Loading

The most common pattern — load from a dictionary:

from agent_clifs import AgentCLI, VirtualFileSystem

vfs = VirtualFileSystem()
vfs.load_from_dict({
    "/src/app.py": "from flask import Flask\napp = Flask(__name__)",
    "/src/models.py": "class User:\n    ...",
    "/docs/setup.md": "# Setup\nRun `pip install -r requirements.txt`",
})

cli = AgentCLI(vfs)
cli.execute("find /src -name '*.py'")

Use with Any Agent Framework

Just pass cli.execute as a tool function:

from langchain.tools import Tool

tool = Tool(
    name="filesystem",
    description="Execute filesystem commands: ls, cat, grep, find, tree, view, head, tail, wc",
    func=cli.execute,
)

Works the same way with LlamaIndex, CrewAI, or any framework that accepts a callable.

LLM-Optimized Mode

Pass structured=True for token-efficient output — no box-drawing characters, type-annotated entries, results grouped by file:

cli = AgentCLI(structured=True)
# grep (standard)                   # grep (structured)
/docs/api/auth.md:3:POST /api/auth   [/docs/api/auth.md]
/docs/api/users.md:3:POST /api/users   L3: POST /api/auth
                                     [/docs/api/users.md]
                                       L3: POST /api/users

Commands

Command Description Key Flags
ls List directory -l -h -R -S -a -d -1
grep Search contents -r -i -n -l -c -v -w -F -A/-B/-C --include --exclude
find Find files -name -iname -type -path -maxdepth -mindepth
view Read with line range view <file> [start] [end]
cat Display files -n -s
tree Directory tree -L -d -a
head/tail First/last lines -n -c
wc Count lines/words -l -w -c
mkdir Create directory -p -v
cp Copy -r -a -n -v
mv Move/rename -n -v
rm Remove -r -f -v
write Write to file write <path> <content>
append Append to file append <path> <content>
touch Create empty file -c
pwd/cd Navigate cd - cd ~

Python API

from agent_clifs import VirtualFileSystem

vfs = VirtualFileSystem()
vfs.load_from_dict({"/file.txt": "hello"})  # bulk load
content = vfs.read_file("/file.txt")         # read
vfs.write_file("/new.txt", "world")          # write
snapshot = vfs.to_dict()                     # export {path: content}

Setup for PyPI Publishing

This project uses GitHub Actions with trusted publishing. See .github/workflows/release.yml.

License

Unlicense — public domain.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_clifs-1.1.0.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_clifs-1.1.0-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file agent_clifs-1.1.0.tar.gz.

File metadata

  • Download URL: agent_clifs-1.1.0.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for agent_clifs-1.1.0.tar.gz
Algorithm Hash digest
SHA256 998ea49f43e35d37230fa95d70647f8e07db4782ec62289d7819e4d2c4e60192
MD5 00164d4df689eddc1b3f36e3c6523a21
BLAKE2b-256 29804bbc55bbe274b1e037671ed9e0aec57cceec8b4c55d813c3dbcacdeb03db

See more details on using hashes here.

File details

Details for the file agent_clifs-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: agent_clifs-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for agent_clifs-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f87fdfa3749382758956ffc0317391dd958b2367304640663511596f171f755
MD5 83c68704c7b19a5bbfcc8c59cb04111b
BLAKE2b-256 cc8f7ac0150eb6b06454cc36563cc97eed86d4694c387ffef2f4044dbeebc45e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page