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:
@@ -2,13 +2,6 @@
|
||||
|
||||
from .billable_time import BillableTimeBase, BillableTimeCreate, BillableTimeResponse, BillableTimeUpdate
|
||||
from .client import ClientBase, ClientCreate, ClientResponse, ClientUpdate
|
||||
from .context_snippet import ContextSnippetBase, ContextSnippetCreate, ContextSnippetResponse, ContextSnippetUpdate
|
||||
from .conversation_context import (
|
||||
ConversationContextBase,
|
||||
ConversationContextCreate,
|
||||
ConversationContextResponse,
|
||||
ConversationContextUpdate,
|
||||
)
|
||||
from .credential import CredentialBase, CredentialCreate, CredentialResponse, CredentialUpdate
|
||||
from .credential_audit_log import (
|
||||
CredentialAuditLogBase,
|
||||
@@ -16,14 +9,12 @@ from .credential_audit_log import (
|
||||
CredentialAuditLogResponse,
|
||||
CredentialAuditLogUpdate,
|
||||
)
|
||||
from .decision_log import DecisionLogBase, DecisionLogCreate, DecisionLogResponse, DecisionLogUpdate
|
||||
from .firewall_rule import FirewallRuleBase, FirewallRuleCreate, FirewallRuleResponse, FirewallRuleUpdate
|
||||
from .infrastructure import InfrastructureBase, InfrastructureCreate, InfrastructureResponse, InfrastructureUpdate
|
||||
from .m365_tenant import M365TenantBase, M365TenantCreate, M365TenantResponse, M365TenantUpdate
|
||||
from .machine import MachineBase, MachineCreate, MachineResponse, MachineUpdate
|
||||
from .network import NetworkBase, NetworkCreate, NetworkResponse, NetworkUpdate
|
||||
from .project import ProjectBase, ProjectCreate, ProjectResponse, ProjectUpdate
|
||||
from .project_state import ProjectStateBase, ProjectStateCreate, ProjectStateResponse, ProjectStateUpdate
|
||||
from .security_incident import SecurityIncidentBase, SecurityIncidentCreate, SecurityIncidentResponse, SecurityIncidentUpdate
|
||||
from .service import ServiceBase, ServiceCreate, ServiceResponse, ServiceUpdate
|
||||
from .session import SessionBase, SessionCreate, SessionResponse, SessionUpdate
|
||||
@@ -118,24 +109,4 @@ __all__ = [
|
||||
"SecurityIncidentCreate",
|
||||
"SecurityIncidentUpdate",
|
||||
"SecurityIncidentResponse",
|
||||
# ConversationContext schemas
|
||||
"ConversationContextBase",
|
||||
"ConversationContextCreate",
|
||||
"ConversationContextUpdate",
|
||||
"ConversationContextResponse",
|
||||
# ContextSnippet schemas
|
||||
"ContextSnippetBase",
|
||||
"ContextSnippetCreate",
|
||||
"ContextSnippetUpdate",
|
||||
"ContextSnippetResponse",
|
||||
# ProjectState schemas
|
||||
"ProjectStateBase",
|
||||
"ProjectStateCreate",
|
||||
"ProjectStateUpdate",
|
||||
"ProjectStateResponse",
|
||||
# DecisionLog schemas
|
||||
"DecisionLogBase",
|
||||
"DecisionLogCreate",
|
||||
"DecisionLogUpdate",
|
||||
"DecisionLogResponse",
|
||||
]
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
"""
|
||||
Pydantic schemas for ContextSnippet model.
|
||||
|
||||
Request and response schemas for reusable context snippets.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class ContextSnippetBase(BaseModel):
|
||||
"""Base schema with shared ContextSnippet fields."""
|
||||
|
||||
project_id: Optional[UUID] = Field(None, description="Project ID (optional)")
|
||||
client_id: Optional[UUID] = Field(None, description="Client ID (optional)")
|
||||
category: str = Field(..., description="Category: tech_decision, configuration, pattern, lesson_learned")
|
||||
title: str = Field(..., description="Brief title describing the snippet")
|
||||
dense_content: str = Field(..., description="Highly compressed information content")
|
||||
structured_data: Optional[str] = Field(None, description="JSON object for optional structured representation")
|
||||
tags: Optional[str] = Field(None, description="JSON array of tags for retrieval and categorization")
|
||||
relevance_score: float = Field(1.0, ge=0.0, le=10.0, description="Float score for ranking relevance (0.0-10.0)")
|
||||
usage_count: int = Field(0, ge=0, description="Integer count of how many times this snippet was retrieved")
|
||||
|
||||
|
||||
class ContextSnippetCreate(ContextSnippetBase):
|
||||
"""Schema for creating a new ContextSnippet."""
|
||||
pass
|
||||
|
||||
|
||||
class ContextSnippetUpdate(BaseModel):
|
||||
"""Schema for updating an existing ContextSnippet. All fields are optional."""
|
||||
|
||||
project_id: Optional[UUID] = Field(None, description="Project ID (optional)")
|
||||
client_id: Optional[UUID] = Field(None, description="Client ID (optional)")
|
||||
category: Optional[str] = Field(None, description="Category: tech_decision, configuration, pattern, lesson_learned")
|
||||
title: Optional[str] = Field(None, description="Brief title describing the snippet")
|
||||
dense_content: Optional[str] = Field(None, description="Highly compressed information content")
|
||||
structured_data: Optional[str] = Field(None, description="JSON object for optional structured representation")
|
||||
tags: Optional[str] = Field(None, description="JSON array of tags for retrieval and categorization")
|
||||
relevance_score: Optional[float] = Field(None, ge=0.0, le=10.0, description="Float score for ranking relevance (0.0-10.0)")
|
||||
usage_count: Optional[int] = Field(None, ge=0, description="Integer count of how many times this snippet was retrieved")
|
||||
|
||||
|
||||
class ContextSnippetResponse(ContextSnippetBase):
|
||||
"""Schema for ContextSnippet responses with ID and timestamps."""
|
||||
|
||||
id: UUID = Field(..., description="Unique identifier for the context snippet")
|
||||
created_at: datetime = Field(..., description="Timestamp when the snippet was created")
|
||||
updated_at: datetime = Field(..., description="Timestamp when the snippet was last updated")
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
@@ -1,56 +0,0 @@
|
||||
"""
|
||||
Pydantic schemas for ConversationContext model.
|
||||
|
||||
Request and response schemas for conversation context storage and recall.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class ConversationContextBase(BaseModel):
|
||||
"""Base schema with shared ConversationContext fields."""
|
||||
|
||||
session_id: Optional[UUID] = Field(None, description="Session ID (optional)")
|
||||
project_id: Optional[UUID] = Field(None, description="Project ID (optional)")
|
||||
machine_id: Optional[UUID] = Field(None, description="Machine ID that created this context")
|
||||
context_type: str = Field(..., description="Type of context: session_summary, project_state, general_context")
|
||||
title: str = Field(..., description="Brief title describing the context")
|
||||
dense_summary: Optional[str] = Field(None, description="Compressed, structured summary (JSON or dense text)")
|
||||
key_decisions: Optional[str] = Field(None, description="JSON array of important decisions made")
|
||||
current_state: Optional[str] = Field(None, description="JSON object describing what's currently in progress")
|
||||
tags: Optional[str] = Field(None, description="JSON array of tags for retrieval and categorization")
|
||||
relevance_score: float = Field(1.0, ge=0.0, le=10.0, description="Float score for ranking relevance (0.0-10.0)")
|
||||
|
||||
|
||||
class ConversationContextCreate(ConversationContextBase):
|
||||
"""Schema for creating a new ConversationContext."""
|
||||
pass
|
||||
|
||||
|
||||
class ConversationContextUpdate(BaseModel):
|
||||
"""Schema for updating an existing ConversationContext. All fields are optional."""
|
||||
|
||||
session_id: Optional[UUID] = Field(None, description="Session ID (optional)")
|
||||
project_id: Optional[UUID] = Field(None, description="Project ID (optional)")
|
||||
machine_id: Optional[UUID] = Field(None, description="Machine ID that created this context")
|
||||
context_type: Optional[str] = Field(None, description="Type of context: session_summary, project_state, general_context")
|
||||
title: Optional[str] = Field(None, description="Brief title describing the context")
|
||||
dense_summary: Optional[str] = Field(None, description="Compressed, structured summary (JSON or dense text)")
|
||||
key_decisions: Optional[str] = Field(None, description="JSON array of important decisions made")
|
||||
current_state: Optional[str] = Field(None, description="JSON object describing what's currently in progress")
|
||||
tags: Optional[str] = Field(None, description="JSON array of tags for retrieval and categorization")
|
||||
relevance_score: Optional[float] = Field(None, ge=0.0, le=10.0, description="Float score for ranking relevance (0.0-10.0)")
|
||||
|
||||
|
||||
class ConversationContextResponse(ConversationContextBase):
|
||||
"""Schema for ConversationContext responses with ID and timestamps."""
|
||||
|
||||
id: UUID = Field(..., description="Unique identifier for the conversation context")
|
||||
created_at: datetime = Field(..., description="Timestamp when the context was created")
|
||||
updated_at: datetime = Field(..., description="Timestamp when the context was last updated")
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
@@ -1,52 +0,0 @@
|
||||
"""
|
||||
Pydantic schemas for DecisionLog model.
|
||||
|
||||
Request and response schemas for tracking important decisions made during work.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class DecisionLogBase(BaseModel):
|
||||
"""Base schema with shared DecisionLog fields."""
|
||||
|
||||
project_id: Optional[UUID] = Field(None, description="Project ID (optional)")
|
||||
session_id: Optional[UUID] = Field(None, description="Session ID (optional)")
|
||||
decision_type: str = Field(..., description="Type of decision: technical, architectural, process, security")
|
||||
decision_text: str = Field(..., description="What was decided (the actual decision)")
|
||||
rationale: Optional[str] = Field(None, description="Why this decision was made")
|
||||
alternatives_considered: Optional[str] = Field(None, description="JSON array of other options that were considered")
|
||||
impact: str = Field("medium", description="Impact level: low, medium, high, critical")
|
||||
tags: Optional[str] = Field(None, description="JSON array of tags for retrieval and categorization")
|
||||
|
||||
|
||||
class DecisionLogCreate(DecisionLogBase):
|
||||
"""Schema for creating a new DecisionLog."""
|
||||
pass
|
||||
|
||||
|
||||
class DecisionLogUpdate(BaseModel):
|
||||
"""Schema for updating an existing DecisionLog. All fields are optional."""
|
||||
|
||||
project_id: Optional[UUID] = Field(None, description="Project ID (optional)")
|
||||
session_id: Optional[UUID] = Field(None, description="Session ID (optional)")
|
||||
decision_type: Optional[str] = Field(None, description="Type of decision: technical, architectural, process, security")
|
||||
decision_text: Optional[str] = Field(None, description="What was decided (the actual decision)")
|
||||
rationale: Optional[str] = Field(None, description="Why this decision was made")
|
||||
alternatives_considered: Optional[str] = Field(None, description="JSON array of other options that were considered")
|
||||
impact: Optional[str] = Field(None, description="Impact level: low, medium, high, critical")
|
||||
tags: Optional[str] = Field(None, description="JSON array of tags for retrieval and categorization")
|
||||
|
||||
|
||||
class DecisionLogResponse(DecisionLogBase):
|
||||
"""Schema for DecisionLog responses with ID and timestamps."""
|
||||
|
||||
id: UUID = Field(..., description="Unique identifier for the decision log")
|
||||
created_at: datetime = Field(..., description="Timestamp when the decision was logged")
|
||||
updated_at: datetime = Field(..., description="Timestamp when the decision log was last updated")
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
@@ -1,53 +0,0 @@
|
||||
"""
|
||||
Pydantic schemas for ProjectState model.
|
||||
|
||||
Request and response schemas for tracking current state of projects.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class ProjectStateBase(BaseModel):
|
||||
"""Base schema with shared ProjectState fields."""
|
||||
|
||||
project_id: UUID = Field(..., description="Project ID (required, unique - one state per project)")
|
||||
last_session_id: Optional[UUID] = Field(None, description="Last session ID that updated this state")
|
||||
current_phase: Optional[str] = Field(None, description="Current phase or stage of the project")
|
||||
progress_percentage: int = Field(0, ge=0, le=100, description="Integer percentage of completion (0-100)")
|
||||
blockers: Optional[str] = Field(None, description="JSON array of current blockers preventing progress")
|
||||
next_actions: Optional[str] = Field(None, description="JSON array of next steps to take")
|
||||
context_summary: Optional[str] = Field(None, description="Dense overview text of where the project currently stands")
|
||||
key_files: Optional[str] = Field(None, description="JSON array of important file paths for this project")
|
||||
important_decisions: Optional[str] = Field(None, description="JSON array of key decisions made for this project")
|
||||
|
||||
|
||||
class ProjectStateCreate(ProjectStateBase):
|
||||
"""Schema for creating a new ProjectState."""
|
||||
pass
|
||||
|
||||
|
||||
class ProjectStateUpdate(BaseModel):
|
||||
"""Schema for updating an existing ProjectState. All fields are optional except project_id."""
|
||||
|
||||
last_session_id: Optional[UUID] = Field(None, description="Last session ID that updated this state")
|
||||
current_phase: Optional[str] = Field(None, description="Current phase or stage of the project")
|
||||
progress_percentage: Optional[int] = Field(None, ge=0, le=100, description="Integer percentage of completion (0-100)")
|
||||
blockers: Optional[str] = Field(None, description="JSON array of current blockers preventing progress")
|
||||
next_actions: Optional[str] = Field(None, description="JSON array of next steps to take")
|
||||
context_summary: Optional[str] = Field(None, description="Dense overview text of where the project currently stands")
|
||||
key_files: Optional[str] = Field(None, description="JSON array of important file paths for this project")
|
||||
important_decisions: Optional[str] = Field(None, description="JSON array of key decisions made for this project")
|
||||
|
||||
|
||||
class ProjectStateResponse(ProjectStateBase):
|
||||
"""Schema for ProjectState responses with ID and timestamps."""
|
||||
|
||||
id: UUID = Field(..., description="Unique identifier for the project state")
|
||||
created_at: datetime = Field(..., description="Timestamp when the state was created")
|
||||
updated_at: datetime = Field(..., description="Timestamp when the state was last updated")
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
Reference in New Issue
Block a user