Agent skill

Session Management

by alinaqi in alinaqi/maggy

Context preservation, tiered summarization, resumability. An agent skill from alinaqi/maggy.

MITAuto-check passedWriting & Content

Install Session Management

skills CLI
$ npx skills add alinaqi/maggy --skill session-management -a claude-code

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

GitHub CLI
$ gh skill install alinaqi/maggy 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/alinaqi/maggy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/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
707
Token cost
~3.6k tokens
SKILL.md length
647 words
Files
1
Skills in repo
71
Repo updated
First seen
Licence
MIT

At a glance

Context preservation, tiered summarization, resumability. An agent skill from alinaqi/maggy.

  • Works in 6 steps: CLAUDE.md as Entry Point → Session File Headers with Reminders → Self-Check Questions → …
  • Tasks that involve Authentication
  • SKILL.md covers Core Principle, Tiered Summarization Rules, Session State Structure and Current State File, plus 10 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Session Management is an agent skill from alinaqi/maggy. Context preservation, tiered summarization, resumability

Its SKILL.md is about 3.6k 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 Writing & Content, covering Authentication and Summarization. The repository describes itself as: What started as an opinionated Claude Code setup kit is now an autonomous AI engineering command center. The licence is MIT.

When your agent uses it

  • Tasks that involve Authentication
  • Tasks that involve Summarization

Example prompts

  • “/session-management”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. CLAUDE.md as Entry Point
  2. Session File Headers with Reminders
  3. Self-Check Questions
  4. Session Start Verification
  5. Periodic Self-Audit
  6. User Prompts

What it can do on your machine

Read from SKILL.md and the folder at commit 72a456e. 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

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown and bash).

    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.6k tokens when it runs. Until then it costs about 19 tokens; SKILL.md has 647 words of instructions outside code blocks.

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

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 alinaqi/maggy at commit 72a456e, republished under its MIT licence (© alinaqi). 647 words, ~3,574 tokens.

Download SKILL.mdSave it as .claude/skills/session-management/SKILL.md (or your agent's skills folder).
name
session-management
description
Context preservation, tiered summarization, resumability
when-to-use
At session checkpoints, after completing major tasks, or when resuming work
user-invocable
false
effort
low

Session Management Skill

For maintaining context across long development sessions and enabling seamless resume after breaks.


Core Principle

Checkpoint at natural breakpoints, resume instantly.

Long development sessions risk context loss. Proactively document state, decisions, and progress so any session can resume exactly where it left off - whether returning after a break or hitting context limits.


Tiered Summarization Rules

Tier 1: Quick Update (current-state.md only)

Trigger: After completing any small task or todo item Action: Update "Active Task", "Progress", and "Next Steps" sections Time: ~30 seconds

Tier 2: Full Checkpoint (current-state.md + decisions.md)

Trigger:

  • After completing a feature or significant change
  • After any architectural/library decision
  • After ~20 tool calls during active work
  • When switching to a different area of the codebase

Action:

  1. Update full current-state.md
  2. Log any decisions to decisions.md
  3. Update files being modified table
Tier 3: Session Archive (archive/ + full checkpoint)

Trigger:

  • End of work session
  • Completing a major feature/milestone
  • Before a significant context shift
  • When context feels heavy (~50+ tool calls)

Action:

  1. Create archive entry: archive/YYYY-MM-DD[-topic].md
  2. Full checkpoint
  3. Clear verbose notes from current-state.md
  4. Update code-landmarks.md if new patterns introduced
Decision Heuristic
┌─────────────────────────────────────────────────────┐
│ After completing work, ask:                         │
├─────────────────────────────────────────────────────┤
│ Was a decision made?        → Log to decisions.md   │
│ Task took >10 tool calls?   → Full Checkpoint       │
│ Major feature complete?     → Archive               │
│ Ending session?             → Archive + Handoff     │
│ Otherwise                   → Quick Update          │
└─────────────────────────────────────────────────────┘

Session State Structure

Create _project_specs/session/ directory:

_project_specs/
└── session/
    ├── current-state.md      # Live session state (update frequently)
    ├── decisions.md          # Key decisions log (append-only)
    ├── code-landmarks.md     # Important code locations
    └── archive/              # Past session summaries
        └── 2025-01-15.md

Current State File

_project_specs/session/current-state.md - Update every 15-20 minutes or after significant progress.

markdown
# Current Session State

*Last updated: 2025-01-15 14:32*

## Active Task
[One sentence: what are we working on right now]

Example: Implementing user authentication flow with JWT tokens

## Current Status
- **Phase**: [exploring | planning | implementing | testing | debugging | refactoring]
- **Progress**: [X of Y steps complete, or percentage]
- **Blocking Issues**: [None, or describe blockers]

## Context Summary
[2-3 sentences summarizing the current state of work]

Example: Created auth middleware and login endpoint. JWT signing works.
Currently implementing token refresh logic. Need to add refresh token
rotation for security.

## Files Being Modified
| File | Status | Notes |
|------|--------|-------|
| src/auth/middleware.ts | Done | JWT verification |
| src/auth/refresh.ts | In Progress | Token rotation |
| src/auth/types.ts | Done | Token interfaces |

## Next Steps
1. [ ] Complete refresh token rotation in refresh.ts
2. [ ] Add token blacklist for logout
3. [ ] Write integration tests for auth flow

## Key Context to Preserve
- Using RS256 algorithm (not HS256) per security requirements
- Refresh tokens stored in HttpOnly cookies
- Access tokens: 15 min, Refresh tokens: 7 days

## Resume Instructions
To continue this work:
1. Read src/auth/refresh.ts - currently at line 45
2. The rotateRefreshToken() function needs error handling
3. Check decisions.md for why we chose RS256 over HS256

Decision Log

_project_specs/session/decisions.md - Append-only log of architectural and implementation decisions.

markdown
# Decision Log

Track key decisions for future reference. Never delete entries.

---

## [2025-01-15] JWT Algorithm Choice

**Decision**: Use RS256 instead of HS256 for JWT signing

**Context**: Implementing authentication system

**Options Considered**:
1. HS256 (symmetric) - Simpler, single secret
2. RS256 (asymmetric) - Public/private key pair

**Choice**: RS256

**Reasoning**:
- Allows token verification without exposing signing key
- Better for microservices (services only need public key)
- Industry standard for production systems

**Trade-offs**:
- Slightly more complex key management
- Larger token size

**References**:
- src/auth/keys/ - Key storage
- docs/security.md - Security architecture

---

## [2025-01-14] Database Schema Approach

**Decision**: Use Drizzle ORM with PostgreSQL

**Context**: Setting up data layer

**Options Considered**:
1. Prisma - Popular, good DX
2. Drizzle - Type-safe, SQL-like
3. Raw SQL - Maximum control

**Choice**: Drizzle

**Reasoning**:
- Better TypeScript inference than Prisma
- More transparent SQL generation
- Lighter weight, faster cold starts

**References**:
- src/db/schema.ts - Schema definitions
- src/db/migrations/ - Migration files

Code Landmarks

_project_specs/session/code-landmarks.md - Important code locations for quick reference.

markdown
# Code Landmarks

Quick reference to important parts of the codebase.

## Entry Points
| Location | Purpose |
|----------|---------|
| src/index.ts | Main application entry |
| src/api/routes.ts | API route definitions |
| src/workers/index.ts | Background job entry |

## Core Business Logic
| Location | Purpose |
|----------|---------|
| src/core/auth/ | Authentication system |
| src/core/billing/ | Payment processing |
| src/core/workflows/ | Main workflow engine |

## Configuration
| Location | Purpose |
|----------|---------|
| src/config/index.ts | Environment config |
| src/config/features.ts | Feature flags |
| drizzle.config.ts | Database config |

## Key Patterns
| Pattern | Example Location | Notes |
|---------|------------------|-------|
| Service Layer | src/services/user.ts | Business logic encapsulation |
| Repository | src/repos/user.ts | Data access abstraction |
| Middleware | src/middleware/auth.ts | Request processing |

## Testing
| Location | Purpose |
|----------|---------|
| tests/unit/ | Unit tests |
| tests/integration/ | API tests |
| tests/e2e/ | End-to-end tests |
| tests/fixtures/ | Test data |

## Gotchas & Non-Obvious Behavior
| Location | Issue | Notes |
|----------|-------|-------|
| src/utils/date.ts | Timezone handling | Always use UTC internally |
| src/api/middleware.ts:45 | Auth bypass | Skip auth for health checks |
| src/db/pool.ts | Connection limit | Max 10 connections in dev |

CLAUDE.md Session Rules

Add this section to CLAUDE.md:

markdown
## Session Management

**IMPORTANT**: Follow session-management.md skill. Update session state at natural breakpoints.

### After Every Task Completion
Ask yourself:
1. Was a decision made? → Log to `decisions.md`
2. Did this take >10 tool calls? → Full checkpoint to `current-state.md`
3. Is a major feature complete? → Create archive entry
4. Otherwise → Quick update to `current-state.md`

### Checkpoint Triggers
**Quick Update** (current-state.md):
- After any todo completion
- After small changes

**Full Checkpoint** (current-state.md + decisions.md):
- After significant changes
- After ~20 tool calls
- After any decision
- When switching focus areas

**Archive** (archive/ + full checkpoint):
- End of session
- Major feature complete
- Context feels heavy

### Session Start Protocol
When beginning work:
1. Read `_project_specs/session/current-state.md`
2. Check `_project_specs/todos/active.md`
3. Review recent `decisions.md` entries if needed
4. Continue from "Next Steps"

### Session End Protocol
Before ending or when context limit approaches:
1. Create archive: `_project_specs/session/archive/YYYY-MM-DD.md`
2. Update current-state.md with handoff format
3. Ensure next steps are specific and actionable

Compression Strategies

When to Compress (Tier 3 Archive)
TriggerAction
~50+ tool callsSummarize progress, archive verbose notes
Major feature completeArchive feature details, update landmarks
Context shiftSummarize previous context, archive, start fresh
End of sessionFull session handoff with archive
What to Keep vs Archive

Keep in active context:

  • Current task and immediate next steps
  • Active file list with status
  • Blocking issues
  • Key decisions affecting current work

Archive/summarize:

  • Exploration paths that didn't work out
  • Detailed debugging traces (keep conclusion only)
  • Verbose error messages (keep root cause only)
  • Research notes (keep recommendations only)
Compression Template

When compressing, use this format:

markdown
## Compressed Context - [Topic]

**Summary**: [1-2 sentences]

**Key Findings**:
- [Bullet points of important discoveries]

**Decisions Made**:
- [Reference to decisions.md entries]

**Relevant Code**:
- [File:line references]

**Archived Details**: [Link to archive file if created]

Session Archive

After significant work or at session end, create archive:

_project_specs/session/archive/YYYY-MM-DD[-topic].md

markdown
# Session Archive: [Date] - [Topic]

## Summary
[Paragraph summarizing what was accomplished]

## Tasks Completed
- [TODO-XXX] Description - Done
- [TODO-YYY] Description - Done

## Key Decisions
- [Reference decisions.md entries made this session]

## Code Changes
| File | Change Type | Description |
|------|-------------|-------------|
| src/auth/login.ts | Created | Login endpoint |
| src/auth/types.ts | Modified | Added RefreshToken type |

## Tests Added
- tests/auth/login.test.ts - Login flow tests
- tests/auth/refresh.test.ts - Token refresh tests

## Open Items Carried Forward
- [Anything not finished, now in active.md]

## Session Stats
- Duration: ~3 hours
- Tool calls: ~120
- Files modified: 8
- Tests added: 12

Integration with Todo System

In active todos, reference session context:

markdown
## [TODO-042] Implement token refresh

**Status:** in-progress
**Session Context:** See current-state.md

### Progress Notes
- 2025-01-15: Started implementation, base structure done
- 2025-01-15: Added rotation logic, need error handling
Auto-Update on Todo Completion

When completing a todo:

  1. Mark todo complete in active.md
  2. Update current-state.md progress
  3. Log any decisions made
  4. Update code-landmarks.md if new patterns introduced

Show full SKILL.md (257 more words)Show less

Quick Commands

Add to project scripts or aliases:

bash
# Show current session state
alias session-status="cat _project_specs/session/current-state.md"

# Quick edit session state
alias session-edit="$EDITOR _project_specs/session/current-state.md"

# View recent decisions
alias decisions="tail -100 _project_specs/session/decisions.md"

# Create session archive
session-archive() {
  cp _project_specs/session/current-state.md \
     "_project_specs/session/archive/$(date +%Y-%m-%d).md"
  echo "Archived to _project_specs/session/archive/$(date +%Y-%m-%d).md"
}

Enforcement Mechanisms

1. CLAUDE.md as Entry Point

CLAUDE.md must reference session-management.md in the Skills section. Claude reads CLAUDE.md first, which directs it to follow session rules.

2. Session File Headers with Reminders

Include enforcement reminders in session file headers:

current-state.md header:

markdown
<!--
CHECKPOINT RULES (from session-management.md):
- Quick update: After any todo completion
- Full checkpoint: After ~20 tool calls or decisions
- Archive: End of session or major feature complete
-->
3. Self-Check Questions

After completing any task, Claude should ask:

□ Did I make a decision? → Log it
□ Did this take >10 tool calls? → Full checkpoint
□ Is a feature complete? → Archive
□ Am I ending/switching context? → Archive + handoff
4. Session Start Verification

When starting a session, Claude must:

  1. Check if current-state.md exists and read it
  2. Announce what it found: "Resuming from: [last state]"
  3. Confirm next steps before proceeding
5. Periodic Self-Audit

Every ~20 tool calls, Claude should check:

  • Is current-state.md up to date?
  • Are there unlogged decisions?
  • Is context getting heavy?
6. User Prompts

Users can enforce by asking:

  • "Update session state" → Triggers checkpoint
  • "What's the current state?" → Claude reads and reports
  • "End session" → Triggers archive + handoff
  • "Resume from last session" → Claude reads state files first

Anti-Patterns

  • No state tracking - Flying blind, can't resume
  • Overly verbose state - Keep it scannable, not a novel
  • Stale state files - Update regularly or they become useless
  • Missing decisions - Future you won't remember why
  • No code landmarks - Wastes time re-discovering the codebase
  • Never archiving - Session files become cluttered
  • Ignoring compression signals - Context overload degrades performance
  • Skipping checkpoint after decisions - Key context lost
  • No handoff at session end - Next session starts blind

Quick Reference

Checkpoint Decision Tree
Task completed?
    │
    ├── Decision made? ──────────────────→ Log to decisions.md
    │
    ├── >10 tool calls OR significant? ──→ Full Checkpoint
    │
    ├── Major feature done? ─────────────→ Archive
    │
    └── Otherwise ───────────────────────→ Quick Update
Files at a Glance
FileUpdate FrequencyPurpose
current-state.mdEvery taskLive state, next steps
decisions.mdWhen decidingArchitectural choices
code-landmarks.mdWhen patterns changeCode navigation
archive/*.mdEnd of session/featureHistorical record

© alinaqi, MIT. 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 skills/session-management of alinaqi/maggy.

Open the folder on GitHubat commit 72a456e

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 skillalinaqi/maggy707—~3.6kAutomated safety check: PassMIT
Spark Reportbreakstageaxe61/genspark-claw159—~738Automated safety check: PassMIT
Tldr Promptgithub/awesome-copilot40k1 repos~3.1kAutomated safety check: PassMIT
Vss Search ArchiveNVIDIA/skills3.5k—~4.2kAutomated safety check: PassApache-2.0
Summarizationdigipulse-engineering/GAAI-framework163—~863Automated safety check: PassCustom licence
Stakeholder Summarytestdouble/han279—~6.3kAutomated safety check: PassMIT

Similar skills

  • Spark Report

    breakstageaxe61/genspark-claw

    Turn raw research, notes, links, or a conversation into a polished, shareable Sparkpage-style report page with an executive summary, structured sections, tables, and citations.

    159 GitHub stars~738 tokensUpdated 13 days ago
    Writing & ContentAuto-check passed
  • Tldr Prompt

    github/awesome-copilot

    Official

    Create tldr summaries for GitHub Copilot files (prompts, agents, instructions, collections), MCP servers, or documentation from URLs and queries.

    40k GitHub starsUsed in 1 repo~3.1k tokens
    Writing & ContentAuto-check passed
  • Vss Search Archive

    NVIDIA/skills

    Official

    A skill your agent uses to run top-level VSS fusion search on archived video, or to ingest video files / RTSP streams for search.

    3.5k GitHub stars~4.2k tokensUpdated today
    Writing & ContentAuto-check passed
  • Summarization

    digipulse-engineering/GAAI-framework

    Transform large, noisy, or short-term memory into compact, durable, high-signal summaries.

    163 GitHub stars~863 tokensUpdated 10 days ago
    Writing & ContentAuto-check passed
  • Stakeholder Summary

    testdouble/han

    Produces a plain-language stakeholder summary from an existing feature specification, for sharing with non-technical stakeholders before implementation kicks off.

    279 GitHub stars~6.3k tokensUpdated 8 days ago
    Writing & ContentAuto-check passed
  • Artifact Type Tailored Context

    closedloop-ai/claude-plugins

    Compresses artifacts for judge evaluation. An agent skill from closedloop-ai/claude-plugins.

    122 GitHub stars~2.1k tokensUpdated yesterday
    Writing & ContentAuto-check: notes

More from alinaqi/maggy

All 71 skills in this repo
  • Aeo Optimization

    alinaqi/maggy

    AI Engine Optimization - semantic triples, page templates, content clusters for AI citations

    707 GitHub stars~3.7k tokensUpdated 15 days ago
    Auto-check passed
  • Agent Teams

    alinaqi/maggy

    Claude Code Agent Teams - default team-based development with strict TDD pipeline enforcement

    707 GitHub stars~5k tokensUpdated 15 days ago
    Auto-check: notes
  • AI Models

    alinaqi/maggy

    Latest AI models reference - Claude, OpenAI, Gemini, Eleven Labs, Replicate

    707 GitHub stars~4.1k tokensUpdated 15 days ago
    Auto-check passed
  • Android Java

    alinaqi/maggy

    Android Java development with MVVM, ViewBinding, and Espresso testing

    707 GitHub stars~3.9k tokensUpdated 15 days ago
    Auto-check: notes
  • Android Kotlin

    alinaqi/maggy

    Android Kotlin development with Coroutines, Jetpack Compose, Hilt, and MockK testing

    707 GitHub stars~3k tokensUpdated 15 days ago
    Auto-check passed
  • Autonomous Testing

    alinaqi/maggy

    AI-driven testing agent that auto-discovers, generates, executes, evaluates, and fixes tests for any project type

    707 GitHub stars~1.1k tokensUpdated 15 days ago
    Auto-check passed

Questions about Session Management

What does Session Management do?

Context preservation, tiered summarization, resumability. An agent skill from alinaqi/maggy. Session Management is an agent skill from alinaqi/maggy.

When should I use Session Management?

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

How do I install Session Management in Claude Code?

Run `npx skills add alinaqi/maggy --skill session-management -a claude-code`. Or copy the skill folder (skills/session-management in alinaqi/maggy) 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 alinaqi/maggy --skill session-management -a codex`. Or copy the skill folder (skills/session-management in alinaqi/maggy) 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 alinaqi/maggy --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?

SKILL.md names no scripts, command-line tools or credentials: Session Management is instructions for the agent only.

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 MIT 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.6k 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: Spark Report (breakstageaxe61/genspark-claw, 159 stars), Tldr Prompt (github/awesome-copilot, 40k stars), Vss Search Archive (NVIDIA/skills, 3.5k stars) and Summarization (digipulse-engineering/GAAI-framework, 163 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Session Management?

alinaqi (a GitHub user) maintains it in alinaqi/maggy, which has 707 GitHub stars. The repository holds 71 skills in this directory. The repository was last updated on September 24, 2026.

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