Development
Development, build, and packaging
Source hot preview, build speed conventions, macOS and Web packaging, data/permissions, domain module recovery, and verification workflow.
On this page
This guide applies to Muteki's Rust mainline repository at FishCodeTech/muteki. Release packages and development checkouts are versioned independently; legacy Python/Electron build commands apply only to the archived v0.4.7 Python branch.
First build from source#
Install Node.js 22 / npm, stable Rust (edition 2024), sccache, C/C++ build tools, CMake, and pkg-config (plus OpenSSL dev headers on Linux; if using the SRC JavaScript signer, install bubblewrap / bwrap and Node with --permission). Exact CI dependencies are in build-packages.yml.
npm --prefix apps/frontend ci
node scripts/dev.mjs --webWeb serves on http://127.0.0.1:3101 and the Rust API on 127.0.0.1:8100. Cargo artifacts live in .cache/target using the shared local profile (opt-level = 3, lto = "off", incremental compilation) across dev, --hot, and install-macos.mjs --build so rebuilding does not invalidate dependency caches. node scripts/cargo.mjs tunes parallelism (~3 GiB/job) and prunes stale incremental directories (default 6 GiB / 3-day budget via scripts/prune-build-cache.py). Rust and Next.js build in parallel, reusing .next when source/lockfile hashes match (MUTEKI_FRONTEND_REBUILD=1 forces a rebuild).
Running node scripts/dev.mjs on macOS builds the Rust workspace and Next production frontend, then launches the native NSH macOS window (not the old Electron wrapper).
Applying changes after edits#
| Area changed | Action |
|---|---|
apps/frontend pages/components/styles | node scripts/dev.mjs --hot --web (3103 / .next-dev); omit --web on macOS for Desktop window |
| Rust server, scheduler, Runner, Desktop shell | Rebuild affected crate and restart the dev command you launched; --hot does not recompile running Rust binaries |
| Production frontend | npm --prefix apps/frontend run build and restart Web |
| macOS app package | Local install (quit app first): node scripts/install-macos.mjs --build --open (local profile). Release zip: node scripts/package-macos.mjs --zip (release profile) |
| Web release archive | node scripts/package-web.mjs |
| Worker tools or container runtime | Rebuild with ./docker/worker/build.sh as documented in Docker containers and images |
Domain modules and recovery#
Chat, CTF (single-task + competitions), Pentest, and SRC run inside the same Rust server process with isolated module readiness tracking:
/api/readinessreports shared core readiness plus per-module state undermodules. One module failing does not take the entire server offline./api/domain-modulesexposesregistered/ready/unavailable/disabledstates. After fixing the root cause, retry in Settings → Operations or sendPOST /api/domain-modules/{id}/retryto recover in place while preserving active tasks and receipts (builtin.single-security-taskandbuiltin.competitionshare the CTF boundary).- Disabling a module halts new work intake without forcefully killing in-flight external actions.
Data directories, permissions, and protocol details#
- State directory: Dev scripts default to
<repo>/.state(overridable viaMUTEKI_STATE_DIR). InstalledMuteki.appstores data in~/Library/Application Support/Muteki/data(frontend cache in~/Library/Caches/Muteki/frontend). - Linux headless browser: Never relies on
--no-sandbox; if the server runs asroot, background headless browser features disable cleanly (chat.browser.headless_root_disallowed) while iframe and Desktop previews continue to work. Run under a non-root user on Linux when headless browsing is needed. - Host logins vs. containers: Host Workers can reuse host CLI logins; container and remote Workers strictly use injectable credentials projected per Run and never mount host private CLI directories directly.
- Codex sidebar grouping & history backfill: Configure existing Codex group names under the Codex instance settings; backfill historical Muteki-created Codex threads read-only using
python3 scripts/list-codex-threads.py --state-dir .... - AGY (
agy.acp) integration: Launches with--process-per-sessionand subscribes to per-session nativeStreamAgentStateUpdateswith loopback verification and per-session CSRF tokens so turns finalize accurately at nativefullyIdle. - Multi-agent orchestration & permissions: Configured roles dispatch via
muteki_collab_discover/muteki_collab_call(muteki_start_thread). Default child execution policy under Settings → Orchestration / Settings → Control applies to newly created child threads only. - HTTP vs. HTTPS: Web mode serves HTTP by default; enable built-in TLS by passing paired
MUTEKI_WEB_TLS_CERTandMUTEKI_WEB_TLS_KEY, or terminate TLS behind Nginx/Caddy/Traefik.
Verification workflow#
Before opening PRs on muteki:
- Run
node scripts/verify/run.mjs --doctorto verify.stateisolation (MUTEKI_STATE_DIR) and port ownership (8100/3101/3103). - Run
node scripts/verify/run.mjsfor custom lint rules,eslint/tsc, contract checks,fast-check,cargo clippy, andproptest. - Verify live end-to-end flows on Web via
kimi-webbridge(never Playwright) and Desktop dev windows viacua-driver(never operating on the installed/Applications/Muteki.app), then stamp commits withnode scripts/verify/run.mjs --record-e2e ... --stamp.
Self-hosting Muteki development#
See Developing Muteki with Muteki for binding your working checkout inside Muteki.app, running dev verification instances, and safely updating the installed macOS app.

