Repository navigation
Description
Problem
Onboarding a new repo to egg means manually editing ~/.config/egg/repositories.yaml — a single user-level file with a schema that has several subtle traps that don't show up until something silently breaks at runtime:
persist_dirsvspersist_system_dirsis the difference between "binary survives into the runtime sandbox" and "binary is silently discarded between Docker stages." Sandbox container missing uv: BRC tester can't runmake test, falls back to incomplete pytest #2065 is exactly this: the local config installeduvvia build_commands to/usr/local/binbut didn't persist that path, so the binary was discarded after Stage 1 andmake testerrored withuv is not installedinside the sandbox. A user readingconfig/repositories.yaml.examplewouldn't catch this — only deep knowledge ofsandbox/docker-setup.py+ the multi-stagesandbox/Dockerfilereveals the trap.watch_filesmust enumerate every dependency manifest the build_commands touch, otherwise Docker layer caching either thrashes (rebuilds on unrelated changes) or silently serves stale dep installs.build_commandsmust be idempotent and run as root in a synthetic working directory under/tmp/repo-deps/— a different shape than the developer's local install flow. Easy to write something that works locally but fails (or no-ops) during the image build.checksmust match the project's actual lint/test commands, but there's no validator that the named commands actually exist in the repo's Makefile.- The config lives only on the operator's machine. Every onboarder has to rediscover the right
build_commands/persist_*/checksblock from scratch, even though the answers are deterministic per-repo and could ship with the repo.
The example file at config/repositories.yaml.example documents the schema but doesn't catch any of these errors at write time. The result is config that looks correct, builds successfully, and then quietly degrades the agent's behavior weeks later when something hits the broken codepath.
Proposal
Three tightly related changes that together cut the onboarding error surface to near zero.
1. Simplify the per-repo schema
Reduce the surface area where users can write config that looks right but is silently wrong. Concretely:
- Collapse
persist_dirs+persist_system_dirsinto a singlepersist:list. The loader classifies each entry as repo-relative vs absolute by the leading/and routes it into the right Docker stage internally. Callers stop having to know which list a path belongs in. (shared/egg_config/...andsandbox/docker-setup.pyare the touch points.) - Make
watch_filesderivable, not required. If omitted, infer from a built-in manifest catalog (pyproject.toml,uv.lock,package.json,pnpm-lock.yaml,package-lock.json,yarn.lock,go.mod,go.sum,Cargo.toml,Cargo.lock,requirements*.txt,Gemfile.lock). Users override only when the heuristic is wrong. This eliminates the most common cache-thrash / stale-deps footgun. - Make
checksderivable when conventional. If omitted, scan the repo'sMakefileforlint/testtargets (andpackage.jsonscriptsfor JS repos) and synthesize a defaultchecks:block. Explicitchecks:still wins. - Validate referenced Makefile targets at load time (not just runtime), so a typo in
make tsetis caught before the agent runs.
The intent is to keep the schema fully expressive but require only the irreducible bits per repo. Heuristics that guess wrong should be easy to override; heuristics that guess right should mean an empty/absent block is the common case.
2. Two config locations: repo defaults + local overrides
Today there's exactly one config file (~/.config/egg/repositories.yaml) and the operator must hand-author the per-repo block. Instead, support a layered model:
- Repo-level defaults at
.egg/repositories.yaml(or similar — see "Open questions") committed to the target repo. Contains only the per-repo block:build_commands,persist,watch_files,checks,auth_mode, etc. — i.e. the stuff that's a property of the repo, not of the operator. - User-level overrides at the existing
~/.config/egg/repositories.yaml. Continues to hold operator-scoped fields (github_username,bot_username,writable_repos,local_repos,default_reviewer,user_mode,github_sync,docker_setupextras) and may override or extend any per-repo field.
Merge semantics:
- Operator-scoped top-level keys (identities, access lists, local mounts) come exclusively from the user file.
- For each repo under
repo_settings.<owner/repo>: deep-merge repo-defaults ← user-overrides, with the user file winning at the leaf level. - List-valued fields (
checks,persist,watch_files): default behavior is replace, with an explicitextends:/+opt-in if/when we need additive merging. (Keep merge rules simple — surprising deep-merges of lists are a known footfgun.) - Lookup of repo defaults: when the operator runs egg against a checkout, look for
.egg/repositories.yamlin that checkout. Skip silently if absent (current behavior preserved).
Why this is worth the complexity: the per-repo block is deterministic given the repo (its languages, its lockfiles, its Makefile). It belongs in version control alongside the repo. Operator identity, access matrices, and local paths are not deterministic and stay user-side. Splitting along that seam means a new operator onboarding an already-instrumented repo gets correct defaults for free.
3. Add an 'onboard repo' skill
A skill (/onboard-repo <path>) — or an egg onboard <repo-path> CLI command — that introspects a target repo and generates a correct per-repo block, written by default to <repo>/.egg/repositories.yaml (the new repo-defaults location) so it can be committed.
Detection logic:
- Python (uv) —
pyproject.toml+uv.lock→ uv install +make deps(oruv sync); persist.venv+/usr/local/bin - Python (pip) —
requirements.txt→pip install -r requirements.txt; persist.venvif a venv is created - Node —
package.json+pnpm-lock.yaml/package-lock.json/yarn.lock→ corepack/pnpm-or-npm install; persistnode_modules - Go —
go.mod→ install Go to/usr/local/go,go mod download; persist/usr/local/go - Rust —
Cargo.toml→ install rustup,cargo fetch; persist~/.cargoandtarget/ - Mixed — combine the above (e.g. a large monorepo = Go + Node + Python)
Then parse the repo's Makefile (or package.json scripts, pyproject.toml [tool.poetry.scripts], etc.) for canonical lint/test command names and propose a checks: block.
Output: a YAML snippet that the skill writes to <repo>/.egg/repositories.yaml (or, if invoked without write permission to the repo, prints to stdout and offers to append to the user file as a fallback).
4. Validate existing config
Extend mcp__egg__validate_config (or add egg validate-config) to flag common misconfigurations across both layers:
build_commandsinstall something to a system path (/usr/local/bin,/opt/...) butpersistdoesn't include the parent dir → the install will be discarded between stagesbuild_commandsdeclarepersist_dirsthat the watch-files-only build context can't actually produce. The classic case (Sandbox agents in egg repo lack working .venv, silently fall back to system Python #2087): a uv/Python repo declarespersist_dirs: [.venv]and runsuv sync, but the build context contains onlyMakefile+pyproject.toml+uv.lock— no source dirs, noREADME.md— so the hatchling build backend errors trying to package the local project. Validator should heuristically detect "uv sync" / "pip install -e ." / "npm install" / etc. paired with a project that needs source files the watch_files don't include, and suggest the no-install-project pattern (or list the missing watch_files). Note: as of Fix #2087: fail loudly when sandbox build_commands silently break #2090,docker-setup.pyitself raises on this case at build time — but the validator should catch it at config-write time, before a wasted image rebuild.checks.commandreferences a Makefile target that doesn't exist in the repo's Makefilewatch_fileslists a manifest thebuild_commandsdon't appear to use, or omits one they do (heuristic: install-tool keywords likepip install,npm ci,go mod)local_repos.pathsentry doesn't exist on diskwritable_reposentries that don't appear underrepo_settings(probably fine, but worth flagging if they have non-default needs)checkpoint_repois well-formedowner/repoand (best-effort) accessible- Repo-defaults file at
<repo>/.egg/repositories.yamlcontains only per-repo-scoped keys (warn if it setsgithub_username,writable_repos, etc., which belong in the user file)
This is the safety net for users who hand-edit; the skill is the on-ramp for users who don't want to; the schema simplification raises the floor so even hand-authored configs are harder to get wrong.
Motivating examples
#2065 — root cause was a missing one-line persist_system_dirs: [/usr/local/bin] in the jwbron/egg block. The user had correctly identified that uv needed to be installed via build_commands; the schema's persistence model is what got them.
#2087 — same jwbron/egg block, different trap: persist_dirs: [.venv] paired with a make deps build command that ran uv sync on a watch-files-only context. The hatchling build backend tried to package the local egg project, errored out because README.md and the source dirs weren't in the build context, docker-setup.py warned-and-continued, and the image shipped with /opt/prebuilt-deps/ empty. Agents silently fell back to system Python for weeks. Fixed in #2090 by raising on the silent failure at build time and adding a make sandbox-deps target that does uv sync --no-install-project.
Both incidents share a shape: hand-authored config that looks correct, builds successfully, and produces an image that's quietly missing the deps the config promised. After the changes proposed here:
- The schema simplification means there's just
persist: [/usr/local/bin, .venv]— no decision to get wrong about which list a path belongs in. - The validator would catch both classes (missing system-dir persist; build-command-can't-produce-the-persist-target) at config-write time, before a wasted image rebuild.
- The skill would never produce either misconfiguration in the first place.
- The repo-defaults file means
jwbron/eggships its own correct block, and no future onboarder rediscovers the traps.
Open questions
- Filename for repo defaults.
.egg/repositories.yamlmirrors the user file naming. Alternatives:.egg.yaml(single-file),egg.yaml(visible at repo root). Mild preference for.egg/repositories.yamlsince.egg/gives us a place for future files (templates, per-repo cached state) without polluting the repo root. - Schema-versioning the repo file. A repo committing
.egg/repositories.yamlis exposing itself to schema churn. Aversion: 1field at the top, with the loader gracefully degrading on newer versions, is probably worth it from day one. - Whether
extends:/ template library belongs in this issue or a follow-up. The original issue listed it as out-of-scope; with repo-defaults landing here, deduplication via templates becomes more attractive but also more separable. Lean toward: ship without templates, revisit once we see how much per-repo config still duplicates across the fleet.
Out of scope (for follow-ups)
- Repo template library (
python-uv,node-pnpm, etc.) that usersextends:from - A web UI / wizard — the CLI/skill is enough to start
- Cross-repo dependency detection (e.g. a backend monorepo + its sibling frontend repo) — handle as a single combined block rather than auto-linking
- Migrating existing users' configs automatically — provide a one-shot
egg config migrateif needed, but don't block the change on it
Activity