Skip to content

Commit fdd5e10

Browse files
docs: add hooks guide and "learns from your usage" section (#784)
Add a dedicated docs/HOOKS.md covering the full hook inventory: the post-commit auto-sync git hook, the Claude Code SessionStart freshness + relevant-decisions block, the PostToolUse enrichment/freshness/read- intelligence/governed-by hooks, the opt-in distill command-rewrite hook, and the Codex hooks, with exact settings.json matchers and commands. Add a README section on how repowise adapts to real usage (session-mined decisions delivered at session start and edit time, demand-weighted docs budget) and a matching comparison-table row. Compress the Code Health and Refactoring Intelligence prose to cut repetition while keeping the moat and the CodeScene head-to-head intact. Collapse the User Guide hooks section into a pointer to the new guide.
1 parent 78022da commit fdd5e10

3 files changed

Lines changed: 296 additions & 125 deletions

File tree

README.md

Lines changed: 61 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
<p align="center"><sub>
3030
<a href="#the-five-layers">Layers</a> ·
31+
<a href="#learns-from-how-you-actually-use-it">Learns from you</a> ·
3132
<a href="#-code-health-the-layer-nobody-else-nails">Code Health</a> ·
3233
<a href="#refactoring-intelligence">Refactoring</a> ·
3334
<a href="#benchmarks">Benchmarks</a> ·
@@ -96,6 +97,31 @@ dead code, CLAUDE.md generation): **[docs/INTELLIGENCE_LAYERS.md →](docs/INTEL
9697

9798
---
9899

100+
## Learns from how you actually use it
101+
102+
repowise doesn't just index once and go stale, it watches how you and your agent
103+
work in the repo and tilts itself toward that. All local, all deterministic, no
104+
extra LLM calls, and it feeds back through the [hooks](docs/HOOKS.md) at zero
105+
agent effort:
106+
107+
- **Decisions mined from your own sessions.** repowise reads your Claude Code
108+
transcripts for the corrections and conventions you actually enforce ("new
109+
endpoints go through the auth middleware", "use the shared HTTP client, not
110+
raw requests"), turns the durable ones into tracked decisions, then delivers
111+
the relevant ones back: a compact block at session start, and a one-line
112+
*"governed by"* notice the moment your agent edits a file that decision
113+
governs. If a later session contradicts a decision, it stops being injected.
114+
- **Docs that follow your questions.** The wiki generation budget tilts toward
115+
the modules you and your agent ask about most (from `get_answer` and
116+
`search_codebase` history), so depth lands where you actually work instead of
117+
spreading evenly. Silent and byte-identical on a fresh repo with no history.
118+
119+
It is a flywheel: **use it → it mines what mattered → it delivers that back on
120+
the next session.** How the hooks carry it: **[docs/HOOKS.md →](docs/HOOKS.md)** ·
121+
decision layer: **[docs/INTELLIGENCE_LAYERS.md →](docs/INTELLIGENCE_LAYERS.md)**
122+
123+
---
124+
99125
## ★ Code Health: the layer nobody else nails
100126

101127
Code health is repowise's deepest differentiator: the one layer with no real
@@ -108,27 +134,26 @@ refactoring plan your agent can execute.
108134
<img src=".github/assets/health-loop.svg" alt="repowise code-health loop: 25 deterministic markers fan into three signals (defect risk, maintainability, performance), the graph and git history locate where risk concentrates, and refactoring intelligence emits concrete plans (Extract Class, Extract Helper, Move Method, Break Cycle, Split File, Extract Method) your agent executes" width="100%" />
109135
</div>
110136

111-
repowise scores **every file 1–10** from **25 deterministic markers**:
112-
McCabe complexity, deep nesting, brain methods, class cohesion (LCOM4), god
113-
classes, native Rabin–Karp clone detection, untested hotspots, function-level
114-
churn, code-age volatility, ownership dispersion, change entropy, co-change
115-
scatter, prior-defect history, test-quality smells, and more.
116-
117-
**Three signals, one index.** The headline 1–10 is **defect risk**: the
118-
defect-calibrated, bug-predictive score in the table below. From the same
119-
marker stream, repowise surfaces two co-equal companion views:
120-
**maintainability** (cohesion, brain methods, DRY and god-class smells that
121-
raise change-cost without predicting bugs) and **performance** (static N+1 /
122-
I/O-in-loop risk, followed across files through the call graph: file-local
123-
linters found 0 of those cross-function cases on a 12k-file benchmark where
124-
repowise surfaced 557). They are separate lenses, never blended into the defect
137+
repowise scores **every file 1–10** from **25 deterministic markers**, McCabe
138+
complexity, brain methods, class cohesion (LCOM4), god classes, native
139+
Rabin–Karp clone detection, untested hotspots, change entropy, prior-defect
140+
history, and more, split into **three signals**:
141+
142+
- **Defect risk** is the headline 1–10: the defect-calibrated, bug-predictive
143+
score in the table below.
144+
- **Maintainability** (cohesion, brain methods, DRY and god-class smells) flags
145+
what raises change-cost without predicting bugs.
146+
- **Performance** (static N+1 / I/O-in-loop risk) is followed across files
147+
through the call graph: file-local linters found 0 of those cross-function
148+
cases on a 12k-file benchmark where repowise surfaced 557.
149+
150+
The companion signals are separate lenses, never blended into the defect
125151
headline, so the bug-predictive number stays clean.
126152

127-
> **Zero LLM calls. Zero cloud requirement. Zero new runtime dependencies.**
128-
> Pure Python over tree-sitter + git data, finishing in **under 30 seconds** on
129-
> a 3,000-file repo. The marker weights are **calibrated against a real defect
130-
> corpus, not hand-tuned**; only the learned constants ship and the runtime
131-
> stays fully deterministic.
153+
> **Zero LLM calls, zero cloud, zero new runtime dependencies.** Pure Python
154+
> over tree-sitter + git data, **under 30 seconds** on a 3,000-file repo. The
155+
> marker weights are **calibrated against a real defect corpus, not hand-tuned**;
156+
> only the learned constants ship and the runtime stays fully deterministic.
132157
133158
```bash
134159
repowise health # KPIs + lowest-scoring files
@@ -163,26 +188,23 @@ User guide & per-marker reference: **[docs/CODE_HEALTH.md](docs/CODE_HEALTH.md)*
163188

164189
### Refactoring intelligence
165190

166-
A health score tells you a file is in trouble. Every other tool stops there, or
167-
prints the same static sentence for every god class in every repo. repowise names
168-
the **specific** fix, computed deterministically from the graph, the class model,
169-
and git co-change: **Extract Class**, **Extract Helper**, **Move Method**,
170-
**Break Cycle**, **Split File**, and **Extract Method**. Each plan names the
171-
exact methods, edges, or symbols that move, and carries its **blast radius**
172-
(the callers and co-changing files that must move with it). Extract Method goes
173-
deepest: an intra-procedural dataflow pass (CFG + def/use + reaching
174-
definitions) finds the exact line span to lift out of an oversized method and
175-
infers the helper's parameters and return value, so the plan is
176-
behavior-preserving by construction. Ranking is **graph-aware** (`impact ×
177-
call-graph centrality × blast radius`), so a fix on a central hub outranks the
178-
same fix on a leaf. That is the wedge: CodeScene's AI refactoring stays within a
179-
single function, where repowise names the cross-file move and the dependents it
180-
ripples to.
191+
A health score tells you a file is in trouble; every other tool stops there, or
192+
prints the same static sentence for every god class. repowise names the
193+
**specific** fix, computed deterministically from the graph, the class model, and
194+
git co-change: **Extract Class**, **Extract Helper**, **Move Method**, **Break
195+
Cycle**, **Split File**, **Extract Method**. Each plan names the exact methods,
196+
edges, or symbols that move and carries its **blast radius** (the callers and
197+
co-changing files that must move with it), ranked **graph-aware** (`impact ×
198+
call-graph centrality × blast radius`) so a fix on a central hub outranks the
199+
same fix on a leaf. That is the wedge: CodeScene's AI refactoring stays inside a
200+
single function; repowise names the cross-file move and the dependents it ripples
201+
to. Extract Method goes deepest, an intra-procedural dataflow pass (CFG + def/use
202+
+ reaching definitions) lifts the exact line span and infers the helper's
203+
signature, behavior-preserving by construction.
181204

182205
The deterministic plan is the product; an optional LLM step (never in the
183-
indexing path, only on explicit request) expands any plan into generated code
184-
plus a unified diff, fed the graph and co-change context a bare codegen tool
185-
throws away.
206+
indexing path, only on request) expands any plan into generated code plus a
207+
unified diff, fed the graph and co-change context a bare codegen tool throws away.
186208

187209
```bash
188210
repowise health --refactoring-targets # ranked plans; get_health(include=["refactoring"]) over MCP
@@ -451,7 +473,7 @@ Ready for the full picture? Run `repowise init --provider …` for the generated
451473
semantic search, or skip key management entirely with the hosted tier at
452474
[repowise.dev](https://www.repowise.dev). Full walkthrough: [docs/QUICKSTART.md](docs/QUICKSTART.md).
453475

454-
**Docs:** [Quickstart](docs/QUICKSTART.md) · [User Guide](docs/USER_GUIDE.md) · [CLI Reference](docs/CLI_REFERENCE.md) · [Codex](docs/CODEX.md) · [MCP Tools](docs/MCP_TOOLS.md) · [Distill](docs/DISTILL.md) · [Workspaces](docs/WORKSPACES.md) · [Auto-Sync](docs/AUTO_SYNC.md) · [Upgrading](docs/UPGRADING.md) · [Config](docs/CONFIG.md)
476+
**Docs:** [Quickstart](docs/QUICKSTART.md) · [User Guide](docs/USER_GUIDE.md) · [CLI Reference](docs/CLI_REFERENCE.md) · [Codex](docs/CODEX.md) · [MCP Tools](docs/MCP_TOOLS.md) · [Hooks](docs/HOOKS.md) · [Distill](docs/DISTILL.md) · [Workspaces](docs/WORKSPACES.md) · [Auto-Sync](docs/AUTO_SYNC.md) · [Upgrading](docs/UPGRADING.md) · [Config](docs/CONFIG.md)
455477

456478
---
457479

@@ -491,6 +513,7 @@ Worked example (*"Add rate limiting to all API endpoints"* in 5 calls instead of
491513
| MCP server for AI agents | ✅ 9 tools || ✅ 3 tools |||
492514
| Proactive agent hooks | ✅ Claude + Codex hooks |||||
493515
| Auto-generated AI instructions (`CLAUDE.md`, `AGENTS.md`) ||||||
516+
| Learns from your usage (session-mined decisions, demand-weighted docs) ||||||
494517
| Code health score (1–10) | ✅ 25 markers |||| ✅ 25–30 |
495518
| Brain Method / LCOM4 / god class ||||||
496519
| Test-coverage intelligence | ✅ LCOV/Cobertura/Clover |||||

0 commit comments

Comments
 (0)