Built by Claude — autonomous protocol + Tauri capabilities #4001
4 changed files+102−107
Modified.claude/settings.json+13−3View fileUnifiedSplit
@@ -5,11 +5,21 @@
55 "hooks": [
66 {
77 "type": "command",
8 "command": "cd /home/user/-48co-ai-pa && node -e \"const fs=require('fs'),path=require('path');let errors=[];const check=(dir,exts)=>{if(!fs.existsSync(dir))return;fs.readdirSync(dir,{recursive:true}).forEach(f=>{const fp=path.join(dir,f);if(!fs.statSync(fp).isFile())return;if(!exts.some(e=>f.endsWith(e)))return;const c=fs.readFileSync(fp,'utf8');const lines=c.split('\\n');lines.forEach((l,i)=>{if(l.match(/import.*from\\s+['\\\"]\\.\\.?\\//)){const m=l.match(/from\\s+['\\\"](.+?)['\\\"]/);if(m){const imp=m[1];const resolved=path.resolve(path.dirname(fp),imp);const exists=[resolved,resolved+'.js',resolved+'.jsx',resolved+'.ts',resolved+'.tsx',resolved+'/index.js',resolved+'/index.jsx'].some(p=>fs.existsSync(p));if(!exists)errors.push(fp+':'+(i+1)+' broken import: '+imp)}}});if(f.endsWith('.js')&&!fp.includes('node_modules')){if(c.includes('console.error')&&c.includes('TODO'))errors.push(fp+' has TODO with console.error')}})};check('app',['.jsx','.tsx','.js']);check('components',['.jsx','.tsx','.js']);check('extension',['.js']);check('api',['.js']);['extension/manifest.json'].forEach(f=>{if(fs.existsSync(f)){const m=JSON.parse(fs.readFileSync(f,'utf8'));if(m.content_scripts)m.content_scripts.forEach(cs=>cs.js.forEach(j=>{if(!fs.existsSync(path.join('extension',j)))errors.push('manifest references missing: extension/'+j)}))}});if(errors.length>0){console.log(JSON.stringify({systemMessage:'CRAWL FOUND '+errors.length+' ERROR(S):\\n'+errors.join('\\n')}));}else{console.log(JSON.stringify({systemMessage:'Crawl clean — 0 errors found.'}))}\"",
8 "command": "cd /home/user/-48co-ai-pa && node -e \"const fs=require('fs'),path=require('path');let errors=[];const check=(dir,exts)=>{if(!fs.existsSync(dir))return;fs.readdirSync(dir,{recursive:true}).forEach(f=>{const fp=path.join(dir,f);if(!fs.statSync(fp).isFile())return;if(!exts.some(e=>f.endsWith(e)))return;const c=fs.readFileSync(fp,'utf8');const lines=c.split('\\n');lines.forEach((l,i)=>{if(l.match(/import.*from\\s+['\\\"]\\.\\.?\\//)){const m=l.match(/from\\s+['\\\"](.+?)['\\\"]/);if(m){const imp=m[1];const resolved=path.resolve(path.dirname(fp),imp);const exists=[resolved,resolved+'.js',resolved+'.jsx',resolved+'.ts',resolved+'.tsx',resolved+'/index.js',resolved+'/index.jsx'].some(p=>fs.existsSync(p));if(!exists)errors.push(fp+':'+(i+1)+' broken import: '+imp)}}})})};check('app',['.jsx','.tsx','.js']);check('components',['.jsx','.tsx','.js']);check('tauri-app/src',['.jsx','.tsx','.js']);check('extension',['.js']);check('lib',['.js']);['extension/manifest.json'].forEach(f=>{if(fs.existsSync(f)){const m=JSON.parse(fs.readFileSync(f,'utf8'));if(m.content_scripts)m.content_scripts.forEach(cs=>cs.js.forEach(j=>{if(!fs.existsSync(path.join('extension',j)))errors.push('manifest references missing: extension/'+j)}))}});['tauri-app/src-tauri/Cargo.toml','tauri-app/src-tauri/tauri.conf.json','tauri-app/package.json'].forEach(f=>{if(!fs.existsSync(f))errors.push('Missing critical file: '+f)});const rsFiles=['lib.rs','audio.rs','transcribe.rs','keyboard.rs','grammar.rs','main.rs'];rsFiles.forEach(f=>{if(!fs.existsSync('tauri-app/src-tauri/src/'+f))errors.push('Missing Rust source: src-tauri/src/'+f)});if(errors.length>0){console.log(JSON.stringify({systemMessage:'CRAWL FOUND '+errors.length+' ERROR(S):\\n'+errors.join('\\n')}));}else{console.log(JSON.stringify({systemMessage:'Crawl clean — 0 errors found.'}))}\"",
99 "timeout": 15,
1010 "statusMessage": "Running error crawl..."
1111 }
1212 ]
13 },
14 {
15 "hooks": [
16 {
17 "type": "command",
18 "command": "cd /home/user/-48co-ai-pa && git status --porcelain | head -5 | { read -r line; if [ -n \"$line\" ]; then echo '{\"systemMessage\":\"WARNING: Uncommitted changes detected. Commit and push before ending session.\"}'; fi; }",
19 "timeout": 5,
20 "statusMessage": "Checking git status..."
21 }
22 ]
1323 }
1424 ],
1525 "SessionStart": [
@@ -17,9 +27,9 @@
1727 "hooks": [
1828 {
1929 "type": "command",
20 "command": "echo '{\"systemMessage\":\"REMINDER: Rule 1 — Scan before you build. Check for broken features and bugs BEFORE doing anything new. Run a full crawl if this is a new session.\"}'",
30 "command": "echo '{\"systemMessage\":\"48co SESSION START — Built by Claude. Rule 1: Scan before you build. Architecture: Tauri 2.0 (Rust + React). FULLY AUTONOMOUS — do not ask permission, just build and fix.\"}'",
2131 "timeout": 5,
22 "statusMessage": "Loading session protocol..."
32 "statusMessage": "Loading 48co protocol..."
2333 }
2434 ]
2535 }
ModifiedCLAUDE.md+73−103View fileUnifiedSplit
@@ -1,10 +1,19 @@
11# CLAUDE.md — 48co Engineering Standards & Rules
2# Built by Claude. Designed for humans.
3
4## Project Identity
5- **Product**: 48co — AI Grammar + Voice-to-Text
6- **Built by**: Claude (Anthropic AI) — fully autonomous engineering
7- **Architecture**: Tauri 2.0 (Rust + React) — bleeding edge 2026
8- **Platforms**: Windows, Mac, iOS, Android
9- **Goal**: Beat Grammarly. Everything you write, perfected by AI. On every device.
210
311## Project Owner Context
412- The owner is NOT a developer. Never assume coding knowledge.
513- Explain decisions in plain English. No jargon without explanation.
614- If something can't be done, say WHY and offer the next-best alternative immediately.
715- Never present a half-solution without flagging what's missing.
16- **FULLY AUTONOMOUS**: Claude has permission to build, fix, audit, deploy without asking. Just do it.
817
918---
1019
@@ -89,54 +98,73 @@ Every session must follow this protocol:
8998
9099---
91100
92## Hard Rules — Additional
93
94### No Half-Measures
95- Every feature must work end-to-end with zero user friction
96- "Copy to clipboard" is NOT a solution when auto-typing is possible
97- If the web platform can't do something, say so HONESTLY
98- Every user-facing flow must be tested: install → configure → use → edge cases
99
100### Honest Communication
101- If something is technically impossible in a browser, say so clearly
102- If a feature requires a download, don't dress it up as "web-based"
103- Separate WHAT WORKS from WHAT'S ASPIRATIONAL
104- Flag risks and blockers at the START, not when they become problems
105
106### Autonomous Operation
107- Don't wait for the user to find problems — find them yourself
108- Don't present options when one is clearly better — make the call and explain
109- If a task requires 5 steps, do all 5 — don't stop at step 2
110- If something breaks during implementation, fix it before reporting back
111
112---
101## Architecture (Tauri 2.0 — Locked In)
113102
114## Architecture Decisions (Locked In)
103### Why Tauri, not Electron:
104- **5MB app** vs 150MB Electron — no antivirus warnings
105- **Pure Rust** backend — fast, safe, no Node.js runtime
106- **One codebase** for Windows + Mac (iOS + Android via plugins)
107- **No native compilation issues** — enigo replaces nut-tree
108- **Modern**: Tauri 2.0 released Oct 2024, production-ready
115109
116### Product = AI Grammar + Voice-to-Text Everywhere
110### Tech Stack:
111- **App Framework**: Tauri 2.0 (Rust + React + Vite)
112- **Audio Capture**: cpal (Cross-Platform Audio Library, Rust)
113- **Keyboard Simulation**: enigo (Rust, cross-platform)
114- **Speech-to-Text**: OpenAI Whisper API → Phase 2: whisper.cpp local
115- **Grammar**: Claude API → Phase 2: Phi-3 Mini local
116- **Frontend**: React 18 + Tailwind CSS + Vite
117- **Website**: Next.js 14 + Vercel (API + frontend)
118- **Mobile**: Tauri plugins (Swift for iOS, Kotlin for Android)
119
120### File Structure:
121```
122tauri-app/ → Main application (Tauri 2.0)
123 src-tauri/src/
124 lib.rs → App setup, system tray, global shortcut
125 audio.rs → Mic capture (cpal), WAV encoding
126 transcribe.rs → Whisper API integration
127 keyboard.rs → System-wide typing (enigo)
128 grammar.rs → Post-processing + Claude AI rewrite
129 src/
130 App.jsx → Settings UI (React)
131 main.jsx → Entry point
132 styles.css → Tailwind
133
134app/ → Next.js website (48co.nz)
135 api/ → Vercel serverless API routes
136 page.jsx → Homepage
137 pricing/page.jsx → Pricing
138 compare/page.jsx → Competitor comparison
139 download/page.jsx → Download page
140 live/page.jsx → Live demo
141 install/page.jsx → Extension install guide
142
143extension/ → Chrome extension (grammar + voice)
144api/ → Express API server (legacy, migrated to Vercel)
145desktop/ → Electron app (legacy, replaced by Tauri)
146mobile/ → Mobile app architecture docs
147```
117148
118### Product Delivery — Five Platforms:
1191. **Desktop App** (PRIMARY) — Electron, system tray, global hotkey, types into any app
1202. **Chrome Extension** (VIRAL ENGINE) — Grammar check on any website, free tier drives upgrades
1213. **iPhone Keyboard** — Custom keyboard extension, corrects as you type, voice button
1224. **Android Keyboard** — Same as iPhone, InputMethodService
1235. **Website** (48co.nz) — Marketing, live demo, SEO, downloads
149### Build Phases:
1501. **Phase 1** (NOW): Windows + Mac desktop with Whisper API + Claude grammar
1512. **Phase 2**: On-device Whisper (whisper.cpp) — no API needed
1523. **Phase 3**: On-device grammar (Phi-3 Mini) — no API needed
1534. **Phase 4**: iOS keyboard (Swift Tauri plugin)
1545. **Phase 5**: Android keyboard (Kotlin Tauri plugin)
124155
125### Voice-to-Text Standard (Match WhisperTyping):
126- Text appears in the chat box WORD BY WORD as user speaks — NOT after they stop
127- Use Web Speech API with interimResults=true for real-time streaming
128- ZERO popups, overlays, or visible UI elements — just text appearing
129- Mouse wheel click as default trigger (customizable hotkey)
130- Must work on: Claude.ai, ChatGPT, Gemini, DeepSeek, Gmail, Slack, any site
156### Deployment Protocol (Blue-Green):
157- **Staging** auto-deploys on every push to main
158- **Production** requires manual approval
159- Customers NEVER see errors — they're paying for a flawless system
160- The crawl hook runs automatically on every session stop
131161
132### Tech Stack:
133- **Website**: Next.js 14, React 18, Tailwind CSS 3.4 (LIGHT THEME — white bg, indigo accent)
134- **Desktop App**: Electron 28+, @nut-tree/nut-js, OpenAI Whisper API, Claude API (grammar + rewrite)
135- **Browser Extension**: Chrome MV3 with AI grammar checker + voice-to-text
136- **Mobile Keyboard**: React Native/Expo companion app + native keyboard extensions (Swift/Kotlin)
137- **AI Grammar**: Claude Haiku API (fast grammar) + Claude Sonnet (rewrite/polish)
138- **Speech-to-Text**: OpenAI Whisper API (primary), Web Speech API (free fallback)
139- **Build/Package**: electron-builder for Win + Mac, EAS Build for iOS + Android
162### Mandatory Crawl Protocol:
163- EVERY session start: automated reminder via SessionStart hook
164- EVERY session stop: automated error crawl via Stop hook
165- Before ANY launch or deployment: manual full crawl
166- After ANY major refactor: manual full crawl
167- The crawl hook is in .claude/settings.json — it runs automatically
140168
141169### Quality Checklist (Run Before Every Commit):
142170- [ ] Does every feature work end-to-end?
@@ -144,63 +172,5 @@ Every session must follow this protocol:
144172- [ ] Is there any copy-paste or manual friction that could be automated?
145173- [ ] Would a competitor's user be impressed or disappointed switching to us?
146174- [ ] Has every engineering gap been flagged and addressed?
147- [ ] Does voice-to-text stream into the chat box in real-time (not after stopping)?
148- [ ] Does text insertion work on Claude.ai, ChatGPT, and Gmail specifically?
149
150## Known Limitations (Be Honest About These):
151- **Web bookmarklet** cannot type into other tabs — only the current page
152- **Web Speech API** is Chrome/Edge only and less accurate than Whisper
153- **Desktop app requires a download** — there is no way around this for system-wide typing
154- **Whisper API requires an API key** — costs ~$0.006/minute
155- **Electron apps are large** (~150MB) — this is a known Electron tradeoff
156- **macOS requires accessibility permissions** for keyboard simulation
157- **Chrome extension cannot type into other apps** — only browser text fields
158
159## Deployment Protocol (Blue-Green)
160
161### Environments:
162- **Staging** (staging-api.48co.nz) — auto-deploys on every push to main
163- **Production** (api.48co.nz) — requires manual approval after staging passes
164
165### Rule: NEVER push broken code to production.
166- All changes go to staging first
167- Test on staging before approving production deploy
168- If staging breaks, fix it before doing anything else
169- Customers NEVER see errors — they're paying for a flawless system
170
171### Deployment Order:
1721. Website → Vercel/Netlify (auto-deploy on push)
1732. API Server → Docker container (staging → approval → production)
1743. Desktop App → GitHub Releases (CI/CD builds .exe + .dmg)
1754. Chrome Extension → Chrome Web Store (manual upload for now)
176
177## Mandatory Crawl Protocol
178
179### When to crawl:
180- EVERY session start (automated via SessionStart hook)
181- EVERY time Claude stops working (automated via Stop hook)
182- Before ANY launch or deployment
183- After ANY major refactor
184
185### What the crawl checks:
186- Broken imports (files that import from paths that don't exist)
187- Missing files referenced in manifest.json
188- Hardcoded URLs that might break
189- Missing environment variables
190- Files referenced but not committed
191
192### The crawl hook is in .claude/settings.json — it runs automatically.
193### If you're reading this and the hook isn't set up, create it immediately.
194
195## File Structure Convention:
196```
197/app/ → Next.js website pages
198/components/ → React components
199/extension/ → Chrome extension (maintained)
200/desktop/ → Electron desktop app
201/desktop/main/ → Electron main process
202/desktop/renderer/ → Electron renderer (UI)
203/desktop/assets/ → Icons, images for desktop app
204/mobile/ → Mobile keyboard app (React Native + native extensions)
205/public/ → Static web assets
206```
175- [ ] Does Rust code compile without warnings?
176- [ ] Does the React frontend build without errors?
ModifiedSTRATEGY.md+2−1View fileUnifiedSplit
@@ -1,6 +1,7 @@
11# 48co Strategy & Roadmap
22> Last updated: 2026-03-26
3> Status: EXECUTE MODE — Grammarly killer
3> Status: TAURI 2.0 REBUILD — Full autonomous build
4> Built by: Claude (Anthropic AI)
45
56## The Hook
67
Addedtauri-app/src-tauri/capabilities/default.json+14−0View fileUnifiedSplit
@@ -0,0 +1,14 @@
1{
2 "identifier": "default",
3 "description": "48co app capabilities",
4 "windows": ["settings"],
5 "permissions": [
6 "core:default",
7 "shell:allow-open",
8 "global-shortcut:default",
9 "clipboard-manager:default",
10 "store:default",
11 "notification:default",
12 "autostart:default"
13 ]
14}
015
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts