# Documentation Index

[Top](../Readme.md)

---

## Overview

This documentation suite provides comprehensive technical reference for the Manual Slop application — a GUI orchestrator for local LLM-driven coding sessions. The guides follow a strict old-school technical documentation style, emphasizing architectural depth, state management details, algorithmic breakdowns, and structural formats.

---

## Guides

| Guide | Contents |
|---|---|
| [Architecture](guide_architecture.md) | Thread domains (GUI Main, Asyncio Worker, HookServer, Ad-hoc), cross-thread data structures (AsyncEventQueue, Guarded Lists, Condition-Variable Dialogs), event system (EventEmitter, SyncEventQueue, UserRequestEvent), application lifetime (boot sequence, shutdown sequence), task pipeline (producer-consumer synchronization), Execution Clutch (HITL mechanism with ConfirmDialog, MMAApprovalDialog, MMASpawnApprovalDialog), AI client multi-provider architecture (Gemini SDK, Anthropic, DeepSeek, Gemini CLI, MiniMax), Anthropic/Gemini caching strategies (4-breakpoint system, server-side TTL), context refresh mechanism (mtime-based file re-reading, diff injection), comms logging (JSON-L format), state machines (ai_status, HITL dialog state) |
| [Meta-Boundary](guide_meta_boundary.md) | Explicit distinction between the Application's domain (Strict HITL — `gui_2.py`, `ai_client.py`, `multi_agent_conductor.py`, `dag_engine.py`) and the Meta-Tooling domain (`scripts/mma_exec.py`, `scripts/claude_mma_exec.py`, `scripts/tool_call.py`, `scripts/mcp_server.py`, `.gemini/`, `.claude/`), preventing feature bleed and safety bypasses via shared bridges like `mcp_client.py`. Documents the Inter-Domain Bridges (`cli_tool_bridge.py`, `claude_tool_bridge.py`) and the `GEMINI_CLI_HOOK_CONTEXT` environment variable. |
| [Tools & IPC](guide_tools.md) | MCP Bridge 3-layer security model (Allowlist Construction, Path Validation, Resolution Gate), all 45 MCP tool signatures (plus `run_powershell` from `src/shell_runner.py`, for a canonical 46 in `models.AGENT_TOOL_NAMES`) with parameters and behavior (File I/O, AST-Based, Analysis, Network, Runtime, Beads), Hook API GET/POST endpoints with request/response formats, ApiHookClient method reference (Connection Methods, State Query Methods, GUI Manipulation Methods, Polling Methods, HITL Method), `/api/ask` synchronous HITL protocol (blocking request-response over HTTP), session logging (comms.log, toolcalls.log, apihooks.log, clicalls.log, scripts/generated/*.ps1), shell runner (mcp_env.toml configuration, run_powershell function with 60s timeout, qa_callback and patch_callback integration for Tier 4 QA + auto-patch) |
| [MMA Orchestration](guide_mma.md) | Ticket/Track/WorkerContext data structures (from `models.py`), DAG engine (TrackDAG class with cycle detection, topological sort, cascade_blocks; ExecutionEngine class with tick-based state machine), ConductorEngine execution loop (run method, _push_state for state broadcast, parse_json_tickets for ingestion), Tier 2 ticket generation (generate_tickets, topological_sort), Tier 3 worker lifecycle (run_worker_lifecycle with Context Amnesia, AST skeleton injection, HITL clutch integration via confirm_spawn and confirm_execution), Tier 4 QA integration (run_tier4_analysis, run_tier4_patch_callback), token firewalling (tier_usage tracking, model escalation), track state persistence (TrackState, save_track_state, load_track_state, get_all_tracks) |
| [Simulations](guide_simulations.md) | Structural Testing Contract (Ban on Arbitrary Core Mocking, `live_gui` Standard, Artifact Isolation), `live_gui` pytest fixture lifecycle (spawning, readiness polling, failure path, teardown, session isolation via reset_ai_client), VerificationLogger for structured diagnostic logging, process cleanup (kill_process_tree for Windows/Unix), Puppeteer pattern (8-stage MMA simulation with mock provider setup, epic planning, track acceptance, ticket loading, status transitions, worker output verification), mock provider strategy (`tests/mock_gemini_cli.py` with JSON-L protocol, input mechanisms, response routing, output protocol), visual verification patterns (DAG integrity, stream telemetry, modal state, performance monitoring), supporting analysis modules (ASTParser with tree-sitter, summarize.py heuristic summaries, outline_tool.py hierarchical outlines) |
| [Context Curation](guide_context_curation.md) | Granular AST control (per-symbol masking as Def, Sig, or Hide for C/C++ files via `ts_cpp_get_skeleton` and `ts_c_get_skeleton`), Fuzzy Anchor Slices (resilient line ranges that survive file modifications via `fuzzy_anchor.py`), Interactive AST Tree Masking (modal flow for inspecting and masking individual classes/functions), Batch Operations (multi-select and batch state modification for the Context Panel), Context Snapshotting (per-Take state restoration via `HistoryManager`), Aggregation Pipeline integration (mask application order, view mode merging) |
| [Shaders & Window](guide_shaders_and_window.md) | Hybrid shader injection strategy (ImDrawList primitives combined with PyOpenGL FBO for advanced effects), pure ImGui borderless window implementation (cross-platform compatible, custom drag/minimize/maximize/close via pywin32 on Windows), event metrics integration for shader performance tracking |
| [RAG](guide_rag.md) | Vector store lifecycle, chunking strategies (character-based and AST-aware), embedding providers (local sentence-transformers, Gemini Embedding 001), ChromaDB integration, parallelized indexing pipeline with mtime-based incremental updates, deep discussion integration with `[RETRIEVED CONTEXT]` injection, full public API surface with edge cases and limitations |
| [Beads](guide_beads.md) | Dolt-backed issue tracking (planned), current mock implementation (`.beads_mock/beads.json`), `BeadsClient` CRUD, MCP tool integration (`bd_create`, `bd_list`, `bd_update`, `bd_ready`), MMA integration roadmap, testing patterns, migration path from mock to real Dolt |
| [Hot Reload](guide_hot_reload.md) | State-preserving module reloading (`HotReloader` and `HotModule`), UI delegation pattern enabling selective swap of rendering functions, capture-reload-restore-or-rollback lifecycle, keyboard trigger (Ctrl+Alt+R), visual error tint feedback, what can/cannot be safely reloaded |
| [Personas](guide_personas.md) | Unified agent profile model consolidating model settings (`preferred_models`), system prompt, tool preset, bias profile, context preset, and aggregation strategy, `PersonaManager` CRUD, scope-based inheritance (global vs project), MMA application flow in `run_worker_lifecycle`, editor modal fields |
| [NERV Theme](guide_nerv_theme.md) | "Black Void" palette with NERV orange/red/green/blue accents, zero-rounding geometry, CRT-style visual effects (scanlines, status flickering, alert animations), `theme_nerv.py` and `theme_nerv_fx.py` modules, FBO shader pipeline, configuration keys, performance cost, accessibility caveats |
| [Workspace Profiles](guide_workspace_profiles.md) | Docking layouts, window visibility, and per-panel state persistence, `WorkspaceProfile` schema (4 fields: `name`, `ini_content: str`, `show_windows`, `panel_states`), `WorkspaceManager` CRUD, scope inheritance (Global and Project), contextual auto-switch (experimental) binding profiles to MMA tier or task context, multi-monitor limitations |
| [Command Palette](guide_command_palette.md) | Fuzzy command resolution with subsequence matching and scoring, async context preview worker to prevent UI hangs, "Everything" mode for cross-domain search (commands, files, symbols, history, settings), streaming results via thread-safe queue, cancellation on query change, 50+ built-in commands, user-defined commands via TOML |
| [Testing](guide_testing.md) | 322 test files, 5 test categories (unit, integration, live_gui, perf, simulation), 7 conftest fixtures (`isolate_workspace`, `reset_paths`, `reset_ai_client`, `vlogger`, `kill_process_tree`, `mock_app`, `live_gui` session-scoped), Hook API testing pattern, Puppeteer pattern for MMA simulation, mock provider strategy, opt-in clean install test, opt-in docker test, coverage targets, anti-patterns (no arbitrary core mocking, artifact isolation to `tests/artifacts/`), early-render C-level crash pattern (`_ini_capture_ready` defer-not-catch for `imgui.save_ini_settings_to_memory`), live_gui authoring contract (wait-for-ready pattern over `time.sleep`, narrow test paths over kitchen-sink `render_main_interface` mocks), test-ordering sensitivity (session-scoped fixture) |
| [Themes](guide_themes.md) | TOML-based theming system: file layout (`themes/<name>.toml` global + `project_themes.toml` per-project), schema (`syntax_palette` + `[colors]` table with `imgui.Col_` snake_case keys), 4-syntax-palette upstream limit (`imgui-bundle` ships `dark`/`light`/`mariana`/`retro_blue` only), built-in vs TOML palette dispatch, `load_themes_from_disk` / `get_syntax_palette_for_theme` / `apply_syntax_palette` public API, hot-reload behavior, color-callable convention (`C_LBL()` / `C_VAL()` for theme-aware helpers) |
| [GUI Main](guide_gui_2.md) | `src/gui_2.py` reference: App class lifecycle, ~90 module-level render functions (UI Delegation Pattern), immgui immediate-mode rendering, Multi-Viewport docks, panel registry, command palette integration, ImGuiScope context managers, hot reload support, key bindings (Ctrl+Shift+P, Ctrl+Alt+R, Ctrl+Z/Y), `_capture_workspace_profile` defer-not-catch pattern (line 813-841, `_ini_capture_ready` flag for `imgui.save_ini_settings_to_memory`), theme color-callable pattern (e.g. `DIR_COLORS`/`KIND_COLORS` dicts store `C_VAL` not `C_VAL()` and are called at use site), `__getattr__` ui_ attrs hasattr-guard (bcdc26d0 silent-None fix), `_LazyModule` / `_FiledialogStub` lazy import proxies, `startup_profiler` + `render_warmup_status_indicator` integration, native `_detect_refresh_rate_win32` (ctypes.EnumDisplaySettingsW) |
| [AI Client](guide_ai_client.md) | `src/ai_client.py` reference: multi-provider LLM singleton (5 providers: Gemini, Anthropic, DeepSeek, MiniMax, Gemini CLI), async dispatch with `asyncio.gather`, threading.local for source tier tagging, context caching (Anthropic ephemeral + Gemini explicit), system prompt assembly, error interception for Tier 4 QA |
| [API Hooks](guide_api_hooks.md) | `src/api_hooks.py` + `src/api_hook_client.py` reference: HookServer on `127.0.0.1:8999`, ApiHookClient Python wrapper, 8+ endpoints (`/status`, `/api/gui`, `/api/ask`, `/api/gui/mma_status`, `/api/performance`, `/api/comms`, `/api/diagnostics`), Remote Confirmation Protocol via `/api/ask` (synchronous blocking HITL), `custom_callback` action for invoking any registered App method |
| [MCP Client](guide_mcp_client.md) | `src/mcp_client.py` reference: 45 native tools (File I/O, Python AST, C/C++ AST, Analysis, Network, Runtime, Beads), 3-layer security model (Allowlist Construction, Path Validation, Resolution Gate), `dispatch()`/`async_dispatch()` entry points, ExternalMCPManager for external MCP servers (Stdio + SSE), JSON-RPC 2.0 engine, public API, configuration |
| [App Controller](guide_app_controller.md) | `src/app_controller.py` reference: headless orchestrator owning AppState and all subsystem managers (PresetManager, PersonaManager, ContextPresetManager, ToolPresetManager, ToolBiasEngine, RAGEngine, HistoryManager, WorkspaceManager, HookServer, HotReloader, PathManager), `_predefined_callbacks` and `_gettable_fields` registries for Hook API, SyncEventQueue bridge, preset/persona/context coordination, headless mode |
| [MMA Engine](guide_multi_agent_conductor.md) | `src/multi_agent_conductor.py` + `src/dag_engine.py` reference: TrackDAG with cycle detection (iterative DFS) and topological sort (Kahn's variant), ExecutionEngine with Auto-Queue / Step Mode state machine, MultiAgentConductor with WorkerPool (configurable concurrency, default 4), mma_exec.py sub-agent invocation for Token Firewall, parse_plan_md utility, Beads mode delegation |
| [Data Models](guide_models.md) | `src/models.py` reference: centralized data model registry using pydantic + dataclasses, model categories (Core, AI, Preset, Persona, Context, MMA, UI State, Logging, Hook, Workspace, RAG), `AGENT_TOOL_NAMES` canonical 45-tool list, `PROVIDERS` constant, `parse_plan_md` utility, validation patterns, SDM tags, serialization strategies (TOML, JSON-L) |
| [Discussions](guide_discussions.md) | The Discussion system: 23-operation matrix A1-A7 (per-entry) + B1-B11 (discussion-level) + C1-C5 (undo/redo), Take naming convention (`<base>_take_<n>`), branching at any entry (`project_manager.branch_discussion`), promotion to top-level (`project_manager.promote_take`), user-managed role list (`app.disc_roles`), per-role filter linked to MMA persona focus, `_disc_entries_lock` thread-safety contract, Hook API session endpoints |
| [State Lifecycle](guide_state_lifecycle.md) | Undo/redo via `HistoryManager` + `UISnapshot` (13 captured fields, 100-snapshot capacity, debounced change detection at render frame), reset flow (`_handle_reset_session` — clears 30+ fields, replaces project, preserves `active_project_path` per the 2026-06-08 regression fix), `App.__getattr__`/`__setattr__` state delegation to Controller, 8-thread io_pool with 11 lock-protected regions (per `IO_POOL_MAX_WORKERS = 8` in `src/io_pool.py:20`; bumped 4→8 in 4a338486 on 2026-06-06), hot-reload integration |
| [Context Aggregation](guide_context_aggregation.md) | The `aggregate.py` (518-line) pipeline: 3 aggregation strategies (`auto`/`summarize`/`full`), 7 per-file view modes (`full`/`summary`/`skeleton`/`outline`/`masked`/`custom`/`none`), full `FileItem` schema (9 fields + `__post_init__` normalizer), `ContextPreset` schema and `ContextPresetManager`, Tier 3 worker variant (`build_tier3_context` with FuzzyAnchor re-resolution and focus-file handling), `force_full`/`auto_aggregate` short-circuits, output file numbering, cache strategy (static prefix + dynamic history) |

---

## Legacy MMA Reference (Deprecated)

*These documents are preserved for historical context. They describe a pre-Feb 2026 architecture and may not reflect current implementation. Prefer the guides above.*

- [MMA_Support Overview](MMA_Support/Overview.md)
- [MMA_Support Architecture Recommendation](MMA_Support/Architecture_Recommendation.md)
- [MMA_Support Data Pipelines and Config](MMA_Support/Data_Pipelines_and_Config.md)
- [MMA_Support Final Analysis Report](MMA_Support/Final_Analysis_Report.md)
- [MMA_Support Implementation Tracks](MMA_Support/Implementation_Tracks.md)
- [MMA_Support Orchestrator Engine](MMA_Support/Orchestrator_Engine.md)
- [MMA_Support Tier 1 Orchestrator](MMA_Support/Tier1_Orchestrator.md)
- [MMA_Support Tier 2 Tech Lead](MMA_Support/Tier2_TechLead.md)
- [MMA_Support Tier 3 Workers](MMA_Support/Tier3_Workers.md)
- [MMA_Support Tier 4 Utility](MMA_Support/Tier4_Utility.md)
- [MMA_Support Original Discussion](MMA_Support/OriginalDiscussion.md)
- [MMA_Support mma_tiered_orchestrator_skill](MMA_Support/mma_tiered_orchestrator_skill.md)

---

## GUI Panels

### Context Hub

The primary panel for project and file management.

- **Project Selector**: Switch between `<project>.toml` configurations. Changing projects swaps the active file list, discussion history, and settings.
- **Git Directory**: Path to the repository for commit tracking and git operations.
- **Main Context File**: Optional primary context document for the project.
- **Output Dir**: Directory where generated markdown files are written.
- **Word-Wrap Toggle**: Dynamically swaps text rendering in large read-only panels between unwrapped (code formatting) and wrapped (prose).
- **Summary Only**: When enabled, sends file structure summaries instead of full content to reduce token usage.
- **Auto-Scroll Comms/Tool History**: Automatically scrolls to the bottom when new entries arrive.

### Files & Media Panel

Controls what context is compiled and sent to the AI.

- **Base Dir**: Root directory for path resolution and MCP tool constraints.
- **Paths**: Explicit files or wildcard globs (`src/**/*.py`).
- **File Flags**:
  - **Auto-Aggregate**: Include in context compilation.
  - **Force Full**: Bypass summary-only mode for this file.
- **Cache Indicator**: Green dot (●) indicates file is in provider's context cache.

### Discussion Hub

Manages conversational branches to prevent context poisoning across tasks.

- **Discussions Sub-Menu**: Create separate timelines for different tasks (e.g., "Refactoring Auth" vs. "Adding API Endpoints").
- **Git Commit Tracking**: "Update Commit" reads HEAD from the project's git directory and stamps the discussion.
- **Entry Management**: Each turn has a Role (User, AI, System, Context, Tool, Vendor API). Toggle between Read/Edit modes, collapse entries, or open in the Global Text Viewer via `[+ Max]`.
- **Auto-Add**: When toggled, Message panel sends and Response panel returns are automatically appended to the current discussion.
- **Truncate History**: Reduces history to N most recent User/AI pairs.

### AI Settings Panel

- **Provider**: Switch between API backends (Gemini, Anthropic, DeepSeek, Gemini CLI, MiniMax).
- **Model**: Select from available models for the current provider.
- **Fetch Models**: Queries the active provider for the latest model list.
- **Temperature / Max Tokens**: Generation parameters.
- **History Truncation Limit**: Character limit for truncating old tool outputs.

### Token Budget Panel

- **Current Usage**: Real-time token counts (input, output, cache read, cache creation).
- **Budget Percentage**: Visual indicator of context window utilization.
- **Provider-Specific Limits**: Anthropic (180K prompt), Gemini (900K input).

### Cache Panel

- **Gemini Cache Stats**: Count, total size, and list of cached files.
- **Clear Cache**: Forces cache invalidation on next send.

### Tool Analytics Panel

- **Per-Tool Statistics**: Call count, total time, failure count for each tool.
- **Session Insights**: Burn rate estimation, average latency.

### Message & Response Panels

- **Message**: User input field with auto-expanding height.
- **Gen + Send**: Compiles markdown context and dispatches to the AI via `AsyncEventQueue`.
- **MD Only**: Dry-runs the compiler for context inspection without API cost.
- **Response**: Read-only output; flashes green on new response.

### Operations Hub

- **Focus Agent Filter**: Show comms/tool history for specific tier (All, Tier 2, Tier 3, Tier 4).
- **Comms History**: Real-time display of raw API traffic (timestamp, direction, kind, provider, model, payload preview).
- **Tool Calls**: Sequential log of tool invocations with script/args and result preview.

### MMA Dashboard

The 4-tier orchestration control center.

- **Track Browser**: List of all tracks with status, progress, and actions (Load, Delete).
- **Active Track Summary**: Color-coded progress bar, ticket status breakdown (Completed, In Progress, Blocked, Todo), ETA estimation.
- **Visual Task DAG**: Node-based visualization using `imgui-node-editor` with color-coded states (Ready, Running, Blocked, Done).
- **Ticket Queue Management**: Bulk operations (Execute, Skip, Block), drag-and-drop reordering, priority assignment.
- **Tier Streams**: Real-time output from Tier 1/2/3/4 agents.

### Tier Stream Panels

Dedicated windows for each MMA tier:

- **Tier 1: Strategy**: Orchestrator output for epic planning and track initialization.
- **Tier 2: Tech Lead**: Architectural decisions and ticket generation.
- **Tier 3: Workers**: Individual worker output streams (one per active ticket).
- **Tier 4: QA**: Error analysis and diagnostic summaries.

### Log Management

- **Session Registry**: Table of all session logs with metadata (start time, message count, size, whitelist status).
- **Star/Unstar**: Mark sessions for preservation during pruning.
- **Force Prune**: Manually trigger aggressive log cleanup.

### Diagnostics Panel

- **Performance Telemetry**: FPS, Frame Time, CPU %, Input Lag with moving averages.
- **Detailed Component Timings**: Per-panel rendering times with threshold alerts.
- **Performance Graphs**: Historical plots for selected metrics.

---

## Configuration Files

### config.toml (Global)

```toml
[ai]
provider = "gemini"
model = "gemini-2.5-flash-lite"
temperature = 0.0
max_tokens = 8192
history_trunc_limit = 8000
system_prompt = ""

[projects]
active = "path/to/project.toml"
paths = ["path/to/project.toml"]

[gui]
separate_message_panel = false
separate_response_panel = false
separate_tool_calls_panel = false
show_windows = { "Context Hub": true, ... }

[paths]
logs_dir = "logs/sessions"
scripts_dir = "scripts/generated"
conductor_dir = "conductor"

[mma]
max_workers = 4
```

### <project>.toml (Per-Project)

```toml
[project]
name = "my_project"
git_dir = "./my_repo"
system_prompt = ""
main_context = ""

[files]
base_dir = "."
paths = ["src/**/*.py"]
tier_assignments = { "src/core.py" = 1 }

[screenshots]
base_dir = "."
paths = []

[output]
output_dir = "./md_gen"

[gemini_cli]
binary_path = "gemini"

[deepseek]
reasoning_effort = "medium"

[agent.tools]
run_powershell = true
read_file = true
list_directory = true
search_files = true
get_file_summary = true
web_search = true
fetch_url = true
py_get_skeleton = true
py_get_code_outline = true
get_file_slice = true
set_file_slice = false
edit_file = false
py_get_definition = true
py_update_definition = false
py_get_signature = true
py_set_signature = false
py_get_class_summary = true
py_get_var_declaration = true
py_set_var_declaration = false
get_git_diff = true
py_find_usages = true
py_get_imports = true
py_check_syntax = true
py_get_hierarchy = true
py_get_docstring = true
get_tree = true
get_ui_performance = true

[mma]
epic = ""
active_track_id = ""
tracks = []
```

### credentials.toml

```toml
[gemini]
api_key = "YOUR_KEY"

[anthropic]
api_key = "YOUR_KEY"

[deepseek]
api_key = "YOUR_KEY"

[minimax]
api_key = "YOUR_KEY"
```

### mcp_env.toml (Optional)

```toml
[path]
prepend = ["C:/custom/bin"]

[env]
MY_VAR = "some_value"
EXPANDED = "${HOME}/subdir"
```

---

## Environment Variables

| Variable | Purpose |
|---|---|
| `SLOP_CONFIG` | Override path to `config.toml` |
| `SLOP_CREDENTIALS` | Override path to `credentials.toml` |
| `SLOP_MCP_ENV` | Override path to `mcp_env.toml` |
| `SLOP_TEST_HOOKS` | Set to `"1"` to enable test hooks |
| `SLOP_LOGS_DIR` | Override logs directory |
| `SLOP_SCRIPTS_DIR` | Override generated scripts directory |
| `SLOP_CONDUCTOR_DIR` | Override conductor directory |
| `GEMINI_CLI_HOOK_CONTEXT` | Set by bridge scripts to bypass HITL for sub-agents |
| `CLAUDE_CLI_HOOK_CONTEXT` | Set by bridge scripts to bypass HITL for sub-agents |

---

## Exit Codes

| Code | Meaning |
|---|---|
| 0 | Normal exit |
| 1 | General error |
| 2 | Configuration error |
| 3 | API error |
| 4 | Test failure |

---

## File Layout

```
manual_slop/
├── conductor/              # Conductor system
│   ├── tracks/             # Track directories
│   │   └── <track_id>/     # Per-track files
│   │       ├── spec.md
│   │       ├── plan.md
│   │       ├── metadata.json
│   │       └── state.toml
│   ├── archive/            # Completed tracks
│   ├── product.md          # Product definition
│   ├── product-guidelines.md
│   ├── tech-stack.md
│   ├── workflow.md
│   ├── index.md
│   └── edit_workflow.md
├── docs/                   # Deep-dive documentation (27 guides + specs/plans)
│   ├── guide_ai_client.md          # Multi-provider LLM client
│   ├── guide_api_hooks.md          # HookServer + ApiHookClient
│   ├── guide_app_controller.md     # Headless AppController
│   ├── guide_architecture.md       # Threading, event system, state machines
│   ├── guide_beads.md              # Beads/Dolt issue tracking
│   ├── guide_command_palette.md    # Command palette + 33 registered commands
│   ├── guide_context_aggregation.md # aggregate.py pipeline (strategies + view modes)
│   ├── guide_context_curation.md   # Granular AST control + Fuzzy Anchor slices
│   ├── guide_discussions.md        # Discussion system + A1-A7 matrix
│   ├── guide_docker_deployment.md  # Docker + Gitea registry deployment
│   ├── guide_gui_2.md              # Main ImGui interface (App class, render functions)
│   ├── guide_hot_reload.md         # State-preserving module reloading
│   ├── guide_mcp_client.md         # 45 MCP tools + 3-layer security
│   ├── guide_meta_boundary.md      # Application vs Meta-Tooling split
│   ├── guide_mma.md                # 4-Tier MMA concepts
│   ├── guide_models.md             # Data model registry
│   ├── guide_multi_agent_conductor.md # ConductorEngine + TrackDAG + WorkerPool
│   ├── guide_nerv_theme.md         # NERV Tactical Console theme
│   ├── guide_personas.md           # Unified agent profile system
│   ├── guide_rag.md                # RAG subsystem (ChromaDB + embeddings)
│   ├── guide_shaders_and_window.md # Shader injection + custom window frame
│   ├── guide_simulations.md        # Test framework + Puppeteer pattern
│   ├── guide_state_lifecycle.md    # Undo/redo + state delegation
│   ├── guide_testing.md            # 322 test files + 7 conftest fixtures
│   ├── guide_themes.md             # Multi-theme TOML system
│   ├── guide_tools.md              # MCP tools + shell runner
│   ├── guide_workspace_profiles.md # Workspace profile save/load
│   ├── Readme.md
│   ├── MMA_Support/        # Legacy MMA reference (deprecated)
│   ├── reports/            # Phase 5 reports
│   └── superpowers/        # Specs and plans for design work
├── src/                    # Core implementation (53 modules)
│   ├── gui_2.py            # Primary ImGui interface
│   ├── app_controller.py   # Headless controller
│   ├── ai_client.py        # Multi-provider LLM (Gemini, Anthropic, DeepSeek, MiniMax)
│   ├── mcp_client.py       # 45 MCP tools + 1 shell runner (canonical 46) with 3-layer security
│   ├── api_hooks.py        # HookServer REST API on :8999
│   ├── api_hook_client.py  # Python client for the Hook API
│   ├── multi_agent_conductor.py  # ConductorEngine
│   ├── dag_engine.py       # TrackDAG + ExecutionEngine
│   ├── models.py           # Ticket, Track, WorkerContext, etc.
│   ├── events.py           # EventEmitter, SyncEventQueue
│   ├── project_manager.py  # TOML persistence, discussion management
│   ├── session_logger.py   # JSON-L + markdown audit trails
│   ├── rag_engine.py       # RAG (ChromaDB + embedding providers)
│   ├── beads_client.py     # Beads/Dolt issue tracking client
│   ├── hot_reloader.py     # State-preserving module reloader
│   ├── personas.py         # Unified agent profile manager
│   ├── presets.py          # System prompt preset manager
│   ├── context_presets.py  # Context composition preset manager
│   ├── tool_presets.py     # Tool preset manager
│   ├── tool_bias.py        # Tool bias engine
│   ├── command_palette.py  # Command palette + fuzzy matcher
│   ├── commands.py         # 33 registered commands
│   ├── workspace_manager.py # Workspace profile save/load
│   ├── theme_2.py          # Theme system (palette/font/etc.)
│   ├── theme_nerv.py       # NERV Tactical Console theme
│   ├── theme_nerv_fx.py    # NERV FX (scanlines, flicker, alert)
│   ├── shell_runner.py     # PowerShell execution with 60s timeout + qa_callback + patch_callback
│   ├── file_cache.py       # ASTParser (tree-sitter)
│   ├── summarize.py        # Heuristic file summaries
│   ├── outline_tool.py     # Hierarchical code outline
│   ├── fuzzy_anchor.py     # Fuzzy anchor slice algorithm
│   ├── history.py          # Undo/redo HistoryManager
│   ├── imgui_scopes.py     # ImGui context managers
│   ├── performance_monitor.py  # FPS/CPU tracking
│   ├── log_registry.py     # Session metadata
│   ├── log_pruner.py       # Automated log cleanup
│   ├── paths.py            # Centralized path resolution
│   ├── cost_tracker.py     # Token cost estimation
│   ├── gemini_cli_adapter.py  # CLI subprocess adapter
│   ├── mma_prompts.py      # Tier-specific system prompts
│   ├── summary_cache.py    # SHA256-keyed summary LRU cache
│   ├── markdown_helper.py  # Markdown rendering helpers
│   ├── patch_modal.py      # Patch approval modal
│   ├── diff_viewer.py      # Diff rendering
│   ├── external_editor.py  # External editor integration
│   ├── orchestrator_pm.py  # Orchestrator project manager
│   ├── conductor_tech_lead.py  # Tier 2 ticket generation
│   ├── synthesis_formatter.py  # Multi-take synthesis
│   ├── thinking_parser.py  # AI thinking-trace extraction
│   └── __init__.py
├── simulation/             # Test simulations
│   ├── sim_base.py         # BaseSimulation class
│   ├── workflow_sim.py     # WorkflowSimulator
│   ├── user_agent.py       # UserSimAgent
│   ├── sim_context.py      # ContextSimulation
│   ├── sim_execution.py    # ExecutionSimulation
│   ├── sim_ai_settings.py  # AISettingsSimulation
│   └── sim_tools.py        # ToolsSimulation
├── tests/                  # Test suite (251 files)
│   ├── conftest.py         # Fixtures (live_gui, isolate_workspace, etc.)
│   ├── mock_gemini_cli.py   # Mock provider for integration tests
│   ├── test_*.py           # Unit tests
│   ├── *_sim.py            # Integration tests using live_gui
│   ├── test_clean_install.py  # Opt-in: clones repo and verifies hooks
│   ├── test_docker_build.py   # Opt-in: builds Docker image
│   ├── artifacts/          # Git-ignored; test outputs
│   └── logs/               # Git-ignored; live_gui log files
├── scripts/                # Utility scripts
│   ├── generated/          # AI-generated scripts
│   ├── check_test_toml_paths.py  # Audit script (CI gate)
│   ├── docker_build.sh
│   └── docker_run.sh
├── sloppy.py               # Main entry point
├── config.toml             # Global configuration
├── manual_slop.toml        # Active project config (current)
└── credentials.toml        # API keys (gitignored)
```
