|
1 | 1 | # Cortex Linux |
2 | 2 |
|
3 | | -**Linux automation that actually works.** Tell it what you want in plain English. |
4 | | - |
| 3 | +An AI-powered package manager for Debian/Ubuntu that understands natural language. |
5 | 4 | ```bash |
6 | | -$ cortex install oracle-23-ai --optimize-gpu |
7 | | - |
8 | | -Analyzing system... NVIDIA RTX 4090 detected |
9 | | -Planning: CUDA 12.3 → cuDNN → Oracle 23 AI |
10 | | -Installing 47 packages (this usually takes mass googling) |
11 | | -Configuring for GPU acceleration |
12 | | -Running validation... |
| 5 | +$ cortex install nginx --dry-run |
13 | 6 |
|
14 | | -Done. Oracle 23 AI ready at localhost:1521 |
15 | | -Total time: 4m 23s (vs. your afternoon) |
16 | | -``` |
| 7 | +🧠 Understanding request... |
| 8 | +📦 Planning installation... |
17 | 9 |
|
18 | | -## The Problem |
| 10 | +Packages to install: |
| 11 | + - nginx (1.24.0) |
| 12 | + - nginx-common |
| 13 | + - libnginx-mod-http-geoip |
19 | 14 |
|
20 | | -We've all been there: |
| 15 | +Commands that will be executed: |
| 16 | + sudo apt update |
| 17 | + sudo apt install -y nginx |
21 | 18 |
|
22 | | -- **12 browser tabs** of conflicting Stack Overflow answers |
23 | | -- **Dependency hell** where installing X breaks Y which needs Z |
24 | | -- **Config file archaeology** - who wrote this? what does `vm.swappiness=60` even do? |
25 | | -- **4 hours later** you still don't have CUDA working |
26 | | - |
27 | | -I built Cortex because I was tired of wasting time on package management instead of actual work. |
| 19 | +Run with --execute to install, or edit the plan above. |
| 20 | +``` |
28 | 21 |
|
29 | 22 | ## What It Does |
30 | 23 |
|
31 | | -Cortex wraps `apt` with an LLM that: |
32 | | - |
33 | | -1. **Understands what you mean** - "install a machine learning stack" → figures out PyTorch, TensorFlow, CUDA, cuDNN, Jupyter, etc. |
34 | | -2. **Detects your hardware** - Sees your GPU/CPU and configures appropriately |
35 | | -3. **Handles dependencies** - Resolves conflicts before they happen |
36 | | -4. **Rolls back on failure** - Something breaks? Undo with one command |
37 | | -5. **Runs in a sandbox** - AI-generated commands execute in Firejail isolation |
38 | | - |
39 | | -It's not magic. It's just automating what a senior sysadmin would do, but faster. |
40 | | - |
41 | | -## Current Status |
42 | | - |
43 | | -**Working (merged to main):** |
44 | | -- LLM integration (Claude API via LangChain) |
45 | | -- Hardware detection (GPU, CPU, memory) |
46 | | -- Sandboxed execution (Firejail + AppArmor) |
47 | | -- Package manager wrapper |
48 | | -- Installation rollback |
49 | | -- Context memory (learns your preferences) |
| 24 | +Cortex wraps `apt` with AI to: |
| 25 | +- Parse natural language requests ("install something for web serving") |
| 26 | +- Detect hardware and optimize installations for your GPU/CPU |
| 27 | +- Resolve dependency conflicts interactively |
| 28 | +- Track installation history with rollback support |
| 29 | +- Run in dry-run mode by default (no surprises) |
50 | 30 |
|
51 | | -**In progress:** |
52 | | -- Dependency resolution improvements |
53 | | -- Better error messages |
54 | | -- Multi-step orchestration |
55 | | -- Web dashboard (maybe) |
56 | | - |
57 | | -This is early-stage software. Expect rough edges. |
| 31 | +## Installation |
| 32 | +```bash |
| 33 | +# Clone the repo |
| 34 | +git clone https://github.com/cortexlinux/cortex.git |
| 35 | +cd cortex |
58 | 36 |
|
59 | | -## Tech Stack |
| 37 | +# Create virtual environment |
| 38 | +python3 -m venv venv |
| 39 | +source venv/bin/activate |
60 | 40 |
|
61 | | -- **Base:** Ubuntu 24.04 LTS |
62 | | -- **Language:** Python 3.11+ (yes, I know - "Python for a package manager?" - it's a prototype, Rust rewrite is on the roadmap) |
63 | | -- **AI:** LangChain + Claude API |
64 | | -- **Security:** Firejail sandboxing, AppArmor policies |
65 | | -- **Storage:** SQLite for history and context |
| 41 | +# Install |
| 42 | +pip install -e . |
66 | 43 |
|
67 | | -## Safety |
| 44 | +# Set your API key |
| 45 | +echo 'ANTHROPIC_API_KEY=your-key-here' > .env |
68 | 46 |
|
69 | | -"But what if the AI hallucinates `rm -rf /`?" |
| 47 | +# Test it |
| 48 | +cortex install nginx --dry-run |
| 49 | +``` |
70 | 50 |
|
71 | | -Fair concern. Here's how we handle it: |
| 51 | +## Usage |
| 52 | +```bash |
| 53 | +# Preview what will happen (safe, no changes) |
| 54 | +cortex install nginx --dry-run |
72 | 55 |
|
73 | | -1. **Sandbox everything** - Commands run in Firejail isolation |
74 | | -2. **Whitelist dangerous operations** - No `rm -rf`, no `dd`, no `mkfs` without explicit confirmation |
75 | | -3. **Dry-run by default** - Shows you what it plans to do before doing it |
76 | | -4. **Rollback built-in** - Every installation is reversible |
77 | | -5. **Human confirmation** - Destructive operations require typing "yes I'm sure" |
| 56 | +# Actually install |
| 57 | +cortex install nginx --execute |
78 | 58 |
|
79 | | -We're paranoid about this. The AI is a suggestion engine, not root. |
| 59 | +# Natural language works |
| 60 | +cortex install "something to edit PDFs" --dry-run |
80 | 61 |
|
81 | | -## Contributing |
| 62 | +# View installation history |
| 63 | +cortex history |
82 | 64 |
|
83 | | -We pay bounties for merged PRs: |
| 65 | +# Rollback an installation |
| 66 | +cortex rollback <id> |
84 | 67 |
|
85 | | -| Type | Amount | |
86 | | -|------|--------| |
87 | | -| Bug fixes | $25-50 | |
88 | | -| Features | $50-200 | |
89 | | -| Major features | $200-500 | |
| 68 | +# Check preferences |
| 69 | +cortex check-pref |
| 70 | +``` |
90 | 71 |
|
91 | | -Payment via Bitcoin, USDC, PayPal, or Venmo. International contributors welcome. |
| 72 | +## Safety |
92 | 73 |
|
93 | | -Check the [issues](https://github.com/cortexlinux/cortex/issues) for bounty labels. |
| 74 | +Cortex is designed to be safe by default: |
| 75 | + |
| 76 | +| Feature | Description | |
| 77 | +|---------|-------------| |
| 78 | +| **Dry-run default** | Shows planned commands without executing | |
| 79 | +| **Firejail sandbox** | Commands run in isolated environment | |
| 80 | +| **Rollback support** | Undo any installation with `cortex rollback` | |
| 81 | +| **Audit logging** | All actions logged to `~/.cortex/history.db` | |
| 82 | +| **No root by default** | Only uses sudo when explicitly needed | |
| 83 | + |
| 84 | +## Project Status |
| 85 | + |
| 86 | +### Completed |
| 87 | +- ✅ CLI with dry-run and execute modes |
| 88 | +- ✅ Claude and OpenAI integration |
| 89 | +- ✅ Installation history and rollback |
| 90 | +- ✅ User preferences (YAML-backed) |
| 91 | +- ✅ Hardware detection |
| 92 | +- ✅ Firejail sandboxing |
| 93 | +- ✅ Kernel optimization features |
| 94 | + |
| 95 | +### In Progress |
| 96 | +- 🔄 Conflict resolution UI (PR #192) |
| 97 | +- 🔄 Multi-step orchestration |
| 98 | +- 🔄 Ollama local model support |
| 99 | + |
| 100 | +### Planned |
| 101 | +- ⏳ Configuration file generation |
| 102 | +- ⏳ Error diagnosis and auto-fix |
| 103 | +- ⏳ Multi-distro support (Fedora, Arch) |
94 | 104 |
|
95 | | -### What We Need |
| 105 | +## Tech Stack |
96 | 106 |
|
97 | | -- **Linux developers** who know apt/dpkg internals |
98 | | -- **Python devs** for the core logic |
99 | | -- **Security folks** to poke holes in our sandbox |
100 | | -- **Technical writers** for documentation |
101 | | -- **Testers** to break things |
| 107 | +| Component | Technology | |
| 108 | +|-----------|------------| |
| 109 | +| Base OS | Ubuntu 22.04+ / Debian 12+ | |
| 110 | +| Language | Python 3.10+ | |
| 111 | +| LLM | Claude API, OpenAI API (Ollama planned) | |
| 112 | +| Security | Firejail, AppArmor | |
| 113 | +| Package Backend | apt/dpkg | |
102 | 114 |
|
103 | | -## Running It |
| 115 | +## Kernel Features |
104 | 116 |
|
| 117 | +Cortex includes optional kernel-level optimizations for LLM workloads: |
105 | 118 | ```bash |
106 | | -# Clone |
107 | | -git clone https://github.com/cortexlinux/cortex.git |
108 | | -cd cortex |
109 | | - |
110 | | -# Install dependencies |
111 | | -pip install -r requirements.txt |
| 119 | +cd cortex/kernel_features |
| 120 | +sudo ./install.sh |
112 | 121 |
|
113 | | -# Set your Claude API key |
114 | | -export ANTHROPIC_API_KEY="your-key" |
| 122 | +# Detect your GPU/NPU |
| 123 | +cortex-detect-hardware |
115 | 124 |
|
116 | | -# Run |
117 | | -python -m cortex install "nginx with ssl" |
| 125 | +# Apply system optimizations |
| 126 | +sudo sysctl -p /etc/sysctl.d/99-cortex-llm.conf |
118 | 127 | ``` |
119 | 128 |
|
120 | | -Requires Ubuntu 22.04+ or Debian 12+. Other distros eventually. |
121 | | - |
122 | | -## FAQ |
123 | | - |
124 | | -**Q: Why Python for a package manager?** |
125 | | -A: It's a prototype. If this takes off, core components get rewritten in Rust. Python lets us move fast and prove the concept. |
| 129 | +See `cortex/kernel_features/README.md` for details. |
126 | 130 |
|
127 | | -**Q: Is this just a wrapper around apt?** |
128 | | -A: Yes, for now. The goal is deeper integration - custom package formats, rollback at filesystem level, eventually kernel-level optimizations. You have to start somewhere. |
129 | | - |
130 | | -**Q: Why Claude and not GPT-4/Llama/etc?** |
131 | | -A: Claude has the best instruction-following for this use case. We'll add model options eventually. |
132 | | - |
133 | | -**Q: Can I use this in production?** |
134 | | -A: Not yet. This is alpha software. Test it on VMs first. |
135 | | - |
136 | | -## Roadmap |
137 | | - |
138 | | -**Phase 1 (now):** Get the basics working. Natural language → apt commands. |
139 | | - |
140 | | -**Phase 2 (Q1 2025):** Polish, error handling, config file generation. |
| 131 | +## Contributing |
141 | 132 |
|
142 | | -**Phase 3 (2025):** Deeper integration - package caching, custom repos, multi-distro support. |
| 133 | +We need: |
| 134 | +- Python developers (package manager features) |
| 135 | +- Linux kernel developers (kernel optimizations) |
| 136 | +- Technical writers (documentation) |
| 137 | +- Beta testers (bug reports) |
143 | 138 |
|
144 | | -**Phase 4 (eventually):** Kernel-level stuff - we have some ideas around native LLM support in the Linux kernel. Wild, but interesting. |
| 139 | +Bounties available for merged PRs. See issues labeled `bounty`. |
145 | 140 |
|
146 | 141 | ## Community |
147 | 142 |
|
148 | | -- **Discord:** [discord.gg/uCqHvxjU83](https://discord.gg/uCqHvxjU83) |
149 | | - |
| 143 | +- Discord: [discord.gg/uCqHvxjU83](https://discord.gg/uCqHvxjU83) |
| 144 | + |
150 | 145 |
|
151 | 146 | ## License |
152 | 147 |
|
153 | | -Apache 2.0 - Use it, fork it, sell it, whatever. Just don't blame us if it breaks. |
154 | | - |
155 | | ---- |
156 | | - |
157 | | -*Built by [Mike Morgan](https://github.com/mikejmorgan-ai) and contributors. We're hiring - if you're good at Linux internals and want to work on something different, reach out.* |
| 148 | +Apache 2.0 |
0 commit comments