{"slug": "explorerepo-tool-for-agents-to-read-remote-git-repositories-without-cloning", "title": "Explorerepo: Tool for agents to read remote Git repositories without cloning", "summary": "A new Go binary called explorerepo lets AI agents read and search remote Git repositories over Git protocol v2 without cloning them or using the GitHub API, fetching only the trees and blobs a command touches via filtered fetch (tree:0, blob:none). In a benchmark using opencode and DeepSeek V4.1 Flash across 15 questions about repositories including ripgrep, the Linux kernel, Android, Chromium and Kubernetes with three runs each in a fresh container, agents with explorerepo installed made 52–57% fewer tool calls, used 53–63% fewer uncached input tokens and answered 45–66% faster, with every answer correct either way. On torvalds/linux with git 2.56.0, explorerepo took 1.7 s for 24 matches from a single git grep sched_tick versus 23 s for a blobless clone that left a 4 MB .git directory, while a depth-1 clone of the same repository downloads 291 MB in 33.7 s.", "body_md": "explorerepo lets an AI agent read or search a remote git repository without cloning it and without\nthe GitHub API. It speaks **Git protocol v2** over SSH or anonymous HTTPS and uses **filtered fetch**\n(`tree:0`, `blob:none`), the same server-side filtering as `git clone --filter`, so the server sends\nonly the commit, trees and blobs a command touches. Requests go to the repository's own\n`git-upload-pack`, which GitHub and gists, GitLab, Bitbucket, Codeberg and googlesource.com serve.\n\nInstall one Go binary and add a line to your global `AGENTS.md` or `CLAUDE.md`, and an agent that\nneeds a single file stops cloning the whole repo. It runs `ls`, `cat`, `head`, `tail`, `sed`,\n`grep`, `rg`, `find` and more against the remote tree, over SSH or plain HTTPS.\n\n```\ngo install github.com/autowert66/explorerepo/cmd/explorerepo@latest\n```\n\nAdd this line to `AGENTS.md` or `CLAUDE.md`:\n\n```\nTo read or search the source of any remote git repo (a library, a dependency, a tool you are asked about), run `explorerepo --repo ORG/REPO -c '<script>'` in your shell (it is a CLI, not an MCP tool) instead of cloning, fetching raw GitHub URLs, `gh api`, or answering from memory; it is a read-only shell over the default branch (ls, tree, cat, head, sed -n, grep -A/-B/-C, rg, find, wc, sort, pipes, loops; no awk). Each call costs a network round trip, so aim for 2-3 calls: (1) orient and locate in one script, e.g. `-c 'tree -L 2 -d; echo \"## hits\"; grep -rn -m 30 \"KEYWORD\" src --include=\"*.rs\"'`; (2) read every relevant range at once, e.g. `-c 'sed -n \"40,120p\" src/a.rs; echo \"## b.rs\"; grep -n -A 25 \"fn name\" src/b.rs'`; then answer. Prefer `grep -n -A N` and `sed -n` ranges over `cat` of whole files. `--repo` also takes gitlab.com/GROUP/REPO, gist:ID, any git URL, and `--rev TAG`; `explorerepo help` lists everything.\n```\n\n`explorerepo help agents` prints the same line, so `explorerepo help agents >> ~/.claude/CLAUDE.md` works too.\n\nA benchmark with opencode and DeepSeek V4.1 Flash covers 15 questions about real repositories, from\nripgrep to the Linux kernel, Android, Chromium and Kubernetes, three runs each in a fresh container.\nWith explorerepo installed, agents made **52–57% fewer tool calls**, used **53–63% fewer uncached\ninput tokens** and answered **45–66% faster**, and every answer was correct either way: Kubernetes's\ndefault eviction thresholds took 3.3 tool calls instead of 13.7. One model and one agent harness;\n[`docs/BENCHMARK.md`](https://github.com/autowert66/explorerepo/blob/main/docs/BENCHMARK.md) has the tables and limits, and `bench/` reruns it.\n\nThen agents work in place:\n\n```\nexplorerepo --repo octocat/Hello-World -c 'ls -la; head -20 README'\nexplorerepo --repo github.com/torvalds/linux --rev v6.11 -c 'grep -rn \"sched_tick\" kernel/sched | head'\nexplorerepo --repo torvalds/linux ls kernel\nexplorerepo --repo torvalds/linux pull drivers/gpu/drm/i915 ./i915\n```\n\n`git clone --depth 1` downloads every file at the tip: 291 MB and 33.7 s for torvalds/linux (see the demo\nabove), for an agent that wanted one file.\n\n`git clone --filter=blob:none --no-checkout --depth 1` is the closest alternative, and it works: `git grep`\nfetches the missing blobs on demand. On torvalds/linux with git 2.56.0, one run each, the clone plus one\n`git grep sched_tick` took 23 s and left a 4 MB `.git` directory; explorerepo took 1.7 s for the same 24\nmatches. The blobless clone fetches the tree of every directory up front, leaves a repository to delete\nafterwards, and requires the agent to know the flags. explorerepo fetches only the trees and blobs a command\nreads and caches them between calls.\n\n`raw.githubusercontent.com` and the GitHub REST API return one file or one directory listing per request, and\nneither can grep. GitHub limits unauthenticated REST requests to 60 per hour per IP address\n([GitHub docs](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api)). Both are\nGitHub-only. In the small-repository set of the [benchmark](https://github.com/autowert66/explorerepo/blob/main/docs/BENCHMARK.md), 89 of the 196 tool calls in the runs\nwithout explorerepo were raw file downloads. `git archive --remote` is rejected by GitHub over both HTTPS and ssh.\n\nHosted MCP servers expose a fixed set of tools. GitMCP's README lists four: fetch documentation, search\ndocumentation, search code (through GitHub's code search), and fetch a URL. DeepWiki's MCP server returns\npages of a generated wiki and answers questions about them (`read_wiki_structure`, `read_wiki_contents`,\n`ask_question`). Neither lists a tool for reading a line range of a file or listing a directory, and both\nneed an MCP entry in the agent's configuration. explorerepo is a command the agent runs in its shell.\n\ngitingest turns a repository into one text digest (summary, tree, contents) to paste into a prompt.\nSourcegraph's `src` is a client for a Sourcegraph instance and searches what that instance has indexed.\nexplorerepo returns only what the script asks for, from any repository you can reach, at any `--rev`.\n\n- To install: Go 1.21 or newer. If your toolchain is older than the version in `go.mod` ,`go install` downloads it automatically.\n- To reach a remote host: the system `ssh` with a key that can reach the host, or nothing at all\nfor a public repository; explorerepo falls back to anonymous HTTPS when ssh is unavailable.\n- For local repositories and the test suite: `git` .\n\nThe protocol probes recorded in `docs/PROBES.md` were run against GitHub and local git 2.56.0.\n\n`go install` writes the binary to `$GOBIN` (default `$(go env GOPATH)/bin`). If `explorerepo` is not\nfound afterwards, add that directory to your `PATH`. To uninstall, delete the file. From a checkout,\n`make build` writes it to `bin/explorerepo` instead.\n\n```\nexplorerepo --repo octocat/Hello-World -c 'ls -la; head -5 README'\n```\n\nOn success you get the repository listing and the file contents:\n\n```\ndrwxr-xr-x - .\ndrwxr-xr-x - ..\n-rw-r--r-- ? README\nHello World!\n```\n\n`ls -l` prints `?` for the size of a blob that has not been fetched yet; the size appears after the\nfile has been read once.\n\n```\nexplorerepo --repo SPEC [--rev REV] [options] -c 'SCRIPT'\nexplorerepo --repo SPEC [--rev REV] [options] CMD [ARGS...]     # single builtin, no shell parsing\nexplorerepo --repo SPEC [--rev REV] [options] < script.sh\nexplorerepo help [CMD | flags | repos | agents | about]\nexplorerepo --help [TOPIC]                                     # same as `help`, brief without a topic\nexplorerepo --version\n\noptions: --rev (alias --hash)  --refresh  --no-cache  --no-mux  --https  --no-https  --check\n         --max-output BYTES (200K)  --max-fetch BYTES (256M)  --max-files N (20000)  --timeout DUR (60s)\n         --color auto|always|never (auto)\nenv:     EXPLOREREPO_REPO (default --repo)  EXPLOREREPO_CACHE  EXPLOREREPO_DEBUG=1  EXPLOREREPO_QUIET  NO_COLOR\n```\n\nAt a terminal, output is colored; pipes, redirects and known agent harnesses get plain text.\n`--color`, `NO_COLOR`, `FORCE_COLOR` and `CLICOLOR_FORCE` override that (`explorerepo help flags`\nhas the details).\n\n`SPEC` accepts `owner/repo` (GitHub), `github.com/owner/repo`, `gitlab.com/group/sub/repo`,\na gist (`gist:<id>`, `gist.github.com/<id>`, or a pasted `https://gist.github.com/<user>/<id>`\nURL), `https://host/owner/repo`, `git@host:path.git`, `ssh://user@host[:port]/path`,\n`file:///abs/path`, or a local path.\nTested hosts: GitHub and gists, GitLab, Bitbucket, Codeberg/Forgejo/Gitea, and googlesource.com; any\nserver speaking Git protocol v2 with filtered fetch works. Servers without filter support (git.sr.ht,\ngit.kernel.org, savannah) are refused with an error. `explorerepo help repos` prints all of this.\nTo test another host, run `explorerepo --repo SPEC --check`: it tries ssh and HTTPS separately,\nwithout the cache or the fallback, and reports each step (connect with protocol v2 and filter\nsupport, refs, commit, one tree, a subtree in one request, a blob) and a verdict.\n\nIt exits 0 when at least one transport works and 128 otherwise. `--https` or `--no-https` limits it\nto one transport.\n`--rev` accepts a branch, tag (annotated tags are peeled), a `refs/...` name, or a full 40-hex\nOID; a tag wins over a branch with the same name, as in git. Abbreviated OIDs are rejected. The\nbyte flags accept `K`, `M`, and `G` suffixes.\n\nGists are ordinary git repositories, so everything below works on them unchanged. They live on the\nseparate host `gist.github.com`, so a `Host github.com` block in `~/.ssh/config` (keys, identity\nfiles) does not apply. Add a matching `Host gist.github.com` stanza if you rely on one. A public gist\nis also readable over the anonymous HTTPS fallback; a secret gist needs an SSH key (or a token) that\nhas access.\n\nThere is no config file. `--repo` (or `EXPLOREREPO_REPO`) is the only required setting; everything\nelse has the default shown above.\n\nSSH is tried first. If a session cannot be established (no key, port 22 blocked, `ssh` not\ninstalled), explorerepo retries the same host over anonymous HTTPS (Git smart HTTP v2, still no\nGitHub API). The object cache is shared between the two, so nothing is re-fetched once a key is set\nup. Anonymous HTTPS reads **public** repositories only; private ones need ssh. When the fallback is\nused, a hint is printed to stderr at most once per day (recorded in the cache dir); suppress it with\n`EXPLOREREPO_QUIET`, or skip the fallback entirely with `--no-https`. `--https` forces HTTPS.\n`--no-cache` also suppresses the note, since there is nowhere to record the timestamp.\n\nThe exit status is the script's. Setup errors (auth, repository not found, bad revision) print\n`explorerepo: ...` and exit 128. A missing `--repo` exits 2 (usage error). An unknown command exits\n127, a timeout exits 124, and an internal error exits 70. Output beyond `--max-output` is cut off\nwith a notice on stderr; truncation is not an error.\n\n`pull [-f] PATH [DEST]` is the only command that writes to the real disk. It copies a file or\ndirectory to `DEST` (default `./<basename of PATH>`), refusing to overwrite without `-f` and refusing\n`.git` entries and symlink escapes. Use it when you want real tools (`rg`, `cargo`, ...) on a\nsubtree.\n\nFetched objects and refs are cached under `$EXPLOREREPO_CACHE`, or\n`os.UserCacheDir()/explorerepo` when that is unset (on macOS, `~/Library/Caches/explorerepo`).\nObjects are stored as git loose objects, so you can read them with\n`GIT_OBJECT_DIRECTORY=<cache>/objects git cat-file -p <oid>`. Refs are cached for 10 minutes so an\nagent sees a consistent snapshot across calls; `--refresh` bypasses the ref cache, and `--no-cache`\nkeeps everything in memory. To reset, delete that directory. The only other thing written is the ssh\ncontrol socket under `$TMPDIR/explorerepo-<uid>/`, which goes away when the master idles out.\n\n```\nmake test                         # offline: builds throwaway repos with the git CLI, uses the local transport\nmake race\nmake live                         # EXPLOREREPO_LIVE=1: octocat/Hello-World and golang/go over ssh\nscripts/probe.sh ssh octocat/Hello-World.git\n```\n\nSHA-256 repositories; protocol v0 servers; authenticated HTTP (the anonymous HTTPS fallback reads\npublic repositories only); Git LFS content (pointer files are shown as-is); `refs/replace/*`\nreplacements (git applies them locally, but the server sends the real objects); path-limited `log`;\na background daemon; FUSE/NFS mounts; writing or pushing anything; process substitution, background\njobs, and real program execution inside the shell.", "url": "https://wpnews.pro/news/explorerepo-tool-for-agents-to-read-remote-git-repositories-without-cloning", "canonical_source": "https://github.com/autowert66/explorerepo", "published_at": "2026-11-10 10:42:36+00:00", "updated_at": "2026-11-10 10:53:22.751586+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["explorerepo", "GitHub", "GitLab", "Bitbucket", "Codeberg", "DeepSeek V4.1 Flash", "opencode", "Linux kernel"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/explorerepo-tool-for-agents-to-read-remote-git-repositories-without-cloning", "markdown": "https://wpnews.pro/news/explorerepo-tool-for-agents-to-read-remote-git-repositories-without-cloning.md", "text": "https://wpnews.pro/news/explorerepo-tool-for-agents-to-read-remote-git-repositories-without-cloning.txt", "jsonld": "https://wpnews.pro/news/explorerepo-tool-for-agents-to-read-remote-git-repositories-without-cloning.jsonld"}}