codemap_orient
Get session orientation for the project - returns formatted markdown with project stats, session checklist, loaded parsers, and quick-start commands. Resets group display state for fresh context.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
rootPath | string | ❌ Optional | Root directory of the project. REQUIRED on first call (to initialize project), optional on subsequent calls (uses currently initialized project). Provide to switch between projects. |
Usage Examples
MCP Usage (for AI Agents like Claude)
json
{
"name": "codemap_orient",
"arguments": {
"rootPath": "/path/to/your/project"
}
}Example Output
JSON Response
json
{
"content": [
{
"type": "text",
"text": "# CodeMap Session Orientation\n\n**Version:** 0.2.5\n**Project Root:** `/path/to/your/project`\n\n## Stats\n\n- **Files:** 299\n- **Symbols:** 3099\n- **Dependencies:** 173\n\n## 📋 Session Checklist\n\n- 🔴 **[HIGH]** Review .codemap/sessions/NEXT_SESSION.md to see if there are any outstanding tasks to do.\n- 🔴 **[HIGH]** Use clean-build.bat to build codemap package\n- 🟡 **[MEDIUM]** Label files with appropriate architectural patterns as you encounter them\n\n## 🏷️ THIS PROJECT USES LABELS!\n\nThis project has **19 labels** defined with **45 assignments**.\n\n**Labels track status, patterns, and workflow states across files.**\n\n- Use `codemap_label_list()` to see all available labels\n- Use `codemap_label_search(labelId: \"...\")` to find labeled files\n- Use `codemap_help(topic: \"labels\")` to learn the label system\n\n**Remember to label files as you work** - check the session checklist for labeling guidance.\n\n## Loaded Parsers\n\n- **@egentica/codemap-parser-typescript** (v0.1.0): .ts, .tsx, .js, .jsx\n- **@egentica/codemap-parser-vue** (v0.1.0): .vue\n- **@egentica/codemap-parser-php** (v0.2.0): .php\n\n## Quick Start Commands\n\n**Search & Navigate:**\n- `codemap_search(query: 'keyword')` - Search files and symbols\n- `codemap_read_file(path: 'src/file.ts')` - Read file contents\n\n**Edit Files:**\n- `codemap_replace_text(target: 'file.ts', oldString: '...', newString: '...')` - Find & replace\n- `codemap_write_file(target: 'file.ts', content: '...')` - Write entire file\n\n**Get Help:**\n- `codemap_help()` - Show all available commands and guides\n- `codemap_help(topic: 'search')` - Get help on specific topic\n\n---\n\n## ⚡ IMPORTANT: Load Core Tools First\n\n**Unlike Desktop Commander tools (which are pre-loaded in the model), CodeMap tools require explicit loading via `tool_search` before first use.**\n\n**At the start of each session, immediately load these essential tools:**\n\n```javascript\ntool_search(query: \"codemap read write replace\")\n// This loads: codemap_read_file, codemap_write, codemap_replace_text, etc.\n```\n\n**Without this step, tool calls will fail with \"tool not loaded\" errors.**\n\n---\n\n## AI Agent Responsibilities\n\n**The system depends on you, the AI Agent, to maintain organization:**\n\n- **Create groups regularly** using `codemap_group_add(name, description, members)`\n- **Add notations** using `codemap_group_notate(name, text)` to document patterns\n- **Use consistent naming** when grouping files together\n\n---\n\n*Session ready. Try `codemap_help()` to explore all features.*\n\n---\n\n## Last Successfully Closed Session\n\n**Session ID:** 2026-04-07T20-37-30\n**Started:** 2026-04-07T20:37:30.202Z\n**Duration:** 2 hours, 15 minutes\n\n**Files Updated (8):**\n- packages/codemap/src/core/Scanner.ts\n- packages/codemap/src/mcp/tools/io/read.tool.ts\n- packages/codemap/CHANGELOG.md\n"
}
]
}When to Use This Tool
-
Use
- Get initial context at the start of a session
- Check project stats (file count, symbols, dependencies)
- Review session checklist items
- Check for orphaned (crashed) previous sessions
- Switch between different projects
- Refresh context after a long conversation
codemap_orient when you need to:
Common Patterns
Session Start Workflow
Always orient at the start of a new session to get full context.
Multi-Project Workflow
You can work with multiple projects by providing different
Re-Orientation During Session
Re-orient periodically in long sessions to refresh context and check for new checklist items.
1. codemap_orient({ rootPath: "/project" })
2. Review the orientation output (stats, checklist, warnings)
3. Check for orphaned sessions or pending tasks
4. Begin working on tasks from checklistAlways orient at the start of a new session to get full context.
Multi-Project Workflow
1. Orient to first project: codemap_orient({ rootPath: "/project-a" })
2. Work on project A
3. Switch: codemap_orient({ rootPath: "/project-b" })
4. Work on project B
5. Return: codemap_orient({ rootPath: "/project-a" })You can work with multiple projects by providing different
rootPath values.Re-Orientation During Session
1. Working on long task...
2. Context getting stale or lost
3. codemap_orient() to refresh (no rootPath needed)
4. Continue with fresh contextRe-orient periodically in long sessions to refresh context and check for new checklist items.
Pro Tips
- rootPath is conditionally required: On first call (project not initialized), you MUST provide
rootPath. On subsequent calls, it's optional - omit it to use the currently initialized project, or provide it to switch projects. - Check for orphaned sessions: The orientation output includes
[ORPHANED]if the previous session crashed without proper closure. Review the session summary to see what was being worked on. - Checklist items are prioritized: Items are sorted by priority (🔴 HIGH, 🟡 MEDIUM, 🟢 LOW). Focus on red items first.
- Orient resets group display state: Calling orient gives you a "fresh" view of groups - all group descriptions and notations will show again on first access. This prevents context pollution in long sessions.
- Parser info tells you language support: The "Loaded Parsers" section shows which file types CodeMap can parse. If your language isn't listed, CodeMap can still track files but won't extract symbols.
- Stats give quick project overview: The stats (files, symbols, dependencies) give you an instant sense of project size and complexity.
Best Practices
- Always call
codemap_orientat the start of every new session to get proper context - Review the checklist items carefully - they often contain important reminders about the project
- When switching projects, always provide the new
rootPathexplicitly - Use orient to check if previous session was properly closed before starting new work
- Re-orient periodically in long sessions to refresh context window
Common Mistakes
❌ Mistake: Not providing
✅ Instead: Always provide
❌ Mistake: Providing
✅ Instead: Omit
❌ Mistake: Ignoring the session checklist
✅ Instead: Review checklist items - they contain important project-specific tasks and reminders
❌ Mistake: Not checking for orphaned sessions
✅ Instead: Look for
❌ Mistake: Never re-orienting during long sessions
✅ Instead: Call
❌ Mistake: Assuming orient is just for the start of sessions
✅ Instead: Use orient anytime you need to refresh context, check stats, or switch projects
rootPath on first call✅ Instead: Always provide
rootPath when initializing a new project: codemap_orient({ rootPath: "/project" })❌ Mistake: Providing
rootPath on every call after initialization✅ Instead: Omit
rootPath for subsequent calls: codemap_orient() uses current project❌ Mistake: Ignoring the session checklist
✅ Instead: Review checklist items - they contain important project-specific tasks and reminders
❌ Mistake: Not checking for orphaned sessions
✅ Instead: Look for
[ORPHANED] in the output and review the session summary if present❌ Mistake: Never re-orienting during long sessions
✅ Instead: Call
codemap_orient() periodically to refresh context and check for new tasks❌ Mistake: Assuming orient is just for the start of sessions
✅ Instead: Use orient anytime you need to refresh context, check stats, or switch projects
Changelog
4 releases- 🔧ModifiedStore backups and source-file rollback history now persist in
%APPDATA%\CodeMap\projects\{id}\(cross-platform:~/Library/Application Support/CodeMap/...on macOS,$XDG_CONFIG_HOME/codemap/...on Linux) instead of the project-local.codemap/backups/and.codemap/filehistory/directories. The.codemap/directory is now fully portable — commit it to Git with confidence. - 🔧ModifiedWatcherServer is disabled by default in 0.2.x. Orient no longer starts the WebSocket server automatically; opt in by setting
watcher.watcherDisabled: falsein.codemap/config.json. The 0.3.x line will return default-on. - 🆕AddedEvery orient touches a machine-wide project registry at
<appdata>/CodeMap/projects.json, recording each project's id, rootPath, lastActive, and (if the watcher is enabled) its assigned port and auth key. External tooling can read this file to discover every CodeMap instance on the machine.
- 🔧ModifiedStore backups and source-file rollback history now persist in