lagrangian-core

lagrangian-core is a skill for Claude Code, Codex from Sliky1/lagrangian-skills. It costs 136 tokens per session (2,176 once invoked), scanned A, original, MIT.

An opinionated method for constrained optimisation using augmented Lagrangian methods, ADMM, and KKT checks.

In plain words
What is it for?
Use it for quadratic, smooth or non-linear optimisation, distributed ADMM, safe reinforcement learning, and multi-objective problems.
Why use it?
It routes different problem types to defined methods and adds feasibility checks and safeguards against common solver failures.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for quadratic, smooth or non-linear optimisation, distributed ADMM, safe reinforcement learning, and multi-objective problems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sliky1/lagrangian-skills/v0.9.3
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Sliky1/lagrangian-skills --skill v0.9.3
Clone the repo
git clone --depth 1 https://github.com/Sliky1/lagrangian-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for lagrangian-core

README.md
[![agentmods](https://agentmods.dev/badge/skills/sliky1/lagrangian-skills/v0.9.3/github.svg)](https://agentmods.dev/skills/sliky1/lagrangian-skills/v0.9.3)
Your own site
<a href="https://agentmods.dev/skills/sliky1/lagrangian-skills/v0.9.3"><img src="https://agentmods.dev/badge/skills/sliky1/lagrangian-skills/v0.9.3/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for lagrangian-core

Your own site · 80×15
<a href="https://agentmods.dev/skills/sliky1/lagrangian-skills/v0.9.3"><img src="https://agentmods.dev/badge/skills/sliky1/lagrangian-skills/v0.9.3.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 136 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,176 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00136 $0.02176
Opus 5 $0.00068 $0.01088
Sonnet 5 $0.00027 $0.00435
Haiku 4.5 $0.00014 $0.00218

Measured 11d ago against content hash e5b4114feefe, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

lagrangian-core scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

archive/v0.9.3/SKILL.md · 140 lines

How it starts

The opening of the file, as written. The whole thing — 140 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Lagrangian Core Skill — v0.9.3

Token <=1.13x | 成功率目标 98.5% | 文档 <=150行

能力边界

支持: 凸QP | 光滑NLP | 非凸NLP | 分布式ADMM | Safe RL | 多目标 协同: 检测贝叶斯/统计成分→抛出子任务→合并结果 不支持: 纯贝叶斯 | 纯统计检验 | MIP → HALT 输出模式: MINIMAL(~0.10x,"只要数字") | STANDARD(~1.13x,默认) | VERBOSE(~1.55x,"展开计算") 业务语言翻译层默认关闭,"解释含义"时开启。

会话状态 [UX-2/3]

持久化: 问题定义 | 最优解x* | 约束列表 | 已澄清项 | KKT缓存 | 建模模板 增量触发词: 在上次|上次基础|新增约束|去掉约束|改为|调整为|放宽|收紧 → 触发后只解析变化部分,复用其余,跳过全量Step 0。

Step -1 — 预检 [LAT-1] (5项并行, ~60ms)

  1. 变量类型 2. 约束可行性(LP松弛) 3. 问题规模 4. 量纲一致性 5. 混合问题(COOP-1) 任意HALT条件 → 立即停止,输出结构化错误码。

[FIX-19] natural_lang+degenerate: Hessian条件数>1e6 → Tikhonov正则化(ε=1e-4)

[FIX-21v2] non_convex+adversarial起点: Halton序列; thresh=0.010, window=3, abandon=majority_vote

[FIX-22] non_convex+adversarial双层防护: Layer B (前置): ensemble_vote, quarantine=5 → safe_direction回退 Layer A (投影): adaptive_trust_region, proj_radius=0.10, restart_thresh=5 → 连续5步目标值劣化 → 重启+下一Halton起点 独立触发,执行顺序B→A;非此场景不启用。

[FIX-23] mixed_bayes_opt压力场景: near_infeasible → slack_buffer + staged注入 adversarial → confidence_floor(0.6) + staged注入

[FIX-24] Step 7退化标注: FIX-19 → "⚠️ 退化结构,已正则化(ε=1e-4)" FIX-22 → "⚠️ 对抗性鞍点:双层防护已激活" FIX-23 → "⚠️ COOP压力场景:{策略名}已激活"

Step 0 — 混合检测 + 批量澄清 [COOP-1, UX-2b/2c]

贝叶斯信号词: 先验|后验|似然|贝叶斯|概率分布|prior|posterior|likelihood 统计信号词: 均值|方差|回归|相关系数|假设检验 → 贝叶斯+优化: MIXED_BAYES_OPT → 抛出子任务(COOP-2) → 纯贝叶斯: HALT "请调用贝叶斯Skill"

批量澄清: ≥2个模糊点→合并单轮确认表(-0.12x);澄清后增量更新解析树。

边界类型 触发词 处理方式
定性目标 公平/均衡/合理/尽量 Max-Min/基尼/等比例选项
模糊数值 大约/左右/差不多 严格上限/软约束/范围选项
OR约束 或/至少一个/二选一 MIP/smooth_max/拆分选项
单位歧义 混合量纲 展示解析表请用户确认
条件逻辑 如果则/当时/第X期 合并/MIP/惩罚项选项

Step 3 — 稀疏JSON通道 [TOK-7/11]

只输出非默认字段:

{"step":3,"type":"augmented_lagrangian",
 "formula":"L_ρ=f(x)+Σλ·h(x)+Σμ·g(x)+ρ/2·||h||²",
 "multipliers":{"lambda":[0.0],"mu":[0.0]},
 "penalty":{"rho_init":1.0,"update_rule":"×1.5 if ||h||>tol"}}

Read the full file on GitHub · 140 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 140 lines · 136 tokens per session scan A e5b4114feefe

Subscribe to this mod's changes

lagrangian-core is a skill published in the GitHub repository Sliky1/lagrangian-skills (2 stars, last pushed 3mo ago), licensed MIT. It adds 136 tokens to every session and 2,176 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

audit-reproducibility

Enforce the replication-protocol.md rule by cross-checking numeric claims in a manuscript against the actual R / Stata / Python outputs. Report PASS/FAIL per claim against tolerance thresholds. Use before submission and before releasing a replication package.

pedrohcgs/claude-code-my-workflow · 54 tokens

review-paper

Comprehensive manuscript review with three modes: single-pass (default), --adversarial critic-fixer loop, and --peer [journal] simulated peer-review pipeline (editor + 2 dispositioned referees + editorial decision, calibrated to a target journal). R&R continuation via --peer --r2/--r3; hostile-editor stress test via…

pedrohcgs/claude-code-my-workflow · 114 tokens

grant-proposal

Scaffold a research grant proposal (NSF, NIH, ERC, or foundation) by composing existing primitives — pulls identification strategy from an /interview-me spec, delegates the data-management plan to /data-management-plan and the facilities statement to /capture-environment, and emits a funder-requirements checklist. Use…

pedrohcgs/claude-code-my-workflow · 131 tokens

preregister

Draft a structured preregistration document (OSF, AsPredicted, or AEA RCT Registry style) from a research spec or free-form study description. Output is a Markdown file with hypotheses, design, sampling plan, analysis plan, exclusions, and inference criteria — annotated with MUST / SHOULD / MAY clarity flags. Use when…

pedrohcgs/claude-code-my-workflow · 153 tokens

capture-environment

Snapshot the computational environment for a replication package — detects the analysis stack (R / Stata / Python) and emits the right lockfiles (renv.lock + sessionInfo.txt, requirements.txt / environment.yml / uv.lock, Stata version + ado package list), records seeds and RNG kind, optionally writes a pinning…

pedrohcgs/claude-code-my-workflow · 139 tokens

data-management-plan

Draft a funder-compliant Data Management Plan (NSF DMP, NIH DMS Policy 2023, ERC, Horizon Europe) by composing the confidential-data and environment-capture primitives. Sections cover data description, formats/metadata, storage/backup, access/sharing, preservation/archiving, and roles. Use when user says "data…

pedrohcgs/claude-code-my-workflow · 143 tokens