{"slug": "show-hn-ghx-a-caching-proxy-for-github-cli-built-for-ai-agents", "title": "Show HN: Ghx – A caching proxy for GitHub CLI, built for AI agents", "summary": "Developer Bruno Borges released ghx, a caching proxy for the GitHub CLI that returns cached read-only command responses in about 0.1s instead of roughly 1s, with a default TTL of 30s. The ghxd daemon uses singleflight coalescing so 10 agents requesting the same data trigger just 1 GitHub API call, and only allowlisted read-only commands such as `gh pr list` and `gh issue view` are cached while mutations pass through and invalidate related entries. ghx installs via `brew install brunoborges/tap/ghx` with pre-built binaries for macOS Apple Silicon, Linux x64/arm64, and Windows x64/arm64, and can place a `gh` shim on the PATH so AI coding agents route through the cache without configuration.", "body_md": "### You run `ghx pr list`\n\nThe `ghx` client resolves your repo, branch, and auth context, then forwards the request to the `ghxd` daemon over a Unix socket.\n\n      A caching proxy for the **[GitHub CLI](https://cli.github.com)** that makes repeated commands instant.\n      Singleflight coalescing means 10 agents asking the same thing triggers just 1 API call.\n    \n\nCached responses return in ~0.1s instead of ~1s. Your scripts and agents feel instant.\n\nFive agents requesting the same PR list simultaneously? Only one API call is made. All five get the result.\n\nOnly known-safe read-only commands are cached. Mutations pass through directly and invalidate related cache entries.\n\nJust use `ghx` instead of `gh`. The daemon auto-starts. No configuration needed.\n\nReal-time web dashboard shows hit rates, per-command stats, and a live request log. Helps you tune your TTL.\n\nContext-aware cache keys prevent cross-repo collisions. Unix socket with strict permissions. No tokens stored.\n\n`ghx pr list`\nUsing a context-aware key (repo + branch + host + auth + args), it looks for a valid cached response. If found and within TTL, it returns instantly.\n\nOn a miss, the daemon executes `gh` once. If other clients request the same thing concurrently (singleflight), they all wait for and share the single result.\n\nThe stdout, stderr, and exit code are cached with a configurable TTL (default 30s). The client writes stdout/stderr and exits with the original exit code.\n\nMeasured with `gh pr list --repo cli/cli --limit 2 --json number,title`\n\nMonitor cache performance at `http://localhost:9847/`\n\nThe dashboard data is also available as JSON for scripting and automation:\n\n```\ncurl http://localhost:9847/api/stats | jq .\n```\n\nOnly explicitly allowlisted read-only commands are cached. Everything else passes through.\n\n| Command | Cached | Notes | \n|---|---|---|\n| `gh pr list/view/status/checks/diff` | ✓ Cached | With any filter/format flags | \n| `gh issue list/view/status` | ✓ Cached | Including `--json` ,`--comments` | \n| `gh repo view/list` | ✓ Cached |  | \n| `gh run list/view` | ✓ Cached |  | \n| `gh workflow list/view` | ✓ Cached |  | \n| `gh release list/view` | ✓ Cached |  | \n| `gh search repos/issues/prs/commits/code` | ✓ Cached |  | \n| `gh api` (GET) | ✓ Cached | REST GET only | \n| `gh label list` | ✓ Cached |  | \n| `gh gist list/view` | ✓ Cached |  | \n| `gh project list/view` | ✓ Cached |  | \n| `gh cache list` | ✓ Cached | Actions cache | \n| `gh ruleset list/view/check` | ✓ Cached |  | \n| `gh org list` | ✓ Cached |  | \n| `gh pr create/merge/close` | ✗ Mutation | Invalidates PR cache | \n| `gh issue create/edit/delete` | ✗ Mutation | Invalidates issue cache | \n| `gh auth/config/codespace` | ✗ Passthrough | Always direct to `gh` | \n\n        Add commands to the allowlist without recompiling. Edit `~/.ghx/config.yaml`\n        and list subcommand prefixes under `additional_cacheable`.\n        Any `gh` invocation whose arguments start with a listed prefix will be cached.\n        Restart the daemon after making changes.\n      \n\n```\nttl: 60s\n\nadditional_cacheable:\n  # Cache `gh status` output\n  - \"status\"\n  # Cache Actions variable listings\n  - \"variable list\"\n  # Cache team member queries\n  - \"api graphql\"\nbrew install brunoborges/tap/ghx\n```\n\n        Pre-built binaries are available for macOS (Apple Silicon), Linux (x64 & arm64), and Windows (x64 & arm64).\n        [Browse releases →](https://github.com/brunoborges/ghx/releases)\n\n`gh` Shim for Transparent Caching\n      When you install ghx, a lightweight `gh` shim is automatically placed on your PATH\n      if no existing GitHub CLI is detected. This is especially powerful for **AI coding agents** —\n      they call `gh` by default, and the shim ensures every command is routed through the ghx caching layer\n      before hitting the real GitHub CLI. No agent configuration needed.\n    \n\nDuring installation (Homebrew, install script, or PowerShell), ghx checks if a real `gh` binary exists on your system. If not, it installs a tiny shim at `gh` that routes all commands through `ghx`.\n\nAI agents like GitHub Copilot and Claude Code use `gh` for GitHub API calls. With the shim in place, every `gh pr list`, `gh issue view`, or `gh api` call flows through ghx's cache — eliminating redundant API requests and preventing rate limits, with zero changes to the agent.\n\nIf `ghx` needs the real GitHub CLI to execute a command, it automatically downloads and installs `gh` for you. No manual setup required — just run your commands and ghx takes care of the rest.\n\n        When a real `gh` binary is detected, ghx **will not install the shim** — so agents will keep calling `gh` directly, bypassing the cache. You have two options:\n      \n\n**Remove the GitHub CLI** and reinstall ghx. The shim will be created, and agents automatically get caching via `gh`. ghx will download the real `gh` binary on first use.\n          \n\n**Keep the GitHub CLI** and install the [agent plugin](#plugin) instead. The plugin teaches agents to call `ghx` directly instead of `gh`.\n          \n\n      For [Claude Code](https://code.claude.com/docs/en/plugins) and\n      [GitHub Copilot CLI](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-cli-plugins) —\n      install the plugin and your agent automatically prefers `ghx` over `gh`.\n    \n\n`/plugin marketplace add brunoborges/agent-plugins`\n\n`/plugin install ghx@agent-plugins`\n\n`ghx`\nA built-in skill teaches the agent to prefer `ghx` for all GitHub CLI commands. Binaries are lazy-installed on first use — no manual setup needed.\n\nghx is designed to be safe by default — no secrets stored, no network exposure.\n\nThe Unix domain socket uses `0600` permissions. Only your user can communicate with the daemon.\n\nAuth tokens are never written to disk or cache. Only a SHA-256 fingerprint is used in cache keys to prevent cross-account collisions.\n\nThe web dashboard binds to `127.0.0.1` only — it is not accessible from the network.\n\nAll cached data lives in memory and is lost on daemon restart. Nothing is persisted to disk.\n\nEach user runs their own isolated daemon instance. No shared state between users on the same machine.", "url": "https://wpnews.pro/news/show-hn-ghx-a-caching-proxy-for-github-cli-built-for-ai-agents", "canonical_source": "https://brunoborges.github.io/ghx/", "published_at": "2026-10-15 15:42:54+00:00", "updated_at": "2026-10-15 15:53:17.618991+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["ghx", "ghxd", "GitHub CLI", "Bruno Borges", "Homebrew", "macOS", "Linux", "Windows"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-ghx-a-caching-proxy-for-github-cli-built-for-ai-agents", "markdown": "https://wpnews.pro/news/show-hn-ghx-a-caching-proxy-for-github-cli-built-for-ai-agents.md", "text": "https://wpnews.pro/news/show-hn-ghx-a-caching-proxy-for-github-cli-built-for-ai-agents.txt", "jsonld": "https://wpnews.pro/news/show-hn-ghx-a-caching-proxy-for-github-cli-built-for-ai-agents.jsonld"}}