edr

command module
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 4 Imported by: 0

README

edr — code editing tools for agents

edr gives coding agents code-aware file tools that front-load the context needed for the next step.

Instead of raw files and grep output, edr returns structured code context:

  • focus file:Symbol — reads a symbol, not the whole file. Includes relevant surrounding context.
  • focus SymbolName — resolves likely matches and opens the best candidate.
  • edit --old X --new Y --verify — diff, updated context, and verification feedback.
  • orient — budgeted structural overview of the codebase in terms of symbols and files.
  • edr --focus file:Sym --edit ... — inspect and mutate in one call when needed.
  • Repeated reads are deduplicated so agents do less work.

Fully local, shell-friendly, no telemetry. Designed to replace generic file operations with agent-oriented ones.

Install

brew install jordw/tap/edr
edr setup

edr setup installs agent instructions to your global config (~/.claude/CLAUDE.md, ~/.cursor/rules/edr.mdc, or ~/.codex/AGENTS.md). Instructions auto-update when edr is rebuilt. They teach the agent to use edr instead of built-in file tools. Session data is stored in ~/.edr/repos/, not in the project directory.

Other install methods

Pre-built binary (review the script first):

curl -fsSL https://raw.githubusercontent.com/jordw/edr/main/install.sh | sh

From source (requires Go 1.24+):

go install github.com/jordw/edr@latest
edr setup

Cloud agents and CI (installs Go if needed, builds):

git clone https://github.com/jordw/edr.git && ./edr/setup.sh

Example

Focus on a function, orient in the project, edit it:

# Without edr: grep to find it, read the range, grep for callers, read each caller
# 5+ tool calls, ~25KB of context

# With edr: 3 calls, ~3KB
edr focus src/scheduler.py:run             # just the function (not the file)
edr orient --dir src/                      # structural overview
edr edit src/scheduler.py \
    --old "def run(self):" \
    --new "def run(self, retries=3):" --verify

Batched: gather everything in one call, mutate in one call:

# 1. Focus on three APIs + orient, one call
edr -f src/scheduler.py:Scheduler --sig \
    -f src/config.py:parse_config \
    -f src/worker.py:Worker --sig \
    -o --dir src/

# 2. Edit two files, verify at the end
edr -e src/scheduler.py --old "def run(self):" --new "def run(self, retries=3):" \
    -e src/config.py --old '"timeout": 30' --new '"timeout": 30, "retries": 3'

How it works

edr uses pure-Go regex-based symbol extraction to give agents capabilities they don't have with raw file tools:

Symbol-level reads and edits. Focus on one function instead of a 400-line file. Get a class API with --signatures. Scope edits to a symbol with --in Symbol. Use --verify for build feedback after edits. The agent sees what it needs and makes better decisions.

Structural navigation. orient shows what's in a directory or project in terms of symbols and files, not raw listings. focus SymbolName resolves ambiguous names with ranked matching. Budget controls keep output sized for agent context windows.

Sessions. edr tracks what the agent has already seen and returns only what changed. Repeated reads produce zero output. Zero config.

Search and indexing. edr index builds a trigram + symbol index that accelerates search, orient, and symbol resolution. On the Linux kernel (93K files), indexed operations complete in 0.02-0.5s. edr bench measures real performance on your repo.

Commands

Primary commands
Command Description
orient [path] Structural overview of a directory or project (replaces map)
focus file[:Symbol] Read file or symbol with context (replaces read)
edit file Edit, write, create files. --verify to check build.
status Repo root, index coverage, undo, build state, warnings
undo Revert last edit/write (auto-checkpointed)
files "pattern" Find files containing text (trigram-accelerated)
index Build or inspect the search index
bench Benchmark operations on current repo
setup Install agent instructions

Old command names map and read still work as aliases for orient and focus.

Batch flags

Chain operations with --focus, --orient, --search, --edit, --write (short: -f -o -s -e -w). File carries forward. Edit includes read-back automatically.

edr --focus file:Sym --sig --orient cmd/
edr --focus file:Func --edit --old "x" --new "y"
edr --search "TODO" --include "*.go"
edr --focus file:Func --expand callers
Cross-repo targeting
edr focus file:Symbol --root /path/to/repo
export EDR_ROOT=/path/to/repo    # set once, all commands use it
Batch modifiers

Focus (after -f): --sig, --skeleton, --full, --expand[=deps], --symbols, --lines 10:50, --budget N

Orient (after -o): --dir, --lang, --grep, --glob, --type, --budget N

Edit (after -e): --old "x" --new "y", --where Sym (resolves file), --in Sym (scope), --content "...", --inside Class, --after Sym, --append, --mkdir, --all, --delete, --dry-run, --fuzzy, --read-back, --no-verify, @file for metacharacters

Output uses plain mode: one JSON header line followed by raw-text body.

Languages

edr reads and edits any text file. Symbol-aware features (symbol reads, --signatures, map) require a supported language:

Symbol parsing: Go, Python, JavaScript/JSX, TypeScript/TSX, Rust, Java, C, C++, Ruby

Limitations

  • Structural navigation, not code analysis. edr finds functions and classes by pattern, not by parsing or type-checking. This means it works instantly, on broken code, with zero config — but it does not have type information. It may miss unusual syntax (e.g. deeply nested anonymous functions).
  • macOS and Linux only. Windows is not planned.
  • Pure Go. No CGO, no C compiler needed. Single ~6MB binary.

How it compares

Without edr, agents grep to find code, read line ranges, guess what's relevant, edit, then re-read to check. Each step is a separate tool call with context the agent has to filter.

With edr, focus file:Symbol returns the function body with relevant context. edit returns the diff and updated code with optional build verification. The agent makes fewer decisions about what to read because edr front-loads useful context.

Operation What the agent gets
focus file:Symbol Symbol body + relevant surrounding context
focus SymbolName Ranked resolution, auto-opens best match
edit --old X --new Y --verify Diff + updated context + verification feedback
orient Budgeted structural overview (symbols and files)
Re-read unchanged file Deduplicated (zero output, zero waste)

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
bench
cmd/benchjson command
benchjson runs Go benchmarks and outputs results as JSON.
benchjson runs Go benchmarks and outputs results as JSON.
internal
cmdspec
Package cmdspec is the single source of truth for edr command metadata.
Package cmdspec is the single source of truth for edr command metadata.
idx
Package idx implements a trigram index for fast text search pre-filtering.
Package idx implements a trigram index for fast text search pre-filtering.
index
Outline produces depth-limited views of source files and symbols.
Outline produces depth-limited views of source files and symbols.
session
Package session provides context-aware response optimization for edr.
Package session provides context-aware response optimization for edr.
setup
Package setup implements the `edr setup` command: index a repo and inject agent instructions into global config files.
Package setup implements the `edr setup` command: index a repo and inject agent instructions into global config files.
warnings
Package warnings detects when the agent's view of the world is stale.
Package warnings detects when the agent's view of the world is stale.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL