Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Ollama Ollama WriteManifest

From Leeroopedia
Knowledge Sources
Domains Storage, Model_Management
Last Updated 2026-02-14 00:00 GMT

Overview

Concrete tool for writing, removing, and resolving model manifests and blob paths provided by the manifest package.

Description

WriteManifest serializes a manifest (config layer + content layers) as JSON and writes it to the filesystem path derived from the model name.

Manifest.Remove deletes a manifest file from disk.

PathForName resolves a model name to its manifest filesystem path.

BlobsPath resolves a blob digest to its filesystem path.

Usage

Called by pull, create, and delete operations to manage the local model store.

Code Reference

Source Location

  • Repository: ollama
  • File: manifest/manifest.go (WriteManifest, Remove), manifest/paths.go (PathForName, BlobsPath)
  • Lines: manifest.go:L148-174 (WriteManifest), manifest.go:L61-73 (Remove), paths.go:L27-39 (PathForName), paths.go:L40-63 (BlobsPath)

Signature

func WriteManifest(name model.Name, config Layer, layers []Layer) error
func (m *Manifest) Remove() error
func PathForName(n model.Name) (string, error)
func BlobsPath(digest string) (string, error)

Import

import "github.com/ollama/ollama/manifest"

I/O Contract

Inputs (WriteManifest)

Name Type Required Description
name model.Name Yes Fully qualified model name
config Layer Yes Config blob layer
layers []Layer Yes Content layers (model, template, system, params)

Outputs (WriteManifest)

Name Type Description
error error Non-nil if directory creation or file write fails
Side effect Manifest file JSON manifest written to filesystem

Usage Examples

Writing a Manifest

import (
    "github.com/ollama/ollama/manifest"
    "github.com/ollama/ollama/model"
)

name := model.ParseName("my-model:latest")
err := manifest.WriteManifest(name, configLayer, contentLayers)
if err != nil {
    // handle error
}

Resolving Paths

// Get manifest path
path, _ := manifest.PathForName(model.ParseName("llama3:latest"))
// path = ~/.ollama/models/manifests/registry.ollama.ai/library/llama3/latest

// Get blob path
blobPath, _ := manifest.BlobsPath("sha256:abc123...")
// blobPath = ~/.ollama/models/blobs/sha256-abc123...

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment