Before running ANY commands, Claude Code must detect the operating system:
Use the process.platform from Node.js or check the environment:
Windows Detection:
process.platform === 'win32'- Path separators use
\ - Commands use Windows syntax
Mac/Linux Detection:
process.platform === 'darwin'(Mac) orprocess.platform === 'linux'- Path separators use
/ - Commands use Unix syntax
Always use cross-platform commands that work on both systems:
| Task | Cross-Platform Command |
|---|---|
| Install deps | npm install (works everywhere) |
| Change directory | cd ui (works everywhere) |
| Kill port | npx kill-port 3000 (works everywhere) |
| Read file | Use the Read tool (not cat) |
| Check file exists | Use Glob tool or fs.existsSync |
| Create directory | mkdir -p or use fs.mkdirSync |
When a user says "start my app", "run the app", "set up the project", or similar commands, Claude Code (YOU) must automatically perform the following steps:
Use Bash to check the platform:
node -e "console.log(process.platform)"This will return:
win32for Windowsdarwinfor Maclinuxfor Linux
These commands work on ALL platforms:
# Install root dependencies
npm install
# Install UI dependencies
cd ui && npm installUse the Read tool to check ui/.env.local (NOT cat command):
- Read the file using Claude Code's Read tool
- Check if it contains a valid API key (not placeholder)
If the file doesn't exist OR contains placeholder sk-oa-v1-your-key-here:
- Ask the user: "Do you have an OpenAnalyst API key? If not, get one at https://10x.events/api-key"
- Once user provides the key, create
ui/.env.localusing the Write tool:
# OpenAnalyst AI API (Required)
OPENANALYST_API_URL=https://api.openanalyst.com/api
OPENANALYST_API_KEY=<USER'S ACTUAL API KEY>
OPENANALYST_MODEL=openanalyst-betaCross-platform command (works on Windows, Mac, Linux):
npx kill-port 3000cd ui && npm run devTell the user: "Your 10X Accountability Coach is running at http://localhost:3000"
When user says "start my app", execute this flow:
1. Detect OS: node -e "console.log(process.platform)"
2. npm install (root) - cross-platform
3. cd ui && npm install - cross-platform
4. Check ui/.env.local for API key (use Read tool)
- If missing/placeholder → Ask user for API key → Create file (use Write tool)
- If valid → Continue
5. npx kill-port 3000 - cross-platform
6. cd ui && npm run dev - cross-platform
7. Tell user: "App running at http://localhost:3000"
The 10X Accountability Coach is a self-contained coaching app powered by the OpenAnalyst API.
User (UI) → Next.js API Route → OpenAnalyst API → Streaming Response → UI
Key Features:
- Single command startup - no second terminal needed
- AI-powered streaming chat responses
- Skills system for structured operations
- Personalized coaching based on user context
- Visit https://10x.events/api-key
- Enter email address
- Receive API key via email
sk-oa-v1-xxxxxxxxxxxxxxxxxxxxxxxx
ui/.env.local ← API key goes here (git-ignored, private)
# OpenAnalyst AI API (Required)
OPENANALYST_API_URL=https://api.openanalyst.com/api
OPENANALYST_API_KEY=sk-oa-v1-YOUR-ACTUAL-KEY-HERE
OPENANALYST_MODEL=openanalyst-beta
# Gemini AI (Optional - for image generation)
# GEMINI_API_KEY=your-gemini-key-here| User Says | Claude Code Action |
|---|---|
| "start my app" | Run full setup flow above |
| "run the app" | Run full setup flow above |
| "set up the project" | Run full setup flow above |
| "install dependencies" | npm install && cd ui && npm install |
| "start the server" | npx kill-port 3000 && cd ui && npm run dev |
| "check API status" | Check ui/.env.local and report status |
| "update my API key" | Ask for new key and update ui/.env.local |
| "stop the server" | npx kill-port 3000 |
20 skills + 6 commands for structured operations:
/streak- Check in to challenge/streak-new- Create new challenge/streak-list- List all challenges/streak-stats- View statistics/streak-switch- Switch active challenge/streak-insights- Cross-challenge insights
When user says "check in" or "/streak", the system:
- Matches the skill from
skills/directory - Injects skill instructions into the AI prompt
- AI follows the skill-specific behavior
data/
├── profiles/{user-id}/
│ ├── profile.md
│ ├── challenges/
│ ├── todos/
│ ├── checkins/
│ └── chats/
├── challenges/{challenge-id}/
│ ├── challenge.md
│ └── days/
├── skills/ # Skill definitions
├── schemas/ # Supabase SQL schemas
└── commands/ # Slash commands
10x-Accountability-Coach/
├── ui/ # Next.js frontend
│ ├── app/ # Pages & API routes
│ ├── components/ # React components
│ ├── lib/ # Utilities & stores
│ └── .env.local # API keys (CREATE THIS!)
├── data/ # User data (file-based)
├── skills/ # AI Skills (20+)
├── commands/ # Slash commands
├── scripts/ # Setup scripts
├── CLAUDE.md # THIS FILE - Claude Code instructions
└── README.md # User documentation
- Check
ui/.env.localhas real API key (not placeholder) - Restart dev server:
npx kill-port 3000 && cd ui && npm run dev
npx kill-port 3000 3001 3002
cd ui && npm run devCross-platform (use these commands on ANY system):
# Remove node_modules (works on Windows, Mac, Linux)
npx rimraf node_modules ui/node_modules
# Reinstall
npm install && cd ui && npm installOr use the Bash tool with platform-specific commands:
- Windows:
rmdir /s /q node_modules ui\node_modules - Mac/Linux:
rm -rf node_modules ui/node_modules
Cross-platform:
cd ui && npx rimraf .next && npm run buildThe app uses path.sep and cross-platform path utilities. If you encounter path-related errors:
- Check paths.ts - Uses
path.basename()andpath.sepfor cross-platform compatibility - Check data-source.ts - Uses environment variables without path hardcoding
- Restart the dev server after making changes
The app supports three data sources with this priority:
- MCP - When MCP is configured and enabled
- Supabase - When toggled ON in settings AND configured
- Local - Default fallback
To check which data source is active:
- Look at the data source indicator in the UI
- Check
ui/lib/data-source.tsfor the logic
When user wants to start the app, Claude Code should:
- ✅ Install all dependencies automatically
- ✅ Check for API key, ask user if missing
- ✅ Create
ui/.env.localwith user's API key - ✅ Kill any process on port 3000
- ✅ Start the dev server
- ✅ Tell user the app is running at http://localhost:3000
The user should only need to:
- Open Claude Code in this project
- Say "start my app"
- Provide API key if asked
- Open http://localhost:3000
Developed by Team 10X | Powered by OpenAnalyst