Bugfix: How to fix critical session management issues in MCP system?

Documentation for Sessions

🐛 Bugfix: How to fix critical session management issues in MCP system?

📋 Decision Context

Question:

How to fix critical session management issues in MCP system?

Task: Fix session 30 manifest creation, active.json sync, and prevent future session tracking errors


🎯 Decision Made

Chosen:

Create proper session-30.json manifest, regenerate active.json, fix MCP session detection to read from active.json first, add validation checks

Options Considered:

  1. Manual session tracking only
  2. Fix session detection in MCP
  3. Ignore session numbers
  4. Use timestamp-based sessions

💭 Reasoning

Root cause: MCP server's session detection was reading stale data or falling back to wrong session. The session-30.json was created but empty (1 byte). Active.json was missing entirely. This caused MCP to log decisions to session 29.11 instead of 30.1. Fix requires: (1) Properly populate session-30.json with complete manifest, (2) Run yarn session:sync to regenerate active.json, (3) Update MCP session detector to prioritize active.json and validate session exists, (4) Add checks to prevent logging to wrong session. Also discovered: numbered directory names (01-getting-started) violate AGENTS.md standards - should use frontmatter 'order' property instead.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation