diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 00000000..872d2011
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,139 @@
+# CLAUDE.md
+
+This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
+
+## Project Overview
+
+Cinny is a Matrix client built with React, TypeScript, and Vite. It focuses on providing a simple, elegant, and secure interface for Matrix messaging. The application uses modern web technologies including React 18, Matrix JS SDK, and Jotai for state management.
+
+## Development Commands
+
+```bash
+# Install dependencies
+npm ci
+
+# Start development server (runs on port 8080)
+npm start
+
+# Build for production
+npm run build
+
+# Lint code (ESLint + Prettier)
+npm run lint
+
+# Type checking
+npm run typecheck
+
+# Individual lint checks
+npm run check:eslint # ESLint only
+npm run check:prettier # Prettier only
+npm run fix:prettier # Auto-fix Prettier issues
+```
+
+## Architecture Overview
+
+### Core Technologies
+- **Frontend**: React 18 with TypeScript
+- **Build Tool**: Vite with custom plugins for Matrix SDK WASM support
+- **State Management**: Jotai atoms with custom hooks for Matrix client binding
+- **Styling**: Vanilla Extract CSS-in-JS + SCSS
+- **Matrix SDK**: matrix-js-sdk with IndexedDB storage and Rust crypto
+- **Routing**: React Router v6
+- **Data Fetching**: React Query (TanStack Query)
+
+### Key Directories Structure
+
+- `src/app/` - Main application code
+ - `atoms/` - Base UI components (buttons, inputs, modals, etc.)
+ - `components/` - Reusable business logic components
+ - `features/` - Feature-specific components and logic
+ - `hooks/` - Custom React hooks
+ - `pages/` - Route components and app setup
+ - `state/` - Jotai atoms and state management
+ - `utils/` - Utility functions
+- `src/client/` - Matrix client initialization and management
+- `public/` - Static assets (icons, fonts, locales)
+
+### State Management Architecture
+
+Cinny uses Jotai for state management with a unique pattern:
+- **Atoms**: Defined in `src/app/state/` for different data types (rooms, invites, unread counts, etc.)
+- **Binding**: Matrix client events are bound to atoms via `useBindAtoms` hooks
+- **Hooks**: Custom hooks in `src/app/state/hooks/` provide convenient access to atom values
+
+Key state atoms:
+- `allRoomsAtom` - All joined rooms
+- `allInvitesAtom` - Room invitations
+- `roomToUnreadAtom` - Unread message counts
+- `mDirectAtom` - Direct message room mappings
+- `roomToParentsAtom` - Space/room hierarchies
+
+### Matrix Client Integration
+
+The Matrix client is initialized in `src/client/initMatrix.ts`:
+- Uses IndexedDB for message storage and crypto store
+- Enables Rust crypto for end-to-end encryption
+- Lazy loads room members for performance
+- Custom crypto callbacks for secret storage
+
+### Component Architecture
+
+- **Atoms**: Basic UI building blocks in `src/app/atoms/`
+- **Components**: Business logic components in `src/app/components/`
+- **Features**: Complete feature implementations in `src/app/features/`
+- **Styling**: Mix of Vanilla Extract (`.css.ts`) and SCSS files
+
+### Key Features
+
+- **Rooms & Spaces**: Full Matrix rooms and spaces support
+- **End-to-End Encryption**: Device verification and cross-signing
+- **Message Types**: Text, images, files, audio, video with rich content
+- **Themes**: Light/dark mode support
+- **PWA**: Service worker with offline capabilities
+- **Internationalization**: i18next with multiple language support
+- **Sliding Sync**: Matrix sliding sync protocol support for improved performance
+
+### Sliding Sync Integration
+
+Cinny now supports Matrix's sliding sync protocol as implemented in `src/app/state/sliding-sync/`:
+
+- **Configuration**: Enabled via `config.json` with proxy URL and list configurations
+- **State Management**: Dedicated Jotai atoms for sliding sync state and data
+- **Bridge**: Transparent integration with existing room list atoms for UI compatibility
+- **Fallback**: Automatic fallback to traditional sync when disabled
+
+Key files:
+- `src/client/initMatrix.ts` - Client initialization with sliding sync support
+- `src/app/state/sliding-sync/` - Sliding sync state management and bridge logic
+- `SLIDING_SYNC.md` - Detailed implementation documentation
+
+## Configuration Files
+
+- `config.json` - Client configuration (homeservers, features)
+- `build.config.ts` - Build-time configuration (base path)
+- `vite.config.js` - Vite build configuration with Matrix SDK WASM support
+- `tsconfig.json` - TypeScript configuration
+
+## Development Notes
+
+### Matrix SDK Integration
+- WASM files for Matrix SDK crypto are served via custom Vite plugin
+- IndexedDB is used for persistent storage of messages and crypto data
+- Client state is bound to Jotai atoms for reactive UI updates
+
+### Styling Approach
+- Primary styling uses Vanilla Extract for type-safe CSS-in-JS
+- Legacy SCSS files exist in some components
+- CSS custom properties for theming support
+
+### Testing & Quality
+- ESLint with Airbnb config + TypeScript rules
+- Prettier for code formatting
+- TypeScript strict mode enabled
+- No test framework currently configured
+
+### Build Process
+- Vite handles bundling with React plugin
+- Service worker built with vite-plugin-pwa
+- Static files copied from public/ and node_modules/
+- WASM support for Matrix SDK crypto functionality
\ No newline at end of file
diff --git a/SLIDING_SYNC.md b/SLIDING_SYNC.md
new file mode 100644
index 00000000..cbf92139
--- /dev/null
+++ b/SLIDING_SYNC.md
@@ -0,0 +1,144 @@
+# Sliding Sync Implementation
+
+This document describes the sliding sync integration added to Cinny.
+
+## Overview
+
+Cinny now supports Matrix's sliding sync protocol as an alternative to the traditional `/sync` endpoint. Sliding sync provides more efficient synchronization, better performance for large accounts, and fine-grained control over data loading.
+
+## Configuration
+
+To enable sliding sync, update your `config.json`:
+
+```json
+{
+ "slidingSync": {
+ "enabled": true,
+ "proxyUrl": "https://your-sliding-sync-proxy.example.com",
+ "defaultLists": {
+ "allRooms": {
+ "ranges": [[0, 49]],
+ "sort": ["by_recency", "by_name"],
+ "timeline_limit": 1,
+ "required_state": [
+ ["m.room.name", ""],
+ ["m.room.avatar", ""],
+ ["m.room.canonical_alias", ""],
+ ["m.room.topic", ""],
+ ["m.room.encryption", ""],
+ ["m.room.member", "$ME"]
+ ]
+ },
+ "directMessages": {
+ "ranges": [[0, 49]],
+ "sort": ["by_recency"],
+ "timeline_limit": 1,
+ "filters": {
+ "is_dm": true
+ },
+ "required_state": [
+ ["m.room.name", ""],
+ ["m.room.avatar", ""],
+ ["m.room.member", "$ME"]
+ ]
+ }
+ }
+ }
+}
+```
+
+### Configuration Options
+
+- `enabled`: Boolean to enable/disable sliding sync
+- `proxyUrl`: URL of your sliding sync proxy server
+- `defaultLists`: Configuration for different room lists
+ - `ranges`: Array of [start, end] ranges for room pagination
+ - `sort`: Array of sort methods (`by_recency`, `by_name`)
+ - `timeline_limit`: Number of timeline events to fetch per room
+ - `required_state`: State events to include in room data
+ - `filters`: Filters to apply to the list (e.g., `is_dm` for direct messages)
+
+## Technical Implementation
+
+### Architecture
+
+```
+SlidingSync → Event Handlers → Jotai Atoms → Bridge → Existing Room List Atoms → UI Components
+```
+
+### Key Components
+
+1. **Client Initialization** (`src/client/initMatrix.ts`)
+ - Conditionally creates SlidingSync instance based on config
+ - Falls back to traditional sync if sliding sync is disabled
+
+2. **State Management** (`src/app/state/sliding-sync/`)
+ - `slidingSync.ts`: Core atoms for sliding sync state
+ - `useSlidingSync.ts`: Hooks for binding sliding sync events to atoms
+ - `roomListBridge.ts`: Bridge between sliding sync data and existing room list atoms
+
+3. **Integration** (`src/app/state/hooks/useBindAtoms.ts`)
+ - Conditionally binds either sliding sync or traditional sync atoms
+ - Maintains compatibility with existing UI components
+
+### State Atoms
+
+- `slidingSyncAtom`: Stores the SlidingSync instance
+- `slidingSyncStateAtom`: Current sync state (PREPARED, SYNCING, STOPPED, ERROR)
+- `slidingSyncEnabledAtom`: Boolean indicating if sliding sync is active
+- `slidingSyncRoomListAtom`: Room lists from sliding sync
+- `slidingSyncRoomDataAtom`: Room metadata from sliding sync
+- `slidingSyncErrorAtom`: Error state
+
+## Usage
+
+### Enabling Sliding Sync
+
+1. **Configuration**: Edit `config.json` to enable sliding sync and set proxy URL
+2. **Restart**: Restart the Cinny application for changes to take effect
+3. **Verification**: Check the settings UI to verify sliding sync is active
+
+### Settings Interface
+
+Cinny provides a comprehensive settings interface for sliding sync:
+
+- **General Settings**: View sliding sync status in Settings → General → Synchronization
+- **Dedicated Page**: Access detailed configuration in Settings → Sliding Sync
+- **Status Indicator**: Real-time sync status displayed in the top bar
+- **URL Validation**: Built-in validation for proxy URLs with helpful error messages
+
+### Settings Features
+
+- **Status Monitoring**: Real-time status display (Active, Syncing, Error, etc.)
+- **Configuration View**: Display current proxy URL and enabled status
+- **URL Examples**: Pre-configured examples of common sliding sync proxies
+- **Error Reporting**: Detailed error messages when sliding sync fails
+- **Validation**: URL format validation with security requirements (HTTPS)
+
+When sliding sync is enabled:
+
+1. The client will use sliding sync instead of traditional `/sync`
+2. Room lists are populated via sliding sync events
+3. Existing UI components continue to work via the bridge layer
+4. Fallback to traditional sync occurs if sliding sync fails or is disabled
+5. Status indicators show real-time sync state
+
+## Requirements
+
+- Matrix JS SDK v37.5.0+
+- Sliding sync proxy server
+- Compatible homeserver (Matrix 1.4+)
+
+## Benefits
+
+- **Performance**: Faster sync for large accounts
+- **Efficiency**: Only loads visible rooms and timelines
+- **Scalability**: Better handling of large room lists
+- **Flexibility**: Fine-grained control over data loading
+
+## Backward Compatibility
+
+The implementation maintains full backward compatibility:
+- Traditional sync works when sliding sync is disabled
+- All existing UI components function without changes
+- Progressive enhancement approach
\ No newline at end of file
diff --git a/config.json b/config.json
index de6015a1..cd41eb93 100644
--- a/config.json
+++ b/config.json
@@ -34,5 +34,38 @@
"hashRouter": {
"enabled": false,
"basename": "/"
+ },
+
+ "slidingSync": {
+ "enabled": true,
+ "proxyUrl": "https://syncv3.matrix.org",
+ "defaultLists": {
+ "allRooms": {
+ "ranges": [[0, 49]],
+ "sort": ["by_recency", "by_name"],
+ "timeline_limit": 1,
+ "required_state": [
+ ["m.room.name", ""],
+ ["m.room.avatar", ""],
+ ["m.room.canonical_alias", ""],
+ ["m.room.topic", ""],
+ ["m.room.encryption", ""],
+ ["m.room.member", "$ME"]
+ ]
+ },
+ "directMessages": {
+ "ranges": [[0, 49]],
+ "sort": ["by_recency"],
+ "timeline_limit": 1,
+ "filters": {
+ "is_dm": true
+ },
+ "required_state": [
+ ["m.room.name", ""],
+ ["m.room.avatar", ""],
+ ["m.room.member", "$ME"]
+ ]
+ }
+ }
}
}
diff --git a/purple-theme-demo.html b/purple-theme-demo.html
new file mode 100644
index 00000000..ba19c3b4
--- /dev/null
+++ b/purple-theme-demo.html
@@ -0,0 +1,262 @@
+
+
+
+
+
+ Cinny Purple Theme - Applied
+
+
+
+
+
+
Cinny Purple Theme
+
🎨 Successfully Applied to Cinny Matrix Client
+
+
+
+
Primary Buttons & Actions
+
+
+
+
+
+
+
+
+
+
Navigation & Room Cards
+
🏠 Home
+
💬 Direct Messages
+
🏢 Workspaces
+
+
+ #general
+ Latest: Welcome to the purple theme!
+
+
+ #development
+ Latest: Theme looks amazing 🎨
+
+
+
+
+
Input Fields & Forms
+
+
+
+
+
+
+ ✅ Purple Theme Successfully Applied!
+ The refined purple color scheme has been integrated into Cinny with gradient buttons,
+ enhanced cards, and beautiful purple accents throughout the interface.
+