Skip to content

OpCodes Reference

All MFBP OpCodes with wire format details. All multi-byte integers are little-endian.


Creates a new lineage with initial energy.

FieldTypeDescription
key_lenu16Key length
key[u8]UTF-8 key bytes
energyf32Initial energy

Response: id: u32 Errors: ALREADY_EXISTS


Retrieves lineage metadata. Triggers Observer Effect (+0.01 energy) unless NO_SIDE_EFFECTS.

FieldTypeDescription
key_lenu16Key length
key[u8]UTF-8 key bytes
flagsu8?Optional query flags

Response:

FieldTypeDescription
statusu8See status codes
energyf32Current energy
rigidityf32Trauma marker
createdu64Unix timestamp
accessedu64Last access time

Status: 0x00 FOUND · 0x01 NOT_FOUND · 0x02 REPRESSED · 0x03 DORMANT

Flags: 0x01 BYPASS · 0x02 INCLUDE_REPRESSED · 0x04 NO_SIDE_EFFECTS · 0x07 FORENSIC


Injects energy delta. Triggers synaptic cascade unless NO_PROPAGATE.

FieldTypeDescription
key_lenu16Key length
key[u8]UTF-8 key bytes
deltaf32Energy to inject
flagsu8?0x01 NO_PROPAGATE

Response: OK


Soft-deletes a lineage (sets energy to 0).

FieldTypeDescription
key_lenu16Key length
key[u8]UTF-8 key bytes

Response: OK


Updates last access time without side effects.

FieldTypeDescription
key_lenu16Key length
key[u8]UTF-8 key bytes

Response: OK


Creates or updates a directed bond.

FieldTypeDescription
src_lenu16Source key length
src[u8]Source key
tgt_lenu16Target key length
tgt[u8]Target key
strengthf32Bond strength (0.0–1.0)
polarityi8+1 synergy · 0 neutral · -1 antagonism

Response: OK


Strengthens an existing bond by delta.

FieldTypeDescription
src_lenu16Source key length
src[u8]Source key
tgt_lenu16Target key length
tgt[u8]Target key
deltaf32Strength delta

Response: OK


Removes a bond between two lineages.

FieldTypeDescription
src_lenu16Source key length
src[u8]Source key
tgt_lenu16Target key length
tgt[u8]Target key

Response: OK


Returns all lineages bonded to key.

FieldTypeDescription
key_lenu16Key length
key[u8]UTF-8 key bytes

Response: count: u32 followed by repeating [key_len, key, strength, polarity]


Returns lineages above energy threshold.

FieldTypeDescription
min_energyf32Minimum energy

Response: count: u32 + [key_len, key, energy]...


Returns top K lineages by energy.

FieldTypeDescription
ku32Number to return

Response: count: u32 + [key_len, key, energy]...


Returns high-rigidity lineages.

FieldTypeDescription
min_rigidityf32Minimum rigidity

Response: count: u32 + [key_len, key, rigidity]...


Pattern match on keys (glob syntax: *, ?).

FieldTypeDescription
pattern_lenu16Pattern length
pattern[u8]Glob pattern

Response: count: u32 + [key_len, key]...


Keep-alive heartbeat. No payload.

Response: uptime: u64 (seconds)


Returns database statistics. No payload.

Response:

FieldType
lineage_countu32
bond_countu32
moodf32
uptimeu64

Creates named persistence checkpoint.

FieldTypeDescription
name_lenu16Name length
name[u8]Checkpoint name

Response: OK


Hot-swaps state from checkpoint.

FieldTypeDescription
name_lenu16Name length
name[u8]Checkpoint name

Response: OK


Pauses or resumes decay processing.

FieldTypeDescription
stateu80x00 thaw · 0x01 freeze

Response: OK


Adjusts runtime physics constants.

FieldTypeDescription
param_idu8Parameter ID
valuef32New value

Parameters:

IDNameDefaultDescription
0x01DECAY_MULTIPLIER1.0Global decay rate
0x02TRAUMA_THRESHOLD0.8Rigidity trigger
0x03BOND_PRUNE0.1Min bond strength
0x04MIN_ENERGY0.01Decay floor

Response: OK


Sets Cortex mood (affects consciousness threshold).

FieldTypeDescription
moodf320.0 depressed → 1.0 euphoric

Response: OK


CodeNamePayload
0xF0OKCommand-specific response
0xF1ERROR[code: u8, msg_len: u16, msg: [u8]]
0xF2EVENTSubscription notification (reserved)
CodeNameDescription
0x01ALREADY_EXISTSKey already exists
0x02NOT_FOUNDKey not found
0x03REPRESSEDBelow consciousness threshold
0x04INVALIDMalformed request
0x05INTERNALServer-side failure