CREATE TABLE IF NOT EXISTS project_context_setting (
    project_id UUID PRIMARY KEY,
    context_window_tokens INT NOT NULL DEFAULT 128000,
    compaction_threshold FLOAT NOT NULL DEFAULT 0.8,
    compaction_max_summary_ratio FLOAT NOT NULL DEFAULT 0.2,
    rag_enabled BOOLEAN NOT NULL DEFAULT true,
    rag_cross_session BOOLEAN NOT NULL DEFAULT true,
    rag_max_results INT NOT NULL DEFAULT 10,
    rag_min_score FLOAT NOT NULL DEFAULT 0.5,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_proj_ctx_rag_enabled ON project_context_setting (rag_enabled);
