Remove conversation context/recall system from ClaudeTools
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>
This commit is contained in:
84
migrations/versions/20260118_172743_remove_context_system.py
Normal file
84
migrations/versions/20260118_172743_remove_context_system.py
Normal file
@@ -0,0 +1,84 @@
|
||||
"""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."
|
||||
)
|
||||
@@ -1,136 +0,0 @@
|
||||
"""add_context_recall_models
|
||||
|
||||
Revision ID: a0dfb0b4373c
|
||||
Revises: 48fab1bdfec6
|
||||
Create Date: 2026-01-16 16:51:48.565444
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'a0dfb0b4373c'
|
||||
down_revision: Union[str, None] = '48fab1bdfec6'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('context_snippets',
|
||||
sa.Column('project_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('client_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('category', sa.String(length=100), nullable=False),
|
||||
sa.Column('title', sa.String(length=200), nullable=False),
|
||||
sa.Column('dense_content', sa.Text(), nullable=False),
|
||||
sa.Column('structured_data', sa.Text(), nullable=True),
|
||||
sa.Column('tags', sa.Text(), nullable=True),
|
||||
sa.Column('relevance_score', sa.Float(), server_default='1.0', nullable=False),
|
||||
sa.Column('usage_count', sa.Integer(), server_default='0', nullable=False),
|
||||
sa.Column('id', sa.CHAR(length=36), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['client_id'], ['clients.id'], ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='SET NULL'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index('idx_context_snippets_category', 'context_snippets', ['category'], unique=False)
|
||||
op.create_index('idx_context_snippets_client', 'context_snippets', ['client_id'], unique=False)
|
||||
op.create_index('idx_context_snippets_project', 'context_snippets', ['project_id'], unique=False)
|
||||
op.create_index('idx_context_snippets_relevance', 'context_snippets', ['relevance_score'], unique=False)
|
||||
op.create_index('idx_context_snippets_usage', 'context_snippets', ['usage_count'], unique=False)
|
||||
op.create_table('conversation_contexts',
|
||||
sa.Column('session_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('project_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('machine_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('context_type', sa.String(length=50), nullable=False),
|
||||
sa.Column('title', sa.String(length=200), nullable=False),
|
||||
sa.Column('dense_summary', sa.Text(), nullable=True),
|
||||
sa.Column('key_decisions', sa.Text(), nullable=True),
|
||||
sa.Column('current_state', sa.Text(), nullable=True),
|
||||
sa.Column('tags', sa.Text(), nullable=True),
|
||||
sa.Column('relevance_score', sa.Float(), server_default='1.0', nullable=False),
|
||||
sa.Column('id', sa.CHAR(length=36), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['machine_id'], ['machines.id'], ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['session_id'], ['sessions.id'], ondelete='SET NULL'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index('idx_conversation_contexts_machine', 'conversation_contexts', ['machine_id'], unique=False)
|
||||
op.create_index('idx_conversation_contexts_project', 'conversation_contexts', ['project_id'], unique=False)
|
||||
op.create_index('idx_conversation_contexts_relevance', 'conversation_contexts', ['relevance_score'], unique=False)
|
||||
op.create_index('idx_conversation_contexts_session', 'conversation_contexts', ['session_id'], unique=False)
|
||||
op.create_index('idx_conversation_contexts_type', 'conversation_contexts', ['context_type'], unique=False)
|
||||
op.create_table('decision_logs',
|
||||
sa.Column('project_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('session_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('decision_type', sa.String(length=100), nullable=False),
|
||||
sa.Column('impact', sa.String(length=50), server_default='medium', nullable=False),
|
||||
sa.Column('decision_text', sa.Text(), nullable=False),
|
||||
sa.Column('rationale', sa.Text(), nullable=True),
|
||||
sa.Column('alternatives_considered', sa.Text(), nullable=True),
|
||||
sa.Column('tags', sa.Text(), nullable=True),
|
||||
sa.Column('id', sa.CHAR(length=36), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['session_id'], ['sessions.id'], ondelete='SET NULL'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index('idx_decision_logs_impact', 'decision_logs', ['impact'], unique=False)
|
||||
op.create_index('idx_decision_logs_project', 'decision_logs', ['project_id'], unique=False)
|
||||
op.create_index('idx_decision_logs_session', 'decision_logs', ['session_id'], unique=False)
|
||||
op.create_index('idx_decision_logs_type', 'decision_logs', ['decision_type'], unique=False)
|
||||
op.create_table('project_states',
|
||||
sa.Column('project_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('last_session_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('current_phase', sa.String(length=100), nullable=True),
|
||||
sa.Column('progress_percentage', sa.Integer(), server_default='0', nullable=False),
|
||||
sa.Column('blockers', sa.Text(), nullable=True),
|
||||
sa.Column('next_actions', sa.Text(), nullable=True),
|
||||
sa.Column('context_summary', sa.Text(), nullable=True),
|
||||
sa.Column('key_files', sa.Text(), nullable=True),
|
||||
sa.Column('important_decisions', sa.Text(), nullable=True),
|
||||
sa.Column('id', sa.CHAR(length=36), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['last_session_id'], ['sessions.id'], ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('project_id')
|
||||
)
|
||||
op.create_index('idx_project_states_last_session', 'project_states', ['last_session_id'], unique=False)
|
||||
op.create_index('idx_project_states_progress', 'project_states', ['progress_percentage'], unique=False)
|
||||
op.create_index('idx_project_states_project', 'project_states', ['project_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user