Convergence - AGENTS.md
Project Overview
Convergence is a Flutter mobile application implementing βThe Convergence Protocol β 40 Nodes of Cognitive Counter-Hackingβ. It is a self-improvement and mindfulness application that provides users with 40 cognitive techniques (called βnodesβ) organized into 5 thematic suites to help resist digital manipulation and improve cognitive hygiene.
The app follows a gamified approach with streaks, progress tracking, and weekly reflections to encourage consistent practice of cognitive defense techniques.
Technology Stack
- Framework: Flutter (SDK >=3.0.0 <4.0.0)
- Language: Dart
- State Management: Provider pattern (
providerpackage) - Database: SQLite via
sqflitepackage - UI Design: Material Design 3 with custom theming
Key Dependencies
| Package | Purpose |
|---|---|
sqflite | Local SQLite database for practice logs |
path_provider | Access to filesystem paths for database |
shared_preferences | Simple key-value storage for settings |
flutter_local_notifications | Local push notifications |
intl | Internationalization and date formatting |
fl_chart | Data visualization (radar charts for progress) |
home_widget | Home screen widgets support |
flutter_svg | SVG image support |
flutter_lints | Dart/Flutter linting rules |
Project Structure
convergence/
βββ android/ # Android platform configuration (minimal)
βββ ios/ # iOS platform configuration (minimal)
βββ assets/ # Static assets
β βββ images/ # Image assets (empty currently)
βββ lib/
β βββ data/
β β βββ nodes_data.dart # Static data for all 40 nodes
β βββ models/
β β βββ node.dart # Data models (Node, PracticeLog, etc.)
β βββ providers/
β β βββ app_provider.dart # State management and business logic
β βββ screens/
β β βββ home_screen.dart # Main dashboard
β β βββ node_detail_screen.dart # Individual node details
β β βββ log_practice_screen.dart # Practice logging UI
β β βββ pattern_screen.dart # Stats and progress visualization
β β βββ weekly_convergence_screen.dart # Weekly review
β βββ services/
β β βββ database_service.dart # SQLite database operations
β βββ widgets/
β β βββ streak_counter.dart # Reusable streak UI component
β βββ main.dart # Application entry point
βββ pubspec.yaml # Project configuration and dependencies
Architecture Overview
The app follows a layered architecture with clear separation of concerns:
1. Data Layer (data/)
NodesDataclass contains static configuration for all 40 nodes- Each node includes: id, title, activation phrase, warning sign, description, suite assignment, and optional marginalia
- 5 Node Suites: Recognition, Resistance, Reconstruction, Relationship, Renewal
2. Model Layer (models/)
Node: Immutable data class representing a cognitive techniquePracticeLog: Record of user practice sessionsNodeSuite: Enum defining the 5 thematic suitesWeeklyConvergence&UserStats: Supporting data structures
3. Service Layer (services/)
DatabaseService: Singleton pattern for SQLite operations- Tables:
practice_logs,weekly_convergences,user_settings - Handles streak calculation, practice counting, and data persistence
4. Provider Layer (providers/)
AppProvider: Main state management usingChangeNotifier- Aggregates data from database and exposes to UI
- Calculates derived state (streaks, progress, top/bottom nodes)
- Handles practice logging and data refresh
5. Presentation Layer (screens/, widgets/)
- Screen widgets are stateless where possible, stateful when needed
- Use
Consumer<AppProvider>orcontext.read<AppProvider>()for state access - Material Design 3 components with custom theming
Key Features
- Daily Node: Rotates through 40 nodes based on day of year
- Practice Logging: Record practice intensity (1-5) and context
- Streak Tracking: Current and longest streak calculation
- Progress Visualization: Radar chart showing progress by suite
- Weekly Convergence: Weekly review of all 40 nodes with reflection
- Pattern Analysis: Top 3 and bottom 3 nodes by practice count
Build and Run Commands
Prerequisites
- Flutter SDK (>=3.0.0)
- Dart SDK
- Android SDK (for Android builds)
- Xcode (for iOS builds, macOS only)
Development Commands
# Get dependencies
flutter pub get
# Run in debug mode
flutter run
# Run on specific device
flutter run -d <device_id>
# Build APK (Android)
flutter build apk
# Build app bundle (Android)
flutter build appbundle
# Build iOS app (macOS only)
flutter build ios
# Run tests
flutter test
# Analyze code
flutter analyze
# Format code
flutter format lib/Code Style Guidelines
Dart/Flutter Conventions
- Follows
flutter_lintsrules (standard Flutter linting) - Use
constconstructors where possible - Prefer single quotes for strings
- Use trailing commas for better diffs
Naming Conventions
- Files: snake_case (e.g.,
home_screen.dart) - Classes: PascalCase (e.g.,
HomeScreen) - Variables/Functions: camelCase (e.g.,
currentStreak) - Constants: camelCase for local, PascalCase for enum-like constants
UI Patterns
- Use
CustomScrollViewwithSliverAppBarfor scrollable screens - Theme-aware colors via
Theme.of(context).colorScheme - Consistent padding: 16px for screen edges, 8px/12px/24px for internal spacing
- Card-based layout with rounded corners (8px-16px radius)
State Management Patterns
// Reading from provider
final provider = context.read<AppProvider>();
// Listening to provider (rebuilds UI)
Consumer<AppProvider>(
builder: (context, provider, child) {
// Build UI with provider data
},
)Testing
Currently, the project has no test files. Testing infrastructure is available via flutter_test dev dependency.
Recommended Test Structure
test/
βββ models/
β βββ node_test.dart
βββ providers/
β βββ app_provider_test.dart
βββ services/
β βββ database_service_test.dart
βββ widgets/
βββ streak_counter_test.dart
Running Tests
# Run all tests
flutter test
# Run with coverage
flutter test --coverage
# Run specific test file
flutter test test/models/node_test.dartDatabase Schema
practice_logs
| Column | Type | Description |
|---|---|---|
| id | INTEGER PRIMARY KEY | Auto-increment ID |
| node_id | INTEGER | Reference to node (1-40) |
| practiced_at | TEXT (ISO8601) | Timestamp of practice |
| intensity | INTEGER | 1-5 intensity rating |
| context | TEXT | Optional context notes |
weekly_convergences
| Column | Type | Description |
|---|---|---|
| id | INTEGER PRIMARY KEY | Auto-increment ID |
| week_start | TEXT (ISO8601) | Start of week |
| nodes_practiced | TEXT | JSON array of node IDs |
| most_avoided | INTEGER | Node ID most avoided |
| commit_to_deepen | INTEGER | Node ID to focus on |
| reflection | TEXT | User reflection text |
user_settings
| Column | Type | Description |
|---|---|---|
| key | TEXT PRIMARY KEY | Setting identifier |
| value | TEXT | Setting value |
The 40 Nodes
Nodes are organized into 5 suites of 8 nodes each:
-
SUITE I: RECOGNITION (Perception Hygiene)
- Pattern Recognition, Emotional Resonance, Source Verification, Temporal Displacement, Attention Architecture, Frequency Analysis, Urgency Decomposition, Novelty Assessment
-
SUITE II: RESISTANCE (Response Protocols)
- The Pause Protocol, Value Reaffirmation, Alternative Narrative, Cost Calculation, Identity Boundary Check, Emotional Audit, Temporal Zoom, Silence Practice
-
SUITE III: RECONSTRUCTION (Meaning-Making)
- First Principles Return, Analog Translation, Embodied Verification, Sleep Integration, Cross-Domain Application, Historical Parallel, Inversion Test, Stakeholder Mapping
-
SUITE IV: RELATIONSHIP (Social Cognition)
- Intergenerational Bridge, Non-Human Perspective, Asymmetric Empathy, Local Context Weighting, Synchronous Ritual, Conflict Preservation, Mentor Memory, Descendant Imagination
-
SUITE V: RENEWAL (Maintenance)
- Cognitive Spring Cleaning, Attention Diet, Boredom Reclamation, Manual Competence, Nature Exposure, Creative Output, Service Orientation, The Weekly Convergence
Security Considerations
- All data is stored locally on device (SQLite)
- No network requests are made by the application
- No sensitive authentication or user identification
- Data persists in appβs private storage
- TODO: Consider export functionality for data backup
Known TODOs
HomeScreen: Settings screen implementationPatternScreen: Export session data featureWeeklyConvergenceScreen: Save weekly convergence to databaseassets/images/: Add actual image assets
Development Notes
- The app uses a green color scheme (
0xFF2E7D32) as the seed color - Font family is set to βInterβ (must be bundled for production)
- Streak calculation is date-based (not time-based)
- Todayβs node is determined by
dayOfYear % 40 - Practice intensity colors: blue (1) β green (2) β orange (3) β deep orange (4) β red (5)