Skip to content

Commit df3267d

Browse files
committed
Add initial PRODUCT.md for Ghost AI Desktop Assistant detailing features, market analysis, pricing, and current status
1 parent 3ce4d6a commit df3267d

File tree

3 files changed

+355
-843
lines changed

3 files changed

+355
-843
lines changed

.github/copilot-instructions.md

Lines changed: 202 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,212 @@
1-
# Copilot Instructions — Ghost Project
1+
# Ghost — Copilot Instructions
22

33
## Project Overview
4-
Ghost is a private, local-first **Agent OS** for desktop and mobile. It uses Tauri v2 (Rust backend) + React/TypeScript (frontend) + SQLite/sqlite-vec + Candle (native AI).
54

6-
## Key Conventions
7-
- **Privacy first**: NEVER add telemetry, analytics, or external network calls
8-
- **Rust backend**: `src-tauri/` with `thiserror`, `anyhow`, `tokio`, `tracing`
9-
- **Frontend**: React 18 + TypeScript strict + Tailwind CSS v4 in `src/`
10-
- **Website**: Astro Starlight in `website/` — deployed to GitHub Pages
11-
- **Commits**: conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`)
12-
- **Never use `--all-features`** in Rust — `metal`/`accelerate` are macOS-only
5+
Ghost is a privacy-first AI desktop assistant built with Tauri v2 (Rust backend) + React/TypeScript/Vite (frontend). All AI inference runs locally via Candle + GGUF models. No cloud dependencies for core functionality.
136

14-
## Website Maintenance
15-
The documentation website (`website/`) should stay in sync with source files:
16-
- `README.md``website/src/content/docs/guides/introduction.md`
17-
- `ROADMAP.md``website/src/content/docs/reference/roadmap.md`
18-
- `CHANGELOG.md``website/src/content/docs/reference/changelog.md`
19-
- `CONTRIBUTING.md``website/src/content/docs/reference/contributing.md`
7+
## Tech Stack
208

21-
Use the `website-maintainer` custom agent for website tasks.
9+
- **Framework:** Tauri v2
10+
- **Backend:** Rust (edition 2021)
11+
- **Frontend:** React + TypeScript + Vite
12+
- **Database:** SQLite via rusqlite (FTS5 for full-text search)
13+
- **ML:** Candle (Hugging Face) — all-MiniLM-L6-v2 for embeddings (384D), Qwen2.5-Instruct GGUF for generation
14+
- **Agent:** ReAct engine with grammar-constrained tool calling
15+
- **Protocols:** MCP (rmcp crate), AG-UI, A2UI, A2A
16+
- **Licensing:** ghost-pro crate (freemium feature gating)
2217

23-
## File Structure
18+
## Build & Test
19+
20+
```bash
21+
# Build
22+
cargo build --release
23+
24+
# Run in dev mode (Tauri)
25+
cargo tauri dev
26+
27+
# Run tests
28+
cargo test
29+
30+
# Run specific test
31+
cargo test test_name
32+
33+
# Clippy lints
34+
cargo clippy -- -D warnings
35+
36+
# Frontend dev
37+
cd frontend && pnpm dev
38+
39+
# Frontend build
40+
cd frontend && pnpm build
41+
```
42+
43+
## Module Structure
44+
45+
```
46+
src-tauri/
47+
├── src/
48+
│ ├── main.rs # Tauri app entry, window setup
49+
│ ├── lib.rs # Core library exports
50+
│ ├── agent/ # ReAct agent engine
51+
│ │ ├── mod.rs # Agent orchestrator
52+
│ │ ├── react.rs # ReAct loop (think → act → observe)
53+
│ │ ├── grammar.rs # Grammar-constrained generation
54+
│ │ └── tools/ # Built-in tool implementations
55+
│ ├── search/ # Hybrid search
56+
│ │ ├── fts.rs # FTS5 full-text search (<5ms)
57+
│ │ ├── semantic.rs # Vector search via Candle embeddings
58+
│ │ └── hybrid.rs # Combined ranking
59+
│ ├── mcp/ # MCP Server + Client
60+
│ │ ├── server.rs # Ghost as MCP server
61+
│ │ ├── client.rs # Connect to external MCP servers
62+
│ │ └── catalog.rs # 30+ curated + registry (6000+)
63+
│ ├── extraction/ # File processing
64+
│ │ ├── watcher.rs # File system watcher
65+
│ │ └── extractors/ # PDF, DOCX, 50+ formats
66+
│ ├── models/ # Local AI model management
67+
│ │ ├── loader.rs # GGUF model loading via Candle
68+
│ │ └── inference.rs # Text generation pipeline
69+
│ ├── db/ # Database layer
70+
│ │ ├── mod.rs # Connection pool, migrations
71+
│ │ ├── schema.rs # Table definitions
72+
│ │ └── migrations/ # SQL migrations
73+
│ └── pro/ # ghost-pro crate integration
74+
│ ├── license.rs # License key validation
75+
│ └── features.rs # Feature gating logic
76+
├── Cargo.toml
77+
└── tauri.conf.json
78+
```
79+
80+
## Rust Conventions
81+
82+
- **Error handling:** Use `anyhow::Result` for application errors, `thiserror` for library errors. Never `unwrap()` in production paths.
83+
- **Async:** Tokio runtime (Tauri v2 default). Use `#[tauri::command]` for frontend-callable functions.
84+
- **Tauri commands:** All Tauri commands go in dedicated command modules, registered in `main.rs` via `invoke_handler`.
85+
- **Database:** All SQL goes through rusqlite with parameterized queries. Never interpolate strings into SQL.
86+
- **Logging:** Use `tracing` crate with structured fields. `tracing::info!`, `tracing::error!`, etc.
87+
- **Testing:** Unit tests in the same file (`#[cfg(test)]` module). Integration tests in `tests/` directory.
88+
89+
## How to Add a New Tool
90+
91+
Tools are functions the ReAct agent can call during reasoning.
92+
93+
1. Create the tool implementation in `src/agent/tools/`:
94+
```rust
95+
// src/agent/tools/my_tool.rs
96+
use serde::{Deserialize, Serialize};
97+
use anyhow::Result;
98+
99+
#[derive(Debug, Deserialize)]
100+
pub struct MyToolInput {
101+
pub query: String,
102+
}
103+
104+
#[derive(Debug, Serialize)]
105+
pub struct MyToolOutput {
106+
pub result: String,
107+
}
108+
109+
pub async fn execute(input: MyToolInput) -> Result<MyToolOutput> {
110+
// Implementation here
111+
Ok(MyToolOutput { result: "done".into() })
112+
}
24113
```
25-
src-tauri/src/ # Rust backend (indexer, db, embeddings, chat, agent, protocols)
26-
src/ # React frontend (components, hooks, lib)
27-
website/ # Astro Starlight documentation site
28-
scripts/ # Build and maintenance scripts
29-
.github/agents/ # Custom Copilot agents (website-maintainer)
114+
115+
2. Register in `src/agent/tools/mod.rs`:
116+
```rust
117+
pub mod my_tool;
118+
119+
// Add to the tool registry
120+
registry.register("my_tool", ToolDef {
121+
name: "my_tool",
122+
description: "What this tool does",
123+
parameters: serde_json::json!({
124+
"type": "object",
125+
"properties": {
126+
"query": { "type": "string", "description": "The search query" }
127+
},
128+
"required": ["query"]
129+
}),
130+
handler: |input| Box::pin(my_tool::execute(serde_json::from_value(input)?)),
131+
});
132+
```
133+
134+
3. Add tests:
135+
```rust
136+
#[cfg(test)]
137+
mod tests {
138+
use super::*;
139+
140+
#[tokio::test]
141+
async fn test_my_tool_basic() {
142+
let input = MyToolInput { query: "test".into() };
143+
let output = execute(input).await.unwrap();
144+
assert!(!output.result.is_empty());
145+
}
146+
}
30147
```
31148

32-
## Copilot Agents
33-
- **website-maintainer**: Assign website/docs issues to `@copilot` — it uses `.github/agents/website-maintainer.agent.md`
34-
- The deploy workflow (`website-deploy.yml`) auto-syncs CHANGELOG, ROADMAP, CONTRIBUTING, SECURITY on every push
149+
4. Run `cargo test` and `cargo clippy` before committing.
150+
151+
## How to Add a New MCP Server
152+
153+
MCP servers extend Ghost's capabilities via the Model Context Protocol.
154+
155+
1. Add to curated catalog in `src/mcp/catalog.rs`:
156+
```rust
157+
CatalogEntry {
158+
id: "my-server",
159+
name: "My Server",
160+
description: "What it does",
161+
transport: Transport::Stdio {
162+
command: "npx",
163+
args: &["-y", "@my-org/mcp-server"],
164+
},
165+
// OR for SSE:
166+
// transport: Transport::Sse { url: "https://my-server.example.com/sse" },
167+
category: Category::Productivity,
168+
requires_config: vec!["API_KEY"], // env vars needed
169+
tier: Tier::Free, // or Tier::Pro
170+
}
171+
```
172+
173+
2. For programmatic MCP client connections:
174+
```rust
175+
use crate::mcp::client::McpClient;
176+
177+
let client = McpClient::connect("my-server", transport_config).await?;
178+
let tools = client.list_tools().await?;
179+
let result = client.call_tool("tool_name", params).await?;
180+
```
181+
182+
3. Test with `cargo test mcp` and verify the server appears in the UI catalog.
183+
184+
## Deploy & Release
185+
186+
- **CI/CD:** GitHub Actions builds for Windows (.msi), macOS (.dmg), Linux (.AppImage)
187+
- **Release:** Tag with `vX.Y.Z`, push triggers release workflow
188+
- **Signing:** macOS requires notarization credentials in GitHub Secrets
189+
- **Auto-update:** Tauri v2 updater plugin checks GitHub Releases
190+
191+
## Key Dependencies
192+
193+
| Crate | Purpose |
194+
|---|---|
195+
| `tauri` | Desktop framework (v2) |
196+
| `rusqlite` | SQLite + FTS5 |
197+
| `candle-core` / `candle-nn` | Local ML inference |
198+
| `candle-transformers` | Model architectures |
199+
| `rmcp` | MCP protocol client/server |
200+
| `tokenizers` | Tokenization for embeddings |
201+
| `serde` / `serde_json` | Serialization |
202+
| `tokio` | Async runtime |
203+
| `tracing` | Structured logging |
204+
| `anyhow` / `thiserror` | Error handling |
205+
206+
## Common Pitfalls
35207

36-
## For Detailed Architecture
37-
Read `CLAUDE.md` at the project root for full architecture, conventions, and decision log.
208+
- **Candle models:** Always load on a dedicated thread — model loading blocks and is heavy. Use `tokio::task::spawn_blocking`.
209+
- **FTS5 queries:** Escape special characters in user input before passing to FTS5 MATCH.
210+
- **Tauri commands:** Must return `Result<T, String>` (Tauri serialization constraint). Wrap errors with `.map_err(|e| e.to_string())`.
211+
- **Database migrations:** Always add new migrations, never modify existing ones. Run in order on first launch.
212+
- **Feature gating:** Check `ghost_pro::is_feature_enabled("feature_name")` before executing Pro-tier logic. Free tier must never crash when Pro features are unavailable.

PRODUCT.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Ghost — Privacy-First AI Desktop Assistant
2+
3+
> v0.14.2 · Tauri v2 + Rust + React/TS/Vite
4+
5+
## What Is Ghost
6+
7+
Ghost is a local-first AI desktop assistant that keeps your data on your machine. It combines full-text search (FTS5, <5ms), semantic vector search (Candle embeddings, all-MiniLM-L6-v2 384D), and a ReAct agent engine with grammar-constrained tool calling — all running without cloud dependencies.
8+
9+
**Core stack:**
10+
- **Backend:** 20,688 lines of Rust — Tauri v2, rusqlite, Candle ML
11+
- **Frontend:** 25 files — React + TypeScript + Vite
12+
- **Local AI:** Qwen2.5-Instruct GGUF (0.5B–7B parameter models)
13+
- **Search:** Hybrid FTS5 + semantic vector, sub-5ms text queries
14+
- **Agent:** ReAct engine with grammar-constrained tool calling
15+
- **Protocols (2026 stack):** MCP Server+Client, AG-UI, A2UI, A2A, Skills
16+
- **MCP Catalog:** 30+ curated servers + 6,000+ from registry
17+
- **File Processing:** Watcher + text extraction for PDF, DOCX, 50+ formats
18+
- **Distribution:** 5+ releases, CI/CD GitHub Actions (Windows/macOS/Linux)
19+
20+
## Market
21+
22+
| Metric | Value |
23+
|---|---|
24+
| AI Desktop Assistant TAM (2025) | $3.35B |
25+
| Projected TAM (2030) | $24.53B |
26+
| CAGR | ~39% |
27+
28+
**Competitor landscape:**
29+
30+
| Competitor | Status | Ghost Advantage |
31+
|---|---|---|
32+
| Rewind AI | Dead (pivoted to Limitless, lost desktop focus) | Ghost is actively maintained, desktop-first |
33+
| Windows Recall | Privacy backlash, enterprise distrust | Ghost is 100% local, zero telemetry |
34+
| Raycast | Mac-only, no local AI | Ghost is cross-platform, runs local models |
35+
| Notion AI / Copilot | Cloud-dependent, data leaves your machine | Ghost keeps everything local |
36+
37+
**Why Ghost wins:** The only cross-platform, privacy-first desktop assistant with local LLM inference, hybrid search, and the full 2026 agent protocol stack (MCP, A2A, AG-UI). No data leaves the machine.
38+
39+
## Pricing
40+
41+
| Tier | Price | Features |
42+
|---|---|---|
43+
| **Free** | $0 | Local AI, FTS5 search, file watcher, basic MCP tools |
44+
| **Pro** | $8/mo | Semantic search, full MCP catalog, advanced agent skills, priority updates |
45+
| **Teams** | $15/user/mo | Shared knowledge bases, team MCP servers, admin controls, SSO |
46+
47+
Monetization via `ghost-pro` crate — feature gating at the Rust level.
48+
49+
## Current Status
50+
51+
- **Version:** 0.14.2
52+
- **Maturity:** Alpha — functional for personal use, not yet monetized
53+
- **Build:** `cargo build --release`
54+
- **Test:** `cargo test`
55+
- **CI/CD:** GitHub Actions multiplatform (Windows, macOS, Linux)
56+
- **Releases:** 5+ published
57+
58+
## Blockers to Revenue
59+
60+
1. **Stripe integration** — No payment processing. Need Stripe Checkout + Customer Portal for Pro/Teams.
61+
2. **License key validation** — No mechanism to gate Pro features. Need license key generation + validation in `ghost-pro` crate.
62+
3. **App store distribution** — Not yet on any store. Need code signing, notarization (macOS), and Microsoft Store submission.
63+
4. **Landing page** — No marketing site. Need ghost.quirozai.com or similar.
64+
65+
## Key Metrics to Track
66+
67+
- Downloads per release (GitHub Releases + app stores)
68+
- Free → Pro conversion rate (target: 5–8%)
69+
- MRR from Pro + Teams subscriptions
70+
- DAU / retention (local telemetry opt-in only)

0 commit comments

Comments
 (0)