nx_antibody.nx
buildroot/runtime/nx_antibody.nx
about
nx_antibody.nx -- adaptive defense generation.
Per [[feedback-unified-immune-architecture-three-tier]] item 2.7:
"adaptive defense GENERATION from observed attacks; the substrate's
defensive judo. Captures real attack samples → processes into
machine-readable defense definitions → affinity-matures across
encounters → distributes via peer mesh → composes legal/social
defense materials. Biology: clonal selection + affinity maturation
+ memory cell formation. Defensive-only discipline: NEVER initiates
contact with attackers; only learns from contact attackers initiate."
Per [[feedback-cell-immune-system-ransomware-judo-ddos-by-bit]]:
the judo is of INFORMATION not retaliation. We never attack back;
we make every attacker action visible + analyzable + distributable.
Per [[feedback-captain-moroni-doctrine]]: DEFENSIVE ONLY. Substrate
refuses to compile offensive antibody operations -- antibodies are
detection signatures, not exploitation payloads.
Lifecycle of an antibody (clonal-selection analog):
1. nx_pamp or nx_pamp_meta detects an attack -- attack sample
captured into nx_xenocell signed observation
2. nx_antibody_generate distills the sample into a detection
signature (hash + kind + Q10 affinity)
3. Antibody added to nx_antibody_array; nx_crispr-style memory
4. On each subsequent encounter, antibody's hit_count increments
and effectiveness Q10 updates (affinity maturation)
5. V2: antibodies above effectiveness threshold federate via
peer-mesh (Citizen Lab analog -- community-shared intel)
6. V2: antibodies compose into legal/social defense materials
(sub-poena docs, public advisories) via nx_evict_journal
forensic chain
Composes:
nx_pamp / nx_pamp_meta -- detection feeds antibody generation
nx_xenocell -- attack samples come from signed observations
nx_crispr -- adaptive memory mechanism reused for antibodies
nx_lysis -- antibody confirms threat -> lysis selects mechanism
nx_restriction -- antibody-positive input refused at IO boundary
dependencies 4 imports · 5 importers
imports: nx_syscalls.nxnx_tier.nxnx_pamp.nxnx_pamp_meta.nx
imported by: nx_antibody_test.nxnx_immune.nxnx_immune_test.nxnx_tier1_immune_compose_test.nxnx_tier2_immune_compose_test.nx
structs
| 113 | struct NxAntibody |
| 126 | struct NxAntibodyArray |
consts
| 76 | const NX_MAGIC_1024: i64 = 1024 |
| 80 | const NX_AB_VD_OK: nx_int = 0 |
| 81 | const NX_AB_VD_ERR_FULL: nx_int = 1 |
| 82 | const NX_AB_VD_MATCH: nx_int = 2 |
| 83 | const NX_AB_VD_NO_MATCH: nx_int = 3 |
| 84 | const NX_AB_VD_ERR_BAD_KIND: nx_int = 4 |
| 92 | const NX_AB_ST_NAIVE: nx_int = 0 |
| 93 | const NX_AB_ST_MATURE: nx_int = 1 |
| 94 | const NX_AB_ST_MEMORY: nx_int = 2 |
| 95 | const NX_AB_ST_N_STATES: nx_int = 3 |
| 99 | const NX_AB_MATURE_HITS: nx_int = 3 |
| 100 | const NX_AB_MATURE_AFFINITY: nx_int = 614 |
| 101 | const NX_AB_MEMORY_HITS: nx_int = 10 |
| 102 | const NX_AB_MEMORY_AFFINITY: nx_int = 870 |
| 103 | const NX_AB_FEDERATION_AFFINITY: nx_int = 768 |
| 133 | const NX_AB_BYTES: nx_size = 56 |
| 134 | const NX_AB_DEFAULT_CAPACITY: nx_size = 128 |
functions
| 138 | func nx_ab_vd_state_is_valid(s: nx_int) -> nx_int called by 1: main |
| 146 | func nx_antibody_array_new(capacity: nx_size) -> *NxAntibodyArray |
| 158 | func _ab_at(a: *NxAntibodyArray, idx: nx_size) -> *NxAntibody |
| 170 | func nx_antibody_generate(arr: *NxAntibodyArray, |
| 199 | func nx_antibody_match(arr: *NxAntibodyArray, |
| 223 | func nx_antibody_affinity_mature(arr: *NxAntibodyArray, |
| 257 | func nx_antibody_is_federation_ready(ab: *NxAntibody) -> nx_int |
| 265 | func nx_antibody_count_by_state(arr: *NxAntibodyArray, state: nx_int) -> nx_int |
| 280 | func nx_antibody_total_hits(arr: *NxAntibodyArray) -> nx_int |