You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,6 +156,54 @@ To profile latency, you must place two progress points that correspond to the st
156
156
157
157
When coz tests a hypothetical optimization it will report the effect of that optimization on the average latency between these two points. Coz can track this information without any knowledge of individual transactions thanks to [Little's Law](https://en.wikipedia.org/wiki/Little%27s_law).
If you're new to Coz or working in an unfamiliar codebase, the hardest part is deciding *where* to place progress points. The `coz suggest-points` subcommand uses an LLM agent to read your source, identify what counts as a unit of work, and propose concrete `COZ_PROGRESS_NAMED` / `COZ_BEGIN` / `COZ_END` placements. Each proposal is shown with a rationale and a unified diff; nothing is written until you confirm.
161
+
162
+
```shell
163
+
export ANTHROPIC_API_KEY=...
164
+
165
+
coz suggest-points src/ # explore src/, then prompt to apply
166
+
coz suggest-points --dry-run src/ # print diffs only, no prompt
167
+
coz suggest-points --apply src/ # skip the prompt, apply everything
168
+
coz suggest-points --kind latency src/ # only propose COZ_BEGIN/COZ_END pairs
169
+
coz suggest-points --hint "HTTP server" src/ # give the agent a domain hint
170
+
```
171
+
172
+
The agent has read-only tools (`list_files`, `read_file`, `grep`) scoped to the paths you pass, and emits one proposal per call. When you accept a proposal, the macro is inserted at the chosen line (matching surrounding indentation), `#include "coz.h"` is added if missing, and the original file is backed up to `*.coz.bak`. Latency points are only applied in matched `BEGIN`/`END` pairs. Files that already contain Coz macros are left alone.
173
+
174
+
#### Choosing an LLM provider
175
+
176
+
`coz suggest-points` supports the same providers as the viewer's optimization assistant. Pick one with `--provider`; the agentic tool-use loop is used on all of them, so results are comparable across providers (quality depends on how well the chosen model follows tool-use instructions).
| Amazon Bedrock |`--provider bedrock`|`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` (optional `AWS_SESSION_TOKEN`); region via `AWS_REGION` / `AWS_DEFAULT_REGION` or `--region`. Any credential source that boto3's default chain picks up (IAM role, `~/.aws/credentials`, SSO) also works. Requires `pip install boto3`. |`anthropic.claude-opus-4-20250514-v1:0`|
183
+
| Ollama (local) |`--provider ollama`| No key. Endpoint via `OLLAMA_HOST` or `--ollama-host` (defaults to `http://localhost:11434`). Use a tool-capable model (e.g. `llama3.1`, `qwen2.5`). |`llama3.1`|
You can also pass `--api-key <key>` inline for Anthropic or OpenAI instead of exporting an env var, and `--model <id>` to select a specific model on any provider. See `coz suggest-points --help` for the full option list (`--include`, `--exclude`, `--max-points`, `--region`, `--ollama-host`, etc.).
206
+
159
207
### Specifying Progress Points on the Command Line
160
208
Coz has command line options to specify progress points when profiling the application instead of modifying its source. This feature is currently disabled because it did not work particularly well. Adding support for better command line-specified progress points is planned in the near future.
0 commit comments