pinecallDocs
Guides / Testing knowledge & memory

Testing knowledge & memory

A golden for the index and one for memory: does the right chunk come back, does a call teach the right facts.

A conversation golden cannot tell you whether the index missed a better passage, or whether a call taught memory the right facts. Three goldens of their own answer those questions, and two of them cost no model call at all.

How it works#

Knowledge and memory each have a read side and a write side. A conversation only ever sees what it was handed, so each side gets a golden that looks at the step directly.

Golden Question Verb Costs
agents/<name>/test/goldens/docs.json does the right chunk come back for a question? pinecall docs eval one embedding per question
agents/<name>/test/goldens/memory.json does recall bring back the right facts? pinecall memory eval one embedding per fact and question
agents/<name>/test/memory/*.json does a call teach memory the right facts? pinecall remember one model call per case
a golden with memory does the agent use what it remembered? pinecall test a conversation

docs eval and memory eval score by code, with no model in the loop: two runs over the same data give the same numbers. Each exits 1 when a question missed.

The index: docs.json#

A list of questions, each with the chunk that should answer it. expects is the heading path a chunk carries: a file alone accepts any chunk of it, a heading accepts that section and what is under it. Where two pages answer as well as each other — the FAQ's one line and the guide it points at — expects is a list, and any of them answers; a page that answers worse is not on the list.

agents/front-desk/test/goldens/docs.json
[
  { "asks": "how much is my co-payment?",
    "expects": "insurance.md › Insurance and billing › Co-payments" },
  { "asks": "do I have to fast before the blood test?",
    "expects": "test-preparation.md › Preparing for a test › Blood tests" },
  { "asks": "how much is a check-up?",
    "expects": ["prices.md › Prices › Check-up", "faq.md › Prices"] }
]
Terminal
$ pinecall docs eval
clinica-norte · pplx-embed-context-v1-0.6b · 7 questions · recall@4 1.00 · nDCG@10 0.89 · 918 ms

With no --k, it asks with the k the agent reads that base with, because the golden asks what a turn gets; with both a golden file and --base named there is no agent to read it from, and it asks with 8. --k 1 asks whether the right chunk comes first. The golden applies no --min-score: it measures the ranking, not the attachment's threshold.

Figure Means
recall@k the share of questions whose chunk came back at all. The one that matters: a chunk the model never sees cannot be used
nDCG@10 how high it ranked. Two bases that both find a passage differ if one puts it first and the other third. Only the k sections asked for are read, so a passage past k counts as not found
the model named the embedder. Two scores compare only under one embedder

Every missed question is printed with the first thing that came back instead. Fifty to a hundred questions per base is the size that stops being noise; the best are the ones callers already asked, and A knowledge base that answers says where to find them and what each miss asks you to fix.

Recall: memory.json#

Each question brings the facts its contact holds and what the caller just said. The facts go to a scratch contact and are deleted after the question, so no real contact is read or written.

agents/front-desk/test/goldens/memory.json
[
  { "holds": ["Prefers mornings", "Dr. Vidal's patient since 2024", "Allergic to penicillin"],
    "asks": "does Tuesday work for you?",
    "expects": ["Prefers mornings"] }
]
Terminal
pinecall memory eval            # with the k a turn reads: six facts
pinecall memory eval --k 1      # is the right fact first?

A fact counts as found when what came back contains it, ignoring case, accents and spacing.

Give each question more facts than a turn reads. A contact with four facts gets all four back whatever the ranking did, and recall@6 1.00 then says nothing. A smaller --k makes recall bite.

Extraction: agents/<name>/test/memory/#

At hang-up, one model call reads the whole call and decides what memory adds, replaces and drops. A case is one call already held, both speakers, and what must come of it:

agents/front-desk/test/memory/keeps-the-allergy-never-the-card.json
{
  "name": "keeps the allergy and never the card",
  "said": [["caller", "I'm Marta, I'm allergic to penicillin"],
           ["agent",  "Noted. Does Tuesday work for you?"],
           ["caller", "Yes. And here's my Visa, 4242 4242 4242 4242"]],
  "holds": [],
  "expect": { "writes": ["allergies"], "never": ["payments"], "never_says": ["4242 4242 4242 4242"] }
}
Field Checks
expect.writes every category named got at least one fact. Categories are the memory policy's remember words, and a fact is filed under one exactly as written: a word the policy does not have is written as other, which no writes names, so the case breaks and its report shows kept add · other · …
expect.never nothing was written under these: the policy's forget words
expect.never_says no fact carries this value, under any category, digits matched alone too
expect.invalidates these held facts were superseded, and no other held fact was: each named by its text, exactly as written in holds

holds is what the contact already has before the call, one sentence per fact (["Prefers mornings", "Allergic to penicillin"]); the model sees each under an id of its own, and expect.invalidates names them back by their text. Each case also says what admission refused and why, on a refused line of its own.

Two more fields are optional. channel says what the call came on (phone when left out), as the model is told it. plants lists sentences that must never pass admission: each is tried as a fact under the policy's first remember category, and the case breaks if one would be written.

Terminal
pinecall remember               # every case
pinecall remember --grep tarjeta

Every answer is judged by code: a category is a word, a value is a literal, a superseded fact is an id. No model compares two sentences. The model is asked for the call's facts in the language the caller spoke, so a case's caller lines are the language it expects them in; the agent's language setting is used only when those lines say nothing clearly.

Use: a golden with memory#

A conversation golden can open the call already knowing facts about the caller. They are answered to the agent's recall for that call alone, and nothing is written to memory. The agent must have a memory policy: a golden with memory is refused for an agent that keeps none.

JSON
{
  "memory": ["Prefers to be called in the morning"],
  "turns": [{ "say": "Do you have anything on Tuesday?" }],
  "expect": { "tools": ["freeSlots"], "not": ["what time suits you"] }
}

What the agent knows by heart (the agent's Knowledge setting) has no golden: it reaches the model whole on every call, so nothing ranks it. The conversation goldens and the grounded judge cover it.

Next steps#