Unified Agent + reusable Go agent core.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add built-in gpt-5 system prompt patch

Lyric 8702d538 e01a6c3d

+138
+1
cmd/mistermorph/runcmd/run.go
··· 197 197 promptprofile.AppendLocalToolNotesBlock(&promptSpec, logger) 198 198 promptprofile.AppendPlanCreateGuidanceBlock(&promptSpec, reg) 199 199 promptprofile.AppendTodoWorkflowBlock(&promptSpec, reg) 200 + promptprofile.AppendGPT5PromptPatch(&promptSpec, strings.TrimSpace(mainCfg.Model), logger) 200 201 201 202 var hook agent.Hook 202 203 if configutil.FlagOrViperBool(cmd, "interactive", "interactive") {
+1
integration/runtime.go
··· 251 251 promptprofile.AppendLocalToolNotesBlock(&promptSpec, logger) 252 252 promptprofile.AppendPlanCreateGuidanceBlock(&promptSpec, reg) 253 253 rt.appendPromptBlocks(&promptSpec) 254 + promptprofile.AppendGPT5PromptPatch(&promptSpec, model, logger) 254 255 255 256 opts := []agent.Option{ 256 257 agent.WithLogger(logger),
+1
internal/channelruntime/heartbeat/run.go
··· 256 256 } 257 257 } 258 258 depsutil.PromptAugmentFromCommon(depsutil.CommonFromHeartbeat(d), &promptSpec, reg) 259 + promptprofile.AppendGPT5PromptPatch(&promptSpec, strings.TrimSpace(opts.Model), opts.Logger) 259 260 260 261 engine := agent.New( 261 262 opts.Client,
+1
internal/channelruntime/taskruntime/runtime.go
··· 220 220 return RunResult{}, err 221 221 } 222 222 depsutil.PromptAugmentFromCommon(rt.commonDeps, &promptSpec, reg) 223 + promptprofile.AppendGPT5PromptPatch(&promptSpec, model, logger) 223 224 224 225 agentCfg := rt.AgentConfig 225 226 agentCfg.DefaultModel = model
+39
internal/promptprofile/model_patches.go
··· 1 + package promptprofile 2 + 3 + import ( 4 + _ "embed" 5 + "log/slog" 6 + "strings" 7 + 8 + "github.com/quailyquaily/mistermorph/agent" 9 + ) 10 + 11 + //go:embed prompts/system.openai.gpt_5.md 12 + var gpt5PromptPatchSource string 13 + 14 + const gpt5PromptPatchFileName = "system.openai.gpt_5.md" 15 + 16 + func AppendGPT5PromptPatch(spec *agent.PromptSpec, model string, log *slog.Logger) { 17 + if spec == nil || !isGPT5FamilyModel(model) { 18 + return 19 + } 20 + content := strings.TrimSpace(gpt5PromptPatchSource) 21 + if content == "" { 22 + return 23 + } 24 + spec.Blocks = append(spec.Blocks, agent.PromptBlock{Content: content}) 25 + } 26 + 27 + func isGPT5FamilyModel(model string) bool { 28 + model = strings.ToLower(strings.TrimSpace(model)) 29 + if model == "" { 30 + return false 31 + } 32 + if idx := strings.LastIndex(model, "/"); idx >= 0 && idx+1 < len(model) { 33 + model = model[idx+1:] 34 + } 35 + if model == "gpt-5" { 36 + return true 37 + } 38 + return strings.HasPrefix(model, "gpt-5.") || strings.HasPrefix(model, "gpt-5-") 39 + }
+83
internal/promptprofile/model_patches_test.go
··· 1 + package promptprofile 2 + 3 + import ( 4 + "testing" 5 + 6 + "github.com/quailyquaily/mistermorph/agent" 7 + ) 8 + 9 + func TestIsGPT5FamilyModel(t *testing.T) { 10 + tests := []struct { 11 + model string 12 + want bool 13 + }{ 14 + {model: "gpt-5", want: true}, 15 + {model: "gpt-5.4", want: true}, 16 + {model: "gpt-5-mini", want: true}, 17 + {model: "openai/gpt-5.4", want: true}, 18 + {model: "carrot/gpt-5.4", want: true}, 19 + {model: "vendor/models/gpt-5.4", want: true}, 20 + {model: "gpt-50", want: false}, 21 + {model: "openai/gpt-50", want: false}, 22 + {model: "gpt-4.1", want: false}, 23 + {model: "", want: false}, 24 + } 25 + for _, tc := range tests { 26 + if got := isGPT5FamilyModel(tc.model); got != tc.want { 27 + t.Fatalf("isGPT5FamilyModel(%q) = %v, want %v", tc.model, got, tc.want) 28 + } 29 + } 30 + } 31 + 32 + func TestAppendGPT5PromptPatch_GPT5Family(t *testing.T) { 33 + restore := stubGPT5PromptPatchSource(t, "[[ GPT-5 Patch ]]\n- Use the GPT-5 policy.") 34 + defer restore() 35 + 36 + tests := []string{ 37 + "gpt-5", 38 + "gpt-5.4", 39 + "openai/gpt-5.4", 40 + "carrot/gpt-5.4", 41 + } 42 + for _, model := range tests { 43 + spec := agent.PromptSpec{} 44 + AppendGPT5PromptPatch(&spec, model, nil) 45 + if len(spec.Blocks) != 1 { 46 + t.Fatalf("model %q blocks len = %d, want 1", model, len(spec.Blocks)) 47 + } 48 + if got := spec.Blocks[0].Content; got != "[[ GPT-5 Patch ]]\n- Use the GPT-5 policy." { 49 + t.Fatalf("model %q patch content = %q", model, got) 50 + } 51 + } 52 + } 53 + 54 + func TestAppendGPT5PromptPatch_SkipsNonMatchingModel(t *testing.T) { 55 + restore := stubGPT5PromptPatchSource(t, "patch") 56 + defer restore() 57 + 58 + spec := agent.PromptSpec{} 59 + AppendGPT5PromptPatch(&spec, "gpt-4.1", nil) 60 + if len(spec.Blocks) != 0 { 61 + t.Fatalf("blocks len = %d, want 0", len(spec.Blocks)) 62 + } 63 + } 64 + 65 + func TestAppendGPT5PromptPatch_SkipsEmptyPatchContent(t *testing.T) { 66 + restore := stubGPT5PromptPatchSource(t, "\n") 67 + defer restore() 68 + 69 + spec := agent.PromptSpec{} 70 + AppendGPT5PromptPatch(&spec, "gpt-5.4", nil) 71 + if len(spec.Blocks) != 0 { 72 + t.Fatalf("blocks len = %d, want 0", len(spec.Blocks)) 73 + } 74 + } 75 + 76 + func stubGPT5PromptPatchSource(t *testing.T, content string) func() { 77 + t.Helper() 78 + old := gpt5PromptPatchSource 79 + gpt5PromptPatchSource = content 80 + return func() { 81 + gpt5PromptPatchSource = old 82 + } 83 + }
+12
internal/promptprofile/prompts/system.openai.gpt_5.md
··· 1 + [[ Rules for GPT models ]] 2 + 3 + - Use plain, direct, and restrained language, with the primary goal of explaining things clearly. 4 + - Do not add thin wrapper functions around existing functions unless the wrapper adds real value beyond renaming. 5 + - Ban AI phrasing and internet sludge: avoid words like "底层模型", "语气分布", "在压", "收一下", "下钻", "落地", "赋能", "抓手", "闭环", "一刀", "用实了" unless the user explicitly wants that. 6 + - Ban "先说判断..." 7 + - Prefer plain human wording over meta wording: say "说话风格变了", not "语气分布漂了"; say "我会少说空话", not "我在压表达风格". 8 + - In Chinese, default to short, direct, spoken sentences. Fewer abstractions, fewer summaries about summaries. 9 + - Do not use Northeastern-dialect phrasing(东北话) by default in Chinese. Avoid lines like "你直接抽我", "不整这个", "老铁", "整不会了", unless the user explicitly wants that tone. 10 + - Do not ask user for following actions like "如果你要,..." unless the user explicitly want that. 11 + * Start with concrete facts before making a judgment. The overall demeanor is simple and sincere, avoiding empty talk and conceptualization. 12 + * When writing documents, follow George Orwell's Rules for Writing.