---
title: Intent Context Manager component_type: script version: 1.0.0 audience: contributor status: active summary: Detects context switches, finds matching plans, prevents plan proliferation keywords:
- intent
- context-switch
- plan-management
- proliferation-guard tokens: ~3500 created: 2026-01-04 updated: 2026-01-04
Intent Context Manager - Handles project/task context switching
Key Responsibilities:
- DETECT context switches in user input
- SEARCH for existing plans matching new context
- ASK for clarification when unclear (never assume)
- GUARD against plan/tasklist proliferation
Usage: from intent_context_manager import IntentContextManager
mgr = IntentContextManager(coditect_root)
# Check if user input indicates context switch
result = mgr.analyze_intent(user_message, current_plan_id)
if result.is_context_switch:
if result.matching_plans:
# Found existing plan(s)
print(f"Found: {result.matching_plans}")
else:
# Need to ask user
print(result.clarification_prompt)
File: intent_context_manager.py
Classes
ContextAnalysisResult
Result of intent/context analysis.
IntentContextManager
Manages intent detection and context switching.
Functions
main()
CLI for testing intent analysis.
get_db_connection()
Get database connection if available.
find_all_plans()
Find all plan files across known locations.
find_matching_plans(query)
Find plans that match a query string.
find_matching_tasks(query)
Find tasks in database that match query.
detect_context_switch(message)
Detect if message indicates a context switch.
count_plans_in_category(category)
Count how many plans exist in a category.
analyze_intent(user_message, current_plan_id)
Analyze user intent and detect context switches.
get_current_context_summary()
Get summary of current context state.
Usage
python intent_context_manager.py