Skip to main content

Templates Library

Ready-to-deploy state contracts — the building blocks (protocols) pre-composed into running machines. Each template is a complete contract definition: states, transitions, the operators each transition fires, and (where it's autonomous) the triggers that drive it. Deploy one onto your machine in a single call and it starts running on your clock, every fire Zeqond-stamped onto your entangled state.

Browse the catalogue here, deploy from the Templates tab of the Contract IDE, or fetch any one over HTTP:

curl -sS https://zeqsdk.com/api/contracts/templates # list all
curl -sS https://zeqsdk.com/api/contracts/templates/categories # categories + counts
curl -sS https://zeqsdk.com/api/contracts/templates/<id> # one, full definition

Every template here is generated from the live catalogue (GET /api/contracts/templates), so the docs track the framework instead of drifting from it. To deploy, POST /api/contracts/templates/<id>/deploy with { "slug": "<your-machine>" } (auth: session) — see any template page for the exact call.


Mechanics

TemplateWhat it does
Force Threshold AlarmNM19 (F = ma) on every reading: idle → watching → alert when computed force crosses your limit. The classic structural-load watchdog.
Harmonic Fatigue WatchNM30 (F = −kx, x(t) = A·cos(ωt+φ)) tracks oscillation amplitude: nominal → worn → failing as displacement grows past tolerances.
Orbital Decay MonitorNM21 (F = G·m₁m₂/r²) per pass: stable_orbit → decaying → deorbit_planned as perigee altitude falls through declared floors.
Energy Conservation AuditorNM23 + NM24 + NM25 (KE + PE = const): balanced → violation when a system's energy books stop closing — the physics-grade sensor sanity check.
Momentum Surge DetectorNM26 (p = mv) + NM27 (Σp_init = Σp_final): flags momentum-balance breaks across a measured boundary — collisions, leaks, slippage.

Quantum

TemplateWhat it does
Eigenvalue Drift MonitorQM5 (Ĥ|ψ⟩ = E|ψ⟩) recomputed per window: calibrated → drifting → recalibrate when the measured energy level walks off the reference.
Tunneling Probability GateQM8 (T ∝ e^{−2∫√(2m(V−E))/ℏ² dx}): the gate opens only when computed transmission probability clears your threshold.
Photon Budget CounterQM10 (E = hν): integrates photon energy over a window — counting → saturated when the dose budget for a sample or sensor is spent.
Half-Life InventoryTM1 time-projection over decay law: stocked → monitor → dispose as remaining activity falls through regulatory thresholds.

Relativity

TemplateWhat it does
Schwarzschild Safety CheckGR37 (r_s = 2GM/c²) on every mass estimate: safe → critical when an object's radius approaches its own Schwarzschild radius. The honest compactness monitor.
Time Dilation LoggerGR35 (Δt = Δt₀√(1 − 2GM/rc² − v²/c²)): syncing → dilated — computes and chain-logs the correction every window. GPS-grade honesty.
Redshift ClassifierGR41 (z = (λ_obs − λ_emit)/λ_emit): classifies incoming spectra into local → significant → high-z bins, every classification proven on-chain.

Thermo & Information

TemplateWhat it does
Entropy Anomaly DetectorCS47 (E = −Σ p·log p) over your event stream: baseline → anomalous when Shannon entropy jumps — the physics-grade weirdness detector.
Landauer Energy AuditLZ1 (E = k_B·T·ln2 × bits_erased): converts a workload's bit erasures into joules — within_budget → over_budget against your thermal envelope.

Biophysics

TemplateWhat it does
HRV Readiness MonitorPSI96 oscillation + CS47 entropy over RR-intervals: rested → strained → overtrained, with every readiness call proven against the actual math.

Operations

TemplateWhat it does
SLA MonitorLatency/availability windows against declared SLOs: healthy → breach → escalated, every breach chain-stamped at the Zeqond it happened.
Data PipelineIngest → validate → publish with failure branches; every stage transition is an audited, Zeqond-stamped fact.
Device LifecycleRegistered → active → maintenance → retired for any fleet, with TM1 time-based service windows and a tamper-evident service history.

Foundations

TemplateWhat it does
Scheduled Compute (Heartbeat)The automation primitive — a self-firing transition on the HulyaPulse cadence. running → running every 60 Zeqonds (swap every_zeqonds for a cron expression like
Threshold Monitor (Generic)Domain-agnostic watchdog. Watches a stream of reading events; KO42 evaluates the windowed average each fire. normal → breached when the average over the last
Oracle Feed (External Ingest)Brings the outside world in. Every 60 Zeqonds it calls your registered oracle external protocol, binds the response, runs KO42, and emits oracle_datum — a s
Approval Workflow (N-of-M)Multi-party sign-off as a contract. pending → approved once N approve events land (default 3), or → rejected the moment a single reject event arrives. Every
Timelock Release GateA generic release gate — no funds, no escrow. held → released once N sign events land (default 2), or → expired when a one_shot deadline passes. Set at_unix
Supply-Chain ProvenanceTamper-evident custody chain. Each handoff event advances the chain and emits custody_changed; a delivered event closes it. Every hop is Zeqond-stamped on
Telemetry Rollup (IoT)Fleet telemetry aggregator. Sums a metric across every telemetry event in a rolling window; collecting → flagged when the windowed total crosses your quota, a
Rate Limiter (Windowed)A windowed rate gate. allowing → limiting when more than threshold request events land inside the rolling window (default 100 / 60 Zeqonds), and back when t
Subscription / Recurring BillingA subscription lifecycle on a cron clock. active emits invoice_due on its billing schedule (default the 1st of each month); a payment_failed event moves it
Attestation / Notary TimestampA perpetual notary. Each notarize event runs KO42 through compute → prove → verify and emits attested — binding the submission to the Zeqond it arrived and

Aerospace

TemplateWhat it does
Hohmann Transfer PlannerMinimum-fuel orbit raise: fires the first burn only when phase angle and Δv budget align, then sequences coast and circularisation. Every burn proven on-chain.
Re-entry Corridor GuardHolds a capsule's entry angle inside the survivable corridor: nominal → shallow/steep warnings → abort-to-orbit if the flight-path angle leaves bounds.

Structural Engineering

TemplateWhat it does
Von Mises Yield GateSTRESS_VON_MISES on live load data: safe → yielding → plastic as the equivalent stress approaches the material's yield strength. The structural-integrity tripwi
Beam Deflection LimitBEAM_DEFLECTION vs span/360 serviceability limit: within_limit → excessive, with a buckling escalation when the load nears the critical buckling threshold.
Fatigue Crack Inspection SchedulerParis-law crack growth: tracks crack length per load cycle and schedules inspection before it reaches critical size. The model behind aircraft & bridge maintena

Material Science

TemplateWhat it does
Alloy Spec ComplianceALLOY_MIXTURE checks a melt's composition against spec bands: in_spec → out_of_spec → rejected. Every heat's certificate is chain-stamped — provable provenance.
Thermal Expansion Mismatch GuardTHERMAL_EXPANSION on a bonded joint: bonded → stressed → delaminating as differential expansion across two materials exceeds the interface tolerance.
Vickers Hardness QAHARDNESS_VICKERS acceptance per part: pass → fail against the heat-treat spec window, with statistical-drift escalation across a batch.

Fluid Dynamics

TemplateWhat it does
Cavitation Onset GuardTracks local pressure vs vapour pressure: nominal → cavitating before bubble collapse pits the impeller. Protects pumps, propellers, and valves.
Turbulence Transition MonitorReynolds-number tracking: laminar → transitional → turbulent. Drives drag models, mixing control, and flow-assurance decisions in real time.

Seismology

TemplateWhat it does
Earthquake Early WarningP-wave detected → S-wave imminent → ALERT in the seconds-long window before destructive shaking arrives. Triggers automated shutoffs and public alerts.

Geophysics

TemplateWhat it does
Landslide Slope-Stability WatchFactor-of-safety on a monitored slope (rainfall + pore pressure + displacement): stable → creeping → imminent. Chain-stamped so warnings are defensible.
Groundwater Drawdown GuardAquifer drawdown (Theis): sustainable → over-extraction → critical as the water table falls past recharge-balanced limits. Protects aquifers from collapse.
Volcanic Tremor EscalationHarmonic-tremor energy + deformation: quiet → unrest → eruption-warning. Multi-signal escalation with a tamper-evident timeline for civil-protection decisions.

Chemical Process Safety

TemplateWhat it does
Reaction Runaway GuardArrhenius reaction rate vs the reactor's heat-removal capacity: controlled → accelerating → RUNAWAY with automatic quench. The model behind preventing real ther
Reaction Completion GateTracks conversion via reaction kinetics: reacting → complete when conversion crosses the target, with a stall branch if the rate flatlines early.

Energy & Grid

TemplateWhat it does
Grid Frequency StabilityMonitors grid frequency against the nominal band: nominal → deviation → load-shed before an under-frequency event cascades into a blackout.
Carnot Efficiency AuditTHERMO_CARNOT ceiling vs measured efficiency: efficient → degraded as a heat engine's real efficiency drifts below its tier of the Carnot limit. Catches fouling
Solar Yield OptimizerSOLAR_OPTIMIZE on irradiance + temperature: tracking → curtail when output exceeds inverter/grid limits, derate on over-temperature. Maximises captured energy s
Transformer Overload GuardPOWER_LOSS + thermal model: normal → overloaded → trip as winding temperature and loss exceed the unit's rating. Extends asset life, prevents fires.

Nuclear

TemplateWhat it does
Reactor Criticality MarginTracks effective multiplication factor k_eff: subcritical → critical → supercritical-warning with automatic scram. The core reactivity-safety contract.
Decay-Heat Removal WatchPost-shutdown decay heat vs cooling capacity: adequate → marginal → insufficient. The Fukushima-class failure mode, made continuously provable.

Medical

TemplateWhat it does
Infusion Safety MonitorPharmacokinetic steady-state: sub-therapeutic → therapeutic → TOXIC as predicted plasma concentration crosses the therapeutic window. Guards continuous-infusion
Renal Dose AdjusterMED_GFR + MED_CLEARANCE: normal → reduce-dose → hold as estimated renal function falls, preventing accumulation of renally-cleared drugs.
Cardiac Rhythm WatchNM30 (x(t)=A·cos(ωt+φ)) tracks beat-to-beat rate excursion: sinus → arrhythmia → alert when the rhythm leaves its declared envelope for too many beats. A physic

Neuroscience

TemplateWhat it does
Seizure-Onset DetectorEEG band-power + entropy: baseline → pre-ictal → ictal, firing an alert in the pre-ictal window so responsive therapy or carers can act.

Biotech

TemplateWhat it does
PCR Amplification CyclerPCR_AMPLIFICATION tracks copy number per cycle: amplifying → plateau → done at target yield, with a no-amplification failure branch. Chain-logged for assay prov
Bioreactor Growth ControlCELL_GROWTH + ENZYME_ACTIVITY: lag → exponential → harvest, feeding and harvesting at the right density. The backbone of cultured production.
Protein Fold Stability GatePROTEIN_FOLD free-energy: folded → unfolding as ΔG crosses the stability threshold under temperature/pH stress. De-risks formulation and storage.

Robotics

TemplateWhat it does
Joint Torque SafetyTORQUE_DYNAMICS per joint: within_limit → over-torque stop, protecting actuators and anything (or anyone) the arm contacts.
Trajectory Feasibility GateTRAJECTORY_PLANNING + INVERSE_KINEMATICS: planned → infeasible if a path violates reach, velocity, or collision limits before it ever executes.

Control Systems

TemplateWhat it does
Control-Loop Stability MarginCT phase/gain margin tracking: stable → marginal → unstable as a closed loop's margins erode (sensor lag, plant drift). Catches oscillation before it runs away.

Signal Processing

TemplateWhat it does
SNR Degradation MonitorSignal-to-noise tracking on a live channel: clean → degraded → lost, with chain-stamped link-budget events for telecom and sensing.

Climate Science

TemplateWhat it does
Carbon Budget TrackerCLIM_RADIATIVE_FORCING against a remaining-budget threshold: on_track → over_budget, with chain-stamped accounting that auditors can verify independently.

Environmental

TemplateWhat it does
Air Quality EscalationAIR_QUALITY_INDEX bands: good → unhealthy → hazardous, driving public advisories and automated ventilation/industrial-curtailment responses.
Water Contamination GateWATER_QUALITY composite: potable → advisory → unsafe, holding distribution until contaminant indices return below limits. Provable public-health record.

Finance & Risk

TemplateWhat it does
Value-at-Risk Breach MonitorVAR_HISTORICAL + PORTFOLIO_VARIANCE: within_limit → breach → de-risk as the portfolio's VaR crosses the desk's risk limit. Every breach time-stamped on-chain fo

Photonics

TemplateWhat it does
Laser Gain Threshold GatePHOT_GAIN_THRESHOLD: below_threshold → lasing → over-drive protection as cavity gain crosses the lasing threshold and then the damage limit.

Acoustics

TemplateWhat it does
Noise Exposure Dose TrackerIntegrates A-weighted sound exposure over a shift: safe → approaching-limit → over-limit per OSHA/EU dose rules. Hearing-protection compliance, provable per wor

Electromagnetism

TemplateWhat it does
EM Field Exposure SafetyEM field-strength vs ICNIRP exposure limits: safe → caution → over-limit near high-power RF / magnets. Worker-safety record that holds up to inspection.

Network Science

TemplateWhat it does
Cascade Failure RiskNET_BETWEENNESS + PageRank load: resilient → fragile → cascade-risk as load concentrates on critical nodes. For power grids, supply chains, and infra networks.

Astrophysics

TemplateWhat it does
Exoplanet Transit DetectorLight-curve dip detection: baseline → candidate-transit → confirmed as periodic dimming clears depth and periodicity thresholds. Survey-pipeline triage, proven

Plasma Physics

TemplateWhat it does
Fusion Confinement MonitorTriple-product confinement vs ignition criterion: subignition → confined → disruption-risk. The control surface for tokamak / stellarator shots.

Condensed Matter

TemplateWhat it does
Superconductor Tc GuardCritical-temperature / critical-current margin: superconducting → approaching-quench → normal as a magnet nears its quench boundary. Protects MRI, fusion, and a

Atmospheric Science

TemplateWhat it does
Storm Intensification WatchTracks cyclone intensification rate from pressure + SST: tracked → intensifying → rapid-intensification alert. Drives evacuation lead time when it matters most.

Thermodynamics

TemplateWhat it does
Heat Exchanger Fouling MonitorTHERMO_HEAT_TRANSFER effectiveness decline: clean → fouling → clean-now as the heat-transfer coefficient drops below the cleaning threshold. Schedules maintenan

Bioinformatics

TemplateWhat it does
Variant Significance GateBIO_BLAST_EVALUE: screening → significant-hit as alignment E-value clears the significance threshold. Flags meaningful matches in genomic search pipelines.

Optics

TemplateWhat it does
Diffraction Limit GateRayleigh resolution check: resolved → unresolved as feature spacing falls below the diffraction limit for the system's NA and wavelength. Imaging / metrology QA

Mechanical Engineering

TemplateWhat it does
Pressure Vessel FEA GateFEA displacement + stress analysis vs ASME-style allowables: within_code → exceedance → derate. Continuous code-compliance for pressure equipment.

Atomic Physics

TemplateWhat it does
Spectral Line ClassifierIdentifies elements from emission/absorption lines: scanning → identified → flagged when an unexpected line appears. Real-time spectroscopy with a provable dete

Cryptography

TemplateWhat it does
RNG Entropy Health GateCRYPTO_ENTROPY on a random source: healthy → degraded → fail, holding key generation when entropy drops below the security floor. Prevents weak-key disasters.

Statistical Mechanics

TemplateWhat it does
Phase Transition DetectorOrder-parameter + susceptibility: ordered → critical → disordered as a system crosses a phase boundary. From material processing to network percolation.

Network & Comms

TemplateWhat it does
Traffic Entropy AnomalyCS47 (Shannon entropy, E=−∑p·log p) per window: nominal → anomalous when source/destination entropy collapses below the floor (flood/DDoS uniformity) → flagged

Gaming & Simulation

TemplateWhat it does
Game Physics Anti-CheatNM27 (Σp conserved) + NM23 (KE=½mv²): valid → suspect when a player's momentum books stop closing, → flagged when kinetic energy exceeds the engine cap. Catches

Aerospace & Defense

TemplateWhat it does
Ballistic Intercept WindowNM21 (F=G·m₁m₂/r²) + NM28 (L=r×p): tracking → window_open as closing range crosses the intercept envelope, → committed when intercept confidence clears threshol

Agriculture & IoT

TemplateWhat it does
Irrigation Pressure GuardNM24 (PE=mgh, water-column head): nominal → low_pressure when line head drops below the minimum, → fault when the pressure drop crosses the leak/burst threshold

Next

  • State Contracts — the contract model: conditions, triggers, pre/post actions, lifecycle, verification.
  • Contract IDE — Generate / Templates / Expert modes; the Saved tab is the home for everything you deploy.
  • Protocols — the named building blocks a transition composes.
  • Operators — the verb each transition fires through the master equation.