Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
35
Statespace is an open-source AI runtime/framework. This monorepo contains the Rust implementation.
Sign in to like and favorite skills
Statespace is an open-source AI runtime/framework. This monorepo contains the Rust implementation.
cargo buildcargo testcargo clippy --all-targets -- -D warningscargo fmt --allcargo checkPre-commit hooks run
cargo fmt --check and cargo clippy. To enable:
git config core.hooksPath .githooks
Note: On macOS, the linker needs to find
libiconv (pulled in by reqwest/rustls). The .envrc handles this automatically with direnv. Without direnv, set:
export LIBRARY_PATH="$(xcrun --show-sdk-path)/usr/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
statespace/ ├── Cargo.toml # Workspace manifest ├── shell.nix # Nix development environment ├── binaries/ │ └── statespace-cli/ # CLI binary │ └── src/ │ ├── main.rs │ ├── args.rs │ ├── config.rs │ ├── error.rs │ ├── commands/ │ └── gateway/ ├── crates/ │ ├── statespace-tool-runtime/ # Core runtime library (no HTTP, no CLI) │ │ └── src/ │ │ ├── lib.rs │ │ ├── error.rs │ │ ├── executor.rs │ │ ├── frontmatter.rs │ │ ├── protocol.rs │ │ ├── security.rs │ │ ├── spec.rs │ │ ├── tools.rs │ │ └── validation.rs │ └── statespace-server/ # HTTP server library │ └── src/ │ ├── lib.rs │ ├── content.rs │ ├── error.rs │ ├── init.rs │ ├── server.rs │ └── templates.rs └── docs/ └── design/ # RFDs
This is a stateless CLI — the gateway's actor model, sagas, and stateful lifecycle management do not apply here. There are no long-lived processes, no message passing, no state machines.
What DOES apply from gateway philosophy:
gateway/ module inside statespace-cli is the effect boundary (HTTP calls to the Statespace API). Commands are orchestration. Pure logic (validation, slugify, config parsing) must have no I/O.lazy_static!, no hidden env var reads.models.rs dumping grounds.Module roles:
frontmatter, spec, security, protocol, validation, templatesexecutor, content, server, init, gateway/gateway/: environments.rs, auth.rs, tokens.rs, organizations.rs, ssh.rs — each file owns the types and API calls for that domain#![allow(dead_code)] file-level suppression — if code is dead, delete it. Mark individual items with #[allow(dead_code)] only with a comment explaining why.Environment struct belongs in gateway/environments.rs, not in a shared types.rstypes.rs / models.rs dumping grounds — split types by domain, co-locate with their API callsstatus: String when the server defines a proper enum — use typed enums (EnvironmentState, Tier, Visibility) client-side too#![allow(dead_code)] to hide unused code — delete it, or annotate individual items with a justificationstatespace-cli ──► statespace-server ──► statespace-tool-runtime │ ▲ └──────────────────────────────────────────┘
Do NOT use
unwrap() or expect() or anything that panics in library code - handle errors properly. In tests, unwrap() and panic!() are fine.
Prefer
crate:: over super:: for imports. Clean it up if you see super::.
Avoid using
pub use on imports unless you are re-exposing a dependency so downstream consumers do not have to depend on it directly.
Skip global state via
lazy_static!, Once, or similar; prefer passing explicit context structs for any shared state.
See docs/design/ for design documents following the Oxide RFD style.