Agent skill
new-session
Start a new session when context is high. Claude uses /clear, Codex uses /exit. Use when context is high or when a fresh session is needed.
Install this agent skill to your Project
npx add-skill https://github.com/zylos-ai/zylos-core/tree/main/skills/new-session
SKILL.md
New Session Skill
Start a fresh session with graceful handoff. Use runtime-specific switch commands:
- Claude:
/clear - Codex:
/exit
When to Use
- Context usage exceeds the runtime threshold (triggered automatically by context monitoring)
- User explicitly asks for a new session or context reset
- When you need a clean context but don't need to reload settings/hooks (use restart-claude for that)
Pre-Switch Checklist
Before sending the session switch command, complete these steps in order:
1. Inventory running background tasks
Check for running background agents using the current runtime's available agent/task listing capability. For Claude, this is TaskList.
Runtime behavior differs here:
- Claude: background subagents survive
/clear, so do not stop them. - Codex:
/exitterminates background tasks. Before enqueueing/exit, make sure required background work has finished.
For each running task, note:
- Agent ID (e.g.,
a42c1aabc5b984e69) - What it's doing (brief description)
- Output file path (so the new session can check on it)
This information goes into the handoff summary (step 2).
2. Write a session handoff summary
Write a brief message covering:
- What was being worked on (active tasks, user requests in progress)
- Current state (what's done, what's pending, any blockers)
- Running background tasks (from step 1 — include agent/task IDs and any output file paths or result handles so the new session can check on them with the runtime-appropriate output mechanism)
- What the next session should pick up (if anything)
3. Send the handoff summary
Determine who to notify:
- If actively collaborating with a user: Send the summary to that user's channel via C4 (their
reply viapath). This keeps the user informed AND records the context into C4 conversation history. - If no active user conversation: Send the summary to the web console channel. This still records it into C4 so the new session's startup hook (c4-session-init) will include it in the conversation context.
The goal is twofold: (a) the user knows what's happening, and (b) the handoff summary appears in C4 conversation history, so the new session can seamlessly continue the work.
4. Enqueue Session Switch Command
For Codex:
node ~/zylos/.claude/skills/comm-bridge/scripts/c4-control.js enqueue --content "/exit" --priority 1 --block-queue-until-idle --no-ack-suffix
For Claude:
node ~/zylos/.claude/skills/comm-bridge/scripts/c4-control.js enqueue --content "/clear" --priority 1 --block-queue-until-idle --no-ack-suffix
How It Works
- Early memory sync (handled by context-monitor, not this skill): At 80% of the session-switch threshold, the context monitor triggers memory sync in the background. The new session's startup hook also checks for unsummarized conversations and triggers sync if needed — so memory sync is never lost, at most delayed by one session.
- Pre-switch checks: Inventory background tasks, write handoff summary.
- Enqueue switch command: Puts the runtime-specific command into the control queue (
/clearfor Claude,/exitfor Codex) - Deliver when idle: Dispatcher delivers the command when idle
- Session switches:
- Claude:
/clearresets conversation context, session-start hooks fire, and background subagents continue independently - Codex:
/exitexits the current session so a fresh one can start
- Claude:
- New session: Session-start hooks fire, including memory sync if unsummarized conversations exceed threshold.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
web-console
Built-in web interface for communicating with Claude without external services. Use when setting up or configuring the web console channel, or troubleshooting browser-based access.
component-management
Guidelines for managing zylos components via CLI and C4 channels. Use when installing, upgrading, or uninstalling components, or when user asks about available components.
restart-claude
Use when the user asks to restart Claude Code, or after changing settings/hooks/keybindings.
comm-bridge
C4 communication bridge — central gateway for ALL external communication (Telegram, Lark, etc.). Use when replying to users via the "reply via" path, sending proactive messages to external channels, querying recent conversations or checkpoint status (prefer c4-db.js CLI; sqlite3 OK for unsupported queries), fetching conversation history for Memory Sync, or creating checkpoints after sync. Incoming messages are queued by channel bots and delivered to Claude via a PM2 dispatcher daemon. Session-start hooks automatically provide conversation context and can trigger Memory Sync when unsummarized conversations exceed the configured threshold.
http
Caddy-based web server providing web console hosting, file sharing, and health check endpoints. Use when configuring HTTP access, setting up file sharing, or troubleshooting web connectivity.
health-check
System health check dispatched by the activity monitor via Control queue. Checks PM2 services, disk space, and memory usage. Use when receiving a control message containing "health-check".
Didn't find tool you were looking for?