<!--
README owner/repo slug note (maintainer):
Badges and clone URLs below use kodehu03/khy-os as the GitHub slug.
Confirm/replace with the real GitHub owner/repo before publishing.
-->
๐ผ๏ธ khy โ the AI-native operating system
khy
<b>The AI-native operating system.</b><br>
A hand-written OS kernel + a Claude-Code-class agentic CLI + a 16-backend AI gateway.<br>
One install, batteries included.
</p>
60-Second Tour ยท What is khy ยท Quickstart ยท The Three Pillars ยท Compare ยท ไธญๆ
๐คฏ What is khy#
khy is a full AI-native operating system โ written almost entirely by one
person. It spans every layer most projects only touch one of:
- a hand-written OS kernel in C (preemptive scheduler, demand paging,
copy-on-write fork, POSIX-style signals, pipes, per-process fd tables, a
dual ELF + PE loader) that boots and runs under QEMU;
- a Claude-Code-class agentic CLI โ streaming TUI, tool-calling loop,
permission gating, sub-agents, workflows, goal mode, context compaction;
- a 16-backend AI gateway that fronts Claude, Qwen, Cursor, Kiro, Windsurf,
Warp, Trae, Ollama, Codex and more behind one API, with cascade failover and
circuit breaking โ no vendor lock-in;
- shipped through two parallel package channels (
pip install khy-os/
npm i -g @khy-os/khy-os) with a self-healing, multi-language dev environment.
It's the kind of project that usually takes a team and a few years. Here it's
one repo you canpip installin 30 seconds and run today.
โก 60-Second Tour#
pip install khy-os # or: npm install -g @khy-os/khy-os
khy # launch the agentic terminal
โโ khy โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 18% ctx โโ
โ โบ refactor the gateway adapter cascade and add a test โ
โ โ
โ ๐ญ ๆ่ ยท 142 ๅญ (Ctrl+O ๅฑๅผ) โ
โ โธ ่ฏปๅ ยท ็ผ่พ ยท ๆง่กๅฝไปค ยท 4 ไธชๆญฅ้ชค โโโโ โ
โ โ ๅฎๆ โ
โ โ น ็ๆไธญโฆ ยท 12s ยท ~340 tok โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฝ๏ธ Demo recording: drop an asciinema cast or GIF at
assets/demo.gif
and it renders here. Seedocs/launch/DEMO.mdfor the
exact 45-second script that shows the kernel booting and the agent coding.
๐ Quickstart#
Install (pick one channel โ both ship the identical workshop)#
# pip channel
python3 -m pip install -U khy-os
# npm channel
npm install -g @khy-os/khy-os
Run#
khy # agentic terminal (the headline experience)
khy preflight # diagnose PATH / Node / deps / claude before first run
khy ai "summarize this repo" # one-shot AI, no REPL
khy gateway status # see which of the 16 AI backends are live
Boot the actual OS#
khy iso build --output dist/khy-os.iso # build a bootable ISO
# then attach dist/khy-os.iso in QEMU / VMware / VirtualBox
New here? Follow the 0-to-power-user ladder: ๆฐๆๆ้ฟ่ทฏ็บฟ (post-install checklist โ configure AI โ daily use โ advanced โ mastery).
Full guides: ๆๆกฃ็ดขๅผ ยท Windows + VMware: windows-vmware-ๆธ
ๅ
๐งฑ The Three Pillars#
1. A real, hand-written kernel#
Not a wrapper around Linux โ a kernel built from boot sector up, validated under
QEMU at every phase:
| Capability | Status |
|---|---|
| Preemptive scheduler + PS/2 keyboard + line-edited shell | โ QEMU-tested |
Demand paging ยท copy-on-write fork ยท fault isolation | โ QEMU-tested |
POSIX-style signals (sigaction/sigreturn) ยท pipes ยท per-process fd tables | โ QEMU-tested |
| Standard streams (fd 0โ2) ยท shell pipelines (`\ | `) |
| Dual binary loader: ELF + PE | โ QEMU-tested |
Hybrid micro/monolithic design โ performance paths in kernel space, I/O through
IPC. Roadmap: real keyboardstdinand block-device persistence.
2. A Claude-Code-class agent in your terminal#
- Streaming Ink TUI with collapsible process groups, persisted thinking,
real context-fill meter, and a live token/stall indicator.
- A full tool-calling loop with structured results, loop detection, and
max_tokens recovery โ benchmarked against Claude Code / Qwen Code / OpenCode.
- Permission gating,
AskUserQuestion, sub-agents, goal mode, and a
visual workflow editor with a native execution engine.
3. A 16-backend AI gateway#
One endpoint in front of every model you already pay for โ bring your own
keys, keep your data local:
Claude ยท Qwen ยท Cursor ยท Kiro ยท Windsurf ยท Warp ยท Trae ยท Ollama ยท Codex ยท โฆ
Cascade failover, circuit breakers, transient-error cooldown, and per-user
multi-tenant isolation. Falls back automatically when a channel goes down.
๐บ๏ธ Architecture#
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ khy CLI ยท Ink TUI ยท agent loop ยท goals โ โ what you touch
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโ
โ AI Gateway (16 adapters, failover) โ โ bring your own keys
โ Claude ยท Qwen ยท Cursor ยท Ollama ยท โฆ โ
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Node backend ยท tools ยท workflows ยท services โ โ runtime
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ
โ khy kernel (C) ยท ELF/PE loader โ โ the OS underneath
โ scheduler ยท paging ยท IPC ยท fork โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Shipped as one workshop through two channels: pip install khy-os / npm i -g @khy-os/khy-os
๐ How It Compares#
| khy | Claude Code | Ollama | A Linux distro | |
|---|---|---|---|---|
| Agentic coding CLI | โ | โ | โ | โ |
| Multi-provider, no lock-in | โ (16) | โ (1) | โ (local only) | โ |
| Self-hostable / bring-your-own-keys | โ | โ | โ | โ |
| Built-in AI gateway w/ failover | โ | โ | โ | โ |
| Hand-written OS kernel | โ | โ | โ | โ (a team) |
| One-command install | โ | โ | โ | โ |
khy isn't trying to beat any one of these โ it's the only project that is all
of them at once, from the kernel to the agent.
๐ฆ What's in the box#
platform/ Python launcher + bundled runtime + shared JS (pip entrypoint)
services/ Node backend: CLI, gateway, adapters, tools, workflows
apps/ Vue management UI + upper-layer apps
kernel/ The OS: boot, src, ELF/PE loader, MoonBit WASM, ISO build
software/ khyquant โ the default built-in app (quant trading)
docs/ ๆถๆ (architecture) ยท ๆๅ (guides) ยท ไฟฎๅค่ฎฐๅฝ (changelogs)
packaging/ npm channel (@khy-os/khy-os) mirroring the pip workshop
๐ฃ๏ธ Roadmap#
- [ ] Real keyboard
stdin+ block-device persistence in the kernel - [ ] Recorded boot-to-agent demo (
assets/demo.gif) - [ ] More gateway adapters + adapter capability matrix in docs
- [ ] Hosted playground
Changelog: CHANGELOG.md
โญ Star history#
๐ค Contributing & community#
- Read
CONTRIBUTING.mdbefore opening a PR. - Be kind โ see
CODE_OF_CONDUCT.md. - Found a vulnerability? See
SECURITY.md(please don't open a public issue).
๐ License#
Source-available. khy is free to download, run, study, and use
non-commercially โ see LICENSE. Copying, modifying, or
redistributing the source, and commercial use, require written permission from
the author (ๅญๆตฉๅ / Kong Haoyuan). For commercial licensing or collaboration,
reach out.
<b>If a one-person AI-native OS is the kind of thing you want to exist,</b><br>
โญ <b>star the repo</b> โ it's the cheapest way to tell the author to keep going.
</p>