← Research archive
Technical note verified Sep 23, 2026

Conversation Engine and SQL-Driven Personality Contract

KESPA moved normal personality selection and tuning out of phrase-specific Brain patches into an application-side Conversation Engine backed by brain_config. The engine derives per-turn conversational posture and personality dimensions from current context, recent tone, durable communication preferences, and SQL policy, then sends a machine-readable behavior contract to Brain for generic style validation and repair. Live testing demonstrated differentiated casual, celebratory, and supportive behavior; tuning remains ongoing and no formal conversation-regression benchmark is claimed at this checkpoint.

conversation-engine personality-contract sql-configuration adaptive-dialogue style-enforcement user-preferences
MARKDOWN

README.md

8,376 bytes SHA-256 634e7b6ebc1d2090…

KESPA-NOTE-027 — Conversation Engine and SQL-Driven Personality Contract

Type: Technical Note Date: 2026-09-23 Status: verified

Summary

KESPA implemented an application-side Conversation Engine and SQL-driven personality contract so conversational style can be selected and tuned as runtime configuration rather than through repeated phrase-specific changes to the Brain runtime.

The engine evaluates the current turn using current situational context, recent conversational tone, durable user communication preferences, and brain_config policy. It produces a response profile containing a posture plus numeric/behavioral dimensions, then compiles those decisions into a machine-readable contract for Brain. Brain generates the response, validates style compliance, and can perform a style-only repair when needed.

The main architectural outcome is a separation of responsibility:

```text Conversation Engine / SQL configuration → decides how KESPA should communicate

Brain → enforces the supplied behavior contract generically ```

Normal personality tuning therefore belongs in configuration/Admin rather than requiring a new phrase-specific Brain patch.

Problem

The current local reasoning model was repeatedly falling back to generic chatbot/customer-service language even when the application had already identified the desired conversational posture.

Prompt placement improved behavior but was not reliable enough. A temporary implementation that removed known canned phrases in Brain demonstrated the problem but was not a maintainable solution because every new wording failure would require another runtime code change.

The replacement architecture makes personality policy data-driven and moves phrase-by-phrase tuning out of the Brain.

Conversation Engine

The Conversation Engine derives a response profile with 17 recorded dimensions:

  • social temperature,
  • warmth,
  • energy,
  • formality,
  • directness,
  • seriousness,
  • humor,
  • sarcasm,
  • playfulness,
  • celebration,
  • sympathy,
  • curiosity,
  • challenge,
  • proactivity,
  • question bias,
  • closure bias,
  • verbosity.

It selects from 11 recorded posture classes:

  • neutral,
  • focused,
  • collaborative,
  • playful,
  • celebratory,
  • supportive,
  • serious,
  • urgent,
  • reflective,
  • challenging,
  • listening.

These postures intentionally produce different delivery characteristics rather than one global tone.

Context Precedence

Current situational context has higher authority than ordinary user style preferences.

For example, a user who normally prefers jokes or profanity should not receive humor merely because those preferences exist when the current message clearly describes grief or loss. The recorded implementation applies serious-context clamps so humor and sarcasm can be suppressed, energy reduced, sympathy increased, and unnecessary questions avoided.

This prevents persistent style preferences from overriding an obviously incompatible current situation.

Durable Communication Preferences

KESPA can use durable communication-preference memories to influence characteristics such as:

  • concise versus detailed responses,
  • directness,
  • humor or sarcasm tolerance,
  • professional/formal style,
  • tolerance for unnecessary follow-up questions.

The design explicitly distinguishes stable communication preferences from transient emotional states. Persistent preferences may influence future conversations, but temporary states such as sadness are not intended to become durable personality labels.

SQL-Backed Configuration

The runtime behavior is backed by brain_config rather than hard-coded phrase rules.

Eight primary Conversation Engine configuration rows are recorded:

  • conversation_engine_enabled,
  • conversation_engine_policy,
  • conversation_posture_profiles,
  • conversation_signal_policy,
  • conversation_humor_policy,
  • conversation_high_stakes_policy,
  • conversation_prompt_policy,
  • conversation_telemetry_policy.

These rows separate global engine behavior, posture targets, signal detection, humor permission, high-stakes clamps, prompt/contract behavior, and telemetry policy.

Configuration can therefore evolve without redefining personality in the model runtime.

Machine-Readable Personality Contract

Instead of relying only on vague prose instructions, the engine compiles explicit behavioral constraints for the current response.

A contract can express expectations such as:

  • avoid or permit a follow-up question,
  • disallow generic offers of assistance,
  • limit response length,
  • mirror the user's conversational register,
  • avoid humor,
  • avoid unsolicited advice,
  • acknowledge the situation before continuing.

The exact wording remains model-generated. The contract defines behavioral boundaries rather than a canned response.

Brain Enforcement Boundary

The recorded Brain build at this checkpoint is:

``text dev-019-personality-contract-v2 ``

The current local model is:

``text qwen2.5-coder:7b-instruct-q4_K_M ``

Brain's personality-related path is now:

``text receive contract → generate response → validate style compliance → perform style-only repair when required → return response ``

Brain does not own the policy decision about whether KESPA should be playful, supportive, formal, brief, sarcastic, or celebratory. Those decisions belong to the Conversation Engine and its configuration.

System Integration

The personality layer remains separate from factual/reasoning systems.

It does not replace or override:

  • routing,
  • memory retrieval,
  • Trusted Knowledge,
  • RAG,
  • web evidence,
  • planning,
  • verification,
  • safety or evidence policy.

This keeps style adaptation from becoming a substitute for correctness or provenance.

Recorded Live Behavior

The supplied implementation record includes live interactions covering casual greeting, celebration, continued celebration, and grief/support scenarios. Those tests showed materially different behavior based on posture rather than one generic support-assistant response pattern.

One supportive response was explicitly described as still needing wording polish. That limitation is preserved here: the architecture is implemented and functioning, but conversational quality remains in a tuning phase.

No formal posture-accuracy percentage, contract-violation rate, user-satisfaction score, or conversation-regression benchmark was supplied, so none is claimed.

Tuning Model

The intended workflow is now:

``text behavior sounds wrong → inspect posture and telemetry → adjust SQL/Admin policy or posture profile → retest ``

rather than:

``text behavior sounds wrong → add another phrase-specific Brain patch ``

This is the primary maintainability improvement of the work.

Telemetry Direction

The implementation identifies telemetry fields useful for separating classification failures from configuration or model-obedience failures, including:

  • posture,
  • reason codes,
  • conversation dimensions,
  • supplied/applied directive state,
  • contract version,
  • style-validation result,
  • repair attempted/succeeded,
  • repair attempts and latency,
  • model used,
  • user feedback.

The design explicitly avoids retaining raw emotional profiling as personality telemetry.

Limitations

This checkpoint does not establish:

  • formal conversation-posture accuracy,
  • a measured contract-violation rate,
  • a measured repair success rate,
  • user-rated naturalness improvements,
  • superiority over other conversational models,
  • that every response is free of generic or robotic wording,
  • that the planned deterministic conversation regression suite has been completed.

The local model remains coder-tuned, and the source explicitly records that some supportive wording still needs refinement.

Future Work

Recorded future work includes:

  • a readable Admin tuning interface over the SQL configuration,
  • a structured communication-preference profile with confidence and reinforcement history,
  • feedback-driven preference adaptation,
  • a deterministic conversation regression suite based on expected posture/permitted behavior rather than exact wording,
  • posture/contract/repair quality metrics,
  • a dedicated conversational-model role when hardware allows.

These items remain future work and are not represented as completed results in this release.

TEXT

SHA256SUMS.txt

393 bytes SHA-256 849cf873edc4d7ba…
634e7b6ebc1d2090009594ef5a2eed6c2d7d3a9405577f60f957b8461c8a5a03  README.md
9e1446e42d7c7eaeb25f22f8c3942139639893ef477b2e3fe87a38be6a55ba91  note.json
ac9787a1a10decf402d0c0a92d2da2be2d330173f4633787b13ff075750d86d1  metrics.csv
42b85548a31dee86fe572a3c2c002f77d45037116aa28231ee8067bf958fb51f  methodology.md
c76ac54e8b7b2333430567b12a65ce0098fd71015b43942bd120b849afd61216  provenance.json
MARKDOWN

methodology.md

3,793 bytes SHA-256 42b85548a31dee86…

Methodology

Objective

Document the implemented KESPA Conversation Engine and SQL-driven personality-contract architecture as a distinct technical result while preserving the boundary between verified implementation behavior and future conversation-quality benchmarking.

Source material

Primary source:

  • user-supplied Jira update, KESPA Conversation Engine + SQL-Driven Personality Contract, dated 2026-09-23 and marked Implemented baseline, tuning phase.

Archive context:

  • the current generated KESPA public research manifest through KESPA-NOTE-026, used to allocate KESPA-NOTE-027 and avoid duplicating prior notes covering memory, Research Ops, artifact storage, or adaptive runtime benchmarking.

Deduplication decision

This work is materially distinct from existing archive entries because it addresses conversation-style policy and enforcement rather than:

  • durable memory storage,
  • private artifact retrieval,
  • research automation,
  • Trusted Knowledge lifecycle,
  • adaptive compute benchmarking.

The live dialogue examples are implementation evidence, not a formal benchmark. They are therefore documented inside this technical note rather than inflated into a separate experiment or benchmark entry.

Evidence classification

Directly recorded

The source directly records:

  • the Conversation Engine as implemented,
  • the current local model identifier,
  • the current Brain build identifier,
  • 17 named response-profile dimensions,
  • 11 named posture classes,
  • eight primary conversation_* configuration rows,
  • current-context precedence over persistent style preferences,
  • durable communication-preference influence,
  • machine-readable contract generation,
  • generic Brain-side validation/style repair,
  • live examples showing differentiated conversational behavior,
  • ongoing tuning needs,
  • future plans for deterministic regression and personality-quality metrics.

Derived

Only simple counts were derived from explicit lists:

  • 17 response dimensions,
  • 11 posture classes,
  • eight primary configuration rows,
  • four displayed live interaction examples.

No quality percentage, posture accuracy, repair success rate, or user-satisfaction metric was derived.

Validation boundary

The note uses status verified because the supplied Jira update explicitly marks the baseline as implemented, describes current Brain/application components, and provides live interaction examples under a section titled current verified behavior.

The status applies to the implementation/architecture checkpoint, not to general conversational quality or scientific validation.

The source explicitly states that at least one supportive response still needs wording polish and that formal conversation regression / personality metrics remain future work.

Publication/privacy boundary

The public package intentionally omits:

  • raw private conversation history,
  • user identities or account data,
  • private memory contents,
  • absolute production filesystem paths,
  • raw SQL dumps,
  • private application source code,
  • internal prompt bodies beyond safe high-level behavioral examples,
  • secrets, credentials, API tokens, cookies, or session data.

Safe component names, configuration-key names, model/build identifiers, architecture, and derived list counts are preserved because they are necessary to understand and reproduce the design boundary.

Interpretation rule

This note documents a maintainability and policy-separation architecture:

``text application/configuration decides conversational posture → Brain enforces the supplied contract generically ``

It does not claim that the personality system is optimal, that the local model is generally superior, or that planned regression metrics have already been measured.

CSV

metrics.csv

1,145 bytes SHA-256 62ad9cb1be392311…
metric,value,unit,status,notes
response_dimensions_recorded,17,dimensions,derived,Count of the explicitly listed Conversation Engine response-profile dimensions in the supplied implementation record.
posture_classes_recorded,11,postures,derived,Count of the explicitly listed posture classes.
primary_conversation_config_rows_recorded,8,rows,derived,Count of the explicitly listed primary conversation_* brain_config rows.
live_interaction_examples_recorded,4,examples,derived,"The supplied update shows four live interaction examples spanning casual, celebratory, and supportive contexts."
brain_build,dev-019-personality-contract-v2,identifier,recorded,Current Brain build recorded by the supplied implementation update.
local_model,qwen2.5-coder:7b-instruct-q4_K_M,identifier,recorded,Current local model recorded by the supplied update.
implementation_status,"implemented baseline, tuning phase",status,recorded,Status stated at the top of the supplied Jira ticket.
formal_conversation_regression_completed,0,boolean,recorded_boundary,A deterministic conversation regression suite is listed as future work rather than a completed benchmark.
JSON

note.json

1,560 bytes SHA-256 9e1446e42d7c7eae…
{
    "id": "KESPA-NOTE-027",
    "type": "technical_note",
    "title": "Conversation Engine and SQL-Driven Personality Contract",
    "date": "2026-09-23",
    "status": "verified",
    "summary": "KESPA moved normal personality selection and tuning out of phrase-specific Brain patches into an application-side Conversation Engine backed by brain_config. The engine derives per-turn conversational posture and personality dimensions from current context, recent tone, durable communication preferences, and SQL policy, then sends a machine-readable behavior contract to Brain for generic style validation and repair. Live testing demonstrated differentiated casual, celebratory, and supportive behavior; tuning remains ongoing and no formal conversation-regression benchmark is claimed at this checkpoint.",
    "brain_build": "dev-019-personality-contract-v2",
    "local_model": "qwen2.5-coder:7b-instruct-q4_K_M",
    "response_dimensions_recorded": 17,
    "posture_classes_recorded": 11,
    "primary_configuration_rows_recorded": 8,
    "architecture_boundary": {
        "conversation_engine": "selects posture, dimensions, and behavioral policy from context/preferences/configuration",
        "brain": "generates, validates style compliance, and performs generic style-only repair when needed"
    },
    "current_status": "implemented_baseline_tuning_phase",
    "formal_conversation_regression_completed": false,
    "tags": [
        "conversation-engine",
        "personality-contract",
        "sql-configuration",
        "adaptive-dialogue",
        "style-enforcement",
        "user-preferences"
    ]
}
JSON

provenance.json

3,937 bytes SHA-256 c76ac54e8b7b2333…
{
    "artifact_id": "KESPA-NOTE-027",
    "source_material": [
        {
            "type": "user_provided_jira_update",
            "date": "2026-09-23",
            "title": "KESPA Conversation Engine + SQL-Driven Personality Contract",
            "status": "Implemented baseline, tuning phase"
        },
        {
            "type": "existing_public_manifest",
            "description": "Current generated KESPA public research manifest through KESPA-NOTE-026, used for deduplication and sequential ID allocation."
        }
    ],
    "directly_recorded_facts": [
        "KESPA implemented a Conversation Engine plus SQL-driven Personality Contract baseline.",
        "The stated goal is to keep normal personality tuning out of phrase-specific Brain patches.",
        "The Conversation Engine evaluates the current turn using current message/context, recent tone, durable communication preferences, and global SQL-backed rules.",
        "The engine records named personality dimensions and selects among named conversational postures.",
        "Current serious situational context has higher precedence than ordinary persistent communication preferences.",
        "The engine can use durable communication-preference memories while avoiding persistent transient emotional-state profiling.",
        "brain_config is the runtime behavior/configuration control plane for the Conversation Engine.",
        "A machine-readable personality contract is compiled for the current response.",
        "Brain receives the contract, generates a response, validates style compliance, and can perform style-only repair.",
        "The current Brain build is dev-019-personality-contract-v2.",
        "The current local model is qwen2.5-coder:7b-instruct-q4_K_M.",
        "Live tests in the supplied update show casual, celebratory, and supportive response behavior.",
        "At least one supportive response still requires wording polish.",
        "Normal personality tuning is intended to occur through SQL/Admin configuration rather than repeated Brain changes.",
        "A deterministic conversation regression suite and personality-quality metrics are future work."
    ],
    "derived_values": [
        {
            "name": "response_dimensions_recorded",
            "value": 17,
            "formula": "count(explicitly listed response-profile dimensions)"
        },
        {
            "name": "posture_classes_recorded",
            "value": 11,
            "formula": "count(explicitly listed posture names)"
        },
        {
            "name": "primary_conversation_config_rows_recorded",
            "value": 8,
            "formula": "count(explicitly listed primary conversation_* configuration rows)"
        },
        {
            "name": "live_interaction_examples_recorded",
            "value": 4,
            "formula": "count(live interaction examples shown in Current Verified Behavior)"
        }
    ],
    "validation_boundary": {
        "verified": [
            "implemented Conversation Engine baseline",
            "SQL-backed personality/configuration architecture",
            "machine-readable personality contract",
            "generic Brain-side contract validation/style repair path",
            "context-over-preference precedence design",
            "recorded live interaction examples"
        ],
        "not_claimed": [
            "formal posture accuracy",
            "formal contract violation rate",
            "formal style-repair success rate",
            "user-rated naturalness improvement",
            "general superiority over other conversational models",
            "completion of the planned deterministic conversation regression suite"
        ]
    },
    "publication_exclusions": [
        "raw private conversations",
        "user/account identifiers",
        "private memory contents",
        "absolute internal filesystem paths",
        "private source code",
        "raw SQL dumps",
        "credentials and secrets",
        "tokens/cookies/session material"
    ],
    "repository_identity": "https://github.com/ryanmurray89/KespaAI-Research",
    "repository_identity_rule": "The public-research manifest repository field is preserved exactly as the canonical KespaAI-Research repository URL."
}