jevrecipes

Recipe catalog / memory-subject

Identify whom a memory describes

memory-subject is a Jev recipe from the jev-recipes TypeScript package. Label whether one candidate memory describes the user, someone else, or a group including the user. Use it when you need to avoid treating a fact about someone else as a fact about the user.

Last updated .

Explore this recipe interactively · Source and implementation guide · Markdown version

How do I 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);

What input does memory-subject take?

FieldTypeNeeded
statementstringRequired
userstringRequired
contextstringOptional
minConfidencenumberOptional
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
  }
}

What does a memory-subject result look like?

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
  }
}

Input

Supply one atomic statement and identify the user whose profile you are considering. Include the user's speaker role, such as "Alex, the speaker of this message." Optional context can identify quoted speakers or resolve pronouns. The recipe has no account or conversation state of its own.

All supplied text must be non-empty. minConfidence defaults to 0.8 and accepts values from 0 to 1. See shared options and behavior for client configuration, validation, and errors.

Result

Verdict Meaning
user The described property belongs to the identified user alone.
other The described property belongs to someone or something else, excluding the user.
shared The same property explicitly applies to a group including the user.
unclear Identities or references are unresolved, no property is attributable, or separate assertions require splitting.

The result has status: 'ready' when confidence meets minConfidence and the verdict is not unclear. Otherwise it has status: 'review'. An unclear verdict always requires review, even at full confidence and a zero threshold. ready concerns attribution, not approval to save a memory.

Decision boundaries

These cases document the intended policy, not measured model accuracy. In this table, the user is Alex, who wrote the message, unless noted.

Statement and context Intended verdict
"I am vegetarian." user
"My brother is vegetarian." other
"My brother and I are vegetarian." shared
"Sam said, 'I am vegetarian.'" other
"I admire my brother." user
"My brother is vegetarian, but I am not." Two separate assertions require splitting. unclear
"They prefer email." No identity is supplied for "they." unclear
"They prefer email." Context identifies "they" as Alex and Sam. shared
"I am not vegetarian." The subject is Alex; the negation must be preserved. user
"If I were vegetarian, I would order tofu." The subject is Alex; the hypothetical does not establish an actual preference. user

Reuse

Use this before attaching a candidate fact to a person's profile. For example, other in the saved example helps your application avoid recording "vegetarian" as Alex's diet.

After attribution, memory-scope can assess where the statement applies, and preference-kind can classify its persistence. Attribution-match answers who said or endorsed a statement, which can differ from whom it describes.

Uses the shared choice helper and makes one logical Jev request. It does not call another recipe, extract facts, or write memories.

Limits

How accurate is memory-subject?

Fixture only

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.

What are the limits of memory-subject?