Skip to main content
Glama

LightWorker is a lightweight, local-first multi-agent task runner with no third-party Python runtime dependencies. It provides dual worker harness execution for both OpenAI Codex and ZCode / GLM CLI, persists the task DAG in SQLite, and uses an isolated Git worktree for write tasks.

Current release: v0.8.0 makes task state trustworthy: every task persists its real backend session id (codex thread / ZCode sessionId), restart reconciliation probes pid liveness instead of blanket-orphaning, and a reaper clears tasks whose worker process died without reporting — no more stuck "running" rows. It also passes ZCODE_* runtime hints through to the ZCode CLI, restoring compatibility with ZCode 0.17+. It retains dual harness support (CodexWorker + ZCodeWorker) and the Codex-native subagent bridge introduced in v0.6.0. By default, LightWorker listens only on the local loopback address and does not automatically commit, merge, push, or publish; write tasks require approval and run in an isolated Git worktree. See CODEX_NATIVE_BRIDGE.md and README_CN.md.

Core Capabilities

Capability

What it does

Dual Worker Harness

Native execution for both OpenAI Codex (CodexWorker) and ZCode / GLM CLI (ZCodeWorker) with dynamic routing

ZCode Auto-Detection

Zero-config discovery for standard ZCode installation paths: %ProgramFiles% / %LOCALAPPDATA% on Windows, /Applications/ZCode.app or ~/Applications/ZCode.app on macOS

Persistent task DAG

SQLite WAL stores tasks, dependencies, events, PIDs, results, and worktree information

Codex-native bridge

Durable native dispatch tickets, lease protection, native thread IDs, and host callbacks for spawn_agent / wait results

Automatic decomposition and parallelism

Lead Codex generates a directed acyclic task graph; independent read-only Workers can run in parallel

Reasoning-aware routing

Mechanical tasks go to DeepSeek V4 Flash by default; complex tasks use gpt-5.6-sol

Approval and isolation

auto_readonly runs read-only tasks automatically; write tasks wait for approval and enter an isolated Git worktree

Three control surfaces

CLI, Codex MCP, and the local Web Console share the same scheduler and state store

Measurable cache optimization

Prompt Protocol v5, strict Cache Cohort v2 isolation, explicit Context Packs, cache-affinity scheduling, and verified warm-cache metrics

Dual-gateway profiles

Named Planner, fast, deep, and review profiles can route through OpenCodex or CLIProxyAPI with explicit fallback and route audits

Capability-aware routing

Tasks declare required capabilities (e.g. web_search); gateways that lack them are excluded up front and fail closed instead of silently degrading

Scope-bound approvals

Each approval binds approval_id plus a SHA-256 scope digest; a task spec that changes after approval is refused

History management

The Web Console can purge terminated tasks with their events and usage records in one click

Local-first security

danger-full-access is prohibited; user MCP servers are isolated by default; no automatic commit, merge, push, or publish

Related MCP server: AgentBraid

Secure Defaults

Boundary

Default behavior

Web Console

Only the literal loopback addresses 127.0.0.1 / ::1 are allowed

Read-only tasks

Can run automatically under auto_readonly

Write tasks

Manual approval, using an isolated Git worktree

User Codex configuration

Ignored by Workers by default, avoiding inheritance of MCP servers with external write access

Git and external systems

Never automatically commits, merges, pushes, publishes, or grants danger-full-access

See SECURITY.md for the full threat model and how to report vulnerabilities.

Requirements

  • Python 3.11+

  • Git

  • Codex CLI or ZCode CLI (Auto-detected on Windows)

  • A working Codex / ZCode login or a configured model gateway

  • CLIProxyAPI/OpenCodex Proxy on the current machine (when using non-OpenAI models)

The local development verification environment is Python 3.13, Git 2.51, Codex CLI, ZCode CLI, and SQLite 3.51.

Installation

Install the CI-verified universal wheel directly from the v0.8.0 GitHub release:

python -m pip install https://github.com/ncepuee/LightWorker/releases/download/v0.8.0/lightworker-0.8.0-py3-none-any.whl
lightworker init
lightworker doctor

SHA-256 checksums for release assets are listed in SHA256SUMS-v0.8.0.txt. When developing or auditing the source, you can install from a pinned tag:

git clone --branch v0.8.0 --depth 1 https://github.com/ncepuee/LightWorker.git
cd LightWorker
python -m pip install -e .

Quick Start

You can run it directly after installation:

$env:LIGHTWORKER_HOME = "$env:LOCALAPPDATA\LightWorker"
lightworker init
lightworker doctor

macOS / Linux:

export LIGHTWORKER_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/lightworker"
lightworker init
lightworker doctor

For a local CLIProxyAPI/OpenCodex setup, we recommend initializing LightWorker with an isolated Codex configuration:

lightworker init --force --isolated-codex `
  --codex-base-url "http://127.0.0.1:10100/v1" `
  --model-catalog "$env:USERPROFILE\.codex\opencodex-catalog.json"

Submit a read-only DeepSeek V4 Flash investigation:

lightworker submit `
  --workspace "/path/to/project" `
  --kind explore `
  --model "deepseek/deepseek-v4-flash" `
  --run `
  "Analyze the project structure and list the three modules that most need tests."

Let Lead Codex decompose the task automatically:

lightworker orchestrate `
  --workspace "/path/to/project" `
  --mode auto_readonly `
  --run `
  "Find the cause of intermittent HTTP 500 errors in the login endpoint and provide an evidence-backed remediation plan."

Example default routing in v0.8.0:

Task type

Default model

Planner / design / review / debugging / complex coding

gpt-5.6-sol

Mechanical execution, formatting, and simple retrieval at low reasoning effort

deepseek/deepseek-v4-flash

Executor

gpt-5.6-sol

When a single task does not specify a model explicitly, routing is automatic based on reasoning effort: low uses deepseek/deepseek-v4-flash; medium/high/xhigh use gpt-5.6-sol. In other words, mechanical execution, formatting, and simple retrieval go to Flash, while design, planning, review, debugging, and complex coding go to OpenAI agents.

Model names and the allowlist can be configured in %LOCALAPPDATA%\LightWorker\config.toml.

Web Console

Run this in the project directory:

lightworker web

This starts the local dashboard at http://127.0.0.1:8765/.

Available Tools

18 tools
approve_taskB

Release one task that is awaiting approval into the execution queue.

Inputs: task_id (required), approval_id (required), scope_digest (required).

cancel_taskA
Destructive

Cancel a queued or active task and terminate its worker process tree.

Inputs: task_id (required).

claim_native_dispatchesB

Claim queued Codex-native tickets for this current host. For every ticket, call spawn_agent, then native_subagent_started. This is the real native bridge; it never runs codex exec as a fallback.

Inputs: host_id (required), limit, lease_seconds.

delegate_batchB

Queue up to the configured limit of already-decomposed worker tasks.

Inputs: tasks (required).

delegate_taskB

Queue one bounded worker task. Explore/review are read-only; execute uses an isolated git worktree and may require approval.

Inputs: objective (required), workspace (required), kind, mode, +17 more.

doctorA
Read-only

Check local Codex, proxy ports, state paths, model allowlist, and concurrency.

Inputs: no named parameters.

escalate_taskA

Create one budgeted read-only retry using a deeper worker profile. The original task remains unchanged.

Inputs: task_id (required), profile.

get_cache_metricsA
Read-only

Return materialized cold/warm cache telemetry and target status without scanning event JSON.

Inputs: model, gateway, window_seconds.

get_eventsA
Read-only

Read append-only task events after an event cursor.

Inputs: task_id (required), limit, after_id.

get_taskB
Read-only

Get one task, its dependencies, and structured result when available.

Inputs: task_id (required).

get_task_treeB
Read-only

List every task belonging to an orchestration root.

Inputs: root_id (required).

list_tasksA
Read-only

List recent tasks, optionally filtered by status.

Inputs: limit, status.

native_subagent_completedC

Persist the terminal result returned by a native Codex subagent after wait_threads completes.

Inputs: status (required), task_id (required), lease_id (required), error, +1 more.

native_subagent_eventB

Write a bounded native-thread progress event and refresh its dispatch lease while waiting with wait_threads.

Inputs: task_id (required), lease_id (required), event_type (required), payload.

native_subagent_startedC

Acknowledge that the current Codex host spawned a native subagent for a claimed LightWorker ticket.

Inputs: task_id (required), lease_id (required), thread_id (required).

orchestrateC

Queue a bounded Lead Codex planning run. It creates a dependency-aware task graph and automatically dispatches allowed child tasks.

Inputs: objective (required), workspace (required), mode, model, +5 more.

retry_fallbackA

Clone a failed read-only task onto its configured fallback gateway. Never falls back automatically.

Inputs: task_id (required).

wait_tasksA
Read-only

Wait up to 55 seconds for tasks to reach a terminal or approval state.

Inputs: task_ids (required), timeout_seconds.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools have a distinct resource/action: delegation (delegate_task, delegate_batch, orchestrate), task lifecycle (approve/cancel/retry/escalate), and native subagent lifecycle are separated. Boundaries are mostly clear, though retry_fallback vs escalate_task and the multi-step native_* flow require careful reading.

    Naming Consistency4/5

    Names are overwhelmingly snake_case and follow verb_noun for most operations (get_task, list_tasks, cancel_task, delegate_batch). Exceptions like doctor, orchestrate, and the native_subagent_* resource_event pattern are minor deviations rather than chaotic.

    Tool Count4/5

    18 tools is slightly above the typical 3-15 range, but the orchestration domain is broad and each tool maps to a distinct lifecycle step or diagnostic. It is heavy but not obviously bloated.

    Completeness4/5

    The surface covers delegation, orchestration, task inspection/waiting/events, approval, cancellation, fallback/escalation, diagnostics, cache metrics, and native subagent lifecycle. Minor gaps like explicit approval rejection or lease release are workaroundable, and some workflow references external host tools (spawn_agent, wait_threads).

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to delegate scoped tasks across multiple providers like Codex, Claude Code, and Antigravity through a single local MCP server, with quota monitoring, notifications, and remote control via messaging apps.
      13
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      A local-first MCP orchestration server that uses Codex as lead planner and Antigravity as host to delegate and review bounded tasks with Git integration and persistent SQLite state.
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      A local MCP control plane for Codex that manages task queues, dynamic roles, and side-panel team collaboration with persistence, dependency gating, and structured reporting.
      MIT