Six months after a nightmare skincare campaign, the same brand came back with another offer.
Same lowball number.
Same vague deliverables.
Same missing payment terms.
I had forgotten the details.
The brand was counting on that.
My AI assistant had forgotten everything too.
It generated another polite, professional counteroffer — completely ignoring:
- the delayed payment
- the unpaid revisions
- and the fact that the brand had eventually settled much higher after negotiation
The AI sounded intelligent.
But it was negotiating blind.
That moment became the starting point for DealMind.
Not another AI chatbot.
An AI negotiation system with persistent memory.
Because negotiation isn’t just language.
It’s accumulated leverage.
The Problem With Most AI Agents
Most AI systems today are stateless.
They generate impressive replies, summarize conversations, and sound intelligent for a single interaction.
Then they forget everything.
That creates a huge problem in negotiation systems because negotiation is not transactional.
It’s historical.
Every previous interaction changes leverage.
Human talent managers understand this intuitively.
They remember:
- which brands always lowball
- which companies delay invoices
- which partnerships generate strong conversions
- which campaigns spiral into revision chaos
- when to push harder
- when to walk away
That accumulated context becomes strategic advantage.
Most AI systems throw it away after every session.
The standard AI negotiation workflow looks something like this:
- Brand sends a DM
- You paste it into ChatGPT
- AI generates a confident-sounding counter
- Repeat from scratch next time
The reply might sound polished.
But strategically, it’s empty.
The model has no idea what happened the last three times you negotiated with this category of brand.
That realization completely changed how I approached DealMind.
I stopped thinking about prompts.
And started thinking about accumulated intelligence.
Architecture
Instagram DM
↓
Hindsight Recall
↓
cascadeflow Routing
↓
Groq Model
↓
Negotiation Response
↓
Memory Stored Back
Building Persistent Negotiation Memory
The first major system I built was the memory layer.
I wanted the agent to behave less like a chatbot and more like an experienced manager that remembers relationship history.
To do that, every negotiation stores structured deal intelligence using Hindsight.
The goal was simple:
- after every negotiation → store what happened
- before every negotiation → retrieve what matters
The recall layer inside lib/hindsight.ts performs semantic retrieval against historical negotiations:
export async function recall(
query: string,
topK = 4
): Promise<RecalledMemory[]> {
const res = await fetch(
`${BASE}/pipelines/${pipelineId()}/retrieve`,
{
method: 'POST',
headers: headers(),
body: JSON.stringify({ query, topK }),
}
)
const data = await res.json()
return (data.documents ?? []) as RecalledMemory[]
}
The important detail here is that the query is semantic, not exact.
A negotiation involving:
“GlowLab skincare sponsorship”
should still retrieve memories from:
“NovaSkin product campaign”
if the negotiation patterns are similar.
That’s where memory starts becoming intelligence instead of storage.
Storing Leverage Instead of Conversations
Raw chat history isn’t very useful.
What matters is structured behavioral memory.
So instead of storing full conversations, DealMind stores negotiation outcomes.
The memory builder looks like this:
export function buildDealMemory(d: DealMemoryPayload): string {
const outcome = d.walked
? 'walked away when countered'
: d.settled
? `settled at $${d.settled}`
: 'outcome unknown'
const payNote =
d.paymentStatus === 'late'
? 'Paid late (2+ weeks).'
: d.paymentStatus === 'on-time'
? 'Paid on time.'
: ''
const revNote = d.revisionOverrun
? 'Brand overran agreed revisions.'
: ''
return [
`Brand: ${d.brand}.`,
`Category: ${d.category}.`,
`Offered: $${d.offered}.`,
`Outcome: ${outcome}.`,
payNote,
revNote,
d.notes,
]
.filter(Boolean)
.join(' ')
}
A stored memory might look like this:
“Brand: NovaSkin Co. Category: Skincare. Offered: $300. Outcome: settled at $650. Paid late (2+ weeks). Brand overran agreed revisions.”
That single memory changes future negotiations dramatically.
The next time the same brand appears:
- pricing floors increase
- NET-30 terms appear automatically
- revision caps get added proactively
- risk scores go up immediately
The AI no longer negotiates from zero.
It negotiates from history.
How Memory Changes the Negotiation Pipeline
Every negotiation request flows through four stages before the AI generates a single sentence.
Step 1 — Recall
Before generating anything, DealMind retrieves relevant memories:
const memoryQuery =
`${brand} ${category} brand deal negotiation rate`
const memories = await recall(memoryQuery, 4)
const memoryContext =
memories.length > 0
? memories
.map((m, i) => `[Memory ${i + 1}]: ${m.content}`)
.join('\n')
: 'No past deals found.'
Step 2 — Analyze
The system evaluates:
- negotiation complexity
- risk level
- category patterns
- leverage indicators
Step 3 — Route
Tasks get routed dynamically through cascadeflow.
Simple tasks:
- classification
- pricing estimation
- categorization
go through lightweight Groq models.
Complex tasks:
- persuasive negotiation
- legal ambiguity
- multi-clause contracts
escalate to stronger reasoning layers.
Step 4 — Store
After the negotiation closes, the outcome gets written back into memory.
The loop closes.
And the system becomes slightly smarter.
Every single deal.
Runtime Intelligence with cascadeflow
Once memory was working well, another problem appeared.
Every negotiation message was hitting the same expensive model.
Even messages like:
“Sounds good, let’s proceed.”
That’s like hiring a senior lawyer to sort your mail.
The solution was runtime routing through cascadeflow.
Instead of treating AI like a single black box, DealMind behaves like an adaptive negotiation pipeline.
The classification layer determines whether a message actually requires deeper reasoning.
lib/cascadeflow.ts handles the routing logic:
export async function classifyComplexity(
message: string
): Promise<ClassifyResult> {
const res = await fetch(
'https://api.groq.com/openai/v1/chat/completions',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${process.env.GROQ_API_KEY}`,
},
body: JSON.stringify({
model: MODELS.classify.id,
max_tokens: 120,
temperature: 0,
messages: [
{
role: 'system',
content:
'Classify negotiation complexity.',
},
{
role: 'user',
content: message,
},
],
}),
}
)
const data = await res.json()
return JSON.parse(
data.choices?.[0]?.message?.content
)
}
The routing system reduced inference cost dramatically while keeping negotiation quality high.
More importantly, it made the system operationally intelligent.
Users could actually see:
- memories being recalled
- models being selected
- leverage being calculated
- risk patterns emerging
The AI stopped feeling reactive.
It started feeling strategic.
The Most Interesting Behavior Emerged After 10 Deals
This was the surprising part.
After enough negotiations, category-level patterns started emerging automatically.
The system learned that:
- skincare brands consistently opened below settlement range
- tech brands paid faster
- affiliate-heavy campaigns underperformed
- brands that abused revisions once often repeated the behavior
Nobody explicitly programmed those insights.
The memory layer surfaced them naturally through accumulated retrieval context.
That’s when DealMind stopped feeling like:
an assistant
and started feeling like:
infrastructure
The system wasn’t just helping generate replies anymore.
It was accumulating operational intelligence over time.
That’s a completely different category of AI product.
What Building DealMind Changed About My View of AI
Most AI demos are impressive for one interaction.
But real products are different.
The systems people actually depend on are the ones that:
- remember context
- evolve behavior
- maintain consistency
- accumulate leverage over time
That’s especially true in negotiation.
Because negotiation is cumulative.
Every interaction changes strategy.
Every outcome changes leverage.
An AI system that forgets history can never negotiate strategically.
Persistent memory changes that.
And once an AI system starts remembering relationships instead of conversations, it stops behaving like a chatbot.
It starts behaving like infrastructure.
The future of AI systems isn’t better prompts.
It’s accumulated intelligence.



Top comments (0)