withInstructions

Configures optional user-defined instructions that influence learning behavior.

Instructions provide a mechanism for users and applications to guide KARL's learning process without requiring deep knowledge of machine learning algorithms. They act as high-level constraints and preferences that shape how the AI interprets data and generates predictions.

Instruction categories:

  • Learning preferences: What types of patterns to prioritize or ignore

  • Prediction constraints: Rules about when and how to make suggestions

  • Privacy controls: Limitations on data usage and storage

  • Context rules: How to interpret interactions in different scenarios

  • Adaptation policies: How quickly to respond to changing user behavior

Instruction formats:

val instructions = listOf(
KarlInstruction.LearningFocus(
type = "temporal_patterns",
priority = InstructionPriority.HIGH,
description = "Focus on time-of-day usage patterns"
),
KarlInstruction.PredictionRule(
condition = "confidence < 0.7",
action = "suppress_suggestion",
description = "Only show high-confidence predictions"
),
KarlInstruction.PrivacyConstraint(
type = "data_retention",
value = "30_days",
description = "Automatically delete old interaction data"
)
)

Dynamic instruction updates: Instructions can be modified after container creation using:

container.updateInstructions(newInstructions)

This allows for runtime adaptation based on user feedback or changing requirements.

Instruction processing:

  • Instructions are validated for syntax and semantic correctness

  • Conflicting instructions are resolved using priority ordering

  • Changes take effect immediately for new predictions

  • Historical data interpretation may be affected by instruction changes

Return

This builder instance for method chaining.

Parameters

instructions

A list of KarlInstruction objects that define learning preferences and constraints. Can be empty for default behavior. Instructions can be updated later via container methods.

See also

for instruction format documentation

for runtime instruction updates