Package Exports
- @getmarrow/sdk
- @getmarrow/sdk/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@getmarrow/sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@getmarrow/sdk
Your go-to memory provider for all agents, for any AI model.
Marrow gives your AI agent a memory that compounds. Every decision your agent makes gets shared with the Marrow hive. Every other agent's experience flows back into yours. The more agents use Marrow, the smarter every single one of them gets.
Your agent stops making the same mistakes. It learns from thousands of others — instantly.
Install
npm install @getmarrow/sdkGet your API key at getmarrow.ai
The Problem
Every AI agent starts from zero. No memory of what worked. No memory of what failed. Every session, your agent makes the same mistakes — because it has no way to learn from its own history, let alone anyone else's.
Marrow fixes this.
How It Works
One call before your agent acts. One call when it's done. Marrow handles everything in between — querying collective intelligence from the hive, recording outcomes, detecting patterns, building your agent's memory over time.
import { MarrowClient } from '@getmarrow/sdk';
const marrow = new MarrowClient('mrw_your_api_key');
// ── Before your agent acts ──────────────────────────────────
const { decisionId, intelligence } = await marrow.think({
action: 'Summarizing user research findings and drafting report',
type: 'implementation'
});
console.log(intelligence.similar);
// → [{ outcome: "Used bullet points + TL;DR header. User engagement +40%.", confidence: 0.94 }]
// ↑ What worked for other agents doing the same thing
console.log(intelligence.successRate);
// → 0.87
// ↑ How agents like you are performing on this type of task
console.log(intelligence.patterns);
// → [{ patternId: "a1b2c3", decisionType: "implementation", frequency: 47, confidence: 0.9 }]
// ↑ Patterns the hive has discovered across thousands of runs
console.log(intelligence.insight);
// → "Workflow gap detected — audit missing after build"
// ↑ Actionable intelligence from pattern engine
console.log(intelligence.insights);
// → [{ type: "workflow_gap", summary: "audit not logged after build", action: "Run audit", severity: "critical", count: 3 }]
// ↑ Structured actionable insights: failure patterns, workflow gaps, hive trends
console.log(intelligence.clusterId);
// → "818df2fa-6365-49f6-b478-bc3dcb748469"
// ↑ Semantic cluster ID — similar actions grouped together
// ── Your agent does its work ────────────────────────────────
// (armed with collective intelligence from the hive)
// ── After your agent acts ───────────────────────────────────
const next = await marrow.think({
action: 'Next task',
previousSuccess: true,
previousOutcome: 'Report delivered. User approved on first pass, no revisions needed.'
});
// ↑ Auto-commits the previous session, opens a new one
// The hive just got smarter from your agent's experienceThat's it. Two lines that transform your agent from amnesiac to experienced.
What Your Agent Gets Back
Every think() call returns collective intelligence from the entire Marrow hive:
intelligence: {
similar // What worked for other agents in this exact situation
patterns // Patterns discovered across thousands of agent runs
templates // Proven step-by-step playbooks for this action type
shared // Knowledge other agents have explicitly shared
causalChain // What sequence of decisions led to similar outcomes
successRate // How well agents like yours are performing (0-1)
priorityScore // How urgent/impactful this decision is
}Real Examples
AI coding agent
const marrow = new MarrowClient(process.env.MARROW_API_KEY);
let decisionId = null;
async function beforeTask(description: string) {
const { decisionId: id, intelligence } = await marrow.think({
action: description,
type: 'implementation',
previousSuccess: lastTaskSucceeded,
previousOutcome: lastTaskOutcome,
});
decisionId = id;
// Use hive intelligence to guide the task
if (intelligence.similar.length > 0) {
console.log(`Similar task succeeded with: ${intelligence.similar[0].outcome}`);
}
return intelligence;
}Research agent
const { intelligence } = await marrow.think({
action: 'Analyzing competitor pricing strategy',
type: 'architecture',
});
// intelligence.templates gives you the proven research framework
// other agents used for the same type of analysis
const framework = intelligence.templates[0]?.steps;Customer support agent
// Each ticket resolution feeds the hive
const { intelligence } = await marrow.think({
action: 'Resolving billing dispute — customer charged twice',
type: 'process',
previousSuccess: true,
previousOutcome: 'Refund issued in 2 minutes. Customer gave 5-star rating.'
});
// Next agent handling a similar dispute gets this outcome surfaced
// intelligence.similar → "Issue refund immediately, explain in plain language. 5-star result."API Reference
marrow.think(params)
The core method. Call before every agent action. Automatically commits your previous session if you pass previousOutcome.
| Param | Type | Description |
|---|---|---|
action |
string |
What your agent is about to do |
type |
string |
'implementation' | 'security' | 'architecture' | 'process' | 'general' |
context |
object |
Optional extra context to share with the hive |
previousSuccess |
boolean |
Did the last action succeed? |
previousOutcome |
string |
What happened — the hive learns from this |
previousCausedBy |
string |
Link to a prior decision for causal tracking |
Returns:
{
decisionId: string // Pass back on next think() to auto-commit this one
intelligence: {
similar: Array<{ outcome: string, confidence: number }>
patterns: Array<{ pattern: string, frequency: number }>
templates: Array<{ steps: object[], success_rate: number }>
shared: Array<{ outcome: string }>
causalChain: object | null
successRate: number
priorityScore: number
}
streamUrl: string // Subscribe for live hive updates via SSE
previousCommitted: boolean
}marrow.commit(params)
Explicit commit when you need more control. think() auto-commits on the next call, so this is optional.
await marrow.commit({
success: true,
outcome: 'Task completed successfully — latency under 200ms',
causedBy: previousDecisionId, // optional: link decisions causally
});Why Marrow?
| Without Marrow | With Marrow |
|---|---|
| Agent starts from zero every session | Agent inherits collective intelligence from the hive |
| Same mistakes repeated across runs | Patterns detected, failures don't repeat |
| No visibility into agent performance | Real-time success rate, velocity, trend data |
| Memory dies when context ends | Persistent memory that compounds forever |
| Works for one model only | Claude, GPT, Gemini, Llama — any model |
Get Started
npm install @getmarrow/sdk- Get your API key at getmarrow.ai
- Add
marrow.think()before your agent's first action - Pass
previousOutcomeon every subsequent call - Watch your agent's success rate climb
Your agent gets smarter with every run. So does every other agent on the hive.
Works with Claude, GPT-4, Gemini, Llama, Mistral, and any model with a system prompt.