3.5 KiB
Manual Slop: Tooling & IPC Technical Reference
A deep-dive into the Model Context Protocol (MCP) bridge, the Hook API, and the "Human-in-the-Loop" communication protocol.
1. The MCP Bridge: Filesystem Security
The AI's ability to interact with your filesystem is mediated by a strict security allowlist.
Path Resolution & Sandboxing
Every tool accessing the disk (e.g., read_file, list_directory, search_files) executes _resolve_and_check(path):
- Normalization: The requested path is converted to an absolute path.
- Constraint Check: The path must reside within the project's
base_dir. - Enforcement: Violations trigger a
PermissionError, returned to the model as anACCESS DENIEDstatus.
Native Toolset
read_file(path): UTF-8 extraction, clamped by token budgets.list_directory(path): Returns a structural map (Name, Type, Size).get_file_summary(path): AST-based heuristic parsing for high-signal architectural mapping without full-file read costs.web_search(query): Scrapes DuckDuckGo raw HTML via a dependency-free parser.
2. The Hook API: Remote Control & Telemetry
Manual Slop exposes a REST-based IPC interface (running by default on port 8999) to facilitate automated verification and external monitoring.
Core Endpoints
GET /status: Engine health and hook server readiness.GET /mma_status: Retrieves the 4-Tier state, active track metadata, and current ticket DAG status.POST /api/gui: Pushes events into theAsyncEventQueue.- Payload example:
{"action": "set_value", "item": "current_provider", "value": "anthropic"}
- Payload example:
GET /diagnostics: High-frequency telemetry for UI performance (FPS, CPU, Input Lag).
ApiHookClient Implementation
The api_hook_client.py provides a robust wrapper for the Hook API:
- Synchronous Wait:
wait_for_server()polls/statuswith exponential backoff. - State Polling:
wait_for_value()blocks until a specific GUI element matches an expected state. - Remote Interaction:
click(),set_value(), andselect_tab()methods allow external agents to drive the GUI.
3. The HITL IPC Flow: ask/respond
Manual Slop supports a synchronous "Human-in-the-Loop" request pattern for operations requiring explicit confirmation or manual data mutation.
Sequence of Operation
- Request: A background agent (e.g., a Tier 3 Worker) calls
/api/askwith a JSON payload. - Intercept: the
HookServergenerates a uniquerequest_idand pushes atype: "ask"event to the GUI's_pending_gui_tasks. - Modal Display: The GUI renders an
Approve/Rejectmodal with the payload details. - Response: Upon user action, the GUI thread
POSTs to/api/ask/respond. - Resume: The original agent call to
/api/ask(which was polling for completion) unblocks and receives the user's response.
This pattern is the foundation of the Execution Clutch, ensuring that no destructive action occurs without an auditable human signal.
4. Synthetic Context Refresh
To minimize token churn and redundant read_file calls, the ai_client performs a post-tool-execution refresh:
- Detection: Triggered after the final tool call in a reasoning round.
- Collection: re-reads all project-tracked files from disk.
- Injection: The updated content is injected into the next LLM turn as a
[SYSTEM: FILES UPDATED]block. - Pruning: Older snapshots are stripped from history in subsequent rounds to maintain a lean context window.