# OpenFang Launch Roadmap
> Competitive gap analysis vs OpenClaw. Organized into 4 sprints.
> Each item has: what, why, files to touch, and done criteria.
---
## Sprint 1 — Stop the Bleeding (3-4 days)
These are showstoppers. The app literally crashes or looks broken without them.
### 1.1 Fix Token Bloat (agents crash after 3 messages) -- DONE
**Status: COMPLETE** -- All 13 items implemented across compactor.rs, context_overflow.rs, context_budget.rs, agent_loop.rs, kernel.rs, agent.rs, and prompt_builder.rs.
**Problem (was):** A single chat message consumed ~45K input tokens (tool definitions + system prompt). By message 3, it hit the 100K quota and crashed with "Token quota exceeded."
**What to do:**
1. **Add token estimation & context guard** (`crates/openfang-runtime/src/compactor.rs`)
- Add `estimate_token_count(messages, system_prompt, tools)` — chars/4 heuristic
- Add `needs_compaction_by_tokens(estimated, context_window)` — triggers at 70% capacity
- Add `token_threshold_ratio: f64` (default 0.7) and `context_window_tokens: usize` (default 200_000) to `CompactionConfig`
- Lower message threshold from 80 to 30
2. **Add in-loop token guard** (`crates/openfang-runtime/src/agent_loop.rs`)
- Before each LLM call: estimate tokens vs context window
- Over 70%: emergency-trim old messages (keep last 10), log warning
- Over 90%: aggressive trim to last 4 messages + inject summary
- Lower `MAX_HISTORY_MESSAGES` from 40 to 20
- Lower `MAX_TOOL_RESULT_CHARS` from 50,000 to 15,000
3. **Filter tools by profile in kernel** (`crates/openfang-kernel/src/kernel.rs`)
- In `available_tools()`: use manifest's `tool_profile` to filter
- Call `tool_profile.tools()` for allowed tool names, filter `builtin_tool_definitions()`
- Only send ALL tools if profile is `Full` AND agent has `ToolAll` capability
- This alone cuts default chat from 41 tools to ~8 tools (saves ~15-20K tokens)
4. **Raise default token quota** (`crates/openfang-types/src/agent.rs`)
- Change `max_llm_tokens_per_hour` from 100_000 to 1_000_000
- 100K is too low — a single system prompt is 30-40K tokens
5. **Token-based compaction trigger** (`crates/openfang-kernel/src/kernel.rs`)
- In `send_message_streaming()`: replace message-count-only check with token-aware check
- After compaction, verify token count actually decreased
6. **Compact system prompt injections** (`crates/openfang-kernel/src/kernel.rs`)
- Cap canonical context to 500 chars
- Cap memory context to 3 items / 200 chars each
- Cap skill knowledge to 2000 chars total
- Skip MCP summary if tool count < 3
**Done when:**
- `cargo test --workspace` passes
- Start an agent, send 10+ messages — no "Token quota exceeded" error
- First-message token count drops from ~45K to ~15-20K
---
### 1.2 Branding & Icon Assets
**Problem:** Desktop app may show Tauri default icons. Branding assets exist at `~/Downloads/openfang/output/` but aren't installed.
**What to do:**
1. Generate all required icon sizes from source PNG (`openfang-logo-transparent.png`, 2000x2000)
2. Place into `crates/openfang-desktop/icons/`:
- `icon.png` (1024x1024)
- `icon.ico` (multi-size: 256, 128, 64, 48, 32, 16)
- `32x32.png`
- `128x128.png`
- `128x128@2x.png` (256x256)
3. Replace web UI logo at `crates/openfang-api/static/logo.png`
4. Update favicon if one exists
**Assets available:**
- `openfang-logo-transparent.png` (328KB, 2000x2000) — primary source
- `openfang-logo-black-bg.png` (312KB) — for dark contexts
- `openfang-vector-transparent.svg` (293KB) — scalable vector
- `openfang-animated.svg` (310KB) — for loading screens
**Done when:**
- Desktop app shows OpenFang logo in taskbar, title bar, and installer
- Web UI shows correct logo in sidebar and favicon
---
### 1.3 Tauri Signing Keypair -- DONE
**Status: COMPLETE** — Generated Ed25519 signing keypair via `cargo tauri signer generate --ci`. Public key installed in `tauri.conf.json`. Private key at `~/.tauri/openfang.key`. Set `TAURI_SIGNING_PRIVATE_KEY_PATH` in CI secrets.
**Problem (was):** `tauri.conf.json` has `"pubkey": "PLACEHOLDER_REPLACE_WITH_GENERATED_PUBKEY"`. Auto-updater is completely dead without this.
---
### 1.4 First-Run Experience Audit -- DONE
**Status: COMPLETE** — Full code audit verified: all 8 wizard API endpoints exist and are implemented (providers list/set/test, templates list, agent spawn, channel configure). 6-step wizard (Welcome → Provider → Agent → Try It → Channel → Done) fully wired. 13 provider help links connected. Auto-detection of existing API keys via auth_status field working. Config editor fix added (POST /api/config/set).
**Problem (was):** New users need a smooth setup wizard. The web UI has a setup checklist + wizard but it's untested end-to-end.
---
## Sprint 2 — Competitive Parity (4-5 days)
These close the gaps that would make users pick OpenClaw over OpenFang.
### 2.1 Browser Screenshot Rendering in Chat -- DONE
**Status: COMPLETE** — browser.rs saves screenshots to uploads temp dir and returns JSON with `image_urls`. chat.js detects `browser_screenshot` tool results and populates `_imageUrls` for inline display.
**Problem (was):** The `browser_screenshot` tool returns base64 image data, but the UI renders it as raw text in a `
` tag.
**What to do:**
1. In `chat.js` `tool_result` handler: detect `browser_screenshot` tool results
2. Parse the base64 data, create `/api/uploads/` entry (like image_generate)
3. Store `_imageUrls` on the tool card
4. UI already renders `tool._imageUrls` — just need to populate it
**Files:** `crates/openfang-api/static/js/pages/chat.js`, `crates/openfang-runtime/src/tool_runner.rs`
**Done when:**
- Browser screenshots appear as inline images in tool cards
- Clicking opens full-size in new tab
---
### 2.2 Chat Message Search -- DONE
**Status: COMPLETE** — Search bar with Ctrl+F shortcut, real-time filtering via `filteredMessages` getter, text highlighting via `highlightSearch()`, match count display.
**Problem (was):** No way to search through chat history. OpenClaw has full-text search.
**What to do:**
1. Add search input to chat header (icon toggle, expands to input)
2. Client-side filter: `messages.filter(m => m.text.includes(query))`
3. Highlight matches in message bubbles
4. Jump-to-message on click
**Files:** `index_body.html` (search UI), `chat.js` (search logic), `components.css` (search styles)
**Done when:**
- Ctrl+F or search icon opens search bar
- Typing filters messages in real-time
- Matching text is highlighted
---
### 2.3 Skill Marketplace Polish -- DONE
**Status: COMPLETE** — Already polished with 4 tabs (Installed, ClawHub, MCP Servers, Quick Start), live search with debounce, sort pills, categories, install/uninstall, skill detail modal, runtime badges, source badges, enable/disable toggles, security warnings.
**Problem (was):** Skills page exists but needs polish for browsing/installing skills.
**What to do:**
1. Verify `/api/skills/search` endpoint works
2. Verify `/api/skills/install` endpoint works
3. Polish UI: skill cards with descriptions, install buttons, installed badge
4. Add FangHub registry URL if not configured
**Files:** `crates/openfang-api/static/js/pages/skills.js`, `crates/openfang-api/src/routes.rs`
**Done when:**
- Users can browse, search, and install skills from the web UI
- Installed skills show "Installed" badge
- Error states handled gracefully
---
### 2.4 Install Script Deployment
**Problem:** `openfang.sh` domain isn't set up. Users can't do `curl -sSf https://openfang.sh | sh`.
**What to do:**
1. Set up GitHub Pages or Cloudflare Worker for openfang.sh
2. Serve `scripts/install.sh` at root
3. Serve `scripts/install.ps1` at `/install.ps1`
4. Test on fresh Linux, macOS, and Windows machines
**Done when:**
- `curl -sSf https://openfang.sh | sh` installs the latest release
- `irm https://openfang.sh/install.ps1 | iex` works on Windows PowerShell
---
### 2.5 First-Run Wizard End-to-End -- DONE
**Status: COMPLETE** — 6-step wizard (Welcome → Provider → Agent → Try It → Channel → Done) with provider auto-detection, API key help links (12 providers), 10 agent templates with category filtering, mini chat for testing, channel setup (Telegram/Discord/Slack), setup checklist on overview page.
**Problem (was):** Setup wizard needs to actually work for zero-config users.
**What to do:**
1. Test wizard steps: welcome, API key entry, provider selection, model pick, first agent spawn
2. Fix any broken flows
3. Add provider-specific help text (where to get API keys)
4. Auto-detect existing `.env` API keys and pre-fill
**Files:** `index_body.html` (wizard template), `routes.rs` (config save endpoint)
**Done when:**
- New user completes wizard in < 2 minutes
- Wizard detects existing API keys from environment
- Clear error messages for invalid keys
---
## Sprint 3 — Differentiation (5-7 days)
These are features where OpenFang can leapfrog OpenClaw.
### 3.1 Voice Input/Output in Web UI -- DONE
**Status: COMPLETE** — Mic button with hold-to-record, MediaRecorder with webm/opus codec, auto-upload and transcription, TTS audio player in tool cards, recording timer display, CSP updated for media-src blob:.
**Problem (was):** `media_transcribe` and `text_to_speech` tools exist but there's no mic button or audio playback in the UI.
**What to do:**
1. Add mic button next to attach button in input area
2. Use Web Audio API / MediaRecorder for recording
3. Upload audio as attachment, auto-invoke `media_transcribe`
4. For TTS responses: detect audio URLs in tool results, add `