Completely removed the database context recall system while preserving database tables for safety. This major cleanup removes 80+ files and 16,831 lines of code. What was removed: - API layer: 4 routers (conversation-contexts, context-snippets, project-states, decision-logs) with 35+ endpoints - Database models: 5 models (ConversationContext, ContextSnippet, DecisionLog, ProjectState, ContextTag) - Services: 4 service layers with business logic - Schemas: 4 Pydantic schema files - Claude Code hooks: 13 hook files (user-prompt-submit, task-complete, sync-contexts, periodic saves) - Scripts: 15+ scripts (import, migration, testing, tombstone checking) - Tests: 5 test files (context recall, compression, diagnostics) - Documentation: 30+ markdown files (guides, architecture, quick starts) - Utilities: context compression, conversation parsing Files modified: - api/main.py: Removed router registrations - api/models/__init__.py: Removed model imports - api/schemas/__init__.py: Removed schema imports - api/services/__init__.py: Removed service imports - .claude/claude.md: Completely rewritten without context references Database tables preserved: - conversation_contexts, context_snippets, context_tags, project_states, decision_logs (5 orphaned tables remain for safety) - Migration created but NOT applied: 20260118_172743_remove_context_system.py - Tables can be dropped later when confirmed not needed New files added: - CONTEXT_SYSTEM_REMOVAL_SUMMARY.md: Detailed removal report - CONTEXT_SYSTEM_REMOVAL_COMPLETE.md: Final status - CONTEXT_EXPORT_RESULTS.md: Export attempt results - scripts/export-tombstoned-contexts.py: Export tool for future use - migrations/versions/20260118_172743_remove_context_system.py Impact: - Reduced from 130 to 95 API endpoints - Reduced from 43 to 38 active database tables - Removed 16,831 lines of code - System fully operational without context recall Reason for removal: - System was not actively used (no tombstoned contexts found) - Reduces codebase complexity - Focuses on core MSP work tracking functionality - Database preserved for safety (can rollback if needed) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
85 lines
3.5 KiB
Python
85 lines
3.5 KiB
Python
"""remove_context_system
|
|
|
|
Revision ID: 20260118_172743
|
|
Revises: 20260118_132847
|
|
Create Date: 2026-01-18 17:27:43
|
|
|
|
Removes the entire conversation context/recall system from ClaudeTools.
|
|
|
|
This migration drops all context-related tables:
|
|
- context_tags (normalized tags table)
|
|
- project_states (project state tracking)
|
|
- decision_logs (decision documentation)
|
|
- conversation_contexts (main context storage)
|
|
- context_snippets (knowledge fragments)
|
|
|
|
WARNING: This is a destructive operation. All context data will be lost.
|
|
Make sure to export any important data before running this migration.
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '20260118_172743'
|
|
down_revision: Union[str, None] = '20260118_132847'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""
|
|
Drop all context-related tables.
|
|
|
|
Tables are dropped in reverse dependency order to avoid foreign key violations.
|
|
"""
|
|
|
|
# Step 1: Drop context_tags table (depends on conversation_contexts)
|
|
op.drop_index('idx_context_tags_tag_context', table_name='context_tags')
|
|
op.drop_index('idx_context_tags_context', table_name='context_tags')
|
|
op.drop_index('idx_context_tags_tag', table_name='context_tags')
|
|
op.drop_table('context_tags')
|
|
|
|
# Step 2: Drop project_states table (depends on projects, sessions)
|
|
op.drop_index('idx_project_states_project', table_name='project_states')
|
|
op.drop_index('idx_project_states_progress', table_name='project_states')
|
|
op.drop_index('idx_project_states_last_session', table_name='project_states')
|
|
op.drop_table('project_states')
|
|
|
|
# Step 3: Drop decision_logs table (depends on projects, sessions)
|
|
op.drop_index('idx_decision_logs_type', table_name='decision_logs')
|
|
op.drop_index('idx_decision_logs_session', table_name='decision_logs')
|
|
op.drop_index('idx_decision_logs_project', table_name='decision_logs')
|
|
op.drop_index('idx_decision_logs_impact', table_name='decision_logs')
|
|
op.drop_table('decision_logs')
|
|
|
|
# Step 4: Drop conversation_contexts table (depends on sessions, projects, machines)
|
|
op.drop_index('idx_conversation_contexts_type', table_name='conversation_contexts')
|
|
op.drop_index('idx_conversation_contexts_session', table_name='conversation_contexts')
|
|
op.drop_index('idx_conversation_contexts_relevance', table_name='conversation_contexts')
|
|
op.drop_index('idx_conversation_contexts_project', table_name='conversation_contexts')
|
|
op.drop_index('idx_conversation_contexts_machine', table_name='conversation_contexts')
|
|
op.drop_table('conversation_contexts')
|
|
|
|
# Step 5: Drop context_snippets table (depends on projects, clients)
|
|
op.drop_index('idx_context_snippets_usage', table_name='context_snippets')
|
|
op.drop_index('idx_context_snippets_relevance', table_name='context_snippets')
|
|
op.drop_index('idx_context_snippets_project', table_name='context_snippets')
|
|
op.drop_index('idx_context_snippets_client', table_name='context_snippets')
|
|
op.drop_index('idx_context_snippets_category', table_name='context_snippets')
|
|
op.drop_table('context_snippets')
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""
|
|
Recreating the context system is not supported.
|
|
|
|
This is a one-way migration. If you need to restore the context system,
|
|
you should restore from a database backup or re-run the original migrations.
|
|
"""
|
|
raise NotImplementedError(
|
|
"Downgrade not supported. Restore from backup or re-run original migrations."
|
|
)
|