A React Native app for the ultimate thinking partner.
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 234 lines 7.4 kB view raw view rendered
1# co 2 3A thinking partner that learns how you think. 4 5co is a single AI agent that builds itself around you through conversation. Unlike traditional chatbots, co maintains a persistent, evolving understanding of who you are, what you're working on, and how you approach problems. 6 7## Core Concept 8 9Every user gets one co agent. That's it. No switching between assistants, no configuring multiple bots. Just one agent that: 10 11- **Learns your patterns**: Notices how you think, what excites you, what frustrates you 12- **Remembers everything**: Maintains both short-term context and long-term memory 13- **Evolves with you**: Updates its understanding as you grow and change 14- **Thinks alongside you**: Not just responding, but actively making connections and surfacing insights 15 16The entire agent definition lives in `src/utils/coAgent.ts`. When you log in for the first time, co creates itself and begins learning. 17 18## How It Works 19 20### Single Agent Architecture 21 22When you log in, the app: 231. Looks for an agent tagged with `co-app` 242. If found, connects to your existing co 253. If not found, creates a new co agent 26 27This means your co persists across devices and sessions. The same agent, with all its accumulated knowledge about you, is available wherever you log in. 28 29### Memory System 30 31co maintains structured memory across multiple blocks: 32 33**You** - Dynamic snapshot of what you're focused on right now. Updated frequently as your attention shifts. 34 35**Human** - Stable facts about you. Professional context, communication style, interests. Changes slowly over time. 36 37**Tasks** - What co is helping you accomplish. Added as new work emerges, removed when complete. 38 39**Knowledge Structure** - How you think. Mental models you use, patterns in how you approach problems, connections between concepts. 40 41**Interaction Log** - Significant moments in your relationship. Decisions made, insights gained, understanding that shifted. 42 43**Persona** - co's core identity and directives. How it thinks about its role as your thinking partner. 44 45**Memory Management** - Guidelines for when to create new memory blocks dynamically based on your usage patterns. 46 47### Background Processing 48 49co includes a sleeptime agent that runs in the background: 50- Manages long-term archival memory 51- Surfaces relevant context from past conversations 52- Operates independently to maintain the primary agent's performance 53 54The sleeptime agent shares memory blocks with the primary agent, enabling seamless context passing. 55 56## Features 57 58### Persistent Memory 59Every conversation builds on what co already knows. The agent's understanding compounds over time. 60 61### Real-time Streaming 62Messages stream token-by-token on web, creating natural conversation flow. 63 64### Adaptive Interface 65- Light and dark themes 66- Cross-platform support (iOS, Android, Web) 67- Responsive layout for mobile and desktop 68 69### File Sharing 70Attach files to messages for context. Works across all platforms. 71 72### Memory Inspection 73View co's memory blocks to see how its understanding has evolved. Available through the sidebar navigation. 74 75### Tool Access 76co can search the web, manage archival memory, and search conversation history to provide informed responses. 77 78## Getting Started 79 80### Prerequisites 81 82- Node.js 18 or higher 83- Letta API token from [letta.com](https://letta.com) 84 85### Installation 86 87```bash 88npm install 89npm start 90``` 91 92Press `w` to open in browser, or scan the QR code with Expo Go on your mobile device. 93 94### First Conversation 95 961. Enter your Letta API key 972. Wait for co to initialize (creates agent with memory blocks) 983. Start talking 99 100co begins building its understanding immediately. The more you interact, the better it gets at thinking alongside you. 101 102## Configuration 103 104### Agent Definition 105 106The entire agent is defined in `src/utils/coAgent.ts`. Key configuration: 107 108```typescript 109model: 'anthropic/claude-haiku-4-5-20251001' 110tools: ['conversation_search', 'web_search', 'fetch_webpage', 'memory'] 111enableSleeptime: true 112``` 113 114### Memory Blocks 115 116Default memory structure is defined in `src/constants/memoryBlocks.ts`. Each block includes: 117- Label (unique identifier) 118- Description (guides when/how co should update it) 119- Initial value (template structure) 120- Size limit 121 122co can dynamically create new blocks based on usage patterns (e.g., creating a "decision_log" if you frequently discuss choices, or "technical_notes" if you share code regularly). 123 124### System Prompt 125 126co's core behavior is defined in `src/constants/systemPrompt.ts`. This establishes: 127- How co thinks about its role 128- When to update memory 129- How to decompose and synthesize information 130- Relationship dynamics with the user 131 132## Architecture 133 134Built with React Native and Expo for true cross-platform support: 135 136- **State**: Zustand stores for agent, auth, and chat state 137- **API**: Letta SDK client with streaming support 138- **Storage**: AsyncStorage (mobile) and SecureStore (sensitive data) 139- **UI**: Native components with custom animations 140 141Key files: 142 143``` 144src/ 145 utils/coAgent.ts - Agent creation and initialization 146 constants/memoryBlocks.ts - Memory block templates 147 constants/systemPrompt.ts - Agent behavior definition 148 hooks/useAgent.ts - Agent lifecycle management 149 hooks/useMessageStream.ts - Streaming message handler 150 stores/agentStore.ts - Agent state management 151``` 152 153## Development 154 155### Running Locally 156 157```bash 158# Web with production optimizations 159npm run web:prod 160 161# iOS 162npm run ios 163 164# Android 165npm run android 166 167# Clear cache if needed 168npx expo start -c 169``` 170 171### Platform Notes 172 173**Web**: Full feature support including token streaming 174 175**iOS/Android**: No streaming (SDK limitation), but all other features work 176 177**Image uploads**: Currently disabled due to SDK validation issues 178 179## Deployment 180 181The app is deployed to Vercel: 182 183```bash 184npx expo export --platform web 185npx vercel dist --prod --yes 186``` 187 188Production URL will be provided upon deployment. 189 190## Customization 191 192### Changing the Model 193 194Edit `src/utils/coAgent.ts`: 195 196```typescript 197model: 'anthropic/claude-sonnet-4-5-20250929' // or any supported model 198``` 199 200### Adding Memory Blocks 201 202Create new block definitions in `src/constants/memoryBlocks.ts` and add to `getDefaultMemoryBlocks()`. 203 204### Modifying Behavior 205 206Edit `src/constants/systemPrompt.ts` to change how co thinks about its role and responsibilities. 207 208## Known Limitations 209 210- Image uploads disabled (SDK bug with streaming endpoint) 211- Token streaming only works on web (React Native SDK limitation) 212- Agent initialization with sleeptime can take 30-60 seconds 213- "Refresh Co" button may timeout during recreation 214 215## Philosophy 216 217Most AI assistants are stateless or have shallow memory. They respond to prompts but don't build deep models of who you are. 218 219co is different. It's designed to become your thinking partner through sustained interaction. It notices patterns in how you work, remembers what matters to you, and proactively makes connections you might miss. 220 221The goal isn't to replace your thinking. It's to augment it. To be the cognitive extension that helps you see your own ideas more clearly. 222 223One agent. One relationship. Built over time through conversation. 224 225## Resources 226 227- [Letta Documentation](https://docs.letta.com) 228- [Letta Discord](https://discord.gg/letta) 229- [React Native Docs](https://reactnative.dev) 230- [Expo Docs](https://docs.expo.dev) 231 232## License 233 234MIT