3.9 KiB
RA-H Open Source Porting Notes (2025-12-09)
Agent Handover
What is this repo? This is ra-h_os, the open source mirror of the private ra-h application. It's a BYO-key (bring your own API keys) version without Mac packaging, Supabase auth, or subscription features.
Quick context:
- Read
CLAUDE.mdfor system overview - Read
README.mdfor setup instructions - Read
docs/9_open-source.mdfor sync process with private repo
Current status: Initial commit complete (2025-12-15). Repo is currently private on GitHub. Before making public, we need a more thorough audit to ensure no sensitive data, credentials, or private references remain. Review all docs, scripts, and code comments for anything that shouldn't be public.
Sync process: Features are built in the private ra-h repo first, then synced here via Step 8 of the workflow (see private repo's docs/development/process/1_workflow.md).
This document captures every change required to bring the private RA-H repo into a runnable, local-only open-source build.
1. Repo Copy & Cleanup
rsyncwith an allowlist copied only source/docs/scripts into~/Desktop/dev/ra-h_os, excluding.git,node_modules, builds, backups, pgdata, logs, Mac artifacts, and tooling metadata (.claude,.mcp.json).- Removed leftover build outputs and workflows:
.next/,.env*,.github/workflows/*,.claude/,.mcp.json. - Regenerated dependencies locally (
npm install --legacy-peer-deps) and rebuilt native modules (npm rebuild better-sqlite3).
2. Rebrand & Licensing
package.jsonrenamed tora-h-open-source, version reset to0.1.0,private: false, scripts force local mode, and Supabase/mac scripts removed.- LICENSE switched from PolyForm to MIT; README rewritten for BYO-key locals;
.env.examplenow defaults toNEXT_PUBLIC_DEPLOYMENT_MODE=localand drops Supabase fields.
3. UI & Runtime Simplification
- Deleted Supabase auth (
AuthProvider,AuthGate, Supabase client/storage), Subscription/Usage components, auto-update wiring, and Tauri-specific helper files. app/layout.tsxrenders a plain layout;app/page.tsxwraps the 3-panel UI inLocalKeyGateso first-run users see the API-key prompt.ThreePanelLayoutnow listens forsettings:opento honor the LocalKeyGate button;SettingsModalshows only local tabs plus a "Local Mode" explainer.
4. Local-Only Key Flow
apiKeyServicestill stores keys inlocalStoragebut now broadcastsapi-keys:updated. Added/api/local/test-anthropicso key validation occurs server-side (avoids browser CORS onapi.anthropic.com).ApiKeysVieweruses that route to verify Anthropic keys; OpenAI testing already worked.- Added
LocalKeyGateoverlay to block the workspace until at least one key is entered.
5. Backend Removal & BYO Keys End-to-End
- Removed Supabase token registry, backend fetch helpers, and all Supabase-facing scripts/docs.
RequestContextnow tracksapiKeys(OpenAI/Anthropic) for the current request.useSSEChatsends those keys with each/api/rah/chatcall; the API route threads them intoresolveModel, WiseRAH, and MiniRAH executors so delegations inherit the same BYO credentials.- Chat logging/backend usage metadata dropped the Supabase proxies; everything runs directly against user-supplied keys.
6. Testing
npm run type-checkpasses.- Local dev requires:
npm rebuild better-sqlite3once per machine,scripts/dev/bootstrap-local.sh,npm run dev. - Manual smoke: open Settings → API Keys, add OpenAI + Anthropic keys (Anthropic test now succeeds), refresh; nodes/ui/chat all function.
7. Documentation Cleanup (2025-12-15)
- Removed
docs/development/completed/(150+ internal PRDs) - Removed
docs/development/process/(internal workflow docs) - Simplified
CLAUDE.mdfor open source users - Kept core architecture docs (
docs/0_overview.mdthroughdocs/6_ui.md)
Keep this doc updated as future open-source specific changes land.