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/connection.md
Connect to a Factory
Start here on first activation or whenever the target, login, or CLI is uncertain. A fresh, empty directory is sufficient: connecting does not require source code, a deployment, or a project config file.
1. Check the CLI
mastra --version
mastra api --help
mastra api factory --helpConfirm factory is actually listed; some older CLIs print parent help for an unknown command. If the repository has a local CLI, use ./node_modules/.bin/mastra instead. Do not upgrade the project's dependencies just to inspect a remote Factory.
If no compatible CLI is available, use a temporary invocation:
npm exec --yes --package=mastra@latest --package=@mastra/core@latest --package=typescript@latest -- mastra api factory --helpSubstitute the same npm exec ... -- mastra prefix for mastra below. The extra packages address missing @mastra/core and typescript dependencies encountered with a bare npx mastra. Check help/schema again whenever the CLI changes. If npm reports engine incompatibility, use a Node version supported by the selected packages.
2. Establish the target and authentication
Ask for the user's Factory instance URL if it isn't already known. Obtain it from their deployment details, the Factory UI's origin, or their deployment administrator; do not derive it from a project name or reuse another user's host. Use the server base URL, not a board-page URL, the platform dashboard/API URL, or a URL ending in /api.
For a platform-hosted Factory, check the existing login:
mastra auth whoamiIf logged out, offer to run mastra auth login and wait for authorization unless the user already requested login. Run it, let the user complete browser authentication, then rerun whoami. The command is mastra auth login, not mastra login. Saved login is user-level and works across directories; do not read the credential file.
For HTTPS hosts recognized by the CLI (*.factory.mastra.cloud and *.factory.staging.mastra.cloud), explicit --url automatically uses the saved login. Factory requests also use the selected organization. Inspect mastra auth orgs --help and, with the user's authorization, mastra auth orgs switch if the organization is wrong. MASTRA_ORG_ID can override organization selection; don't silently change it.
For local, custom-domain, or self-hosted deployments, platform login is not necessarily applicable. Confirm the deployment's authentication requirements. The CLI does not automatically send saved platform credentials to arbitrary hosts. Use the deployment's approved environment/header mechanism if required; never ask the user to paste secrets into chat, read saved credentials, or send a platform token to an unverified host. An unauthenticated curl returning 401 does not prove a logged-in CLI request will fail.
3. Connect and discover projects
Set FACTORY_URL to the actual instance URL supplied or verified above. This shell variable is just a convenience, not an auto-read CLI environment variable.
mastra api --url "$FACTORY_URL" factory project list '{"page":0,"perPage":10}' \
| jq '{page, projects: [.data[] | {id, name}]}'Follow page.hasMore before concluding a named project is absent. Select the sole project or match the user's named project; ask when multiple choices remain plausible. Keep --url "$FACTORY_URL" on every subsequent command, including thread/memory calls and their schema discovery. A successful call does not persist a target.
An empty project list is not proof there are no projects: confirm the URL, organization, access, and pagination. A 401/403 calls for checking login and access, not inventing IDs or retrying with credentials borrowed from another project.
Alternative: automatic target resolution
If the working directory is a repository that has already been deployed with mastra deploy, it contains a .mastra-project.json link file and plain mastra api factory ... works with no --url at all:
# from inside a deployed project's repo
mastra api factory project list '{"page":0,"perPage":10}' | jq '.data[] | {id, name}'Without --url, Factory/runtime commands probe http://localhost:4111 first, then read .mastra-project.json in the working directory to resolve the platform deployment. A reachable local server can therefore win over a linked deployment. Prefer an explicit URL for unambiguous remote inspection.
The link file is normally written by deployment commands after project selection; login and read-only API calls do not create it. Do not deploy, copy another repository's config, or hand-author a link file just to connect. MASTRA_PROJECT_ID / MASTRA_ORGANIZATION_ID are not substitutes for a Factory target; their service-target handling applies to observability/learning, not Factory URL lookup.
Distinguish these identifiers:
Platform deployment project: the host identity referenced by
.mastra-project.json.Factory project: an organization-scoped logical project returned by
factory project liston the selected deployment.
Names, IDs, organizations, and project counts are deployment-specific. Never assume either namespace's IDs can be used in the other, or that a deployment name appears in the Factory list.
Factory commands use origin-level /web/* routes, bypassing --server-api-prefix. Thread/memory commands use the runtime API prefix (normally /api); for a customized server prefix, discover it from the deployment rather than adding /api to FACTORY_URL.
Installing or repairing the skill
Prefer the repository source so references are installed with the skill:
npx skills add mastra-ai/skills --skill mastra-factoryUse the interactive selection to choose scope and agent. For a supported global target, an explicit example is:
npx skills add mastra-ai/skills --skill mastra-factory --agent claude-code -g -y
npx skills list -g --agent claude-codeReplace claude-code with the user's actual supported agent; don't install for an unrelated agent. Check npx skills --help for current options. PromptScript does not support global installation: select project scope for that agent (omit -g), or target a different intended agent that supports global scope. A multi-agent install can partially succeed while reporting a PromptScript failure. Project-scope PromptScript installs have been observed to report "copied" while npx skills list shows the skill as "not linked", so a successful copy is not proof of integration. Verify the intended agent's installation, the SKILL.md and its referenced files, and activation in that agent rather than trusting the aggregate install message.
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