Skip to content

feat: trajectory compression — learn from own best executions #9

@stackbilt-admin

Description

@stackbilt-admin

Summary

Port trajectory compression from the daemon (v1.65.0). Compresses successful LLM traces into few-shot examples per classification, injected back into dispatch prompts.

What to port

  • Migration: 0022_trajectory_examples.sql
  • Module: trajectory-compress.ts — trace grouping, quality scoring, compression
  • Injection: getTrajectoryContext() called from augmentIntent() in dispatch.ts
  • Registration in scheduled/index.ts

How it works

  • Groups successful traces by classification (min 5 samples)
  • Selects median-quality trace as representative example
  • Quality score: confidence × completion length × inverse cost
  • Injects as few-shot context: "Prior successful execution for similar query"
  • 14-day TTL, max 20 examples, daily refresh at 04 UTC

Depends on

  • LLM call tracing

Metadata

Metadata

Assignees

No one assigned

    Labels

    aegisAEGIS auto-triageenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions