0.0
No release in over 3 years
Fleet pipeline intake: classify, deduplicate, and route work items
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

lex-assessor

Fleet pipeline intake for LegionIO. Receives normalized work items from source absorbers, deduplicates them atomically, classifies via LLM structured output, and applies configuration templates before routing downstream.

Overview

lex-assessor is the first stage of the Fleet Pipeline — the autonomous coding system that takes GitHub issues and pull requests and routes them through planning, implementation, validation, and feedback loops.

When a work item arrives, the assessor:

  1. Deduplicates — computes a SHA256 fingerprint of source:source_ref:title and claims it atomically via Redis SETNX. Duplicate submissions are rejected immediately.
  2. Classifies — calls an LLM to assess priority, complexity, work type, primary language, and estimated difficulty (0.0–1.0).
  3. Templates — selects a config preset based on the complexity classification and deep-merges any source-level overrides on top.
  4. Routes — returns the fully assessed work item ready for the next pipeline stage.

When a work item exceeds its maximum iteration count, escalate handles the cleanup: labels the GitHub issue, posts a summary comment, submits to the human approval queue, releases the dedup lock, and clears all Redis refs.

Complexity Classifications

Classification Planning Solvers Validators Max Iterations
trivial_fix disabled 1 0 1
simple_bug disabled 1 1 3
moderate_feature enabled (default) 1 3 5
complex_feature enabled 2 3 8
critical_production disabled 3 3 10
background disabled 1 0 2

Unknown complexity falls back to moderate_feature.

Runners

Runners::Assessor

assess

Legion::Extensions::Assessor::Runners::Assessor.assess(work_item: work_item)
# Success:
# => { success: true, work_item: { ..., pipeline: { stage: 'assessed', trace: [...] } } }
#
# Duplicate:
# => { success: false, reason: :duplicate, work_item_id: "uuid" }

All runner methods accept the standard Legion extraction pattern:

assess(results: nil, work_item: nil, args: nil, **)

work_item can be passed directly or extracted from results[:work_item] or args[:work_item] — whichever is non-nil.

escalate

Legion::Extensions::Assessor::Runners::Assessor.escalate(work_item: work_item)
# => { success: true, work_item: { ..., pipeline: { stage: 'escalated' } } }

Escalation performs these steps in order:

  1. Labels the GitHub issue fleet:escalated (no-op if lex-github not loaded)
  2. Posts an escalation summary comment (no-op if lex-github not loaded)
  3. Submits to ApprovalQueue with resume routing key lex.developer.runners.developer.incorporate_feedback (no-op if lex-audit not loaded)
  4. Releases the dedup fingerprint so the work item can re-enter the pipeline
  5. Clears fleet:payload, fleet:context, and fleet:worktree Redis keys

Helpers

Helpers::Dedup

fp = Legion::Extensions::Assessor::Helpers::Dedup.fingerprint(
  source: 'github', source_ref: 'LegionIO/lex-exec#42', title: 'Fix timeout'
)
# => "a3f4b2c1..." (SHA256 hex, 64 chars)

Dedup.claim!(fingerprint: fp)        # => true (first claim) / false (duplicate)
Dedup.duplicate?(fingerprint: fp)    # => true / false
Dedup.release!(fingerprint: fp)      # removes the lock

Default TTL is Legion::Settings.dig(:fleet, :cache, :dedup_ttl_seconds) || 86_400 (24 hours).

Helpers::Classifier

result = Legion::Extensions::Assessor::Helpers::Classifier.classify(work_item: work_item)
# => {
#      priority: :high,
#      complexity: :simple_bug,
#      work_type: :bug_fix,
#      language: :ruby,
#      estimated_difficulty: 0.3
#    }

capability = Classifier.difficulty_to_capability(0.7)  # => :reasoning

Helpers::ConfigTemplates

template = Legion::Extensions::Assessor::Helpers::ConfigTemplates.for_classification(
  complexity: :moderate_feature
)

merged = ConfigTemplates.merge_with_overrides(
  template: template,
  overrides: { implementation: { solvers: 2 } }
)

Transport

Name Type Durable
Exchange lex.assessor topic yes
Queue lex.assessor.runners.assessor yes
Routing key lex.assessor.runners.assessor.#

Configuration

All configurable values read from Legion::Settings.dig(:fleet, ...):

Setting Default Description
:fleet, :cache, :dedup_ttl_seconds 86_400 Dedup cache TTL (seconds)

Installation

Add to your Gemfile:

gem 'lex-assessor'

Development

bundle install
bundle exec rspec      # 43 examples, 0 failures
bundle exec rubocop    # 0 offenses

License

MIT