# AI use cases for Soda Mem (SodaMem/SodaMem)

Repo: [SodaMem/SodaMem](https://github.com/SodaMem/SodaMem) | Use cases: 4 | Page: https://dedupedai.com/use-cases/sodamem-sodamem/

SodaMem is a Python memory layer for AI agents that stores facts with links back to their source turns and recalls them without LLM calls.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Give Claude Code memory that persists across sessions: https://dedupedai.com/use-cases/sodamem-sodamem/persistent-memory-for-coding-agent/
- Build a chatbot that updates facts when users change them: https://dedupedai.com/use-cases/sodamem-sodamem/memory-that-updates-when-facts-change/
- Trace each recalled memory back to the turn it came from: https://dedupedai.com/use-cases/sodamem-sodamem/trace-agent-memory-to-source-turn/
- Call Soda Mem memory from a TypeScript app over HTTP: https://dedupedai.com/use-cases/sodamem-sodamem/memory-api-for-typescript-app/

## How to give Claude Code memory that persists across sessions with Soda Mem

Repo: [SodaMem/SodaMem](https://github.com/SodaMem/SodaMem) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Install Soda Mem as a daemon and wire Claude Code to recall and retain context through MCP and hooks.

**Who it is for:** A developer using Claude Code on a long-running project who keeps re-explaining conventions and past decisions each session.

**The problem:** Coding sessions start blank, so the assistant forgets preferences, decisions and project facts from earlier work.

**The outcome:** Claude Code recalls stored project context at the start of new sessions, with memory handled by the Soda Mem daemon.

### Steps

1. Run `pip install "sodamem[chroma,llm]"` to install Soda Mem.
2. Run `sodamem daemon ensure` once to start the process that owns the stores.
3. Run `sodamem install claude-code` to wire the client to the daemon.
4. Start a Claude Code session and confirm a stored fact from an earlier session is recalled.

### Prompt to paste into your agent

```text
Using the SodaMem repo at <repo path>, install SodaMem, start the daemon, and wire Claude Code to it. Expected output: the install command finishes without errors. Verify by starting a new Claude Code session and checking that a fact from a previous session is recalled.
```

### Caveat

The README says a coding session mostly does not call memory tools on its own, so the hooks are what make recall and retention automatic, and the README does not describe how the hooks behave per client beyond that.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/sodamem-sodamem/persistent-memory-for-coding-agent/

## How to build a chatbot that updates facts when users change them with Soda Mem

Repo: [SodaMem/SodaMem](https://github.com/SodaMem/SodaMem) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Ingest a user message and recall the latest version of a fact, with the older version kept readable.

**Who it is for:** A Python developer building a personal assistant whose users change jobs, homes or preferences over time.

**The problem:** Most memory stores overwrite old values, so the assistant gives outdated answers after a user changes their mind.

**The outcome:** The assistant returns a prompt-ready memory block showing the current fact, with citations to the turn it came from.

### Steps

1. Run `pip install "sodamem[chroma,llm]"` to install Soda Mem.
2. Set SODAMEM_LLM_API_KEY in your environment for the extractor.
3. Create a script that calls Soda Mem.open("./data", extractor=FactEventExtractorV2(create_provider_from_env())) and calls mem.ingest with a message that changes a fact.
4. Call mem.build_context with a question about that fact and print block.text and block.citations.

### Prompt to paste into your agent

```text
In the SodaMem repo at <repo path>, write a Python script that ingests a message for user u1 saying the user moved to a new city, then calls build_context for where the user lives. Expected output: the new city in block.text with citations. Verify that the old city does not appear as the current answer.
```

### Caveat

Ingest needs an LLM provider through the extractor, so the first run depends on a valid API key, while the recall step makes zero LLM calls.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/sodamem-sodamem/memory-that-updates-when-facts-change/

## How to trace each recalled memory back to the turn it came from with Soda Mem

Repo: [SodaMem/SodaMem](https://github.com/SodaMem/SodaMem) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Check where a stored fact came from before trusting an agent's answer about a user.

**Who it is for:** A developer or reviewer who must explain why an agent believes something about a user.

**The problem:** A similarity score alone does not show which conversation produced a remembered claim.

**The outcome:** Each line of recalled context links to a source span and the exact raw turn, so the claim can be checked.

### Steps

1. Run `pip install "sodamem[chroma,llm]"` to install Soda Mem.
2. Call mem.build_context for the user and question you want to audit, with a token_budget.
3. Read block.citations to get each evidence item and its source.
4. Use the MCP tool entity_timeline to see one entity's history in order, with each item still pointing at its source.

### Prompt to paste into your agent

```text
Using the SodaMem repo at <repo path>, run build_context for user <user_id> with the question <question>. Expected output: a list of citations, each tied to a session and turn. Verify that every line in the context has a citation.
```

### Caveat

Citations trace to stored turns only, so the audit is only as complete as what was ingested.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/sodamem-sodamem/trace-agent-memory-to-source-turn/

## How to call Soda Mem memory from a TypeScript app over HTTP with Soda Mem

Repo: [SodaMem/SodaMem](https://github.com/SodaMem/SodaMem) | Difficulty: Advanced | Time: 45 minutes | Basis: From the README

Use the sodamem npm client to fetch a zero-LLM context block from a running Soda Mem service.

**Who it is for:** A TypeScript or Node developer whose app needs per-user memory but who does not want to run Python in the app.

**The problem:** Without a memory API, each app must build its own store and retrieval logic for user context.

**The outcome:** The app gets a prompt-ready context block for a user and query from the Soda Mem HTTP service.

### Steps

1. Start the Soda Mem HTTP service as described in the Self-hosting section of the README (inferred: the service needs the server extra).
2. Run `npm i sodamem` in the app.
3. Create a SodaMemClient with baseUrl set to your service and apiKey read from SODAMEM_API_KEY.
4. Call mem.context with user_id, query and token_budget and use the returned block in your prompt.

### Prompt to paste into your agent

```text
In the app at <project path>, install the sodamem npm package and call the SodaMem context endpoint for user <user_id>. Expected output: a context block returned with a text field. Verify the request succeeds with the API key sent as a Bearer token.
```

### Caveat

The self-hosting steps are not in the excerpt provided, so the service start command must be taken from the full README before the client can connect.

Risk, credentials: The API key sent in the Authorization header must stay in environment variables and out of source control.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/sodamem-sodamem/memory-api-for-typescript-app/
