Metadata-Version: 2.4
Name: codetheory
Version: 0.1.3
Summary: Zero-dependency, multi-provider CLI AI agent with local GPU optimization, subagents, and safety guardrails.
Author: Guru Hemanth
License: MIT
Keywords: ai-agent,cli,ollama,claude,openai,devops,local-llm
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: flake8>=7.0; extra == "dev"
Requires-Dist: bandit>=1.7; extra == "dev"
Dynamic: license-file

# codetheory

A **zero-dependency**, multi-provider, cross-platform **CLI AI agent** with local GPU tuning (Ollama), native Anthropic `/v1/messages` & OpenAI-compatible support, isolated subagents, per-session chat history, and built-in security guardrails.

## Features
- **Zero Runtime Dependencies:** Pure Python 3.10+ standard library (`urllib`, `json`, `subprocess`, `difflib`).
- **15+ Providers:** Ollama (with WSL2 $\rightarrow$ Windows host auto-discovery & 4GB VRAM tuning), LM Studio, OpenAI, Anthropic (native `/v1/messages`), Gemini, Groq, OpenRouter, Mistral, DeepSeek, xAI, Together, Fireworks, Cerebras, NVIDIA NIM, or any custom OpenAI-compatible URL.
- **Cross-Shell & Multi-OS:** Auto-detects `bash`, `zsh`, `fish`, `sh`, `pwsh`, `powershell`, and `cmd`, plus `dnf`, `apt`, `pacman`, `zypper`, `apk`, `brew`, `winget`, `choco`, `pip`, and `npm`.
- **Full Tooling + Subagents:** `read_file`, `write_file` (atomic + diff preview), `edit_file` (unified diff preview), `list_dir`, `grep_search`, `find_files`, `run_command`, `install_package`, `delete_path` (recoverable trash + mandatory approval), `web_search`, `fetch_url`, and `spawn_subagent`.
- **Anthropic-Spec Agentic Loop:** Enforces `max_turns`, handles `end_turn` / `max_tokens` stops, and uses `LoopDetector` to prevent self-repeating tool loops and error spirals.
- **Security Hardening:** Automatic API key redaction in tool outputs/logs, SSRF blocking for cloud metadata/link-local IPs, protected OS path guards, and destructive/RCE command approval gates.
- **Interactive & Headless Modes:**
  - Interactive REPL with `/setup`, `/providers`, `/provider [name|#]`, `/key`, `/models`, `/settings`, `/history`, `/auto`, `/think`, `/gpu`, and `Tab` autocomplete.
  - Headless pipe/CI mode: `codetheory -p "your prompt"` or `git diff | codetheory -p "review this"`.
  - Auto-loads project rules from `AGENT.md` or `.agentrules` in the current directory.

## Installation
```bash
pip install -e .
# or with pipx / uv:
pipx install .
uv tool install .
```

## Quick Start
```bash
# Interactive mode
codetheory

# Headless / pipe mode
codetheory -p "summarize TODOs in src/"
git diff | codetheory -p "review this diff for bugs"
```
