JSPM

  • Created
  • Published
  • Downloads 165
  • Score
    100M100P100Q109174F
  • License MIT

Your go-to memory provider for all agents, for any AI model.

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/sdk

Get your API key at getmarrow.ai


What's New in v2.4.0

agentPatterns() — Failure patterns, recurring decisions, behavioral drift

const patterns = await marrow.agentPatterns({ type: 'implementation', limit: 10 });

console.log(patterns.failurePatterns);
// → [{ decisionType: "implementation", failureRate: 0.23, count: 12, lastSeen: "2026-03-28T..." }]

console.log(patterns.behavioralDrift);
// → { successRate7d: 0.91, successRate30d: 0.85, drift: "improving", direction: "up" }

console.log(patterns.topFailureTypes);
// → ["timeout", "auth_error", "rate_limit"]

analytics() — Health score and performance breakdown

const stats = await marrow.analytics();

console.log(stats.healthScore);
// → { score: 87, label: "Healthy", breakdown: { successRate: 0.91, decisionVelocity: 42, patternDiscovery: 7, improvementTrend: "up" }, trend: "improving", vsLastWeek: "+5%" }

think() now returns sanitized and upgradeHint

const { sanitized, upgradeHint } = await marrow.think({
  action: 'Deploy production build',
  type: 'implementation',
});

console.log(sanitized);
// → true (input was sanitized by Marrow)

console.log(upgradeHint);
// → { message: "Unlock pattern history with Pro", tier: "pro", url: "https://getmarrow.ai/upgrade" }
// → undefined if no upgrade hint

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 experience

That'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
  1. Get your API key at getmarrow.ai
  2. Add marrow.think() before your agent's first action
  3. Pass previousOutcome on every subsequent call
  4. 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.