# Matrx AI: Remaining Implementation Tasks

*This document explicitly tracks the remaining initiatives required to complete the Pi-Mono parity project according to our master plan. The safe refactors (Tail Truncation, Sniffer Scaffolding, Compaction Mapping) have been implemented. The following tasks require careful debugging and explicit APIs to be built.*

## 1. Implement Explicit Sandbox Edit Tool (AST/Fuzzy Diff)
**Difficulty:** Medium 
**Status:** Pending
**Location:** `matrx_ai/tools/implementations/code.py`
- We have addressed the tail-truncation of standard python execution properly.
- We still need to implement a dedicated `code_edit_file` tool that utilizes unified fuzz/AST differences (mirroring pi-mono's `edit-diff.ts`).
- **Safety check:** Do not implement blind `replace_contents` — enforce `old_text` exact matching.

## 2. API Endpoints & Exec Hooks for Context Compaction Tiers 1-5
**Difficulty:** Medium
**Status:** Pending
**Location:** `matrx_ai/orchestrator/executor.py`
- Scaffolding `compaction_settings` inside `UnifiedConfig` is finished.
- In `executor.py`, within the `while iteration < max_iterations:` loop, implement the byte-boundary measurement that actually *invokes* the compaction triggers at Tier 4 and Tier 5.
- Stub out logging triggers for Tiers 2 and 3 as defined.

## 3. Asynchronous Steering & Follow-up Injection
**Difficulty:** High (Requires Care)
**Status:** Pending
**Location:** `matrx_ai/orchestrator/executor.py`, `matrx_ai/orchestrator/requests.py`, API Routes
- Add `steering_queue: asyncio.Queue` inside `AIMatrixRequest`.
- Construct `/api/orchestrator/steer` POST endpoint in the unified routing layer.
- At the sync-boundary between Tool Resolution and LLM API call in `execute_until_complete()`, await a non-blocking queue pop. If populated, seamlessly inject it as a standard UI message directly into `current_request.config.messages` modifying the loop in place.

## 4. UI Surfacing of Sniffed Contexts
**Difficulty:** Low
**Status:** Pending
**Location:** React Admin Dashboard
- The `environment_sniffer.py` is established. It finds `.cursorrules` and other files and surfaces them inside the payload. 
- Ensure that the React Dashboard UI renders these properly inside `detected_contexts` inside the UI session start-up modal to give users a checkbox per-detected environment file before they execute.
