repo-context-optimizer
rco gives a coding agent a map of a repo as one JSON object: the signatures of each file, how modules fit together, and the parts of a file that changed. No model, no keys, and no network except tiktoken's one-time encoding download when the tokens extra is installed. Install with pip install repo-context-optimizer.
Languages
Works on Python, JS/TS, Go, Java, C#, Kotlin, PHP, Ruby, Swift, CSS, SQL, shell, PowerShell, Docker (Dockerfiles and Compose files), C and C++, COBOL, Terraform and OpenTofu, Protocol Buffers, GraphQL, Python stub files, Vue, Svelte and Astro components, and Rust. You install it with pip, but it reads any repo.
Each row below says what the map holds, which imports become Forest edges, which files rco tests takes for tests, what a --passed record tells apart, and what was measured. Everything is read from src/rco/lang, src/rco/registry.py, the test environments guide and the support matrix.
What --passed always keys on. 0.1.9 keyed a record on the git tree only. Since 0.2.0 a record also carries a digest of the test environment: os, arch, libc, os version, container image (none outside a container; inside one rco needs RCO_CONTAINER_IMAGE or podman's image id, else every test runs), the CI matrix leg, TZ, LC_ALL and LANG, plus the per-language parts in the table. A record from another environment, an old record with no digest, or an environment rco cannot read gives the usual selection and skips nothing. Only Python narrows to test functions (path::test_fn); every other language selects whole test files.
| Language | Map: what is extracted | Imports and edges | rco tests: test files, and what the pass record also tells apart |
Measured savings |
|---|---|---|---|---|
| Python | Public classes, functions, methods with signatures, type hints and first docstring line; UPPER_CASE constants; annotated fields; __all__; argparse commands and flags; HTTP routes |
import and from ... import, relative too, by longest in-repo dotted name; stdlib and third party ignored |
test_*.py, *_test.py; test-function selection.Record: python (or python3) and in-tree .venv, venv, .tox/*, .nox/*: version, flags, the declared dependency closure as installed, .pth and editable sources; PYTHONHASHSEED, PYTHONOPTIMIZE, PYTHONPATH, PYTEST_ADDOPTS |
django 57.3%, transformers 86.3% at 8730f35 |
| JavaScript and TypeScript | exported names (every top-level name not starting with _ in a script) |
import ... from, export ... from, require("..."), import("...") with a literal; relative paths (extension, index, .js to .ts) and workspace packages by package.json name. tsconfig path aliases are not read |
*.test.*, *.spec.*, __tests__/.Record: node --version, NODE_OPTIONS, NODE_ENV, NODE_PATH, the Bun or Deno version when the tree has their files (a Bun-only or Deno-only runner stays detected); lock: package-lock.json, npm-shrinkwrap.json, pnpm-lock.yaml, yarn.lock, bun.lock, bun.lockb, deno.lock, else the packages in node_modules, Yarn Plug'n'Play's .pnp.cjs, and linked packages' files |
vite 77.4% at 8730f35 |
| Go | exported (capitalized) names | import "..." and import blocks, resolved through go.mod module paths to one file of the package (the first non-test file by name). rco tests still reaches the other files and _test.go of that package (0.2.1) |
*_test.go.Record: go version, go env (GOOS, GOARCH, CGO_ENABLED, the CGO_*FLAGS, GOFLAGS, GOEXPERIMENT, CC and more), GODEBUG, GOWORK; lock: go.sum, else go list -m all or the modules go list -deps -test uses |
cli/cli 83.4% at 8730f35 |
| Java | public and protected classes, interfaces, enums, records, annotations with their methods, fields, constants |
import, import static, wildcard imports, and same-package use, across source roots |
*Test, *Tests, *IT, *TestCase, Test*, and files under test/ or tests/.Record: java -version, JAVA_HOME's JDK, Gradle and Maven property variables; lock: gradle.lockfile in every Gradle project; Maven: mvn dependency:list; Gradle without locks is not detected, so tests run |
guava 82.6% at 7cbc034 |
| C# | public and protected types (class, struct, interface, enum, record, delegate) with methods, properties, fields, events, constants |
using, global using, using static, aliases, by namespace; <ProjectReference> in .csproj |
*Test, *Tests, *TestCase, *Fixture, files under test/ or tests/, *.Tests, *.Test and *.UnitTests projects.Record: dotnet --version, dotnet --list-runtimes, roll-forward, host environment and globalization variables; lock: packages.lock.json in every project, else dotnet restore and dotnet list package |
Newtonsoft.Json 78.5%, serilog 60.6% at 7cbc034 |
| Kotlin | classes, interfaces, objects, enums, type aliases; top-level functions and properties; extension functions; anything not private or internal |
import, wildcard, as aliases, and same-package declarations; Java files too |
*Test, *Tests, *IT, *TestCase, *Spec, files under test/ or tests/, *Test source sets.Record: as Java |
okhttp 70.7%, Java and Kotlin together, at 7cbc034 |
| PHP | Top-level functions and constants; classes, interfaces, traits, enums with public and protected members |
use (also function and const), require and include with a literal path, composer.json PSR-4 autoload and autoload-dev |
*Test, *Tests, *TestCase, files under test/ or tests/.Record: php -v, php -m, every effective ini setting, PHP_INI_SCAN_DIR, PHPRC, XDEBUG_MODE, XDEBUG_CONFIG; lock: composer.lock, else composer show --no-interaction |
laravel/framework 62.4% at 7cbc034 |
| Ruby | classes and modules by full constant path with methods, attributes, aliases, constants; private and protected honored |
require, require_relative, load, autoload with literal paths or __dir__/__FILE__ joins; load paths from Gemfile, gemspec and Rakefile; constant references |
*_spec.rb, *_test.rb, test_*.rb, files under spec/ or test/.Record: ruby -v, RUBYOPT, RUBYLIB, GEM_HOME, GEM_PATH, BUNDLE_*, Bundler's .bundle/config; lock: Gemfile.lock, else gem list and bundle list |
rubocop 38.7% at 11afa3c |
| Rust | pub items |
The crate module tree as rustc builds it: mod x; (x.rs, x/mod.rs, inline, #[path]), use with crate::, self::, super::, child modules, workspace crates and brace groups, pub use re-exports. Files no crate root reaches use the directory rule. ripgrep 3e85c6c: 78 of 105 files have an edge (37 of 105 on 0.1.8) |
.rs files directly in tests/ or test/; inline unit tests have no file of their own.Record: rustc -vV, the rustc and rustdoc flag variables, the target, RUSTC and its wrappers, RUSTUP_TOOLCHAIN, CARGO_TARGET_*, CARGO_PROFILE_*, cargo config files outside the tree; lock: Cargo.lock, else cargo metadata |
ripgrep 35.3% total, 49.3% median, 6/3/1 at rco b1a9eb1d (2026-12-04, America/Los_Angeles) |
| Swift | classes, structs, enums, protocols, actors, extensions, type aliases, functions, methods, init, subscript, properties; open, public or package |
import Module (also @testable and kind imports), resolved to Package.swift targets (default Sources/<Target>), else to the files that declare the module |
*Test, *Tests, *Spec, files under Tests/, tests/, Test/ or test/.Record: swift --version, DEVELOPER_DIR, SDKROOT; lock: Package.resolved, else the pins swift package resolve writes; no root Package.swift is not detected |
Alamofire 56.6% at 14467c9 |
| CSS | Top-level rules and at-rules by selector or prelude; custom properties of :root, :host and html |
@import and url() |
no test file pattern, so tests run under another language. Record: nothing of its own |
pdf.js CSS-only 40.1% at 39d574ca; the-mill Wall 0% |
| SQL | Tables, views, columns, indexes, procedures and functions from MySQL, PostgreSQL and SQLite DDL | none: SQL files import nothing | no test file pattern. Record: nothing of its own; rco verify --schema reads a SQL dump |
not measured |
| shell | Functions | source and . |
no test file pattern; a script a test names by path is a reader. Record: nothing of its own |
nvm 0% at 8730f35 |
| PowerShell | Functions | dot-sourcing and Import-Module |
no test file pattern. Record: nothing of its own |
not measured |
| Docker | Dockerfile stages, base images, COPY/ADD, RUN, ARG/ENV, ENTRYPOINT/CMD; Compose services, build, image, depends_on, with x- anchors and merge keys |
COPY/ADD sources, Compose build to its Dockerfile, env_file, include, extends |
no test files of its own: a change selects every test when CI, the top-level Makefile or a test file uses containers, else the tests that read the file. Record: in a container, each FROM and Compose image by digest (@sha256: pinned, else crane, skopeo or docker buildx imagetools; one that none resolves is not detected, so tests run); outside one, a fixed value |
awesome-compose Docker only 18.0% (median of arms) at 8730f35 and 0b2fd01 |
| Protocol Buffers | package, import, options, message fields, enums, services and rpcs | import paths; tests reach the file through generated stubs |
tests that reach it through generated stubs, or every test when no other language reaches it. Record: protoc --version and buf --version (absent when missing), well-known types beside protoc; PROTOC, PROTOC_INCLUDE |
feast 66.0% total, 87.7% median at 1c6641b36 |
| GraphQL | top-level type, input, query, mutation, fragment by name | #import; graphql-codegen outputs link their schema and documents |
test selection as for Protocol Buffers. Record: nothing of its own; graphql-codegen is a JavaScript package the JS lock already keys |
not measured on a public repo |
Stub files (.pyi) |
Python members in a SRCMODULE | beside the .py, or alone for a compiled module; a type-checker test links every .pyi |
test selection as measured on numpy. Record: nothing of its own; mypy is a Python package the Python probe already keys |
numpy 4.2% total, 1.1% median at 660310cc4d |
| C and C++ | header declarations: functions, classes and their public members, structs, enums, typedefs, #define macros |
#include (beside the file, then include directories CMake, Makefile -I or meson name, then include/ and src/), a header's same-stem source, the files one CMake command builds |
test_*, *_test, *-test, *_tests, *_unittest, *Test, *Tests; every test when CI, the top-level Makefile or a test file runs a script suite (runtest, tclsh, bats, pytest, prove).Record: cc --version, c++ --version, CC, CXX, the flag and search-path variables, CMAKE_BUILD_TYPE and the other CMake variables; lock: conan.lock, vcpkg-lock.json, else not detected (runs) |
token savings not measured; test selection on fmt 50ba042, newest 120 commits: 0 misses (28 commits were false skips before) |
| Terraform and OpenTofu | variables with type and default, outputs, module calls with source and version, resources, data, locals, required providers; terraform test runs |
var., local., module., data. and resource references to the declaring file of the same module, local module sources, ${path.module} files, a test file to the module it runs against |
*.tftest.hcl, *.tofutest.hcl: the test files that reach the change; every test when Terratest, kitchen-terraform or Python tftest drive it.Record: terraform version -json, TF_CLI_ARGS*, TF_VAR_*, TF_WORKSPACE, TF_CLI_CONFIG_FILE, probe:terraform (remote modules); lock: .terraform.lock.hcl in each tested module, else not detected (runs) |
terraform-aws-eks 60.8%, aws-ia/terraform-aws-vpc 57.1% (median of arms, Terraform only) at 8730f35 with Terraform grafted on |
| COBOL | programs with USING/RETURNING, paragraphs and sections, ENTRY points, level 01 and 77 data items with their PIC; fixed and free format |
COPY to the copybook, CALL "name" and EXEC CICS LINK/XCTL through PROGRAM-ID |
the tests that read the file; every test when CI or a test file runs cobolcheck, zunit, runtest, bats, pytest or prove.Record: cobc --version, COB_COPY_DIR, COBCPY and the other COB_* variables; no lock to read |
carddemo 76.5% (median of arms, 7 commits) at 59cc6c2; cobol-programming-course 44.4% (66 commits) at 780b1c9 |
| Vue, Svelte and Astro | script exports; a component node with props and events |
<script> and Astro frontmatter imports, src= blocks, <style> @import |
no component test-file pattern of its own: the JS/TS tests that import them run under the JavaScript row. Record: nothing of its own; node --version and the JS/TS locks key them |
component files only: element-plus 30.3%, starlight 12.8%, skeleton 4.5% at 8730f35 plus lang/sfc |
| any other language | the file shows by path | none | none | not measured |
Token density per language (node kinds, sig, doc, lines, and what each command supports) is in Commands by language. How the digest is built: test environments. Each sha and source: support matrix.
Two things set rco apart from grep, ctags and other search tools:
- Token density: the agent reads only the fields it needs. rco answers with a JSON object, so an agent takes
parts, a signature or a line range and skips the rest. The map may hold more than a task needs, which is safer than holding too little and scanning again. grep and similar tools print lines, and an agent reads that output top to bottom, then often searches again. - The measure is tokens to finish a task, not the size of one command's output. A short grep output that leads to rereading files and more searches can cost more in the end. rco is judged by the tokens an agent spends to complete a task with it and without it: the proof.
If you are an agent
rco: look up the map before the code
- Run
rco map --preloadonce per checkout. - Before you read code, run
rco map --for FILE...for the files you will touch. It prints JSON. - Do not read a source file top to bottom:
partshas each--forfile's nodes and whatchangedagainstbase. Open the file only to edit at the part you looked up. - The map is JSON, not text to grep: look things up with
rco map --get NAME,--search REGEXor--list [KIND|PATH](each returns a list). Open a raw file only when the map does not answer. - If
built.behindis not 0, runrco map --preloadand map again; read any file inbuilt.differsdirectly. Ifbuilt.sourceisworktree, the map already has those uncommitted edits. - To test a change, run
pytest $(rco tests BASE HEAD --list)instead of the full suite. - After a compaction, rerun
rco map --for FILE...instead of rereading the files.
The proof: tokens to finish a task
An agent that has to change a file usually greps for names, then reads whole files to see the signatures around them; most of those tokens go to finding its way, not editing. So rco is measured by the tokens an agent spends to complete a task with rco and without it (grep, ctags and reading files), counting rereads and repeated searches, and whether the answer is right.
Five tasks on rco's own history at release/0.2.1 c082ebd1d7a1, tiktoken o200k_base, printed by rco baseline --tasks. This is a modeled agent, not a live agent run: rco is charged only for the JSON fields the task reads plus any follow-up file slices; grep or git for its full stdout plus re-scans and follow-up slices. Which fields a task reads is a judgement fixed in the code. Truth answers come from git or ctags, never from rco. The run, its inputs and limits: docs/baseline/rel021-tasks-c082ebd.md. Run it on your repo with rco baseline --tasks.
| task | tokens rco | tokens grep / git | right? |
|---|---|---|---|
| T1 find a definition and open it | 330 | 432 | both; reading the definition (303) is most of each |
| T2 which tests to run for a commit | 408 | 3,325 | both include the test the commit changed; rco lists 57 test files, grep 75 |
| T3 can a branch merge onto another | 9 | 23 | both; the git side is the truth |
| T4 contract changes of a commit | 392 | 314 | both cover the 7 public definitions that changed |
| T5 merge order of two branches | 66 | 83 | both; the git side is three merge-tree calls |
On this one commit and branch pair rco cost less on T1, T2, T3 and T5 and more on T4. What rco prints is often much more than what the task reads (T5: 66 used of 12,128 printed): the map offers more, and the modeled agent reads the fields it needs. rco baseline --grep is not that measurement: it estimates, per commit, the outlined parts of the files that commit changed against ctags -x plus a grep of those files, with no callers, field-selective reads, follow-up reads or multi-step tasks. The earlier modeled run at 0.1.9 is kept in docs/baseline/rel019-c58e371-task-cost.md.
Earlier estimates, from the replay definition at rco 8730f35 (changed files plus their one-hop imports, budget 12000, tiktoken o200k_base): what an agent would read per commit with and without rco, not a run of an agent on a task. They have not been remeasured with rco baseline. Source: the 8730f35 comparison.
- Saved 45% to 65% of tokens on our own repos since 1 Nov 2026 (win/tie/loss): md2xarticle
e0eee6f45.2% (18 commits, 13/5/0), this repo 62.5% (149, 121/20/8), the-millf6daf9864.8% (298, 205/88/5). rco lost on 13 commits, all after the same-folder import change, where the map followed those imports and cost more than reading the files. - grep and ctags saved more on the same commits. Where rco sent a map, % saved for rco / aider's map at rco's size / ctags / grep of changed names: this repo (129 commits) 63.7 / 63.7 / 67.8 / 71.0, the-mill (210) 71.1 / 71.2 / 71.5 / 73.5. ctags and grep there borrowed rco's import graph and changed-name list, so a compact outline, not rco alone, is what saves the tokens.
- Not measured: a live agent's tokens to finish a task, and whether it does the task better. The task table above is a model of an agent.
What each command prints next to the grep, git or ctags sequence it replaces, with right-or-wrong checks and timings, is an appendix: output size per command, not task cost. Grep often prints less per command; that is not what a task costs.
30-second start
pip install "repo-context-optimizer[tokens]" # tiktoken adds real token counts
cd your-repo
rco baseline # does it help on your repo? estimates your last 10 code commits
rco baseline --grep # the same commits, estimated for grep plus ctags
rco map --for src/cli.py # what an agent looks up before editing src/cli.py
rco init --agents # point AGENTS.md and similar files at `rco map`
CI runs only the tests that matter, and never reruns tests that already passed on the same code. rco tests picks the tests a change can reach; with --passed it picks nothing when the tree under test already passed, and only the tests for what changed since when it did not. It keys on the git tree, so squash, rebase and merge commits, a merge queue, and the push after a merge all get it. On this repo, PR #190's merge-queue run ran 934 tests in 4m45s after its pull request had passed them; its base had moved 6 files since, and with the pull request's record rco tests --passed selects 48 test files (197 test IDs) for that run. rco init --ci-tests writes the workflow. Setting rco up for a team repo: adopting rco, then GitHub setup.
Commands
Nine commands, no setup: the map is built from git and cached in .rco/ as it is read. Every command prints JSON by default and also takes --repo PATH (default .), --format json|markdown (markdown renders the same object) and --out FILE.
flowchart LR
rco((rco)) --> map["map<br/>--for --list --search --get<br/>--preload --clear --name"] & tree["tree<br/>--for"] & forest["forest"]
rco --> diff["diff<br/>--staged --worktree"] & tests["tests<br/>--staged --worktree<br/>--ignore --list<br/>--passed --record"] & mc["merge-check<br/>--onto --base --head<br/>--order --planned"]
rco --> baseline["baseline<br/>--last --since --grep<br/>--pr --max-files --tasks"] & verify["verify<br/>--schema --openapi<br/>--help-text"] & init["init<br/>--agents --hooks --remove-hooks<br/>--metrics --ci-tests<br/>--no-config --no-ci"]
| Command and flag | what it does | what it is for |
|---|---|---|
rco map |
the repo map at a commit (default HEAD) as JSON: the Forest plus every Tree; fills the cache as it reads |
an agent's first look at a repo |
--for FILE... |
only the modules that own those files and their neighbors, the signatures of the files they import, and each file's parts and what changed |
before editing: what to know about those files without reading them |
--list [KIND|PATH] / --search REGEX / --get NAME |
nodes from the map as a JSON list, filtered by kind or path, by name pattern, or by exact name | looking a name up instead of grepping |
--preload [--name NAME] |
builds and stores the map for a commit ahead of time and moves a named pointer (default main) |
warming the cache in CI or after a merge |
--clear [--name NAME] |
empties this repo's cache (Trees, prose, pointers); never touches git or sources | starting the cache over |
rco tree |
the Trees (signatures) of a commit | reading a module's contract |
--for PATH... |
only the modules that own those paths | narrowing to one area |
rco forest |
how the modules fit together at a commit | seeing the shape of a repo |
rco diff |
added, removed and changed signatures, flags, columns and routes between two commits, with callers | reviewing what a change does to its contract |
--staged / --worktree |
diffs the index or the working tree against HEAD |
checking edits before you commit |
rco tests |
the tests that can see the changes between two commits, through imports and file names | running only the tests a change can affect |
--staged / --worktree |
uses the index or working tree as the head | picking tests before you commit |
--ignore GLOB |
drops changed paths no test reads (repeatable) | keeping data-only changes from running everything |
--list |
the pytest node IDs a change reaches (or whole test files), one per line | feeding pytest in CI |
--record / --passed RECORD |
--record names HEAD's tree, parents and environment digest; --passed (repeatable) takes records of trees that passed in this environment: none when HEAD's tree is one, else the diff from the nearest, else BASE |
never rerunning tests on code that already passed |
rco merge-check |
per BRANCH given: text conflicts onto --onto (default branch), and whether it uses what this PR (--base..--head) changed; exit 1 only on a text conflict |
knowing before a merge which branches break |
--order |
for two or more branches: what each changes that another uses, and a safe merge order | planning the order of several merges |
--planned FILE / --card NAME / --others FILE |
a card's planned file list (FILE, or - for stdin) and, with --others, the other cards' lists: a hint of overlap with those lists and the BRANCHes; never blocks |
seeing overlap at claim time |
rco baseline |
per-commit token estimate of the outlined changed parts over the last 10 code commits | finding out whether rco helps on your repo |
--last N / --since DATE |
which commits to estimate | A longer window, or a roll-up since a date |
--grep |
the same commits estimated for one fixed ctags plus grep run | comparing rco with grep on your own history |
--pr N |
the commits of pull request N | measuring one pull request in CI |
--max-files N |
skips commits that change more code files (default 50) | keeping bulk changes out of the estimate |
--tasks |
tokens to finish five fixed tasks, rco against grep or git, each with a truth answer; a modeled agent, not a live run | measuring tokens to finish a task, not only a commit outline |
rco verify |
compares the map with real outputs you captured; exit 1 on a mismatch | proving the map matches the running system |
--schema / --openapi / --help-text CMD=FILE |
A SQL schema dump, an OpenAPI document, or a saved --help (repeatable) |
checking tables, routes or CLI flags |
rco init |
writes rco.toml and a CI report job, keeping any file that exists |
one-step setup |
--agents |
writes the agent block above into AGENTS.md and similar files |
pointing agents at the map |
--hooks / --remove-hooks |
adds or removes a post-merge hook that preloads the map | keeping the cache warm locally |
--metrics |
adds a CI step that runs baseline --pr and uploads the report |
tracking savings per pull request |
--ci-tests |
writes .github/workflows/rco-tests.yml: pytest on what rco tests selects, records each green tree, reads earlier records back |
CI that runs only the tests that matter, once per tree |
--no-config / --no-ci |
skips rco.toml or the workflow |
setting up only part |
flowchart LR
G["git commit"] -->|"map reads a commit not stored yet: lazy fill"| S[("store in .rco/<br/>Trees keyed by content hash<br/>commits indexed by sha, named pointers")]
G -->|"map --preload: fill ahead, move a pointer"| S
C["map --clear"] -->|"empties Trees, prose, pointers; never git"| S
The cache: map fills it lazily, --preload fills it ahead, --clear empties it, and entries are keyed by content, so a rerun writes nothing new. Exit codes, JSON fields and examples are in docs/commands.md.
Commands by language
Every map node has kind, name and path, plus sig, doc and children where the language has them. lines is only for Python and stub files (.pyi) today. rco map --for FILE puts each file's nodes in parts. rco baseline uses those outlined parts for every language with an extractor. rco init --ci-tests writes a pytest workflow. unknown means not verified. Measured on rco 0.2.1 at fold fffa2a4e, 2026-12-03 (America/Los_Angeles), on a small polyglot sample repo (one class, function and test per language, plus a two-branch merge-check). The limits below, and how the digest is built: support matrix and test environments. Savings shas: support matrix.
| Language | map / tree nodes (attrs.kind) |
sig |
doc |
lines |
forest |
diff callers |
rco tests |
verify |
merge-check uses |
|---|---|---|---|---|---|---|---|---|---|
| Python | pymodule, class, function, method, field, constant; command, flag; route |
type hints | first docstring line | yes | edges; entry points; owns commands and routes | yes, through imports, self and annotations |
test functions (path::test_fn) |
--schema no; --openapi and --help-text yes |
yes |
| JavaScript and TypeScript | srcmodule, class (class, interface, enum, type), function, method, field, constant |
types | leading comment | no | edges; package.json directories are modules |
yes | whole test files | no | yes |
| Go | srcmodule, class (struct, interface), function, method, field, constant |
yes | leading comment | no | edges (an import still links one file of the package) | yes, including same-package tests | whole test files, including other files and _test.go of the same package (0.2.1) |
no | yes (documented; same-package callers in diff) |
| Java | srcmodule, class (class, interface, enum, record, annotation), method, field, constant |
yes | leading comment | no | edges | yes | whole test files | no | yes |
| C# | srcmodule, class (class, struct, interface, enum, record, delegate), method, field, constant |
yes | leading comment, XML tags kept | no | edges | yes | whole test files | no | yes |
| Kotlin | srcmodule, class (class, interface, object, enum, annotation, typealias), method (top-level functions too), field, constant |
yes | leading comment | no | edges | yes | whole test files | no | yes |
| PHP | srcmodule, class (class, interface, trait, enum), method (top-level functions too), field, constant |
yes | leading comment | no | edges | none found: rco matches . (its member_sep), not ->, so $b->set(1) gives no callers |
whole test files | no | none found: rco matches . (its member_sep), not -> |
| Ruby | srcmodule, class (class, module), function, method, field, constant |
parameter names | leading comment | no | edges | yes | whole test files | no | yes |
| Rust | srcmodule, class (struct, enum, trait, mod), function, method, field, constant |
yes | leading comment | no | edges; Cargo.toml directories are modules |
yes | whole test files | no | yes |
| Swift | srcmodule, class (struct, enum, protocol, actor, extension, typealias), function, method, field, constant |
yes | leading comment | no | edges | yes | whole test files | no | yes |
| shell, PowerShell | srcmodule, function |
parameters (() in shell) |
leading comment | no | edges | yes | none: no test file pattern | no | yes for PowerShell; shell not measured (no contract change in the two-branch run) |
| CSS | srcmodule, field (rule or at-rule), constant (custom property) |
none | file comment | no | edges | no callers | none: no test file pattern | no | file overlap only; no symbol uses |
| SQL | table, view, column, index, procedure |
column types | leading -- comment or COMMENT |
no | none; owns tables and views | no callers; columns and tables change | a changed .sql file selects every test unless a code file names it |
--schema yes |
none found |
| Docker | srcmodule, class (stage, service), function (CMD, ENTRYPOINT, HEALTHCHECK), field, constant |
yes | none found | no | edges | no callers; CMD changes show |
none of its own: every test when CI, the Makefile or a test uses containers, else tests that name the file | no | none found |
| Protocol Buffers | srcmodule, class (message, enum, service, import), field, method, constant |
fields and rpcs | none found (// comments not on nodes) |
no | import edges; generated stubs depend on the .proto |
added fields show; no callers found | tests through generated stubs, or every test when no other language reaches it | no | none found |
| GraphQL | srcmodule, class (type) |
none | file comment | no | #import edges |
added types show; a field-only change does not (Trees hold top-level types only); no callers found | as Protocol Buffers; when no other language reaches it, every test runs | no | none found |
Stub files (.pyi) |
Python members in a srcmodule (lang pyi) |
type hints | file docstring | yes | beside the .py, or alone for a compiled module |
yes; in this run callers were only inside the stub | a type-checker test links every .pyi; a Python test that imports the stub is selected |
no | none found |
| C and C++ | header declarations: functions, classes and public members, structs, unions, enums, typedefs, macros; a source file is its path and include edges | yes | file comment | no | #include, same-stem source, files one CMake command builds |
yes, in including .c files and tests |
test_*, *_test, *-test, *_tests, *_unittest, *Test, *Tests; every test when CI, the Makefile or a test file runs a script suite; a same-stem test was selected |
no | yes |
| Terraform and OpenTofu | variable (FIELD), output (EXPORT), module / resource / data (CLASS), locals (CONSTANT) |
type and default on variables | variable description |
no | references to the declaring file, local module sources, ${path.module}, a test file to its module |
variable changes show; no callers found | *.tftest.hcl or *.tofutest.hcl that reach the change; every test when Terratest, kitchen-terraform or Python tftest drive it |
no | none found |
| COBOL | class (program), field (level 01 / 77), procedure |
none found | program comment | no | COPY, CALL and EXEC CICS LINK/XCTL |
procedure add/remove show; no callers found | the tests that read the file; every test when CI or a test file runs cobolcheck, zunit, runtest, bats, pytest or prove |
no | none found |
| Vue, Svelte and Astro | class (component), field, function, constant; an interface of props |
yes | leading comment | no | <script> and frontmatter imports, src= blocks, <style> @import |
export changes show; no callers found | no component test-file pattern; the JS/TS tests that import them are selected | no | none found |
Limits measured at rco 0.2.1 (fffa2a4e): PHP: rco matches . (its member_sep), not ->, so $b->set(1) gives no diff callers or merge-check uses; Kotlin and PHP top-level functions still have kind method; a .sql change with no code-file name still selects every test. Go rco tests now selects other files and _test.go of the same package (0.2.1); an import edge still links only the first non-test .go file of the package by name. Stub files emit lines; other non-Python languages still do not. On ripgrep 3e85c6c at rco b1a9eb1d (2026-12-04, America/Los_Angeles), 78 of 105 .rs files have an edge, and the last-10 replay saved 35.3% total, 49.3% median, 6/3/1, so Rust is shipped.
Repo types and planned work
| Status | Languages and repo types | Token savings |
|---|---|---|
| 🗓️ upcoming, no date | A concept classifier for prose (map --search matches only node and module names today, so a prose phrase finds nothing); richer map nodes (signatures, imports, callers) and other optimizations in progress |
not measured |
| ⚪ fallback, dropped | Any other language: the file shows by path. Dropped: none yet. A dropped language is a deliberate decision and is never deleted; each one is listed with dropped_reason (one line), evidence (path to the replay result), dropped_on (date) and revisit_when, the same four fields as the concept taxonomy. A language listed nowhere here is a real gap, to be added as planned |
not measured |
| ✅ repo types | Single package, monorepo, polyglot, submodules (skipped with a note), LFS (opaque), empty repo | not measured by type |
- Not measured: the pass record's saving, and a live agent's tokens to finish a task.
How rco is built
flowchart TB
A["9 commands<br/>commands/: one Spec each"] --> B["Map layer<br/>core/: build, forest, diff, refs"]
B --> S["Cache<br/>store/: SQLite, filled on read"]
B --> C["File graph<br/>imports, edges"]
C --> D["Language registry"]
D --> E["lang/<language>/ on a shared engine"]
E --> F["Shared base<br/>gitread, canon, model, output"]
Deterministic, one design for every language, checked in CI and with SPIN, and measured with losses counted: docs/architecture.md has why, the layers and the module behind each command. Design, roadmap and process: docs/design/.
Documentation and license
Commands, support matrix, architecture, adopting rco, GitHub setup, cloud agents, changelog. MIT; see LICENSE.
Metadata
Release files for repo-context-optimizer 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| repo_context_optimizer-0.2.1.tar.gz | 692.4 kB | With provenance | Details for repo_context_optimizer-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| repo_context_optimizer-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for repo_context_optimizer-0.2.1-py3-none-any.whl |
Total release size: 1.1 MB
Release files / repo_context_optimizer-0.2.1.tar.gz
| Download URL | repo_context_optimizer-0.2.1.tar.gz |
|---|---|
| Size | 692.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42445118a6e3697da1ae4b1127f9b8f1b35ef9b70be7053223e4762f2388fde7
|
|
BLAKE2b-256 checksum How to use checksums |
6f30314f618bcd90590565bc3ff81285df0da89fe8033ec8eca18541920dcebe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / repo_context_optimizer-0.2.1-py3-none-any.whl
| Download URL | repo_context_optimizer-0.2.1-py3-none-any.whl |
|---|---|
| Size | 411.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b23458e615d3a58402371cf4fc4824ab977e9ba9adb185776cd72b545afb5a97
|
|
BLAKE2b-256 checksum How to use checksums |
1e4422c671233eeb4e737ff00c4cb377b92837686a19d5073bf9f4778970c6f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logSecurity for repo-context-optimizer 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for repo_context_optimizer-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.