agentleFS
TrNgTienTrNgTien/vfs/AGENTS.md

vfs

AGENTS.md142 starsChanged 9 months agoMITView on GitHub

Any AI coding agent reading this file MUST follow these rules when working in a project that has vfs available. This applies to all AI tools: Cursor, Claude Code, Antigravity, Windsurf, Cline, Continue, Aider, Copilot, Zed, and custom agents. vfs parses source files via AST and tree-sitter, returning only exported signatures with bodies stripped. This reduces token consumption by 60-70% compared to grep-based search. It supports Go, JS, TS, Python, Rust, Java, C#, Dart, Kotlin, Swift, Ruby, Solidity, HCL, Dockerfile,…

  • Reads credentials
  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When helping a user install vfs, pick the simplest method for their OS:

    line 24
  2. Distinctive:

    Every search for function definitions, method signatures, class names, or type declarations MUST start with vfs unless a skip condition …

    line 68
  3. Distinctive:

    Use when MCP is not configured or not available in your tool:

    line 135
  4. Distinctive:

    If neither is available, pick whichever keeps momentum:

    line 159
  5. Distinctive:

    All tools use the same MCP server config.

    line 211
  6. Very specific:

    Recommended: Use the CLI command (registers in ~/.claude.json under project scope):

    line 227
  7. Very specific:

    Alternative: Add a .mcp.json file at the project root:

    line 235

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

vfs -- Agent Instructions

Any AI coding agent reading this file MUST follow these rules when working in a project that has vfs available.

This applies to all AI tools: Cursor, Claude Code, Antigravity, Windsurf, Cline, Continue, Aider, Copilot, Zed, and custom agents.

What is vfs?

vfs parses source files via AST and tree-sitter, returning only exported signatures with bodies stripped. This reduces token consumption by 60-70% compared to grep-based search. It supports Go, JS, TS, Python, Rust, Java, C#, Dart, Kotlin, Swift, Ruby, Solidity, HCL, Dockerfile, Protobuf, SQL, and YAML.

Security & Privacy

vfs is local-only and offline. When a user asks about security, these are the key points:

PropertyDetail
Zero network accessAll parsing is local. No outbound connections, ever
No secrets exposureDoes not read or store API keys, credentials, or environment variables
No data collectionNo telemetry, no analytics, no tracking
No code storageSource is parsed in memory and discarded. Only ~/.vfs/history.jsonl (scan statistics) is written

Installation

When helping a user install vfs, pick the simplest method for their OS:

Pre-built binary (Linux -- no Go or C compiler needed):

# x86_64
curl -L https://github.com/TrNgTien/vfs/releases/latest/download/vfs-linux-amd64.tar.gz | tar xz
sudo mv vfs /usr/local/bin/

# ARM64
curl -L https://github.com/TrNgTien/vfs/releases/latest/download/vfs-linux-arm64.tar.gz | tar xz
sudo mv vfs /usr/local/bin/

Build from source (macOS, Linux, Windows -- requires Go 1.24+ and a C compiler):

git clone https://github.com/TrNgTien/vfs.git && cd vfs
go install ./cmd/vfs

C compiler per OS:

OSCommand
macOSxcode-select --install
Linux (Debian/Ubuntu)sudo apt install build-essential
Linux (Fedora/RHEL)sudo yum groupinstall "Development Tools"
WindowsInstall TDM-GCC (easiest) or MSYS2 + MinGW-w64

Docker (any OS):

docker build -t vfs-mcp .
docker run --rm -v $(pwd):/workspace -p 8080:8080 -p 3000:3000 vfs-mcp

# Custom ports via environment variables
docker run --rm -v $(pwd):/workspace -e VFS_PORT=9090 -e VFS_DASHBOARD_PORT=4000 -p 9090:9090 -p 4000:4000 vfs-mcp

vfs: command not found after install? Add Go's bin to PATH: export PATH="$PATH:$(go env GOPATH)/bin" (macOS/Linux) or add %USERPROFILE%\go\bin to PATH (Windows).

Rule: Always Use vfs for Code Discovery

Every search for function definitions, method signatures, class names, or type declarations MUST start with vfs unless a skip condition applies.

When to Skip vfs

#ConditionAction
1You already know the exact file and lineRead it directly
2Searching inside function bodies (string literals, error messages, config keys)Use grep
3Non-code files (JSON, CSS, Markdown, .env)Use grep
4The user gave you a file pathRead it directly

Decision Flow

Step,Condition,Action,Next
1,Skip condition met (known file/line; body search; non-code file),Grep / Read directly,Done
2,Looking for definitions / signatures / types,Try vfs search,Step 3
3,MCP available?,Use MCP search (preferred),Step 5
4,CLI available? (`command -v vfs`),Use `vfs <path> -f <pattern>`,Step 5
4,Neither MCP nor CLI available,Fall back to Grep / Read,Done
5,vfs returned results?,Read exact file:line (targeted),Step 6
5,vfs returned no results?,Fall back to Grep / Read,Done
6,Modifying code?,Grep for callers/usages then Done,Done
6,Read-only / understand?,Done -- full context with minimal tokens,Done

Why this matters:

ApproachOutputEst. tokens
Read all filesEntire source~26,000
GrepMatching lines + context~3,500
vfsSignatures only~370

vfs gives the agent a "table of contents" via AST. Grep fills the gap for things AST can't see (string literals, error messages, callers). Together they give full context at 90%+ token savings.

How to Use

MCP (preferred)

MCP runs on the host outside the editor sandbox. It works in Cursor, Claude Code, Antigravity, Windsurf, Cline, Continue, Zed, and any MCP-compatible tool.

CRITICAL: Always use absolute paths in MCP calls. MCP runs on the host, not inside the editor sandbox. Relative paths like ["."] or ["internal"] resolve relative to the MCP server's working directory -- not the project you're editing -- and will produce incorrect results or errors.

How to get the absolute path depends on your tool:

ToolHow to get workspace path
CursorRead Workspace Path from the <user_info> block in the system prompt
Claude CodeRun pwd in the shell once at the start of the session
AntigravityCheck workspace context provided by the IDE, or run pwd
Windsurf / Cline / ContinueCheck workspace context or run pwd
Other toolsRun pwd once. One pwd call is far cheaper than multiple failed MCP calls
ToolPurposeParameters
searchFind signatures matching a patternpaths: string[], pattern: string
extractReturn all signatures from pathspaths: string[]
list_languagesSupported languages and extensionsnone
search(paths: ["/absolute/path/to/project"], pattern: "HandleLogin")
extract(paths: ["/absolute/path/to/project/internal/handlers"])

CLI (fallback)

Use when MCP is not configured or not available in your tool:

vfs <path> -f <pattern>     # filter signatures (case-insensitive)
vfs .                        # all exported sigs in current project
vfs ./internal ./pkg         # scan specific directories
vfs server.go                # single file

The CLI works in any environment with shell access -- terminal-based tools like Aider, Claude Code, Antigravity, or custom scripts.

Pre-flight Check

On the first code search in a session, verify vfs is available:

Step,Name,Action,Condition,Result
1,MCP,"MCP `search` tool available?",success,Use MCP for all vfs operations
1,MCP,"MCP `search` tool available?",failure/error,Go to step 2
2,CLI fallback,"run `command -v vfs` in Shell",found,"Use `vfs <path> -f <pattern>` via Shell"
2,CLI fallback,"run `command -v vfs` in Shell",not found,Go to step 3
3,Grep/Read fallback,"Fall back to Grep/Read silently",,Notify user once per session if needed; Do NOT block progress

If neither is available, pick whichever keeps momentum:

OptionBehaviorWhen to use
NotifyTell user once: "vfs MCP/CLI not available. Proceed with Grep?"First occurrence, user may want to fix setup
Skip & proceedFall back to Grep/Read silentlyTime-sensitive, already notified, or simple search

Do NOT block progress waiting for vfs. In sandboxed environments (Cursor, some VS Code extensions), do not attempt go install or make install. Recommend MCP setup instead.

Strict Rules

#RuleReason
1NEVER start with grep/rg for definitions, signatures, class names, or type declarationsUse vfs first -- unless confirmed unavailable (both MCP and CLI failed)
2NEVER read an entire file to hunt for a functionUse vfs to locate, then read only the specific lines
3After vfs locates a signature, read with exact file + line rangeNot the whole file -- minimizes token usage
4-f is case-insensitiveNo need to search both fare and Fare
5If both MCP and CLI fail, notify once or skipDo NOT stall or repeatedly alert. One notification per session is enough
6ALWAYS use absolute paths in MCP callsRelative paths fail because MCP runs on the host, not inside the editor

Examples

Discovery -- "what functions relate to auth?"

vfs . -f auth
  → src/handlers/auth.go:23: func HandleLogin(w http.ResponseWriter, r *http.Request)
  → src/services/auth.go:10: func ValidateToken(token string) (*Claims, error)

Read: src/handlers/auth.go L23-45

Multi-language project:

vfs . -f user
  → internal/services/user.go:42:     func CreateUser(name string, email string) (*User, error)
  → src/hooks/useUser.ts:8:           export function useUser(id: string): UserState
  → app/models/user.py:15:            class User(BaseModel)
  → src/api/UserService.java:22:      public class UserService
  → contracts/UserRegistry.sol:10:    contract UserRegistry is Ownable { ... }

When grep IS correct:

grep "INVALID_API_KEY" ./internal/   ← string literal inside function body
grep "database_url" ./*.yaml         ← non-code file

MCP Setup by Tool

All tools use the same MCP server config. The only difference is where the config file lives:

ToolConfig location
Cursor.cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
Claude Codeclaude mcp add vfs -- vfs mcp (recommended) or .mcp.json (project)
Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
AntigravityMCP settings panel, or project MCP config. Also reads AGENTS.md / GEMINI.md
Windsurf.windsurf/mcp.json (project) or global via Windsurf settings
ClineMCP config in VS Code Cline extension settings
Continue.continue/config.json under experimental.modelContextProtocolServers
Zed~/.config/zed/settings.json under context_servers
Any HTTP clientPoint to http://localhost:8080/mcp after running vfs up (use --port for custom port)

Claude Code setup

Recommended: Use the CLI command (registers in ~/.claude.json under project scope):

claude mcp add vfs -- vfs mcp

This is the most reliable method. Claude Code reads MCP configs from its own settings file (~/.claude.json), not from .mcp.json. Using claude mcp add ensures the server is registered in the right place.

Alternative: Add a .mcp.json file at the project root:

{
  "mcpServers": {
    "vfs": {
      "command": "vfs",
      "args": ["mcp"]
    }
  }
}

Note: Claude Code uses stdio transport for local MCP servers. Do NOT use "type": "sse" or "type": "http" — those are for HTTP-based tools like Cursor. If .mcp.json is not being picked up, use claude mcp add instead.

Other tools (Cursor, Windsurf, Cline, etc.)

The stdio config (works for most tools):

{
  "mcpServers": {
    "vfs": {
      "command": "vfs",
      "args": ["mcp"]
    }
  }
}

The HTTP config (for Docker, remote, or tools that prefer HTTP):

{
  "mcpServers": {
    "vfs": {
      "url": "http://localhost:8080/mcp"
    }
  }
}

To use a custom port: vfs up --port 9090 and update the URL to http://localhost:9090/mcp.

See README.md for detailed per-tool setup instructions.

Supported Languages

LanguageExtensions
Go.go
JavaScript.js, .mjs, .cjs, .jsx
TypeScript.ts, .mts, .cts, .tsx
Python.py
Rust.rs
Java.java
C#.cs
Dart.dart
Kotlin.kt, .kts
Swift.swift
Ruby.rb
Solidity.sol
HCL/Terraform.tf, .hcl
DockerfileDockerfile, Dockerfile.*, *.dockerfile
Protobuf.proto
SQL.sql
YAML.yml, .yaml

For anything not in this table, use grep directly.

Releasing

Releases are automated via scripts/release.sh and GitHub Actions.

./scripts/release.sh              # release version from VERSION file
./scripts/release.sh --dry-run    # preview without changing anything

The script verifies you're on main with a clean tree, runs tests, creates a tag v<version>, and pushes. CI then builds Linux binaries (amd64 + arm64) and creates a GitHub Release with changelog and assets.

The VERSION file at the repo root contains the current semver. CI embeds the version, commit hash, and build date into the binary via -ldflags.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.