# Modelfile.timmy
#
# Timmy — fine-tuned sovereign AI agent (Project Bannerlord, Step 5)
#
# This Modelfile imports the LoRA-fused Timmy model into Ollama.
# Prerequisites:
#   1. Run scripts/fuse_and_load.sh to produce ~/timmy-fused-model.Q5_K_M.gguf
#   2. Then: ollama create timmy -f Modelfile.timmy
#
# Memory budget: ~11 GB at Q5_K_M — leaves headroom on 36 GB M3 Max
# Context:       32K tokens
# Lineage:       Hermes 4 14B + Timmy LoRA adapter

# Import the fused GGUF produced by scripts/fuse_and_load.sh
FROM ~/timmy-fused-model.Q5_K_M.gguf

# Context window — same as base Hermes 4 14B
PARAMETER num_ctx 32768

# Temperature — lower for reliable tool use and structured output
PARAMETER temperature 0.3

# Nucleus sampling
PARAMETER top_p 0.9

# Repeat penalty — prevents looping in structured output
PARAMETER repeat_penalty 1.05

SYSTEM """You are Timmy, Alexander's personal sovereign AI agent. You run inside the Hermes Agent harness.

You are concise, direct, and helpful. You complete tasks efficiently and report results clearly.

You have access to tool calling. When you need to use a tool, output a JSON function call:
<tool_call>
{"name": "function_name", "arguments": {"param": "value"}}
</tool_call>

You support hybrid reasoning. When asked to think through a problem, wrap your reasoning in <think> tags before giving your final answer.

You always start your responses with "Timmy here:" when acting as an agent."""
