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.1.tar.gz (38.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.1-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_clifs-1.1.1.tar.gz
  • Upload date:
  • Size: 38.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.1.tar.gz
Algorithm Hash digest
SHA256 72d171b2413f62d2a29e06b47c7686ed3b9e1a2495a8d9b54954f811fe25698f
MD5 a266b345732a5b0a06a56557687f2533
BLAKE2b-256 72afc8db31ffbe29286b42e3dffbcd51a5a54880f6bdb81cf7e7e20d70e0cb84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agent_clifs-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4adca3c8f8c2d54cde6db5824a1036bb036ca2ee1d68a2854073a16d99de7e54
MD5 765a4b41002aad7f5e186ae8b397cfa3
BLAKE2b-256 b80fc51e794efcf0747a363e7abf043e93b9cee15a1ea0c97496cd5ab4b83172

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