MCP Tools Reference
SnapBack gives your AI assistant four tools that form a complete session lifecycle. All communication is local β nothing leaves your machine.
| Tool | When to Call | Writes State |
|---|---|---|
snap_begin | Start of every task β before anything else | β Opens session |
snap_pulse | Mid-task health check | β Read-only |
snap_learn | When you discover something worth remembering | β Writes rule |
snap_end | Task 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
task | string | No | What youβre about to do |
files | string[] | No | Files 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
focus | "risk" | "cochanges" | "vitals" | No | Narrow the response to a specific aspect |
task | string | No | Get a topology-enhanced briefing scoped to this task |
query | string | No | Search 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
trigger | string | β | The condition. Starts with βwhenβ |
action | string | β | What to do when the trigger fires. Starts with a verb |
files | string[] | No | Files this rule applies to |
type | "pattern" | "pitfall" | "constraint" | "preference" | No | Controls how this surfaces in future briefings |
severity | "info" | "warning" | "critical" | No | critical 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
outcome | string | β | 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.