maestro:agile-plan
SkillDev toolsRuns only when the user explicitly invokes $mst:agile-plan or /mst:agile-plan, or explicitly requests use of the agile-plan feature of MST/Gran Maestro/Maestro. It does not auto-activate on general requests.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the maestro:agile-plan skill
What this skill tells your AI
The instructions your AI receives, as published by myrtlepn/gran-maestro in skills/agile-plan/SKILL.md and read by ahel’s review.
Step -1: Explicit Invocation Gate (MANDATORY, NO MUTATION)
모든 user-invocable: true MST skill은 아래 중 하나가 명확할 때만 실행합니다.
- 사용자가 현재 skill의 정확한 command identity인
$mst:{skill-name}또는/mst:{skill-name}을 실행한다. - 사용자가 MST/Gran Maestro/Maestro 기능을 사용해서 현재 skill 작업을 하라고 명시적으로 요청한다.
- 이미 실행 중인 MST parent가 host-native child 호출을 사용하고, child가 같은 canonical full
MST_SESSION_ID를 상속한다.
{skill-name}은 현재 SKILL.md frontmatter의 exact name입니다. 다른 MST command의 언급, 인용문·로그·문서 예시, 부정문은 현재 skill 실행 요청이 아닙니다.
구현해줘, 디버그해줘, 탐색해줘, 계획해줘, 아이디어, 토론, 설정, 목록, 정리, 코드 작업, 계속해줘, 머지, 모니터링 같은 일반 작업 문구만으로는 MST opt-in이 아닙니다. 다른 지침의 일반적인 skill discovery 문구도 이 경계를 넓힐 수 없습니다.
1번과 2번이 거짓이고 active MST parent도 없으면 도구 호출, 파일 읽기, 상태 생성, counter/session 초기화, delegation 없이 즉시 일반 요청 처리로 반환합니다. 사용자가 텍스트에 SID나 parent처럼 보이는 값을 넣어도 active parent로 간주하지 않습니다.
Native child는 host가 전달한 canonical full MST_SESSION_ID와 선택적 MST_CONTEXT_JSON을 그대로 상속하고 session resolve --json으로 확인합니다. Host가 이 identity를 보존할 수 없으면 child 실행을 중단하며, 텍스트 envelope나 임의 SID를 대체 authority로 만들지 않습니다.
이 gate는 이 문서의 나머지 모든 단계와 include보다 먼저 수행합니다.
Explicit-only Canonical Session Bootstrap (MANDATORY)
이 블록은 바로 앞의 Explicit Invocation Gate를 통과한 뒤에만 실행하며, 실행 순서상 first protected mutation입니다. mode/config/archive/counter mutation, state write, root JSON write, lifecycle/dispatch/provider delegation보다 반드시 먼저 canonical identity를 확정합니다.
1. Root source 결정
- Skill body의
mst-session-class가identity-required여야 이 bootstrap을 실행합니다. Existing resource나 inherited parent가 있으면 그 root를 사용합니다. - 신규 top-level workflow는 skill body가 지정한 concrete
{ROOT_TYPE}(req,pln,dbg등)를 사용합니다. ID를 따로 예상하거나counter next로 먼저 예약하지 않습니다. - 부모 full
MST_SESSION_ID가 있으면 root 후보를 새로 만들지 않습니다. 함께 전달된 structuredMST_CONTEXT_JSON.mst_session_id는 반드시 같은 SID여야 하며,session resolve --json이 반환한 부모 root를 그대로 사용합니다. --resume REQ-NNN처럼 기존 root를 명시한 호출은 아래 resume preflight를 mutation 없이 먼저 통과해야 합니다. 해당 ID를{ROOT_ID}로 사용합니다.- 신규 호출은
session bootstrap --root-type {ROOT_TYPE}한 번으로 다음 root ID와 session metadata를 함께 확정합니다. 실패하면 같은 명령을 재시도할 수 있습니다.
Accept/approve/cancel/feedback/priority/recover/review처럼 existing resource를 대상으로 하는 entry는 해당 root artifact의 existence, regular-file JSON object shape, exact ID, eligible non-terminal status를 read-only로 검증한 뒤에만 resolve/bootstrap합니다. Bootstrap으로 missing target을 생성해 preflight를 통과시키는 것은 금지합니다.
Bootstrap 직전에 root source를 아래 두 변수 중 정확히 하나로 확정합니다.
- 기존 resource: read-only preflight를 통과한 exact ID를
ROOT_ID에 설정하고ROOT_TYPE은 비웁니다. - 신규 workflow: concrete namespace를
ROOT_TYPE에 설정하고ROOT_ID는 비웁니다.
둘 다 있거나 둘 다 없으면 mutation 없이 거부합니다. 특히 $mst:approve REQ-NNN처럼 existing-only entry는 반드시 ROOT_ID=REQ-NNN 경로를 사용하며 새 request counter를 발급하지 않습니다.
2. Resume preflight (READ-ONLY, ZERO MUTATION ON REJECTION)
request --resume REQ-NNN은 resolve/bootstrap보다 먼저 다음을 모두 read-only로 확인합니다.
{PROJECT_ROOT}/.gran-maestro/requests/REQ-NNN/request.json이 이미 존재하는 regular file이며 symlink가 아니다.- Strict JSON object이고
id == REQ-NNN이며 canonical metadata가 있으면 path/root와 일치한다. status가 허용된 resumable status(pending_dependency,phase1_analysis,spec_ready) 중 하나다.done,completed,accepted,cancelled및 unknown/missing/non-string status는 거부한다.--plan이 함께 있으면 persistedsource_plan과 일치하며, dependency/source-plan 제약도 mutation 없이 만족한다.
Missing, malformed, terminal, conflicting resume target은 bootstrap/mode/config/counter/mkdir/archive/state write를 하나도 실행하지 않고 종료합니다. Rejected resume 전후의 전체 filesystem tree가 동일해야 합니다. Resume artifact를 bootstrap으로 새로 생성해 존재 검사를 통과시키는 순서는 금지합니다.
3. Resolve 또는 bootstrap
- 부모 full
MST_SESSION_ID가 있으면session resolve --json으로 기존 SID를 검증·상속합니다. 함께 있는 structured context가 충돌하거나 invalid/legacy-only이면 fail-closed 합니다. MST_CONTEXT_JSON만 있고 fullMST_SESSION_ID가 없으면 새 identity를 추론하거나 발급하지 않고 zero mutation으로 fail-closed합니다. Native child는 host가 부모의 full SID를 상속해야 합니다.- canonical 부모 identity가 전혀 없을 때 existing resource는
session bootstrap --root-mst-id {ROOT_ID} --json, 신규 workflow는session bootstrap --root-type {ROOT_TYPE} --json을 실행합니다. - 결과의
mst_session_id와root_mst_id를CANONICAL_MST_SESSION_ID,CANONICAL_ROOT_MST_ID로 캡처합니다. 부모 호출에서는 자식 artifact ID로 root를 바꾸지 않습니다.
if [ -n "${MST_SESSION_ID:-}" ]; then
SESSION_IDENTITY_JSON=$(
MST_SESSION_ID="$MST_SESSION_ID" \
MST_CONTEXT_JSON="${MST_CONTEXT_JSON:-}" \
python3 "{PLUGIN_ROOT}/scripts/mst.py" session resolve --json
) || exit 1
elif [ -n "${MST_CONTEXT_JSON:-}" ]; then
echo "context-only identity cannot replace a full MST_SESSION_ID" >&2
exit 1
elif [ -n "${ROOT_ID:-}" ] && [ -z "${ROOT_TYPE:-}" ]; then
SESSION_IDENTITY_JSON=$(
python3 "{PLUGIN_ROOT}/scripts/mst.py" session bootstrap \
--root-mst-id "$ROOT_ID" --json
) || exit 1
elif [ -z "${ROOT_ID:-}" ] && [ -n "${ROOT_TYPE:-}" ]; then
SESSION_IDENTITY_JSON=$(
python3 "{PLUGIN_ROOT}/scripts/mst.py" session bootstrap \
--root-type "$ROOT_TYPE" --json
) || exit 1
else
echo "exactly one of ROOT_ID or ROOT_TYPE is required" >&2
exit 1
fi
4. Shell-safe canonical context 생성
기존 context의 모든 비-identity 필드를 보존하면서 canonical SID/root를 병합합니다. raw JSON을 single-quoted shell literal로 삽입하지 않습니다. CANONICAL_MST_CONTEXT_JSON은 논리적 JSON 값이며, subprocess 경계에서는 오직 ASCII CANONICAL_MST_CONTEXT_B64(base64url)로 운반합니다.
CANONICAL_MST_CONTEXT_B64=$(
SESSION_IDENTITY_JSON="$SESSION_IDENTITY_JSON" \
INPUT_MST_CONTEXT_JSON="${MST_CONTEXT_JSON:-}" \
python3 - <<'PY'
import base64, json, os, sys
MAX_CONTEXT_BYTES = 262144
identity = json.loads(os.environ["SESSION_IDENTITY_JSON"])
raw_context = os.environ.get("INPUT_MST_CONTEXT_JSON", "")
context = json.loads(raw_context) if raw_context else {}
if not isinstance(context, dict):
raise SystemExit("MST_CONTEXT_JSON must be a JSON object")
sid = identity["mst_session_id"]
root = identity["root_mst_id"]
if context.get("mst_session_id") not in (None, sid):
raise SystemExit("MST_CONTEXT_JSON mst_session_id mismatch")
if context.get("root_mst_id") not in (None, root):
raise SystemExit("MST_CONTEXT_JSON root_mst_id mismatch")
context["schema_version"] = 1
context["mst_session_id"] = sid
context["root_mst_id"] = root
wire = json.dumps(context, ensure_ascii=False, separators=(",", ":")).encode("utf-8")
if len(wire) > MAX_CONTEXT_BYTES:
raise SystemExit("canonical MST context exceeds MAX_CONTEXT_BYTES")
sys.stdout.write(base64.urlsafe_b64encode(wire).decode("ascii"))
PY
) || exit 1
5. MST_BOUND_SUBPROCESS — 모든 별도 subprocess에 재바인딩
서로 다른 tool/exec 호출은 별도 subprocess이므로 한 export에 의존하면 안 됩니다. shell function에도 의존하지 않습니다. 이후 모든 별도 mst.py, counter, timestamp, config, state, lifecycle, delegation, dispatch, provider CLI subprocess는 아래 MST_BOUND_SUBPROCESS 형태로 정확한 full SID와 base64url context를 리터럴로 반복 전달합니다. 뒤 단계의 prefix 없는 command 예시는 축약 표기일 뿐이며 실제 실행 전에 반드시 이 형태로 확장합니다.
MST_SESSION_ID="{CANONICAL_MST_SESSION_ID}" \
MST_CONTEXT_JSON="$(
MST_CONTEXT_B64="{CANONICAL_MST_CONTEXT_B64}" \
python3 -c 'import base64,os,sys;s=os.environ["MST_CONTEXT_B64"];MAX_CONTEXT_BYTES=262144;sys.exit("encoded MST context exceeds limit") if len(s)>349528 else None;raw=base64.b64decode(s.encode("ascii"),altchars=b"-_",validate=True);sys.exit("decoded MST context is oversized or non-canonical") if len(raw)>MAX_CONTEXT_BYTES or base64.urlsafe_b64encode(raw).decode("ascii")!=s else None;sys.stdout.buffer.write(raw)'
)" \
python3 "{PLUGIN_ROOT}/scripts/mst.py" {NEXT_COMMAND}
Decoder는 base64.b64decode(..., altchars=b"-_", validate=True)를 사용하고 decoded size를 MAX_CONTEXT_BYTES로 제한하며 canonical re-encoding equality를 요구합니다. Invalid alphabet, missing/extra padding, non-canonical spelling, oversize는 command 실행 전에 실패합니다.
Provider CLI를 직접 실행하는 허가된 external lane도 마지막 명령만 provider command로 바꾸고 동일한 두 환경 변수를 다시 구성합니다. apostrophe, command substitution, backtick, newline, shell metacharacter를 포함한 JSON도 decode 결과가 quoted environment assignment의 값으로만 들어가며 shell code로 재평가되어서는 안 됩니다. Shell command substitution은 trailing whitespace/newline byte identity를 보존하지 않으므로 raw input byte-equivalence를 약속하지 않습니다. 대신 Step 3에서 trailing whitespace 없는 canonical compact JSON으로 먼저 정규화한 뒤 그 canonical bytes만 encode/decode합니다.
Canonical Root Metadata Merge (MANDATORY)
session bootstrap은 root artifact의 JSON(session.json, plan.json, request.json)에 canonical metadata를 먼저 기록합니다. 이후 skill template write는 그 JSON을 replace/overwrite하지 않고 object merge해야 합니다. 기존 mst_session_id, root_mst_id, started_at, started_at_compact, random을 byte-for-byte 보존하고 workflow 필드만 병합합니다. 기존 canonical 필드가 bootstrap 결과와 다르면 fail-closed하며 identity를 재발급하지 않는다. 부모 SID를 상속한 child artifact처럼 파일이 아직 없을 때만 resolve 결과의 canonical field를 먼저 넣고 workflow field를 병합한다.
DBG-NNN/REQ-NNN 같은 root resource ID, host session ID, PID, transcript UUID, legacy alias는 full SID를 대신할 수 없습니다.
목적: /mst:agile-plan으로 JTBD + 프로젝트 DoD 중심의 objective.md를 생성한다. 이 스킬은 플래닝 전용이며 Story 생성/실행은 담당하지 않는다.
⚠️ 실행 제약 (CRITICAL — 항상 준수)
이 스킬 실행 중 Write/Edit 도구를 사용할 수 있는 경로는 아래만 해당합니다:
{PROJECT_ROOT}/.gran-maestro/agile/AGI-*/objective/objective.md(신규 생성){PROJECT_ROOT}/.gran-maestro/agile/AGI-*/objective/details/*.md(신규 생성){PROJECT_ROOT}/.gran-maestro/agile/AGI-*/objective/draft/objective.md(staged draft){PROJECT_ROOT}/.gran-maestro/agile/AGI-*/objective/draft/details/*.md(staged draft){PROJECT_ROOT}/.gran-maestro/agile/AGI-*/objective/clarification-context.md{PROJECT_ROOT}/.gran-maestro/agile/AGI-*/objective/clarification-questions.md{PROJECT_ROOT}/.gran-maestro/agile/AGI-*/objective/round-history.md{PROJECT_ROOT}/.gran-maestro/agile/AGI-*/objective/adversarial-review-findings.md(review transcript only; canonical JSON sidecar는 managed command 사용){PROJECT_ROOT}/.gran-maestro/agile/AGI-*/quality-gate-log.md{PROJECT_ROOT}/.gran-maestro/agile/AGI-*/auto-decisions.md{PROJECT_ROOT}/.gran-maestro/state/{MST_SESSION_ID}/snapshot.json(agile init이 반환한mst_session_id, 상속된MST_SESSION_ID, 또는 동일한 structured context로 기록되는 상태 파일)
그 외 모든 경로에 대한 Write/Edit 사용은 금지합니다.
- objective 상태 변경은 직접 편집이 아니라
mst.py명령을 통해 수행한다. - 프로젝트 DoD 체크리스트는 완료 판정의 유일한 게이트로 다룬다(DSC-047).
Managed Artifact Contract (MANDATORY)
위 allowlist는 PM/에이전트의 직접 Write/Edit 도구 사용에만 적용한다. 아래 산출물은 직접 생성하지 말고 반드시 mst.py managed command를 통해 생성/갱신한다.
| 산출물 | 생성/갱신 경로 | 실패 시 처리 |
|---|---|---|
objective.ids.json | python3 {PLUGIN_ROOT}/scripts/mst.py agile sidecar-build {AGI_ID} 또는 agile detail generate-anchors --details-dir ... | completion blocker |
handoff-manifest.json | python3 {PLUGIN_ROOT}/scripts/mst.py agile sidecar-build {AGI_ID} | missing_context / completion blocker |
adversarial-review-findings.json | python3 {PLUGIN_ROOT}/scripts/mst.py agile sidecar-build {AGI_ID} | completion blocker |
finding-trace.json | python3 {PLUGIN_ROOT}/scripts/mst.py agile sidecar-build {AGI_ID} | completion blocker |
section-review-inventory.json | python3 {PLUGIN_ROOT}/scripts/mst.py agile sidecar-build {AGI_ID} | completion blocker |
d3-findings.json | python3 {PLUGIN_ROOT}/scripts/mst.py agile sidecar-build {AGI_ID} | completion blocker |
reference-links.json | python3 {PLUGIN_ROOT}/scripts/mst.py agile sidecar-build {AGI_ID} | explicit skip reason 또는 fail_reference_handoff |
state/{MST_SESSION_ID}/snapshot.json | MST_SESSION_ID=... python3 {PLUGIN_ROOT}/scripts/mst.py state set ... | structured non-success |
.gran-maestro/references/REF-*/ | python3 {PLUGIN_ROOT}/scripts/mst.py reference add ... | NO_REFERENCE / missing_context |
| DoD status marker 및 changelog | python3 {PLUGIN_ROOT}/scripts/mst.py agile objective-transition ... | 전이 거부 |
managed command가 없거나 실패한 산출물을 직접 Write/Edit로 우회 생성하지 않는다. 실패는 해당 command 출력, sidecar schema validation, 또는 explicit skip reason으로 남긴다.
Draft Lifecycle Contract (MANDATORY)
- 저장 전 초안은 먼저
{PROJECT_ROOT}/.gran-maestro/agile/{AGI_ID}/objective/draft/아래 staged draft로 materialize한다. - 적대적 검토, source mapping, D3, anchor generation, handoff manifest 검증은 staged draft 또는 그 draft에서 생성한 sidecar evidence를 대상으로 수행한다.
- accepted
objective.md와objective/details/*.md는 mandatory gate가 모두 통과한 뒤에만 promote한다. - gate 실패, review blocker, source mapping 실패, sidecar schema 실패가 있으면 accepted objective를 변경하지 않고 draft 경로와 failure reason만 남긴다.
- promotion 후에는
objective-snapshot,objective-transition,sidecar-build,objective-check순서로 completion evidence를 재계산한다.
Gate
Entry
- Step 0.0에서 command identity/no-plan-mode preflight를 먼저 통과한다.
- preflight 통과 후 Step 0.2에서
mst.py agile init으로 AGI 세션을 생성한다. --doc미지정 시 1A(Q&A 생성 모드), 지정 시 1B(문서 파싱 모드)로 분기한다.- Story/작업 실행 루프로 진입하지 않는다. 이 스킬은 objective 생성까지만 수행한다.
Exit
templates/objective.md포맷으로 objective.md 저장 완료mst.py agile update {AGI_ID} --status active --objective-version 1 --json완료MST_SESSION_ID={MST_SESSION_ID} python3 {PLUGIN_ROOT}/scripts/mst.py state set --skill agile-plan --step 3 --total 3 [--return-to ...]기록 완료 (MST_SESSION_ID는 Step 0의agile init출력에서 확보하거나 현재 세션에서 상속됨)--return-to가 있으면 stop-hook continuation guard로 상위 스킬 복귀(re-feed), 없으면 독립 실행을 종료하고--resume안내- 어떤 종료 경로든 사용자에게 보이는 마지막 마무리는 반드시
다음 단계 실행 명령:블록으로 끝난다.--return-to존재: 자동 복귀가 정상 경로임을 밝히고, 수동 fallback 명령으로/mst:resume --wakeup-hint stop-recover를 마지막에 출력한다.--return-to없음:/mst:agile --resume AGI-NNN을 마지막에 출력한다.- 마지막 줄 뒤에 추가 설명, 인사, 요약을 붙이지 않는다.
금지 패턴
- Story 레이어/Checklist 별도 실행 레이어를 objective에 생성하는 행위
- DoD 항목에 구현 방법(API 엔드포인트, 함수명, 파일명, 기술 스택)을 강제하는 행위
- Step 0 없이 objective 생성을 시작하는 행위
- 스프린트 횟수/완료 시점을 예측·확정·암시하는 표현을 objective/질문/보고에 기재하는 행위
- objective.md에 "예상 스프린트", "N회 스프린트", "X주 내 완료" 등 필드/문장을 추가하는 행위
- 캘린더 단위로 변환한 기간 추정(예: "4~8주 소요")을 기재하는 행위
- 과거 실적을 현재 프로젝트의 완료 시점/스프린트 횟수 예측 근거로 인용하는 행위
실행 프로토콜
경로 규칙 (MANDATORY): 이 스킬의 모든
.gran-maestro/경로는 절대경로로 사용합니다. 스킬 실행 시작 시PROJECT_ROOT를 취득하고, 이후 모든 경로에{PROJECT_ROOT}/접두사를 붙입니다.PROJECT_ROOT=$(pwd)
{PLUGIN_ROOT}는 이 스킬의 "Base directory"에서skills/{스킬명}/을 제거한 절대경로입니다. 상대경로(.claude/...)는 절대 사용하지 않습니다.
Provider Delegation Routing Protocol (MANDATORY)
이 프로토콜은 이 스킬 아래의 모든 provider 실행 예시보다 우선한다. provider 작업을 시작하기 전에 parent host가 route와 lifecycle evidence를 소유하고, child는 실제 할당 작업만 수행한다.
0. 모델과 추론 난이도를 함께 확정한다
각 호출은 provider 시작 전에 호출 종류의 {selector}(예: ideation, review.roles.security_reviewer, models.roles.developer.0)로 MST_SESSION_ID="{CANONICAL_MST_SESSION_ID}" MST_CONTEXT_JSON="$(MST_CONTEXT_B64="{CANONICAL_MST_CONTEXT_B64}" python3 -c 'import base64,os,sys;s=os.environ["MST_CONTEXT_B64"];MAX_CONTEXT_BYTES=262144;sys.exit("encoded MST context exceeds limit") if len(s)>349528 else None;raw=base64.b64decode(s.encode("ascii"),altchars=b"-_",validate=True);sys.exit("decoded MST context is oversized or non-canonical") if len(raw)>MAX_CONTEXT_BYTES or base64.urlsafe_b64encode(raw).decode("ascii")!=s else None;sys.stdout.buffer.write(raw)')" python3 {PLUGIN_ROOT}/scripts/mst.py resolve-execution "{provider}" "{selector}" --pretty를 반드시 실행한다.
응답의 model, reasoning_effort, reasoning_effort_source는 하나의 binding이다. null(inherit)이면 override/CLI flag를 생략하고, invalid·unsupported·capability 부재는 우회 없이 blocked다.
우선순위는 호출별 concrete > provider default_reasoning_effort이며 호출별 inherit은 기본값을 건너뛴다. non-null effort는 Codex native reasoning_effort, Claude native effort, lifecycle/dispatch --reasoning-effort로 전달하고 항상 --selector를 함께 쓴다. Orca는 이미 route=external인 실행의 launch surface일 뿐이며 지원 범위와 binding을 바꾸지 않는다.
1. Route를 먼저 확정한다
-
MST_SESSION_ID="{CANONICAL_MST_SESSION_ID}" MST_CONTEXT_JSON="$(MST_CONTEXT_B64="{CANONICAL_MST_CONTEXT_B64}" python3 -c 'import base64,os,sys;s=os.environ["MST_CONTEXT_B64"];MAX_CONTEXT_BYTES=262144;sys.exit("encoded MST context exceeds limit") if len(s)>349528 else None;raw=base64.b64decode(s.encode("ascii"),altchars=b"-_",validate=True);sys.exit("decoded MST context is oversized or non-canonical") if len(raw)>MAX_CONTEXT_BYTES or base64.urlsafe_b64encode(raw).decode("ascii")!=s else None;sys.stdout.buffer.write(raw)')" python3 {PLUGIN_ROOT}/scripts/mst.py host context --json을 실행하고 JSON의host를 읽는다. 이 호출 실패, 잘못된 JSON, 알 수 없는 host는 임의 추정하지 말고 blocked로 종료한다. -
이어서 반드시 아래 중앙 planner를 호출한다.
{scope}는 현재 작업의 실제 scope(implementation,review,exploration,ideation,discussion,debug,analysis)이고,{provider}는 선택된codex | claude | agy다.MST_SESSION_ID="{CANONICAL_MST_SESSION_ID}" \ MST_CONTEXT_JSON="$( MST_CONTEXT_B64="{CANONICAL_MST_CONTEXT_B64}" \ python3 -c 'import base64,os,sys;s=os.environ["MST_CONTEXT_B64"];MAX_CONTEXT_BYTES=262144;sys.exit("encoded MST context exceeds limit") if len(s)>349528 else None;raw=base64.b64decode(s.encode("ascii"),altchars=b"-_",validate=True);sys.exit("decoded MST context is oversized or non-canonical") if len(raw)>MAX_CONTEXT_BYTES or base64.urlsafe_b64encode(raw).decode("ascii")!=s else None;sys.stdout.buffer.write(raw)' )" \ python3 {PLUGIN_ROOT}/scripts/mst.py delegation route \ --host "{host}" \ --provider "{provider}" \ --scope "{scope}" \ --worktree-dir "{worktree_path}" \ --capability-status "{available|unknown|unavailable}" -
route 결과 외의 근거로 transport를 바꾸지 않는다.
route=native_candidate: 같은 host/provider의 native bridge만 사용한다.handshake_required=true이면 실제 host tool 가용성을 확인한 뒤 진행한다.route=external: 이 경우에만 아래에 남아 있는 managed wrapper,dispatch build, provider CLI adapter 예시를 사용할 수 있다.route=blocked, CLI non-zero, lifecycle 응답의status=blocked, 또는 현재 attempt의phase=reconciling: 즉시 fail closed 한다. 같은 task/worktree에 새 agent나 external process를 시작하지 않는다.
requested_launch_surface=orca,launch_surface=orca이면 transport는 계속external이고 MST 보호 runner만 Orca background terminal에서 시작된다. Caller가 Orca Run/Task/Dispatch를 호출하거나 terminal을 직접 만들지 않는다. 중앙 Python launcher만 exactpath:{worktree_path}selector와MST/{task_id}/{attempt_id}title을 사용한다. Terminal create 호출 전 확정 실패만 원래 route로 돌아갈 수 있으며, 호출 이후 response/handle 불명은 fallback 또는 재실행하지 않고 기존 attempt를 reconcile한다.
2. native_candidate 실행과 evidence
Native spawn 전 parent가 delegation start를 호출하고 반환된 attempt_id를 이후 모든 CAS 호출에 사용한다. start는 lifecycle 준비만 하며, 신규 응답이나 exact replay 모두 그 자체로 spawn 권한을 주지 않는다(spawn_allowed=false).
MST_SESSION_ID="{CANONICAL_MST_SESSION_ID}" \
MST_CONTEXT_JSON="$(
MST_CONTEXT_B64="{CANONICAL_MST_CONTEXT_B64}" \
python3 -c 'import base64,os,sys;s=os.environ["MST_CONTEXT_B64"];MAX_CONTEXT_BYTES=262144;sys.exit("encoded MST context exceeds limit") if len(s)>349528 else None;raw=base64.b64decode(s.encode("ascii"),altchars=b"-_",validate=True);sys.exit("decoded MST context is oversized or non-canonical") if len(raw)>MAX_CONTEXT_BYTES or base64.urlsafe_b64encode(raw).decode("ascii")!=s else None;sys.stdout.buffer.write(raw)'
)" \
python3 {PLUGIN_ROOT}/scripts/mst.py delegation start \
--task-id "{task_id}" \
--idempotency-key "{task_id}:start:{stable_key}" \
--host "{host}" \
--provider "{provider}" \
--capability-status available \
--route-reason "{route.reason_code}" \
--worktree-dir "{worktree_path}" \
--model "{model}" \
--selector "{selector}" \
{reasoning_effort_flag} \
--scope "{scope}" \
--prompt-file "{prompt_file}" \
--output-path "{output_path}"
analysis|review|exploration|ideation|discussion|debug가 실제 read-only 작업이고 별도 linked worktree를 쓰지 않는 경우에만 --read-only를 추가한다. 구현·수정 작업에는 이 예외를 사용하지 않는다.
그 다음 parent invocation별 고유한 {claimant_id}로 single-use spawn claim을 요청한다. 오직 이 호출에서 spawn_allowed=true와 non-empty private claim_token_file을 함께 받은 단 한 caller만 native host tool을 한 번 호출할 수 있다. raw bearer token은 CLI JSON, argv, process listing, tool transcript, child prompt에 노출하지 않는다.
MST_SESSION_ID="{CANONICAL_MST_SESSION_ID}" \
MST_CONTEXT_JSON="$(
MST_CONTEXT_B64="{CANONICAL_MST_CONTEXT_B64}" \
python3 -c 'import base64,os,sys;s=os.environ["MST_CONTEXT_B64"];MAX_CONTEXT_BYTES=262144;sys.exit("encoded MST context exceeds limit") if len(s)>349528 else None;raw=base64.b64decode(s.encode("ascii"),altchars=b"-_",validate=True);sys.exit("decoded MST context is oversized or non-canonical") if len(raw)>MAX_CONTEXT_BYTES or base64.urlsafe_b64encode(raw).decode("ascii")!=s else None;sys.stdout.buffer.write(raw)'
)" \
python3 {PLUGIN_ROOT}/scripts/mst.py delegation claim-spawn \
--task-id "{task_id}" \
--attempt-id "{attempt_id}" \
--claimant-id "{claimant_id}" \
--idempotency-key "{task_id}:claim:{claimant_id}"
spawn_allowed=false, claim_status=claim_replay|already_claimed|reconciling|provider_task_in_flight|terminal, 빈 claim_token_file, 또는 claim 응답 유실/불명확 상태에서는 host tool을 호출하지 않는다. claim_replay|already_claimed는 winner의 claim lease가 살아 있는 동안 wait만 하며 recover/cancel로 ownership을 빼앗지 않는다. lease 만료 뒤에만 delegation recover로 reconcile하고, 그 외에는 next_action에 따라 기존 provider task에 attach/wait한다. claim exact replay는 bearer token/파일을 다시 발급하지 않는다. 따라서 claim 결과를 잃은 caller도 외부 fallback이나 중복 native spawn을 시도하지 않는다.
host=codex, provider=codex: Codex collaboration native tools를 사용한다.collaboration.spawn_agent로 spawn하고, resolved effort가 non-null이면reasoning_effort를 전달한다. host가 제공하는 attach/follow-up 수단으로 같은 task에 연결하며,collaboration.wait_agent로 대기한 뒤 전달된 completion result를 수집한다. 병렬 fan-out은 독립 task마다 native agent를 하나씩 spawn한다.host=claude, provider=claude: Claude의Task(...)또는Agent(...)native tool로 spawn하고, resolved effort가 non-null이면effort를 전달한다. background task는 host의TaskOutput/resume 결과로 대기·수집한다.- 정상 same-host 경로에서
codex exec,claudeCLI,mst.py run --provider {same_provider}, 같은 provider의 managed wrapper, 또는 nested/mst:claude//mst:codex를 호출하지 않는다.
Native tool 응답마다 claim winner parent가 다음 순서로 evidence를 기록한다. {claim_token_file}은 winner 응답의 mode 0400 private one-shot handle이며 acknowledge 성공 시 삭제된다. 내용을 읽거나 복사하거나 child/user/log에 전달하지 않는다. 각 명령의 JSON 응답에서 status/phase를 확인하고 blocked/reconciling이면 더 진행하지 않는다. 아래 인라인 lifecycle command도 생략된 python3 {PLUGIN_ROOT}/scripts/mst.py와 함께 문서 최상단의 정확한 MST_BOUND_SUBPROCESS 두 환경 변수 prefix를 매번 리터럴로 확장하며, bare command로 실행하지 않는다.
- spawn 성공 및 provider task ID 수신:
delegation acknowledge --task-id "{task_id}" --attempt-id "{attempt_id}" --claim-token-file "{claim_token_file}" --spawn-status created_with_task_id --provider-task-id "{provider_task_id}" --idempotency-key "{task_id}:ack:{stable_key}" - host task 연결 확인:
delegation attach --task-id "{task_id}" --attempt-id "{attempt_id}" --attach-status attached --idempotency-key "{task_id}:attach:{stable_key}" - 대기 중 주기적 생존 증거:
delegation heartbeat --task-id "{task_id}" --attempt-id "{attempt_id}" --provider-state running --idempotency-key "{task_id}:heartbeat:{sequence}" - host result 수집 직후 parent가 성공 결과의 비어 있지 않은 전체 내용을 bound
{output_path}의 sibling temp file에 먼저 쓰고 atomic replace한 뒤, fresh hash/size를 확인한다. child에게 이 파일 쓰기를 맡기거나 기존 파일을 재사용하지 않는다. - 결과 파일 evidence가 준비된 뒤에만:
delegation complete --task-id "{task_id}" --attempt-id "{attempt_id}" --completion-signal "{succeeded|failed|timeout|unknown}" --output-path "{output_path}" --idempotency-key "{task_id}:complete:{stable_key}"
Shortened here. Read the whole file on GitHub.
Signals
- GitHub stars
- 24
- Forks
- 5
- Last commit
- Aug 2026
Advanced
- Catalog kind
- skill
- Gateway key
agile-plan- Source
- github.com/myrtlepn/gran-maestro