[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"readme:tgrep":3},"\u003Ch1>tgrep\u003C\u002Fh1>\n\u003Cp>Trigram-indexed grep with a client\u002Fserver architecture for fast regex search\nin large codebases.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>tgrep is integrated into \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fgithub\u002Fcopilot-cli\" rel=\"nofollow ugc noopener\">GitHub Copilot CLI\u003C\u002Fa>\nto power fast grep searches across large repositories.\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Ch2>Quick start\u003C\u002Fh2>\n\u003Cp>\u003Ca href=\"#installation\" rel=\"nofollow ugc noopener\">Install tgrep\u003C\u002Fa>, then start a server:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">tgrep serve .           # builds the index if needed; runs in the foreground\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>In another terminal:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">tgrep -- \"fn main\" .    # automatically connects to the server\ntgrep status .          # show indexing and refresh status\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Without a server, run \u003Ccode>tgrep index .\u003C\u002Fcode> to build an on-disk index. Searches use\nthe server when available, then the local index, or scan the filesystem if no\nusable index exists. Indexes are stored in \u003Ccode>.tgrep\u002F\u003C\u002Fcode> by default; add this\ndirectory to \u003Ccode>.gitignore\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>Indexes can lag filesystem changes.\u003C\u002Fstrong> The server updates asynchronously;\nwithout a server, rerun \u003Ccode>tgrep index .\u003C\u002Fcode> after changes. Use \u003Ccode>--no-index\u003C\u002Fcode> when a\nsearch must read the current files. Queries scan during an initial build until\ncomplete coverage is available.\u003C\u002Fp>\n\u003Cp>For coding agents, see \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftgrep\u002Fblob\u002FHEAD\u002FAGENTS.md\" rel=\"nofollow ugc noopener\">AGENTS.md\u003C\u002Fa>. To install MCP search tools and\nstartup hooks for Codex or pi, run \u003Ccode>bash install-agent.sh\u003C\u002Fcode> from this checkout\n(Linux\u002FmacOS, Python 3.11+). See the\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftgrep\u002Fblob\u002FHEAD\u002Fscripts\u002Fagent\u002FREADME.md\" rel=\"nofollow ugc noopener\">agent integration guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003Ch2>Performance\u003C\u002Fh2>\n\u003Cp>A trigram index narrows each query to files that could match, then verifies\nthose files with the regex engine in parallel. Patterns without useful\ntrigrams may still require searching every indexed file.\u003C\u002Fp>\n\u003Cp>In the August 24, 2026 benchmark sweep, tgrep was faster than ripgrep in 17 of\n18 repo\u002Fplatform combinations, with speedups from 0.93x to 51.9x. These measure\nclient\u002Fserver search latency with the index already built, not indexing time.\nResults depend on the query, repository, storage, and match volume. See\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftgrep\u002Fblob\u002FHEAD\u002FBENCHMARKS.md\" rel=\"nofollow ugc noopener\">BENCHMARKS.md\u003C\u002Fa> for measurements and methodology.\u003C\u002Fp>\n\u003Ch2>Usage\u003C\u002Fh2>\n\u003Ch3>Build the index\u003C\u002Fh3>\n\u003Cpre>\u003Ccode class=\"language-bash\">tgrep index .                        # index current directory\ntgrep index \u002Fpath\u002Fto\u002Frepo             # index a specific repo\ntgrep index . --index-path \u002Ftmp\u002Fidx    # custom index location\ntgrep index . --exclude vendor --exclude third_party  # skip directories\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Each build reports elapsed time and, where available, peak memory:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>Index built successfully at \u002Ftmp\u002Fidx\nIndexed in 22.6s using external strategy (peak memory 160.1 MiB)\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Windows reports peak private committed bytes; Linux samples anonymous resident\nmemory. Both exclude file-backed mappings and report the working set separately\nwhen it is substantially larger. macOS reports resident memory instead.\u003C\u002Fp>\n\u003Ch4>Repositories without a \u003Ccode>.git\u003C\u002Fcode> directory\u003C\u002Fh4>\n\u003Cp>Like ripgrep, tgrep applies \u003Ccode>.gitignore\u003C\u002Fcode> only inside a Git repository. It warns\nwhen a root \u003Ccode>.gitignore\u003C\u002Fcode> is present but not applied. Use \u003Ccode>--no-require-git\u003C\u002Fcode> on\nindexing, serving, and searching to apply those rules outside Git:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">tgrep index . --no-require-git\ntgrep serve . --no-require-git\ntgrep --no-require-git -- \"pattern\" .\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch4>Case-insensitive repositories\u003C\u002Fh4>\n\u003Cp>When Git's \u003Ccode>core.ignorecase\u003C\u002Fcode> is enabled, tgrep applies an additional\ncase-insensitive exclusion pass for the repository's root \u003Ccode>.gitignore\u003C\u002Fcode> and\n\u003Ccode>.git\u002Finfo\u002Fexclude\u003C\u002Fcode>. Git-tracked paths are exempt from this additional pass,\nbut not from ordinary traversal, binary, or size filtering.\u003C\u002Fp>\n\u003Cp>Nested \u003Ccode>.gitignore\u003C\u002Fcode> files and global ignore rules do not get this additional\npass. \u003Ccode>--no-ignore\u003C\u002Fcode> disables it along with the normal ignore rules.\u003C\u002Fp>\n\u003Ch4>Keep \u003Ccode>index\u003C\u002Fcode> and \u003Ccode>serve\u003C\u002Fcode> flags in step\u003C\u002Fh4>\n\u003Cp>Use the same \u003Ccode>--no-require-git\u003C\u002Fcode>, \u003Ccode>--no-ignore\u003C\u002Fcode>, \u003Ccode>--max-filesize\u003C\u002Fcode> (or\n\u003Ccode>--no-max-filesize\u003C\u002Fcode>), and \u003Ccode>--exclude\u003C\u002Fcode> settings for \u003Ccode>index\u003C\u002Fcode> and \u003Ccode>serve\u003C\u002Fcode>.\nStartup reconciliation removes indexed files excluded by the server's current\nsettings. For example, serving an uncapped index with \u003Ccode>--max-filesize 8M\u003C\u002Fcode>\nremoves files larger than 8 MiB from that index.\u003C\u002Fp>\n\u003Cp>Pass the same size policy, \u003Ccode>--no-require-git\u003C\u002Fcode>, and any custom \u003Ccode>--index-path\u003C\u002Fcode>\nto searches too. \u003Ccode>--exclude\u003C\u002Fcode> is o\u003C\u002Fp>\n",1790587593918]