contenox

module
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0

README ΒΆ

Contenox

Go License Version

πŸ“– Read the full documentation at contenox.com

Industrial-grade AI automation, right at your fingertips.

Built for environments where you can't just copy-paste from a browser window. Contenox is a fully-local CLI that turns natural language goals into persistent, step-by-step plans and executes them safely using real shell and filesystem tools. Powered by any LLM (Ollama, OpenAI, Gemini, vLLM, etc.). Zero cloud required.

$ contenox plan new "install a git pre-commit hook that prevents commits when go build fails"
Creating plan "install-a-git-pre-commit-a3f9e12b" with 5 steps. Now active.

$ contenox plan next --auto
Executing Step 1: Install necessary tools...              βœ“
Executing Step 2: Create .git/hooks/pre-commit...         βœ“
Executing Step 3: Edit the hook script with the check...  βœ“
Executing Step 4: Write bash content to the hook file...  βœ“
Executing Step 5: chmod +x .git/hooks/pre-commit...       βœ“

No pending steps. Plan is complete!

The model wrote that hook. On your machine. No copy-paste hell.


⭐ Leave a star if you like it, and we welcome contributions!


🌐 contenox beam β€” Web UI + API server

When you want a browser UI on top of the same runtime:

contenox beam

Starts the full Contenox HTTP server and serves the Beam React app (task chains, admin, hooks, MCP, and more). Use contenox chat, contenox plan, and contenox run from the terminal when you prefer the CLI.

Beam login (/login): default username admin, password admin (local dev; see the quickstart for context).


Why Contenox?

Contenox is different:

  • Persistent plans stored in SQLite β€” pause, inspect, retry, replan at any time
  • Human-in-the-loop by default β€” --auto only when you say so
  • Real tools β€” shell commands and filesystem, not just code suggestions
  • Fully offline with Ollama β€” no data leaves your machine
  • Chains are just JSON β€” write your own LLM workflows
  • Industrial-Grade State Machine β€” Under the hood, Contenox is a robust workflow engine, not a brittle chat-loop wrapper. Plans survive reboots and network drops.
  • Native MCP Support β€” connect to local filesystems, memory servers, and remote tools instantly via the Model Context Protocol.

πŸ”Œ Universal Tooling with MCP

Contenox is a native Model Context Protocol (MCP) client. Instead of writing custom integrations, you can instantly connect your local agent to any MCP-compatible data source, persistent memory, or tool API.

# Give your agent access to the local filesystem
contenox mcp add filesystem --transport stdio \
  --command npx --args "-y,@modelcontextprotocol/server-filesystem,/"

# Give your agent a persistent memory graph across reboots
contenox mcp add memory --transport stdio \
  --command npx --args "-y,@modelcontextprotocol/server-memory"

# Connect to cloud tools securely over SSE
contenox mcp add cloud-tools --transport sse --url https://api.example.com/mcp

Every registered MCP server becomes natively available to your agent during chat sessions and execution plans.


πŸ›  Turn Any API into an Agent Tool

Don't need the MCP ecosystem? Expose any HTTP API as an agent tool in seconds with contenox hook add. Write a FastAPI service β€” Contenox reads its OpenAPI schema and makes every endpoint callable by the model, with no extra glue code.

# Register your FastAPI service as a tool
contenox hook add my-api --url http://localhost:8000

# The model can now call any endpoint on it directly as a tool
contenox run "fetch the latest metrics from my API and summarize them"

Any service that speaks HTTP and exposes an OpenAPI spec becomes a first-class agent tool.


Quick Start

Install

Ubuntu / Linux

TAG=$(curl -sL https://api.github.com/repos/contenox/contenox/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
curl -sL "https://github.com/contenox/contenox/releases/download/${TAG}/contenox-${TAG}-linux-${ARCH}" -o contenox
chmod +x contenox && sudo mv contenox /usr/local/bin/contenox
contenox --version

macOS

TAG=$(curl -sL https://api.github.com/repos/contenox/contenox/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/arm64/arm64/')
curl -sL "https://github.com/contenox/contenox/releases/download/${TAG}/contenox-${TAG}-darwin-${ARCH}" -o contenox
chmod +x contenox && sudo mv contenox /usr/local/bin/contenox
contenox --version

Or pick a binary from Releases.

First run
# 1. Initialize (creates .contenox/ with default chains)
contenox init

# 2. Register a backend
ollama serve && ollama pull qwen2.5:7b
contenox backend add local --type ollama
contenox config set default-model qwen2.5:7b

# Or for OpenAI / Gemini:
# contenox backend add openai --type openai --api-key-env OPENAI_API_KEY
# contenox config set default-model gpt-5-mini

# 3. Chat with your model:
contenox "hey, what can you do?"
echo 'fix the typos in README.md' | contenox

# 4. Plan and execute a multi-step task:
contenox plan new "create a TODOS.md from all TODO comments in the codebase"
contenox plan next --auto

Requirements: an LLM with tool calling support. Local: ollama serve && ollama pull qwen2.5:7b Cloud: register a backend with contenox backend add and set your API key via --api-key-env.


Full example
# 1. Create
contenox plan new "install a git pre-commit hook that blocks commits when go build fails"

# 2. Review the plan before touching anything
contenox plan show

# 3. Execute one step at a time
contenox plan next
contenox plan next
# ...

# Or run everything at once once you trust it
contenox plan next --auto

# 4. If a step went wrong
contenox plan retry 3

# 5. Final check
contenox plan show

contenox plan β€” AI-driven plans

contenox plan new "migrate all TODO comments in the codebase to TODOS.md"
contenox plan new "set up a git pre-commit hook that blocks commits when go build fails"
contenox plan new "find all .go files larger than 500 lines and write a refactoring report"

Contenox breaks any goal into an ordered plan, then executes it step by step using real tools.

Commands
Command What it does
contenox plan next Run one step (safe default β€” review before continuing)
contenox plan next --auto Run all remaining steps autonomously
contenox plan show See the active plan + step status
contenox plan list All plans (* = active)
contenox plan retry <N> Re-run a failed step
contenox plan skip <N> Mark a step skipped and move on
contenox plan replan Let the model rewrite the remaining steps
contenox plan delete <name> Delete a plan by name
contenox plan clean Delete all completed plans

Pro tip: Always do contenox plan show before --auto.


contenox chat β€” Persistent chat session
contenox chat "what is my current working directory?"
contenox chat "list files in my home directory"
echo "explain this" | contenox chat

Uses .contenox/default-chain.json. Natural language β†’ shell tools β†’ response.

contenox run β€” Scriptable, stateless execution

For CI/pipelines where you want full control:

contenox run --chain .contenox/my-chain.json "what is 2+2?"
cat diff.txt | contenox run --chain .contenox/review.json --input-type chat
contenox run --chain .contenox/doc-chain.json --input @main.go
contenox run --chain .contenox/parse-chain.json --input-type json '{"key":"value"}'

run is stateless β€” no chat history. --chain is required. Supported --input-type: string (default), chat, json, int, float, bool.

🧠 Reasoning model support

Pass --think to stream the model's internal chain-of-thought to stderr before it acts β€” works with DeepSeek-R1, OpenAI o3, Gemini Thinking, and Ollama thinking models:

contenox --think "why is my API slow?"
contenox run --chain .contenox/review.json --think --input @main.go

Configuration

Contenox stores all configuration in SQLite (.contenox/local.db or ~/.contenox/local.db). No YAML file needed β€” register backends and set defaults using CLI commands.

Register a backend
# Local Ollama (URL inferred automatically)
contenox backend add local --type ollama

# OpenAI (base URL inferred)
contenox backend add openai --type openai --api-key-env OPENAI_API_KEY

# Google Gemini
contenox backend add gemini --type gemini --api-key-env GEMINI_API_KEY

# Self-hosted vLLM or compatible endpoint
contenox backend add myvllm --type vllm --url http://gpu-host:8000
Set persistent defaults
contenox config set default-model    qwen2.5:7b
contenox config set default-provider ollama
contenox config set default-chain    .contenox/default-chain.json

contenox config list   # review current settings
Manage backends
contenox backend list
contenox backend show openai
contenox backend remove myvllm
Backend --type Notes
Ollama ollama Local. ollama serve first.
OpenAI openai Use --api-key-env OPENAI_API_KEY
Gemini gemini Use --api-key-env GEMINI_API_KEY
vLLM vllm Self-hosted OpenAI-compatible endpoint

Safety

  • Opt-in shell access β€” --shell flag must be passed explicitly to enable local_shell
  • Chain-scoped policy β€” allowed and denied commands are declared in the chain's hook_policies field; the default chains ship with a sensible allowlist out of the box
  • Human-in-the-loop β€” plan next executes one step and stops; --auto requires explicit intent
  • Local-first β€” with Ollama, nothing leaves your machine

Build from source

git clone https://github.com/contenox/contenox
cd contenox
go build -o contenox ./cmd/contenox
contenox init

Questions or feedback: hello@contenox.com

Directories ΒΆ

Path Synopsis
Package apiframework provides HTTP request/response helpers used by the runtime API.
Package apiframework provides HTTP request/response helpers used by the runtime API.
Package chatservice provides chat session management and message persistence.
Package chatservice provides chat session management and message persistence.
Package chatsessionmodes orchestrates a single chat turn: mode resolution, context injection, chain execution, and persistence.
Package chatsessionmodes orchestrates a single chat turn: mode resolution, context injection, chain execution, and persistence.
cmd
contenox command
Contenox CLI: run task chains locally with SQLite-backed state and optional Beam server.
Contenox CLI: run task chains locally with SQLite-backed state and optional Beam server.
core module
Package hitlservice manages HITL (human-in-the-loop) policy evaluation and in-flight approval gate management for tool calls that require human review.
Package hitlservice manages HITL (human-in-the-loop) policy evaluation and in-flight approval gate management for tool calls that require human review.
internal
approvalapi
Package approvalapi provides the HTTP endpoint for resolving HITL approval requests emitted by localhooks.HITLWrapper.
Package approvalapi provides the HTTP endpoint for resolving HITL approval requests emitted by localhooks.HITLWrapper.
authapi
Package usersapi provides HTTP handlers for user authentication and management.
Package usersapi provides HTTP handlers for user authentication and management.
clikv
Package clikv reads and writes contenox CLI settings in SQLite KV (prefix "cli.").
Package clikv reads and writes contenox CLI settings in SQLite KV (prefix "cli.").
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.
hitlpolicyapi
Package hitlpolicyapi provides CRUD HTTP routes for named HITL policy files stored in VFS.
Package hitlpolicyapi provides CRUD HTTP routes for named HITL policy files stored in VFS.
hooks
internal/hooks/multi_repo.go
internal/hooks/multi_repo.go
mcpserverapi
Package mcpserverapi exposes REST endpoints for managing MCP server configurations.
Package mcpserverapi exposes REST endpoints for managing MCP server configurations.
openapidocs
Package openapidocs serves the OpenAPI specification and API browser embedded in the binary.
Package openapidocs serves the OpenAPI specification and API browser embedded in the binary.
runtimestate
runtimestate implements the core logic for reconciling the declared state of LLM backends (from dbInstance) with their actual observed state.
runtimestate implements the core logic for reconciling the declared state of LLM backends (from dbInstance) with their actual observed state.
setupapi
Package setupapi exposes REST routes for Beam onboarding (readiness + CLI defaults in KV).
Package setupapi exposes REST routes for Beam onboarding (readiness + CLI defaults in KV).
setupcheck
Package setupcheck evaluates local runtime readiness (defaults, backends) for Beam and CLI.
Package setupcheck evaluates local runtime readiness (defaults, backends) for Beam and CLI.
vfsapi
Package vfsapi provides HTTP handlers for file and folder management.
Package vfsapi provides HTTP handlers for file and folder management.
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 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.
libs
libauth module
libdb module
libollama module
Package localhooks provides local hook integrations.
Package localhooks provides local hook integrations.
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.
Package mcpserverservice provides CRUD operations for MCP server configurations.
Package mcpserverservice provides CRUD operations for MCP server configurations.
Package mcpworker manages persistent MCP server sessions across a distributed deployment.
Package mcpworker manages persistent MCP server sessions across a distributed deployment.
Package planservice manages AI-generated execution plans.
Package planservice manages AI-generated execution plans.
Package sessionservice provides CRUD operations for CLI chat sessions.
Package sessionservice provides CRUD operations for CLI chat sessions.
Package taskengine provides a configurable workflow system for building AI-powered task chains.
Package taskengine provides a configurable workflow system for building AI-powered task chains.
compact
Package compact summarizes older messages of a running ChatHistory when it approaches the model's context window, replacing them with one synthetic user message of the form:
Package compact summarizes older messages of a running ChatHistory when it approaches the model's context window, replacing them with one synthetic user message of the form:
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.
Package terminalservice hosts a single PTY-backed shell session per process.
Package terminalservice hosts a single PTY-backed shell session per process.
tokenizer module
tools
openapi-gen command
openapi-gen/internal/comment
Package comment extracts documentation text from go/ast comment groups for OpenAPI generation.
Package comment extracts documentation text from go/ast comment groups for OpenAPI generation.
openapi-gen/internal/project
Package project loads parsed Go packages for the main module (go list ./...).
Package project loads parsed Go packages for the main module (go list ./...).
version command
Package vfsservice provides a virtual filesystem abstraction backed by Postgres (via libdbexec).
Package vfsservice provides a virtual filesystem abstraction backed by Postgres (via libdbexec).

Jump to

Keyboard shortcuts

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