# qaribhaider/ollama-to-lmstudio-symlinks architecture

> Architecture diagram of the GitHub repository qaribhaider/ollama-to-lmstudio-symlinks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qaribhaider/ollama-to-lmstudio-symlinks
- Repository: https://github.com/qaribhaider/ollama-to-lmstudio-symlinks

## Overview

This is a cross-platform CLI for sharing model files between Ollama and LM Studio through symlinks or hard links. The principal workflow discovers models in one application, normalizes model metadata, then registers links in the other; reverse mode also creates Ollama model registration. Separate commands inspect storage savings, remove broken links, and selectively delete managed links. Relationships among the CLI and core packages are supported by the excerpts and SOURCE INDEX; command-specific details not shown in source are based on the README.

Main entry points: [`cmd/ollama-symlinks/main.go`](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/cmd/ollama-symlinks/main.go) (CLI commands), [`internal/linking/linking.go`](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go) (Forward linking), [`internal/ollama/ollama.go`](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/ollama/ollama.go) (Ollama manifests), [`internal/lmstudio/lmstudio.go`](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/lmstudio/lmstudio.go) (LM Studio GGUFs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and interaction"]
  node_cli["CLI commands<br/>[main.go]"]
  node_terminal["Interactive menus<br/>[main.go]"]
  node_ui["Terminal output<br/>[styles.go]"]
end

subgraph group_discovery["Model discovery"]
  node_ollama_discovery["Ollama manifests<br/>[ollama.go]"]
  node_lm_discovery["LM Studio GGUFs<br/>[lmstudio.go]"]
  node_gguf["GGUF metadata<br/>[reader.go]"]
  node_models["Model records<br/>[models.go]"]
end

subgraph group_linking["Link and registration"]
  node_forward["Forward linking<br/>[linking.go]"]
  node_reverse["Reverse registration<br/>[linking.go]"]
  node_link_primitives["Link primitives<br/>[linking.go]"]
  node_ollama_check["Ollama validation<br/>[executable.go]"]
  node_lm_check["LM Studio validation<br/>[executable.go]"]
end

subgraph group_management["Link management"]
  node_status["Storage status<br/>[status.go]"]
  node_cleanup_delete["Cleanup and delete<br/>[linking.go]"]
end

node_user(("Operator"))

node_user -->|"runs"| node_cli
node_cli -->|"offers menus"| node_terminal
node_terminal -->|"prints output"| node_ui
node_cli -->|"discovers models"| node_ollama_discovery
node_cli -->|"discovers models"| node_lm_discovery
node_lm_discovery -->|"inspects headers"| node_gguf
node_ollama_discovery -->|"creates records"| node_models
node_lm_discovery -->|"creates records"| node_models
node_cli -->|"runs forward mode"| node_forward
node_cli -->|"runs reverse mode"| node_reverse
node_forward -->|"creates links"| node_link_primitives
node_reverse -->|"links blobs"| node_link_primitives
node_forward -->|"uses model data"| node_ollama_discovery
node_reverse -->|"resolves executable"| node_ollama_discovery
node_cli -.->|"validates installation"| node_ollama_check
node_cli -.->|"validates installation"| node_lm_check
node_cli -->|"shows status"| node_status
node_cli -->|"runs maintenance"| node_cleanup_delete
node_cleanup_delete -.->|"removes links"| node_link_primitives
node_forward -->|"reports results"| node_ui
node_reverse -->|"reports results"| node_ui

click node_cli "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/cmd/ollama-symlinks/main.go"
click node_terminal "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/cmd/ollama-symlinks/main.go"
click node_ui "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/ui/styles.go"
click node_ollama_discovery "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/ollama/ollama.go"
click node_lm_discovery "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/lmstudio/lmstudio.go"
click node_gguf "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/gguf/reader.go"
click node_models "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/models/models.go"
click node_forward "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go"
click node_reverse "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go"
click node_link_primitives "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go"
click node_ollama_check "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/ollama/executable.go"
click node_lm_check "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/lmstudio/executable.go"
click node_status "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/status.go"
click node_cleanup_delete "https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go"

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_terminal,node_ui toneBlue
class node_ollama_discovery,node_lm_discovery,node_gguf,node_models toneAmber
class node_forward,node_reverse,node_link_primitives,node_ollama_check,node_lm_check toneMint
class node_status,node_cleanup_delete toneRose
class node_user toneIndigo
```

## Components

### CLI and interaction

- [CLI commands](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/cmd/ollama-symlinks/main.go): `cmd/ollama-symlinks/main.go`
- [Interactive menus](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/cmd/ollama-symlinks/main.go): `cmd/ollama-symlinks/main.go`
- [Terminal output](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/ui/styles.go): `internal/ui/styles.go`

### Model discovery

- [Ollama manifests](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/ollama/ollama.go): `internal/ollama/ollama.go`
- [LM Studio GGUFs](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/lmstudio/lmstudio.go): `internal/lmstudio/lmstudio.go`
- [GGUF metadata](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/gguf/reader.go): `internal/gguf/reader.go`
- [Model records](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/models/models.go): `internal/models/models.go`

### Link and registration

- [Forward linking](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go): `internal/linking/linking.go`
- [Reverse registration](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go): `internal/linking/linking.go`
- [Link primitives](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go): `internal/linking/linking.go`
- [Ollama validation](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/ollama/executable.go): `internal/ollama/executable.go`
- [LM Studio validation](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/lmstudio/executable.go): `internal/lmstudio/executable.go`

### Link management

- [Storage status](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/status.go): `internal/linking/status.go`
- [Cleanup and delete](https://github.com/qaribhaider/ollama-to-lmstudio-symlinks/blob/main/internal/linking/linking.go): `internal/linking/linking.go`

### Other components

- **Operator**

## Connections

- Operator → CLI commands: runs (evidence: `README.md`)
- CLI commands → Interactive menus: offers menus (evidence: `cmd/ollama-symlinks/main.go`)
- Interactive menus → Terminal output: prints output (evidence: `cmd/ollama-symlinks/main.go`)
- CLI commands → Ollama manifests: discovers models (evidence: `cmd/ollama-symlinks/main.go`)
- CLI commands → LM Studio GGUFs: discovers models (evidence: `cmd/ollama-symlinks/main.go`)
- LM Studio GGUFs → GGUF metadata: inspects headers (evidence: `internal/lmstudio/lmstudio.go`)
- Ollama manifests → Model records: creates records (evidence: `internal/ollama/ollama.go`)
- LM Studio GGUFs → Model records: creates records (evidence: `internal/lmstudio/lmstudio.go`)
- CLI commands → Forward linking: runs forward mode (evidence: `README.md`)
- CLI commands → Reverse registration: runs reverse mode (evidence: `README.md`)
- Forward linking → Link primitives: creates links (evidence: `internal/linking/linking.go`)
- Reverse registration → Link primitives: links blobs (evidence: `internal/linking/linking.go`)
- Forward linking → Ollama manifests: uses model data (evidence: `internal/linking/linking.go`)
- Reverse registration → Ollama manifests: resolves executable (evidence: `internal/linking/linking.go`)
- CLI commands → Ollama validation: validates installation
- CLI commands → LM Studio validation: validates installation
- CLI commands → Storage status: shows status (evidence: `README.md`)
- CLI commands → Cleanup and delete: runs maintenance (evidence: `README.md`)
- Cleanup and delete → Link primitives: removes links (evidence: `internal/linking/linking.go`)
- Forward linking → Terminal output: reports results (evidence: `internal/linking/linking.go`)
- Reverse registration → Terminal output: reports results (evidence: `internal/linking/linking.go`)
