name: moon-build-orchestration
description: >-
Adopt moonrepo/moon as the build orchestration layer above cargo/pnpm/vite/tauri.
Moon adds: content-hash-based task caching (BLAKE3), affected-change detection
(only rebuild what the PR touched), DAG-parallel task execution, and optional
remote cache (Bazel RE v2). Use when the monorepo's build time is unacceptable,
when OOM from parallel Tauri builds is occurring, or when CI needs affected-only
builds. Moon wraps existing tools — it does NOT replace cargo, pnpm, or tauri.
Recommendation from moonrepo ingest: ADOPT-AS-TOOL (8/10), do NOT fork.
status: stable
lane: [infra, build, ci]
type: tooling-adoption
trigger: >-
"moon build", "moonrepo", "affected builds", "build orchestration",
"build caching", "speed up monorepo build", "only rebuild what changed",
"tauri build oom", "parallel build oom"
source-ingest: .planning/ingest/2026-06-07-article-github-com-moonrepo-moon.md
port-score: 8.0/10 (adopt-as-tool)
argument-hint: --target : [--affected]
moon-build-orchestration
Wraps our monorepo build tools (cargo, pnpm, vite, tauri) with a content-hash cache, affected-detection, and parallel DAG execution via moonrepo/moon.
NOT a code port — moon is adopted as a binary tool via proto. Ingest recommendation: ADOPT, do NOT fork or vendor.
Why adopt moon
- OOM prevention — affected-detection means CI/CD only runs
cargo buildfor crates that CHANGED, not all 70+ crates. Directly addresses the OOM parallel-Tauri-build issue (memoryfeedback_serialize_heavy_tauri_builds_oom) - Cache reuse — BLAKE3 content hash means a re-run of the same commit hits cache instantly (hydrates tarred output, skips compilation entirely)
- Affected detection —
moon run --affected :buildruns only build tasks for projects touched by the current git diff vs defaultBranch - Stack orthogonal — moon does NOT replace gad (planning/STATE.xml) or xp/gad CLI; it sits between gad and cargo/pnpm
Adoption workflow (3-day estimate)
Day 1 — Bootstrap
# Install proto (moon's toolchain manager)
curl -fsSL https://moonrepo.dev/install/proto.sh | sh
# Install moon via proto
proto install moon
# Init workspace at repo root
moon init # generates .moon/workspace.yml + .moon/toolchains.yml
Day 2 — Wire priority projects
For each of: apps/kael, apps/meshboard, apps/ide, crates/xp,
packages/magicborn-cli:
# <project>/moon.yml
language: rust # or node
type: application|library
tasks:
build:
command: cargo build --release
inputs:
- "src/**/*"
- "Cargo.toml"
outputs:
- "target/release/<name>"
check:
command: cargo check --message-format=short
inputs:
- "src/**/*"
- "Cargo.toml"
Day 3 — Wire CI / affected detection
# In CI pipeline:
moon run --affected :build # builds only changed projects
moon run --affected :test # tests only projects with changes
moon run --affected :check # type/lint checks for changed only
# Remote cache (optional, Depot.dev or self-hosted bazel-remote):
# .moon/workspace.yml → remote: { host: 'grpcs://cache.depot.dev', ... }
Stack order
gad (planning) → moon (build orchestration) → cargo/pnpm/vite/tauri (compile)
Moon does NOT interfere with:
- sccache (operates at rustc level; moon operates at task level — they stack)
- release-fast profile (cargo args pass through; moon keys cache per --profile)
- pnpm workspaces (moon discovers pnpm packages as projects; pnpm manages lockfile)
Config reference
# .moon/workspace.yml
projects:
globs:
- 'apps/*'
- 'crates/*'
- 'packages/*'
- 'sites/*'
vcs:
manager: git
defaultBranch: main
# .prototools (pin toolchain versions)
node = "22.14.0"
rust = "stable"
bun = "1.2.2"
Anti-patterns
- Do NOT fork moon — consume pinned binary via proto; moon releases weekly
- Do NOT replace sccache with moon's cache — they are different layers; use both
- Do NOT add moon tasks for tasks that already run fast (<5s); cache overhead is not worth it for trivial scripts
- Do NOT use
moon run :buildin non-CI contexts if you are already runningcargo builddirectly — moon adds value for multi-project orchestration, not single-crate builds
Provenance
- Source: moonrepo/moon (MIT) —
.planning/ingest/2026-06-07-article-github-com-moonrepo-moon.md - Recommendation: ADOPT-AS-TOOL (8/10), do NOT fork (4.2/10)
- Key insight: affected-detection + content-hash cache directly solve our OOM parallel-build problem without any source modification
- Built: 2026-06-07