Getting started
Install Preceptor and create your first instructional plan.
Installation
Preceptor requires Node.js 24 or later and ECMAScript modules (ESM). TypeScript declarations are included.
npm install @0xbuff/preceptorQuick start
Save this example as instruction.mjs. It needs no API key, network connection or lesson adapter.
// preceptor-docs: runnable
import { POLICY_REVISION, planInstruction } from "@0xbuff/preceptor";
const host = {
policyRevision: POLICY_REVISION,
sessionId: "example",
mode: "guided_learning",
grants: [],
consent: [],
installed: [],
};
const result = planInstruction(host, { assistance: "plan", intent: "question" });
if (result.status !== "completed" || result.strategy !== "question")
throw new Error("Expected an offline question plan");
console.log(result.nextActions[0]?.text);node instruction.mjsExpected output:
Predict what happens next and explain the reasoning behind your prediction.The host supplies the mode and empty grants, consent and installed operation lists. planInstruction validates the inputs, selects the question strategy and returns a fixed prompt. No capability is granted. Change the intent to hint for a different prompt.
Use runInstruction when you need generated advice or contextual operations. A generation request without a model reports model_unavailable, except when locked assessment guidance applies.
Next steps
- Instructional policy: select modes and authorize operations.
- Sessions: connect model, lesson and practice adapters.
- Narrative memory: recall scoped facts.
- Committed summaries: use feedback from host decisions.
- API reference: look up exported functions and types.