serving-and-cli
Operate Mellea 0.8.0.dev0's m CLI and OpenAI-compatible server safely, including serving, routing, response schemas, streaming, decomposition, migration, evaluation routing, and bounded adapter commands.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- serving-and-cli
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate Mellea 0.8.0.dev0's m CLI and OpenAI-compatible server safely, including serving, routing, response schemas, streaming, decomposition, migration, evaluation routing, and bounded adapter commands.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/cli-reference.md10.4 KB
- 参考文档references/deployment-and-config.md7.6 KB
- 参考文档references/serving-api.md11.6 KB
- 参考文档references/troubleshooting.md13.1 KB
- 脚本scripts/check_cli_surface.py9.6 KB
03 SKILL.md 正文
Serving and CLI
Use this route for the m entry point, m serve,
POST /v1/chat/completions, GET /health, OpenAI-compatible clients, model
routing, response formats, SSE streaming, m decompose, m fix, or the
bounded CLI aspects of m alora and m eval. The operating contract is for
Mellea 0.8.0.dev0 and Python 3.11+.
Route the task
- Run the safe bundled checker before invoking a side-effectful command:
python scripts/check_cli_surface.py --mode static. To render installed help without executing a callback, use--mode help --target <name>. - Read CLI reference for exact command families, current defaults, output files, prerequisites, and side effects.
- For
m serve, request/response fields, structured output, routing, streaming, multimodal messages, and error envelopes, read Serving API. - Before binding a socket or exposing a process, read Deployment and configuration.
- For missing extras, schema failures, port conflicts, backend errors, partial output, or command-safety recovery, read Troubleshooting.
Safety gates
- Help and static inspection are safe.
m serveimports user code and starts a blocking server;m decomposeandm evalcall models and write files;m fix genslotswrites unless--dry-run; aLoRA commands may download a model, consume substantial compute, overwrite local files, prompt, or upload to Hugging Face Hub. - Require an explicit decision before a public bind, provider call, model download, training run, remote upload, or non-dry-run rewrite. Never use a side-effectful command as an installation probe.
- Prefer
127.0.0.1over them servewildcard default. The built-in service has no authentication, TLS, rate limiting, or authorization layer. - Treat request
modelas untrusted routing metadata. Route only through a fixed allowlist; never derive a provider URL, import, credential, or arbitrary model loader directly from it. - Validate
json_schemabefore generation. A response schema affects output only when the served function acceptsformatand passes it into Mellea. - True incremental streaming needs an uncomputed thunk and a streaming-capable backend. A computed result becomes one SSE content chunk.
Minimal workflows
Plan a serving request
- Choose a local host and an unused port; prefer
127.0.0.1:8080. - Confirm the app's
servesignature and backend prerequisites without importing untrusted, side-effectful application code. - Draft one minimal request with
modeland a user message. - Add exactly one advanced feature at a time:
stream,response_format, tools, multimodal content, or model routing. - Check
/health, then send the bounded request and inspect the response or SSE[DONE]marker.
Plan a CLI migration or pipeline
- Render the exact nested help surface and check paths/credentials first.
- For
fix, run--dry-runand review every match before writing. - For
decomposeoreval, bound model/token/timeout settings and use a new output path; these commands make provider calls and files. - Inspect generated Python, validators, and result counts before executing or treating a run as successful.
- Record which operations were deferred because they need a live backend, training resources, or remote write approval.
Route a difficult request
- Structured-output endpoint with routing and streaming: read all of Serving API, use a fixed route allowlist, validate the JSON schema, and ensure the streaming branch returns an uncomputed thunk.
- Missing server extra: run help/static checks, install
server, and repeat help; do not start Uvicorn as a dependency test. - Decompose/fix misuse: read the failure table in Troubleshooting, preserve generated or rewritten artifacts, and recover with a narrower, reviewable operation.
Ownership boundaries
Route provider selection, model identifiers, credentials, backend extras, and
provider failures to ../backends-and-models/SKILL.md. Route evaluation design,
judge validity, and sampling semantics to
../sampling-and-evaluation/SKILL.md. Route tool execution, tool-call loops,
and MCP to ../tools-and-agents/SKILL.md when that route is available; this
skill covers only the HTTP envelope and CLI boundary for tools.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).