agentleFS
VercelKnown publishervercel-labs/bash-tool/CLAUDE.md

bash-tool

CLAUDE.md626 starsChanged 11 months agoMITView on GitHub

This file provides guidance for Claude Code when working on this project. bash-tool is a generic bash tool for AI agents, compatible with AI SDK (https://ai-sdk.dev/). It provides bash, readFile, and writeFile tools that work with a sandboxed environment. Tests are co-located with source files (*.test.ts). Tests are included in TypeScript compilation for type checking. AI SDK tool execute calls require ToolExecutionOptions with toolCallId and messages.

  • In this repository2 other files it gives its agents.

The file

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

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Destination directory: All files go to destination (default: /workspace).

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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
CLAUDE.md

CLAUDE.md

This file provides guidance for Claude Code when working on this project.

Project Overview

bash-tool is a generic bash tool for AI agents, compatible with AI SDK (https://ai-sdk.dev/). It provides bash, readFile, and writeFile tools that work with a sandboxed environment.

Commands

pnpm build          # Compile TypeScript to dist/
pnpm typecheck      # Type check without emitting
pnpm test           # Run tests in watch mode
pnpm test:run       # Run tests once
pnpm lint           # Check with Biome
pnpm lint:fix       # Fix lint issues
pnpm knip           # Check for unused exports/dependencies
pnpm validate       # Run all checks (lint, knip, typecheck, test)

Architecture

Entry Point

  • src/index.ts - Public exports only (createBashTool and types)
  • src/tool.ts - Main createBashTool() function that orchestrates everything

Core Interfaces (src/types.ts)

  • Sandbox - Abstract interface for sandbox implementations (executeCommand, readFile, writeFile, stop)
  • CreateBashToolOptions - Configuration for createBashTool
  • BashToolkit - Return type with tools and sandbox instance

Sandbox Adapters (src/sandbox/)

  • just-bash.ts - Default adapter using just-bash (optional peer dependency)
  • vercel.ts - Adapter wrapping @vercel/sandbox instances

Tools (src/tools/)

  • bash.ts - Execute bash commands with contextual LLM instructions
  • read-file.ts - Read file contents
  • write-file.ts - Write files

File Loading (src/files/)

  • loader.ts - Loads files from inline content or disk directories

Key Design Decisions

  1. Optional peer dependencies: just-bash and @vercel/sandbox are optional. Dynamic imports with helpful error messages when not installed.
  2. Destination directory: All files go to destination (default: /workspace). This is also the working directory for commands.
  3. Contextual instructions: The bash tool generates LLM instructions that include the working directory and list of available files.
  4. Sandbox auto-detection: The sandbox parameter auto-detects both @vercel/sandbox instances (checks for shells and kill) and just-bash Bash instances (checks for exec method). Users can also provide a custom Sandbox implementation.

Testing

Tests are co-located with source files (*.test.ts). Tests are included in TypeScript compilation for type checking.

  • Unit tests mock just-bash
  • Integration tests (tool.integration.test.ts) use real just-bash

AI SDK tool execute calls require ToolExecutionOptions with toolCallId and messages.

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.