axiom-foundation-models-ref
Reference — Complete Foundation Models framework guide covering LanguageModelSession, @Generable, @Guide, Tool protocol, streaming, dynamic schemas, built-in use cases, and all WWDC 2025 code examples
npx skills add majiayu000/claude-skill-registry --skill axiom-foundation-models-ref-charleswiltgen-axiom-2 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Describes a Foundation Models framework for on-device large language models with a 3B parameter, 2-bit quantized model and 4096 token context. It covers the LanguageModelSession core class, the @Generable macro for structured output, @Guide constraints, streaming via PartiallyGenerated types, and a Tool protocol to integrate external data fetches. It includes code examples for creating sessions (with or without tools or specific models), using respond(to:) and respond(to:generating:), transcript maintenance, isResponding gating, and streaming integration with SwiftUI. It also explains tool usage patterns (GetWeatherTool example), how tools are attached to a session, and how tool results are incorporated into model responses. It lists navigation help, isResponding behavior, and notes about multiple tools and parallel calls, along with best practices for tool naming and usage.
How it works
The skill defines a Foundation Models framework API reference that includes:
- Model specs: 3B parameter model, 2-bit quantized, 4096 token context; runs on-device with no network or data leaving device.
- LanguageModelSession: maintains transcript, supports multi-turn interactions, allows creating sessions with instructions, tools, or a specific model/use case.
- respond(to:) and respond(to:generating:): functions to generate text or structured outputs, returning a Response with a .content property.
- Generable macro: enables structured outputs via Swift types, with constrained decoding to ensure schema adherence; supports primitive, collection, and composed types; demonstrates usage on structs and enums.
- Streaming: uses snapshot streaming via Itinerary.PartiallyGenerated to progressively fill properties; includes streamResponse and SwiftUI integration.
- Tool Protocol: defines a Tool protocol to fetch external data, with a GetWeatherTool example; describes how tools are attached to a session and how tool outputs are inserted into transcripts.
- Tool calling behavior: tools can be called multiple times per request, possibly in parallel; model decides when to call; arguments are ensured valid via @Generable.
When to use it
Use this reference when you are implementing Foundation Models features, understanding API capabilities, looking up specific code examples, planning architecture with Foundation Models, migrating from prototype to production, or debugging implementation issues. Related skills include axiom-foundation-models and axiom-foundation-models-diag.
What it can touch
Tools are attached to a LanguageModelSession (e.g., GetWeatherTool) to fetch external data. The protocol defines a call(arguments:) async throws -> ToolOutput method; tool outputs can be natural language or structured GeneratedContent. The example shows attaching GetWeatherTool to a session and issuing a prompt to retrieve weather data.
Caveats
The reference notes the model is a 3B parameter, 2-bit quantized, with a 4096 token context; it runs entirely on-device with no network, no cost, no data leaves the device. It emphasizes structured decoding to guarantee correctness and warns about token counts affecting latency via longer prompts. It does not provide outcomes beyond the described behaviors and examples.
# Foundation Models Framework — Complete API Reference ## Overview The Foundation Models framework provides access to Apple's on-device Large Language Model (3 billion parameters, 2-bit quantized) with a Swift API. This reference covers every API, all WWDC 2025 code examples, and comprehensive implementation patterns. ### Model Specifications 3B parameter model, 2-bit quantized, 4096 token context (input + output combined). Optimized for on-device summarization, extraction, classification, and generation. NOT suited for world knowledge, complex reasoning, math, or translation. Runs entirely on-device — no network, no cost, no data leaves device. --- ## When to Use This Reference Use this reference when: - Implementing Foundation Models features - Understanding API capabilities - Looking up specific code examples - Planning architecture with Foundation Models - Migrating from prototype to production - Debugging implementation issues **Related Skills**: - `axiom-foundation-models` — Discipline skill with anti-patterns, pressure scenarios, decision trees - `axiom-foundation-models-diag` — Diagnostic skill for troubleshooting issues --- ## LanguageModelSession ### Overview `LanguageMod
- Overview
- Model Specifications
- When to Use This Reference
- LanguageModelSession
- Creating a Session
- Instructions vs Prompts
- respond(to:) Method
- respond(to:generating:) Method
- Generation Options
- Multi-Turn Interactions
- Retaining Context
- Transcript Property
- isResponding Property
- @Generable Macro
What does the axiom-foundation-models-ref skill do?
Reference — Complete Foundation Models framework guide covering LanguageModelSession, @Generable, @Guide, Tool protocol, streaming, dynamic schemas, built-in use cases, and all WWDC 2025 code examples
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill axiom-foundation-models-ref-charleswiltgen-axiom-2 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
