Repository navigation
Closed
Description
Overview
Implement the model manager that handles GGUF model discovery, download with resume support, SHA256 verification, and lifecycle state tracking. This is self-contained infrastructure — it manages files on disk and reports status, but does not perform inference.
Includes automatic model selection based on system RAM to simplify first-launch onboarding.
Acceptance Criteria
-
ModelManagertrait from Shared types, traits, and interface contracts for agent subsystems #998 fully implemented - Auto-selects model based on system RAM: >16GB -> 8B, <=16GB -> 3B
- Exposes
recommended_model()returning the RAM-appropriateChatModelSpec - Download from HuggingFace with HTTP range-request resume
- SHA256 verification passes for valid files, rejects corrupted files
- Cancellation stops download and cleans up
.partialfile - Disk space check prevents download when insufficient space
- Model listing correctly merges catalog with on-disk state
- Directory creation if
~/.nodespace/models/does not exist - Integration test: download a small test file, verify SHA256, report progress
- Code passes
bun run quality:fix
Technical Specifications
New Module
packages/desktop-app/src-tauri/src/local_agent/model_manager.rs
Model Catalog (Hardcoded v1)
| Model | File | Size | URL |
|---|---|---|---|
| Ministral 3B Q4_K_M | Ministral-3-3B-Instruct-2512-Q4_K_M.gguf |
2.0 GB | HuggingFace mistralai |
| Ministral 8B Q4_K_M | Ministral-3-8B-Instruct-2512-Q4_K_M.gguf |
4.8 GB | HuggingFace mistralai |
RAM Detection
- Use
sysinfocrate to detect total system memory -
16GB -> recommend 8B (deeper reasoning, vision capable)
- <=16GB -> recommend 3B (fast, lightweight, identical tool reliability)
- Store recommendation as
ChatModelSpecaccessible viarecommended_model()
Download Implementation
- HTTP Range requests for resume (HuggingFace CDN supports
Accept-Ranges: bytes) - Partial files stored with
.partialextension - Progress via callback (
DownloadEvent::Progress) - Cancellation via tokio
CancellationToken - SHA256 stream-hash after download, delete file if mismatch
Status State Machine
NotDownloaded -> Downloading { progress_pct, bytes_downloaded } -> Verifying -> Ready -> Loaded -> Error(String)
Model Directory
- Default:
~/Library/Application Support/NodeSpace/models/(macOS) - Scan for existing
.gguffiles, match against catalog by filename - Report unknown models as "unrecognized"
Reference Files
packages/desktop-app/src-tauri/src/app_services.rs— service patternspackages/nlp-engine/src/config.rs— model path resolution
Exports
GgufModelManagerstruct implementingModelManager
Dependencies
Related Issues
- ACP Integration and Local LLM Capability #997 (parent epic)
Activity
malibio commentedon Apr 3, 2026
Baseline: frontend tests have pre-existing vitest startup error (TypeError in vitest internals). Rust-only changes in this issue.
feat: GGUF model manager with download, verification, and lifecycle (c…
feat: GGUF model manager with download, verification, and lifecycle (c…
feat: local agent ReAct loop with history management and context budg…
feat: local agent ReAct loop with history management and context budg…
feat: local agent ReAct loop with history management and context budg…
feat: GGUF model manager with download, verification, and lifecycle (c…
feat: local agent ReAct loop with history management and context budg…