Recipe catalog / memory-subject
Identify whom a memory describes
Label whether one candidate memory describes the user, someone else, or a group including the user.
You need to avoid treating a fact about someone else as a fact about the user.
Explore this recipe interactively ยท Source and implementation guide
Use memory-subject in TypeScript
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { memorySubject } from 'jev-recipes/memory-subject';
const result = await memorySubject({
"statement": "My brother is vegetarian.",
"user": "Alex, the speaker of the statement."
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| statement | string | Required |
| user | string | Required |
| context | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"statement": {
"type": "string",
"description": "One atomic statement or candidate memory whose subject should be identified."
},
"user": {
"type": "string",
"description": "The person whose memory profile is being considered, including their speaker role when relevant."
},
"context": {
"type": "string",
"description": "Supplied speaker identities or surrounding text needed to resolve references."
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"statement",
"user"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"verdict": {
"type": "string",
"enum": [
"user",
"other",
"shared",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"user",
"other",
"shared",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"user",
"other",
"shared",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}Saved example result
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo memory-subject.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "other",
"confidence": 0.97,
"probabilities": {
"user": 0.01,
"other": 0.97,
"shared": 0.01,
"unclear": 0.01
}
}
Evaluation evidence
No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.
Use the evaluation guide to measure this decision on your own labeled cases.
Limitations
- Requires an identified user and enough speaker context to resolve references; it does not infer a user from an account or session.
- Subject attribution does not establish truth, actuality, permanence, consent, or permission to store a memory.
- Classifies one atomic statement; it does not extract, split, rewrite, or persist memories.
Related recipes
- memory-scope: Use memory-scope to identify where a fact applies after identifying whom it describes.
- attribution-match: Use attribution-match to check who said or endorsed a statement, rather than whom the statement describes.
- preference-kind: Use preference-kind to distinguish a lasting preference from a temporary instruction.