Session
Manages session identity, preferences, and context continuity across agent sessions. This skill is agent-agnostic — it relies on AGENTS.md for auto-invocation.
Auto-run behavior
This skill is invoked automatically at session start (see AGENTS.md). When auto-invoked:
Restore tab name
— run the tab-naming script
Load preferences
— read session.json and apply any stored preferences
Show context bookmark
— if a previous session left a context note, display it
When invoked manually, the user can change preferences or bookmark context.
Step 1 — Set terminal tab name (tmux only)
Check if
$TMUX
is set. If yes, run the tab-naming script:
bash
"
$(
dirname
"
$0
"
)
/../skills/swain-session/scripts/swain-tab-name.sh"
--auto
Use the project root to locate the script. The script reads
swain.settings.json
for the tab name format (default:
{project} @ {branch}
).
If this fails (e.g., not in a git repo), set a fallback title of "swain".
If
$TMUX
is NOT set
, skip tab naming and show this tip:
Tip:
Tab naming and workspace layouts require tmux. Run
tmux
before starting Claude Code to enable
/swain-session
tab naming and
/swain-stage
layouts.
Step 2 — Load session preferences
Read the session state file. The file location is:
Find the script
BOOKMARK_SCRIPT
" $( find . .claude .agents -path '*/swain-session/scripts/swain-bookmark.sh' -print -quit 2
/dev/null ) "
Basic note
bash " $BOOKMARK_SCRIPT " "Transitioned SPEC-001 to Approved"
Note with files
bash " $BOOKMARK_SCRIPT " "Implemented auth middleware" --files src/auth.ts src/auth.test.ts
Clear bookmark
bash " $BOOKMARK_SCRIPT " --clear The script handles session.json discovery, atomic writes, and graceful degradation (no jq = silent no-op). Focus Lane The operator can set a focus lane to tell swain-status to recommend within a single vision or initiative. This is a steering mechanism — it doesn't hide other work, but frames recommendations around the operator's current focus. Setting focus: When the operator says "focus on security" or "I'm working on VISION-001", resolve the name to an artifact ID and invoke the focus script. Name-to-ID resolution: If the operator uses a name instead of an ID (e.g., "security" instead of "VISION-001"), search Vision and Initiative artifact titles for the best match using swain chart: bash skills/swain-design/scripts/chart.sh --ids --flat 2
/dev/null | grep -i "
" If exactly one match, use it. If multiple matches, ask the operator to clarify. If no match, tell the operator no Vision or Initiative matches that name and offer to create one. bash " $( find . .claude .agents -path '*/swain-session/scripts/swain-focus.sh' -print -quit 2 /dev/null ) " set < RESOLVED-ID
Clearing focus: bash " $( find . .claude .agents -path '*/swain-session/scripts/swain-focus.sh' -print -quit 2
/dev/null ) " clear Checking focus: bash " $( find . .claude .agents -path '*/swain-session/scripts/swain-focus.sh' -print -quit 2
/dev/null ) " Focus lane is stored in .agents/session.json under the focus_lane key. It persists across status checks within a session. swain-status reads it to filter recommendations and show peripheral awareness for non-focus visions. Settings This skill reads from swain.settings.json (project root) and ~/.config/swain/settings.json (user override). User settings take precedence. Relevant settings: terminal.tabNameFormat — format string for tab names. Supports {project} and {branch} placeholders. Default: {project} @ {branch} Error handling If jq is not available, warn the user and skip JSON operations. Tab naming still works without jq. If git is not available, use the directory name as the project name and skip branch detection. Never fail hard — session management is a convenience, not a gate.