Queue moonmind workflows

From MoonLadderStudios/MoonMind · View interactive version

Queue moonmind workflows is an AI agent skill from the GitHub repository MoonLadderStudios/MoonMind. Queue additional MoonMind workflows from inside an existing workflow by submitting explicit `/api/executions` requests, applying stable idempotency, verifying every returned `workflowId` with the execution API, and writing a durable queue summary. Use when a workflow needs to fan out follow-up MoonM

How to use this skill

Skill file

Queue MoonMind Workflows

Overview

Queue child MoonMind workflows through the durable execution API and verify

their visibility before reporting success. This skill is for workflow fan-out:

creating more MoonMind executions from a running MoonMind workflow, not for

planning future work in an agent-local task list.

Non-Negotiables

workflowId returned by POST /api/executions and verified by

GET /api/executions/{workflowId}.

manifest, an in-session task list, or a proposal.

database, call Temporal CLI directly for creation, or infer success from

agent stdout.

fail when idempotency cannot be established unless the operator explicitly

asks for non-idempotent submission.

generated context must be artifact refs or issue refs, not embedded blobs.

Manifest

Write a manifest containing one complete /api/executions request per child:

{
  "batchScope": "mm:parent-workflow-or-run",
  "workflows": [
    {
      "ref": "github:MoonLadderStudios/MoonMind#722",
      "request": {
        "type": "task",
        "priority": 0,
        "maxAttempts": 3,
        "payload": {
          "repository": "MoonLadderStudios/MoonMind",
          "runtimeInheritance": "caller",
          "requiredCapabilities": ["git", "gh"],
          "task": {
            "title": "Implement GitHub issue #722",
            "instructions": "Implement GitHub issue MoonLadderStudios/MoonMind#722.",
            "taskTemplate": {"slug": "github-issue-implement", "scope": "global"},
            "inputs": {
              "github_issue_ref": "MoonLadderStudios/MoonMind#722"
            },
            "publish": {"mode": "pr"}
          }
        }
      }
    }
  ]
}

The helper supports both execution API shapes:

Author preset children with `task.taskTemplate: {"slug": "<preset-slug>",

"scope": "global"}` so the execution API expands the exact registered

preset. github-issue-implement is a preset (preset:github-issue-implement),

not a Skill: do not queue it via task.skill.name. Reserve `task.tool:

{"type": "skill", "name": ...}` for actual Skill identities and validate

every example ref against the real capability catalog and admission contract.

When MOONMIND_EXECUTION_FANOUT_BEARER_TOKEN_FILE or the direct

MOONMIND_EXECUTION_FANOUT_BEARER_TOKEN value is present, only the task-shaped

child form is accepted and the helper binds it to the caller with

runtimeInheritance="caller"; direct create and schedule shapes remain available

only to ordinary authenticated API users.

For task-shaped requests, idempotency is stored at request.payload.idempotencyKey.

For direct create requests, idempotency is stored at request.idempotencyKey.

Workflow

  1. Resolve helpers exclusively from the run's immutable active bundle.

```bash

QUEUE_MOONMIND_WORKFLOWS_SKILL_DIR="${QUEUE_MOONMIND_WORKFLOWS_SKILL_DIR:-${MOONMIND_ACTIVE_SKILLS_DIR:+$MOONMIND_ACTIVE_SKILLS_DIR/queue-moonmind-workflows}}"

test -n "$QUEUE_MOONMIND_WORKFLOWS_SKILL_DIR" && test -f "$QUEUE_MOONMIND_WORKFLOWS_SKILL_DIR/SKILL.md"

```

Inside MoonMind, MOONMIND_ACTIVE_SKILLS_DIR is always set and the helper

below resolves from it; a checked-in .agents/skills directory must never

shadow the selected snapshot. When no skill-specific override is present,

the helper resolves to

${MOONMIND_ACTIVE_SKILLS_DIR:-.agents/skills}/queue-moonmind-workflows/scripts/queue_moonmind_workflows.py.

Outside MoonMind, set

QUEUE_MOONMIND_WORKFLOWS_SKILL_DIR to the directory containing this

SKILL.md (no MoonMind-only environment variables required). A missing

selected helper is a materialization/packaging error: stop as blocked

instead of substituting stale repository code.

  1. Resolve the child targets and write the manifest to a managed artifact path,

usually artifacts/queue-moonmind-workflows-manifest.json.

  1. Run the helper:

```bash

python3 "$QUEUE_MOONMIND_WORKFLOWS_SKILL_DIR/scripts/queue_moonmind_workflows.py" \

--manifest artifacts/queue-moonmind-workflows-manifest.json \

--max-workflows 25

```

  1. Read the helper output. A successful queue has:
  1. Report queued workflow IDs and the summary artifact path. If any item failed

submission or verification, report the run as failed/partial and include the

specific failing ref values.

Helper Behavior

scripts/queue_moonmind_workflows.py:

closed if that lease-owned file is missing or empty; otherwise accepts the

direct MOONMIND_EXECUTION_FANOUT_BEARER_TOKEN value for portable hosts;

substitutes a broader API token when scoped authority is configured;

MOONMIND_API_TOKEN, MOONMIND_AUTH_TOKEN, MOONMIND_BEARER_TOKEN, or

MOONMIND_API_KEY when present, and also forwards

MOONMIND_WORKER_TOKEN or MOONMIND_WORKER_TOKEN_FILE for deployments that

still accept the legacy worker header;

MOONMIND_WORKFLOW_ID, TEMPORAL_WORKFLOW_ID, MOONMIND_AGENT_RUN_ID,

MOONMIND_RUN_ID, or AGENT_RUN_ID;

GET /api/executions/{workflowId};

artifact spool when available, otherwise under --artifacts-dir;

Use --dry-run to validate and summarize the manifest without submitting. Use

--allow-empty only when a no-op is an acceptable outcome.

Result Standard

Treat these as failures:

failures instead of silent success.

one from parent scope.

within the retry window.

When queueing from an already-running workflow, prefer

runtimeInheritance: "caller" in the child payload and include a fallback

runtime only when the parent task context supplies one. Do not silently switch

model, effort, provider profile, repository, publish mode, or credentials.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.