@mrclrchtr/supi-claude-md 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/node_modules/@mrclrchtr/supi-core/README.md +90 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +30 -0
- package/node_modules/@mrclrchtr/supi-core/src/config-settings.ts +76 -0
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +186 -0
- package/node_modules/@mrclrchtr/supi-core/src/context-messages.ts +119 -0
- package/node_modules/@mrclrchtr/supi-core/src/context-provider-registry.ts +36 -0
- package/node_modules/@mrclrchtr/supi-core/src/context-tag.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +255 -0
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +83 -0
- package/node_modules/@mrclrchtr/supi-core/src/project-roots.ts +170 -0
- package/node_modules/@mrclrchtr/supi-core/src/registry-utils.ts +54 -0
- package/node_modules/@mrclrchtr/supi-core/src/session-utils.ts +29 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings-command.ts +15 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings-registry.ts +41 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +226 -0
- package/node_modules/@mrclrchtr/supi-core/src/terminal.ts +60 -0
- package/package.json +44 -0
- package/skills/claude-md-improver/SKILL.md +253 -0
- package/skills/claude-md-improver/references/quality-criteria.md +114 -0
- package/skills/claude-md-improver/references/templates.md +300 -0
- package/skills/claude-md-improver/references/update-guidelines.md +218 -0
- package/skills/claude-md-revision/SKILL.md +126 -0
- package/skills/claude-md-revision/evals/evals.json +43 -0
- package/skills/claude-md-revision/references/quality-criteria.md +114 -0
- package/skills/claude-md-revision/references/templates.md +300 -0
- package/skills/claude-md-revision/references/update-guidelines.md +218 -0
- package/src/claude-md.ts +163 -0
- package/src/config.ts +33 -0
- package/src/discovery.ts +133 -0
- package/src/index.ts +1 -0
- package/src/settings-registration.ts +119 -0
- package/src/state.ts +94 -0
- package/src/subdirectory.ts +84 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// Generic settings overlay for SuPi extensions.
|
|
2
|
+
//
|
|
3
|
+
// Uses pi-tui's SettingsList with scope toggle (Tab), extension grouping,
|
|
4
|
+
// and search. Each extension declares its settings via registerSettings().
|
|
5
|
+
|
|
6
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { getSettingsListTheme } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
import {
|
|
9
|
+
Container,
|
|
10
|
+
Input,
|
|
11
|
+
Key,
|
|
12
|
+
matchesKey,
|
|
13
|
+
type SettingItem,
|
|
14
|
+
SettingsList,
|
|
15
|
+
Text,
|
|
16
|
+
} from "@earendil-works/pi-tui";
|
|
17
|
+
import {
|
|
18
|
+
getRegisteredSettings,
|
|
19
|
+
type SettingsScope,
|
|
20
|
+
type SettingsSection,
|
|
21
|
+
} from "./settings-registry.ts";
|
|
22
|
+
|
|
23
|
+
// ── Input submenu component ──────────────────────────────────
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates a pi-tui Input-backed submenu component with enter-to-confirm
|
|
27
|
+
* and escape-to-cancel handling.
|
|
28
|
+
*
|
|
29
|
+
* @param currentValue - Initial value for the text input.
|
|
30
|
+
* @param label - Label text displayed above the input.
|
|
31
|
+
* @param done - Callback invoked with the confirmed value, or undefined on cancel.
|
|
32
|
+
*/
|
|
33
|
+
export function createInputSubmenu(
|
|
34
|
+
currentValue: string,
|
|
35
|
+
label: string,
|
|
36
|
+
done: (selectedValue?: string) => void,
|
|
37
|
+
): {
|
|
38
|
+
render: (width: number) => string[];
|
|
39
|
+
invalidate: () => void;
|
|
40
|
+
handleInput: (data: string) => boolean;
|
|
41
|
+
} {
|
|
42
|
+
const input = new Input();
|
|
43
|
+
input.setValue(currentValue);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
render: (_width: number) => {
|
|
47
|
+
const lines = [` ${label}`];
|
|
48
|
+
lines.push(...input.render(_width));
|
|
49
|
+
lines.push(" enter confirm • esc cancel");
|
|
50
|
+
return lines;
|
|
51
|
+
},
|
|
52
|
+
invalidate: () => {
|
|
53
|
+
input.invalidate();
|
|
54
|
+
},
|
|
55
|
+
handleInput: (data: string) => {
|
|
56
|
+
if (matchesKey(data, Key.escape)) {
|
|
57
|
+
done();
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (matchesKey(data, Key.enter)) {
|
|
61
|
+
done(input.getValue());
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
input.handleInput(data);
|
|
65
|
+
return true;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ── Types ────────────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
interface OverlayState {
|
|
73
|
+
scope: SettingsScope;
|
|
74
|
+
cwd: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ── Pure helpers ─────────────────────────────────────────────
|
|
78
|
+
|
|
79
|
+
function getScopeLabel(scope: SettingsScope): string {
|
|
80
|
+
return scope === "project" ? "Project" : "Global";
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function buildFlatItems(
|
|
84
|
+
sections: SettingsSection[],
|
|
85
|
+
scope: SettingsScope,
|
|
86
|
+
cwd: string,
|
|
87
|
+
): SettingItem[] {
|
|
88
|
+
const items: SettingItem[] = [];
|
|
89
|
+
for (const section of sections) {
|
|
90
|
+
const sectionItems = section.loadValues(scope, cwd);
|
|
91
|
+
for (const item of sectionItems) {
|
|
92
|
+
items.push({
|
|
93
|
+
...item,
|
|
94
|
+
id: `${section.id}.${item.id}`,
|
|
95
|
+
label: `${section.label}: ${item.label}`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return items;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function findSectionAndId(
|
|
103
|
+
sections: SettingsSection[],
|
|
104
|
+
flatId: string,
|
|
105
|
+
): { section: SettingsSection; itemId: string } | null {
|
|
106
|
+
const dotIndex = flatId.indexOf(".");
|
|
107
|
+
if (dotIndex === -1) return null;
|
|
108
|
+
const sectionId = flatId.slice(0, dotIndex);
|
|
109
|
+
const itemId = flatId.slice(dotIndex + 1);
|
|
110
|
+
const section = sections.find((s) => s.id === sectionId);
|
|
111
|
+
if (!section) return null;
|
|
112
|
+
return { section, itemId };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ── Component ────────────────────────────────────────────────
|
|
116
|
+
|
|
117
|
+
interface SettingsOverlayDeps {
|
|
118
|
+
state: OverlayState;
|
|
119
|
+
container: Container;
|
|
120
|
+
settingsList: SettingsList | null;
|
|
121
|
+
tui: Parameters<Parameters<ExtensionContext["ui"]["custom"]>[0]>[0];
|
|
122
|
+
theme: Parameters<Parameters<ExtensionContext["ui"]["custom"]>[0]>[1];
|
|
123
|
+
done: () => void;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function createSettingsList(deps: SettingsOverlayDeps): SettingsList {
|
|
127
|
+
const sections = getRegisteredSettings();
|
|
128
|
+
const items = buildFlatItems(sections, deps.state.scope, deps.state.cwd);
|
|
129
|
+
const onChange = (flatId: string, newValue: string) => {
|
|
130
|
+
const found = findSectionAndId(sections, flatId);
|
|
131
|
+
if (found) {
|
|
132
|
+
found.section.persistChange(deps.state.scope, deps.state.cwd, found.itemId, newValue);
|
|
133
|
+
}
|
|
134
|
+
// Re-read all values to reflect persisted changes, but keep the list
|
|
135
|
+
// instance (and its selectedIndex) intact.
|
|
136
|
+
const updatedItems = buildFlatItems(sections, deps.state.scope, deps.state.cwd);
|
|
137
|
+
for (const updated of updatedItems) {
|
|
138
|
+
const existing = items.find((i) => i.id === updated.id);
|
|
139
|
+
if (existing && existing.currentValue !== updated.currentValue) {
|
|
140
|
+
settingsList.updateValue(updated.id, updated.currentValue);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
deps.tui.requestRender();
|
|
144
|
+
};
|
|
145
|
+
const settingsList = new SettingsList(
|
|
146
|
+
items,
|
|
147
|
+
Math.min(items.length + 4, 20),
|
|
148
|
+
getSettingsListTheme(),
|
|
149
|
+
onChange,
|
|
150
|
+
() => deps.done(),
|
|
151
|
+
{ enableSearch: true },
|
|
152
|
+
);
|
|
153
|
+
return settingsList;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function rebuildSettingsList(deps: SettingsOverlayDeps): SettingsList {
|
|
157
|
+
const settingsList = createSettingsList(deps);
|
|
158
|
+
deps.settingsList = settingsList;
|
|
159
|
+
|
|
160
|
+
deps.container.clear();
|
|
161
|
+
deps.container.addChild(createHeaderComponent(deps));
|
|
162
|
+
deps.container.addChild(settingsList);
|
|
163
|
+
|
|
164
|
+
return settingsList;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function createHeaderComponent(deps: SettingsOverlayDeps): Text {
|
|
168
|
+
const { theme, state } = deps;
|
|
169
|
+
const scopeLabel = getScopeLabel(state.scope);
|
|
170
|
+
const otherScope = state.scope === "project" ? "Global" : "Project";
|
|
171
|
+
const headerText = new Text(
|
|
172
|
+
`${theme.fg("accent", theme.bold("SuPi Settings"))} ${theme.fg("text", `Scope: ${scopeLabel}`)} ${theme.fg("dim", `(tab → ${otherScope})`)}`,
|
|
173
|
+
0,
|
|
174
|
+
0,
|
|
175
|
+
);
|
|
176
|
+
return headerText;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function handleScopeToggle(deps: SettingsOverlayDeps): void {
|
|
180
|
+
deps.state.scope = deps.state.scope === "project" ? "global" : "project";
|
|
181
|
+
rebuildSettingsList(deps);
|
|
182
|
+
deps.tui.requestRender();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ── Entry point ──────────────────────────────────────────────
|
|
186
|
+
|
|
187
|
+
export function openSettingsOverlay(ctx: ExtensionContext): void {
|
|
188
|
+
const sections = getRegisteredSettings();
|
|
189
|
+
if (sections.length === 0) {
|
|
190
|
+
ctx.ui.notify("No settings registered by SuPi extensions", "info");
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
void ctx.ui.custom<void>((tui, theme, _kb, done) => {
|
|
195
|
+
const state: OverlayState = { scope: "project", cwd: ctx.cwd };
|
|
196
|
+
const container = new Container();
|
|
197
|
+
|
|
198
|
+
const deps: SettingsOverlayDeps = {
|
|
199
|
+
state,
|
|
200
|
+
container,
|
|
201
|
+
settingsList: null,
|
|
202
|
+
tui,
|
|
203
|
+
theme,
|
|
204
|
+
done,
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
rebuildSettingsList(deps);
|
|
208
|
+
|
|
209
|
+
const component = {
|
|
210
|
+
render: (width: number) => container.render(width),
|
|
211
|
+
invalidate: () => container.invalidate(),
|
|
212
|
+
handleInput: (data: string) => {
|
|
213
|
+
if (matchesKey(data, Key.tab)) {
|
|
214
|
+
handleScopeToggle(deps);
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
// Delegate input to the settings list (always set after rebuildSettingsList)
|
|
218
|
+
deps.settingsList?.handleInput?.(data);
|
|
219
|
+
deps.tui.requestRender();
|
|
220
|
+
return true;
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
return component;
|
|
225
|
+
});
|
|
226
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared terminal title formatting and signaling utilities.
|
|
3
|
+
*
|
|
4
|
+
* Centralized place for pi title convention (π prefix), completion (✓)
|
|
5
|
+
* and waiting (●) indicators, and the audible terminal bell.
|
|
6
|
+
*/
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
|
|
9
|
+
/** Unicode checkmark shown when the agent finishes a turn. */
|
|
10
|
+
export const DONE_SYMBOL = "\u2713";
|
|
11
|
+
/** Unicode dot shown when waiting for user input. */
|
|
12
|
+
export const WAITING_SYMBOL = "\u25CF";
|
|
13
|
+
|
|
14
|
+
/** Minimal UI surface needed for title operations. */
|
|
15
|
+
export interface TitleTarget {
|
|
16
|
+
ui: {
|
|
17
|
+
setTitle?(title: string): void;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Format pi's canonical terminal title from session name and cwd.
|
|
23
|
+
* Falls back gracefully when either is missing.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* formatTitle("my-session", "/home/projects/foo") // "π - my-session - foo"
|
|
27
|
+
* formatTitle(undefined, "/home/projects/foo") // "π - foo"
|
|
28
|
+
* formatTitle("my-session") // "π - my-session"
|
|
29
|
+
* formatTitle() // "π"
|
|
30
|
+
*/
|
|
31
|
+
export function formatTitle(sessionName?: string, cwd?: string): string {
|
|
32
|
+
const base = cwd ? path.basename(cwd) : undefined;
|
|
33
|
+
if (sessionName && base) return `π - ${sessionName} - ${base}`;
|
|
34
|
+
if (sessionName) return `π - ${sessionName}`;
|
|
35
|
+
if (base) return `π - ${base}`;
|
|
36
|
+
return "π";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Sound the audible terminal bell (ASCII BEL). */
|
|
40
|
+
export function signalBell(): void {
|
|
41
|
+
process.stdout.write("\x07");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Set the terminal title to indicate the agent is waiting for user input.
|
|
46
|
+
* Prefixes with ● and sounds the terminal bell.
|
|
47
|
+
*/
|
|
48
|
+
export function signalWaiting(ctx: TitleTarget, title: string): void {
|
|
49
|
+
ctx.ui.setTitle?.(`${WAITING_SYMBOL} ${title}`);
|
|
50
|
+
signalBell();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Set the terminal title to indicate the agent turn has completed.
|
|
55
|
+
* Prefixes with ✓ and sounds the terminal bell.
|
|
56
|
+
*/
|
|
57
|
+
export function signalDone(ctx: TitleTarget, title: string): void {
|
|
58
|
+
ctx.ui.setTitle?.(`${DONE_SYMBOL} ${title}`);
|
|
59
|
+
signalBell();
|
|
60
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mrclrchtr/supi-claude-md",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SuPi claude-md extension — automatic subdirectory context injection for pi",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/mrclrchtr/supi.git"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"pi-package",
|
|
15
|
+
"pi",
|
|
16
|
+
"pi-coding-agent"
|
|
17
|
+
],
|
|
18
|
+
"files": [
|
|
19
|
+
"src/**/*.ts",
|
|
20
|
+
"skills",
|
|
21
|
+
"!__tests__"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@mrclrchtr/supi-core": "workspace:*"
|
|
25
|
+
},
|
|
26
|
+
"bundledDependencies": [
|
|
27
|
+
"@mrclrchtr/supi-core"
|
|
28
|
+
],
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
31
|
+
"@earendil-works/pi-tui": "*"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^25.6.0",
|
|
35
|
+
"vitest": "^4.1.4",
|
|
36
|
+
"@mrclrchtr/supi-test-utils": "workspace:*"
|
|
37
|
+
},
|
|
38
|
+
"pi": {
|
|
39
|
+
"extensions": [
|
|
40
|
+
"./src/claude-md.ts"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"main": "src/index.ts"
|
|
44
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-md-improver
|
|
3
|
+
description: Use this skill to audit and improve CLAUDE.md files in repositories. Use when user asks to check, audit, update, improve, or fix CLAUDE.md files. Scans for all CLAUDE.md files, evaluates quality against templates, outputs quality report, then makes targeted updates.
|
|
4
|
+
tools: Read, Glob, Grep, Bash, Edit
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CLAUDE.md Improver
|
|
8
|
+
|
|
9
|
+
Audit, evaluate, and improve CLAUDE.md files across a codebase to ensure PI has optimal project context.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Phase 1: Context Baseline Review
|
|
14
|
+
|
|
15
|
+
**No file reads in this phase.** Use only what is already loaded in this session's context.
|
|
16
|
+
|
|
17
|
+
**Purpose:** This baseline review is the primary evidence for scoring Criterion 7 (Auto-Delivered Overlap) in Phase 3. Its goal is to identify which information categories are already delivered automatically by SuPi extensions or native pi, so you do NOT recommend adding that same content to CLAUDE.md. If you skip this step, you will inflate scores and propose redundant additions that already appear in every session.
|
|
18
|
+
|
|
19
|
+
**Step 1 — Detect auto-injected sources.** Scan the conversation context for:
|
|
20
|
+
|
|
21
|
+
| Source identifier | What to look for | Typical content |
|
|
22
|
+
|-------------------|------------------|---------------|
|
|
23
|
+
| `supi-code-intelligence` | Workspace module graphs, package lists, dependency arrows, file counts | `## Modules` tables, architecture overviews, root directory trees |
|
|
24
|
+
| `supi-claude-md` | `<extension-context source="supi-claude-md">` blocks | Subdirectory CLAUDE.md/AGENTS.md content already injected below cwd |
|
|
25
|
+
| `native-pi` | Root CLAUDE.md or AGENTS.md loaded into the system prompt | Project-wide instructions from the repository root |
|
|
26
|
+
| Other extensions | `<extension-context source="...">` blocks | Any other extension-injected context |
|
|
27
|
+
|
|
28
|
+
**Step 2 — Build the baseline.** For each source found, record what it already covers:
|
|
29
|
+
|
|
30
|
+
| Source | Content Category | Already Covers | Scope |
|
|
31
|
+
|--------|------------------|----------------|-------|
|
|
32
|
+
| `supi-code-intelligence` | Module graph | Package names, descriptions, dependency relationships | **Root-level** |
|
|
33
|
+
| `supi-code-intelligence` | Workspace overview | File counts, root directory tree, top-level landmarks | **Root-level** |
|
|
34
|
+
| `supi-claude-md` | Subdirectory instructions | `packages/*/CLAUDE.md` content injected during this session | **Package-specific** |
|
|
35
|
+
| `native-pi` | Root instructions | `./CLAUDE.md`, `./AGENTS.md` in system prompt | **Root-level** |
|
|
36
|
+
|
|
37
|
+
Add rows for any additional categories visible in context.
|
|
38
|
+
|
|
39
|
+
**Step 3 — Classify redundancy risk by scope.** Use the table above to categorize:
|
|
40
|
+
|
|
41
|
+
- **Root-level high risk** (already auto-delivered; do NOT recommend for root `./CLAUDE.md`):
|
|
42
|
+
- Package/module inventories (from `supi-code-intelligence`)
|
|
43
|
+
- Root directory trees and file counts (from `supi-code-intelligence`)
|
|
44
|
+
- Dependency graphs from manifests (from `supi-code-intelligence`)
|
|
45
|
+
- High-level architecture without project-specific reasoning (from `supi-code-intelligence`)
|
|
46
|
+
|
|
47
|
+
- **Package-specific high risk** (already auto-delivered; do NOT recommend for that package's `CLAUDE.md`):
|
|
48
|
+
- Subdirectory CLAUDE.md/AGENTS.md already injected by `supi-claude-md` during this session
|
|
49
|
+
|
|
50
|
+
- **Low risk** (not auto-delivered; safe to recommend in CLAUDE.md at any scope):
|
|
51
|
+
- Commands and workflows
|
|
52
|
+
- Gotchas and non-obvious patterns
|
|
53
|
+
- Cross-package conventions not obvious from manifests
|
|
54
|
+
- Curated "start here" guidance with ownership or boundary reasoning
|
|
55
|
+
- Project-specific exceptions to generic rules
|
|
56
|
+
|
|
57
|
+
**Step 4 — Output the baseline.** Produce this structured overview before proceeding to Phase 2:
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
## Phase 1 Baseline Review
|
|
61
|
+
|
|
62
|
+
### SuPi Detected: yes / no
|
|
63
|
+
|
|
64
|
+
### Auto-Injected Content by Source
|
|
65
|
+
|
|
66
|
+
| Source | Content Category | Already Covers | Scope |
|
|
67
|
+
|--------|------------------|----------------|-------|
|
|
68
|
+
| ... | ... | ... | Root / Package-specific |
|
|
69
|
+
|
|
70
|
+
### Redundancy Risk Assessment
|
|
71
|
+
|
|
72
|
+
- **Root-level high risk** (do NOT recommend for root `./CLAUDE.md`):
|
|
73
|
+
- [List categories]
|
|
74
|
+
- **Package-specific high risk** (do NOT recommend for matching package `CLAUDE.md`):
|
|
75
|
+
- [List categories]
|
|
76
|
+
- **Low risk** (safe to recommend):
|
|
77
|
+
- [List categories]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Note:** This review is intentionally approximate — it compares against the context already visible to you, not the literal hidden system prompt. If no SuPi-delivered context is visible in the conversation, the baseline is empty and this phase is a no-op.
|
|
81
|
+
|
|
82
|
+
### Phase 2: Discovery
|
|
83
|
+
|
|
84
|
+
Now read files from disk. Find all CLAUDE.md files in the repository:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
find . -name "CLAUDE.md" -o -name ".claude.md" -o -name ".claude.local.md" 2>/dev/null | head -50
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**File Types & Locations:**
|
|
91
|
+
|
|
92
|
+
| Type | Location | Purpose |
|
|
93
|
+
|------|----------|---------|
|
|
94
|
+
| Project root | `./CLAUDE.md` | Primary project context (checked into git, shared with team) |
|
|
95
|
+
| Local overrides | `./.claude.local.md` | Personal/local settings (gitignored, not shared) |
|
|
96
|
+
| Global defaults | `~/.claude/CLAUDE.md` | User-wide defaults across all projects |
|
|
97
|
+
| Package-specific | `./packages/*/CLAUDE.md` | Module-level context in monorepos |
|
|
98
|
+
| Subdirectory | Any nested location | Feature/domain-specific context |
|
|
99
|
+
|
|
100
|
+
**Note:** PI auto-discovers CLAUDE.md files in parent directories, making monorepo setups work automatically.
|
|
101
|
+
|
|
102
|
+
### Phase 3: Quality Assessment
|
|
103
|
+
|
|
104
|
+
For each CLAUDE.md file found in Phase 2, evaluate against quality criteria, incorporating the Phase 1 baseline review results. See [references/quality-criteria.md](references/quality-criteria.md) for detailed rubrics.
|
|
105
|
+
|
|
106
|
+
**Quick Assessment Checklist:**
|
|
107
|
+
|
|
108
|
+
| Criterion | Weight | Check |
|
|
109
|
+
|-----------|--------|-------|
|
|
110
|
+
| Commands/workflows documented | High | Are build/test/deploy commands present? |
|
|
111
|
+
| Architecture clarity | High | Can PI understand the codebase structure? |
|
|
112
|
+
| Non-obvious patterns | Medium | Are gotchas and quirks documented? |
|
|
113
|
+
| Conciseness | Medium | No verbose explanations or obvious info? |
|
|
114
|
+
| Currency | High | Does it reflect current codebase state? |
|
|
115
|
+
| Actionability | High | Are instructions executable, not vague? |
|
|
116
|
+
| Auto-delivered overlap | Low | Does it duplicate what SuPi extensions already inject? **Use the Phase 1 Redundancy Risk Assessment as primary evidence.** |
|
|
117
|
+
|
|
118
|
+
**Quality Scores:**
|
|
119
|
+
- **A (90-100)**: Comprehensive, current, actionable
|
|
120
|
+
- **B (70-89)**: Good coverage, minor gaps
|
|
121
|
+
- **C (50-69)**: Basic info, missing key sections
|
|
122
|
+
- **D (30-49)**: Sparse or outdated
|
|
123
|
+
- **F (0-29)**: Missing or severely outdated
|
|
124
|
+
|
|
125
|
+
### Phase 4: Quality Report Output
|
|
126
|
+
|
|
127
|
+
**ALWAYS output the quality report BEFORE making any updates.**
|
|
128
|
+
|
|
129
|
+
Format:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
## CLAUDE.md Quality Report
|
|
133
|
+
|
|
134
|
+
### Summary
|
|
135
|
+
- Files found: X
|
|
136
|
+
- Average score: X/100
|
|
137
|
+
- Files needing update: X
|
|
138
|
+
|
|
139
|
+
### File-by-File Assessment
|
|
140
|
+
|
|
141
|
+
#### 1. ./CLAUDE.md (Project Root)
|
|
142
|
+
**Score: XX/100 (Grade: X)**
|
|
143
|
+
|
|
144
|
+
**Context Overlap Review:**
|
|
145
|
+
- **Fully redundant (root-level):** [sections already covered by baseline context — applies to root `./CLAUDE.md`]
|
|
146
|
+
- **Fully redundant (package-specific):** [sections already covered by baseline context — applies to that package's `CLAUDE.md`]
|
|
147
|
+
- **Partially redundant:** [sections with overlap plus human-only value]
|
|
148
|
+
- **Unique:** [sections that should stay]
|
|
149
|
+
|
|
150
|
+
| Criterion | Score | Notes |
|
|
151
|
+
|-----------|-------|-------|
|
|
152
|
+
| Commands/workflows | X/15 | ... |
|
|
153
|
+
| Architecture clarity | X/15 | ... |
|
|
154
|
+
| Non-obvious patterns | X/15 | ... |
|
|
155
|
+
| Conciseness | X/15 | ... |
|
|
156
|
+
| Currency | X/15 | ... |
|
|
157
|
+
| Actionability | X/15 | ... |
|
|
158
|
+
| Auto-delivered overlap | X/10 | ... |
|
|
159
|
+
|
|
160
|
+
**Issues:**
|
|
161
|
+
- [List specific problems]
|
|
162
|
+
|
|
163
|
+
**Recommended additions:**
|
|
164
|
+
- [List what should be added]
|
|
165
|
+
|
|
166
|
+
#### 2. ./packages/api/CLAUDE.md (Package-specific)
|
|
167
|
+
...
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Phase 5: Targeted Updates
|
|
171
|
+
|
|
172
|
+
After outputting the quality report, ask user for confirmation before updating.
|
|
173
|
+
|
|
174
|
+
**Update Guidelines (Critical):**
|
|
175
|
+
|
|
176
|
+
1. **Propose targeted additions only** - Focus on genuinely useful info:
|
|
177
|
+
- Commands or workflows discovered during analysis
|
|
178
|
+
- Gotchas or non-obvious patterns found in code
|
|
179
|
+
- Package relationships that weren't clear
|
|
180
|
+
- Testing approaches that work
|
|
181
|
+
- Configuration quirks
|
|
182
|
+
|
|
183
|
+
2. **Keep it minimal** - Avoid:
|
|
184
|
+
- Restating what's obvious from the code
|
|
185
|
+
- Generic best practices already covered
|
|
186
|
+
- One-off fixes unlikely to recur
|
|
187
|
+
- Verbose explanations when a one-liner suffices
|
|
188
|
+
|
|
189
|
+
3. **Show diffs** - For each change, show:
|
|
190
|
+
- Which CLAUDE.md file to update
|
|
191
|
+
- The specific addition (as a diff or quoted block)
|
|
192
|
+
- Brief explanation of why this helps future sessions
|
|
193
|
+
|
|
194
|
+
**Diff Format:**
|
|
195
|
+
|
|
196
|
+
```markdown
|
|
197
|
+
### Update: ./CLAUDE.md
|
|
198
|
+
|
|
199
|
+
**Why:** Build command was missing, causing confusion about how to run the project.
|
|
200
|
+
|
|
201
|
+
```diff
|
|
202
|
+
+ ## Quick Start
|
|
203
|
+
+
|
|
204
|
+
+ ```bash
|
|
205
|
+
+ npm install
|
|
206
|
+
+ npm run dev # Start development server on port 3000
|
|
207
|
+
+ ```
|
|
208
|
+
```
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Phase 6: Apply Updates
|
|
212
|
+
|
|
213
|
+
After user approval, apply changes using the Edit tool. Preserve existing content structure.
|
|
214
|
+
|
|
215
|
+
## Templates
|
|
216
|
+
|
|
217
|
+
See [references/templates.md](references/templates.md) for CLAUDE.md templates by project type.
|
|
218
|
+
|
|
219
|
+
## Common Issues to Flag
|
|
220
|
+
|
|
221
|
+
1. **Stale commands**: Build commands that no longer work
|
|
222
|
+
2. **Missing dependencies**: Required tools not mentioned
|
|
223
|
+
3. **Outdated architecture**: File structure that's changed
|
|
224
|
+
4. **Missing environment setup**: Required env vars or config
|
|
225
|
+
5. **Broken test commands**: Test scripts that have changed
|
|
226
|
+
6. **Undocumented gotchas**: Non-obvious patterns not captured
|
|
227
|
+
|
|
228
|
+
## User Tips to Share
|
|
229
|
+
|
|
230
|
+
When presenting recommendations, remind users:
|
|
231
|
+
|
|
232
|
+
- **Keep it concise**: CLAUDE.md should be human-readable; dense is better than verbose
|
|
233
|
+
- **Actionable commands**: All documented commands should be copy-paste ready
|
|
234
|
+
- **Use `.claude.local.md`**: For personal preferences not shared with team (add to `.gitignore`)
|
|
235
|
+
- **Global defaults**: Put user-wide preferences in `~/.claude/CLAUDE.md`
|
|
236
|
+
|
|
237
|
+
## What Makes a Great CLAUDE.md
|
|
238
|
+
|
|
239
|
+
**Key principles:**
|
|
240
|
+
- Concise and human-readable
|
|
241
|
+
- Actionable commands that can be copy-pasted
|
|
242
|
+
- Project-specific patterns, not generic advice
|
|
243
|
+
- Non-obvious gotchas and warnings
|
|
244
|
+
|
|
245
|
+
**Recommended sections** (use only what's relevant):
|
|
246
|
+
- Commands (build, test, dev, lint)
|
|
247
|
+
- Architecture (directory structure)
|
|
248
|
+
- Key Files (entry points, config)
|
|
249
|
+
- Code Style (project conventions)
|
|
250
|
+
- Environment (required vars, setup)
|
|
251
|
+
- Testing (commands, patterns)
|
|
252
|
+
- Gotchas (quirks, common mistakes)
|
|
253
|
+
- Workflow (when to do what)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# CLAUDE.md Quality Criteria
|
|
2
|
+
|
|
3
|
+
## Scoring Rubric
|
|
4
|
+
|
|
5
|
+
### 1. Commands/Workflows (15 points)
|
|
6
|
+
|
|
7
|
+
**15 points**: All essential commands documented with context
|
|
8
|
+
- Build, test, lint, deploy commands present
|
|
9
|
+
- Development workflow clear
|
|
10
|
+
- Common operations documented
|
|
11
|
+
|
|
12
|
+
**12 points**: Most commands present, some missing context
|
|
13
|
+
|
|
14
|
+
**8 points**: Basic commands only, no workflow
|
|
15
|
+
|
|
16
|
+
**4 points**: Few commands, many missing
|
|
17
|
+
|
|
18
|
+
**0 points**: No commands documented
|
|
19
|
+
|
|
20
|
+
### 2. Architecture Clarity (15 points)
|
|
21
|
+
|
|
22
|
+
**15 points**: Clear codebase map
|
|
23
|
+
- Key directories explained
|
|
24
|
+
- Module relationships documented
|
|
25
|
+
- Entry points identified
|
|
26
|
+
- Data flow described where relevant
|
|
27
|
+
|
|
28
|
+
**12 points**: Good structure overview, minor gaps
|
|
29
|
+
|
|
30
|
+
**8 points**: Basic directory listing only
|
|
31
|
+
|
|
32
|
+
**4 points**: Vague or incomplete
|
|
33
|
+
|
|
34
|
+
**0 points**: No architecture info
|
|
35
|
+
|
|
36
|
+
### 3. Non-Obvious Patterns (15 points)
|
|
37
|
+
|
|
38
|
+
**15 points**: Gotchas and quirks captured
|
|
39
|
+
- Known issues documented
|
|
40
|
+
- Workarounds explained
|
|
41
|
+
- Edge cases noted
|
|
42
|
+
- "Why we do it this way" for unusual patterns
|
|
43
|
+
|
|
44
|
+
**10 points**: Some patterns documented
|
|
45
|
+
|
|
46
|
+
**5 points**: Minimal pattern documentation
|
|
47
|
+
|
|
48
|
+
**0 points**: No patterns or gotchas
|
|
49
|
+
|
|
50
|
+
### 4. Conciseness (15 points)
|
|
51
|
+
|
|
52
|
+
**15 points**: Dense, valuable content
|
|
53
|
+
- No filler or obvious info
|
|
54
|
+
- Each line adds value
|
|
55
|
+
- No redundancy with code comments
|
|
56
|
+
|
|
57
|
+
**10 points**: Mostly concise, some padding
|
|
58
|
+
|
|
59
|
+
**5 points**: Verbose in places
|
|
60
|
+
|
|
61
|
+
**0 points**: Mostly filler or restates obvious code
|
|
62
|
+
|
|
63
|
+
### 5. Currency (15 points)
|
|
64
|
+
|
|
65
|
+
**15 points**: Reflects current codebase
|
|
66
|
+
- Commands work as documented
|
|
67
|
+
- File references accurate
|
|
68
|
+
- Tech stack current
|
|
69
|
+
|
|
70
|
+
**10 points**: Mostly current, minor staleness
|
|
71
|
+
|
|
72
|
+
**5 points**: Several outdated references
|
|
73
|
+
|
|
74
|
+
**0 points**: Severely outdated
|
|
75
|
+
|
|
76
|
+
### 6. Actionability (15 points)
|
|
77
|
+
|
|
78
|
+
**15 points**: Instructions are executable
|
|
79
|
+
- Commands can be copy-pasted
|
|
80
|
+
- Steps are concrete
|
|
81
|
+
- Paths are real
|
|
82
|
+
|
|
83
|
+
**10 points**: Mostly actionable
|
|
84
|
+
|
|
85
|
+
**5 points**: Some vague instructions
|
|
86
|
+
|
|
87
|
+
**0 points**: Vague or theoretical
|
|
88
|
+
|
|
89
|
+
### 7. Auto-Delivered Overlap (10 points)
|
|
90
|
+
|
|
91
|
+
Score this criterion after a **context baseline review**: compare the CLAUDE.md against what a SuPi-enabled PI session likely already has from `code_intel brief` and other known injected context.
|
|
92
|
+
|
|
93
|
+
**10 points**: Almost no overlap. Any overlap is tiny and clearly justified by human-only reasoning.
|
|
94
|
+
|
|
95
|
+
**7 points**: Some overlap, but the file still adds meaningful unique guidance (for example, a partially redundant structure section that keeps ownership rules or a concise "start here" note).
|
|
96
|
+
|
|
97
|
+
**4 points**: Significant overlap — package tables, root project-structure trees, architecture overviews, or dependency graphs duplicate the baseline context and should be compressed.
|
|
98
|
+
|
|
99
|
+
**0 points**: Large sections are almost entirely duplicated generated context (module lists with descriptions, dense dependency tables, long root directory trees).
|
|
100
|
+
|
|
101
|
+
**What is NOT overlap:** Gotchas specific to a package's behavior; cross-package patterns that aren't discoverable from manifests; commands and workflows; human-curated "Start Here" guidance with reasoning; concise structure notes that explain boundaries, ownership, initialization order, or important exceptions; and sections classified as **unique** during the baseline review.
|
|
102
|
+
|
|
103
|
+
**What IS overlap:** Monorepo package tables where every row is `{name, description, path}`; root-level "Modules" or "Packages" sections with >5 entries; the **fully redundant** portion of a section during baseline review; root `## Project structure` / `## Architecture` trees that mostly restate folders, packages, or module layout already visible from `code_intel brief`; high-level architecture overviews that don't add relationships, gotchas, conventions, or exceptions beyond what's in `package.json`; and dependency graphs that could be generated from `pnpm-workspace.yaml`.
|
|
104
|
+
|
|
105
|
+
## Assessment Process
|
|
106
|
+
|
|
107
|
+
1. Read the CLAUDE.md file completely.
|
|
108
|
+
2. If SuPi is active, perform a **context baseline review** first: compare against `code_intel brief` and other known injected context, then classify sections as **fully redundant**, **partially redundant**, or **unique**.
|
|
109
|
+
3. Cross-reference with the actual codebase: run documented commands (mentally or actually), check that referenced files exist, and verify architecture descriptions.
|
|
110
|
+
4. Score each criterion, calculate the total, assign the grade, list the specific issues, and propose concrete improvements.
|
|
111
|
+
|
|
112
|
+
## Red Flags
|
|
113
|
+
|
|
114
|
+
Watch for commands that would fail (wrong paths, missing deps), references to deleted files or folders, outdated tech versions, template copy without customization, generic advice, stale `TODO` items, duplicate info across multiple CLAUDE.md files, sections that duplicate `code_intel brief` output, and structure sections where the redundant tree/inventory portion should be separated from the unique guidance portion.
|