Skip to main content

TheCode

AI Software Engineer for your terminal.

TheCode is a provider-independent coding agent with a full-screen terminal workbench. It can understand a repository, search and read code, propose plans, edit files with approval, run commands and tests, inspect Git changes, and preserve local sessions.

Created by Inacio Sacataria.

PyPI version Python License: MIT

TheCode can modify files and execute approved commands. Use version control, review permission prompts, and never share API keys.

Highlights

  • Premium Textual and Rich terminal interface
  • Streaming assistant responses and live tool activity
  • Preview, Diff, Files, Architecture, Terminal, and Logs panels
  • Tool inspector with arguments, output, status, and duration
  • Permission modes for safe, interactive, or more autonomous work
  • OpenRouter free models by default, plus OpenAI, Anthropic, and local Ollama support
  • Git-aware repository analysis and session history
  • Multi-folder .code-workspace support
  • @file context, project rules, skills, and AGENTS.md support
  • Sensitive-file protection for .env, private keys, and credentials
  • Windows, Linux, and macOS support

Requirements

  • Python 3.12 or newer
  • Git
  • Ripgrep is recommended for fast search
  • An API key for OpenAI or Anthropic; OpenRouter can start on free models without a key, and Ollama can run locally without one

Install

The recommended installation uses pipx, which keeps CLI applications isolated:

pipx install thecode-agent

If pipx is not installed:

python -m pip install --user pipx
python -m pipx ensurepath

Alternatively, install with pip:

python -m pip install thecode-agent

Upgrade later with:

pipx upgrade thecode-agent
# or: python -m pip install --upgrade thecode-agent

First run

Open a terminal in the project you want TheCode to work on:

cd path/to/your/project
thecode config --setup
thecode doctor
thecode

The setup wizard asks for a provider, model, optional API key, and permission mode. OpenRouter starts on openrouter/free by default, and other providers store credentials in the project .env; that file should remain ignored by Git.

Inside the workbench, type a request:

Create a small REST API for managing fruits and add tests.

Type / to discover interactive commands. Use @path/to/file.py to attach a specific file to the request.

Providers

Provider Credential Example model
OpenRouter Optional on free models openrouter/free
OpenAI OPENAI_API_KEY Provider model identifier
Anthropic ANTHROPIC_API_KEY Provider model identifier
Ollama No key required Any locally installed model

Run the setup wizard again at any time:

thecode config --setup

Never commit .env or paste credentials into chat, issues, logs, or documentation. Revoke any key that has been exposed.

Workbench controls

Key Action
Enter Send the request
Ctrl+P Quick Open a file
Ctrl+K Open the command center
Ctrl+T Ask the agent to run relevant tests
Ctrl+R Run the previous request again
Ctrl+L Clear the conversation view
Esc Cancel the current operation
Ctrl+Q Exit TheCode

When typing /, suggestions are filtered as you type. Press Down and Enter, click an option, or press Tab to accept the first suggestion.

Useful interactive commands:

/commands
/config
/models
/architect OBJECTIVE
/theme NAME
/workspace NAME
/processes
/session
/clear
/exit

/architect performs a read-only Current/Proposed architecture analysis. TheCode only starts implementation after you select Apply architecture.

Author and support

Author: Inacio Sacataria

If you want to support the project, set a donate URL and use the new CLI command:

$env:THECODE_DONATE_URL="https://your-donate-link.example"
thecode donate

Inside the workbench, use /about to show the author and /donate to show the support link.

CLI commands

The full-screen workbench is the default, but commands can also be run directly:

thecode
thecode chat
thecode chat --classic
thecode ask "How does authentication work?"
thecode plan "Migrate JWT authentication 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 delete-session SESSION_ID
thecode theme

Permission modes

  • safe: reads are automatic; writes and commands require confirmation.
  • ask: reads are automatic; mutating actions request approval.
  • auto: lower-risk operations can run automatically; high-risk actions still ask and critical actions remain blocked.

Permission prompts support Allow once, Allow for this session, and Deny. Destructive and critical operations remain restricted.

Project instructions and context

Initialize optional project configuration and an instruction file:

thecode init

This creates .nexus/config.yaml and NEXUS.md without overwriting existing files. TheCode also understands common agent instructions including AGENTS.md, AGENT.md, CLAUDE.md, .cursorrules, Cursor rules, and SKILL.md files.

Configuration is loaded from ~/.nexus/config.yaml, then overridden by the current project's .nexus/config.yaml.

Example:

llm:
  provider: openrouter
  model: openrouter/free
agent:
  max_steps: 30
permissions:
  mode: ask
context:
  max_characters: 120000

Workspaces

TheCode detects a .code-workspace file and supports multiple project folders:

thecode workspace open platform.code-workspace
thecode workspace list platform.code-workspace
thecode workspace add ../backend --path platform.code-workspace

Inside the workbench, use /workspace NAME to switch the active folder.

Sessions and recovery

Sessions are stored locally in ~/.nexus/sessions.db.

thecode sessions
thecode resume SESSION_ID
thecode undo SESSION_ID
thecode delete-session SESSION_ID

undo refuses to overwrite a file that was subsequently changed by the user.

Troubleshooting

Run diagnostics first:

thecode doctor

If the thecode command is not found, restart the terminal after installing with pipx, or run:

python -m pipx ensurepath

If an older editable installation takes precedence, uninstall the previous package and reinstall:

python -m pip uninstall thecode-agent -y
python -m pip install --upgrade thecode-agent

For a clean onboarding reset, close TheCode first and remove its local state. This does not remove your source code:

# PowerShell
Remove-Item -Recurse -Force .nexus -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$HOME\.nexus" -ErrorAction SilentlyContinue
thecode config --setup

API keys stored in .env or operating-system environment variables are not deleted by this reset.

Security

Paths are resolved against the active project, including symlinks. Sensitive files are hidden from automatic previews, Quick Open, project trees, and @file attachments. Commands use argument arrays rather than shell=True; unsupported shell operators and destructive patterns are blocked. File changes preserve recovery metadata.

Security reports should not contain live credentials, private keys, or proprietary source code.

Development

Clone the repository and install the development dependencies:

python -m venv .venv
source .venv/bin/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"

Run the quality checks:

ruff check nexus tests
mypy nexus
pytest

HTTP provider tests use mocked transports and do not require live API access.

License

TheCode is available under the MIT License.

Metadata

Release files for thecode-agent 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for thecode-agent 0.1.2
File Size Uploaded Provenance
thecode_agent-0.1.2.tar.gz 78.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for thecode-agent 0.1.2
File Interpreter ABI Platform
thecode_agent-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 170.4 kB

Release files / thecode_agent-0.1.2.tar.gz

Download URL thecode_agent-0.1.2.tar.gz
Size 78.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c322d207c97a941a3f078fc2775d44702335e6d2a8213a46ac4cc6eb959a485a
BLAKE2b-256 checksum
How to use checksums
7368f483310b38e7672ed9a5a5424306d522300bd8630cd5c3160c6c13944517
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / thecode_agent-0.1.2-py3-none-any.whl

Download URL thecode_agent-0.1.2-py3-none-any.whl
Size 92.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7965d80457bd7c1f358cebdefe37d52f333c0a1afcf6d537fbd19f97a66bc7d
BLAKE2b-256 checksum
How to use checksums
06277b9fbcdaeb0cb4e515315b40f7fd5ee7e28cad1087bd59381feca1c6e8e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for thecode-agent 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page