Skip to content

Workload Analysis

The Workload Analysis Layer inspects the developer’s workspace context, active files, project structure, language, and complexity, to build a Workload Profile that describes what kind of work the request entails.

A workload profile is a structured snapshot of the task at hand. It includes:

FieldDescriptionSource
languageDetected programming language(s)File extension + heuristics
stackFramework or runtime identifiedrepo/intelligence/profiler.ts
complexityLevelEstimated complexity (1-5)complexityLevel() in workload/analyzer.ts
contextBucketSize of context window neededMessage length + attachment size
outputBucketExpected response lengthKeyword prediction in workload/signals.ts
executionPriorityurgency × complexity × cost sensitivityderiveExecutionPriority() in workload/analyzer.ts
confidenceHow certain the analysis iscomputeConfidence() in workload/analyzer.ts
Classified Intent
|
v
[1] Scan Active Files --> Detect language, stack, file count
|
v
[2] Assess Complexity --> complexityLevel(), classifyComplexity()
|
v
[3] Measure Context --> contextBucket, outputBucket estimates
|
v
[4] Compute Priority --> deriveExecutionPriority()
|
v
[5] Build Workload Snapshot -> buildWorkloadSnapshot()

The complexity engine looks at:

  1. Message length, longer prompts suggest more complex tasks
  2. File attachments, .ts, .tsx, .py, .rs files carry different complexity weights
  3. Multi-step indicators, keywords like “and then”, “after that”, “in addition” indicate multi-step reasoning
  4. Domain keywords, “architecture”, “refactor”, “design pattern” score higher than “variable name”

Key functions in workload/signals.ts:

FunctionPurpose
extractComplexityScore()Scans request text for complexity keywords
extractLatencySensitivity()Detects urgency cues (“quick”, “now”, “ASAP”)
extractCostSensitivity()Detects budget-conscious language (“cheap”, “cost”, “save”)
estimateContextSize()Measures message + attachment tokens
predictOutputLength()Predicts response length from keywords (“short”, “detailed”, “comprehensive”)
predictToolUsage()Detects agentic language implying tool calls
detectWorkflowStyle()Classifies as interactive, agentic, or batch
computeCodingWeight()Weights coding-specific signals higher than general chat
FileWhat It Does
workload/analyzer.tsMain analysis orchestrator. Builds the complete workload profile
workload/signals.tsSignal extraction library. Pure functions for text analysis
workload/types.tsTypeScript types for workload profiles, signals, and buckets
repo/intelligence/profiler.tsRepository-level profiling. Detects monorepo structure, identifies stack
repo/intelligence/scanner.tsFile system scanner. Walks workspace to detect languages and frameworks

The workload profile feeds into:

  1. Strategy Engine, workload complexity determines which strategy is selected
  2. Provider Scoring, context bucket size filters out models with small context windows
  3. Economics, cost sensitivity from workload analysis caps the budget ceiling
  4. Execution, execution priority determines timeout profiles and retry policies