Agent skill

Session Management

by josstei in josstei/maestro-orchestrate

Manages orchestration session state, tracking, and resumption

Apache-2.0Auto-check passedAgent Workflows

Install Session Management

skills CLI
$ npx skills add josstei/maestro-orchestrate --skill session-management -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install josstei/maestro-orchestrate session-management --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/josstei/maestro-orchestrate.git skills-src && mkdir -p .claude/skills && cp -r skills-src/src/skills/shared/session-management .claude/skills/session-management && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
session-management
GitHub stars
465
Token cost
~3.5k tokens
SKILL.md length
1,499 words
Files
1
Skills in repo
17
Repo updated
First seen
Licence
Apache-2.0

At a glance

Manages orchestration session state, tracking, and resumption

  • Works in 9 steps: Resolve state directory from… → Create /state/ directory if it does not… → Verify no existing active-session.md —… → …
  • Tasks that involve Authentication
  • SKILL.md covers State Access Protocol, Hook-Level Session State, Session Creation Protocol and State Update Protocol, plus 3 more sections
  • Calls node

What it does

Session Management is an agent skill from josstei/maestro-orchestrate. Manages orchestration session state, tracking, and resumption

Its SKILL.md is about 3.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Authentication and Session handoff. The repository describes itself as: Multi-agent orchestration platform for Gemini CLI, Claude Code, Codex, and Qwen Code — 39 specialists, parallel subagents, persistent sessions, and built-in code review…. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Authentication
  • Tasks that involve Session handoff

Example prompts

  • “Use the session-management skill to manage orchestration session state, tracking, and resumption”
  • “/session-management”

Workflow steps

9 steps, taken from the first numbered list in SKILL.md.

  1. Resolve state directory from MAESTRO_STATE_DIR
  2. Create /state/ directory if it does not exist (defense-in-depth fallback — workspace readiness startup check is the primary mechanism)
  3. Verify no existing active-session.md — if one exists, alert the user and offer to archive or resume
  4. Generate session state using the session-state template loaded via get_skill_content
  5. Initialize all phases as pending
  6. Set overall status to in_progress
  7. Set current_phase to 1
  8. Record design document and implementation plan paths
  9. Initialize empty token_usage, file manifests, downstream_context, and errors sections

What it can do on your machine

Read from SKILL.md and the folder at commit 4f5d434. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • node

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Session Management loads about 3.5k tokens when it runs. Until then it costs about 20 tokens; SKILL.md has 1,499 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~20
When it runs · the whole SKILL.md, loaded when a task matches
~3.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from josstei/maestro-orchestrate at commit 4f5d434, republished under its Apache-2.0 licence (© josstei). 1,499 words, ~3,501 tokens.

Download SKILL.mdSave it as .claude/skills/session-management/SKILL.md (or your agent's skills folder).
name
session-management
description
Manages orchestration session state, tracking, and resumption

Session Management Skill

Activate this skill for all session state operations during Maestro orchestration. This skill defines the protocols for creating, updating, resuming, and archiving orchestration sessions.

State Access Protocol

When MCP state tools are available, prefer them for state operations:

  • Preferred: MCP tools (initialize_workspace, create_session, update_session, transition_phase, get_session_status, archive_session) — structured I/O, atomic operations.
  • Fallback: write_file/replace directly on state files — when MCP tools are not in the available tool list.
  • Legacy: Shell scripts (write-state.js, read-state.js) — remain available but are not the recommended path.

Detection: check whether MCP state tools appear in your available tools. If they do, use them. If they do not, use write_file/replace.

Hook-Level Session State

Maestro hooks maintain a separate, transient state directory under ${MAESTRO_HOOKS_DIR:-<os.tmpdir()>/maestro-hooks-<uid>}/<session-id>/ that is distinct from orchestration state in <MAESTRO_STATE_DIR>:

ConcernOrchestration StateHook State
Location<MAESTRO_STATE_DIR>/state/${MAESTRO_HOOKS_DIR:-<os.tmpdir()>/maestro-hooks-<uid>}/<session-id>/
LifecycleCreated at execution setup, archived in Phase 4Directory created by the session-start hook when an active session exists; active-agent file written by the pre-delegation hook and cleared by the post-delegation hook; stale directories pruned by both session-start and pre-delegation hooks
ContentsSession metadata, phase tracking, token usage, file manifestsActive agent tracking file (active-agent)
PersistenceSurvives session restarts (supports /maestro:resume)Ephemeral — lost on session end or system reboot
Managed byOrchestrator via session-management skillThe runtime's pre-delegation and post-delegation hooks

The pre-delegation hook prunes stale hook state directories older than 2 hours to prevent accumulation from abnormal session terminations.

The orchestrator does not read or write hook-level state directly. It interacts only with <MAESTRO_STATE_DIR> paths. The two state systems are independent and serve different concerns.

Session Creation Protocol

When to Create

For Standard workflow, create a new session at execution setup after the design document and implementation plan are approved and the execution mode gate has resolved. For Express workflow, create a session after the structured brief is approved (see Express Workflow section in the orchestrator template).

Session ID Format

YYYY-MM-DD-<topic-slug>

Where:

  • YYYY-MM-DD is the orchestration start date
  • <topic-slug> is a lowercase, hyphenated summary matching the design document topic
File Location

<MAESTRO_STATE_DIR>/state/active-session.md

All state paths in this skill use <MAESTRO_STATE_DIR> as their base directory (default: docs/maestro). In procedural steps, <state_dir> represents the resolved value of this variable.

State File Access

Both read_file and write_file work on state paths inside <MAESTRO_STATE_DIR>. The runtime's file-access configuration makes state paths accessible.

Use the runtime's bundled scripts/ directory for these helper commands so they still work when the extension is installed outside the workspace root.

Reading state files: Use read_file directly. The read-state.js script remains available as an alternative for TOML shell blocks that inject state before the model's first turn:

run_shell_command: node <runtime-script-root>/read-state.js <relative-path>

Writing state files: Use write_file directly. When content must be piped from a shell command, use the atomic write script:

run_shell_command: echo '...' | node <runtime-script-root>/write-state.js <relative-path>

Rules:

  • The write-state.js script writes atomically (temp file + rename) to prevent partial writes
  • Both scripts validate against absolute paths and path traversal
Initialization Steps
  1. Resolve state directory from MAESTRO_STATE_DIR
  2. Create <state_dir>/state/ directory if it does not exist (defense-in-depth fallback — workspace readiness startup check is the primary mechanism)
  3. Verify no existing active-session.md — if one exists, alert the user and offer to archive or resume
  4. Generate session state using the session-state template loaded via get_skill_content
  5. Initialize all phases as pending
  6. Set overall status to in_progress
  7. Set current_phase to 1
  8. Record design document and implementation plan paths
  9. Initialize empty token_usage, file manifests, downstream_context, and errors sections
Initial State Template
yaml
---
session_id: "<YYYY-MM-DD-topic-slug>"
task: "<user's original task description>"
created: "<ISO 8601 timestamp>"
updated: "<ISO 8601 timestamp>"
status: "in_progress"
workflow_mode: "<standard|express>"
design_document: "<state_dir>/plans/<design-doc-filename>"
implementation_plan: "<state_dir>/plans/<impl-plan-filename>"
current_phase: 1
total_phases: <integer from impl plan>
execution_mode: null
execution_backend: null
task_complexity: null

token_usage:
  total_input: 0
  total_output: 0
  total_cached: 0
  by_agent: {}

phases:
  - id: 1
    name: "<phase name from impl plan>"
    status: "pending"
    agents: []
    parallel: false
    started: null
    completed: null
    blocked_by: []
    files_created: []
    files_modified: []
    files_deleted: []
    downstream_context:
      key_interfaces_introduced: []
      patterns_established: []
      integration_points: []
      assumptions: []
      warnings: []
    errors: []
    retry_count: 0
---

# <Topic> Orchestration Log

Include task_complexity (from design document frontmatter) in the session state. Place after execution_backend, before token_usage. Default: null.

State Update Protocol

Update Triggers

Update session state on every meaningful state change:

  • Phase status transitions
  • File manifest changes
  • Downstream context extraction from completed phases
  • Error occurrences
  • Token usage increments
  • Phase completion or failure
Update Rules
  1. Timestamp: Update updated field on every state change
  2. Phase Status: Transition phase status following valid transitions:
    • pending -> in_progress
    • in_progress -> completed
    • in_progress -> failed
    • failed -> in_progress (retry)
    • pending -> skipped (user decision only)
  3. Current Phase: Update current_phase to the ID of the currently executing phase
  4. File Manifest: Append to files_created, files_modified, or files_deleted as subagents report changes
  5. Downstream Context: Persist parsed Handoff Report Part 2 fields into phase downstream_context
  6. Token Usage: Aggregate token counts from subagent responses into both total_* and by_agent sections
  7. Error Recording: Append to phase errors array with complete metadata
Error Recording Format
yaml
errors:
  - agent: "<agent-name>"
    timestamp: "<ISO 8601>"
    type: "<validation|timeout|file_conflict|runtime|dependency>"
    message: "<full error description>"
    resolution: "<what was done to resolve, or 'pending'>"
    resolved: false
Retry Tracking
  • Increment retry_count on each retry attempt
  • Maximum 2 retries per phase before escalating to user
  • Record each retry as a separate error entry with resolution details
Markdown Body Updates

After updating YAML frontmatter, append to the Markdown body:

markdown
## Phase N: <Phase Name> <status indicator>

### <Agent Name> Output
[Summary of agent output or full content]

### Files Changed
- Created: [list]
- Modified: [list]

### Downstream Context
- Key Interfaces Introduced: [list]
- Patterns Established: [list]
- Integration Points: [list]
- Assumptions: [list]
- Warnings: [list]

### Validation Result
[Pass/Fail with details]

Status indicators:

  • Completed: checkmark
  • In Progress: circle
  • Failed: cross
  • Pending: square
  • Skipped: dash

Archive Protocol

When to Archive

Archive session state when:

  • All phases are completed successfully AND MAESTRO_AUTO_ARCHIVE is true (default)
  • User explicitly requests archival (regardless of MAESTRO_AUTO_ARCHIVE setting)
  • User starts a new orchestration (previous session must be archived first, regardless of setting)

When MAESTRO_AUTO_ARCHIVE is false, prompt the user after successful completion: "Session complete. Auto-archive is disabled. Would you like to archive this session?"

Show full SKILL.md (653 more words)Show less
Archive Steps

If archive_session appears in your available tools, use it — a single call handles all archival:

  1. Call archive_session with the session ID. The MCP tool atomically:
    • Updates session status to completed
    • Moves active-session.md to <state_dir>/state/archive/<session-id>.md
    • Moves design document to <state_dir>/plans/archive/ (if it exists and is non-null)
    • Moves implementation plan to <state_dir>/plans/archive/ (if it exists and is non-null)
  2. Confirm archival to user with summary of what was archived (use the archived_files array in the response)

If archive_session is not available, fall back to manual file operations:

  1. Create <state_dir>/plans/archive/ directory if it does not exist
  2. Create <state_dir>/state/archive/ directory if it does not exist
  3. MOVE (not copy) design document from <state_dir>/plans/ to <state_dir>/plans/archive/ — the original MUST be deleted. Use the shell-command tool from runtime context with mv or read+write+delete. Do NOT leave the file in both locations. Skip this step if design_document is null (Express sessions).
  4. MOVE (not copy) implementation plan from <state_dir>/plans/ to <state_dir>/plans/archive/ — same: delete the original. Skip this step if implementation_plan is null (Express sessions).
  5. Update session state status to completed
  6. Update updated timestamp
  7. MOVE (not copy) active-session.md from <state_dir>/state/ to <state_dir>/state/archive/<session-id>.md — delete the original.
  8. Confirm archival to user with summary of what was archived
Archive Verification

After archival, verify ALL of the following (archive is incomplete if any check fails):

  • No active-session.md exists in <state_dir>/state/
  • No plan files remain in <state_dir>/plans/ (only the archive/ subdirectory should be present)
  • Archived files are readable at their new locations in archive/
  • If files still exist in the original locations, delete them now — the archive step used copy instead of move

Resume Protocol

When to Resume

Resume is triggered by the /maestro:resume command or when /maestro:orchestrate detects an existing active session.

Resume Steps
  1. Read State: If session state was already injected into the prompt (e.g., via /maestro:resume), use that injected content instead of calling get_session_status. Otherwise, if get_session_status appears in your available tools, call it to read the active session. Otherwise, read state via run_shell_command: node <runtime-script-root>/read-active-session.js (resolves MAESTRO_STATE_DIR internally)
  2. Parse Frontmatter: Extract YAML frontmatter for session metadata
  3. Identify Position: Determine:
    • Last completed phase (highest ID with status: completed)
    • Current active phase (first phase with status: in_progress or pending)
    • Any failed phases with unresolved errors
  4. Check Errors: Identify unresolved errors from previous execution
  5. Present Summary: Display status summary to user using the resume format defined in the orchestrator instructions
  6. Handle Errors: If unresolved errors exist:
    • Present each error with context
    • Offer options: retry, skip, abort, or adjust parameters
    • Wait for user guidance before proceeding
  7. Continue Execution: Resume from the first pending or failed phase
  8. Update State: Mark resumed phase as in_progress and update timestamps
Express Resume Branch

When resuming a session with workflow_mode: "express" (read from session state via get_session_status), follow the Express workflow's resume protocol instead of the standard resume steps above:

  • If phase status is pending: re-generate and present the structured brief for approval. On approval, proceed to delegation.
  • If phase status is in_progress: the implementing agent was interrupted. Re-delegate with the same scope. Use the agents array to identify which agent was running.
  • If phase status is completed but session status is in_progress: code review or archival was interrupted. Run the code review step, then archive.

Express sessions have a single phase. The phase status combined with the agents array contents determines the resume position.

Conflict Detection

When resuming, check for potential conflicts:

  • Files that were partially modified (phase started but not completed)
  • External modifications to files in the manifest since last session
  • Changes to the implementation plan since last execution

Report any detected conflicts to the user before proceeding.

Token Usage Tracking

Collection

After each subagent invocation, record:

  • Input tokens consumed
  • Output tokens generated
  • Cached tokens used (if available)
Aggregation

Maintain two levels of aggregation:

  1. Total: Sum across all agents and phases
  2. By Agent: Per-agent totals across all their invocations
Format
yaml
token_usage:
  total_input: 15000
  total_output: 8000
  total_cached: 3000
  by_agent:
    coder:
      input: 8000
      output: 4000
      cached: 2000
    tester:
      input: 7000
      output: 4000
      cached: 1000

© josstei, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in src/skills/shared/session-management of josstei/maestro-orchestrate.

Open the folder on GitHubat commit 4f5d434

Compare with similar skills

Session Management next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Session Management compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Session Management this skilljosstei/maestro-orchestrate465—~3.5kAutomated safety check: PassApache-2.0
Project Session ManagementMicrock/ordinary-claude-skills403—~1.9kAutomated safety check: PassCustom licence
MCP Server Builder with mcp-usemcp-use/mcp-use11k—~923Automated safety check: PassApache-2.0
Cao MCP Appsawslabs/cli-agent-orchestrator1.4k—~1.9kAutomated safety check: PassApache-2.0
CodemanArk0N/Codeman784—~13kAutomated safety check: NotesMIT
Cross Origin Iframe Probejumodada/Drissionpage-MCP-Server487—~1.2kAutomated safety check: PassCustom licence

Similar skills

  • Project Session Management

    Microck/ordinary-claude-skills

    Track progress across work sessions using SESSION.md with git checkpoints and concrete next actions.

    403 GitHub stars~1.9k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Builds, modifies, debugs, migrates and verifies TypeScript MCP servers and MCP Apps with the mcp-use framework, treating the installed package's types as the source of truth.

    11k GitHub stars~923 tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Cao MCP Apps

    awslabs/cli-agent-orchestrator

    Official

    Enable, operate, and extend CAO's MCP Apps surface — the host-rendered fleet dashboard visible inside MCP App hosts (Claude Desktop, ChatGPT, VS Code Copilot, Goose, Postman).

    1.4k GitHub stars~1.9k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Codeman

    Ark0N/Codeman

    Drive Codeman, the session manager this agent is running inside, over its HTTP API: list sessions, start worker sessions, send them prompts, block until they finish (wait / wait-output /…

    784 GitHub stars~13k tokensUpdated yesterday
    Agent WorkflowsAuto-check: notes
  • Cross Origin Iframe Probe

    jumodada/Drissionpage-MCP-Server

    A skill your agent uses when a drissionpage-mcp task targets an iframe such as a payment widget, challenge, SSO flow, or embedded checkout.

    487 GitHub stars~1.2k tokensUpdated 24 days ago
    Agent WorkflowsAuto-check passed
  • Githits Onboarding

    githits-com/githits-cli

    A skill your agent uses when the user asks to install, connect, configure, sign in to, sign up for, or start using GitHits.

    114 GitHub stars~3.5k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from josstei/maestro-orchestrate

All 17 skills in this repo
  • Code Review

    josstei/maestro-orchestrate

    Standalone code review methodology for structured, severity-classified code assessment

    465 GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • Execution

    josstei/maestro-orchestrate

    Phase execution methodology for orchestration workflows with error handling and completion protocols

    465 GitHub stars~3.1k tokensUpdated yesterday
    Auto-check passed
  • Implementation Planning

    josstei/maestro-orchestrate

    Generates detailed implementation plans from finalized designs

    465 GitHub stars~4.4k tokensUpdated yesterday
    Auto-check passed
  • Validation

    josstei/maestro-orchestrate

    Cross-cutting validation methodology for verifying phase outputs and project integrity

    465 GitHub stars~2.3k tokensUpdated yesterday
    Auto-check passed
  • Delegation

    josstei/maestro-orchestrate

    Agent delegation best practices for constructing effective subagent prompts with proper scoping

    465 GitHub stars~5.2k tokensUpdated yesterday
    Auto-check passed
  • A11y Audit

    josstei/maestro-orchestrate

    Run a Maestro-style accessibility audit for WCAG compliance, ARIA usage, keyboard navigation, and screen reader compatibility

    465 GitHub stars~245 tokensUpdated yesterday
    Auto-check passed

Questions about Session Management

What does Session Management do?

Manages orchestration session state, tracking, and resumption. Session Management is an agent skill from josstei/maestro-orchestrate.

When should I use Session Management?

Session Management fits situations like: tasks that involve Authentication; tasks that involve Session handoff.

How do I install Session Management in Claude Code?

Run `npx skills add josstei/maestro-orchestrate --skill session-management -a claude-code`. Or copy the skill folder (src/skills/shared/session-management in josstei/maestro-orchestrate) into .claude/skills/session-management in your project. Claude Code loads it when a task matches its description.

How do I install Session Management in Codex?

Run `npx skills add josstei/maestro-orchestrate --skill session-management -a codex`. Or copy the skill folder (src/skills/shared/session-management in josstei/maestro-orchestrate) into .agents/skills/session-management in your project. Codex loads it when a task matches its description.

Can I use Session Management in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add josstei/maestro-orchestrate --skill session-management -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/session-management, .gemini/skills/session-management, .github/skills/session-management and .opencode/skills/session-management in your project.

What does Session Management need to run?

Going by SKILL.md and its folder, Session Management needs the command-line tools its instructions call (node).

Does Session Management access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Session Management safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Session Management use?

Session Management is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Session Management use?

About 3.5k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Session Management?

Skills that share tags, products or a category with Session Management: Project Session Management (Microck/ordinary-claude-skills, 403 stars), MCP Server Builder with mcp-use (mcp-use/mcp-use, 11k stars), Cao MCP Apps (awslabs/cli-agent-orchestrator, 1.4k stars) and Codeman (Ark0N/Codeman, 784 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Session Management?

josstei (a GitHub user) maintains it in josstei/maestro-orchestrate, which has 465 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 6, 2026.

Source: josstei/maestro-orchestrate on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.