You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
- add model-scoped section extraction that mirrors the existing
mode-specific behavior
- thread the active model id through system message construction so
matching content is emitted
- document the Model: heading convention and cover it with unit tests
## Testing
- bun test v1.3.1 (89fa0f34)
- Generated version.ts: v0.5.1-90-gfe3b2519 (fe3b251) at
2025-11-16T21:43:17Z
[0] bun run node_modules/@typescript/native-preview/bin/tsgo.js --noEmit
exited with code 0
[1] bun run node_modules/@typescript/native-preview/bin/tsgo.js --noEmit
-p tsconfig.main.json exited with code 0
_Generated with _
---------
Co-authored-by: root <root@ovh-1.tailc2a514.ts.net>
Co-authored-by: Ammar Bandukwala <ammar@ammar.io>
Copy file name to clipboardExpand all lines: docs/instruction-files.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ Rules:
24
24
- Workspace instructions are checked first, then global instructions
25
25
- The first matching section wins (at most one section is used)
26
26
- The section's content is everything until the next heading of the same or higher level
27
+
- Mode sections are stripped from the general `<custom-instructions>` block; only the active mode's content is re-sent via its `<mode>` tag.
27
28
- Missing sections are ignored (no error)
28
29
29
30
<!-- Note to developers: This behavior is implemented in src/services/systemMessage.ts (search for extractModeSection). Keep this documentation in sync with code changes. -->
@@ -62,6 +63,32 @@ When compacting conversation history:
62
63
63
64
Customizing the `compact` mode is particularly useful for controlling what information is preserved during automatic history compaction.
64
65
66
+
## Model Prompts
67
+
68
+
Similar to modes, mux reads headings titled `Model: <regex>` to scope instructions to specific models or families. The `<regex>` is matched against the full model identifier (for example, `openai:gpt-5.1-codex`).
69
+
70
+
Rules:
71
+
72
+
- Workspace instructions are evaluated before global instructions; the first matching section wins.
73
+
- Regexes are case-insensitive by default. Use `/pattern/flags` syntax to opt into custom flags (e.g., `/openai:.*codex/i`).
74
+
- Invalid regex patterns are ignored instead of breaking the parse.
75
+
- Model sections are also removed from `<custom-instructions>`; only the first regex match (if any) is injected via its `<model-…>` tag.
76
+
- Only the content under the first matching heading is injected.
77
+
78
+
<!-- Developers: See extractModelSection in src/node/utils/main/markdown.ts for the implementation. -->
0 commit comments