Skip to content

feat: add mastracode integration#440

Closed
wardpeet wants to merge 1 commit into
ogulcancelik:masterfrom
wardpeet:issue/337-mastracode-integration
Closed

feat: add mastracode integration#440
wardpeet wants to merge 1 commit into
ogulcancelik:masterfrom
wardpeet:issue/337-mastracode-integration

Conversation

@wardpeet

@wardpeet wardpeet commented Jun 3, 2026

Copy link
Copy Markdown

Summary

  • Add MastraCode as an installable Herdr integration target.
  • Install a MastraCode hook asset into the MastraCode config directory.
  • Wire MastraCode CLI parsing, integration recommendations/status, install, uninstall, and tests.

Refs #337

Test plan

  • git diff --check
  • sh -n src/integration/assets/mastracode/herdr-agent-state.sh
  • HERDR_ENV=0 sh src/integration/assets/mastracode/herdr-agent-state.sh working <<<'{}'

just and cargo are not available in this local environment, so the full Rust check suite could not be run here.

refs ogulcancelik#337

Co-Authored-By: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
@ogulcancelik

Copy link
Copy Markdown
Owner

@wardpeet thanks for the pr. the upstream conflict looks small enough to resolve; it is mostly newer integrations landing in the same registry code.

i checked mastracode hooks docs. the available events appear to be sessionstart, userpromptsubmit, pretooluse, posttooluse, stop, sessionend, and notification: https://code.mastra.ai/configuration#hook-events

my main question is whether those hooks are lifecycle-complete enough to use as the source of truth. mastracode has permission rules with ask, so approval prompts exist, but i do not see a dedicated permission/request hook. does notification fire for those approval prompts, or is there another hook payload we can use to reliably report blocked?

also, have you confirmed esc/interruption behavior? the docs say stop fires when an agent response ends as complete, aborted, or error, so i expect esc to produce stop, but it would be good to verify against the actual cli.

if the hooks are only event notifications rather than a complete status lifecycle, i would prefer not to make them the primary integration path. we had similar issues with claude code and codex: missed or ambiguous hook events made state drift, and we ended up relying on screen reads because herdr needs current visible status, not just event history. if mastracode has stable visible ui states, please consider adding screen heuristics instead; src/detect/agents/codex.rs and src/detect/agents/claude_code.rs are good references.

@ogulcancelik

Copy link
Copy Markdown
Owner

@wardpeet i assume you don't have much time to support this. let me know when you want to :)

@wardpeet

Copy link
Copy Markdown
Author

Hey sorry, pushing a new feature. Afterwards i'll re-open. I've been using herdr non stop! :D

@ogulcancelik

Copy link
Copy Markdown
Owner

Hey sorry, pushing a new feature. Afterwards i'll re-open. I've been using herdr non stop! :D

let me know when you are able to support the pr :D also please check docs now herdr has two tiers of agents, first citizen agents who have full lifecylce hook supports or not, both require new manifest shapes, also agent detect cli should help you to debug the correct manifest regarding screens. if mastracode uses osc for titles even better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants