codeflash/.claude/rules/optimization-patterns.md
Kevin Turcios 0650973d8c refactor: restructure CLAUDE.md for effective context usage
- Remove commands block from CLAUDE.md (standard tool usage Claude knows)
- Remove dead @AGENTS.md reference
- Add optimization pipeline overview with module pointers
- Add domain glossary (optimization candidate, addressable time, candidate
  forest, replay test, tracer, worktree mode)
- Extract mypy workflow to .claude/skills/fix-mypy.md (on-demand)
- Create .claude/skills/fix-prek.md for prek workflow (on-demand)
- Add key entry points table to architecture.md
- Create path-scoped rules: optimization-patterns.md, language-patterns.md
- Remove redundancy from source-code.md and across rules files
- Move "never use pip" convention to code-style.md
2026-02-14 17:37:51 -05:00

1 KiB

paths
codeflash/optimization/**/*.py
codeflash/verification/**/*.py
codeflash/benchmarking/**/*.py
codeflash/context/**/*.py

Optimization Pipeline Patterns

  • All major operations return Result[SuccessType, ErrorType] — construct with Success(value) / Failure(error), check with is_successful() before calling unwrap()
  • Code context has token limits (OPTIMIZATION_CONTEXT_TOKEN_LIMIT, TESTGEN_CONTEXT_TOKEN_LIMIT in config_consts.py) — exceeding them rejects the function
  • read_writable_code can span multiple files; read_only_context_code is reference-only
  • Code is serialized as markdown code blocks: ```language:filepath\ncode\n``` (see CodeStringsMarkdown)
  • Candidates form a forest (DAG): refinements/repairs reference parent_id on previous candidates
  • Test generation and optimization run concurrently — coordinate through CandidateEvaluationContext
  • Generated tests are instrumented with codeflash_capture.py to record return values and traces