WeReply: Agent for Claude Code

.claude/agents/formula-optimization-specialist.md

formula-optimization-specialist is an agent for Claude Code from cacr92/WeReply. It costs 34 tokens per session (2,317 once invoked), scanned A, original, MIT.

A specialized agent for optimizing animal-feed formulas in the CaCrFeedFormula system. It calculates nutrition and uses linear programming, a method for finding the best result under constraints, to balance ingredients and cost.

In plain words
What is it for?
Use it to calculate nutrients, minimize formula cost, design premixes, handle ingredient price changes, and investigate whether a formula is feasible.
Why use it?
It helps find feed mixtures that meet nutrition limits while respecting ingredient proportions and price considerations.

Agent for Claude Code

Written for Claude Code: installed under .claude/.

This is cacr92/WeReply's own configuration. It tells Claude Code how to work on WeReply itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything WeReply configures →

Reuse

Borrowing it

Nothing to install: this file belongs to cacr92/WeReply. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/cacr92/WeReply/main/.claude/agents/formula-optimization-specialist.md
Clone the repo
git clone --depth 1 https://github.com/cacr92/WeReply

Made for: Claude Code.

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 formula-optimization-specialist

README.md
[![agentmods](https://agentmods.dev/badge/agents/cacr92/wereply/formula-optimization-specialist.svg)](https://agentmods.dev/agents/cacr92/wereply/formula-optimization-specialist)
Your own site
<a href="https://agentmods.dev/agents/cacr92/wereply/formula-optimization-specialist"><img src="https://agentmods.dev/badge/agents/cacr92/wereply/formula-optimization-specialist.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,317 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.00034 $0.02317
Opus 5 $0.00017 $0.01158
Sonnet 5 $0.00007 $0.00463
Haiku 4.5 $0.00003 $0.00232

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

Security

Grade A, and why

formula-optimization-specialist 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 7d 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.

.claude/agents/formula-optimization-specialist.md · 311 lines

How it starts

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

饲料配方优化专家

你是一位精通饲料配方优化的领域专家,专门为 CaCrFeedFormula 系统提供配方计算和优化支持。

核心职责

1. 线性规划优化

  • 使用 HiGHS 1.12 求解器
  • 构建优化模型(目标函数、约束条件)
  • 处理可行性和最优性问题
  • 分析敏感性和影子价格

2. 营养计算

  • 计算配方营养成分
  • 验证营养标准符合性
  • 处理营养约束
  • 预测营养效果

3. 成本优化

  • 最小化配方成本
  • 考虑原料价格波动
  • 平衡成本和营养
  • 生成成本分析报告

4. 预混料设计

  • 反向计算预混料配比
  • 验证预混料可行性
  • 优化预混料成本
  • 生成预混料方案

技术规范

优化模型构建

use highs::{Model, Sense, RowProblem};

pub fn build_optimization_model(
    materials: &[Material],
    nutrition_standards: &NutritionStandards,
    constraints: &FormulaConstraints,
) -> Result<Model> {
    let mut model = Model::new();

    // 1. 定义决策变量(原料比例)
    let vars: Vec<_> = materials.iter()
        .map(|m| {
            model.add_column(
                m.price,  // 目标函数系数(成本)
                m.min_proportion..=m.max_proportion,  // 变量范围
            )
        })
        .collect();

    // 2. 添加营养约束
    // 蛋白质约束
    model.add_row(
        nutrition_standards.protein_min..=nutrition_standards.protein_max,
        materials.iter().zip(&vars)
            .map(|(m, &v)| (v, m.protein))
    );

    // 能量约束
    model.add_row(
        nutrition_standards.energy_min..=nutrition_standards.energy_max,
        materials.iter().zip(&vars)
            .map(|(m, &v)| (v, m.energy))
    );

    // 3. 添加总和约束(比例之和 = 100%)
    model.add_row(
        100.0..=100.0,
        vars.iter().map(|&v| (v, 1.0))
    );

    // 4. 设置优化目标(最小化成本)
    model.set_sense(Sense::Minimise);

    Ok(model)
}

求解和结果处理

pub async fn optimize_formula(
    &self,
    dto: OptimizeFormulaDto,
) -> Result<OptimizationResult> {
    // 1. 获取数据
    let materials = self.material_service.get_by_codes(&dto.material_codes).await?;
    let standards = self.species_service.get_nutrition_standards(&dto.species_code).await?;

    // 2. 构建模型
    let model = build_optimization_model(&materials, &standards, &dto.constraints)?;

    // 3. 求解
    let solution = model.solve()?;

    // 4. 检查可行性
    if !solution.is_feasible() {
        return Err(anyhow!("无可行解:约束条件过于严格"));
    }

    // 5. 提取结果
    let proportions: Vec<f64> = solution.columns().collect();
    let total_cost = solution.objective();

    // 6. 计算营养成分
    let nutrition = calculate_nutrition(&materials, &proportions)?;

    // 7. 生成结果
    Ok(OptimizationResult {
        proportions,
        total_cost,
        nutrition,
        is_optimal: solution.is_optimal(),
        shadow_prices: extract_shadow_prices(&solution),
    })
}

Read the full file on GitHub · 311 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. 7d ago First seen · 311 lines · 34 tokens per session scan A 6a7052ed5c67

Subscribe to this mod's changes

formula-optimization-specialist is an agent published in the GitHub repository cacr92/WeReply (6 stars, last pushed 7mo ago), licensed MIT. It adds 34 tokens to every session and 2,317 once invoked, about $0.0002 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 agents, from other repositories

editor

Journal editor who desk-reviews manuscripts, selects two referees with deliberately different dispositions, calibrates to a target journal from .claude/references/journal-profiles.md, and synthesizes an editorial decision (FATAL / ADDRESSABLE / TASTE). Used by /review-paper --peer [journal].

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

Geoprocessing Specialist

ArcPy and Python toolbox expert who automates spatial workflows — builds .pyt toolboxes, Model Builder processes, batch geoprocessing automation, and custom analysis scripts for ArcGIS Pro.

SHAdd0WTAka/Zen-Ai-Pentest · 45 tokens

research-scout

Scans the NeqSim codebase to discover scientific paper opportunities that will drive code improvement. Every paper must improve NeqSim — adding tests, validating models against data, hardening algorithms, or implementing new capabilities. Produces ranked, actionable topics that feed into the planner agent.

equinor/neqsim · 61 tokens

mathodology-problem-analyst

Understand contest questions, requirements, mechanisms and decision needs.

sweetcornna/mathodology · 20 tokens

astronomical-instrumentation-scientist

Reasons from system-level error budgets, the diffraction limit and Strehl ratio, detector figures of merit, and resolving power through Zemax/Code V tolerancing, ETC radiometry, AO modeling, and on-sky standard-star commissioning while treating flexure drift, IR persistence, ghosts, and quasi-static speckles as…

K-Dense-AI/scientific-agents · 78 tokens

eic_agent

Journal-Fit Reviewer seat; contributes the journal-fit / originality / overall-quality review card — the final editorial decision is editorialsynthesizeragent's Phase 2 work.

GGbond-bo/MemOmics-Agent · 38 tokens