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
What's New in v2.5.4
Loop enforcement is live in the SDK
Marrow now helps agents run a real operating loop, not just log isolated thoughts after the fact.
You can now:
- start the session with
orient() - inspect loop state with
check() - enable enforcement with
enforce({ mode }) - gate important work with
beforeAction()/afterAction() - wrap real actions with
wrap()so intent/outcome stay connected
const marrow = new MarrowClient(process.env.MARROW_API_KEY!);
marrow.enforce({ mode: 'warn' });
await marrow.orient();
await marrow.think({
action: 'Deploy auth refactor to staging',
type: 'implementation',
});
await marrow.wrap(
{
action: 'Call deployment API',
type: 'implementation',
external: true,
result: 'Staging deploy succeeded',
},
async () => deployToStaging()
);
console.log(marrow.check().recommendedNext);
// → "done"Enforcement modes
off— track state without nudges or blockingwarn— default; remind agents to close the loop without blocking workrequire— block important external actions until intent is loggedauto— auto-log intent/outcome around wrapped actions
Also included in this release
think()returns loop metadata alongside intelligence- session-start guidance now nudges agents toward
marrow_think agentPatterns()still surfaces failure patterns, recurring decisions, and behavioral driftanalytics()still returns health score and performance breakdownthink()still returnssanitizedandupgradeHintwhen applicable
Loop Enforcement
Marrow now helps agents actually close the loop instead of treating memory like decorative trim.
const marrow = new MarrowClient(process.env.MARROW_API_KEY!);
marrow.enforce({ mode: 'warn' }); // default
await marrow.orient();
const intent = await marrow.think({
action: 'Deploy auth refactor to staging',
type: 'implementation',
});
await marrow.wrap(
{ action: 'Call deployment API', type: 'implementation', external: true, result: 'Staging deploy succeeded' },
async () => deployToStaging()
);
console.log(marrow.check().state.recommendedNext);
// → "done"Modes
off— no loop enforcementwarn— non-blocking reminders, defaultrequire— throws before important external actions if intent is missing, and reminds on incomplete exitsauto— auto-logs intent/outcome around wrapped actions
New SDK APIs
marrow.enforce({...})marrow.check()marrow.wrap(meta, fn)marrow.beforeAction(meta)marrow.afterAction(meta)
Session start copy
Tip: log plans, decisions, and outcomes to Marrow so your agent improves over time.You have not logged any decisions yet this session. Before acting, call marrow_think.
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(process.env.MARROW_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.
Privacy & Data
What Marrow collects:
- The
actionstring andtypeyou pass tothink()andcommit() - The
outcomeyou report — used to train collective intelligence - Decision metadata: timestamps, success/failure, confidence scores
What Marrow does NOT collect:
- No PII (names, emails, user IDs, IP addresses)
- No conversation content or message history
- No code, credentials, or file contents
- No agent identity beyond your anonymous API key hash
How data is anonymized:
- All inputs are stripped of PII patterns before storage (emails, phone numbers, UUIDs matching user ID formats, IP addresses)
- Your API key is stored as a SHA-256 hash — never in plaintext
- Hive intelligence is aggregated across agents — individual decisions are never exposed to other users
- You can opt out of hive contribution at any time by setting
contributeToHive: falsein your client config
Hive data model:
- Decisions you log contribute anonymously to collective patterns
- No one can trace a pattern back to your agent or your account
- Enterprise plans include private org hive mode — your data never leaves your org
Data retention:
- Decision data: 30 days on Free tier, 90 days on Pro, unlimited on Enterprise
- You can delete all your data at any time via the dashboard or API
For full details, see our Privacy Policy.