---
title: n1r.core — what the runtime owns
---

# `n1r.core` — what the runtime owns

> _`n1r.core` is the N1-owned runtime surface. It hides substrate details and owns the cross-cutting mechanics every Nexus product needs._

`n1r.core` is the foundation that takes an authored pack and turns it into a bounded, observable, scoped runtime execution. It exists so product packs do not need to own auth, tokens, model quirks, telemetry policy, or trusted-fact generation.

## What `n1r.core` owns

| Responsibility | What that means |
|---|---|
| Pack loading and validation | Reads the authored files, checks them, and refuses invalid packs before runtime |
| OAuth2 token lifecycle | Acquires the token for the run or session, refreshes it when needed, and hands it to Pinax |
| Model resolution | Resolves model ids and chooses provider-native routing where required |
| LLM attribution and observability | Emits PHI-safe model telemetry with run, pack, subject, and model attribution |
| Hard run bounds | Enforces a real wall-clock timeout and cancellation path |
| Artifact emission | Returns structured clinical reasoning artifacts and lineage |
| Clinician-authored instrumentation | Applies the same runtime instrumentation to database-backed clinician definitions |
## The important auth boundary

`n1r.core` owns token acquisition and refresh. Pinax receives the token and runtime context it is handed. Pinax then uses that token when calling `api-client`. `api-backend` remains the policy authority.

That boundary keeps token lifecycle in one runtime layer and keeps capability code separate from identity logic.

## The important model boundary

`n1r.core` resolves models by registry id, not by raw provider URL. It can use provider-native routes where needed. Gemini reasoning paths are the clearest case: the proven pattern is native Gemini through the LiteLLM gateway root when required, not flattening everything through one OpenAI-compatible path.

## The important runtime boundary

Tool-call limits are not enough. `n1r.core` must enforce hard wall-clock bounds around async runs. A cooperative stop signal is not a real production limit.

## The important authoring boundary

`n1r.core` must treat file-authored packs and active database-backed definitions as one runtime class after normalization. Clinician-authored agents do not get a weaker runtime path. They receive the same token, observability, timeout, artifact, and lineage behavior automatically.
