Skip to content

feat: add Mastra Code plugin system - #18658

Merged
TylerBarnes merged 18 commits into
mainfrom
feat/mc-basic-plugin-system
Jun 30, 2026
Merged

feat: add Mastra Code plugin system#18658
TylerBarnes merged 18 commits into
mainfrom
feat/mc-basic-plugin-system

Conversation

@TylerBarnes

@TylerBarnes TylerBarnes commented Jun 30, 2026

Copy link
Copy Markdown
Member

Adds the first Mastra Code plugin system so users can install trusted local or GitHub plugins and expose their tools inside the TUI.

Plugins can be a local path, or installed via a github url. When installing from github it will clone it to the installed scope (project or global) and MC will then periodically check if it needs to pull new commits down.

For local plugins, it hot reloads tool changes, allowing MC to work on its own tools via a plugin. It can modify the tool, call it, modify, etc in a loop until it works properly.

import { defineMastraCodePlugin, createTool, z } from 'mastracode/plugin';

export default defineMastraCodePlugin({
  id: 'example.plugin',
  name: 'Example Plugin',
  tools: {
    example_tool: {
      tool: createTool({
        id: 'example_tool',
        description: 'Run an example plugin tool',
        inputSchema: z.object({ message: z.string() }),
        execute: async context => ({ message: context.message }),
      }),
    },
  },
});

Plugins can define tools, optional config, render hints, bundled slash commands and skills, and plugin instructions. The /plugins UI handles install, scaffold, details, config, enable/disable, and local/GitHub source management. Local plugin edits reload at execution time, and GitHub checkouts poll for updates while preserving local changes on backup branches before resetting.

This also adds project-level plugin blocking, progress streaming for plugin tools, subagent-style rendering for plugin tools that ask for it, and a README note that plugins should only be installed from trusted sources.

Smoke tested with Alexandria: the expert tool executes, config persists, and bundled command/skill loading was tested earlier. Focused unit tests, typecheck, and pnpm build:mastracode pass.

example plugin: https://github.com/mastra-ai/alexandria/blob/main/.mastracode/plugins/sources/local/alexandria/src/index.ts#L101

Screenshot 2026-06-29 at 5 07 24 PM Screenshot 2026-06-29 at 5 07 39 PM Screenshot 2026-06-29 at 5 07 34 PM Screenshot 2026-06-29 at 5 07 44 PM image (34)

ELI5

This PR adds a way for Mastra Code to load “trusted plugin” code so it can learn new tools and commands. You can install plugins from your computer or GitHub, manage them in the terminal UI, and see their tool progress update live—plus reload plugins automatically when local code changes or GitHub has updates.

Summary

  • Introduces the first Mastra Code plugin system:

    • Public plugin API/types (defineMastraCodePlugin) and writeToolProgress support
    • .mastracode-plugin.json manifest handling
    • Local + GitHub install, local discovery, scoped plugin registries (load/merge/save), and a full plugin loader pipeline
    • A PluginManager that tracks active plugins, supports reloads, and handles local hot-reload + GitHub polling/update with backup/dirtiness safety
    • Project-level plugin blocking via disabledPlugins
  • Wires plugins into the app runtime so plugin contributions work everywhere:

    • Merges plugin tool names into mode allowlists and dynamically builds toolsets from loaded plugin tools
    • Appends plugin-provided instructions into generated agent prompts
    • Exposes plugin-provided assets via TUI/session state (skills/commands/instructions), and treats plugin command dirs as extra high-priority slash-command sources
  • Adds /plugins TUI management with end-to-end flows:

    • Install new plugins, scaffold plugin projects, view details, configure plugin config values (including model selection + API key prompting), enable/disable, uninstall
    • Install-source management (local path vs GitHub URL) with trust-confirmation guidance
    • Includes block/disabled handling in the UI and behavior (hidden/conflicted/blocked states)
  • Improves plugin tool UX in chat/TUI:

    • Streams plugin tool progress from core → TUI using data-mastracode-tool-progress, emitting tool updates and rendering progress output
    • Adds “subagent-style” rendering for tools that request it, including static subagent component handling and replay for previously stored tool calls
    • Supports local hot reloading and GitHub polling/update scenarios
  • Tests + release notes:

    • Adds unit tests for plugin loader/manager/registry/scaffold, plugin instruction generation, tool-progress streaming, and tool rendering precedence
    • Adds TUI unit tests for /plugins
    • Adds E2E fixtures covering bundled commands/skills, tool streaming, local hot reload, GitHub poll updates, blocking/config behavior, and scaffold/install/execute flows
    • Updates docs and adds a changeset publishing “Mastra Code” plugin support.

@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 59f484c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mastracode Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
mastra-studio-preview Ignored Ignored Preview Jun 30, 2026 6:03pm
mastra-docs-1.x Skipped Skipped Jun 30, 2026 6:03pm
mastra-playground-ui Skipped Skipped Jun 30, 2026 6:03pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds Mastra Code plugin support end to end: public plugin APIs, install/load/manage flows, agent wiring, tool progress streaming, subagent rendering, and a /plugins command plus scaffold CLI.

Changes

Mastra Code Plugin System

Layer / File(s) Summary
Public plugin API module (plugin.ts)
mastracode/src/plugin.ts, mastracode/src/plugin.test.ts, mastracode/package.json, mastracode/tsup.config.ts, .changeset/true-clowns-divide.md
Adds the public plugin module, progress-writing helper, package export/build entry, and release note.
Plugin types, paths, registry, and scaffold
mastracode/src/plugins/types.ts, mastracode/src/plugins/paths.ts, mastracode/src/plugins/registry.ts, mastracode/src/plugins/manifest.ts, mastracode/src/plugins/package-link.ts, mastracode/src/plugins/scaffold.ts, mastracode/src/plugins/install.ts, mastracode/src/plugins/__tests__/*
Defines plugin types, path helpers, registry/manifest persistence, package linking, scaffolding, install/discovery helpers, and related tests.
Plugin loader and manager
mastracode/src/plugins/loader.ts, mastracode/src/plugins/manager.ts, mastracode/src/plugins/__tests__/*
Implements plugin loading, conflict detection, live tool proxies, hot reload, GitHub polling, and registry-backed lifecycle operations.
Agent wiring, state, and tool progress
mastracode/src/schema.ts, mastracode/src/index.ts, mastracode/src/agents/tools.ts, mastracode/src/agents/workspace.ts, mastracode/src/agents/instructions.ts, mastracode/src/__tests__/index.test.ts, mastracode/src/agents/extra-tools.test.ts, mastracode/src/agents/__tests__/instructions.test.ts, packages/core/src/agent-controller/agent-controller.ts, packages/core/src/agent-controller/session-run-engine.ts, packages/core/src/agent-controller/display-state.test.ts, packages/core/src/agent/agent.ts, packages/core/src/tools/tool-builder/builder.ts
Threads plugin tools, paths, and instructions through state and agent setup, and propagates tool progress through outputWriter into core agent-controller events.
Subagent rendering for plugin tool calls
mastracode/src/tui/components/subagent-execution.ts, mastracode/src/tui/components/tool-execution-enhanced.ts, mastracode/src/tui/handlers/tool.ts, mastracode/src/tui/handlers/message.ts, mastracode/src/tui/render-messages.ts, mastracode/src/tui/components/__tests__/*, mastracode/src/tui/handlers/__tests__/*, mastracode/src/tui/__tests__/render-messages.test.ts
Refactors subagent execution rendering, routes plugin progress into static subagent components, replays subagent tool calls from history, and updates quiet-preview behavior.
TUI /plugins command and slash-command integration
mastracode/src/tui/commands/plugins.ts, mastracode/src/tui/commands/types.ts, mastracode/src/tui/commands/index.ts, mastracode/src/tui/command-dispatch.ts, mastracode/src/tui/mastra-tui.ts, mastracode/src/tui/state.ts, mastracode/src/tui/setup.ts, mastracode/src/utils/slash-command-loader.ts, mastracode/src/tui/components/help-overlay.ts, mastracode/src/tui/__tests__/command-dispatch.test.ts, mastracode/src/tui/commands/__tests__/plugins.test.ts
Adds the /plugins UI and wiring across slash commands, autocomplete, help, custom command loading, TUI state, and command tests.
CLI plugin subcommand, docs, and E2E scenarios
mastracode/src/main.ts, mastracode/e2e/terminal-backend.ts, mastracode/e2e/tui/plugins.ts, mastracode/e2e/tui/index.ts, mastracode/e2e/tui/types.ts, mastracode/e2e/fixtures/plugins-*.json, mastracode/README.md
Adds mastracode plugin scaffold, wires pluginManager into TUI startup, updates docs, and adds plugin E2E scenarios and fixtures.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise, descriptive, and accurately summarizes the plugin-system changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mc-basic-plugin-system

Comment @coderabbitai help to get the list of available commands.

@dane-ai-mastra dane-ai-mastra Bot added the complexity: critical Critical-complexity PR label Jun 30, 2026
@dane-ai-mastra

dane-ai-mastra Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

PR triage

Linked issue check skipped for core contributor @TylerBarnes.


PR complexity score

Factor Value Score impact
Files changed 66 +60
Lines changed 5509 +60
Author merged PRs 567 -20
Test files changed Yes -10
Final score 90

Applied label: complexity: critical


Changed test gate

Changed tests passed against the base branch; they should fail before the PR code is applied.

Label: tests: failing ❌

@socket-security

socket-security Bot commented Jun 30, 2026

Copy link
Copy Markdown

Dependency limit exceeded — report not shown.

This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report.

Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard.

Socket is always free for open source. If this is a non-commercial open source project, contact us to request a free Team account.

@superagent-security superagent-security Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superagent found 2 security concern(s).

Comment thread mastracode/src/plugins/manager.ts
Comment thread mastracode/src/agents/instructions.ts Outdated
@superagent-security superagent-security Bot added the pr:flagged Superagent security flag label Jun 30, 2026
@dane-ai-mastra dane-ai-mastra Bot added the tests: green ✅ Changed tests failed against base as expected label Jun 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 19

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/core/src/agent-controller/agent-controller.ts (1)

1495-1533: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Unify formatToolProgressOutput. This copy has already drifted from session-run-engine.ts: when progress is an object without string status/detail, this path returns '' while the other path falls back to JSON.stringify(progress)\n, so identical progress payloads can produce different shell output depending on where they’re handled.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/agent-controller/agent-controller.ts` around lines 1495 -
1533, The `formatToolProgressOutput` implementation in `agent-controller.ts` has
drifted from `session-run-engine.ts` and handles object progress differently,
causing inconsistent shell output for the same payloads. Update
`formatToolProgressOutput` to match the shared behavior used by the other path:
keep string handling the same, but for non-null objects without usable
`status`/`detail`, fall back to a serialized representation instead of returning
an empty string. Use the existing `formatToolProgressOutput` helper and the
`outputWriter` flow as the location to align this logic.

Source: Coding guidelines

mastracode/src/tui/components/tool-execution-enhanced.ts (1)

2397-2402: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Bound and truncate partial generic output before rendering it inline.

This branch now renders every accumulated partial line with no height cap and no width truncation. Since updateResult() rebuilds on every streaming delta, long-running plugin tools can make the transcript grow unboundedly and noticeably degrade TUI responsiveness.

Suggested fix
     if (!this.result || this.isPartial) {
       const partialOutput = this.result ? this.getFormattedOutput() : '';
-      const preview = partialOutput ? partialOutput.split('\n') : this.formatArgsPreview();
+      const maxLineWidth = getTermWidth() - 4 - BOX_INDENT * 2;
+      const collapsedLines = this.getCollapsedLineLimit(10);
+      let preview = partialOutput ? partialOutput.split('\n') : this.formatArgsPreview();
+      const hasMore = preview.length > collapsedLines + 1;
+      if (hasMore) {
+        preview = preview.slice(-collapsedLines);
+      }
       this.contentBox.addChild(new Text(border('╭──'), 0, 0));
       if (preview.length > 0) {
-        const previewLines = preview.map(line => border('│') + ' ' + theme.fg('toolOutput', line));
+        const previewLines = preview.map(line => border('│') + ' ' + theme.fg('toolOutput', truncateAnsi(line, maxLineWidth)));
         this.contentBox.addChild(new Text(previewLines.join('\n'), 0, 0));
       }
+      if (hasMore) {
+        this.contentBox.addChild(
+          new Text(border('│') + ' ' + theme.fg('muted', `... more above`), 0, 0),
+        );
+      }
       this.contentBox.addChild(new Text(`${border('╰──')} ${footerText}`, 0, 0));
       return;
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mastracode/src/tui/components/tool-execution-enhanced.ts` around lines 2397 -
2402, The inline partial-output rendering in tool-execution-enhanced should be
bounded so streaming updates do not keep appending unlimited content; update the
branch around getFormattedOutput(), formatArgsPreview(), and the preview mapping
to cap the number of displayed lines and truncate each line to the available
width before adding it to contentBox. Use the existing updateResult() flow and
the partialOutput/preview generation path to keep only a small recent slice of
generic output and apply an ellipsis or similar truncation for overlong lines.
🧹 Nitpick comments (7)
mastracode/src/plugin.test.ts (1)

5-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the agent.outputWriter branch.

This suite only exercises the fallback writer.custom path. A small test with both agent.outputWriter and writer.custom present would lock in the intended precedence and catch duplicate-emission regressions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mastracode/src/plugin.test.ts` around lines 5 - 34, The writeToolProgress
tests only cover the fallback writer.custom path; add a test that includes both
agent.outputWriter and writer.custom to verify the agent.outputWriter branch
takes precedence and only one progress chunk is emitted. Use the
writeToolProgress helper and its agent/outputWriter handling to assert the
intended routing behavior, preventing duplicate emissions when both writers are
available.
mastracode/src/plugins/__tests__/registry.test.ts (1)

1-166: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move this Vitest suite next to the source file(s).

mastracode/src/plugins/__tests__/registry.test.ts violates the repo rule for colocated Vitest tests. Please place these tests beside mastracode/src/plugins/registry.ts / mastracode/src/plugins/paths.ts instead of under __tests__. As per coding guidelines, “Vitest tests should be colocated with their source.”
[potential_issue]

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mastracode/src/plugins/__tests__/registry.test.ts` around lines 1 - 166, The
Vitest suite is in a non-colocated __tests__ folder, which violates the repo
test placement rule. Move the tests so they live beside the source modules they
cover, specifically alongside the registry and paths implementations referenced
by loadPluginRegistry, savePluginRegistry, mergePluginRegistries,
removePluginRecord, setPluginRecord, getPluginRoot, getPluginRegistryPath, and
getPluginScopePaths. Keep the test contents the same, just relocate them to the
appropriate colocated test file(s) next to registry.ts and paths.ts.

Source: Coding guidelines

mastracode/src/plugins/__tests__/scaffold.test.ts (1)

1-89: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move this test next to scaffold.ts.

mastracode/src/plugins/__tests__/scaffold.test.ts is not colocated with mastracode/src/plugins/scaffold.ts, which violates the repo’s Vitest test-location rule. As per coding guidelines, "Vitest tests should be colocated with their source."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mastracode/src/plugins/__tests__/scaffold.test.ts` around lines 1 - 89, Move
the Vitest spec for scaffoldPlugin so it is colocated with the source file
scaffold.ts, since the current scaffold.test.ts location violates the repo
test-placement rule. Keep the same test content and imports, but relocate the
file beside scaffold.ts and ensure references to resolveScaffoldTarget,
scaffoldPlugin, and formatScaffoldSuccess still resolve correctly after the
move.

Source: Coding guidelines

mastracode/src/utils/__tests__/slash-command-loader.test.ts (1)

35-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

This test does not actually verify precedence.

It proves plugin command dirs are loaded, but not that they override built-in/custom locations when names collide. Add a same-name command in projectDir/.mastracode/commands and assert the plugin version wins; otherwise an ordering regression would still leave this test green.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mastracode/src/utils/__tests__/slash-command-loader.test.ts` around lines 35
- 49, The current test only proves plugin command directories are included, not
that they take precedence over built-in custom command locations on name
collisions. Update the `loadCustomCommands` test to create a same-named command
in `projectDir/.mastracode/commands` and a plugin version in the plugin
directory, then assert the returned command from `loadCustomCommands` resolves
to the plugin file and metadata. Use the existing `loadCustomCommands` and
`commands.find(...)` setup so the test verifies override ordering rather than
just presence.
mastracode/src/tui/handlers/__tests__/tool.test.ts (1)

62-121: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the finish-without-result regression here.

This new path only exercises tool_start and text progress. The runtime contract also allows { event: 'finish' } without result, and that's the branch where plugin subagents currently get cleaned up. A case that omits result and then delivers handleToolEnd() would lock in the final-output behavior we need.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mastracode/src/tui/handlers/__tests__/tool.test.ts` around lines 62 - 121,
The existing test only covers tool_start and text progress for the subagent
path, but it misses the finish-without-result cleanup behavior. Extend the
handleToolUpdate/handleToolEnd coverage in tool.test.ts for the same
handleToolInputStart flow so it includes a { event: 'finish' } update with no
result, then calls handleToolEnd and asserts the plugin subagent state is
cleaned up correctly. Use the existing symbols handleToolUpdate, handleToolEnd,
pendingSubagents, and streamingComponent to locate and update the test.
mastracode/src/__tests__/index.test.ts (1)

490-508: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep this Vitest coverage colocated with index.ts.

This new case is being added under src/__tests__/ instead of beside the source file. Please move it to a colocated index.test.ts so the suite follows the repo's test layout rule. As per coding guidelines, **/*.{test,spec}.{ts,tsx,js,jsx}: Vitest tests should be colocated with their source.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mastracode/src/__tests__/index.test.ts` around lines 490 - 508, The new
Vitest case for createMastraCode is in the wrong test location; move this
coverage from the shared __tests__ folder to a colocated index.test.ts beside
the source file so it follows the repo’s test layout rule. Keep the same
assertions around createMastraCode, pluginManager, controllerConstructorMock,
and the mode availableTools/pluginInstructions checks, but place the test file
next to index.ts.

Source: Coding guidelines

mastracode/src/agents/__tests__/instructions.test.ts (1)

55-82: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep this Vitest coverage next to instructions.ts.

This new case is going into agents/__tests__/ instead of a colocated instructions.test.ts. Please move it next to the source file so the suite stays consistent with the repo's Vitest layout rule. As per coding guidelines, **/*.{test,spec}.{ts,tsx,js,jsx}: Vitest tests should be colocated with their source.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mastracode/src/agents/__tests__/instructions.test.ts` around lines 55 - 82,
The new Vitest case for getDynamicInstructions is in the wrong place; move the
appended plugin-instructions test to be colocated with instructions.ts so the
suite follows the repo’s source-adjacent test layout. Keep the existing
assertions, but relocate the test that exercises getDynamicInstructions and the
controller/state setup into the same directory as the source module.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/true-clowns-divide.md:
- Line 5: The changeset entry is too dense and missing the required short public
example for the new plugin feature. Rewrite the description to be scannable by
splitting the Mastra Code plugin support summary into a few outcome-focused
bullets, and add a tiny public API example using defineMastraCodePlugin(...) so
readers can quickly see how to use the new feature.

In `@mastracode/e2e/tui/plugins.ts`:
- Around line 18-21: Reset the shared scenario state in the e2e TUI plugin setup
so later runs don’t inherit stale module-level data. Update the logic around the
module-scoped variables currentTui, hotReloadPluginDir, githubPollSourceDir, and
githubPollManager to explicitly clear them between scenarios or before each
setup/reset entry point. Make the reset happen in the same place that
initializes or tears down the plugin state so each scenario starts from a clean
slate.
- Around line 163-167: The symlink setup in the plugin preparation logic is
swallowing all failures, which hides real environment problems. Update the
try/catch around symlinkSync in the plugin setup helper so it only ignores the
expected “already exists” case when the prepared directory is reused, and
rethrows any other error; use the symlink creation block in plugins.ts to locate
the change.

In `@mastracode/src/index.ts`:
- Around line 476-480: The startup-only plugin snapshot in the controller is
stale after plugin reloads, so hook `pluginManager.onReload(...)` into the same
initialization path that builds `pluginSkillPaths`, `pluginInstructions`, and
`availableTools`. Update the controller/session state from the fresh plugin
snapshot (or recreate the controller/session if those fields are immutable) so
newly added/updated plugin tools and instructions are reflected immediately in
`plan`/`fast` without requiring a restart.

In `@mastracode/src/main.ts`:
- Around line 197-206: The readFlag helper in main.ts is accepting the next
token even when it is another flag, which lets scaffoldPlugin receive invalid
values like "--name" for --id. Update readFlag() to only return a value when the
flag is present and the following token exists and does not start with "--", and
ensure the plugin scaffold flow using scaffoldPlugin() fails fast or treats the
flag as missing when validation fails.

In `@mastracode/src/plugins/loader.ts`:
- Around line 193-196: The isToolEntryObject guard currently treats null as a
valid tool because typeof null is object, allowing invalid plugin exports
through validation. Update this check in isToolEntryObject to explicitly reject
null before accepting an object-shaped tool entry, so only real tool objects are
added to the active tool map.
- Around line 102-108: `resolvePluginRoot` and `resolvePluginEntryPath`
currently trust persisted `record.path` and `record.entry`, which can allow path
traversal out of the plugin root before `importPluginModule` runs. Update these
helpers to re-validate and contain relative scoped paths and entries by
resolving against the expected plugin root and rejecting or normalizing any
`..`-based escape attempts, while preserving support for absolute local plugin
paths. Use the existing symbols `resolvePluginRoot`, `resolvePluginEntryPath`,
and `importPluginModule` to place the containment check at the path resolution
boundary.

In `@mastracode/src/plugins/manager.ts`:
- Around line 397-408: The GitHub uninstall flow in `uninstall` can recursively
delete any registry-provided path, so add a containment check before `fs.rmSync`
to ensure the resolved `checkoutPath` stays inside `paths.root`. Use the
existing `record.path`, `paths.root`, and `checkoutPath` logic in `manager.ts`
to normalize/resolve both paths, reject anything that escapes the plugin root,
and only proceed with deletion when the checkout is confirmed to be under the
expected root.
- Around line 219-244: The refresh flow in manager.ts only marks `changed` when
`readGitHead()` differs before/after, so `refreshGithubCheckout()` can reset
plugin files on disk without triggering `reload()`. Update the
`refreshGithubCheckout`/caller flow in `Manager` so it returns whether a `git
reset --hard` or backup occurred, and use that signal alongside the HEAD
comparison to decide when `reload()` should run, ensuring stale in-memory plugin
state is refreshed even when HEAD is unchanged.
- Around line 149-167: The reload/watch path in PluginManager is assuming every
local plugin has a resolvable entry, but `loadPlugins()` can produce `status:
'load failed'` for missing local entries. Update `updateLocalEntryWatchers()`
(and any related reload logic in `reloadChangedLocalPlugins()`) to skip plugins
that cannot resolve a valid entry/version, instead of calling
`getEntryVersion()` unconditionally on `resolvePluginEntryPath(plugin,
this.options)`. Keep the loader contract intact by treating missing local
entries as metadata-level failures rather than allowing `PluginManager.reload()`
to throw.

In `@mastracode/src/plugins/manifest.ts`:
- Around line 42-50: Validate manifest entries before persisting them in
upsertPluginManifestEntry so the write path cannot create entries that
loadPluginManifest would later reject. Add the same required-field checks for
entry.id and entry.entry before updating manifest.plugins and calling
savePluginManifest, and make sure scaffoldPlugin’s unchecked options.id path is
covered by this validation so empty values are rejected consistently.

In `@mastracode/src/plugins/package-link.ts`:
- Around line 7-13: The symlink creation in ensureMastraCodePackageLink
currently assumes fs.symlinkSync(..., 'dir') will work everywhere, which can
break plugin scaffold/install on Windows. Update this function to detect Windows
and add a fallback path when creating the mastracode link under node_modules
fails, using the existing nodeModulesDir/linkPath flow so non-Windows behavior
stays unchanged. Keep the fix localized to ensureMastraCodePackageLink and
preserve the existing existence check before attempting the link.

In `@mastracode/src/tui/commands/__tests__/plugins.test.ts`:
- Around line 1-4: The test suite in plugins.test.ts should be colocated with
its source instead of living under __tests__. Move this Vitest suite next to
plugins.ts in the same commands folder, and keep the existing
imports/handlePluginsCommand coverage intact while updating any relative paths
if needed.

In `@mastracode/src/tui/commands/plugins.ts`:
- Around line 134-150: Surface failures from plugin mutation actions instead of
fire-and-forget. In the handlers in plugins.ts that call
ctx.pluginManager.setEnabled, ctx.pluginManager.uninstall, and setConfigValue
(including the configure flow), await the promise or attach a catch so
rejections are handled; on failure, keep the overlay behavior consistent and
show an error message to the user rather than letting an unhandled rejection
occur. Use the existing command handlers around showPluginsList,
configurePluginFlow, and the plugin manager calls as the place to add the error
handling.
- Around line 215-225: The boolean branch in the plugin config flow only returns
true or false, so it never lets PluginManager.setConfigValue() clear an override
back to inherited/default behavior. Update the logic in the boolean handling
path inside plugins.ts (the askModalQuestion / formatConfigValueQuestion flow)
to offer a clear/reset choice or otherwise return undefined or '' when the user
wants to remove the override, while still returning true/false for normal
selections.

In `@mastracode/src/tui/components/subagent-execution.ts`:
- Line 173: The streamed activity text is being truncated too aggressively
because formatTextActivityLines() hard-caps the output with a fixed slice, which
drops earlier lines once finalResult is suppressed as a duplicate. Remove the
hard .slice(-8) behavior and rely on the existing maxActivityLines and
collapsedLines logic to control how many lines are shown. Update the related
path in subagent-execution so the same line-preservation behavior applies
wherever the activity text is formatted, including the duplicated section
referenced by the reviewer.

In `@mastracode/src/tui/components/tool-execution-enhanced.ts`:
- Around line 869-874: The completed generic tool preview in
tool-execution-enhanced.ts is hard-coded to 2 lines, ignoring the user’s quiet
preview setting. Update the preview truncation logic in the relevant
rendering/helper path around the existing this.isPartial check so that finished
generic tools use quietPreviewLineLimit instead of a fixed 2-line slice, while
still preserving the partial-preview behavior. Make sure the change applies to
the generic tool preview flow and not just partial executions, so the TUI
settings selection is respected after completion.

In `@mastracode/src/tui/handlers/tool.ts`:
- Around line 51-55: The SubagentProgressEvent finish flow is removing plugin
subagents too early when a finish event arrives without a final result, which
prevents handleToolEnd from updating the transcript later. Update the
ToolHandler logic around SubagentProgressEvent, finish(), and handleToolEnd() so
a plugin subagent remains pending until the real tool result is received, only
finalizing/removing the entry when an actual result is available. Keep the
finish event as a status update path and preserve the pending state for later
tool_end completion.

In `@mastracode/src/tui/mastra-tui.ts`:
- Around line 567-575: The plugin state update in refreshPluginRuntimeState is
not awaited, so loadCustomSlashCommands and refreshSkillsAutocomplete can read
stale pluginCommandPaths and related fields. Update the state write on
this.state.session.state.set(...) to be awaited before invoking the reload
helpers, and keep the sequencing inside refreshPluginRuntimeState so the
command/skill refresh always uses the latest activePlugins data.

---

Outside diff comments:
In `@mastracode/src/tui/components/tool-execution-enhanced.ts`:
- Around line 2397-2402: The inline partial-output rendering in
tool-execution-enhanced should be bounded so streaming updates do not keep
appending unlimited content; update the branch around getFormattedOutput(),
formatArgsPreview(), and the preview mapping to cap the number of displayed
lines and truncate each line to the available width before adding it to
contentBox. Use the existing updateResult() flow and the partialOutput/preview
generation path to keep only a small recent slice of generic output and apply an
ellipsis or similar truncation for overlong lines.

In `@packages/core/src/agent-controller/agent-controller.ts`:
- Around line 1495-1533: The `formatToolProgressOutput` implementation in
`agent-controller.ts` has drifted from `session-run-engine.ts` and handles
object progress differently, causing inconsistent shell output for the same
payloads. Update `formatToolProgressOutput` to match the shared behavior used by
the other path: keep string handling the same, but for non-null objects without
usable `status`/`detail`, fall back to a serialized representation instead of
returning an empty string. Use the existing `formatToolProgressOutput` helper
and the `outputWriter` flow as the location to align this logic.

---

Nitpick comments:
In `@mastracode/src/__tests__/index.test.ts`:
- Around line 490-508: The new Vitest case for createMastraCode is in the wrong
test location; move this coverage from the shared __tests__ folder to a
colocated index.test.ts beside the source file so it follows the repo’s test
layout rule. Keep the same assertions around createMastraCode, pluginManager,
controllerConstructorMock, and the mode availableTools/pluginInstructions
checks, but place the test file next to index.ts.

In `@mastracode/src/agents/__tests__/instructions.test.ts`:
- Around line 55-82: The new Vitest case for getDynamicInstructions is in the
wrong place; move the appended plugin-instructions test to be colocated with
instructions.ts so the suite follows the repo’s source-adjacent test layout.
Keep the existing assertions, but relocate the test that exercises
getDynamicInstructions and the controller/state setup into the same directory as
the source module.

In `@mastracode/src/plugin.test.ts`:
- Around line 5-34: The writeToolProgress tests only cover the fallback
writer.custom path; add a test that includes both agent.outputWriter and
writer.custom to verify the agent.outputWriter branch takes precedence and only
one progress chunk is emitted. Use the writeToolProgress helper and its
agent/outputWriter handling to assert the intended routing behavior, preventing
duplicate emissions when both writers are available.

In `@mastracode/src/plugins/__tests__/registry.test.ts`:
- Around line 1-166: The Vitest suite is in a non-colocated __tests__ folder,
which violates the repo test placement rule. Move the tests so they live beside
the source modules they cover, specifically alongside the registry and paths
implementations referenced by loadPluginRegistry, savePluginRegistry,
mergePluginRegistries, removePluginRecord, setPluginRecord, getPluginRoot,
getPluginRegistryPath, and getPluginScopePaths. Keep the test contents the same,
just relocate them to the appropriate colocated test file(s) next to registry.ts
and paths.ts.

In `@mastracode/src/plugins/__tests__/scaffold.test.ts`:
- Around line 1-89: Move the Vitest spec for scaffoldPlugin so it is colocated
with the source file scaffold.ts, since the current scaffold.test.ts location
violates the repo test-placement rule. Keep the same test content and imports,
but relocate the file beside scaffold.ts and ensure references to
resolveScaffoldTarget, scaffoldPlugin, and formatScaffoldSuccess still resolve
correctly after the move.

In `@mastracode/src/tui/handlers/__tests__/tool.test.ts`:
- Around line 62-121: The existing test only covers tool_start and text progress
for the subagent path, but it misses the finish-without-result cleanup behavior.
Extend the handleToolUpdate/handleToolEnd coverage in tool.test.ts for the same
handleToolInputStart flow so it includes a { event: 'finish' } update with no
result, then calls handleToolEnd and asserts the plugin subagent state is
cleaned up correctly. Use the existing symbols handleToolUpdate, handleToolEnd,
pendingSubagents, and streamingComponent to locate and update the test.

In `@mastracode/src/utils/__tests__/slash-command-loader.test.ts`:
- Around line 35-49: The current test only proves plugin command directories are
included, not that they take precedence over built-in custom command locations
on name collisions. Update the `loadCustomCommands` test to create a same-named
command in `projectDir/.mastracode/commands` and a plugin version in the plugin
directory, then assert the returned command from `loadCustomCommands` resolves
to the plugin file and metadata. Use the existing `loadCustomCommands` and
`commands.find(...)` setup so the test verifies override ordering rather than
just presence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1576ed8f-b0c7-49ac-afcc-74715e23b32d

📥 Commits

Reviewing files that changed from the base of the PR and between c607ece and 1d23c18.

📒 Files selected for processing (66)
  • .changeset/true-clowns-divide.md
  • mastracode/README.md
  • mastracode/e2e/fixtures/plugins-assets-loading.json
  • mastracode/e2e/fixtures/plugins-github-poll-update.json
  • mastracode/e2e/fixtures/plugins-local-hot-reload.json
  • mastracode/e2e/fixtures/plugins-local-tool.json
  • mastracode/e2e/fixtures/plugins-scaffold-install-tool.json
  • mastracode/e2e/fixtures/plugins-streaming-tool-output.json
  • mastracode/e2e/terminal-backend.ts
  • mastracode/e2e/tui/index.ts
  • mastracode/e2e/tui/plugins.ts
  • mastracode/e2e/tui/types.ts
  • mastracode/package.json
  • mastracode/src/__tests__/index.test.ts
  • mastracode/src/agents/__tests__/instructions.test.ts
  • mastracode/src/agents/extra-tools.test.ts
  • mastracode/src/agents/instructions.ts
  • mastracode/src/agents/tools.ts
  • mastracode/src/agents/workspace.ts
  • mastracode/src/index.ts
  • mastracode/src/main.ts
  • mastracode/src/plugin.test.ts
  • mastracode/src/plugin.ts
  • mastracode/src/plugins/__tests__/install.test.ts
  • mastracode/src/plugins/__tests__/loader.test.ts
  • mastracode/src/plugins/__tests__/manager.test.ts
  • mastracode/src/plugins/__tests__/registry.test.ts
  • mastracode/src/plugins/__tests__/scaffold.test.ts
  • mastracode/src/plugins/install.ts
  • mastracode/src/plugins/loader.ts
  • mastracode/src/plugins/manager.ts
  • mastracode/src/plugins/manifest.ts
  • mastracode/src/plugins/package-link.ts
  • mastracode/src/plugins/paths.ts
  • mastracode/src/plugins/registry.ts
  • mastracode/src/plugins/scaffold.ts
  • mastracode/src/plugins/types.ts
  • mastracode/src/schema.ts
  • mastracode/src/tui/__tests__/command-dispatch.test.ts
  • mastracode/src/tui/__tests__/render-messages.test.ts
  • mastracode/src/tui/command-dispatch.ts
  • mastracode/src/tui/commands/__tests__/plugins.test.ts
  • mastracode/src/tui/commands/index.ts
  • mastracode/src/tui/commands/plugins.ts
  • mastracode/src/tui/commands/types.ts
  • mastracode/src/tui/components/__tests__/subagent-execution.test.ts
  • mastracode/src/tui/components/__tests__/tool-execution-enhanced.test.ts
  • mastracode/src/tui/components/help-overlay.ts
  • mastracode/src/tui/components/subagent-execution.ts
  • mastracode/src/tui/components/tool-execution-enhanced.ts
  • mastracode/src/tui/handlers/__tests__/message.test.ts
  • mastracode/src/tui/handlers/__tests__/tool.test.ts
  • mastracode/src/tui/handlers/message.ts
  • mastracode/src/tui/handlers/tool.ts
  • mastracode/src/tui/mastra-tui.ts
  • mastracode/src/tui/render-messages.ts
  • mastracode/src/tui/setup.ts
  • mastracode/src/tui/state.ts
  • mastracode/src/utils/__tests__/slash-command-loader.test.ts
  • mastracode/src/utils/slash-command-loader.ts
  • mastracode/tsup.config.ts
  • packages/core/src/agent-controller/agent-controller.ts
  • packages/core/src/agent-controller/display-state.test.ts
  • packages/core/src/agent-controller/session-run-engine.ts
  • packages/core/src/agent/agent.ts
  • packages/core/src/tools/tool-builder/builder.ts

Comment thread .changeset/true-clowns-divide.md Outdated
Comment thread mastracode/e2e/tui/plugins.ts
Comment thread mastracode/e2e/tui/plugins.ts
Comment thread mastracode/src/index.ts
Comment thread mastracode/src/main.ts Outdated
Comment thread mastracode/src/tui/commands/plugins.ts
Comment thread mastracode/src/tui/components/subagent-execution.ts
Comment thread mastracode/src/tui/components/tool-execution-enhanced.ts Outdated
Comment thread mastracode/src/tui/handlers/tool.ts
Comment thread mastracode/src/tui/mastra-tui.ts
@vercel
vercel Bot temporarily deployed to Preview – mastra-playground-ui June 30, 2026 02:29 Inactive
@vercel
vercel Bot temporarily deployed to Preview – mastra-docs-1.x June 30, 2026 02:29 Inactive
Comment thread mastracode/src/plugins/loader.ts Outdated
function renderIndex(pluginId: string, pluginName: string): string {
return `import { createTool, defineMastraCodePlugin, z } from 'mastracode/plugin';

export default defineMastraCodePlugin({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename it to experimentalDefineCodePluign? or just do breaking changes when we need to?

Suggested change
export default defineMastraCodePlugin({
export default experimentalDefineCodePluign({

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we make a breaking change to the plugin shape we can add something like specVersion: 2 or similar into defineMastraCodePlugin or have the import different like mastracode/plugin/v2 but I don't really expect we'll need to since the shape is pretty simple

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I also don't really expect many people outside of Mastra will write plugins anyway (I could be wrong)

TylerBarnes and others added 13 commits June 30, 2026 08:53
Add a TypeScript-only plugin API for Mastra Code tools, including plugin registry loading, local/GitHub install support, scaffolding, TUI management, dynamic tool exposure, and focused E2E coverage.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Add plugin progress helpers that route tool output through the controller into live TUI updates, including a configurable subagent-style renderer for plugin tools. The renderer now supports custom labels, colors, icons, taller activity windows, chronological text/tool activity, and history rehydration.\n\nAlso add local plugin hot reload by cache-busting TypeScript plugin imports with entry mtimes and watching local plugin entry files so edits are reflected without restarting Mastra Code. Cover streaming, renderer behavior, and same-session hot reload with focused unit and E2E tests.\n\nCo-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Reload changed local plugin entries before executing plugin tools so active sessions pick up updated tool implementations without a restart.

Tighten the hot reload E2E fixture to assert the actual updated tool result instead of only the follow-up model text.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Scaffold .mastracode-plugin.json so GitHub installs can find nested scaffolded plugin entries without guessing.

Allow entry retry paths to point at plugin directories as well as .ts files, then auto-detect the TypeScript entry inside the selected directory.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Keep GitHub-installed plugin checkouts fresh by periodically pulling fast-forward updates and reloading plugin tools when the checkout HEAD changes.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Allow project and global plugin registries to declare disabled plugin IDs so a globally installed plugin can be intentionally hidden in specific projects without uninstalling it.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Let plugins declare model, boolean, and string configuration options, persist configured values in plugin registries, pass resolved values into plugin context, and expose a /plugins configure flow.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Back up local commits and dirty working tree changes before refreshing installed GitHub plugin checkouts, then force the checkout to its upstream branch so plugin updates do not get stuck behind divergent local state.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Allow plugin model config values to be cleared so tools can inherit the active session model. Keep plugin config Escape navigation inside the overlay flow and hide custom-response choices for fixed plugin config prompts.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Expose plugin commands and skills from installed plugin directories so plugin authors can ship interaction assets alongside tools. Also requires plugin tools to use first-class { tool, render } entries and keeps plugin tools available across modes.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Let plugins declare additional system instructions that are loaded with active plugins and appended to the base MastraCode prompt. This gives plugin authors a first-class way to ship behavioral guidance alongside tools, commands, and skills.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Refresh plugin-provided runtime assets after reloads, avoid mutating tool objects for render metadata, and make GitHub plugin polling preserve dirty checkout state before resets.

Also document plugin trust boundaries and consolidate the mastracode plugin changeset.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Warn users that GitHub plugins auto-update from their repositories during install, while preserving the intentional auto-update behavior. Also isolate plugin-provided instructions behind explicit delimiters and priority guidance in the generated agent prompt.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
@vercel
vercel Bot temporarily deployed to Preview – mastra-docs-1.x June 30, 2026 17:27 Inactive
@dane-ai-mastra dane-ai-mastra Bot added tests: failing ❌ Changed tests passed against base tests: green ✅ Changed tests failed against base as expected and removed tests: green ✅ Changed tests failed against base as expected tests: failing ❌ Changed tests passed against base labels Jun 30, 2026
Tighten plugin registry path validation, harden GitHub checkout refreshes, surface plugin mutation failures, and polish plugin renderer/config behavior.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
Handle existing plugin package links safely and tighten bare-name scaffold detection.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
@vercel
vercel Bot temporarily deployed to Preview – mastra-docs-1.x June 30, 2026 18:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – mastra-playground-ui June 30, 2026 18:02 Inactive
@dane-ai-mastra dane-ai-mastra Bot added tests: failing ❌ Changed tests passed against base and removed tests: green ✅ Changed tests failed against base as expected labels Jun 30, 2026
Make the plugin changeset easier to scan and include a minimal public API example.

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
@superagent-security superagent-security Bot added pr:flagged Superagent security flag and removed pr:flagged Superagent security flag labels Jun 30, 2026
@dane-ai-mastra dane-ai-mastra Bot added tests: green ✅ Changed tests failed against base as expected and removed tests: failing ❌ Changed tests passed against base labels Jun 30, 2026
@TylerBarnes
TylerBarnes merged commit 6c86bda into main Jun 30, 2026
100 checks passed
@TylerBarnes
TylerBarnes deleted the feat/mc-basic-plugin-system branch June 30, 2026 20:03
CalebBarnes pushed a commit that referenced this pull request Jun 30, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @mastra/core@1.48.0-alpha.10

### Minor Changes

- add OM-managed working memory
([#18654](#18654))

Adds `observationalMemory.observation.manageWorkingMemory` so the
Observer can update working memory automatically instead of requiring
the main agent to call the working memory tool.

  ```ts
  new Memory({
    options: {
      workingMemory: { enabled: true },
      observationalMemory: {
        enabled: true,
        observation: { manageWorkingMemory: true },
      },
    },
  });
  ```

This option adds `WorkingMemoryExtractor`, defaults
`workingMemory.agentManaged` to `false`, and defaults
`workingMemory.useStateSignals` to `true` when working memory is
enabled. Set `workingMemory.agentManaged: true` to keep the main agent's
working memory tool and instructions enabled.

### Patch Changes

- add observational memory extractors
([#18653](#18653))

  Introduces a public Extractor API for Observational Memory
  with inline XML extraction and structured follow-up modes.
  Includes built-in extractors for current task, suggested
  response, and thread title. Persists extracted values into
  thread OM metadata with key-level merging and carry-forward
  into future observer/reflector prompts.

- Scripts using Mastra no longer hang after completing their work. The
scheduler timer that polls for due schedules previously kept the Node.js
event loop alive, preventing process exit even when all work was done.
The timer now allows the process to exit naturally.
([#18713](#18713))

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Fixed channel broadcasting so agent runs on a channel-backed thread
post back to the channel even when they did not start from an inbound
platform message. Previously only runs triggered by an incoming
Slack/Discord/etc. message would render to the channel; heartbeat,
Studio, and custom UI runs were silently dropped. The channels output
processor now reconstructs the channel destination from the thread
itself, so any run on a channel-backed thread delivers its output.
([#18630](#18630))
## @mastra/memory@1.22.0-alpha.3

### Minor Changes

- add observational memory extractors
([#18653](#18653))

  Introduces a public Extractor API for Observational Memory
  with inline XML extraction and structured follow-up modes.
  Includes built-in extractors for current task, suggested
  response, and thread title. Persists extracted values into
  thread OM metadata with key-level merging and carry-forward
  into future observer/reflector prompts.

- add OM-managed working memory
([#18654](#18654))

Adds `observationalMemory.observation.manageWorkingMemory` so the
Observer can update working memory automatically instead of requiring
the main agent to call the working memory tool.

  ```ts
  new Memory({
    options: {
      workingMemory: { enabled: true },
      observationalMemory: {
        enabled: true,
        observation: { manageWorkingMemory: true },
      },
    },
  });
  ```

This option adds `WorkingMemoryExtractor`, defaults
`workingMemory.agentManaged` to `false`, and defaults
`workingMemory.useStateSignals` to `true` when working memory is
enabled. Set `workingMemory.agentManaged: true` to keep the main agent's
working memory tool and instructions enabled.

### Patch Changes

- add Studio support for observational memory extractors
([#18655](#18655))

Adds `bufferedObservationChunks` and extraction metadata to the
buffer-status API and client types so extracted values flow through
during live streaming. Renders observational memory indicators from a
normalized cycle model that preserves extraction data across streaming,
refetch, reload, activation, and failure transitions.

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/client-js@1.29.0-alpha.10

### Patch Changes

- add Studio support for observational memory extractors
([#18655](#18655))

Adds `bufferedObservationChunks` and extraction metadata to the
buffer-status API and client types so extracted values flow through
during live streaming. Renders observational memory indicators from a
normalized cycle model that preserves extraction data across streaming,
refetch, reload, activation, and failure transitions.

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/react@1.2.1-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/client-js@1.29.0-alpha.10
## @mastra/deployer-cloud@1.48.0-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/deployer@1.48.0-alpha.10
## @mastra/longmemeval@1.1.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
  - @mastra/libsql@1.14.3-alpha.0
## @mastra/opencode@0.1.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
  - @mastra/libsql@1.14.3-alpha.0
## mastracode@0.27.0-alpha.10

### Patch Changes

- Improved the Mastra Code status area to show active work time,
completed work duration, and idle time.
([#18656](#18656))

- Added Mastra Code plugin support:
([#18658](#18658))
- Install, scaffold, configure, block, and auto-update plugins with
local-change backups.
- Load plugin tools in all modes, including streaming progress and
subagent-style rendering.
- Load bundled plugin commands, skills, and plugin-provided system
instructions.

  Example:

  ```ts
import { createTool, defineMastraCodePlugin, z } from
'mastracode/plugin';

  export default defineMastraCodePlugin({
    id: 'acme.tools',
    tools: {
      echo: {
        tool: createTool({
          id: 'echo',
          inputSchema: z.object({ message: z.string() }),
          execute: async ({ message }) => ({ message }),
        }),
      },
    },
  });
  ```

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
  - @mastra/libsql@1.14.3-alpha.0
  - @mastra/pg@1.14.3-alpha.0
  - @mastra/hono@1.5.3-alpha.10
  - @mastra/react@1.2.1-alpha.10
## @mastra/agent-builder@1.1.3-alpha.3

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
## mastra@1.17.0-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/deployer@1.48.0-alpha.10
## @mastra/deployer@1.48.0-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/editor@0.13.3-alpha.3

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
## @mastra/mcp-docs-server@1.2.3-alpha.17

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/playground-ui@38.0.0-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
  - @mastra/client-js@1.29.0-alpha.10
  - @mastra/react@1.2.1-alpha.10
## @mastra/server@1.48.0-alpha.10

### Patch Changes

- add Studio support for observational memory extractors
([#18655](#18655))

Adds `bufferedObservationChunks` and extraction metadata to the
buffer-status API and client types so extracted values flow through
during live streaming. Renders observational memory indicators from a
normalized cycle model that preserves extraction data across streaming,
refetch, reload, activation, and failure transitions.

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/express@1.4.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/fastify@1.4.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/hono@1.5.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/koa@1.6.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/nestjs@0.2.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/next@0.2.2-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
  - @mastra/hono@1.5.3-alpha.10
## @mastra/tanstack-start@0.2.2-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
  - @mastra/hono@1.5.3-alpha.10
## @mastra/libsql@1.14.3-alpha.0

### Patch Changes

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/mongodb@1.11.1-alpha.1

### Patch Changes

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/mysql@0.3.2-alpha.0

### Patch Changes

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/pg@1.14.3-alpha.0

### Patch Changes

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/temporal@0.2.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/deployer@1.48.0-alpha.10
## create-mastra@1.17.0-alpha.10


## @internal/playground@1.17.0-alpha.10

### Patch Changes

- add Studio support for observational memory extractors
([#18655](#18655))

Adds `bufferedObservationChunks` and extraction metadata to the
buffer-status API and client types so extracted values flow through
during live streaming. Renders observational memory indicators from a
normalized cycle model that preserves extraction data across streaming,
refetch, reload, activation, and failure transitions.

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/client-js@1.29.0-alpha.10
  - @mastra/react@1.2.1-alpha.10
  - @mastra/playground-ui@38.0.0-alpha.10

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
wardpeet pushed a commit that referenced this pull request Jul 1, 2026
Adds the first Mastra Code plugin system so users can install trusted
local or GitHub plugins and expose their tools inside the TUI.

Plugins can be a local path, or installed via a github url. When
installing from github it will clone it to the installed scope (project
or global) and MC will then periodically check if it needs to pull new
commits down.

For local plugins, it hot reloads tool changes, allowing MC to work on
its own tools via a plugin. It can modify the tool, call it, modify, etc
in a loop until it works properly.

```ts
import { defineMastraCodePlugin, createTool, z } from 'mastracode/plugin';

export default defineMastraCodePlugin({
  id: 'example.plugin',
  name: 'Example Plugin',
  tools: {
    example_tool: {
      tool: createTool({
        id: 'example_tool',
        description: 'Run an example plugin tool',
        inputSchema: z.object({ message: z.string() }),
        execute: async context => ({ message: context.message }),
      }),
    },
  },
});
```

Plugins can define tools, optional config, render hints, bundled slash
commands and skills, and plugin instructions. The `/plugins` UI handles
install, scaffold, details, config, enable/disable, and local/GitHub
source management. Local plugin edits reload at execution time, and
GitHub checkouts poll for updates while preserving local changes on
backup branches before resetting.

This also adds project-level plugin blocking, progress streaming for
plugin tools, subagent-style rendering for plugin tools that ask for it,
and a README note that plugins should only be installed from trusted
sources.

Smoke tested with Alexandria: the expert tool executes, config persists,
and bundled command/skill loading was tested earlier. Focused unit
tests, typecheck, and `pnpm build:mastracode` pass.

example plugin:
https://github.com/mastra-ai/alexandria/blob/main/.mastracode/plugins/sources/local/alexandria/src/index.ts#L101

<img width="675" height="103" alt="Screenshot 2026-06-29 at 5 07 24 PM"
src="https://github.com/user-attachments/assets/74db5628-e546-421b-9916-f68a9eed281d"
/>
<img width="890" height="328" alt="Screenshot 2026-06-29 at 5 07 39 PM"
src="https://github.com/user-attachments/assets/9b3c6add-1d98-4583-8e74-0a0f9fdbe99d"
/>
<img width="721" height="336" alt="Screenshot 2026-06-29 at 5 07 34 PM"
src="https://github.com/user-attachments/assets/f2d3e0be-c9b8-41ed-9208-56ff82f380ed"
/>
<img width="564" height="506" alt="Screenshot 2026-06-29 at 5 07 44 PM"
src="https://github.com/user-attachments/assets/6f082267-52c5-43a0-98af-3b3e06d4f582"
/>

<img width="2530" height="1156" alt="image (34)"
src="https://github.com/user-attachments/assets/e964bf8c-dbd3-4ead-b25e-3ea848ac93bf"
/>



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
This PR adds a way for Mastra Code to load “trusted plugin” code so it
can learn new tools and commands. You can install plugins from your
computer or GitHub, manage them in the terminal UI, and see their tool
progress update live—plus reload plugins automatically when local code
changes or GitHub has updates.

## Summary
- Introduces the first Mastra Code plugin system:
- Public plugin API/types (`defineMastraCodePlugin`) and
`writeToolProgress` support
  - `.mastracode-plugin.json` manifest handling
- Local + GitHub install, local discovery, scoped plugin registries
(load/merge/save), and a full plugin loader pipeline
- A `PluginManager` that tracks active plugins, supports reloads, and
handles local hot-reload + GitHub polling/update with backup/dirtiness
safety
  - Project-level plugin blocking via `disabledPlugins`

- Wires plugins into the app runtime so plugin contributions work
everywhere:
- Merges plugin tool names into mode allowlists and dynamically builds
toolsets from loaded plugin tools
  - Appends plugin-provided instructions into generated agent prompts
- Exposes plugin-provided assets via TUI/session state
(skills/commands/instructions), and treats plugin command dirs as extra
high-priority slash-command sources

- Adds `/plugins` TUI management with end-to-end flows:
- Install new plugins, scaffold plugin projects, view details, configure
plugin config values (including model selection + API key prompting),
enable/disable, uninstall
- Install-source management (local path vs GitHub URL) with
trust-confirmation guidance
- Includes block/disabled handling in the UI and behavior
(hidden/conflicted/blocked states)

- Improves plugin tool UX in chat/TUI:
- Streams plugin tool progress from core → TUI using
`data-mastracode-tool-progress`, emitting tool updates and rendering
progress output
- Adds “subagent-style” rendering for tools that request it, including
static subagent component handling and replay for previously stored tool
calls
  - Supports local hot reloading and GitHub polling/update scenarios

- Tests + release notes:
- Adds unit tests for plugin loader/manager/registry/scaffold, plugin
instruction generation, tool-progress streaming, and tool rendering
precedence
  - Adds TUI unit tests for `/plugins`
- Adds E2E fixtures covering bundled commands/skills, tool streaming,
local hot reload, GitHub poll updates, blocking/config behavior, and
scaffold/install/execute flows
- Updates docs and adds a changeset publishing “Mastra Code” plugin
support.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
wardpeet pushed a commit that referenced this pull request Jul 1, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @mastra/core@1.48.0-alpha.10

### Minor Changes

- add OM-managed working memory
([#18654](#18654))

Adds `observationalMemory.observation.manageWorkingMemory` so the
Observer can update working memory automatically instead of requiring
the main agent to call the working memory tool.

  ```ts
  new Memory({
    options: {
      workingMemory: { enabled: true },
      observationalMemory: {
        enabled: true,
        observation: { manageWorkingMemory: true },
      },
    },
  });
  ```

This option adds `WorkingMemoryExtractor`, defaults
`workingMemory.agentManaged` to `false`, and defaults
`workingMemory.useStateSignals` to `true` when working memory is
enabled. Set `workingMemory.agentManaged: true` to keep the main agent's
working memory tool and instructions enabled.

### Patch Changes

- add observational memory extractors
([#18653](#18653))

  Introduces a public Extractor API for Observational Memory
  with inline XML extraction and structured follow-up modes.
  Includes built-in extractors for current task, suggested
  response, and thread title. Persists extracted values into
  thread OM metadata with key-level merging and carry-forward
  into future observer/reflector prompts.

- Scripts using Mastra no longer hang after completing their work. The
scheduler timer that polls for due schedules previously kept the Node.js
event loop alive, preventing process exit even when all work was done.
The timer now allows the process to exit naturally.
([#18713](#18713))

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Fixed channel broadcasting so agent runs on a channel-backed thread
post back to the channel even when they did not start from an inbound
platform message. Previously only runs triggered by an incoming
Slack/Discord/etc. message would render to the channel; heartbeat,
Studio, and custom UI runs were silently dropped. The channels output
processor now reconstructs the channel destination from the thread
itself, so any run on a channel-backed thread delivers its output.
([#18630](#18630))
## @mastra/memory@1.22.0-alpha.3

### Minor Changes

- add observational memory extractors
([#18653](#18653))

  Introduces a public Extractor API for Observational Memory
  with inline XML extraction and structured follow-up modes.
  Includes built-in extractors for current task, suggested
  response, and thread title. Persists extracted values into
  thread OM metadata with key-level merging and carry-forward
  into future observer/reflector prompts.

- add OM-managed working memory
([#18654](#18654))

Adds `observationalMemory.observation.manageWorkingMemory` so the
Observer can update working memory automatically instead of requiring
the main agent to call the working memory tool.

  ```ts
  new Memory({
    options: {
      workingMemory: { enabled: true },
      observationalMemory: {
        enabled: true,
        observation: { manageWorkingMemory: true },
      },
    },
  });
  ```

This option adds `WorkingMemoryExtractor`, defaults
`workingMemory.agentManaged` to `false`, and defaults
`workingMemory.useStateSignals` to `true` when working memory is
enabled. Set `workingMemory.agentManaged: true` to keep the main agent's
working memory tool and instructions enabled.

### Patch Changes

- add Studio support for observational memory extractors
([#18655](#18655))

Adds `bufferedObservationChunks` and extraction metadata to the
buffer-status API and client types so extracted values flow through
during live streaming. Renders observational memory indicators from a
normalized cycle model that preserves extraction data across streaming,
refetch, reload, activation, and failure transitions.

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/client-js@1.29.0-alpha.10

### Patch Changes

- add Studio support for observational memory extractors
([#18655](#18655))

Adds `bufferedObservationChunks` and extraction metadata to the
buffer-status API and client types so extracted values flow through
during live streaming. Renders observational memory indicators from a
normalized cycle model that preserves extraction data across streaming,
refetch, reload, activation, and failure transitions.

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/react@1.2.1-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/client-js@1.29.0-alpha.10
## @mastra/deployer-cloud@1.48.0-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/deployer@1.48.0-alpha.10
## @mastra/longmemeval@1.1.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
  - @mastra/libsql@1.14.3-alpha.0
## @mastra/opencode@0.1.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
  - @mastra/libsql@1.14.3-alpha.0
## mastracode@0.27.0-alpha.10

### Patch Changes

- Improved the Mastra Code status area to show active work time,
completed work duration, and idle time.
([#18656](#18656))

- Added Mastra Code plugin support:
([#18658](#18658))
- Install, scaffold, configure, block, and auto-update plugins with
local-change backups.
- Load plugin tools in all modes, including streaming progress and
subagent-style rendering.
- Load bundled plugin commands, skills, and plugin-provided system
instructions.

  Example:

  ```ts
import { createTool, defineMastraCodePlugin, z } from
'mastracode/plugin';

  export default defineMastraCodePlugin({
    id: 'acme.tools',
    tools: {
      echo: {
        tool: createTool({
          id: 'echo',
          inputSchema: z.object({ message: z.string() }),
          execute: async ({ message }) => ({ message }),
        }),
      },
    },
  });
  ```

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
  - @mastra/libsql@1.14.3-alpha.0
  - @mastra/pg@1.14.3-alpha.0
  - @mastra/hono@1.5.3-alpha.10
  - @mastra/react@1.2.1-alpha.10
## @mastra/agent-builder@1.1.3-alpha.3

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
## mastra@1.17.0-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/deployer@1.48.0-alpha.10
## @mastra/deployer@1.48.0-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/editor@0.13.3-alpha.3

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
## @mastra/mcp-docs-server@1.2.3-alpha.17

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/playground-ui@38.0.0-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/memory@1.22.0-alpha.3
  - @mastra/core@1.48.0-alpha.10
  - @mastra/client-js@1.29.0-alpha.10
  - @mastra/react@1.2.1-alpha.10
## @mastra/server@1.48.0-alpha.10

### Patch Changes

- add Studio support for observational memory extractors
([#18655](#18655))

Adds `bufferedObservationChunks` and extraction metadata to the
buffer-status API and client types so extracted values flow through
during live streaming. Renders observational memory indicators from a
normalized cycle model that preserves extraction data across streaming,
refetch, reload, activation, and failure transitions.

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/express@1.4.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/fastify@1.4.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/hono@1.5.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/koa@1.6.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/nestjs@0.2.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
## @mastra/next@0.2.2-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
  - @mastra/hono@1.5.3-alpha.10
## @mastra/tanstack-start@0.2.2-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/server@1.48.0-alpha.10
  - @mastra/hono@1.5.3-alpha.10
## @mastra/libsql@1.14.3-alpha.0

### Patch Changes

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/mongodb@1.11.1-alpha.1

### Patch Changes

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/mysql@0.3.2-alpha.0

### Patch Changes

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/pg@1.14.3-alpha.0

### Patch Changes

- Fixed buffered observation extraction metadata so stored OM chunks
keep extracted values and extraction failures across memory storage
adapters. ([#18655](#18655))

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
## @mastra/temporal@0.2.3-alpha.10

### Patch Changes

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/deployer@1.48.0-alpha.10
## create-mastra@1.17.0-alpha.10


## @internal/playground@1.17.0-alpha.10

### Patch Changes

- add Studio support for observational memory extractors
([#18655](#18655))

Adds `bufferedObservationChunks` and extraction metadata to the
buffer-status API and client types so extracted values flow through
during live streaming. Renders observational memory indicators from a
normalized cycle model that preserves extraction data across streaming,
refetch, reload, activation, and failure transitions.

- Updated dependencies
[[`6f578ac`](6f578ac),
[`c01012f`](c01012f),
[`9eefdc0`](9eefdc0),
[`be875ed`](be875ed),
[`9eefdc0`](9eefdc0),
[`7d112ca`](7d112ca)]:
  - @mastra/core@1.48.0-alpha.10
  - @mastra/client-js@1.29.0-alpha.10
  - @mastra/react@1.2.1-alpha.10
  - @mastra/playground-ui@38.0.0-alpha.10

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

complexity: critical Critical-complexity PR tests: green ✅ Changed tests failed against base as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants