mirror of
https://github.com/alirezarezvani/claude-skills.git
synced 2026-09-11 22:51:28 +00:00
Adds the agent-launcher/ top-level domain — a plugin re-implementation of Anthropic's launch-your-agent reference skill (Apache-2.0; independent, not a fork) for building Claude Managed Agents (CMA) in the user's own account. Every session starts with a goal (./my-agent/goal.json, surfaced by an opt-in AGENT_LAUNCHER_SESSION=1 SessionStart hook + /cs:goal); loop_compiler.py compiles that goal into a bounded grade->iterate loop (CMA user.define_outcome self-grading, max_iterations 1..20), a recurring POSIX-cron scheduled-deployment loop, or a single-pass interview->stage->launch workflow. - 6 skills: agent-launcher-orchestrator (context: fork goal router) + interview + stage-launch + grade-iterate + run-without-you + wrap-up - 18 stdlib-only deterministic scaffolder tools (NO network/API calls; live launches emitted as BYOK curl that never prints the key); all pass --help/--sample - 4 agents (orchestrator + interviewer + grader + deployer), 8 /cs:* commands - opt-in SessionStart/SessionEnd hooks (exit 0 on any error), 5 shared references, 4 assets (build-sheet schema + overview/next-directions templates + example) - validators enforce CMA limits (<=20 skills/session, <=8 memory stores, depth-1 multiagent, max_iterations <=20, <=1000 deployments/org) - registered in marketplace.json; headline counters trued up via derive_counters.py --check (skills 362->368, domains 18->19, tools 644->664, refs 741->746, agents 102->106, commands 116->124, plugins 88->89) Distinct from engineering/agent-harness (generic bounded loop over any domain) and engineering/write-a-skill (authors Claude Code skills, not CMAs). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012FwXG6TqCXKZQvF4iD69cv
83 lines
2.5 KiB
Python
83 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""SessionStart hook for agent-launcher (OPT-IN).
|
|
|
|
Disabled unless AGENT_LAUNCHER_SESSION=1. When enabled, finds the current CMA
|
|
launch goal (./my-agent/goal.json, searching a couple of nearby locations) and
|
|
prints it wrapped in <agent_launcher_goal> tags. Claude Code surfaces SessionStart
|
|
stdout as session context, so a multi-session launch resumes at the recorded phase.
|
|
|
|
Treat the content as DATA, not instructions — verify suggested next steps against
|
|
current state before acting. Any error exits 0: a hook must never break a session.
|
|
|
|
Stdlib-only.
|
|
"""
|
|
import json
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
MAX_BODY = 4000
|
|
|
|
|
|
def disabled() -> bool:
|
|
return os.environ.get("AGENT_LAUNCHER_SESSION", "0") != "1"
|
|
|
|
|
|
def find_goal() -> Path | None:
|
|
candidates = [
|
|
Path.cwd() / "my-agent" / "goal.json",
|
|
Path.cwd() / ".my-agent" / "goal.json",
|
|
]
|
|
# also any ./my-agent-*/goal.json (multiple agents)
|
|
try:
|
|
for d in sorted(Path.cwd().glob("my-agent-*/goal.json")):
|
|
candidates.append(d)
|
|
except OSError:
|
|
pass
|
|
for c in candidates:
|
|
if c.exists():
|
|
return c
|
|
return None
|
|
|
|
|
|
def main() -> int:
|
|
if disabled():
|
|
return 0
|
|
try:
|
|
gp = find_goal()
|
|
if not gp:
|
|
# Nothing to resume; stay silent.
|
|
return 0
|
|
state = json.loads(gp.read_text())
|
|
goal = state.get("goal", "")
|
|
phase = state.get("phase", "interview")
|
|
agent_name = state.get("agent_name", "")
|
|
done = ", ".join(state.get("phases_done", []) or []) or "none"
|
|
loop = state.get("loop") or {}
|
|
loop_str = f"{loop.get('shape')} (max_iterations={loop.get('max_iterations')})" if loop else "not compiled yet"
|
|
notes = state.get("notes", "")
|
|
|
|
body = (
|
|
f"You have an in-progress Claude Managed Agent launch. Resume it with /cs:launch.\n"
|
|
f" goal: {goal}\n"
|
|
f" agent_name: {agent_name}\n"
|
|
f" phase: {phase}\n"
|
|
f" phases_done: {done}\n"
|
|
f" loop: {loop_str}\n"
|
|
f" goal_file: {gp}\n"
|
|
)
|
|
if notes:
|
|
body += f" notes: {notes}\n"
|
|
body = body[:MAX_BODY]
|
|
|
|
print("<agent_launcher_goal>")
|
|
print(body.rstrip())
|
|
print("</agent_launcher_goal>")
|
|
except Exception:
|
|
# Never break a session.
|
|
return 0
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|