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.0.0.tar.gz (27.9 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.0.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_clifs-1.0.0.tar.gz
  • Upload date:
  • Size: 27.9 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.0.0.tar.gz
Algorithm Hash digest
SHA256 3bcc1cc7a0024f119403175d9e0e63ba4eabdd8f7004856dbae867b5f555f54c
MD5 703a12c2362f8cb9f4af8b82d7d47854
BLAKE2b-256 4edc76e6f3ecc45ce84be7eecbbd6b0856074a46e6b7af4b4926915afd9f83e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agent_clifs-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.6 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8954340861ef2123d843b26e44250ac96ffcb9cffbf1eadf0895ef2404bcff7b
MD5 3cc2ac34209e287bda4cf1b1c9b7c203
BLAKE2b-256 d235d8f96a163938ff4412d4ff8f7e3ff7482cc580190c78a4f973feabd13a14

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