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
| Template | What it does |
|---|---|
| Force Threshold Alarm | NM19 (F = ma) on every reading: idle → watching → alert when computed force crosses your limit. The classic structural-load watchdog. |
| Harmonic Fatigue Watch | NM30 (F = −kx, x(t) = A·cos(ωt+φ)) tracks oscillation amplitude: nominal → worn → failing as displacement grows past tolerances. |
| Orbital Decay Monitor | NM21 (F = G·m₁m₂/r²) per pass: stable_orbit → decaying → deorbit_planned as perigee altitude falls through declared floors. |
| Energy Conservation Auditor | NM23 + NM24 + NM25 (KE + PE = const): balanced → violation when a system's energy books stop closing — the physics-grade sensor sanity check. |
| Momentum Surge Detector | NM26 (p = mv) + NM27 (Σp_init = Σp_final): flags momentum-balance breaks across a measured boundary — collisions, leaks, slippage. |
Quantum
| Template | What it does |
|---|---|
| Eigenvalue Drift Monitor | QM5 (Ĥ|ψ⟩ = E|ψ⟩) recomputed per window: calibrated → drifting → recalibrate when the measured energy level walks off the reference. |
| Tunneling Probability Gate | QM8 (T ∝ e^{−2∫√(2m(V−E))/ℏ² dx}): the gate opens only when computed transmission probability clears your threshold. |
| Photon Budget Counter | QM10 (E = hν): integrates photon energy over a window — counting → saturated when the dose budget for a sample or sensor is spent. |
| Half-Life Inventory | TM1 time-projection over decay law: stocked → monitor → dispose as remaining activity falls through regulatory thresholds. |
Relativity
| Template | What it does |
|---|---|
| Schwarzschild Safety Check | GR37 (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 Logger | GR35 (Δt = Δt₀√(1 − 2GM/rc² − v²/c²)): syncing → dilated — computes and chain-logs the correction every window. GPS-grade honesty. |
| Redshift Classifier | GR41 (z = (λ_obs − λ_emit)/λ_emit): classifies incoming spectra into local → significant → high-z bins, every classification proven on-chain. |
Thermo & Information
| Template | What it does |
|---|---|
| Entropy Anomaly Detector | CS47 (E = −Σ p·log p) over your event stream: baseline → anomalous when Shannon entropy jumps — the physics-grade weirdness detector. |
| Landauer Energy Audit | LZ1 (E = k_B·T·ln2 × bits_erased): converts a workload's bit erasures into joules — within_budget → over_budget against your thermal envelope. |
Biophysics
| Template | What it does |
|---|---|
| HRV Readiness Monitor | PSI96 oscillation + CS47 entropy over RR-intervals: rested → strained → overtrained, with every readiness call proven against the actual math. |
Operations
| Template | What it does |
|---|---|
| SLA Monitor | Latency/availability windows against declared SLOs: healthy → breach → escalated, every breach chain-stamped at the Zeqond it happened. |
| Data Pipeline | Ingest → validate → publish with failure branches; every stage transition is an audited, Zeqond-stamped fact. |
| Device Lifecycle | Registered → active → maintenance → retired for any fleet, with TM1 time-based service windows and a tamper-evident service history. |
Foundations
| Template | What 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 Gate | A 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 Provenance | Tamper-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 Billing | A 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 Timestamp | A perpetual notary. Each notarize event runs KO42 through compute → prove → verify and emits attested — binding the submission to the Zeqond it arrived and |
Aerospace
| Template | What it does |
|---|---|
| Hohmann Transfer Planner | Minimum-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 Guard | Holds 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
| Template | What it does |
|---|---|
| Von Mises Yield Gate | STRESS_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 Limit | BEAM_DEFLECTION vs span/360 serviceability limit: within_limit → excessive, with a buckling escalation when the load nears the critical buckling threshold. |
| Fatigue Crack Inspection Scheduler | Paris-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
| Template | What it does |
|---|---|
| Alloy Spec Compliance | ALLOY_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 Guard | THERMAL_EXPANSION on a bonded joint: bonded → stressed → delaminating as differential expansion across two materials exceeds the interface tolerance. |
| Vickers Hardness QA | HARDNESS_VICKERS acceptance per part: pass → fail against the heat-treat spec window, with statistical-drift escalation across a batch. |
Fluid Dynamics
| Template | What it does |
|---|---|
| Cavitation Onset Guard | Tracks local pressure vs vapour pressure: nominal → cavitating before bubble collapse pits the impeller. Protects pumps, propellers, and valves. |
| Turbulence Transition Monitor | Reynolds-number tracking: laminar → transitional → turbulent. Drives drag models, mixing control, and flow-assurance decisions in real time. |
Seismology
| Template | What it does |
|---|---|
| Earthquake Early Warning | P-wave detected → S-wave imminent → ALERT in the seconds-long window before destructive shaking arrives. Triggers automated shutoffs and public alerts. |
Geophysics
| Template | What it does |
|---|---|
| Landslide Slope-Stability Watch | Factor-of-safety on a monitored slope (rainfall + pore pressure + displacement): stable → creeping → imminent. Chain-stamped so warnings are defensible. |
| Groundwater Drawdown Guard | Aquifer drawdown (Theis): sustainable → over-extraction → critical as the water table falls past recharge-balanced limits. Protects aquifers from collapse. |
| Volcanic Tremor Escalation | Harmonic-tremor energy + deformation: quiet → unrest → eruption-warning. Multi-signal escalation with a tamper-evident timeline for civil-protection decisions. |
Chemical Process Safety
| Template | What it does |
|---|---|
| Reaction Runaway Guard | Arrhenius reaction rate vs the reactor's heat-removal capacity: controlled → accelerating → RUNAWAY with automatic quench. The model behind preventing real ther |
| Reaction Completion Gate | Tracks conversion via reaction kinetics: reacting → complete when conversion crosses the target, with a stall branch if the rate flatlines early. |
Energy & Grid
| Template | What it does |
|---|---|
| Grid Frequency Stability | Monitors grid frequency against the nominal band: nominal → deviation → load-shed before an under-frequency event cascades into a blackout. |
| Carnot Efficiency Audit | THERMO_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 Optimizer | SOLAR_OPTIMIZE on irradiance + temperature: tracking → curtail when output exceeds inverter/grid limits, derate on over-temperature. Maximises captured energy s |
| Transformer Overload Guard | POWER_LOSS + thermal model: normal → overloaded → trip as winding temperature and loss exceed the unit's rating. Extends asset life, prevents fires. |
Nuclear
| Template | What it does |
|---|---|
| Reactor Criticality Margin | Tracks effective multiplication factor k_eff: subcritical → critical → supercritical-warning with automatic scram. The core reactivity-safety contract. |
| Decay-Heat Removal Watch | Post-shutdown decay heat vs cooling capacity: adequate → marginal → insufficient. The Fukushima-class failure mode, made continuously provable. |
Medical
| Template | What it does |
|---|---|
| Infusion Safety Monitor | Pharmacokinetic steady-state: sub-therapeutic → therapeutic → TOXIC as predicted plasma concentration crosses the therapeutic window. Guards continuous-infusion |
| Renal Dose Adjuster | MED_GFR + MED_CLEARANCE: normal → reduce-dose → hold as estimated renal function falls, preventing accumulation of renally-cleared drugs. |
| Cardiac Rhythm Watch | NM30 (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
| Template | What it does |
|---|---|
| Seizure-Onset Detector | EEG band-power + entropy: baseline → pre-ictal → ictal, firing an alert in the pre-ictal window so responsive therapy or carers can act. |
Biotech
| Template | What it does |
|---|---|
| PCR Amplification Cycler | PCR_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 Control | CELL_GROWTH + ENZYME_ACTIVITY: lag → exponential → harvest, feeding and harvesting at the right density. The backbone of cultured production. |
| Protein Fold Stability Gate | PROTEIN_FOLD free-energy: folded → unfolding as ΔG crosses the stability threshold under temperature/pH stress. De-risks formulation and storage. |
Robotics
| Template | What it does |
|---|---|
| Joint Torque Safety | TORQUE_DYNAMICS per joint: within_limit → over-torque stop, protecting actuators and anything (or anyone) the arm contacts. |
| Trajectory Feasibility Gate | TRAJECTORY_PLANNING + INVERSE_KINEMATICS: planned → infeasible if a path violates reach, velocity, or collision limits before it ever executes. |
Control Systems
| Template | What it does |
|---|---|
| Control-Loop Stability Margin | CT 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
| Template | What it does |
|---|---|
| SNR Degradation Monitor | Signal-to-noise tracking on a live channel: clean → degraded → lost, with chain-stamped link-budget events for telecom and sensing. |
Climate Science
| Template | What it does |
|---|---|
| Carbon Budget Tracker | CLIM_RADIATIVE_FORCING against a remaining-budget threshold: on_track → over_budget, with chain-stamped accounting that auditors can verify independently. |
Environmental
| Template | What it does |
|---|---|
| Air Quality Escalation | AIR_QUALITY_INDEX bands: good → unhealthy → hazardous, driving public advisories and automated ventilation/industrial-curtailment responses. |
| Water Contamination Gate | WATER_QUALITY composite: potable → advisory → unsafe, holding distribution until contaminant indices return below limits. Provable public-health record. |
Finance & Risk
| Template | What it does |
|---|---|
| Value-at-Risk Breach Monitor | VAR_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
| Template | What it does |
|---|---|
| Laser Gain Threshold Gate | PHOT_GAIN_THRESHOLD: below_threshold → lasing → over-drive protection as cavity gain crosses the lasing threshold and then the damage limit. |
Acoustics
| Template | What it does |
|---|---|
| Noise Exposure Dose Tracker | Integrates A-weighted sound exposure over a shift: safe → approaching-limit → over-limit per OSHA/EU dose rules. Hearing-protection compliance, provable per wor |
Electromagnetism
| Template | What it does |
|---|---|
| EM Field Exposure Safety | EM 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
| Template | What it does |
|---|---|
| Cascade Failure Risk | NET_BETWEENNESS + PageRank load: resilient → fragile → cascade-risk as load concentrates on critical nodes. For power grids, supply chains, and infra networks. |
Astrophysics
| Template | What it does |
|---|---|
| Exoplanet Transit Detector | Light-curve dip detection: baseline → candidate-transit → confirmed as periodic dimming clears depth and periodicity thresholds. Survey-pipeline triage, proven |
Plasma Physics
| Template | What it does |
|---|---|
| Fusion Confinement Monitor | Triple-product confinement vs ignition criterion: subignition → confined → disruption-risk. The control surface for tokamak / stellarator shots. |
Condensed Matter
| Template | What it does |
|---|---|
| Superconductor Tc Guard | Critical-temperature / critical-current margin: superconducting → approaching-quench → normal as a magnet nears its quench boundary. Protects MRI, fusion, and a |
Atmospheric Science
| Template | What it does |
|---|---|
| Storm Intensification Watch | Tracks cyclone intensification rate from pressure + SST: tracked → intensifying → rapid-intensification alert. Drives evacuation lead time when it matters most. |
Thermodynamics
| Template | What it does |
|---|---|
| Heat Exchanger Fouling Monitor | THERMO_HEAT_TRANSFER effectiveness decline: clean → fouling → clean-now as the heat-transfer coefficient drops below the cleaning threshold. Schedules maintenan |
Bioinformatics
| Template | What it does |
|---|---|
| Variant Significance Gate | BIO_BLAST_EVALUE: screening → significant-hit as alignment E-value clears the significance threshold. Flags meaningful matches in genomic search pipelines. |
Optics
| Template | What it does |
|---|---|
| Diffraction Limit Gate | Rayleigh resolution check: resolved → unresolved as feature spacing falls below the diffraction limit for the system's NA and wavelength. Imaging / metrology QA |
Mechanical Engineering
| Template | What it does |
|---|---|
| Pressure Vessel FEA Gate | FEA displacement + stress analysis vs ASME-style allowables: within_code → exceedance → derate. Continuous code-compliance for pressure equipment. |
Atomic Physics
| Template | What it does |
|---|---|
| Spectral Line Classifier | Identifies elements from emission/absorption lines: scanning → identified → flagged when an unexpected line appears. Real-time spectroscopy with a provable dete |
Cryptography
| Template | What it does |
|---|---|
| RNG Entropy Health Gate | CRYPTO_ENTROPY on a random source: healthy → degraded → fail, holding key generation when entropy drops below the security floor. Prevents weak-key disasters. |
Statistical Mechanics
| Template | What it does |
|---|---|
| Phase Transition Detector | Order-parameter + susceptibility: ordered → critical → disordered as a system crosses a phase boundary. From material processing to network percolation. |
Network & Comms
| Template | What it does |
|---|---|
| Traffic Entropy Anomaly | CS47 (Shannon entropy, E=−∑p·log p) per window: nominal → anomalous when source/destination entropy collapses below the floor (flood/DDoS uniformity) → flagged |
Gaming & Simulation
| Template | What it does |
|---|---|
| Game Physics Anti-Cheat | NM27 (Σ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
| Template | What it does |
|---|---|
| Ballistic Intercept Window | NM21 (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
| Template | What it does |
|---|---|
| Irrigation Pressure Guard | NM24 (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.