Architecture Guide for bombyx Project

VerifiedSafe

Overview of the bombyx Rust CLI architecture: module layout, responsibilities, and how to extend it safely.

Sby Skills Guide Bot
DevelopmentIntermediate
9/6/2026
Claude CodeCursorCodex
#rust#architecture#codebase-navigation#cli#quality-gates

Recommended for

Automated summary

Documents the architecture of the bombyx Rust CLI: crate layout, each module's responsibilities, quality gate thresholds and core design constraints.

Strengths

  • Breaks responsibilities down per module (config, remote, plan, doctor, update, xtask) naming the key types and functions
  • States measurable, enforceable quality gates (clippy -D warnings, 90%/85% coverage, ≤ 6% duplication, no unsafe, RUSTSEC clean)
  • Makes the load-bearing constraint explicit: neither the workstation nor the VM host reads project files, everything is regenerated from config.toml
  • Points to the single source of the version number and explains how a subcommand is planned then executed

Limitations

  • Tied to the bombyx repository, not reusable on another project
  • The provided document cuts off at the quality gates table: the advertised 'how to add a feature' walkthrough is not included
  • Gives no concrete sample config.toml or RemoteCommand
When to use it

Use it when working inside the bombyx repo and you need to find the right module or check which quality gates a change must pass.

When not to use it

Not useful for a different Rust project, nor for learning to install and operate bombyx as an end user.

Security analysis

Safe
Quality score88/100

This is a project architecture document with no declared tools, no executable instructions, and no destructive, exfiltrating, or obfuscated actions. It only references normal Rust build, testing, and quality-gate commands.

No concerns found

How this analysis is made

Examples

Locate a new subcommand
I want to add a `bombyx snapshot` subcommand. Which files in this repo do I need to touch, and how does plan() wire a subcommand to its commands?
Check merge gates
What clippy, coverage and duplication thresholds does bombyx enforce, and what does the config module need to satisfy before I open a PR?
Understand the trust boundary
Why does bombyx regenerate the Vagrantfile and bootstrap script on every boot instead of letting the VM host read the project files?

name: architect description: Project overview and architecture guide for bombyx -- crate layout, responsibilities, quality gates, and how to add a feature.

bombyx Architecture

Project Identity

| Field | Value | |-------|-------| | Language | Rust (edition 2024, stable toolchain) | | Shape | CLI only -- no services, no frontend | | License | MIT | | Version | crates/bombyx/Cargo.toml (single source) | | Versioning | SemVer 2.0.0 | | Platforms | Windows (workstation), Linux | | Template | derived from breki/rustbase |

What bombyx Does

Drives isolated AI-agent VMs on a libvirt host, usually a second machine reached over SSH. The control plane is deliberately thin: bombyx generates a Vagrantfile and a bootstrap script, writes them onto the VM host and runs vagrant there, streaming output back. When host names the machine bombyx is running on, the same script goes through sh -c instead.

The key architectural constraint: neither the workstation nor the VM host reads the project's files. Both generated files come out of the operator's own config.toml and are rewritten on every boot, so the host cannot drift, and the guest clones the project itself once it is running. See docs/trust-boundary.md.

Repository Layout

bombyx/
  .cargo/
    config.toml         # cargo xtask alias
  .claude/
    hooks/              # Claude Code hook scripts
    commands/           # slash commands
    skills/             # domain knowledge skills
    settings.json       # hook configuration
  crates/
    bombyx/
      src/
        lib.rs          # crate root, re-exports
        plan.rs         # which commands run, in what order
        config.rs       # config.toml parsing (submodules)
        remote.rs       # command building, either route
        vagrantfile.rs  # renders the two generated files
        doctor.rs       # preflight checks (submodules)
        update.rs       # self-update (submodules)
        name.rs term.rs tool.rs
        bin/bombyx/
          main.rs       # CLI entry point (thin)
      tests/
        integration_test.rs
  xtask/
    src/
      main.rs           # build automation
  scripts/              # bash wrappers
  docs/
    developer/
      DIARY.md          # development diary
      redteam-log.md    # security review findings
      artisan-log.md    # quality review findings

Module Responsibilities

config -- project configuration

Parses the operator's config.toml: a file-wide host, and one [projects.<name>] table per project carrying remote_root, an optional host, [vm] and [source]. Config::load_project(name, registry) is the one loader, and config::host::rank picks between the two host keys, the project's own winning. Every host in the file is checked as the file is read, so holding a Registry proves they all passed. Typed errors via thiserror. Computes remote paths (remote_project_dir, remote_scratch_dir).

remote -- command construction

Pure functions returning a RemoteCommand { program, args, dir }. Nothing here spawns a process. That separation is what makes quoting, path joining and command composition unit-testable with no VM host in the loop.

Includes shell_quote for POSIX single-quote escaping -- every value interpolated into a remote script goes through it.

bin/bombyx/main.rs -- entry point

Clap parsing, then plan() maps a subcommand to a sequence of Commands, which are either printed (--dry-run) or executed. Kept thin because coverage excludes src/bin/.

xtask -- build automation

Not published. validate, test, clippy, fmt, coverage, dupes, audit, dep-age*.

Quality Gates

| Gate | Threshold | |------|-----------| | Clippy | Zero warnings (-D warnings) | | Formatting | cargo fmt --check | | Coverage | 90% overall, 85% per module | | Duplication | <= 6% (production code) | | Unsafe code | Forbidden (#[forbid(unsafe_code)]) | | Advisories | RUSTSEC clean |

cargo xtask validate runs every gate; the six above are the ones worth memorising, and CLAUDE.md under Definition of Done lists them all in execution order.

The Claude Code Stop hook runs a subset: fmt-check, clippy, doc and test. It skips coverage and duplication deliberately, because both are slow -- see .claude/hooks/stop-check.sh. A coverage regression is caught by validate, not by the hook.

Adding a New Subcommand

  1. Write tests first (TDD).
  2. Add the command-building function in remote.rs with unit tests asserting the exact argv. There are two argv shapes, one per route, so assert both -- see Config::for_tests_local.
  3. Add the VmCmd variant and its action_of arm in main.rs -- the CLI surface, and nothing else.
  4. Add the Action variant and its plan() arm in plan.rs, with the unit test asserting the ordered commands. This is where the logic goes: main.rs is excluded from coverage.
  5. Add an integration test driving the real binary with --dry-run.
  6. Run cargo xtask validate.
  7. Commit with /commit.

Keep logic out of main.rs: it is excluded from coverage, so anything non-trivial there ships untested.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/architecture-guide-for-bombyx-project-mtpag76o/download' --output '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md.part' && mv '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md.part' '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && test -s '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/architect' && cp -R '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o' '.claude/skills/architect'

Cursor
test -f '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && test -s '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/architect' && cp -R '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o' '.cursor/skills/architect'

Codex
test -f '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && test -s '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/architect' && cp -R '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o' '.agents/skills/architect'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o'

openskills read 'architecture-guide-for-bombyx-project-mtpag76o'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills