docs(cookbooks): rename the adjuster to Sarah and sync outputs to a fresh live run

This commit is contained in:
kartik-mem0
2026-08-27 15:20:34 +05:30
parent 6aa0c27212
commit 4fb96e9518
2 changed files with 299 additions and 148 deletions
@@ -3,7 +3,7 @@ title: Give Agents Shared Working Memory
description: Keep a claims adjuster's personal preferences separate from a claim's shared decisions using user_id, agent_id, and two sets of custom instructions.
---
Priya is a claims adjuster. Every claim she opens should remember how she likes things drafted. Every claim itself should remember its own decisions, no matter which adjuster opens it next. A single `user_id` and one project-wide instruction set cannot hold both without one leaking into the other.
Sarah is a claims adjuster. Every claim she opens should remember how she likes things drafted. Every claim itself should remember its own decisions, no matter which adjuster opens it next. A single `user_id` and one project-wide instruction set cannot hold both without one leaking into the other.
<Info icon="cloud">
**Works with:** Mem0 Platform (`MemoryClient`)
@@ -35,11 +35,11 @@ Grab an API key from the <a href="https://app.mem0.ai/?utm_source=oss&utm_medium
## Make It Work Once
Claim CLM-48211 is a warehouse fire loss for Meridian Logistics, and Priya is the adjuster who opened it. Set two rule sets on the project once: `custom_instructions` for what belongs to the adjuster, `agent_custom_instructions` for what belongs to the claim.
Claim CLM-48211 is a warehouse fire loss for Meridian Logistics, and Sarah is the adjuster who opened it. Set two rule sets on the project once: `custom_instructions` for what belongs to the adjuster, `agent_custom_instructions` for what belongs to the claim.
<CodeGroup>
```python Python
ADJUSTER = "adjuster_priya_cookbook_demo"
ADJUSTER = "adjuster_sarah_cookbook_demo"
CLAIM = "claims_agent_clm48211_cookbook_demo"
user_instructions = """Your Task: Track what a claims adjuster needs remembered about themselves, not about any single claim.
@@ -73,7 +73,7 @@ client.project.update(
)
```
```typescript TypeScript
const ADJUSTER = "adjuster_priya_cookbook_demo";
const ADJUSTER = "adjuster_sarah_cookbook_demo";
const CLAIM = "claims_agent_clm48211_cookbook_demo";
const userInstructions = `Your Task: Track what a claims adjuster needs remembered about themselves, not about any single claim.
@@ -133,12 +133,12 @@ await client.add(
</CodeGroup>
<Info icon="check">
Expected output: one memory, attributed to `CLAIM`: `"Reserve on claim CLM-48211 was raised to $1.8 million because the structural engineer's report indicated the warehouse requires a full rebuild rather than a repair"`. Nothing lands on Priya's personal shelf, the instructions exclude claim decisions from it.
Expected output: two memories, both attributed to `CLAIM`: `"Reserve for claim CLM-48211 was increased to $1.8 million to cover a full rebuild, as indicated by the structural engineer's report"`, plus the engineer's rebuild finding stored as its own durable fact. Nothing lands on Sarah's personal shelf, the instructions exclude claim decisions from it.
</Info>
## The Problem
Suppose Marcus, a second adjuster, needs to pick up CLM-48211 while Priya is out. If claim decisions only ever went on the acting adjuster's `user_id`, with no `agent_id` and no `agent_custom_instructions`, Marcus's own memory would be empty no matter what Priya decided:
Suppose Marcus, a second adjuster, needs to pick up CLM-48211 while Sarah is out. If claim decisions only ever went on the acting adjuster's `user_id`, with no `agent_id` and no `agent_custom_instructions`, Marcus's own memory would be empty no matter what Sarah decided:
```python
marcus_personal = client.get_all(filters={"user_id": "adjuster_marcus_cookbook_demo"})
@@ -150,7 +150,7 @@ print(marcus_personal["count"])
0
```
Marcus has never talked to Mem0 before, so an empty personal shelf is expected. The real gap is structural: if the reserve decision above had gone on Priya's `user_id` alone, it would live there permanently, and Marcus would have no identifier that reaches it. The claim's history would be trapped on one person's shelf.
Marcus has never talked to Mem0 before, so an empty personal shelf is expected. The real gap is structural: if the reserve decision above had gone on Sarah's `user_id` alone, it would live there permanently, and Marcus would have no identifier that reaches it. The claim's history would be trapped on one person's shelf.
## Fix It: Give the Claim Its Own Shelf
@@ -176,19 +176,19 @@ for (const r of marcusView.results) {
```
</CodeGroup>
**Output** (after the full scenario below has run, four claim facts on file):
**Output** (from the full notebook run, four claim facts on file):
```
- [claims_agent_clm48211_cookbook_demo] Assistant noted that the cause of loss for claim CLM-48211 is faulty wiring identified by the fire marshal's report
- [claims_agent_clm48211_cookbook_demo] Reserve on claim CLM-48211 was raised to $1.8 million because the structural engineer's report indicated the warehouse requires a full rebuild rather than a repair
- [claims_agent_clm48211_cookbook_demo] The building coverage limit on the Meridian Logistics policy for claim CLM-48211 is $2,400,000 with a $25,000 deductible
- [claims_agent_clm48211_cookbook_demo] Assistant recorded that subrogation is being pursued against Voss Electrical for claim CLM-48211 based on the fire marshal's finding of faulty wiring as the ignition source
- [claims_agent_clm48211_cookbook_demo] Reserve for claim CLM-48211 was increased to $1.8 million to cover a full rebuild, as indicated by the structural engineer's report
- [claims_agent_clm48211_cookbook_demo] The structural engineer's report for claim CLM-48211 states that the warehouse requires a full rebuild rather than a repair
- [claims_agent_clm48211_cookbook_demo] The building coverage limit for claim CLM-48211 under the Meridian Logistics policy is $2,400,000 with a $25,000 deductible
- [claims_agent_clm48211_cookbook_demo] Assistant noted that subrogation will be pursued against Voss Electrical, with the fire marshal's report identifying faulty wiring as the ignition source
```
Marcus sees the full claim history and none of Priya's personal preferences, because those never carried `agent_id` attribution in the first place.
Marcus sees the full claim history and none of Sarah's personal preferences, because those never carried `agent_id` attribution in the first place.
## Build On It: One Message, Two Shelves
A single message can touch both shelves in one `add()` call. Priya makes a claim decision and states a personal preference in the same breath:
A single message can touch both shelves in one `add()` call. Sarah makes a claim decision and states a personal preference in the same breath:
<CodeGroup>
```python Python
@@ -212,10 +212,10 @@ await client.add(
```
</CodeGroup>
**Output:** three memories from one call. Two land on the claim shelf (the subrogation decision, and a cause-of-loss fact pulled out of the same sentence even though it was never stated on its own), one lands on Priya's personal shelf (the bullet-point formatting rule).
**Output:** two memories from one call, one per shelf. The subrogation decision lands on the claim shelf with the fire marshal's faulty-wiring finding folded into its reasoning, and the bullet-point formatting rule lands on Sarah's personal shelf.
<Warning>
Extraction makes judgment calls, it does not mirror your instructions line by line. Earlier in this scenario, a one-off policy-limit lookup (excluded by name in the instructions above) still landed on the claim shelf, because it was judged a durable fact worth keeping for the life of the claim. Read what actually got stored with `get_all()` rather than assuming the instructions were applied literally.
Extraction makes judgment calls, it does not mirror your instructions line by line. In the full notebook run, a one-off policy-limit lookup (excluded by name in the instructions above) still landed on the claim shelf, because it was judged a durable fact worth keeping for the life of the claim. Read what actually got stored with `get_all()` rather than assuming the instructions were applied literally.
</Warning>
## Production Patterns
@@ -223,13 +223,13 @@ Extraction makes judgment calls, it does not mirror your instructions line by li
- **Reviewing and correcting a personal shelf**: `get_all()` with the adjuster's `user_id`, then act on what is actually stored.
<CodeGroup>
```python Python
priya_shelf = client.get_all(filters={"user_id": ADJUSTER})
for r in priya_shelf["results"]:
sarah_shelf = client.get_all(filters={"user_id": ADJUSTER})
for r in sarah_shelf["results"]:
print(r["id"], "-", r["memory"])
```
```typescript TypeScript
const priyaShelf = await client.getAll({ filters: { userId: ADJUSTER } });
for (const r of priyaShelf.results) {
const sarahShelf = await client.getAll({ filters: { userId: ADJUSTER } });
for (const r of sarahShelf.results) {
console.log(r.id, "-", r.memory);
}
```
+279 -128
View File
@@ -13,23 +13,46 @@
"\n",
"Mem0 keeps these apart using two identifiers on every `add()` call, `user_id` for the adjuster and `agent_id` for the claim, plus two separate sets of extraction rules, `custom_instructions` for the adjuster shelf and `agent_custom_instructions` for the claim shelf. This mirrors the id convention used in Mem0's CoCounsel example, where a lawyer maps to `user_id` and a case maps to `agent_id`. Here the adjuster is the person, and the claim is the shared case file.\n",
"\n",
"This notebook was executed live against the Mem0 Platform API. Every output below is a real response, not a mock.",
"\n\nFor the narrative walkthrough of this same pattern, see the [Give Agents Shared Working Memory](https://docs.mem0.ai/cookbooks/essentials/agent-memory-insurance-claims) cookbook page."
"This notebook was executed live against the Mem0 Platform API. Every output below is a real response, not a mock.\n",
"\n",
"For the narrative walkthrough of this same pattern, see the [Give Agents Shared Working Memory](https://docs.mem0.ai/cookbooks/essentials/agent-memory-insurance-claims) cookbook page."
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"outputs": [],
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:08.774876Z",
"iopub.status.busy": "2026-08-27T09:46:08.774699Z",
"iopub.status.idle": "2026-08-27T09:46:09.471287Z",
"shell.execute_reply": "2026-08-27T09:46:09.470775Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"%pip install -q mem0ai"
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:09.472860Z",
"iopub.status.busy": "2026-08-27T09:46:09.472717Z",
"iopub.status.idle": "2026-08-27T09:46:14.361722Z",
"shell.execute_reply": "2026-08-27T09:46:14.361005Z"
}
},
"outputs": [],
"source": [
"import json\n",
@@ -41,7 +64,7 @@
"os.environ[\"MEM0_API_KEY\"] = \"YOUR_MEM0_API_KEY\"\n",
"client = MemoryClient()\n",
"\n",
"ADJUSTER_PRIYA = \"adjuster_priya_cookbook_demo\"\n",
"ADJUSTER_SARAH = \"adjuster_sarah_cookbook_demo\"\n",
"ADJUSTER_MARCUS = \"adjuster_marcus_cookbook_demo\"\n",
"CLAIM_AGENT = \"claims_agent_clm48211_cookbook_demo\""
]
@@ -52,14 +75,14 @@
"source": [
"## 1. The mapping\n",
"\n",
"Claim CLM-48211 is a commercial property fire loss at a Meridian Logistics warehouse. Priya is the adjuster who opened it.\n",
"Claim CLM-48211 is a commercial property fire loss at a Meridian Logistics warehouse. Sarah is the adjuster who opened it.\n",
"\n",
"| Mem0 identifier | Maps to | What lives there |\n",
"|---|---|---|\n",
"| `user_id` | An individual adjuster, e.g. Priya | Her drafting style, her communication rules, durable across every claim she works |\n",
"| `user_id` | An individual adjuster, e.g. Sarah | Her drafting style, her communication rules, durable across every claim she works |\n",
"| `agent_id` | One claim's agent instance, e.g. `claims_agent_clm48211` | Decisions made on this claim and why, plus durable facts about it, shared by anyone who opens the claim |\n",
"\n",
"Every `add()` call below passes both `user_id=ADJUSTER_PRIYA` and `agent_id=CLAIM_AGENT` at once. Mem0 does not require you to pick a shelf ahead of time, it extracts facts from the conversation and routes each one against the rules for its shelf."
"Every `add()` call below passes both `user_id=ADJUSTER_SARAH` and `agent_id=CLAIM_AGENT` at once. Mem0 does not require you to pick a shelf ahead of time, it extracts facts from the conversation and routes each one against the rules for its shelf."
]
},
{
@@ -75,15 +98,22 @@
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:14.364467Z",
"iopub.status.busy": "2026-08-27T09:46:14.364243Z",
"iopub.status.idle": "2026-08-27T09:46:14.692628Z",
"shell.execute_reply": "2026-08-27T09:46:14.692110Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"had custom_instructions: True\n",
"had agent_custom_instructions: False"
"had agent_custom_instructions: False\n"
]
}
],
@@ -95,14 +125,21 @@
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:14.694276Z",
"iopub.status.busy": "2026-08-27T09:46:14.694156Z",
"iopub.status.idle": "2026-08-27T09:46:15.051548Z",
"shell.execute_reply": "2026-08-27T09:46:15.050970Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"{'message': 'Updated custom instructions and agent custom instructions'}"
"{'message': 'Updated custom instructions and agent custom instructions'}\n"
]
}
],
@@ -157,15 +194,22 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Day 1: Priya works the claim\n",
"## 3. Day 1: Sarah works the claim\n",
"\n",
"`add()` on the Platform is asynchronous, it returns a `PENDING` status and an `event_id`, and extraction finishes in the background. A production agent does not need to wait for it, but this notebook does, so the next cell reads its own writes. The small polling helper below is only useful for a demo like this one."
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:15.053514Z",
"iopub.status.busy": "2026-08-27T09:46:15.053386Z",
"iopub.status.idle": "2026-08-27T09:46:15.057906Z",
"shell.execute_reply": "2026-08-27T09:46:15.057402Z"
}
},
"outputs": [],
"source": [
"def wait_for_event(client, event_id, timeout=90, poll_every=2):\n",
@@ -196,34 +240,41 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Priya starts the day by pulling a number off the policy."
"Sarah starts the day by pulling a number off the policy."
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 6,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:15.059720Z",
"iopub.status.busy": "2026-08-27T09:46:15.059580Z",
"iopub.status.idle": "2026-08-27T09:46:23.223178Z",
"shell.execute_reply": "2026-08-27T09:46:23.222458Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"[\n",
" {\n",
" \"event_start\": null,\n",
" \"event_end\": null,\n",
" \"id\": \"c76bf47b-c5bf-4893-95d5-6ae8c5a4177b\",\n",
" \"data\": {\n",
" \"memory\": \"The building coverage limit on the Meridian Logistics policy for claim CLM-48211 is $2,400,000 with a $25,000 deductible\"\n",
" \"memory\": \"The building coverage limit for claim CLM-48211 under the Meridian Logistics policy is $2,400,000 with a $25,000 deductible\"\n",
" },\n",
" \"user_id\": \"adjuster_priya_cookbook_demo\",\n",
" \"attributed_to\": \"assistant\",\n",
" \"event_date\": null,\n",
" \"memory_type\": null,\n",
" \"id\": \"79a37e82-9188-4ff2-b504-d1a8d84abb3b\",\n",
" \"event\": \"ADD\",\n",
" \"plan_status\": null\n",
" \"user_id\": \"adjuster_sarah_cookbook_demo\",\n",
" \"event_end\": null,\n",
" \"event_date\": null,\n",
" \"event_start\": null,\n",
" \"memory_type\": null,\n",
" \"plan_status\": null,\n",
" \"attributed_to\": \"assistant\"\n",
" }\n",
"]"
"]\n"
]
}
],
@@ -234,7 +285,7 @@
" {\"role\": \"user\", \"content\": \"What's the building coverage limit on the Meridian Logistics policy for claim CLM-48211?\"},\n",
" {\"role\": \"assistant\", \"content\": \"Checking the policy now. The building coverage limit is $2,400,000 with a $25,000 deductible.\"},\n",
" ],\n",
" user_id=ADJUSTER_PRIYA,\n",
" user_id=ADJUSTER_SARAH,\n",
" agent_id=CLAIM_AGENT,\n",
")\n",
"print(json.dumps(event[\"results\"], indent=2))"
@@ -251,15 +302,23 @@
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 7,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:23.225503Z",
"iopub.status.busy": "2026-08-27T09:46:23.225354Z",
"iopub.status.idle": "2026-08-27T09:46:50.042538Z",
"shell.execute_reply": "2026-08-27T09:46:50.041648Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"status: SUCCEEDED | created: 1\n",
" - Reserve on claim CLM-48211 was raised to $1.8 million because the structural engineer's report indicated the warehouse requires a full rebuild rather than a repair"
"status: SUCCEEDED | created: 2\n",
" - Reserve for claim CLM-48211 was increased to $1.8 million to cover a full rebuild, as indicated by the structural engineer's report\n",
" - The structural engineer's report for claim CLM-48211 states that the warehouse requires a full rebuild rather than a repair\n"
]
}
],
@@ -270,7 +329,7 @@
" {\"role\": \"user\", \"content\": \"I'm raising the reserve on CLM-48211 to $1.8 million. The structural engineer's report says the warehouse needs a full rebuild, not a repair.\"},\n",
" {\"role\": \"assistant\", \"content\": \"Got it. Reserve raised to $1.8 million on CLM-48211 for a full rebuild, per the structural engineer's report. I'll keep that on file for the claim.\"},\n",
" ],\n",
" user_id=ADJUSTER_PRIYA,\n",
" user_id=ADJUSTER_SARAH,\n",
" agent_id=CLAIM_AGENT,\n",
")\n",
"summarize(event)"
@@ -280,20 +339,27 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Then a personal rule for how Priya wants things written."
"Then a personal rule for how Sarah wants things written."
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 8,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:50.044560Z",
"iopub.status.busy": "2026-08-27T09:46:50.044403Z",
"iopub.status.idle": "2026-08-27T09:46:58.104329Z",
"shell.execute_reply": "2026-08-27T09:46:58.103578Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"status: SUCCEEDED | created: 1\n",
" - User prefers drafts to contain no em dashes and coverage position letters to be limited to one page"
" - User prefers that any drafted documents contain no em dashes and that coverage position letters be limited to one page\n"
]
}
],
@@ -304,7 +370,7 @@
" {\"role\": \"user\", \"content\": \"Also, for anything you draft for me: no em dashes, and keep coverage position letters to one page.\"},\n",
" {\"role\": \"assistant\", \"content\": \"Understood. No em dashes, and coverage letters kept to one page, for everything I draft for you.\"},\n",
" ],\n",
" user_id=ADJUSTER_PRIYA,\n",
" user_id=ADJUSTER_SARAH,\n",
" agent_id=CLAIM_AGENT,\n",
")\n",
"summarize(event)"
@@ -319,14 +385,21 @@
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 9,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:46:58.106438Z",
"iopub.status.busy": "2026-08-27T09:46:58.106284Z",
"iopub.status.idle": "2026-08-27T09:47:04.002795Z",
"shell.execute_reply": "2026-08-27T09:47:04.002018Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"status: SUCCEEDED | created: 0"
"status: SUCCEEDED | created: 0\n"
]
}
],
@@ -337,7 +410,7 @@
" {\"role\": \"user\", \"content\": \"Thanks. Quick one, what's the weather like in Chicago right now?\"},\n",
" {\"role\": \"assistant\", \"content\": \"It's 72 degrees and clear in Chicago right now.\"},\n",
" ],\n",
" user_id=ADJUSTER_PRIYA,\n",
" user_id=ADJUSTER_SARAH,\n",
" agent_id=CLAIM_AGENT,\n",
")\n",
"summarize(event)"
@@ -354,17 +427,23 @@
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 10,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:04.005189Z",
"iopub.status.busy": "2026-08-27T09:47:04.005036Z",
"iopub.status.idle": "2026-08-27T09:47:28.624576Z",
"shell.execute_reply": "2026-08-27T09:47:28.623569Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"status: SUCCEEDED | created: 3\n",
" - User prefers claim summaries to be formatted as bullet points rather than paragraphs for all claims\n",
" - Assistant recorded that subrogation is being pursued against Voss Electrical for claim CLM-48211 based on the fire marshal's finding of faulty wiring as the ignition source\n",
" - Assistant noted that the cause of loss for claim CLM-48211 is faulty wiring identified by the fire marshal's report"
"status: SUCCEEDED | created: 2\n",
" - User prefers claim summaries to be written as bullet points instead of paragraphs\n",
" - Assistant noted that subrogation will be pursued against Voss Electrical, with the fire marshal's report identifying faulty wiring as the ignition source\n"
]
}
],
@@ -375,7 +454,7 @@
" {\"role\": \"user\", \"content\": \"I've decided to pursue subrogation against Voss Electrical, the contractor who rewired the warehouse six months ago. The fire marshal's report points to faulty wiring as the ignition source. Also, from now on keep my claim summaries to bullet points, not paragraphs.\"},\n",
" {\"role\": \"assistant\", \"content\": \"Noted both. Pursuing subrogation against Voss Electrical based on the fire marshal's faulty-wiring finding, and I'll keep your summaries in bullet points going forward.\"},\n",
" ],\n",
" user_id=ADJUSTER_PRIYA,\n",
" user_id=ADJUSTER_SARAH,\n",
" agent_id=CLAIM_AGENT,\n",
")\n",
"summarize(event)"
@@ -385,7 +464,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"One exchange produced three memories: a personal formatting preference, a subrogation decision, and a durable claim fact (the cause of loss) that neither of us mentioned as a separate sentence, Mem0 pulled it out of the subrogation reasoning on its own."
"One exchange produced two memories on two different shelves: a bullet-point formatting preference for Sarah, and a subrogation decision for the claim. Notice the cause of loss (faulty wiring) never got its own memory this run, Mem0 folded it into the subrogation memory's reasoning. Extraction makes judgment calls like that, so read what was actually stored instead of assuming."
]
},
{
@@ -399,16 +478,23 @@
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 11,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:28.626951Z",
"iopub.status.busy": "2026-08-27T09:47:28.626768Z",
"iopub.status.idle": "2026-08-27T09:47:29.109030Z",
"shell.execute_reply": "2026-08-27T09:47:29.108411Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"2 memories on Priya's shelf\n",
"- User prefers claim summaries to be formatted as bullet points rather than paragraphs for all claims\n",
"- User prefers drafts to contain no em dashes and coverage position letters to be limited to one page"
"2 memories on Sarah's shelf\n",
"- User prefers claim summaries to be written as bullet points instead of paragraphs\n",
"- User prefers that any drafted documents contain no em dashes and that coverage position letters be limited to one page\n"
]
}
],
@@ -421,25 +507,32 @@
" print(\"-\", r[\"memory\"])\n",
"\n",
"\n",
"priya_all = client.get_all(filters={\"user_id\": ADJUSTER_PRIYA})\n",
"print(f\"{priya_all['count']} memories on Priya's shelf\")\n",
"dump(priya_all[\"results\"])"
"sarah_all = client.get_all(filters={\"user_id\": ADJUSTER_SARAH})\n",
"print(f\"{sarah_all['count']} memories on Sarah's shelf\")\n",
"dump(sarah_all[\"results\"])"
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 12,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:29.110873Z",
"iopub.status.busy": "2026-08-27T09:47:29.110737Z",
"iopub.status.idle": "2026-08-27T09:47:29.597248Z",
"shell.execute_reply": "2026-08-27T09:47:29.596174Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"4 memories on the claim's shelf\n",
"- Assistant recorded that subrogation is being pursued against Voss Electrical for claim CLM-48211 based on the fire marshal's finding of faulty wiring as the ignition source\n",
"- Assistant noted that the cause of loss for claim CLM-48211 is faulty wiring identified by the fire marshal's report\n",
"- Reserve on claim CLM-48211 was raised to $1.8 million because the structural engineer's report indicated the warehouse requires a full rebuild rather than a repair\n",
"- The building coverage limit on the Meridian Logistics policy for claim CLM-48211 is $2,400,000 with a $25,000 deductible"
"- Assistant noted that subrogation will be pursued against Voss Electrical, with the fire marshal's report identifying faulty wiring as the ignition source\n",
"- The structural engineer's report for claim CLM-48211 states that the warehouse requires a full rebuild rather than a repair\n",
"- Reserve for claim CLM-48211 was increased to $1.8 million to cover a full rebuild, as indicated by the structural engineer's report\n",
"- The building coverage limit for claim CLM-48211 under the Meridian Logistics policy is $2,400,000 with a $25,000 deductible\n"
]
}
],
@@ -453,7 +546,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Priya's shelf holds two personal style rules and nothing about the claim. The claim's shelf holds four claim facts, the coverage limit, the reserve change, the subrogation call, and the cause of loss, and nothing about how Priya likes things written. The small talk from section 3 is on neither shelf, it was correctly dropped."
"Sarah's shelf holds two personal style rules and nothing about the claim. The claim's shelf holds four claim facts, the coverage limit, the reserve change, the engineer's rebuild finding, and the subrogation call with the cause of loss folded in, and nothing about how Sarah likes things written. The small talk from section 3 is on neither shelf, it was correctly dropped."
]
},
{
@@ -462,31 +555,38 @@
"source": [
"## 6. Day 2\n",
"\n",
"Priya comes back the next day and asks for a status update. A search scoped with `OR` across both identifiers pulls from both shelves at once, ranked by relevance to the query."
"Sarah comes back the next day and asks for a status update. A search scoped with `OR` across both identifiers pulls from both shelves at once, ranked by relevance to the query."
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 13,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:29.599237Z",
"iopub.status.busy": "2026-08-27T09:47:29.599098Z",
"iopub.status.idle": "2026-08-27T09:47:30.099318Z",
"shell.execute_reply": "2026-08-27T09:47:30.098227Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"- Assistant noted that the cause of loss for claim CLM-48211 is faulty wiring identified by the fire marshal's report\n",
"- Reserve on claim CLM-48211 was raised to $1.8 million because the structural engineer's report indicated the warehouse requires a full rebuild rather than a repair\n",
"- The building coverage limit on the Meridian Logistics policy for claim CLM-48211 is $2,400,000 with a $25,000 deductible\n",
"- Assistant recorded that subrogation is being pursued against Voss Electrical for claim CLM-48211 based on the fire marshal's finding of faulty wiring as the ignition source\n",
"- User prefers claim summaries to be formatted as bullet points rather than paragraphs for all claims\n",
"- User prefers drafts to contain no em dashes and coverage position letters to be limited to one page"
"- Reserve for claim CLM-48211 was increased to $1.8 million to cover a full rebuild, as indicated by the structural engineer's report\n",
"- The structural engineer's report for claim CLM-48211 states that the warehouse requires a full rebuild rather than a repair\n",
"- The building coverage limit for claim CLM-48211 under the Meridian Logistics policy is $2,400,000 with a $25,000 deductible\n",
"- User prefers that any drafted documents contain no em dashes and that coverage position letters be limited to one page\n",
"- User prefers claim summaries to be written as bullet points instead of paragraphs\n",
"- Assistant noted that subrogation will be pursued against Voss Electrical, with the fire marshal's report identifying faulty wiring as the ignition source\n"
]
}
],
"source": [
"status_results = client.search(\n",
" \"Draft a status update on claim CLM-48211.\",\n",
" filters={\"OR\": [{\"user_id\": ADJUSTER_PRIYA}, {\"agent_id\": CLAIM_AGENT}]},\n",
" filters={\"OR\": [{\"user_id\": ADJUSTER_SARAH}, {\"agent_id\": CLAIM_AGENT}]},\n",
")\n",
"dump(status_results[\"results\"])"
]
@@ -495,7 +595,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"One query, one search call, both shelves, correctly ranked. This is what makes the split useful day to day, an agent drafting on Priya's behalf does not need to know ahead of time which shelf a given fact lives on."
"One query, one search call, both shelves, correctly ranked. This is what makes the split useful day to day, an agent drafting on Sarah's behalf does not need to know ahead of time which shelf a given fact lives on."
]
},
{
@@ -504,20 +604,27 @@
"source": [
"## 7. A second adjuster opens the same claim\n",
"\n",
"Marcus has never worked with Priya and has never touched CLM-48211 before. His personal shelf should be empty."
"Marcus has never worked with Sarah and has never touched CLM-48211 before. His personal shelf should be empty."
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 14,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:30.101305Z",
"iopub.status.busy": "2026-08-27T09:47:30.101161Z",
"iopub.status.idle": "2026-08-27T09:47:30.528115Z",
"shell.execute_reply": "2026-08-27T09:47:30.527276Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"0 memories on Marcus's personal shelf\n",
"(none)"
"(none)\n"
]
}
],
@@ -531,22 +638,29 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"But the claim's shelf is not private to Priya, it belongs to the claim. When Marcus opens CLM-48211 cold, he sees exactly what she left behind."
"But the claim's shelf is not private to Sarah, it belongs to the claim. When Marcus opens CLM-48211 cold, he sees exactly what she left behind."
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 15,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:30.530364Z",
"iopub.status.busy": "2026-08-27T09:47:30.530205Z",
"iopub.status.idle": "2026-08-27T09:47:31.017665Z",
"shell.execute_reply": "2026-08-27T09:47:31.016750Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"- Assistant noted that the cause of loss for claim CLM-48211 is faulty wiring identified by the fire marshal's report\n",
"- Reserve on claim CLM-48211 was raised to $1.8 million because the structural engineer's report indicated the warehouse requires a full rebuild rather than a repair\n",
"- The building coverage limit on the Meridian Logistics policy for claim CLM-48211 is $2,400,000 with a $25,000 deductible\n",
"- Assistant recorded that subrogation is being pursued against Voss Electrical for claim CLM-48211 based on the fire marshal's finding of faulty wiring as the ignition source"
"- Reserve for claim CLM-48211 was increased to $1.8 million to cover a full rebuild, as indicated by the structural engineer's report\n",
"- The structural engineer's report for claim CLM-48211 states that the warehouse requires a full rebuild rather than a repair\n",
"- The building coverage limit for claim CLM-48211 under the Meridian Logistics policy is $2,400,000 with a $25,000 deductible\n",
"- Assistant noted that subrogation will be pursued against Voss Electrical, with the fire marshal's report identifying faulty wiring as the ignition source\n"
]
}
],
@@ -562,7 +676,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Four claim facts, zero of Priya's personal preferences. Marcus gets full context on the claim without inheriting a single one of her style rules, exactly the separation the two rule sets were set up to produce."
"Four claim facts, zero of Sarah's personal preferences. Marcus gets full context on the claim without inheriting a single one of her style rules, exactly the separation the two rule sets were set up to produce."
]
},
{
@@ -571,26 +685,33 @@
"source": [
"## 8. Review, edit, and forget\n",
"\n",
"Priya can inspect and prune her own shelf directly."
"Sarah can inspect and prune her own shelf directly."
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 16,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:31.019536Z",
"iopub.status.busy": "2026-08-27T09:47:31.019388Z",
"iopub.status.idle": "2026-08-27T09:47:31.495240Z",
"shell.execute_reply": "2026-08-27T09:47:31.494231Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"2e2b6f92-effb-4b23-a444-fda5d570781e - User prefers claim summaries to be formatted as bullet points rather than paragraphs for all claims\n",
"993076e6-5c6e-433c-9a11-8238548d4091 - User prefers drafts to contain no em dashes and coverage position letters to be limited to one page"
"fab356e1-1603-407e-9f99-24a56c08ff6c - User prefers claim summaries to be written as bullet points instead of paragraphs\n",
"895f5c47-64bf-44c7-a36f-b37697be5037 - User prefers that any drafted documents contain no em dashes and that coverage position letters be limited to one page\n"
]
}
],
"source": [
"priya_review = client.get_all(filters={\"user_id\": ADJUSTER_PRIYA})\n",
"for r in priya_review[\"results\"]:\n",
"sarah_review = client.get_all(filters={\"user_id\": ADJUSTER_SARAH})\n",
"for r in sarah_review[\"results\"]:\n",
" print(r[\"id\"], \"-\", r[\"memory\"])"
]
},
@@ -603,22 +724,30 @@
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 17,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:31.497312Z",
"iopub.status.busy": "2026-08-27T09:47:31.497155Z",
"iopub.status.idle": "2026-08-27T09:47:32.650786Z",
"shell.execute_reply": "2026-08-27T09:47:32.650172Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"- User prefers claim summaries to be formatted as bullet points rather than paragraphs for all claims"
"- User prefers claim summaries to be written as bullet points instead of paragraphs\n"
]
}
],
"source": [
"client.delete(\"993076e6-5c6e-433c-9a11-8238548d4091\")\n",
"stale = next(r for r in sarah_review[\"results\"] if \"one page\" in r[\"memory\"].lower() or \"letter\" in r[\"memory\"].lower())\n",
"client.delete(stale[\"id\"])\n",
"\n",
"priya_after = client.get_all(filters={\"user_id\": ADJUSTER_PRIYA})\n",
"dump(priya_after[\"results\"])"
"sarah_after = client.get_all(filters={\"user_id\": ADJUSTER_SARAH})\n",
"dump(sarah_after[\"results\"])"
]
},
{
@@ -632,20 +761,33 @@
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"execution_count": 18,
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-27T09:47:32.652435Z",
"iopub.status.busy": "2026-08-27T09:47:32.652317Z",
"iopub.status.idle": "2026-08-27T09:47:34.183374Z",
"shell.execute_reply": "2026-08-27T09:47:34.182528Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"demo memories deleted\n",
"project instructions restored"
"demo memories deleted\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"project instructions restored\n"
]
}
],
"source": [
"client.delete_all(user_id=ADJUSTER_PRIYA)\n",
"client.delete_all(user_id=ADJUSTER_SARAH)\n",
"client.delete_all(user_id=ADJUSTER_MARCUS)\n",
"client.delete_all(agent_id=CLAIM_AGENT)\n",
"print(\"demo memories deleted\")\n",
@@ -683,7 +825,16 @@
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.6"
}
},
"nbformat": 4,