# goldeneaglex10/codespacecortex architecture

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

- Interactive diagram: https://gitdiagram.com/goldeneaglex10/codespacecortex
- Repository: https://github.com/goldeneaglex10/codespacecortex

## Overview

Codespace Cortex is a multi-service learning platform: a private API gateway fronts tutoring, while a knowledge pipeline ingests tenant-scoped course material and serves retrieval. The tutor builds student context, consults registered tools, and generates pedagogy-checked answers through configurable LLM providers. The graph preserves the gateway’s security and governance concerns and the pipeline’s ingestion and search stages. No README was supplied, and gateway-to-tutor or tutor-to-search runtime wiring is not established by the excerpts, so those links are omitted.

Main entry points: [`tutor-service/agents/agent.py`](https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/agents/agent.py) (Tutor agent), [`knowledge-pipeline/pipeline/ingest.py`](https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/ingest.py) (Ingestion coordinator), [`api-service/app/main.py`](https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/main.py) (Private API), [`api-service/app/gateway/routers/chat.py`](https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/gateway/routers/chat.py) (Chat route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["API gateway"]
  node_gateway_app["Private API<br/>[main.py]"]
  node_chat_route["Chat route<br/>[chat.py]"]
  node_security["Request security"]
  node_cache["Response cache<br/>[cache.py]"]
  node_health["Health route<br/>[health.py]"]
  node_governance["Audit and metering"]
end

subgraph group_knowledge["Knowledge pipeline"]
  node_connector["Content connector<br/>[base.py]"]
  node_ingest["Ingestion coordinator<br/>[ingest.py]"]
  node_chunker["Content chunker<br/>[chunker.py]"]
  node_embedder["Embedding providers<br/>[embedder_base.py]"]
  node_vector_store[("Tenant vector store<br/>[vector_store.py]")]
  node_search_api["Pipeline API<br/>[api.py]"]
  node_search["Tenant-scoped search<br/>[search_tool.py]"]
end

subgraph group_tutoring["Tutor runtime"]
  node_context["Student context<br/>[build_context.py]"]
  node_tutor_router["Tutor router<br/>[router.py]"]
  node_agent["Tutor agent<br/>[agent.py]"]
  node_tool_registry["Tool registry<br/>[tool_registry.py]"]
  node_prompt["Tutor prompts<br/>[prompts.py]"]
  node_pedagogy["Pedagogy checks<br/>[pedagogy.py]"]
  node_llm["LLM providers<br/>[provider.py]"]
end

subgraph group_state["Platform state"]
  node_db[("Database access<br/>[db.py]")]
  node_domain_models[("Learning records")]
end

node_student(("Student"))
node_content_source["Course content source"]
node_model_services["Model providers"]

node_student -->|"requests API"| node_gateway_app
node_gateway_app -->|"routes chat"| node_chat_route
node_gateway_app -->|"routes health"| node_health
node_gateway_app -->|"requires API key"| node_security
node_chat_route -->|"uses dependencies"| node_security
node_chat_route -->|"uses cache"| node_cache
node_chat_route -.->|"records activity"| node_governance
node_db -.->|"persists records"| node_domain_models
node_content_source -.->|"provides content"| node_connector
node_ingest -->|"fetches items"| node_connector
node_ingest -->|"chunks content"| node_chunker
node_ingest -->|"embeds chunks"| node_embedder
node_ingest -->|"stores embeddings"| node_vector_store
node_search_api -->|"dispatches search"| node_search
node_search -->|"embeds query"| node_embedder
node_search -->|"retrieves matches"| node_vector_store
node_student -.->|"submits question"| node_tutor_router
node_tutor_router -->|"builds context"| node_context
node_tutor_router -->|"dispatches request"| node_agent
node_agent -->|"builds prompt"| node_prompt
node_agent -->|"checks answer"| node_pedagogy
node_agent -->|"executes tools"| node_tool_registry
node_agent -->|"requests completion"| node_llm
node_llm -.->|"calls model API"| node_model_services

click node_gateway_app "https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/main.py"
click node_chat_route "https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/gateway/routers/chat.py"
click node_security "https://github.com/goldeneaglex10/codespacecortex/tree/main/api-service/app/gateway/dependencies"
click node_cache "https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/gateway/dependencies/cache.py"
click node_health "https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/gateway/routers/health.py"
click node_governance "https://github.com/goldeneaglex10/codespacecortex/tree/main/api-service/app/governance"
click node_db "https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/data/db.py"
click node_domain_models "https://github.com/goldeneaglex10/codespacecortex/tree/main/api-service/app/data/models"
click node_connector "https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/connector/base.py"
click node_ingest "https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/ingest.py"
click node_chunker "https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/chunker.py"
click node_embedder "https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/embedder_base.py"
click node_vector_store "https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/storage/vector_store.py"
click node_search_api "https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/api.py"
click node_search "https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/search_tool.py"
click node_context "https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/context_engine/build_context.py"
click node_tutor_router "https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/orchestrator/router.py"
click node_agent "https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/agents/agent.py"
click node_tool_registry "https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/context_engine/tool_registry.py"
click node_prompt "https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/agents/prompts.py"
click node_pedagogy "https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/agents/pedagogy.py"
click node_llm "https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/llm/provider.py"

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_gateway_app,node_chat_route,node_security,node_cache,node_health,node_governance toneBlue
class node_connector,node_ingest,node_chunker,node_embedder,node_vector_store,node_search_api,node_search toneAmber
class node_context,node_tutor_router,node_agent,node_tool_registry,node_prompt,node_pedagogy,node_llm toneMint
class node_db,node_domain_models toneRose
class node_student,node_content_source,node_model_services toneIndigo
```

## Components

### API gateway

- [Private API](https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/main.py): `api-service/app/main.py`
- [Chat route](https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/gateway/routers/chat.py): `api-service/app/gateway/routers/chat.py`
- [Request security](https://github.com/goldeneaglex10/codespacecortex/tree/main/api-service/app/gateway/dependencies): `api-service/app/gateway/dependencies`
- [Response cache](https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/gateway/dependencies/cache.py): `api-service/app/gateway/dependencies/cache.py`
- [Health route](https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/gateway/routers/health.py): `api-service/app/gateway/routers/health.py`
- [Audit and metering](https://github.com/goldeneaglex10/codespacecortex/tree/main/api-service/app/governance): `api-service/app/governance`

### Knowledge pipeline

- [Content connector](https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/connector/base.py): `knowledge-pipeline/connector/base.py`
- [Ingestion coordinator](https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/ingest.py): `knowledge-pipeline/pipeline/ingest.py`
- [Content chunker](https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/chunker.py): `knowledge-pipeline/pipeline/chunker.py`
- [Embedding providers](https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/embedder_base.py): `knowledge-pipeline/pipeline/embedder_base.py`
- [Tenant vector store](https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/storage/vector_store.py): `knowledge-pipeline/storage/vector_store.py`
- [Pipeline API](https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/api.py): `knowledge-pipeline/pipeline/api.py`
- [Tenant-scoped search](https://github.com/goldeneaglex10/codespacecortex/blob/main/knowledge-pipeline/pipeline/search_tool.py): `knowledge-pipeline/pipeline/search_tool.py`

### Tutor runtime

- [Student context](https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/context_engine/build_context.py): `tutor-service/context_engine/build_context.py`
- [Tutor router](https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/orchestrator/router.py): `tutor-service/orchestrator/router.py`
- [Tutor agent](https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/agents/agent.py): `tutor-service/agents/agent.py`
- [Tool registry](https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/context_engine/tool_registry.py): `tutor-service/context_engine/tool_registry.py`
- [Tutor prompts](https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/agents/prompts.py): `tutor-service/agents/prompts.py`
- [Pedagogy checks](https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/agents/pedagogy.py): `tutor-service/agents/pedagogy.py`
- [LLM providers](https://github.com/goldeneaglex10/codespacecortex/blob/main/tutor-service/llm/provider.py): `tutor-service/llm/provider.py`

### Platform state

- [Database access](https://github.com/goldeneaglex10/codespacecortex/blob/main/api-service/app/data/db.py): `api-service/app/data/db.py`
- [Learning records](https://github.com/goldeneaglex10/codespacecortex/tree/main/api-service/app/data/models): `api-service/app/data/models`

### Other components

- **Student**
- **Course content source**
- **Model providers**

## Connections

- Student → Private API: requests API (evidence: `api-service/app/main.py`)
- Private API → Chat route: routes chat (evidence: `api-service/app/main.py`)
- Private API → Health route: routes health (evidence: `api-service/app/main.py`)
- Private API → Request security: requires API key (evidence: `api-service/app/main.py`)
- Chat route → Request security: uses dependencies (evidence: `api-service/app/gateway/routers/chat.py`)
- Chat route → Response cache: uses cache (evidence: `api-service/app/gateway/routers/chat.py`)
- Chat route → Audit and metering: records activity
- Database access → Learning records: persists records
- Course content source → Content connector: provides content
- Ingestion coordinator → Content connector: fetches items (evidence: `knowledge-pipeline/pipeline/ingest.py`)
- Ingestion coordinator → Content chunker: chunks content (evidence: `knowledge-pipeline/pipeline/ingest.py`)
- Ingestion coordinator → Embedding providers: embeds chunks (evidence: `knowledge-pipeline/pipeline/ingest.py`)
- Ingestion coordinator → Tenant vector store: stores embeddings (evidence: `knowledge-pipeline/pipeline/ingest.py`)
- Pipeline API → Tenant-scoped search: dispatches search (evidence: `knowledge-pipeline/pipeline/api.py`)
- Tenant-scoped search → Embedding providers: embeds query (evidence: `knowledge-pipeline/pipeline/search_tool.py`)
- Tenant-scoped search → Tenant vector store: retrieves matches (evidence: `knowledge-pipeline/pipeline/search_tool.py`)
- Student → Tutor router: submits question
- Tutor router → Student context: builds context (evidence: `tutor-service/orchestrator/router.py`)
- Tutor router → Tutor agent: dispatches request (evidence: `tutor-service/orchestrator/router.py`)
- Tutor agent → Tutor prompts: builds prompt (evidence: `tutor-service/agents/agent.py`)
- Tutor agent → Pedagogy checks: checks answer (evidence: `tutor-service/agents/agent.py`)
- Tutor agent → Tool registry: executes tools (evidence: `tutor-service/agents/agent.py`)
- Tutor agent → LLM providers: requests completion (evidence: `tutor-service/agents/agent.py`)
- LLM providers → Model providers: calls model API
