# How do you use Claktor?

A coding agent runs Claktor. You give the agent the prompt from [claktor.com](https://claktor.com), and it installs the CLI, reads the guide and proposes refactors. You can run it on demand, in a sub-agent, or on a schedule in CI.

## How do you run it on demand?

Ask your agent to refactor with Claktor every so often, for example after a large feature lands. To keep your main session's context free, ask the agent to spawn a sub-agent for it.

## How do you run it in CI?

Add the same prompt to whatever agent already runs in your CI and put it on a schedule. Each run opens pull requests, and your team decides what to merge.

## What does each pull request contain?

The [guide](https://claktor.com/guide.md) has the agent work on a new branch and make one coherent change. The agent keeps the change only when the target's check passes and the count drops by at least 50 [normalized tokens](/learn/how-claktor-measures-code). The pull request states the repetition removed, the behavior kept, the tokens removed and the checks run.

## What makes it work better?

- Give the target a check. Claktor records the repository's existing check for each target, and the agent runs it before and after every change.
- Keep `.claktor/` between CI runs. It is git-ignored and holds the map decisions that later runs reuse.
- The map takes a few minutes of agent work. The search itself takes seconds.
- Tests, manifests and check configuration stay unchanged in every pull request.
