How does Claktor search a codebase efficiently?
Claktor maps the repository before it searches. The map keeps tests and generated files out of the program and its rankings. The search then starts in the largest production target and returns leads ranked by estimated savings.
What does the map record?
claktor map records the tracked files and manifests and seeds .claktor/decisions.json. The agent corrects the seed:
- which files are tests
- which files are generated or vendored, each with a reason
- which existing check covers each production target
claktor map compile validates the decisions. They are saved and reused on later runs.
Where does the search start?
claktor map target measures every production target and selects the one with the most normalized tokens. It prints the target, its check and its directories, ordered by the source bytes each holds.
What is a lead?
A lead is a ranked starting hypothesis. claktor similar ranks leads by estimated net savings after extraction costs. The families inside one lead are disjoint, so one change can cover them all. Separate leads may overlap, so they are alternatives.
claktor length diff measures the saving, and the target's check tests behavior.
One lead from steipete/Markdansi:
$ claktor similar src --target root-typescript-production
57 2 disjoint families sharing src/stream.ts
36 function·approximate ×4
src/stream.ts
133–139 flushTable
141–147 flushFence 97%
126–131 flushHeldHeader 76%
119–124 emitRendered 58%
The merged refactor turned three flush functions into one. It removed 50 production lines and about 180 tokens.
What are the commands?
claktor map
claktor map compile
claktor map target
claktor similar DIRECTORY --target TARGET
claktor length diff --compare <start commit>
The Claktor guide has the full workflow.