Scan your whole stack
From OX Research Newsroom
Are you using clicodemode?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.7.0
clicodemode was last scanned on 23 Nov 2026 at version 0.7.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.7.0 LATEST | 23 Nov 2026 | 1 rule fired |
| 0.6.2 | 23 Nov 2026 | 1 rule fired |
| 0.6.1 | 23 Nov 2026 | 1 rule fired |
Findings for v0.7.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The package includes a WebAssembly (.wasm) module. It cannot be reviewed as source, but it runs sandboxed inside the JavaScript runtime and can access only what the host code gives it. WebAssembly is common in parsers, codecs and cryptography libraries. Shown for awareness.
LOWThe score describes 0.7.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Register the commands your Python CLI already has as Code Mode operations, then let an agent run small JavaScript-like programs that call them.
Go is the primary library. This package is an experimental thin wrapper
around the Go engine compiled to WebAssembly (GOOS=wasip1) and run by
wasmtime. The engine owns
parsing, language semantics and portable validation; Python never interprets
the language and nothing is reimplemented. The host (your Python code) owns
authorization and path/exec security. Version 0.7.0 matches the Go library
version; cm.engine_version() reports the engine that is embedded.
pip install clicodemode
The wheel is pure Python plus the embedded engine (_codemode.wasm); the only
dependency, wasmtime, is installed from its own wheels. Needs Python >= 3.9.
From source (needs Go and Python >= 3.9; Python 3.10+ for the check script):
git clone https://github.com/muthuishere/clicodemode && cd clicodemode
bash python/scripts/check_python.sh # venv, build wasm, pytest, mypy --strict, wheel in python/dist/
# or just the two commands it wraps for a wheel:
bash python/scripts/build_wasm.sh && python3 -m pip install build && python3 -m build python
pip install python/dist/clicodemode-0.7.0-py3-none-any.whl
import click
from clicodemode import CodeMode, Policy
@click.group()
def inventory() -> None:
"""Existing CLI; nothing here knows about Code Mode."""
@inventory.command()
@click.argument("sku")
@click.option("--qty", type=int, default=1)
def add(sku: str, qty: int) -> dict:
"""Add stock; returns the new level."""
return {"sku": sku, "qty": qty}
cm = CodeMode("1.0.0", policy=Policy(allow=lambda op: op.side_effects != "external"))
cm.register_click(inventory, "inv") # becomes ops.inv.add
r = cm.run("""
export default async () => {
const a = await ops.inv.add({ sku: "apple", qty: 5 });
return { a, total: a.qty + 2 };
}""")
print(r.ok, r.value) # True {'a': {'qty': 5, 'sku': 'apple'}, 'total': 7}
print(cm.engine_version())
| Area | Status |
|---|---|
exec / execStream / shell |
denied (the guest has no processes) |
| Module imports | not available (no filesystem in the guest) |
| Handlers | synchronous; a running handler cannot be pre-empted, so timeout and cancel apply after it returns. This is partial coverage of SPEC LIM-2/LIM-3; a test (test_slow_handler_is_not_cut_off_by_timeout) pins it so nobody relies on it |
| Click / Typer | leaf commands only; group callbacks and group-level options do not run |
| argparse | leaf (sub-)parsers become operations, nested sub-parsers included; options on a parent parser that precede the sub-command do not apply |
| Parallelism | Promise.all calls are answered one after another by the host |
| Security | the Go engine owns parsing, semantics and portable validation (syntax, static checks, operation-input schemas). Authorization and filesystem/path/exec security are enforced by your Python host (Policy.allow, handler code); WebAssembly does not sandbox them |
| Cold vs warm | cold: first engine in a process about 300 ms; warm: later engines about 6 ms, a steady run with one host call about 0.3 ms (details under "Measured") |
| Go engine (in WASM) | Python layer (this package) |
|---|---|
| JS parser/AST, language and evaluation semantics | operation registration |
portable core validation: syntax and static checks, diagnostics (file:line:col), operation-input schema checks, limits (steps, call depth, concurrency) |
calling your Python handlers, JSON in/out |
| capability fingerprint, docs, generated skill | policy gate (Policy.allow), timeouts/cancellation, I/O |
| host authorization and filesystem/path security |
Authorization that depends on the host (who may call what, which paths a
handler may touch) is enforced in Python, in your handlers and your Policy.
Nothing about paths or files is validated or sandboxed by the WASM engine:
the guest has no filesystem at all, but your handlers do, with your privileges.
If a handler takes a path, validate it in the handler (resolve it, check it
stays under an allowed directory) and deny the operation in Policy when in doubt.
# from the repository root; needs Go (to build the engine) and Python >= 3.9 (tested 3.9-3.15)
python/scripts/build_wasm.sh # Go -> python/src/clicodemode/_codemode.wasm (git-ignored)
cd python
python3.13 -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest # unit tests + examples + the conformance suite
.venv/bin/python tests/conformance_runner.py # conformance report only
.venv/bin/python -m mypy # strict
python -m build # wheel + sdist in dist/ (contains the wasm)
scripts/check_python.sh # the whole clean sequence in one go
The wasm is a build output (about 7.1 MB, about 2.1 MB inside the wheel). It is
never committed: build_wasm.sh produces it and python -m build packages it.
Building a wheel without running the script first fails the wasm check in
check_python.sh and raises a clear error at first use.
Runtime dependency: wasmtime~=51.0 (Apache-2.0 WITH LLVM-exception). Test extras: click, typer, pytest.
from clicodemode import CodeMode, Limits, Policy
cm = CodeMode("1.0.0",
limits=Limits(max_steps=1_000_000, timeout_ms=2000),
policy=Policy(allow=lambda op: op.side_effects != "external"))
@cm.operation("health.check", description="Report health.", side_effects="none", idempotent=True,
input_schema={"type": "object", "properties": {}, "additionalProperties": False})
def health(args):
return {"ok": True}
r = cm.run("export default async () => await ops.health.check({})", timeout=5)
r.ok, r.value, r.error, r.diagnostics, r.stdout, r.ms
cm.run(src, input=..., file=..., timeout=<seconds>, cancel=<threading.Event>),
cm.eval(expr), cm.check(src), cm.compile(src), cm.capabilities(),
cm.operations(), cm.describe(name), cm.docs(), cm.skill(), cm.cancel(), cm.close().
A program that throws, is rejected or times out is a Result(ok=False), not an exception.
cm.register_function("util.greet", greet) # schema from the signature and type hints
cm.register_click(group, "inv", exclude=["code"]) # every leaf command becomes inv.<cmd> (sub-groups: inv.<sub>.<cmd>)
cm.register_typer(app, exclude=["code"]) # via the command Typer builds
cm.register_argparse(parser, exclude=["code"]) # sub-parsers with set_defaults(func=handler)
The wrapped command runs in-process, with its own argument parsing, so Click,
Typer and argparse validation and errors apply. Its return value is the result;
if it returns None, what it printed is the result (JSON-decoded when it is
JSON). Click/Typer errors and argparse usage errors become rejected calls with
the original message. Only leaf commands run: group callbacks and group-level
options do not (use obj= for ctx.obj). Stdout capture is process-wide, so
wrapped commands are serialised by a lock.
Complete, tested examples, each a real CLI with an extra code run command:
examples/click_cli.py,
examples/typer_cli.py,
examples/argparse_cli.py.
python examples/click_cli.py code run -e 'await call("inventory.add", {sku: "apple", qty: 5})'
(The examples only read a program file the user names on the command line; they expose no file operations as operations.)
run, when the engine emits a call. Calls from Promise.all are all issued by the program but answered one after another by the host."<op>: denied by policy"; the handler never runs. A raising policy denies, with its message.None is null, Unicode is preserved. A handler result that is not JSON-serialisable (dataclass, set, NaN) rejects that call with a message naming the operation.input_schema by the engine before your handler is reached (the schemas derived for functions/Click/Typer/argparse use additionalProperties: false).max_steps, max_call_depth) end the run without a restart. Limits.timeout_ms is enforced by the engine; the host adds a 1 s backstop. A Python handler that is executing cannot be pre-empted: timeout/cancel apply when it returns.CodeMode serialises its calls with a lock, so sharing it is safe but one run at a time; cancel() is the only call meant for another thread. Use one instance per thread for parallel runs. A handler cannot re-enter its own engine (raises UsageError).CodeMode has its own WebAssembly instance and its own operations. The compiled module is shared per process.No claim of parity. Known differences: no module imports (no filesystem in the guest); CPU-bound code is slower (a 1M-iteration loop took ~0.5 s here); handlers are sync Python, so a blocked handler cannot be cancelled mid-call; exec/shell are denied; key order of operation results and input is not preserved by the Go engine (fixture lang6-*); the engine's own known deviations (conformance known_deviation) apply as they do in Go; only one engine per WASM instance, started lazily and restarted after registration changes or interruption.
| first engine in a process (Cranelift compile of the 7.1 MB module + run) | ~300 ms |
| new engine afterwards (module deserialized from the process cache) + first run | ~6 ms |
steady run with one host call |
~0.3 ms |
500 parallel calls in one Promise.all |
~50 ms |
| interrupted run + restart + next run (200 ms budget) | ~230 ms |
tests/conformance_runner.py drives ../conformance/cases/*.json (250 cases)
through this API. Cases flagged known_deviation are reported as skipped, never
as passed; cases the wrapper cannot express are listed as unsupported
(currently one: an operation that never settles, which a synchronous handler
cannot model). Policy maps the fixtures' deny_side_effects.
The engine is an interpreter, not a sandbox for hostile code. Programs can
only reach what you register, but registered handlers run with the host
process's full privileges, and a program can call them in any order and
quantity. Policy.allow is the gate: deny what an agent must not do, validate
every argument that reaches files, processes or the network inside the
handler, and keep side_effects honest. Resource limits (Limits, timeouts)
bound compute, not what handlers do.
MIT (see LICENSE).
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.