[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6993T7FVZVSVTRQNJCYVYEA":3,"skill-same:01M6993T7FVZVSVTRQNJCYVYEA":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":31,"linkOnly":32,"markdownContent":33,"markdownBody":34,"frontMatter":35,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":39,"repositoryHtmlUrl":40,"repositoryHomepageUrl":7,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":43,"updatedAt":44,"install":45,"resources":58},"01M6993T7FVZVSVTRQNJCYVYEA","dev-capsem","dev-capsem 能力语义",null,"","google\u002Fcapsem","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M69939YZJTP726NQK4NZNB48",186,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fdev-capsem\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BSTR9G4A4GZ0VB2DFN9490","开发环境与工具链管理","SCENARIO","使用场景",[30],"dev capsem","2026-11-10 10:12:30",false,"---\nname: dev-capsem\ndescription: Capsem project overview and navigation: what it is, how the crates fit, which skill owns what. Start here when orienting on any task.\n---\n\n# Capsem\n\nCapsem sandboxes AI agents in air-gapped Linux VMs on macOS using Apple's Virtualization.framework (with KVM for Linux). Runs as a daemon service (like Docker). Built with Rust and Astro.\n\n## Engineering standard\n\nQuality, security and performance are P0 and every coding agent's\nresponsibility. See something, say something, do something.\nWhen you notice a defect or an improvement while working -- a bug, a fragile\npath, a lint or guard failure, a small refactor that clarifies, a way to make\nsomething faster or more reliable, a vulnerable dependency -- do not walk past\nit as \"not my problem.\" Small: fix it test-first (`\u002Fdev-testing`) and commit\nit in its own scoped commit. Too big to fold in: open a GitHub bug with enough\ndetail to act on. A vulnerability is fixed immediately, test-first, in its own\n`security:` commit -- never parked, never filed publicly while unfixed. Stop\nto ask only for genuine judgment calls (user-visible behavior, weakening a\nsecurity boundary, real scope, or a maintainer's dependency choice), and even\nthen lead with a recommendation. The full contract is\n`AGENTS.md` -> \"Fix what you find\".\n\n## Crate map\n\n| Crate | What | Key modules |\n|-------|------|-------------|\n| `capsem-foundation` | Dependency-light host primitives shared across product crates. | `paths.rs`, `uds.rs`, `poll.rs`, `telemetry.rs`, `log_layer.rs`, `ipc_handshake.rs` |\n| `capsem-cache` | Bounded observable cache mechanics; callers own freshness policy. | `bounded.rs`, `snapshot.rs`, `telemetry.rs` |\n| `capsem-archive` | Append-only, block-compressed body archive for one session ledger. | `format.rs`, `writer.rs`, `reader.rs` |\n| `capsem-crypto` | Accelerated hashes, integrity verification, randomness, TLS keys, JWT verification, signatures, and secret handling. | `verify.rs`, `random.rs`, `tls.rs`, `jwt.rs`, `secrets.rs` |\n| `capsem-ledger` | Confined session-ledger worker and archive codec executor. | `main.rs`, `codec.rs` |\n| `capsem-telemetry` | Single owner of every `metrics`-facade metric name, kind, unit, and description. Emitters import names from here. | `lib.rs` (`MetricSpec`, `describe_all`), `db.rs`, `dns.rs`, `mitm.rs`, `security.rs`, `virtio_blk.rs` |\n| `capsem-assets` | VM asset lifecycle and manifest compatibility. | `asset_manager.rs`, `manifest_compat.rs` |\n| `capsem-api` | Gateway wire types and OpenAPI contract. | `document.rs`, `hypervisor.rs`, `vm_info.rs` |\n| `capsem-sdk` (`sdk\u002Frust`) | Async HTTP gateway clients, shared API DTOs, and bounded local gateway discovery. | `transport.rs`, `hypervisor.rs`, `local.rs` |\n| `capsem-config` | Product config contracts, parsing, validation, and provider\u002FMCP identity. | `types.rs`, `validation.rs`, `provider_profile.rs`, `mcp.rs`, `resolver.rs` |\n| `capsem-credentials` | Credential provider contracts and durable credential storage. | `provider.rs`, `store.rs`, `durable.rs` |\n| `capsem-core` | VM, hypervisor, security-engine, network-intercept, and session-runtime domain library. | `vm\u002F`, `net\u002F`, `security_engine\u002F`, `mcp\u002F`, `hypervisor\u002F`, `image.rs` |\n| `capsem-service` | Daemon service. Axum HTTP over UDS, VM lifecycle. | `main.rs` (routes, IPC), `api.rs` (request\u002Fresponse types) |\n| `capsem-process` | Per-VM process. Boots VM, bridges vsock, job store. | `main.rs` (vsock setup, IPC handler) |\n| `capsem-proxy` | Confined HTTP\u002FDNS proxy worker for VM and standalone traffic. | `main.rs` |\n| `capsem` | CLI client. Rust SDK over authenticated gateway HTTP; local status\u002Fasset administration and startup use UDS. | `main.rs` (create, resume, shell, list, exec, run, stop, delete, persist, purge, info, logs, restart, version, doctor, fork, image) |\n| `capsem-tui` | Terminal control UI over the gateway API. | `main.rs`, view\u002Fstate modules |\n| `capsem-admin` | Runtime image build, asset, release, and config validation administration. | `main.rs` |\n| `@capsem\u002Fmcp` (`mcp\u002Ftypescript`) | Separately installed host MCP server for AI agents. Stdio, typed SDK, authenticated gateway HTTP. | `cli.ts`, `server.ts`, tool modules |\n| `capsem-router` | Confined TCP publication companion. Relays declared listeners to granted VSOCK data descriptors; no VM control authority. | `lib.rs`, `main.rs` |\n| `capsem-network` | Private networks between VMs: the u16-framed ethernet frame codec for a cable and the switch's MAC forwarding table. Pure code; the I\u002FO lives in `capsem-router --network`, one L2 switch per network that VMs `plug()` into. | `frames.rs`, `switch.rs` |\n| `capsem-mcp-transport` | Connected HTTP capabilities and native role bootstrap; no VM, policy or secret ownership. | `http_transport.rs`, `native_worker.rs` |\n| `capsem-mcp-aggregator` | Low-privilege subprocess. Connects to external MCP servers and routes tool calls. Service supervises it; the VM owner receives connected asynchronous MessagePack RPC. No ambient VM \u002F DB \u002F FS \u002F network access. | `runtime.rs`, `server_manager.rs` |\n| `capsem-mcp-builtin` | Stdio MCP server subprocess exposing built-in tools: HTTP (fetch, grep, headers) and the `echo` transport probe. Service-owned through the aggregator's narrow peer capability. | `main.rs` (rmcp handler) |\n| `capsem-gateway` | TCP-to-UDS HTTP gateway. Frontend + tray connect through this. | `main.rs` (Axum router), `proxy.rs`, `status.rs`, `terminal.rs`, `auth.rs` |\n| `capsem-app` | Thin Tauri webview shell. Points at gateway (`http:\u002F\u002F127.0.0.1:19222`). Shell commands are registered in `src\u002Flib.rs` (frontend logging, log-path diagnostics and external URL opening); update checks use the service API. Bundles `web\u002Fapp\u002Fdist` so it can render the service-unavailable screen. Crate name matches directory; binary is `capsem-app`. | `lib.rs` |\n| `capsem-tray` | System tray. Polls gateway for VM status, quick actions (open dashboard, quit). | `main.rs`, `menu.rs` |\n| `capsem-agent` | Guest binaries. Cross-compiled for aarch64\u002Fx86_64-linux-musl. | `main.rs` (PTY agent + file I\u002FO), `net_proxy.rs` (TCP relay), `mcp_server.rs` (MCP relay), `sysutil.rs` (guest suspend helper; in-VM shutdown disabled) |\n| `capsem-logger` | Session DB schema, queries, async writer. | `schema.rs`, `writer.rs`, `events.rs` |\n| `capsem-proto` | Shared protocol types. | `ipc.rs` (ServiceToProcess\u002FProcessToService), `lib.rs` (HostToGuest\u002FGuestToHost) |\n| `capsem-guard` | Companion-process lifecycle primitives: parent-watch + singleton flock. Used by gateway and tray to refuse-standalone, enforce one-instance, and self-exit when the service dies (incl. SIGKILL). | `src\u002Flib.rs` (`install`, `Singleton`, `watch_parent_or_exit`) |\n| `capsem-bench` | Host\u002Fguest benchmark harness and result collection. | `main.rs`, collectors and dimensions |\n| `capsem-mock-server` | Hermetic HTTP\u002FTLS\u002FWebSocket upstream for tests and benchmarks. | `main.rs` |\n\nRule: reusable logic belongs in the lowest-dependency crate that owns its\ndomain. Cross-process wire contracts belong in `capsem-proto`; host plumbing in\n`capsem-foundation`; assets, config, and credentials in their named crates; VM,\nhypervisor, security-engine, and host network runtime in `capsem-core`.\n\n## Directory map\n\n| Path | What | Skill |\n|------|------|-------|\n| `crates\u002F` | Rust workspace | `\u002Fsite-architecture` |\n| `web\u002Fapp\u002F` | Astro 7 + Svelte 5 + Tailwind v4 + owned semantic CSS | `\u002Ffrontend-design` |\n| `web\u002Fmarketing\u002F` | Marketing website (Astro + Svelte 5) | `\u002Fsite-marketing` |\n| `web\u002Fdocs\u002F` | Documentation site (Astro Starlight) | `\u002Fsite-infra` |\n| `build_system\u002Fbuilder\u002F` | Python builder and gate package | `\u002Fbuild-images`, `\u002Fdev-gate` |\n| `build_system\u002Fscripts\u002F` | Thin functional command boundaries | `\u002Fdev-gate`, `\u002Frelease-process` |\n| `guest\u002Fartifacts\u002F` | capsem-init, bashrc, diagnostics | `\u002Fdev-capsem-doctor`, `\u002Fbuild-initrd` |\n| `cache\u002Ftarget\u002Fassets\u002F` | Built VM assets (gitignored, per-arch) | `\u002Fbuild-images` |\n| `web\u002Fgraphics\u002F` | Brand icons and app icons (source of truth) | `\u002Fdev-capsem` |\n| `skills\u002F` | AI agent skills | `\u002Fdev-skills`, `\u002Fmeta-organize-skills` |\n| `config\u002F` | Runtime image source (`docker\u002Fimage`), corp, and settings config | `\u002Fsite-architecture`, `\u002Fbuild-images` |\n\n## Skill map\n\nWhen working on a specific area, consult the relevant skill:\n\n### Development\n| Skill | When |\n|-------|------|\n| `\u002Fdev-just` | Which just recipe to run |\n| `\u002Fdev-testing` | Test policy, TDD, coverage |\n| `\u002Fdev-debugging` | Bug investigation workflow |\n| `\u002Fdev-rust-patterns` | Async, cross-compile, error handling |\n| `\u002Fdev-capsem-doctor` | In-VM diagnostic suite |\n| `\u002Fdev-installation` | Package install, service registration, self-update, install tests |\n| `\u002Fdev-setup` | New developer onboarding |\n| `\u002Fdev-skills` | Skills system internals |\n\n### Subsystems\n| Skill | When |\n|-------|------|\n| `\u002Fdev-mitm-proxy` | MITM proxy, SSE parsing, telemetry |\n| `\u002Fdev-mcp` | Guest MCP endpoint, tool routing |\n| `\u002Fdev-testing-hypervisor` | KVM, Apple VZ, VirtioFS |\n| `\u002Fdev-testing-vm` | In-VM tests, session inspection, fixtures |\n| `\u002Fdev-testing-frontend` | vitest, visual verification |\n\n### Build & release\n| Skill | When |\n|-------|------|\n| `\u002Fbuild-images` | VM runtime builds: kernel, rootfs, OBOM |\n| `\u002Fbuild-initrd` | Guest binary repack, fast iteration |\n| `\u002Frelease-process` | Release, CI, signing, docs, changelog |\n\n### Frontend & site\n| Skill | When |\n|-------|------|\n| `\u002Ffrontend-design` | Owned design system, semantic colors, Svelte 5 runes |\n| `\u002Fsite-architecture` | System architecture, service daemon, gateway, key files |\n| `\u002Fsite-infra` | Astro Starlight docs site |\n\n## Communication paths\n\n```\nAI Agent    -> @capsem\u002Fmcp (stdio)     -> authenticated gateway HTTP -> capsem-service -> capsem-process -> vsock -> guest\nUser CLI    -> capsem (Rust SDK)       -> authenticated gateway HTTP -> capsem-service -> capsem-process -> vsock -> guest\nDesktop UI  -> capsem-gateway (TCP)    -> HTTP\u002FUDS -> capsem-service -> capsem-process -> vsock -> guest\nTray app    -> capsem-gateway (TCP)    -> HTTP\u002FUDS -> capsem-service -> capsem-process -> vsock -> guest\nGuest HTTPS -> iptables -> vsock:5002  -> Host MITM proxy -> upstream\nGuest MCP   -> framed vsock:5002      -> MITM MCP endpoint -> external MCP servers\n```\n\nVsock ports: 5000 (control), 5001 (terminal), 5002 (MITM + framed guest MCP), 5004 (lifecycle\u002Fcapsem-sysutil), 5005 (exec output).\n\n## Config hierarchy\n\n1. Corp config (`corp.toml`) -- enterprise constraints, reporting endpoints,\n   and locked rule\u002Fplugin policy. Corp wins.\n2. User settings (`~\u002F.capsem\u002Fsettings.toml`) -- rules, detections, MCP,\n   plugins, and UI\u002Fapp preferences.\n3. Built-in defaults compiled into the binary.\n\nThe service merges the three into one per-VM policy file,\n`vm\u002Factive_policy.toml`, at every boot. There is no `user.toml` policy rail.\n\nConfig naming is strict:\n- `schema` validates one contract shape.\n- `catalog` lists discovered or materialized instances.\n- UI metadata renders settings only.\n- `admin`, `guest`, and `registry` are not config authority roots.\n- The only top-level config directories are `settings\u002F`, `corp\u002F`,\n  `docker\u002F`, and `data\u002F`. Adding another root is a contract change and needs\n  a failing guard first.\n- `capsem-admin` is a validator\u002Fmaterializer\u002Fbuilder, not an authoring wizard.\n  It must not grow `init`, `new`, `add`, provider, registry, or backend\n  workspace authoring commands.\n\n## Key invariants\n\n- Guest VM is air-gapped. No real NIC, no real DNS, no direct internet.\n- Guest binaries are read-only (chmod 555). Rootfs mounted read-only.\n- **Every session boots the one VM runtime.** Applications come from OCI\n  images; policy comes from corp + settings + built-in defaults; size comes\n  from create flags with fixed defaults.\n- The binary must be codesigned with `com.apple.security.virtualization`.\n- Domain libraries own reusable logic; binary crates keep entrypoints focused\n  on parsing, wiring, lifecycle, and presentation. Do not move unrelated logic\n  into `capsem-core` merely because more than one caller needs it.\n- **Fork images are first-class objects.** `capsem fork \u003Csession> \u003Cimage-name>`\n  clones a session into a reusable template. Forked images depend on the\n  runtime asset set and must remain compatible with it.\n- **Public surfaces are approval-gated.** `config\u002Fpublic-surface.toml` is the\n  exact allowlist for public Just recipes, Capsem CLI command paths, and\n  service HTTP method\u002Fpath pairs. `tests\u002Ftest_public_surface_contract.py`\n  fails on additions, removals, renames, or count drift. Never refresh that\n  ledger mechanically; a surface change requires explicit product approval.\n\n## Installation\n\nRelease packages are the primary install path. Native install validation is\nowned by the platform-neutral glow-up contract: Linux exercises the package in\nthe systemd install rail; macOS installs the signed exact package in a clean\nTart guest and boots its payload through physical Apple VZ. There is no public\nnative-install or release-command fork.\n\n**Install layout** (`~\u002F.capsem\u002F`):\n- `bin\u002F` -- capsem, capsem-service, capsem-process, capsem-mcp-aggregator, capsem-mcp-builtin, capsem-gateway, capsem-tray\n- `@capsem\u002Fmcp` -- separately installed npm package; native installation does not install Node.js or download it\n- `assets\u002F` -- manifest.json and the runtime VM assets such as `vmlinuz`,\n  `initrd.img`, and EROFS rootfs images\n- `run\u002F` -- service.sock, service.pid, gateway.token, gateway.port, gateway.pid, instances\u002F\n\n**Service registration**: LaunchAgent (macOS: `com.capsem.service`) \u002F systemd user unit (Linux: `capsem.service`). Auto-restarts on crash. See `\u002Fdev-installation` for the full wizard flow.\n","# Capsem\n\nCapsem sandboxes AI agents in air-gapped Linux VMs on macOS using Apple's Virtualization.framework (with KVM for Linux). Runs as a daemon service (like Docker). Built with Rust and Astro.\n\n## Engineering standard\n\nQuality, security and performance are P0 and every coding agent's\nresponsibility. See something, say something, do something.\nWhen you notice a defect or an improvement while working -- a bug, a fragile\npath, a lint or guard failure, a small refactor that clarifies, a way to make\nsomething faster or more reliable, a vulnerable dependency -- do not walk past\nit as \"not my problem.\" Small: fix it test-first (`\u002Fdev-testing`) and commit\nit in its own scoped commit. Too big to fold in: open a GitHub bug with enough\ndetail to act on. A vulnerability is fixed immediately, test-first, in its own\n`security:` commit -- never parked, never filed publicly while unfixed. Stop\nto ask only for genuine judgment calls (user-visible behavior, weakening a\nsecurity boundary, real scope, or a maintainer's dependency choice), and even\nthen lead with a recommendation. The full contract is\n`AGENTS.md` -> \"Fix what you find\".\n\n## Crate map\n\n| Crate | What | Key modules |\n|-------|------|-------------|\n| `capsem-foundation` | Dependency-light host primitives shared across product crates. | `paths.rs`, `uds.rs`, `poll.rs`, `telemetry.rs`, `log_layer.rs`, `ipc_handshake.rs` |\n| `capsem-cache` | Bounded observable cache mechanics; callers own freshness policy. | `bounded.rs`, `snapshot.rs`, `telemetry.rs` |\n| `capsem-archive` | Append-only, block-compressed body archive for one session ledger. | `format.rs`, `writer.rs`, `reader.rs` |\n| `capsem-crypto` | Accelerated hashes, integrity verification, randomness, TLS keys, JWT verification, signatures, and secret handling. | `verify.rs`, `random.rs`, `tls.rs`, `jwt.rs`, `secrets.rs` |\n| `capsem-ledger` | Confined session-ledger worker and archive codec executor. | `main.rs`, `codec.rs` |\n| `capsem-telemetry` | Single owner of every `metrics`-facade metric name, kind, unit, and description. Emitters import names from here. | `lib.rs` (`MetricSpec`, `describe_all`), `db.rs`, `dns.rs`, `mitm.rs`, `security.rs`, `virtio_blk.rs` |\n| `capsem-assets` | VM asset lifecycle and manifest compatibility. | `asset_manager.rs`, `manifest_compat.rs` |\n| `capsem-api` | Gateway wire types and OpenAPI contract. | `document.rs`, `hypervisor.rs`, `vm_info.rs` |\n| `capsem-sdk` (`sdk\u002Frust`) | Async HTTP gateway clients, shared API DTOs, and bounded local gateway discovery. | `transport.rs`, `hypervisor.rs`, `local.rs` |\n| `capsem-config` | Product config contracts, parsing, validation, and provider\u002FMCP identity. | `types.rs`, `validation.rs`, `provider_profile.rs`, `mcp.rs`, `resolver.rs` |\n| `capsem-credentials` | Credential provider contracts and durable credential storage. | `provider.rs`, `store.rs`, `durable.rs` |\n| `capsem-core` | VM, hypervisor, security-engine, network-intercept, and session-runtime domain library. | `vm\u002F`, `net\u002F`, `security_engine\u002F`, `mcp\u002F`, `hypervisor\u002F`, `image.rs` |\n| `capsem-service` | Daemon service. Axum HTTP over UDS, VM lifecycle. | `main.rs` (routes, IPC), `api.rs` (request\u002Fresponse types) |\n| `capsem-process` | Per-VM process. Boots VM, bridges vsock, job store. | `main.rs` (vsock setup, IPC handler) |\n| `capsem-proxy` | Confined HTTP\u002FDNS proxy worker for VM and standalone traffic. | `main.rs` |\n| `capsem` | CLI client. Rust SDK over authenticated gateway HTTP; local status\u002Fasset administration and startup use UDS. | `main.rs` (create, resume, shell, list, exec, run, stop, delete, persist, purge, info, logs, restart, version, doctor, fork, image) |\n| `capsem-tui` | Terminal control UI over the gateway API. | `main.rs`, view\u002Fstate modules |\n| `capsem-admin` | Runtime image build, asset, release, and config validation administration. | `main.rs` |\n| `@capsem\u002Fmcp` (`mcp\u002Ftypescript`) | Separately installed host MCP server for AI agents. Stdio, typed SDK, authenticated gateway HTTP. | `cli.ts`, `server.ts`, tool modules |\n| `capsem-router` | Confined TCP publication companion. Relays declared listeners to granted VSOCK data descriptors; no VM control authority. | `lib.rs`, `main.rs` |\n| `capsem-network` | Private networks between VMs: the u16-framed ethernet frame codec for a cable and the switch's MAC forwarding table. Pure code; the I\u002FO lives in `capsem-router --network`, one L2 switch per network that VMs `plug()` into. | `frames.rs`, `switch.rs` |\n| `capsem-mcp-transport` | Connected HTTP capabilities and native role bootstrap; no VM, policy or secret ownership. | `http_transport.rs`, `native_worker.rs` |\n| `capsem-mcp-aggregator` | Low-privilege subprocess. Connects to external MCP servers and routes tool calls. Service supervises it; the VM owner receives connected asynchronous MessagePack RPC. No ambient VM \u002F DB \u002F FS \u002F network access. | `runtime.rs`, `server_manager.rs` |\n| `capsem-mcp-builtin` | Stdio MCP server subprocess exposing built-in tools: HTTP (fetch, grep, headers) and the `echo` transport probe. Service-owned through the aggregator's narrow peer capability. | `main.rs` (rmcp handler) |\n| `capsem-gateway` | TCP-to-UDS HTTP gateway. Frontend + tray connect through this. | `main.rs` (Axum router), `proxy.rs`, `status.rs`, `terminal.rs`, `auth.rs` |\n| `capsem-app` | Thin Tauri webview shell. Points at gateway (`http:\u002F\u002F127.0.0.1:19222`). Shell commands are registered in `src\u002Flib.rs` (frontend logging, log-path diagnostics and external URL opening); update checks use the service API. Bundles `web\u002Fapp\u002Fdist` so it can render the service-unavailable screen. Crate name matches directory; binary is `capsem-app`. | `lib.rs` |\n| `capsem-tray` | System tray. Polls gateway for VM status, quick actions (open dashboard, quit). | `main.rs`, `menu.rs` |\n| `capsem-agent` | Guest binaries. Cross-compiled for aarch64\u002Fx86_64-linux-musl. | `main.rs` (PTY agent + file I\u002FO), `net_proxy.rs` (TCP relay), `mcp_server.rs` (MCP relay), `sysutil.rs` (guest suspend helper; in-VM shutdown disabled) |\n| `capsem-logger` | Session DB schema, queries, async writer. | `schema.rs`, `writer.rs`, `events.rs` |\n| `capsem-proto` | Shared protocol types. | `ipc.rs` (ServiceToProcess\u002FProcessToService), `lib.rs` (HostToGuest\u002FGuestToHost) |\n| `capsem-guard` | Companion-process lifecycle primitives: parent-watch + singleton flock. Used by gateway and tray to refuse-standalone, enforce one-instance, and self-exit when the service dies (incl. SIGKILL). | `src\u002Flib.rs` (`install`, `Singleton`, `watch_parent_or_exit`) |\n| `capsem-bench` | Host\u002Fguest benchmark harness and result collection. | `main.rs`, collectors and dimensions |\n| `capsem-mock-server` | Hermetic HTTP\u002FTLS\u002FWebSocket upstream for tests and benchmarks. | `main.rs` |\n\nRule: reusable logic belongs in the lowest-dependency crate that owns its\ndomain. Cross-process wire contracts belong in `capsem-proto`; host plumbing in\n`capsem-foundation`; assets, config, and credentials in their named crates; VM,\nhypervisor, security-engine, and host network runtime in `capsem-core`.\n\n## Directory map\n\n| Path | What | Skill |\n|------|------|-------|\n| `crates\u002F` | Rust workspace | `\u002Fsite-architecture` |\n| `web\u002Fapp\u002F` | Astro 7 + Svelte 5 + Tailwind v4 + owned semantic CSS | `\u002Ffrontend-design` |\n| `web\u002Fmarketing\u002F` | Marketing website (Astro + Svelte 5) | `\u002Fsite-marketing` |\n| `web\u002Fdocs\u002F` | Documentation site (Astro Starlight) | `\u002Fsite-infra` |\n| `build_system\u002Fbuilder\u002F` | Python builder and gate package | `\u002Fbuild-images`, `\u002Fdev-gate` |\n| `build_system\u002Fscripts\u002F` | Thin functional command boundaries | `\u002Fdev-gate`, `\u002Frelease-process` |\n| `guest\u002Fartifacts\u002F` | capsem-init, bashrc, diagnostics | `\u002Fdev-capsem-doctor`, `\u002Fbuild-initrd` |\n| `cache\u002Ftarget\u002Fassets\u002F` | Built VM assets (gitignored, per-arch) | `\u002Fbuild-images` |\n| `web\u002Fgraphics\u002F` | Brand icons and app icons (source of truth) | `\u002Fdev-capsem` |\n| `skills\u002F` | AI agent skills | `\u002Fdev-skills`, `\u002Fmeta-organize-skills` |\n| `config\u002F` | Runtime image source (`docker\u002Fimage`), corp, and settings config | `\u002Fsite-architecture`, `\u002Fbuild-images` |\n\n## Skill map\n\nWhen working on a specific area, consult the relevant skill:\n\n### Development\n| Skill | When |\n|-------|------|\n| `\u002Fdev-just` | Which just recipe to run |\n| `\u002Fdev-testing` | Test policy, TDD, coverage |\n| `\u002Fdev-debugging` | Bug investigation workflow |\n| `\u002Fdev-rust-patterns` | Async, cross-compile, error handling |\n| `\u002Fdev-capsem-doctor` | In-VM diagnostic suite |\n| `\u002Fdev-installation` | Package install, service registration, self-update, install tests |\n| `\u002Fdev-setup` | New developer onboarding |\n| `\u002Fdev-skills` | Skills system internals |\n\n### Subsystems\n| Skill | When |\n|-------|------|\n| `\u002Fdev-mitm-proxy` | MITM proxy, SSE parsing, telemetry |\n| `\u002Fdev-mcp` | Guest MCP endpoint, tool routing |\n| `\u002Fdev-testing-hypervisor` | KVM, Apple VZ, VirtioFS |\n| `\u002Fdev-testing-vm` | In-VM tests, session inspection, fixtures |\n| `\u002Fdev-testing-frontend` | vitest, visual verification |\n\n### Build & release\n| Skill | When |\n|-------|------|\n| `\u002Fbuild-images` | VM runtime builds: kernel, rootfs, OBOM |\n| `\u002Fbuild-initrd` | Guest binary repack, fast iteration |\n| `\u002Frelease-process` | Release, CI, signing, docs, changelog |\n\n### Frontend & site\n| Skill | When |\n|-------|------|\n| `\u002Ffrontend-design` | Owned design system, semantic colors, Svelte 5 runes |\n| `\u002Fsite-architecture` | System architecture, service daemon, gateway, key files |\n| `\u002Fsite-infra` | Astro Starlight docs site |\n\n## Communication paths\n\n```\nAI Agent    -> @capsem\u002Fmcp (stdio)     -> authenticated gateway HTTP -> capsem-service -> capsem-process -> vsock -> guest\nUser CLI    -> capsem (Rust SDK)       -> authenticated gateway HTTP -> capsem-service -> capsem-process -> vsock -> guest\nDesktop UI  -> capsem-gateway (TCP)    -> HTTP\u002FUDS -> capsem-service -> capsem-process -> vsock -> guest\nTray app    -> capsem-gateway (TCP)    -> HTTP\u002FUDS -> capsem-service -> capsem-process -> vsock -> guest\nGuest HTTPS -> iptables -> vsock:5002  -> Host MITM proxy -> upstream\nGuest MCP   -> framed vsock:5002      -> MITM MCP endpoint -> external MCP servers\n```\n\nVsock ports: 5000 (control), 5001 (terminal), 5002 (MITM + framed guest MCP), 5004 (lifecycle\u002Fcapsem-sysutil), 5005 (exec output).\n\n## Config hierarchy\n\n1. Corp config (`corp.toml`) -- enterprise constraints, reporting endpoints,\n   and locked rule\u002Fplugin policy. Corp wins.\n2. User settings (`~\u002F.capsem\u002Fsettings.toml`) -- rules, detections, MCP,\n   plugins, and UI\u002Fapp preferences.\n3. Built-in defaults compiled into the binary.\n\nThe service merges the three into one per-VM policy file,\n`vm\u002Factive_policy.toml`, at every boot. There is no `user.toml` policy rail.\n\nConfig naming is strict:\n- `schema` validates one contract shape.\n- `catalog` lists discovered or materialized instances.\n- UI metadata renders settings only.\n- `admin`, `guest`, and `registry` are not config authority roots.\n- The only top-level config directories are `settings\u002F`, `corp\u002F`,\n  `docker\u002F`, and `data\u002F`. Adding another root is a contract change and needs\n  a failing guard first.\n- `capsem-admin` is a validator\u002Fmaterializer\u002Fbuilder, not an authoring wizard.\n  It must not grow `init`, `new`, `add`, provider, registry, or backend\n  workspace authoring commands.\n\n## Key invariants\n\n- Guest VM is air-gapped. No real NIC, no real DNS, no direct internet.\n- Guest binaries are read-only (chmod 555). Rootfs mounted read-only.\n- **Every session boots the one VM runtime.** Applications come from OCI\n  images; policy comes from corp + settings + built-in defaults; size comes\n  from create flags with fixed defaults.\n- The binary must be codesigned with `com.apple.security.virtualization`.\n- Domain libraries own reusable logic; binary crates keep entrypoints focused\n  on parsing, wiring, lifecycle, and presentation. Do not move unrelated logic\n  into `capsem-core` merely because more than one caller needs it.\n- **Fork images are first-class objects.** `capsem fork \u003Csession> \u003Cimage-name>`\n  clones a session into a reusable template. Forked images depend on the\n  runtime asset set and must remain compatible with it.\n- **Public surfaces are approval-gated.** `config\u002Fpublic-surface.toml` is the\n  exact allowlist for public Just recipes, Capsem CLI command paths, and\n  service HTTP method\u002Fpath pairs. `tests\u002Ftest_public_surface_contract.py`\n  fails on additions, removals, renames, or count drift. Never refresh that\n  ledger mechanically; a surface change requires explicit product approval.\n\n## Installation\n\nRelease packages are the primary install path. Native install validation is\nowned by the platform-neutral glow-up contract: Linux exercises the package in\nthe systemd install rail; macOS installs the signed exact package in a clean\nTart guest and boots its payload through physical Apple VZ. There is no public\nnative-install or release-command fork.\n\n**Install layout** (`~\u002F.capsem\u002F`):\n- `bin\u002F` -- capsem, capsem-service, capsem-process, capsem-mcp-aggregator, capsem-mcp-builtin, capsem-gateway, capsem-tray\n- `@capsem\u002Fmcp` -- separately installed npm package; native installation does not install Node.js or download it\n- `assets\u002F` -- manifest.json and the runtime VM assets such as `vmlinuz`,\n  `initrd.img`, and EROFS rootfs images\n- `run\u002F` -- service.sock, service.pid, gateway.token, gateway.port, gateway.pid, instances\u002F\n\n**Service registration**: LaunchAgent (macOS: `com.capsem.service`) \u002F systemd user unit (Linux: `capsem.service`). Auto-restarts on crash. See `\u002Fdev-installation` for the full wizard flow.\n",{},"main","d357170bb677125c80cebed720e62bf47bf083ad","skills\u002Fdev-capsem",26,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 00:49:59",{"source":9,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add google\u002Fcapsem --skill dev-capsem",{"tool":51,"command":52},"bunx","bunx skills add google\u002Fcapsem --skill dev-capsem",{"tool":54,"command":55},"pnpm","pnpm dlx skills add google\u002Fcapsem --skill dev-capsem","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fdev-capsem\u002FSKILL.md",true,[],[60,77,93,108,120,132],{"skillNo":61,"name":62,"nameZh":63,"description":64,"descriptionZh":65,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":66,"categories":67,"keywords":74,"publishedAt":31},"01M699558T2T4DJMBN08ZCQ79K","use-capsem","Capsem 虚拟机任务执行","Run tasks in Capsem VMs through MCP. Use when an agent needs isolated execution, file analysis, or reports returned to the host.","通过 MCP 在 Capsem 虚拟机中运行任务。在智能体需要隔离执行、文件分析，或将报告返回到主机时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fuse-capsem\u002FSKILL.md",[68,71],{"categoryNo":69,"categoryName":70,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BRN0DBCRG4XGJMB6QQEP11","编码任务委派",{"categoryNo":72,"categoryName":73,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",[75,76],"use capsem","MCP",{"skillNo":78,"name":79,"nameZh":80,"description":81,"descriptionZh":82,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":83,"categories":84,"keywords":91,"publishedAt":31},"01M69953Z1CSVQ4N07QX529CZY","site-marketing","营销网站内容维护","The marketing website, capsem.org. Use when editing copy, adding sections, or changing the site theme.","营销网站 capsem.org。在编辑文案、添加板块或更改网站主题时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-marketing\u002FSKILL.md",[85,88],{"categoryNo":86,"categoryName":87,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQGD6C0J544QTJ9R38Z7ZG","营销专员",{"categoryNo":89,"categoryName":90,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQV98WRP4APE9VKKKKJ6FV","社交媒体与内容平台管理",[92],"site marketing",{"skillNo":94,"name":95,"nameZh":96,"description":97,"descriptionZh":98,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":99,"categories":100,"keywords":105,"publishedAt":31},"01M69952B33KBBV37N8QTC4191","site-infra","文档站基础设施维护","The documentation site, docs.capsem.org. Use for user-directed Diátaxis documentation and Astro Starlight changes.","文档站点 docs.capsem.org。用于面向用户的 Diátaxis 文档和 Astro Starlight 相关更改。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-infra\u002FSKILL.md",[101,104],{"categoryNo":102,"categoryName":103,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQ6TK1MPB82068236GSXDE","文档处理",{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},[106,107],"site infra","docs",{"skillNo":109,"name":110,"nameZh":111,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":112,"categories":113,"keywords":118,"publishedAt":31},"01M69950YKCZKCDB98JDQNBBRJ","site-architecture","站点架构设计","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-architecture\u002FSKILL.md",[114,117],{"categoryNo":115,"categoryName":116,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQ6TKQDF2K4KQS863Q79P4","开发参考",{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},[119],"site architecture",{"skillNo":121,"name":122,"nameZh":123,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":124,"categories":125,"keywords":130,"publishedAt":31},"01M6994Z61JWZ0G2YRJTWFH933","release-process","版本发布流程","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Frelease-process\u002FSKILL.md",[126,127],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":128,"categoryName":129,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQNXPY1AV6BSR5VKHDMWRH","部署与发布管理",[131],"release process",{"skillNo":133,"name":134,"nameZh":135,"description":136,"descriptionZh":137,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":138,"categories":139,"keywords":144,"publishedAt":31},"01M6994XKHADM6FBTYTAPG7FYC","meta-skill-creation","智能体技能创建与优化","Create, improve, and evaluate skills. Use when writing a new skill, editing an existing one, or tuning a description for better triggering.","创建、改进和评估技能。在编写新技能、编辑现有技能或调整 description 以优化触发效果时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fmeta-skill-creation\u002FSKILL.md",[140,143],{"categoryNo":141,"categoryName":142,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BRN0CV1NMDZ5TEJX1GVM29","插件与技能管理",{"categoryNo":72,"categoryName":73,"taxonomyType":22,"taxonomyTypeDesc":23},[145,146],"meta skill creation","writing"]