claudeos-core 2.3.2 โ 2.4.1
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 +790 -74
- package/CODE_OF_CONDUCT.md +15 -0
- package/README.de.md +374 -876
- package/README.es.md +374 -875
- package/README.fr.md +374 -875
- package/README.hi.md +374 -875
- package/README.ja.md +374 -875
- package/README.ko.md +374 -874
- package/README.md +374 -876
- package/README.ru.md +374 -877
- package/README.vi.md +374 -875
- package/README.zh-CN.md +374 -874
- package/SECURITY.md +51 -0
- package/bin/commands/init.js +192 -37
- package/content-validator/index.js +97 -4
- 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 +81 -0
- package/pass-prompts/templates/common/pass3-footer.md +104 -0
- package/pass-prompts/templates/java-spring/pass3.md +19 -18
- package/pass-prompts/templates/kotlin-spring/pass3.md +23 -22
- 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 +11 -1
- package/plan-installer/scanners/scan-java.js +98 -2
- package/plan-installer/stack-detector.js +44 -0
package/README.md
CHANGED
|
@@ -1,1016 +1,514 @@
|
|
|
1
1
|
# ClaudeOS-Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/claudeos-core)
|
|
4
|
+
[](https://github.com/claudeos-core/claudeos-core/actions/workflows/test.yml)
|
|
5
|
+
[](https://github.com/claudeos-core/claudeos-core/actions/workflows/test.yml)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://www.npmjs.com/package/claudeos-core)
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
npx claudeos-core init
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
ClaudeOS-Core reads your codebase, extracts every pattern it finds, and generates a complete set of Standards, Rules, Skills, and Guides tailored to _your_ project. After that, when you tell Claude Code "Create a CRUD for orders", it produces code that matches your existing patterns exactly.
|
|
10
|
-
|
|
11
|
-
[๐ฐ๐ท ํ๊ตญ์ด](./README.ko.md) ยท [๐จ๐ณ ไธญๆ](./README.zh-CN.md) ยท [๐ฏ๐ต ๆฅๆฌ่ช](./README.ja.md) ยท [๐ช๐ธ Espaรฑol](./README.es.md) ยท [๐ป๐ณ Tiแบฟng Viแปt](./README.vi.md) ยท [๐ฎ๐ณ เคนเคฟเคจเฅเคฆเฅ](./README.hi.md) ยท [๐ท๐บ ะ ัััะบะธะน](./README.ru.md) ยท [๐ซ๐ท Franรงais](./README.fr.md) ยท [๐ฉ๐ช Deutsch](./README.de.md)
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Why ClaudeOS-Core?
|
|
16
|
-
|
|
17
|
-
Every other Claude Code tool works like this:
|
|
18
|
-
|
|
19
|
-
> **Human describes the project โ LLM generates documentation**
|
|
20
|
-
|
|
21
|
-
ClaudeOS-Core works like this:
|
|
22
|
-
|
|
23
|
-
> **Code analyzes your source โ Code builds a tailored prompt โ LLM generates documentation โ Code verifies the output**
|
|
24
|
-
|
|
25
|
-
This is not a small difference. Here's why it matters:
|
|
26
|
-
|
|
27
|
-
### The core problem: LLMs guess. Code doesn't.
|
|
28
|
-
|
|
29
|
-
When you ask Claude to "analyze this project," it **guesses** your stack, your ORM, your domain structure.
|
|
30
|
-
It might see `spring-boot` in your `build.gradle` but miss that you use MyBatis (not JPA).
|
|
31
|
-
It might detect a `user/` directory but not realize your project uses layer-first packaging (Pattern A), not domain-first (Pattern B).
|
|
32
|
-
|
|
33
|
-
**ClaudeOS-Core doesn't guess.** Before Claude ever sees your project, Node.js code has already:
|
|
34
|
-
|
|
35
|
-
- Parsed `build.gradle` / `package.json` / `pyproject.toml` and **confirmed** your stack, ORM, DB, and package manager
|
|
36
|
-
- Scanned your directory structure and **confirmed** your domain list with file counts
|
|
37
|
-
- Classified your project structure into one of 5 Java patterns, Kotlin CQRS/BFF, or Next.js App Router/FSD
|
|
38
|
-
- Split domains into optimally-sized groups that fit Claude's context window
|
|
39
|
-
- Assembled a stack-specific prompt with all confirmed facts injected
|
|
40
|
-
|
|
41
|
-
By the time Claude receives the prompt, there's nothing left to guess. The stack is confirmed. The domains are confirmed. The structure pattern is confirmed. Claude's only job is to generate documentation that matches these **confirmed facts**.
|
|
42
|
-
|
|
43
|
-
### The result
|
|
44
|
-
|
|
45
|
-
Other tools produce "generally good" documentation.
|
|
46
|
-
ClaudeOS-Core produces documentation that knows your project uses `ApiResponse.ok()` (not `ResponseEntity.success()`), that your MyBatis XML mappers live in `src/main/resources/mybatis/mappers/`, and that your package structure is `com.company.module.{domain}.controller` โ because it read your actual code.
|
|
47
|
-
|
|
48
|
-
### Before & After
|
|
49
|
-
|
|
50
|
-
**Without ClaudeOS-Core** โ you ask Claude Code to create an Order CRUD:
|
|
51
|
-
```
|
|
52
|
-
โ Uses JPA-style repository (your project uses MyBatis)
|
|
53
|
-
โ Creates ResponseEntity.success() (your wrapper is ApiResponse.ok())
|
|
54
|
-
โ Places files in order/controller/ (your project uses controller/order/)
|
|
55
|
-
โ Generates English comments (your team writes Korean comments)
|
|
56
|
-
โ You spend 20 minutes fixing every generated file
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**With ClaudeOS-Core** โ `.claude/rules/` already contains your confirmed patterns:
|
|
60
|
-
```
|
|
61
|
-
โ
Generates MyBatis mapper + XML (detected from build.gradle)
|
|
62
|
-
โ
Uses ApiResponse.ok() (extracted from your actual source)
|
|
63
|
-
โ
Places files in controller/order/ (Pattern A confirmed by structure scan)
|
|
64
|
-
โ
Korean comments (--lang ko applied)
|
|
65
|
-
โ Generated code matches your project conventions immediately
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
This difference compounds. 10 tasks/day ร 20 minutes saved = **3+ hours/day**.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Post-Generation Quality Assurance (v2.3.0)
|
|
73
|
-
|
|
74
|
-
Generation is only half the problem. The other half is **knowing the output is correct** โ across 10 output languages, across 11 stack templates, across projects of any size. v2.3.0 adds two deterministic validators that run after generation and do not depend on LLM self-checks:
|
|
10
|
+
**Make Claude Code follow YOUR project's conventions on the first try โ not generic defaults.**
|
|
75
11
|
|
|
76
|
-
|
|
12
|
+
A deterministic Node.js scanner reads your code first; a 4-pass Claude pipeline then writes the full set โ `CLAUDE.md` + auto-loaded `.claude/rules/` + standards + skills + L4 memory. 10 output languages, 5 post-generation validators, and an explicit path allowlist that prevents the LLM from inventing files or frameworks not in your code.
|
|
77
13
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
The cross-language guarantee is verified by test fixtures in all 10 languages, including bad-case fixtures in 6 of those languages that produce identical error signatures. When an invariant fails on a Vietnamese project, the fix is the same as when it fails on a German project.
|
|
81
|
-
|
|
82
|
-
### `content-validator [10/10]` โ path-claim verification and MANIFEST consistency
|
|
83
|
-
|
|
84
|
-
Reads every backticked path reference (`src/...`, `.claude/rules/...`, `claudeos-core/skills/...`) from all generated `.md` files and verifies them against the actual file system. Catches two classes of LLM failure that no tool detected before:
|
|
85
|
-
|
|
86
|
-
- **`STALE_PATH`** โ when Pass 3 or Pass 4 fabricates a plausible-but-nonexistent path. Three canonical classes: (1) **identifier-to-filename renormalization** โ inferring a filename from an ALL_CAPS TypeScript constant or Java annotation when the actual filename lives under a different convention; (2) **framework-convention entry-point invention** โ assuming a stock entry-point file (Vite's main module, Next.js app-router providers, etc.) in a project that chose a different layout; (3) **plausibly-named utility invention** โ citing a concrete filename for a helper that "would naturally" exist under a seen directory.
|
|
87
|
-
- **`MANIFEST_DRIFT`** โ when `claudeos-core/skills/00.shared/MANIFEST.md` registers a skill that `CLAUDE.md ยง6` doesn't mention (or vice versa). Recognizes the common orchestrator + sub-skills layout where `CLAUDE.md ยง6` is an entry point and `MANIFEST.md` is the full registry โ sub-skills are considered covered via their parent orchestrator.
|
|
88
|
-
|
|
89
|
-
The validator is paired with prompt-time prevention in `pass3-footer.md` and `pass4.md`: anti-pattern blocks documenting the specific hallucination classes (parent-directory prefix, Vite/MSW/Vitest/Jest/RTL library conventions), and explicit positive guidance to scope rules by directory when a concrete filename isn't in `pass3a-facts.md`.
|
|
90
|
-
|
|
91
|
-
### Run validation on any project
|
|
14
|
+
Works on [**12 stacks**](#supported-stacks) (monorepos included) โ one `npx` command, no config, resume-safe, idempotent.
|
|
92
15
|
|
|
93
16
|
```bash
|
|
94
|
-
npx claudeos-core health # all validators โ single go/no-go verdict
|
|
95
|
-
npx claudeos-core lint # CLAUDE.md structural invariants only (any language)
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Supported Stacks
|
|
101
|
-
|
|
102
|
-
| Stack | Detection | Analysis Depth |
|
|
103
|
-
|---|---|---|
|
|
104
|
-
| **Java / Spring Boot** | `build.gradle`, `pom.xml`, 5 package patterns | 10 categories, 59 sub-items |
|
|
105
|
-
| **Kotlin / Spring Boot** | `build.gradle.kts`, kotlin plugin, `settings.gradle.kts`, CQRS/BFF auto-detect | 12 categories, 95 sub-items |
|
|
106
|
-
| **Node.js / Express** | `package.json` | 9 categories, 57 sub-items |
|
|
107
|
-
| **Node.js / NestJS** | `package.json` (`@nestjs/core`) | 10 categories, 68 sub-items |
|
|
108
|
-
| **Next.js / React** | `package.json`, `next.config.*`, FSD support | 9 categories, 55 sub-items |
|
|
109
|
-
| **Vue / Nuxt** | `package.json`, `nuxt.config.*`, Composition API | 9 categories, 58 sub-items |
|
|
110
|
-
| **Python / Django** | `requirements.txt`, `pyproject.toml` | 10 categories, 55 sub-items |
|
|
111
|
-
| **Python / FastAPI** | `requirements.txt`, `pyproject.toml` | 10 categories, 58 sub-items |
|
|
112
|
-
| **Node.js / Fastify** | `package.json` | 10 categories, 62 sub-items |
|
|
113
|
-
| **Vite / React SPA** | `package.json`, `vite.config.*` | 9 categories, 55 sub-items |
|
|
114
|
-
| **Angular** | `package.json`, `angular.json` | 12 categories, 78 sub-items |
|
|
115
|
-
|
|
116
|
-
Auto-detected: language & version, framework & version (including Vite as SPA framework), ORM (MyBatis, JPA, Exposed, Prisma, TypeORM, SQLAlchemy, etc.), database (PostgreSQL, MySQL, Oracle, MongoDB, SQLite), package manager (Gradle, Maven, npm, yarn, pnpm, pip, poetry), architecture (CQRS, BFF โ from module names), multi-module structure (from settings.gradle), monorepo (Turborepo, pnpm-workspace, Lerna, npm/yarn workspaces), **runtime configuration from `.env.example`** (v2.2.0 โ port/host/API-target across 16+ convention variable names for Vite, Next.js, Nuxt, Angular, Node, Python frameworks).
|
|
117
|
-
|
|
118
|
-
**You don't specify anything. It's all detected automatically.**
|
|
119
|
-
|
|
120
|
-
### `.env`-driven runtime configuration (v2.2.0)
|
|
121
|
-
|
|
122
|
-
v2.2.0 adds `lib/env-parser.js` so generated `CLAUDE.md` reflects what the project actually declares rather than framework defaults.
|
|
123
|
-
|
|
124
|
-
- **Search order**: `.env.example` (canonical, committed) โ `.env.local.example` โ `.env.sample` โ `.env.template` โ `.env` โ `.env.local` โ `.env.development`. The `.example` variant wins because it is the developer-neutral shape-of-truth, not one contributor's local overrides.
|
|
125
|
-
- **Port variable conventions recognised**: `VITE_PORT` / `VITE_DEV_PORT` / `VITE_DESKTOP_PORT` / `NEXT_PUBLIC_PORT` / `NUXT_PORT` / `NG_PORT` / `APP_PORT` / `SERVER_PORT` / `HTTP_PORT` / `DEV_PORT` / `FLASK_RUN_PORT` / `UVICORN_PORT` / `DJANGO_PORT` / generic `PORT`. Framework-specific names win over the generic `PORT` when both are present.
|
|
126
|
-
- **Host & API target**: `VITE_DEV_HOST` / `VITE_API_TARGET` / `NEXT_PUBLIC_API_URL` / `NUXT_PUBLIC_API_BASE` / `BACKEND_URL` / `PROXY_TARGET` etc.
|
|
127
|
-
- **Precedence**: Spring Boot `application.yml` `server.port` still wins (framework-native config), then `.env`-declared port, then framework default (Vite 5173, Next.js 3000, Django 8000, etc.) as last resort.
|
|
128
|
-
- **Sensitive-variable redaction**: values of variables matching `PASSWORD` / `SECRET` / `TOKEN` / `API_KEY` / `ACCESS_KEY` / `PRIVATE_KEY` / `CREDENTIAL` / `JWT_SECRET` / `CLIENT_SECRET` / `SESSION_SECRET` / `BEARER` / `SALT` patterns are replaced with `***REDACTED***` before reaching any downstream generator. Defense-in-depth against accidentally committed secrets in `.env.example`. `DATABASE_URL` is explicitly whitelisted for stack-detector DB-identification back-compat.
|
|
129
|
-
|
|
130
|
-
### Java Domain Detection (5 patterns with fallback)
|
|
131
|
-
|
|
132
|
-
| Priority | Pattern | Structure | Example |
|
|
133
|
-
|---|---|---|---|
|
|
134
|
-
| A | Layer-first | `controller/{domain}/` | `controller/user/UserController.java` |
|
|
135
|
-
| B | Domain-first | `{domain}/controller/` | `user/controller/UserController.java` |
|
|
136
|
-
| D | Module prefix | `{module}/{domain}/controller/` | `front/member/controller/MemberController.java` |
|
|
137
|
-
| E | DDD/Hexagonal | `{domain}/adapter/in/web/` | `user/adapter/in/web/UserController.java` |
|
|
138
|
-
| C | Flat | `controller/*.java` | `controller/UserController.java` โ extracts `user` from class name |
|
|
139
|
-
|
|
140
|
-
Service-only domains (without controllers) are also detected via `service/`, `dao/`, `aggregator/`, `facade/`, `usecase/`, `orchestrator/`, `mapper/`, `repository/` directories. Skips: `common`, `config`, `util`, `core`, `front`, `admin`, `v1`, `v2`, etc.
|
|
141
|
-
|
|
142
|
-
### Kotlin Multi-Module Domain Detection
|
|
143
|
-
|
|
144
|
-
For Kotlin projects with Gradle multi-module structure (e.g., CQRS monorepo):
|
|
145
|
-
|
|
146
|
-
| Step | What It Does | Example |
|
|
147
|
-
|---|---|---|
|
|
148
|
-
| 1 | Scan `settings.gradle.kts` for `include()` | Finds 14 modules |
|
|
149
|
-
| 2 | Detect module type from name | `reservation-command-server` โ type: `command` |
|
|
150
|
-
| 3 | Extract domain from module name | `reservation-command-server` โ domain: `reservation` |
|
|
151
|
-
| 4 | Group same domain across modules | `reservation-command-server` + `common-query-server` โ 1 domain |
|
|
152
|
-
| 5 | Detect architecture | Has `command` + `query` modules โ CQRS |
|
|
153
|
-
|
|
154
|
-
Supported module types: `command`, `query`, `bff`, `integration`, `standalone`, `library`. Shared libraries (`shared-lib`, `integration-lib`) are detected as special domains.
|
|
155
|
-
|
|
156
|
-
### Frontend Domain Detection
|
|
157
|
-
|
|
158
|
-
- **App Router**: `app/{domain}/page.tsx` (Next.js)
|
|
159
|
-
- **Pages Router**: `pages/{domain}/index.tsx`
|
|
160
|
-
- **FSD (Feature-Sliced Design)**: `features/*/`, `widgets/*/`, `entities/*/`
|
|
161
|
-
- **RSC/Client split**: Detects `client.tsx` pattern, tracks Server/Client component separation
|
|
162
|
-
- **Non-standard nested paths**: Detects pages, components, and FSD layers under `src/*/` paths (e.g., `src/admin/pages/dashboard/`, `src/admin/components/form/`, `src/admin/features/billing/`)
|
|
163
|
-
- **Platform/tier-split detection (v2.0.0)**: Recognizes `src/{platform}/{subapp}/` layouts โ `{platform}` can be a device/target keyword (`desktop`, `pc`, `web`, `mobile`, `mc`, `mo`, `sp`, `tablet`, `tab`, `pwa`, `tv`, `ctv`, `ott`, `watch`, `wear`) or an access-tier keyword (`admin`, `cms`, `backoffice`, `back-office`, `portal`). Emits one domain per `(platform, subapp)` pair named `{platform}-{subapp}` with per-domain counts for routes/components/layouts/hooks. Runs across Angular, Next.js, React, and Vue simultaneously (multi-extension glob `{tsx,jsx,ts,js,vue}`). Requires โฅ2 source files per subapp to avoid noisy 1-file domains.
|
|
164
|
-
- **Monorepo platform split (v2.0.0)**: The platform scan also matches `{apps,packages}/*/src/{platform}/{subapp}/` (Turborepo/pnpm workspace with `src/`) and `{apps,packages}/{platform}/{subapp}/` (workspaces without `src/` wrapper).
|
|
165
|
-
- **Fallback E โ routes-file (v2.0.0)**: When primary scanners + Fallbacks AโD all return 0, globs `**/routes/*.{tsx,jsx,ts,js,vue}` and groups by the parent-of-`routes` directory name. Catches React Router file-routing projects (CRA/Vite + `react-router`) that don't match Next.js `page.tsx` or FSD layouts. Generic parent names (`src`, `app`, `pages`) are filtered out.
|
|
166
|
-
- **Config fallback**: Detects Next.js/Vite/Nuxt from config files when not in `package.json` (monorepo support)
|
|
167
|
-
- **Deep directory fallback**: For React/CRA/Vite/Vue/RN projects, scans `**/components/*/`, `**/views/*/`, `**/screens/*/`, `**/containers/*/`, `**/pages/*/`, `**/routes/*/`, `**/modules/*/`, `**/domains/*/` at any depth
|
|
168
|
-
- **Shared ignore lists (v2.0.0)**: All scanners share `BUILD_IGNORE_DIRS` (`node_modules`, `build`, `dist`, `out`, `.next`, `.nuxt`, `.svelte-kit`, `.angular`, `.turbo`, `.cache`, `.parcel-cache`, `coverage`, `storybook-static`, `.vercel`, `.netlify`) and `TEST_FILE_IGNORE` (spec/test/stories/e2e/cy + `__snapshots__`/`__tests__`) so build outputs and test fixtures don't inflate per-domain file counts.
|
|
169
|
-
|
|
170
|
-
### Scanner Overrides (v2.0.0)
|
|
171
|
-
|
|
172
|
-
Drop an optional `.claudeos-scan.json` at your project root to extend scanner defaults without editing the toolkit. All fields are **additive** โ user entries extend defaults, never replace:
|
|
173
|
-
|
|
174
|
-
```json
|
|
175
|
-
{
|
|
176
|
-
"frontendScan": {
|
|
177
|
-
"platformKeywords": ["kiosk"],
|
|
178
|
-
"skipSubappNames": ["legacy"],
|
|
179
|
-
"minSubappFiles": 3
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
| Field | Default | Purpose |
|
|
185
|
-
|---|---|---|
|
|
186
|
-
| `platformKeywords` | built-in list above | Additional `{platform}` keywords for the platform scan (e.g., `kiosk`, `vr`, `embedded`) |
|
|
187
|
-
| `skipSubappNames` | structural dirs only | Additional subapp names to exclude from platform-scan domain emission |
|
|
188
|
-
| `minSubappFiles` | `2` | Override the minimum file count required before a subapp becomes a domain |
|
|
189
|
-
|
|
190
|
-
Missing file or malformed JSON โ silently falls back to defaults (no crash). Typical use: opt-in a short abbreviation (`adm`, `bo`) that the built-in list excludes as too ambiguous, or raise `minSubappFiles` for noisy monorepos.
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## Quick Start
|
|
195
|
-
|
|
196
|
-
### Prerequisites
|
|
197
|
-
|
|
198
|
-
- **Node.js** v18+
|
|
199
|
-
- **Claude Code CLI** (installed & authenticated)
|
|
200
|
-
|
|
201
|
-
### Installation
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
cd /your/project/root
|
|
205
|
-
|
|
206
|
-
# Option A: npx (recommended โ no install needed)
|
|
207
|
-
npx claudeos-core init
|
|
208
|
-
|
|
209
|
-
# Option B: global install
|
|
210
|
-
npm install -g claudeos-core
|
|
211
|
-
claudeos-core init
|
|
212
|
-
|
|
213
|
-
# Option C: project devDependency
|
|
214
|
-
npm install --save-dev claudeos-core
|
|
215
17
|
npx claudeos-core init
|
|
216
|
-
|
|
217
|
-
# Option D: git clone (for development/contribution)
|
|
218
|
-
git clone https://github.com/claudeos-core/claudeos-core.git claudeos-core-tools
|
|
219
|
-
|
|
220
|
-
# Cross-platform (PowerShell, CMD, Bash, Zsh โ any terminal)
|
|
221
|
-
node claudeos-core-tools/bin/cli.js init
|
|
222
|
-
|
|
223
|
-
# Linux/macOS (Bash only)
|
|
224
|
-
bash claudeos-core-tools/bootstrap.sh
|
|
225
18
|
```
|
|
226
19
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
When you run `init` without `--lang`, an interactive selector appears โ use arrow keys or number keys to choose:
|
|
20
|
+
[๐ฐ๐ท ํ๊ตญ์ด](README.ko.md) ยท [๐จ๐ณ ไธญๆ](README.zh-CN.md) ยท [๐ฏ๐ต ๆฅๆฌ่ช](README.ja.md) ยท [๐ช๐ธ Espaรฑol](README.es.md) ยท [๐ป๐ณ Tiแบฟng Viแปt](README.vi.md) ยท [๐ฎ๐ณ เคนเคฟเคจเฅเคฆเฅ](README.hi.md) ยท [๐ท๐บ ะ ัััะบะธะน](README.ru.md) ยท [๐ซ๐ท Franรงais](README.fr.md) ยท [๐ฉ๐ช Deutsch](README.de.md)
|
|
230
21
|
|
|
231
|
-
|
|
232
|
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
233
|
-
โ Select generated document language (required) โ
|
|
234
|
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
235
|
-
|
|
236
|
-
Generated files (CLAUDE.md, Standards, Rules,
|
|
237
|
-
Skills, Guides) will be written in English.
|
|
238
|
-
|
|
239
|
-
โฏ 1. en โ English
|
|
240
|
-
2. ko โ ํ๊ตญ์ด (Korean)
|
|
241
|
-
3. zh-CN โ ็ฎไฝไธญๆ (Chinese Simplified)
|
|
242
|
-
4. ja โ ๆฅๆฌ่ช (Japanese)
|
|
243
|
-
5. es โ Espaรฑol (Spanish)
|
|
244
|
-
6. vi โ Tiแบฟng Viแปt (Vietnamese)
|
|
245
|
-
7. hi โ เคนเคฟเคจเฅเคฆเฅ (Hindi)
|
|
246
|
-
8. ru โ ะ ัััะบะธะน (Russian)
|
|
247
|
-
9. fr โ Franรงais (French)
|
|
248
|
-
10. de โ Deutsch (German)
|
|
249
|
-
|
|
250
|
-
โโ Move 1-0 Jump Enter Select ESC Cancel
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
The description changes to the selected language as you navigate. To skip the selector, pass `--lang` directly:
|
|
22
|
+
---
|
|
254
23
|
|
|
255
|
-
|
|
256
|
-
npx claudeos-core init --lang ko # Korean
|
|
257
|
-
npx claudeos-core init --lang ja # Japanese
|
|
258
|
-
npx claudeos-core init --lang en # English (default)
|
|
259
|
-
```
|
|
24
|
+
## What is this?
|
|
260
25
|
|
|
261
|
-
|
|
26
|
+
You use Claude Code. It's powerful, but every session starts fresh โ it has no memory of how _your_ project is structured. So it falls back to "generally good" defaults that rarely match what your team actually does:
|
|
262
27
|
|
|
263
|
-
|
|
28
|
+
- Your team uses **MyBatis**, but Claude generates JPA repositories.
|
|
29
|
+
- Your response wrapper is `ApiResponse.ok()`, but Claude writes `ResponseEntity.success()`.
|
|
30
|
+
- Your packages are layer-first (`controller/order/`), but Claude creates domain-first (`order/controller/`).
|
|
31
|
+
- Your errors go through centralized middleware, but Claude scatters `try/catch` in every endpoint.
|
|
264
32
|
|
|
265
|
-
|
|
33
|
+
You'd want a `.claude/rules/` set per project โ Claude Code auto-loads it every session โ but writing those rules by hand for each new repo takes hours, and they drift as the code evolves.
|
|
266
34
|
|
|
267
|
-
|
|
35
|
+
**ClaudeOS-Core writes them for you, from your actual source code.** A deterministic Node.js scanner reads your project first (stack, ORM, package layout, conventions, file paths). Then a 4-pass Claude pipeline turns the extracted facts into a complete documentation set:
|
|
268
36
|
|
|
269
|
-
|
|
37
|
+
- **`CLAUDE.md`** โ the project index Claude reads on every session
|
|
38
|
+
- **`.claude/rules/`** โ auto-loaded rules per category (`00.core` / `10.backend` / `20.frontend` / `30.security-db` / `40.infra` / `60.memory` / `70.domains` / `80.verification`)
|
|
39
|
+
- **`claudeos-core/standard/`** โ reference docs (the "why" behind each rule)
|
|
40
|
+
- **`claudeos-core/skills/`** โ reusable patterns (CRUD scaffolding, page templates)
|
|
41
|
+
- **`claudeos-core/memory/`** โ decision log + failure patterns that grow with the project
|
|
270
42
|
|
|
271
|
-
|
|
272
|
-
cd /your/project/root
|
|
43
|
+
Because the scanner hands Claude an explicit path allowlist, the LLM **cannot invent files or frameworks that aren't in your code**. Five post-generation validators (`claude-md-validator`, `content-validator`, `pass-json-validator`, `plan-validator`, `sync-checker`) verify the output before it ships โ language-invariant, so the same rules apply whether you generate in English, Korean, or any of 8 other languages.
|
|
273
44
|
|
|
274
|
-
git clone https://github.com/claudeos-core/claudeos-core.git claudeos-core-tools
|
|
275
|
-
cd claudeos-core-tools && npm install && cd ..
|
|
276
45
|
```
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
# Rules (v2.0.0: added 60.memory)
|
|
282
|
-
mkdir -p .claude/rules/{00.core,10.backend,20.frontend,30.security-db,40.infra,50.sync,60.memory}
|
|
283
|
-
|
|
284
|
-
# Standards
|
|
285
|
-
mkdir -p claudeos-core/standard/{00.core,10.backend-api,20.frontend-ui,30.security-db,40.infra,50.verification,90.optional}
|
|
286
|
-
|
|
287
|
-
# Skills
|
|
288
|
-
mkdir -p claudeos-core/skills/{00.shared,10.backend-crud/scaffold-crud-feature,20.frontend-page/scaffold-page-feature,50.testing,90.experimental}
|
|
289
|
-
|
|
290
|
-
# Guide, Database, MCP, Generated, Memory (v2.0.0: added memory; v2.1.0: removed plan)
|
|
291
|
-
mkdir -p claudeos-core/guide/{01.onboarding,02.usage,03.troubleshooting,04.architecture}
|
|
292
|
-
mkdir -p claudeos-core/{database,mcp-guide,generated,memory}
|
|
46
|
+
Before: You โ Claude Code โ "generally good" code โ manual fixing each time
|
|
47
|
+
After: You โ Claude Code โ code that matches YOUR project โ ship it
|
|
293
48
|
```
|
|
294
49
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
#### Step 3: Run plan-installer (project analysis)
|
|
298
|
-
|
|
299
|
-
This scans your project, detects the stack, finds domains, splits them into groups, and generates prompts.
|
|
50
|
+
---
|
|
300
51
|
|
|
301
|
-
|
|
302
|
-
|
|
52
|
+
## See it on a real project
|
|
53
|
+
|
|
54
|
+
Run on [`spring-boot-realworld-example-app`](https://github.com/gothinkster/spring-boot-realworld-example-app) โ Java 11 ยท Spring Boot 2.6 ยท MyBatis ยท SQLite ยท 187 source files. Output: **75 generated files**, total time **53 minutes**, all validators โ
.
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<img src="docs/assets/spring-boot-realworld-demo.gif" alt="ClaudeOS-Core init running on spring-boot-realworld-example-app โ stack detection, 4-pass pipeline, validators, completion summary" width="769">
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
<details>
|
|
61
|
+
<summary><strong>๐บ Terminal output (text version, for search & copy)</strong></summary>
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
65
|
+
โ ClaudeOS-Core โ Bootstrap (4-Pass) โ
|
|
66
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
67
|
+
Project root: spring-boot-realworld-example-app
|
|
68
|
+
Language: English (en)
|
|
69
|
+
|
|
70
|
+
[Phase 1] Detecting stack...
|
|
71
|
+
Language: java 11
|
|
72
|
+
Framework: spring-boot 2.6.3
|
|
73
|
+
Database: sqlite
|
|
74
|
+
ORM: mybatis
|
|
75
|
+
PackageMgr: gradle
|
|
76
|
+
|
|
77
|
+
[Phase 2] Scanning structure...
|
|
78
|
+
Backend: 2 domains
|
|
79
|
+
Total: 2 domains
|
|
80
|
+
Package: io.spring.infrastructure
|
|
81
|
+
|
|
82
|
+
[Phase 5] Active domains...
|
|
83
|
+
โ
00.core โ
10.backend โญ๏ธ 20.frontend
|
|
84
|
+
โ
30.security-db โ
40.infra
|
|
85
|
+
โ
80.verification โ
90.optional
|
|
86
|
+
|
|
87
|
+
[4] Pass 1 โ Deep analysis per domain group...
|
|
88
|
+
โ
pass1-1.json created (5m 34s)
|
|
89
|
+
[โโโโโโโโโโโโโโโโโโโโ] 25% (1/4)
|
|
90
|
+
|
|
91
|
+
[5] Pass 2 โ Merging analysis results...
|
|
92
|
+
โ
pass2-merged.json created (4m 22s)
|
|
93
|
+
[โโโโโโโโโโโโโโโโโโโโ] 50% (2/4)
|
|
94
|
+
|
|
95
|
+
[6] Pass 3 โ Generating all files...
|
|
96
|
+
๐ Pass 3 split mode (3a โ 3b โ 3c โ 3d-aux)
|
|
97
|
+
โ
3a complete (2m 57s) โ pass3a-facts.md (187-path allowlist)
|
|
98
|
+
โ
3b complete (18m 49s) โ CLAUDE.md + 19 standards + 20 rules
|
|
99
|
+
โ
3c complete (12m 35s) โ 13 skills + 9 guides
|
|
100
|
+
โ
3d-aux complete (3m 18s) โ database/ + mcp-guide/
|
|
101
|
+
๐ Pass 3 split complete: 4/4 stages successful
|
|
102
|
+
[โโโโโโโโโโโโโโโโโโโโ] 75% (3/4)
|
|
103
|
+
|
|
104
|
+
[7] Pass 4 โ Memory scaffolding...
|
|
105
|
+
๐ฆ Pass 4 staged-rules: 6 rule files moved to .claude/rules/
|
|
106
|
+
โ
Pass 4 complete (5m)
|
|
107
|
+
๐ Gap-fill: all 12 expected files already present
|
|
108
|
+
[โโโโโโโโโโโโโโโโโโโโ] 100% (4/4)
|
|
109
|
+
|
|
110
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
111
|
+
โ ClaudeOS-Core โ Health Checker โ
|
|
112
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
113
|
+
โ
plan-validator pass
|
|
114
|
+
โ
sync-checker pass
|
|
115
|
+
โ
content-validator pass
|
|
116
|
+
โ
pass-json-validator pass
|
|
117
|
+
โ
All systems operational
|
|
118
|
+
|
|
119
|
+
[Lint] โ
CLAUDE.md structure valid (25 checks)
|
|
120
|
+
[Content] โ
All content validation passed
|
|
121
|
+
Total: 0 advisories, 0 notes
|
|
122
|
+
|
|
123
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
124
|
+
โ โ
ClaudeOS-Core โ Complete โ
|
|
125
|
+
โ Files created: 75 โ
|
|
126
|
+
โ Domains analyzed: 1 group โ
|
|
127
|
+
โ L4 scaffolded: memory + rules โ
|
|
128
|
+
โ Output language: English โ
|
|
129
|
+
โ Total time: 53m 8s โ
|
|
130
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
</details>
|
|
134
|
+
|
|
135
|
+
<details>
|
|
136
|
+
<summary><strong>๐ What ends up in your <code>CLAUDE.md</code> (real excerpt โ Section 1 + 2)</strong></summary>
|
|
137
|
+
|
|
138
|
+
```markdown
|
|
139
|
+
# CLAUDE.md โ spring-boot-realworld-example-app
|
|
140
|
+
|
|
141
|
+
> Reference implementation of the RealWorld backend specification on
|
|
142
|
+
> Java 11 + Spring Boot 2.6, exposing both REST and GraphQL endpoints
|
|
143
|
+
> over a hexagonal MyBatis persistence layer.
|
|
144
|
+
|
|
145
|
+
## 1. Role Definition
|
|
146
|
+
|
|
147
|
+
As the senior developer for this repository, you are responsible for
|
|
148
|
+
writing, modifying, and reviewing code. Responses must be written in English.
|
|
149
|
+
A Java Spring Boot REST + GraphQL API server organized around a hexagonal
|
|
150
|
+
(ports & adapters) architecture, with a CQRS-lite read/write split inside
|
|
151
|
+
an XML-driven MyBatis persistence layer and JWT-based authentication.
|
|
152
|
+
|
|
153
|
+
## 2. Project Overview
|
|
154
|
+
|
|
155
|
+
| Item | Value |
|
|
156
|
+
|---|---|
|
|
157
|
+
| Language | Java 11 |
|
|
158
|
+
| Framework | Spring Boot 2.6.3 |
|
|
159
|
+
| Build Tool | Gradle (Groovy DSL) |
|
|
160
|
+
| Persistence | MyBatis 3 via `mybatis-spring-boot-starter:2.2.2` (no JPA) |
|
|
161
|
+
| Database | SQLite (`org.xerial:sqlite-jdbc:3.36.0.3`) โ `dev.db` (default), `:memory:` (test) |
|
|
162
|
+
| Migration | Flyway โ single baseline `V1__create_tables.sql` |
|
|
163
|
+
| API Style | REST (`io.spring.api.*`) + GraphQL via Netflix DGS `:4.9.21` |
|
|
164
|
+
| Authentication | JWT HS512 (`jjwt-api:0.11.2`) + Spring Security `PasswordEncoder` |
|
|
165
|
+
| Server Port | 8080 (default) |
|
|
166
|
+
| Test Stack | JUnit Jupiter 5, Mockito, AssertJ, rest-assured, spring-mock-mvc |
|
|
303
167
|
```
|
|
304
168
|
|
|
305
|
-
|
|
306
|
-
- `project-analysis.json` โ detected stack, domains, frontend info
|
|
307
|
-
- `domain-groups.json` โ domain groups for Pass 1
|
|
308
|
-
- `pass1-backend-prompt.md` / `pass1-frontend-prompt.md` โ analysis prompts
|
|
309
|
-
- `pass2-prompt.md` โ merge prompt
|
|
310
|
-
- `pass3-prompt.md` โ Pass 3 prompt template with the Phase 1 "Read Once, Extract Facts" block prepended (Rules AโE). The automated pipeline splits Pass 3 into multiple stages at runtime; this template feeds each stage.
|
|
311
|
-
- `pass3-context.json` โ slim project summary (< 5 KB, built after Pass 2) that Pass 3 prompts prefer over the full `pass2-merged.json` (v2.1.0)
|
|
312
|
-
- `pass4-prompt.md` โ L4 memory scaffolding prompt (v2.0.0; uses the same `staging-override.md` for `60.memory/` rule writes)
|
|
313
|
-
|
|
314
|
-
You can inspect these files to verify detection accuracy before proceeding.
|
|
169
|
+
Every value above โ exact dependency coordinates, the `dev.db` filename, the `V1__create_tables.sql` migration name, "no JPA" โ is extracted by the scanner from `build.gradle` / `application.properties` / source tree before Claude writes the file. Nothing is guessed.
|
|
315
170
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
Run Pass 1 for each domain group. Check `domain-groups.json` for the number of groups.
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
# Check how many groups
|
|
322
|
-
cat claudeos-core/generated/domain-groups.json | node -e "
|
|
323
|
-
const g = JSON.parse(require('fs').readFileSync('/dev/stdin','utf-8'));
|
|
324
|
-
g.groups.forEach((g,i) => console.log('Group '+(i+1)+': ['+g.domains.join(', ')+'] ('+g.type+', ~'+g.estimatedFiles+' files)'));
|
|
325
|
-
"
|
|
326
|
-
|
|
327
|
-
# Run Pass 1 for each group (replace domains and group number)
|
|
328
|
-
# Note: v1.6.1+ uses Node.js String.replace() instead of perl โ perl is no
|
|
329
|
-
# longer required, and replacement-function semantics prevent regex injection
|
|
330
|
-
# from $/&/$1 characters that may appear in domain names.
|
|
331
|
-
#
|
|
332
|
-
# For group 1:
|
|
333
|
-
DOMAIN_LIST="user, order, product" PASS_NUM=1 node -e "
|
|
334
|
-
const fs = require('fs');
|
|
335
|
-
const tpl = fs.readFileSync('claudeos-core/generated/pass1-backend-prompt.md','utf-8');
|
|
336
|
-
const out = tpl
|
|
337
|
-
.replace(/\{\{DOMAIN_GROUP\}\}/g, () => process.env.DOMAIN_LIST)
|
|
338
|
-
.replace(/\{\{PASS_NUM\}\}/g, () => process.env.PASS_NUM);
|
|
339
|
-
process.stdout.write(out);
|
|
340
|
-
" | claude -p --dangerously-skip-permissions
|
|
341
|
-
|
|
342
|
-
# For group 2 (if exists):
|
|
343
|
-
DOMAIN_LIST="payment, system, delivery" PASS_NUM=2 node -e "
|
|
344
|
-
const fs = require('fs');
|
|
345
|
-
const tpl = fs.readFileSync('claudeos-core/generated/pass1-backend-prompt.md','utf-8');
|
|
346
|
-
const out = tpl
|
|
347
|
-
.replace(/\{\{DOMAIN_GROUP\}\}/g, () => process.env.DOMAIN_LIST)
|
|
348
|
-
.replace(/\{\{PASS_NUM\}\}/g, () => process.env.PASS_NUM);
|
|
349
|
-
process.stdout.write(out);
|
|
350
|
-
" | claude -p --dangerously-skip-permissions
|
|
351
|
-
|
|
352
|
-
# For frontend groups, swap pass1-backend-prompt.md โ pass1-frontend-prompt.md
|
|
353
|
-
```
|
|
171
|
+
</details>
|
|
354
172
|
|
|
355
|
-
|
|
173
|
+
<details>
|
|
174
|
+
<summary><strong>๐ก๏ธ A real auto-loaded rule (<code>.claude/rules/10.backend/01.controller-rules.md</code>)</strong></summary>
|
|
356
175
|
|
|
357
|
-
|
|
176
|
+
````markdown
|
|
177
|
+
---
|
|
178
|
+
paths:
|
|
179
|
+
- "**/*"
|
|
180
|
+
---
|
|
358
181
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
182
|
+
# Controller Rules
|
|
183
|
+
|
|
184
|
+
## REST (`io.spring.api.*`)
|
|
185
|
+
|
|
186
|
+
- Controllers are the SOLE response wrapper for HTTP โ no aggregator/facade above them.
|
|
187
|
+
Return `ResponseEntity<?>` or a body Spring serializes via `JacksonCustomizations`.
|
|
188
|
+
- Each controller method calls exactly ONE application service method. Multi-source
|
|
189
|
+
composition lives in the application service.
|
|
190
|
+
- Controllers MUST NOT import `io.spring.infrastructure.*`. No direct `@Mapper` access.
|
|
191
|
+
- Validate command-param arguments with `@Valid`. Custom JSR-303 constraints live under
|
|
192
|
+
`io.spring.application.{aggregate}.*`.
|
|
193
|
+
- Resolve the current user via `@AuthenticationPrincipal User`.
|
|
194
|
+
- Let exceptions propagate to `io.spring.api.exception.CustomizeExceptionHandler`
|
|
195
|
+
(`@ControllerAdvice`). Do NOT `try/catch` business exceptions inside the controller.
|
|
196
|
+
|
|
197
|
+
## GraphQL (`io.spring.graphql.*`)
|
|
198
|
+
|
|
199
|
+
- DGS components (`@DgsComponent`) are the sole GraphQL response wrappers.
|
|
200
|
+
Use `@DgsQuery` / `@DgsData` / `@DgsMutation`.
|
|
201
|
+
- Resolve the current user via `io.spring.graphql.SecurityUtil.getCurrentUser()`.
|
|
202
|
+
|
|
203
|
+
## Examples
|
|
204
|
+
|
|
205
|
+
โ
Correct:
|
|
206
|
+
```java
|
|
207
|
+
@PostMapping
|
|
208
|
+
public ResponseEntity<?> createArticle(@AuthenticationPrincipal User user,
|
|
209
|
+
@Valid @RequestBody NewArticleParam param) {
|
|
210
|
+
Article article = articleCommandService.createArticle(param, user);
|
|
211
|
+
ArticleData data = articleQueryService.findById(article.getId(), user)
|
|
212
|
+
.orElseThrow(ResourceNotFoundException::new);
|
|
213
|
+
return ResponseEntity.ok(Map.of("article", data));
|
|
214
|
+
}
|
|
362
215
|
```
|
|
363
216
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
217
|
+
โ Incorrect:
|
|
218
|
+
```java
|
|
219
|
+
@PostMapping
|
|
220
|
+
public ResponseEntity<?> create(@RequestBody NewArticleParam p) {
|
|
221
|
+
try {
|
|
222
|
+
articleCommandService.createArticle(p, currentUser);
|
|
223
|
+
} catch (Exception e) { // NO โ let CustomizeExceptionHandler handle it
|
|
224
|
+
return ResponseEntity.status(500).body(e.getMessage()); // NO โ leaks raw message
|
|
225
|
+
}
|
|
226
|
+
return ResponseEntity.ok().build();
|
|
227
|
+
}
|
|
375
228
|
```
|
|
229
|
+
````
|
|
376
230
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
The automated pipeline runs these stages. The stage list is:
|
|
380
|
-
|
|
381
|
-
| Stage | Writes | Notes |
|
|
382
|
-
|---|---|---|
|
|
383
|
-
| `3a` | `pass3a-facts.md` (5โ10 KB distilled fact sheet) | Reads `pass2-merged.json` once; later stages reference this file |
|
|
384
|
-
| `3b-core` | `CLAUDE.md`, common `standard/`, common `.claude/rules/` | Cross-project files; no domain-specific output |
|
|
385
|
-
| `3b-1..N` | Domain-specific `standard/60.domains/*.md` + domain rules | Batch of โค15 domains per stage (auto-divided at โฅ16 domains) |
|
|
386
|
-
| `3c-core` | `guide/` (9 files), `skills/00.shared/MANIFEST.md`, `skills/*/` orchestrators | Shared skills and all user-facing guides |
|
|
387
|
-
| `3c-1..N` | Domain sub-skills under `skills/20.frontend-page/scaffold-page-feature/` | Batch of โค15 domains per stage |
|
|
388
|
-
| `3d-aux` | `database/`, `mcp-guide/` | Fixed-size, independent of domain count |
|
|
389
|
-
|
|
390
|
-
For a 1โ15 domain project this expands to 4 stages (`3a`, `3b-core`, `3c-core`, `3d-aux` โ no batch sub-division). For 16โ30 domains it expands to 8 stages (`3b` and `3c` each sub-divided into 2 batches). See [Auto-scaling by Project Size](#auto-scaling-by-project-size) for the full table.
|
|
231
|
+
The `paths: ["**/*"]` glob means Claude Code auto-loads this rule whenever you edit any file in the project. Every class name, package path, and exception handler in the rule comes directly from the scanned source โ including the project's actual `CustomizeExceptionHandler` and `JacksonCustomizations`.
|
|
391
232
|
|
|
392
|
-
|
|
233
|
+
</details>
|
|
393
234
|
|
|
394
|
-
>
|
|
235
|
+
<details>
|
|
236
|
+
<summary><strong>๐ง An auto-generated <code>decision-log.md</code> seed (real excerpt)</strong></summary>
|
|
395
237
|
|
|
396
|
-
|
|
238
|
+
```markdown
|
|
239
|
+
## 2026-04-26 โ Hexagonal ports & adapters with MyBatis-only persistence
|
|
397
240
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
241
|
+
- **Context:** `io.spring.core.*` exposes `*Repository` ports (e.g.,
|
|
242
|
+
`io.spring.core.article.ArticleRepository`) implemented by
|
|
243
|
+
`io.spring.infrastructure.repository.MyBatis*Repository` adapters.
|
|
244
|
+
The domain layer has zero `org.springframework.*` /
|
|
245
|
+
`org.apache.ibatis.*` / `io.spring.infrastructure.*` imports.
|
|
246
|
+
- **Options considered:** JPA/Hibernate, Spring Data, MyBatis-Plus
|
|
247
|
+
`BaseMapper`. None adopted.
|
|
248
|
+
- **Decision:** MyBatis 3 (`mybatis-spring-boot-starter:2.2.2`) with
|
|
249
|
+
hand-written XML statements under `src/main/resources/mapper/*.xml`.
|
|
250
|
+
Hexagonal port/adapter wiring keeps the domain framework-free.
|
|
251
|
+
- **Consequences:** Every SQL lives in XML โ `@Select`/`@Insert`/`@Update`/`@Delete`
|
|
252
|
+
annotations are forbidden. New aggregates require both a
|
|
253
|
+
`core.{aggregate}.{Aggregate}Repository` port AND a
|
|
254
|
+
`MyBatis{Aggregate}Repository` adapter; introducing a JPA repository would
|
|
255
|
+
split the persistence model.
|
|
401
256
|
```
|
|
402
257
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
> **v2.1.0 gap-fill:** Pass 4 also ensures `claudeos-core/skills/00.shared/MANIFEST.md` exists. If Pass 3c omitted it (possible on skill-sparse projects because the stack `pass3.md` templates list `MANIFEST.md` among generation targets without marking it REQUIRED), the gap-fill creates a minimal stub so that `.claude/rules/50.sync/02.skills-sync.md` (v2.2.0 path โ the sync rule count was reduced from 3 to 2, so what was `03` is now `02`) always has a valid reference target. Idempotent: skips if the file already has real content (>20 chars).
|
|
258
|
+
Pass 4 seeds `decision-log.md` with the architectural decisions extracted from `pass2-merged.json` so future sessions remember *why* the codebase looks the way it does โ not just *what* it looks like. Every option ("JPA/Hibernate", "MyBatis-Plus") and every consequence is grounded in the actual `build.gradle` dependency block.
|
|
406
259
|
|
|
407
|
-
>
|
|
260
|
+
</details>
|
|
408
261
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
```bash
|
|
412
|
-
# Generate metadata (required before other checks)
|
|
413
|
-
node claudeos-core-tools/manifest-generator/index.js
|
|
414
|
-
|
|
415
|
-
# Run all checks
|
|
416
|
-
node claudeos-core-tools/health-checker/index.js
|
|
262
|
+
---
|
|
417
263
|
|
|
418
|
-
|
|
419
|
-
node claudeos-core-tools/plan-validator/index.js --check # Plan โ disk consistency
|
|
420
|
-
node claudeos-core-tools/sync-checker/index.js # Unregistered/orphaned files
|
|
421
|
-
node claudeos-core-tools/content-validator/index.js # File quality checks (incl. memory/ section [9/9])
|
|
422
|
-
node claudeos-core-tools/pass-json-validator/index.js # Pass 1โ4 JSON + completion marker checks
|
|
423
|
-
```
|
|
264
|
+
## Quick Start
|
|
424
265
|
|
|
425
|
-
|
|
266
|
+
**Prerequisites:** Node.js 18+, [Claude Code](https://docs.anthropic.com/en/docs/claude-code) installed and authenticated.
|
|
426
267
|
|
|
427
268
|
```bash
|
|
428
|
-
#
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
# Check CLAUDE.md
|
|
432
|
-
head -30 CLAUDE.md
|
|
269
|
+
# 1. Go to your project root
|
|
270
|
+
cd my-spring-boot-project
|
|
433
271
|
|
|
434
|
-
#
|
|
435
|
-
cat claudeos-core/standard/00.core/01.project-overview.md | head -20
|
|
436
|
-
|
|
437
|
-
# Check rules
|
|
438
|
-
ls .claude/rules/*/
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
> **Tip:** If any step fails, you can fix the issue and re-run just that step. Pass 1/2 results are cached โ if `pass1-N.json` or `pass2-merged.json` already exists, the automated pipeline skips them. Use `npx claudeos-core init --force` to delete previous results and start fresh.
|
|
442
|
-
|
|
443
|
-
### Start Using
|
|
444
|
-
|
|
445
|
-
```
|
|
446
|
-
# In Claude Code โ just ask naturally:
|
|
447
|
-
"Create a CRUD for the order domain"
|
|
448
|
-
"Add user authentication API"
|
|
449
|
-
"Refactor this code to match project patterns"
|
|
450
|
-
|
|
451
|
-
# Claude Code automatically references your generated Standards, Rules, and Skills.
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
---
|
|
455
|
-
|
|
456
|
-
## How It Works โ 4-Pass Pipeline
|
|
457
|
-
|
|
458
|
-
```
|
|
272
|
+
# 2. Run init (this analyzes your code and asks Claude to write the rules)
|
|
459
273
|
npx claudeos-core init
|
|
460
|
-
โ
|
|
461
|
-
โโโ [1] npm install โ Dependencies (~10s)
|
|
462
|
-
โโโ [2] Directory structure โ Create folders (~1s)
|
|
463
|
-
โโโ [3] plan-installer (Node.js) โ Project scan (~5s)
|
|
464
|
-
โ โโโ Auto-detect stack (multi-stack aware)
|
|
465
|
-
โ โโโ Extract domain list (tagged: backend/frontend)
|
|
466
|
-
โ โโโ Split into domain groups (per type)
|
|
467
|
-
โ โโโ Build pass3-context.json (slim summary, v2.1.0)
|
|
468
|
-
โ โโโ Select stack-specific prompts (per type)
|
|
469
|
-
โ
|
|
470
|
-
โโโ [4] Pass 1 ร N (claude -p) โ Deep code analysis (~2-8min)
|
|
471
|
-
โ โโโ โ๏ธ Backend groups โ backend-specific prompt
|
|
472
|
-
โ โโโ ๐จ Frontend groups โ frontend-specific prompt
|
|
473
|
-
โ
|
|
474
|
-
โโโ [5] Pass 2 ร 1 (claude -p) โ Merge analysis (~1min)
|
|
475
|
-
โ โโโ Consolidate ALL Pass 1 results into pass2-merged.json
|
|
476
|
-
โ
|
|
477
|
-
โโโ [6] Pass 3 (split mode, v2.1.0) โ Generate everything
|
|
478
|
-
โ โ
|
|
479
|
-
โ โโโ 3a ร 1 (claude -p) โ Fact extraction (~5-10min)
|
|
480
|
-
โ โ โโโ Read pass2-merged.json once โ pass3a-facts.md
|
|
481
|
-
โ โ
|
|
482
|
-
โ โโโ 3b-core ร 1 (claude -p) โ CLAUDE.md + common standard/rules
|
|
483
|
-
โ โโโ 3b-1..N ร N (claude -p) โ Domain standards/rules (โค15 domains/batch)
|
|
484
|
-
โ โ
|
|
485
|
-
โ โโโ 3c-core ร 1 (claude -p) โ Guides + shared skills + MANIFEST.md
|
|
486
|
-
โ โโโ 3c-1..N ร N (claude -p) โ Domain sub-skills (โค15 domains/batch)
|
|
487
|
-
โ โ
|
|
488
|
-
โ โโโ 3d-aux ร 1 (claude -p) โ database/ + mcp-guide/ stubs
|
|
489
|
-
โ
|
|
490
|
-
โโโ [7] Pass 4 ร 1 (claude -p) โ Memory scaffolding (~30s-5min)
|
|
491
|
-
โ โโโ Seed memory/ (decision-log, failure-patterns, โฆ)
|
|
492
|
-
โ โโโ Generate 60.memory/ rules
|
|
493
|
-
โ โโโ Append "Memory (L4)" section to CLAUDE.md
|
|
494
|
-
โ โโโ Gap-fill: ensure skills/00.shared/MANIFEST.md exists (v2.1.0)
|
|
495
|
-
โ
|
|
496
|
-
โโโ [8] Verification โ Auto-run health checker
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
### Why 4 Passes?
|
|
500
|
-
|
|
501
|
-
**Pass 1** is the only pass that reads your source code. It selects representative files per domain and extracts patterns across 55โ95 analysis categories (per stack). For large projects, Pass 1 runs multiple times โ one per domain group. In multi-stack projects (e.g., Java backend + React frontend), backend and frontend domains use **different analysis prompts** tailored to each stack.
|
|
502
274
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
**Pass 3** (split mode, v2.1.0) takes the merged analysis and generates the entire file ecosystem (CLAUDE.md, rules, standards, skills, guides) across multiple sequential `claude -p` calls. The key insight is that output-accumulation overflow is not predictable from input size: single-call Pass 3 worked fine on 2-domain projects and reliably failed at ~5 domains, and the failure boundary shifted depending on how verbose each file happened to be. Split mode sidesteps this entirely โ each stage starts with a fresh context window and writes a bounded subset of files. Cross-stage consistency (which was the main advantage of the single-call approach) is preserved by `pass3a-facts.md`, a 5โ10 KB distilled fact sheet that every subsequent stage references.
|
|
506
|
-
|
|
507
|
-
The Pass 3 prompt template also includes a **Phase 1 "Read Once, Extract Facts" block** with five rules that further constrain output volume:
|
|
508
|
-
|
|
509
|
-
- **Rule A** โ Reference the fact table; don't re-read `pass2-merged.json`.
|
|
510
|
-
- **Rule B** โ Idempotent file writing (skip if target exists with real content), making Pass 3 safely re-runnable after interruption.
|
|
511
|
-
- **Rule C** โ Cross-file consistency enforced via the fact table as single source of truth.
|
|
512
|
-
- **Rule D** โ Output conciseness: one line (`[WRITE]`/`[SKIP]`) between file writes, no restating the fact table, no echoing file content.
|
|
513
|
-
- **Rule E** โ Batch idempotent check: one `Glob` at PHASE 2 start instead of per-target `Read` calls.
|
|
514
|
-
|
|
515
|
-
In **v2.2.0**, Pass 3 also inlines a deterministic CLAUDE.md scaffold (`pass-prompts/templates/common/claude-md-scaffold.md`) into the prompt. This fixes the 8 top-level section titles and order so the generated `CLAUDE.md` no longer drifts across projects, while still letting per-section content adapt to each project. The stack-detector's new `.env`-parser (`lib/env-parser.js`) supplies `stack.envInfo` to the prompt so port/host/API-target rows match what the project actually declares rather than framework defaults.
|
|
516
|
-
|
|
517
|
-
**Pass 4** scaffolds the L4 Memory layer: persistent team knowledge files (decision-log, failure-patterns, compaction policy, auto-rule-update) plus the `60.memory/` rules that tell future sessions when and how to read/write those files. The memory layer is what lets Claude Code accumulate lessons across sessions instead of re-discovering them each time. When `--lang` is non-English, the fallback static content is translated via Claude before being written. v2.1.0 adds a gap-fill for `skills/00.shared/MANIFEST.md` in case Pass 3c omitted it.
|
|
518
|
-
|
|
519
|
-
---
|
|
275
|
+
# 3. Done. Open Claude Code and start coding โ your rules are already loaded.
|
|
276
|
+
```
|
|
520
277
|
|
|
521
|
-
|
|
278
|
+
**What you get** after `init` finishes:
|
|
522
279
|
|
|
523
280
|
```
|
|
524
281
|
your-project/
|
|
525
|
-
โ
|
|
526
|
-
โโโ CLAUDE.md โ Claude Code entry point (deterministic 8-section structure, v2.2.0)
|
|
527
|
-
โ
|
|
528
282
|
โโโ .claude/
|
|
529
|
-
โ โโโ rules/
|
|
530
|
-
โ โโโ 00.core/
|
|
531
|
-
โ โโโ 10.backend/
|
|
532
|
-
โ โโโ 20.frontend/
|
|
533
|
-
โ โโโ 30.security-db/
|
|
534
|
-
โ โโโ 40.infra/
|
|
535
|
-
โ โโโ 50.sync/
|
|
536
|
-
โ
|
|
537
|
-
โ
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
โ
|
|
541
|
-
โ โ โโโ
|
|
542
|
-
โ โ โโโ
|
|
543
|
-
โ โ โโโ
|
|
544
|
-
โ โ โโโ
|
|
545
|
-
โ โ โโโ
|
|
546
|
-
โ โ โโโ
|
|
547
|
-
โ โ โโโ
|
|
548
|
-
โ โ
|
|
549
|
-
โ
|
|
550
|
-
โ
|
|
551
|
-
โ
|
|
552
|
-
โ
|
|
553
|
-
โ
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
โ โ โโโ 00.core/ โ Overview, architecture, naming
|
|
559
|
-
โ โ โโโ 10.backend-api/ โ API patterns (stack-specific)
|
|
560
|
-
โ โ โโโ 20.frontend-ui/ โ Frontend patterns (if detected)
|
|
561
|
-
โ โ โโโ 30.security-db/ โ Security, DB schema, utilities
|
|
562
|
-
โ โ โโโ 40.infra/ โ Config, logging, CI/CD
|
|
563
|
-
โ โ โโโ 50.verification/ โ Build verification, testing
|
|
564
|
-
โ โ โโโ 60.domains/ โ Per-domain standards (written by Pass 3b-N, v2.1.0)
|
|
565
|
-
โ โ โโโ 90.optional/ โ Optional conventions (stack-specific extras)
|
|
566
|
-
โ โโโ skills/ โ CRUD/page scaffolding skills
|
|
567
|
-
โ โ โโโ 00.shared/MANIFEST.md โ Single source of truth for registered skills
|
|
568
|
-
โ โโโ guide/ โ Onboarding, FAQ, troubleshooting (9 files)
|
|
569
|
-
โ โโโ database/ โ DB schema, migration guide
|
|
570
|
-
โ โโโ mcp-guide/ โ MCP server integration guide
|
|
571
|
-
โ โโโ memory/ โ L4: team knowledge (4 files) โ commit these
|
|
572
|
-
โ โโโ decision-log.md โ "Why" behind design decisions
|
|
573
|
-
โ โโโ failure-patterns.md โ Recurring errors & fixes (auto-scored โ `npx claudeos-core memory score`)
|
|
574
|
-
โ โโโ compaction.md โ 4-stage compaction strategy (run `npx claudeos-core memory compact`)
|
|
575
|
-
โ โโโ auto-rule-update.md โ Rule improvement proposals (`npx claudeos-core memory propose-rules`)
|
|
576
|
-
โ
|
|
577
|
-
โโโ claudeos-core-tools/ โ This toolkit (don't modify)
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
Every standard file includes โ
correct examples, โ incorrect examples, and a rules summary table โ all derived from your actual code patterns, not generic templates.
|
|
581
|
-
|
|
582
|
-
> **v2.1.0 note:** `claudeos-core/plan/` is no longer generated. Master plans were an internal backup that Claude Code didn't consume at runtime, and aggregating them in Pass 3 was a primary cause of output-accumulation overflow. Use `git` for backup/restore instead. Projects upgrading from v2.0.x can safely delete any existing `claudeos-core/plan/` directory.
|
|
583
|
-
|
|
584
|
-
### Gitignore recommendations
|
|
585
|
-
|
|
586
|
-
**Do commit** (team knowledge โ meant to be shared):
|
|
587
|
-
- `CLAUDE.md` โ Claude Code entry point
|
|
588
|
-
- `.claude/rules/**` โ auto-loaded rules
|
|
589
|
-
- `claudeos-core/standard/**`, `skills/**`, `guide/**`, `database/**`, `mcp-guide/**`, `plan/**` โ generated documentation
|
|
590
|
-
- `claudeos-core/memory/**` โ decision history, failure patterns, rule proposals
|
|
591
|
-
|
|
592
|
-
**Do NOT commit** (regeneratable build artifacts):
|
|
593
|
-
|
|
594
|
-
```gitignore
|
|
595
|
-
# ClaudeOS-Core โ generated analysis & translation cache
|
|
596
|
-
claudeos-core/generated/
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
The `generated/` directory contains analysis JSON (`pass1-*.json`, `pass2-merged.json`), prompts (`pass1/2/3/4-prompt.md`), Pass completion markers (`pass3-complete.json`, `pass4-memory.json`), translation cache (`.i18n-cache-<lang>.json`), and the transient staging directory (`.staged-rules/`) โ all rebuildable by re-running `npx claudeos-core init`.
|
|
283
|
+
โ โโโ rules/ โ Auto-loaded by Claude Code
|
|
284
|
+
โ โโโ 00.core/ (general rules โ naming, architecture)
|
|
285
|
+
โ โโโ 10.backend/ (backend stack rules, if any)
|
|
286
|
+
โ โโโ 20.frontend/ (frontend stack rules, if any)
|
|
287
|
+
โ โโโ 30.security-db/ (security & DB conventions)
|
|
288
|
+
โ โโโ 40.infra/ (env, logging, CI/CD)
|
|
289
|
+
โ โโโ 50.sync/ (doc-sync reminders โ rules only)
|
|
290
|
+
โ โโโ 60.memory/ (memory rules โ Pass 4, rules only)
|
|
291
|
+
โ โโโ 70.domains/{type}/ (per-domain rules, type = backend|frontend)
|
|
292
|
+
โ โโโ 80.verification/ (testing strategy + build verification reminders)
|
|
293
|
+
โโโ claudeos-core/
|
|
294
|
+
โ โโโ standard/ โ Reference docs (mirror category structure)
|
|
295
|
+
โ โ โโโ 00.core/ (project overview, architecture, naming)
|
|
296
|
+
โ โ โโโ 10.backend/ (backend reference โ if backend stack)
|
|
297
|
+
โ โ โโโ 20.frontend/ (frontend reference โ if frontend stack)
|
|
298
|
+
โ โ โโโ 30.security-db/ (security & DB reference)
|
|
299
|
+
โ โ โโโ 40.infra/ (env / logging / CI-CD reference)
|
|
300
|
+
โ โ โโโ 70.domains/{type}/ (per-domain reference)
|
|
301
|
+
โ โ โโโ 80.verification/ (build / startup / testing reference โ standard only)
|
|
302
|
+
โ โ โโโ 90.optional/ (stack-specific extras โ standard only)
|
|
303
|
+
โ โโโ skills/ (reusable patterns Claude can apply)
|
|
304
|
+
โ โโโ guide/ (how-to guides for common tasks)
|
|
305
|
+
โ โโโ database/ (schema overview, migration guide)
|
|
306
|
+
โ โโโ mcp-guide/ (MCP integration notes)
|
|
307
|
+
โ โโโ memory/ (decision log, failure patterns, compaction)
|
|
308
|
+
โโโ CLAUDE.md (the index Claude reads first)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Categories sharing the same number prefix between `rules/` and `standard/` represent the same conceptual area (e.g., `10.backend` rules โ `10.backend` standards). Rules-only categories: `50.sync` (doc sync reminders) and `60.memory` (Pass 4 memory). Standard-only category: `90.optional` (stack-specific extras with no enforcement). All other prefixes (`00`, `10`, `20`, `30`, `40`, `70`, `80`) appear in BOTH `rules/` and `standard/`. Claude Code now knows your project.
|
|
600
312
|
|
|
601
313
|
---
|
|
602
314
|
|
|
603
|
-
##
|
|
604
|
-
|
|
605
|
-
Pass 3's split mode scales stage count with domain count. The batch sub-division kicks in at 16 domains to keep each stage under ~50 files of output, which is the empirical safe range for `claude -p` before output-accumulation overflow starts.
|
|
606
|
-
|
|
607
|
-
| Project Size | Domains | Pass 3 Stages | Total `claude -p` | Est. Time |
|
|
608
|
-
|---|---|---|---|---|
|
|
609
|
-
| Small | 1โ4 | 4 (`3a`, `3b-core`, `3c-core`, `3d-aux`) | 7 (Pass 1 + 2 + 4 stages of Pass 3 + Pass 4) | ~10โ15 min |
|
|
610
|
-
| Medium | 5โ15 | 4 | 8โ9 | ~25โ45 min |
|
|
611
|
-
| Large | 16โ30 | **8** (3b, 3c each split into 2 batches) | 11โ12 | **~60โ105 min** |
|
|
612
|
-
| X-Large | 31โ45 | 10 | 13โ14 | ~100โ150 min |
|
|
613
|
-
| XX-Large | 46โ60 | 12 | 15โ16 | ~150โ200 min |
|
|
614
|
-
| XXX-Large | 61+ | 14+ | 17+ | 200 min+ |
|
|
315
|
+
## Who is this for?
|
|
615
316
|
|
|
616
|
-
|
|
317
|
+
| You are... | The pain this removes |
|
|
318
|
+
|---|---|
|
|
319
|
+
| **A solo dev** starting a new project with Claude Code | "Teach Claude my conventions every session" โ gone. `CLAUDE.md` + 8-category `.claude/rules/` generated in one pass. |
|
|
320
|
+
| **A team lead** maintaining shared standards across repos | `.claude/rules/` drift as people rename packages, switch ORMs, or change response wrappers. ClaudeOS-Core re-syncs deterministically โ same input, byte-identical output, no diff noise. |
|
|
321
|
+
| **Already using Claude Code** but tired of fixing generated code | Wrong response wrapper, wrong package layout, JPA when you use MyBatis, `try/catch` scattered when your project uses centralized middleware. The scanner extracts your real conventions; every Claude pass runs against an explicit path allowlist. |
|
|
322
|
+
| **Onboarding to a new repo** (existing project, joining a team) | Run `init` on the repo, get a living architecture map: stack table in CLAUDE.md, per-layer rules with โ
/โ examples, decision log seeded with "why" behind major choices (JPA vs MyBatis, REST vs GraphQL, etc.). Reading 5 files beats reading 5,000 source files. |
|
|
323
|
+
| **Working in Korean / Japanese / Chinese / 7 more languages** | Most Claude Code rule generators are English-only. ClaudeOS-Core writes the full set in **10 languages** (`en/ko/ja/zh-CN/es/vi/hi/ru/fr/de`) with **byte-identical structural validation** โ same `claude-md-validator` verdict regardless of output language. |
|
|
324
|
+
| **Running on a monorepo** (Turborepo, pnpm/yarn workspaces, Lerna) | Backend + frontend domains analyzed in one run with separate prompts; `apps/*/` and `packages/*/` walked automatically; per-stack rules emitted under `70.domains/{type}/`. |
|
|
325
|
+
| **Contributing to OSS or experimenting** | Output is gitignore-friendly โ `claudeos-core/` is your local working dir, only `CLAUDE.md` + `.claude/` need to ship. Resume-safe if interrupted; idempotent on re-runs (your manual edits to rules survive without `--force`). |
|
|
617
326
|
|
|
618
|
-
|
|
327
|
+
**Not a fit if:** you want a one-size-fits-all preset bundle of agents/skills/rules that works on day one without a scan step (see [docs/comparison.md](docs/comparison.md) for what fits where), your project doesn't match one of the [supported stacks](#supported-stacks) yet, or you only need a single `CLAUDE.md` (built-in `claude /init` is enough โ no need to install another tool).
|
|
619
328
|
|
|
620
329
|
---
|
|
621
330
|
|
|
622
|
-
##
|
|
623
|
-
|
|
624
|
-
ClaudeOS-Core includes 5 built-in verification tools that run automatically after generation:
|
|
625
|
-
|
|
626
|
-
```bash
|
|
627
|
-
# Run all checks at once (recommended)
|
|
628
|
-
npx claudeos-core health
|
|
331
|
+
## How does it work?
|
|
629
332
|
|
|
630
|
-
|
|
631
|
-
npx claudeos-core validate # Plan โ disk comparison
|
|
632
|
-
npx claudeos-core refresh # Disk โ Plan sync
|
|
633
|
-
npx claudeos-core restore # Plan โ Disk restore
|
|
333
|
+
ClaudeOS-Core inverts the usual Claude Code workflow:
|
|
634
334
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
node claudeos-core-tools/plan-validator/index.js --check
|
|
639
|
-
node claudeos-core-tools/sync-checker/index.js
|
|
335
|
+
```
|
|
336
|
+
Usual: You describe project โ Claude guesses your stack โ Claude writes docs
|
|
337
|
+
This: Code reads your stack โ Code passes confirmed facts to Claude โ Claude writes docs from facts
|
|
640
338
|
```
|
|
641
339
|
|
|
642
|
-
|
|
643
|
-
|---|---|
|
|
644
|
-
| **manifest-generator** | Builds metadata JSON (`rule-manifest.json`, `sync-map.json`, initializes `stale-report.json`); indexes 7 directories including `memory/` (`totalMemory` in summary). v2.1.0: `plan-manifest.json` is no longer generated since master plans were removed. |
|
|
645
|
-
| **plan-validator** | Validates master plan `<file>` blocks against disk for projects that still have `claudeos-core/plan/` (legacy upgrade case). v2.1.0: skips `plan-sync-status.json` emission when `plan/` is absent or empty โ `stale-report.json` still records a passing no-op. |
|
|
646
|
-
| **sync-checker** | Detects unregistered files (on disk but not in plan) and orphaned entries โ covers 7 directories (added `memory/` in v2.0.0). Exits cleanly when `sync-map.json` has no mappings (v2.1.0 default state). |
|
|
647
|
-
| **content-validator** | 10-check quality gate. Checks 1โ9 cover empty files, missing โ
/โ examples, required sections, and L4 memory scaffold integrity (decision-log heading dates, failure-pattern required fields, fence-aware parsing). **Check 10 (v2.3.0)** adds path-claim verification across all generated `.md` files and MANIFEST โ CLAUDE.md ยง6 cross-reference โ catches `STALE_PATH` (LLM-fabricated paths from identifier-to-filename renormalization, framework-convention entry-point invention, or plausibly-named utility invention) and `MANIFEST_DRIFT` (registered skills not mentioned in CLAUDE.md or vice versa), with an orchestrator/sub-skill exception that recognizes the canonical "ยง6 entry point + MANIFEST registry" split. |
|
|
648
|
-
| **claude-md-validator (v2.3.0)** | Structural invariant check on `CLAUDE.md` using only language-invariant signals (markdown syntax, literal file names, section/sub-section/table-row counts). 25 checks, language-agnostic โ identical verdicts across all 10 output languages. Invoked via `npx claudeos-core lint`. |
|
|
649
|
-
| **pass-json-validator** | Validates Pass 1โ4 JSON structure plus the `pass3-complete.json` (split-mode shape, v2.1.0) and `pass4-memory.json` completion markers |
|
|
340
|
+
The pipeline runs in **three stages**, with code on both sides of the LLM call:
|
|
650
341
|
|
|
651
|
-
|
|
342
|
+
**1. Step A โ Scanner (deterministic, no LLM).** A Node.js scanner walks your project root, reads `package.json` / `build.gradle` / `pom.xml` / `pyproject.toml`, parses `.env*` files (with sensitive-variable redaction for `PASSWORD/SECRET/TOKEN/JWT_SECRET/...`), classifies your architecture pattern (Java's 5 patterns A/B/C/D/E, Kotlin CQRS / multi-module, Next.js App vs. Pages Router, FSD, components-pattern), discovers domains, and builds an explicit allowlist of every source file path that exists. Output: `project-analysis.json` โ the single source of truth for what follows.
|
|
652
343
|
|
|
653
|
-
|
|
344
|
+
**2. Step B โ 4-Pass Claude pipeline (constrained by Step A's facts).**
|
|
345
|
+
- **Pass 1** reads representative files per domain group and extracts ~50โ100 conventions per domain โ response wrappers, logging libraries, error handling, naming conventions, test patterns. Runs once per domain group (`max 4 domains, 40 files per group`) so context never overflows.
|
|
346
|
+
- **Pass 2** merges all per-domain analysis into a project-wide picture and resolves disagreements by picking the dominant convention.
|
|
347
|
+
- **Pass 3** writes `CLAUDE.md` + `.claude/rules/` + `claudeos-core/standard/` + skills + guides โ split into stages (`3a` facts โ `3b-core/3b-N` rules+standards โ `3c-core/3c-N` skills+guides โ `3d-aux` database+mcp-guide) so each stage's prompt fits the LLM's context window even when `pass2-merged.json` is large. Sub-divides 3b/3c into โค15-domain batches for โฅ16-domain projects.
|
|
348
|
+
- **Pass 4** seeds the L4 memory layer (`decision-log.md`, `failure-patterns.md`, `compaction.md`, `auto-rule-update.md`) and adds universal scaffold rules. Pass 4 is **forbidden from modifying `CLAUDE.md`** โ Pass 3's Section 8 is authoritative.
|
|
654
349
|
|
|
655
|
-
|
|
350
|
+
**3. Step C โ Verification (deterministic, no LLM).** Five validators check the output:
|
|
351
|
+
- `claude-md-validator` โ 25 structural checks on `CLAUDE.md` (8 sections, H3/H4 counts, memory file uniqueness, T1 canonical heading invariant). Language-invariant: same verdict regardless of `--lang`.
|
|
352
|
+
- `content-validator` โ 10 content checks including path-claim verification (`STALE_PATH` catches fabricated `src/...` references) and MANIFEST drift detection.
|
|
353
|
+
- `pass-json-validator` โ Pass 1/2/3/4 JSON well-formedness + stack-aware section count.
|
|
354
|
+
- `plan-validator` โ plan โ disk consistency (legacy, mostly no-op since v2.1.0).
|
|
355
|
+
- `sync-checker` โ disk โ `sync-map.json` registration consistency across 7 tracked dirs.
|
|
656
356
|
|
|
657
|
-
|
|
357
|
+
Three severity tiers (`fail` / `warn` / `advisory`) so warnings never deadlock CI on LLM hallucinations the user can fix manually.
|
|
658
358
|
|
|
659
|
-
|
|
660
|
-
|---|---|---|
|
|
661
|
-
| `CLAUDE.md` | Every conversation start | Always |
|
|
662
|
-
| `.claude/rules/00.core/*` | When any file is edited (`paths: ["**/*"]`) | Always |
|
|
663
|
-
| `.claude/rules/10.backend/*` | When any file is edited (`paths: ["**/*"]`) | Always |
|
|
664
|
-
| `.claude/rules/20.frontend/*` | When any frontend file is edited (scoped to component/page/style paths) | Conditional |
|
|
665
|
-
| `.claude/rules/30.security-db/*` | When any file is edited (`paths: ["**/*"]`) | Always |
|
|
666
|
-
| `.claude/rules/40.infra/*` | Only when editing config/infra files (scoped paths) | Conditional |
|
|
667
|
-
| `.claude/rules/50.sync/*` | Only when editing claudeos-core files (scoped paths) | Conditional |
|
|
668
|
-
| `.claude/rules/60.memory/*` | When `claudeos-core/memory/*` is edited (scoped to memory paths) โ instructs **how** to read/write the on-demand memory layer | Conditional (v2.0.0) |
|
|
359
|
+
The invariant that ties it all together: **Claude can only cite paths that actually exist in your code**, because Step A hands it a finite allowlist. If the LLM still tries to invent something (rare but happens on certain seeds), Step C catches it before the docs ship.
|
|
669
360
|
|
|
670
|
-
|
|
361
|
+
For per-pass details, marker-based resume, the staged-rules workaround for Claude Code's `.claude/` sensitive-path block, and stack detection internals, see [docs/architecture.md](docs/architecture.md).
|
|
671
362
|
|
|
672
|
-
|
|
363
|
+
---
|
|
673
364
|
|
|
674
|
-
|
|
675
|
-
- `claudeos-core/database/**` โ DB schema (for queries, mappers, migrations)
|
|
676
|
-
- `claudeos-core/memory/**` (v2.0.0) โ L4 team knowledge layer; **not** auto-loaded (would be too noisy on every conversation). Instead, the `60.memory/*` rules tell Claude *when* to Read these files: at session start (skim recent `decision-log.md` + high-importance `failure-patterns.md`), and append-on-demand when making decisions or hitting recurring errors.
|
|
365
|
+
## Supported Stacks
|
|
677
366
|
|
|
678
|
-
|
|
367
|
+
12 stacks, auto-detected from your project files:
|
|
679
368
|
|
|
680
|
-
|
|
369
|
+
**Backend:** Java/Spring Boot ยท Kotlin/Spring Boot ยท Node/Express ยท Node/Fastify ยท Node/NestJS ยท Python/Django ยท Python/FastAPI ยท Python/Flask
|
|
681
370
|
|
|
682
|
-
|
|
371
|
+
**Frontend:** Node/Next.js ยท Node/Vite ยท Angular ยท Vue/Nuxt
|
|
683
372
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
| `claudeos-core/generated/` | Build metadata JSON, prompts, Pass markers, translation cache, `.staged-rules/`. Not for coding. |
|
|
688
|
-
| `claudeos-core/guide/` | Onboarding guides for humans. |
|
|
689
|
-
| `claudeos-core/mcp-guide/` | MCP server docs. Not for coding. |
|
|
690
|
-
| `claudeos-core/memory/` (auto-load) | **Auto-load disabled** by design โ would balloon context on every conversation. Read on-demand via the `60.memory/*` rules instead (e.g. session-start scan of `failure-patterns.md`). Always commit these files. |
|
|
373
|
+
Multi-stack projects (e.g., Spring Boot backend + Next.js frontend) work out of the box.
|
|
374
|
+
|
|
375
|
+
For detection rules and what each scanner extracts, see [docs/stacks.md](docs/stacks.md).
|
|
691
376
|
|
|
692
377
|
---
|
|
693
378
|
|
|
694
379
|
## Daily Workflow
|
|
695
380
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
```
|
|
699
|
-
# Just use Claude Code as normal โ it references your standards automatically:
|
|
700
|
-
"Create a CRUD for the order domain"
|
|
701
|
-
"Add user profile update API"
|
|
702
|
-
"Refactor this code to match project patterns"
|
|
703
|
-
```
|
|
704
|
-
|
|
705
|
-
### After Manually Editing Standards
|
|
381
|
+
Three commands cover ~95% of usage:
|
|
706
382
|
|
|
707
383
|
```bash
|
|
708
|
-
#
|
|
709
|
-
npx claudeos-core
|
|
710
|
-
|
|
711
|
-
# Verify everything is consistent
|
|
712
|
-
npx claudeos-core health
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
### When Docs Get Corrupted
|
|
384
|
+
# First time on a project
|
|
385
|
+
npx claudeos-core init
|
|
716
386
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
# longer generated). Commit your generated docs regularly so you can roll
|
|
720
|
-
# back specific files without regenerating:
|
|
721
|
-
git checkout HEAD -- .claude/rules/ claudeos-core/
|
|
387
|
+
# After you manually edited standards or rules
|
|
388
|
+
npx claudeos-core lint
|
|
722
389
|
|
|
723
|
-
#
|
|
724
|
-
npx claudeos-core
|
|
390
|
+
# Health check (run before commits, or in CI)
|
|
391
|
+
npx claudeos-core health
|
|
725
392
|
```
|
|
726
393
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
The L4 Memory layer (`claudeos-core/memory/`) accumulates team knowledge across sessions. Three CLI subcommands keep it healthy:
|
|
394
|
+
Two more for memory layer maintenance:
|
|
730
395
|
|
|
731
396
|
```bash
|
|
732
|
-
# Compact
|
|
397
|
+
# Compact the failure-patterns log (run periodically)
|
|
733
398
|
npx claudeos-core memory compact
|
|
734
|
-
# Stage 1: summarize aged entries (>30 days, body โ one-line)
|
|
735
|
-
# Stage 2: merge duplicate headings (frequency summed, latest fix kept)
|
|
736
|
-
# Stage 3: drop low-importance + aged (importance <3 AND lastSeen >60 days)
|
|
737
|
-
# Stage 4: enforce 400-line cap per file (oldest low-importance dropped first)
|
|
738
|
-
|
|
739
|
-
# Score: re-rank failure-patterns.md entries by importance
|
|
740
|
-
npx claudeos-core memory score
|
|
741
|
-
# importance = round(frequency ร 1.5 + recency ร 5), capped at 10
|
|
742
|
-
# Run after appending several new failure patterns
|
|
743
399
|
|
|
744
|
-
#
|
|
400
|
+
# Promote frequent failure patterns into proposed rules
|
|
745
401
|
npx claudeos-core memory propose-rules
|
|
746
|
-
# Reads failure-patterns.md entries with frequency โฅ 3
|
|
747
|
-
# Computes confidence (sigmoid on weighted evidence ร anchor multiplier)
|
|
748
|
-
# Writes proposals to memory/auto-rule-update.md (NOT auto-applied)
|
|
749
|
-
# Confidence โฅ 0.70 deserves serious review; accept โ edit rule + log decision
|
|
750
|
-
|
|
751
|
-
# v2.1.0: `memory --help` now routes to subcommand help (was showing top-level)
|
|
752
|
-
npx claudeos-core memory --help
|
|
753
402
|
```
|
|
754
403
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
When to write to memory (Claude does this on-demand, but you can edit manually too):
|
|
758
|
-
- **`decision-log.md`** โ append a new entry whenever you choose between competing patterns, select a library, define a team convention, or decide NOT to do something. Append-only; never edit historical entries.
|
|
759
|
-
- **`failure-patterns.md`** โ append on the **second occurrence** of a recurring error or non-obvious root cause. First-time errors don't need an entry.
|
|
760
|
-
- `compaction.md` and `auto-rule-update.md` โ generated/managed by the CLI subcommands above; don't edit by hand.
|
|
761
|
-
|
|
762
|
-
### CI/CD Integration
|
|
763
|
-
|
|
764
|
-
```yaml
|
|
765
|
-
# GitHub Actions example
|
|
766
|
-
- run: npx claudeos-core validate
|
|
767
|
-
# Exit code 1 blocks the PR
|
|
768
|
-
|
|
769
|
-
# Optional: monthly memory housekeeping (separate cron workflow)
|
|
770
|
-
- run: npx claudeos-core memory compact
|
|
771
|
-
- run: npx claudeos-core memory score
|
|
772
|
-
```
|
|
773
|
-
|
|
774
|
-
---
|
|
775
|
-
|
|
776
|
-
## How Is This Different?
|
|
777
|
-
|
|
778
|
-
### vs Other Claude Code Tools
|
|
779
|
-
|
|
780
|
-
| | ClaudeOS-Core | Everything Claude Code (50K+ โญ) | Harness | specs-generator | Claude `/init` |
|
|
781
|
-
|---|---|---|---|---|---|
|
|
782
|
-
| **Approach** | Code analyzes first, then LLM generates | Pre-built config presets | LLM designs agent teams | LLM generates spec docs | LLM writes CLAUDE.md |
|
|
783
|
-
| **Reads your source code** | โ
Deterministic static analysis | โ | โ | โ (LLM reads) | โ (LLM reads) |
|
|
784
|
-
| **Stack detection** | Code confirms (ORM, DB, build tool, pkg manager) | N/A (stack-agnostic) | LLM guesses | LLM guesses | LLM guesses |
|
|
785
|
-
| **Domain detection** | Code confirms (Java 5 patterns, Kotlin CQRS, Next.js FSD) | N/A | LLM guesses | N/A | N/A |
|
|
786
|
-
| **Same project โ Same result** | โ
Deterministic analysis | โ
(static files) | โ (LLM varies) | โ (LLM varies) | โ (LLM varies) |
|
|
787
|
-
| **Large project handling** | Domain group splitting (4 domains / 40 files per group) | N/A | No splitting | No splitting | Context window limit |
|
|
788
|
-
| **Output** | CLAUDE.md + Rules + Standards + Skills + Guides + Plans (40-50+ files) | Agents + Skills + Commands + Hooks | Agents + Skills | 6 spec documents | CLAUDE.md (1 file) |
|
|
789
|
-
| **Output location** | `.claude/rules/` (auto-loaded by Claude Code) | `.claude/` various | `.claude/agents/` + `.claude/skills/` | `.claude/steering/` + `specs/` | `CLAUDE.md` |
|
|
790
|
-
| **Post-generation verification** | โ
5 automated validators | โ | โ | โ | โ |
|
|
791
|
-
| **Multi-language output** | โ
10 languages | โ | โ | โ | โ |
|
|
792
|
-
| **Multi-stack** | โ
Backend + Frontend simultaneous | โ Stack-agnostic | โ | โ | Partial |
|
|
793
|
-
| **Persistent memory layer** | โ
L4 โ decision log + failure patterns + auto-scored rule proposals (v2.0.0) | โ | โ | โ | โ |
|
|
794
|
-
| **Agent orchestration** | โ | โ
28 agents | โ
6 patterns | โ | โ |
|
|
795
|
-
|
|
796
|
-
### The key difference in one sentence
|
|
797
|
-
|
|
798
|
-
**Other tools give Claude "generally good instructions." ClaudeOS-Core gives Claude "instructions extracted from your actual code."**
|
|
799
|
-
|
|
800
|
-
That's why Claude Code stops generating JPA code in your MyBatis project,
|
|
801
|
-
stops using `success()` when your codebase uses `ok()`,
|
|
802
|
-
and stops creating `user/controller/` directories when your project uses `controller/user/`.
|
|
803
|
-
|
|
804
|
-
### Complementary, not competing
|
|
805
|
-
|
|
806
|
-
ClaudeOS-Core focuses on **project-specific rules and standards**.
|
|
807
|
-
Other tools focus on **agent orchestration and workflows**.
|
|
808
|
-
|
|
809
|
-
You can use ClaudeOS-Core to generate your project's rules, then use ECC or Harness on top for agent teams and workflow automation. They solve different problems.
|
|
404
|
+
For each command's full options, see [docs/commands.md](docs/commands.md).
|
|
810
405
|
|
|
811
406
|
---
|
|
812
407
|
|
|
813
|
-
##
|
|
814
|
-
|
|
815
|
-
**Q: Does it modify my source code?**
|
|
816
|
-
No. It only creates `CLAUDE.md`, `.claude/rules/`, and `claudeos-core/`. Your existing code is never modified.
|
|
817
|
-
|
|
818
|
-
**Q: How much does it cost?**
|
|
819
|
-
It calls `claude -p` several times across 4 passes. In v2.1.0 split mode, Pass 3 alone expands into 4โ14+ stages depending on project size (see [Auto-scaling](#auto-scaling-by-project-size)). A typical small project (1โ15 domains) uses 8โ9 `claude -p` calls total; an 18-domain project uses 11; a 60-domain project uses 15โ17. Each stage runs with a fresh context window โ the per-call token cost is actually lower than single-call Pass 3 was, because no stage has to hold the entire file tree in one context. When `--lang` is non-English, the static fallback path may invoke a few additional `claude -p` calls for translation; results are cached in `claudeos-core/generated/.i18n-cache-<lang>.json` so subsequent runs reuse them. This is within normal Claude Code usage.
|
|
820
|
-
|
|
821
|
-
**Q: What is Pass 3 split mode and why was it added in v2.1.0?**
|
|
822
|
-
Before v2.1.0, Pass 3 made a single `claude -p` call that had to emit the entire generated file tree (`CLAUDE.md`, standards, rules, skills, guides โ typically 30โ60 files) in one response. This worked on small projects but reliably hit `Prompt is too long` output-accumulation failures at ~5 domains. The failure was not predictable from input size โ it depended on how verbose each generated file happened to be, and could strike the same project intermittently. Split mode sidesteps the problem structurally: Pass 3 is broken into sequential stages (`3a` โ `3b-core` โ `3b-N` โ `3c-core` โ `3c-N` โ `3d-aux`), each a separate `claude -p` call with a fresh context window. Cross-stage consistency is preserved by `pass3a-facts.md`, a 5โ10 KB distilled fact sheet that every later stage references instead of re-reading `pass2-merged.json`. The `pass3-complete.json` marker carries a `groupsCompleted` array so a crash during `3c-2` resumes from `3c-2` (not from `3a`), avoiding double token cost.
|
|
823
|
-
**Q: Should I commit the generated files to Git?**
|
|
824
|
-
Yes, recommended. Your team can share the same Claude Code standards. Consider adding `claudeos-core/generated/` to `.gitignore` (analysis JSON is regeneratable).
|
|
825
|
-
|
|
826
|
-
**Q: What about mixed-stack projects (e.g., Java backend + React frontend)?**
|
|
827
|
-
Fully supported. ClaudeOS-Core auto-detects both stacks, tags domains as `backend` or `frontend`, and uses stack-specific analysis prompts for each. Pass 2 merges everything, and Pass 3 generates both backend and frontend standards across its split stages โ backend domains go into some 3b/3c batches, frontend domains into others, all referencing the same `pass3a-facts.md` for consistency.
|
|
828
|
-
|
|
829
|
-
**Q: Does it work with Turborepo / pnpm workspaces / Lerna monorepos?**
|
|
830
|
-
Yes. ClaudeOS-Core detects `turbo.json`, `pnpm-workspace.yaml`, `lerna.json`, or `package.json#workspaces` and automatically scans sub-package `package.json` files for framework/ORM/DB dependencies. Domain scanning covers `apps/*/src/` and `packages/*/src/` patterns. Run from the monorepo root.
|
|
831
|
-
|
|
832
|
-
**Q: What happens on re-run?**
|
|
833
|
-
If previous Pass 1/2 results exist, an interactive prompt lets you choose: **Continue** (resume from where it stopped) or **Fresh** (delete all and start over). Use `--force` to skip the prompt and always start fresh. In v2.1.0 split mode, Pass 3 resume works at stage granularity โ if the run crashed during `3c-2`, the next `init` resumes from `3c-2` rather than restarting from `3a` (which would double the token cost). The `pass3-complete.json` marker records `mode: "split"` plus a `groupsCompleted` array to drive this logic.
|
|
834
|
-
|
|
835
|
-
**Q: Does NestJS get its own template or use the Express one?**
|
|
836
|
-
NestJS uses a dedicated `node-nestjs` template with NestJS-specific analysis categories: `@Module`, `@Injectable`, `@Controller` decorators, Guards, Pipes, Interceptors, DI container, CQRS patterns, and `Test.createTestingModule`. Express projects use the separate `node-express` template.
|
|
837
|
-
|
|
838
|
-
**Q: What about Vue / Nuxt projects?**
|
|
839
|
-
Vue/Nuxt uses a dedicated `vue-nuxt` template covering Composition API, `<script setup>`, defineProps/defineEmits, Pinia stores, `useFetch`/`useAsyncData`, Nitro server routes, and `@nuxt/test-utils`. Next.js/React projects use the `node-nextjs` template.
|
|
840
|
-
|
|
841
|
-
**Q: Does it support Kotlin?**
|
|
842
|
-
Yes. ClaudeOS-Core auto-detects Kotlin from `build.gradle.kts` or the kotlin plugin in `build.gradle`. It uses a dedicated `kotlin-spring` template with Kotlin-specific analysis (data classes, sealed classes, coroutines, extension functions, MockK, etc.).
|
|
843
|
-
|
|
844
|
-
**Q: What about CQRS / BFF architecture?**
|
|
845
|
-
Fully supported for Kotlin multi-module projects. ClaudeOS-Core reads `settings.gradle.kts`, detects module types (command, query, bff, integration) from module names, and groups the same domain across Command/Query modules. The generated standards include separate rules for command controllers vs query controllers, BFF/Feign patterns, and inter-module communication conventions.
|
|
846
|
-
|
|
847
|
-
**Q: What about Gradle multi-module monorepos?**
|
|
848
|
-
ClaudeOS-Core scans all submodules (`**/src/main/kotlin/**/*.kt`) regardless of nesting depth. Module types are inferred from naming conventions (e.g., `reservation-command-server` โ domain: `reservation`, type: `command`). Shared libraries (`shared-lib`, `integration-lib`) are also detected.
|
|
849
|
-
|
|
850
|
-
**Q: What is the L4 Memory layer (v2.0.0)? Should I commit `claudeos-core/memory/`?**
|
|
851
|
-
Yes โ **always commit** `claudeos-core/memory/`. It's persistent team knowledge: `decision-log.md` records the *why* behind architectural choices (append-only), `failure-patterns.md` registers recurring errors with importance scores so future sessions avoid them, `compaction.md` defines the 4-stage compaction policy, and `auto-rule-update.md` collects machine-generated rule improvement proposals. Unlike rules (auto-loaded by path), memory files are **on-demand** โ Claude reads them only when the `60.memory/*` rules direct it to (e.g. session-start scan of high-importance failures). This keeps context cost low while preserving long-term knowledge.
|
|
852
|
-
|
|
853
|
-
**Q: What if Pass 4 fails?**
|
|
854
|
-
The automated pipeline (`npx claudeos-core init`) has a static fallback: if `claude -p` fails or `pass4-prompt.md` is missing, it scaffolds the memory layer directly via `lib/memory-scaffold.js`. When `--lang` is non-English, the static fallback **must** translate via the `claude` CLI โ if that fails too, the run aborts with `InitError` (no silent English fallback). Re-run when `claude` is authenticated, or use `--lang en` to skip translation. Translation results are cached in `claudeos-core/generated/.i18n-cache-<lang>.json` so subsequent runs reuse them.
|
|
855
|
-
|
|
856
|
-
**Q: What do `memory compact` / `memory score` / `memory propose-rules` do?**
|
|
857
|
-
See the [Memory Layer Maintenance](#memory-layer-maintenance-v200) section above. Short version: `compact` runs the 4-stage policy (summarize aged, merge duplicates, drop low-importance aged, enforce 400-line cap); `score` re-ranks `failure-patterns.md` by importance (frequency ร recency); `propose-rules` surfaces candidate rule additions from recurring failures into `auto-rule-update.md` (not auto-applied โ review and accept/reject manually).
|
|
408
|
+
## What makes this different
|
|
858
409
|
|
|
859
|
-
|
|
860
|
-
v2.0.0 added three Pass 3 silent-failure guards (Guard 3 covers two incomplete-output variants: H2 for `guide/` and H1 for `standard/skills`). Guard 1 ("partial staged-rules move") and Guard 3 ("incomplete output โ missing/empty guide files or missing standard sentinel / empty skills") don't depend on existing rules, but Guard 2 ("zero rules detected") does โ it fires when Claude ignored the `staging-override.md` directive and tried to write directly to `.claude/` (where Claude Code's sensitive-path policy blocks it). Stale rules from a prior run would let Guard 2 false-negative โ so `--force`/`fresh` wipes `.claude/rules/` to ensure a clean detection. **Manual edits to rule files will be lost** under `--force`/`fresh`; back them up first if needed. (v2.1.0 note: Guard 3 H1 no longer checks `plan/` since master plans are no longer generated.)
|
|
410
|
+
Most Claude Code documentation tools generate from a description (you tell the tool, the tool tells Claude). ClaudeOS-Core generates from your actual source code (the tool reads, the tool tells Claude what's confirmed, Claude writes only what's confirmed).
|
|
861
411
|
|
|
862
|
-
|
|
863
|
-
Claude Code's sensitive-path policy refuses direct writes to `.claude/` from the `claude -p` subprocess (even with `--dangerously-skip-permissions`). v2.0.0 works around this by having Pass 3/4 prompts redirect all `.claude/rules/` writes to the staging directory; the Node.js orchestrator (not subject to that policy) then moves the staged tree into `.claude/rules/` after each pass. This is transparent to the user โ the directory is auto-created, auto-cleaned, and auto-moved. If a prior run crashed mid-move, the next run wipes the staging dir before retrying. In v2.1.0 split mode, the stage runner moves staged rules to `.claude/rules/` after every stage (not just at the end), so a crash mid-Pass-3 still leaves previously completed stages' rules in place.
|
|
412
|
+
Three concrete consequences:
|
|
864
413
|
|
|
865
|
-
**
|
|
866
|
-
|
|
414
|
+
1. **Deterministic stack detection.** Same project + same code = same output. No "Claude rolled differently this time."
|
|
415
|
+
2. **No invented paths.** The Pass 3 prompt explicitly lists every allowed source path; Claude can't cite paths that don't exist.
|
|
416
|
+
3. **Multi-stack aware.** Backend and frontend domains use different analysis prompts in the same run.
|
|
867
417
|
|
|
868
|
-
|
|
869
|
-
Nothing required โ v2.1.0 tools ignore `plan/` when it's absent or empty, and `plan-validator` still handles legacy projects with populated `plan/` directories for backward compatibility. You can safely delete `claudeos-core/plan/` if you don't need the master plan backups (git history is a better backup anyway). If you keep `plan/`, running `npx claudeos-core init` won't update it โ new content is not aggregated into master plans in v2.1.0. Verification tools handle both cases cleanly.
|
|
418
|
+
For a side-by-side scope comparison with other tools, see [docs/comparison.md](docs/comparison.md). The comparison is about **what each tool does**, not **which is better** โ most are complementary.
|
|
870
419
|
|
|
871
420
|
---
|
|
872
421
|
|
|
873
|
-
##
|
|
422
|
+
## Verification (post-generation)
|
|
874
423
|
|
|
875
|
-
|
|
876
|
-
pass-prompts/templates/
|
|
877
|
-
โโโ common/ # Shared header/footer + pass4 + staging-override + CLAUDE.md scaffold (v2.2.0)
|
|
878
|
-
โ โโโ header.md # Role + output-format directive (all passes)
|
|
879
|
-
โ โโโ pass3-footer.md # Post-Pass-3 health-check instruction + 5 CRITICAL guardrail blocks (v2.2.0)
|
|
880
|
-
โ โโโ pass3-phase1.md # "Read Once, Extract Facts" block with Rules A-E (v2.1.0)
|
|
881
|
-
โ โโโ pass4.md # Memory scaffolding prompt (v2.0.0)
|
|
882
|
-
โ โโโ staging-override.md # Redirects .claude/rules/** writes to .staged-rules/** (v2.0.0)
|
|
883
|
-
โ โโโ claude-md-scaffold.md # Deterministic 8-section CLAUDE.md template (v2.2.0)
|
|
884
|
-
โ โโโ lang-instructions.json # Per-language output directives (10 languages)
|
|
885
|
-
โโโ java-spring/ # Java / Spring Boot
|
|
886
|
-
โโโ kotlin-spring/ # Kotlin / Spring Boot (CQRS, BFF, multi-module)
|
|
887
|
-
โโโ node-express/ # Node.js / Express
|
|
888
|
-
โโโ node-nestjs/ # Node.js / NestJS (Module, DI, Guard, Pipe, Interceptor)
|
|
889
|
-
โโโ node-fastify/ # Node.js / Fastify
|
|
890
|
-
โโโ node-nextjs/ # Next.js / React (App Router, RSC)
|
|
891
|
-
โโโ node-vite/ # Vite SPA (React, client-side routing, VITE_ env, Vitest)
|
|
892
|
-
โโโ vue-nuxt/ # Vue / Nuxt (Composition API, Pinia, Nitro)
|
|
893
|
-
โโโ angular/ # Angular
|
|
894
|
-
โโโ python-django/ # Python / Django (DRF)
|
|
895
|
-
โโโ python-fastapi/ # Python / FastAPI
|
|
896
|
-
โโโ python-flask/ # Python / Flask (Blueprint, app factory, Jinja2)
|
|
897
|
-
```
|
|
898
|
-
|
|
899
|
-
`plan-installer` auto-detects your stack(s), then assembles type-specific prompts. NestJS, Vue/Nuxt, Vite SPA, and Flask each use dedicated templates with framework-specific analysis categories (e.g., `@Module`/`@Injectable`/Guards for NestJS; `<script setup>`/Pinia/useFetch for Vue; client-side routing/`VITE_` env for Vite; Blueprint/`app.factory`/Flask-SQLAlchemy for Flask). For multi-stack projects, separate `pass1-backend-prompt.md` and `pass1-frontend-prompt.md` are generated, while `pass3-prompt.md` combines both stacks' generation targets. In v2.1.0, the Pass 3 template is prepended with `common/pass3-phase1.md` (the "Read Once, Extract Facts" block with Rules AโE) before being sliced per split-mode stage. Pass 4 uses the shared `common/pass4.md` template (memory scaffolding) regardless of stack.
|
|
900
|
-
|
|
901
|
-
**In v2.2.0**, the Pass 3 prompt also inlines `common/claude-md-scaffold.md` (the deterministic 8-section CLAUDE.md template) between the phase1 block and the stack-specific body โ this fixes the section structure so generated CLAUDE.md files don't drift across projects while letting content adapt per-project. Templates are written **English-first**; the language injection from `lang-instructions.json` tells the LLM to translate section titles and prose at emit time into the target output language.
|
|
902
|
-
|
|
903
|
-
---
|
|
904
|
-
|
|
905
|
-
## Monorepo Support
|
|
906
|
-
|
|
907
|
-
ClaudeOS-Core automatically detects JS/TS monorepo setups and scans sub-packages for dependencies.
|
|
424
|
+
After Claude writes the docs, code verifies them. Five separate validators:
|
|
908
425
|
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
- `
|
|
913
|
-
|
|
426
|
+
| Validator | What it checks | Run by |
|
|
427
|
+
|---|---|---|
|
|
428
|
+
| `claude-md-validator` | CLAUDE.md structural invariants (8 sections, language-invariant) | `claudeos-core lint` |
|
|
429
|
+
| `content-validator` | Path claims actually exist; manifest consistency | `health` (advisory) |
|
|
430
|
+
| `pass-json-validator` | Pass 1 / 2 / 3 / 4 outputs are well-formed JSON | `health` (warn) |
|
|
431
|
+
| `plan-validator` | Saved plan matches what's on disk | `health` (fail-on-error) |
|
|
432
|
+
| `sync-checker` | Disk files match `sync-map.json` registrations (orphaned/unregistered detection) | `health` (fail-on-error) |
|
|
914
433
|
|
|
915
|
-
|
|
434
|
+
A `health-checker` orchestrates the four runtime validators with three-tier severity (fail / warn / advisory) and exits with the appropriate code for CI. `claude-md-validator` runs separately via the `lint` command since structural drift is a re-init signal, not a soft warning. Run anytime:
|
|
916
435
|
|
|
917
436
|
```bash
|
|
918
|
-
|
|
919
|
-
npx claudeos-core init
|
|
920
|
-
```
|
|
921
|
-
|
|
922
|
-
**What gets detected:**
|
|
923
|
-
- Dependencies from `apps/web/package.json` (e.g., `next`, `react`) โ frontend stack
|
|
924
|
-
- Dependencies from `apps/api/package.json` (e.g., `express`, `prisma`) โ backend stack
|
|
925
|
-
- Dependencies from `packages/db/package.json` (e.g., `drizzle-orm`) โ ORM/DB
|
|
926
|
-
- Custom workspace paths from `pnpm-workspace.yaml` (e.g., `services/*`)
|
|
927
|
-
|
|
928
|
-
**Domain scanning also covers monorepo layouts:**
|
|
929
|
-
- `apps/api/src/modules/*/` and `apps/api/src/*/` for backend domains
|
|
930
|
-
- `apps/web/app/*/`, `apps/web/src/app/*/`, `apps/web/pages/*/` for frontend domains
|
|
931
|
-
- `packages/*/src/*/` for shared package domains
|
|
932
|
-
|
|
933
|
-
```
|
|
934
|
-
my-monorepo/ โ Run here: npx claudeos-core init
|
|
935
|
-
โโโ turbo.json โ Auto-detected as Turborepo
|
|
936
|
-
โโโ apps/
|
|
937
|
-
โ โโโ web/ โ Next.js detected from apps/web/package.json
|
|
938
|
-
โ โ โโโ app/dashboard/ โ Frontend domain detected
|
|
939
|
-
โ โ โโโ package.json โ { "dependencies": { "next": "^14" } }
|
|
940
|
-
โ โโโ api/ โ Express detected from apps/api/package.json
|
|
941
|
-
โ โโโ src/modules/users/ โ Backend domain detected
|
|
942
|
-
โ โโโ package.json โ { "dependencies": { "express": "^4" } }
|
|
943
|
-
โโโ packages/
|
|
944
|
-
โ โโโ db/ โ Drizzle detected from packages/db/package.json
|
|
945
|
-
โ โโโ ui/
|
|
946
|
-
โโโ package.json โ { "workspaces": ["apps/*", "packages/*"] }
|
|
437
|
+
npx claudeos-core health
|
|
947
438
|
```
|
|
948
439
|
|
|
949
|
-
|
|
440
|
+
For each validator's checks in detail, see [docs/verification.md](docs/verification.md).
|
|
950
441
|
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
**"claude: command not found"** โ Claude Code CLI is not installed or not in PATH. See [Claude Code docs](https://code.claude.com/docs/en/overview).
|
|
954
|
-
|
|
955
|
-
**"npm install failed"** โ Node.js version may be too low. Requires v18+.
|
|
956
|
-
|
|
957
|
-
**"0 domains detected"** โ Your project structure may be non-standard. See the detection patterns above for your stack.
|
|
958
|
-
|
|
959
|
-
**"0 domains detected" on Kotlin project** โ Ensure your project has `build.gradle.kts` (or `build.gradle` with kotlin plugin) at the root, and source files are under `**/src/main/kotlin/`. For multi-module projects, ensure `settings.gradle.kts` contains `include()` statements. Single-module Kotlin projects (without `settings.gradle`) are also supported โ domains are extracted from package/class structure under `src/main/kotlin/`.
|
|
442
|
+
---
|
|
960
443
|
|
|
961
|
-
|
|
444
|
+
## Memory Layer (optional, for long-running projects)
|
|
962
445
|
|
|
963
|
-
|
|
446
|
+
After v2.0, ClaudeOS-Core writes a `claudeos-core/memory/` folder with four files:
|
|
964
447
|
|
|
965
|
-
|
|
448
|
+
- `decision-log.md` โ append-only "why we chose X over Y"
|
|
449
|
+
- `failure-patterns.md` โ recurring errors with frequency/importance scores
|
|
450
|
+
- `compaction.md` โ how memory is auto-compacted over time
|
|
451
|
+
- `auto-rule-update.md` โ patterns that should become new rules
|
|
966
452
|
|
|
967
|
-
|
|
453
|
+
You can run `npx claudeos-core memory propose-rules` to ask Claude to look at recent failure patterns and suggest new rules to add.
|
|
968
454
|
|
|
969
|
-
|
|
455
|
+
For the memory model and lifecycle, see [docs/memory-layer.md](docs/memory-layer.md).
|
|
970
456
|
|
|
971
|
-
|
|
457
|
+
---
|
|
972
458
|
|
|
973
|
-
|
|
459
|
+
## FAQ
|
|
974
460
|
|
|
975
|
-
**
|
|
461
|
+
**Q: Do I need a Claude API key?**
|
|
462
|
+
A: No. ClaudeOS-Core uses your existing Claude Code installation โ it pipes prompts to `claude -p` on your machine. No extra accounts.
|
|
976
463
|
|
|
977
|
-
**
|
|
464
|
+
**Q: Will this overwrite my existing CLAUDE.md or `.claude/rules/`?**
|
|
465
|
+
A: First run on a fresh project: it creates them. Re-running without `--force` preserves your edits โ pass markers from the previous run are detected and the passes are skipped. Re-running with `--force` wipes and regenerates everything (your edits are lost โ that's what `--force` means). See [docs/safety.md](docs/safety.md).
|
|
978
466
|
|
|
979
|
-
**
|
|
467
|
+
**Q: My stack isn't supported. Can I add one?**
|
|
468
|
+
A: Yes. New stacks need ~3 prompt templates + a domain scanner. See [CONTRIBUTING.md](CONTRIBUTING.md) for the 8-step guide.
|
|
980
469
|
|
|
981
|
-
**
|
|
470
|
+
**Q: How do I generate docs in Korean (or another language)?**
|
|
471
|
+
A: `npx claudeos-core init --lang ko`. 10 languages supported: en, ko, ja, zh-CN, es, vi, hi, ru, fr, de.
|
|
982
472
|
|
|
983
|
-
**
|
|
473
|
+
**Q: Does this work with monorepos?**
|
|
474
|
+
A: Yes โ Turborepo (`turbo.json`), pnpm workspaces (`pnpm-workspace.yaml`), Lerna (`lerna.json`), and npm/yarn workspaces (`package.json#workspaces`) are detected by the stack-detector. Each app gets its own analysis. Other monorepo layouts (e.g., NX) are not detected specifically, but generic `apps/*/` and `packages/*/` patterns are still picked up by the per-stack scanners.
|
|
984
475
|
|
|
985
|
-
**
|
|
476
|
+
**Q: What if Claude Code generates rules I disagree with?**
|
|
477
|
+
A: Edit them directly. Then run `npx claudeos-core lint` to verify CLAUDE.md is still structurally valid. Your edits are preserved on subsequent `init` runs (without `--force`) โ the resume mechanism skips passes whose markers exist.
|
|
986
478
|
|
|
987
|
-
**
|
|
479
|
+
**Q: Where do I report bugs?**
|
|
480
|
+
A: [GitHub Issues](https://github.com/claudeos-core/claudeos-core/issues). For security issues, see [SECURITY.md](SECURITY.md).
|
|
988
481
|
|
|
989
|
-
|
|
482
|
+
---
|
|
990
483
|
|
|
991
|
-
|
|
484
|
+
## Documentation
|
|
992
485
|
|
|
993
|
-
|
|
486
|
+
| Topic | Read this |
|
|
487
|
+
|---|---|
|
|
488
|
+
| How the 4-pass pipeline works (deeper than the diagram) | [docs/architecture.md](docs/architecture.md) |
|
|
489
|
+
| Visual diagrams (Mermaid) of the architecture | [docs/diagrams.md](docs/diagrams.md) |
|
|
490
|
+
| Stack detection โ what each scanner looks for | [docs/stacks.md](docs/stacks.md) |
|
|
491
|
+
| Memory layer โ decision logs and failure patterns | [docs/memory-layer.md](docs/memory-layer.md) |
|
|
492
|
+
| All 5 validators in detail | [docs/verification.md](docs/verification.md) |
|
|
493
|
+
| Every CLI command and option | [docs/commands.md](docs/commands.md) |
|
|
494
|
+
| Manual installation (no `npx`) | [docs/manual-installation.md](docs/manual-installation.md) |
|
|
495
|
+
| Scanner overrides โ `.claudeos-scan.json` | [docs/advanced-config.md](docs/advanced-config.md) |
|
|
496
|
+
| Safety: what gets preserved on re-init | [docs/safety.md](docs/safety.md) |
|
|
497
|
+
| Comparison with similar tools (scope, not quality) | [docs/comparison.md](docs/comparison.md) |
|
|
498
|
+
| Errors and recovery | [docs/troubleshooting.md](docs/troubleshooting.md) |
|
|
994
499
|
|
|
995
500
|
---
|
|
996
501
|
|
|
997
502
|
## Contributing
|
|
998
503
|
|
|
999
|
-
Contributions
|
|
1000
|
-
|
|
1001
|
-
- **New stack templates** โ Ruby/Rails, Go (Gin/Fiber/Echo), PHP (Laravel/Symfony), Rust (Axum/Actix), Svelte/SvelteKit, Remix
|
|
1002
|
-
- **IDE integration** โ VS Code extension, IntelliJ plugin
|
|
1003
|
-
- **CI/CD templates** โ GitLab CI, CircleCI, Jenkins examples (GitHub Actions already shipped โ see `.github/workflows/test.yml`)
|
|
1004
|
-
- **Test coverage** โ Expanding test suite (currently 602 tests across 30 test files covering scanners, stack detection, domain grouping, plan parsing, prompt generation, CLI selectors, monorepo detection, Vite SPA detection, verification tools, L4 memory scaffold, Pass 2 resume validation, Pass 3 Guards 1/2/3 (H1 sentinel + H2 BOM-aware empty-file + strict stale-marker unlink), Pass 3 split-mode batch subdivision, Pass 3 partial-marker resume (v2.1.0), Pass 4 marker content validation + stale-marker unlink strictness + scaffoldSkillsManifest gap-fill (v2.1.0), translation env-skip guard + early fail-fast + CI workflow, staged-rules move, lang-aware translation fallback, master plan removal regression suite (v2.1.0), memory score/compact formatting regression (v2.1.0), AI Work Rules template structure, and `.env`-parser port/host/API-target extraction + sensitive-variable redaction (v2.2.0))
|
|
504
|
+
Contributions welcome โ adding stack support, improving prompts, fixing bugs. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
1005
505
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
---
|
|
506
|
+
For Code of Conduct and security policy, see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) and [SECURITY.md](SECURITY.md).
|
|
1009
507
|
|
|
1010
|
-
##
|
|
508
|
+
## License
|
|
1011
509
|
|
|
1012
|
-
|
|
510
|
+
[ISC](LICENSE) โ free for any use, including commercial.
|
|
1013
511
|
|
|
1014
|
-
|
|
512
|
+
---
|
|
1015
513
|
|
|
1016
|
-
|
|
514
|
+
<sub>Built with care by [@claudeos-core](https://github.com/claudeos-core). If this saved you time, a โญ on GitHub keeps it visible.</sub>
|