How saifmht19/mind-mirror-1 works
MindMirror is a research prototype for explaining manipulation signals in AI conversations. Its main workflow is a user submitting or editing a conversation in the React workspace, the FastAPI service sending visible turns to Gemini for per-turn predictions, and the service returning evidence-backed tactics and escalation risk for display. The product also includes local live simulation, comparison and context experiments, batch dataset analysis, and presentation views. Research-data generation and annotation are distinct supporting workflows. Some backend and UI wiring is unsampled; those relationships are included only where the README or excerpts support them.
Main entry points: App.tsx Workspace shell · main.py HTTP API · service.py Detection orchestration · schema.py Dialogue data schema
Components 23
Research workspace
- Workspace shell
frontend/src/App.tsx - Live simulator view
frontend/src/LiveSimulator.tsx - Side-by-side view
frontend/src/CompareSimulator.tsx - Context experiment view
frontend/src/ContextExperiment.tsx - Multi-turn experiment view
frontend/src/MultiTurnExperiment.tsx - Presentation tour
frontend/src/PresentationTour.tsx - Safety evidence view
frontend/src/WhyItMatters.tsx
Analysis service
- HTTP API
backend/main.py - Detection orchestration
backend/service.py - Gemini detector
backend/gemini.py - Escalation scoring
backend/escalation.py - Conversation validation
backend/schemas.py - Dataset analysis
backend/datasets.py
Conversation simulation
- Scenario simulator
backend/simulator.py
Research workflows
- Experiment runners
evaluation/context_experiment.py - Synthetic dialogue generation
generation/generator.py - Human annotation
annotation/labeler.py - Context model pipeline
models/train_context_model.py - Legacy model inference
models/inference.py
Research data
- Dialogue data schema
data/schema.py - Dataset importer
data/import_chatbotmanip.py
Other components
- Researcher
- Local Ollama model
Connections 26
- Researcher → Workspace shell: uses
README.md - Workspace shell → Live simulator view: shows
frontend/src/App.tsx - Workspace shell → Side-by-side view: shows
frontend/src/App.tsx - Workspace shell → Context experiment view: shows
frontend/src/App.tsx - Workspace shell → Multi-turn experiment view: shows
README.md - Workspace shell → Presentation tour: shows
frontend/src/App.tsx - Workspace shell → Safety evidence view: shows
frontend/src/App.tsx - Workspace shell → HTTP API: calls
README.md - HTTP API → Detection orchestration: routes analysis
backend/main.py - Detection orchestration → Conversation validation: validates with
backend/service.py - Detection orchestration → Gemini detector: requests predictions
backend/service.py - Detection orchestration → Escalation scoring: scores prediction
backend/service.py - HTTP API → Dataset analysis: supports batch analysis
README.md - HTTP API → Scenario simulator: registers routes
backend/main.py - Live simulator view → Scenario simulator: gets scenarios
README.md - Scenario simulator → Local Ollama model: generates replies
README.md - Live simulator view → HTTP API: submits visible turns
README.md - Side-by-side view → HTTP API: requests analysis
README.md - Context experiment view → Experiment runners: shows saved results
README.md - Multi-turn experiment view → Experiment runners: shows saved results
README.md - Experiment runners → Detection orchestration: runs detector
evaluation/context_experiment.py - Synthetic dialogue generation → Dialogue data schema: creates records
generation/generator.py - Human annotation → Dialogue data schema: labels samples
annotation/labeler.py - Dataset importer → Dialogue data schema: builds records
data/import_chatbotmanip.py - Context model pipeline → Dialogue data schema: loads data
models/train_context_model.py - Legacy model inference → Context model pipeline: uses features
models/inference.py