Skip to main content
Glama
X-isdoingreat

warehouse-cad-agent

README.md
# Warehouse CAD for Codex

This repository is one Windows-first distribution for a Codex plugin and its deterministic warehouse CAD engine.

```text
free Chinese <-> Codex (understand, ask, decide)
                   -> CadProgram
                   -> warehouse_cad_program (the only MCP tool)
                   -> deterministic engine
                   -> managed CAD work copy
```

Codex is the only natural-language Agent. The plugin does not contain another chatbot, language parser, model runtime, or rule-based Chinese command interpreter. Users talk to Codex; Codex preserves the exact turns, asks for missing facts, previews an inspectable `CadProgram`, and calls the one tool. The engine validates and executes that program. It never guesses missing dimensions, height, equipment identity, or source evidence.

## v0.3.0rc1 verification boundary

This release candidate separates two claims that must not be confused:

- Verified without AutoCAD: one irregular synthetic Chinese request reaches a real Codex CLI, becomes a provenance-bound program, passes deterministic equipment-fact validation, and enters the registered `equipment.create_2d` CAD-facing **plan** boundary. Incomplete and blank inputs fail closed. The check runs from two independent clean checkouts and installed-wheel runtimes.
- Deferred until AutoCAD is available: CAD `execute`, an actual DWG change, editable 2D, height-driven 3D, source/final overlay, save, fresh reopen, and customer-drawing coverage.

The accepted plan explicitly reports `mutates_cad=true` and `cad_call_made=false`. It proves the integration and product calling form only; it is not drawing evidence. See the [RC release notes](docs/RELEASE_NOTES_v0.3.0rc1.md) and the [no-AutoCAD input template](templates/no-autocad-integration/README.md).

## Requirements

- Windows and CPython 3.11 x86-64.
- Codex CLI or Codex in the ChatGPT desktop app.
- Git and a clean checkout at an immutable commit.
- ODA File Converter for DWG/DXF conversion.
- AutoCAD Core Console for operations that create or verify native DWG entities.
- A Chinese font such as Microsoft YaHei or SimSun for Chinese CAD text.

The repository pins public Python dependencies and hashes in `requirements.lock`. Editable installs are deliberately unsupported for the product runtime.

## Install from a clone

From the repository root in PowerShell:

```powershell
.\scripts\bootstrap.ps1
codex plugin marketplace add .
codex plugin add warehouse-cad-agent@warehouse-cad-agent
codex plugin list
```

The first command builds both local wheels, creates an isolated runtime, installs hash-locked dependencies, and writes a marker bound to the Git commit, tracked-source fingerprint, Python version, dependency lock, and both wheel hashes. The launcher fails closed if any binding changes; it never falls back to a system package, editable source tree, or an older plugin cache.

For an isolated runtime location:

```powershell
.\scripts\bootstrap.ps1 -RuntimeRoot C:\path\to\empty-runtime-root
```

Restart Codex after installing or updating the plugin so a new thread discovers the Skill and MCP server. Local marketplace and plugin commands follow the official [Codex plugin packaging guide](https://developers.openai.com/plugins/build/plugins). Project-scoped or personal MCP configuration is described in the official [Codex MCP guide](https://learn.chatgpt.com/docs/extend/mcp?surface=cli).

## Use

Open Codex in the clone and invoke `$warehouse-cad-agent`. Give the source drawing and speak normally in Chinese. For example:

> 先把这张图里的物流设备都去掉,建筑和通道这些结构保留。右边空着那块帮我画一台输送机,大概从这个角点往东,长六米宽一米二;高度我等会儿再给你。

Codex must ask when “这个角点”, direction, unit, device identity, or any other required fact is not resolvable. In `v0.3.0rc1`, the no-AutoCAD release gate stops at an accepted, unexecuted `equipment.create_2d` plan; it does not produce visible CAD. After an AutoCAD-dependent final-artifact gate is available and passes, the intended next stages are editable 2D in a managed work copy, a same-window comparison, and only then a later height turn such as “就刚才那台,高度两米四,做成立体的”. Devices without a supplied height must remain 2D.

The user is never asked to handwrite JSON. `CadProgram` is an internal, inspectable boundary generated by Codex. Each adopted value is bound to the exact user turn, SHA-256, and character span.

## Read-only diagnosis

After bootstrap, use `warehouse-cad-agent doctor` inside the runtime reported by the bootstrap receipt. Doctor checks package identity, Codex availability, ODA, AutoCAD Core Console, Chinese fonts, and runtime writability without editing CAD.

## Evidence boundary

A successful handshake, a valid program, a JSON receipt, a wheel, or a screenshot alone is not proof that the requested CAD changed. A final capability claim requires the source-bound program chain, actual saved CAD, fresh reopen/readback, zero-pollution failure checks, and—when correspondence to a source view is claimed—a same-camera source/final/overlay using the actual final CAD.

Customer drawings, their coordinates and text, natural-language replay inputs, oracles, screenshots, and generated results must stay outside the public repository.

## Development checks

Development tooling is separate from the product runtime:

```powershell
py -3.11 -m pip install pytest ruff
py -3.11 -m ruff check .
py -3.11 -m pytest packages\cad-to-layout-engine\tests plugins\warehouse-cad-agent\tests
```

See [architecture](docs/ARCHITECTURE.md), [product boundary](docs/PRODUCT_BOUNDARY.md),
the [Chinese quickstart](docs/QUICKSTART_ZH.md), and the
[isolated Codex reproduction guide](docs/REPRODUCE_WITH_CODEX_ZH.md).

TDQS

B3.4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct level: project management, session management, querying, editing, and exporting. No two tools overlap in purpose, making selection unambiguous.

Naming Consistency4/5

All tools share the 'warehouse_' prefix, and four of five follow the 'warehouse_cad_' pattern. The sole exception, 'warehouse_project', still fits the broad naming scheme but lacks the 'cad_' segment, a minor inconsistency.

Tool Count5/5

With only 5 tools, the set is tightly focused and each tool covers a major capability area. This is an ideal scope for a CAD agent, avoiding bloat while remaining useful.

Completeness4/5

The tools cover the full workflow from project validation/rebuild, session control, query, edit, to export. Minor gaps exist (e.g., no explicit import or undo), but the core lifecycle is well supported.

Maintenance

ActivityMaintained
ResponsivenessNo issues