refinement

This commit is contained in:
aseembits93 2026-03-27 13:42:08 -07:00
parent 36e5f932ab
commit 8a24c86922
2 changed files with 34 additions and 47 deletions

View file

@ -19,14 +19,9 @@ This guide walks you through installing the Codeflash Claude Code plugin and run
```bash
/plugin marketplace add codeflash-ai/codeflash-cc-plugin
/plugin install codeflash
```
Or from a local clone:
```bash
git clone https://github.com/codeflash-ai/codeflash-cc-plugin.git
/plugin marketplace add ./codeflash-cc-plugin
/plugin install codeflash
```
@ -36,37 +31,56 @@ By default, plugins install at the **user** level (available across all projects
| Scope | Flag | Effect |
|-------|------|--------|
| User (default) | _(none)_ | Available in all your projects |
| Project | `--scope project` | Shared with team via `.claude/settings.json` |
| Local | `--scope local` | This project only, gitignored |
```bash
/plugin install codeflash --scope project
```
| User (default) | _(none)_ | Available in all your projects locally via `~/.claude/settings.json` |
| Project | `--scope project` | Shared with team with version control via `.claude/settings.json` |
| Local | `--scope local` | This project only for local use, gitignored |
### Verify installation
Run `/plugin` to open the plugin manager. Confirm **codeflash** appears under the **Installed** tab.
## First optimization
## User-invokable optimization
Run the `/optimize` skill with a target file:
```
/optimize src/utils.py
/optimize --file src/utils.py
```
Run the `/optimize` skill with a target file and a target function:
```
/optimize --file src/utils.py --function my_func
```
Run the `/optimize` skill with a natural language instruction:
```
/optimize the my_func function in utils.py
```
The plugin would work even without the command being explicitly called.
```
make my_func run faster
```
What happens behind the scenes:
1. The skill forks a background **optimizer agent**
2. The agent walks upward from CWD to the git root, looking for `pyproject.toml` (Python) or `package.json` (JS/TS)
3. It verifies codeflash is installed and configured
4. If configuration is missing, it auto-discovers your module root and tests directory and writes the config for you
5. It runs `codeflash --subagent` in the background with a 10-minute timeout
6. Results are reported when optimization completes
2. It parses the instruction to figure out the file and function to optimize
3. The agent walks upward from CWD to the git root, looking for `pyproject.toml` (Python) or `package.json` (JS/TS)
4. It verifies codeflash is installed and configured
5. If configuration is missing, it auto-discovers your module root and tests directory and writes the config for you
6. It runs `codeflash --subagent` in the background with a 10-minute timeout along with the file and function argument.
7. Results are reported when optimization completes
You can continue working while codeflash optimizes in the background.
## Continuous Optimization triggered on commit
Whenever any new code is commited to the repository after the claude session starts, a new background codeflash **optimizer agent** will spawn automatically to optimize the new code.
## Set up auto-permissions
Run `/codeflash:setup` to allow codeflash to execute automatically without permission prompts:

View file

@ -67,40 +67,13 @@ npm install --save-dev codeflash
Run this in the directory containing your `package.json`.
## Hook not triggering after commits
**Symptom**: You commit Python/JS/TS files but don't see optimization suggestions.
**Check**:
1. Verify the hook is registered: look for `hooks/hooks.json` in the plugin directory
2. Check the debug log: `cat /tmp/codeflash-hook-debug.log`
3. Ensure commits touch `.py`, `.js`, `.ts`, `.jsx`, or `.tsx` files
4. The hook only detects commits made **during the current session** (after the transcript file was created). Commits from before starting Claude Code won't trigger it.
## Hook triggering repeatedly
**Symptom**: The hook keeps suggesting optimization for the same commits.
This shouldn't happen due to deduplication (the hook tracks seen commit hashes in `$TRANSCRIPT_DIR/codeflash-seen`). If it does:
1. Check the seen-marker file exists in the transcript directory
2. Look at `/tmp/codeflash-hook-debug.log` for the dedup logic trace
3. If commit hashes changed (e.g., amended commits), the hook treats them as new
## "Attempting to repair broken tests..."
<Info>
This is **normal codeflash behavior**, not an error. Codeflash generates tests and sometimes needs to fix them. Let it continue.
</Info>
## 10-minute timeout exceeded
**Symptom**: Codeflash background task times out.
This can happen on large projects or with `--all`. Options:
This can happen on large projects. Options:
- Optimize specific files instead of the entire project: `/optimize src/specific_file.py`
- Target individual functions: `/optimize src/utils.py my_function`
- The `--all` flag scans every function, which naturally takes longer
## Formatter errors