github mastra-ai/mastra @mastra/core@1.6.0
February 23, 2026

latest releases: @mastra/pg@1.6.1, @mastra/mongodb@1.5.1, @mastra/libsql@1.6.1...
9 hours ago

Highlights

AST-Based Workspace Edit Tool (mastra_workspace_ast_edit)

A new AST edit tool enables intelligent code transformations (rename identifiers, add/remove/merge imports, pattern-based replacements with metavariables) and is automatically available when @ast-grep/napi is installed, enabling robust refactors beyond string-based edits.

Harness UX + Built-ins: Streaming Tool Argument Previews and Task Tools

Tool renderers now stream argument previews in real time (including diffs for edits and streamed file content for writes) via partial JSON parsing, and task_write/task_check are now built-in Harness tools automatically injected into agent calls for structured task tracking.

Observational Memory Continuity Improvements (Suggested Continuation + Current Task)

Observational Memory now preserves suggestedContinuation and currentTask across activations (with storage adapter support), improving conversational continuity when the message window shrinks; activation/priority handling is improved to better hit retention targets and avoid runaway observer output.

Changelog

@mastra/core@1.6.0

Minor Changes

  • Added AST edit tool (workspace_ast_edit) for intelligent code transformations using AST analysis. Supports renaming identifiers, adding/removing/merging imports, and pattern-based find-and-replace with metavariable substitution. Automatically available when @ast-grep/napi is installed in the project. (#13233)

    Example:

    const workspace = new Workspace({
      filesystem: new LocalFilesystem({ basePath: '/my/project' }),
    });
    const tools = createWorkspaceTools(workspace);
    
    // Rename all occurrences of an identifier
    await tools['mastra_workspace_ast_edit'].execute({
      path: '/src/utils.ts',
      transform: 'rename',
      targetName: 'oldName',
      newName: 'newName',
    });
    
    // Add an import (merges into existing imports from the same module)
    await tools['mastra_workspace_ast_edit'].execute({
      path: '/src/app.ts',
      transform: 'add-import',
      importSpec: { module: 'react', names: ['useState', 'useEffect'] },
    });
    
    // Pattern-based replacement with metavariables
    await tools['mastra_workspace_ast_edit'].execute({
      path: '/src/app.ts',
      pattern: 'console.log($ARG)',
      replacement: 'logger.debug($ARG)',
    });
  • Added streaming tool argument previews across all tool renderers. Tool names, file paths, and commands now appear immediately as the model generates them, rather than waiting for the complete tool call. (#13328)

    • Generic tools show live key/value argument previews as args stream in
    • Edit tool renders a bordered diff preview as soon as old_str and new_str are available, even before the tool result arrives
    • Write tool streams syntax-highlighted file content in a bordered box while args arrive
    • Find files shows the glob pattern in the pending header
    • Task write streams items directly into the pinned task list component in real-time

    All tools use partial JSON parsing to progressively display argument information. This is enabled automatically for all Harness-based agents — no configuration required.

  • Added optional threadLock callbacks to HarnessConfig for preventing concurrent thread access across processes. The Harness calls acquire/release during selectOrCreateThread, createThread, and switchThread when configured. Locking is opt-in — when threadLock is not provided, behavior is unchanged. (#13334)

    const harness = new Harness({
      id: 'my-harness',
      storage: myStore,
      modes: [{ id: 'default', agent: myAgent }],
      threadLock: {
        acquire: threadId => acquireThreadLock(threadId),
        release: threadId => releaseThreadLock(threadId),
      },
    });
  • Refactored all Harness class methods to accept object parameters instead of positional arguments, and standardized method naming. (#13353)

    Why: Positional arguments make call sites harder to read, especially for methods with optional middle parameters or multiple string arguments. Object parameters are self-documenting and easier to extend without breaking changes.

    • Methods returning arrays use list prefix (listModes, listAvailableModels, listMessages, listMessagesForThread)
    • persistThreadSettingsetThreadSetting
    • resolveToolApprovalDecisionrespondToToolApproval (consistent with respondToQuestion / respondToPlanApproval)
    • setPermissionCategorysetPermissionForCategory
    • setPermissionToolsetPermissionForTool

    Before:

    await harness.switchMode('build');
    await harness.sendMessage('Hello', { images });
    const modes = harness.getModes();
    const models = await harness.getAvailableModels();
    harness.resolveToolApprovalDecision('approve');

    After:

    await harness.switchMode({ modeId: 'build' });
    await harness.sendMessage({ content: 'Hello', images });
    const modes = harness.listModes();
    const models = await harness.listAvailableModels();
    harness.respondToToolApproval({ decision: 'approve' });

    The HarnessRequestContext interface methods (registerQuestion, registerPlanApproval, getSubagentModelId) are also updated to use object parameters.

  • Added task_write and task_check as built-in Harness tools. These tools are automatically injected into every agent call, allowing agents to track structured task lists without manual tool registration. (#13344)

    // Agents can call task_write to create/update a task list
    await tools['task_write'].execute({
      tasks: [
        { content: 'Fix authentication bug', status: 'in_progress', activeForm: 'Fixing authentication bug' },
        { content: 'Add unit tests', status: 'pending', activeForm: 'Adding unit tests' },
      ],
    });
    
    // Agents can call task_check to verify all tasks are complete before finishing
    await tools['task_check'].execute({});
    // Returns: { completed: 1, inProgress: 0, pending: 1, allDone: false, incomplete: [...] }

Patch Changes

  • Fixed duplicate Vercel AI Gateway configuration that could cause incorrect API key resolution. Removed a redundant override that conflicted with the upstream models.dev registry. (#13291)

  • Fixed Vercel AI Gateway failing when using the model router string format (e.g. vercel/openai/gpt-oss-120b). The provider registry was overriding createGateway's base URL with an incorrect value, causing API requests to hit the wrong endpoint. Removed the URL override so the AI SDK uses its own correct default. Closes #13280. (#13287)

  • Fixed recursive schema warnings for processor graph entries by unrolling to a fixed depth of 3 levels, matching the existing rule group pattern (#13292)

  • Fixed Observational Memory status not updating during conversations. The harness was missing streaming handlers for OM data chunks (status, observation start/end, buffering, activation), so the TUI never received real-time OM progress updates. Also added switchObserverModel and switchReflectorModel methods so changing OM models properly emits events to subscribers. (#13330)

  • Fixed thread resuming in git worktrees. Previously, starting mastracode in a new worktree would resume a thread from another worktree of the same repo. Threads are now auto-tagged with the project path and filtered on resume so each worktree gets its own thread scope. (#13343)

  • Fixed a crash where the Node.js process would terminate with an unhandled TypeError when an LLM stream encountered an error. The ReadableStreamDefaultController would throw "Controller is already closed" when chunks were enqueued after a downstream consumer cancelled or terminated the stream. All controller.enqueue(), controller.close(), and controller.error() calls now check if the controller is still open before attempting operations. (#13107) (#13142)

  • Added suggestedContinuation and currentTask fields to the in-memory storage adapter's Observational Memory activation result, aligning it with the persistent storage implementations. (#13354)

  • Fixed provider-executed tools (e.g. Anthropic web_search) causing stream bail when called in parallel with regular tools. The tool-call-step now provides a fallback result for provider-executed tools whose output was not propagated, preventing the mapping step from misidentifying them as pending HITL interactions. Fixes #13125. (#13126)

  • Updated dependencies [7184d87]:

    • @mastra/schema-compat@1.1.2

@mastra/arize@1.0.4

Patch Changes

@mastra/braintrust@1.0.4

Patch Changes

@mastra/clickhouse@1.2.2

Patch Changes

@mastra/client-js@1.6.0

Patch Changes

@mastra/cloudflare@1.2.1

Patch Changes

@mastra/datadog@1.0.3

Patch Changes

@mastra/deployer@1.6.0

Patch Changes

@mastra/deployer-cloud@1.6.0

Patch Changes

@mastra/deployer-cloudflare@1.1.3

Patch Changes

@mastra/deployer-netlify@1.0.7

Patch Changes

@mastra/deployer-vercel@1.0.7

Patch Changes

@mastra/express@1.1.5

Patch Changes

@mastra/fastify@1.1.5

Patch Changes

@mastra/hono@1.1.5

Patch Changes

@mastra/koa@1.2.1

Patch Changes

@mastra/laminar@1.0.3

Patch Changes

@mastra/langfuse@1.0.3

Patch Changes

@mastra/langsmith@1.1.1

Patch Changes

@mastra/libsql@1.6.0

Minor Changes

  • Added MCP server table and CRUD operations to storage adapters, enabling MCP server configurations to be persisted alongside agents and workflows. (#13357)

Patch Changes

@mastra/longmemeval@1.0.7

Patch Changes

@mastra/mcp-docs-server@1.1.4

Patch Changes

@mastra/memory@1.5.0

Minor Changes

  • Improved conversational continuity when the message window shrinks during Observational Memory activation. The agent now preserves its suggested next response and current task across activation, so it maintains context instead of losing track of the conversation. (#13354)

    Also improved the Observer to capture user messages more faithfully, reduce repetitive observations, and treat the most recent user message as the highest-priority signal.

Patch Changes

  • Improved Observational Memory priority handling. User messages and task completions are now always treated as high priority, ensuring the observer captures the most relevant context during conversations. (#13329)

  • Improved Observational Memory activation to preserve more usable context after activation. Previously, activation could leave the agent with too much or too little context depending on how chunks aligned with the retention target. (#13305)

    • Activation now lands closer to the retention target by biasing chunk selection to slightly overshoot rather than undershoot
    • Added safeguards to prevent activation from consuming too much context (95% ceiling and 1000-token floor)
    • When pending tokens exceed blockAfter, activation now aggressively reduces context to unblock the conversation
    • bufferActivation now accepts absolute token values (>= 1000) in addition to ratios (0–1), giving more precise control over when activation triggers
  • Observations no longer inflate token counts from degenerate LLM output. Runaway or repetitive observer/reflector output is automatically detected and retried, preventing excessive context usage after activation. (#13354)

  • Updated dependencies [0d9efb4, 7184d87, 5caa13d, 940163f, 47892c8, 45bb78b, 70eef84, d84e52d, 24b80af, 608e156, 2b2e157, 59d30b5, 453693b, 78d1c80, c204b63, 742a417]:

    • @mastra/core@1.6.0
    • @mastra/schema-compat@1.1.2

@mastra/mongodb@1.5.0

Minor Changes

  • Added MCP server table and CRUD operations to storage adapters, enabling MCP server configurations to be persisted alongside agents and workflows. (#13357)

Patch Changes

@mastra/observability@1.2.1

Patch Changes

  • Fixed telemetry spans being silently dropped when the default exporter was used. The exporter now holds spans in memory until initialization completes, ensuring all spans are propagated to your tracing backend. (#12936)

  • Fixed keysToStrip.has is not a function crash in deepClean() when bundlers transform new Set([...]) into a plain object or array. This affected agents with memory deployed to Mastra Cloud. (#13322)

  • Updated dependencies [0d9efb4, 5caa13d, 940163f, 47892c8, 45bb78b, 70eef84, d84e52d, 24b80af, 608e156, 2b2e157, 59d30b5, 453693b, 78d1c80, c204b63, 742a417]:

    • @mastra/core@1.6.0

@mastra/opencode@0.0.4

Patch Changes

@mastra/otel-bridge@1.0.3

Patch Changes

@mastra/otel-exporter@1.0.3

Patch Changes

@mastra/pg@1.6.0

Minor Changes

  • Added MCP server table and CRUD operations to storage adapters, enabling MCP server configurations to be persisted alongside agents and workflows. (#13357)

Patch Changes

@mastra/playground-ui@13.0.0

Minor Changes

  • Added Tree.Input component for inline file and folder creation within the Tree. Supports auto-focus, Enter to confirm, Escape to cancel, and blur handling with correct depth indentation. (#13264)

    import { Tree } from '@mastra/playground-ui';
    
    <Tree.Folder name="src" defaultOpen>
      <Tree.Input
        type="file"
        placeholder="new-file.ts"
        onSubmit={name => createFile(name)}
        onCancel={() => setCreating(false)}
      />
      <Tree.File name="index.ts" />
    </Tree.Folder>;

Patch Changes

  • dependencies updates: (#13284)

  • dependencies updates: (#13300)

  • Added a side-by-side diff view to the Dataset comparison pages (Compare Items and Compare Item Versions), making it easier to spot differences between dataset entries at a glance. (#13267)

  • Fixed the Experiment Result panel crashing with a type error when results contained nested objects instead of plain strings. (#13275)

  • Added a searchable combobox header to the Dataset page, allowing you to quickly filter and switch between datasets without scrolling through a long list. (#13273)

  • Added a composable Tree component for displaying file-system-like views with collapsible folders, file type icons, selection support, and action slots (#13259)

  • Updated dependencies [e4034e5, 0d9efb4, 7184d87, 5caa13d, 940163f, 47892c8, 3f8f1b3, 45bb78b, 70eef84, d84e52d, 24b80af, 608e156, 2b2e157, 59d30b5, 453693b, 78d1c80, c204b63, 742a417]:

    • @mastra/react@0.2.5
    • @mastra/core@1.6.0
    • @mastra/client-js@1.6.0
    • @mastra/schema-compat@1.1.2
    • @mastra/ai-sdk@1.0.5

@mastra/posthog@1.0.4

Patch Changes

@mastra/react@0.2.5

Patch Changes

@mastra/schema-compat@1.1.2

Patch Changes

  • Fixed Groq provider not receiving schema compatibility transformations, which caused HTTP 400 errors when AI models omitted optional parameters from workspace tool calls (e.g. list_files). Groq now correctly gets the same optional-to-nullable schema handling as OpenAI. (#13303)

@mastra/sentry@1.0.3

Patch Changes

@mastra/server@1.6.0

Patch Changes

Don't miss a new mastra release

NewReleases is sending notifications on new releases.