# Implementation Plan: Agent Tool Preference & Bias Tuning

## Phase 1: Data Model & Storage Extension [checkpoint: 77a0b38]
- [x] Task: Extend the `ToolPreset` and `Tool` models. 77a0b38
    - [x] Update `src/tool_presets.py` to include `weight` (int, 1-5) for tools. 77a0b38
    - [x] Add `parameter_bias` (dict mapping parameter names to priority strings) to the `Tool` model. 77a0b38
    - [x] Update `ToolPresetManager` to handle saving and loading these new fields from `tool_presets.toml`. 77a0b38
- [x] Task: Implement Global Bias Profiles. 77a0b38
    - [x] Define `BiasProfile` dataclass in `src/models.py`. 77a0b38
    - [x] Implement logic to store and retrieve these profiles from `tool_presets.toml`. 77a0b38
- [x] Task: Write unit tests for the extended data model and storage logic. 77a0b38
- [x] Task: Conductor - User Manual Verification 'Phase 1: Data Model Extension' (Protocol in workflow.md) 77a0b38

## Phase 2: Orchestration & Nudging Logic [checkpoint: cad04bf]
- [x] Task: Implement the `ToolBiasEngine` in `src/ai_client.py` (or a new module). cad04bf
    - [x] Implement `apply_semantic_nudges(tool_definitions, preset)`: This function should modify tool descriptions with priority tags. cad04bf
    - [x] Implement `generate_tooling_strategy(preset, global_bias)`: This function should return a Markdown string for the system prompt. cad04bf
- [x] Task: Integrate the bias engine into the AI client `send()` loop. cad04bf
    - [x] Ensure that for every agent turn, the tool definitions and system instructions are dynamically biased based on the active agent's role and selected preset. cad04bf
- [x] Task: Write integration tests for the bias generation logic. cad04bf
    - [x] Verify that high-weight tools correctly receive "[HIGH PRIORITY]" tags. cad04bf
    - [x] Verify that the strategy section is correctly appended to the system instructions. cad04bf
- [x] Task: Conductor - User Manual Verification 'Phase 2: Orchestration Logic' (Protocol in workflow.md) cad04bf

## Phase 3: GUI Integration [checkpoint: 1c83b3e]
- [x] Task: Update the Tool Preset Manager UI. 1c83b3e
    - [x] Add `imgui.slider_int` for each tool to adjust its weight. 1c83b3e
    - [x] Add a sub-menu or modal for editing parameter-level bias. 1c83b3e
- [x] Task: Enhance tool list visualization. 1c83b3e
    - [x] Implement color-coded priority badges in the Operations panel and tool settings. 1c83b3e
- [x] Task: Implement the "Bias Override" in the agent focus modal. 1c83b3e
    - [x] Add a dropdown to select a global bias profile or a specific preset override before spawning a worker. 1c83b3e
- [x] Task: Write integration tests for the new UI data flow. 1c83b3e
- [x] Task: Conductor - User Manual Verification 'Phase 3: GUI Integration' (Protocol in workflow.md) 1c83b3e

## Phase 4: Verification & Final Polish [checkpoint: 85ae409]
- [x] Task: Create a Bias Efficacy Simulation. 85ae409
    - [x] Implement a specialized simulation test where two tools could solve a problem, and verify the agent chooses the one with higher weight. 85ae409
- [x] Task: Final UI polish (spacing, icons, tooltips explaining the bias system). 85ae409
- [x] Task: Run full suite of relevant tests. 85ae409
- [x] Task: Conductor - User Manual Verification 'Phase 4: Verification & Polish' (Protocol in workflow.md) 85ae409
