npcrs

Rust core for the NPC system. Mirrors npcpy for function parity.
Modules
| Module | npcpy equivalent | Description |
|---|---|---|
npc_compiler |
npcpy.npc_compiler |
NPC, Team, Jinx, Agent/ToolAgent/CodingAgent |
gen |
npcpy.gen |
LLM response (genai), cost, sanitization, image gen |
llm_funcs |
npcpy.llm_funcs |
get_llm_response(), check_llm_command() |
memory |
npcpy.memory |
Conversation history, knowledge graph, embeddings, search |
tools |
npcpy.tools |
Tool registry, flatten_tool_messages() |
data |
npcpy.data |
Web search, file loading, text processing |
work |
npcpy.work |
Job scheduling, triggers |
ml_funcs |
npcpy.ml_funcs |
ML model fit/predict/score (via Python subprocess) |
npc_array |
npcpy.npc_array |
Vectorized inference, ensemble voting |
mix |
npcpy.mix |
Multi-agent debate |
ft |
npcpy.ft |
Fine-tuning (SFT via Python subprocess) |
kernel |
— | OS kernel: process table, scheduling, IPC (Rust-specific) |
process |
— | NPC process lifecycle, resource limits |
serve |
npcpy.serve |
HTTP REST API + MCP server |
ffi |
— | C-ABI for Flutter/Dart/mobile |
See COVERAGE.md for detailed function-by-function parity status.
Build
Usage as library
use ;
// Boot kernel with a team directory
let kernel = boot?;
// Execute through the agent loop (tools, delegation, etc.)
let output = kernel.exec.await?;
// Delegate to a specific NPC
let output = kernel.delegate.await?;
Usage as npcsh (shell)
Build and run from npcsh/rust/:
Or symlink as npc for direct .npc/.jinx execution:
# Run NPC files directly
# Run jinx files directly
# Scaffold a new team
Cross-compile for Android
# Add targets
# Set NDK env
# Build
# Copy to Flutter project
FFI
Produces cdylib and staticlib for embedding in Flutter, Android, iOS, desktop apps. See src/ffi/mod.rs for the C-ABI exports and eazy-phone/lib/npc/npcrs_bindings.dart for the Dart bindings.
DB
Uses the same ~/npcsh_history.db and conversation_history table schema as the Python npcsh. Both versions can share the same database.
License
MIT