Three private tiles in the codeflash workspace: - codeflash-rules: 6 steering rules (code-style, architecture, optimization-patterns, git-conventions, testing-rules, language-rules) - codeflash-docs: 7 doc pages (domain-types, optimization-pipeline, context-extraction, verification, ai-service, configuration) - codeflash-skills: 2 skills (debug-optimization-failure, add-codeflash-feature)
1.2 KiB
1.2 KiB
Optimization Pipeline Patterns
- All major operations return
Result[SuccessType, ErrorType]— construct withSuccess(value)/Failure(error), check withis_successful()before callingunwrap() - Code context has token limits (
OPTIMIZATION_CONTEXT_TOKEN_LIMIT=16000,TESTGEN_CONTEXT_TOKEN_LIMIT=16000incode_utils/config_consts.py) — exceeding them rejects the function read_writable_code(modifiable code) can span multiple files;read_only_context_codeis reference-only dependency code- Code is serialized as markdown code blocks:
```language:filepath\ncode\n```— seeCodeStringsMarkdowninmodels/models.py - Candidates form a forest (DAG): refinements/repairs reference
parent_idon previous candidates viaOptimizedCandidateSource(OPTIMIZE, REFINE, REPAIR, ADAPTIVE, JIT_REWRITE) - Test generation and optimization run concurrently — coordinate through
CandidateEvaluationContext - Generated tests are instrumented with
codeflash_capture.pyto record return values and traces - Minimum improvement threshold is 5% (
MIN_IMPROVEMENT_THRESHOLD=0.05) — candidates below this are rejected - Stability thresholds:
STABILITY_WINDOW_SIZE=0.35,STABILITY_CENTER_TOLERANCE=0.0025,STABILITY_SPREAD_TOLERANCE=0.0025