Skip to content

Semi-automatic, human-gated self-improvement loop (learn from hard interactions) #43

Description

@AlexanderF123

Idea

Add a semi-automatic, human-gated self-improvement loop so the assistant gets better over time by learning from its own hard interactions — without a human having to manually hunt for prompt fixes.

Why

In production we repeatedly find prompt/knowledge gaps only by noticing a bad answer, hand-writing a prompt rule, testing it, and promoting or rolling it back. That detect → propose → verify → promote cycle is exactly what could be (partly) automated.

Proposed loop

  1. Collect signals — flag hard interactions: high latency / many round-trips, user corrections ("no, use field X"), 👎 feedback, retries, error markers ("column does not exist"). (Prerequisite: this needs per-turn telemetry + a feedback control — see the telemetry issue.)
  2. Offline analysis (batch, not live) — periodically an LLM clusters the flagged cases, identifies recurring failure patterns, and proposes prompt/knowledge-base edits as a diff (e.g. "add a query pattern for X", "field Y lives in name1").
  3. Human approval — proposed diffs go to a review queue; nothing goes live unreviewed.
  4. Regression gate + versioning — every change is evaluated against a fixed regression test set and only promoted if nothing regresses; the prompt is versioned with one-click rollback.

Explicitly NOT fully autonomous

  • Auto-edits can silently regress quality (fixing one case while breaking another). A fixed eval set + human gate is required.
  • "Long-running" ≠ "wrong" — latency is a weak proxy for a prompt problem.
  • Unbounded auto-appended "fixes" cause prompt bloat (slower + costlier) → needs a consolidation step.
  • A system touching financial/PII data should not rewrite its own instructions ungoverned.

Relationship to other issues

  • Depends on per-turn telemetry + feedback capture (prerequisite).
  • As more retrieval logic moves into curated query tools, the prompt stabilizes and the "learning" can target the tool/catalog layer instead of free-form prompt text — safer and more convergent.

Suggested first building block

A fixed regression test set (representative questions + verified expected answers) shipped with the app, runnable on demand. Without this gate, any self-improvement (automatic or manual) is blind. It is also independently useful for validating prompt/model changes.

Context

Feedback from production use with ERPNext v15 + Aakvatech PropMS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions