Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(ui): correct the singular, ordinals and a field name in UI copy (#3465)

Yunus Ozen2e3ac2354818
diff --git a/packages/server/src/repowise/server/services/refactoring_health.py b/packages/server/src/repowise/server/services/refactoring_health.py
index 39ecdeb87..1aab17d66 100644
--- a/packages/server/src/repowise/server/services/refactoring_health.py
+++ b/packages/server/src/repowise/server/services/refactoring_health.py
@@ -431,9 +431,9 @@ class RefactoringHealthService:
# say the symbol has to be located again before the step is applied.
if any(step.get("relocated_by") for step in page):
payload["ordering_note"] = (
- "A step carrying `relocated_by` names a symbol an earlier step moves. "
- "Locate it again before applying the step; its file and span describe "
- "where the symbol was."
+ "A step marked 'Moved by an earlier step' names a symbol an earlier step "
+ "relocates. Locate it again before applying the step; its file and span "
+ "describe where the symbol was."
)
return payload
diff --git a/packages/ui/__tests__/health/performance-view.test.tsx b/packages/ui/__tests__/health/performance-view.test.tsx
index f2dfd13fd..0776b3c9f 100644
--- a/packages/ui/__tests__/health/performance-view.test.tsx
+++ b/packages/ui/__tests__/health/performance-view.test.tsx
@@ -2,6 +2,7 @@ import { fireEvent, render, screen, waitFor, within } from "@testing-library/rea
import { describe, expect, it, vi } from "vitest";
import type { RefactoringPlan } from "@repowise-dev/types/refactoring";
+import { ScopeLine } from "../../src/health/performance/filters";
import { PerformanceView } from "../../src/health/performance-view";
import {
adapter,
@@ -1047,3 +1048,16 @@ describe("PerformanceView drawer, the fix itself", () => {
});
});
+describe("ScopeLine", () => {
+ it.each([
+ ["all", 1, "1 opportunity"],
+ ["all", 2, "2 opportunities"],
+ ["production", 1, "1 production opportunity"],
+ ["production", 0, "0 production opportunities"],
+ ] as const)("names %s with %s as %s", (context, total, expected) => {
+ render(
+ <ScopeLine filteredTotal={total} repositoryTotal={total} context={context} narrowed={0} />,
+ );
+ expect(screen.getByRole("status").textContent).toContain(expected);
+ });
+});
diff --git a/packages/ui/src/files/file-history-tab.tsx b/packages/ui/src/files/file-history-tab.tsx
index 9526ef368..899331811 100644
--- a/packages/ui/src/files/file-history-tab.tsx
+++ b/packages/ui/src/files/file-history-tab.tsx
@@ -7,7 +7,13 @@ import { ProportionBar } from "../shared/proportion-bar";
import { ChangeHistoryCard } from "../git/change-history-card";
import { StatRibbon, type RibbonStat } from "../stats/stat-ribbon";
import { summarizeFixHistory } from "../lib/fix-history";
-import { formatAgeDays, formatNumber, formatRelativeTime, truncatePath } from "../lib/format";
+import {
+ formatAgeDays,
+ formatNumber,
+ formatRelativeTime,
+ ordinal,
+ truncatePath,
+} from "../lib/format";
import type { FileDetailGit } from "@repowise-dev/types/files";
import { FileSection, Fig } from "./file-section";
import { FileMark } from "./file-marks";
@@ -71,7 +77,7 @@ export function FileHistoryTab({
{ label: "Bus factor", value: formatNumber(git.bus_factor) },
];
if (git.churn_percentile != null) {
- stats.push({ label: "Churn", value: `${Math.round(git.churn_percentile)}th pct` });
+ stats.push({ label: "Churn", value: `${ordinal(Math.round(git.churn_percentile))} pct` });
}
return (
diff --git a/packages/ui/src/health/churn-complexity-quadrant.tsx b/packages/ui/src/health/churn-complexity-quadrant.tsx
index 7793cd4a7..388e537c7 100644
--- a/packages/ui/src/health/churn-complexity-quadrant.tsx
+++ b/packages/ui/src/health/churn-complexity-quadrant.tsx
@@ -6,6 +6,7 @@ import { useMemo, useState } from "react";
// subpath imports are fine (erased before resolution).
import { bandForScore, formatScore } from "@repowise-dev/types";
import type { ChurnComplexityPoint } from "@repowise-dev/types/health";
+import { ordinal } from "../lib/format";
import { HEALTH_BAND_FILL } from "./tokens";
export interface ChurnComplexityQuadrantProps {
@@ -148,7 +149,7 @@ export function ChurnComplexityQuadrant({
onMouseLeave={() => setHovered(null)}
onClick={onSelect ? () => onSelect(p) : undefined}
>
- <title>{`${p.file_path}\n${p.commit_count_90d} commits/90d (${Math.round(p.churn_percentile)}th pct) · CCN ${p.max_ccn} · NLOC ${p.nloc} · score ${formatScore(p.score)}`}</title>
+ <title>{`${p.file_path}\n${p.commit_count_90d} commits/90d (${ordinal(Math.round(p.churn_percentile))} pct) · CCN ${p.max_ccn} · NLOC ${p.nloc} · score ${formatScore(p.score)}`}</title>
</circle>
);
})}
diff --git a/packages/ui/src/health/file-signals-panel.tsx b/packages/ui/src/health/file-signals-panel.tsx
index 2b2a717a6..bf0c7fa7d 100644
--- a/packages/ui/src/health/file-signals-panel.tsx
+++ b/packages/ui/src/health/file-signals-panel.tsx
@@ -1,7 +1,7 @@
"use client";
import type { FileSignals } from "@repowise-dev/types/health";
-import { formatRelativeTimeOrNull } from "../lib/format";
+import { formatRelativeTimeOrNull, ordinal } from "../lib/format";
export interface FileSignalsPanelProps {
signals: FileSignals | null | undefined;
@@ -45,7 +45,7 @@ export function FileSignalsPanel({ signals, hideHeading = false }: FileSignalsPa
value={
signals.change_entropy_pct == null
? null
- : `${Math.round(signals.change_entropy_pct)}th pct`
+ : `${ordinal(Math.round(signals.change_entropy_pct))} pct`
}
caption="change scatter: how spread out its edits are"
present={signals.change_entropy_pct != null}
diff --git a/packages/ui/src/health/performance/filters.tsx b/packages/ui/src/health/performance/filters.tsx
index 822d5676d..116d4c244 100644
--- a/packages/ui/src/health/performance/filters.tsx
+++ b/packages/ui/src/health/performance/filters.tsx
@@ -187,10 +187,11 @@ export function ScopeLine({
narrowed: number;
analyzedCommit?: string | null | undefined;
}) {
+ const noun = filteredTotal === 1 ? "opportunity" : "opportunities";
const scope =
context === "all"
- ? "opportunities"
- : `${contextLabel(context as PerformanceExecutionContext).toLowerCase()} opportunities`;
+ ? noun
+ : `${contextLabel(context as PerformanceExecutionContext).toLowerCase()} ${noun}`;
return (
<p role="status" className="text-xs text-[var(--color-text-tertiary)]">
<span className="tabular-nums">{filteredTotal.toLocaleString()}</span> {scope}
diff --git a/packages/ui/src/lib/format.test.ts b/packages/ui/src/lib/format.test.ts
index 83ea7462a..8a69d44bf 100644
--- a/packages/ui/src/lib/format.test.ts
+++ b/packages/ui/src/lib/format.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
-import { formatTopPercentile } from "./format";
+import { formatTopPercentile, ordinal } from "./format";
describe("formatTopPercentile", () => {
it.each([
@@ -19,3 +19,21 @@ describe("formatTopPercentile", () => {
expect(formatTopPercentile(-1)).toBe("top 100%");
});
});
+
+describe("ordinal", () => {
+ it.each([
+ [1, "1st"],
+ [2, "2nd"],
+ [3, "3rd"],
+ [4, "4th"],
+ [11, "11th"],
+ [12, "12th"],
+ [13, "13th"],
+ [21, "21st"],
+ [93, "93rd"],
+ [111, "111th"],
+ [0, "0th"],
+ ])("renders %s as %s", (n, expected) => {
+ expect(ordinal(n)).toBe(expected);
+ });
+});
diff --git a/packages/ui/src/lib/format.ts b/packages/ui/src/lib/format.ts
index 392389fed..3a13ebda4 100644
--- a/packages/ui/src/lib/format.ts
+++ b/packages/ui/src/lib/format.ts
@@ -31,6 +31,14 @@ export function formatNumber(n: number): string {
return NUMBER_FORMAT.format(n);
}
+/** English ordinal of an integer: 1 → "1st", 2 → "2nd", 3 → "3rd", 11 → "11th", 93 → "93rd". */
+export function ordinal(n: number): string {
+ const tens = Math.abs(n) % 100;
+ const suffix =
+ tens >= 11 && tens <= 13 ? "th" : (["th", "st", "nd", "rd"][Math.abs(n) % 10] ?? "th");
+ return `${n}${suffix}`;
+}
+
/** Format large counts compactly: 1234567 → "1.2M", 98432 → "98.4K", 999 → "999" */
export function formatCompact(n: number): string {
if (n >= 1_000_000) return `${Number((n / 1_000_000).toFixed(1))}M`;
diff --git a/tests/fixtures/agent_prompts/golden.json b/tests/fixtures/agent_prompts/golden.json
index 29502a65f..a69a9cebd 100644
--- a/tests/fixtures/agent_prompts/golden.json
+++ b/tests/fixtures/agent_prompts/golden.json
@@ -105,10 +105,10 @@
},
"refactoring_opportunity": {
"two_steps_one_relocated": {
- "generic": "You are a senior engineer in this repository. Repowise, a code-intelligence index, composed the ordered refactoring steps below for one file from its static analysis. Repowise does not edit code: the steps are a spec for you to apply. Read the code each step names and confirm it before you change it.\n## Extract Method in `src/loader.py` (`acme/api`)\n- Opportunity: `refop4_dddddddddddddddddddd`\n- File: `src/loader.py`\n- Leading cause: complex method.\n- 2 steps: 1 mechanical, 1 judgment.\n- Recovers ~2.50 of health score if applied.\n- Effort: M bucket. Detector confidence: high.\n- No dominant problem was recorded for this file, so whether these steps address it is unknown.\n## Steps, in order\nA step carrying `relocated_by` names a symbol an earlier step moves.\n\n1. **Extract Method** at `src/loader.py:40-120` (`Loader.load`)\n - Step id: `refac4_aaaaaaaaaaaaaaaaaaaa`\n - Mechanical: dataflow proved local extraction.\n - Move lines 61-78 of `Loader.load` into a new helper `<name>` in the same scope, and replace them with one call to it. The helper's name is a placeholder: rename it for what it returns or does, in its header and its call. (`src/loader.py:61-78`)\n - Parameters (in): path\n - Returns (out): (nothing)\n\n2. **Move Method** at `src/loader.py:130` (`Loader.parse`)\n - Step id: `refac4_eeeeeeeeeeeeeeeeeeee`\n - Judgment. Not established: call sites resolved.\n - **Locate it again first.** Step `refac4_aaaaaaaaaaaaaaaaaaaa` moves this symbol, so the path and lines above are where it was, not where it will be when you get here.\n - This step's plan was not in this payload; ask for it by id: `refac4_eeeeeeeeeeeeeeeeeeee`.\n## Evidence behind the diagnosis\nSupporting observations, not extra work.\n- Extract Helper `loader.py:10-20`: duplicated lines: 11; occurrence count: 2\n1 of 3 shown.\n## Verify\n### For `Loader.load`\n\nRun these before and after the change, the most direct first:\n\n- `tests/test_loader.py`\n\nRun:\n\n```\npytest tests/test_loader.py\n```\n\n### For `Loader.parse`\n\nNo guarding test was found; the test added before the edit passes after it.\n## Hard constraints\n- **Apply the steps in the order given.** It is dependency-safe; reordering it is not.\n- **Read a judgment step's code before applying it.** Its obligation is unproven.\n- **Do not generate a script that rewrites the file.** Make each edit directly in the file, one at a time, re-reading the span after each.\n- **Keep behaviour.** Run the tests (and type-checker / linter) before and after.\n- **Confirm before changing.** The plan comes from stored static analysis; the code may have moved since it ran.\n- **Say when it is wrong.** If the plan does not fit the real code, stop and explain why instead of forcing it.\n## What I expect back\n1. The refactored code, with each step above applied in order.\n2. Per step: whether you applied it, and for anything you skipped, the reason.\n3. The Verify run, before and after, with its result.\n4. The opportunity id `refop4_dddddddddddddddddddd`, so the work can be matched back to the record.\n## This opportunity's id\n`refop4_dddddddddddddddddddd`\nQuote it when you report back.",
- "claude-code": "You are Claude Code in this repository. Repowise, a code-intelligence index, composed the ordered refactoring steps below for one file from its static analysis. Repowise does not edit code: the steps are a spec for you to apply. Read each span with Read and Grep before editing, and track the steps with TodoWrite.\n## Extract Method in `src/loader.py` (`acme/api`)\n- Opportunity: `refop4_dddddddddddddddddddd`\n- File: `src/loader.py`\n- Leading cause: complex method.\n- 2 steps: 1 mechanical, 1 judgment.\n- Recovers ~2.50 of health score if applied.\n- Effort: M bucket. Detector confidence: high.\n- No dominant problem was recorded for this file, so whether these steps address it is unknown.\n## Steps, in order\nA step carrying `relocated_by` names a symbol an earlier step moves.\n\n1. **Extract Method** at `src/loader.py:40-120` (`Loader.load`)\n - Step id: `refac4_aaaaaaaaaaaaaaaaaaaa`\n - Mechanical: dataflow proved local extraction.\n - Move lines 61-78 of `Loader.load` into a new helper `<name>` in the same scope, and replace them with one call to it. The helper's name is a placeholder: rename it for what it returns or does, in its header and its call. (`src/loader.py:61-78`)\n - Parameters (in): path\n - Returns (out): (nothing)\n\n2. **Move Method** at `src/loader.py:130` (`Loader.parse`)\n - Step id: `refac4_eeeeeeeeeeeeeeeeeeee`\n - Judgment. Not established: call sites resolved.\n - **Locate it again first.** Step `refac4_aaaaaaaaaaaaaaaaaaaa` moves this symbol, so the path and lines above are where it was, not where it will be when you get here.\n - This step's plan was not in this payload; ask for it by id: `refac4_eeeeeeeeeeeeeeeeeeee`.\n## Evidence behind the diagnosis\nSupporting observations, not extra work.\n- Extract Helper `loader.py:10-20`: duplicated lines: 11; occurrence count: 2\n1 of 3 shown.\n## Verify\n### For `Loader.load`\n\nRun these before and after the change, the most direct first:\n\n- `tests/test_loader.py`\n\nRun:\n\n```\npytest tests/test_loader.py\n```\n\n### For `Loader.parse`\n\nNo guarding test was found; the test added before the edit passes after it.\n## Hard constraints\n- **Apply the steps in the order given.** It is dependency-safe; reordering it is not.\n- **Read a judgment step's code before applying it.** Its obligation is unproven.\n- **Do not generate a script that rewrites the file.** Make each edit directly in the file, one at a time, re-reading the span after each.\n- **Keep behaviour.** Run the tests (and type-checker / linter) before and after.\n- **Confirm before changing.** The plan comes from stored static analysis; the code may have moved since it ran.\n- **Say when it is wrong.** If the plan does not fit the real code, stop and explain why instead of forcing it.\n## What I expect back\n1. The refactored code, with each step above applied in order.\n2. Per step: whether you applied it, and for anything you skipped, the reason.\n3. The Verify run, before and after, with its result.\n4. The opportunity id `refop4_dddddddddddddddddddd`, so the work can be matched back to the record.\n## This opportunity's id\n`refop4_dddddddddddddddddddd`\nQuote it when you report back.",
- "claude-code-mcp": "You are Claude Code in this repository, which Repowise indexes and serves over MCP. Repowise composed the ordered refactoring steps below for one file from its static analysis. It does not edit code: the steps are a spec for you to apply. Pull the record with the call at the end and `get_symbol` each span before reading files by hand.\n## Extract Method in `src/loader.py` (`acme/api`)\n- Opportunity: `refop4_dddddddddddddddddddd`\n- File: `src/loader.py`\n- Leading cause: complex method.\n- 2 steps: 1 mechanical, 1 judgment.\n- Recovers ~2.50 of health score if applied.\n- Effort: M bucket. Detector confidence: high.\n- No dominant problem was recorded for this file, so whether these steps address it is unknown.\n## Steps, in order\nA step carrying `relocated_by` names a symbol an earlier step moves.\n\n1. **Extract Method** at `src/loader.py:40-120` (`Loader.load`)\n - Step id: `refac4_aaaaaaaaaaaaaaaaaaaa`\n - Mechanical: dataflow proved local extraction.\n - Move lines 61-78 of `Loader.load` into a new helper `<name>` in the same scope, and replace them with one call to it. The helper's name is a placeholder: rename it for what it returns or does, in its header and its call. (`src/loader.py:61-78`)\n - Parameters (in): path\n - Returns (out): (nothing)\n\n2. **Move Method** at `src/loader.py:130` (`Loader.parse`)\n - Step id: `refac4_eeeeeeeeeeeeeeeeeeee`\n - Judgment. Not established: call sites resolved.\n - **Locate it again first.** Step `refac4_aaaaaaaaaaaaaaaaaaaa` moves this symbol, so the path and lines above are where it was, not where it will be when you get here.\n - This step's plan was not in this payload; ask for it by id: `refac4_eeeeeeeeeeeeeeeeeeee`.\n## Evidence behind the diagnosis\nSupporting observations, not extra work.\n- Extract Helper `loader.py:10-20`: duplicated lines: 11; occurrence count: 2\n1 of 3 shown.\n## Verify\n### For `Loader.load`\n\nRun these before and after the change, the most direct first:\n\n- `tests/test_loader.py`\n\nRun:\n\n```\npytest tests/test_loader.py\n```\n\n### For `Loader.parse`\n\nNo guarding test was found; the test added before the edit passes after it.\n## Hard constraints\n- **Apply the steps in the order given.** It is dependency-safe; reordering it is not.\n- **Read a judgment step's code before applying it.** Its obligation is unproven.\n- **Do not generate a script that rewrites the file.** Make each edit directly in the file, one at a time, re-reading the span after each.\n- **Keep behaviour.** Run the tests (and type-checker / linter) before and after.\n- **Confirm before changing.** The plan comes from stored static analysis; the code may have moved since it ran.\n- **Say when it is wrong.** If the plan does not fit the real code, stop and explain why instead of forcing it.\n## What I expect back\n1. The refactored code, with each step above applied in order.\n2. Per step: whether you applied it, and for anything you skipped, the reason.\n3. The Verify run, before and after, with its result.\n4. The opportunity id `refop4_dddddddddddddddddddd`, so the work can be matched back to the record.\n## Pull this record yourself\n`get_health(opportunity_id=\"refop4_dddddddddddddddddddd\")`\nIt returns this opportunity from the index: every ordered step with its plan, the validation profiles and the evidence. Call it before you start; the steps above are a snapshot.",
- "cursor": "Work in this repository. Repowise, a code-intelligence index, composed the ordered refactoring steps below for one file from its static analysis. Repowise does not edit code: the steps are a spec for you to apply. Open each span with @file and confirm it before editing.\n## Extract Method in `src/loader.py` (`acme/api`)\n- Opportunity: `refop4_dddddddddddddddddddd`\n- File: `src/loader.py`\n- Leading cause: complex method.\n- 2 steps: 1 mechanical, 1 judgment.\n- Recovers ~2.50 of health score if applied.\n- Effort: M bucket. Detector confidence: high.\n- No dominant problem was recorded for this file, so whether these steps address it is unknown.\n## Steps, in order\nA step carrying `relocated_by` names a symbol an earlier step moves.\n\n1. **Extract Method** at `src/loader.py:40-120` (`Loader.load`)\n - Step id: `refac4_aaaaaaaaaaaaaaaaaaaa`\n - Mechanical: dataflow proved local extraction.\n - Move lines 61-78 of `Loader.load` into a new helper `<name>` in the same scope, and replace them with one call to it. The helper's name is a placeholder: rename it for what it returns or does, in its header and its call. (`src/loader.py:61-78`)\n - Parameters (in): path\n - Returns (out): (nothing)\n\n2. **Move Method** at `src/loader.py:130` (`Loader.parse`)\n - Step id: `refac4_eeeeeeeeeeeeeeeeeeee`\n - Judgment. Not established: call sites resolved.\n - **Locate it again first.** Step `refac4_aaaaaaaaaaaaaaaaaaaa` moves this symbol, so the path and lines above are where it was, not where it will be when you get here.\n - This step's plan was not in this payload; ask for it by id: `refac4_eeeeeeeeeeeeeeeeeeee`.\n## Evidence behind the diagnosis\nSupporting observations, not extra work.\n- Extract Helper `loader.py:10-20`: duplicated lines: 11; occurrence count: 2\n1 of 3 shown.\n## Verify\n### For `Loader.load`\n\nRun these before and after the change, the most direct first:\n\n- `tests/test_loader.py`\n\nRun:\n\n```\npytest tests/test_loader.py\n```\n\n### For `Loader.parse`\n\nNo guarding test was found; the test added before the edit passes after it.\n## Hard constraints\n- **Apply the steps in the order given.** It is dependency-safe; reordering it is not.\n- **Read a judgment step's code before applying it.** Its obligation is unproven.\n- **Do not generate a script that rewrites the file.** Make each edit directly in the file, one at a time, re-reading the span after each.\n- **Keep behaviour.** Run the tests (and type-checker / linter) before and after.\n- **Confirm before changing.** The plan comes from stored static analysis; the code may have moved since it ran.\n- **Say when it is wrong.** If the plan does not fit the real code, stop and explain why instead of forcing it.\n## What I expect back\n1. The refactored code, with each step above applied in order.\n2. Per step: whether you applied it, and for anything you skipped, the reason.\n3. The Verify run, before and after, with its result.\n4. The opportunity id `refop4_dddddddddddddddddddd`, so the work can be matched back to the record.\n## This opportunity's id\n`refop4_dddddddddddddddddddd`\nQuote it when you report back."
+ "generic": "You are a senior engineer in this repository. Repowise, a code-intelligence index, composed the ordered refactoring steps below for one file from its static analysis. Repowise does not edit code: the steps are a spec for you to apply. Read the code each step names and confirm it before you change it.\n## Extract Method in `src/loader.py` (`acme/api`)\n- Opportunity: `refop4_dddddddddddddddddddd`\n- File: `src/loader.py`\n- Leading cause: complex method.\n- 2 steps: 1 mechanical, 1 judgment.\n- Recovers ~2.50 of health score if applied.\n- Effort: M bucket. Detector confidence: high.\n- No dominant problem was recorded for this file, so whether these steps address it is unknown.\n## Steps, in order\nA step marked 'Moved by an earlier step' names a symbol an earlier step relocates.\n\n1. **Extract Method** at `src/loader.py:40-120` (`Loader.load`)\n - Step id: `refac4_aaaaaaaaaaaaaaaaaaaa`\n - Mechanical: dataflow proved local extraction.\n - Move lines 61-78 of `Loader.load` into a new helper `<name>` in the same scope, and replace them with one call to it. The helper's name is a placeholder: rename it for what it returns or does, in its header and its call. (`src/loader.py:61-78`)\n - Parameters (in): path\n - Returns (out): (nothing)\n\n2. **Move Method** at `src/loader.py:130` (`Loader.parse`)\n - Step id: `refac4_eeeeeeeeeeeeeeeeeeee`\n - Judgment. Not established: call sites resolved.\n - **Locate it again first.** Step `refac4_aaaaaaaaaaaaaaaaaaaa` moves this symbol, so the path and lines above are where it was, not where it will be when you get here.\n - This step's plan was not in this payload; ask for it by id: `refac4_eeeeeeeeeeeeeeeeeeee`.\n## Evidence behind the diagnosis\nSupporting observations, not extra work.\n- Extract Helper `loader.py:10-20`: duplicated lines: 11; occurrence count: 2\n1 of 3 shown.\n## Verify\n### For `Loader.load`\n\nRun these before and after the change, the most direct first:\n\n- `tests/test_loader.py`\n\nRun:\n\n```\npytest tests/test_loader.py\n```\n\n### For `Loader.parse`\n\nNo guarding test was found; the test added before the edit passes after it.\n## Hard constraints\n- **Apply the steps in the order given.** It is dependency-safe; reordering it is not.\n- **Read a judgment step's code before applying it.** Its obligation is unproven.\n- **Do not generate a script that rewrites the file.** Make each edit directly in the file, one at a time, re-reading the span after each.\n- **Keep behaviour.** Run the tests (and type-checker / linter) before and after.\n- **Confirm before changing.** The plan comes from stored static analysis; the code may have moved since it ran.\n- **Say when it is wrong.** If the plan does not fit the real code, stop and explain why instead of forcing it.\n## What I expect back\n1. The refactored code, with each step above applied in order.\n2. Per step: whether you applied it, and for anything you skipped, the reason.\n3. The Verify run, before and after, with its result.\n4. The opportunity id `refop4_dddddddddddddddddddd`, so the work can be matched back to the record.\n## This opportunity's id\n`refop4_dddddddddddddddddddd`\nQuote it when you report back.",
+ "claude-code": "You are Claude Code in this repository. Repowise, a code-intelligence index, composed the ordered refactoring steps below for one file from its static analysis. Repowise does not edit code: the steps are a spec for you to apply. Read each span with Read and Grep before editing, and track the steps with TodoWrite.\n## Extract Method in `src/loader.py` (`acme/api`)\n- Opportunity: `refop4_dddddddddddddddddddd`\n- File: `src/loader.py`\n- Leading cause: complex method.\n- 2 steps: 1 mechanical, 1 judgment.\n- Recovers ~2.50 of health score if applied.\n- Effort: M bucket. Detector confidence: high.\n- No dominant problem was recorded for this file, so whether these steps address it is unknown.\n## Steps, in order\nA step marked 'Moved by an earlier step' names a symbol an earlier step relocates.\n\n1. **Extract Method** at `src/loader.py:40-120` (`Loader.load`)\n - Step id: `refac4_aaaaaaaaaaaaaaaaaaaa`\n - Mechanical: dataflow proved local extraction.\n - Move lines 61-78 of `Loader.load` into a new helper `<name>` in the same scope, and replace them with one call to it. The helper's name is a placeholder: rename it for what it returns or does, in its header and its call. (`src/loader.py:61-78`)\n - Parameters (in): path\n - Returns (out): (nothing)\n\n2. **Move Method** at `src/loader.py:130` (`Loader.parse`)\n - Step id: `refac4_eeeeeeeeeeeeeeeeeeee`\n - Judgment. Not established: call sites resolved.\n - **Locate it again first.** Step `refac4_aaaaaaaaaaaaaaaaaaaa` moves this symbol, so the path and lines above are where it was, not where it will be when you get here.\n - This step's plan was not in this payload; ask for it by id: `refac4_eeeeeeeeeeeeeeeeeeee`.\n## Evidence behind the diagnosis\nSupporting observations, not extra work.\n- Extract Helper `loader.py:10-20`: duplicated lines: 11; occurrence count: 2\n1 of 3 shown.\n## Verify\n### For `Loader.load`\n\nRun these before and after the change, the most direct first:\n\n- `tests/test_loader.py`\n\nRun:\n\n```\npytest tests/test_loader.py\n```\n\n### For `Loader.parse`\n\nNo guarding test was found; the test added before the edit passes after it.\n## Hard constraints\n- **Apply the steps in the order given.** It is dependency-safe; reordering it is not.\n- **Read a judgment step's code before applying it.** Its obligation is unproven.\n- **Do not generate a script that rewrites the file.** Make each edit directly in the file, one at a time, re-reading the span after each.\n- **Keep behaviour.** Run the tests (and type-checker / linter) before and after.\n- **Confirm before changing.** The plan comes from stored static analysis; the code may have moved since it ran.\n- **Say when it is wrong.** If the plan does not fit the real code, stop and explain why instead of forcing it.\n## What I expect back\n1. The refactored code, with each step above applied in order.\n2. Per step: whether you applied it, and for anything you skipped, the reason.\n3. The Verify run, before and after, with its result.\n4. The opportunity id `refop4_dddddddddddddddddddd`, so the work can be matched back to the record.\n## This opportunity's id\n`refop4_dddddddddddddddddddd`\nQuote it when you report back.",
+ "claude-code-mcp": "You are Claude Code in this repository, which Repowise indexes and serves over MCP. Repowise composed the ordered refactoring steps below for one file from its static analysis. It does not edit code: the steps are a spec for you to apply. Pull the record with the call at the end and `get_symbol` each span before reading files by hand.\n## Extract Method in `src/loader.py` (`acme/api`)\n- Opportunity: `refop4_dddddddddddddddddddd`\n- File: `src/loader.py`\n- Leading cause: complex method.\n- 2 steps: 1 mechanical, 1 judgment.\n- Recovers ~2.50 of health score if applied.\n- Effort: M bucket. Detector confidence: high.\n- No dominant problem was recorded for this file, so whether these steps address it is unknown.\n## Steps, in order\nA step marked 'Moved by an earlier step' names a symbol an earlier step relocates.\n\n1. **Extract Method** at `src/loader.py:40-120` (`Loader.load`)\n - Step id: `refac4_aaaaaaaaaaaaaaaaaaaa`\n - Mechanical: dataflow proved local extraction.\n - Move lines 61-78 of `Loader.load` into a new helper `<name>` in the same scope, and replace them with one call to it. The helper's name is a placeholder: rename it for what it returns or does, in its header and its call. (`src/loader.py:61-78`)\n - Parameters (in): path\n - Returns (out): (nothing)\n\n2. **Move Method** at `src/loader.py:130` (`Loader.parse`)\n - Step id: `refac4_eeeeeeeeeeeeeeeeeeee`\n - Judgment. Not established: call sites resolved.\n - **Locate it again first.** Step `refac4_aaaaaaaaaaaaaaaaaaaa` moves this symbol, so the path and lines above are where it was, not where it will be when you get here.\n - This step's plan was not in this payload; ask for it by id: `refac4_eeeeeeeeeeeeeeeeeeee`.\n## Evidence behind the diagnosis\nSupporting observations, not extra work.\n- Extract Helper `loader.py:10-20`: duplicated lines: 11; occurrence count: 2\n1 of 3 shown.\n## Verify\n### For `Loader.load`\n\nRun these before and after the change, the most direct first:\n\n- `tests/test_loader.py`\n\nRun:\n\n```\npytest tests/test_loader.py\n```\n\n### For `Loader.parse`\n\nNo guarding test was found; the test added before the edit passes after it.\n## Hard constraints\n- **Apply the steps in the order given.** It is dependency-safe; reordering it is not.\n- **Read a judgment step's code before applying it.** Its obligation is unproven.\n- **Do not generate a script that rewrites the file.** Make each edit directly in the file, one at a time, re-reading the span after each.\n- **Keep behaviour.** Run the tests (and type-checker / linter) before and after.\n- **Confirm before changing.** The plan comes from stored static analysis; the code may have moved since it ran.\n- **Say when it is wrong.** If the plan does not fit the real code, stop and explain why instead of forcing it.\n## What I expect back\n1. The refactored code, with each step above applied in order.\n2. Per step: whether you applied it, and for anything you skipped, the reason.\n3. The Verify run, before and after, with its result.\n4. The opportunity id `refop4_dddddddddddddddddddd`, so the work can be matched back to the record.\n## Pull this record yourself\n`get_health(opportunity_id=\"refop4_dddddddddddddddddddd\")`\nIt returns this opportunity from the index: every ordered step with its plan, the validation profiles and the evidence. Call it before you start; the steps above are a snapshot.",
+ "cursor": "Work in this repository. Repowise, a code-intelligence index, composed the ordered refactoring steps below for one file from its static analysis. Repowise does not edit code: the steps are a spec for you to apply. Open each span with @file and confirm it before editing.\n## Extract Method in `src/loader.py` (`acme/api`)\n- Opportunity: `refop4_dddddddddddddddddddd`\n- File: `src/loader.py`\n- Leading cause: complex method.\n- 2 steps: 1 mechanical, 1 judgment.\n- Recovers ~2.50 of health score if applied.\n- Effort: M bucket. Detector confidence: high.\n- No dominant problem was recorded for this file, so whether these steps address it is unknown.\n## Steps, in order\nA step marked 'Moved by an earlier step' names a symbol an earlier step relocates.\n\n1. **Extract Method** at `src/loader.py:40-120` (`Loader.load`)\n - Step id: `refac4_aaaaaaaaaaaaaaaaaaaa`\n - Mechanical: dataflow proved local extraction.\n - Move lines 61-78 of `Loader.load` into a new helper `<name>` in the same scope, and replace them with one call to it. The helper's name is a placeholder: rename it for what it returns or does, in its header and its call. (`src/loader.py:61-78`)\n - Parameters (in): path\n - Returns (out): (nothing)\n\n2. **Move Method** at `src/loader.py:130` (`Loader.parse`)\n - Step id: `refac4_eeeeeeeeeeeeeeeeeeee`\n - Judgment. Not established: call sites resolved.\n - **Locate it again first.** Step `refac4_aaaaaaaaaaaaaaaaaaaa` moves this symbol, so the path and lines above are where it was, not where it will be when you get here.\n - This step's plan was not in this payload; ask for it by id: `refac4_eeeeeeeeeeeeeeeeeeee`.\n## Evidence behind the diagnosis\nSupporting observations, not extra work.\n- Extract Helper `loader.py:10-20`: duplicated lines: 11; occurrence count: 2\n1 of 3 shown.\n## Verify\n### For `Loader.load`\n\nRun these before and after the change, the most direct first:\n\n- `tests/test_loader.py`\n\nRun:\n\n```\npytest tests/test_loader.py\n```\n\n### For `Loader.parse`\n\nNo guarding test was found; the test added before the edit passes after it.\n## Hard constraints\n- **Apply the steps in the order given.** It is dependency-safe; reordering it is not.\n- **Read a judgment step's code before applying it.** Its obligation is unproven.\n- **Do not generate a script that rewrites the file.** Make each edit directly in the file, one at a time, re-reading the span after each.\n- **Keep behaviour.** Run the tests (and type-checker / linter) before and after.\n- **Confirm before changing.** The plan comes from stored static analysis; the code may have moved since it ran.\n- **Say when it is wrong.** If the plan does not fit the real code, stop and explain why instead of forcing it.\n## What I expect back\n1. The refactored code, with each step above applied in order.\n2. Per step: whether you applied it, and for anything you skipped, the reason.\n3. The Verify run, before and after, with its result.\n4. The opportunity id `refop4_dddddddddddddddddddd`, so the work can be matched back to the record.\n## This opportunity's id\n`refop4_dddddddddddddddddddd`\nQuote it when you report back."
}
}
}
diff --git a/tests/fixtures/agent_prompts/refactoring.json b/tests/fixtures/agent_prompts/refactoring.json
index eb3bd2755..20aa0174c 100644
--- a/tests/fixtures/agent_prompts/refactoring.json
+++ b/tests/fixtures/agent_prompts/refactoring.json
@@ -542,7 +542,7 @@
"mechanical_steps": 1,
"judgment_steps": 1,
"recoverable_health": 2.5,
- "ordering_note": "A step carrying `relocated_by` names a symbol an earlier step moves.",
+ "ordering_note": "A step marked 'Moved by an earlier step' names a symbol an earlier step relocates.",
"steps": [
{
"plan_id": "refac4_aaaaaaaaaaaaaaaaaaaa",