How sanehasiddique/memtrace works
MEMTRACE turns incoming events into structured, versioned memories, then retrieves currently valid facts to answer questions with a focused model briefing and an auditable cost record. Its dashboard presents memory behavior and savings, alongside an engineering comparison of baseline and memory-aware agents. The README documents the memory lifecycle; sampled routes show query dispatch and cost reporting. Several runtime modules are indexed but unsampled, so their internal call paths are not expanded here.
Main entry points: workflow.py Memory workflow · orchestrator.py Agent comparison · jev_live.py Memory judgment · graph.py Memory-aware agent
Components 26
Memory workflow
- HTTP API
backend/app/api/routes.py - Memory workflow
backend/app/agent/workflow.py - Fact extraction
backend/app/memory/extraction.py - Memory judgment
backend/app/judgment/jev_live.py - Memory lifecycle
backend/app/memory/service.py - Hybrid retrieval
backend/app/memory/retrieval.py - Context builder
backend/app/context/builder.py - Memory graph store
backend/app/memory/neo4j_repository.py
Agent runtime
- Agent comparison
backend/app/orchestrator.py - Baseline agent
backend/app/agent1/graph.py - Memory-aware agent
backend/app/agent2/graph.py - Tool routing
backend/app/agent2/tool_routing.py
Model services
- Graph8 tools
backend/app/core/graph8_client.py - JEV service
backend/app/core/jev_client.py - LLM client
backend/app/core/llm_client.py
Cost and tracing
- Cost accounting
backend/app/cost/service.py - Cost records
backend/app/cost/repository.py - Run metrics
backend/app/metrics/collector.py - Execution tracing
backend/app/tracing/langsmith.py
Dashboard
- Dashboard
frontend/src/App.jsx - Agent comparison
frontend/src/components/comparison/DualAgentComparisonView.jsx - Executive view
frontend/src/components/executive/ExecutiveView.jsx - API client
frontend/src/api.js
Other components
- User
- LangSmith
- Vercel AI Gateway
Connections 29
- User → HTTP API: submits events and queries
README.md - HTTP API → Memory workflow: dispatches query
backend/app/api/routes.py - Memory workflow → Fact extraction: extracts facts
README.md - Memory workflow → Memory judgment: judges facts
README.md - Memory judgment → Memory lifecycle: chooses operation
README.md - Memory lifecycle → Memory graph store: updates graph
README.md - Memory workflow → Hybrid retrieval: retrieves valid facts
README.md - Hybrid retrieval → Memory graph store: reads memories
README.md - Memory workflow → Context builder: builds briefing
README.md - Memory workflow → LLM client: generates answer
README.md - Agent comparison → Baseline agent: runs baseline
backend/app/orchestrator.py - Agent comparison → Memory-aware agent: runs memory agent
backend/app/orchestrator.py - Memory-aware agent → Tool routing: routes tool calls
backend/app/agent2/tool_routing.py - Tool routing → Graph8 tools: calls tools
backend/app/agent2/tool_routing.py - Tool routing → JEV service: evaluates choices
backend/app/agent2/tool_routing.py - Baseline agent → LLM client: requests completion
README.md - Memory-aware agent → LLM client: requests completion
README.md - Memory judgment → Vercel AI Gateway: requests judgments
README.md - Memory workflow → Cost accounting: records run cost
- Cost accounting → Cost records: persists records
backend/app/cost/service.py - Agent comparison → Run metrics: builds turn metrics
backend/app/orchestrator.py - Agent comparison → Execution tracing: emits traces
- Execution tracing → LangSmith: sends traces
README.md - User → Dashboard: opens dashboard
README.md - Dashboard → Agent comparison: selects comparison
frontend/src/App.jsx - Dashboard → Executive view: selects executive view
frontend/src/App.jsx - Agent comparison → API client: requests runtime data
frontend/src/components/comparison/DualAgentComparisonView.jsx - Executive view → API client: requests dashboard data
- API client → HTTP API: calls HTTP endpoints
frontend/src/api.js