claudeos-core 2.3.1 → 2.4.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/CHANGELOG.md +1460 -73
- package/CODE_OF_CONDUCT.md +15 -0
- package/README.de.md +321 -883
- package/README.es.md +322 -883
- package/README.fr.md +322 -883
- package/README.hi.md +322 -883
- package/README.ja.md +322 -883
- package/README.ko.md +322 -882
- package/README.md +321 -883
- package/README.ru.md +322 -885
- package/README.vi.md +322 -883
- package/README.zh-CN.md +321 -881
- package/SECURITY.md +51 -0
- package/bin/commands/init.js +570 -264
- package/content-validator/index.js +185 -12
- package/health-checker/index.js +44 -10
- package/package.json +92 -90
- package/pass-json-validator/index.js +58 -7
- package/pass-prompts/templates/angular/pass3.md +15 -14
- package/pass-prompts/templates/common/claude-md-scaffold.md +203 -20
- package/pass-prompts/templates/common/pass3-footer.md +297 -56
- package/pass-prompts/templates/common/pass3a-facts.md +48 -3
- package/pass-prompts/templates/common/pass4.md +78 -40
- package/pass-prompts/templates/java-spring/pass1.md +54 -0
- package/pass-prompts/templates/java-spring/pass3.md +20 -19
- package/pass-prompts/templates/kotlin-spring/pass1.md +45 -0
- package/pass-prompts/templates/kotlin-spring/pass3.md +24 -23
- package/pass-prompts/templates/node-express/pass3.md +18 -17
- package/pass-prompts/templates/node-fastify/pass3.md +11 -10
- package/pass-prompts/templates/node-nestjs/pass3.md +11 -10
- package/pass-prompts/templates/node-nextjs/pass3.md +18 -17
- package/pass-prompts/templates/node-vite/pass3.md +11 -10
- package/pass-prompts/templates/python-django/pass3.md +18 -17
- package/pass-prompts/templates/python-fastapi/pass3.md +18 -17
- package/pass-prompts/templates/python-flask/pass3.md +9 -8
- package/pass-prompts/templates/vue-nuxt/pass3.md +9 -8
- package/plan-installer/domain-grouper.js +45 -5
- package/plan-installer/index.js +34 -1
- package/plan-installer/pass3-context-builder.js +14 -0
- package/plan-installer/scanners/scan-frontend.js +2 -1
- package/plan-installer/scanners/scan-java.js +98 -2
- package/plan-installer/source-paths.js +242 -0
- package/plan-installer/stack-detector.js +522 -42
|
@@ -70,10 +70,17 @@ async function main() {
|
|
|
70
70
|
|
|
71
71
|
// ─── 1. project-analysis.json ──────────────────────────
|
|
72
72
|
console.log(" [1/5] project-analysis.json...");
|
|
73
|
+
// v2.4.0 — `template` (singular, legacy single-stack form) removed from
|
|
74
|
+
// recommended-keys list. `templates` (plural object {backend, frontend})
|
|
75
|
+
// is the canonical form since multi-stack support landed; the consumer
|
|
76
|
+
// at line ~88 already does `pa.templates || pa.template` fallback for
|
|
77
|
+
// back-compat. Listing `template` as recommended caused a false-positive
|
|
78
|
+
// MISSING_KEY WARNING on every healthy multi-stack-aware project where
|
|
79
|
+
// only `templates` exists.
|
|
73
80
|
const pa = validateJson(
|
|
74
81
|
path.join(GEN_DIR, "project-analysis.json"),
|
|
75
82
|
["analyzedAt", "stack", "domains", "frontend", "summary"],
|
|
76
|
-
["lang", "
|
|
83
|
+
["lang", "templates", "rootPackage", "activeDomains"]
|
|
77
84
|
);
|
|
78
85
|
if (pa) {
|
|
79
86
|
if (!pa.stack || !pa.stack.language) {
|
|
@@ -167,6 +174,32 @@ async function main() {
|
|
|
167
174
|
"codeQuality", // 12. Code quality tools
|
|
168
175
|
];
|
|
169
176
|
|
|
177
|
+
// v2.4.0 — Semantic alias map for sections.
|
|
178
|
+
//
|
|
179
|
+
// Pass 2 LLM frequently emits section keys with numeric prefixes
|
|
180
|
+
// ("1_universalPatterns") or alternate vocabulary ("majorityPatterns"
|
|
181
|
+
// instead of "sharedPatterns"). The fuzzy normalizer can't catch
|
|
182
|
+
// these because the stems don't overlap. This alias map adds known
|
|
183
|
+
// semantic equivalents so the existence check matches when ANY of
|
|
184
|
+
// the canonical name OR its aliases is present.
|
|
185
|
+
//
|
|
186
|
+
// Each entry: canonical name → [...alternate keys (case/separator
|
|
187
|
+
// insensitive — normalized identically to keys at check time)].
|
|
188
|
+
const SECTION_ALIASES = {
|
|
189
|
+
commonPatterns: ["universalPatterns", "1_universalPatterns", "1universalPatterns", "patterns_universal"],
|
|
190
|
+
sharedPatterns: ["majorityPatterns", "2_majorityPatterns", "2majorityPatterns", "patterns_majority"],
|
|
191
|
+
domainSpecific: ["domainSpecificPatterns", "3_domainSpecific", "perDomain", "domains"],
|
|
192
|
+
antiPatterns: ["antipatternSummary", "4_antiPatterns", "5_antiPatternSummary", "antiPatternSummary"],
|
|
193
|
+
namingConventions: ["naming", "5_namingConventions", "6_namingConventions"],
|
|
194
|
+
commonUtilities: ["sharedUtilities", "utilities", "6_commonUtilities", "7_commonUtilities"],
|
|
195
|
+
security: ["securityPatterns", "auth", "authentication", "7_security", "8_security"],
|
|
196
|
+
testing: ["testStrategy", "testingStrategy", "9_testing", "10_testing"],
|
|
197
|
+
logging: ["loggingStrategy", "monitoring", "loggingMonitoring", "10_logging", "11_logging"],
|
|
198
|
+
codeQuality: ["quality", "codeQualityTools", "12_codeQuality", "13_codeQuality"],
|
|
199
|
+
database: ["dbPatterns", "8_database"],
|
|
200
|
+
performance: ["perfPatterns", "11_performance"],
|
|
201
|
+
};
|
|
202
|
+
|
|
170
203
|
// Sections only in backend stacks (java/node-express/django/fastapi/kotlin)
|
|
171
204
|
const BACKEND_SECTIONS = [
|
|
172
205
|
"database", // 8. DB patterns
|
|
@@ -208,15 +241,19 @@ async function main() {
|
|
|
208
241
|
...(isKotlinCqrs ? KOTLIN_CQRS_SECTIONS : []),
|
|
209
242
|
];
|
|
210
243
|
|
|
211
|
-
// Key existence validation (case-insensitive fuzzy matching)
|
|
244
|
+
// Key existence validation (case-insensitive fuzzy matching + alias map)
|
|
212
245
|
// Normalize a key to a comparable form: lowercase, strip separators
|
|
213
|
-
const normalize = (s) => s.toLowerCase().replace(/[_\-\s]/g, "");
|
|
246
|
+
const normalize = (s) => s.toLowerCase().replace(/[_\-\s\.]/g, "");
|
|
214
247
|
const normalizedKeys = keys.map(normalize);
|
|
215
248
|
for (const section of sectionsToCheck) {
|
|
216
249
|
const sectionNorm = normalize(section);
|
|
217
|
-
// Exact normalized match
|
|
250
|
+
// (1) Exact normalized match
|
|
251
|
+
// (2) Substring match on canonical (one-direction, length >= 6 to avoid false positives)
|
|
252
|
+
// (3) v2.4.0 — Alias map: any aliased name (normalized) matches a key (normalized)
|
|
253
|
+
const aliases = (SECTION_ALIASES[section] || []).map(normalize);
|
|
218
254
|
const found = normalizedKeys.some(k => k === sectionNorm)
|
|
219
|
-
|| (sectionNorm.length >= 6 && normalizedKeys.some(k => k.includes(sectionNorm)))
|
|
255
|
+
|| (sectionNorm.length >= 6 && normalizedKeys.some(k => k.includes(sectionNorm)))
|
|
256
|
+
|| aliases.some(a => normalizedKeys.some(k => k === a || (a.length >= 6 && k.includes(a))));
|
|
220
257
|
if (!found) {
|
|
221
258
|
warnings.push({
|
|
222
259
|
file: "pass2-merged.json",
|
|
@@ -270,7 +307,13 @@ async function main() {
|
|
|
270
307
|
console.log(" [5a/5] pass3-complete.json (optional)...");
|
|
271
308
|
const p3path = path.join(GEN_DIR, "pass3-complete.json");
|
|
272
309
|
if (fs.existsSync(p3path)) {
|
|
273
|
-
|
|
310
|
+
// v2.4.0 — `backfilled` and `reason` removed from recommended-keys list.
|
|
311
|
+
// Both are scenario-specific: `backfilled: true` is set only when init.js
|
|
312
|
+
// backfilled the marker for a pre-v1.7 CLAUDE.md (rare upgrade path),
|
|
313
|
+
// and `reason` documents that backfill source. Normal Claude-driven
|
|
314
|
+
// Pass 3 completion never has either — listing them as "recommended"
|
|
315
|
+
// produced a false-positive MISSING_KEY WARNING on every healthy run.
|
|
316
|
+
const p3 = validateJson(p3path, ["completedAt"], []);
|
|
274
317
|
if (p3) {
|
|
275
318
|
if (typeof p3.completedAt !== "string" || !/^\d{4}-\d{2}-\d{2}T/.test(p3.completedAt)) {
|
|
276
319
|
warnings.push({ file: "pass3-complete.json", type: "INVALID_TIMESTAMP", msg: `completedAt should be ISO 8601 (got ${JSON.stringify(p3.completedAt)})` });
|
|
@@ -286,9 +329,17 @@ async function main() {
|
|
|
286
329
|
console.log(" [5b/5] pass4-memory.json (optional)...");
|
|
287
330
|
const p4path = path.join(GEN_DIR, "pass4-memory.json");
|
|
288
331
|
if (fs.existsSync(p4path)) {
|
|
332
|
+
// v2.4.0 — `planFiles` removed from optional list because master plan
|
|
333
|
+
// generation was removed in v2.1.0. Pass 4 normal completion never has
|
|
334
|
+
// it, so the recommendation produced a false-positive WARNING on every
|
|
335
|
+
// healthy run. Same for `fallback` (only set when Claude-driven Pass 4
|
|
336
|
+
// failed and static fallback ran) — its absence is the SUCCESS path.
|
|
337
|
+
// `seededDecisions` (only when initial decision-log is seeded) and
|
|
338
|
+
// `ruleFiles` (only when Pass 4 emits rules outside scaffold) are also
|
|
339
|
+
// scenario-specific; demoted from "recommended" to "purely optional".
|
|
289
340
|
const p4 = validateJson(p4path,
|
|
290
341
|
["analyzedAt", "passNum", "memoryFiles"],
|
|
291
|
-
[
|
|
342
|
+
[] // No recommended optional keys; all scenario-specific (see comment above)
|
|
292
343
|
);
|
|
293
344
|
if (p4) {
|
|
294
345
|
if (typeof p4.passNum !== "number" || p4.passNum !== 4) {
|
|
@@ -47,26 +47,26 @@ Generation targets:
|
|
|
47
47
|
- 00.core/01.project-overview.md — Stack (Angular version, TypeScript version), project structure
|
|
48
48
|
- 00.core/02.architecture.md — Module hierarchy, DI tree, data flow, lazy loading map
|
|
49
49
|
- 00.core/03.naming-conventions.md — File/class/selector/module naming conventions
|
|
50
|
-
- 20.frontend
|
|
51
|
-
- 20.frontend
|
|
52
|
-
- 20.frontend
|
|
53
|
-
- 20.frontend
|
|
54
|
-
- 20.frontend
|
|
55
|
-
- 20.frontend
|
|
56
|
-
- 20.frontend
|
|
57
|
-
- 20.frontend
|
|
58
|
-
- 20.frontend
|
|
59
|
-
- 10.backend
|
|
50
|
+
- 20.frontend/01.component-patterns.md — Component structure, lifecycle, OnPush, Signals, I/O
|
|
51
|
+
- 20.frontend/02.routing-patterns.md — Route config, lazy loading, guards, resolvers
|
|
52
|
+
- 20.frontend/03.service-di-patterns.md — Injectable, providers, injection tokens, inject()
|
|
53
|
+
- 20.frontend/04.rxjs-patterns.md — Observable management, operators, subscription cleanup
|
|
54
|
+
- 20.frontend/05.template-patterns.md — Directives, content projection, control flow (@if/@for)
|
|
55
|
+
- 20.frontend/06.form-patterns.md — Reactive/Template forms, validators, error handling
|
|
56
|
+
- 20.frontend/07.state-management.md — NgRx/NGXS/Signal Store patterns
|
|
57
|
+
- 20.frontend/08.http-patterns.md — HttpClient, interceptors, caching, error handling
|
|
58
|
+
- 20.frontend/09.styling-patterns.md — ViewEncapsulation, theming, responsive
|
|
59
|
+
- 10.backend/01.api-integration.md — API service abstraction, interceptors (if backend exists)
|
|
60
60
|
- 30.security-db/01.security-auth.md — Auth guards, JWT interceptor, route protection
|
|
61
61
|
- 40.infra/01.environment-config.md — environment.ts, angular.json, build configuration
|
|
62
62
|
- 40.infra/02.logging-monitoring.md — Error tracking, performance monitoring
|
|
63
63
|
- 40.infra/03.cicd-deployment.md — CI/CD pipeline, ng build --configuration, Docker
|
|
64
|
-
-
|
|
65
|
-
-
|
|
64
|
+
- 80.verification/01.development-verification.md — ng serve, ng build, Lighthouse
|
|
65
|
+
- 80.verification/02.testing-strategy.md — TestBed, component harness, E2E strategy
|
|
66
66
|
|
|
67
67
|
Each file MUST include:
|
|
68
|
-
- Correct examples (code blocks in TypeScript)
|
|
69
|
-
- Incorrect examples (code blocks showing common Angular mistakes)
|
|
68
|
+
- Correct examples (✅ code blocks in TypeScript)
|
|
69
|
+
- Incorrect examples (❌ code blocks showing common Angular mistakes)
|
|
70
70
|
- Key rules summary table
|
|
71
71
|
|
|
72
72
|
3. .claude/rules/ (active domains only)
|
|
@@ -83,6 +83,7 @@ Generation targets:
|
|
|
83
83
|
- `40.infra/03.cicd-deployment-rules.md` paths: `["**/*.yml", "**/*.yaml", "**/Dockerfile*", "**/*.ts"]` — CI config + source
|
|
84
84
|
- `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]`
|
|
85
85
|
- `60.memory/*` rules: forward reference — Pass 4 will generate 4 files (01.decision-log, 02.failure-patterns, 03.compaction, 04.auto-rule-update), each with file-specific `paths`. Pass 3 must STILL list ```.claude/rules/60.memory/*``` as a row in CLAUDE.md Section 6 Rules table so developers/Claude see the category exists.
|
|
86
|
+
- `70.domains/*` rules (multi-domain projects only): per-domain rules at `.claude/rules/70.domains/{type}/{domain}-rules.md` (where `{type}` is `backend` or `frontend`, ALWAYS present even in single-stack projects for uniform layout + zero-migration future-proofing), each with a `paths:` glob scoped to that domain's source directories so the rule auto-loads only when editing files within the relevant domain. Folder name is PLURAL (`domains/`) — collection of N per-domain files — and each file inside uses the SINGULAR domain name (`{domain}-rules.md`). DO NOT use `60.domains/` (collides with `60.memory/`) and DO NOT skip the `{type}/` sub-folder. See pass3-footer.md "Per-domain folder convention" for the full rationale.
|
|
86
87
|
- MUST generate `.claude/rules/00.core/00.standard-reference.md` as a directory of all standard files
|
|
87
88
|
|
|
88
89
|
4. .claude/rules/50.sync/ (2 sync rules)
|
|
@@ -52,38 +52,73 @@ DO NOT:
|
|
|
52
52
|
The 8 canonical section headings below (`## 1. Role Definition` through
|
|
53
53
|
`## 8. Common Rules & Memory (L4)`) use English as their canonical form.
|
|
54
54
|
When generating CLAUDE.md in a non-English output language, the English
|
|
55
|
-
canonical heading MUST remain the primary heading text
|
|
56
|
-
translation
|
|
57
|
-
|
|
58
|
-
This
|
|
59
|
-
have their CLAUDE.md files consumed
|
|
60
|
-
navigation, side-by-side review).
|
|
61
|
-
native-language translation for the
|
|
62
|
-
|
|
63
|
-
no longer matches
|
|
55
|
+
canonical heading MUST remain the primary heading text AND a
|
|
56
|
+
native-language translation MUST be appended in parentheses.
|
|
57
|
+
|
|
58
|
+
This dual requirement exists for two reasons. First, multiple projects
|
|
59
|
+
in the same organization will have their CLAUDE.md files consumed
|
|
60
|
+
together (multi-repo grep, cross-repo navigation, side-by-side review).
|
|
61
|
+
When every project uses a different native-language translation for the
|
|
62
|
+
same section, even when the structure is otherwise identical,
|
|
63
|
+
discoverability breaks: `grep "## 7. DO NOT Read"` no longer matches
|
|
64
|
+
all siblings. Second, when the CONTENT below the heading is written in
|
|
65
|
+
the target language (e.g., Korean body), a Korean reader scanning the
|
|
66
|
+
document benefits from seeing a Korean gloss next to the English
|
|
67
|
+
canonical token — the heading reads both as a stable grep target AND as
|
|
68
|
+
an intelligible label. Run-to-run consistency matters too: gloss
|
|
69
|
+
inclusion must not vary between generations of the same project.
|
|
64
70
|
|
|
65
71
|
Format rule:
|
|
66
|
-
- Primary (
|
|
67
|
-
- Parenthetical (
|
|
72
|
+
- Primary (REQUIRED): English canonical heading exactly as listed.
|
|
73
|
+
- Parenthetical (REQUIRED when `{OUTPUT_LANG}` != `en`, OMITTED when
|
|
74
|
+
`{OUTPUT_LANG}` == `en`): native-language translation, added at the
|
|
75
|
+
end in parentheses.
|
|
76
|
+
|
|
77
|
+
Canonical translations — use these verbatim when `{OUTPUT_LANG}` matches:
|
|
78
|
+
|
|
79
|
+
| Code | §1 | §2 | §3 | §4 | §5 | §6 | §7 | §8 |
|
|
80
|
+
|-------|----|----|----|----|----|----|----|----|
|
|
81
|
+
| `en` | (no gloss — English is canonical) |
|
|
82
|
+
| `ko` | (역할 정의) | (프로젝트 개요) | (빌드 및 실행 명령어) | (핵심 아키텍처) | (디렉터리 구조) | (Standard / Rules / Skills 참조) | (직접 읽지 말아야 할 파일) | (공통 규칙 및 메모리 (L4)) |
|
|
83
|
+
| `zh-CN` | (角色定义) | (项目概述) | (构建和运行命令) | (核心架构) | (目录结构) | (Standard / Rules / Skills 参考) | (请勿直接读取的文件) | (通用规则与内存 (L4)) |
|
|
84
|
+
| `ja` | (役割定義) | (プロジェクト概要) | (ビルド&実行コマンド) | (コアアーキテクチャ) | (ディレクトリ構造) | (Standard / Rules / Skills 参照) | (直接読まないファイル) | (共通ルール&メモリ (L4)) |
|
|
85
|
+
| `es` | (Definición del rol) | (Resumen del proyecto) | (Comandos de compilación y ejecución) | (Arquitectura central) | (Estructura de directorios) | (Referencia Standard / Rules / Skills) | (Archivos que NO se deben leer) | (Reglas comunes y memoria (L4)) |
|
|
86
|
+
| `vi` | (Định nghĩa vai trò) | (Tổng quan dự án) | (Lệnh build và chạy) | (Kiến trúc cốt lõi) | (Cấu trúc thư mục) | (Tham chiếu Standard / Rules / Skills) | (Tệp KHÔNG được đọc) | (Quy tắc chung & bộ nhớ (L4)) |
|
|
87
|
+
| `hi` | (भूमिका परिभाषा) | (परियोजना अवलोकन) | (बिल्ड और रन कमांड) | (मुख्य आर्किटेक्चर) | (निर्देशिका संरचना) | (Standard / Rules / Skills संदर्भ) | (न पढ़ने योग्य फ़ाइलें) | (सामान्य नियम और मेमोरी (L4)) |
|
|
88
|
+
| `ru` | (Определение роли) | (Обзор проекта) | (Команды сборки и запуска) | (Основная архитектура) | (Структура каталогов) | (Справочник Standard / Rules / Skills) | (Файлы, которые НЕ следует читать) | (Общие правила и память (L4)) |
|
|
89
|
+
| `fr` | (Définition du rôle) | (Aperçu du projet) | (Commandes de build et d'exécution) | (Architecture principale) | (Structure des répertoires) | (Référence Standard / Rules / Skills) | (Fichiers à NE PAS lire) | (Règles communes & mémoire (L4)) |
|
|
90
|
+
| `de` | (Rollendefinition) | (Projektübersicht) | (Build- und Ausführungsbefehle) | (Kernarchitektur) | (Verzeichnisstruktur) | (Standard / Rules / Skills-Referenz) | (Nicht zu lesende Dateien) | (Gemeinsame Regeln & Speicher (L4)) |
|
|
68
91
|
|
|
69
92
|
Examples (ko output):
|
|
70
93
|
|
|
71
|
-
✅ `##
|
|
94
|
+
✅ `## 1. Role Definition (역할 정의)`
|
|
72
95
|
✅ `## 7. DO NOT Read (직접 읽지 말아야 할 파일)`
|
|
96
|
+
❌ `## 1. Role Definition`
|
|
97
|
+
— gloss is required when OUTPUT_LANG != en
|
|
73
98
|
❌ `## 7. 읽지 말 것 (Files Not to Be Read Directly)`
|
|
74
99
|
— English must be primary, not parenthetical
|
|
75
100
|
❌ `## 7. 읽지 말 것`
|
|
76
|
-
— English canonical must appear
|
|
101
|
+
— English canonical must appear as primary
|
|
77
102
|
|
|
78
103
|
Examples (ja output):
|
|
79
104
|
|
|
80
105
|
✅ `## 7. DO NOT Read (直接読まないファイル)`
|
|
106
|
+
❌ `## 7. DO NOT Read`
|
|
107
|
+
— gloss is required when OUTPUT_LANG != en
|
|
81
108
|
❌ `## 7. 直接読まないファイル (DO NOT Read)`
|
|
109
|
+
— English must be primary, not parenthetical
|
|
110
|
+
|
|
111
|
+
Examples (en output):
|
|
82
112
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
113
|
+
✅ `## 7. DO NOT Read`
|
|
114
|
+
❌ `## 7. DO NOT Read (Files Not to Be Read Directly)`
|
|
115
|
+
— gloss must be OMITTED when OUTPUT_LANG == en
|
|
116
|
+
(the English canonical already serves as the label)
|
|
117
|
+
|
|
118
|
+
For `{OUTPUT_LANG}` codes not in the table above, translate each
|
|
119
|
+
canonical heading semantically into the target language and append in
|
|
120
|
+
parentheses following the same pattern. The CONTENT below the heading
|
|
121
|
+
is written entirely in the target language regardless of the gloss.
|
|
87
122
|
|
|
88
123
|
DO:
|
|
89
124
|
- Adapt content within each section to project facts from pass2-merged.json
|
|
@@ -101,8 +136,20 @@ Use the following structure EXACTLY:
|
|
|
101
136
|
|
|
102
137
|
> {1-2 line project intro}
|
|
103
138
|
|
|
139
|
+
{!-- SECTION HEADING RULE (applies to all 8 ## headings below):
|
|
140
|
+
The heading format "## N. English Canonical" shown in this scaffold
|
|
141
|
+
is the en (English) form. For non-English OUTPUT_LANG, APPEND the
|
|
142
|
+
canonical gloss in parentheses per the "Section heading format"
|
|
143
|
+
table earlier in this scaffold.
|
|
144
|
+
Example (ko): `## 1. Role Definition (역할 정의)`
|
|
145
|
+
Example (en): `## 1. Role Definition` (no gloss)
|
|
146
|
+
--}
|
|
147
|
+
|
|
104
148
|
## 1. Role Definition
|
|
105
149
|
|
|
150
|
+
{!-- Line 1 below is in English for reference only. When OUTPUT_LANG != en,
|
|
151
|
+
REPLACE with the canonical translation from "Section 1: Role Definition"
|
|
152
|
+
rules further down in this scaffold. See the 10-language canonical list. --}
|
|
106
153
|
As the senior developer for this repository, you are responsible for writing, modifying, and reviewing code. Responses must be written in {OUTPUT_LANG}.
|
|
107
154
|
{PROJECT_CONTEXT}.
|
|
108
155
|
|
|
@@ -232,6 +279,12 @@ Unlike rules that auto-load via `paths` glob, this layer is referenced **on-dema
|
|
|
232
279
|
4. **Record repeated errors**: If the same error occurs ≥2 times and the root cause is non-obvious, register it in `failure-patterns.md` with a new pattern-id.
|
|
233
280
|
5. **Periodic compaction**: When a memory file approaches 400 lines or has not been tidied up for over a month, run `npx claudeos-core memory compact`.
|
|
234
281
|
6. **Review rule-update proposals**: Review proposals in `auto-rule-update.md` with confidence ≥ 0.70. When accepting, edit the corresponding rule file and log the decision in `decision-log.md`.
|
|
282
|
+
|
|
283
|
+
**Session Resume (after auto-compact or restart)**: Claude Code's auto-compact feature may truncate session context mid-work, and a restarted session starts with a fresh context window. When resuming work:
|
|
284
|
+
|
|
285
|
+
- **Re-scan** `failure-patterns.md` — error patterns referenced pre-compact may have been dropped from context.
|
|
286
|
+
- **Re-read the 3 most recent entries** of `decision-log.md` — new decisions may have been recorded during the truncated portion of the session.
|
|
287
|
+
- **Re-match rules by `paths` glob** for the current working files — CLAUDE.md is always loaded, but `paths`-conditional rules may not have been re-loaded after compact. Explicitly Read the relevant rule files if needed.
|
|
235
288
|
```
|
|
236
289
|
|
|
237
290
|
---
|
|
@@ -242,11 +295,45 @@ Unlike rules that auto-load via `paths` glob, this layer is referenced **on-dema
|
|
|
242
295
|
|
|
243
296
|
**Structure**: EXACTLY 2 lines.
|
|
244
297
|
|
|
245
|
-
**Line 1** (fixed
|
|
298
|
+
**Line 1** (fixed meaning, EMIT IN THE TARGET OUTPUT LANGUAGE — do NOT copy the English reference verbatim unless `{OUTPUT_LANG}` is English):
|
|
299
|
+
|
|
300
|
+
The sentence below is the **semantic reference in English**. Translate it
|
|
301
|
+
fully into `{OUTPUT_LANG}`. The English text is NOT a literal template —
|
|
302
|
+
copying it verbatim for a non-English target produces the ironic bug of
|
|
303
|
+
writing "Responses must be written in Korean" in English.
|
|
304
|
+
|
|
305
|
+
English reference (semantic, for `en` output only):
|
|
246
306
|
```
|
|
247
307
|
As the senior developer for this repository, you are responsible for writing, modifying, and reviewing code. Responses must be written in {OUTPUT_LANG}.
|
|
248
308
|
```
|
|
249
309
|
|
|
310
|
+
**Canonical translations** — emit these VERBATIM when `{OUTPUT_LANG}` matches
|
|
311
|
+
the target language. If `{OUTPUT_LANG}` is some other language not listed
|
|
312
|
+
here, translate the English reference following the same semantic
|
|
313
|
+
structure (senior developer + write/modify/review code + respond in target
|
|
314
|
+
language):
|
|
315
|
+
|
|
316
|
+
- `en` →
|
|
317
|
+
`As the senior developer for this repository, you are responsible for writing, modifying, and reviewing code. Responses must be written in English.`
|
|
318
|
+
- `ko` (한국어) →
|
|
319
|
+
`이 리포지토리의 시니어 개발자로서 코드 작성, 수정, 리뷰를 책임진다. 응답은 한국어로 작성해야 한다.`
|
|
320
|
+
- `zh-CN` (简体中文) →
|
|
321
|
+
`作为此仓库的高级开发者,负责代码的编写、修改和审查。回答必须使用简体中文。`
|
|
322
|
+
- `ja` (日本語) →
|
|
323
|
+
`このリポジトリのシニア開発者として、コードの記述、修正、レビューを担当する。回答は日本語で記述すること。`
|
|
324
|
+
- `es` (Español) →
|
|
325
|
+
`Como desarrollador senior de este repositorio, eres responsable de escribir, modificar y revisar código. Las respuestas deben estar escritas en español.`
|
|
326
|
+
- `vi` (Tiếng Việt) →
|
|
327
|
+
`Với tư cách là lập trình viên cấp cao của kho lưu trữ này, bạn chịu trách nhiệm viết, sửa đổi và đánh giá mã. Các câu trả lời phải được viết bằng tiếng Việt.`
|
|
328
|
+
- `hi` (हिन्दी) →
|
|
329
|
+
`इस रिपॉजिटरी के वरिष्ठ डेवलपर के रूप में, आप कोड लिखने, संशोधित करने और समीक्षा करने के लिए ज़िम्मेदार हैं। उत्तर हिन्दी में लिखे जाने चाहिए।`
|
|
330
|
+
- `ru` (Русский) →
|
|
331
|
+
`Как старший разработчик этого репозитория, вы отвечаете за написание, изменение и проверку кода. Ответы должны быть написаны на русском языке.`
|
|
332
|
+
- `fr` (Français) →
|
|
333
|
+
`En tant que développeur senior de ce dépôt, vous êtes responsable de l'écriture, de la modification et de la révision du code. Les réponses doivent être rédigées en français.`
|
|
334
|
+
- `de` (Deutsch) →
|
|
335
|
+
`Als Senior-Entwickler dieses Repositorys sind Sie für das Schreiben, Ändern und Überprüfen von Code verantwortlich. Antworten müssen auf Deutsch verfasst werden.`
|
|
336
|
+
|
|
250
337
|
**Line 2** (`{PROJECT_CONTEXT}` — dynamically generated, Level 2 abstraction):
|
|
251
338
|
|
|
252
339
|
Generate `{PROJECT_CONTEXT}` as a single sentence combining:
|
|
@@ -474,6 +561,63 @@ Format: `**{category}**: {explanation}`
|
|
|
474
561
|
Example row for 60.memory:
|
|
475
562
|
`.claude/rules/60.memory/*` | Auto-loaded when editing L4 memory
|
|
476
563
|
files (decision-log · failure-patterns · compaction · auto-rule-update) |
|
|
564
|
+
Example row for 70.domains (only when the project has multi-batch
|
|
565
|
+
domain output — see "Per-domain folder convention" below):
|
|
566
|
+
`.claude/rules/70.domains/*` | Auto-loaded when editing files within
|
|
567
|
+
a specific domain (paths-scoped, one rule file per domain) |
|
|
568
|
+
|
|
569
|
+
**Per-domain folder convention (canonical, v2.4.0+)**:
|
|
570
|
+
|
|
571
|
+
When a project has multiple distinct domains and Pass 3 emits per-domain
|
|
572
|
+
output (typical for backends with ≥4 domains, multi-batch runs, or
|
|
573
|
+
projects where rules need domain-specific `paths` glob scoping), the
|
|
574
|
+
canonical folder is **`70.domains/{type}/`** (PLURAL collection +
|
|
575
|
+
ALWAYS-typed sub-folder), and each file inside uses the singular
|
|
576
|
+
domain name:
|
|
577
|
+
|
|
578
|
+
- `claudeos-core/standard/70.domains/{type}/{domain}.md` — `{type}`
|
|
579
|
+
is `backend` or `frontend`
|
|
580
|
+
- `.claude/rules/70.domains/{type}/{domain}-rules.md` — per-domain rule
|
|
581
|
+
(with `paths` frontmatter scoping to that domain's source directories)
|
|
582
|
+
|
|
583
|
+
The `{type}/` sub-folder is ALWAYS present, even in single-stack
|
|
584
|
+
projects (backend-only or frontend-only). Reasons: (1) zero file moves
|
|
585
|
+
when a single-stack project later adds the other stack, (2) no LLM
|
|
586
|
+
probabilistic drift between Pass 3 runs (one pattern always), (3) one
|
|
587
|
+
pattern for validators to recognize, (4) future-proof for new stack
|
|
588
|
+
types (mobile/cli/agent).
|
|
589
|
+
|
|
590
|
+
The Pass 3 orchestrator (`bin/commands/init.js`) classifies each domain
|
|
591
|
+
via `project-analysis.json` and emits per-domain target paths
|
|
592
|
+
explicitly in the batch scope note — you (the LLM) should follow the
|
|
593
|
+
explicit paths shown there.
|
|
594
|
+
- `claudeos-core/skills/{category}/domains/{domain}.md` — per-domain
|
|
595
|
+
skill notes (sub-folder under skill category, no number prefix
|
|
596
|
+
because skills/ is a separate namespace from standard/rules)
|
|
597
|
+
- `claudeos-core/skills/{category}/02.domains.md` — sibling
|
|
598
|
+
ORCHESTRATOR for the `domains/` sub-folder (REQUIRED whenever
|
|
599
|
+
`domains/` is populated). Mirrors the canonical pattern
|
|
600
|
+
`01.scaffold-*-feature.md` ↔ `scaffold-*-feature/`: orchestrator
|
|
601
|
+
file at category root + sub-folder of the same stem. Stem
|
|
602
|
+
(`domains`) MUST match sub-folder name so `content-validator`'s
|
|
603
|
+
standard orchestrator-stem matching covers the sub-skills
|
|
604
|
+
directly without depending on the global-MANIFEST coverage
|
|
605
|
+
fallback. The per-domain note files INSIDE `domains/` carry NO
|
|
606
|
+
numeric prefix (`payment.md`, not `01.payment.md`) — domains are
|
|
607
|
+
independent siblings without execution order, unlike the
|
|
608
|
+
sequenced CRUD sub-skills (`01.dto.md` → `08.test.md`) where
|
|
609
|
+
numbers encode the scaffolding step order.
|
|
610
|
+
|
|
611
|
+
The `70.` prefix sits AFTER `60.memory` (which is regression-guarded to
|
|
612
|
+
60) and BEFORE `90.optional`, giving per-domain content its own clean
|
|
613
|
+
slot in the rules numbering. The folder name is plural (`domains/`)
|
|
614
|
+
because it holds N files, one per project domain — matching the standard
|
|
615
|
+
filesystem convention `users/user.md`, `posts/post.md`. The other
|
|
616
|
+
numbered category folders (`00.core/`, `10.backend/`, etc.) are singular
|
|
617
|
+
because each represents ONE topic, not a collection.
|
|
618
|
+
|
|
619
|
+
DO NOT use `60.domains/` (collides with `60.memory/`) and DO NOT use
|
|
620
|
+
`70.domain/` (singular folder is incorrect for a collection).
|
|
477
621
|
|
|
478
622
|
**Sub-section 3**: `### Skills (Automated Repeated-task Procedures)`
|
|
479
623
|
- Bullet list
|
|
@@ -563,6 +707,24 @@ Workflow: `#### Memory Workflow` — FIXED 6-step numbered list
|
|
|
563
707
|
5. Periodic compaction — memory compact command
|
|
564
708
|
6. Review rule-update proposals — auto-rule-update review
|
|
565
709
|
|
|
710
|
+
**Session Resume block** (RECOMMENDED, follows the 6-step numbered list
|
|
711
|
+
as prose — not a new H4 subsection). Opens with bold label
|
|
712
|
+
`**Session Resume (after auto-compact or restart)**:` followed by a
|
|
713
|
+
3-bullet list covering: re-scan `failure-patterns.md`, re-read the 3
|
|
714
|
+
most recent entries of `decision-log.md`, and re-match rules by `paths`
|
|
715
|
+
glob for current working files. This block addresses Claude Code's
|
|
716
|
+
auto-compact behavior that may truncate session context mid-work.
|
|
717
|
+
|
|
718
|
+
New CLAUDE.md generation (`npx claudeos-core init`) emits this block
|
|
719
|
+
by default. Existing CLAUDE.md files without it remain structurally
|
|
720
|
+
valid — the validator does not enforce Session Resume presence, only
|
|
721
|
+
that if present it follows the prose-not-H4 form.
|
|
722
|
+
|
|
723
|
+
The Session Resume block MUST NOT be a `####` subsection — the Section
|
|
724
|
+
8 structural validator enforces EXACTLY 2 `####` headings (L4 Memory
|
|
725
|
+
Files + Memory Workflow). Session Resume is prose inside the Memory
|
|
726
|
+
Workflow section, not a sibling heading.
|
|
727
|
+
|
|
566
728
|
**Section 8 single-occurrence rule** (enforces the "one canonical home"
|
|
567
729
|
principle):
|
|
568
730
|
- The L4 Memory Files table appears EXACTLY ONCE in the entire document
|
|
@@ -624,10 +786,27 @@ Before finalizing, verify:
|
|
|
624
786
|
Structure, Standard / Rules / Skills Reference, DO NOT Read,
|
|
625
787
|
Common Rules & Memory (L4)) — rendered in the target output
|
|
626
788
|
language with equivalent meaning and order
|
|
789
|
+
- [ ] **Section heading gloss rule:**
|
|
790
|
+
If `{OUTPUT_LANG}` != `en`, EVERY one of the 8 `##` headings MUST
|
|
791
|
+
carry the parenthetical native-language gloss from the canonical
|
|
792
|
+
table in "Section heading format". Example (ko):
|
|
793
|
+
`## 1. Role Definition (역할 정의)`, `## 7. DO NOT Read (직접 읽지 말아야 할 파일)`.
|
|
794
|
+
If any heading is missing its gloss while `{OUTPUT_LANG}` != `en`,
|
|
795
|
+
the output is NON-COMPLIANT — add the gloss before finalizing.
|
|
796
|
+
- [ ] **English gloss-absence rule:**
|
|
797
|
+
If `{OUTPUT_LANG}` == `en`, headings MUST NOT carry a parenthetical
|
|
798
|
+
gloss (the English canonical already serves as the label).
|
|
799
|
+
`## 7. DO NOT Read` is correct; `## 7. DO NOT Read (Files Not to Be
|
|
800
|
+
Read Directly)` is incorrect for `en` output.
|
|
627
801
|
- [ ] Section order is correct
|
|
628
802
|
- [ ] No sections renamed, merged, or split
|
|
629
803
|
- [ ] No sections added beyond the 8
|
|
630
804
|
- [ ] Section 1 is 2 lines
|
|
805
|
+
- [ ] Section 1 Line 1 is in `{OUTPUT_LANG}` — matches the canonical
|
|
806
|
+
translation in "Section 1: Role Definition" rules (if
|
|
807
|
+
`{OUTPUT_LANG}` is one of the 10 canonical codes). If Line 1
|
|
808
|
+
contains the English phrase "As the senior developer" while
|
|
809
|
+
`{OUTPUT_LANG}` is NOT `en`, the translation was skipped — fix it.
|
|
631
810
|
- [ ] Section 2 is 8-12 rows table
|
|
632
811
|
- [ ] Section 5 has at most 3 emphasis bullets below tree
|
|
633
812
|
- [ ] Section 6 has EXACTLY 3 sub-sections (Standard / Rules / Skills)
|
|
@@ -648,8 +827,12 @@ Before finalizing, verify:
|
|
|
648
827
|
|
|
649
828
|
### Example: Section 1 for different stacks
|
|
650
829
|
|
|
651
|
-
|
|
652
|
-
|
|
830
|
+
⚠️ **Language note:** The English examples below show the SEMANTIC
|
|
831
|
+
structure only. Line 1 of Section 1 MUST be emitted in `{OUTPUT_LANG}` —
|
|
832
|
+
use the canonical translations from "Section 1: Role Definition" rules
|
|
833
|
+
above. Line 2 (PROJECT_CONTEXT) should also be written in
|
|
834
|
+
`{OUTPUT_LANG}`, keeping technical identifiers (framework names, pattern
|
|
835
|
+
names, stack labels) in their standard English form where idiomatic.
|
|
653
836
|
|
|
654
837
|
**Java Spring Boot backend**:
|
|
655
838
|
```
|