Skip to content

API‐Reference

{KVN-AI} - @KullAILABS edited this page May 2, 2026 · 1 revision

API Reference

Back to M-COP WIKI | See also: Architecture | Installation-and-Quickstart | Core-Concepts-and-Glossary

Full generated TypeDoc: docs/api/README.md


NovaNeoEncoder

Import: import { NovaNeoEncoder } from '@/core';
Alias: ContextTensorEncoder
Package: @kullailabs/mcop-core

Constructor

new NovaNeoEncoder(options: NovaNeoEncoderOptions)

Options:

Parameter Type Default Description
dimensions number 64 Dimensionality of the output context tensor
normalize boolean true Whether to L2-normalize the output vector

Methods

encode(input: string): ContextTensor

Encodes a string input into a deterministic fixed-dimension tensor.

const tensor = encoder.encode('dialectical synthesis');
// Returns: { vector: Float32Array, entropy: number, dimensions: number }

Returns: ContextTensor

Field Type Description
vector Float32Array The encoded tensor (length = dimensions)
entropy number Entropy/uncertainty estimate for this encoding
dimensions number Dimensionality of this tensor

Determinism guarantee: The same input string always returns the same vector and entropy, regardless of runtime or platform.


StigmergyV5

Import: import { StigmergyV5 } from '@/core';
Alias: SharedTraceMemoryV5
Package: @kullailabs/mcop-core

Constructor

new StigmergyV5(options?: StigmergyOptions)

Options:

Parameter Type Default Description
resonanceThreshold number 0.4 Minimum cosine similarity to return a matching trace

Methods

recordTrace(context: ContextTensor, synthesis: ContextTensor, meta?: object): PheromoneTrace

Stores a new (input, output) pair as a pheromone trace in shared memory.

const trace = stigmergy.recordTrace(contextTensor, synthesisTensor, { note: 'bootstrap' });

Returns: PheromoneTrace

Field Type Description
id string Unique trace identifier
contextVector Float32Array The input context tensor
synthesisVector Float32Array The synthesis/output tensor
merkleHash string SHA-256 Merkle-chain hash for this trace
timestamp number Unix timestamp of recording
meta object Optional metadata passed to the call

getResonance(query: ContextTensor): ResonanceResult

Retrieves the best-matching pheromone trace from memory using cosine similarity.

const resonance = stigmergy.getResonance(contextTensor);
// Returns null if no trace exceeds resonanceThreshold

Returns: ResonanceResult | null

Field Type Description
trace PheromoneTrace The best-matching stored trace
score number Cosine similarity score (0–1)

getAllTraces(): PheromoneTrace[]

Returns all stored pheromone traces in insertion order.


HolographicEtch

Import: import { HolographicEtch } from '@/core';
Alias: ChangeAuditLogger
Package: @kullailabs/mcop-core

Constructor

new HolographicEtch(options?: HolographicEtchOptions)

Options:

Parameter Type Default Description
confidenceFloor number 0 Minimum allowed confidence delta

Methods

applyEtch(context: ContextTensor, synthesis: ContextTensor, label: string): EtchRecord

Records a rank-1 micro-etch (confidence-delta update) to the append-only audit trail.

const etchRecord = etch.applyEtch(contextTensor, synthesisTensor, 'unit test');

Returns: EtchRecord

Field Type Description
id string Unique etch record identifier
label string Human-readable label for this etch
confidenceDelta number The confidence change recorded
etchHash string SHA-256 hash linking to previous etch
timestamp number Unix timestamp

getAuditTrail(): EtchRecord[]

Returns all etch records in the append-only audit trail (insertion order).

replayFrom(etchId: string): EtchRecord[]

Replays the audit trail from a specific etch record ID, enabling deterministic state reconstruction.


ProvenanceMetadata

The standard output bundle returned by all adapter methods.

interface ProvenanceMetadata {
  merkleRoot: string;       // Root hash of the Merkle chain for this run
  entropyScore: number;     // Encoder entropy estimate
  resonanceScore: number;   // Stigmergy cosine similarity score
  etchHash: string;         // Holographic Etch record hash
  provenance: {
    inputHash: string;      // SHA-256 of the raw input
    timestamp: number;      // Unix timestamp
    encoderVersion: string; // NovaNeoEncoder version
    stigmergyVersion: string; // StigmergyV5 version
    etchVersion: string;    // HolographicEtch version
  };
}

Universal Adapter Protocol (IMCOPAdapter)

Import: import type { IMCOPAdapter } from '@/adapters';

interface IMCOPAdapter {
  encoder: NovaNeoEncoder;
  stigmergy: StigmergyV5;
  holographicEtch: HolographicEtch;
}

All platform adapters implement this interface. The adapter bundles the triad and exposes platform-specific methods that return ProvenanceMetadata alongside the platform result.


MagnificMCOPAdapter

Import: import { MagnificMCOPAdapter } from '@/adapters';

Constructor

new MagnificMCOPAdapter(options: IMCOPAdapter & MagnificOptions)

Methods

generateOptimizedImage(prompt: string, options: MagnificImageOptions): Promise<MagnificResult & ProvenanceMetadata>

const { result, merkleRoot, provenance } = await adapter.generateOptimizedImage(
  'aurora-lit cathedral at dawn',
  { model: 'mystic-2.5-fluid', resolution: '4k' }
);

HiggsfieldMCOPAdapter

Import (Python): from mcop_package.adapters import HiggsfieldMCOPAdapter

Constructor

HiggsfieldMCOPAdapter(
    encoder: NovaNeoEncoder,
    stigmergy: StigmergyV5,
    holographic_etch: HolographicEtch,
)

Methods

optimize_cinematic_video(prompt: str, model: str) -> HiggsfieldResult

result = adapter.optimize_cinematic_video(
    prompt='storm-lit ocean, slow motion waves',
    model='higgsfield-cinema-v2',
)

Python Package (mcop_package)

The Python mirror of the TypeScript core. Located in mcop_package/.

Import:

from mcop_package import NovaNeoEncoder, StigmergyV5, HolographicEtch

The Python API mirrors the TypeScript API with PEP 8 naming conventions (snake_case):

TypeScript Python
NovaNeoEncoder NovaNeoEncoder
StigmergyV5 StigmergyV5
HolographicEtch HolographicEtch
encoder.encode(input) encoder.encode(input)
stigmergy.recordTrace(ctx, syn) stigmergy.record_trace(ctx, syn)
stigmergy.getResonance(ctx) stigmergy.get_resonance(ctx)
etch.applyEtch(ctx, syn, label) etch.apply_etch(ctx, syn, label)
etch.getAuditTrail() etch.get_audit_trail()

Further Reference