Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ When changing plugin content:
- Update substantive docs like `README.md` when the plugin behavior, inventory, or usage changes.
- When adding a user-facing skill, document it: create a `docs/guides/<skill-name>.md` page (purpose, novel mechanics, when to use, chain position — follow the shape of the existing pages), add a catalog row under the right category in `docs/guides/README.md`, add a situation row to `skills/ce-help/references/skill-map.md` (marked `(manual)` when the skill sets `disable-model-invocation`; the test suite checks both), and bump the skill count in `tests/release-metadata.test.ts`. `docs/guides/README.md` is the **only** place a skill's prose description is maintained. The root `README.md` carries a grouped overview that lists skill *names* under a category, so a new skill also needs its name added to the right group row and the three stated skill counts bumped (badge, intro, section lead). `tests/release-metadata.test.ts` enforces that every skill name appears in that overview exactly once, that no unknown name appears, and that the three counts match the skill directories under `skills/` (each with a `SKILL.md`) — so the suite catches a missing name, a stale count, or a name left behind during a move. Choosing the *right* group is yours; a test that knew the correct category per skill would be the second inventory this arrangement exists to avoid — the previous three-way sync of full descriptions was unenforced and had already drifted, which is why descriptions now live in exactly one place. Every current user-facing skill has a page, including `lfg` and `ce-dogfood`.
- When a skill starts or stops running another skill, update the interplay stated in `skills/ce-help/references/workflow.md`; `tests/skills/ce-help-contract.test.ts` fails until the two agree. Re-run `tests/skill-eval-cell/packs/ce-help-routing.md` after a change to how skills hand off.
- When adding, removing, renaming, or changing the meaning/default/consumer of a `.compound-engineering/config.yaml` option, update `skills/ce-setup/references/config-template.yaml`, its byte-identical `.compound-engineering/config.example.yaml` copy, the centralized `docs/guides/configuration.md` reference, and the affected consumer skill docs in the same change. Any template edit also bumps the header's version line, re-pins `tests/fixtures/ce-config-template-pin.json`, and appends new lines to `skills/ce-setup/references/config-template-lines.txt`. A removed key gets an entry in `skills/ce-setup/references/retired-config-keys.yaml`. `tests/skills/ce-setup-config-template.test.ts` enforces all of this. Ordinary keys may also live in optional checkout-local `config.local.yaml` (overrides the repo file). `docs_root` belongs only in `config.yaml`. Durable team instructions still belong in the project's normal agent-instructions mechanism.
- When adding, removing, renaming, or changing the meaning/default/consumer of a `.compound-engineering/config.yaml` option, update `skills/ce-setup/references/config-template.yaml`, its byte-identical `.compound-engineering/config.example.yaml` copy, the centralized `docs/guides/configuration.md` reference, and the affected consumer skill docs in the same change. Any template edit also bumps the header's version line, re-pins `tests/fixtures/ce-config-template-pin.json`, and appends new lines to `skills/ce-setup/references/config-template-lines.txt`. A removed key gets an entry in `skills/ce-setup/references/retired-config-keys.yaml`. `tests/skills/ce-setup-config-template.test.ts` enforces all of this. Ordinary keys may also live in optional `config.local.yaml` in the checkout, or in the primary worktree's copy for a linked worktree with none (overrides the repo file). `docs_root` belongs only in `config.yaml`. Durable team instructions still belong in the project's normal agent-instructions mechanism.
- Do not hand-bump release-owned versions in plugin or marketplace manifests.
- Do not hand-add release entries to `CHANGELOG.md` or treat it as the canonical source for new releases.
- Run `bun run release:validate` if agents, commands, skills, MCP servers, or release-owned descriptions/counts may have changed.
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/ce-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ Skip it when:
## FAQ

**What is `compound-engineering.local.md` and why is it obsolete?**
It was the old machine-local config file. Team defaults now live in `.compound-engineering/config.yaml`, and `config.local.yaml` is the optional per-checkout override. Review-agent selection is automatic.
It was the old machine-local config file. Team defaults now live in `.compound-engineering/config.yaml`, and `config.local.yaml` is the optional per-checkout override, which a linked worktree with none inherits from the primary worktree. Review-agent selection is automatic.

**Why gitignore `.compound-engineering/config.local.yaml`?**
It is a per-checkout override, so committing it defeats the point. The committed `config.example.yaml` shows the available settings. Setup creates the repo file, never the override.
It is a per-checkout override (a linked worktree with none inherits the primary worktree's), so committing it defeats the point. The committed `config.example.yaml` shows the available settings. Setup creates the repo file, never the override.

---

Expand Down
5 changes: 3 additions & 2 deletions docs/guides/configuration.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Compound Engineering configuration

Compound Engineering keeps optional repo defaults in `.compound-engineering/config.yaml`. Ordinary keys may also live in `.compound-engineering/config.local.yaml`, which overrides the repo file per key. Both files are visible to every supported harness that opens the same checkout.
Compound Engineering keeps optional repo defaults in `.compound-engineering/config.yaml`. Ordinary keys may also live in `.compound-engineering/config.local.yaml`, which overrides the repo file per key. Both files are visible to every supported harness that opens the same checkout; a linked worktree with no `config.local.yaml` of its own reads the primary worktree's.

Run `/ce-setup` to create `config.yaml` and refresh the committed `.compound-engineering/config.example.yaml`. Setup does not create `config.local.yaml`. The template's header carries a `# ce-config-template-version:` line. When `config.yaml` has an older version, setup rebuilds it on the current template with every setting kept (see the [ce-setup guide](./ce-setup.md#what-it-fixes)). Uncomment only the keys you want to change. Do not put credentials, CLI commands, or harness flags in either file.

## How keys resolve

- **Ordinary keys:** read `config.local.yaml`, then `config.yaml`. The first active (non-commented) value wins. A missing file is skipped. Invalid or empty scalars continue to the next layer, then the skill default. A present list or map, including empty, replaces the whole key.
- **Linked worktrees:** when this checkout is a linked worktree and has no `config.local.yaml`, the local layer is the primary worktree's copy — the main worktree `git worktree list --porcelain` reports first, and only when that path is a checkout itself. A primary whose checkout path git cannot name — for example one created with `--separate-git-dir` — leaves the local layer absent rather than reading another directory. A local file in this checkout still wins, and `config.yaml` stays this checkout's.
- **`docs_root`:** read only from `config.yaml`. A `docs_root` in `config.local.yaml` is ignored.
- **Gitignore does not change resolution.** Either file works whether ignored or committed.
- A current-task instruction still wins over config. Session and project instructions already in context can override or narrow it.
Expand Down Expand Up @@ -81,7 +82,7 @@ Config is a default, not another agent-instructions file:
- Each skill's runtime contract still decides whether a setting applies. For example, model elevation takes effect on whichever harness can reach the requested model.
- Some skills define a more specific preference order for their own routing. Their skill page documents that order.

Committed `config.yaml` is shared across worktrees of the same project. `config.local.yaml` is per-checkout. CE Work resolves delegation before it creates detached worker worktrees, so an already-selected route is carried into that run.
Committed `config.yaml` is shared across worktrees of the same project. `config.local.yaml` is per-checkout, and a linked worktree with none inherits the primary worktree's. CE Work resolves delegation before it creates detached worker worktrees, so an already-selected route is carried into that run.

## Options

Expand Down
6 changes: 3 additions & 3 deletions skills/ce-brainstorm/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Resolve `<root>` the first time you compose or read a `<root>/` path, never earl
`brainstorm_output` and `brainstorm_model` resolve by this rule instead:

<!-- ce-config-layers:start -->
**Resolve ordinary CE yaml keys from the two repo files.**
**Resolve CE yaml keys from the config files.**

- **Read** `<repo-root>/.compound-engineering/config.local.yaml`, then `config.yaml` (`<repo-root>` = `git rev-parse --show-toplevel`). Missing files are skipped. Gitignore does not change resolution.
- **Win** with the first active (non-commented) value. For scalars, empty is unset; an invalid value continues to the next layer, then the skill default. For lists and maps, a present key — including an empty list or map — replaces the whole key.
- **Read** `<repo-root>/.compound-engineering/config.local.yaml` — or the primary worktree's copy of it when this checkout is a linked worktree with no local file — then `config.yaml` (`<repo-root>` = `git rev-parse --show-toplevel`). Missing files are skipped. Gitignore does not change resolution.
- **Win** with the first active (non-commented) value: empty scalars are unset, an invalid value continues to the next layer, then the skill default; a present list or map — including an empty list or map — replaces the whole key.
- **Do not** use this rule for `docs_root` — that key is `config.yaml` only.
<!-- ce-config-layers:end -->

Expand Down
44 changes: 40 additions & 4 deletions skills/ce-brainstorm/scripts/packs-resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"""Resolve the Compound Packs declared in this repo's CE config into pack roots.
Reads the `packs:` list from `<repo-root>/.compound-engineering/config.yaml`
and `config.local.yaml` (both layers concatenate; local adds, never replaces),
and `config.local.yaml` (both layers concatenate; local adds, never replaces).
A linked worktree with no local file reads the primary worktree's, and that
file's relative sources resolve against the primary worktree.
validates each entry, resolves path and git sources, enumerates the packs each
source publishes, applies selection, and prints one JSON object to stdout:
Expand Down Expand Up @@ -659,6 +661,28 @@ def _emit(declared_only: bool, entries: list, roots: list, warnings: list, error
return 0


def _primary_worktree_root(repo_root: str) -> str | None:
"""The main worktree's root when `repo_root` is a linked worktree. None for
the main worktree itself, a submodule, or when git cannot answer."""
if shutil.which("git") is None:
return None
proc = subprocess.run(["git", "worktree", "list", "--porcelain"], cwd=repo_root,
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True)
if proc.returncode != 0:
return None
for line in proc.stdout.splitlines():
if line.startswith("worktree "):
main = line[len("worktree "):].strip()
if not main or os.path.realpath(main) == os.path.realpath(repo_root):
return None
probe = subprocess.run(["git", "-C", main, "rev-parse", "--show-toplevel"],
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True)
if probe.returncode != 0 or os.path.realpath(probe.stdout.strip()) != os.path.realpath(main):
return None
return main
return None


def _repo_root() -> str | None:
"""The enclosing checkout's top level: git's answer when git is on PATH,
otherwise the nearest ancestor of the working directory holding a `.git`
Expand Down Expand Up @@ -692,8 +716,20 @@ def _main(argv: list) -> int:
warnings.append("not inside a git repository; no CE config to read")
return _emit(args.declared_only, entries, roots, warnings, errors)
cfg_dir = os.path.join(repo_root, ".compound-engineering")
for name in CONFIG_FILES:
entries.extend(parse_packs_block(os.path.join(cfg_dir, name), errors))
sources = [(os.path.join(cfg_dir, CONFIG_FILES[0]), repo_root)]
local_path = os.path.join(cfg_dir, CONFIG_FILES[1])
local_base = repo_root
if not os.path.isfile(local_path):
primary = _primary_worktree_root(repo_root)
if primary is not None:
inherited = os.path.join(primary, ".compound-engineering", CONFIG_FILES[1])
if os.path.isfile(inherited):
local_path, local_base = inherited, primary
sources.append((local_path, local_base))
for path, base in sources:
for entry in parse_packs_block(path, errors):
entry["_base_root"] = base
entries.append(entry)

if args.declared_only:
for entry in entries:
Expand All @@ -702,7 +738,7 @@ def _main(argv: list) -> int:

for entry in entries:
try:
resolve_entry(entry, repo_root, roots, warnings, errors)
resolve_entry(entry, entry.get("_base_root", repo_root), roots, warnings, errors)
except Exception as exc: # one entry's surprise is that entry's error, not everyone's
errors.append(f"{_entry_label(entry)}: unexpected error resolving entry: {exc}")

Expand Down
6 changes: 3 additions & 3 deletions skills/ce-code-review/references/cross-model-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Pass `XHOST_HARNESS` as `CROSS_MODEL_HOST_HARNESS`; pass `XHOST_FAMILY` as the f
Claude Code, Codex, and Grok each serve their own model family, so the snippet takes the family from that harness's marker when it is the only such marker present. Another harness can copy one of those markers (oh-my-pi sets `CLAUDECODE=1` whatever model serves it), and a session started from inside another harness inherits that harness's marker. So the snippet leaves family `unknown` on a harness that serves any model (oh-my-pi or Pi) or when more than one of those markers is present. Pass a family the snippet names. When the snippet yields harness `omp` or `pi`, still pass `unknown` and start the job: the worker reads the serving family from the model that harness's session records and skips when it names no first-party model. Elsewhere, where the snippet leaves family `unknown`, set it only from a model id the runtime publishes as the model serving this session, and only when that id maps to `codex`, `claude`, `grok`, `composer`, or `gemini`. A requested model, the model's own claim, and the product name are not that id. Never infer serving family from the Cursor brand. Otherwise an unknown host family cannot pass the automatic same-family check, so skip the automatic cross-model pass.

<!-- ce-config-layers:start -->
**Resolve ordinary CE yaml keys from the two repo files.**
**Resolve CE yaml keys from the config files.**

- **Read** `<repo-root>/.compound-engineering/config.local.yaml`, then `config.yaml` (`<repo-root>` = `git rev-parse --show-toplevel`). Missing files are skipped. Gitignore does not change resolution.
- **Win** with the first active (non-commented) value. For scalars, empty is unset; an invalid value continues to the next layer, then the skill default. For lists and maps, a present key — including an empty list or map — replaces the whole key.
- **Read** `<repo-root>/.compound-engineering/config.local.yaml` — or the primary worktree's copy of it when this checkout is a linked worktree with no local file — then `config.yaml` (`<repo-root>` = `git rev-parse --show-toplevel`). Missing files are skipped. Gitignore does not change resolution.
- **Win** with the first active (non-commented) value: empty scalars are unset, an invalid value continues to the next layer, then the skill default; a present list or map — including an empty list or map — replaces the whole key.
- **Do not** use this rule for `docs_root` — that key is `config.yaml` only.
<!-- ce-config-layers:end -->

Expand Down
6 changes: 3 additions & 3 deletions skills/ce-code-review/references/subagent-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ If the user's or project's active instructions or the live prompt name a model f
**Configured model.** `review_subagents` in CE config is the model configured for this subagent's role. Read it under this rule:

<!-- ce-config-layers:start -->
**Resolve ordinary CE yaml keys from the two repo files.**
**Resolve CE yaml keys from the config files.**

- **Read** `<repo-root>/.compound-engineering/config.local.yaml`, then `config.yaml` (`<repo-root>` = `git rev-parse --show-toplevel`). Missing files are skipped. Gitignore does not change resolution.
- **Win** with the first active (non-commented) value. For scalars, empty is unset; an invalid value continues to the next layer, then the skill default. For lists and maps, a present key — including an empty list or map — replaces the whole key.
- **Read** `<repo-root>/.compound-engineering/config.local.yaml` — or the primary worktree's copy of it when this checkout is a linked worktree with no local file — then `config.yaml` (`<repo-root>` = `git rev-parse --show-toplevel`). Missing files are skipped. Gitignore does not change resolution.
- **Win** with the first active (non-commented) value: empty scalars are unset, an invalid value continues to the next layer, then the skill default; a present list or map — including an empty list or map — replaces the whole key.
- **Do not** use this rule for `docs_root` — that key is `config.yaml` only.
<!-- ce-config-layers:end -->

Expand Down
Loading
Loading