# mahammadaslam9/devmemory-ai architecture

> Architecture diagram of the GitHub repository mahammadaslam9/devmemory-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahammadaslam9/devmemory-ai
- Repository: https://github.com/mahammadaslam9/devmemory-ai

## Overview

DevMemory AI is a developer assistant for persistent project and developer context. A user chats or searches remembered context in the React interface; the backend recalls relevant Hindsight memories, uses Groq to answer, and distills and deduplicates new facts before retaining them. The documented direct retain and recall APIs are also represented. The main chat handler and duplicate-check logic are visible in `backend/src/index.ts`; subsystem links not directly evidenced by sampled source are omitted.

Main entry points: [`backend/src/index.ts`](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts) (Chat orchestration), [`backend/src/services/hindsight.ts`](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/services/hindsight.ts) (Hindsight client adapter), [`frontend/src/App.tsx`](https://github.com/mahammadaslam9/devmemory-ai/blob/main/frontend/src/App.tsx) (Chat and search UI), [`backend/src/services/groq.ts`](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/services/groq.ts) (Answer and distillation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Developer interface"]
  node_ui["Chat and search UI<br/>[App.tsx]"]
end

subgraph group_api["Backend API"]
  node_api_router["REST API routes<br/>[index.ts]"]
  node_chat_flow["Chat orchestration<br/>[index.ts]"]
  node_memory_routes["Memory API<br/>[index.ts]"]
  node_dedup["Duplicate screening<br/>[index.ts]"]
end

subgraph group_reasoning["AI reasoning"]
  node_groq_service["Answer and distillation<br/>[groq.ts]"]
end

subgraph group_memory["Persistent memory"]
  node_hindsight_adapter["Hindsight client adapter<br/>[hindsight.ts]"]
end

node_developer(("Developer"))
node_groq["Groq LLM"]
node_hindsight[("Hindsight memory bank")]

node_developer -->|"asks or searches"| node_ui
node_ui -->|"sends API requests"| node_api_router
node_api_router -->|"dispatches chat"| node_chat_flow
node_api_router -->|"dispatches memory requests"| node_memory_routes
node_chat_flow -->|"recalls context"| node_hindsight_adapter
node_hindsight_adapter -->|"recalls or retains"| node_hindsight
node_chat_flow -->|"requests answer"| node_groq_service
node_groq_service -->|"generates and distills"| node_groq
node_chat_flow -->|"requests memory summary"| node_groq_service
node_chat_flow -->|"checks candidate"| node_dedup
node_dedup -->|"recalls possible duplicates"| node_hindsight_adapter
node_chat_flow -->|"retains nonduplicate"| node_hindsight_adapter
node_memory_routes -->|"retains or recalls"| node_hindsight_adapter
node_chat_flow -->|"returns answer and memories"| node_ui
node_memory_routes -->|"returns memory results"| node_ui

click node_ui "https://github.com/mahammadaslam9/devmemory-ai/blob/main/frontend/src/App.tsx"
click node_api_router "https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts"
click node_chat_flow "https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts"
click node_memory_routes "https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts"
click node_dedup "https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts"
click node_groq_service "https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/services/groq.ts"
click node_hindsight_adapter "https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/services/hindsight.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui toneBlue
class node_api_router,node_chat_flow,node_memory_routes,node_dedup,node_hindsight toneAmber
class node_groq_service toneMint
class node_hindsight_adapter toneRose
class node_developer,node_groq toneIndigo
```

## Components

### Developer interface

- [Chat and search UI](https://github.com/mahammadaslam9/devmemory-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### Backend API

- [REST API routes](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Chat orchestration](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Memory API](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Duplicate screening](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/index.ts): `backend/src/index.ts`

### AI reasoning

- [Answer and distillation](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/services/groq.ts): `backend/src/services/groq.ts`

### Persistent memory

- [Hindsight client adapter](https://github.com/mahammadaslam9/devmemory-ai/blob/main/backend/src/services/hindsight.ts): `backend/src/services/hindsight.ts`

### Other components

- **Developer**
- **Groq LLM**
- **Hindsight memory bank**

## Connections

- Developer → Chat and search UI: asks or searches
- Chat and search UI → REST API routes: sends API requests
- REST API routes → Chat orchestration: dispatches chat
- REST API routes → Memory API: dispatches memory requests
- Chat orchestration → Hindsight client adapter: recalls context
- Hindsight client adapter → Hindsight memory bank: recalls or retains
- Chat orchestration → Answer and distillation: requests answer
- Answer and distillation → Groq LLM: generates and distills
- Chat orchestration → Answer and distillation: requests memory summary
- Chat orchestration → Duplicate screening: checks candidate
- Duplicate screening → Hindsight client adapter: recalls possible duplicates
- Chat orchestration → Hindsight client adapter: retains nonduplicate
- Memory API → Hindsight client adapter: retains or recalls
- Chat orchestration → Chat and search UI: returns answer and memories
- Memory API → Chat and search UI: returns memory results
