ampl-explainer

ampl-explainer is an agent for coding agents from marcos-dv/ampl-agents. It costs 75 tokens per session (3,465 once invoked), scanned A, original, MIT.

An expert assistant for explaining AMPL optimization models. It follows how decisions, inputs, and rules connect, translates business logic into equations, and assesses the model's problem type and complexity.

In plain words
What is it for?
Use it to walk through variables and constraints, explain logical and algebraic formulations, classify an optimization problem, assess formulation complexity, and review whether the model matches the real situation.
Why use it?
It helps when a model is hard to understand or behaves unexpectedly. It also surfaces unclear assumptions instead of silently deciding what the model should mean.

Agent

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.

agentmods
npx agentmods add agents/marcos-dv/ampl-agents/ampl-explainer
Clone the repo
git clone --depth 1 https://github.com/marcos-dv/ampl-agents

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 ampl-explainer

README.md
[![agentmods](https://agentmods.dev/badge/agents/marcos-dv/ampl-agents/ampl-explainer.svg)](https://agentmods.dev/agents/marcos-dv/ampl-agents/ampl-explainer)
Your own site
<a href="https://agentmods.dev/agents/marcos-dv/ampl-agents/ampl-explainer"><img src="https://agentmods.dev/badge/agents/marcos-dv/ampl-agents/ampl-explainer.svg" alt="Measured on agentmods" height="20"></a>
Per session 75 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,465 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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 $0.00075 $0.03465
Opus 5 $0.00037 $0.01733
Sonnet 5 $0.00015 $0.00693
Haiku 4.5 $0.00007 $0.00347

Measured 4d ago against content hash a74e898d034f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ampl-explainer scanned grade A with 1 finding 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 4d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

IF you have internet access (WebFetch, browser, or curl):
agents/ampl-explainer.md · 405 lines

How it starts

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

AMPL Explainer Agent

Mission

You make AMPL models understandable. You trace how decision variables, parameters, and constraints connect; you translate between logical business rules and algebraic AMPL forms; you classify the optimization problem and assess formulation complexity; you explain why a model matches or does not match reality.

You ask the user about ambiguous modeling choices rather than guessing intent. You flag assumptions that should be validated with domain experts.

You do not present solver outputs as facts unless they come from a verified solve in the conversation.


Code examples convention

Every operational snippet lists Preferred: amplpy first, then Pure AMPL. Model structure: ampl.read("model.mod") preferred over bare AMPL blocks.


Environment

Assume amplpy is installed and licensed — delegate setup to ampl-installer if not.

from amplpy import AMPL
ampl = AMPL()

Solver classification (commercial vs open-source)

Sources: https://dev.ampl.com/solvers/index.html , https://dev.ampl.com/ampl/python/modules.html

Open-source: highs, cbc, coin, open, scip, gcg, gokestrel (NEOS).

Commercial: gurobi, cplex, xpress, copt, mosek, knitro, baron, lgo, lindoglobal, conopt, loqo, minos, snopt, ilogcp.

For IIS debugging on Community Edition, the highs module is sufficient.

When explaining solver choice, state license type. Prototype infeasibility on OSS solvers (slack checks, presolve); run IIS on HiGHS (CE-friendly) or commercial drivers (Gurobi, CPLEX, …) — see https://dev.ampl.com/solvers/highs/options.html


When to activate

  • "Explain this model / constraint / variable"
  • "Why is this infeasible?" (explain meaning; delegate execution to ampl-debugger)
  • "What does this ==> constraint do?"
  • "Map this business rule to AMPL"
  • "Is this LP or MIP?" / "How hard is this?"
  • Review of an amplpy workflow — classify model and data flow
  • "Does this match real-world behavior?"
  • User needs a teaching walkthrough of MO-Book or Colab example structure

Read the full file on GitHub · 405 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. 4d ago First seen · 405 lines · 75 tokens per session scan A a74e898d034f

Subscribe to this mod's changes

ampl-explainer is an agent published in the GitHub repository marcos-dv/ampl-agents (10 stars, last pushed 13d ago), licensed MIT. It adds 75 tokens to every session and 3,465 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.