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.

Shell
npm --prefix apps/frontend ci
node scripts/dev.mjs --web

Web 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 changedAction
apps/frontend pages/components/stylesnode scripts/dev.mjs --hot --web (3103 / .next-dev); omit --web on macOS for Desktop window
Rust server, scheduler, Runner, Desktop shellRebuild affected crate and restart the dev command you launched; --hot does not recompile running Rust binaries
Production frontendnpm --prefix apps/frontend run build and restart Web
macOS app packageLocal 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 archivenode scripts/package-web.mjs
Worker tools or container runtimeRebuild 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/readiness reports shared core readiness plus per-module state under modules. One module failing does not take the entire server offline.
  • /api/domain-modules exposes registered / ready / unavailable / disabled states. After fixing the root cause, retry in Settings → Operations or send POST /api/domain-modules/{id}/retry to recover in place while preserving active tasks and receipts (builtin.single-security-task and builtin.competition share 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 via MUTEKI_STATE_DIR). Installed Muteki.app stores 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 as root, 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-session and subscribes to per-session native StreamAgentStateUpdates with loopback verification and per-session CSRF tokens so turns finalize accurately at native fullyIdle.
  • 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_CERT and MUTEKI_WEB_TLS_KEY, or terminate TLS behind Nginx/Caddy/Traefik.

Verification workflow#

Before opening PRs on muteki:

  1. Run node scripts/verify/run.mjs --doctor to verify .state isolation (MUTEKI_STATE_DIR) and port ownership (8100 / 3101 / 3103).
  2. Run node scripts/verify/run.mjs for custom lint rules, eslint / tsc, contract checks, fast-check, cargo clippy, and proptest.
  3. Verify live end-to-end flows on Web via kimi-webbridge (never Playwright) and Desktop dev windows via cua-driver (never operating on the installed /Applications/Muteki.app), then stamp commits with node 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.

Documentation pages

↑↓Select↵OpenescClose