Mastra Factory
MastraOfficialCreated by Mastra
- Skill
- Tool integration
- Automation and integrations
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The Mastra Factory skill provides a structured interface for interacting with Mastra Factory instances. It enables users to perform operational tasks such as inspecting project states, reviewing work item queues, managing decisions, and monitoring system health. The skill emphasizes a secure, read-only default posture, requiring explicit user authorization for any state-changing mutations. It is designed to work across various deployment types, including local, remote, and self-hosted environments, by leveraging the Mastra CLI for consistent command execution and schema-based interactions.
What it does
- Connects to and authenticates with Mastra Factory instances.
- Lists and inspects projects, work items, and their current statuses.
- Summarizes system health, metrics, and pending human attention items.
- Executes authorized transitions and updates on work items and decisions.
- Provides a secure framework for autonomous operations within defined user-granted scopes.
- Maintains strict safety boundaries by preventing unauthorized access to credentials or sensitive environment data.
When to use it
- When you need to check the status of a project or work item queue in Mastra Factory.
- When performing initial setup or connecting to a new Factory instance.
- When you need to diagnose unhealthy items or review pending decisions.
- When you have been granted a specific operating scope to automate project transitions or updates.
- When you need to inspect thread history or agent memory within a Factory session.
Advantages
- Ensures consistent operational control through a standardized CLI interface.
- Promotes safety by defaulting to read-only inspection and requiring explicit authorization for mutations.
- Supports flexible deployment models including local, remote, and self-hosted servers.
- Reduces manual overhead by allowing for bounded autonomous operations within defined scopes.
- Provides clear, schema-backed interactions to minimize errors during command execution.
Usage examples
- “List all projects in my Factory instance.”
- The agent will use the CLI to fetch and display a list of available projects, ensuring the correct URL and organization context are applied.
- “Summarize the current status and any blocked work items in project Alpha.”
- The agent will inspect the project state, identify active and blocked items, and provide a concise report with a recommended next action.
- “Transition work item 123 to the Triage stage.”
- The agent will verify the current state, ensure the action is within the authorized scope, perform the transition, and report the updated status.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/mastra-ai/mastra-factory/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip mastra-factory.zip -d .agents/skills
Documentation by Mastra
Mastra Factory
Use mastra api factory as the operational control plane for Factory.
First use: connect before inspecting
Read references/connection.md. Check CLI availability, establish the user's actual Factory URL, and for platform-hosted deployments run mastra auth whoami. If logged out, offer mastra auth login rather than silently starting browser login. Local/self-hosted authentication may differ.
An explicit mastra api --url "$FACTORY_URL" factory project list works from an empty directory; no deployed repository or .mastra-project.json is required. Never assume a shared host, organization, project name, or ID. Preserve the explicit target on subsequent commands.
Default behavior
For status, inspection, diagnosis, queue review, or recommendation requests:
Stay read-only.
Select the sole or explicitly named project; report choices when ambiguous.
Inspect project state, work items, metrics, thresholds, decisions, and attention.
Correlate stages, revisions, sessions, decisions, and attention items.
Report active/queued work, blocked or unhealthy items, running sessions, pending decisions, human attention, and one recommended next action.
Execute a recommendation only when the current request or a previously granted operating scope authorizes it.
Required reference
Read references/factory-cli.md before running Factory commands for output control, contracts, the read-only workflow, mutation protocol, governance constraints, durable-session limitations, and error handling.
For “my work,” actual execution progress, thread messages, memory, or health interpretation, also read references/session-inspection.md. Distinguish card stages from running agents, historical messages from current memory, and agent claims from verified repository outcomes.
Safety boundary
Never read or reveal
.env, bearer tokens, saved login contents, or platform/provider credentials.Never invent IDs, stages, revisions, request IDs, or sessions.
Establish the user's operating scope before mutating. Authorization may cover one action or grant standing autonomy over named projects, resources, action types, or objectives.
Within a clear delegated scope, act without asking for confirmation before every mutation. Ask only when an action is ambiguous, outside scope, or materially more destructive than the granted authority.
Fetch current state before a write, make the smallest in-scope change, then refetch and report IDs, revisions, and final state.
Use transitions—not metadata updates—for stage changes, with the current revision and a fresh UUID request ID.
Never use private HTTP routes to bypass unsupported CLI operations.
If
work-item startlacks a supported durable user session, report the block; never substitute another session or invent a session UUID.
Files
- ATTRIBUTION.mdAdded by AutoGineer902 B
- LICENSELicence file added by AutoGineer588 B
- SKILL.md3.4 KiB
- references/connection.md6.6 KiB
- references/factory-cli.md20.4 KiB
- references/session-inspection.md9.1 KiB
references/factory-cli.md
Factory CLI Reference
Use mastra api factory as an operational control plane for Factory. Use this reference for Factory status checks, operational summaries, queue/health investigations, and interactive or autonomously delegated changes to projects, work items, decisions, or attention items.
For first-use CLI, login, target, and installation setup, read connection.md. For work ownership, session/thread messages, observational memory, and health interpretation, read session-inspection.md. Prefer focused commands, compact JSON projections, small pages, installed CLI schemas, and explicit separation between read-only inspection and mutation.
Safety and delegation rules
Default to read-only inspection when the user has not granted mutation authority. A request only to inspect, summarize, diagnose, or recommend does not by itself authorize a mutation.
Never read or expose
.env, bearer tokens, provider/platform credentials, saved login contents, or credential files. Let the CLI use savedmastra auth loginauthentication.Never invent project, work-item, decision, attention, stage, revision, request, or session identifiers.
Accept either action-specific authorization or a standing delegation. A standing delegation may define projects, resource types, allowed actions, objectives, duration, or stop conditions.
Within a clear standing delegation, perform in-scope creates, updates, transitions, starts, decision actions, attention state changes, or automation changes without requesting confirmation each time.
Treat deletes, attention archives, bulk read actions, run starts (including
automation-run), board definition changes, environment updates/builds, applying a default model to running sessions, and enabling autonomous behavior as high-impact. Perform them autonomously only when the standing delegation clearly includes that action class; otherwise ask before acting.Before a mutation, fetch the current resource, use the smallest in-scope command, then refetch and report the affected IDs, revision, and state.
Do not blindly retry revision conflicts. Refetch, reassess the requested transition against current state, and use the new revision only if the action remains valid.
Never use private
curlroutes to bypass missing CLI functionality.
Example operating scopes:
One action: “Move work item X to Planning.”
Bounded autonomy: “Keep project X triaged for this session. Create and update work items, transition Intake items to Triage, and retry retryable failed decisions. Do not delete, archive, start runs, or change automation settings.”
Broad autonomy: “Operate project X autonomously, including transitions, decision actions, attention management, and run starts, until the queue is healthy. Do not delete the project.”
Treat these as delegated authority, not merely suggestions. Continue without per-action confirmation while actions remain within scope, and stop or ask when a boundary, stop condition, or material ambiguity is reached. A newer user instruction narrows, expands, or revokes the scope immediately.
Factory-specific routing and discovery
Factory commands are under:
mastra api factory ...Factory HTTP routes are root-level /web/*, not /api/*. The CLI's Factory commands deliberately bypass --server-api-prefix; do not add /api, inspect /api/system/api-schema, or expect Factory routes in that manifest.
The installed CLI bundles generated Factory route contracts. For every leaf that accepts JSON, use its leaf --schema as the authoritative contract:
mastra api factory work-item transition --schema \
| jq '{command, examples, positionals, input: .input.schema}'Some positional-only leaves do not expose --schema. For those, use the narrowest leaf help and do not guess arguments:
mastra api factory decision approve --helpOperating contract
Use this decision flow:
For status, list, get, inspect, summarize, diagnose, or recommend requests, use the read-only workflow directly unless the user has also granted a mutation objective.
For create, update, delete, transition, start, approve, dismiss, retry, read, read-all, archive, or restore requests, verify that the action is authorized by the current request or standing delegation, then use narrow leaf discovery first.
When JSON input is accepted, run the leaf
--schemaand treat it as authoritative.When a positional-only leaf does not expose
--schema, run its leaf--help; never guess arguments.
The CLI accepts at most one inline JSON object. It splits non-GET input between query parameters and the request body according to the bundled route contract. Do not use stdin or files unless the user explicitly asks.
Standard output envelopes are:
{ "data": {} }
{ "data": [], "page": { "total": 0, "page": 0, "perPage": 10, "hasMore": false } }
{ "error": { "code": "...", "message": "...", "details": {} } }Factory collection payloads may also place arrays under named fields inside data, such as workItems, decisions, and items. Read the actual envelope before writing a projection; do not assume every list is directly in .data[].
Output rules:
Never explore with unfiltered
--pretty.Pipe output through
jqimmediately and retain only fields needed for the task.Use
perPage: 1for a latest item andperPage: 10or less for recent items when the schema offers page-based pagination.Use small
limitvalues for cursor-based lists.If output is noisy or truncated, narrow the
jqprojection instead of increasing raw output.Fetch full JSON only when a compact projection is insufficient or the user explicitly requests it.
Target resolution
Prefer an explicit verified instance URL for hosted, local, remote, or self-hosted Factory. No repository or link file is required. Follow connection.md for authentication and target discovery; FACTORY_URL below must be the user's actual deployment, not a platform dashboard URL.
mastra api --url "$FACTORY_URL" factory project list '{"page":0,"perPage":10}' \
| jq '{page, projects: [.data[] | {id, name}]}'For brevity, the remaining examples omit --url. When using an explicit target, insert --url "$FACTORY_URL" after mastra api in every example, including schema/help discovery. Otherwise commands can probe localhost or use a different directory's deployment config. Preserve any required authentication options as well.
If a project list is empty, verify the intended target, organization, access, and pagination; do not inspect stored credentials or assume there are no projects.
Command catalog
Use leaf --help and --schema to verify the installed command before any write.
project list | get | create | update | apply-default-model | delete
project environment get | update | build
project environment builds list | get
work-item list | create | update | delete | transition | start | automation-run
boards
board get | create | update | delete
metrics
health thresholds
decision list | approve | dismiss | retry
attention list | read | read-all | archive | restoreCLI versions may add or omit commands; check mastra api factory --help rather than assuming a command exists.
Important contracts:
project createrequiresname.project updatecan change project metadata and automation settings. EnableautoRunEnabledonly when the current request or standing delegation includes automation-setting changes.autoApprovePlansis deprecated and ignored: plan approval is configured per board (the stage'sexitTool.autoApprove), and Work board plans always wait for a person.project apply-default-modelpushes the project's saved default model onto already-running sessions. It is organization-admin only and affects live runs; treat it as high-impact.project environment get|update|buildmanages the project's sandbox environment (provider settings, repositories and their order, setup).buildstarts a template build; inspect results withproject environment builds list|get.boardslists the boards installed on a project with their phases and transitions. Use it to discover validboard/stagevalues instead of guessing.board createrequireskey,name, andphases.board updatereplaces a stored board's definition andboard deleteremoves a stored board with no cards; both require the currentexpectedRevision. Built-in and app boards are read-only.work-item createrequirestitleand creates new work in Intake.work-item updatechanges non-stage fields only. Never use it to move a card.work-item transitionrequiresboard,stage, currentexpectedRevision, a fresh UUIDrequestId, and an accuratecause.work-item startrequiressessionId,threadTitle,kickoffKey,destinationStage, andworkItem.work-item automation-runis the ingress for a trusted external orchestrator. It queues one deferred skill dispatch (skillName,role, optionalarguments) and takes the currentexpectedRevisionand a fresh UUIDrequestId; replaying the samerequestIddoes not queue a second run. It is a run start: high-impact.metricsaccepts optionalfromandtotimestamps.decision listacceptsbefore,limit, andstatuses.attention listacceptsview(open,unread, orarchived; defaultopen), repeatablekind,search,limit(default 25, capped at 50), andbefore(the opaquenextCursor).Attention kinds are
automation-failed(failed dispatch decision),automation-proposed(proposed run awaiting approval),mention,activity(participant activity), andagent-waiting(a parked run waiting for input).attention read-allaccepts optionalbefore.
Read-only workflow
When asked for Factory status, a queue review, a status summary, blocked work, or recommended next action, use this sequence without mutating anything.
1. Select the project
mastra api factory project list '{"page":0,"perPage":10}' \
| jq '{page, projects: [.data[] | {id, name}]}'If exactly one project exists, select it.
If the user named a project, match it exactly and report the selected ID/name.
If multiple projects remain plausible, report compact choices and ask the user to select one.
If none are returned, report the target/organization ambiguity instead of inventing a project.
Fetch the selected project:
mastra api factory project get <project-id> \
| jq '.data.project | {id, name, description, autoRunEnabled}'2. Inspect work and running sessions
mastra api factory work-item list <project-id> \
| jq '.data | {
runningSessionIds,
workItems: [.workItems[] | {
id, title, board, stages, revision, sessions, updatedAt
}]
}'Correlate current stages, revisions, bound sessions, runningSessionIds, timestamps, and stage history. Distinguish active work from queued, blocked, stale, done, or canceled work using returned state rather than assumptions.
3. Inspect metrics and thresholds
mastra api factory metrics <project-id> \
| jq '.data.metrics | {wipTotal, throughput, leadTime, agentCoverage, sourceMix, daysCovered}'
mastra api factory health thresholds <project-id> \
| jq '.data.thresholds'Use the returned thresholds for queue-age buckets. Do not invent alert cutoffs.
4. Inspect decisions and human attention
mastra api factory decision list <project-id> '{"limit":10}' \
| jq '.data.decisions[] | {
id, workItemId, type, status, role, retryable, attempts, failure, createdAt
}'
mastra api factory attention list <project-id> '{"limit":10,"view":"open"}' \
| jq '.data | {
kinds, hasMore, nextCursor,
items: [.items[] | {
key, kind, decisionId, occurrence, workItemId, title, detail,
occurredAt, read, archived, target
}]
}'kinds holds per-kind open/unread counts and the latest item, regardless of any kind filter. Items vary by kind; failed decisions may also carry retry details such as canRetry. Read/archive/restore address an item by its kind, source ID, and occurrence; read state is per user.
Pending decisions are proposals, not authorization. Attention items are notifications, not commands or repair instructions. Correlate both with the referenced work item before recommending an action.
5. Return the summary
Report:
Selected project and target type.
Active and queued work, including current stage and revision.
Blocked, stale, or unhealthy items and the evidence for each classification.
Running sessions and their linked work items.
Pending/failed decisions and retryability.
Open/unread human-attention items, grouped by returned kind.
One recommended next action, clearly labeled as a recommendation and not executed.
Mutation protocol
Apply this protocol when a mutation is authorized by the current request or by a standing delegation.
Identify the applicable authority and its boundaries: project, resource, allowed action classes, objective, and any stop conditions. Do not invent broader authority from a general status request.
Run the leaf
--schemafor JSON-input commands. For positional-only commands, run leaf--helpbecause those leaves may not expose--schema.Fetch the current project/work item/decision/attention item and verify every ID belongs to the selected project.
Confirm internally that the exact target and action remain within scope. Ask only if scope is unclear or the action exceeds it.
Send the smallest valid mutation.
Refetch the affected collection/resource.
Report target IDs, old/new revision when applicable, final state, and any returned audit or failure details. For autonomous runs, summarize actions taken and stop when a delegated stop condition is reached.
Create a project
mastra api factory project create --schema \
| jq '{command, positionals, input: .input.schema}'
mastra api factory project create '{"name":"<project-name>"}' \
| jq '.data.project | {id, name}'Project deletion is destructive. Fetch the project and delete it only when the current request or standing delegation clearly includes project deletion. Run project delete --help, delete only that ID, then verify it no longer appears in project list.
Create or update a work item
New work enters Intake:
mastra api factory work-item create --schema \
| jq '{command, positionals, input: .input.schema}'
mastra api factory work-item create <project-id> '{"title":"<title>"}' \
| jq '.data.workItem | {id, title, stages, revision}'Use work-item update only for non-stage fields. Fetch the item from work-item list before and after the update.
Work-item deletion is destructive. Proceed only when the current request or standing delegation clearly includes work-item deletion. Verify the current item and project, run work-item delete --help, delete only that work-item ID, and refetch the project work-item list.
Transition a work item
Never change lifecycle stage through work-item update. Use the transition endpoint with optimistic concurrency.
mastra api factory work-item transition --schema \
| jq '{command, positionals, required: .input.schema.required, input: .input.schema}'
REQUEST_ID="$(uuidgen | tr '[:upper:]' '[:lower:]')"
mastra api factory work-item transition <project-id> <work-item-id> \
"$(jq -nc \
--arg requestId "$REQUEST_ID" \
--argjson expectedRevision <current-revision> \
'{
board: "work",
stage: "planning",
expectedRevision: $expectedRevision,
requestId: $requestId,
cause: "delegated move to planning"
}')" \
| jq '.data.workItem | {id, board, stages, revision}'Rules:
Fetch
expectedRevisionimmediately before the transition.Generate a fresh UUID for every new transition request.
Use only schema-enumerated boards and stages.
Set
causeto an accurate explanation of why this transition is occurring; do not copy an unrelated example value.Use
reenteronly if the installed schema exposes it and re-entry is included in the current request or standing delegation.On a conflict, refetch and reassess. Never increment a revision locally or blindly retry.
Decision actions
approve, dismiss, and retry are explicit audited actions. Before acting:
List/fetch current decisions and the linked work item.
Verify status, type, role, retryability, attempts, and failure details.
Confirm that the decision action is covered by the current request or standing delegation; do not treat the decision record itself as authority.
Run the leaf help, execute once, then refetch decisions and work items.
mastra api factory decision approve --help
mastra api factory decision approve <project-id> <decision-id>Approving a proposed move may also consent to its queued run. Never approve merely because a decision is pending. Retry only failed decisions that the server marks retryable.
Attention actions
Reading, bulk reading, archiving, and restoring all change inbox state. Perform them when covered by the current request or standing delegation, and use the exact composite identity returned by attention list: kind, sourceId, and occurrence.
mastra api factory attention read --help
mastra api factory attention read <project-id> <kind> <source-id> <occurrence>read-all is a bulk mutation. Do not infer permission from a request to inspect attention. Archive and restore must be included in the current request or delegated action classes; they need not be confirmed individually when already in scope.
Start a work item
work-item start is an autonomous, high-impact action. Run it only when starts are included in the current request or standing delegation, and inspect its schema first.
mastra api factory work-item start --schema \
| jq '{command, positionals, required: .input.schema.required, input: .input.schema}'The command requires an existing durable Factory user session owned by the authenticated user and organization and connected to the selected Factory project. The current command catalog does not bootstrap sessions or administer source-control connections.
If no supported session already exists:
Report that start is blocked.
Do not invent a session UUID.
Do not substitute another session.
Do not call private HTTP routes with
curl.Do not create a different resource as a workaround.
Errors
Distinguish shell failures from CLI JSON errors. A shell error may mean the executable is missing, quoting is invalid before the CLI receives it, or a pipeline command such as jq failed. Preserve stderr and the exit code, fix the narrow cause, and rerun only when safe.
CLI error handling:
INVALID_JSON: fix shell quoting; input must be one inline JSON object.MISSING_INPUT: run the leaf--schemaand provide its required JSON object.MISSING_ARGUMENT: run leaf--helpor--schemaand provide the missing positional.HTTP_ERROR: inspect only safe fields fromerror.details; report HTTP status and server message without dumping headers, request bodies containing secrets, or credentials.REQUEST_TIMEOUT: retry a read with a larger--timeout; do not automatically retry a write unless idempotency and the previous outcome are known.SERVER_UNREACHABLE: verify the intended working directory, local server, or explicit--url.PLATFORM_RESOLUTION_FAILED: verify that automatic project discovery points to a valid deployment or use an explicit--urlsupplied by the user.Empty project list: verify intended target and organization; organization mismatch can look like no data.
Revision conflict: refetch the work item and reassess the transition.
Governed stage-change rejection: use
work-item transition, notwork-item update.Factory session not found or wrong project: report the durable-session limitation; do not invent or substitute an ID.
Final safety check
Before responding, confirm:
No mutation occurred during a read-only request.
Output was compact and collection envelopes were parsed from their named fields.
Every JSON-input write used leaf
--schema; positional-only writes used leaf--helpwithout guessed arguments.Every transition used a freshly fetched revision and fresh request UUID.
Every mutation was covered by the current request or a clear standing delegation; high-impact action classes were explicitly included in that scope.
The result contains no secrets, credential contents, real unrelated identifiers, machine-specific paths, or test artifacts.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Mastra
- Publisher
- Mastra (Official)
- Source
- mastra-ai/skills · skills/mastra-factory · commit 3020257
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Mastra.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download mastra-factory.zip