Outcome is not reward.
Reward is a versioned interpretation of outcomes under an objective and guardrails.
Closed-loop decision learning
T2K turns each consequential decision into a governed episode: what the system knew, what it recommended, who authorized it, what ran, what happened, and why a policy change was or was not promoted.
Canonical architecture
It defines the meaning of state variables, permissible actions, measurements, rewards, constraints, authority, and terminal conditions.
KnowledgeState= Compile(Ontology, AcceptedClaims, Provenance, Time, Context)Recommendation= Reason(PolicyVersion, KnowledgeState, Objective, Policies)RewardAssessment= Evaluate(Observations, Baseline, RewardSpec, Attribution)NextPolicy= GovernedPromote(Learn(Episodes), Evaluation, HumanReview)Reward is a versioned interpretation of outcomes under an objective and guardrails.
A human override is useful feedback, but it can reflect preference, missing context, or error.
An outcome after an action is not automatically attributable to that action.
Policy, objective, reward, and ontology updates create reviewed versions with rollback.
Hands-on path
Begin with a repeated decision that has a measurable result and a reversible action. TransferOS owner-dependency reduction is a useful example.
Create an immutable Decision Context from accepted claims, the resolved pack set, objectives, policies, alternatives, uncertainty, and authority requirements.
Create the Decision Context after baseline deployment. It freezes the active policy descriptor, and the episode must honor that version even after a later deployment.
Store input and output hashes, model and prompt versions, tool versions, latency, cost, trace, and action probability when off-policy evaluation will need it.
Keep recommendation, authorization, and execution separate. External effects require an idempotent attempt and a successful execution receipt.
Record sourced measurements after execution. An observation is not automatically an accepted business fact and is not automatically caused by the action.
Evaluate the observation vector against direction, weight, baseline, window, attribution method, and guardrails. Do not hide a failed guardrail inside one scalar.
Close only after the authorized decision is bound, required measurements are complete, no execution attempts remain unresolved, and every guardrail violation has an independent waiver.
Build from training episodes, evaluate against a disjoint holdout, require action coverage, inspect intervals and safety, then let a different human promote the immutable version.
TransferOS example
import { T2kClient } from "@t2kai/core";
// The agent API is a structured decision problem, not a prompt.
const episode = await t2k.createDecisionEpisode(graphKey, {
episodeKey: "episode:owner-dependency:2026-07",
// This context was created after baseline deployment and froze that binding.
decisionContextKey: "decision:owner-dependency:2026-07"
});
await t2k.recordReasoningRun(episode.id, {
runKey: "run:owner-dependency:001",
modelRef: "agent:operations-reviewer",
promptVersion: "owner-dependency-v3",
codeVersion: gitSha,
inputHash: context.contextHash,
outputHash: recommendationHash
});
await t2k.recordEpisodeObservation(episode.id, {
measureRef: "operations.owner_approval_share",
observedValue: 0.42,
baselineValue: 0.71,
observationWindow: "90d",
sourceRefs: ["workflow://approvals/2026-q3"],
provenance: { method: "approval_log_aggregation" },
observedAt: new Date().toISOString()
});
const assessment = await t2k.assessEpisodeReward(episode.id, {
assessmentKey: "assessment:owner-dependency:90d"
});
if (assessment.lifecycleStatus === "guardrail_violation") {
throw new Error("Independent waiver or remediation required before closure");
}
await t2k.closeDecisionEpisode(episode.id, "Required review is complete");
const evaluation = await evaluator.evaluateLearningCandidate(candidate.id, {
evaluationKey: "replay:owner-dependency:1.1.0",
evaluationType: "historical_replay",
holdoutEpisodeIds
});
if (evaluation.lifecycleStatus !== "passed") {
throw new Error("Do not promote an unsupported challenger");
}
await promoter.promoteLearningCandidate(candidate.id, {
reviewRationale: "Held-out replay passed; intervals and safety reviewed.",
deploy: true
});Executable evidence
Harborlight Field Service is fully synthetic. Its public clean-room fixture validates the exact schema, compiles the pack, and computes a disjoint held-out replay. Studio's acceptance suite extends the same evidence through services, Postgres, promotion, and rollback.
Verified golden demo
# Create and run a local decision project
npx create-t2k@latest my-decision-loop
cd my-decision-loop
npm start
# Verify the same scaffold from source
git clone https://github.com/sigaihealth/t2k-core.git
cd t2k-core
npm ci
npm run example:scaffoldInspect the public fixtureChoose the weakest sufficient learner
The learning mode should match the decision topology, reversibility, evidence volume, and risk. Most SMB teams should begin with supervised feedback.
Humans review outcomes and propose policy improvements.
Log action propensity and evaluate challengers offline first.
Requires terminal conditions, strict authority, and an exploration budget.
The solver can change while objectives and constraints remain governed.
Historical verdicts, metrics, and safety results come from the reference evaluator, not the caller.
A candidate cannot pass when the logged behavior does not support the actions it selects.
A configured technical pass below 20 episodes remains directional evidence, not statistical generalization.
The candidate proposer, evaluator, and promoter must be different signed-in humans.
Production rule
Online exploration is accepted only when authority is explicit, actions are reversible, maximum exploration probability is bounded, guardrails are measurable, and rollback is operational.