@silverbackbase/trace
v0.3.0
Published
Marketing action memory primitive for AI agents
Readme
Trace
Marketing action memory for AI agents.
Trace gives your AI agent a memory of past marketing actions. Before every recommendation, it checks what was already done. When a performance drop is mentioned, it correlates with recent actions. It reminds you when it's time to analyze results.
Local-first. SQLite. No account, no API key, no data leaving your machine.
npx @silverbackbase/trace init→ Configures MCP, skill, and end-of-session hook in Claude Code automatically.
Why
Your agent recommends optimizing a page that was updated three weeks ago. It doesn't know. You explain, it moves on — until next session, when it's forgotten again.
A lead drop arrives. The agent digs into Analytics, campaigns, keywords. It doesn't know you changed the Google Ads budget ten days ago. Nobody logged that.
Trace is the missing primitive. Agents have tools to read data — not to remember actions.
How it works
1. Install
npx @silverbackbase/trace init
# or with a custom directory
npx @silverbackbase/trace init --dir /path/to/traceConfigures automatically:
- MCP server in
~/.claude.json— 5 tools available in Claude Code - Proactive skill in
~/.claude/skills/trace/SKILL.md - End-of-session reminder hook in
~/.claude/settings.json
Restart Claude Code to activate.
2. Log actions
trace add # interactive mode
# or inline
trace add "Rewrote service page H1 and intro" \
--client acme \
--channel seo \
--type page_updated \
--url https://acme.fr/service3. The agent acts on memory
Before any marketing recommendation, the agent calls trace_before_action. If a similar action was done recently and hasn't been reviewed yet, it returns review_first instead of proceeding blindly.
trace_before_action({
client_name: "Acme",
channel: "seo",
action_type: "page_updated",
asset_url: "https://acme.fr/service"
})
// → { recommendation: "review_first", reason: "Action done 18 days ago, not yet reviewed." }MCP Tools
| Tool | Description |
|------|-------------|
| trace_log | Log a marketing action with full context |
| trace_before_action | Check if a similar action was done recently — returns act, wait, or review_first |
| trace_correlate | Find recent actions that may explain a reported performance drop |
| trace_due | Return actions whose review window has passed |
| trace_query | Search and filter past actions by client, channel, period, or keyword |
| trace_review | Mark an action as reviewed, store post-action metrics snapshot, compute delta vs baseline |
Snapshot metrics
Trace can capture a metrics snapshot (GSC clicks, impressions, Trail leads) at log time and again at review time, then compute the delta automatically.
Workflow:
- When logging an action, the agent captures current metrics and passes them as
baseline_snapshottotrace_log. - Later,
trace_duereturns actions with asnapshot_hintflag — signaling that a baseline exists and a delta can be computed. - The agent calls
trace_reviewwith areview_snapshotof current metrics. Trace computes and returns absolute deltas and percentage changes.
// At log time
trace_log({
client_name: "Acme",
channel: "seo",
action_type: "page_updated",
summary: "Rewrote service page",
baseline_snapshot: {
gsc_clicks_28d: 142,
gsc_impressions_28d: 3800,
trail_leads_28d: 4
}
})
// At review time (45 days later)
trace_review({
action_id: "abc123",
notes: "Rankings improved on main keyword",
review_snapshot: {
gsc_clicks_28d: 198,
gsc_impressions_28d: 4200,
trail_leads_28d: 7
}
})
// → { delta: { gsc_clicks_28d: { absolute: +56, pct: +39.4 }, ... } }CLI
trace init # Initialize (configure MCP, skill, hook)
trace add [summary] # Log an action — interactive or inline
trace list # Recent actions
trace due # Actions pending review
trace search <query> # Search by keywordChannels & action types
| Channel | Action types |
|---------|-------------|
| seo | page_created, page_updated, backlink_added, redirect_added, schema_added |
| sea | campaign_created, budget_changed, keyword_added, ad_updated |
| local_seo | gmb_post, gmb_photos, gmb_response, citation_added |
| cro | ab_test_started, ab_test_ended, form_changed, cta_changed |
| content | article_published, newsletter_sent, social_post |
Review windows
Trace auto-calculates a review_date based on action type:
| Action type | Review after |
|-------------|-------------|
| budget_changed | 7 days |
| ab_test_ended | 14 days |
| page_updated | 45 days |
| page_created | 60 days |
| backlink_added | 90 days |
Self-host / SDK
npm install @silverbackbase/traceimport { openDb, addAction, getDueActions } from "@silverbackbase/trace";
const db = openDb("/path/to/trace");
addAction(db, {
client_name: "Acme",
channel: "seo",
action_type: "page_updated",
summary: "Rewrote service page",
});
const due = getDueActions(db);
db.close();Requirements
- Node.js 22+
- Claude Code (for MCP + skill + hook)
License
MIT — SilverBackBase
