Direct user statements or direct behavioural evidence. Content this layer contains was said or demonstrated by the user.
- Sources: chat, forms, instrumented actions
- Never generated
- Addressable, auditable, user-editable
PSON5 is an open-source personalization infrastructure and
.pson file format. It keeps what the user said, what
the model inferred, and what the simulator predicted as three
separate, auditable things — so agents can plan, explain, and fail
gracefully on top of them.
Vendor memory features store free-form notes derived by the model itself. You cannot, in general, tell which entries are direct user statements and which are the model's guesses about you. The same ambiguity propagates to every downstream agent.
.pson moves between models, tenants, and stores.This separation is the hard constraint of the project. Every engine, every storage adapter, every SDK call is designed to keep these three layers from collapsing. Scope §29, the "Final Constraint."
Direct user statements or direct behavioural evidence. Content this layer contains was said or demonstrated by the user.
Traits, tendencies, heuristics. Every entry carries a confidence score and references the observed evidence that supports it.
Scenario-specific predictions generated in response to a query. Never written back as observed or inferred.
Signals flow in through the acquisition engine, get structured by modeling, simulated on demand, tracked as state, related through the graph, and persisted via serialization. Every hop respects the layer invariant.
.pson documents. Versioned, schema-validated,
consent-scoped, encryption-aware. Roundtrips in under 1.3 ms at
1000-fact scale.
The SDK ships with first-class adapters for OpenAI, Anthropic, and any
OpenAI-compatible endpoint. Plug in a custom ProviderAdapter
if you're running your own.
npm install @pson5/sdk
import { createPsonSdk } from "@pson5/sdk";
const sdk = createPsonSdk({ provider: "anthropic" });
const profile = await sdk.observe({
domain: "core",
fact: "primary_language",
value: "rust"
});
const traits = await sdk.infer(profile);
const decision = await sdk.simulate({
profile,
scenario: "series_a_founding_engineer_offer"
});
npx @pson5/cli init ./profile.pson
npx @pson5/cli ask --domain core
npx @pson5/cli simulate \
--profile ./profile.pson \
--scenario "series_a_offer"
The SDK pulls in whichever engines you need. Everything is also addressable individually — use the trait extractor without the simulator, the graph without the SDK, whatever fits.
Primary TypeScript SDK. Observe, infer, simulate, project context for an agent. This is what most integrations use.
Terminal interface — init, ask, infer, simulate, project, explain. Typed error codes, shell completion, readable output.
Single source of interface truth. All TypeScript types and contracts shared by every package.
JSON Schemas for .pson documents. Validation, migration,
drift detection.
Redaction, consent enforcement, provider-policy helpers. Keeps restricted fields out of simulation output.
Adaptive question flow, follow-up generation, fatigue detection, contradiction probing. Works with or without a domain registry.
Rules-first trait extractor, pattern miner, heuristic builder. Every output is confidence-annotated and evidence-linked.
Scenario simulation: decision, response, action likelihood, counterfactual. Emits reasoning trace + caveats alongside every prediction.
Dynamic state derivation — focused, distracted, stressed, motivated — with trigger patterns and recovery signals.
Knowledge-graph construction + explainability helpers. Deterministic derivation so two runs over the same data produce identical graphs.
.pson init, import/export, storage adapters, persistence.
Roundtrips 1000 facts in ~1.3 ms.
Model-agnostic ProviderAdapter registry. OpenAI,
Anthropic, and OpenAI-compatible ship built-in.
Agent-safe projection layer. Redacted, consent-scoped summary of a profile — never exposes raw internals to the agent.
Neo4j persistence + graph sync. Bidirectional with the graph engine; supports Cypher traversal.
Postgres-oriented repository + schema helpers. Use with pgvector for embedding support.
Full org on npm: npmjs.com/org/pson5
Each package ships with its own README, typed entry points, and keeps its public surface small. The full monorepo lives at github.com/fredabila/pson5 .
The SDK exposes PSON operations as tool definitions consumable by Claude,
GPT, and OpenAI-compatible models. The agent calls
projectContext(scope) and receives a redacted,
consent-scoped summary with a reasoning trace. Raw evidence never leaks.
import Anthropic from "@anthropic-ai/sdk";
import { buildAgentTools } from "@pson5/sdk/agent-tools";
const client = new Anthropic();
const tools = buildAgentTools(sdk, { scope: "core" });
const response = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 1024,
tools,
messages: [
{ role: "user", content: "Should I take the Series A offer?" }
]
});
// The agent calls pson_project, pson_simulate, pson_explain as tools.
// Every simulation comes back with reasoning + caveats.
Every trait carries confidence. Predictions carry confidence. Low-confidence is marked, not hidden.
Scopes, restricted fields, and revocation are in the data model, not a side table.
Domain modules activate only when you need them. No silent over-collection.
A .pson file moves between models, tenants, and backends unchanged.
Productivity, education, finance, health, social — and custom domains under your own namespace.
Observed, inferred, simulated remain distinct across every engine, every store, every API surface.
@pson5/sdk.v0.2.0 is the first production-oriented release. PRs welcome. Scope doc is the canonical spec — every engine respects it.