# d2i-group/tsflab architecture

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

- Interactive diagram: https://gitdiagram.com/d2i-group/tsflab
- Repository: https://github.com/d2i-group/tsflab

## Overview

TSFLab is an agent-agnostic time-series forecasting research workbench, not an agent or merely a model library. A compatible coding agent uses the CLI and domain guidance to discover verified model, component, and dataset knowledge; configure and run comparable experiments; inspect results; and contribute validated improvements for reuse. The experiment runner, catalog, data presets, and repository checks are distinct stages, with run records supporting reproducibility and bounded research rounds. The web app supplies a separate results/leaderboard view. Relationships are limited to README-documented flows and references visible in the supplied source index; many implementation details were not sampled.

Main entry points: [`src/tsflab/experiments/runner/run_one.py`](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/runner/run_one.py) (Experiment runner), [`src/tsflab/cli/main.py`](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/cli/main.py) (TSF CLI), [`src/tsflab/catalog/cards/search.py`](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/cards/search.py) (Knowledge cards), [`src/tsflab/experiments/config/loader.py`](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/config/loader.py) (Experiment configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent support"]
  node_cli["TSF CLI<br/>[main.py]"]
  node_guide["Domain guide<br/>[modules.py]"]
  node_tasktemplates["Task templates<br/>[tasks.py]"]
end

subgraph group_knowledge["Forecasting knowledge"]
  node_catalog["Knowledge cards<br/>[search.py]"]
  node_modelregistry["Model registry<br/>[models.py]"]
  node_datasets["Dataset presets<br/>[provider.py]"]
  node_components["Reusable components<br/>[components.py]"]
end

subgraph group_experiments["Experiment workflower"]
  node_configuration["Experiment configuration<br/>[loader.py]"]
  node_runner["Experiment runner<br/>[run_one.py]"]
  node_models["Forecasting models"]
  node_evaluation["Evaluation metrics<br/>[evaluator.py]"]
  node_infrastructure["Execution infrastructure<br/>[execution.py]"]
  node_records[("Run records<br/>[storage.py]")]
end

subgraph group_improvement["Recursive improvement"]
  node_rounds[("Research rounds<br/>[rounds.py]")]
  node_admission["Admission and audits<br/>[audit.py]"]
  node_repository["Repository checks<br/>[repository.py]"]
end

subgraph group_results["Results and reporting"]
  node_results["Results and leaderboard<br/>[leaderboard.py]"]
  node_web["Results web app<br/>[page.tsx]"]
end

node_researcher(("Researcher / agent"))

node_researcher -->|"invokes"| node_cli
node_cli -->|"loads guidance"| node_guide
node_cli -->|"renders tasks"| node_tasktemplates
node_researcher -->|"discovers knowledge"| node_catalog
node_catalog -->|"retrieves model metadata"| node_modelregistry
node_researcher -->|"selects data"| node_datasets
node_researcher -->|"reuses components"| node_components
node_researcher -->|"declares experiment"| node_configuration
node_configuration -->|"configures"| node_runner
node_runner -->|"executes"| node_models
node_runner -->|"loads data"| node_datasets
node_runner -->|"evaluates"| node_evaluation
node_runner -.->|"uses execution services"| node_infrastructure
node_runner -->|"persists runs"| node_records
node_researcher -->|"manages research rounds"| node_rounds
node_researcher -->|"proposes verified changes"| node_admission
node_cli -->|"routes repo checks"| node_repository
node_repository -->|"audits catalog"| node_admission
node_researcher -->|"inspects outcomes"| node_results
node_results -.->|"presents leaderboard"| node_web

click node_cli "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/cli/main.py"
click node_guide "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/agent/modules.py"
click node_tasktemplates "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/agent/tasks.py"
click node_catalog "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/cards/search.py"
click node_modelregistry "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/registry/models.py"
click node_datasets "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/data/provider.py"
click node_components "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/components.py"
click node_configuration "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/config/loader.py"
click node_runner "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/runner/run_one.py"
click node_models "https://github.com/d2i-group/tsflab/tree/main/src/tsflab/models"
click node_evaluation "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/runner/evaluator.py"
click node_infrastructure "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/infra/execution.py"
click node_records "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/infra/storage.py"
click node_rounds "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/research/rounds.py"
click node_admission "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/cards/audit.py"
click node_repository "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/cli/commands/repository.py"
click node_results "https://github.com/d2i-group/tsflab/blob/main/src/tsflab/core/leaderboard.py"
click node_web "https://github.com/d2i-group/tsflab/blob/main/apps/web/app/page.tsx"

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_cli,node_guide,node_tasktemplates toneBlue
class node_catalog,node_modelregistry,node_datasets,node_components toneAmber
class node_configuration,node_runner,node_models,node_evaluation,node_infrastructure,node_records toneMint
class node_rounds,node_admission,node_repository toneRose
class node_results,node_web,node_researcher toneIndigo
```

## Components

### Agent support

- [TSF CLI](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/cli/main.py): `src/tsflab/cli/main.py`
- [Domain guide](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/agent/modules.py): `src/tsflab/agent/modules.py`
- [Task templates](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/agent/tasks.py): `src/tsflab/agent/tasks.py`

### Forecasting knowledge

- [Knowledge cards](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/cards/search.py): `src/tsflab/catalog/cards/search.py`
- [Model registry](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/registry/models.py): `src/tsflab/catalog/registry/models.py`
- [Dataset presets](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/data/provider.py): `src/tsflab/data/provider.py`
- [Reusable components](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/components.py): `src/tsflab/catalog/components.py`

### Experiment workflower

- [Experiment configuration](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/config/loader.py): `src/tsflab/experiments/config/loader.py`
- [Experiment runner](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/runner/run_one.py): `src/tsflab/experiments/runner/run_one.py`
- [Forecasting models](https://github.com/d2i-group/tsflab/tree/main/src/tsflab/models): `src/tsflab/models`
- [Evaluation metrics](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/runner/evaluator.py): `src/tsflab/experiments/runner/evaluator.py`
- [Execution infrastructure](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/infra/execution.py): `src/tsflab/experiments/infra/execution.py`
- [Run records](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/experiments/infra/storage.py): `src/tsflab/experiments/infra/storage.py`

### Recursive improvement

- [Research rounds](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/research/rounds.py): `src/tsflab/research/rounds.py`
- [Admission and audits](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/catalog/cards/audit.py): `src/tsflab/catalog/cards/audit.py`
- [Repository checks](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/cli/commands/repository.py): `src/tsflab/cli/commands/repository.py`

### Results and reporting

- [Results and leaderboard](https://github.com/d2i-group/tsflab/blob/main/src/tsflab/core/leaderboard.py): `src/tsflab/core/leaderboard.py`
- [Results web app](https://github.com/d2i-group/tsflab/blob/main/apps/web/app/page.tsx): `apps/web/app/page.tsx`

### Other components

- **Researcher / agent**

## Connections

- Researcher / agent → TSF CLI: invokes (evidence: `README.md`)
- TSF CLI → Domain guide: loads guidance
- TSF CLI → Task templates: renders tasks
- Researcher / agent → Knowledge cards: discovers knowledge (evidence: `README.md`)
- Knowledge cards → Model registry: retrieves model metadata (evidence: `src/tsflab/catalog/cards/search.py`)
- Researcher / agent → Dataset presets: selects data (evidence: `README.md`)
- Researcher / agent → Reusable components: reuses components (evidence: `README.md`)
- Researcher / agent → Experiment configuration: declares experiment (evidence: `README.md`)
- Experiment configuration → Experiment runner: configures (evidence: `README.md`)
- Experiment runner → Forecasting models: executes (evidence: `src/tsflab/experiments/runner/run_one.py`)
- Experiment runner → Dataset presets: loads data (evidence: `src/tsflab/experiments/runner/run_one.py`)
- Experiment runner → Evaluation metrics: evaluates (evidence: `src/tsflab/experiments/runner/run_one.py`)
- Experiment runner → Execution infrastructure: uses execution services
- Experiment runner → Run records: persists runs (evidence: `src/tsflab/experiments/runner/run_one.py`)
- Researcher / agent → Research rounds: manages research rounds
- Researcher / agent → Admission and audits: proposes verified changes (evidence: `README.md`)
- TSF CLI → Repository checks: routes repo checks (evidence: `src/tsflab/cli/main.py`)
- Repository checks → Admission and audits: audits catalog (evidence: `src/tsflab/cli/commands/repository.py`)
- Researcher / agent → Results and leaderboard: inspects outcomes (evidence: `README.md`)
- Results and leaderboard → Results web app: presents leaderboard
