Skip to content

Code & Files

File operations are the most frequently used tools in Gee-Code. The AI reads your code, makes targeted edits, creates new files, and searches across your entire project — all with dedicated tools optimized for each operation.

Reads any file on your filesystem. Supports text files, images (PNG, JPG), PDFs, and Jupyter notebooks.

Read(file_path="/path/to/file.py")
Read(file_path="/path/to/file.py", offset=50, limit=100) # Lines 50-150
  • Line numbers are included in output (cat -n format)
  • Long lines are truncated at 2000 characters
  • Images are displayed visually (Gee-Code is multimodal)
  • PDFs support page ranges for large documents

Creates a new file or completely replaces an existing one.

Write(file_path="/path/to/new-file.py", content="...")

Use Write for new files only. For modifications to existing files, always use Edit — it’s 97% more efficient because it only transmits the changed portion.

Makes targeted text replacements in existing files. This is the primary tool for modifying code.

Edit(file_path="/path/to/file.py", old_string="def old_func():", new_string="def new_func():")
  • Finds the exact old_string in the file and replaces it with new_string
  • Fails if old_string isn’t unique — provide more surrounding context to disambiguate
  • Use replace_all=true to replace every occurrence (useful for renaming)

Batch multiple edits into a single atomic operation.

MultiEdit(file_path="/path/to/file.py", edits=[
{"old_string": "import os", "new_string": "import os\nimport sys"},
{"old_string": "def main():", "new_string": "def main(args):"}
])

More efficient than multiple individual Edit calls when changing several parts of the same file.

Line-based operations for when you know the exact line numbers:

InsertLines(file_path="file.py", line_number=10, content="# New comment")
ReplaceLines(file_path="file.py", start_line=5, end_line=8, content="# Replaced")

Find files by name pattern. Fast pattern matching that works on any codebase size.

Glob(pattern="**/*.py") # All Python files
Glob(pattern="src/**/*.tsx") # React components
Glob(pattern="**/test_*.py", path="/src") # Test files in src

Results are sorted by modification time — most recently changed files first.

Search file contents with regular expressions. Built on ripgrep for speed.

Grep(pattern="def authenticate") # Find function definition
Grep(pattern="TODO|FIXME", glob="*.py") # Find todos in Python files
Grep(pattern="class.*Error", output_mode="content", context=3) # Show context

Output modes:

  • files_with_matches (default) — just file paths
  • content — matching lines with context
  • count — match counts per file

After writes and edits, Gee-Code can automatically validate the changed file — checking for syntax errors, lint issues, and type errors. Validation results appear inline so the AI can fix issues immediately.

Supported validators include ESLint, Prettier, Ruff, MyPy, and more. See Validation for setup details.

  1. Edit over Write — always prefer Edit for existing files. It’s faster, cheaper, and less error-prone.
  2. Glob before Grep — find the right files first, then search their contents.
  3. Use context in Grep — add -A, -B, or -C flags to see surrounding code.
  4. Multiline Grep — use multiline=true for patterns that span multiple lines (class definitions, function signatures).