runtime

module
v0.35.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: Apache-2.0

README

Contenox

AI workflows you can run, review, and own.

AI is becoming an integral part of software engineering. The critical question is whether it makes you sharper or merely more dependent.

Naive AI usage risks turning engineering judgment into rented fluency—highly useful while the model is strong, reachable, and affordable, but ephemeral. The durable value in software engineering has never been the typing; it is knowing what to build, knowing what changed, and maintaining the capacity to own the system when it breaks.

Contenox is built as an exoskeleton, not an autopilot. It amplifies the engineer doing the work. You remain firmly in the loop because the workflows, tools, state, and approval policies are entirely authored and reviewed by you.

What Contenox is not: It is not an autonomous coding employee, a hosted autopilot, or a prompt habit hidden away in your shell history. It is a local runtime for AI-assisted work that keeps an engineer in control.

Docs: contenox.com


For Work That Touches Real Systems

Contenox is purpose-built for high-consequence engineering environments: production repositories, internal APIs, infrastructure scripts, operational dashboards, release pipelines, and systems of record.

In these environments, an "AI agent" cannot mean "give a model broad credentials and hope for the best." It requires a strict runtime boundary:

  • Explicit tools & policies to govern actions.
  • Local state to preserve privacy.
  • Human-in-the-loop (HITL) approval for execution.
  • Reviewable evidence for auditing.

The core issue is not that agents can act; it is agents acting outside a boundary you author. The model can reason, inspect, and propose—but the Chain decides what it may touch, and the operator decides what it may change.


Install

curl -fsSL https://contenox.com/install.sh | sh

Inspect Before Installing

If you prefer to audit the installation script first:

curl -fsSLO https://contenox.com/install.sh
less install.sh
sh install.sh

Pre-built release downloads and source builds are also available on the releases page.


Quick Start

contenox setup                    # Choose a provider/model for this machine
contenox "say hello world in python"    # Query directly from the CLI
contenox chat -e                         # Open $EDITOR to compose a rich prompt

Manage past contexts effortlessly using contenox session list and contenox session switch <name>.

Smart Dual-Model Routing

Inline autocomplete runs on a dedicated model separate from the main chat. This ensures editor ghost text stays entirely local and ultra-low latency, while complex chat queries can leverage larger frontier models:

# Rich chat routed to a hosted model
contenox config set default-provider          openai
contenox config set default-model             gpt-5-mini

# Ghost text routed to a local model
contenox config set default-autocomplete-provider llama
contenox config set default-autocomplete-model    qwen3-coder-30b-a3b

To enable autocomplete in VS Code, run the command: Contenox: Enable Autocomplete.


Core Use Cases

Contenox excels when workflows are specific, repeatable, and require explicit guardrails:

  • Reviewing Diffs: Run tests, summarize architectural risks, and gate destructive operations behind manual approvals.
  • Drafting Release Evidence: Automatically aggregate git logs, PRs, issue tickets, and CI outputs into clean changelogs, deployment checklists, and reviewer packets.
  • Wrapping Internal APIs: Safely expose subsets of OpenAPI specs while masking sensitive tenant/environment arguments and requiring authorization for mutating calls.
  • Automating Repo Chores: Ingest an issue tracking item, generate a patch, run local validation checks, and draft the PR description.
  • Inspecting Live Operations: Query diagnostic dashboards, shell scripts, or Model Context Protocol (MCP) tools via tightly scoped policies rather than broad, persistent credentials.
  • Edge Autocomplete: Offload editor suggestions to local workstation models while maintaining high-powered reasoning in chat.

The exact same Chain runs seamlessly across the Terminal, VS Code, Zed, JetBrains, AionUi, or any standard ACP client.


Security & Runtime Protection

Identified Risk Contenox Mitigation
Fleeting Agent History Chains are declarative files: easily reviewable, version-controlled, and repeatable.
Unbounded Agent Access Enforced via strict tool allowlists, localized command policies, and tightly scoped API definitions.
Post-Damage Review Destructive actions are systematically blocked by human-in-the-loop approval gates prior to execution.
Leaky Internal APIs Curated OpenAPI subsets encapsulate hidden environment variables, auth tokens, and tenant arguments.
Vendor Lock-in Provider and model routing live in configuration files, entirely decoupled from application logic.
Frontier Model Budget Burn Routine tasks and linting checks are automatically routed to local or private-network infrastructure.
Exfiltration of Team Data All interactive sessions, states, configs, and runtime logs remain completely local.

Architectural Fit

Contenox serves as the local agent runtime layer running between your interface and your infrastructure.

Ecosystem The Contenox Paradigm
IDE Copilots Editor assistance is only one piece of the puzzle. Workflows must execute uniformly across the terminal, IDEs, and independent headless scripts.
CLI Coding Agents A single coding loop is not a structured runtime. Contenox adds multi-session persistence, strict tool authorization, explicit model routing, and human gates.
LangChain / Frameworks Software development libraries are not end-user products. Contenox provides an out-of-the-box executable runtime tailored for engineers and teams.
Dify / n8n / Web Tools Workflows touching local source code and specialized internal infrastructure should never depend on a third-party SaaS control plane.
Ollama Wrappers A model provider is not a workflow boundary. Contenox introduces native Chains, secure tool definitions, and dynamic routing across hybrid infrastructure.

Connect Your Stack

Any asset accessible via an OpenAPI spec, a shell command, or an MCP server can be transformed into a secure tool inside a Contenox Chain:

# Connect any Model Context Protocol (MCP) server
contenox mcp add notion https://mcp.notion.com/mcp --auth-type oauth

# Wrap an internal HTTP API using its OpenAPI specification
contenox tools add erp_billing \
  --url https://erp.internal.example.com \
  --spec ./billing-subset.yaml

# Bind the local shell under a strictly defined Chain policy
contenox --shell "check Proxmox and flag anything red"


Editor Integration

Contenox natively communicates via the Agent Client Protocol (ACP) over standard I/O.

Zed Integration

Add the following snippet to your ~/.config/zed/settings.json:

{
  "agent_servers": {
    "Contenox": {
      "type": "custom",
      "command": "contenox",
      "args": ["acp"]
    }
  }
}

Tool invocations render dynamically as interactive UI cards showing the underlying paths, human-in-the-loop prompts hook directly into the editor's native permissions, and full session history replays automatically upon reopening projects.

Other Environments
  • VS Code: Install the official Contenox Extension (ext install contenox.contenox-runtime).
  • Web Interface: Running contenox serve mounts your active sessions, chains, and backends locally inside Beam, the bundled web UI.

Step-by-step guides: Zed | JetBrains | AionUi.


Managing Backends

Routing rules are treated as system configuration, not application logic. Add hosted, local, or private network backends seamlessly:

# Private infrastructure & local inference
contenox backend add ollama --type ollama
contenox backend add myvllm --type vllm --url http://gpu-host:8000

# Commercial cloud providers
contenox backend add openai    --type openai    --api-key-env OPENAI_API_KEY
contenox backend add anthropic --type anthropic --api-key-env ANTHROPIC_API_KEY
contenox backend add gemini    --type gemini    --api-key-env GEMINI_API_KEY

# Set global operational routing defaults
contenox config set default-model     qwen3-8b
contenox config set default-provider  llama

Note on Local Inference: The native llama and openvino backends are driven by modeld, Contenox's local inference engine. While contenox init registers them, standard pre-compiled binary distributions do not yet bundle modeld out of the box. Using local modeld engines currently requires compiling from source: see the modeld Source Build Guide.


modeld System Architecture

The North Star: Routine tokens must be kept local, private, and cheap.

modeld represents Contenox’s vision for local inference: an architecture defined by a single owner, an active local model, persistent work sessions, and zero-latency resident context optimized for consumer workstation hardware.

Rather than treating context as an expensive prompt resent on every single turn, modeld optimizes for long-context execution via resident state:

  • Dedicated Compute Allocation: Device memory and KV budgets focus entirely on running a single model deep and fast, bypassing multi-tenant multiplexing penalties.
  • Warm-Reuse Sessions: Stably prefixed KV states are kept hot in memory. Only newly altered trailing suffixes are re-prefilled, radically dropping execution costs on massive repositories.
  • Durable Snapshot & Restore: Session graphs are branchable and persist across process Restarts, letting code context outlive terminal sessions.
  • Zero-Configuration Acceleration: Automatical detection of hardware capability at runtime ensures optimal offloading ratios and context window bounds with zero manual tuning.
Architecture Deep-Dives

Building From Source

Prerequisites
  • Go 1.25+
  • C/C++ compiler toolchain (for local engine bindings)
# Clone the repository
git clone https://github.com/contenox/runtime
cd runtime

# Build the main core CLI
make build-contenox

# Compile and run modeld with the llama.cpp backend
CONTENOX_MODELD_BACKEND=llama make run-modeld

# Compile and run modeld with the Intel OpenVINO backend
make deps-modeld
CONTENOX_MODELD_BACKEND=openvino make run-modeld


Core Dependencies

The contenox core CLI is written entirely in pure Go. Local inference runs out-of-process via the C/C++ modeld daemon, linking against the following upstream libraries:

Dependency System Role Licensing
llama.cpp GGUF inference optimization across CPU, CUDA, HIP, and Metal MIT
OpenVINO Hardware-accelerated runtime for CPU, iGPU, and NPU chips Apache-2.0
OpenVINO GenAI LLM pipelines built over foundational OpenVINO runtimes Apache-2.0
OpenVINO Tokenizers Specialized execution parsing for OpenVINO GenAI Apache-2.0
minja Jinja-style chat template engine (bundled in GenAI) MIT

Upstream license notices accompany all compiled artifacts in the /licenses and /LICENSES directories inside modeld packages (llama.cpp + OpenVINO components + NVIDIA CUDA EULA when applicable). This ensures compliance for public distribution via VS Code, registries, and Windows Store. Go dependencies are maintained standardly in go.mod.


Questions? Reach out at hello@contenox.com

Directories

Path Synopsis
Package apiframework provides HTTP request/response helpers for the Contenox API.
Package apiframework provides HTTP request/response helpers for the Contenox API.
cmd
contenox command
Contenox CLI: run task chains locally with SQLite-backed state.
Contenox CLI: run task chains locally with SQLite-backed state.
modeld command
Command modeld is the contenox model daemon: the per-user, per-data-root owner of resident model state.
Command modeld is the contenox model daemon: the per-user, per-data-root owner of resident model state.
Package libauth provides secure authentication and authorization services using JWT tokens.
Package libauth provides secure authentication and authorization services using JWT tokens.
Package bus provides an interface for core publish-subscribe messaging.
Package bus provides an interface for core publish-subscribe messaging.
Package libcipher provides a collection of cryptographic utilities for encryption, decryption, integrity verification, and secure key generation.
Package libcipher provides a collection of cryptographic utilities for encryption, decryption, integrity verification, and secure key generation.
3.
Package liblease implements a cooperative, time-bounded file lease: a single-holder lock backed by an ordinary file, not an OS primitive.
Package liblease implements a cooperative, time-bounded file lease: a single-holder lock backed by an ordinary file, not an OS primitive.
Package routine provides utilities for managing recurring tasks (routines) with circuit breaker protection.
Package routine provides utilities for managing recurring tasks (routines) with circuit breaker protection.
modeld
capacity
Package capacity is modeld's hardware capacity planner: it resolves the EFFECTIVE context window a model can actually be served at on this device, from the model's KV-cache footprint and the device's free memory — not the model's trained ceiling alone.
Package capacity is modeld's hardware capacity planner: it resolves the EFFECTIVE context window a model can actually be served at on this device, from the model's KV-cache footprint and the device's free memory — not the model's trained ceiling alone.
devicelease
Package devicelease guards physical accelerator residency across modeld data roots.
Package devicelease guards physical accelerator residency across modeld data roots.
internal/sessionkit
Package sessionkit holds the small backend-neutral helpers shared by the modeld transport.Session adapters (llama.cpp in modeld/llama/llamasession and OpenVINO in modeld/openvino).
Package sessionkit holds the small backend-neutral helpers shared by the modeld transport.Session adapters (llama.cpp in modeld/llama/llamasession and OpenVINO in modeld/openvino).
llama
Package llama defines the modeld-side llama backend contract: persistent inference sessions keep a stable prefix's KV hot and re-prefill only the changed suffix.
Package llama defines the modeld-side llama backend contract: persistent inference sessions keep a stable prefix's KV hot and re-prefill only the changed suffix.
llama/llamacppshim
Package llamacppshim owns the direct llama.cpp C API boundary for modeld.
Package llamacppshim owns the direct llama.cpp C API boundary for modeld.
llama/llamasession
Capability mapping kept in an untagged, cgo-free file so the backend-parity contract can pin it verbatim in plain CI: capability drift must fail there, not only in tagged native builds.
Capability mapping kept in an untagged, cgo-free file so the backend-parity contract can pin it verbatim in plain CI: capability drift must fail there, not only in tagged native builds.
modelstore
Package modelstore resolves model names to on-disk paths within a modeld node's models directory.
Package modelstore resolves model names to on-disk paths within a modeld node's models directory.
openvino
Package openvino implements the runtime/transport.Service boundary for the OpenVINO (Intel) backend: it opens persistent, manifest-keyed sessions on the owned device (CPU / GPU) that the runtime drives over the transport.
Package openvino implements the runtime/transport.Service boundary for the OpenVINO (Intel) backend: it opens persistent, manifest-keyed sessions on the owned device (CPU / GPU) that the runtime drives over the transport.
openvino/ovsession
Package ovsession contains the native OpenVINO session/KV bridge used by the openvino modelrepo provider.
Package ovsession contains the native OpenVINO session/KV bridge used by the openvino modelrepo provider.
owner
Package owner manages lease-based ownership of the local runtime's resident state.
Package owner manages lease-based ownership of the local runtime's resident state.
residency
Package residency contains modeld's backend-neutral KV residency policy.
Package residency contains modeld's backend-neutral KV residency policy.
slot
Package slot enforces modeld's single active local model invariant.
Package slot enforces modeld's single active local model invariant.
runtime
archiveutil
Package archiveutil provides shared, path-traversal-safe archive extraction.
Package archiveutil provides shared, path-traversal-safe archive extraction.
benchreport
Package benchreport is the common local-node benchmark report: one JSON shape emitted across every backend/model/hardware profile so runtime latency and warm-reuse claims stay honest.
Package benchreport is the common local-node benchmark report: one JSON shape emitted across every backend/model/hardware profile so runtime latency and warm-reuse claims stay honest.
chatservice
Package chatservice persists the conversation thread.
Package chatservice persists the conversation thread.
contenoxcli
backends.go contains helpers for LLM backend and provider config KV storage.
backends.go contains helpers for LLM backend and provider config KV storage.
hitlservice
Package hitlservice evaluates approval policies for tool calls.
Package hitlservice evaluates approval policies for tool calls.
internal/hostcapacity
Package hostcapacity gives the CLI a best-effort, pre-install estimate of how much memory a curated model would have to fit in on this machine.
Package hostcapacity gives the CLI a best-effort, pre-install estimate of how much memory a curated model would have to fit in on this machine.
internal/modeldinstall
Package modeldinstall discovers, downloads, verifies, installs, and validates a prebuilt modeld package for the current machine.
Package modeldinstall discovers, downloads, verifies, installs, and validates a prebuilt modeld package for the current machine.
internal/modeldprobe
Package modeldprobe detects whether the modeld daemon (the separate CGO inference binary) is installed, running, or dead, so the runtime can fail honestly and the setup wizard can guide the user.
Package modeldprobe detects whether the modeld daemon (the separate CGO inference binary) is installed, running, or dead, so the runtime can fail honestly and the setup wizard can guide the user.
internal/setupcheck
Package setupcheck evaluates local runtime readiness (defaults, backends) for the CLI.
Package setupcheck evaluates local runtime readiness (defaults, backends) for the CLI.
internal/tools
internal/tools/multi_repo.go
internal/tools/multi_repo.go
internal/web
Package web serves the embedded Beam React SPA from the contenox binary.
Package web serves the embedded Beam React SPA from the contenox binary.
llmrepo
Package llmrepo provides a unified facade over LLM backends discovered via runtimestate: prompt, chat, streaming, embedding, and tokenization through a single ModelRepo interface.
Package llmrepo provides a unified facade over LLM backends discovered via runtimestate: prompt, chat, streaming, embedding, and tokenization through a single ModelRepo interface.
localtools
Package localtools provides tools that fire around chain execution: approval gates and host-side helpers.
Package localtools provides tools that fire around chain execution: approval gates and host-side helpers.
localtools/mcpoauth
Package mcpoauth implements the MCP OAuth 2.1 Authorization Code + PKCE flow for CLI clients.
Package mcpoauth implements the MCP OAuth 2.1 Authorization Code + PKCE flow for CLI clients.
mcpserverservice
Package mcpserverservice stores MCP server configs.
Package mcpserverservice stores MCP server configs.
mcpworker
Package mcpworker keeps MCP server connections alive across chain steps.
Package mcpworker keeps MCP server connections alive across chain steps.
modelrepo
Package modelrepo defines the provider-facing contracts for LLM backends: the Provider interface (capabilities + client factories), the per-capability client interfaces (LLMPromptExecClient, LLMChatClient, LLMEmbedClient, LLMStreamClient), and the shared request/response types (Message, ChatResult, StreamParcel, Tool, ChatArgument).
Package modelrepo defines the provider-facing contracts for LLM backends: the Provider interface (capabilities + client factories), the per-capability client interfaces (LLMPromptExecClient, LLMChatClient, LLMEmbedClient, LLMStreamClient), and the shared request/response types (Message, ChatResult, StreamParcel, Tool, ChatArgument).
modelrepo/anthropic
Package anthropic is a direct (non-Vertex) provider for the Anthropic API (api.anthropic.com), which speaks the Messages API.
Package anthropic is a direct (non-Vertex) provider for the Anthropic API (api.anthropic.com), which speaks the Messages API.
modelrepo/bedrock
Package bedrock is a provider for AWS Bedrock via the unified Converse API.
Package bedrock is a provider for AWS Bedrock via the unified Converse API.
modelrepo/codec/chatcompletions
Package chatcompletions is a transport-agnostic codec for the OpenAI Chat Completions wire format (`/chat/completions`-style request/response and SSE streaming).
Package chatcompletions is a transport-agnostic codec for the OpenAI Chat Completions wire format (`/chat/completions`-style request/response and SSE streaming).
modelrepo/codec/messages
Package messages is a transport-agnostic codec for Anthropic's Messages API wire format (request, content-block response, and named-SSE-event streaming).
Package messages is a transport-agnostic codec for Anthropic's Messages API wire format (request, content-block response, and named-SSE-event streaming).
modelrepo/gemini
Package gemini implements the modelrepo.Provider contract against Google's Gemini Generative Language API.
Package gemini implements the modelrepo.Provider contract against Google's Gemini Generative Language API.
modelrepo/llama
Package llama is the graduated local coding-node runtime: a persistent, workspace-scoped inference session that keeps a stable prefix's KV hot and re-prefills only the changed suffix (the live warm-reuse hot path), distinct from the toy fixed-constant `local` provider.
Package llama is the graduated local coding-node runtime: a persistent, workspace-scoped inference session that keeps a stable prefix's KV hot and re-prefills only the changed suffix (the live warm-reuse hot path), distinct from the toy fixed-constant `local` provider.
modelrepo/mistral
Package mistral is a direct (non-Vertex) provider for the Mistral API (api.mistral.ai), which speaks the OpenAI-compatible chat/completions format.
Package mistral is a direct (non-Vertex) provider for the Mistral API (api.mistral.ai), which speaks the OpenAI-compatible chat/completions format.
modelrepo/modeldconn
Package modeldconn is the runtime's client seam to the modeld daemon: it resolves the current lease leader (via modeldprobe), dials it over the gRPC transport, and opens sessions.
Package modeldconn is the runtime's client seam to the modeld daemon: it resolves the current lease leader (via modeldprobe), dials it over the gRPC transport, and opens sessions.
modelrepo/ollama
Package ollama implements the modelrepo.Provider contract against Ollama HTTP endpoints.
Package ollama implements the modelrepo.Provider contract against Ollama HTTP endpoints.
modelrepo/openai
Package openai implements the modelrepo.Provider contract against the OpenAI HTTP API and OpenAI-compatible endpoints.
Package openai implements the modelrepo.Provider contract against the OpenAI HTTP API and OpenAI-compatible endpoints.
modelrepo/openrouter
Package openrouter is a catalog provider for OpenRouter (openrouter.ai), which exposes 300+ models from many providers through a single OpenAI-compatible endpoint.
Package openrouter is a catalog provider for OpenRouter (openrouter.ai), which exposes 300+ models from many providers through a single OpenAI-compatible endpoint.
modelrepo/openvino
Package openvino is the runtime-side modelprovider for OpenVINO (Intel) local inference.
Package openvino is the runtime-side modelprovider for OpenVINO (Intel) local inference.
modelrepo/vertex
Package vertex implements the modelrepo.Provider contract against Google Vertex AI publisher endpoints, using OAuth bearer tokens minted from service-account credentials.
Package vertex implements the modelrepo.Provider contract against Google Vertex AI publisher endpoints, using OAuth bearer tokens minted from service-account credentials.
modelrepo/vllm
Package vllm implements the modelrepo.Provider contract against vLLM OpenAI-compatible HTTP endpoints.
Package vllm implements the modelrepo.Provider contract against vLLM OpenAI-compatible HTTP endpoints.
ollamatokenizer
Package ollamatokenizer provides Tokenizer implementations used by llmrepo to count and split tokens for a given model.
Package ollamatokenizer provides Tokenizer implementations used by llmrepo to count and split tokens for a given model.
runtimestate
Package runtimestate reconciles the declared state of LLM backends (from dbInstance) with their actual observed state.
Package runtimestate reconciles the declared state of LLM backends (from dbInstance) with their actual observed state.
sessionservice
Package sessionservice stores CLI chat sessions so conversations persist across terminal restarts.
Package sessionservice stores CLI chat sessions so conversations persist across terminal restarts.
taskengine
Package taskengine orchestrates an agent: it drives LLM turns, tool calls, and routing in a loop, defined as a JSON chain you version in git.
Package taskengine orchestrates an agent: it drives LLM turns, tool calls, and routing in a loop, defined as a JSON chain you version in git.
taskengine/llmretry
Package llmretry wraps a single LLM call with classified retry, exponential backoff, and an optional model fallback.
Package llmretry wraps a single LLM call with classified retry, exponential backoff, and an optional model fallback.
transport
Package transport defines the contract the modeld daemon implements and the runtime calls: a persistent, manifest-keyed warm-reuse inference session.
Package transport defines the contract the modeld daemon implements and the runtime calls: a persistent, manifest-keyed warm-reuse inference session.
transport/grpc
Package grpc is the gRPC wire transport for the runtime/transport.Service contract.
Package grpc is the gRPC wire transport for the runtime/transport.Service contract.
tools
openapi-gen command
Command openapi-gen generates runtime/internal/openapidocs/openapi.json from the HTTP route registrations and the inline annotations in the route packages.
Command openapi-gen generates runtime/internal/openapidocs/openapi.json from the HTTP route registrations and the inline annotations in the route packages.
version command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL