claude-code-autoconfig 1.0.172 → 1.0.174

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.
@@ -0,0 +1,260 @@
1
+ <!-- @description Scan Claude artifacts and extract structured rules into .claude/rules/ -->
2
+ <!-- @version 3 -->
3
+ <!-- @param select | string | optional | Write only specific rules by number: "1,3,5". Default: all. -->
4
+ <!-- @param keep-sources | boolean | optional | Write rules but skip source cleanup (Step 8) -->
5
+ <!-- @response success | Rules extracted, written, and sources cleaned up. -->
6
+ <!-- @response no-rules | No extractable rules found in scanned sources. -->
7
+ <!-- @sideeffect Creates .claude/rules/ files and removes extracted content from source files -->
8
+ <!-- @example /extract-rules | Scan, propose, prompt for approval, write, and clean up -->
9
+ <!-- @example /extract-rules --keep-sources | Write rules without modifying source files -->
10
+ <!-- @example /extract-rules --select 1,3 | Write only rules #1 and #3 -->
11
+
12
+ # Extract Rules
13
+
14
+ Scan all Claude configuration artifacts and propose structured rules for `.claude/rules/`.
15
+
16
+ ## Step 0: Git safety check
17
+
18
+ Before doing anything else, check for uncommitted changes:
19
+
20
+ ```bash
21
+ git status --porcelain
22
+ ```
23
+
24
+ If there are uncommitted changes, show this warning and wait for confirmation:
25
+
26
+ > **Warning:** This command will modify files (extract rules from sources and optionally clean up originals). You have uncommitted changes.
27
+ >
28
+ > Commit your work before proceeding, or type "continue" to proceed anyway.
29
+
30
+ If the working tree is clean, proceed silently.
31
+
32
+ ## Step 1: Discover sources
33
+
34
+ Scan these locations for `.md` files containing potential rules. **Skip any that don't exist** — not all projects have all of these:
35
+
36
+ 1. `CLAUDE.md` (project root)
37
+ 2. `CLAUDE.local.md` (project root, if present)
38
+ 3. All `.md` files in `.claude/` recursively (feedback, commands, etc.) — **excluding** `.claude/rules/` and `.claude/commands/extract-rules.md`
39
+ 4. Any nested `CLAUDE.md` files in subdirectories (e.g., `src/CLAUDE.md`)
40
+ 5. Auto memory files — memory often contains misplaced imperatives that should be promoted to rules. To find the memory directory, list `~/.claude/projects/` and fuzzy-match against the current project path. The directory name encodes the path with dashes replacing separators, but encoding varies by platform and may not be consistent for paths with spaces, special characters, or deep nesting. **Discovery strategy**: list all directories under `~/.claude/projects/`, then find the one whose name best matches the current working directory (check if the directory name contains key path segments like the project folder name). Read `MEMORY.md` in that directory, then each `.md` file it links to. If no match is found or the memory directory can't be read, skip this source silently.
41
+
42
+ Also read all existing `.claude/rules/` files to avoid proposing duplicates.
43
+
44
+ ## Step 2: Extract candidate rules
45
+
46
+ A rule is a **deterministic behavioral instruction** that Claude should follow when working on specific files or file patterns. Good rules are:
47
+
48
+ - **Actionable**: "Do X" or "Never do Y" — not background context
49
+ - **Scoped**: Applies to specific files, directories, or file patterns
50
+ - **Not already enforced**: Skip anything already handled by hooks, settings, or linting
51
+ - **Not ephemeral**: Skip project status, session notes, debugging histories
52
+
53
+ **Skip these** (they belong in other artifacts):
54
+ - Domain knowledge / business logic explanations → stay in their source doc
55
+ - Slash command definitions → stay in `commands/`
56
+ - Session-specific debugging notes → stay in memory
57
+ - Deployment / operational procedures → stay in their source doc
58
+ - **Unscoped behavioral imperatives** (e.g., "always use conventional commits", "ask before deleting files") → stay in CLAUDE.md. The value of `.claude/rules/` is path-scoped loading — a rule without a meaningful file scope loads identically to CLAUDE.md, so extracting it is just moving it sideways. Only extract if you can identify a real file pattern.
59
+
60
+ ## Step 3: Deduplicate
61
+
62
+ - If a candidate rule already exists in `.claude/rules/` (same intent, even if worded differently), skip it
63
+ - If the same guidance appears in multiple sources, note all sources but propose one rule
64
+ - Group related rules into single files when they share the same `paths` scope. If two imperatives apply to the same files, they belong in one rule file. If they target different files, keep them separate — even if topically related.
65
+ - **Rules spanning multiple scopes**: If a rule applies to multiple file patterns (e.g., "never use `any` in tests or production code"), use multiple entries in the `paths` array — this is valid and preferred over splitting into separate rule files:
66
+ ```yaml
67
+ paths:
68
+ - "**/*.test.*"
69
+ - "src/**/*"
70
+ ```
71
+
72
+ ## Step 4: Detect conflicts
73
+
74
+ Check for contradictory guidance across sources. Two rules conflict when they give opposite instructions for the same scope (e.g., "always mock the DB in tests" vs "never mock the DB in tests").
75
+
76
+ For each conflict found:
77
+ - Flag it with `⚠️ CONFLICT` in the output
78
+ - Show both sources and the contradictory statements
79
+ - Do **not** propose either rule — ask the user which one wins
80
+
81
+ Conflicts block extraction for the affected rules only. Non-conflicting rules proceed normally.
82
+
83
+ ## Step 5: Rate confidence
84
+
85
+ For each proposed rule, assign a confidence level:
86
+
87
+ - **HIGH** — Explicit imperative instruction ("never do X", "always do Y", "must use Z", "prefer X over Y"). The source text literally contains an imperative. Extract these.
88
+ - **SKIP** — Everything else: inferred conventions, contextual guidance, implementation details derivable from the code. Do not propose these.
89
+
90
+ ## Step 6: Output proposals
91
+
92
+ For each HIGH-confidence rule, output:
93
+
94
+ ```
95
+ ### Rule: <short name>
96
+ **Source**: <file(s) it was extracted from>
97
+ **Paths**: <e.g., `src/background.ts`, `src/**/*.ts`, `*.ts`>
98
+ **File name**: <proposed .claude/rules/ filename, e.g., `linkedin-selectors.md`>
99
+
100
+ --- file content ---
101
+ ---
102
+ paths:
103
+ - "src/background.ts"
104
+ - "src/**/*.ts"
105
+ ---
106
+
107
+ <rule content here>
108
+ --- end file content ---
109
+ ```
110
+
111
+ The file content block must include proper YAML frontmatter with `paths` as an array. This is the exact format Claude Code expects.
112
+
113
+ **Validate paths**: Before proposing a rule, use Glob to verify that at least one `paths` pattern matches existing files in the project. If no files match, flag it with `⚠️ no matching files` and exclude it from the proposal. Dead rules erode trust.
114
+
115
+ **Output format**: Always show the summary table first, followed by a stats line. If there are 5 or fewer proposals, show the full file-content blocks after the table. If there are more than 5, ask the user if they want to see the full content for all rules or specific ones (e.g., "show 1,3" or "show all").
116
+
117
+ Summary table format:
118
+
119
+ | # | Rule file | Paths | Source(s) | Status |
120
+ |---|-----------|-------|-----------|--------|
121
+
122
+ Status column: `NEW` if no prior rule exists, `UPDATE` if it would merge with/extend an existing rule, `SKIP` if already covered.
123
+
124
+ After the table, show a stats line:
125
+
126
+ > Scanned **N** sources · Extracted **X** rules · Skipped **Y** candidates
127
+
128
+ ### Examples
129
+
130
+ **Example 1: Clear imperative → single rule**
131
+
132
+ Source (`.claude/feedback/FEEDBACK.md`):
133
+ ```markdown
134
+ ## Dev Build vs Prod Build — CRITICAL
135
+ **ALWAYS use `npm run build`** (dev build) for local development and testing.
136
+ **NEVER use `build:prod`** unless the user explicitly asks to package for distribution.
137
+ Dev build includes a stable ID in the config. Prod build = random ID = broken auth.
138
+ ```
139
+
140
+ Extracted rule (`.claude/rules/build-rules.md`):
141
+ ```markdown
142
+ ---
143
+ paths:
144
+ - "build.config.ts"
145
+ - "package.json"
146
+ ---
147
+
148
+ ALWAYS use `npm run build` (dev build) for local development and testing. NEVER use `build:prod` unless the user explicitly asks to package for distribution.
149
+
150
+ Dev build includes a stable ID in the config. Prod build = random ID = broken auth.
151
+ ```
152
+
153
+ Note: the imperative ("ALWAYS", "NEVER") transfers directly. The explanation is condensed but kept — it justifies the rule. Paths target the files a developer would touch when building.
154
+
155
+ **Example 2: Mixed content → split into two rules**
156
+
157
+ Source (`.claude/feedback/FEEDBACK.md`):
158
+ ```markdown
159
+ ## Related Projects
160
+ The business logic lives in the adjacent `../backend-api` project. This project is mostly UI — it sends raw data to the API which does the actual processing.
161
+ Treat these as a single unit. When the user mentions a feature, check backend-api automatically. Don't ask — just go find it.
162
+
163
+ ## Fix Scoping
164
+ Scope fixes narrowly. Each data source has unique structure.
165
+ 1. Check the `match()` function before modifying handlers
166
+ 2. Don't apply fixes broadly across sources without asking
167
+ 3. Test on the specific input that had the problem
168
+ ```
169
+
170
+ Extracted as TWO rules because they have different path scopes:
171
+
172
+ `.claude/rules/related-projects.md`:
173
+ ```markdown
174
+ ---
175
+ paths:
176
+ - "src/scrapers/*.ts"
177
+ - "src/services/*.ts"
178
+ ---
179
+
180
+ The business logic lives in `../backend-api`. When the user mentions a feature, check backend-api automatically. Don't ask — just go find it.
181
+ ```
182
+
183
+ `.claude/rules/fix-scoping.md`:
184
+ ```markdown
185
+ ---
186
+ paths:
187
+ - "src/scrapers/*.ts"
188
+ - "src/adapters/*.ts"
189
+ ---
190
+
191
+ Scope fixes narrowly. Each data source has unique structure.
192
+ 1. Check the `match()` function before modifying handlers
193
+ 2. Don't apply fixes broadly across sources without asking
194
+ 3. Test on the specific input that had the problem
195
+ ```
196
+
197
+ Note: same source section, but the "related projects" rule applies broadly to services while "fix scoping" targets handler files specifically. Different paths → separate rules.
198
+
199
+ ## Step 7: Write rules
200
+
201
+ Write all proposed rules directly. No prompt needed — the user committed their work in Step 0 and can revert if needed.
202
+
203
+ - **If `--select N,N,...` is passed**: Write only the specified rules by number from the summary table. Skip all others.
204
+ - **If `--keep-sources` is passed**: Skip Step 8 (source cleanup) entirely. Rules are written but original source files are left untouched. Useful for validating extracted rules before committing to the full migration.
205
+
206
+ ## Step 8: Source cleanup
207
+
208
+ **Skip this step if `--keep-sources` was passed.**
209
+
210
+ After writing rules, remove the extracted content from the original source files:
211
+
212
+ 1. For each written rule, locate the original text in the source file(s)
213
+ 2. Remove the extracted lines from the source — do not leave comments or placeholders
214
+ 3. If removing content leaves an empty section (e.g., a `## Discoveries` section with no remaining entries), remove the section heading too
215
+ 4. Preserve all non-extracted content in the source file
216
+ 5. **Memory files**: Do NOT edit memory files (`~/.claude/projects/.../memory/`). These are outside the project directory and managed by Claude's auto-memory system. Extracted imperatives from memory will naturally be pruned by autodream once the rule takes over.
217
+
218
+ Show what was cleaned:
219
+
220
+ ```
221
+ Cleaned sources:
222
+ CLAUDE.md — removed 3 lines (2 rules extracted)
223
+ .claude/feedback/FEEDBACK.md — removed 1 line (1 rule extracted)
224
+ ```
225
+
226
+ ## Step 9: Changelog summary
227
+
228
+ After applying rules (and optional cleanup), show a final changelog summarizing all changes. This is the last output the user sees, so it must be self-contained and scannable.
229
+
230
+ Format each rule as a block with a blank line between blocks:
231
+
232
+ ```
233
+ NEW .claude/rules/build-rules.md
234
+ [manifest.config.ts, package.json]
235
+ 1. "ALWAYS use dev build, NEVER use prod for local testing"
236
+ 2. "Bump BASE_VERSION before CWS builds"
237
+ from FEEDBACK.md
238
+
239
+ NEW .claude/rules/content-logging.md
240
+ [src/content.tsx, src/components/**/*.tsx]
241
+ "Never import fileLogger in content scripts"
242
+ from MEMORY.md → feedback_check_logs_yourself.md
243
+
244
+ UPD .claude/rules/debugging.md
245
+ [src/**/*.ts, src/**/*.tsx]
246
+ added "check logs yourself, never ask user"
247
+ from MEMORY.md → feedback_check_logs_yourself.md
248
+
249
+ --- 4 rules unchanged
250
+ ```
251
+
252
+ Each block has four lines:
253
+ 1. Status prefix + full rule file path (`.claude/rules/filename.md`)
254
+ 2. `[paths]` — the file patterns that trigger this rule, in square brackets
255
+ 3. Rule description(s) — numbered list if multiple imperatives, no number if single
256
+ 4. `from` — source file. For memory files discovered via MEMORY.md index, use arrow notation: `from MEMORY.md → specific_file.md`
257
+
258
+ Other rules:
259
+ - Status prefixes: `NEW` (created), `UPD` (merged new content into existing rule), `---` (unchanged count)
260
+ - On re-runs with no changes, show: `No new rules found. N existing rules unchanged.`
@@ -883,6 +883,11 @@
883
883
  <span class="tree-file-icon">📄</span>
884
884
  <span class="file">enable-retro.md</span>
885
885
  </div>
886
+ <div class="tree-item indent-3 hidden" data-info="extract-rules" data-parent="commands">
887
+ <span class="tree-spacer"></span>
888
+ <span class="tree-file-icon">📄</span>
889
+ <span class="file">extract-rules.md</span>
890
+ </div>
886
891
  <div class="tree-item indent-3 hidden" data-info="gls" data-parent="commands">
887
892
  <span class="tree-spacer"></span>
888
893
  <span class="tree-file-icon">📄</span>
@@ -1263,7 +1268,7 @@
1263
1268
  title: '.claude/ Directory',
1264
1269
  desc: 'Commands, rules, settings, and these docs. Keeps configuration organized as your project grows.'
1265
1270
  },
1266
- 'rules': {
1271
+ 'rules': {
1267
1272
  title: 'rules/',
1268
1273
  desc: 'Path-scoped context that loads when Claude works on matching files.'
1269
1274
  },
@@ -1303,6 +1308,11 @@
1303
1308
  desc: '(Experimental) Enable Claude to log tech debt it encounters into .claude/retro.<div style="margin-top: 12px;"><strong>Parameters</strong><div style="margin-top: 4px; opacity: 0.6;">None</div></div><div style="margin-top: 12px;"><strong>Responses</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Status</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>success</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Retro enabled — Claude will log tech debt to .claude/retro/ when encountered.</td></tr></table></div><div style="margin-top: 12px;"><strong>Side Effects</strong><div style="margin-top: 4px; font-size: 0.9em;">Creates .claude/retro/README.md, adds agent, updates CLAUDE.md</div></div><div style="margin-top: 12px;"><strong>Examples</strong><div style="margin-top: 6px; background: var(--bg-elevated); border-radius: 6px; padding: 8px 12px; font-family: monospace; font-size: 0.85em;"><div><code>/enable-retro</code> <span style="opacity: 0.6;">— Activate tech debt tracking</span></div></div></div>',
1304
1309
  trigger: '/enable-retro'
1305
1310
  },
1311
+ 'extract-rules': {
1312
+ title: 'extract-rules.md',
1313
+ desc: 'Scan Claude artifacts and extract structured rules into .claude/rules/<div style="margin-top: 12px;"><strong>Parameters</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Name</th><th style="padding: 4px 8px 4px 0;">Type</th><th style="padding: 4px 8px 4px 0;">Required</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>select</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;"><code>string</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">optional</td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Write only specific rules by number: "1,3,5". Default: all.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>keep-sources</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;"><code>boolean</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">optional</td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Write rules but skip source cleanup (Step 8)</td></tr></table></div><div style="margin-top: 12px;"><strong>Responses</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Status</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>success</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Rules extracted, written, and sources cleaned up.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>no-rules</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">No extractable rules found in scanned sources.</td></tr></table></div><div style="margin-top: 12px;"><strong>Side Effects</strong><div style="margin-top: 4px; font-size: 0.9em;">Creates .claude/rules/ files and removes extracted content from source files</div></div><div style="margin-top: 12px;"><strong>Examples</strong><div style="margin-top: 6px; background: var(--bg-elevated); border-radius: 6px; padding: 8px 12px; font-family: monospace; font-size: 0.85em;"><div><code>/extract-rules</code> <span style="opacity: 0.6;">— Scan, propose, prompt for approval, write, and clean up</span></div><div><code>/extract-rules --keep-sources</code> <span style="opacity: 0.6;">— Write rules without modifying source files</span></div><div><code>/extract-rules --select 1,3</code> <span style="opacity: 0.6;">— Write only rules #1 and #3</span></div></div></div>',
1314
+ trigger: '/extract-rules'
1315
+ },
1306
1316
  'gls': {
1307
1317
  title: 'gls.md',
1308
1318
  desc: 'Get the latest screenshot(s) and display them.<div style="margin-top: 12px;"><strong>Parameters</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Name</th><th style="padding: 4px 8px 4px 0;">Type</th><th style="padding: 4px 8px 4px 0;">Required</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>count</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;"><code>integer</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">optional</td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Number of screenshots to display. Use /gls-N syntax. Default: 1. Min: 1.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>path</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;"><code>string</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">optional</td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Screenshot directory path. Saved for future use. Auto-detected if omitted.</td></tr></table></div><div style="margin-top: 12px;"><strong>Responses</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Status</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>success</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Displays requested screenshot(s) from newest to oldest.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>no-screenshots</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Directory exists but contains no image files.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>no-directory</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Unable to detect screenshot directory — prompts for path.</td></tr></table></div><div style="margin-top: 12px;"><strong>Side Effects</strong><div style="margin-top: 4px; font-size: 0.9em;">Saves detected screenshot path to .claude/cca.config.json on first run</div></div><div style="margin-top: 12px;"><strong>Examples</strong><div style="margin-top: 6px; background: var(--bg-elevated); border-radius: 6px; padding: 8px 12px; font-family: monospace; font-size: 0.85em;"><div><code>/gls</code> <span style="opacity: 0.6;">— Display the most recent screenshot</span></div><div><code>/gls-3</code> <span style="opacity: 0.6;">— Display the 3 most recent screenshots</span></div><div><code>/gls /path/to/dir</code> <span style="opacity: 0.6;">— Use a specific screenshot directory</span></div></div></div>',
@@ -1569,7 +1579,7 @@ CRITICAL: A plausible-looking cause from code reading is NOT confirmed evidence.
1569
1579
 
1570
1580
  > Run \`/autoconfig\` to populate this based on your project.`
1571
1581
  },
1572
- 'autoconfig-update': {
1582
+ 'autoconfig-update': {
1573
1583
  filename: 'autoconfig-update.md',
1574
1584
  content: `<!-- @applied
1575
1585
  -->
@@ -1689,6 +1699,38 @@ Each item is a structured story file with:
1689
1699
 
1690
1700
  - "Fix retro #001" — Work on a specific item
1691
1701
  - "What's in the retro backlog?" — List pending items`
1702
+ },
1703
+ 'extract-rules': {
1704
+ filename: 'extract-rules.md',
1705
+ content: `# Extract Rules
1706
+
1707
+ Scan all Claude configuration artifacts and propose structured rules for \`.claude/rules/\`.
1708
+
1709
+ ## Step 0: Git safety check
1710
+
1711
+ Before doing anything else, check for uncommitted changes:
1712
+
1713
+ \`\`\`bash
1714
+ git status --porcelain
1715
+ \`\`\`
1716
+
1717
+ If there are uncommitted changes, show this warning and wait for confirmation:
1718
+
1719
+ > **Warning:** This command will modify files (extract rules from sources and optionally clean up originals). You have uncommitted changes.
1720
+ >
1721
+ > Commit your work before proceeding, or type "continue" to proceed anyway.
1722
+
1723
+ If the working tree is clean, proceed silently.
1724
+
1725
+ ## Step 1: Discover sources
1726
+
1727
+ Scan these locations for \`.md\` files containing potential rules. **Skip any that don't exist** — not all projects have all of these:
1728
+
1729
+ 1. \`CLAUDE.md\` (project root)
1730
+ 2. \`CLAUDE.local.md\` (project root, if present)
1731
+ 3. All \`.md\` files in \`.claude/\` recursively (feedback, commands, etc.) — **excluding** \`.claude/rules/\` and \`.claude/commands/extract-rules.md\`
1732
+ 4. Any nested \`CLAUDE.md\` files in subdirectories (e.g., \`src/CLAUDE.md\`)
1733
+ 5. Auto memory files — memory often contains misplaced imperatives that should be promoted to rules. To find the memory directory, list \`~/.claude/projects/\` and fuzzy-match against the current project path. The directory name encodes the path with dashes replacing separators, but encoding varies by platform and may not be consistent for paths with spaces, special characters, or deep nesting. **Discovery strategy**: list all directories under \`~/.claude/projects/\`, then find the one whose name best matches the current working directory (check if the directory name contains key path segments like the project folder name). Read \`MEMORY.md\` in that directory, then each \`.md\` file it links to. If no match is found or the memory directory can't be read, skip this source silently.`
1692
1734
  },
1693
1735
  'gls': {
1694
1736
  filename: 'gls.md',
@@ -0,0 +1,26 @@
1
+ ---
2
+ paths:
3
+ - "package.json"
4
+ - "README.md"
5
+ - "bin/cli.js"
6
+ - ".claude/commands/*.md"
7
+ - ".claude/docs/*.html"
8
+ - ".claude/scripts/sync-docs.js"
9
+ ---
10
+
11
+ Before any publish to npm — whether via `/publish`, `npm publish`, `npm version`, or any other method — you MUST complete both steps below. Never skip either.
12
+
13
+ ## 1. Sync README.md
14
+
15
+ Compare README.md against the current project state. Check:
16
+
17
+ 1. File tree matches actual `.claude/` directory contents
18
+ 2. Slash commands table matches actual `.claude/commands/` files (names, descriptions, versions)
19
+ 3. Feature sections reflect current capabilities
20
+ 4. No references to nonexistent commands, files, or removed features
21
+
22
+ Update and commit if anything is out of date.
23
+
24
+ ## 2. Regenerate interactive HTML docs
25
+
26
+ Run `node .claude/scripts/sync-docs.js` to rebuild `.claude/docs/autoconfig.docs.html` from the current `.claude/` directory. Commit the regenerated file if it changed.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.0.174
4
+ - feat: add pre-publish rules for README and docs sync
5
+
6
+ ## v1.0.173
7
+ - feat: ship /extract-rules to users
8
+
3
9
  ## v1.0.172
4
10
  - feat: /extract-rules v3 — auto-apply, --keep-sources, changelog with paths
5
11
 
@@ -141,9 +147,3 @@
141
147
  ## v1.0.125
142
148
  - feat: auto-migrate FEEDBACK.md to Discoveries during CLI upgrade
143
149
 
144
- ## v1.0.124
145
- - fix: remove Step 0 from /autoconfig, clarify terminal requirement
146
-
147
- ## v1.0.123
148
- - fix: use npm exec instead of npx in Step 0
149
-
package/README.md CHANGED
@@ -49,6 +49,7 @@ your-project/
49
49
  │ ├── autoconfig-update.md # /autoconfig-update - install updates
50
50
  │ ├── commit-and-push.md # /commit-and-push - git workflow
51
51
  │ ├── enable-retro.md # /enable-retro - opt-in tech debt tracking
52
+ │ ├── extract-rules.md # /extract-rules - scan & extract rules
52
53
  │ ├── gls.md # /gls - view latest screenshot
53
54
  │ ├── recover-context.md # /recover-context - restore context after compaction
54
55
  │ ├── show-docs.md # /show-docs - interactive walkthrough
@@ -64,7 +65,11 @@ your-project/
64
65
  ├── docs/ # Interactive documentation
65
66
  │ └── autoconfig.docs.html # Open with /show-docs
66
67
  ├── updates/ # Pending config updates
67
- ├── rules/ # Path-scoped context (empty)
68
+ ├── rules/ # Path-scoped context rules
69
+ │ ├── deploy-approval.md # Require approval before publish
70
+ │ └── readme-sync.md # Sync README & docs before publish
71
+ ├── scripts/ # Utility scripts
72
+ │ └── sync-docs.js # Regenerate interactive HTML docs
68
73
  ├── .mcp.json # MCP server configs (empty placeholder)
69
74
  └── settings.json # Permissions & security
70
75
  ```
@@ -104,6 +109,7 @@ Autoconfig is **self-configuring**. Run `/autoconfig` and Claude:
104
109
  | `/recover-context` | Recovers conversation context after compaction |
105
110
  | `/gls` | Views latest screenshot for visual context |
106
111
  | `/validate-cca-install` | Validates installation against latest published version |
112
+ | `/extract-rules` | Scan Claude artifacts and extract structured rules |
107
113
  | `/enable-retro` | (Experimental) Enable tech debt tracking |
108
114
 
109
115
  ### Updates
@@ -153,7 +159,7 @@ Work through items anytime: *"Hey Claude, fix retro #001"*
153
159
 
154
160
  ### Rules
155
161
 
156
- The `rules/` directory is intentionally empty. Effective rules require understanding your codebase patterns, team conventions, and quality standards.
162
+ The `rules/` directory contains path-scoped context rules that activate when Claude edits matching files. Autoconfig ships with publish-safety rules; you can add your own or use `/extract-rules` to generate rules from existing Claude artifacts.
157
163
 
158
164
  **Want optimized rules for your project?**
159
165
  Reach out: [info@adac1001.com](mailto:info@adac1001.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-autoconfig",
3
- "version": "1.0.172",
3
+ "version": "1.0.174",
4
4
  "description": "Intelligent, self-configuring setup for Claude Code. One command analyzes your project, configures Claude, and shows you what it did.",
5
5
  "author": "ADAC 1001 <info@adac1001.com>",
6
6
  "license": "MIT",
@@ -38,7 +38,6 @@
38
38
  "!.claude/cca.config.json",
39
39
  "!.claude/.autoconfig-version",
40
40
  "!.claude/commands/publish.md",
41
- "!.claude/commands/extract-rules.md",
42
41
  "!.claude/plans",
43
42
  "CLAUDE.md",
44
43
  "CHANGELOG.md"