Logo van Moai Factory Foreman

Moai Factory Foreman

OrganisatiePopulair
modu-ai
moai-factory-foreman

One unattended factory foreman iteration: watch the backlog queue, dispatch the next operator-picked card to an isolated worker, collect completion evidence on read (not on claims), and report. This is the body the project's loop.md driver invokes each iteration of a bare /loop; it can also be invoked directly to test one cycle by hand.

Add to TypingMind

Overzicht

Uitgevermodu-ai
Repositorymoai-adk
Skillnaammoai-factory-foreman
Sterren
1.2K
Forks
226
Meegeleverde bestanden
Alleen instructies
LicentieApache-2.0
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Compleet zonder extra bestanden

    Alles wat het model nodig heeft, staat in de instructies — geen extra bestanden om te synchroniseren.

  • Open source

    Gepubliceerd door modu-ai op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Moai Factory Foreman in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-factory-foreman
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/modu-ai/moai-adk.git /tmp/moai-adk
mkdir -p .claude/skills
cp -r /tmp/moai-adk/.claude/skills/moai-factory-foreman .claude/skills/moai-factory-foreman
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Moai Factory Foreman in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Moai Factory Foreman automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Moai Factory Foreman niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Factory Foreman Loop Iteration

[HARD] Before the first action of a session running this skill, read BOTH role-gated rule files in full: .claude/rules/moai/workflow/factory-dispatch.md and .claude/rules/moai/workflow/cross-session-messaging.md. A Codex-only project deploys the same files under .moai/policies/ (for example .moai/policies/workflow/factory-dispatch.md) — read whichever layout this project carries. The always-loaded surface carries only their stubs; the dispatch protocol, the card classes, and the queue boundaries this loop consumes live in those two files.

One unattended pass of the factory foreman: watch the backlog queue, dispatch the next operator-picked card to an isolated worker, collect completion evidence, report. The queue surface is moai todo (the moai gtd spelling serves the same queue); the dispatch protocol and card classes live in the factory dispatch rule (.claude/rules/moai/workflow/factory-dispatch.md). foreman — an auxiliary role of the leader: the unattended watcher that dispatches the already-picked card to an isolated worker when no leader session is holding the queue.

Running unattended

AskUserQuestion is removed from the tool pool while this skill is active — that is the mechanical guarantee that the loop cannot stop and ask. Anything that would have been a question becomes a line in the iteration report, and anything that genuinely needs the operator's decision becomes a blocked card under Boundaries below.

Deployment: start a session in the project, run bare /loop, then background the session — loop tasks carry over to the background session and keep running without a terminal. Esc cancels the pending wakeup of a waiting loop. A recurring loop expires seven days after creation; restart it when the queue still needs a foreman. Background monitors do not survive a session resume — the first iteration after a resume re-arms the queue watch.

The session's permission settings must already allow what this loop uses (queue reads, git inspection, the worker spawn). A permission prompt that surfaces while unattended stalls the iteration until someone attaches; pre-approving that surface in project settings is the operator's setup step, not something this loop can do for itself.

Boundaries (hard)

  1. The operator admits and picks work. Only backlog items whose state is already picked are dispatchable. Never run moai gtd add; never run moai gtd next <n> — that mutation is the operator's pick. Never invent, reword, or reorder cards. An empty queue is a legitimate state: say so and idle. A batch authorization (/moai:todo --auto — the operator's typed invocation-as-approval) is the card-pick gate's autonomous form (.claude/rules/moai/workflow/auto-semantics.md §9): within it, serial consumption on its own judgment, outside the keep-set (bar a [보류 card, which is ranked last, not excluded), is authorized; queue ADMISSION stays the operator's. A lane takes its card through moai factory next --card <id>, never through this loop.
  2. No approval gate is answered on the operator's behalf. When a card's next step needs a human decision that is not already recorded as made (plan-to-run kickoff approval, a review severity call, a scope choice), do not proceed. Leave the card picked, name it blocked-for-operator in the report together with the decision it waits on, and move on.
  3. One write-capable worker at a time. While a worker is in flight the iteration only reads. This is the foreman's own serialization, stricter than the doctrine it sits under — one writer per tree, owned by .claude/rules/moai/core/agent-common-protocol.md § Background Agent Execution. The foreman keeps one worker in flight so a failed iteration has exactly one author to read.
  4. Every worker runs in its own worktree (isolation: "worktree" on the spawn; relative paths in the prompt — the worker's CWD is its worktree root). Nothing writes to the shared checkout.
  5. No integration actions. No push, no pull request, no merge, no branch deletion, no worktree disposal. The card's branch is unpushed and its worktree is the work's only instance; both stay until the operator integrates them. The report names the branch and the worktree path.
  6. Verification is lane-local. The worker runs only the checks its own change can affect; the full suite belongs to CI. Never spawn background CPU load — the queue watch below is the only long-running process this loop arms.
  7. Completion is read, never trusted. A card advances only on evidence this iteration actually read.

The iteration

  1. Queue watch. If no backlog monitor is live (first iteration, or after a resume), arm one Monitor on the queue file, re-arming it at each expiry:

    • command:

      sh
      # The queue directory, resolved the way factory.StateDirForRoot does for a
      # standard git-repository project: <moai-home>/db/<project-key>/todo,
      # keyed by the repository's canonical (primary-checkout) root.
      mh=${MOAI_HOME:-$HOME/.moai}
      root=$(git rev-parse --show-toplevel 2>/dev/null) || root=$PWD
      top=$(git worktree list --porcelain 2>/dev/null | sed -n 's/^worktree //p' | head -n 1)
      [ -n "$top" ] && root=$top
      root=$(cd "$root" && pwd -P)
      key=$(basename "$root"); key=$(printf '%s' "$key" | tr -c 'A-Za-z0-9._-' '-')
      sum=$(printf '%s' "$root" | sha256sum 2>/dev/null | cut -c1-8)
      [ -n "$sum" ] || sum=$(printf '%s' "$root" | shasum -a 256 | cut -c1-8)
      d=$mh/db/$key-$sum/todo
      last=init
      while true; do
        cur=$(cksum "$d"/backlog.db "$d"/backlog.db-wal 2>/dev/null)
        [ -n "$cur" ] || cur=missing
        if [ "$cur" != "$last" ]; then
          [ "$last" != init ] && echo "backlog changed"
          last=$cur
        fi
        sleep 5
      done
    • timeout_ms: 1800000

    • description: backlog queue watch

    The persistent option no longer exists — every Monitor now carries a deadline, timeout_ms is a required input, and the watch above is an unbounded loop that never ends on its own. 1800000 is the longest deadline the tool documents accepting; a larger value is capped rather than honoured. At expiry the loop is killed and one notice arrives with the event count, so an iteration that still needs the watch re-arms it. A non-interactive (-p) session is reported to cap the deadline lower than an interactive one; that lower cap is not observable from the tool input schema, so treat a shorter-than-requested expiry there as expected rather than as a fault.

    The watch resolves the queue directory the way factory.StateDirForRoot does for a standard git-repository project — a project-keyed directory under the moai home (MOAI_HOME when that is set to an absolute path, otherwise ~/.moai), keyed by the primary checkout's root — so a linked worktree watches the primary checkout's queue, not a directory local to its own tree. The queue is the database, and a backlog.json beside it is an export or a legacy leftover — never the queue — so a watch pointed at the JSON on a migrated project polls a file that never changes and reports nothing, forever. The write-ahead log is watched alongside the database because a committed write can sit in backlog.db-wal with the database image byte-identical until a checkpoint folds it back; watching the database alone misses exactly those mutations. The checksum poll emits one line per change and costs two tiny reads every five seconds. Do not tighten the interval, and do not arm a second watcher. Each emitted line, like each scheduled wakeup, is a prompt to run this same idempotent iteration — an iteration that finds nothing to do ends quickly.

  2. Read the queue. moai gtd list --json (lock-free). A missing queue file is an empty queue, never an error. Records carry id, text, spec_id, and state (queued | picked | dropped).

  3. Collect before dispatch. If a worker dispatched by an earlier iteration has returned, read its evidence file first (step 6). If a worker is still running, end the iteration with a one-line status.

  4. Choose the dispatchable card. The oldest picked item with no live worker and no recorded blocker. queued items are not yours to pick outside a batch authorization.

  5. Dispatch one worker with the Agent tool, isolation: "worktree". The dispatch is a fixed-field address block — a pointer, not a copy, ten lines at most:

    card: <id>
    spec: <SPEC-ID>            # only when the card carries one
    cmd: <the card's work in one line; the phase command when a SPEC is attached>
    evidence: .moai/reports/<card-id>/evidence.md

    Route the spawn to the agent the card's work matches under the standard delegation rules; where no specialist matches, a general-purpose spawn with a domain whitelist. The worker prompt carries the block plus these standing orders: rename the worktree branch to WT-<slug> (a descriptive slug, never the card id) first; implement the card; verify lane-locally; write the evidence file with decisions, verbatim output tails of the checks run, explicit gaps, and residual risk; commit by explicit pathspec; never push.

  6. Collect on evidence. When the worker returns, read the evidence file it names. Advance the card — moai gtd done <t-id> — only when the evidence shows the work complete: verbatim passing output present, gaps named. A missing, unreadable, or stale evidence file is a gap: the card stays picked, the report says why, and the card is not re-dispatched this iteration. Absence of a failure signal is not a pass.

  7. Report. Close with two to six lines: queue summary, what was dispatched or collected, which evidence was read, blocked cards and the decisions they wait on. This report is what the operator reads on reattach — name what you read, not what you were told.

Factory seam (reserved, not implemented)

The single-worker dispatch above is the only mode. Fanning a card out to numbered factory lanes — the multi-lane launcher surface — is separate work; when the foreman grows that routing, it lands here as a second dispatch mode chosen per card. Until then this loop spawns one subagent per card, reads no factory state, and launches no lanes.

Failure handling

Stop the loop (ScheduleWakeup with stop: true), with a one-line reason, when the loop cannot do its job: the queue file is repeatedly unreadable, the queue watch cannot be armed, or this skill's own surface is broken. A transient worker failure is not a loop failure — record it on the card and let the next iteration decide whether to re-dispatch.

Veelgestelde vragen

Wat doet de AI-skill Moai Factory Foreman?

One unattended factory foreman iteration: watch the backlog queue, dispatch the next operator-picked card to an isolated worker, collect completion evidence on read (not on claims), and report. This is the body the project's loop.md driver invokes each iteration of a bare /loop; it can also be invoked directly to test one cycle by hand.

Waarom Moai Factory Foreman gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Moai Factory Foreman bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Moai Factory Foreman in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-factory-foreman. TypingMind leest het bestand SKILL.md en installeert het als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Moai Factory Foreman gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Moai Factory Foreman gebruiken?

Zoveel als je wilt. Je kunt Moai Factory Foreman gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Moai Factory Foreman gratis?

Ja. Deze skill is door modu-ai op GitHub gepubliceerd onder de licentie Apache-2.0. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇