|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is the documentation website for Basic Memory (`docs.basicmemory.com`), built with Astro, React components, and MDX for content. The site provides comprehensive documentation including guides, integrations, how-to articles, and technical references. |
| 8 | + |
| 9 | +### What is Basic Memory? |
| 10 | + |
| 11 | +**Basic Memory** is a local-first knowledge management system built on the Model Context Protocol (MCP) that enables persistent AI memory across conversations. Instead of losing valuable insights in conversation history, users build a persistent knowledge base where both human and AI can read, write, and enhance each other's work. |
| 12 | + |
| 13 | +**Repository**: https://github.com/basicmachines-co/basic-memory |
| 14 | +**Website**: https://basicmemory.com |
| 15 | +**Current Version**: v0.15.0 (released October 4, 2025) |
| 16 | + |
| 17 | +**Key Features**: |
| 18 | +- 17 MCP tools for AI integration (write_note, read_note, edit_note, search_notes, build_context, etc.) |
| 19 | +- Local markdown files create a semantic knowledge graph |
| 20 | +- Multi-project support with project switching |
| 21 | +- Integrations with Claude Desktop, VS Code, Cursor, Obsidian |
| 22 | +- Python-based with FastAPI endpoints and comprehensive CLI |
| 23 | +- Real-time file synchronization |
| 24 | +- SQLite indexing with markdown as source of truth |
| 25 | + |
| 26 | +**v0.15.0 Major Features**: |
| 27 | +- Cloud authentication support (WorkOS integration) |
| 28 | +- Stateless MCP architecture for cloud deployment |
| 29 | +- Cloud sync via rclone bisync |
| 30 | +- Cloud mount CLI commands for local file access |
| 31 | +- Subscription validation for cloud billing |
| 32 | +- ChatGPT tools integration |
| 33 | +- `.gitignore` support in sync operations |
| 34 | +- Configurable permalink generation |
| 35 | +- Performance optimizations for API and database |
| 36 | +- Critical bug fixes for permalink collisions |
| 37 | + |
| 38 | +### Basic Memory Cloud (Upcoming Release) |
| 39 | + |
| 40 | +**Basic Memory Cloud** is a multi-tenant cloud platform that provides hosted Basic Memory instances with subscription billing and authentication. |
| 41 | + |
| 42 | +**Repository**: https://github.com/basicmachines-co/basic-memory-cloud |
| 43 | +**Status**: Active development, pre-release |
| 44 | + |
| 45 | +**Architecture**: |
| 46 | +- **Web App** (Vue.js + Nuxt) - Frontend with WorkOS AuthKit magic link authentication |
| 47 | +- **Cloud Service** (FastAPI + ARQ) - Tenant management and provisioning |
| 48 | +- **MCP Gateway** - Proxy routing to tenant instances with JWT validation |
| 49 | +- **API Service** - Per-tenant Basic Memory instances with full isolation |
| 50 | +- **Database** - Neon PostgreSQL with branch-per-PR workflow |
| 51 | +- **Infrastructure** - Fly.io container orchestration |
| 52 | +- **Billing** - Polar subscription integration |
| 53 | + |
| 54 | +**Key Capabilities**: |
| 55 | +- WorkOS AuthKit authentication with magic links |
| 56 | +- Per-user isolated Basic Memory instances |
| 57 | +- Automatic tenant provisioning via ARQ job queue |
| 58 | +- Cloud sync via rclone for local-cloud bidirectional sync |
| 59 | +- Subscription-based access control |
| 60 | +- OAuth 2.1 server for MCP client registration |
| 61 | + |
| 62 | +### Documentation Scope |
| 63 | + |
| 64 | +This documentation site covers both: |
| 65 | +1. **Basic Memory** (local-first product) - Installation, MCP tools, CLI, integrations, knowledge format |
| 66 | +2. **Basic Memory Cloud** (upcoming) - Cloud-specific features, authentication, sync, billing |
| 67 | + |
| 68 | +The site is currently being updated for v0.15.0 and to include cloud product documentation. |
| 69 | + |
| 70 | +## Development Commands |
| 71 | + |
| 72 | +```bash |
| 73 | +npm install # Install dependencies |
| 74 | +npm run dev # Start dev server at localhost:4321 |
| 75 | +npm run build # Build production site to ./dist/ |
| 76 | +npm run preview # Preview production build locally |
| 77 | +npm run astro ... # Run Astro CLI commands |
| 78 | +``` |
| 79 | + |
| 80 | +## Architecture |
| 81 | + |
| 82 | +### Tech Stack |
| 83 | +- **Framework**: Astro 5 with MDX and React integration |
| 84 | +- **Styling**: Tailwind CSS with custom design tokens |
| 85 | +- **Components**: React (TSX) and Astro components |
| 86 | +- **Search**: Pagefind for static search |
| 87 | +- **Diagrams**: Mermaid integration with theme support |
| 88 | +- **Syntax Highlighting**: Shiki with GitHub light/dark themes |
| 89 | + |
| 90 | +### Directory Structure |
| 91 | + |
| 92 | +``` |
| 93 | +src/ |
| 94 | +├── components/ # React and Astro components |
| 95 | +│ ├── *.tsx # React components (Callout, Card, CodeBlock, Tabs, etc.) |
| 96 | +│ └── *.astro # Astro components (Header, Sidebar, Footer, etc.) |
| 97 | +├── config/ |
| 98 | +│ └── navigation.ts # Navigation configuration |
| 99 | +├── layouts/ |
| 100 | +│ ├── Layout.astro # Base layout |
| 101 | +│ └── DocsLayout.astro # Docs page layout with sidebar + TOC |
| 102 | +├── lib/ |
| 103 | +│ └── utils.ts # Utility functions (cn, etc.) |
| 104 | +├── pages/ # File-based routing |
| 105 | +│ ├── index.mdx |
| 106 | +│ ├── guides/ |
| 107 | +│ ├── integrations/ |
| 108 | +│ ├── how-to/ |
| 109 | +│ └── technical/ |
| 110 | +└── styles/ # Global styles and CSS variables |
| 111 | +``` |
| 112 | + |
| 113 | +### Key Architectural Patterns |
| 114 | + |
| 115 | +**Navigation System** (`src/config/navigation.ts`): |
| 116 | +- Centralized configuration for all navigation |
| 117 | +- `navConfig.sidebar`: Hierarchical sidebar structure with sections and items |
| 118 | +- `navConfig.sidebarTopLinks`: External links with icons (GitHub, Discord, etc.) |
| 119 | +- `navConfig.topNav`: Top navigation links |
| 120 | +- Interface: `SidebarSection` containing `NavItem[]` |
| 121 | + |
| 122 | +**Layout Composition**: |
| 123 | +- `Layout.astro`: Base layout with head/meta tags |
| 124 | +- `DocsLayout.astro`: Three-column layout (Sidebar → Content → TableOfContents) |
| 125 | +- Uses frontmatter `layout` field in MDX files |
| 126 | + |
| 127 | +**Component System**: |
| 128 | +- Documentation components exported from `src/components/index.ts` |
| 129 | +- Custom components available in MDX: `Card`, `CardGroup`, `Callout`, `Tip`, `Warning`, `Note`, `Info`, `Steps`, `Tabs`, `CodeBlock`, `CodeGroup`, `InstallationTabs` |
| 130 | +- All use Tailwind CSS with dark mode support via `class` strategy |
| 131 | + |
| 132 | +**Path Aliases**: |
| 133 | +- `@/*` maps to `./src/*` (configured in tsconfig.json) |
| 134 | +- Always use `@/components`, `@/config`, etc. for imports |
| 135 | + |
| 136 | +**Theming**: |
| 137 | +- Dark mode: Class-based (`darkMode: 'class'` in Tailwind) |
| 138 | +- Theme toggle component with localStorage persistence |
| 139 | +- Custom CSS variables in Tailwind config for design tokens |
| 140 | +- Mermaid diagrams support light/dark themes |
| 141 | + |
| 142 | +## Content Guidelines |
| 143 | + |
| 144 | +### Adding Documentation Pages |
| 145 | + |
| 146 | +1. Create MDX file in appropriate `src/pages/` subdirectory |
| 147 | +2. Add frontmatter: |
| 148 | + ```yaml |
| 149 | + --- |
| 150 | + layout: '@/layouts/DocsLayout.astro' |
| 151 | + title: 'Page Title' |
| 152 | + description: 'Optional description' |
| 153 | + --- |
| 154 | + ``` |
| 155 | +3. Add navigation entry to `src/config/navigation.ts` in correct section |
| 156 | +4. Import and use documentation components as needed |
| 157 | + |
| 158 | +### Using Components in MDX |
| 159 | + |
| 160 | +```mdx |
| 161 | +import { Card, CardGroup, Callout, Steps } from '@/components' |
| 162 | + |
| 163 | +<Callout type="info"> |
| 164 | + Important information here |
| 165 | +</Callout> |
| 166 | + |
| 167 | +<Steps> |
| 168 | +1. First step |
| 169 | +2. Second step |
| 170 | +</Steps> |
| 171 | + |
| 172 | +<CardGroup cols={2}> |
| 173 | + <Card title="Guide 1" href="/guide-1" /> |
| 174 | + <Card title="Guide 2" href="/guide-2" /> |
| 175 | +</CardGroup> |
| 176 | +``` |
| 177 | + |
| 178 | +## Navigation Updates |
| 179 | + |
| 180 | +When adding/removing/reorganizing pages, update `src/config/navigation.ts`: |
| 181 | + |
| 182 | +```typescript |
| 183 | +export const navConfig = { |
| 184 | + sidebar: [ |
| 185 | + { |
| 186 | + title: 'Section Name', |
| 187 | + items: [ |
| 188 | + { title: 'Page Title', href: '/path/to/page' }, |
| 189 | + ], |
| 190 | + }, |
| 191 | + ], |
| 192 | +} |
| 193 | +``` |
| 194 | + |
| 195 | +The sidebar automatically highlights the current page based on `href` matching `Astro.url.pathname`. |
| 196 | + |
| 197 | +## Styling Conventions |
| 198 | + |
| 199 | +- Use Tailwind utility classes |
| 200 | +- Dark mode: Add `dark:` variants for all colors |
| 201 | +- Responsive: Mobile-first with `md:` and `lg:` breakpoints |
| 202 | +- Custom colors use HSL CSS variables from Tailwind config |
| 203 | +- Components should support both light and dark themes |
| 204 | + |
| 205 | +## Site Configuration |
| 206 | + |
| 207 | +- Site URL: `https://docs.basicmemory.com` (in astro.config.mjs) |
| 208 | +- Mermaid diagrams use 'default' (light) and 'base' (dark) themes |
| 209 | +- Shiki syntax highlighting uses 'github-light' and 'github-dark' |
| 210 | +- Pagefind builds search index automatically during production build |
| 211 | + |
| 212 | +## Documentation Status & Priorities |
| 213 | + |
| 214 | +### Current Branch: v0.15.0-release-docs |
| 215 | + |
| 216 | +This branch is dedicated to updating documentation for: |
| 217 | +1. Basic Memory v0.15.0 release (October 4, 2025) |
| 218 | +2. Basic Memory Cloud product (upcoming release) |
| 219 | + |
| 220 | +### Areas Requiring Updates for v0.15.0 |
| 221 | + |
| 222 | +**New Features to Document**: |
| 223 | +- Cloud authentication and WorkOS integration |
| 224 | +- Cloud sync capabilities via rclone bisync |
| 225 | +- Cloud mount CLI commands (fast/balanced/safe profiles) |
| 226 | +- Subscription validation and billing integration |
| 227 | +- ChatGPT tools integration |
| 228 | +- `.gitignore` support in sync operations |
| 229 | +- Configurable permalink generation (`disable_permalinks` flag) |
| 230 | +- Stateless MCP architecture changes |
| 231 | + |
| 232 | +**CLI Reference Updates**: |
| 233 | +- Cloud-specific commands (`cloud mount`, `cloud sync`, etc.) |
| 234 | +- New MCP tools if any were added |
| 235 | +- Subscription validation commands |
| 236 | + |
| 237 | +**Integration Updates**: |
| 238 | +- Any changes to Claude Desktop integration |
| 239 | +- Any changes to VS Code/Cursor integrations |
| 240 | +- ChatGPT integration documentation (new) |
| 241 | + |
| 242 | +### Areas Requiring Cloud Product Documentation |
| 243 | + |
| 244 | +**New Pages Needed**: |
| 245 | +- Cloud product overview and value proposition |
| 246 | +- Getting started with Basic Memory Cloud |
| 247 | +- Authentication (WorkOS magic links) |
| 248 | +- Subscription and billing (Polar integration) |
| 249 | +- Cloud sync setup and usage |
| 250 | +- Cloud mount for local editing |
| 251 | +- Cloud vs. Local comparison |
| 252 | + |
| 253 | +**Architecture Documentation**: |
| 254 | +- Multi-tenant architecture overview |
| 255 | +- Per-tenant isolation model |
| 256 | +- Cloud sync architecture |
| 257 | +- MCP gateway and proxy routing |
| 258 | + |
| 259 | +### Reference Materials |
| 260 | + |
| 261 | +When documenting features: |
| 262 | +- **Basic Memory CHANGELOG**: `gh api repos/basicmachines-co/basic-memory/contents/CHANGELOG.md` |
| 263 | +- **Release Notes**: `gh release view v0.15.0 --repo basicmachines-co/basic-memory` |
| 264 | +- **Basic Memory README**: https://github.com/basicmachines-co/basic-memory |
| 265 | +- **Cloud README**: https://github.com/basicmachines-co/basic-memory-cloud |
| 266 | +- **Cloud CLAUDE.md**: https://github.com/basicmachines-co/basic-memory-cloud/blob/main/CLAUDE.md |
0 commit comments