Optimize preventive maintenance policy

Optimize preventive replacement or refactoring intervals with Bayesian-scenario Weibull renewal-reward economics and a worst-case cost penalty.

What it's for

Answers when to refactor or replace before it fails, using renewal-reward economics and a worst-case penalty — instead of waiting for the outage to set the schedule.

Converts dependency, upgrade, and recurring incident history into a defensible maintain-now versus run-to-failure policy with annual economics.

What you give it

Inputs split into evidence read from your connected systems, calibration your team owns, and numerical controls that affect precision but never the result's meaning.

Field Type Role Required
assets array of objects (7 fields) Evidence Yes
interval_step_days integer ≥ 1, ≤ 365 Your calibration Optional
max_detail_rows integer ≥ 1, ≤ 5000 Numerical control Optional
maximum_interval_days integer ≥ 1, ≤ 3650 Your calibration Optional
minimum_interval_days integer ≥ 1, ≤ 3650 Your calibration Optional
risk_aversion number ≥ 0, ≤ 1 Your calibration Optional

Each assets record

Field Type Required
downtime_cost_per_hour number (≥ 0) Yes
failure_downtime_hours number (≥ 0) Yes
failure_models array of objects (3 fields) Yes
failure_recovery_cost number (≥ 0) Yes
id string (non-empty) Yes
planned_downtime_hours number (≥ 0) Yes
planned_maintenance_cost number (≥ 0) Yes
Example input
{
  "assets": [
    {
      "downtime_cost_per_hour": 500,
      "failure_downtime_hours": 24,
      "failure_models": [
        {
          "probability": 0.7,
          "scale_days": 100,
          "shape": 3
        },
        {
          "probability": 0.3,
          "scale_days": 80,
          "shape": 3
        }
      ],
      "failure_recovery_cost": 20000,
      "id": "primary-database-upgrade",
      "planned_downtime_hours": 1,
      "planned_maintenance_cost": 500
    }
  ],
  "maximum_interval_days": 300,
  "risk_aversion": 0.5
}

What you get back

This is the actual output of running the example above — computed by the same function the platform calls, not an illustration.

Example output
{
  "asset_policies": [
    {
      "asset_id": "primary-database-upgrade",
      "expected_annual_cost": 23620.0287,
      "expected_annual_savings_vs_run_to_failure": 115391.9701,
      "expected_availability": 0.997512,
      "expected_cycle_days": 21.9797,
      "failure_model_count": 2,
      "failures_per_year": 0.2259,
      "planned_events_per_year": 16.3917,
      "policy": "preventive_age_replacement",
      "replacement_interval_days": 22,
      "risk_adjusted_annual_cost": 25440.0648,
      "risk_adjusted_annual_savings_vs_run_to_failure": 124741.421,
      "run_to_failure_annual_cost": 139011.9988,
      "worst_case_annual_cost": 27260.1009
    }
  ],
  "assumptions": [
    "Each supplied Weibull model describes operating age to failure, and its probability represents parameter uncertainty fixed before policy selection.",
    "Failure behavior renews after replacement; repair quality, correlated incidents, capacity constraints, and time-varying hazards are not represented.",
    "Planned and failure costs include all material engineering, customer, compliance, and downtime consequences on a common monetary scale.",
    "The result is an age-replacement policy for services, dependencies, upgrades, or refactoring—not a schedule for maintaining people."
  ],
  "configuration": {
    "interval_step_days": 1,
    "maximum_interval_days": 300,
    "minimum_interval_days": 1,
    "risk_aversion": 0.5
  },
  "decision": "preventive_maintenance_portfolio_available",
  "method": "weibull_bayesian_renewal_reward_age_replacement_v1",
  "portfolio": {
    "assets": 1,
    "detail_rows_returned": 1,
    "detail_rows_truncated": 0,
    "expected_annual_cost": 23620.0287,
    "expected_annual_savings": 115391.9701,
    "preventive_asset_count": 1,
    "risk_adjusted_annual_cost": 25440.0648,
    "risk_adjusted_annual_savings": 124741.421,
    "run_to_failure_annual_cost": 139011.9988,
    "run_to_failure_asset_count": 0,

Truncated for display — the full payload is 47 lines.

How it works

Sequential Bayesian & bandits — Learn while deciding — update beliefs as evidence arrives and choose where the next unit of effort is worth spending.

  1. 1 Optimize preventive replacement or refactoring intervals with Bayesian-scenario Weibull renewal-reward economics and a worst-case cost penalty.
  2. 2 Evaluate the method-specific diagnostics and gates returned by the function, then abstain unless the declared decision clears them under locally governed thresholds.

Before you trust it

Every tool in the catalog ships with the conditions under which its answer is meaningful — and the conditions under which it should abstain instead of guessing.

Assumptions & guardrails

  • The likelihood or reward model, prior support, action logging, delayed outcomes, and any stationarity assumptions match the deployment process.
  • Posterior probability and adaptive selection are model-conditional; they are not substitutes for randomized propensities or guaranteed safety.

Minimum evidence

  • assets: required and organization-defined

How to validate it

Backtest the chosen action against simple feasible baselines on held-out scenarios, sweep costs/constraints/risk tolerance, and require constraint feasibility under adverse inputs.

Calibrating it to your org

Same for everyone

The mathematical kernel, validation rules, method version, and JSON output semantics are organization-independent; no tenant-trained coefficients or company benchmark is embedded in the function.

Specific to you

  • Weibull scale and shape posterior per service/dependency
  • planned and failure downtime distributions
  • planned maintenance cost
  • failure recovery cost
  • downtime cost per hour

Calibration workflow

  1. 1 Define the management decision, target outcome, aggregate unit, privacy boundary, cadence, and prediction/intervention horizon for this organization.
  2. 2 Build a tenant-scoped historical cohort using only information available before each prediction or decision; preserve zero periods, censoring, assignment probabilities, and unresolved outcomes when the method requires them.
  3. 3 Estimate statistical parameters on training history, but obtain costs, utilities, risk tolerance, practical-effect thresholds, capacity, and policy constraints from accountable decision owners.
  4. 4 Validate on later time windows or held-out aggregate units at the deployment grain, against a simple baseline and the function-specific validation strategy.
  5. 5 Deploy only if the returned decision clears evidence, overlap, calibration, robustness, and guardrail checks; warning, unsupported, schema-gap, and fallback decisions are abstentions.
  6. 6 Monitor realized outcomes, data drift, coverage, and decision regret; recalibrate at a governed cadence or after a detected regime/definition change, never merely because a stakeholder dislikes the result.

Call it from your AI

You don't wire up 388 tools in your MCP client. The GitRevio MCP server exposes 18 tools, three of which let an agent search the catalog, read a tool's schema, and run it — so the assistant finds this one on its own.

gitrevio_capabilities_search
  { "q": "optimize preventive replacement or refactoring intervals" }
  → finds "optimize_preventive_maintenance_policy"

gitrevio_capability_describe
  { "capability_id": "optimize_preventive_maintenance_policy" }
  → returns the input schema and agent guidance shown on this page

gitrevio_capability_run
  { "capability_id": "optimize_preventive_maintenance_policy", "arguments": { ... } }
  → returns the result shown above

Works in Claude Desktop, Claude Code, Cursor, Cline, Continue.dev, Goose and Aider. See the MCP server.

Related tools

Audit CI pipeline evidence integrity

Audit the complete point-in-time change-to-pipeline-to-job-to-rerun cohort, exposing missing CI, orphan records, future leakage, inconsistent required-job outcomes, incomplete provider evidence and same-configuration fail-then-pass flake proxies without scoring people.

Statistical audit & measurement

Audit incident learning evidence integrity

Audit the complete point-in-time incident-to-postmortem-to-corrective-action lineage, separating missing or contradictory evidence from genuine overdue learning debt without attributing individual fault.

Statistical audit & measurement

Audit operational alert decision integrity

Audit every point-in-time operational alert evaluation by recomputing fire/suppress decisions and verifying effective policy, cooldown, evidence freshness, context, controls, severity routing, acknowledgement, action and mature outcome lineage.

Constrained optimization

Audit root cause traceback evidence integrity

Audit whether an anomaly traceback is complete, point-in-time, multiplicity-controlled and honestly labeled as temporal or causal, including every upstream candidate, path lag, edge identification basis and later root-recovery validation.

Causal inference & experiment design

Estimate software reliability growth

Estimate long-run software reliability growth with a power-law nonhomogeneous Poisson process, bootstrap trend evidence, and future incident exposure.

Forecasting & survival

Estimate transportable root cause probability

Estimate how likely a mechanism actually caused an observed failure using transport-weighted Bayesian random-effects MCMC across remediation studies, posterior probability of necessity, convergence diagnostics and mandatory unmeasured-confounding sensitivity.

Sequential Bayesian & bandits

See every tool in Quality, incidents & reliability →

Ready to See Your Engineering work clearly?

Request a free demo