# shellcrafter/ai-inference architecture

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

- Interactive diagram: https://gitdiagram.com/shellcrafter/ai-inference
- Repository: https://github.com/shellcrafter/ai-inference

## Overview

ShellCrafter is a Termux-based Android app-in-a-shell for running a local Qwen model offline. The documented workflow is to install dependencies and the model once, then invoke `runqwen`, choose an inference mode, and chat through llama.cpp. The tree contains only the installer and runtime scripts; the README documents their responsibilities and interactions, so links below rely on that documentation rather than inspected source.

Main entry points: [`install.sh`](https://github.com/shellcrafter/ai-inference/blob/main/install.sh) (Installer), [`run_ai.sh`](https://github.com/shellcrafter/ai-inference/blob/main/run_ai.sh) (Runtime script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Installation"]
  node_installer["Installer<br/>[install.sh]"]
  node_termux["Termux environment"]
end

subgraph group_runtime["Local inference"]
  node_command["runqwen command"]
  node_runtime_script["Runtime script<br/>[run_ai.sh]"]
  node_mode["Mode selection<br/>[run_ai.sh]"]
  node_engine["llama.cpp engine"]
end

subgraph group_assets["Runtime assets"]
  node_llama_pkg["llama.cpp package"]
  node_model["Qwen GGUF model"]
end

node_user(("Termux user"))
node_internet(("Internet"))

node_user -->|"runs setup"| node_installer
node_installer -->|"checks environment"| node_termux
node_installer -->|"installs package"| node_llama_pkg
node_installer -->|"downloads model"| node_internet
node_installer -->|"verifies download"| node_model
node_installer -->|"installs runtime"| node_runtime_script
node_installer -->|"creates command"| node_command
node_user -->|"invokes"| node_command
node_command -->|"launches"| node_runtime_script
node_runtime_script -->|"offers modes"| node_mode
node_runtime_script -->|"runs inference"| node_engine
node_runtime_script -->|"uses local model"| node_model

click node_installer "https://github.com/shellcrafter/ai-inference/blob/main/install.sh"
click node_runtime_script "https://github.com/shellcrafter/ai-inference/blob/main/run_ai.sh"
click node_mode "https://github.com/shellcrafter/ai-inference/blob/main/run_ai.sh"

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_installer,node_termux,node_user toneBlue
class node_command,node_runtime_script,node_mode,node_engine toneAmber
class node_llama_pkg,node_model toneMint
class node_internet toneIndigo
```

## Components

### Installation

- [Installer](https://github.com/shellcrafter/ai-inference/blob/main/install.sh): `install.sh`
- **Termux environment**

### Local inference

- **runqwen command**
- [Runtime script](https://github.com/shellcrafter/ai-inference/blob/main/run_ai.sh): `run_ai.sh`
- [Mode selection](https://github.com/shellcrafter/ai-inference/blob/main/run_ai.sh): `run_ai.sh`
- **llama.cpp engine**

### Runtime assets

- **llama.cpp package**
- **Qwen GGUF model**

### Other components

- **Termux user**
- **Internet**

## Connections

- Termux user → Installer: runs setup (evidence: `README.md`)
- Installer → Termux environment: checks environment (evidence: `README.md`)
- Installer → llama.cpp package: installs package (evidence: `README.md`)
- Installer → Internet: downloads model (evidence: `README.md`)
- Installer → Qwen GGUF model: verifies download (evidence: `README.md`)
- Installer → Runtime script: installs runtime (evidence: `README.md`)
- Installer → runqwen command: creates command (evidence: `README.md`)
- Termux user → runqwen command: invokes (evidence: `README.md`)
- runqwen command → Runtime script: launches (evidence: `README.md`)
- Runtime script → Mode selection: offers modes (evidence: `README.md`)
- Runtime script → llama.cpp engine: runs inference (evidence: `README.md`)
- Runtime script → Qwen GGUF model: uses local model (evidence: `README.md`)
