The Goldilocks Brain is the recommendation engine behind Cosmo’s strategic advice. It answers: “Given everything I know about this user’s pipeline, winning patterns, and market position — what should they focus on today?”
The 80/20 Explore/Exploit Framework
The core principle: 80% of recommendations should be safe bets (companies that match your proven winning profile), and 20% should be wildcards (companies outside your comfort zone that might reveal new opportunities).
// src/domain/scoring/services/recommendation/recommendationService.ts
const exploitCount = Math.floor(limit * 0.8); // 80% proven matches
const exploreCount = limit - exploitCount; // 20% wildcardsThis isn’t arbitrary. In machine learning, the explore/exploit tradeoff is a well-studied problem. Pure exploitation (only recommending what worked before) leads to blind spots. Pure exploration (random suggestions) wastes the rep’s time. The 80/20 split balances learning against productivity.
Exploit Picks: Your Best Bets
Exploit picks are companies with the highest ML composite scores that don’t have open deals yet:
SELECT c.id, c.company_name, s.composite_score, s.fit_score, s.intent_score
FROM companies c
JOIN scores s ON s.company_id = c.id AND s.user_id = c.user_id
LEFT JOIN deals d ON d.company_id = c.id AND d.user_id = c.user_id AND d.is_closed = false
WHERE c.user_id = $1
AND s.composite_score IS NOT NULL
AND d.id IS NULL -- No open deals
ORDER BY s.composite_score DESC
LIMIT $2These are companies that look like your past winners (high fit) and are showing buying signals (high intent) — but nobody’s working them yet. Classic low-hanging fruit.
Explore Picks: The Wildcards
Explore picks come from explorationService.getExploratoryCompanies(). These are companies that fall outside the current ICP bell curve but show interesting signals.
The exploration system uses seven strategies across four dimensions:
Exploit Strategies (2)
top_scored — Highest composite score, proven profile match
high_intent — High intent score regardless of fit (hot leads)Explore Strategies (4 dimensions)
industry_adjacent — Companies in related but different industries
size_outlier — Companies larger or smaller than your typical customer
geo_expansion — Companies in new geographic markets
signal_divergent — Companies with unusual intent signal patternsEach strategy draws from exploratory_segments — tracked segments that the system has proposed for exploration:
// src/domain/scoring/services/discovery/
const segments = await pool.query(
`SELECT * FROM exploratory_segments
WHERE user_id = $1 AND status = 'exploring'
ORDER BY confidence_score DESC`,
[userId]
);Segment Lifecycle
Exploratory segments have a lifecycle:
exploring → absorbed (became part of the ICP) or abandoned (didn't work out)When a rep acts on explore picks and closes deals, the segment’s metrics update:
// After a deal closes in an exploratory segment
UPDATE exploratory_segments SET
deals_won = deals_won + 1,
total_deal_value = total_deal_value + $2,
confidence_score = (deals_won::float / GREATEST(deals_won + deals_lost, 1)) * 100
WHERE id = $1If a segment accumulates enough wins, it can trigger a bell curve shift — the ICP automatically expands to include what was once a wildcard:
INSERT INTO bell_curve_shifts (user_id, shift_type, dimension, previous_range, new_range, ...)
VALUES ($1, 'expand', 'industry', '{"min": "5112", "max": "5112"}',
'{"min": "5112", "max": "5415"}', ...)This is the learning loop: explore → win → absorb → the ICP grows smarter.
Interleaving Recommendations
Exploit and explore picks are interleaved so the rep doesn’t see a block of safe bets followed by a block of wildcards:
// Spread explore picks evenly throughout the exploit list
const interleaved = [];
const step = Math.ceil(exploitPicks.length / explorePicks.length);
let exploreIdx = 0;
for (let i = 0; i < exploitPicks.length; i++) {
interleaved.push(exploitPicks[i]);
if ((i + 1) % step === 0 && exploreIdx < explorePicks.length) {
interleaved.push(explorePicks[exploreIdx++]);
}
}With 8 exploit picks and 2 explore picks, the result looks like: exploit, exploit, exploit, exploit, explore, exploit, exploit, exploit, exploit, explore. The wildcards are sprinkled in naturally.
The Goldilocks Zone
The highest-value companies live in the Goldilocks zone: high fit AND high intent AND high composite:
// Goldilocks criteria
const isGoldilocks = (
fitScore >= 70 &&
intentScore >= 70 &&
compositeScore >= 75
);These are companies that match your winning profile (they look like companies you’ve closed before) AND are actively showing buying signals (they’re researching solutions, engaging with content, or making technology changes). The intersection of “good match” and “ready to buy” is where the highest conversion probability lives.
The get_goldilocks_profile tool in Cosmo surfaces these directly:
// tools/discovery.ts
async function getGoldilocksProfile(userId: string, icpProfileId?: string) {
const recommendations = await goldilocksService.getRecommendations(userId);
return {
goldilocksAccounts: recommendations.filter(r => r.isGoldilocks),
totalRecommendations: recommendations.length,
explorationInsights: recommendations.filter(r => r.pickType === 'explore'),
};
}How Cosmo Uses the Brain
When you ask Cosmo “what should I focus on today?”, it calls get_daily_picks and get_top_recommendations:
// The 8B classifier maps natural language to tools:
// "what should I focus on?" → [get_daily_picks, get_pipeline_health]
// "who should I reach out to?" → [get_top_recommendations, find_contacts]
// "show me my Goldilocks accounts" → [get_goldilocks_profile]The tool results feed into the 70B model, which synthesizes a strategic briefing:
"Here are your top priorities for today:
1. **Acme Corp** (Goldilocks) — Composite: 92. They visited your pricing page twice
this week and their VP of Engineering just connected on LinkedIn.
→ Draft an intro email to Alex Rivera (VP Eng)
2. **TechFlow Inc** — Intent: 85. They're evaluating competitors in your space
based on recent job postings for your technology stack.
→ Schedule a demo before they commit elsewhere
3. **NovaCo** (Explore) — Outside your usual profile but showing strong intent.
They're in healthcare (you typically sell to SaaS), but the deal signals
match your winning pattern.
→ Worth a discovery call to test the healthcare vertical"The third recommendation is the explore pick — clearly labeled as a wildcard so the rep understands why it’s there.
The Minimum Data Threshold
The recommendation engine requires at least 5 closed deals before generating meaningful recommendations:
if (closedDeals < 5) {
return {
recommendations: [],
message: 'Need at least 5 closed deals to generate recommendations',
closedDeals,
requiredDeals: 5,
};
}With fewer than 5 deals, the winning profile isn’t statistically reliable. Recommending based on 2 wins could lead the rep down a narrow path based on coincidence rather than pattern. The threshold is intentionally low (5, not 50) because B2B sales cycles are long — a startup might only close 5 deals in their first quarter.
Key Takeaways
-
80/20 explore/exploit balances proven patterns against learning opportunities.
-
Seven strategies across four dimensions ensure recommendations aren’t one-dimensional.
-
Exploratory segments track wildcard performance over time. Winning segments get absorbed into the ICP through bell curve shifts.
-
Goldilocks zone (Fit ≥70, Intent ≥70, Composite ≥75) identifies the highest-probability opportunities.
-
Interleaving mixes explore picks into exploit picks naturally, so reps encounter wildcards without feeling like they’re being sent on random errands.
Next chapter: action tools — how Cosmo sends emails, creates tasks, and executes real-world operations.