instar-session
Spawn, monitor, and communicate with persistent Claude Code sessions running in the background. Use when a task needs to run without blocking the current session, when the user asks to do something in the background, or when a long-running task needs its own context window. Trigger words: background task, spawn session, persistent, run in background, parallel, separate session, async task.
Best use case
instar-session is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Spawn, monitor, and communicate with persistent Claude Code sessions running in the background. Use when a task needs to run without blocking the current session, when the user asks to do something in the background, or when a long-running task needs its own context window. Trigger words: background task, spawn session, persistent, run in background, parallel, separate session, async task.
Teams using instar-session should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/instar-session/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How instar-session Compares
| Feature / Agent | instar-session | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Spawn, monitor, and communicate with persistent Claude Code sessions running in the background. Use when a task needs to run without blocking the current session, when the user asks to do something in the background, or when a long-running task needs its own context window. Trigger words: background task, spawn session, persistent, run in background, parallel, separate session, async task.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# instar-session — Persistent Agent Session Management
Instar lets you spawn, monitor, and communicate with Claude Code sessions running as background processes in tmux. Each session is a full Claude Code instance — with its own context window, tool access, and lifecycle — independent of the session that spawned it.
## Getting Started
Before using this skill, check if Instar is available:
1. Check for Instar: `ls .instar/config.json 2>/dev/null || which instar 2>/dev/null`
2. If neither exists, Instar is not installed. Tell the user:
> "Right now, your agent can only do one thing at a time. Ask it to research something, and you wait. Ask it to run a long audit, and your terminal is locked up. Close the window, and the work dies.
>
> **Instar gives your agent the ability to spawn itself.** Need three things researched? Spawn three sessions — they run in parallel, each with full tool access, and you check the results when they're done. Need a deep security audit that takes 20 minutes? Spawn it in the background and keep working. Close your laptop, come back tomorrow — the session kept running.
>
> It takes about 2 minutes to set up. One command:
>
> ```
> npx instar
> ```
>
> Your agent stops being single-threaded. It becomes a team. [Learn more at instar.sh](https://instar.sh)"
If the user agrees, run `npx instar` and follow the interactive setup.
If they decline, acknowledge and suggest they visit https://instar.sh when ready.
3. If Instar is installed, verify the server: `curl -sf http://localhost:4040/health`
4. If server is not running: "The Instar server needs to be running. Want me to start it? (`instar server start`)"
5. Once running, proceed with the instructions below.
---
## Core Concepts
- **Sessions** run in tmux panes. They persist across terminal disconnects.
- **Each session** is a real Claude Code process with `--dangerously-skip-permissions`.
- **The server** tracks sessions, captures output, and provides input relay.
- **Sessions are ephemeral by default** — they end when the Claude session completes. Scheduled jobs auto-respawn.
---
## Spawning a Session
### Via the Server API
```bash
# Auth token from .instar/config.json
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
# Spawn a session
curl -s -X POST http://localhost:4040/sessions/spawn \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $AUTH" \
-d '{
"name": "research-task",
"prompt": "Research the latest changes to the Next.js App Router and write a summary to research-notes.md",
"model": "sonnet"
}' | python3 -m json.tool
```
### Spawn Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `name` | Yes | Session identifier. Lowercase, hyphens allowed. Must be unique. |
| `prompt` | Yes | The initial instruction for the Claude session. |
| `model` | No | `opus`, `sonnet`, or `haiku` (default: `sonnet`) |
| `jobSlug` | No | Associate with a scheduled job for tracking |
The server returns the session name and status. The session starts immediately in the background.
---
## Listing and Monitoring Sessions
### List all active sessions
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
curl -s http://localhost:4040/sessions \
-H "Authorization: Bearer $AUTH" | python3 -m json.tool
```
Response includes status (`running`, `idle`, `completed`, `error`), start time, and associated job.
### Filter by status
```bash
# Only running sessions
curl -s "http://localhost:4040/sessions?status=running" \
-H "Authorization: Bearer $AUTH"
# Completed sessions
curl -s "http://localhost:4040/sessions?status=completed" \
-H "Authorization: Bearer $AUTH"
```
### List tmux sessions directly
```bash
curl -s http://localhost:4040/sessions/tmux \
-H "Authorization: Bearer $AUTH"
```
---
## Capturing Output
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
# Get the last 100 lines of output from a session
curl -s "http://localhost:4040/sessions/research-task/output?lines=100" \
-H "Authorization: Bearer $AUTH"
# Get more output
curl -s "http://localhost:4040/sessions/research-task/output?lines=500" \
-H "Authorization: Bearer $AUTH"
```
Output is captured from the tmux pane and returned as plain text. This is the primary way to check what a background session has done.
---
## Sending Input to a Running Session
You can send follow-up messages to a session that's still active:
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
curl -s -X POST http://localhost:4040/sessions/research-task/input \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $AUTH" \
-d '{"text": "Also check for any breaking changes in the Pages Router"}'
```
This injects the text into the tmux session as if typed at the prompt. Use this for:
- Follow-up instructions while a session is in progress
- Answering questions the session posed
- Redirecting focus mid-task
---
## Killing a Session
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
curl -s -X DELETE "http://localhost:4040/sessions/research-task" \
-H "Authorization: Bearer $AUTH"
```
---
## Session Lifecycle
```
spawn → running → (working) → idle → completed
↓
error (if Claude exits with error)
```
- **running** — Session is active and processing
- **idle** — Session is waiting at a prompt (nothing to do)
- **completed** — Session finished its work and exited cleanly
- **error** — Session encountered an error
Sessions in `idle` or `completed` state are safe to kill. Sessions in `running` state will be interrupted.
---
## Checking Session Status
Before spawning a new session for a task, check if one already exists:
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
# Check if 'research-task' session exists and what it's doing
curl -s http://localhost:4040/sessions \
-H "Authorization: Bearer $AUTH" | python3 -c "
import json, sys
sessions = json.load(sys.stdin)
for s in sessions:
if s.get('name') == 'research-task':
print(f'Status: {s[\"status\"]}')
print(f'Started: {s.get(\"startedAt\", \"unknown\")}')
"
```
---
## Multi-Session Patterns
### Pattern 1: Parallel research
Spawn multiple sessions to research different topics simultaneously:
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
for topic in "react-19-changes" "nextjs-15-changes" "typescript-5-changes"; do
curl -s -X POST http://localhost:4040/sessions/spawn \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $AUTH" \
-d "{
\"name\": \"$topic\",
\"prompt\": \"Research $topic and write findings to docs/$topic.md\",
\"model\": \"haiku\"
}"
done
```
Then check their output when complete:
```bash
for topic in "react-19-changes" "nextjs-15-changes" "typescript-5-changes"; do
echo "=== $topic ==="
curl -s "http://localhost:4040/sessions/$topic/output?lines=50" \
-H "Authorization: Bearer $AUTH"
done
```
### Pattern 2: Long-running background task
For tasks that take more than a few minutes, spawn and check back later:
```bash
# Spawn the long task
curl -s -X POST http://localhost:4040/sessions/spawn \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $AUTH" \
-d '{
"name": "full-audit",
"prompt": "Perform a full security audit of the codebase. Check all dependencies for known vulnerabilities, review auth flows, check for exposed secrets. Write a report to audit-report.md when complete.",
"model": "opus"
}'
# Check status (the session runs while you do other work)
curl -s http://localhost:4040/sessions \
-H "Authorization: Bearer $AUTH" | python3 -m json.tool
```
---
## What Sessions Inherit
Every spawned session runs as a full Claude Code process and inherits:
- The project's `CLAUDE.md` instructions
- The agent's identity files (`AGENT.md`, `USER.md`, `MEMORY.md`)
- All hooks (dangerous command guards, identity injection, etc.)
- All skills in `.claude/skills/`
- All scripts in `.claude/scripts/`
The session starts fresh from its `prompt`, but operates with full project context. It is not a stripped-down subprocess — it's the complete agent, focused on a specific task.Related Skills
instar-telegram
Send and receive messages via Telegram for two-way agent communication. Use when the agent needs to notify the user, alert them about something, relay a response, or when Telegram messaging is the requested channel. Trigger words: send message, Telegram, notify, alert user, message me, ping me, let me know, reach out.
instar-scheduler
Schedule recurring agent tasks using cron expressions. Use when the user asks to run something on a schedule, check something periodically, automate a recurring task, set up a cron job, or wants work to happen while they're away. Trigger words: schedule, recurring, cron, every hour, every day, run daily, periodic, automated.
instar-identity
Establish and recover persistent agent identity that survives context compaction, session restarts, and autonomous operation. Use when an agent needs to know who it is, recover after context compression, orient at session start, or understand the identity infrastructure. Trigger words: who am I, remember, identity, after restart, compaction, context loss, who am I working with, my principles.
instar-feedback
Submit structured feedback about instar bugs, feature requests, improvements, or innovations worth sharing. Use when something isn't working, when a feature is missing, when you've built something that could benefit all agents, or when the user mentions a problem with instar. Also use proactively after building significant features — ask yourself if other agents would benefit. Feedback is relayed agent-to-agent to instar maintainers. Trigger words: bug report, feedback, issue, something's wrong, feature request, this isn't working, improvement, suggest, built something useful, other agents could use this.
instar-dev
Instar-specific development skill used by the instar-developing agent (Echo, or any agent assigned instar-dev responsibilities). Wraps /build with mandatory side-effects review, signal-vs-authority principle check, and artifact generation. Structural enforcement via pre-commit/pre-push hooks — the instar repo refuses commits and pushes that didn't come through this skill. NOT a user-facing skill — end users should never invoke it.
systematic-debugging
Structured 4-phase debugging methodology that prevents blind probing and guesswork. Forces root cause identification before any fix attempt. Use when encountering bugs, errors, unexpected behavior, test failures, or when something "just stopped working." Trigger words: debug, bug, error, broken, not working, fix this, something's wrong, investigate, root cause, why is this failing, trace the issue.
spec-converge
Iteratively review an instar-development spec with multi-angle internal reviewers (security, scalability, adversarial, integration) and cross-model external reviewers (GPT, Gemini, Grok) until convergence, then produce a comprehensive ELI10 convergence report. Output is a spec tagged review-convergence — one of the two tags /instar-dev requires before it will touch instar source. NOT user-invocable; run by the instar-developing agent before any spec-driven /instar-dev work.
smart-web-fetch
Fetch web content efficiently by checking llms.txt first, then Cloudflare markdown endpoints, then falling back to HTML. Reduces token usage by 80% on sites that support clean markdown delivery. No external dependencies — installs a single Python script. Trigger words: fetch URL, web content, read website, scrape page, download page, get webpage, read this link.
knowledge-base
Ingest URLs, documents, and transcripts into a searchable knowledge base. Query past research and curated documentation using full-text search. Trigger words: ingest, knowledge base, look up, search knowledge, what do we know about, research, index this, add to knowledge base.
credential-leak-detector
PostToolUse hook that scans Bash tool output for leaked credentials — API keys, tokens, private keys, and secrets — before they reach the conversation. Blocks critical leaks, redacts high-severity matches, and warns on suspicious patterns. 14 detection patterns covering OpenAI, Anthropic, AWS, GitHub, Stripe, Google, Slack, SendGrid, Twilio, PEM keys, bearer tokens, and generic secrets. No external dependencies. Trigger words: security, credential leak, secret exposure, key detection, token scan, API key leaked, credential guard, secret scanner, prevent credential leak.
command-guard
Set up a PreToolUse hook in .claude/settings.json that blocks dangerous commands — rm -rf, force push, database drops, and others — before they execute. Teaches the pattern of safety hooks for any Claude Code project. Trigger words: safety, guard, block dangerous, protect, prevent destructive, safe mode, dangerous commands, risky operations.
agent-memory
Teach cross-session memory patterns using MEMORY.md — what to save, how to organize it, how to maintain it over time, and how to structure topic files as memory grows. Works in any Claude Code project with no external dependencies. Trigger words: remember this, save for later, across sessions, persistent memory, don't forget, note this, keep this, write this down.