Skip to content

Ihorog/cit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

373 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CIT Logo

CIT (Ci Interface Terminal)

Vercel Deployment Unified CIT

Version: 2.1.0 (Final Release) 🏁

CIT (Ci Interface Terminal) is a lightweight API gateway that sits between your Cimeika devices and the OpenAI API.
It exposes a minimal HTTP interface and forwards chat requests to OpenAI using Python's standard library.
The service is designed to run locally on Android through Termux and can be connected to other systems over a LAN.

🧬 Unified Architecture: CIT now serves as the core of a modular ecosystem that unifies 5 repositories (cit, ciwiki, cimeika-unified, media, cit_versel) following the 111 density principle (1 core, 1 registry, 1 entry point). See Unification Documentation for details.

🆕 v2.1 Features: Autonomous OpenAI client, enhanced Job Manager, memory optimization (~80MB vs ~150MB), and complete API documentation. See Release Notes for details.

Note: For conceptual understanding of Ci and its underlying framework, see the Legend Ci documentation (canonical source: ciwiki/Legend ci). This README focuses on technical implementation.

Features

Core (v2.1)

  • Autonomous OpenAI Client – Standalone OpenAIClient class for programmatic API access with intelligent routing
  • Job Management System – Create and track long-running tasks via /v1/jobs/* endpoints
  • Memory Optimized – ~80MB memory usage (47% reduction from v2.0) through streaming multipart parsing
  • Audit System – Comprehensive logging and monitoring of resources, API requests, and security (see Audit Documentation)

API Endpoints

  • Health checkGET /health returns a simple JSON object to verify the service is running.
  • Web UIGET /ui (or /) provides a browser-based chat interface with Speech-to-Text (STT) and Text-to-Speech (TTS) support.
  • Chat proxyPOST /chat forwards your chat messages to OpenAI and returns the response.
  • Intelligent API routing – uses OpenAI's Responses API with automatic fallback to Chat Completions API.
  • File operations – Upload, download, and manage files via /files, /file, /upload endpoints
  • Configuration – Runtime configuration via /config endpoint
  • AuditGET /audit and GET /audit/resources provide comprehensive system auditing (see Audit Documentation)

Technical

  • No external dependencies – implemented with Python's built‑in modules, so it works out of the box in Termux.
  • Simple deployment – start the server with a single script or integrate it into Termux Boot for auto‑start.

Quick start in Termux

Follow these three steps to install and run CIT on your Android device using Termux:

  1. Install Termux packages

    pkg update -y && pkg upgrade -y
    pkg install -y git python termux-services
  2. Clone the repository

    git clone https://github.com/Ihorog/cit.git ~/cit
    cd ~/cit
  3. Run the server

    # Export your OpenAI API key (required)
    export OPENAI_API_KEY="your-api-key-here"
    # Optional: Export your HuggingFace token for ML model access
    export HUGGINGFACE_API_TOKEN="your-token-here"
    # Start the server on port 8790
    python server/cit_server.py

The service will listen on all interfaces (port 8790 by default).
You can add the start command to scripts/termux_boot/cit_start.sh and enable Termux Boot to run CIT automatically after a reboot.

Access the Web UI at http://127.0.0.1:8790/ui in your browser to use the chat interface with voice capabilities.

Modular Engine

CIT now includes a modular engine that unifies multiple repositories into a single system. Use the engine CLI for advanced operations:

Build & Validate

# Validate all modules and their dependencies
python core/engine.py build

Run Server

# Start the HTTP server (alternative to python ci.py)
python core/engine.py run

Module Management

# Run a specific module
python core/engine.py module <module-id>

# Show system status
python core/engine.py status

For detailed information about the modular architecture, see Unification Documentation.

Example requests

Web UI

Open your browser and navigate to:

http://127.0.0.1:8790/ui

The Web UI provides:

  • Text input with "Send" button
  • 🎙️ STT button for voice input (Ukrainian language)
  • 🔊 TTS button to hear the assistant's response
  • Real-time health status indicator
  • Dark theme optimized for mobile

API Endpoints

Check that CIT is running:

curl http://127.0.0.1:8790/health
# → {"ok": true, "model": "gpt-4o-mini", "ts": "2026-01-01T22:04:59.584648+00:00"}

Send a chat message to OpenAI via CIT:

curl -X POST http://127.0.0.1:8790/chat \
     -H "Content-Type: application/json" \
     -d '{"message": "Hello, world!"}'

# Example response:
# {
#   "reply": "Hello! How can I assist you today?",
#   "api": "chat.completions",
#   "raw": {
#     "id": "chatcmpl-abc123",
#     "object": "chat.completion",
#     "created": 1735756800,
#     "model": "gpt-4.1-mini",
#     "choices": [
#       {
#         "index": 0,
#         "message": {
#           "role": "assistant",
#           "content": "Hello! How can I assist you today?"
#         },
#         "finish_reason": "stop"
#       }
#     ]
#   }
# }

Or open the Web UI in your browser:

# Open http://127.0.0.1:8790/ui in your browser
# Features:
# - Interactive chat interface
# - 🎙️ Speech-to-Text (STT) for voice input
# - 🔊 Text-to-Speech (TTS) to hear responses
# - Dark theme optimized for mobile

Repository check

Run a lightweight repo verification (syntax + /health probe) without external dependencies:

./scripts/repo_check.sh

The script starts a temporary server on port 8979 by default. Set OPENAI_API_KEY if you want to include the /chat smoke test.

Repository layout

cit/
├── README.md             # this file
├── .gitignore            # common ignores (.env, Python cache)
├── docs/
│   └── ARCHITECTURE.md   # high‑level architecture description
├── server/
│   └── cit_server.py     # main HTTP server implementation
└── scripts/
    ├── termux_bootstrap.sh    # optional helper to set up Termux environment
    └── termux_boot/cit_start.sh # script run by Termux Boot

Note: Operational scripts have been organized into scripts/ops/ and vault/sync scripts into scripts/vault/. See README files in those directories for details.

Web Interface (Cimeika)

In addition to the embedded UI served by the CIT server, there's a modern Next.js PWA interface called Cimeika in the /web directory.

Features:

  • 🎨 Beautiful dark theme optimized for mobile
  • 💬 Full-featured chat interface with AI
  • 🎙️ Speech-to-Text (Ukrainian)
  • 🔊 Text-to-Speech (Ukrainian)
  • 📱 PWA support (install as app)
  • 🎯 Menu system with multiple sections
  • 📊 Real-time health monitoring

Quick start:

# Start CIT server (required)
export OPENAI_API_KEY="your-api-key-here"
python server/cit_server.py

# In another terminal, start web app
cd web
npm install
npm run dev
# Open http://localhost:3000

See web/README_WEB.md for detailed documentation, deployment guides, and PWA setup.

🚀 Автоматичне розгортання

Веб-інтерфейс автоматично розгортається на Vercel при кожному push до main гілки.

Швидкий старт

  1. Налаштуйте Vercel токени — див. docs/VERCEL_SETUP.md
  2. Push код — деплой відбудеться автоматично
  3. Створіть PR — отримаєте preview URL для тестування

Локальне тестування

# Перевірити що збірка працює
./scripts/test-vercel-deploy.sh

# Деплой вручну (потрібен Vercel CLI)
npm install -g vercel
vercel --prod

Детальна документація: docs/VERCEL_SETUP.md

Copilot

GitHub Copilot development follows the canonical instructions defined in the ciwiki repository.

Key principles:

  • Anti-repeat: eliminate repeated actions
  • Single execution path through PR → verification → approval
  • Documentation first

See .github/copilot-instructions.md for the full instructions synchronized from ciwiki.

Development Process

Implementation Proposals

For significant features or architectural changes, CIT uses a structured proposal process:

  1. Create Proposal - Use the implementation proposal template
  2. Review - Submit PR for team review and feedback
  3. Implement - Build according to the approved proposal
  4. Verify - Test against acceptance criteria
  5. Document - Update CHANGELOG and documentation

Quick start:

# Create a new proposal
cp docs/IMPLEMENTATION_PROPOSAL_TEMPLATE.md docs/proposals/IMPL-$(date +%Y-%m-%d)-my-feature.md

# Edit the proposal and submit for review
git checkout -b proposal/my-feature
git add docs/proposals/IMPL-*-my-feature.md
git commit -m "Proposal: Add my feature"
git push origin proposal/my-feature

Resources:

See docs/PROPOSAL_GUIDE.md for detailed instructions.

License

This project is released under the MIT License. See LICENSE for details.

About

Ci home copilot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6