{"id":"05c29c48-321c-47f9-8cfe-56acdb5fa66a","slug":"smart-session-routing","kind":"skill","name":"smart-session-routing","summary":"Smart session routing skill for AI chat applications","owner":"Jiyr0119","repoUrl":"https://github.com/Jiyr0119/smart-session-routing","license":"MIT","licenseTier":"permissive","trust":"community","stars":0,"match":null,"fewStars":true,"format":"skill","createdAt":"2026-02-25T07:40:31.000Z","addedAt":"2026-10-21T10:49:57.539Z","logoUrl":"https://avatars.githubusercontent.com/u/28727613?u=499605b4b2fd0dd245b5911c9c7b28279e75b21e&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["communication","developer-tools"],"tags":["agent","ai-chat","claude-code","session-management"],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-23T18:59:04.106Z","sample":false,"url":"https://conduits.dev/tools/smart-session-routing","language":"","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# 🧠 Smart Session Routing\n\n**[中文文档](./README_zh.md)**\n\n> An intelligent session routing skill for AI chat applications — helps AI agents decide whether a user's message should continue the current conversation or start a new one.\n\n## ✨ Features\n\n- 🎯 **5 Decision Signals** — Semantic relevance, explicit intent, context window, time gap, conversation health\n- 🔄 **3 Implementation Approaches** — AI self-judgment (prompt-based), backend middleware, frontend heuristics\n- 🌐 **Bilingual Support** — Chinese & English intent detection out of the box\n- 📊 **Complete Decision Matrix** — Combined signal evaluation with edge case handling\n- 🧩 **Framework Agnostic** — Works with any AI model, any frontend framework, any backend stack\n\n## 📦 Installation\n\n### Option 1: Direct Copy\n\n```bash\ngit clone https://github.com/YOUR_USERNAME/smart-session-routing.git\ncp -r smart-session-routing /path/to/your-project/.agent/skills/\n```\n\n### Option 2: Git Submodule (Recommended)\n\n```bash\ncd /path/to/your-project\ngit submodule add https://github.com/YOUR_USERNAME/smart-session-routing.git .agent/skills/smart-session-routing\n```\n\nUpdate to latest version:\n\n```bash\ngit submodule update --remote .agent/skills/smart-session-routing\n```\n\n## 📂 Structure\n\n```\nsmart-session-routing/\n├── SKILL.md                           # Core guide (~750 words, always loaded)\n├── references/\n│   ├── decision-framework.md          # Detailed scoring model & thresholds\n│   └── implementation-patterns.md     # Architecture patterns & design principles\n└── examples/\n    ├── conversation-scenarios.md      # 14 real-world routing scenarios\n    └── session-router-prompt.md       # Prompt template for AI self-judgment\n```\n\n## 🚀 Quick Start\n\n### How It Works\n\nWhen a user sends a message, the router evaluates 5 signals:\n\n```\nIncoming Message\n    │\n    ├─ Explicit new-session intent?  ──YES──→ 🆕 NEW SESSION\n    │\n    ├─ Context window >80% full?     ──YES──→ 🆕 NEW SESSION (with summary)\n    │\n    ├─ Semantic similarity < 0.3?    ──YES──→ ❓ PROMPT USER\n    │\n    ├─ Time gap > threshold?         ──YES──→ ❓ PROMPT USER\n    │\n    └─ None of the above             ──────→ ✅ CONTINUE\n```\n\n### Approach 1: AI Self-Judgment (Fastest to Integrate)\n\nAdd the prompt template from `examples/session-router-prompt.md` to your system prompt. The AI will output a routing decision as a JSON comment before each response:\n\n```\n<!--session_route: {\"decision\": \"continue\", \"confidence\": 0.9}-->\n```\n\n### Approach 2: Lightweight Middleware\n\nImplement a routing service that intercepts messages before they reach the AI model. See `references/implementation-patterns.md` for three architecture patterns.\n\n### Approach 3: Hybrid (Production Grade)\n\nCombine client-side heuristics (instant intent/time checks) with server-side intelligence (semantic analysis). Best for large-scale applications.\n\nSee `examples/conversation-scenarios.md` for 14 real-world scenarios to calibrate your routing logic.\n\n## ⚙️ Configuration\n\nKey thresholds to tune for your use case:\n\n| Parameter | Default | Description |\n|-----------|---------|-------------|\n| `semantic_threshold` | 0.3 | Below this → topic shift detected |\n| `context_critical_pct` | 0.8 | Above this → force new session |\n| `time_gap_prompt_hours` | 4 | Prompt user after this gap |\n| `time_gap_new_session_hours` | 24 | Suggest new session after this gap |\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'feat: add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\n[MIT](./LICENSE)\n"}