claudeos-core 2.1.1 → 2.3.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +1649 -481
  2. package/CONTRIBUTING.md +92 -92
  3. package/README.de.md +64 -5
  4. package/README.es.md +64 -5
  5. package/README.fr.md +64 -5
  6. package/README.hi.md +64 -5
  7. package/README.ja.md +64 -5
  8. package/README.ko.md +1018 -959
  9. package/README.md +1020 -960
  10. package/README.ru.md +66 -5
  11. package/README.vi.md +1019 -960
  12. package/README.zh-CN.md +64 -5
  13. package/bin/cli.js +152 -148
  14. package/bin/commands/init.js +1673 -1518
  15. package/bin/commands/lint.js +62 -0
  16. package/bin/commands/memory.js +438 -438
  17. package/bin/lib/cli-utils.js +206 -206
  18. package/claude-md-validator/index.js +184 -0
  19. package/claude-md-validator/reporter.js +66 -0
  20. package/claude-md-validator/structural-checks.js +528 -0
  21. package/content-validator/index.js +666 -436
  22. package/lib/env-parser.js +317 -0
  23. package/lib/expected-guides.js +23 -23
  24. package/lib/expected-outputs.js +90 -90
  25. package/lib/language-config.js +35 -35
  26. package/lib/memory-scaffold.js +1058 -1052
  27. package/lib/plan-parser.js +165 -165
  28. package/lib/staged-rules.js +118 -118
  29. package/manifest-generator/index.js +174 -174
  30. package/package.json +90 -87
  31. package/pass-json-validator/index.js +337 -337
  32. package/pass-prompts/templates/angular/pass3.md +28 -13
  33. package/pass-prompts/templates/common/claude-md-scaffold.md +686 -0
  34. package/pass-prompts/templates/common/pass3-footer.md +402 -39
  35. package/pass-prompts/templates/common/pass3b-core-header.md +43 -0
  36. package/pass-prompts/templates/common/pass4.md +375 -302
  37. package/pass-prompts/templates/common/staging-override.md +26 -26
  38. package/pass-prompts/templates/java-spring/pass3.md +31 -21
  39. package/pass-prompts/templates/kotlin-spring/pass3.md +34 -22
  40. package/pass-prompts/templates/node-express/pass3.md +30 -21
  41. package/pass-prompts/templates/node-fastify/pass3.md +28 -14
  42. package/pass-prompts/templates/node-nestjs/pass3.md +29 -14
  43. package/pass-prompts/templates/node-nextjs/pass3.md +34 -21
  44. package/pass-prompts/templates/node-vite/pass1.md +117 -117
  45. package/pass-prompts/templates/node-vite/pass2.md +78 -78
  46. package/pass-prompts/templates/node-vite/pass3.md +30 -13
  47. package/pass-prompts/templates/python-django/pass3.md +32 -21
  48. package/pass-prompts/templates/python-fastapi/pass3.md +33 -21
  49. package/pass-prompts/templates/python-flask/pass1.md +119 -119
  50. package/pass-prompts/templates/python-flask/pass2.md +85 -85
  51. package/pass-prompts/templates/python-flask/pass3.md +31 -13
  52. package/pass-prompts/templates/vue-nuxt/pass3.md +32 -13
  53. package/plan-installer/domain-grouper.js +76 -76
  54. package/plan-installer/index.js +137 -129
  55. package/plan-installer/prompt-generator.js +188 -128
  56. package/plan-installer/scanners/scan-frontend.js +505 -473
  57. package/plan-installer/scanners/scan-java.js +226 -226
  58. package/plan-installer/scanners/scan-node.js +57 -57
  59. package/plan-installer/scanners/scan-python.js +85 -85
  60. package/plan-installer/stack-detector.js +482 -466
  61. package/plan-installer/structure-scanner.js +65 -65
  62. package/sync-checker/index.js +177 -177
@@ -1,39 +1,402 @@
1
-
2
- CRITICAL — No Hallucination Guard:
3
- You may ONLY reference technologies that are explicitly present in the two files you read:
4
- project-analysis.json (stack detection results) and pass2-merged.json (code analysis results).
5
- If a library, framework, tool, or pattern does NOT appear in either of these files,
6
- you MUST NOT mention it, generate code examples for it, or assume it exists — not in
7
- standards, rules, skills, guides, database docs, or CLAUDE.md.
8
- Do NOT infer or guess technologies from other detected technologies.
9
- Examples of violations:
10
- - Writing "React Query caching" when pass2-merged.json has no TanStack Query / React Query entry
11
- - Adding "Zustand store pattern" when pass2-merged.json has no Zustand usage
12
- - Generating "Prisma schema" examples when project-analysis.json ORM is not Prisma
13
- - Assuming React Query exists because Orval was detected (inference is NOT detection)
14
- When in doubt, omit. Missing content is fixable; hallucinated content erodes trust.
15
-
16
- CRITICAL — No Domain-Specific Hardcoding:
17
- All generated documentation in claudeos-core/standard/, .claude/rules/, and claudeos-core/skills/
18
- MUST use generic, reusable patterns — NEVER hardcode project-specific domain names, table names,
19
- URL paths, or class names as examples.
20
- Use placeholder patterns instead:
21
- - Table names: `{prefix}_{table_name}` not a specific table like `user_account`
22
- - URL paths: `{domain}/{resource}` not a specific path like `/notice/getList`
23
- - DTO names: `{Action}{Entity}ReqDto` not a specific class like `GetNoticeListReqDto`
24
- - Domain keys: `{DOMAIN_KEY}` not a specific code like `NOTICE`
25
- Allowed exceptions:
26
- - Project-wide common fields that appear across ALL domains (e.g., audit columns, base classes)
27
- - Framework/infrastructure names (e.g., `BaseEntity`, `SecurityConfig`)
28
- - Listing existing domain names only when explaining how to ADD NEW ones (configuration examples)
29
- Reason: These documents are project-wide COMMON rules. If specific domain names appear,
30
- developers working on other domains may ignore the rules as irrelevant to them.
31
-
32
- CRITICAL — Skill Orchestrator Completeness:
33
- The orchestrator file (e.g., 01.scaffold-page-feature.md, 01.scaffold-crud-feature.md)
34
- MUST list ALL sub-skill files in its execution order table with no gaps.
35
- Every sub-skill file generated in the scaffold directory MUST have a corresponding row.
36
- Do NOT skip any number in the sequence.
37
-
38
- After completion, run the following commands in order:
39
- 1. npx claudeos-core health
1
+
2
+ CRITICAL — No Hallucination Guard:
3
+ You may ONLY reference technologies that are explicitly present in the two files you read:
4
+ project-analysis.json (stack detection results) and pass2-merged.json (code analysis results).
5
+ If a library, framework, tool, or pattern does NOT appear in either of these files,
6
+ you MUST NOT mention it, generate code examples for it, or assume it exists — not in
7
+ standards, rules, skills, guides, database docs, or CLAUDE.md.
8
+ Do NOT infer or guess technologies from other detected technologies.
9
+ Examples of violations:
10
+ - Writing "React Query caching" when pass2-merged.json has no TanStack Query / React Query entry
11
+ - Adding "Zustand store pattern" when pass2-merged.json has no Zustand usage
12
+ - Generating "Prisma schema" examples when project-analysis.json ORM is not Prisma
13
+ - Assuming React Query exists because Orval was detected (inference is NOT detection)
14
+ When in doubt, omit. Missing content is fixable; hallucinated content erodes trust.
15
+
16
+ CRITICAL — No Domain-Specific Hardcoding:
17
+ All generated documentation in claudeos-core/standard/, .claude/rules/, and claudeos-core/skills/
18
+ MUST use generic, reusable patterns — NEVER hardcode project-specific domain names, table names,
19
+ URL paths, or class names as examples.
20
+ Use placeholder patterns instead:
21
+ - Table names: `{prefix}_{table_name}` not a specific table like `user_account`
22
+ - URL paths: `{domain}/{resource}` not a specific path like `/notice/getList`
23
+ - DTO names: `{Action}{Entity}ReqDto` not a specific class like `GetNoticeListReqDto`
24
+ - Domain keys: `{DOMAIN_KEY}` not a specific code like `NOTICE`
25
+ Allowed exceptions:
26
+ - Project-wide common fields that appear across ALL domains (e.g., audit columns, base classes)
27
+ - Framework/infrastructure names (e.g., `BaseEntity`, `SecurityConfig`)
28
+ - Listing existing domain names only when explaining how to ADD NEW ones (configuration examples)
29
+ Reason: These documents are project-wide COMMON rules. If specific domain names appear,
30
+ developers working on other domains may ignore the rules as irrelevant to them.
31
+
32
+ CRITICAL — Skill Orchestrator Completeness:
33
+ The orchestrator file (e.g., 01.scaffold-page-feature.md, 01.scaffold-crud-feature.md)
34
+ MUST list ALL sub-skill files in its execution order table with no gaps.
35
+ Every sub-skill file generated in the scaffold directory MUST have a corresponding row.
36
+ Do NOT skip any number in the sequence.
37
+
38
+ CRITICAL Sync Rule Economy:
39
+ For 50.sync/*, generate AT MOST 2 files:
40
+ - One doc-sync rule covering BOTH directions (standard ↔ rules) as a single bidirectional rule.
41
+ - One skills-sync rule covering the skills ↔ MANIFEST relationship.
42
+ Do NOT generate separate "A → B" and "B → A" files for the same mirror relationship —
43
+ they are redundant and multiply self-maintenance cost.
44
+
45
+ Inside sync rules:
46
+ - Do NOT hardcode file-to-file mapping tables (e.g., "standard/X.md → rules/X-rules.md"
47
+ listed for every pair). Express the relationship as a NAMING CONVENTION instead
48
+ (e.g., "standard/<N>.<dir>/<M>.<name>.md ↔ .claude/rules/<N>.<dir>/<M>.<name>-rules.md").
49
+ - The master mapping index lives in .claude/rules/00.core/00.standard-reference.md —
50
+ sync rules should reference it, not duplicate it.
51
+ - Hardcoded mapping tables rot fast: every new standard file forces an edit.
52
+ Naming conventions are self-describing and maintenance-free.
53
+
54
+ CRITICAL — `00.standard-reference.md` Composition:
55
+ This file is the mechanical standards index loaded on every edit via
56
+ `paths: ["**/*"]`. Its role is to let Claude Code locate a standard file
57
+ quickly without enumerating the whole tree. Scope it strictly:
58
+
59
+ INCLUDE:
60
+ - Every file that will exist under `claudeos-core/standard/` after Pass 3 + Pass 4.
61
+ This includes FORWARD REFERENCES to Pass 4 outputs — specifically
62
+ `claudeos-core/standard/00.core/04.doc-writing-guide.md` (generated by Pass 4's
63
+ Required output #12). Omitting it creates an index gap the moment Pass 4 runs.
64
+ If Pass 4 lands a file at `claudeos-core/standard/00.core/04.doc-writing-guide.md`,
65
+ it must already appear in Pass 3's `00.standard-reference.md` under `## Core`.
66
+
67
+ DO NOT INCLUDE:
68
+ - "DO NOT Read" / "context waste" / "Avoid reading" sections listing
69
+ `claudeos-core/generated/`, `claudeos-core/guide/`, `claudeos-core/mcp-guide/`,
70
+ `build/`, `internal/`, or any "negative list". CLAUDE.md Section 7
71
+ (DO NOT Read) is the single source of truth for that information, and it
72
+ is more complete (includes project-specific paths like `build/` and
73
+ external modules). Replicating this list inside `00.standard-reference.md`
74
+ creates a duplicate maintenance point that drifts over time.
75
+ - Rule files (`.claude/rules/*`), skill files (`claudeos-core/skills/*`), or
76
+ memory files (`claudeos-core/memory/*`). The index is for standards only.
77
+ - Inline descriptions per file (1-line summaries). Those live in CLAUDE.md
78
+ Section 6's Standard sub-section, which is loaded once per session
79
+ (session-time budget), while this file is reloaded on every edit
80
+ (per-edit budget). Keep the per-edit payload minimal — paths only.
81
+
82
+ CRITICAL — `.env` Is the Source of Truth for Runtime Configuration:
83
+ When pass2-merged.json contains `stack.envInfo` (parsed from the project's
84
+ `.env.example` or `.env`), treat that data as authoritative for:
85
+
86
+ - Port numbers (dev server, API server, alternate ports like mobile/storybook)
87
+ - Host names (dev host, API host)
88
+ - API target URLs (backend proxy target, external service endpoints)
89
+ - Any other runtime configuration the project explicitly declares
90
+
91
+ Do NOT override these with framework defaults (Vite 5173, Next.js 3000,
92
+ Django 8000, etc.) when the project's env file says otherwise. Framework
93
+ defaults are only valid when `stack.envInfo` is absent or the specific
94
+ field is null.
95
+
96
+ This affects:
97
+ - CLAUDE.md Section 2 (Project Overview table) — port / host / API target rows
98
+ - CLAUDE.md Section 3 (Build & Run Commands) — inline comments next to run commands
99
+ - Any generated rule that references port values (e.g., 30.security-db/
100
+ auth rules that mention CORS origins)
101
+
102
+ When in doubt, read `.env.example` directly and cross-check against
103
+ `stack.envInfo.vars`. If they disagree, trust `.env.example` as the
104
+ canonical declaration.
105
+
106
+ CRITICAL — Rule `paths` Must Match Rule Content:
107
+ Each `.claude/rules/*` file's `paths` frontmatter MUST match the file types
108
+ that the rule's guardrails actually target, NOT the category's default.
109
+
110
+ - A logging rule's guardrails apply to source code (e.g., `console.log` use,
111
+ PII in logs, `catch {}` empty blocks). Its `paths` MUST include source code
112
+ extensions (`**/*.ts`, `**/*.py`, `**/*.java`, etc.), not just config files.
113
+ - An environment-config rule's guardrails apply to `.env*`, `*.config.*`,
114
+ and similar. Its `paths` must include those.
115
+ - A CI/CD rule's guardrails often span both — CI YAML AND source code
116
+ (e.g., "no hardcoded API origin in source", "no direct edits to generated
117
+ client"). Its `paths` must include both categories.
118
+
119
+ Do NOT copy `paths` verbatim across sibling rule files in the same category.
120
+ Each file is evaluated independently based on what it enforces. The Pass 3
121
+ prompt now specifies per-file paths for `40.infra/*` — follow those EXACTLY,
122
+ do not substitute a category-level shortcut.
123
+
124
+ When generating a rule file, re-read the file's own guardrail content and
125
+ verify: "When should Claude Code auto-load this rule?" The answer determines
126
+ paths. If the answer is "when editing TypeScript source", paths must include
127
+ `**/*.ts` / `**/*.tsx` — not `**/*.json`.
128
+
129
+ CRITICAL — CLAUDE.md Scaffold Compliance:
130
+ CLAUDE.md generation MUST follow the scaffold at:
131
+ `pass-prompts/templates/common/claude-md-scaffold.md`
132
+
133
+ The scaffold enforces EXACTLY 8 top-level (##) sections with FIXED
134
+ titles and order (canonical English names below — emit each heading
135
+ in the target output language with equivalent meaning):
136
+ 1. Role Definition
137
+ 2. Project Overview
138
+ 3. Build & Run Commands
139
+ 4. Core Architecture
140
+ 5. Directory Structure
141
+ 6. Standard / Rules / Skills Reference
142
+ 7. DO NOT Read (Files Not to Be Read Directly)
143
+ 8. Common Rules & Memory (L4)
144
+
145
+ Before finalizing, verify:
146
+ - Exactly 8 `##` sections (no more, no less)
147
+ - Section titles match the scaffold's FIXED names (in the target output language)
148
+ - Section order matches
149
+ - Section 1 is exactly 2 lines (role + PROJECT_CONTEXT)
150
+ - Section 6 has EXACTLY 3 sub-sections (Standard / Rules / Skills — no "Guide" sub-section)
151
+ - Section 7 includes the 3 common claudeos-core/* entries
152
+ (guide/, generated/, mcp-guide/)
153
+ - Section 8 has EXACTLY 2 sub-sections:
154
+ - `### Common Rules (auto-loaded on every edit)` — meta-summary table
155
+ of `paths: ["**/*"]` rules (typically
156
+ `00.core/51.doc-writing-rules.md` and `00.core/52.ai-work-rules.md`)
157
+ - `### L4 Memory (on-demand reference)` — intro + 4-row memory file
158
+ table + 6-step workflow, EACH APPEARING EXACTLY ONCE
159
+
160
+ FORBIDDEN `##`-level sections (beyond the canonical 8):
161
+
162
+ RULE: No `##` section may have a title whose semantic category is "rules",
163
+ "memory", "L4", "guardrails", or any rephrasing thereof. The 8 canonical
164
+ sections above are the COMPLETE set of allowed top-level headings.
165
+
166
+ This rule is LANGUAGE-INVARIANT. When generating in a non-English output
167
+ language, apply this rule to the translated heading, not just the English
168
+ one. The LLM's task is NOT to match a finite blocklist of English strings;
169
+ it is to reject ANY 9th `##` section regardless of wording.
170
+
171
+ Examples of forbidden `##` sections (canonical English label → common
172
+ translated variants that are ALSO forbidden):
173
+
174
+ - "Memory Layer (L4)" →
175
+ Korean (ko): "메모리 (L4)", "메모리 레이어 (L4)", "L4 메모리"
176
+ Japanese (ja): "メモリ (L4)", "メモリレイヤー (L4)", "L4 メモリ"
177
+ Chinese (zh): "记忆层 (L4)", "内存 (L4)", "L4 记忆", "记忆 (L4)"
178
+ Spanish (es): "Capa de Memoria (L4)", "Memoria (L4)", "L4 Memoria"
179
+ Vietnamese (vi):"Lớp Bộ nhớ (L4)", "Bộ nhớ (L4)", "L4 Bộ nhớ"
180
+ Hindi (hi): "मेमोरी लेयर (L4)", "मेमोरी (L4)", "L4 मेमोरी"
181
+ Russian (ru): "Слой памяти (L4)", "Память (L4)", "L4 Память"
182
+ French (fr): "Couche Mémoire (L4)", "Mémoire (L4)", "L4 Mémoire"
183
+ German (de): "Speicherebene (L4)", "Speicher (L4)", "L4 Speicher"
184
+ All forbidden; L4 memory belongs as a SUB-SECTION inside Section 8.
185
+
186
+ - "Common Rules" →
187
+ Korean (ko): "공통 규칙", "공통 가드레일"
188
+ Japanese (ja): "共通ルール", "共通ガードレール"
189
+ Chinese (zh): "通用规则", "公共规则"
190
+ Spanish (es): "Reglas Comunes", "Guardarraíles Comunes"
191
+ Vietnamese (vi):"Quy tắc Chung", "Lan can Chung"
192
+ Hindi (hi): "सामान्य नियम", "सामान्य गार्डरेल"
193
+ Russian (ru): "Общие правила", "Общие ограждения"
194
+ French (fr): "Règles Communes", "Garde-fous Communs"
195
+ German (de): "Allgemeine Regeln", "Allgemeine Leitplanken"
196
+ All forbidden; common rules belong as a SUB-SECTION inside Section 8.
197
+
198
+ - "L4 Memory Files (Re-declaration)" or any restated memory table →
199
+ Any heading in any language under which the L4 Memory Files table is
200
+ restated is forbidden. The table appears EXACTLY ONCE in the whole
201
+ document (inside Section 8 sub-section 2).
202
+
203
+ - "Documentation Writing Rules", "AI Work Rules", "Required to Observe
204
+ While Working", "Rules Summary" →
205
+ Same prohibition across all 10 output languages (ko, ja, zh-CN, es,
206
+ vi, hi, ru, fr, de, en). These are rule content, not CLAUDE.md
207
+ content; move their bodies to `.claude/rules/*`.
208
+
209
+ DECISION RULE (apply before writing any `##` heading):
210
+ 1. Is this heading one of the 8 canonical sections? → Proceed.
211
+ 2. Does this heading's meaning fall under "rules", "memory", "L4",
212
+ "guardrails", or "procedures to follow"? → STOP. The content belongs
213
+ in `.claude/rules/*` or inside Section 8 as a sub-section.
214
+ 3. Anything else → Re-check whether this content actually belongs in
215
+ CLAUDE.md at all; most extra `##` sections are signs that the content
216
+ should live in `.claude/rules/*`, `claudeos-core/standard/*`, or
217
+ `claudeos-core/memory/*`.
218
+
219
+ Where common-rule information DOES belong:
220
+ - `##`-level: Section 8 sub-section 1 (`### Common Rules (auto-loaded
221
+ on every edit)`). Include a meta-summary table with columns
222
+ `| Rule File | Role | Core Enforcement |` (column labels emitted in
223
+ target output language). The "Core Enforcement" column is a ONE-LINE
224
+ meta summary of each rule, NOT a copy of the rule body. Example:
225
+ `| 00.core/51.doc-writing-rules.md | Documentation writing rules
226
+ | paths required, no domain/absolute-path hardcoding, ## Reference
227
+ section required |`
228
+ - The rule BODY itself lives in `.claude/rules/00.core/51.*.md` and is
229
+ auto-loaded; CLAUDE.md only summarizes "what this rule enforces",
230
+ one line per rule.
231
+
232
+ POST-GENERATION CHECK (MANDATORY — execute as the last step before
233
+ declaring CLAUDE.md generation complete):
234
+
235
+ STEP 1 — Count. Run a mental grep for `^## ` in your generated CLAUDE.md.
236
+ Record the count.
237
+
238
+ STEP 2 — Assert. The count MUST equal 8. Not 7. Not 9. Exactly 8.
239
+ This is LANGUAGE-INVARIANT and TITLE-INVARIANT: a 9th `##` section is
240
+ forbidden regardless of its title, in any of the 10 supported output
241
+ languages.
242
+
243
+ STEP 3 — Repair (only if count ≠ 8). Locate the deviation and apply:
244
+ - Count = 9 or more → identify the surplus section(s); for EACH surplus:
245
+ - If it contains memory-file references (`decision-log.md`,
246
+ `failure-patterns.md`, `compaction.md`, `auto-rule-update.md`) →
247
+ DELETE the entire section; its content already lives in Section 8
248
+ sub-section 2
249
+ - If it contains rule-summary content → MERGE into Section 8
250
+ sub-section 1 (not as a new section)
251
+ - If it contains procedural/enforcement content → MOVE to
252
+ `.claude/rules/*`, not CLAUDE.md
253
+ - Otherwise → MERGE into the best-fitting Section 1-7
254
+ - Count = 7 or fewer → a required section is missing; add it following
255
+ the scaffold's canonical order
256
+
257
+ STEP 4 — Verify repair. Re-count `^## `. If still ≠ 8, repeat STEP 3.
258
+ Do NOT declare CLAUDE.md generation complete until count = 8 AND
259
+ Section 8 contains exactly 2 `###` sub-sections.
260
+
261
+ STEP 4b — Title determinism check. For each of the 8 `## N.` headings,
262
+ confirm that the English canonical phrase is present as the primary
263
+ heading text (a native-language translation may follow in parentheses).
264
+ This rule is LANGUAGE-INVARIANT — applied regardless of `{OUTPUT_LANG}`:
265
+
266
+ ✅ `## 7. DO NOT Read`
267
+ ✅ `## 7. DO NOT Read (직접 읽지 말아야 할 파일)`
268
+ ❌ `## 7. 읽지 말 것 (Files Not to Be Read Directly)`
269
+ — English canonical must be PRIMARY, not parenthetical
270
+
271
+ Required canonical tokens by section number:
272
+ §1 → "Role Definition"
273
+ §2 → "Project Overview"
274
+ §3 → "Build" (as in "Build & Run Commands")
275
+ §4 → "Core Architecture"
276
+ §5 → "Directory Structure"
277
+ §6 → "Standard" (as in "Standard / Rules / Skills Reference")
278
+ §7 → "DO NOT Read"
279
+ §8 → "Memory" (as in "Common Rules & Memory (L4)")
280
+
281
+ WHY: Multi-repo consumers (Claude Code sessions spanning sibling
282
+ projects, organization-wide grep, cross-repo navigation) must be able
283
+ to find Section N in every CLAUDE.md by a single English keyword search.
284
+ Without this invariant, one project's §7 reads "DO NOT Read (읽지 말 것)"
285
+ and a sibling's reads "읽지 말 것 (DO NOT Read)" — identical meaning,
286
+ but `grep "## 7. DO NOT Read"` silently misses the second.
287
+
288
+ If any heading lacks its canonical token, rewrite it before finalizing.
289
+
290
+ STEP 5 — External validation available. After saving CLAUDE.md, the
291
+ user can run `npx claudeos-core lint` to independently verify structure
292
+ via the language-invariant validator (v2.3.0+). This is purely a safety
293
+ net; the LLM should not rely on it — the structure must be correct at
294
+ write time.
295
+
296
+ CRITICAL — Path fact grounding (MANDATORY):
297
+
298
+ Every `src/...` (or equivalent language-specific source root) path you
299
+ write in rules, standard, or CLAUDE.md MUST be a literal, verbatim path
300
+ from `pass2-merged.json` / `project-analysis.json` / `pass1-*.json`.
301
+ Do not invent, augment, or "normalize" filenames.
302
+
303
+ The single most common Pass 3 hallucination pattern is inferring a
304
+ filename from its parent directory:
305
+
306
+ Directory seen in facts: src/feature/routers/
307
+ File seen in facts: src/feature/routers/routePath.ts
308
+ src/feature/routers/routeComponentMap.ts
309
+
310
+ ❌ WRONG: write `src/feature/routers/featureRoutePath.ts`
311
+ (prepended "feature" because the dir is `feature/`)
312
+ ❌ WRONG: write `src/feature/routers/FEATURE_COMPONENT_MAP.ts`
313
+ (uppercased to match the TS constant name)
314
+ ✅ RIGHT: write `src/feature/routers/routePath.ts`
315
+
316
+ Mechanism of the error: the model sees a constant named
317
+ `FEATURE_ROUTE_PATH` (a TypeScript identifier) and "renormalizes" the
318
+ filename to match it. TypeScript identifiers and filenames are
319
+ independent — do NOT let the constant's name drive the filename you
320
+ write. The filename in `pass2-merged.json` is authoritative.
321
+
322
+ Same rule applies to domain prefixes in general:
323
+ - `src/feature/X.ts` is the correct reference even when the file's
324
+ exported symbols start with `Feature*` or `FEATURE_*`.
325
+ - Do NOT prepend the parent directory name to the filename as a
326
+ disambiguator. The directory path is already the scope.
327
+
328
+ Library-convention hallucination class (equally important):
329
+
330
+ When generating a standard file about testing, mocking, styling,
331
+ state management, or similar library-centric topics, do NOT reach
332
+ for "the canonical file location" from the library's own docs. There
333
+ is no canonical location — every project chooses its own.
334
+
335
+ ❌ WRONG: writing `testing-strategy.md` and referencing
336
+ `src/__mocks__/handlers.ts`, `src/test/setup.ts`,
337
+ `src/setupTests.ts`, or `src/test-utils.tsx` because MSW,
338
+ Vitest, or Jest docs show these paths.
339
+ ❌ WRONG: writing `styling-patterns.md` and referencing a
340
+ `src/styles/globals.css` or `src/theme.ts` because the
341
+ framework's quick-start uses them.
342
+
343
+ ✅ RIGHT: if pass3a-facts.md lists no test setup file (e.g.,
344
+ the project has 0% coverage with vitest installed but
345
+ no tests), write the testing guidance in abstract terms
346
+ ("a shared setup module in a test directory of your
347
+ choice") without naming a specific path.
348
+ ✅ RIGHT: for any library-centric standard, if the specific
349
+ file is not in pass3a-facts.md, describe the pattern
350
+ by role (what the file does) rather than by name (what
351
+ it is called).
352
+
353
+ Critical triggers for this class:
354
+ - `testing-strategy.md` / `testing-patterns.md` — almost always
355
+ tries to name a mock handler file or test setup file.
356
+ - `styling-patterns.md` — almost always tries to name a global
357
+ stylesheet or theme file.
358
+ - `state-management.md` — almost always tries to name a store
359
+ bootstrap file (Redux, Zustand, etc.) even when the project
360
+ uses only React Context.
361
+
362
+ The rule in all cases: if pass3a-facts.md has the concrete path,
363
+ use it verbatim; if not, describe the role without naming a file.
364
+
365
+ This rule is enforced post-generation by `content-validator [10/10]
366
+ path-claim verification`. Fabricated paths will be flagged as
367
+ `STALE_PATH` errors with the path quoted back, forcing re-generation.
368
+
369
+ CRITICAL — MANIFEST ↔ CLAUDE.md §6 Skills consistency:
370
+
371
+ If `claudeos-core/skills/00.shared/MANIFEST.md` registers skill files
372
+ under its skill table, CLAUDE.md §6 Skills sub-section MUST mention
373
+ every one of those skill paths (at minimum a bullet reference is
374
+ enough; the full description may live in MANIFEST itself). Likewise,
375
+ every skill listed in CLAUDE.md §6 MUST exist in MANIFEST.
376
+
377
+ Asymmetry breaks the "single source of truth" claim and is detected by
378
+ `content-validator [10/10]` as `MANIFEST_DRIFT`. When in doubt, sync
379
+ both directions when Pass 3 finishes — do not defer.
380
+
381
+ CRITICAL — CLAUDE.md Does Not Duplicate Rules:
382
+ CLAUDE.md describes STRUCTURE (overview, architecture, directory, references),
383
+ not enforcement rules. It MUST NOT list or restate rules that are already
384
+ (or should be) enforced by .claude/rules/* or documented in claudeos-core/standard/*.
385
+
386
+ Examples of what does NOT belong in CLAUDE.md:
387
+ - Coding rules (hardcoding prohibition, `any` casting, naming conventions)
388
+ → these go in .claude/rules/00.core/* or 03.naming-conventions.md
389
+ - Domain-specific rules (XSS prevention in specific components, response envelope)
390
+ → these go in .claude/rules/{domain}/* or standard/{domain}/
391
+ - Multi-file sync rules (routePath + routeComponentMap sync)
392
+ → these go in .claude/rules/{domain}/* with paths glob
393
+ - Work procedures (Entity → DTO → Controller order)
394
+ → these go in claudeos-core/skills/* or claudeos-core/guide/02.usage/
395
+
396
+ Section 1 "Role Definition" may reference that rules exist at a high
397
+ level (the scaffold's PROJECT_CONTEXT mentions architecture style),
398
+ but it does NOT enumerate rules. Section 6 "Standard / Rules / Skills
399
+ Reference" provides a REFERENCE INDEX (what exists), not rule content.
400
+
401
+ After completion, run the following commands in order:
402
+ 1. npx claudeos-core health
@@ -51,6 +51,49 @@ MUST match the fact sheet exactly. If `pass3a-facts.md` says
51
51
  `controller-patterns.md`, `response-exception.md`, and
52
52
  `controller-rules.md` MUST all show Controller wrapping the response.
53
53
 
54
+ ## CLAUDE.md Section 6 — Skills sub-section (entry point only)
55
+
56
+ The Skills sub-section inside CLAUDE.md Section 6 is an **entry point**,
57
+ not a full registry. Pass 3c has not yet run when Section 6 is being
58
+ written, so the specific sub-skill filenames (e.g. `01.dto.md`,
59
+ `02.mapper-read.md`) do not exist and must NOT be predicted. Listing
60
+ sub-skills here by name always produces one of two bugs:
61
+
62
+ 1. Hallucinated filenames when Pass 3c picks a different breakdown than
63
+ the one predicted (e.g. `01.entity.md` written here, `01.dto.md`
64
+ generated by Pass 3c → mismatch → MANIFEST_DRIFT).
65
+
66
+ 2. Silent staleness when Pass 3c adds or removes a sub-skill later and
67
+ CLAUDE.md is not regenerated — the listed names diverge from
68
+ MANIFEST and the drift is user-visible.
69
+
70
+ ### What to write in Section 6 — Skills
71
+
72
+ List ONLY:
73
+ - `claudeos-core/skills/00.shared/MANIFEST.md` — the skill registry
74
+ - The orchestrator file(s) for any skill that has sub-skills, with a
75
+ short one-line role description. Example:
76
+ `claudeos-core/skills/10.backend-crud/01.scaffold-crud-feature.md`
77
+ — CRUD scaffolding orchestrator (sub-skills registered in MANIFEST).
78
+ - Standalone skills (skills without sub-skills), if any exist and can
79
+ be verified from the Pass 3c scope described in the stack template.
80
+
81
+ ### What NOT to write in Section 6 — Skills
82
+
83
+ - Do NOT list individual sub-skill files
84
+ (`scaffold-crud-feature/01.dto.md`,
85
+ `scaffold-crud-feature/02.mapper-read.md`, …). They belong in
86
+ MANIFEST only. The orchestrator row in Section 6 covers them via
87
+ indirection — the v2.3.0 validator recognizes this pattern and
88
+ suppresses MANIFEST_DRIFT for sub-skills under a mentioned
89
+ orchestrator.
90
+ - Do NOT predict sub-skill names, counts, or ordering. Write
91
+ "sub-skills registered in MANIFEST" instead of enumerating them.
92
+
93
+ This single-source-of-truth split (CLAUDE.md §6 = entry; MANIFEST =
94
+ full registry) keeps the two documents independently correct as Pass
95
+ 3c iterates on the sub-skill set.
96
+
54
97
  ---
55
98
 
56
99
  Below is the stack-specific generation guide. Apply these instructions within