一键导入
shared-lifecycle
Process lifecycle management and auxiliary script rules for Ralph agents
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Process lifecycle management and auxiliary script rules for Ralph agents
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Complete Developer workflow orchestration - task research sequence, implementation flow, validation gates, PRD synchronization, exit conditions.
Complete Game Designer workflow - skill invocation protocol, GDD creation, playtest flow with GDD review, design sessions. MUST load before starting assignments.
Complete PM Coordinator workflow - task assignment, project orchestration, PRD management, worker coordination. Use proactively when starting PM agent work.
Complete PM Coordinator workflow - task assignment, project orchestration, PRD management, worker coordination. Use proactively when starting PM agent work.
Complete QA Validator workflow orchestration. References specialized skills for each validation step. Load at session startup for full protocol.
Base instructions and guidelines for all agents in the system. This skill provides foundational behaviors and communication protocols that all agents should follow.
| name | shared-lifecycle |
| description | Process lifecycle management and auxiliary script rules for Ralph agents |
"Cleanup after yourself. Don't leave processes running when you exit."
Location: ./.claude/session/process-registry.json
The registry tracks all running processes across all agents.
Format:
{
"version": "1.0",
"lastUpdated": "2026-01-26T10:00:00Z",
"processes": {
"dev-server-3000": {
"name": "dev-server",
"port": 3000,
"pid": 12345,
"agent": "qa",
"startedAt": "2026-01-26T09:55:00Z",
"command": "npm run dev",
"status": "running",
"purpose": "browser-validation"
}
},
"agents": {
"qa": ["dev-server-3000"],
"developer": [],
"pm": []
}
}
Check registry:
Read: ./.claude/session/process-registry.json
Update registry:
Edit: ./.claude/session/process-registry.json
Using Bash tool with run_in_background=true:
# Start dev server in background
Bash(command="npm run dev", run_in_background=true)
# Returns: { shell_id: "abc123" }
Capture the shell_id — you need it for cleanup!
Before starting a process that binds to a port:
# Check if port is in use
Bash(command="netstat -an | grep :3000 || echo 'Port 3000 available'")
Before updating status to "idle" or reporting task complete:
# Kill the background process using shell_id
TaskStop(task_id="abc123")
CRITICAL: Always stop background processes before exit
Your work is transactional. The Watchdog considers you "busy" until you explicitly say otherwise.
./.claude/session/messages/{agent}/./.claude/session/pending-messages-{agent}.jsonMessages move from Inbox -> Transaction File. Once delivered, transaction file is the active batch lock.
./.claude/session/messages/.pending-messages-{agent}.json.You must explicitly signal when you are done with the current batch of messages.
Send a status_update message:
status_updatewatchdogidle, waiting, or readyEffect: This marks the batch as complete/available so Watchdog can safely unlock and deliver next queued batch.
Always cleanup in a finally pattern:
1. Start background process (capture shell_id)
2. Try:
- Do the work
3. Finally:
- Stop background process (TaskStop with shell_id)
- Update process registry
4. Only THEN: Update task status
Anti-pattern: ❌ Exiting without stopping background processes Good pattern: ✅ Always cleanup, even if work fails
Scripts in ./.claude/session/ help with automation and cleanup.
| Classification | Pattern | Retention |
|---|---|---|
| Temporary | *-runner.sh, msg-*.json, *.exit, *.tmp | Auto-delete after 1 hour |
| Reusable | Documented below | Persist across sessions |
| Unknown | Everything else | Manual cleanup |
If you create a helper script that provides value:
{agent}-{purpose}.sh./.claude/session/ executable by all agents| Don't | Do Instead |
|---|---|
| Start background processes without tracking | Capture shell_id, use for cleanup |
| Leave processes running after exit | Always cleanup before status update |
| Start same process multiple times | Check registry first |
| Assume someone else will cleanup | Cleanup your own processes |
| Use PowerShell Get-Content/Set-Content | Use Read/Write tools |
| Use manual temp file pattern | Use Edit tool |