Fix scaffold pain points + fix three regressions (plan prompt, mutation filter, migrations)#29
Merged
teallarson merged 2 commits intomainfrom Mar 18, 2026
Merged
Conversation
…, migrations, source mapping - B1: plan/route.ts now imports systemPrompt from lib/agent.ts (removes duplicate PLAN_SYSTEM_PROMPT) - B2: mutation filter narrowed to destructive-only ops (delete/archive/remove/merge/close) - B3: NEXT_PUBLIC_APP_URL and BETTER_AUTH_URL derived from PORT in next.config.ts - B4: runMigrations verifies non-empty SQL output; adds db:setup script to templates - B5: lib/sources.ts adds Reddit, X, and Notion source mappings - Bump version to 0.5.0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ration messages The previous commit replaced the structured planning prompt (which emits ```json:task / ```json:summary blocks) with the general system prompt, breaking the parser — zero tasks shown. This restores a dedicated plan-prompt.md for the planning route. Also restores the comprehensive mutation filter regex (create, update, send, reply, etc.) and replaces hardcoded "bun run db:setup" recovery messages with template-aware commands from meta.migrate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The first commit (
ac3ae8e) introduced scaffold improvements but also caused three regressions. The second commit fixes all three:Original improvements (ac3ae8e)
lib/agent.ts/triage-agent.tsNEXT_PUBLIC_APP_URLandBETTER_AUTH_URLderived fromPORTinnext.config.ts.sqlfiles were generated before proceeding0.4.1 → 0.5.0Regression fixes (4ae140d)
system-prompt.mduses plain-text format, but theextractJsonBlocks()parser expects```json:task/```json:summaryfenced blocks. Created a dedicatedplan-prompt.mdwith the structured format and wired it into both ai-sdk and mastra plan routes.delete|archive|remove|merge|close, allowing write tools (create, send, reply, post, etc.) through to the planner. Restored the full filter."bun run db:setup"is wrong for langchain (Python/Alembic). AddedformatMigrateCommands()helper that builds the correct command frommeta.migrate.Files changed
templates/_shared/plan-prompt.mdtemplates/_shared/partials/plan-route-body.hbsplanPromptinstead ofsystemPrompt; restore comprehensive mutation filtertemplates/ai-sdk/template.jsonplan-prompt.mdto sharedFilestemplates/mastra/template.jsonplan-prompt.mdto sharedFilestemplates/ai-sdk/lib/agent.tsplanPrompttemplates/mastra/src/mastra/agents/triage-agent.tsplanPrompttemplates/ai-sdk/app/api/plan/route.ts.hbsplanPromptinstead ofsystemPrompttemplates/mastra/app/api/plan/route.ts.hbsplanPromptinstead ofsystemPromptsrc/post-scaffold.tsformatMigrateCommands()helper; use for recovery messagesTest plan
ai-sdktemplate — verifylib/plan-prompt.mdexists and plan route importsplanPromptmastratemplate — verifysrc/mastra/agents/plan-prompt.mdexists and plan route importsplanPromptlangchaintemplate — verify unchanged (uses its own_build_plan_prompt()).venv/bin/alembic upgrade head🤖 Generated with Claude Code