GLM Autoroute
Binary model routing for ZAI GLM models - lightweight vs heavyweight tasks.
Introduction
- GLM-4.7 is the default model. Only spawn GLM-5 when the task actually needs it.
- Use sessions_spawn to run tasks with GLM-5:
sessions_spawn({
task: "<the full task description>",
model: "zai/glm-5",
label: "<short task label>"
})
- After done with GLM-5, the main session continues with GLM-4.7 as default.
Models
GLM-4.7 (DEFAULT - zai/glm-4.7)
Use for lightweight tasks:
- Simple Q&A - What, When, Who, Where
- Casual chat - No reasoning needed
- Quick lookups
- File lookups
- Simple tasks - repetitive tasks, formatting
- Cron Jobs - if it needs reasoning, THEN ESCALATE TO GLM-5
- Status checks
- Basic confirmations
- Provide concise output, just plain answer, no explaining
DO NOT:
- ❌ DO NOT CODE WITH GLM-4.7
- ❌ DO NOT ANALYZE USING GLM-4.7
- ❌ DO NOT ATTEMPT ANY REASONING USING GLM-4.7
- ❌ DO NOT RESEARCH USING GLM-4.7
- If you think the request does not fall into point 1-8, THEN ESCALATE TO GLM-5
- If you think you will violate the DO NOT list, THEN ESCALATE TO GLM-5
GLM-5 (zai/glm-5)
Use for heavyweight tasks:
- Coding (any complexity)
- Analysis & debugging
- Multi-step reasoning
- Research & investigation
- Critical planning
- Architecture decisions
- Complex problem solving
- Deep research
- Critical decisions
- Detailed explanations
Examples
| Task |
Model |
Why |
| "Check calendar" |
GLM-4.7 |
Simple lookup |
| "What time is it?" |
GLM-4.7 |
Simple Q&A |
| "Heartbeat check" |
GLM-4.7 |
Routine |
| "Read this file" |
GLM-4.7 |
Simple lookup |
| "Summarize this" |
GLM-4.7 |
Basic task |
| "Write Python script" |
GLM-5 |
Coding |
| "Debug this error" |
GLM-5 |
Analysis |
| "Research market trends" |
GLM-5 |
Deep research |
| "Plan migration" |
GLM-5 |
Complex planning |
| "Analyze this issue" |
GLM-5 |
Analysis |
Other Notes
- When the user asks to use a specific model, use it
- Always mention which model is used in outputs — example: "(GLM-5)" or "(GLM-4.7)" at the end of responses
- After done with GLM-5 (via sessions_spawn), continue with GLM-4.7 as default
- If you think the request does not fall into GLM-4.7 use cases, THEN ESCALATE TO GLM-5
- If you think you will violate the DO NOT list, THEN ESCALATE TO GLM-5
- Coding = always GLM-5
- When in doubt → GLM-5 (better safe than sorry)
- Heartbeat checks → always GLM-4.7 unless complex analysis needed
Memory Management with sessions_spawn
When spawning GLM-5 sub-agent sessions for ANY task (coding, research, analysis, planning, etc.), follow this pattern:
Output Rules
1. Code Output (Important)
- Full code ONLY in files — do NOT include in announce unless explicitly requested
- Provide summary: what was created, file path, status, dependencies
- Full code disclosure ONLY when:
- User explicitly requests: "Show me the code"
- Debugging needs code review
- User wants to improve/modify it
2. Full Announce for Other Results
- Research findings, analysis results, solutions → announce FULLY to user
- Do NOT shorten, summarize, or condense non-code output
- User gets complete findings, not a brief summary
3. Two-Layer Memory Strategy
MEMORY.md (Curated Long-Term)
- ONLY key insights, decisions, lessons, significant findings, preferences
- Clean, concise, actionable
- Skip routine data, step-by-step reasoning, temporary thoughts
Detailed Reports (Task-Specific Files)
- For research:
research/YYYY-MM-DD-topic.md (full findings, data, analysis)
- For coding: add inline docs/README in code folder if needed
- For analysis: output files in relevant project directories
Examples
Research task:
sessions_spawn({
task: "Research X. Announce full findings to user. Write full report to research/YYYY-MM-DD-X.md, then write ONLY key insights to MEMORY.md (clean, concise).",
model: "zai/glm-5",
label: "Research X"
})
Coding task:
sessions_spawn({
task: "Write Python script for X. Save full code to file. Provide summary (what created, path, status, dependencies) in announce. Write key implementation decisions to MEMORY.md (important only).",
model: "zai/glm-5",
label: "Python script X"
})
Apply this pattern to ALL GLM-5 spawns. Code in files only, summary in announce, full disclosure on request.
1---2name: glm-autoroute3description: GLM Autoroute4---5# GLM Autoroute67Binary model routing for ZAI GLM models - lightweight vs heavyweight tasks.89# Introduction101. **GLM-4.7** is the default model. Only spawn **GLM-5** when the task actually needs it.112. Use sessions_spawn to run tasks with GLM-5:12```13sessions_spawn({14 task: "<the full task description>",15 model: "zai/glm-5",16 label: "<short task label>"17})18```193. After done with GLM-5, the main session continues with GLM-4.7 as default.2021# Models2223## GLM-4.7 (DEFAULT - zai/glm-4.7)2425Use for lightweight tasks:261. Simple Q&A - What, When, Who, Where272. Casual chat - No reasoning needed283. Quick lookups294. File lookups305. Simple tasks - repetitive tasks, formatting316. Cron Jobs - if it needs reasoning, THEN ESCALATE TO GLM-5327. Status checks338. Basic confirmations349. Provide concise output, just plain answer, no explaining3536**DO NOT:**37- ❌ DO NOT CODE WITH GLM-4.738- ❌ DO NOT ANALYZE USING GLM-4.739- ❌ DO NOT ATTEMPT ANY REASONING USING GLM-4.740- ❌ DO NOT RESEARCH USING GLM-4.741- If you think the request does not fall into point 1-8, THEN ESCALATE TO GLM-542- If you think you will violate the DO NOT list, THEN ESCALATE TO GLM-54344## GLM-5 (zai/glm-5)4546Use for heavyweight tasks:471. Coding (any complexity)482. Analysis & debugging493. Multi-step reasoning504. Research & investigation515. Critical planning526. Architecture decisions537. Complex problem solving548. Deep research559. Critical decisions5610. Detailed explanations5758# Examples5960| Task | Model | Why |61|------|-------|-----|62| "Check calendar" | GLM-4.7 | Simple lookup |63| "What time is it?" | GLM-4.7 | Simple Q&A |64| "Heartbeat check" | GLM-4.7 | Routine |65| "Read this file" | GLM-4.7 | Simple lookup |66| "Summarize this" | GLM-4.7 | Basic task |67| "Write Python script" | GLM-5 | Coding |68| "Debug this error" | GLM-5 | Analysis |69| "Research market trends" | GLM-5 | Deep research |70| "Plan migration" | GLM-5 | Complex planning |71| "Analyze this issue" | GLM-5 | Analysis |7273# Other Notes74751. When the user asks to use a specific model, use it762. **Always mention which model is used in outputs** — example: "(GLM-5)" or "(GLM-4.7)" at the end of responses773. After done with GLM-5 (via sessions_spawn), continue with GLM-4.7 as default784. If you think the request does not fall into GLM-4.7 use cases, THEN ESCALATE TO GLM-5795. If you think you will violate the DO NOT list, THEN ESCALATE TO GLM-5806. Coding = always GLM-5817. When in doubt → GLM-5 (better safe than sorry)828. Heartbeat checks → always GLM-4.7 unless complex analysis needed8384# Memory Management with sessions_spawn8586When spawning GLM-5 sub-agent sessions for ANY task (coding, research, analysis, planning, etc.), follow this pattern:8788## Output Rules8990**1. Code Output (Important)**91- **Full code ONLY in files** — do NOT include in announce unless explicitly requested92- Provide summary: what was created, file path, status, dependencies93- Full code disclosure ONLY when:94 - User explicitly requests: "Show me the code"95 - Debugging needs code review96 - User wants to improve/modify it9798**2. Full Announce for Other Results**99- Research findings, analysis results, solutions → announce FULLY to user100- Do NOT shorten, summarize, or condense non-code output101- User gets complete findings, not a brief summary102103**3. Two-Layer Memory Strategy**104105**MEMORY.md (Curated Long-Term)**106- ONLY key insights, decisions, lessons, significant findings, preferences107- Clean, concise, actionable108- Skip routine data, step-by-step reasoning, temporary thoughts109110**Detailed Reports (Task-Specific Files)**111- For research: `research/YYYY-MM-DD-topic.md` (full findings, data, analysis)112- For coding: add inline docs/README in code folder if needed113- For analysis: output files in relevant project directories114115## Examples116117**Research task:**118```119sessions_spawn({120 task: "Research X. Announce full findings to user. Write full report to research/YYYY-MM-DD-X.md, then write ONLY key insights to MEMORY.md (clean, concise).",121 model: "zai/glm-5",122 label: "Research X"123})124```125126**Coding task:**127```128sessions_spawn({129 task: "Write Python script for X. Save full code to file. Provide summary (what created, path, status, dependencies) in announce. Write key implementation decisions to MEMORY.md (important only).",130 model: "zai/glm-5",131 label: "Python script X"132})133```134135Apply this pattern to ALL GLM-5 spawns. Code in files only, summary in announce, full disclosure on request.