Edge, ruin and finish
Three experiences as policies your product runs on the signals, with reference code, the cues each gives on the sandbox scenarios, and the safety they need.
Edge, ruin and finish are policies: rules your product applies to imminence and to the orgasm calls to decide what to do next. orgasm.dev gives you the signals; the reference presets below turn them into cues, and what a cue does (lower an intensity, slow a scene, pause a level) is yours to decide. orgasm.dev does count what came of them, at the presets' own levels: each edge (edge.completed), each ruin (ruined on orgasm.end, from your stimulation reports) and each orgasm, which is what a live session is charged for.
| Cue | Means |
|---|---|
build | Increase, or continue increasing |
hold | Stop increasing; keep the current level |
back_off | Reduce or pause, now |
resume | Start building again after a rest |
sustain | Keep going through the orgasm that has begun |
ease_off | Wind down gently |
stop | Stop stimulation now, and for good |
The thresholds are starting values to tune for each person and each experience, not calibrated operating points. The sandbox scenarios are scripted and do not react to cues; the charts show what the presets would do on them.
Edge
Approach the point of no return and back away, as often as the person wants. The preset holds once p60 reaches 0.5, backs off once p30 reaches 0.6, and resumes only after a minute's rest and once p30 is below 0.3. It returns from holding to building only well below the hold level, so it does not flap. An onset or a peak means the edge was crossed; the preset stops. Each approach that reaches the back-off level and falls below the resume level with no orgasm is an edge, and orgasm.dev sends edge.completed for it.
| at | cue | because |
|---|---|---|
| 62 s | build | imminence is available |
| 306 s | hold | p60 0.51 ≥ 0.5 |
| 362 s | back_off | p30 0.60 ≥ 0.6 |
| 422 s | resume | rested 60 s and p30 0.17 < 0.3 |
| 501 s | hold | p60 0.51 ≥ 0.5 |
| 548 s | back_off | p30 0.61 ≥ 0.6 |
| 608 s | resume | rested 60 s and p30 0.21 < 0.3 |
| 692 s | hold | p60 0.52 ≥ 0.5 |
| 747 s | back_off | p30 0.61 ≥ 0.6 |
| 807 s | resume | rested 60 s and p30 0.23 < 0.3 |
Ruin
Build to the point of no return, then stop completely and for good. The stop comes from imminence (p30 at 0.75), because an orgasm call arrives a few seconds after the moment it names, which is too late to time a ruin. If a call arrives first, the preset stops at once. Report the stop with reportStimulation as it happens: an orgasm that begins within 30 seconds of it is counted as a ruin, and its orgasm.end says ruined: true.
| at | cue | because |
|---|---|---|
| 62 s | build | imminence is available |
| 586 s | stop | p30 0.77 ≥ 0.75: the point of no return |
Finish
Build to an orgasm and carry the person through it, then ease off. For a woman, sustain runs from the onset to the end; for a man, the peak is the orgasm. With orgasms above 1 the preset builds again after each, until the count is reached.
| at | cue | because |
|---|---|---|
| 62 s | build | imminence is available |
| 545.4 s | sustain | onset called; keep going through it |
| 576 s | build | end called; 1 of 2, continue |
| 647.2 s | sustain | onset called; keep going through it |
| 672.9 s | ease_off | end called; 2 of 2 finished |
The code
Each preset is a function of the event stream: feed it every event in sequence order and act on the cues it returns. Copy it into your product and tune it.
// Reference implementations of the edge, ruin and finish presets.
//
// A preset is a policy your product runs on the event stream; it is not
// something orgasm.dev detects. Each preset reads `imminence.updated` and the
// orgasm calls and answers with a cue for your experience: build, hold, back
// off, resume, sustain, ease off or stop. What a cue does (lower an intensity,
// slow a scene, pause a game) is yours to decide.
//
// The thresholds are starting values to tune per person, not calibrated
// operating points. Signals can be wrong: never raise intensity on a signal
// alone, and keep a stop control that works whatever the signals say.
export type Cue = 'build' | 'hold' | 'back_off' | 'resume' | 'sustain' | 'ease_off' | 'stop';
export interface CueEvent {
cue: Cue;
/** Stream seconds of the event that produced the cue. */
atS: number;
reason: string;
}
/** The parts of an orgasm.dev event a preset reads. */
export interface PresetInput {
type: string;
streamTimeS: number;
data?: unknown;
}
export interface Preset {
readonly name: 'edge' | 'ruin' | 'finish';
/** Feed every event in `sequence` order; returns a cue when one is due. */
next(event: PresetInput): CueEvent | null;
}
interface Imminence {
p30: number | null;
p60: number | null;
}
const imminenceOf = (event: PresetInput): Imminence | null =>
event.type === 'imminence.updated' ? (event.data as Imminence) : null;
const ended = (event: PresetInput) =>
event.type === 'session.status' && (event.data as { status?: string } | undefined)?.status === 'ended';
const orgasmIndexOf = (event: PresetInput) => (event.data as { orgasmIndex: number }).orgasmIndex;
const fmt = (p: number) => p.toFixed(2);
export interface EdgeOptions {
/** Stop increasing once p60 reaches this. */
holdAtP60?: number;
/** Back off once p30 reaches this. */
backOffAtP30?: number;
/** Resume only once p30 is below this... */
resumeBelowP30?: number;
/** ...and at least this many seconds have passed since backing off. */
restS?: number;
}
/**
* Edge: approach the point of no return and back away, as many times as the
* person wants. An onset or a peak means the edge was crossed; the preset
* then stops.
*/
export function edge(options: EdgeOptions = {}): Preset {
const { holdAtP60 = 0.5, backOffAtP30 = 0.6, resumeBelowP30 = 0.3, restS = 60 } = options;
let state: 'idle' | 'building' | 'holding' | 'resting' | 'done' = 'idle';
let restingSince = 0;
return {
name: 'edge',
next(event) {
if (state === 'done') return null;
const t = event.streamTimeS;
if (ended(event)) {
state = 'done';
return null;
}
if (event.type === 'orgasm.onset' || event.type === 'orgasm.peak') {
state = 'done';
return { cue: 'stop', atS: t, reason: 'an orgasm began, so the edge was crossed' };
}
const im = imminenceOf(event);
if (!im) return null;
if (im.p30 === null || im.p60 === null) {
if (state === 'building' || state === 'idle') {
state = 'holding';
return { cue: 'hold', atS: t, reason: 'no face reading; do not increase without one' };
}
return null;
}
if (state === 'idle') {
state = 'building';
return { cue: 'build', atS: t, reason: 'imminence is available' };
}
if (state === 'resting') {
if (t - restingSince >= restS && im.p30 < resumeBelowP30) {
state = 'building';
return { cue: 'resume', atS: t, reason: `rested ${Math.round(t - restingSince)} s and p30 ${fmt(im.p30)} < ${resumeBelowP30}` };
}
return null;
}
if (im.p30 >= backOffAtP30) {
state = 'resting';
restingSince = t;
return { cue: 'back_off', atS: t, reason: `p30 ${fmt(im.p30)} ≥ ${backOffAtP30}` };
}
if (state === 'building' && im.p60 >= holdAtP60) {
state = 'holding';
return { cue: 'hold', atS: t, reason: `p60 ${fmt(im.p60)} ≥ ${holdAtP60}` };
}
// Hysteresis: return to building only well below the hold level.
if (state === 'holding' && im.p60 < holdAtP60 - 0.1) {
state = 'building';
return { cue: 'build', atS: t, reason: `p60 ${fmt(im.p60)} < ${fmt(holdAtP60 - 0.1)}` };
}
return null;
},
};
}
export interface RuinOptions {
/** Stop for good once p30 reaches this: the point of no return. */
stopAtP30?: number;
}
/**
* Ruin: build to the point of no return, then stop stimulation completely and
* for good. The stop comes from imminence, because orgasm calls arrive a few
* seconds after the moment they name, which is too late to time a ruin.
*/
export function ruin(options: RuinOptions = {}): Preset {
const { stopAtP30 = 0.75 } = options;
let state: 'idle' | 'building' | 'holding' | 'done' = 'idle';
return {
name: 'ruin',
next(event) {
if (state === 'done') return null;
const t = event.streamTimeS;
if (ended(event)) {
state = 'done';
return null;
}
if (event.type === 'orgasm.onset' || event.type === 'orgasm.peak') {
state = 'done';
return { cue: 'stop', atS: t, reason: 'an orgasm was called before the stop level; stop now' };
}
const im = imminenceOf(event);
if (!im) return null;
if (im.p30 === null) {
if (state !== 'holding') {
state = 'holding';
return { cue: 'hold', atS: t, reason: 'no face reading; do not increase without one' };
}
return null;
}
if (im.p30 >= stopAtP30) {
state = 'done';
return { cue: 'stop', atS: t, reason: `p30 ${fmt(im.p30)} ≥ ${stopAtP30}: the point of no return` };
}
if (state !== 'building') {
state = 'building';
return { cue: 'build', atS: t, reason: 'imminence is available' };
}
return null;
},
};
}
export interface FinishOptions {
/** How many orgasms to finish before easing off. */
orgasms?: number;
}
/**
* Finish: build to an orgasm and through it, then ease off. A woman's orgasm
* runs from its onset to its end; a man's is reached at its peak.
*/
export function finish(options: FinishOptions = {}): Preset {
const { orgasms = 1 } = options;
let state: 'idle' | 'building' | 'holding' | 'sustaining' | 'done' = 'idle';
const reached = new Set<number>();
const reach = (t: number, index: number, what: string): CueEvent | null => {
if (reached.has(index)) return null;
reached.add(index);
if (reached.size >= orgasms) {
state = 'done';
return { cue: 'ease_off', atS: t, reason: `${what}; ${reached.size} of ${orgasms} finished` };
}
state = 'building';
return { cue: 'build', atS: t, reason: `${what}; ${reached.size} of ${orgasms}, continue` };
};
return {
name: 'finish',
next(event) {
if (state === 'done') return null;
const t = event.streamTimeS;
if (ended(event)) {
state = 'done';
return null;
}
if (event.type === 'orgasm.onset') {
state = 'sustaining';
return { cue: 'sustain', atS: t, reason: 'onset called; keep going through it' };
}
if (event.type === 'orgasm.peak') return reach(t, orgasmIndexOf(event), 'peak called');
if (event.type === 'orgasm.end') return reach(t, orgasmIndexOf(event), 'end called');
const im = imminenceOf(event);
if (!im || state === 'sustaining') return null;
if (im.p30 === null) {
if (state === 'building' || state === 'idle') {
state = 'holding';
return { cue: 'hold', atS: t, reason: 'no face reading; do not increase without one' };
}
return null;
}
if (state !== 'building') {
state = 'building';
return { cue: 'build', atS: t, reason: 'imminence is available' };
}
return null;
},
};
}
export const presets = { edge, ruin, finish };
/** Runs a preset over a list of events and returns every cue it gives. */
export function cuesFor(preset: Preset, events: PresetInput[]): CueEvent[] {
const cues: CueEvent[] = [];
for (const event of events) {
const cue = preset.next(event);
if (cue) cues.push(cue);
}
return cues;
}
Safety
Every experience built on these signals needs the following, whatever the preset:
- A stop that always works. The person can end stimulation instantly at any moment, with a control that does not depend on the signals, the network or your server.
- Signals advise; limits decide. Never raise intensity on a signal alone, and cap intensity in the device, not in the policy. Treat a
nullreading as unknown and hold. - False calls and missed calls happen. If a call has consequences in your experience (a forfeit, a reset, a reward), the person agreed to them in advance and can contest a call.
- Electrical stimulation has its own rules. Follow the device maker's instructions; never pass current across the chest or near the heart, and never use it with a pacemaker or another implanted device.
- Consent is ongoing. Denial, ruin and long edging are intense. Check in, let the person change the preset or stop mid-session, and plan for rest and aftercare.