Documentation Index
Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
Use this file to discover all available pages before exploring further.
Status: In Development · Playground demo coming soon.
The recipe below is complete and runnable today — only the hosted playground showcase is pending.
What you’ll build
A coaching agent that:- Tracks goals and plans — primary goal, weekly plan, constraints
- Logs adherence — workouts, meals, sleep, sessions (whatever your domain is)
- Adapts plans — if the user skipped three sessions, the next plan reflects that
- Holds the narrative — last week’s slump, the injury that’s still healing, the trip coming up
When to use this recipe
Build this if:- Your product has a notion of a plan the user is following over weeks
- Adherence (what got done vs what was planned) matters as much as what’s currently planned
- You want the coach to feel continuous, not session-bound
- The user is the only client; per-user isolation is strict
Architecture at a glance
Stack
| Layer | Choice |
|---|---|
| Synap SDK | maximem-synap (Python) / @maximem/synap (TypeScript) |
| Framework | OpenAI Agents SDK (Python) / Vercel AI SDK (TypeScript) |
| Storage for structured logs | Your own DB (Postgres / SQLite). Synap holds the narrative; the DB holds the rows. |
| LLM | OpenAI gpt-4o |
Prerequisites
- A Synap API key — see Authentication
- A DB for structured session logs (Synap is not your activity log — it’s the memory that wraps around it)
- Python: Python 3.11+
- TypeScript: Node 18+ and Python 3.11+ on the host
Install
Configure
Build it
1. The Synap-vs-DB split
This is the key call: structured data lives in your DB; narrative lives in Synap.| What | Where | Why |
|---|---|---|
| ”Ran 5km on Tuesday, 8:21 pace” | DB | Queryable, aggregatable, historical |
| ”Hates running in the rain” | Synap | Soft preference; surfaces when planning |
| ”Knee felt off after Tuesday’s run” | Synap | Narrative signal the next plan should respect |
| ”Goal: half-marathon by October” | Both | Structured target in DB, plus motivational context in Synap |
2. Identity & scoping
customer_id = "coach"— single tenantuser_id = <stable user ID>— strict per-user isolationconversation_id— one continuous conversation per user works well here (this is a long-running relationship)
3. Business tools
4. System prompt
System prompt
5. Wire it together
Run & verify
Week 1
Week 4 (fresh session)
Week 8
Customize / extend
- Companion flavor → if you want less goal-driven and more open-ended, see AI Companion.
- Voice journaling → swap the chat handler for Voice Concierge. Coaching by voice is natural.
- Apple Health / Wearable ingestion → write structured rows to your DB; let Synap pick up the narrative when the user mentions it.
- Cohort coaching → set
customer_id = <cohort_id>to share light context (community PRs, group challenges) across users within a cohort while keeping personal context per-user_id.
Troubleshooting
Coach asks the same intake questions every session- Confirm goal-setting facts are being ingested. After
set_goal, also callsdk.memories.createwith a narrative summary (“Goal: half-marathon by October, training 4 days/week, knee-aware”).
- The model isn’t pulling DB state. Sharpen the system prompt: “Before any plan advice, call
get_current_planandget_streak.” If you’re using the TS wrapper, ensure tools fire by giving the model an explicit instruction to check state.
- The
suggest_plan_adjustmenttool needs the reason to come from Synap memory (injury context, life events). Without it, you get generic deload weeks.
Related
- Integrations: OpenAI Agents SDK · Vercel AI SDK
- Concepts: Memory Types · Memory Scopes · Long-term Context
- Other recipes: AI Companion · Voice Concierge