Expand description
Malvin: implementation and review workflow driven by the Cursor SDK (cursor:) or Pi (pi:).
Re-exports§
pub use workspace_paths::canonical_work_dir_for_logs;pub use workspace_paths::find_malvin_logs_root;pub use workspace_paths::git_worktree_toplevel;pub use workspace_paths::is_malvin_workspace;pub use workspace_paths::legacy_malvin_checks_path;pub use workspace_paths::malvin_acp_spawn_chamber_dir;pub use workspace_paths::malvin_advice_path;pub use workspace_paths::malvin_checks_path;pub use workspace_paths::malvin_config_path;pub use workspace_paths::malvin_data_root;pub use workspace_paths::malvin_home_config_path;pub use workspace_paths::malvin_home_logs_root;pub use workspace_paths::malvin_logs_root;pub use workspace_paths::malvin_user_home_root;pub use workspace_paths::read_work_dir_manifest;pub use workspace_paths::remove_legacy_malvin_checks_file;pub use workspace_paths::resolve_malvin_checks_path;pub use workspace_paths::workspace_logs_hash;pub use workspace_paths::write_work_dir_manifest;pub use workspace_paths::MALVIN_ADVICE_REL;pub use workspace_paths::MALVIN_CHECKS_REL;pub use workspace_paths::MALVIN_CONFIG_REL;pub use workspace_paths::MALVIN_DIR;pub use workspace_paths::MALVIN_HOME_CONFIG_FILE;pub use workspace_paths::MALVIN_LOGS_REL;pub use workspace_paths::MALVIN_TEST_ALLOW_HOME_CONFIG_MUTATION;pub use workspace_paths::MALVIN_USER_HOME_DIR;pub use workspace_paths::WORK_DIR_MANIFEST;pub use acp::AgentError;pub use acp::AgentIoOptions;pub use acp::AuthError;pub use acp::CoderPromptOptions;pub use acp::snapshot_pids;pub use acp::terminate_agent_process_group;pub use ansi_strip::strip_ansi_escapes;pub use artifacts::startup_request_tag_label;pub use artifacts::MalvinChecksBackup;pub use artifacts::RunArtifacts;pub use artifacts::SessionDotfileBackups;pub use artifacts::backup_workspace_malvin_checks_if_present;pub use artifacts::create_run_artifacts_from_text;pub use artifacts::restore_workspace_session_dotfiles;pub use artifacts::create_kpop_run_artifacts;pub use artifacts::create_run_artifacts;pub use artifacts::resolve_user_md_request;pub use config::DEFAULT_CLI_MODEL;pub use kpop_progression::agent_declared_success;pub use output::ERROR_WHO;pub use output::MALVIN_WHO;pub use output::WARNING_WHO;pub use output::format_line;pub use output::format_log_tag_inner;pub use output::format_who_tag_prefix;pub use output::init_stdout_style;pub use output::print_log_error;pub use output::print_log_warning;pub use output::print_stderr_line;pub use output::print_stdout_line;pub use output::print_stdout_text;pub use prompts::DO_HEADER_MD;pub use prompts::HEADER_MD;pub use prompts::PromptError;pub use prompts::PromptStore;pub use prompts::malformed_brace_placeholders;pub use prompts::render_header;pub use run_timing::RunTiming;pub use run_timing::TimingPhase;pub use run_timing::finalize_and_emit_run_timing;pub use run_timing::finalize_run_timing_json_only;pub use run_timing::print_summary_from_run_dir;pub use support_paths::agent_or_cursor_agent_bin;pub use support_paths::command_line;pub use support_paths::format_logs_dir;pub use support_paths::init_from_env;pub use support_paths::lookup_bin_on_path;pub use orchestrator::check_abort;pub use workflow_context::format_malvin_command;pub use workflow_context::format_prompt_path;pub use workflow_context::workflow_context_paths_only;pub use workflow_context::PromptModelOpts;
Modules§
- acp
- Shared agent runtime helpers used by Cursor/Pi backends.
- acp_
post_ run - acp_
trace_ impersonation - ACP trace update kinds (see
concepts.md§3). - agent
- Agent interface (malvin → cursor-agent / pi). Agent interface surface: malvin orchestration → Mini or cursor-agent.
- agent_
backend - agent_
phase - Infers agent phase labels for stdout heartbeats from malvin runtime signals.
- ansi_
strip - Strip ANSI SGR and related sequences for plain-text comparisons.
- artifacts
- Run directories and log paths.
- bridge_
protocol - Shared JSONL bridge protocol for Cursor and Prime Node bridges.
- bridge_
sdk - Shared Cursor/Prime/Pi JSONL bridge core (session, IO, log adapters, timing).
- cli
- coder_
prompt_ phase - Coder-prompt phase machine (see
concepts.md§6). - command_
output_ timeout - Timed
Commandcapture for short-lived helper binaries (e.g.malvin models). - config
- Runtime configuration shared with the vendored ACP client.
- cursor_
sdk - Cursor TypeScript SDK backend (
cursor:models via Node JSONL bridge). - do_flow
--doworkflow: one coder ACP prompt with dual headers (header.md+do_header.md) and user request.- herdr
- Opportunistic herdr client: report malvin agent state when pane env is injected.
- inspire_
flow inspiresubcommand: one-shot MBC2 boundary-exploration prompt frommbc2.md.- kpop_
engine - kpop_
log_ protocol KPopLogProtocol— parsed step headings inexp_log_*.md(seesrc/kpop_engine/).- kpop_
progression - llm_
transport - Shared LLM completion types used by run timing / usage recording. Neutral completion types used by the local LLM engine and Prime sidecar.
- malvin_
sandbox - Host sandbox: process-group isolation and USS for all malvin-started processes.
- mem_
limit_ config - Agent process-group memory cap from
~/.malvin_home/config.toml. - model_
id - Prefixed model ids:
cursor:…,pi:…. - nested_
budget_ scopes - Nested budget scopes (see
concepts.md§1). - observability
- Dual-contract observability for malvin runs.
- orchestrator
- output
- Shared line-oriented formatting for stdout, stderr, and run logs.
- pi_sdk
pi:backend via an externally installedpibinary (JSONL RPC). No vendored Pi crates.- process_
group_ rss - Sum resident set size / USS for sandbox-tracked process sets.
- prompt_
stratification - Prompt stratification (see
concepts.md§4). - prompts
- Prompt templates sourced from embedded defaults, with optional custom root.
- reliability_
tier - Tenacious resilience tier (see
concepts.md§7). - repo_
checks - repo_
gates - router_
flow - Default-route flow:
header.md→kpop_common.md→router_a.md→ optionalrouter_b.md, outer--max-loops. - run_
timing - Wall-clock and phase-bucketed LLM wait timing for agent runs.
- sdk_
drain_ timeout - Idle timeout while SDK bridges drain for
run_done. - session_
dotfile_ backup - session_
sandbox_ policy - Sandbox as session-scoped spawn policy (see
concepts.md§5). - source_
detect - Heuristic detection for whether a workspace tree looks like it contains project source.
- stdout_
log_ path - Global stdout tee log path holder (crate-root leaf: no malvin internals).
- support_
paths - PATH lookup, argv capture for traces, and run-dir display paths.
- tool_
summary - workflow_
context - workspace_
paths - Workspace layout paths (
.malvin/tree) and home-directory run logs.
Structs§
- Kpop
Turn Prompts - RunDir
Options - Options for
create_run_dir. - Sandbox
OomKill Facts - Sandbox
OomKill Record - Session
Name Guard
Constants§
- MALVIN_
SHORT_ ID_ LEN - OOM_
REASON_ MEASUREMENT_ FAIL_ CLOSED - OOM_
REASON_ MEMORY_ LIMIT - WORKSPACE_
CONFIG_ PATHS - Workspace config paths to try when reading, newest canonical path first.
Functions§
- acquire_
acp_ spawn_ lock_ for_ slot - acquire_
name - acquire_
session_ name - active_
acp_ lock_ slot - active_
agent_ heartbeat_ stats - USS and process-count suffix for heartbeat payloads, when an agent session is live.
- assert_
no_ peer_ acp_ spawn_ lock_ for_ slot - assert_
no_ peer_ name_ lock - Cross-process guard: one live malvin process per session name.
- build_
identifier - canonical_
workflow_ name - Map a CLI subcommand name to its canonical workflow name.
- create_
run_ dir - Creates
~/.malvin_home/logs/<hash>/<timestamp>_<id>/forbase_dir(or the current directory). - format_
current_ state - Builds the multi-line
current_statebody for prompt templates. - gate_
iteration_ oom_ killed - generate_
auto_ name - generate_
auto_ name_ with - is_
valid_ malvin_ short_ id - malvin_
short_ id - name_
path - names_
registry_ root - parse_
holder_ pid - record_
sandbox_ oom_ kill - Writes or overwrites the run-directory OOM marker for the active gate iteration.
- release_
acp_ spawn_ lock - release_
name - resolve_
session_ log_ path - Resolve an on-disk session transcript path for
workflow, checking legacy log names. - resolve_
workspace_ malvin_ config_ path - Resolve workspace metadata config for reads (never for creates).
- set_
active_ acp_ lock_ slot - Records the session-name lock slot for this process (set at entrypoint when
--nameis used). - store_
db_ contains_ substring - sweep_
stale_ acp_ spawn_ locks - Remove stale lock files under
.malvin/acp_spawn/(invalid PID or dead holder). - test_
post_ teardown_ poll_ interval - test_
post_ teardown_ wait_ budget - test_
wait_ until_ async - user_
home_ dir - validate_
malvin_ short_ id - validate_
name