lmoci authoring skill
lmoci is the Oracle Cloud Infrastructure host for LMScript, providing both the shared lmcloud procedural schema on Go hostkit and a 16-section OCI inventory, Object Storage, Queue, Streaming, IAM, and Vault/KMS toolset.
Purpose
Use lmoci to script OCI Object Storage, OCI Queue, Streaming, IAM compartments and policy linting, Vault/KMS metadata, and cross-cloud lmcloud programs against offline fixtures or the local ocisim emulator on 127.0.0.1:4599.
When to use it
Choose lmoci when running portable lmcloud programs against OCI semantics, when testing signed OCI REST calls and IAM policies against ocisim on port 4599, or when using deterministic JSON CLI subcommands (lmoci os, lmoci iam, lmoci queue, lmoci stream, lmoci vault, lmoci inventory).
Install
Declare lmoci in an LMScript _lmcode_ block so the compiler downloads and verifies the platform release binary and compiles against its embedded schema.
p = _lmcode_ cli="lmoci" install="github:lmctl-ai/lmoci@latest";
Commands
Run LMScript programs with lmscript, or run lmoci directly for schema inspection, signature listing, and direct OCI subcommands.
lmoci --version
lmoci --help
lmoci --notices
lmoci [cloud] --lmcode-schema --json
lmoci [cloud] --lmcode-signatures
lmoci [cloud] --lmcode-signatures --without-std
lmoci inventory all --demo
lmoci os namespace --endpoint http://127.0.0.1:4599
lmoci iam lint-policy --name sandbox-policy --statement "Allow group Devs to manage objects in compartment sandbox"
lmscript examples/object_storage.lms
Inputs and outputs
In shared lmcloud mode, programs use context cloud: Cloud and receive typed handles (ObjectMeta, ObjectListPage, QueueMessage, QueueMessageList, TableItem, TablePage, Policy, LintReport, FunctionConfig, FunctionInvokeResult, User, UserPage, Session, CostReport, MetricsReport, CloudError). Direct CLI subcommands emit a deterministic JSON envelope containing ok, area, action, profile, endpoint, data, and error.
Safety rules
With no endpoint and no live opt-in, lmoci uses its offline in-process fake adapter and makes zero external connections. Plain HTTP endpoints are permitted only for loopback addresses (127.0.0.1:4599 for ocisim). When targeting a loopback emulator without an ~/.oci/config file or LMOCI_SIM_PRIVATE_KEY_PATH, lmoci automatically synthesizes an ephemeral RSA-2048 keypair so draft-cavage OCI HTTP request signing runs end-to-end. Sandbox mutations enforce the lmoci-<runId>- / lmoci_<runId>_ prefix and freeformTags.lmoci_test = <runId>, record creations in a persistent JSON ledger, tear down resources in reverse order, and redact PEM keys, passphrases, and tokens from all output.
Worked examples
Example 1: Object Storage and Queue round-trip on the shared lmcloud schema.
p = _lmcode_ cli="lmoci" install="github:lmctl-ai/lmoci@latest";
# Optional: target local ocisim on 127.0.0.1:4599
# cloud.set_endpoint("all", "http://127.0.0.1:4599");
cloud.set_cost_cap_usd(0.05);
cloud.bucket_create("lmoci-artifacts");
let meta = cloud.object_put("lmoci-artifacts", "manifests/v1.json", "{\"ok\":true}");
assert(meta.exists() && meta.size() == 11, "object put failed");
cloud.queue_create("lmoci-events");
cloud.queue_send("lmoci-events", cloud.object_get("lmoci-artifacts", "manifests/v1.json"));
let msgs = cloud.queue_receive("lmoci-events", 1, 30, 0);
assert(msgs.len() == 1, "expected 1 message");
cloud.queue_ack("lmoci-events", msgs.at(0).receipt());
cloud.object_delete("lmoci-artifacts", "manifests/v1.json");
cloud.bucket_delete("lmoci-artifacts");
cloud.queue_delete("lmoci-events");
print(cloud.cost_report().summary());
end _lmcode_
r = run_lmcode(p);
assert(r.ok, "OCI storage and queue workflow failed");
Example 2: Standard lmcode_std_v3 REST and CLI handlers over OCI Object Storage.
p = _lmcode_ cli="lmoci" install="github:lmctl-ai/lmoci@latest";
@"/buckets/:bucket/objects/:key"
fn get_obj(x: RestExchange) -> void implements RestGet {
x.send(cloud.object_get(x.param("bucket"), x.param("key")));
}
@"--bucket"
fn opt_bkt(x: RestExchange) -> void implements CliOption {
x.set("bucket", x.query("bucket"));
}
@"seed-object"
fn cmd_seed(x: RestExchange) -> void implements CliCommand {
let b = x.get("bucket");
cloud.bucket_create(b);
cloud.object_put(b, "note.txt", x.body());
x.send("seeded:" + b);
}
rest_config("prefix", "/v1");
let c = rest_cli(str_split("--bucket oci-bkt seed-object -- oci-payload", " "));
let g = rest_cli(str_split("/v1/buckets/oci-bkt/objects/note.txt", " "));
print(c + " -> " + g);
end _lmcode_
r = run_lmcode(p);
assert(r.ok, "OCI REST/CLI example failed");
Errors and exit codes
Shared cloud operations report errors through ErrorCode (OK, INVALID_ARGUMENT, NOT_FOUND, CONFLICT, PRECONDITION_FAILED, UNAUTHENTICATED, PERMISSION_DENIED, COST_CAP_EXCEEDED, INTERNAL) and cloud.last_error(). In ocisim --auth enforce mode, signature failures return HTTP 401 NotAuthenticated (mapped to UNAUTHENTICATED) and IAM policy denials return HTTP 403 NotAuthorizedOrNotFound (mapped to PERMISSION_DENIED). Exit code 0 indicates success; exit code 2 indicates invalid CLI usage or invalid LMOCI_MAX_MEMORY_MB setting; exit code 3 indicates runtime cloud error, policy denial, or memory budget breach; exit code 4 indicates bytecode load failure. The direct subcommands (cred, inventory, os, iam, queue, stream, vault) are documented in the repository README; a host build that does not ship them rejects them with a CLI_USAGE error and exit code 2.
How to verify
Verify the binary version, schema emission, and Go conformance suite.
lmoci --version
lmoci --lmcode-signatures
go test ./...