Repository navigation
API_Reference
Jules Martins edited this page May 10, 2026
·
1 revision
This section details the primary software contracts within mentask, including the core managers and the new Orchestration Layer introduced in v0.11.0.
The central reasoning engine. It coordinates managers to execute the cognitive loop autonomously.
-
Method
run_query(prompt, history): Executes the main Thinking -> Action -> Observation cycle with Stall Detection. -
Method
_get_level_instruction(level): Returns dynamic system instructions based on the classified engineering rigor. -
Method
_perform_context_snap(): Summarizes history to stay within token limits.
-
Method
classify(prompt): Uses a fast LLM pass to assign anEngineeringLevel(L0-L3) to the session.
Defines the mindset of the orchestrator:
-
L0_INQUIRY: Pure info, no tools. -
L1_PRAGMATIC: Fast execution, shell fallback. -
L2_STANDARD: Standard Research-Execute cycle. -
L3_ARCHITECT: Maximum rigor, forces formal planning.
Serves as the high-level CLI agent entry point.
-
Method
start(): Initializes the interactive terminal session and launches the Orchestrator loop.
-
ensure_session(config): Lazy-loads the chat session with retry-resilient generative configurations.
-
_get_project_blueprint(): Performs the recursive project scan on startup. -
build_system_instruction(): Injects the Blueprint, Memory, and Active Missions into the prompt.
-
process_async_stream(...): Consumes generators and extracts tool calls mid-flight.
-
handle_command(cmd_text): Dispatcher for slash commands including the new/trustsystem.
The security centinel for directory-level authorization.
-
is_trusted(path): Validates if a path is within the workspace or the whitelist. -
add_trust(path),remove_trust(path): Manage the permanent trust whitelist.
-
analyze_command_safety(command): Runs risk analysis returning a categorizedSafetyReport. -
ensure_safe_path(path): Standardizes and validates paths, protecting against drive-letter escapes on Windows.
-
get_working_dir(): Automatically detects if a.mentask/folder exists in the project root. -
get_config_dir(): Returns the local workspace directory if available, or falls back to global~/.mentask.
Function manage_workspace(action) [New in v0.11.0]
Handles local project initialization and workspace metadata synchronization.
Function read_file(path, ...), edit_file(path, ...), execute_bash(command)
Core agentic tools, now strictly gated by TrustManager before execution.