Agent Skills › dtyq/magic › startup-manager

startup-manager

GitHub

管理沙箱启动脚本,用于在重建后自动恢复依赖和状态。支持注册、测试及移除启动任务,确保环境一致性。

backend/super-magic/agents/skills/startup-manager/SKILL.md dtyq/magic

触发场景

用户询问沙箱启动时运行的命令 需要在沙箱重建后自动恢复本地依赖或状态

安装

npx skills add dtyq/magic --skill startup-manager -g -y
更多选项

非标准路径

npx skills add https://github.com/dtyq/magic/tree/master/backend/super-magic/agents/skills/startup-manager -g -y

不安装直接使用

npx skills use dtyq/magic@startup-manager

指定 Agent (Claude Code)

npx skills add dtyq/magic --skill startup-manager -a claude-code -g -y

安装 repo 全部 skill

npx skills add dtyq/magic --all -g -y

预览 repo 内 skill

npx skills add dtyq/magic --list

SKILL.md

Frontmatter
{
    "name": "startup-manager",
    "description": "Register, inspect, test, or remove scripts that run every time this sandbox starts, such as reinstalling project dependencies onto local disk after a sandbox rebuild. Use when dependencies or other local state must come back automatically, or when the user asks what runs at sandbox startup. Not for inspecting, upgrading, or restarting the sandbox itself (use sandbox-manager) or for clock-based schedules (use using-cron)."
}

Startup Manager

A startup task is a shell script stored in .workspace/.magic/startup/<task_id>.md. After every sandbox start, all enabled tasks run once, one after another, in the background.

1. When to use

Situation Use
Dependencies or other local state must come back after a sandbox rebuild This skill
Run something at a time of day or on an interval using-cron
Inspect, upgrade, or restart the sandbox itself sandbox-manager

Check the Runtime Environment section in the system prompt. In a cloud sandbox, a rebuild empties local disk, so startup tasks are what bring dependencies back. On a local machine, dependencies are not lost; do not suggest a startup task unless the user asks for one. If they do, it runs every time the service starts.

2. Ask the user first

Tell the user that the script will run automatically every time the sandbox starts, and show the script. Pass confirmed: True only after the user agrees. Creating a task, changing its script, and enabling it all require this confirmation; without it the tool returns confirmation_required.

3. Write idempotent scripts

After a rebuild, dependency directories are empty, not missing. Never use "the directory exists" to decide that dependencies are installed. Use the package manager's own idempotent install:

  • npm: npm install
  • pnpm: pnpm install --frozen-lockfile
  • Python venv:
    [ -x .venv/bin/python ] || python3 -m venv .venv
    .venv/bin/pip install -r requirements.txt
    
  • uv: uv sync
  • Composer: composer install

Scripts must not wait for input. Set workdir to the project directory relative to .workspace instead of starting the script with cd.

4. How tasks run

  • Tasks run in the background after each sandbox start. They never block the conversation and never notify anyone.
  • Each run is a normal background shell task, so its output can be read with shell_await.
  • Results only exist for the current sandbox session. You do not need to check them routinely; check them when something looks wrong, such as a missing dependency.
  • A task copied from another project, for example through import or sharing, is skipped until the user confirms it for the current project.

5. Tools

All tools are called through Code Mode and return a readable result.content.

Register a task, then test it right away:

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("startup_task_create", {
    "name": "my-app deps",
    "workdir": "my-app",
    "script": "npm install",
    "confirmed": True,
})
print(result.content)
if result.ok:
    run = tool.call("startup_task_run", {"task_id": result.data["task_id"]})
    print(run.content)
""")

If the run moved to the background, wait for it with the shell_await call given in run.content until it finishes, and confirm it succeeded.

Other operations:

run_sdk_snippet(python_code="""
from sdk.tool import tool

print(tool.call("startup_task_list", {}).content)
print(tool.call("startup_task_update", {"task_id": "my-app-deps", "timeout_seconds": 1800}).content)
print(tool.call("startup_task_delete", {"task_id": "my-app-deps"}).content)
""")

startup_task_update changes only the fields you pass. Changing script or passing enabled: True also requires confirmed: True.

6. Read the status

startup_task_list reports how each task ran after this sandbox started:

Status What to do
Running Wait with shell_await on its background task ID, then retry your command
Succeeded Nothing
Failed Read the output or log, fix the script or install manually, and tell the user
Stopped after timeout Read the log; raise timeout_seconds only if the install was still progressing
Skipped, disabled Enable it only if the user wants it
Skipped, confirmed in a different project Ask the user again, then call startup_task_update with enabled: True and confirmed: True
Not run yet The startup round has not reached it, or it was never run in this session

版本历史

  • 0f1432c 当前 2026-11-03 04:33

同 Skill 集合

backend/super-magic/agents/skills/agent-info/SKILL.md
backend/super-magic/agents/skills/canvas-designer/SKILL.md
backend/super-magic/agents/skills/chat-history/SKILL.md
backend/super-magic/agents/skills/cli-manager/SKILL.md
backend/super-magic/agents/skills/compact-chat-history/SKILL.md
backend/super-magic/agents/skills/creating-slides/SKILL.md
backend/super-magic/agents/skills/develop-data-analysis-dashboard/SKILL.md
backend/super-magic/agents/skills/document-converter/SKILL.md
backend/super-magic/agents/skills/download/SKILL.md
backend/super-magic/agents/skills/env-manager/SKILL.md
backend/super-magic/agents/skills/file-bundle/SKILL.md
backend/super-magic/agents/skills/html-design-style/SKILL.md
backend/super-magic/agents/skills/im-channels/SKILL.md
backend/super-magic/agents/skills/magic-calendar/SKILL.md
backend/super-magic/agents/skills/magicbase/SKILL.md
backend/super-magic/agents/skills/micro-app-architect/SKILL.md
backend/super-magic/agents/skills/persona-research/SKILL.md
backend/super-magic/agents/skills/sandbox-manager/SKILL.md
backend/super-magic/agents/skills/self-media-pre-publish-analyzer/SKILL.md
backend/super-magic/agents/skills/share/SKILL.md
backend/super-magic/agents/skills/skill-vetter/SKILL.md
backend/super-magic/agents/skills/slide-template-maker/SKILL.md
backend/super-magic/agents/skills/slide-template-replacement/SKILL.md
backend/super-magic/agents/skills/subagents/SKILL.md
backend/super-magic/agents/skills/super-magic/SKILL.md
backend/super-magic/agents/skills/teamshare-cli/SKILL.md
backend/super-magic/agents/skills/use-magicbase/SKILL.md
backend/super-magic/agents/skills/user-info/SKILL.md
backend/super-magic/agents/skills/using-cron/SKILL.md
backend/super-magic/agents/skills/using-llm/SKILL.md
backend/super-magic/agents/skills/using-mcp/SKILL.md
frontend/magic-web/.agents/skills/antd-style-to-tailwind/SKILL.md
frontend/magic-web/.agents/skills/code-review-expert/SKILL.md
frontend/magic-web/.agents/skills/dual-edition-module-migration/SKILL.md
frontend/magic-web/.agents/skills/frontend-storage-requirements/SKILL.md
frontend/magic-web/.agents/skills/magic-web-error-logging/SKILL.md
frontend/magic-web/.agents/skills/sw-best-practices/SKILL.md
frontend/magic-web/.agents/skills/ui-data-testid/SKILL.md
frontend/magic-web/.agents/skills/vercel-composition-patterns/SKILL.md
frontend/magic-web/.agents/skills/vercel-react-best-practices/SKILL.md
backend/super-magic/agents/skills/ai-card-generator/SKILL.md
backend/super-magic/agents/skills/canvas-manager/SKILL.md
backend/super-magic/agents/skills/crew-creator/SKILL.md
backend/super-magic/agents/skills/deep-research/SKILL.md
backend/super-magic/agents/skills/dingtalk-cli/SKILL.md
backend/super-magic/agents/skills/html-api-sdk/SKILL.md
backend/super-magic/agents/skills/html-app-architect/SKILL.md
backend/super-magic/agents/skills/lark-cli/SKILL.md
backend/super-magic/agents/skills/memory/SKILL.md

元信息

文件数
0
版本
0f1432c
Hash
15fd618a
收录时间
2026-11-03 04:33

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-11-04 12:32
浙ICP备14020137号-1