ghostos-ai 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. ghostos_ai-1.0.0/LICENSE +21 -0
  2. ghostos_ai-1.0.0/PKG-INFO +296 -0
  3. ghostos_ai-1.0.0/README.md +266 -0
  4. ghostos_ai-1.0.0/ghost/__init__.py +6 -0
  5. ghostos_ai-1.0.0/ghost/__main__.py +7 -0
  6. ghostos_ai-1.0.0/ghost/config.py +57 -0
  7. ghostos_ai-1.0.0/ghost/core/__init__.py +40 -0
  8. ghostos_ai-1.0.0/ghost/core/agent.py +265 -0
  9. ghostos_ai-1.0.0/ghost/core/audio.py +104 -0
  10. ghostos_ai-1.0.0/ghost/core/autopilot.py +173 -0
  11. ghostos_ai-1.0.0/ghost/core/chameleon.py +113 -0
  12. ghostos_ai-1.0.0/ghost/core/clipboard.py +165 -0
  13. ghostos_ai-1.0.0/ghost/core/engine.py +280 -0
  14. ghostos_ai-1.0.0/ghost/core/ghostwriter.py +93 -0
  15. ghostos_ai-1.0.0/ghost/core/lens.py +160 -0
  16. ghostos_ai-1.0.0/ghost/core/memory_juggler.py +205 -0
  17. ghostos_ai-1.0.0/ghost/core/memory_vault.py +154 -0
  18. ghostos_ai-1.0.0/ghost/core/rag.py +308 -0
  19. ghostos_ai-1.0.0/ghost/core/rpg.py +123 -0
  20. ghostos_ai-1.0.0/ghost/core/time_machine.py +185 -0
  21. ghostos_ai-1.0.0/ghost/core/vacuum.py +96 -0
  22. ghostos_ai-1.0.0/ghost/core/vision.py +134 -0
  23. ghostos_ai-1.0.0/ghost/core/voice.py +143 -0
  24. ghostos_ai-1.0.0/ghost/core/web_search.py +131 -0
  25. ghostos_ai-1.0.0/ghost/ui/__init__.py +7 -0
  26. ghostos_ai-1.0.0/ghost/ui/api.py +344 -0
  27. ghostos_ai-1.0.0/ghost/ui/app.py +63 -0
  28. ghostos_ai-1.0.0/ghost/ui/assets/ghost.js +890 -0
  29. ghostos_ai-1.0.0/ghost/ui/assets/i18n.js +940 -0
  30. ghostos_ai-1.0.0/ghost/ui/assets/index.html +376 -0
  31. ghostos_ai-1.0.0/ghost/ui/assets/style.css +855 -0
  32. ghostos_ai-1.0.0/ghostos_ai.egg-info/PKG-INFO +296 -0
  33. ghostos_ai-1.0.0/ghostos_ai.egg-info/SOURCES.txt +53 -0
  34. ghostos_ai-1.0.0/ghostos_ai.egg-info/dependency_links.txt +1 -0
  35. ghostos_ai-1.0.0/ghostos_ai.egg-info/entry_points.txt +2 -0
  36. ghostos_ai-1.0.0/ghostos_ai.egg-info/requires.txt +6 -0
  37. ghostos_ai-1.0.0/ghostos_ai.egg-info/top_level.txt +1 -0
  38. ghostos_ai-1.0.0/pyproject.toml +38 -0
  39. ghostos_ai-1.0.0/setup.cfg +4 -0
  40. ghostos_ai-1.0.0/setup.py +27 -0
  41. ghostos_ai-1.0.0/tests/test_agent.py +49 -0
  42. ghostos_ai-1.0.0/tests/test_autopilot.py +41 -0
  43. ghostos_ai-1.0.0/tests/test_chameleon.py +28 -0
  44. ghostos_ai-1.0.0/tests/test_clipboard.py +30 -0
  45. ghostos_ai-1.0.0/tests/test_ghostwriter.py +21 -0
  46. ghostos_ai-1.0.0/tests/test_i18n.py +37 -0
  47. ghostos_ai-1.0.0/tests/test_juggler.py +45 -0
  48. ghostos_ai-1.0.0/tests/test_lens.py +40 -0
  49. ghostos_ai-1.0.0/tests/test_memory_vault.py +40 -0
  50. ghostos_ai-1.0.0/tests/test_rag.py +52 -0
  51. ghostos_ai-1.0.0/tests/test_rpg.py +29 -0
  52. ghostos_ai-1.0.0/tests/test_time_machine.py +21 -0
  53. ghostos_ai-1.0.0/tests/test_vacuum.py +29 -0
  54. ghostos_ai-1.0.0/tests/test_voice.py +28 -0
  55. ghostos_ai-1.0.0/tests/test_web_search.py +25 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 KIB.best
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,296 @@
1
+ Metadata-Version: 2.4
2
+ Name: ghostos-ai
3
+ Version: 1.0.0
4
+ Summary: The Invisible, Featherweight, Offline Desktop AI Companion & Copilot
5
+ Home-page: https://github.com/GhostOS-ai/GhostOS
6
+ Author: KIB.best
7
+ Author-email: "KIB.best" <GhostOS@kib.best>
8
+ Project-URL: Homepage, https://github.com/GhostOS-ai/GhostOS
9
+ Project-URL: Bug Tracker, https://github.com/GhostOS-ai/GhostOS/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: Microsoft :: Windows
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Classifier: Topic :: Desktop Environment
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: rich>=13.0.0
22
+ Requires-Dist: pywebview>=5.0.0
23
+ Requires-Dist: psutil>=5.9.0
24
+ Requires-Dist: pypdf>=4.0.0
25
+ Requires-Dist: python-docx>=1.0.0
26
+ Requires-Dist: Pillow>=10.0.0
27
+ Dynamic: author
28
+ Dynamic: home-page
29
+ Dynamic: license-file
30
+
31
+ <div align="center">
32
+
33
+ ```
34
+ .---.
35
+ / \
36
+ | () () | G H O S T O S
37
+ \ - / The Invisible, Featherweight, Offline Desktop AI Copilot
38
+ /`---'\
39
+ / \ [ 100% Private • Dynamic VRAM Juggler • Zero-DB RAG • Casper Pet ]
40
+ (_/^\_/\_/^)
41
+ ```
42
+
43
+ # 👻 GhostOS
44
+ ### The Featherweight, Offline AI Assistant & Desktop Companion
45
+
46
+ <p align="center">
47
+ <b>🌐 Language Select / Выбор языка / Тілді таңдау / 语言选择:</b><br>
48
+ <a href="README.md"><b>English</b></a> •
49
+ <a href="docs/README_RU.md"><b>Русский</b></a> •
50
+ <a href="docs/README_KK.md"><b>Қазақша</b></a> •
51
+ <a href="docs/README_ZH.md"><b>简体中文</b></a> •
52
+ <a href="docs/README_ES.md"><b>Español</b></a> •
53
+ <a href="docs/README_DE.md"><b>Deutsch</b></a> •
54
+ <a href="docs/README_FR.md"><b>Français</b></a> •
55
+ <a href="docs/README_JA.md"><b>日本語</b></a> •
56
+ <a href="docs/README_PT.md"><b>Português</b></a>
57
+ </p>
58
+
59
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
60
+ [![Author: KIB.best](https://img.shields.io/badge/Author-KIB.best-8A2BE2.svg)](https://kib.best)
61
+ [![Email](https://img.shields.io/badge/Contact-GhostOS%40kib.best-0071e3.svg)](mailto:GhostOS@kib.best)
62
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
63
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-brightgreen.svg)]()
64
+ [![Idle RAM](https://img.shields.io/badge/Idle%20RAM-%3C35%20MB-success.svg)]()
65
+ [![Peak VRAM](https://img.shields.io/badge/Peak%20VRAM-%E2%89%A43.5%20GB-blueviolet.svg)]()
66
+ [![Privacy](https://img.shields.io/badge/Privacy-100%25%20Offline-orange.svg)]()
67
+
68
+ **A unified, ultra-lightweight desktop AI companion that runs effortlessly on low-spec laptops and base Apple Silicon Macs (4GB–8GB RAM) without Out-Of-Memory (OOM) crashes.**
69
+
70
+ [Quickstart](#-quickstart) • [Features](#-exclusive-killer-features) • [Comparison](#-why-ghostos-vs-others) • [Architecture](#-architecture) • [CLI Cheatsheet](#-cli-cheatsheet) • [Privacy Pledge](#-100-paranoid-privacy-pledge)
71
+
72
+ </div>
73
+
74
+ ---
75
+
76
+ ### 💡 Why GhostOS?
77
+
78
+ Running local AI today is frustrating and bloated:
79
+ - **Electron RAM Bloat:** Most local AI desktop apps (LM Studio, Jan, AnythingLLM) burn **800MB–1.2GB of RAM** on the UI alone before a single neural weight is loaded into memory.
80
+ - **The Multi-Model OOM Trap:** Trying to run an LLM (3GB) + Vision model (2GB) + Whisper (1GB) simultaneously crashes any device with 4GB–8GB RAM.
81
+ - **Overcomplicated RAG Stacks:** Document chat tools force users to install Docker containers, heavy vector databases (Chroma/Qdrant), and gigabytes of bloated Python dependencies.
82
+
83
+ **GhostOS solves this from first principles:**
84
+ 1. **Casper Companion Pet & HUD:** Rendered via native system web engines (WebKit on macOS, Edge WebView2 on Windows, WebKitGTK on Linux) consuming just **~35MB RAM**.
85
+ 2. **Dynamic VRAM Juggler:** Dynamically hot-swaps between LLM, Vision, and Whisper on demand in <150ms. Peak VRAM never exceeds **3.5GB**.
86
+ 3. **Zero-DB RAG:** Drop files onto Casper — indexed in milliseconds using pure **SQLite FTS5** with zero external database dependencies.
87
+ 4. **100% Local & Private:** Zero telemetries, zero cloud fallbacks. Fully functional air-gapped with Wi-Fi switched off.
88
+
89
+ ---
90
+
91
+ ### ✨ Exclusive Killer Features
92
+
93
+ #### 1. 👻 Casper: The Living Desktop Pet
94
+ * A quiet, translucent porcelain ghost that floats gently over your workspace.
95
+ * **"Casper Eats Files":** Drag & drop any PDF, code repository, notes, or spreadsheet directly onto Casper. Casper opens his mouth, swallows the file, and indexes it into your local knowledge base instantly (+15 XP!).
96
+ * **Visual Moods & Reactive States:**
97
+ * 💤 `Idle`: Weightless floating animation, 0% CPU footprint.
98
+ * 🔮 `Thinking`: Ethereal sapphire aura, streaming local neural tokens.
99
+ * 🎧 `Listening`: Casper wears glowing headphones, capturing offline meetings.
100
+ * 🍕 `Eating`: Document suction animation with real-time XP gain.
101
+ * ⚠️ `Alarm`: Visual security warning when a dangerous shell command is detected.
102
+ * Single-click for quick phrases & interactions; double-click or press `Cmd+Shift+Space` / `Ctrl+Shift+Space` to morph into the **Spotlight HUD**.
103
+
104
+ #### 2. ✍️ Ghostwriter (AI Inline Completion in Any App)
105
+ * Highlight text anywhere (Word, Telegram, browser, IDE, terminal) $\rightarrow$ press hotkey $\rightarrow$ transform instantly:
106
+ * ✨ `polish`: Professional, crisp, and concise rewrite.
107
+ * 🤝 `polite`: Diplomatic, respectful business tone.
108
+ * 📝 `grammar`: Fixes spelling and grammar mistakes with zero conversational fluff.
109
+ * 🎯 `summarize`: Distills text down to 2-3 key takeaways.
110
+ * 🌐 `translate`: Instant translation into English, Russian, Kazakh, Chinese, etc.
111
+ * 🛠️ `code_fix`: Automatically diagnoses and fixes bugs in code snippets.
112
+ * Use from CLI: `ghost write --mode polite "draft message"` or rewrite clipboard in 1 click!
113
+
114
+ #### 3. 🧠 Memory Vault (Cross-Session Context Graph)
115
+ * Local SQLite knowledge graph that permanently stores personal context across restarts.
116
+ * Casper automatically remembers your developer stack, favorite languages, and active projects.
117
+ * Injects personal context into queries with **0 KB extra VRAM** and 0% background CPU footprint.
118
+ * CLI: `ghost vault list`, `ghost vault remember tech_stack "Python, Rust, Apple Silicon"`.
119
+
120
+ #### 4. 🛡️ Terminal Sandbox Lens (Destructive Command Protection)
121
+ * Deep safety inspection for shell commands before execution.
122
+ * Intercepts and blocks destructive operations (`rm -rf /`, `mkfs`, raw `dd`, `DROP DATABASE`, `format C:`).
123
+ * Explains risks in plain human language and suggests safe alternatives before running.
124
+ * Interactive audit: `ghost sandbox "rm -rf /"`.
125
+
126
+ #### 5. 📅 Daily Standup & Conventional Commit Crafter
127
+ * Analyzes daily workspace file modifications, git diffs, and session commits.
128
+ * Generates ready-to-share Daily Standup reports for Slack / Telegram (*"What I accomplished", "What I'm working on", "Blockers"*).
129
+ * Automatically crafts semantic Conventional Commits (`feat(...)`, `fix(...)`, `refactor(...)`).
130
+ * CLI: `ghost standup`.
131
+
132
+ #### 6. 🎙️ Auto-Minutes Meeting Copilot
133
+ * 100% private offline secretary for Zoom, Google Meet, and voice notes.
134
+ * Generates structured markdown meeting minutes with **Executive Overview**, **Key Decisions**, and **Action Items with Deadlines**.
135
+ * Whisper model hot-swaps in only for the 5-second transcription window and immediately frees VRAM.
136
+
137
+ #### 7. 🦎 Memory Chameleon (Adaptive Power Profiles)
138
+ * Dynamically monitors battery state and system RAM pressure:
139
+ * 🍃 **ECO Mode:** Triggers on battery or RAM > 82%. Context capped at 1024 tokens, 2 CPU threads, 60s auto-sleep, 30 FPS pet.
140
+ * ⚖️ **Balanced Mode:** Context 2048 tokens, 4 threads, 180s auto-sleep.
141
+ * ⚡ **Performance Beast:** On AC power and free RAM > 50%. Context 4096 tokens, full GPU acceleration.
142
+
143
+ #### 8. 🎮 Casper RPG Evolution System
144
+ * Gamified companion that grows with your work:
145
+ * Gain XP for feeding files (+15 XP), running commands (+25 XP), asking questions (+10 XP).
146
+ * Unlocks evolutions and visual accessories (Cyberpunk Visor, Magic Spellbook, Golden Crown).
147
+
148
+ ---
149
+
150
+ ### 📊 Why GhostOS vs. Others?
151
+
152
+ | Feature | GhostOS 👻 | Jan.ai / LM Studio | Ollama | AnythingLLM |
153
+ | :--- | :---: | :---: | :---: | :---: |
154
+ | **GUI Memory Footprint** | **~35 MB** (Native Engine) | ~850 MB (Electron) | None (CLI only) | ~1.1 GB (Electron + DB) |
155
+ | **Desktop Pet Companion** | **Yes (Casper RPG)** | ❌ No | ❌ No | ❌ No |
156
+ | **Drag & Drop RAG Ingestion**| **Yes (Drop onto Pet)** | ❌ Manual upload | ❌ Manual import | ❌ Manual upload |
157
+ | **Dynamic VRAM Swapping** | **Yes (VRAM Juggler)** | ❌ OOM on low VRAM | ❌ Manual CLI | ❌ OOM on low VRAM |
158
+ | **KV-Cache Disk Freezer** | **Yes (0 MB idle VRAM)**| ❌ No | ❌ No | ❌ No |
159
+ | **Context Vacuum (Pruning)** | **Yes (Saves 40-60%)** | ❌ No | ❌ No | ❌ No |
160
+ | **Adaptive Battery Profiles**| **Yes (Chameleon Mode)**| ❌ No | ❌ No | ❌ No |
161
+ | **Inline AI Ghostwriter** | **Yes (Any desktop app)**| ❌ No | ❌ No | ❌ No |
162
+ | **Terminal Sandbox Lens** | **Yes (Safety protection)**| ❌ No | ❌ No | ❌ No |
163
+ | **Daily Standup / Commit Crafter**| **Yes (Built-in)** | ❌ No | ❌ No | ❌ No |
164
+ | **External DB Requirement** | **Zero (SQLite FTS5)** | Varies | None | Requires Vector DB / Chroma |
165
+ | **Cross-Platform (macOS/Win/Linux)** | **Yes** | Yes | Yes | Yes |
166
+ | **Works 100% Offline** | **Yes** | Yes | Yes | Mostly |
167
+
168
+ ---
169
+
170
+ ### 🚀 Quickstart
171
+
172
+ #### 1. Clone & Install
173
+ ```bash
174
+ git clone https://github.com/GhostOS-ai/GhostOS.git
175
+ cd GhostOS
176
+ pip install -e .
177
+ ```
178
+
179
+ #### 2. Launch Casper Desktop Pet & HUD
180
+ ```bash
181
+ ghost pet
182
+ ```
183
+ *Casper will float on your desktop. Drag any file onto him, or click him to open the HUD!*
184
+
185
+ #### 3. Or use directly from Terminal (CLI)
186
+ ```bash
187
+ # Instant question with zero setup
188
+ ghost "Why does Python raise RecursionError and how to fix it?"
189
+
190
+ # Feed a document or source directory to Casper (Zero-DB RAG)
191
+ ghost eat ~/Documents/my_notes.txt
192
+ ghost eat ./src/
193
+
194
+ # Inline AI Ghostwriter (rewrites clipboard or given text)
195
+ ghost write --mode polite "can you fix this asap"
196
+ ghost write --mode grammar
197
+
198
+ # Long-term Memory Vault
199
+ ghost vault remember tech_stack "Python, Rust, Apple Silicon"
200
+ ghost vault list
201
+
202
+ # Daily Standup Report & Semantic Commit Crafter
203
+ ghost standup
204
+
205
+ # Terminal Sandbox Safety Lens
206
+ ghost sandbox "rm -rf /"
207
+
208
+ # Search indexed knowledge
209
+ ghost rag search "database migration"
210
+
211
+ # Inspect current active screen
212
+ ghost screen
213
+
214
+ # Generate and safely run a terminal task
215
+ ghost exec "find all files larger than 100MB"
216
+
217
+ # Check VRAM Juggler memory diagnostics
218
+ ghost status
219
+ ```
220
+
221
+ ---
222
+
223
+ ### ⌨️ Keyboard Shortcuts
224
+
225
+ | Shortcut | Action |
226
+ | :--- | :--- |
227
+ | `Cmd + Shift + Space` / `Ctrl + Shift + Space` | Toggle Spotlight HUD |
228
+ | `Click Ghost` | Talk with Casper / Pet reaction |
229
+ | `Double Click Ghost` | Open Quick Command HUD |
230
+ | `Escape` | Minimize back to Floating Casper |
231
+ | `Enter` | Submit query |
232
+ | `Drag & Drop File` | Feed document to Casper (Instant RAG) |
233
+
234
+ ---
235
+
236
+ ### 🏗️ Architecture
237
+
238
+ ```mermaid
239
+ flowchart TD
240
+ User([User Desktop]) -->|Drag & Drop File / Click| Pet["👻 Casper Floating Pet (Native Engine)"]
241
+ User -->|Hotkey Cmd+Shift+Space| HUD["🔮 Spotlight HUD / Command Bar"]
242
+ User -->|Terminal CLI| CLI["💻 ghost CLI (rich)"]
243
+
244
+ Pet --> Bridge["Python <-> JS Bridge API"]
245
+ HUD --> Bridge
246
+ CLI --> Core["GhostOS Core Engine"]
247
+ Bridge --> Core
248
+
249
+ subgraph MemoryManagement ["🧠 VRAM Juggler & Memory Chameleon"]
250
+ Core --> Juggler["Memory Juggler Dispatcher"]
251
+ Juggler -->|Hot-Swap <= 3.5GB| M1["Qwen 2.5 / Llama 3.2 (LLM)"]
252
+ Juggler -->|Hot-Swap <= 2.0GB| M2["Moondream2 / MiniCPM (Vision)"]
253
+ Juggler -->|Hot-Swap <= 0.6GB| M3["Whisper (Voice Copilot)"]
254
+ end
255
+
256
+ subgraph Storage ["📂 Zero-DB Storage & Vault"]
257
+ Core --> RAG["SQLite FTS5 Knowledge Base"]
258
+ Core --> Vault["🧠 Memory Vault (Long-Term Facts)"]
259
+ RAG --> Docs[("Local Notes / Code / PDFs")]
260
+ end
261
+
262
+ subgraph OSIntegration ["⚡ System Integration"]
263
+ Core --> Screen["Silent Screen Inspector"]
264
+ Core --> Pilot["Safe Terminal Autopilot"]
265
+ Core --> Lens["🛡️ Sandbox Lens"]
266
+ Core --> Writer["✍️ Ghostwriter Engine"]
267
+ end
268
+ ```
269
+
270
+ ---
271
+
272
+ ### 🔒 100% Paranoid Privacy Pledge
273
+
274
+ GhostOS is engineered with privacy as a foundational constraint:
275
+ - **Zero Telemetry:** No analytics, no phone-home pings, no user tracking.
276
+ - **Zero Cloud Fallbacks:** Every neural calculation runs locally on your device's CPU/GPU.
277
+ - **Air-Gapped Ready:** Works with your Wi-Fi completely disabled.
278
+
279
+ ---
280
+
281
+ ### 🤝 Contributing
282
+
283
+ Contributions are warmly welcomed! Feel free to submit issues, pull requests, or custom Casper skins.
284
+
285
+ ```bash
286
+ # Run full unit test suite (44+ tests)
287
+ python3 -m unittest discover tests
288
+ ```
289
+
290
+ ---
291
+
292
+ ### 📄 License & Authorship
293
+
294
+ - **Author:** [KIB.best](https://kib.best)
295
+ - **Email:** [GhostOS@kib.best](mailto:GhostOS@kib.best)
296
+ - **License:** MIT License © 2026 KIB.best. Free for personal and commercial use.
@@ -0,0 +1,266 @@
1
+ <div align="center">
2
+
3
+ ```
4
+ .---.
5
+ / \
6
+ | () () | G H O S T O S
7
+ \ - / The Invisible, Featherweight, Offline Desktop AI Copilot
8
+ /`---'\
9
+ / \ [ 100% Private • Dynamic VRAM Juggler • Zero-DB RAG • Casper Pet ]
10
+ (_/^\_/\_/^)
11
+ ```
12
+
13
+ # 👻 GhostOS
14
+ ### The Featherweight, Offline AI Assistant & Desktop Companion
15
+
16
+ <p align="center">
17
+ <b>🌐 Language Select / Выбор языка / Тілді таңдау / 语言选择:</b><br>
18
+ <a href="README.md"><b>English</b></a> •
19
+ <a href="docs/README_RU.md"><b>Русский</b></a> •
20
+ <a href="docs/README_KK.md"><b>Қазақша</b></a> •
21
+ <a href="docs/README_ZH.md"><b>简体中文</b></a> •
22
+ <a href="docs/README_ES.md"><b>Español</b></a> •
23
+ <a href="docs/README_DE.md"><b>Deutsch</b></a> •
24
+ <a href="docs/README_FR.md"><b>Français</b></a> •
25
+ <a href="docs/README_JA.md"><b>日本語</b></a> •
26
+ <a href="docs/README_PT.md"><b>Português</b></a>
27
+ </p>
28
+
29
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
30
+ [![Author: KIB.best](https://img.shields.io/badge/Author-KIB.best-8A2BE2.svg)](https://kib.best)
31
+ [![Email](https://img.shields.io/badge/Contact-GhostOS%40kib.best-0071e3.svg)](mailto:GhostOS@kib.best)
32
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
33
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-brightgreen.svg)]()
34
+ [![Idle RAM](https://img.shields.io/badge/Idle%20RAM-%3C35%20MB-success.svg)]()
35
+ [![Peak VRAM](https://img.shields.io/badge/Peak%20VRAM-%E2%89%A43.5%20GB-blueviolet.svg)]()
36
+ [![Privacy](https://img.shields.io/badge/Privacy-100%25%20Offline-orange.svg)]()
37
+
38
+ **A unified, ultra-lightweight desktop AI companion that runs effortlessly on low-spec laptops and base Apple Silicon Macs (4GB–8GB RAM) without Out-Of-Memory (OOM) crashes.**
39
+
40
+ [Quickstart](#-quickstart) • [Features](#-exclusive-killer-features) • [Comparison](#-why-ghostos-vs-others) • [Architecture](#-architecture) • [CLI Cheatsheet](#-cli-cheatsheet) • [Privacy Pledge](#-100-paranoid-privacy-pledge)
41
+
42
+ </div>
43
+
44
+ ---
45
+
46
+ ### 💡 Why GhostOS?
47
+
48
+ Running local AI today is frustrating and bloated:
49
+ - **Electron RAM Bloat:** Most local AI desktop apps (LM Studio, Jan, AnythingLLM) burn **800MB–1.2GB of RAM** on the UI alone before a single neural weight is loaded into memory.
50
+ - **The Multi-Model OOM Trap:** Trying to run an LLM (3GB) + Vision model (2GB) + Whisper (1GB) simultaneously crashes any device with 4GB–8GB RAM.
51
+ - **Overcomplicated RAG Stacks:** Document chat tools force users to install Docker containers, heavy vector databases (Chroma/Qdrant), and gigabytes of bloated Python dependencies.
52
+
53
+ **GhostOS solves this from first principles:**
54
+ 1. **Casper Companion Pet & HUD:** Rendered via native system web engines (WebKit on macOS, Edge WebView2 on Windows, WebKitGTK on Linux) consuming just **~35MB RAM**.
55
+ 2. **Dynamic VRAM Juggler:** Dynamically hot-swaps between LLM, Vision, and Whisper on demand in <150ms. Peak VRAM never exceeds **3.5GB**.
56
+ 3. **Zero-DB RAG:** Drop files onto Casper — indexed in milliseconds using pure **SQLite FTS5** with zero external database dependencies.
57
+ 4. **100% Local & Private:** Zero telemetries, zero cloud fallbacks. Fully functional air-gapped with Wi-Fi switched off.
58
+
59
+ ---
60
+
61
+ ### ✨ Exclusive Killer Features
62
+
63
+ #### 1. 👻 Casper: The Living Desktop Pet
64
+ * A quiet, translucent porcelain ghost that floats gently over your workspace.
65
+ * **"Casper Eats Files":** Drag & drop any PDF, code repository, notes, or spreadsheet directly onto Casper. Casper opens his mouth, swallows the file, and indexes it into your local knowledge base instantly (+15 XP!).
66
+ * **Visual Moods & Reactive States:**
67
+ * 💤 `Idle`: Weightless floating animation, 0% CPU footprint.
68
+ * 🔮 `Thinking`: Ethereal sapphire aura, streaming local neural tokens.
69
+ * 🎧 `Listening`: Casper wears glowing headphones, capturing offline meetings.
70
+ * 🍕 `Eating`: Document suction animation with real-time XP gain.
71
+ * ⚠️ `Alarm`: Visual security warning when a dangerous shell command is detected.
72
+ * Single-click for quick phrases & interactions; double-click or press `Cmd+Shift+Space` / `Ctrl+Shift+Space` to morph into the **Spotlight HUD**.
73
+
74
+ #### 2. ✍️ Ghostwriter (AI Inline Completion in Any App)
75
+ * Highlight text anywhere (Word, Telegram, browser, IDE, terminal) $\rightarrow$ press hotkey $\rightarrow$ transform instantly:
76
+ * ✨ `polish`: Professional, crisp, and concise rewrite.
77
+ * 🤝 `polite`: Diplomatic, respectful business tone.
78
+ * 📝 `grammar`: Fixes spelling and grammar mistakes with zero conversational fluff.
79
+ * 🎯 `summarize`: Distills text down to 2-3 key takeaways.
80
+ * 🌐 `translate`: Instant translation into English, Russian, Kazakh, Chinese, etc.
81
+ * 🛠️ `code_fix`: Automatically diagnoses and fixes bugs in code snippets.
82
+ * Use from CLI: `ghost write --mode polite "draft message"` or rewrite clipboard in 1 click!
83
+
84
+ #### 3. 🧠 Memory Vault (Cross-Session Context Graph)
85
+ * Local SQLite knowledge graph that permanently stores personal context across restarts.
86
+ * Casper automatically remembers your developer stack, favorite languages, and active projects.
87
+ * Injects personal context into queries with **0 KB extra VRAM** and 0% background CPU footprint.
88
+ * CLI: `ghost vault list`, `ghost vault remember tech_stack "Python, Rust, Apple Silicon"`.
89
+
90
+ #### 4. 🛡️ Terminal Sandbox Lens (Destructive Command Protection)
91
+ * Deep safety inspection for shell commands before execution.
92
+ * Intercepts and blocks destructive operations (`rm -rf /`, `mkfs`, raw `dd`, `DROP DATABASE`, `format C:`).
93
+ * Explains risks in plain human language and suggests safe alternatives before running.
94
+ * Interactive audit: `ghost sandbox "rm -rf /"`.
95
+
96
+ #### 5. 📅 Daily Standup & Conventional Commit Crafter
97
+ * Analyzes daily workspace file modifications, git diffs, and session commits.
98
+ * Generates ready-to-share Daily Standup reports for Slack / Telegram (*"What I accomplished", "What I'm working on", "Blockers"*).
99
+ * Automatically crafts semantic Conventional Commits (`feat(...)`, `fix(...)`, `refactor(...)`).
100
+ * CLI: `ghost standup`.
101
+
102
+ #### 6. 🎙️ Auto-Minutes Meeting Copilot
103
+ * 100% private offline secretary for Zoom, Google Meet, and voice notes.
104
+ * Generates structured markdown meeting minutes with **Executive Overview**, **Key Decisions**, and **Action Items with Deadlines**.
105
+ * Whisper model hot-swaps in only for the 5-second transcription window and immediately frees VRAM.
106
+
107
+ #### 7. 🦎 Memory Chameleon (Adaptive Power Profiles)
108
+ * Dynamically monitors battery state and system RAM pressure:
109
+ * 🍃 **ECO Mode:** Triggers on battery or RAM > 82%. Context capped at 1024 tokens, 2 CPU threads, 60s auto-sleep, 30 FPS pet.
110
+ * ⚖️ **Balanced Mode:** Context 2048 tokens, 4 threads, 180s auto-sleep.
111
+ * ⚡ **Performance Beast:** On AC power and free RAM > 50%. Context 4096 tokens, full GPU acceleration.
112
+
113
+ #### 8. 🎮 Casper RPG Evolution System
114
+ * Gamified companion that grows with your work:
115
+ * Gain XP for feeding files (+15 XP), running commands (+25 XP), asking questions (+10 XP).
116
+ * Unlocks evolutions and visual accessories (Cyberpunk Visor, Magic Spellbook, Golden Crown).
117
+
118
+ ---
119
+
120
+ ### 📊 Why GhostOS vs. Others?
121
+
122
+ | Feature | GhostOS 👻 | Jan.ai / LM Studio | Ollama | AnythingLLM |
123
+ | :--- | :---: | :---: | :---: | :---: |
124
+ | **GUI Memory Footprint** | **~35 MB** (Native Engine) | ~850 MB (Electron) | None (CLI only) | ~1.1 GB (Electron + DB) |
125
+ | **Desktop Pet Companion** | **Yes (Casper RPG)** | ❌ No | ❌ No | ❌ No |
126
+ | **Drag & Drop RAG Ingestion**| **Yes (Drop onto Pet)** | ❌ Manual upload | ❌ Manual import | ❌ Manual upload |
127
+ | **Dynamic VRAM Swapping** | **Yes (VRAM Juggler)** | ❌ OOM on low VRAM | ❌ Manual CLI | ❌ OOM on low VRAM |
128
+ | **KV-Cache Disk Freezer** | **Yes (0 MB idle VRAM)**| ❌ No | ❌ No | ❌ No |
129
+ | **Context Vacuum (Pruning)** | **Yes (Saves 40-60%)** | ❌ No | ❌ No | ❌ No |
130
+ | **Adaptive Battery Profiles**| **Yes (Chameleon Mode)**| ❌ No | ❌ No | ❌ No |
131
+ | **Inline AI Ghostwriter** | **Yes (Any desktop app)**| ❌ No | ❌ No | ❌ No |
132
+ | **Terminal Sandbox Lens** | **Yes (Safety protection)**| ❌ No | ❌ No | ❌ No |
133
+ | **Daily Standup / Commit Crafter**| **Yes (Built-in)** | ❌ No | ❌ No | ❌ No |
134
+ | **External DB Requirement** | **Zero (SQLite FTS5)** | Varies | None | Requires Vector DB / Chroma |
135
+ | **Cross-Platform (macOS/Win/Linux)** | **Yes** | Yes | Yes | Yes |
136
+ | **Works 100% Offline** | **Yes** | Yes | Yes | Mostly |
137
+
138
+ ---
139
+
140
+ ### 🚀 Quickstart
141
+
142
+ #### 1. Clone & Install
143
+ ```bash
144
+ git clone https://github.com/GhostOS-ai/GhostOS.git
145
+ cd GhostOS
146
+ pip install -e .
147
+ ```
148
+
149
+ #### 2. Launch Casper Desktop Pet & HUD
150
+ ```bash
151
+ ghost pet
152
+ ```
153
+ *Casper will float on your desktop. Drag any file onto him, or click him to open the HUD!*
154
+
155
+ #### 3. Or use directly from Terminal (CLI)
156
+ ```bash
157
+ # Instant question with zero setup
158
+ ghost "Why does Python raise RecursionError and how to fix it?"
159
+
160
+ # Feed a document or source directory to Casper (Zero-DB RAG)
161
+ ghost eat ~/Documents/my_notes.txt
162
+ ghost eat ./src/
163
+
164
+ # Inline AI Ghostwriter (rewrites clipboard or given text)
165
+ ghost write --mode polite "can you fix this asap"
166
+ ghost write --mode grammar
167
+
168
+ # Long-term Memory Vault
169
+ ghost vault remember tech_stack "Python, Rust, Apple Silicon"
170
+ ghost vault list
171
+
172
+ # Daily Standup Report & Semantic Commit Crafter
173
+ ghost standup
174
+
175
+ # Terminal Sandbox Safety Lens
176
+ ghost sandbox "rm -rf /"
177
+
178
+ # Search indexed knowledge
179
+ ghost rag search "database migration"
180
+
181
+ # Inspect current active screen
182
+ ghost screen
183
+
184
+ # Generate and safely run a terminal task
185
+ ghost exec "find all files larger than 100MB"
186
+
187
+ # Check VRAM Juggler memory diagnostics
188
+ ghost status
189
+ ```
190
+
191
+ ---
192
+
193
+ ### ⌨️ Keyboard Shortcuts
194
+
195
+ | Shortcut | Action |
196
+ | :--- | :--- |
197
+ | `Cmd + Shift + Space` / `Ctrl + Shift + Space` | Toggle Spotlight HUD |
198
+ | `Click Ghost` | Talk with Casper / Pet reaction |
199
+ | `Double Click Ghost` | Open Quick Command HUD |
200
+ | `Escape` | Minimize back to Floating Casper |
201
+ | `Enter` | Submit query |
202
+ | `Drag & Drop File` | Feed document to Casper (Instant RAG) |
203
+
204
+ ---
205
+
206
+ ### 🏗️ Architecture
207
+
208
+ ```mermaid
209
+ flowchart TD
210
+ User([User Desktop]) -->|Drag & Drop File / Click| Pet["👻 Casper Floating Pet (Native Engine)"]
211
+ User -->|Hotkey Cmd+Shift+Space| HUD["🔮 Spotlight HUD / Command Bar"]
212
+ User -->|Terminal CLI| CLI["💻 ghost CLI (rich)"]
213
+
214
+ Pet --> Bridge["Python <-> JS Bridge API"]
215
+ HUD --> Bridge
216
+ CLI --> Core["GhostOS Core Engine"]
217
+ Bridge --> Core
218
+
219
+ subgraph MemoryManagement ["🧠 VRAM Juggler & Memory Chameleon"]
220
+ Core --> Juggler["Memory Juggler Dispatcher"]
221
+ Juggler -->|Hot-Swap <= 3.5GB| M1["Qwen 2.5 / Llama 3.2 (LLM)"]
222
+ Juggler -->|Hot-Swap <= 2.0GB| M2["Moondream2 / MiniCPM (Vision)"]
223
+ Juggler -->|Hot-Swap <= 0.6GB| M3["Whisper (Voice Copilot)"]
224
+ end
225
+
226
+ subgraph Storage ["📂 Zero-DB Storage & Vault"]
227
+ Core --> RAG["SQLite FTS5 Knowledge Base"]
228
+ Core --> Vault["🧠 Memory Vault (Long-Term Facts)"]
229
+ RAG --> Docs[("Local Notes / Code / PDFs")]
230
+ end
231
+
232
+ subgraph OSIntegration ["⚡ System Integration"]
233
+ Core --> Screen["Silent Screen Inspector"]
234
+ Core --> Pilot["Safe Terminal Autopilot"]
235
+ Core --> Lens["🛡️ Sandbox Lens"]
236
+ Core --> Writer["✍️ Ghostwriter Engine"]
237
+ end
238
+ ```
239
+
240
+ ---
241
+
242
+ ### 🔒 100% Paranoid Privacy Pledge
243
+
244
+ GhostOS is engineered with privacy as a foundational constraint:
245
+ - **Zero Telemetry:** No analytics, no phone-home pings, no user tracking.
246
+ - **Zero Cloud Fallbacks:** Every neural calculation runs locally on your device's CPU/GPU.
247
+ - **Air-Gapped Ready:** Works with your Wi-Fi completely disabled.
248
+
249
+ ---
250
+
251
+ ### 🤝 Contributing
252
+
253
+ Contributions are warmly welcomed! Feel free to submit issues, pull requests, or custom Casper skins.
254
+
255
+ ```bash
256
+ # Run full unit test suite (44+ tests)
257
+ python3 -m unittest discover tests
258
+ ```
259
+
260
+ ---
261
+
262
+ ### 📄 License & Authorship
263
+
264
+ - **Author:** [KIB.best](https://kib.best)
265
+ - **Email:** [GhostOS@kib.best](mailto:GhostOS@kib.best)
266
+ - **License:** MIT License © 2026 KIB.best. Free for personal and commercial use.
@@ -0,0 +1,6 @@
1
+ """
2
+ GhostOS: The Invisible, Featherweight, Offline Desktop AI Companion & Copilot.
3
+ """
4
+ __version__ = "1.0.0"
5
+ __author__ = "KIB.best"
6
+ __email__ = "GhostOS@kib.best"
@@ -0,0 +1,7 @@
1
+ """
2
+ Entry point for python -m ghost
3
+ """
4
+ from ghost.cli.main import main
5
+
6
+ if __name__ == "__main__":
7
+ main()
@@ -0,0 +1,57 @@
1
+ """
2
+ GhostOS Configuration & Path Management
3
+ """
4
+ import os
5
+ import json
6
+ from pathlib import Path
7
+ from typing import Dict, Any
8
+
9
+ # Root data directory in user home
10
+ GHOST_HOME = Path.home() / ".ghostos"
11
+ GHOST_MODELS_DIR = GHOST_HOME / "models"
12
+ GHOST_CACHE_DIR = GHOST_HOME / "cache"
13
+ GHOST_RECORDINGS_DIR = GHOST_HOME / "recordings"
14
+ GHOST_DB_PATH = GHOST_HOME / "ghost_knowledge.db"
15
+ CONFIG_FILE = GHOST_HOME / "config.json"
16
+
17
+ DEFAULT_CONFIG: Dict[str, Any] = {
18
+ "engine": "auto", # "auto", "ollama", "llamacpp", "mock"
19
+ "model_name": "qwen2.5-3b-q4",
20
+ "vram_limit_mb": 4096, # Target VRAM ceiling (4GB)
21
+ "auto_sleep_seconds": 180, # Unload inactive models after 3 minutes
22
+ "pet_mode": "floating", # "floating", "stealth", "docked"
23
+ "hotkey": "Cmd+Shift+Space",
24
+ "sound_effects": True,
25
+ "theme": "dark_neon",
26
+ "ollama_host": "http://localhost:11434",
27
+ "safe_terminal_mode": True,
28
+ }
29
+
30
+ def ensure_dirs() -> None:
31
+ """Ensure all required directories exist."""
32
+ GHOST_HOME.mkdir(parents=True, exist_ok=True)
33
+ GHOST_MODELS_DIR.mkdir(parents=True, exist_ok=True)
34
+ GHOST_CACHE_DIR.mkdir(parents=True, exist_ok=True)
35
+ GHOST_RECORDINGS_DIR.mkdir(parents=True, exist_ok=True)
36
+ if not CONFIG_FILE.exists():
37
+ save_config(DEFAULT_CONFIG)
38
+
39
+ def load_config() -> Dict[str, Any]:
40
+ """Load configuration from disk, falling back to defaults."""
41
+ ensure_dirs()
42
+ if CONFIG_FILE.exists():
43
+ try:
44
+ with open(CONFIG_FILE, "r", encoding="utf-8") as f:
45
+ data = json.load(f)
46
+ merged = DEFAULT_CONFIG.copy()
47
+ merged.update(data)
48
+ return merged
49
+ except Exception:
50
+ return DEFAULT_CONFIG.copy()
51
+ return DEFAULT_CONFIG.copy()
52
+
53
+ def save_config(cfg: Dict[str, Any]) -> None:
54
+ """Save configuration to disk."""
55
+ GHOST_HOME.mkdir(parents=True, exist_ok=True)
56
+ with open(CONFIG_FILE, "w", encoding="utf-8") as f:
57
+ json.dump(cfg, f, indent=2, ensure_ascii=False)