core/capabilities/context/session-bridge/SKILL.md
Preserves and restores context across agent sessions using plan file checkboxes as source of truth. Use when starting a new session, resuming previous work, ending a session, or when the user says "continue from last time", "what was I doing", or "save progress".
npx skillsauth add xoai/sage session-bridgeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Maintain continuity across sessions using the plan file as the source of truth.
Core Principle: The file system is the source of truth. What artifacts
exist in .sage/work/ and their frontmatter status tells you where things
stand. decisions.md provides reasoning context that helps find the active work quickly.
State updates happen at checkpoints (Rule 7), not per-task.
Two levels of state, each with a different purpose:
.sage/work/<feature>/ contains artifacts with YAML frontmatter:
brief.md, spec.md, plan.md — each with status and phasepending, in-progress, completed, blockedThis is always accurate because artifacts are created and updated as part of the workflow. No separate "save" action needed.
Each initiative's .sage/work/[initiative]/decisions.md is the
per-cycle log; the global .sage/decisions.md is a shared
cross-initiative log. Both are places where the agent and human
write significant decisions and context. It provides reasoning that
artifact frontmatter doesn't capture — WHY decisions were made,
what alternatives were considered, and what the human's priorities are.
When resuming work, run the generated brief FIRST:
python3 sage/runtime/tools/manifest.py resume
(Plugin installs: python3 "${CLAUDE_PLUGIN_ROOT}/tools/manifest.py" resume.)
It performs Steps 1–3 below mechanically — selection, evidence, decisions — and prints the resume authority order (cycle-protocol.md). Only fall back to the manual steps when the tool is unavailable (no python3, or a manifest-less pre-v1.0.9 project).
Scan .sage/work/ for active initiatives. Read frontmatter from
manifest.md, brief.md, spec.md, or plan.md (whichever exists). Note
title, status, phase. If a plan exists, scan the task checkboxes to
understand how far implementation progressed.
This is the source of truth — what artifacts exist tells you where the project stands.
Branch matching (git projects): read the current branch and
match it against the recorded branch: field in each
initiative's manifest frontmatter (git-discipline records it at
branch creation — match on the recorded field, never re-derive from
branch or directory names). Prefer the initiative whose recorded
branch matches HEAD in the resume menu; if HEAD is on the default
branch while initiative branches exist, list them.
Owner exclusion (parallel worktrees): exclude initiatives whose
manifest carries an owner: pointing at a different checkout —
compare git rev-parse --show-toplevel against the recorded
owner: after path normalization (trailing slashes, symlinks).
They belong to another worktree's session. A session opened inside
a worktree auto-resumes that worktree's checked-out initiative by
the same branch-matching rule.
Read the matched initiative's own decision log first —
.sage/work/[initiative]/decisions.md — then the global
.sage/decisions.md (cross-initiative decisions; older projects
may have only the global file). Read the last 3-5 entries of each.
These capture recent decisions and direction changes — WHY the
project is in its current state, not just WHAT state it's in.
If artifacts and the codebase disagree (e.g., plan says "spec phase" but implementation files exist), trust the codebase. The file system is the ultimate source of truth. Update artifacts to match reality.
Sage: Resuming [feature name]. [Phase] phase. [Summary of what exists and what's next.]
State updates happen ONLY at checkpoints (Rule 7), not per-task:
Prepend significant decisions to the initiative's decision log
(.sage/work/[initiative]/decisions.md; cross-initiative decisions
go to the global .sage/decisions.md):
### 2025-03-13 — Token storage decision
Chose httpOnly cookies over localStorage for JWT storage.
XSS protection outweighs CSRF handling cost.
spec.md updated with cookie-based auth approach.
Update artifact frontmatter if status changed.
Append to .sage/conventions.md:
### Error handling
Project uses a centralized error handler in src/middleware/error-handler.ts.
All route handlers throw typed errors; the middleware formats the response.
If the session is ending gracefully (human says "stop", "done for now"):
If the session ends abruptly: the artifacts in .sage/work/ and
their frontmatter reflect the real state. The next session's slash
command auto-pickup reads them to orient.
FIX mode typically doesn't have plan artifacts. For FIX mode:
/fix command scans for in-progress fix workNo artifacts found: "Sage: Fresh project, no work in progress."
All artifacts completed: "Previous initiative [name] is complete. Ready for a new task."
Artifacts and codebase disagree: Always trust the codebase (git log, file existence) over artifacts. Update artifact frontmatter to match.
.sage/work/ are the ground truth for state.testing
Root cause diagnosis with evidence, Reproducing test, Minimal patch
tools
Session resumption with context
tools
Configure Sage preset and project settings. Switch between base, startup, enterprise, or opensource constitution presets. Use when the user says "configure sage", "change preset", or "sage settings".
development
Brief (medium+ tasks), Spec, Implementation plan