A secure, provider-independent coding agent for the terminal
Project description
TheCode
TheCode is a provider-independent AI coding agent with a premium Textual terminal interface. It can inspect code, search files, plan changes, edit files with approval, execute bounded commands, run tests, analyze Git, and retain local session history.
TheCode is an early product foundation. Review proposed actions and keep important work under version control.
Requirements and installation
- Python 3.12+
- Git
- Ripgrep is recommended
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
cp .env.example .env
thecode config --setup
thecode doctor
Usage
thecode
thecode chat
thecode ask "how does authentication work?"
thecode plan "migrate JWT to OAuth2"
thecode run "fix the failing tests"
thecode review
thecode init
thecode config
thecode models
thecode sessions
thecode resume SESSION_ID
thecode undo SESSION_ID
thecode init creates .nexus/config.yaml and NEXUS.md without overwriting existing files. The former tablutech and nexus commands remain compatibility aliases.
Configuration
Global configuration is read from ~/.nexus/config.yaml; project configuration from .nexus/config.yaml takes precedence. Provider secrets belong in environment variables, never YAML.
llm:
provider: openrouter
model: anthropic/claude-sonnet-4
agent:
max_steps: 30
permissions:
mode: ask
context:
max_characters: 120000
Supported providers are OpenRouter, OpenAI, Anthropic, and Ollama. Set the corresponding key from .env.example.
Run thecode config --setup to choose the provider and model interactively. API keys are
entered with hidden input and stored only in the project .env, which is ignored by Git.
Safety model
Every path is resolved against the project root, including symlinks. Sensitive files require explicit authorization. Commands use argument arrays, never shell=True; shell operators and destructive patterns are blocked. Write tools preserve previous content, and session rollback refuses to overwrite subsequent user edits.
Permission modes:
safe: reads are automatic; writes and commands require confirmation.ask: reads are automatic; mutating actions request approval.auto: low-risk operations are automatic; high-risk actions still ask and critical actions remain blocked.
Architecture
The CLI composes an agent loop, a provider-neutral LLM interface, a typed tool registry, deterministic permission/security layers, repository services, and SQLite session storage. Providers normalize their native tool-call formats into LLMResponse; tools expose Pydantic JSON schemas and return ToolResult. This keeps provider, UI, and execution concerns independent.
Project instruction priority is NEXUS.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md, then README.md.
Development
ruff check .
mypy nexus
pytest
HTTP providers are designed for httpx.MockTransport; tests do not require live API access.
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 thecode_agent-0.1.0.tar.gz.
File metadata
- Download URL: thecode_agent-0.1.0.tar.gz
- Upload date:
- Size: 56.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa4d1bf93c619e22bf29fdab8c4a6c2ecbc79177e6de5b0ea0961ed299b1ce39
|
|
| MD5 |
e1a9e23e75e0741fd97d6f05afb35b1d
|
|
| BLAKE2b-256 |
3f8f6a81dea58a4535aadabf0ab8b35c9646bbffdb355d8ec6cf1b1917d8d11e
|
File details
Details for the file thecode_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: thecode_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 72.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
484db97d2200465a62eb3cc0d0a3e483c8a74d4e6397427bcde03f1435c4e45c
|
|
| MD5 |
230848819ce752d1738acfc9a8099141
|
|
| BLAKE2b-256 |
37331c98b27fb142a4e2443005e328b0cafe14bad40c3976114a45d0d4e68a2f
|