claudeos-core 2.1.0 → 2.2.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 (35) hide show
  1. package/CHANGELOG.md +456 -0
  2. package/README.de.md +33 -39
  3. package/README.es.md +33 -39
  4. package/README.fr.md +33 -39
  5. package/README.hi.md +33 -39
  6. package/README.ja.md +33 -39
  7. package/README.ko.md +37 -43
  8. package/README.md +37 -43
  9. package/README.ru.md +35 -39
  10. package/README.vi.md +33 -39
  11. package/README.zh-CN.md +33 -39
  12. package/bin/commands/init.js +81 -45
  13. package/content-validator/index.js +6 -1
  14. package/lib/env-parser.js +317 -0
  15. package/lib/memory-scaffold.js +7 -5
  16. package/package.json +1 -1
  17. package/pass-prompts/templates/angular/pass3.md +28 -13
  18. package/pass-prompts/templates/common/claude-md-scaffold.md +644 -0
  19. package/pass-prompts/templates/common/pass3-footer.md +185 -0
  20. package/pass-prompts/templates/common/pass4.md +6 -3
  21. package/pass-prompts/templates/common/staging-override.md +1 -1
  22. package/pass-prompts/templates/java-spring/pass3.md +31 -21
  23. package/pass-prompts/templates/kotlin-spring/pass3.md +34 -22
  24. package/pass-prompts/templates/node-express/pass3.md +30 -21
  25. package/pass-prompts/templates/node-fastify/pass3.md +28 -14
  26. package/pass-prompts/templates/node-nestjs/pass3.md +29 -14
  27. package/pass-prompts/templates/node-nextjs/pass3.md +34 -21
  28. package/pass-prompts/templates/node-vite/pass3.md +30 -13
  29. package/pass-prompts/templates/python-django/pass3.md +32 -21
  30. package/pass-prompts/templates/python-fastapi/pass3.md +33 -21
  31. package/pass-prompts/templates/python-flask/pass3.md +31 -13
  32. package/pass-prompts/templates/vue-nuxt/pass3.md +32 -13
  33. package/plan-installer/index.js +8 -0
  34. package/plan-installer/prompt-generator.js +18 -1
  35. package/plan-installer/stack-detector.js +16 -0
@@ -29,20 +29,31 @@ Determine from pass2-merged.json which layer handles response formatting (API Ro
29
29
  service/utility layer). This MUST be identical across architecture.md, api-routes.md,
30
30
  and all rules files. Do NOT describe different response flows in different files.
31
31
 
32
- CRITICAL — CLAUDE.md Reference Table Completeness:
33
- The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
34
- Include all frontend-ui, backend-api, security-db, infra, and verification standards.
35
- Alternatively, add a note directing readers to .claude/rules/00.core/00.standard-reference.md
36
- for the complete list.
37
-
38
32
  Generation targets:
39
33
 
40
34
  1. CLAUDE.md (project root)
41
- - Role definition (based on detected stack)
42
- - Build & Run Commands (use ONLY the detected packageManager — never hardcode npm/yarn/pnpm)
43
- - Core architecture diagram
44
- - Directory structure description
45
- - Standard/Skills/Guide reference table
35
+
36
+ Follow the scaffold EXACTLY:
37
+ → `pass-prompts/templates/common/claude-md-scaffold.md`
38
+
39
+ The scaffold enforces an 8-section deterministic structure:
40
+ 1. Role Definition → 2. Project Overview → 3. Build & Run Commands →
41
+ 4. Core Architecture → 5. Directory Structure → 6. Standard / Rules / Skills Reference →
42
+ 7. DO NOT Read → 8. Common Rules & Memory (L4)
43
+
44
+ All section titles, order, and formats are FIXED by the scaffold.
45
+ Content within each section adapts to this project based on pass2-merged.json.
46
+ The scaffold's validation checklist MUST pass.
47
+
48
+ Stack-specific hints for this project (Next.js):
49
+ - Project type for Section 1 PROJECT_CONTEXT: "Full-stack Web Application"
50
+ (detect App Router vs Pages Router and reflect, e.g., "Next.js App Router-based")
51
+ - Architecture diagram (Section 4): server components vs client components,
52
+ data fetching (server actions / route handlers), middleware flow
53
+ - Use ONLY the detected packageManager in Section 3
54
+ - Section 5 tree: distinguish app/ (App Router) vs pages/ (Pages Router) as applicable
55
+ - Detect codegen tools (orval, graphql-codegen, prisma generate)
56
+ and reflect in Section 5 emphasis ("Do Not Modify Manually")
46
57
 
47
58
  2. claudeos-core/standard/ (active domains only)
48
59
  - 00.core/01.project-overview.md — Stack, routing approach, deployment environment
@@ -80,8 +91,11 @@ Generation targets:
80
91
  - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
81
92
  - `20.frontend/*` rules: `paths: ["**/*"]` — always loaded (frontend rules needed for any source editing)
82
93
  - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
83
- - `40.infra/*` rules: `paths: ["**/*.json", "**/*.env*", "**/next.config.*", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]` — loaded only for config/infra files
94
+ - `40.infra/01.environment-config-rules.md` paths: `["**/.env*", "**/next.config.*", "**/*.json"]` — env / Next.js config
95
+ - `40.infra/02.logging-monitoring-rules.md` paths: `["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]` — source code where logs live
96
+ - `40.infra/03.cicd-deployment-rules.md` paths: `["**/*.yml", "**/*.yaml", "**/Dockerfile*", "**/*.ts", "**/*.tsx"]` — CI config + source
84
97
  - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
98
+ - `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.
85
99
  - MUST generate `.claude/rules/00.core/00.standard-reference.md` — a directory of all standard files. This is NOT a "read all" instruction. Claude should Read ONLY the standards relevant to the current task. Structure it as:
86
100
  ```
87
101
  ---
@@ -96,6 +110,7 @@ Generation targets:
96
110
  - claudeos-core/standard/00.core/01.project-overview.md
97
111
  - claudeos-core/standard/00.core/02.architecture.md
98
112
  - claudeos-core/standard/00.core/03.naming-conventions.md
113
+ - claudeos-core/standard/00.core/04.doc-writing-guide.md
99
114
  ## Frontend UI
100
115
  - claudeos-core/standard/20.frontend-ui/01.component-patterns.md
101
116
  - claudeos-core/standard/20.frontend-ui/02.page-routing-patterns.md
@@ -112,18 +127,16 @@ Generation targets:
112
127
  - claudeos-core/standard/40.infra/03.cicd-deployment.md
113
128
  - claudeos-core/standard/50.verification/01.development-verification.md
114
129
  - claudeos-core/standard/50.verification/02.testing-strategy.md
115
- ## DO NOT Read (context waste)
116
- - claudeos-core/generated/ — Build metadata. Not for coding reference.
117
- - claudeos-core/guide/ — Onboarding/usage guides for humans. Not for coding reference.
118
- - claudeos-core/mcp-guide/ — MCP server integration docs. Not for coding reference.
119
130
  ```
120
- List only the standard files that were actually generated above.
131
+ List only the standard files that were actually generated above. NOTE: `00.core/04.doc-writing-guide.md` is a FORWARD REFERENCE — Pass 4 will generate it; include it anyway. Do NOT add a "DO NOT Read" section here — that information lives in CLAUDE.md Section 7 (the single source of truth).
121
132
 
122
- 4. .claude/rules/50.sync/ (3 sync rules — AI fallback reminders)
133
+ 4. .claude/rules/50.sync/ (2 sync rules — AI fallback reminders)
123
134
  - NOTE: These rules remind AI to run `npx claudeos-core refresh` after modifying standard/rules/skills files.
124
- - 01.standard-sync.md — Remind AI to update corresponding rule when standard is modified
125
- - 02.rules-sync.md Remind AI to update corresponding standard when rules are modified
126
- - 03.skills-sync.md Remind AI to update MANIFEST.md when skills are modified
135
+ - 01.doc-sync.md — Bidirectional standard rules sync reminder (both directions in ONE rule).
136
+ Do NOT generate a separate 02.rules-sync.md mirror file redundant.
137
+ Express the mapping as a naming convention (standard/<N>.<dir>/<M>.<n>.md
138
+ .claude/rules/<N>.<dir>/<M>.<n>-rules.md), NOT a hardcoded file-to-file table.
139
+ - 02.skills-sync.md — Remind AI to update MANIFEST.md when skills are modified
127
140
 
128
141
  5. claudeos-core/skills/ (active domains only)
129
142
  - 20.frontend-page/01.scaffold-page-feature.md (orchestrator)
@@ -18,17 +18,29 @@ ALL code examples in rules and standards MUST use EXACT method names, class name
18
18
  and signatures from pass2-merged.json analysis data.
19
19
  Do NOT paraphrase, rename, or infer API names.
20
20
 
21
- CRITICAL — CLAUDE.md Reference Table Completeness:
22
- The reference table in CLAUDE.md MUST list ALL generated standard files.
23
-
24
21
  Generation targets:
25
22
 
26
23
  1. CLAUDE.md (project root)
27
- - Role definition (based on detected stack — Vite + React SPA)
28
- - Build & Run Commands (use ONLY the detected packageManager)
29
- - Core architecture diagram (client-side SPA, routing, state management)
30
- - Directory structure description
31
- - Standard/Skills/Guide reference table
24
+
25
+ Follow the scaffold EXACTLY:
26
+ `pass-prompts/templates/common/claude-md-scaffold.md`
27
+
28
+ The scaffold enforces an 8-section deterministic structure:
29
+ 1. Role Definition → 2. Project Overview → 3. Build & Run Commands →
30
+ 4. Core Architecture → 5. Directory Structure → 6. Standard / Rules / Skills Reference →
31
+ 7. DO NOT Read → 8. Common Rules & Memory (L4)
32
+
33
+ All section titles, order, and formats are FIXED by the scaffold.
34
+ Content within each section adapts to this project based on pass2-merged.json.
35
+ The scaffold's validation checklist MUST pass.
36
+
37
+ Stack-specific hints for this project (Vite + React SPA):
38
+ - Project type for Section 1 PROJECT_CONTEXT: "SPA"
39
+ (reflect the actual character, e.g., Back Office / Front Office / Full-stack)
40
+ - Architecture diagram (Section 4): client-side routing, state management, data flow
41
+ - Detect multi-entry configs (vite.config.*.ts) and reflect in Section 2 / 4 / 5
42
+ - Detect codegen tools (orval, openapi-generator) and reflect in Section 5 emphasis
43
+ (auto-generated directories → "Do Not Modify Manually")
32
44
 
33
45
  2. claudeos-core/standard/ (active domains only)
34
46
  - 00.core/01.project-overview.md — Stack, routing approach, deployment environment
@@ -64,14 +76,19 @@ Generation targets:
64
76
  - `00.core/*` rules: `paths: ["**/*"]`
65
77
  - `20.frontend/*` rules: `paths: ["**/*"]`
66
78
  - `30.security-db/*` rules: `paths: ["**/*"]`
67
- - `40.infra/*` rules: `paths: ["**/*.json", "**/*.env*", "**/vite.config.*", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]`
79
+ - `40.infra/01.environment-config-rules.md` paths: `["**/*.env*", "**/vite.config.*", "**/*.json"]` — env / build config
80
+ - `40.infra/02.logging-monitoring-rules.md` paths: `["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]` — source code where logs live
81
+ - `40.infra/03.cicd-deployment-rules.md` paths: `["**/*.yml", "**/*.yaml", "**/Dockerfile*", "**/*.ts", "**/*.tsx"]` — CI config + source with API origin / codegen references
68
82
  - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]`
83
+ - `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.
69
84
  - MUST generate `.claude/rules/00.core/00.standard-reference.md` — directory of all standard files.
70
85
 
71
- 4. .claude/rules/50.sync/ (3 sync rules)
72
- - 01.standard-sync.md — Remind AI to update corresponding rule when standard is modified
73
- - 02.rules-sync.md Remind AI to update corresponding standard when rules are modified
74
- - 03.skills-sync.md Remind AI to update MANIFEST.md when skills are modified
86
+ 4. .claude/rules/50.sync/ (2 sync rules)
87
+ - 01.doc-sync.md — Bidirectional standard rules sync reminder (both directions in ONE rule).
88
+ Do NOT generate a separate 02.rules-sync.md mirror file redundant.
89
+ Express the mapping as a naming convention (standard/<N>.<dir>/<M>.<n>.md
90
+ .claude/rules/<N>.<dir>/<M>.<n>-rules.md), NOT a hardcoded file-to-file table.
91
+ - 02.skills-sync.md — Remind AI to update MANIFEST.md when skills are modified
75
92
 
76
93
  5. claudeos-core/skills/ (active domains only)
77
94
  - 20.frontend-page/01.scaffold-page-feature.md (orchestrator)
@@ -28,20 +28,29 @@ Determine from pass2-merged.json which layer (View/ViewSet vs Service) calls
28
28
  the response wrapper. This MUST be identical across architecture.md, view-patterns.md,
29
29
  response-exception.md, and all rules files. Do NOT describe different response flows in different files.
30
30
 
31
- CRITICAL — CLAUDE.md Reference Table Completeness:
32
- The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
33
- Include all backend-api, security-db, infra, and verification standards.
34
- Alternatively, add a note directing readers to .claude/rules/00.core/00.standard-reference.md
35
- for the complete list.
36
-
37
31
  Generation targets:
38
32
 
39
33
  1. CLAUDE.md (project root)
40
- - Role definition (based on detected stack)
41
- - Build & Run Commands (pip/poetry, manage.py, gunicorn/uwsgi)
42
- - Core architecture diagram
43
- - Django app structure
44
- - Standard/Skills/Guide reference table
34
+
35
+ Follow the scaffold EXACTLY:
36
+ → `pass-prompts/templates/common/claude-md-scaffold.md`
37
+
38
+ The scaffold enforces an 8-section deterministic structure:
39
+ 1. Role Definition → 2. Project Overview → 3. Build & Run Commands →
40
+ 4. Core Architecture → 5. Directory Structure → 6. Standard / Rules / Skills Reference →
41
+ 7. DO NOT Read → 8. Common Rules & Memory (L4)
42
+
43
+ All section titles, order, and formats are FIXED by the scaffold.
44
+ Content within each section adapts to this project based on pass2-merged.json.
45
+ The scaffold's validation checklist MUST pass.
46
+
47
+ Stack-specific hints for this project (Python Django):
48
+ - Project type for Section 1 PROJECT_CONTEXT: "REST API Server" or "Web Application"
49
+ (when DRF is used, "DRF-based REST API Server"; when detected, e.g., "Async Task Queue + Cache Layer")
50
+ - Architecture diagram (Section 4): MTV structure, request flow, app structure
51
+ - Section 3 commands: pip/poetry, manage.py (migrate/runserver/collectstatic), gunicorn/uwsgi
52
+ - Django apps: list in Section 2 (count only or the main apps), details in Section 5 tree
53
+ - Detect Celery/Redis/channels and reflect in Section 2 or Section 4 Absent / Not Adopted
45
54
 
46
55
  2. claudeos-core/standard/ (active domains only)
47
56
  - 00.core/01.project-overview.md — Stack, app list, server info
@@ -80,8 +89,11 @@ Generation targets:
80
89
  - `00.core/*` rules: `paths: ["**/*"]` — always loaded (architecture, naming are universally needed)
81
90
  - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
82
91
  - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
83
- - `40.infra/*` rules: `paths: ["**/*"]` always loaded (Django settings are .py files, so infra paths cannot be scoped separately)
92
+ - `40.infra/01.environment-config-rules.md` paths: `["**/.env*", "**/settings*.py", "**/settings/**/*.py", "**/*.toml", "**/*.cfg"]` env / Django settings
93
+ - `40.infra/02.logging-monitoring-rules.md` paths: `["**/*.py"]` — source code where logs live
94
+ - `40.infra/03.cicd-deployment-rules.md` paths: `["**/*.yml", "**/*.yaml", "**/Dockerfile*", "**/*.py"]` — CI / deploy config + source
84
95
  - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
96
+ - `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.
85
97
  - MUST generate `.claude/rules/00.core/00.standard-reference.md` — a directory of all standard files. This is NOT a "read all" instruction. Claude should Read ONLY the standards relevant to the current task. Structure it as:
86
98
  ```
87
99
  ---
@@ -96,6 +108,7 @@ Generation targets:
96
108
  - claudeos-core/standard/00.core/01.project-overview.md
97
109
  - claudeos-core/standard/00.core/02.architecture.md
98
110
  - claudeos-core/standard/00.core/03.naming-conventions.md
111
+ - claudeos-core/standard/00.core/04.doc-writing-guide.md
99
112
  ## Backend API
100
113
  - claudeos-core/standard/10.backend-api/01.view-patterns.md
101
114
  - claudeos-core/standard/10.backend-api/02.serializer-patterns.md
@@ -113,18 +126,16 @@ Generation targets:
113
126
  - claudeos-core/standard/40.infra/03.cicd-deployment.md
114
127
  - claudeos-core/standard/50.verification/01.development-verification.md
115
128
  - claudeos-core/standard/50.verification/02.testing-strategy.md
116
- ## DO NOT Read (context waste)
117
- - claudeos-core/generated/ — Build metadata. Not for coding reference.
118
- - claudeos-core/guide/ — Onboarding/usage guides for humans. Not for coding reference.
119
- - claudeos-core/mcp-guide/ — MCP server integration docs. Not for coding reference.
120
129
  ```
121
- List only the standard files that were actually generated above.
130
+ List only the standard files that were actually generated above. NOTE: `00.core/04.doc-writing-guide.md` is a FORWARD REFERENCE — Pass 4 will generate it; include it anyway. Do NOT add a "DO NOT Read" section here — that information lives in CLAUDE.md Section 7 (the single source of truth).
122
131
 
123
- 4. .claude/rules/50.sync/ (3 sync rules — AI fallback reminders)
132
+ 4. .claude/rules/50.sync/ (2 sync rules — AI fallback reminders)
124
133
  - NOTE: These rules remind AI to run `npx claudeos-core refresh` after modifying standard/rules/skills files.
125
- - 01.standard-sync.md — Remind AI to update corresponding rule when standard is modified
126
- - 02.rules-sync.md Remind AI to update corresponding standard when rules are modified
127
- - 03.skills-sync.md Remind AI to update MANIFEST.md when skills are modified
134
+ - 01.doc-sync.md — Bidirectional standard rules sync reminder (both directions in ONE rule).
135
+ Do NOT generate a separate 02.rules-sync.md mirror file redundant.
136
+ Express the mapping as a naming convention (standard/<N>.<dir>/<M>.<n>.md
137
+ .claude/rules/<N>.<dir>/<M>.<n>-rules.md), NOT a hardcoded file-to-file table.
138
+ - 02.skills-sync.md — Remind AI to update MANIFEST.md when skills are modified
128
139
 
129
140
  5. claudeos-core/skills/ (active domains only)
130
141
  - 10.backend-crud/01.scaffold-crud-feature.md (orchestrator)
@@ -28,20 +28,30 @@ Determine from pass2-merged.json which layer (router/endpoint vs service/CRUD) c
28
28
  the response wrapper. This MUST be identical across architecture.md, router-endpoint-patterns.md,
29
29
  response-exception.md, and all rules files. Do NOT describe different response flows in different files.
30
30
 
31
- CRITICAL — CLAUDE.md Reference Table Completeness:
32
- The reference table in CLAUDE.md MUST list ALL generated standard files, not just core.
33
- Include all backend-api, security-db, infra, and verification standards.
34
- Alternatively, add a note directing readers to .claude/rules/00.core/00.standard-reference.md
35
- for the complete list.
36
-
37
31
  Generation targets:
38
32
 
39
33
  1. CLAUDE.md (project root)
40
- - Role definition (based on detected stack)
41
- - Build & Run Commands (pip/poetry, uvicorn, docker)
42
- - Core architecture diagram
43
- - Module structure
44
- - Standard/Skills/Guide reference table
34
+
35
+ Follow the scaffold EXACTLY:
36
+ → `pass-prompts/templates/common/claude-md-scaffold.md`
37
+
38
+ The scaffold enforces an 8-section deterministic structure:
39
+ 1. Role Definition → 2. Project Overview → 3. Build & Run Commands →
40
+ 4. Core Architecture → 5. Directory Structure → 6. Standard / Rules / Skills Reference →
41
+ 7. DO NOT Read → 8. Common Rules & Memory (L4)
42
+
43
+ All section titles, order, and formats are FIXED by the scaffold.
44
+ Content within each section adapts to this project based on pass2-merged.json.
45
+ The scaffold's validation checklist MUST pass.
46
+
47
+ Stack-specific hints for this project (Python FastAPI):
48
+ - Project type for Section 1 PROJECT_CONTEXT: "Asynchronous REST API Server"
49
+ (reflect pydantic-schema-based automatic OpenAPI documentation)
50
+ - Architecture diagram (Section 4): router → dependency → service → repository,
51
+ async request lifecycle, pydantic validation
52
+ - Section 3 commands: pip/poetry install, uvicorn dev, docker deployment
53
+ - Module structure: reflect in Section 5 tree (routers/, models/, schemas/, services/)
54
+ - Detect Celery/Redis/SQLAlchemy async and reflect in Section 2 or Section 4
45
55
 
46
56
  2. claudeos-core/standard/ (active domains only)
47
57
  - 00.core/01.project-overview.md — Stack, modules, server info
@@ -80,8 +90,11 @@ Generation targets:
80
90
  - `00.core/*` rules: `paths: ["**/*"]` — always loaded (architecture, naming are universally needed)
81
91
  - `10.backend/*` rules: `paths: ["**/*"]` — always loaded (backend rules needed for any source editing)
82
92
  - `30.security-db/*` rules: `paths: ["**/*"]` — always loaded (cross-cutting concerns)
83
- - `40.infra/*` rules: `paths: ["**/*.toml", "**/*.env*", "**/config/**", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]` — loaded only for config/infra files
93
+ - `40.infra/01.environment-config-rules.md` paths: `["**/.env*", "**/config/**", "**/*.toml", "**/*.cfg"]` — env / config files
94
+ - `40.infra/02.logging-monitoring-rules.md` paths: `["**/*.py"]` — source code where logs live
95
+ - `40.infra/03.cicd-deployment-rules.md` paths: `["**/*.yml", "**/*.yaml", "**/Dockerfile*", "**/*.py"]` — CI / deploy config + source
84
96
  - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]` — loaded only when editing claudeos-core files
97
+ - `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.
85
98
  - MUST generate `.claude/rules/00.core/00.standard-reference.md` — a directory of all standard files. This is NOT a "read all" instruction. Claude should Read ONLY the standards relevant to the current task. Structure it as:
86
99
  ```
87
100
  ---
@@ -96,6 +109,7 @@ Generation targets:
96
109
  - claudeos-core/standard/00.core/01.project-overview.md
97
110
  - claudeos-core/standard/00.core/02.architecture.md
98
111
  - claudeos-core/standard/00.core/03.naming-conventions.md
112
+ - claudeos-core/standard/00.core/04.doc-writing-guide.md
99
113
  ## Backend API
100
114
  - claudeos-core/standard/10.backend-api/01.router-endpoint-patterns.md
101
115
  - claudeos-core/standard/10.backend-api/02.schema-pydantic-patterns.md
@@ -113,18 +127,16 @@ Generation targets:
113
127
  - claudeos-core/standard/40.infra/03.cicd-deployment.md
114
128
  - claudeos-core/standard/50.verification/01.development-verification.md
115
129
  - claudeos-core/standard/50.verification/02.testing-strategy.md
116
- ## DO NOT Read (context waste)
117
- - claudeos-core/generated/ — Build metadata. Not for coding reference.
118
- - claudeos-core/guide/ — Onboarding/usage guides for humans. Not for coding reference.
119
- - claudeos-core/mcp-guide/ — MCP server integration docs. Not for coding reference.
120
130
  ```
121
- List only the standard files that were actually generated above.
131
+ List only the standard files that were actually generated above. NOTE: `00.core/04.doc-writing-guide.md` is a FORWARD REFERENCE — Pass 4 will generate it; include it anyway. Do NOT add a "DO NOT Read" section here — that information lives in CLAUDE.md Section 7 (the single source of truth).
122
132
 
123
- 4. .claude/rules/50.sync/ (3 sync rules — AI fallback reminders)
133
+ 4. .claude/rules/50.sync/ (2 sync rules — AI fallback reminders)
124
134
  - NOTE: These rules remind AI to run `npx claudeos-core refresh` after modifying standard/rules/skills files.
125
- - 01.standard-sync.md — Remind AI to update corresponding rule when standard is modified
126
- - 02.rules-sync.md Remind AI to update corresponding standard when rules are modified
127
- - 03.skills-sync.md Remind AI to update MANIFEST.md when skills are modified
135
+ - 01.doc-sync.md — Bidirectional standard rules sync reminder (both directions in ONE rule).
136
+ Do NOT generate a separate 02.rules-sync.md mirror file redundant.
137
+ Express the mapping as a naming convention (standard/<N>.<dir>/<M>.<n>.md
138
+ .claude/rules/<N>.<dir>/<M>.<n>-rules.md), NOT a hardcoded file-to-file table.
139
+ - 02.skills-sync.md — Remind AI to update MANIFEST.md when skills are modified
128
140
 
129
141
  5. claudeos-core/skills/ (active domains only)
130
142
  - 10.backend-crud/01.scaffold-crud-feature.md (orchestrator)
@@ -22,17 +22,30 @@ Determine from pass2-merged.json which layer (route handler vs service layer) fo
22
22
  the response. This MUST be identical across architecture.md, route-patterns.md,
23
23
  and all rules files.
24
24
 
25
- CRITICAL — CLAUDE.md Reference Table Completeness:
26
- The reference table in CLAUDE.md MUST list ALL generated standard files.
27
-
28
25
  Generation targets:
29
26
 
30
27
  1. CLAUDE.md (project root)
31
- - Role definition (based on detected stack — Flask)
32
- - Build & Run Commands (pip/poetry, flask run, gunicorn, docker)
33
- - Core architecture diagram (application factory, Blueprint structure)
34
- - Module structure
35
- - Standard/Skills/Guide reference table
28
+
29
+ Follow the scaffold EXACTLY:
30
+ → `pass-prompts/templates/common/claude-md-scaffold.md`
31
+
32
+ The scaffold enforces an 8-section deterministic structure:
33
+ 1. Role Definition → 2. Project Overview → 3. Build & Run Commands →
34
+ 4. Core Architecture → 5. Directory Structure → 6. Standard / Rules / Skills Reference →
35
+ 7. DO NOT Read → 8. Common Rules & Memory (L4)
36
+
37
+ All section titles, order, and formats are FIXED by the scaffold.
38
+ Content within each section adapts to this project based on pass2-merged.json.
39
+ The scaffold's validation checklist MUST pass.
40
+
41
+ Stack-specific hints for this project (Python Flask):
42
+ - Project type for Section 1 PROJECT_CONTEXT: "Lightweight Web Application" or "REST API Server"
43
+ (reflect the application factory pattern and Blueprint structure)
44
+ - Architecture diagram (Section 4): application factory → Blueprint → route → service,
45
+ request lifecycle
46
+ - Section 3 commands: pip/poetry install, flask run (dev), gunicorn (production), docker
47
+ - Module structure: reflect in Section 5 tree (blueprints/, models/, services/)
48
+ - Detect SQLAlchemy/marshmallow/WTForms and reflect in Section 2
36
49
 
37
50
  2. claudeos-core/standard/ (active domains only)
38
51
  - 00.core/01.project-overview.md — Stack, modules, server info
@@ -64,14 +77,19 @@ Generation targets:
64
77
  - `00.core/*` rules: `paths: ["**/*"]`
65
78
  - `10.backend/*` rules: `paths: ["**/*"]`
66
79
  - `30.security-db/*` rules: `paths: ["**/*"]`
67
- - `40.infra/*` rules: `paths: ["**/*.json", "**/*.env*", "**/*.cfg", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]`
80
+ - `40.infra/01.environment-config-rules.md` paths: `["**/.env*", "**/config.py", "**/config/**", "**/*.cfg", "**/*.toml"]` — env / Flask config
81
+ - `40.infra/02.logging-monitoring-rules.md` paths: `["**/*.py"]` — source code where logs live
82
+ - `40.infra/03.cicd-deployment-rules.md` paths: `["**/*.yml", "**/*.yaml", "**/Dockerfile*", "**/*.py"]` — CI / deploy config + source
68
83
  - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]`
84
+ - `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.
69
85
  - MUST generate `.claude/rules/00.core/00.standard-reference.md` — directory of all standard files
70
86
 
71
- 4. .claude/rules/50.sync/ (3 sync rules)
72
- - 01.standard-sync.md
73
- - 02.rules-sync.md
74
- - 03.skills-sync.md
87
+ 4. .claude/rules/50.sync/ (2 sync rules)
88
+ - 01.doc-sync.md — Bidirectional standard ↔ rules sync reminder (both directions in ONE rule).
89
+ Do NOT generate a separate 02.rules-sync.md mirror file — redundant.
90
+ Express the mapping as a naming convention (standard/<N>.<dir>/<M>.<n>.md
91
+ .claude/rules/<N>.<dir>/<M>.<n>-rules.md), NOT a hardcoded file-to-file table.
92
+ - 02.skills-sync.md — Remind AI to update MANIFEST.md when skills are modified
75
93
 
76
94
  5. claudeos-core/skills/ (active domains only)
77
95
  - 10.backend-crud/01.scaffold-crud-feature.md (orchestrator)
@@ -17,17 +17,31 @@ CRITICAL — Code Example Accuracy:
17
17
  ALL code examples MUST use EXACT method names, class names, and signatures from pass2-merged.json.
18
18
  Do NOT paraphrase, rename, or infer API names.
19
19
 
20
- CRITICAL — CLAUDE.md Reference Table Completeness:
21
- The reference table in CLAUDE.md MUST list ALL generated standard files.
22
-
23
20
  Generation targets:
24
21
 
25
22
  1. CLAUDE.md (project root)
26
- - Role definition (Vue/Nuxt frontend developer)
27
- - Build & Run Commands (use ONLY the detected packageManager)
28
- - Core architecture diagram
29
- - Directory structure description
30
- - Standard/Skills/Guide reference table
23
+
24
+ Follow the scaffold EXACTLY:
25
+ → `pass-prompts/templates/common/claude-md-scaffold.md`
26
+
27
+ The scaffold enforces an 8-section deterministic structure:
28
+ 1. Role Definition → 2. Project Overview → 3. Build & Run Commands →
29
+ 4. Core Architecture → 5. Directory Structure → 6. Standard / Rules / Skills Reference →
30
+ 7. DO NOT Read → 8. Common Rules & Memory (L4)
31
+
32
+ All section titles, order, and formats are FIXED by the scaffold.
33
+ Content within each section adapts to this project based on pass2-merged.json.
34
+ The scaffold's validation checklist MUST pass.
35
+
36
+ Stack-specific hints for this project (Vue / Nuxt):
37
+ - Project type for Section 1 PROJECT_CONTEXT: when Nuxt is detected, "Full-stack Web Application"
38
+ or "SSR/SSG-based SPA"; when pure Vue is detected, "Vue SPA"
39
+ - Architecture diagram (Section 4): component hierarchy, data flow (useFetch/useAsyncData),
40
+ Nuxt projects include a Nitro server layer
41
+ - Use ONLY the detected packageManager in Section 3
42
+ - Directory structure (Section 5): Nuxt uses auto-routing-based pages/,
43
+ Vue uses an explicit router-config file structure
44
+ - Detect the state-management approach (Pinia vs Composables) and reflect in Section 4 Core Patterns
31
45
 
32
46
  2. claudeos-core/standard/ (active domains only)
33
47
  - 00.core/01.project-overview.md — Stack, routing approach, deployment environment
@@ -61,14 +75,19 @@ Generation targets:
61
75
  - `10.backend/*` rules: `paths: ["**/*"]`
62
76
  - `20.frontend/*` rules: `paths: ["**/*"]`
63
77
  - `30.security-db/*` rules: `paths: ["**/*"]`
64
- - `40.infra/*` rules: `paths: ["**/*.json", "**/*.env*", "**/nuxt.config.*", "**/vite.config.*", "**/Dockerfile*", "**/*.yml", "**/*.yaml"]`
78
+ - `40.infra/01.environment-config-rules.md` paths: `["**/.env*", "**/nuxt.config.*", "**/vite.config.*", "**/*.json"]` — env / Nuxt/Vite config
79
+ - `40.infra/02.logging-monitoring-rules.md` paths: `["**/*.ts", "**/*.tsx", "**/*.vue", "**/*.js"]` — source code (including SFC) where logs live
80
+ - `40.infra/03.cicd-deployment-rules.md` paths: `["**/*.yml", "**/*.yaml", "**/Dockerfile*", "**/*.ts", "**/*.vue"]` — CI config + source
65
81
  - `50.sync/*` rules: `paths: ["**/claudeos-core/**", "**/.claude/**"]`
82
+ - `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.
66
83
  - MUST generate `.claude/rules/00.core/00.standard-reference.md` — directory of all standard files
67
84
 
68
- 4. .claude/rules/50.sync/ (3 sync rules)
69
- - 01.standard-sync.md
70
- - 02.rules-sync.md
71
- - 03.skills-sync.md
85
+ 4. .claude/rules/50.sync/ (2 sync rules)
86
+ - 01.doc-sync.md — Bidirectional standard ↔ rules sync reminder (both directions in ONE rule).
87
+ Do NOT generate a separate 02.rules-sync.md mirror file — redundant.
88
+ Express the mapping as a naming convention (standard/<N>.<dir>/<M>.<n>.md
89
+ .claude/rules/<N>.<dir>/<M>.<n>-rules.md), NOT a hardcoded file-to-file table.
90
+ - 02.skills-sync.md — Remind AI to update MANIFEST.md when skills are modified
72
91
 
73
92
  5. claudeos-core/skills/ (active domains only)
74
93
  - 20.frontend-page/01.scaffold-page-feature.md (orchestrator)
@@ -91,6 +91,14 @@ async function main() {
91
91
  console.log();
92
92
 
93
93
  // Save outputs
94
+ //
95
+ // Port resolution precedence (stack.port):
96
+ // 1. stack.port already set by stack-detector (Spring application.yml
97
+ // server.port, or .env file PORT variable) — highest authority.
98
+ // 2. defaultPort fallback below — framework convention, only used when
99
+ // the project declares no port of its own. This is a last-resort
100
+ // default; prefer that stack-detector extract it from .env.example
101
+ // to keep CLAUDE.md truthful to what the project actually runs.
94
102
  const defaultPort = (stack.framework === "fastapi" || stack.framework === "django") ? 8000
95
103
  : stack.framework === "flask" ? 5000
96
104
  : stack.framework === "vite" ? 5173
@@ -37,6 +37,23 @@ function generatePrompts(templates, lang, templatesDir, generatedDir) {
37
37
  const phase1Path = path.join(commonDir, "pass3-phase1.md");
38
38
  const phase1 = existsSafe(phase1Path) ? readFileSafe(phase1Path) + "\n" : "";
39
39
 
40
+ // v2.2: CLAUDE.md Scaffold — the 8-section deterministic template for CLAUDE.md.
41
+ // Embedded inline (not referenced by path) because the prompt runs in the user's
42
+ // project directory where the scaffold file does not exist. Stack-specific pass3
43
+ // templates and pass3-footer both reference "pass-prompts/templates/common/
44
+ // claude-md-scaffold.md" in their instructions, and this embed makes that
45
+ // reference resolvable via in-context content. Wrapped in explicit delimiters
46
+ // so the LLM can reliably locate the scaffold block.
47
+ const scaffoldPath = path.join(commonDir, "claude-md-scaffold.md");
48
+ const scaffold = existsSafe(scaffoldPath)
49
+ ? "\n---\n\n# === EMBEDDED: claude-md-scaffold.md ===\n\n"
50
+ + "The content below is the scaffold referenced by stack-specific sections\n"
51
+ + "and the Pass 3 footer. Treat this embedded block as the authoritative\n"
52
+ + "source when instructions mention `pass-prompts/templates/common/claude-md-scaffold.md`.\n\n"
53
+ + readFileSafe(scaffoldPath)
54
+ + "\n\n# === END EMBEDDED: claude-md-scaffold.md ===\n\n---\n\n"
55
+ : "";
56
+
40
57
  let langInstruction = "";
41
58
  if (lang && lang !== "en" && existsSafe(langPath)) {
42
59
  const langData = readJsonSafe(langPath);
@@ -100,7 +117,7 @@ function generatePrompts(templates, lang, templatesDir, generatedDir) {
100
117
 
101
118
  writeFileSafe(
102
119
  path.join(generatedDir, "pass3-prompt.md"),
103
- header + langInstruction + stagingOverride + phase1 + combinedBody.trimEnd() + "\n" + footer
120
+ header + langInstruction + stagingOverride + phase1 + scaffold + combinedBody.trimEnd() + "\n" + footer
104
121
  );
105
122
  console.log(` ✅ pass3-prompt.md${templates.frontend && templates.backend ? " (multi-stack combined)" : ""}`);
106
123
  }
@@ -9,6 +9,7 @@
9
9
  const path = require("path");
10
10
  const { glob } = require("glob");
11
11
  const { readFileSafe, readJsonSafe, existsSafe } = require("../lib/safe-fs");
12
+ const { readStackEnvInfo } = require("../lib/env-parser");
12
13
 
13
14
  // ─── Lookup tables ──────────────────────────────────────────────
14
15
 
@@ -460,6 +461,21 @@ async function detectStack(ROOT) {
460
461
  }
461
462
  }
462
463
 
464
+ // ── .env-derived factual config ──
465
+ // Read .env.example (preferred) or .env to capture ports/hosts/API targets
466
+ // the project actually declares. This overrides framework-default guesses
467
+ // in downstream code (plan-installer/index.js defaultPort) and exposes the
468
+ // full variable map to Pass 3 prompts via project-analysis.json.
469
+ const envInfo = readStackEnvInfo(ROOT);
470
+ if (envInfo) {
471
+ stack.envInfo = envInfo;
472
+ // Promote .env-declared port to stack.port if no earlier detection won
473
+ // (e.g., Spring application.yml parsing at line 407).
474
+ if (!stack.port && envInfo.port) {
475
+ stack.port = envInfo.port;
476
+ }
477
+ }
478
+
463
479
  return stack;
464
480
  }
465
481