# Final Design: The Dialectic Engine

## Executive Summary
The **Dialectic Engine** is a "Reasoning Support System" that helps users build robust arguments by mapping their thoughts into an IBIS (Issue-Based Information System) structure and autonomously stress-testing them against external knowledge. Unlike a simple search engine or a passive note-taker, it actively engages in a "Dialectic Process"—thesis, antithesis, synthesis—to refine the user's worldview.

## Core Components

### 1. The Mapper (Parser & Graph Builder)
- **Role**: Turns flat text into structured thought.
- **Mechanism**: Scans Markdown files for rhetorical patterns ("Because", "Therefore", "However").
- **Output**: A `memory` graph of `Issues`, `Positions`, and `Arguments`.
- **Tools**: `filesystem` (Read), `memory` (Write).

### 2. The Challenger (Researcher)
- **Role**: Prevents confirmation bias.
- **Mechanism**: For every leaf node in the graph (an Argument without further backing), it performs a `web_search` for counter-evidence.
- **Logic**: If User says "X is true", Agent searches "Arguments against X" or "Evidence refuting X".
- **Tools**: `web`, `fetch`.

### 3. The Scribe (Reporter)
- **Role**: Non-destructive feedback.
- **Mechanism**: Instead of editing the user's original file (which disrupts flow), it creates a sibling file (e.g., `Topic.dialectic.md`) containing the Argument Map visualization and "Open Questions" found by the Challenger.
- **Tools**: `filesystem` (Write).

## Execution Loop

1.  **Monitor**: Watch `/workspace/thoughts/` for changes.
2.  **Parse**: Extract IBIS structure from new content.
    *   *User*: "We should use Rust because it is memory safe."
    *   *Graph*: `Issue(Language?)` -> `Position(Rust)` -> `Argument(Memory Safety)`.
3.  **Evaluate**: Check graph density.
    *   *Agent*: "Argument(Memory Safety) has no 'Evidence' node."
4.  **Investigate**:
    *   *Action*: `web_search("Rust memory safety limitations cve")`
5.  **Report**: Update the Shadow Graph.
    *   *Output*: "Counter-point found: 'Rust unsafe blocks can still leak memory (Source: CVE-202X)'"
6.  **Notify**: Update `status.log` or the sidecar file.

## Persistence Strategy
*   **Primary**: **Memory Graph** (Neo4j/SQLite via MCP) holds the logical structure, citations, and status (Verified/Disputed).
*   **Secondary**: **Markdown Artifacts** allow the user to browse the argument map without special tools (using Mermaid.js diagrams generated by the agent).

## Autonomy Level
**Semi-Autonomous (Background Daemon)**. It reads and thinks on its own, but its "Speech" (writing) is confined to specific side-channels to avoid interrupting the user.

## Key Insight
Separating the **Argument Structure** (Logic) from the **Source Text** (Rhetoric) allows the agent to treat "Thinking" as a rigorous engineering process (Unit Testing for Ideas).
