* Add Java/Kotlin detection to top-level language router Adds pom.xml, build.gradle, build.gradle.kts, settings.gradle, and settings.gradle.kts as markers that route to the codeflash-java router. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java/Kotlin agent definitions for all optimization domains 10 agents covering the full optimization pipeline: - codeflash-java: router/team lead for domain detection - codeflash-java-setup: environment detection (build tool, JDK, profiling tools) - codeflash-java-deep: cross-domain optimizer (default) - codeflash-java-cpu: data structures, algorithms, JIT deopt, JMH benchmarks - codeflash-java-memory: heap/GC tuning, escape analysis, leak detection - codeflash-java-async: virtual threads, lock contention, CompletableFuture - codeflash-java-structure: class loading, JPMS, startup time, circular deps - codeflash-java-scan: quick cross-domain diagnosis via JFR/jdeps/GC logs - codeflash-java-ci: GitHub webhook handler for Java PRs - codeflash-java-pr-prep: JMH benchmarks and PR body templates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java domain reference guides for all optimization domains 6 guides covering deep domain knowledge for agent consumption: - data-structures: collection selection, autoboxing, JIT patterns, sorting - memory: JVM heap layout, GC algorithms and tuning, escape analysis, leaks - async: virtual threads, structured concurrency, lock hierarchy, contention - structure: class loading, JPMS, CDS/AppCDS, ServiceLoader, Spring startup - database: JPA N+1, HikariCP, pagination, batch operations, EXPLAIN plans - native: JNI, Panama FFM API, GraalVM native-image, Vector API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java optimization skills: session launcher and JFR profiling - codeflash-optimize: session launcher with start/resume/status/scan/review - jfr-profiling: quick-action JFR profiling in cpu/alloc/wall modes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Slim Java agents to match Go's concise ~175-line pattern Move inline code examples, antipattern encyclopedias, JMH templates, and deep-dive sections from agent prompts into reference guides. Agents now contain only: target tables, one-liner antipatterns, reasoning checklists, profiling commands, and keep/discard trees. Line counts (before → after): cpu: 636 → 181 memory: 878 → 193 async: 578 → 165 structure: 532 → 167 deep: 507 → 186 scan: 440 → 163 Average: 595 → 176 (vs Go's 175) Adds to data-structures/guide.md: - Collection contract traps table - Reflection → MethodHandle migration pattern - JMH benchmark template Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix Makefile build: use rsync merge and portable sed -i Two bugs in the build target: 1. cp -R created nested dirs (agents/agents/, references/references/) instead of merging language overlay into shared base. Fix: rsync -a. 2. sed -i '' is macOS-only; fails silently on Linux. Fix: sed -i.bak (works on both macOS and Linux), then delete .bak files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add HANDOFF.md session lifecycle to Java agents Java agents could read HANDOFF.md on resume but never wrote or updated it. A session that hit plateau would lose all context — what was tried, what worked, why it stopped, what to do next. Changes: - Deep agent: init HANDOFF.md on fresh start, record after each experiment, write Stop Reason + learnings.md on session end - Domain agents (CPU, memory, async, structure): record to HANDOFF.md after each keep/discard, write session-end state - Handoff template: make language-agnostic (was Python-specific), add Session status, Strategy & Decisions, and Stop Reason fields Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Close 11 gaps between Java and Python plugins Add missing sections to Java deep agent: experiment loop depth (12 steps), library boundary breaking, Phase 0 environment setup, CI mode, pre-submit review, adversarial review, team orchestration, cross-domain results schema, and structured progress reporting. Add polymorphic dispatch safety to CPU agent and data-structures guide. Add diff hygiene to CPU agent. Add native reference to router. Create two new reference files: library-replacement.md (Guava/Commons/ Jackson/Joda replacement tables) and team-orchestration.md (full dispatch and merge protocol). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| .claude-plugin | ||
| agents | ||
| commands | ||
| hooks | ||
| languages | ||
| references/shared | ||
| vendor/codex | ||
| ARCHITECTURE.md | ||
| README.md | ||
| ROADMAP.md | ||
Plugin Architecture
The codeflash plugin is a multi-language Claude Code plugin for autonomous performance optimization.
Session Flow
/codeflash-optimize start
└─ Skill asks user for context (AskUserQuestion)
└─ Skill launches language router (FOREGROUND, run_in_background: false)
└─ Router runs setup agent (waits for completion)
└─ Router reads CLAUDE.md, library research, etc.
└─ Router creates team: TeamCreate("codeflash-session")
└─ Router creates tasks: TaskCreate("Setup", "Baseline", "Experiment loop")
└─ Router launches optimizer (BACKGROUND, run_in_background: true)
└─ Router STAYS ALIVE coordinating:
├─ Receives [baseline], [progress], [experiment] via SendMessage
├─ Relays progress directly to user (foreground output)
├─ Handles [complete] → cleanup, changelog, TeamDelete
└─ Returns result to skill when session ends
The skill launches the language router in the foreground so its progress output streams directly to the user. The router launches the optimizer in the background as a named teammate and stays alive to coordinate via SendMessage. This is the Team Lead + Specialists pattern — the router is the team lead, the optimizer and any domain agents are specialists.
Agent Hierarchy
Tier 1: Top Router (plugin/agents/codeflash.md)
└─ Detects language, delegates immediately
Tier 2: Language Router / Team Lead
├─ codeflash-python (plugin/languages/python/agents/)
└─ codeflash-javascript (plugin/languages/javascript/agents/)
Tools: TeamCreate, TeamDelete, Agent, SendMessage, TaskCreate/Update
Tier 3: Deep Agent / Sub-Team Lead
├─ codeflash-deep (Python)
└─ codeflash-js-deep (JavaScript)
Tools: TeamCreate, Agent, SendMessage (can dispatch domain specialists)
Tier 4: Domain Specialists
├─ cpu, memory, async, structure (Python)
└─ cpu, memory, async, structure, bundle (JavaScript)
Tools: SendMessage only (report to parent, no team authority)
Shared (language-agnostic):
├─ codeflash-researcher (read-only, parallel investigation)
└─ codeflash-review (standalone or post-session gate)
File Layout
Language-agnostic (base)
agents/codeflash.md— language router that detects the project language and delegatesagents/codeflash-review.md— review agent (works on any language)agents/codeflash-researcher.md— research agent (works on any language)commands/— codex CLI commandsvendor/codex/— codex companion scripts and schemas (vendored)references/shared/— shared methodology (experiment loop, templates, benchmarks)hooks/— session lifecycle and review gate hooks
Python (languages/python/)
agents/codeflash-python.md— Python domain router (Team Lead)agents/codeflash-deep.md— primary optimizer (profiles all dimensions jointly)agents/codeflash-cpu.md,-memory.md,-async.md,-structure.md— one agent per domainagents/codeflash-setup.md— detects project env, installs depsagents/codeflash-scan.md,-ci.md,-pr-prep.md— scan, CI, and PR preparationskills/—/codeflash-optimizeentry point, memray profilingreferences/— Python-specific protocol implementations + domain deep-dive docs
JavaScript (languages/javascript/)
agents/codeflash-javascript.md— JS/TS domain router (Team Lead)agents/codeflash-js-deep.md— primary optimizer (profiles all dimensions jointly)agents/codeflash-js-cpu.md,-memory.md,-async.md,-structure.md,-bundle.md— one agent per domain (5 domains)agents/codeflash-js-setup.md— detects runtime/package manager, installs depsagents/codeflash-js-scan.md,-ci.md,-pr-prep.md— scan, CI, and PR preparationskills/—/codeflash-optimizeentry point, V8 profiling referencereferences/— JS-specific references (Prisma performance, domain deep-dives)
Adding a New Language
Follow this template — Team Lead + Deep Agent are required, domain specialists are added as needed:
| Component | Required? | Role |
|---|---|---|
codeflash-<lang> |
Yes | Language Router / Team Lead (TeamCreate, Agent, SendMessage) |
codeflash-<lang>-deep |
Yes | Primary optimizer / Sub-Team Lead (TeamCreate, Agent, SendMessage) |
codeflash-<lang>-setup |
Yes | Environment setup utility (one-off, no team membership) |
codeflash-<lang>-cpu |
As needed | CPU/algorithm specialist (SendMessage only) |
codeflash-<lang>-memory |
As needed | Memory specialist (SendMessage only) |
codeflash-<lang>-async |
As needed | Concurrency specialist (SendMessage only) |
codeflash-<lang>-structure |
As needed | Module/import specialist (SendMessage only) |
| Language-specific domains | As needed | e.g., bundle for JS, compile for Go/Rust |
codeflash-<lang>-scan |
Optional | Quick diagnostic (one-off) |
codeflash-<lang>-ci |
Optional | CI webhook handler |
codeflash-<lang>-pr-prep |
Optional | PR preparation |
Shared agents (codeflash-researcher, codeflash-review) work across all languages.
Build
make build-plugin # default: LANG=python → dist/ is a Python-only plugin
make build-plugin LANG=javascript # dist/ is a JavaScript-only plugin
make clean # remove dist/
Each build produces a single-language plugin in dist/. The Makefile copies language-agnostic files from plugin/, overlays plugin/languages/<LANG>/ (agents, references, skills), and rewrites internal paths so everything is flat. You pick the language at build time — there is no multi-language dist yet, because loading all languages at once is extremely heavy on context and compute.