Skip to main content

Crate malvin

Crate malvin 

Source
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 Command capture 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
--do workflow: 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
inspire subcommand: one-shot MBC2 boundary-exploration prompt from mbc2.md.
kpop_engine
kpop_log_protocol
KPopLogProtocol — parsed step headings in exp_log_*.md (see src/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 installed pi binary (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.mdkpop_common.mdrouter_a.md → optional router_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§

KpopTurnPrompts
RunDirOptions
Options for create_run_dir.
SandboxOomKillFacts
SandboxOomKillRecord
SessionNameGuard

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>/ for base_dir (or the current directory).
format_current_state
Builds the multi-line current_state body 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 --name is 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