13 سلوكًا · std/behaviors
std-data-collectorpure buffer-accumulation atom, parameterized for any ML domain. Collects data points into a buffer and fires BUFFER_READY with the full accumulated buffer once it reaches config.bufferSize, then resets for the next cycle. No ML compute, no model call — state machine + array operators only. Use ahead of a training loop, a batch inference call, or any downstream rung that needs a fixed-size window of accumulated observations.
uses DataCollector from "std/behaviors/std-data-collector"الكيان: DataBuffer (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
DataCollectorRun | COLLECT | BUFFER_READY |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
DataCollectorRun | bufferSize | int | Buffer size |
std-graph-builderbuilds node/edge structures from an entity collection for downstream GNN pipelines; pure array/object transform, no ML compute.
uses GraphBuilder from "std/behaviors/std-graph-builder"الكيان: GraphStructure (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
GraphBuilderRun | BUILD_GRAPH, RESET | GRAPH_READY |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
GraphBuilderRun | directed | boolean | Directed |
GraphBuilderRun | edgeField | string | Edge field |
GraphBuilderRun | nodeFeatures | [string] | Node features |
std-ml-classifystructured LLM verdict from a closed category set, via the llm.classify service seam. Bottom of the fall-through: always answers or fails, never abstains.
uses MlClassify from "std/behaviors/std-ml-classify"الكيان: ClassifierVerdict (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
ClassifyRun | CLASSIFY, RESET | CLASSIFIED_RAW, CLASSIFY_CALL_FAILED, CLASSIFIED, CLASSIFY_FAILED |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
ClassifyRun | categories | [string] | Categories |
ClassifyRun | model | string | Model |
std-ml-exact-checknormalizes and compares a candidate value against a key value; abstains on no match.
uses MlExactCheck from "std/behaviors/std-ml-exact-check"الكيان: ExactCheck (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
ExactCheckRun | CHECK, RESET | EXACT_MATCHED, EXACT_UNMATCHED |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
ExactCheckRun | caseSensitive | boolean | Case sensitive |
ExactCheckRun | numericTolerance | float | Numeric tolerance |
ExactCheckRun | trimWhitespace | boolean | Trim whitespace |
std-ml-inferthe learned rung (R4) of the intelligence ladder, and the seam between a .lolo circuit and a trained model deployed on masar (or off-the-shelf HuggingFace weights) reached through the ml service. Sends the caller-supplied input straight to call-service ml infer, then guards the raw output before it ever becomes an effect: validates it against the declared outputContract, clamps it into range, and only then decides. Emits INFERRED when the output satisfies the contract and confidence clears confidenceFloor — carrying the clamped output, confidence, and an empty violations list. Otherwise abstains with INFER_ABSTAINED, whose reason is one of: low confidence (contract satisfied but below floor, violations empty), contract violation (violations populated via contract/violations for diagnosis), or unavailable (the service call itself failed — a masar cold start or a down endpoint, never surfaced as a user-visible error). Use when a numeric or tensor-shaped model answer needs a licensed guard before becoming a decision — classification scores, regressions, embedding-derived predictions — and the next rung (R5 generative) should take over on any abstain.
uses MlInfer from "std/behaviors/std-ml-infer"الكيان: Inference (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
InferenceRun | INFER, RESET | INFERRED_RAW, INFER_CALL_FAILED, INFERRED, INFER_ABSTAINED |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
InferenceRun | confidenceFloor | float | Confidence floor |
InferenceRun | model | string | Model reference |
InferenceRun | outputContract | OutputContract | Output contract |
std-ml-label-capturerecords a labeled example (input, verdict, source rung, observed outcome) so that expensive top-rung answers become training data for a cheaper rung later. Generic: it knows nothing about grading or students. sampleRate gates what fraction of examples are kept (1 = capture all); sink tags which named destination the example is attributed to.
uses MlLabelCapture from "std/behaviors/std-ml-label-capture"الكيان: LabeledExample (persistent)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
LabelCaptureListener | CAPTURE | LABEL_CAPTURED |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
LabelCaptureListener | sampleRate | float | Sample rate |
LabelCaptureListener | sink | string | Label sink |
std-ml-lookupfinds the candidate value in a list of accepted values; abstains when nothing matches.
uses MlLookup from "std/behaviors/std-ml-lookup"الكيان: KeyLookup (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
LookupRun | LOOKUP, RESET | KEY_HIT, KEY_MISS |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
LookupRun | matchField | string | Match field |
LookupRun | normalize | boolean | Normalize |
std-ml-posteriorthe statistical rung (R2) of the intelligence ladder. Holds a Beta(alpha, beta) belief over an unknown success rate and updates it from boolean observations (Bayesian updating, knowledge tracing, Thompson-sampling prior). After each observation it draws samples from the posterior, computes a credible interval, and decides: MASTERY_REACHED when the mean clears the floor with a tight interval, REMEDIATION_NEEDED when the mean sits at or below the ceiling with the same confidence, or EVIDENCE_INSUFFICIENT — the abstain — when the interval is still too wide to trust. Use when a hand-tuned score needs to become a belief that can say 'not enough evidence yet' (mastery, skill, risk, preference, difficulty).
uses MlPosterior from "std/behaviors/std-ml-posterior"الكيان: Posterior (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
PosteriorBelief | OBSERVE | MASTERY_REACHED, REMEDIATION_NEEDED, EVIDENCE_INSUFFICIENT |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
PosteriorBelief | intervalWidthMax | float | Max credible-interval width |
PosteriorBelief | masteryFloor | float | Mastery floor |
PosteriorBelief | priorAlpha | float | Prior alpha |
PosteriorBelief | priorBeta | float | Prior beta |
PosteriorBelief | remediationCeiling | float | Remediation ceiling |
PosteriorBelief | sampleCount | int | Posterior sample count |
std-ml-similarityembed a candidate against references and gate on cosine floor + margin; abstains when not confident.
uses MlSimilarity from "std/behaviors/std-ml-similarity"الكيان: SimilarityComparison (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
SimilarityRun | COMPARE, EMBED_FAILED, RESET | EMBEDDED, SIMILARITY_MATCHED, SIMILARITY_ABSTAINED |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
SimilarityRun | floor | float | Match floor |
SimilarityRun | margin | float | Match margin |
std-tokenizera text-preprocessing atom for tokenization. Splits raw text into a token sequence using a configurable method (whitespace, character, or arbitrary delimiter), normalizes and truncates the sequence, then maps each token to a vocabulary id (falling back to unkId when the token is absent from config.vocab). Feeds downstream embedding or sequence-model atoms. Pure circuit logic: str/* and array/* operators only, no ML compute, no model call.
uses Tokenizer from "std/behaviors/std-tokenizer"الكيان: TokenSequence (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
TokenizerRun | TOKENIZE, RESET | TOKENIZED |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
TokenizerRun | delimiter | string | Delimiter |
TokenizerRun | lowercase | boolean | Lowercase |
TokenizerRun | maxLength | int | Max length |
TokenizerRun | method | string | Method |
TokenizerRun | trimWhitespace | boolean | Trim whitespace |
TokenizerRun | unkId | int | Unknown token id |
TokenizerRun | vocab | Map<string,int> | Vocabulary |
std-weight-validatora constraint-checking atom for model weights, applying the same discipline as the zero-warning validator to weights: constrained and checked, not trusted (Almadar_Intelligence_Ladder.md §7.5). Checks a candidate weight tensor against three pure predicate constraints — magnitude bounds (every element's absolute value must clear maxMagnitude), forbidden regions (excluded [min,max] bands no weight may land in even within the magnitude bound), and a regression threshold against a baseline tensor (per-element drift must not exceed regressionThreshold; 0 disables the check) — and reports every violated check with its detail. Emits WEIGHTS_ACCEPTED when all three checks clear, or WEIGHTS_REJECTED carrying the full violations list otherwise. Pure circuit logic: predicates and comparisons only, no ML compute, no model call.
uses WeightValidator from "std/behaviors/std-weight-validator"الكيان: WeightValidation (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
WeightValidatorRun | VALIDATE_WEIGHTS, RESET | WEIGHTS_ACCEPTED, WEIGHTS_REJECTED |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
WeightValidatorRun | forbiddenRegions | [Range] | Forbidden regions |
WeightValidatorRun | maxMagnitude | float | Max weight magnitude |
WeightValidatorRun | regressionThreshold | float | Regression threshold |
std-escalating-decisionthe intelligence ladder itself, as one reusable composition. One request enters at DECIDE and falls through the rungs in order — R0 exact check, R1 table lookup, R3 retrieval, R4 learned inference, R5 generative classification — each rung handing off to the next by abstaining, until one proves the answer. Exits DECIDED, tagged with which rung answered (rung, confidence, matched, reasoning), or DECISION_FAILED if even the generative floor could not serve it. The escalation is a chain, not a hub: each rung listens directly to the rung above it and projects its own inputs out of the carried request, so the trait graph is a DAG and no event ever returns to a rung that already ran. Domain-agnostic: it knows about candidates and categories, not students or quizzes — grading, routing, matching, moderation, and duplicate detection are all this same molecule with different knobs. R2 (the Beta posterior) is deliberately not in this chain: it is the 'decide what to do next' half of a turn and already lives in std-knowledge-tracing.
uses EscalatingDecision from "std/behaviors/std-escalating-decision"الكيان: LadderRequest (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
LadderEntry | DECIDE, RESET | RUN_EXACT |
ExactRung | لا شيء | لا شيء |
LookupRung | لا شيء | لا شيء |
SimilarityRung | لا شيء | لا شيء |
InferRung | لا شيء | لا شيء |
ClassifyRung | لا شيء | لا شيء |
LadderVerdictSink | FROM_EXACT, FROM_LOOKUP, FROM_SIMILARITY, FROM_INFER, FROM_CLASSIFY, FROM_CLASSIFY_FAILURE, RESET | DECIDED, DECISION_FAILED |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
ExactRung | caseSensitive | boolean | Case sensitive |
ExactRung | numericTolerance | float | Numeric tolerance |
ExactRung | trimWhitespace | boolean | Trim whitespace |
LookupRung | matchField | string | Match field |
LookupRung | normalize | boolean | Normalize |
SimilarityRung | floor | float | Match floor |
SimilarityRung | margin | float | Match margin |
InferRung | confidenceFloor | float | Confidence floor |
InferRung | model | string | Model reference |
InferRung | outputContract | OutputContract | Output contract |
ClassifyRung | categories | [string] | Categories |
ClassifyRung | model | string | Model |
std-knowledge-tracingturns one true/false observation ('did the learner get this right?') into a tracked belief about mastery, and captures the same observation as a labeled training example in the same motion. Composes std-ml-posterior (the R2 statistical rung — a Beta-Bernoulli belief over an unknown success rate) with std-ml-label-capture: every posterior verdict — MASTERY_REACHED, REMEDIATION_NEEDED, or the abstain EVIDENCE_INSUFFICIENT — becomes a persisted labeled example (the input skill, the posterior's own verdict, and the ground-truth outcome that produced it), so a cheaper rung can later be trained to reproduce the same call without running the statistics. Domain-agnostic: it knows about skills and observations, not students, quizzes, or courses. One instance tracks one belief (e.g. one learner × one skill); the host composes as many instances as it has beliefs to hold.
uses KnowledgeTracing from "std/behaviors/std-knowledge-tracing"الكيان: KnowledgeState (runtime)
السمات
| السمة | الأحداث | يبثّ |
|---|---|---|
ObservationRelay | OBSERVE_SKILL, VERDICT_REACHED | OBSERVATION_MADE, CAPTURE_LABEL |
PosteriorTracker | لا شيء | لا شيء |
Labels | لا شيء | لا شيء |
مفاتيح الإعداد
| السمة | المفتاح | النوع | التسمية |
|---|---|---|---|
PosteriorTracker | intervalWidthMax | float | Max credible-interval width |
PosteriorTracker | masteryFloor | float | Mastery floor |
PosteriorTracker | priorAlpha | float | Prior alpha |
PosteriorTracker | priorBeta | float | Prior beta |
PosteriorTracker | remediationCeiling | float | Remediation ceiling |
PosteriorTracker | sampleCount | int | Posterior sample count |
Labels | sampleRate | float | Sample rate |
Labels | sink | string | Label sink |