Skip to content

sptos-shell

In-kernel debug shell for the SPTOS Cognition Kernel

Overview

sptos-shell provides a line-based debug shell for runtime inspection of SPTOS kernel state. It supports serial console use via a trait-based backend (ShellBackend) that kernel integrators implement. This crate is no_std compatible and requires only alloc.

Key Features

  • 13 built-in commands — help, info, mem, tasks, caps, queues, vectors, proofs, cpu, witness, perf, trace, reboot
  • Trait-based backendShellBackend trait decouples the shell from kernel internals
  • Line-based parsing — Simple command parser suitable for serial consoles and embedded environments
  • Command history — Configurable history buffer (default 32 entries)
  • no_std with alloc — Uses only alloc for dynamic strings and vectors

Dependencies

No internal SPTOS dependencies. Types are defined internally to keep this crate self-contained.

Usage

rust
use sptos_shell::{Shell, ShellConfig, Command, Parser};

let config = ShellConfig::default(); // prompt: "sptos> "
let mut shell = Shell::new(config);
let output = shell.execute_line("mem", &kernel_backend);

API Reference

Core Types

TypeDescription
ShellMain shell instance with history and command dispatch
ShellConfigConfiguration (max history, echo, prompt string)
ShellBackendTrait that kernel integrators implement for state access
CommandParsed command enum (Help, Info, Mem, Tasks, etc.)
ParserLine-based command parser
MemoryStatsMemory statistics returned by the backend
TaskInfoTask information returned by the backend
ParseErrorError type for command parsing failures

Released under the MIT License.