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.2.tar.gz (39.0 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.2-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_clifs-1.1.2.tar.gz
  • Upload date:
  • Size: 39.0 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.2.tar.gz
Algorithm Hash digest
SHA256 464b74b6666897df52b093c26345e436c7f3eb0786c0bcef6119af18a9c099b6
MD5 0106a12e023544e67d01ec7e85ea5d6f
BLAKE2b-256 3e2d168d3fd52231c6826f5c6a853a3a861f4a83f5fc1936afaaf683a046d29d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agent_clifs-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 29.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d0554e5609993c32b776d405c6d1b8b13e2165d9ad4e933e1c6dc2e34f2c64a4
MD5 29e2e114edadeac08e99092fd0027c04
BLAKE2b-256 e6f8f025a18b989a7562a0c38b738eb7adceb3561497b1f301314addd7d67ba4

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