How imbdy/trace works
Trace is an AI debugging companion: a user submits a Debug or Explain request, the desktop frontend sends it to a loopback backend, and the backend gathers evidence, consults Ollama, verifies cited locations, and returns a report. The report can include a verified patch; history and follow-ups support continued investigation. Both Electron and Tkinter frontends are present. Edges reflect the README, excerpts, and SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: investigation_engine.py Agent investigation graph · server.py Loopback API server · main.ts Electron shell · api_client.py Loopback API client
Components 22
Desktop experience
- Electron shell
electron/src/main/main.ts - Companion and results UI
electron/src/renderer - Tk companion app
trace_ui/app.py - Companion panel
trace_ui/companion.py - Results workspace
trace_ui/results_window.py
Request and history
- API contract types
electron/src/shared/protocol.ts - Loopback API client
trace_ui/api_client.py - Loopback API server
trace_backend/server.py - Investigation history
trace_backend/history.py
Investigation pipeline
- Agent investigation graph
trace_backend/investigation_engine.py - Graph execution
trace_backend/agent_graph.py - Ollama inference client
trace_backend/ollama_client.py - Citation verification
trace_backend/validator.py - Investigation report
trace_backend/schemas.py
Evidence and changes
- Screenshot capture
trace_backend/screenshot_service.py - Local context collection
trace_backend/context_collector.py - Project inspection
trace_backend/project_inspector.py - Diagnostics and code tools
trace_backend/code_tools.py - Git enrichment
trace_backend/git_context.py - Verified patch application
trace_backend/code_fixer.py
Other components
- Developer
- Ollama model service
Connections 25
- Developer → Companion and results UI: submits request
- Developer → Companion panel: submits request
- Electron shell → Companion and results UI: hosts UI
- Electron shell → Loopback API server: starts backend
electron/src/main/main.ts - Electron shell → Loopback API client: calls API
electron/src/main/main.ts - Tk companion app → Companion panel: creates panel
trace_ui/app.py - Tk companion app → Results workspace: opens results
trace_ui/app.py - Tk companion app → Loopback API client: starts and streams
trace_ui/app.py - Loopback API client → Loopback API server: sends HTTP requests
trace_ui/api_client.py - Loopback API server → Agent investigation graph: runs investigation
trace_backend/server.py - Loopback API server → Investigation history: loads and saves history
trace_backend/server.py - Agent investigation graph → Graph execution: executes graph
trace_backend/investigation_engine.py - Agent investigation graph → Screenshot capture: captures screen
trace_backend/investigation_engine.py - Agent investigation graph → Local context collection: collects context
trace_backend/investigation_engine.py - Agent investigation graph → Project inspection: reads project files
trace_backend/investigation_engine.py - Agent investigation graph → Diagnostics and code tools: runs diagnostics
trace_backend/investigation_engine.py - Agent investigation graph → Git enrichment: enriches findings
trace_backend/investigation_engine.py - Agent investigation graph → Ollama inference client: requests analysis
trace_backend/investigation_engine.py - Ollama inference client → Ollama model service: sends prompts
trace_backend/ollama_client.py - Agent investigation graph → Citation verification: verifies citations
trace_backend/investigation_engine.py - Agent investigation graph → Verified patch application: applies verified patch
trace_backend/investigation_engine.py - Agent investigation graph → Investigation report: builds report
trace_backend/investigation_engine.py - Loopback API server → Electron shell: streams status and report
- Loopback API server → Loopback API client: streams events and results
trace_ui/api_client.py - Results workspace → Developer: presents findings