AI Context Infrastructure Layer - Reduce token consumption. Maintain AI continuity.
Project description
🌿 Stop repeating yourself to AI. Let ContextOS remember. 🌿
Getting Started · CLI Commands · How It Works · Roadmap · Contributing
🤔 The Problem
Every AI session starts from zero.
You explain your project. Again. You explain what's done. Again. You explain the constraints. Again.
Meanwhile the AI burns hundreds of tokens just reading context it already processed yesterday.
There had to be a better way.
⚡ The Solution
Without ContextOS With ContextOS
───────────────── ──────────────
You → [entire codebase] You → ContextOS → [45 tokens]
→ [full history] ↓
→ [repeated rules] Compressed. Focused. Structured.
→ AI Model → AI Model
~3000 tokens ~45 tokens
ContextOS sits between you and any AI model. It maintains structured project memory and injects only what the AI needs — nothing more.
🔥 Why ContextOS?
❌ Without ContextOS
|
✅ With ContextOS
|
📦 Install
pip install contextos-cli
Or from source:
git clone https://github.com/Whynotshashwat/ContextOS.git
cd ContextOS
python -m venv .venv
# Windows
.venv\Scripts\activate
# Mac/Linux
source .venv/bin/activate
pip install -e .
Verify:
context --help
🚀 Quick Start
# 1. Initialize in your project
context init "Jarvis" "Build an AI voice assistant"
# 2. Check project state
context status
# 3. Break task into subtasks
context decompose 1
# 4. Get next task
context next
# 5. See exactly what AI receives
context explain
# 6. Mark task done
context done 1.1
# 7. Get A/B/C implementation approaches
context suggest 1
🖥 CLI Commands
| Command | Description | Example |
|---|---|---|
context init |
Initialize ContextOS | context init "Jarvis" "Build AI assistant" |
context status |
Show full project state | context status |
context next |
Advance to next task | context next |
context done |
Mark task complete | context done 1.1 |
context decompose |
Break task into subtasks | context decompose 1 |
context suggest |
Get A/B/C approaches | context suggest 1 |
context explain |
Preview context injection | context explain |
context goal |
Update project goal | context goal "New goal" |
context snapshot |
Save checkpoint | context snapshot "before refactor" |
context rollback |
Restore last snapshot | context rollback |
context import |
Import from README/TODO | context import |
Flags
context done 1.1 --dry-run # Preview without executing
context decompose 1 --dry-run # Preview subtasks before creating
🧠 How It Works
┌─────────────────────────────────────────────────────┐
│ Your Project │
│ │
│ ┌──────────────┐ ┌───────────────────────┐ │
│ │ You/IDE │───────▶│ ContextOS │ │
│ └──────────────┘ │ │ │
│ │ ┌─────────────────┐ │ │
│ │ │ Context Engine │ │ │
│ │ │ Compressor │ │ │
│ │ │ Memory Store │ │ │
│ │ │ Decision Log │ │ │
│ │ └────────┬────────┘ │ │
│ └───────────┼───────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────┐ │
│ │ Compressed Context │ │
│ │ 45 tokens (not 3000) │ │
│ └───────────┬───────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────┐ │
│ │ AI Model │ │
│ │ (any provider) │ │
│ └───────────────────────┘ │
└─────────────────────────────────────────────────────┘
Context Priority Stack
ContextOS compresses context using a strict priority order:
Priority 1 ── Current task + subtask
Priority 2 ── Active rules
Priority 3 ── Last 3 decisions
Priority 4 ── Pending task titles
Priority 5 ── Project goal
Drop ── Completed details, logs, cache
📊 Context Score
Every context status shows real metrics:
╭──────────────── ContextOS Status ─────────────────╮
│ Jarvis │
│ Build an AI voice assistant │
╰────────────────────────────────────────────────────╯
Field Value
Phase Core Features
Current Task Command Parser
Current Subtask Map commands
Progress 2/5 tasks done
Context Score 90/100
Score breakdown:
- Project name + goal defined → +35
- Phase set → +10
- Active task + subtask → +25
- Tasks with subtasks → +20
📄 AICF — AI Context Format
ContextOS uses AICF (AI Context Format) — an open specification for structured AI project memory.
{
"aicf_version": "1.0",
"project": {
"name": "Jarvis",
"goal": "Build an AI voice assistant",
"description": "Voice and text AI assistant"
},
"state": {
"phase": "Core Features",
"current_task": "2",
"current_subtask": "2.2"
},
"tasks": [
{
"id": "1",
"title": "Project setup",
"status": "done"
},
{
"id": "2",
"title": "Command parser",
"status": "in_progress",
"subtasks": [
{ "id": "2.1", "title": "Detect keywords", "status": "done" },
{ "id": "2.2", "title": "Map commands", "status": "pending" }
]
}
],
"rules": {
"max_subtasks": 5,
"execute_one_subtask_only": true
}
}
Any tool can read AICF. No ContextOS dependency required.
🗂 Project Memory Structure
your-project/
└── .contextos/ ← isolated memory layer
├── aicf.json ← project state (safe to commit)
├── memory.json ← compressed history
├── decisions.json ← decision log
├── snapshots/ ← context checkpoints
└── logs/ ← interaction logs
⚠️ Add
config.jsonto.gitignore— it contains your API keys.
🛡 Removal Safety
ContextOS is fully removable at any time:
# Remove ContextOS completely
rm -rf .contextos/
pip uninstall contextos-cli
Your project:
- ✅ Compiles
- ✅ Runs
- ✅ Behaves identically
Zero runtime dependency. Zero leftover code.
📈 Roadmap
Phase 1 — MVP ████████████████████ Done ✅
Phase 2 — Smart Memory ░░░░░░░░░░░░░░░░░░░░ Up Next
Phase 3 — Ecosystem ░░░░░░░░░░░░░░░░░░░░ Planned
- Core engine
- AICF schema
- CLI — all commands
- Context compression
- Decision tracking
- A/B/C suggestion engine
- Snapshot and rollback
- Context import
- Context score
- Python SDK
- JavaScript SDK
- VS Code extension
- Antigravity integration
- Team shared memory
- Cloud sync
🤝 Contributing
Contributions are welcome.
# Fork the repo
git clone https://github.com/YOURUSERNAME/ContextOS.git
cd ContextOS
python -m venv .venv
.venv\Scripts\activate
pip install -e .
# Create your branch
git checkout -b feature/your-feature
# Make changes and push
git push origin feature/your-feature
See CONTRIBUTING.md for guidelines.
📜 License
Apache 2.0 — see LICENSE
Free for personal and commercial use.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file contextos_cli-0.2.0.tar.gz.
File metadata
- Download URL: contextos_cli-0.2.0.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4321ae5ecadf02f7e238eb8639c23333809edba5c7b0268c7ea4362bb9fd71d8
|
|
| MD5 |
ef92c04c0c967ec794ac3e37a82c96bd
|
|
| BLAKE2b-256 |
acaf4e5f533a26ab77830581cfe9f5e8408de24e952f47f8b3a0fa70cc665bf7
|
File details
Details for the file contextos_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: contextos_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baf250bd9f07087620161afe7b1a51eab4c2912082c431a1765c082fced8aa5e
|
|
| MD5 |
12178ae970774890341d5b0f4a5e4e16
|
|
| BLAKE2b-256 |
03c8e5a870230c45c0af349408fd0d54944de47471424e533470ec08eae3d6a1
|