claudeos-core 1.7.0 → 2.0.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 +138 -0
- package/CONTRIBUTING.md +92 -59
- package/README.de.md +465 -240
- package/README.es.md +446 -223
- package/README.fr.md +461 -238
- package/README.hi.md +485 -261
- package/README.ja.md +440 -235
- package/README.ko.md +244 -56
- package/README.md +215 -47
- package/README.ru.md +462 -238
- package/README.vi.md +454 -230
- package/README.zh-CN.md +476 -252
- package/bin/cli.js +144 -140
- package/bin/commands/init.js +550 -46
- package/bin/commands/memory.js +426 -0
- package/bin/lib/cli-utils.js +206 -143
- package/bootstrap.sh +81 -390
- package/content-validator/index.js +436 -340
- package/lib/expected-guides.js +23 -0
- package/lib/expected-outputs.js +91 -0
- package/lib/language-config.js +35 -0
- package/lib/memory-scaffold.js +1014 -0
- package/lib/plan-parser.js +153 -149
- package/lib/staged-rules.js +118 -0
- package/manifest-generator/index.js +176 -171
- package/package.json +1 -1
- package/pass-json-validator/index.js +337 -299
- package/pass-prompts/templates/common/pass3-footer.md +16 -0
- package/pass-prompts/templates/common/pass4.md +317 -0
- package/pass-prompts/templates/common/staging-override.md +26 -0
- package/pass-prompts/templates/python-flask/pass1.md +119 -0
- package/pass-prompts/templates/python-flask/pass2.md +85 -0
- package/pass-prompts/templates/python-flask/pass3.md +103 -0
- package/plan-installer/domain-grouper.js +2 -1
- package/plan-installer/prompt-generator.js +120 -96
- package/plan-installer/scanners/scan-frontend.js +219 -10
- package/plan-installer/scanners/scan-java.js +226 -223
- package/plan-installer/scanners/scan-python.js +21 -0
- package/sync-checker/index.js +133 -132
|
@@ -13,6 +13,22 @@ Examples of violations:
|
|
|
13
13
|
- Assuming React Query exists because Orval was detected (inference is NOT detection)
|
|
14
14
|
When in doubt, omit. Missing content is fixable; hallucinated content erodes trust.
|
|
15
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
|
+
|
|
16
32
|
CRITICAL — Skill Orchestrator Completeness:
|
|
17
33
|
The orchestrator file (e.g., 01.scaffold-page-feature.md, 01.scaffold-crud-feature.md)
|
|
18
34
|
MUST list ALL sub-skill files in its execution order table with no gaps.
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Pass 4 — L4 Memory & Feedback Layer
|
|
2
|
+
|
|
3
|
+
You are generating the initial scaffolding for the L4 Memory layer on top of the
|
|
4
|
+
existing ClaudeOS-Core output. Read these two files to understand the project:
|
|
5
|
+
|
|
6
|
+
- `{{PROJECT_ROOT}}/claudeos-core/generated/project-analysis.json`
|
|
7
|
+
- `{{PROJECT_ROOT}}/claudeos-core/generated/pass2-merged.json`
|
|
8
|
+
|
|
9
|
+
Then generate the files listed below **exactly as specified**. Do NOT invent
|
|
10
|
+
additional files. Do NOT modify existing Pass 3 output in `standard/`, `skills/`,
|
|
11
|
+
`guide/`, `plan/`, `database/`, `mcp-guide/`.
|
|
12
|
+
|
|
13
|
+
You **WILL** create new rule files in `.claude/rules/60.memory/`,
|
|
14
|
+
and **append** a new section to the existing `CLAUDE.md`.
|
|
15
|
+
|
|
16
|
+
**Language rule:** All generated content (rule descriptions, CLAUDE.md append section,
|
|
17
|
+
compaction categories, decision-log seeds) must be written in **{{LANG_NAME}}**.
|
|
18
|
+
Frontmatter keys (`name`, `paths`) and file paths remain in English.
|
|
19
|
+
|
|
20
|
+
Memory scaffold files (sections 1–4) follow these rules:
|
|
21
|
+
- **Headings and description text** may be written in **{{LANG_NAME}}**.
|
|
22
|
+
- **CLI-parsed keywords MUST remain in English** (the CLI parses these literally):
|
|
23
|
+
- `## Last Compaction` (compaction.md section heading)
|
|
24
|
+
- `frequency:`, `importance:`, `last seen:` (failure-patterns.md field keys)
|
|
25
|
+
- `fix` or `solution` (failure-patterns.md fix line detection)
|
|
26
|
+
- **Title lines** (`# Decision Log`, `# Failure Patterns`, etc.) may be translated.
|
|
27
|
+
- **Instructional text** should be translated.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Required output — L4 Memory (`{{PROJECT_ROOT}}/claudeos-core/memory/`)
|
|
32
|
+
|
|
33
|
+
### 1. `memory/decision-log.md`
|
|
34
|
+
Start with the template below, then **append 3–5 seed entries** extracted from
|
|
35
|
+
`pass2-merged.json` that represent foundational architectural decisions already
|
|
36
|
+
made in this codebase. Each seed entry must be grounded in evidence from
|
|
37
|
+
pass2-merged.json — do NOT invent decisions.
|
|
38
|
+
Write the **title** (`# Decision Log`), the **descriptive italics** below it, and the seed entry **body text** in **{{LANG_NAME}}**. Keep the format specification's inline code literal (`## YYYY-MM-DD — <Title>`, `Context / Options / Decision / Consequences`).
|
|
39
|
+
|
|
40
|
+
Template header (translate the title and italics):
|
|
41
|
+
```markdown
|
|
42
|
+
# Decision Log
|
|
43
|
+
|
|
44
|
+
_Permanent record of "why" behind design choices. Append-only._
|
|
45
|
+
_Format: `## YYYY-MM-DD — <Title>` then Context / Options / Decision / Consequences._
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Seed entry format (for each of the 3–5 seeds, dated today in `YYYY-MM-DD` format
|
|
49
|
+
— use the current UTC date; do NOT leave a literal placeholder):
|
|
50
|
+
```markdown
|
|
51
|
+
## <YYYY-MM-DD> — <Short title of the architectural choice>
|
|
52
|
+
|
|
53
|
+
- **Context:** <what in pass2-merged.json this is grounded on>
|
|
54
|
+
- **Options considered:** <optional — list if pass2-merged mentions alternatives>
|
|
55
|
+
- **Decision:** <the pattern observed>
|
|
56
|
+
- **Consequences:** <what this locks in for future work>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 2. `memory/failure-patterns.md`
|
|
60
|
+
Write the title and descriptive italics in **{{LANG_NAME}}**. Keep CLI commands (`npx claudeos-core memory score`) literal. In the `_Format:` italics line, keep the format keywords `Frequency`, `Last Seen`, `Importance`, `Fix` literal in English (these names reappear as parsed field keys `frequency:`, `last seen:`, `importance:`, `fix:` in actual entries, and the memory CLI parser depends on that spelling surviving). Baseline template (translate the prose parts):
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
# Failure Patterns
|
|
64
|
+
|
|
65
|
+
_Recurring errors and their fixes. Importance auto-scored by `npx claudeos-core memory score`._
|
|
66
|
+
_Format: `## <pattern-id>` with Frequency / Last Seen / Importance / Fix._
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Do NOT add any seed entries — this file fills up as failures are encountered.
|
|
70
|
+
|
|
71
|
+
### 3. `memory/compaction.md`
|
|
72
|
+
Write the full compaction strategy document. Adapt it to this project:
|
|
73
|
+
- Include a "Project-specific error categories" section listing 2–4 categories
|
|
74
|
+
based on the detected stack (e.g., for Kotlin: "Kotlin compilation errors",
|
|
75
|
+
"Gradle build failures"; for Python: "Import errors", "Virtualenv drift").
|
|
76
|
+
- Write the project-specific categories section in **{{LANG_NAME}}**.
|
|
77
|
+
|
|
78
|
+
**Translate into {{LANG_NAME}}**: the title (`# Compaction Strategy`), descriptive italics, all `##`/`###` section headings (`Preservation Priority`, `Stages`, `Stage 1 — Summarize aged entries`, `Stage 2 — Merge duplicate patterns`, `Stage 3 — Drop low-importance entries`, `Stage 4 — Enforce file size cap`, `Project-specific error categories`), and the prose explanations under each heading (including bullet-point explanations like "Keep: pattern-id, frequency, one-line fix summary").
|
|
79
|
+
|
|
80
|
+
**Keep literal (do NOT translate)**: the `## Last Compaction` heading (CLI-parsed verbatim), all inline code values (`importance >= 7`, `lastSeen`, `frequency = sum`, `fix`, `rule-manifest.json`, `decision-log.md`, `failure-patterns.md`), and all CLI commands (`npx claudeos-core memory compact`).
|
|
81
|
+
|
|
82
|
+
Baseline template (translate per above, then append the project-specific section at the end):
|
|
83
|
+
```markdown
|
|
84
|
+
# Compaction Strategy
|
|
85
|
+
|
|
86
|
+
_4-stage compaction rules for `decision-log.md` and `failure-patterns.md`._
|
|
87
|
+
_Run via `npx claudeos-core memory compact`._
|
|
88
|
+
|
|
89
|
+
## Preservation Priority
|
|
90
|
+
Entries are preserved if ANY of:
|
|
91
|
+
- `importance >= 7`
|
|
92
|
+
- `lastSeen` within 30 days
|
|
93
|
+
- Referenced by an active rule (path listed in rule-manifest.json)
|
|
94
|
+
|
|
95
|
+
## Stages
|
|
96
|
+
|
|
97
|
+
### Stage 1 — Summarize aged entries
|
|
98
|
+
Entries older than 30 days with no recent reference are summarized:
|
|
99
|
+
- Keep: pattern-id, frequency, one-line fix summary
|
|
100
|
+
- Drop: verbose context, full stack traces
|
|
101
|
+
|
|
102
|
+
### Stage 2 — Merge duplicate patterns
|
|
103
|
+
Failure entries with the same root cause are merged:
|
|
104
|
+
- `frequency = sum`
|
|
105
|
+
- `lastSeen = max`
|
|
106
|
+
- `fix` unified to the most recent working solution
|
|
107
|
+
|
|
108
|
+
### Stage 3 — Drop low-importance entries
|
|
109
|
+
Entries with `importance < 3` AND `lastSeen > 60 days` are removed.
|
|
110
|
+
|
|
111
|
+
### Stage 4 — Enforce file size cap
|
|
112
|
+
Each target file is capped at 400 lines.
|
|
113
|
+
When exceeded, the oldest (by `lastSeen`) low-importance entries are dropped first.
|
|
114
|
+
|
|
115
|
+
## Project-specific error categories
|
|
116
|
+
<2–4 categories based on the detected stack, written in {{LANG_NAME}}>
|
|
117
|
+
|
|
118
|
+
## Last Compaction
|
|
119
|
+
(never — run `npx claudeos-core memory compact`)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 4. `memory/auto-rule-update.md`
|
|
123
|
+
Write the title, descriptive italics, "How to apply" heading, the 3 how-to-apply steps, the "Proposals" heading, and the placeholder line in **{{LANG_NAME}}**. Keep CLI commands (`npx claudeos-core memory propose-rules`), file references (`decision-log.md`), and inline code literal. Baseline template (translate the prose parts):
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
# Auto Rule Update Proposals
|
|
127
|
+
|
|
128
|
+
_Generated by `npx claudeos-core memory propose-rules`._
|
|
129
|
+
_Each proposal: failure pattern → affected rule → diff → confidence._
|
|
130
|
+
|
|
131
|
+
## How to apply
|
|
132
|
+
1. Review each proposal below.
|
|
133
|
+
2. If accepted, edit the affected rule file and commit.
|
|
134
|
+
3. Move the accepted proposal into `decision-log.md` as a record.
|
|
135
|
+
|
|
136
|
+
## Proposals
|
|
137
|
+
(none yet — run `npx claudeos-core memory propose-rules` after accumulating failure patterns)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Required output — Rules (`.claude/rules/`)
|
|
143
|
+
|
|
144
|
+
Generate 6 rule files. Each file must include YAML frontmatter (`name`, `paths`) and markdown body.
|
|
145
|
+
**Frontmatter values stay in English; all body text (bullet points, descriptions, section headings like `## Reference`) MUST be written in {{LANG_NAME}}.** Keep literal in English: file paths, CLI commands, inline code (`` `...` ``), and the CLI-parsed field names (`frequency:`, `last seen:`, `importance:`, `fix:`) when they appear in examples.
|
|
146
|
+
|
|
147
|
+
### 5. `.claude/rules/00.core/51.doc-writing-rules.md`
|
|
148
|
+
Frontmatter: `name: Document Writing Rules`, `paths: ["**/*"]`
|
|
149
|
+
Body (write in **{{LANG_NAME}}**) must cover:
|
|
150
|
+
- [CRITICAL] Rules file paths frontmatter required — every `.claude/rules/` file must have `paths` in frontmatter, do not propose narrowing `**/*` to specific patterns
|
|
151
|
+
- [CRITICAL] No domain-specific or path hardcoding in rules; use generic placeholder patterns
|
|
152
|
+
- [CRITICAL] Code examples must mirror actual project structure (verify directory paths before writing examples)
|
|
153
|
+
- Topic repetition across rules/standard is intentional reinforcement, not duplication
|
|
154
|
+
- Planned references (paths that don't yet exist) are forward declarations; do not flag them as missing
|
|
155
|
+
- `## Reference` section at the end linking to corresponding standard files
|
|
156
|
+
|
|
157
|
+
### 6. `.claude/rules/00.core/52.ai-work-rules.md`
|
|
158
|
+
Frontmatter: `name: AI Work Rules`, `paths: ["**/*"]`
|
|
159
|
+
Body (write in **{{LANG_NAME}}**) must cover:
|
|
160
|
+
- Accuracy over token saving; verify before claiming
|
|
161
|
+
- 13 hallucination prevention patterns (see memory-scaffold static fallback for reference list)
|
|
162
|
+
- No unsolicited suggestions; ask when unsure
|
|
163
|
+
- Memory vs Rules — no duplication judgment (Memory is on-demand, Rules are auto-loaded)
|
|
164
|
+
- Planned references — no "missing" judgment
|
|
165
|
+
- Code/document generation accuracy — check actual source before guessing field names
|
|
166
|
+
|
|
167
|
+
### 7. `.claude/rules/60.memory/01.decision-log.md`
|
|
168
|
+
Frontmatter: `name: Decision Log`, `paths: ["claudeos-core/memory/decision-log.md"]`
|
|
169
|
+
Body (write in **{{LANG_NAME}}**): read timing (session start + before architectural changes), write timing
|
|
170
|
+
(competing patterns / library choice / convention / NOT doing something),
|
|
171
|
+
entry format (ISO date heading + Context / Options / Decision / Consequences),
|
|
172
|
+
append-only rule.
|
|
173
|
+
|
|
174
|
+
### 8. `.claude/rules/60.memory/02.failure-patterns.md`
|
|
175
|
+
Frontmatter: `name: Failure Patterns`, `paths: ["claudeos-core/memory/failure-patterns.md"]`
|
|
176
|
+
Body (write in **{{LANG_NAME}}**): read timing (session start + encountering an error), write timing (2nd occurrence +
|
|
177
|
+
non-obvious root cause + undocumented workaround), entry format with
|
|
178
|
+
**frequency**, **last seen**, **symptoms**, **root cause**, **fix** fields (keep these field names literal in English when showing example entries; prose explanations around them translate).
|
|
179
|
+
Never delete entries manually — use `npx claudeos-core memory compact`.
|
|
180
|
+
|
|
181
|
+
### 9. `.claude/rules/60.memory/03.compaction.md`
|
|
182
|
+
Frontmatter: `name: Compaction Strategy`, `paths: ["claudeos-core/memory/compaction.md"]`
|
|
183
|
+
Body (write in **{{LANG_NAME}}**): reference to the 4 stages and preservation rules. Do NOT edit unless intentionally
|
|
184
|
+
changing the compaction policy; do NOT run compaction logic manually — always use the CLI.
|
|
185
|
+
|
|
186
|
+
### 10. `.claude/rules/60.memory/04.auto-rule-update.md`
|
|
187
|
+
Frontmatter: `name: Auto Rule Update`, `paths: ["claudeos-core/memory/auto-rule-update.md"]`
|
|
188
|
+
Body (write in **{{LANG_NAME}}**): machine-generated proposals; review → accept → edit rule → record in decision-log.
|
|
189
|
+
Proposals with confidence >= 0.70 deserve serious consideration. Do NOT edit proposals directly.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Required output — Master plan (`{{PROJECT_ROOT}}/claudeos-core/plan/`)
|
|
194
|
+
|
|
195
|
+
### 11. `plan/50.memory-master.md`
|
|
196
|
+
Master plan aggregating all 4 memory files using the `<file path="...">` format.
|
|
197
|
+
Include the full content of each memory file (including the seed decision-log entries
|
|
198
|
+
and project-specific compaction categories).
|
|
199
|
+
|
|
200
|
+
Write the plan's **title** (e.g., `# 50. Memory Master Plan`) and any **introductory sentence** before the `<file>` blocks in **{{LANG_NAME}}**. Inside each `<file path="...">` block, include the already-translated memory file content verbatim — do NOT re-translate or modify it.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Required output — CLAUDE.md append
|
|
205
|
+
|
|
206
|
+
### 12. Append a new section to existing `CLAUDE.md`
|
|
207
|
+
|
|
208
|
+
Do NOT overwrite existing CLAUDE.md content — **append only** at the end.
|
|
209
|
+
The new section must include the `(L4)` marker in its top heading (the marker
|
|
210
|
+
is language-independent so the CLI fallback can detect it). For example, English:
|
|
211
|
+
`## Memory (L4)`, Korean: `## 메모리 (L4)`.
|
|
212
|
+
|
|
213
|
+
Include:
|
|
214
|
+
- Common rules table (references to `00.core/51.doc-writing-rules.md` and `52.ai-work-rules.md`)
|
|
215
|
+
- L4 Memory table with 4 files (decision-log, failure-patterns, compaction, auto-rule-update)
|
|
216
|
+
— include Purpose and Action columns
|
|
217
|
+
- Master plan reference (`claudeos-core/plan/50.memory-master.md`)
|
|
218
|
+
- Memory workflow (6 numbered steps: scan failure-patterns at session start →
|
|
219
|
+
skim recent decision-log → record decisions → record repeat errors →
|
|
220
|
+
periodic `memory compact` → review `auto-rule-update.md` proposals)
|
|
221
|
+
|
|
222
|
+
Write this section in **{{LANG_NAME}}**, but keep the `(L4)` heading marker,
|
|
223
|
+
file paths, and CLI command names in English.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Required output — Standard (`{{PROJECT_ROOT}}/claudeos-core/standard/00.core/`)
|
|
228
|
+
|
|
229
|
+
### 13. `claudeos-core/standard/00.core/XX.doc-writing-guide.md`
|
|
230
|
+
Scan `claudeos-core/standard/00.core/` for existing numbered files. Use the **next sequential number**
|
|
231
|
+
(e.g., if `01`, `02`, `03` exist, create `04.doc-writing-guide.md`).
|
|
232
|
+
|
|
233
|
+
This is the **detailed guide** corresponding to `.claude/rules/00.core/51.doc-writing-rules.md`.
|
|
234
|
+
Write entirely in **{{LANG_NAME}}**.
|
|
235
|
+
|
|
236
|
+
Body must cover:
|
|
237
|
+
1. **Document layer structure** — table with Layer/Path/Role/Loading for CLAUDE.md, Rules, Standard, Skills, Memory, Master Plan. Include a relationship diagram showing CLAUDE.md → Rules → Standard flow.
|
|
238
|
+
2. **Rules file writing rules** — paths frontmatter required, paths scope settings table, file structure template with `## Reference` section. Do not propose narrowing `**/*`.
|
|
239
|
+
3. **Standard file writing rules** — long files are normal, file naming (`number.name.md`), register in `00.standard-reference.md`.
|
|
240
|
+
4. **Skills file writing rules** — MANIFEST.md registration, paths frontmatter in generated rules, verify reference paths.
|
|
241
|
+
5. **Planned references** — paths that don't yet exist are forward declarations. Do not label as missing/stale/dead.
|
|
242
|
+
6. **Multi-layer defensive rule placement is intentional** — repetition across Rules files is reinforcement, not duplication. Do not propose consolidation.
|
|
243
|
+
7. **Topic repetition is not duplication** — same topic in CLAUDE.md + Rules + Standard serves different layer/domain roles. Trivial expression differences are not inconsistency risks.
|
|
244
|
+
8. **No domain-specific hardcoding** — use generic placeholder patterns.
|
|
245
|
+
9. **No system absolute path hardcoding** — use relative paths, include ❌/✅ examples.
|
|
246
|
+
10. **Code examples must follow project conventions** — verify directory structure, follow project naming conventions.
|
|
247
|
+
11. **Change synchronization procedure** — table showing Standard→Rules+Plan, Rules→Plan, Skills→MANIFEST+Plan sync targets.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Completion marker
|
|
252
|
+
|
|
253
|
+
After all files are written, create:
|
|
254
|
+
|
|
255
|
+
`{{PROJECT_ROOT}}/claudeos-core/generated/pass4-memory.json`
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"analyzedAt": "<ISO timestamp>",
|
|
260
|
+
"passNum": 4,
|
|
261
|
+
"memoryFiles": [
|
|
262
|
+
"claudeos-core/memory/decision-log.md",
|
|
263
|
+
"claudeos-core/memory/failure-patterns.md",
|
|
264
|
+
"claudeos-core/memory/compaction.md",
|
|
265
|
+
"claudeos-core/memory/auto-rule-update.md"
|
|
266
|
+
],
|
|
267
|
+
"ruleFiles": [
|
|
268
|
+
".claude/rules/00.core/51.doc-writing-rules.md",
|
|
269
|
+
".claude/rules/00.core/52.ai-work-rules.md",
|
|
270
|
+
".claude/rules/60.memory/01.decision-log.md",
|
|
271
|
+
".claude/rules/60.memory/02.failure-patterns.md",
|
|
272
|
+
".claude/rules/60.memory/03.compaction.md",
|
|
273
|
+
".claude/rules/60.memory/04.auto-rule-update.md"
|
|
274
|
+
],
|
|
275
|
+
"planFiles": [
|
|
276
|
+
"claudeos-core/plan/50.memory-master.md"
|
|
277
|
+
],
|
|
278
|
+
"standardFiles": [
|
|
279
|
+
"claudeos-core/standard/00.core/XX.doc-writing-guide.md"
|
|
280
|
+
],
|
|
281
|
+
"claudeMdAppended": true,
|
|
282
|
+
"seededDecisions": <integer count of seed entries written to decision-log.md>
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Guardrails
|
|
289
|
+
|
|
290
|
+
- Do NOT modify existing Pass 3 output files in `claudeos-core/standard/` (except adding the new doc-writing-guide),
|
|
291
|
+
`claudeos-core/skills/`, `claudeos-core/guide/`, `claudeos-core/database/`,
|
|
292
|
+
`claudeos-core/mcp-guide/`.
|
|
293
|
+
- Do NOT modify existing `.claude/rules/00.core/00.*` through `.claude/rules/00.core/02.*` files (Pass 3 output).
|
|
294
|
+
- Do NOT modify existing `.claude/rules/10.backend/` through `.claude/rules/50.sync/` files.
|
|
295
|
+
- DO create `.claude/rules/00.core/51.doc-writing-rules.md` and `.claude/rules/00.core/52.ai-work-rules.md` (Pass 4 output).
|
|
296
|
+
- DO create `claudeos-core/standard/00.core/XX.doc-writing-guide.md` with the next sequential number (Pass 4 output).
|
|
297
|
+
- Do NOT overwrite existing CLAUDE.md content — **append only**.
|
|
298
|
+
- Do NOT translate CLI-parsed keywords in memory files: `## Last Compaction`, `frequency:`, `importance:`, `last seen:`, `fix`, `solution`.
|
|
299
|
+
- DO translate all other text in memory files (titles, descriptions, instructions) into **{{LANG_NAME}}**.
|
|
300
|
+
- DO write rule files (sections 5–10), standard file (section 13), and CLAUDE.md append section in **{{LANG_NAME}}**.
|
|
301
|
+
- Keep seed decision-log entries **grounded** in pass2-merged.json only. No hallucination.
|
|
302
|
+
- Use the current date (UTC, YYYY-MM-DD) for dated headings — substitute the real date,
|
|
303
|
+
never leave `<YYYY-MM-DD>` or any placeholder-looking token as literal text.
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Output discipline (CRITICAL)
|
|
308
|
+
|
|
309
|
+
Do your work by writing files with the Write tool. When you finish, **end the conversation with a single short line only** — specifically:
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
Pass 4 complete.
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Do NOT print a summary of what you created. Do NOT list the files you wrote. Do NOT report files that you "failed" to write because of tool errors or permission issues — those errors are visible in the tool result stream already, and duplicating them in prose confuses the init pipeline downstream.
|
|
316
|
+
|
|
317
|
+
The init orchestrator verifies completion by checking that `{{PROJECT_ROOT}}/claudeos-core/generated/pass4-memory.json` exists — nothing you print to the console affects that check. A verbose summary is at best redundant, and at worst (e.g. when you say "failed to create X" but the file actually got written) actively misleads the user. Stay silent and trust the marker file.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
## CRITICAL — Write path redirect for `.claude/rules/` (tool-access workaround)
|
|
2
|
+
|
|
3
|
+
Claude Code's sensitive-path policy blocks direct writes under `.claude/` from this subprocess, even with `--dangerously-skip-permissions`. To work around this safely, all rule files must be written to a staging directory and the Node.js orchestrator will move them after you finish.
|
|
4
|
+
|
|
5
|
+
**Rule (overrides every instruction below):**
|
|
6
|
+
|
|
7
|
+
> Whenever the instructions below tell you to WRITE a file whose path starts with `.claude/rules/`, write it to `claudeos-core/generated/.staged-rules/` instead, **preserving the subpath exactly**.
|
|
8
|
+
|
|
9
|
+
Examples (write-target redirect, **subpath preserved**):
|
|
10
|
+
|
|
11
|
+
| Instruction says to write | You MUST write to |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `.claude/rules/00.core/00.standard-reference.md` | `claudeos-core/generated/.staged-rules/00.core/00.standard-reference.md` |
|
|
14
|
+
| `.claude/rules/10.backend/01.controller-rules.md` | `claudeos-core/generated/.staged-rules/10.backend/01.controller-rules.md` |
|
|
15
|
+
| `.claude/rules/50.sync/01.standard-sync.md` | `claudeos-core/generated/.staged-rules/50.sync/01.standard-sync.md` |
|
|
16
|
+
| `.claude/rules/60.memory/01.decision-log.md` | `claudeos-core/generated/.staged-rules/60.memory/01.decision-log.md` |
|
|
17
|
+
|
|
18
|
+
**Important clarifications:**
|
|
19
|
+
|
|
20
|
+
1. **Prose references stay as-is.** When the instructions or the file content you generate describe `.claude/rules/` as a concept ("Rules (.claude/rules/) and Standards...", "Each rule file in .claude/rules/ links to..."), keep that text literal. Only the **write-target file paths** are redirected. Generated file bodies will eventually live under `.claude/rules/`, so in-body references should point to the final location, not the staging location.
|
|
21
|
+
2. **Frontmatter `paths:` values stay as-is.** These are glob patterns scoped to project files (`"**/*"`, `"**/*.yml"`, etc.), not self-references.
|
|
22
|
+
3. **Do NOT attempt to write to `.claude/rules/` directly** — those writes will be refused by the tool.
|
|
23
|
+
4. **Create missing staging subdirectories as needed.** `claudeos-core/generated/` exists, but subpaths under `.staged-rules/` do not yet.
|
|
24
|
+
5. **This redirect applies to THIS Pass only.** Files written anywhere else (e.g. `claudeos-core/standard/`, `CLAUDE.md`, `claudeos-core/memory/`) are unaffected — write those to their intended paths as stated in the instructions below.
|
|
25
|
+
|
|
26
|
+
---
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Read claudeos-core/generated/project-analysis.json and
|
|
2
|
+
perform a deep analysis of the following domains only: {{DOMAIN_GROUP}}
|
|
3
|
+
|
|
4
|
+
For each domain, select one representative file per layer, read its code, and analyze it.
|
|
5
|
+
Prioritize files with the richest patterns.
|
|
6
|
+
|
|
7
|
+
Analysis items (per domain):
|
|
8
|
+
|
|
9
|
+
1. Route/Blueprint Patterns
|
|
10
|
+
- Blueprint structure (Blueprint registration, url_prefix, naming)
|
|
11
|
+
- Route decorators (@app.route, @bp.route with methods)
|
|
12
|
+
- URL patterns and naming conventions
|
|
13
|
+
- View function structure (function-based vs class-based MethodView)
|
|
14
|
+
- Request handling (request.args, request.form, request.json, request.files)
|
|
15
|
+
- Response patterns (jsonify, make_response, Response, redirect, abort)
|
|
16
|
+
- If a custom response wrapper exists, record its EXACT function/class name, EXACT import path
|
|
17
|
+
- **Response wrapping layer (CRITICAL)**: Which layer formats the response?
|
|
18
|
+
Does the route handler call it directly, or does a service layer return formatted data?
|
|
19
|
+
- Error handling (errorhandler, abort, custom exception classes)
|
|
20
|
+
- Authentication (flask-login, flask-jwt-extended, custom decorators)
|
|
21
|
+
- API documentation (flask-restx, flask-smorest, flasgger)
|
|
22
|
+
- Pagination patterns
|
|
23
|
+
|
|
24
|
+
2. Data Model Patterns
|
|
25
|
+
- ORM (SQLAlchemy, Flask-SQLAlchemy, Peewee)
|
|
26
|
+
- Model structure (db.Model, relationships, mixins)
|
|
27
|
+
- Serialization (marshmallow, flask-marshmallow, manual to_dict)
|
|
28
|
+
- Form validation (WTForms, Flask-WTF, manual)
|
|
29
|
+
- Request/Response schema separation
|
|
30
|
+
- Enum/constant management
|
|
31
|
+
|
|
32
|
+
3. Data Access Patterns
|
|
33
|
+
- Session management (db.session, scoped_session)
|
|
34
|
+
- Repository/DAO pattern vs direct model queries
|
|
35
|
+
- Migration (Flask-Migrate / Alembic)
|
|
36
|
+
- Query optimization (eager loading, lazy loading)
|
|
37
|
+
- Connection management (pool, teardown_appcontext)
|
|
38
|
+
- Transaction management
|
|
39
|
+
|
|
40
|
+
4. Application Structure Patterns
|
|
41
|
+
- Application factory (create_app)
|
|
42
|
+
- Configuration (app.config, from_object, from_envvar)
|
|
43
|
+
- Extension initialization (db.init_app, login_manager.init_app)
|
|
44
|
+
- Context (application context, request context, g, current_app)
|
|
45
|
+
- Before/after request hooks (before_request, after_request, teardown_request)
|
|
46
|
+
- Import paths: record EXACT import conventions
|
|
47
|
+
- Utility function locations: record EXACT module paths
|
|
48
|
+
|
|
49
|
+
5. Configuration/Environment Patterns
|
|
50
|
+
- Environment variable management (python-dotenv, os.environ)
|
|
51
|
+
- Config classes (DevelopmentConfig, ProductionConfig)
|
|
52
|
+
- Per-environment branching
|
|
53
|
+
- Secret management (SECRET_KEY, database URL)
|
|
54
|
+
|
|
55
|
+
6. Logging Patterns
|
|
56
|
+
- Logger usage (app.logger, structlog, loguru, logging)
|
|
57
|
+
- Log level policy
|
|
58
|
+
- Request/response logging
|
|
59
|
+
- Error logging
|
|
60
|
+
|
|
61
|
+
7. Testing Patterns
|
|
62
|
+
- Test framework (pytest, unittest)
|
|
63
|
+
- Test client (app.test_client, pytest fixtures)
|
|
64
|
+
- Application factory testing (create_app with test config)
|
|
65
|
+
- Fixture management (conftest, client fixture)
|
|
66
|
+
- DB test strategy (test DB, SQLite in-memory, transaction rollback)
|
|
67
|
+
- Mocking (unittest.mock, pytest-mock, responses)
|
|
68
|
+
|
|
69
|
+
8. Domain-Specific Patterns
|
|
70
|
+
- Template rendering (Jinja2, render_template) vs JSON API
|
|
71
|
+
- File upload (request.files, werkzeug FileStorage)
|
|
72
|
+
- Background tasks (Celery, RQ, APScheduler)
|
|
73
|
+
- WebSocket (Flask-SocketIO)
|
|
74
|
+
- External API integration (requests, httpx)
|
|
75
|
+
- Caching (Flask-Caching, Redis)
|
|
76
|
+
- Session management (server-side, Flask-Session)
|
|
77
|
+
- CSRF protection (Flask-WTF CSRFProtect)
|
|
78
|
+
|
|
79
|
+
9. Anti-patterns / Inconsistencies
|
|
80
|
+
- Circular imports
|
|
81
|
+
- Missing application factory
|
|
82
|
+
- Global state misuse
|
|
83
|
+
- Missing error handlers
|
|
84
|
+
- Security issues (injection, missing CSRF, debug mode in production)
|
|
85
|
+
- Performance issues (blocking I/O, N+1 queries)
|
|
86
|
+
|
|
87
|
+
Do not create or modify source files. Analysis only.
|
|
88
|
+
Save results to claudeos-core/generated/pass1-{{PASS_NUM}}.json in the following format:
|
|
89
|
+
|
|
90
|
+
{
|
|
91
|
+
"analyzedAt": "ISO timestamp",
|
|
92
|
+
"passNum": {{PASS_NUM}},
|
|
93
|
+
"domains": ["auth", "users", "orders", "products"],
|
|
94
|
+
"analysisPerDomain": {
|
|
95
|
+
"users": {
|
|
96
|
+
"representativeFiles": {
|
|
97
|
+
"routes": "app/users/routes.py",
|
|
98
|
+
"models": "app/users/models.py",
|
|
99
|
+
"forms": "app/users/forms.py",
|
|
100
|
+
"services": "app/users/services.py"
|
|
101
|
+
},
|
|
102
|
+
"patterns": {
|
|
103
|
+
"routes": { ... },
|
|
104
|
+
"models": { ... },
|
|
105
|
+
"dataAccess": { ... },
|
|
106
|
+
"appStructure": { ... },
|
|
107
|
+
"config": { ... },
|
|
108
|
+
"logging": { ... },
|
|
109
|
+
"testing": { ... }
|
|
110
|
+
},
|
|
111
|
+
"specialPatterns": [],
|
|
112
|
+
"antiPatterns": []
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"crossDomainCommon": {
|
|
116
|
+
"description": "Patterns commonly used across domains in this group",
|
|
117
|
+
"patterns": []
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Read all pass1-*.json files from the claudeos-core/generated/ directory and
|
|
2
|
+
merge all domain analysis results into a single unified report.
|
|
3
|
+
|
|
4
|
+
Merge items:
|
|
5
|
+
|
|
6
|
+
1. Universal Patterns (shared by 100% of all domains)
|
|
7
|
+
- Route/Blueprint style (decorators, response format, status codes)
|
|
8
|
+
- **Response flow**: Which layer wraps the response? (route handler vs service layer)
|
|
9
|
+
Record the definitive answer. If an orchestration layer exists, describe it.
|
|
10
|
+
- Model/serialization conventions (SQLAlchemy, marshmallow)
|
|
11
|
+
- Data access patterns (session management, queries)
|
|
12
|
+
- Application factory structure (create_app, extensions)
|
|
13
|
+
- Error handling patterns
|
|
14
|
+
- Before/after request hooks
|
|
15
|
+
|
|
16
|
+
2. Majority Patterns (shared by 50%+ of domains)
|
|
17
|
+
- Specify which domains share them
|
|
18
|
+
|
|
19
|
+
3. Domain-Specific Patterns (unique to a single domain)
|
|
20
|
+
- File upload: which domain
|
|
21
|
+
- WebSocket: which domain
|
|
22
|
+
- Background tasks: which domain
|
|
23
|
+
- External API: which domain
|
|
24
|
+
- Caching: which domain
|
|
25
|
+
- Template rendering: which domain
|
|
26
|
+
|
|
27
|
+
4. Anti-pattern Summary
|
|
28
|
+
- Consolidate all inconsistencies found across domains
|
|
29
|
+
- Classify by severity (CRITICAL / HIGH / MEDIUM / LOW)
|
|
30
|
+
|
|
31
|
+
5. Naming Conventions Summary
|
|
32
|
+
- Module/package naming (snake_case)
|
|
33
|
+
- Blueprint naming conventions
|
|
34
|
+
- Model/schema naming conventions
|
|
35
|
+
- Route URL patterns
|
|
36
|
+
- File structure conventions
|
|
37
|
+
|
|
38
|
+
6. Common Models/Utilities List
|
|
39
|
+
- Base model mixins with EXACT import paths
|
|
40
|
+
- Shared utility functions with EXACT module paths
|
|
41
|
+
- Constants/Enum management with EXACT locations
|
|
42
|
+
- Extension instances (db, login_manager, etc.)
|
|
43
|
+
|
|
44
|
+
7. Security/Authentication Patterns
|
|
45
|
+
- Authentication method (flask-login, flask-jwt-extended, custom)
|
|
46
|
+
- Authorization decorators (login_required, custom)
|
|
47
|
+
- CSRF protection
|
|
48
|
+
- CORS configuration
|
|
49
|
+
- Environment variable management
|
|
50
|
+
|
|
51
|
+
8. Database Patterns
|
|
52
|
+
- Table naming (__tablename__)
|
|
53
|
+
- Migration strategy (Flask-Migrate)
|
|
54
|
+
- Seed data management
|
|
55
|
+
- Audit fields (created_at, updated_at)
|
|
56
|
+
- Relationship patterns
|
|
57
|
+
- Index/constraints
|
|
58
|
+
|
|
59
|
+
9. Testing Strategy Summary
|
|
60
|
+
- Test coverage level
|
|
61
|
+
- Test classification system (unit/integration/E2E)
|
|
62
|
+
- Test client setup (app.test_client)
|
|
63
|
+
- Fixture/Factory strategy
|
|
64
|
+
- Mocking strategy
|
|
65
|
+
- DB test strategy
|
|
66
|
+
|
|
67
|
+
10. Logging/Monitoring Strategy
|
|
68
|
+
- Logger standard (app.logger vs custom)
|
|
69
|
+
- Log level policy
|
|
70
|
+
- Request/response logging
|
|
71
|
+
|
|
72
|
+
11. Performance Patterns
|
|
73
|
+
- Caching strategy (Flask-Caching)
|
|
74
|
+
- Connection pool configuration
|
|
75
|
+
- Query optimization
|
|
76
|
+
- Static file serving
|
|
77
|
+
|
|
78
|
+
12. Code Quality Tools
|
|
79
|
+
- Lint/Format tools (ruff, black, isort, mypy, flake8)
|
|
80
|
+
- Pre-commit hooks
|
|
81
|
+
- Type Checking (mypy, pyright)
|
|
82
|
+
- CI integration status
|
|
83
|
+
|
|
84
|
+
Do not generate code. Merge only.
|
|
85
|
+
Save results to claudeos-core/generated/pass2-merged.json.
|