LightWorker
LightWorker is a local-first multi-agent task orchestration system for Codex, providing persistent task graphs, automatic decomposition, and secure execution.
Task Orchestration & Delegation
orchestrate: Queue a Lead Codex planning run that decomposes an objective into a dependency-aware DAG and dispatches child tasks, with modes likeplan_only,auto_readonly, orauto_execute.delegate_task: Queue a single worker task of kindexplore(read-only),review(read-only), orexecute(isolated Git worktree, may require approval), with fine-grained control over model, profile, budget, dependencies, and timeouts.delegate_batch: Queue multiple pre-decomposed worker tasks at once.
Task Monitoring
get_task: Retrieve a task with its dependencies and structured results.get_task_tree: List all tasks under an orchestration root (full DAG view).list_tasks: Filter tasks by status.wait_tasks: Wait for tasks to reach terminal or approval states (up to 55s).get_events: Read append-only event streams with cursor-based pagination.
Task Lifecycle Control
approve_task: Release a write task awaiting manual approval.cancel_task: Cancel queued/active tasks and terminate their processes.retry_fallback: Clone a failed read-only task to a fallback gateway.escalate_task: Create a budgeted retry with a deeper worker profile.
System & Diagnostics
get_cache_metrics: Retrieve cold/warm cache telemetry and target status.doctor: Verify local Codex, proxy ports, state paths, model allowlist, and concurrency.
Execution, Security & Persistence
Write tasks run in isolated Git worktrees and require manual approval; read-only tasks can auto-execute.
Enforces local-first security: binds to loopback, ignores external Codex configs, prohibits automatic Git operations.
Persists task DAGs, events, results, and worktree info in SQLite.
Supports explicit, size-capped Context Packs for stable references.
Integration
Multiple surfaces: CLI, Codex MCP, and a local Web Console, all sharing the same scheduler and state store.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LightWorkerSplit the refactoring into parallel tasks and approve the write ones via the console."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LightWorker is a lightweight, local-first multi-agent task runner with no third-party Python runtime dependencies. It lets Codex submit tasks through MCP, persists the task DAG in SQLite, executes Workers with codex exec --json, and uses an isolated Git worktree for write tasks.
Project status:
v0.2.0is the current release. It adds profile-based dual-gateway delegation and a measurable DeepSeek Cache Lab. 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.
Core Capabilities
Capability | What it does |
Persistent task DAG | SQLite WAL stores tasks, dependencies, events, PIDs, results, and worktree information |
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 |
Approval and isolation |
|
Three control surfaces | CLI, Codex MCP, and the local Web Console share the same scheduler and state store |
Measurable cache optimization | Prompt Protocol v4, 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 |
Local-first security |
|
Related MCP server: Malon
Secure Defaults
Boundary | Default behavior |
Web Console | Only the literal loopback addresses |
Read-only tasks | Can run automatically under |
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 |
See SECURITY.md for the full threat model and how to report vulnerabilities.
Requirements
Python 3.11+
Git
Codex CLI
A working Codex 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 0.146.0, and SQLite 3.51.
Installation
Install the CI-verified universal wheel directly from the v0.2.0 GitHub release:
python -m pip install https://github.com/ncepuee/LightWorker/releases/download/v0.2.0/lightworker-0.2.0-py3-none-any.whl
lightworker init
lightworker doctorSHA-256 checksums for release assets are listed in SHA256SUMS.txt. When developing or auditing the source, you can install from a pinned tag:
git clone --branch v0.2.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 doctormacOS / Linux:
export LIGHTWORKER_HOME="${XDG_STATE_HOME:-$HOME/.local/state}/lightworker"
lightworker init
lightworker doctorFor 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 "C:\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 "C:\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.2.0:
Task type | Default model |
Planner / design / review / debugging / complex coding |
|
Mechanical execution, formatting, and simple retrieval at |
|
Executor |
|
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:
.\Start-LightWorker-Web.ps1You can also run it directly:
python -m lightworker web
python -m lightworker web --no-open --port 8766The default address is http://127.0.0.1:8766/. The page offers:
Task overview, status filtering, and automatic refresh every three seconds.
Forms for auto-planned tasks and single-Worker tasks.
Approval of
awaiting_approvalwrite tasks and cancellation of non-terminal tasks.Structured task results, error messages, and event stream inspection.
Status of Codex, CLIProxyAPI, OpenCodex Proxy, and the model allowlist.
A DeepSeek Cache Lab card with verified warm-cache hit rate, strict cohort audit, and target status.
Explicit Context Packs for stable shared reference material without automatic repository or environment-file ingestion.
The Web service may only bind to the literal loopback addresses 127.0.0.1 or ::1. A random session token is generated at every startup, and write endpoints must carry it; the page injects the token automatically, so no manual entry is required. The token protects against cross-site write requests from browsers; it does not isolate other local processes running under the same user. Same-user local processes are within the trusted boundary, and read-only APIs may return task and diagnostic information. Web and Codex MCP share the SQLite state store, and a process lock guarantees that only one Scheduler executes tasks at any given time. Processes without the lock stay in standby: they can still submit and query tasks and will take over automatically once the current Scheduler exits.
Brand assets:
lightworker/web/logo.svg: LightWorker's "converging execution core" vector mark, used in the sidebar and empty states.lightworker/web/favicon.svg: an optically corrected 16/32 px dark favicon.lightworker/web/lightworker-app-icon.png: a high-resolution app icon generated with GPT Image, used asapple-touch-iconand as a brand asset.
If the user Codex configuration enables many MCP servers, we recommend letting Workers use an isolated configuration so that each subtask does not repeatedly load unrelated tools:
[runner]
codex_ignore_user_config = true
codex_base_url = "http://127.0.0.1:10100/v1"
codex_model_catalog = "C:\\Users\\you\\.codex\\opencodex-catalog.json"--ignore-user-config still reuses Codex's authentication directory, but does not load user-level MCP servers or sandbox defaults; LightWorker explicitly passes a read-only or workspace-write sandbox.
Isolation is the default security boundary, not just a performance option: unattended Workers should not inherit user MCP servers that could perform external writes such as GitHub or Slack. Only set codex_ignore_user_config to false if you clearly understand the risk and want to be compatible with user-level configuration; in that case auto_readonly can only constrain Codex's local sandbox and cannot guarantee that third-party MCP servers have no external side effects.
Model Gateways
LightWorker does not store API keys for model services directly. It invokes the local Codex CLI and can connect to OpenAI or a compatible gateway through Codex's model catalog. When using a local gateway such as CLIProxyAPI, we recommend listening only on the loopback address and keeping authentication files in the user configuration directory, not in the project repository.
The default routing is only a starting point: low-reasoning tasks go to DeepSeek V4 Flash, while complex planning, coding, and review go to gpt-5.6-sol. All available models remain controlled by the allowlist in config.toml.
Provider Cache Lab
Prompt Protocol v4 keeps the stable safety, output, role, profile, and optional Context Pack contract ahead of task-specific content. Cache Cohort v2 prevents misleading aggregation across gateways, response modes, upstream models, reasoning effort, profiles, schemas, sandboxes, Context Packs, configuration scopes, and tool contracts. Root-fair scheduling permits at most one extra same-cohort affinity selection, so cache reuse cannot starve unrelated roots.
The 90% target is certified only for one strict cohort using at least 20 route-verified warm samples and a token-weighted verified hit rate. Unverified routes, legacy cohorts, cold starts, and different gateways remain visible but cannot be combined into an “achieved” result. Metrics are available in the Web Console, lightworker cache-metrics, the GET /api/cache-metrics endpoint, and the MCP get_cache_metrics tool.
Context Packs are explicit caller-supplied reference text, capped at 32 KiB, canonically encoded, screened for likely credentials, and treated as untrusted data. LightWorker never automatically reads repository files, logs, environment files, or arbitrary paths into a Context Pack. Prompt and cache events expose hashes and byte counts rather than Context Pack content.
Privacy and Local State
Task content, events, results, and process information are stored in an SQLite database under LIGHTWORKER_HOME. The default state directory is outside the source tree, and the repository's .gitignore also excludes common runtime state, databases, logs, environment files, user configuration, and worktree paths; do not point a custom LIGHTWORKER_HOME at an unignored location inside the source tree. The public source contains no local credentials or personal paths.
LightWorker itself contains no telemetry module. It only accesses the configured model gateway through the local Codex CLI while executing tasks; whether the source code and prompts involved in a task are sent to a remote service depends on the model you choose and its terms of service.
Approving Write Tasks
Under auto_readonly, the Executor in the plan enters awaiting_approval:
python -m lightworker tasks --status awaiting_approval
python -m lightworker approve <task-id>
python -m lightworker runThe Executor requires the source repository to have no uncommitted changes, then creates:
%LOCALAPPDATA%\LightWorker\worktrees\<task-id>After the task completes, only the Git worktree, branch, diff, and test results are kept; nothing is merged automatically.
Codex MCP
Generate the configuration snippet:
python -m lightworker mcp-configAdd the output to ~/.codex/config.toml, then restart Codex. You can also register it via the CLI:
codex mcp add lightworker `
--env LIGHTWORKER_HOME="$env:LOCALAPPDATA\LightWorker" `
-- python -m lightworker mcpIf you are not launching from the LightWorker source directory, run pip install -e . first, or set cwd to this project directory in the MCP configuration.
The MCP tools include:
orchestratedelegate_taskdelegate_batchget_taskget_task_treelist_taskswait_tasksget_eventsapprove_taskcancel_taskdoctor
Suggested usage from Codex:
Use auto_readonly by default. Only approve execute tasks when the user has explicitly authorized changes.
Multiple Explorers can run in parallel; write tasks on the same repository must run in an isolated worktree.
Workers must return their conclusions as structured evidence through get_task; a natural-language claim of "done" is not accepted as evidence of completion.CLI Commands
lightworker init
lightworker doctor
lightworker web
lightworker orchestrate
lightworker submit
lightworker run
lightworker tasks
lightworker status
lightworker tree
lightworker events
lightworker approve
lightworker cancel
lightworker mcp
lightworker mcp-configIf the console script is not installed, replace lightworker with python -m lightworker.
State Machine
queued → starting → running → completed
└→ finishing → completed (Planner)
├→ failed
├→ cancelled
└→ blocked
awaiting_approval → queuedWhen the Runner restarts, leftover starting/running tasks are marked orphaned to avoid silently re-executing write tasks.
Acknowledgements and Design Influences
LightWorker incorporates the most practical mechanisms from these projects:
OpenHands: backend, workspace, automated control surface.
AionUi: Lead/Teammate, task board, asynchronous collaboration.
Delegate: Git worktree, Reviewer, and Merge Worker concepts.
Cindy: explicit separation of creation, queuing, dispatch, and completion.
OpenWorker: fresh context, short lifecycle, read-only exploration.
It does not depend on these projects, and installing any of them is not required.
Project entry points: Changelog · Security · Contributing · Issues · Releases
Current Limitations
The first release does not include Redis, remote Workers, or Docker management.
A process lock guarantees only one Scheduler; while the Web Console is running, the remaining MCP instances act as passive clients of the shared state store.
Whether models such as DeepSeek can reliably execute Codex tool calls depends on the corresponding gateway and model compatibility.
If a non-Planner Worker ignores the JSON Schema and returns text, the task is saved with a usable result marked
schema_valid=false; the Planner does not allow this degradation because non-JSON results cannot safely generate a task DAG.auto_executestill never automatically commits, merges, pushes, publishes, or performs external writes.Path restrictions are currently enforced jointly by the workspace, the Codex sandbox, and the prompt; robust isolation against adversarial workloads would require a Docker backend.
Tests
python -m pytestLicense
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables 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.Last updated122Apache 2.0
- Alicense-qualityBmaintenanceLocal-first MCP server for AI coding agents that provides isolated code search, memory ledger, context rot detection, and cost governance.Last updated212MIT
- Alicense-qualityBmaintenanceA 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.Last updatedApache 2.0
- Alicense-qualityBmaintenanceA local MCP control plane for Codex that manages task queues, dynamic roles, and side-panel team collaboration with persistence, dependency gating, and structured reporting.Last updatedMIT
Related MCP Connectors
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ncepuee/LightWorker'
If you have feedback or need assistance with the MCP directory API, please join our Discord server