SnapBack

MCP Tools Reference

SnapBack gives your AI assistant four tools that form a complete session lifecycle. All communication is local β€” nothing leaves your machine.

ToolWhen to CallWrites State
snap_beginStart of every task β€” before anything elseβœ“ Opens session
snap_pulseMid-task health checkβœ— Read-only
snap_learnWhen you discover something worth rememberingβœ“ Writes rule
snap_endTask completeβœ“ Closes session

Workflow: snap_begin β†’ [work] β†’ snap_pulse (optional) β†’ snap_learn (as needed) β†’ snap_end


snap_begin β€” Session Start

Opens a session and loads codebase intelligence your AI doesn’t have yet: fragile files, co-change patterns, past learnings. Safe to call multiple times β€” resumes an existing session instead of creating a duplicate.

Call this before any other tool.

Parameters:

ParameterTypeRequiredDescription
taskstringNoWhat you’re about to do
filesstring[]NoFiles you plan to modify

Returns: Session ID, relevant past learnings, fragile file warnings, co-change alerts, risk assessment.

Example:

{
  "name": "snap_begin",
  "input": {
    "task": "Refactor authentication middleware",
    "files": ["src/middleware/auth.ts", "src/lib/session.ts"]
  }
}

First session in a new codebase returns sparse output β€” that’s normal. Intelligence accumulates with each session.


snap_pulse β€” Mid-Session Check

Read-only health check. Returns current session vitals, warnings, and co-change gaps. Doesn’t write, learn, or create snapshots.

When to call: After 3+ file changes, before a destructive operation, when you’re uncertain about approach, or before asking the user a clarifying question.

Parameters:

ParameterTypeRequiredDescription
focus"risk" | "cochanges" | "vitals"NoNarrow the response to a specific aspect
taskstringNoGet a topology-enhanced briefing scoped to this task
querystringNoSearch past learnings from the knowledge base

Returns: Session vitals (pulse, pressure, trajectory), active warnings, fragile files touched, co-change gaps.

Example:

{
  "name": "snap_pulse",
  "input": { "query": "What should I know about the auth middleware?" }
}

Use query to retrieve past learnings without calling snap_learn. Read-only β€” searching never stores anything.


snap_learn β€” Capture a Rule

Encodes an IF/THEN rule into the workspace knowledge base. Not for general observations β€” for rules that should surface in future sessions.

Call immediately when: the user corrects an assumption, you find unexpected codebase behavior, or an error reveals an unknown constraint.

Parameters:

ParameterTypeRequiredDescription
triggerstringβœ“The condition. Starts with β€œwhen”
actionstringβœ“What to do when the trigger fires. Starts with a verb
filesstring[]NoFiles this rule applies to
type"pattern" | "pitfall" | "constraint" | "preference"NoControls how this surfaces in future briefings
severity"info" | "warning" | "critical"Nocritical surfaces in snap_begin even on cold start

Returns: Confirmation and related learnings already in the knowledge base.

Example:

{
  "name": "snap_learn",
  "input": {
    "trigger": "when modifying token refresh logic in auth.ts",
    "action": "snapshot first β€” this file has 3 rollbacks across 2 sessions",
    "type": "pitfall",
    "severity": "warning",
    "files": ["src/auth/auth.ts"]
  }
}

Rules start cold. After appearing in 3+ sessions they auto-promote and surface more prominently in briefings.


snap_end β€” Closing Ceremony

Closes the session and returns a full summary: files modified, snapshots created, learnings captured, coherence score, and carry-forward context for next time.

Call this before your final message to the user.

Parameters:

ParameterTypeRequiredDescription
outcomestringβœ“What you accomplished, what’s incomplete, and decisions made. One paragraph minimum β€” this becomes the opening context for your next session

Returns: Session summary with metrics, coherence score, carry-forward items, and AI synthesis (Pro).

Example:

{
  "name": "snap_end",
  "input": {
    "outcome": "Refactored auth middleware to support OAuth2 PKCE. Token refresh is now in src/auth/refresh.ts. Left incomplete: revoke-token endpoint still uses the old pattern. Decided to keep session cookies HTTP-only after security review."
  }
}

A vague outcome ("done", "completed") produces a sparse briefing next session. Be specific β€” future sessions start from this context.


Full Session Flow

Start task
  β†’ snap_begin({ task: "...", files: [...] })
  β†’ Read the briefing. Note fragile files and co-change alerts.

During work
  β†’ snap_learn({ trigger: "when...", action: "...", type: "pitfall" })  // when you discover something
  β†’ snap_pulse({ focus: "risk" })                                        // optional mid-task check

Finish task
  β†’ snap_end({ outcome: "What you did, what's left, decisions made." })
  β†’ Carry-forward items appear in your next snap_begin briefing.

Privacy

All MCP communication is local. Your AI assistant talks to snapbackd on your machine via Unix socket (macOS/Linux) or named pipe (Windows). No code is transmitted β€” only intelligence metadata: patterns, risk scores, warnings, learning IDs.