session-create
Original:🇺🇸 English
Translated
Open a new context session at the start of a leader agent workflow. Records agentName, storyId, and phase in wint.contextSessions, emitting a structured SESSION CREATED block for downstream workers to inherit.
2installs
Sourcemichael-menard/monorepo
Added on
NPX Install
npx skill4agent add michael-menard/monorepo session-createTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →/session-create - Open a Context Session
Description
Opens a new context session at the beginning of a leader agent's workflow. The session record tracks token usage, agent identity, and story context across multi-agent workflows. Workers inherit this session via the companion skill.
session-inheritSession tracking is telemetry — it must never gate or block a workflow. If the session cannot be created (DB unavailable, null return), the leader emits a warning and continues normally.
Usage
/session-create # called at start of leader workflow
/session-create storyId=WINT-1234 phase=execute # with story and phase contextParameters
| Parameter | Required | Default | Description |
|---|---|---|---|
| Yes | (current agent name) | The name of the leader agent opening the session |
| No | null | Story ID for this workflow (e.g. |
| No | null | Current workflow phase (e.g. |
| No | (auto-generated UUID) | Override the session UUID (rarely needed) |
What It Does
This skill:
- Calls with
mcp__postgres-knowledgebase__sessionCreate,agentName, andstoryIdphase - Records the returned and emits the structured
session_idoutput blockSESSION CREATED - Handles null returns (DB error) gracefully — emits and continues
SESSION UNAVAILABLE
Execution Steps
Step 1: Invoke sessionCreate
Call the MCP tool with required and optional fields:
javascript
const result = await mcp__postgres_knowledgebase__sessionCreate({
agentName: 'dev-execute-leader', // required — name of THIS agent
storyId: 'WINT-2090', // optional
phase: 'execute', // optional
// sessionId: crypto.randomUUID() // omit to auto-generate
})SessionCreateInput fields:
| Field | Type | Required | Notes |
|---|---|---|---|
| string (min 1) | Yes | Name of the leader agent |
| UUID string | No | Auto-generated if omitted |
| string | null | No | Story identifier |
| string | null | No | Workflow phase label |
| int >= 0 | No | Default: 0 |
| int >= 0 | No | Default: 0 |
| int >= 0 | No | Default: 0 |
| Date | No | Defaults to now() |
Step 2: Handle the result
Success path — is not null:
resultjavascript
if (result && result.sessionId) {
// Emit the structured output block (see Output section below)
}Null-return path — DB error or connection failure:
javascript
if (result === null) {
// Emit SESSION UNAVAILABLE warning and continue
}Step 3: Emit structured output
On success, always emit the following block so workers can parse the session ID:
SESSION CREATED
session_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
agent: dev-execute-leader
story_id: WINT-2090
phase: executeTheline must match the regex:session_id/SESSION CREATED\n\s+session_id:\s+([0-9a-f-]{36})/
Output
Success
After a successful call, emit:
sessionCreateSESSION CREATED
session_id: {uuid returned by sessionCreate}
agent: {agentName}
story_id: {storyId or "—"}
phase: {phase or "—"}Null Return (Graceful Degradation)
If returns (DB unavailable or insertion error):
sessionCreatenullSESSION UNAVAILABLE — continuing without session trackingThen continue the workflow normally. Do not block, retry, or raise an error. Session tracking is telemetry, not a gate.
Session Lifecycle
The full session lifecycle across a multi-agent workflow:
- Leader opens — calls →
session-create→ emitssessionCreateSESSION CREATED - Workers inherit — each worker calls →
session-inherit→ emitssessionQuery(activeOnly: true)SESSION INHERITED - Workers update tokens — call
sessionUpdate({ sessionId, mode: 'incremental', inputTokens, outputTokens }) - Leader closes — the leader (and ONLY the leader that opened the session) calls
sessionComplete - Periodic cleanup — archives old sessions (future: WINT-2100)
sessionCleanup({ retentionDays: 90 })
Workers MUST NOT call. See thesessionCompleteskill for the full restriction.session-inherit
Graceful Degradation
Session tracking is purely telemetry. The following conditions must NOT block the workflow:
| Condition | Behavior |
|---|---|
| DB connection unavailable | Emit |
| Same as above |
| MCP tool unavailable | Log warning, proceed without session |
| Network timeout | Log warning, proceed without session |
The leader's downstream work (plan execution, file writes, code generation) must continue regardless of session state.
Examples
Minimal invocation
javascript
const session = await mcp__postgres_knowledgebase__sessionCreate({
agentName: 'dev-execute-leader',
})
// Emits:
// SESSION CREATED
// session_id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
// agent: dev-execute-leader
// story_id: —
// phase: —Full invocation with context
javascript
const session = await mcp__postgres_knowledgebase__sessionCreate({
agentName: 'dev-execute-leader',
storyId: 'WINT-2090',
phase: 'execute',
})
// Emits:
// SESSION CREATED
// session_id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
// agent: dev-execute-leader
// story_id: WINT-2090
// phase: executeNull-return path
javascript
const session = await mcp__postgres_knowledgebase__sessionCreate({
agentName: 'dev-execute-leader',
storyId: 'WINT-2090',
phase: 'execute',
})
if (!session) {
// Emit:
// SESSION UNAVAILABLE — continuing without session tracking
// then continue with the rest of the workflow normally
}Integration Notes
- The from
session_idshould be passed to spawned workers via their prompt context so they can callSESSION CREATEDsession-inherit - Workers use and filter client-side — they do NOT receive a
sessionQuery({ activeOnly: true, limit: 50 })filter directlysessionId - The leader is solely responsible for calling at the end of its workflow
sessionComplete