@namch/agent-assistant 1.3.0 → 1.3.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/agents/backend-engineer.md +3 -3
  3. package/agents/brainstormer.md +3 -3
  4. package/agents/business-analyst.md +3 -3
  5. package/agents/database-architect.md +3 -3
  6. package/agents/debugger.md +2 -2
  7. package/agents/designer.md +2 -2
  8. package/agents/devops-engineer.md +2 -2
  9. package/agents/docs-manager.md +23 -15
  10. package/agents/frontend-engineer.md +3 -3
  11. package/agents/game-engineer.md +3 -3
  12. package/agents/mobile-engineer.md +4 -4
  13. package/agents/performance-engineer.md +3 -3
  14. package/agents/planner.md +4 -4
  15. package/agents/project-manager.md +3 -3
  16. package/agents/researcher.md +3 -3
  17. package/agents/reviewer.md +3 -3
  18. package/agents/scouter.md +3 -3
  19. package/agents/security-engineer.md +3 -3
  20. package/agents/tech-lead.md +3 -3
  21. package/agents/tester.md +2 -2
  22. package/commands/docs/audit.md +554 -78
  23. package/commands/docs/business.md +392 -76
  24. package/commands/docs/core.md +573 -74
  25. package/commands/docs.md +62 -61
  26. package/documents/business/business-features/00-index.md +101 -0
  27. package/documents/business/business-features/01-feature-inventory.md +341 -0
  28. package/documents/business/business-features/02-prioritization-moscow.md +148 -0
  29. package/documents/business/business-features/03-feature-specifications.md +512 -0
  30. package/documents/business/business-features/04-dependencies-and-release-sequencing.md +313 -0
  31. package/documents/business/business-features/05-success-metrics.md +290 -0
  32. package/documents/business/business-glossary/00-index.md +89 -0
  33. package/documents/business/business-glossary/01-canonical-terms.md +428 -0
  34. package/documents/business/business-glossary/02-synonyms-and-deprecated-terms.md +180 -0
  35. package/documents/business/business-glossary/03-domain-entities-and-events.md +395 -0
  36. package/documents/business/business-glossary/04-api-term-mapping.md +173 -0
  37. package/documents/business/business-prd/00-index.md +107 -0
  38. package/documents/business/business-prd/01-executive-summary.md +131 -0
  39. package/documents/business/business-prd/02-problem-goals-and-scope.md +204 -0
  40. package/documents/business/business-prd/03-stakeholders-and-requirements.md +210 -0
  41. package/documents/business/business-prd/04-acceptance-risks-assumptions.md +246 -0
  42. package/documents/business/business-workflows/00-index.md +107 -0
  43. package/documents/business/business-workflows/01-actor-map.md +303 -0
  44. package/documents/business/business-workflows/02-workflow-catalog.md +252 -0
  45. package/documents/business/business-workflows/03-detailed-workflows.md +641 -0
  46. package/documents/business/business-workflows/04-decision-rules-and-exceptions.md +216 -0
  47. package/documents/business/business-workflows/05-sla-and-handoffs.md +253 -0
  48. package/documents/knowledge-architecture/00-index.md +159 -0
  49. package/documents/knowledge-architecture/01-system-overview.md +240 -0
  50. package/documents/knowledge-architecture/02-components.md +419 -0
  51. package/documents/knowledge-architecture/03-data-flow.md +369 -0
  52. package/documents/knowledge-architecture/04-design-patterns.md +498 -0
  53. package/documents/knowledge-architecture/05-decisions.md +410 -0
  54. package/documents/knowledge-domain/00-index.md +251 -0
  55. package/documents/knowledge-domain/01-entities.md +583 -0
  56. package/documents/knowledge-domain/02-database-schema.md +138 -0
  57. package/documents/knowledge-domain/03-api-contracts.md +479 -0
  58. package/documents/knowledge-domain/04-business-rules.md +555 -0
  59. package/documents/knowledge-overview/00-index.md +107 -0
  60. package/documents/knowledge-overview/01-project-identity.md +162 -0
  61. package/documents/knowledge-overview/02-tech-stack.md +119 -0
  62. package/documents/knowledge-overview/03-features.md +233 -0
  63. package/documents/knowledge-overview/04-getting-started.md +394 -0
  64. package/documents/knowledge-source-base/00-index.md +107 -0
  65. package/documents/knowledge-source-base/01-directory-structure.md +312 -0
  66. package/documents/knowledge-source-base/02-entry-points.md +346 -0
  67. package/documents/knowledge-source-base/03-key-modules.md +582 -0
  68. package/documents/knowledge-source-base/04-configuration.md +467 -0
  69. package/documents/knowledge-standards/00-index.md +129 -0
  70. package/documents/knowledge-standards/01-code-style.md +161 -0
  71. package/documents/knowledge-standards/02-conventions.md +255 -0
  72. package/documents/knowledge-standards/03-git-workflow.md +228 -0
  73. package/documents/knowledge-standards/04-testing-standards.md +175 -0
  74. package/package.json +1 -1
  75. package/rules/REFERENCE.md +10 -6
  76. package/skills/docs-audit/README.md +10 -8
  77. package/skills/docs-audit/SKILL.md +45 -41
  78. package/skills/docs-audit/references/scoring-framework.md +5 -5
  79. package/skills/docs-core/README.md +19 -14
  80. package/skills/docs-core/SKILL.md +189 -117
  81. package/skills/planning/references/codebase-understanding.md +5 -5
  82. package/documents/business/business-features.md +0 -894
  83. package/documents/business/business-glossary.md +0 -554
  84. package/documents/business/business-prd.md +0 -400
  85. package/documents/business/business-workflows.md +0 -713
  86. package/documents/knowledge-architecture.md +0 -621
  87. package/documents/knowledge-domain.md +0 -602
  88. package/documents/knowledge-overview.md +0 -316
  89. package/documents/knowledge-source-base.md +0 -581
  90. package/documents/knowledge-standards.md +0 -632
@@ -1,19 +1,19 @@
1
1
  ---
2
- description: 💻 Core Docs Generate 5 essential technical documentation files
3
- version: "1.0"
2
+ description: "Core Docs - Generate 5 knowledge folders with evidence-backed sub-files for comprehensive technical documentation"
3
+ version: "2.0"
4
4
  category: documentation
5
5
  execution-mode: execute
6
6
  ---
7
7
 
8
- # /docs:core — Core Technical Documentation
8
+ # /docs:core — Core Technical Documentation (v3.0)
9
9
 
10
- > **MISSION**: Analyze current project and generate **ALL 5** essential documentation files.
10
+ > **MISSION**: Analyze the current project through deep codebase reconnaissance, then generate **5 knowledge folders** each with `00-index.md` + focused sub-files. Every claim must trace to actual source code. The result must enable a new team member or AI agent to fully understand the project without reading the codebase.
11
11
 
12
12
  <scope>$ARGUMENTS</scope>
13
13
 
14
14
  ---
15
15
 
16
- ## 🛑 PRE-FLIGHT (DO FIRST — BLOCKS PHASE 1)
16
+ ## PRE-FLIGHT (DO FIRST — BLOCKS PHASE 1)
17
17
 
18
18
  **LOAD now** (in order; path `./rules/` or `~/.{TOOL}/skills/agent-assistant/rules/`):
19
19
 
@@ -21,141 +21,640 @@ execution-mode: execute
21
21
  2. PHASES.md — Phase Execution
22
22
  3. AGENTS.md — Tiered Execution
23
23
 
24
- **⛔ Do not run Phase 1 until all are loaded.** Follow **all** rules in those files; they override any conflicting instructions in this file.
24
+ **Do not run Phase 1 until all are loaded.** Follow **all** rules in those files; they override any conflicting instructions in this file.
25
25
 
26
26
  ---
27
27
 
28
- ## 🔀 TIERED EXECUTION PROTOCOL (MANDATORY)
28
+ ## TIERED EXECUTION PROTOCOL (MANDATORY)
29
29
 
30
- > **Reference: AGENTS.md (Tiered Execution)`
30
+ > **Reference: AGENTS.md (Tiered Execution)**
31
31
 
32
32
  ```yaml
33
33
  tiered_execution:
34
34
  principle: "Sub-agent FIRST (Tier 1). EMBODY ONLY on system failure (Tier 2)."
35
35
  for_each_phase:
36
- TIER_1_MANDATORY: "IF tool exists MUST use SUB_AGENT_DELEGATION"
37
- TIER_2_FALLBACK: "ONLY on system errorNOT complexity/preference/speed"
36
+ TIER_1_MANDATORY: "IF tool exists -> MUST use SUB_AGENT_DELEGATION"
37
+ TIER_2_FALLBACK: "ONLY on system error - NOT complexity/preference/speed"
38
38
  anti_lazy_fallback:
39
- - NEVER use Tier 2 when Tier 1 tool is available
40
- - ALWAYS attempt Tier 1 first when tool exists
39
+ - NEVER use Tier 2 when Tier 1 tool is available
40
+ - ALWAYS attempt Tier 1 first when tool exists
41
41
  ```
42
42
 
43
43
  ---
44
44
 
45
- ## 📦 DELIVERABLES (REQUIRED ALL 5 FILES)
45
+ ## DELIVERABLES — FOLDER-BASED KNOWLEDGE SYSTEM
46
46
 
47
47
  > [!CAUTION]
48
- > **MUST CREATE ALL 5 FILES**. Incomplete = FAILED execution.
48
+ > **MUST CREATE OR UPDATE ALL 5 FOLDERS** with their `00-index.md` and sub-files. Incomplete = FAILED execution.
49
49
 
50
- > **⛔ DOCUMENT LANGUAGE — NON-NEGOTIABLE**
51
- > Every file under `./documents/` must be written in **English only**. Headings, body text, tables, and lists must be in English. Do not use the user's language (e.g. Vietnamese) for file content. Chat/UI may follow user language; document files do not. (CORE § LAW 6.)
50
+ > **DOCUMENT LANGUAGE — NON-NEGOTIABLE**
51
+ > Every file under `./documents/` must be written in **English only**. Headings, body text, tables, and lists must be in English. Do not use the user's language for file content. Chat/UI may follow user language; document files do not. (CORE LAW 6.)
52
52
 
53
- | File | Purpose |
54
- | --------------------------------------- | ------------------------------------------------------------- |
55
- | `./documents/knowledge-overview.md` | Project introduction, goals, tech stack, getting started |
56
- | `./documents/knowledge-architecture.md` | System design, components, data flow, design patterns |
57
- | `./documents/knowledge-domain.md` | Data models, database schema, API contracts, domain entities |
58
- | `./documents/knowledge-source-base.md` | Directory structure, file purposes, entry points, key modules |
59
- | `./documents/knowledge-standards.md` | Code style, naming conventions, commit format, guidelines |
53
+ ### Folder Structure
60
54
 
61
- ### 📋 File Purpose Details
55
+ ```
56
+ ./documents/
57
+ knowledge-overview/
58
+ 00-index.md # Summary + TOC + cross-references
59
+ 01-project-identity.md # Name, version, purpose, vision, mission
60
+ 02-tech-stack.md # Languages, frameworks, runtime, dependencies
61
+ 03-features.md # Key features, metrics, capabilities
62
+ 04-getting-started.md # Prerequisites, installation, first run
63
+
64
+ knowledge-architecture/
65
+ 00-index.md # Architecture summary + TOC
66
+ 01-system-overview.md # High-level diagram, layers, boundaries
67
+ 02-components.md # Core components, responsibilities, interfaces
68
+ 03-data-flow.md # Request processing, data pipelines, event flows
69
+ 04-design-patterns.md # Patterns used, rationale, examples
70
+ 05-decisions.md # ADRs, trade-offs, architectural constraints
71
+
72
+ knowledge-domain/
73
+ 00-index.md # Domain summary + TOC
74
+ 01-entities.md # Core entities, ERD, relationships
75
+ 02-database-schema.md # Tables, indexes, migrations, seeds
76
+ 03-api-contracts.md # Endpoints, payloads, auth, errors
77
+ 04-business-rules.md # Validations, state machines, constraints
78
+
79
+ knowledge-source-base/
80
+ 00-index.md # Source overview + TOC
81
+ 01-directory-structure.md # Full directory tree with annotations
82
+ 02-entry-points.md # Main files, boot sequence, initialization
83
+ 03-key-modules.md # Core modules breakdown, dependencies
84
+ 04-configuration.md # Config files, env vars, secrets management
85
+
86
+ knowledge-standards/
87
+ 00-index.md # Standards overview + TOC
88
+ 01-code-style.md # Formatting, linting, naming conventions
89
+ 02-conventions.md # File/directory patterns, imports, exports
90
+ 03-git-workflow.md # Commit format, branching, PR process
91
+ 04-testing-standards.md # Test structure, coverage goals, patterns
92
+ ```
93
+
94
+ ### The `00-index.md` Pattern (MANDATORY for every folder)
95
+
96
+ Each `00-index.md` MUST include:
97
+
98
+ 1. **Brief overview** (2-3 paragraphs summarizing the knowledge area)
99
+ 2. **Sub-files table** — filename, description, and what it covers
100
+ 3. **Quick facts** — key reference data
101
+ 4. **Cross-references** — links to related knowledge folders
102
+ 5. **Known Gaps and Open Questions** — what could not be determined
103
+
104
+ ```markdown
105
+ # Knowledge {Area}
106
+
107
+ > **Purpose**: {one-line}
108
+ > **Sub-files**: {count}
109
+ > **Last Updated**: {YYYY-MM-DD}
62
110
 
63
- | File | AI Uses It For | Key Sections |
64
- |------|----------------|--------------|
65
- | **overview** | Understanding WHAT the project does and WHY | Purpose, Goals, Tech Stack, Features, Getting Started |
66
- | **architecture** | Understanding HOW components interact | Layers, Components, Data Flow, Design Patterns, Dependencies |
67
- | **domain** | Understanding WHAT DATA the project handles | Entities, Relationships, Database Schema, API Endpoints, Business Rules |
68
- | **source-base** | Understanding WHERE code lives | Directory Tree, Entry Points, Key Files, Module Breakdown |
69
- | **standards** | Understanding HOW to write code correctly | Naming, Style, Commit Format, PR Guidelines, Testing Standards |
111
+ ## Quick Summary
112
+ {2-3 paragraph executive summary}
113
+
114
+ ## Sub-Files
115
+
116
+ | File | Description |
117
+ |------|-------------|
118
+ | [01-xxx.md](./01-xxx.md) | Covers ... |
119
+ | [02-xxx.md](./02-xxx.md) | Covers ... |
120
+
121
+ ## Quick Facts
122
+
123
+ | Key | Value |
124
+ |-----|-------|
125
+ | ... | ... |
126
+
127
+ ## Cross-References
128
+
129
+ - [knowledge-architecture/](../knowledge-architecture/00-index.md) — How components interact
130
+ - [knowledge-domain/](../knowledge-domain/00-index.md) — Data models and APIs
131
+
132
+ ## Known Gaps and Open Questions
133
+
134
+ - {What could not be determined and why}
135
+ ```
136
+
137
+ ### Scaling Rules
138
+
139
+ | Condition | Action |
140
+ |-----------|--------|
141
+ | Sub-file would exceed ~300 lines | Split into focused sub-files |
142
+ | Sub-file would be < 20 lines | Merge into nearest related sub-file |
143
+ | Project has many modules/services | Add per-module sub-files |
144
+ | Project has complex integrations | Add integration sub-files |
145
+
146
+ > **Numbering**: Always 2-digit prefix. Update `00-index.md` TOC when adding files.
70
147
 
71
148
  ---
72
149
 
73
- ## INCREMENTAL EXECUTION (MANDATORY)
150
+ ## INCREMENTAL EXECUTION (MANDATORY)
74
151
 
75
- One phase at a time, each phase independent: Phase 1 then Phase 2 in one reply. No batching (load only what each phase needs). **Within each phase:** when doing a part, output it in format so user sees what’s happening (announce before doing).
152
+ One phase at a time, each phase independent: Phase 1 -> then Phase 2 -> then Verification -> in one reply. No batching (load only what each phase needs). **Within each phase**: announce before doing, emit deliverables as you go.
76
153
 
77
154
  ---
78
155
 
79
- ## 🎭 Phase 1: CODEBASE ANALYSIS
156
+ ## Phase 1: DEEP CODEBASE RECONNAISSANCE
80
157
 
81
- | Attribute | Value |
82
- | --------- | ----------------------------------------- |
83
- | **Agent** | `scouter` |
84
- | **Goal** | Scan entire project structure and content |
158
+ | Attribute | Value |
159
+ |-----------|-------|
160
+ | **Agent** | `scouter` |
161
+ | **Goal** | Pre-flight mode detection + deep project scan + structured intelligence report |
162
+ | **Skill** | Load `skills/docs-core/references/deep-recon-checklist.md` for scan protocol |
85
163
 
86
- ### TIERED EXECUTION
164
+ ### TIERED EXECUTION
87
165
 
88
166
  **TIER 1 (MANDATORY when tool exists):**
89
-
90
167
  > Invoke runSubagent for `scouter`. Context: ISOLATED.
91
168
 
92
169
  **TIER 2 (FALLBACK on system error only):**
93
-
94
170
  > Load `{AGENTS_PATH}/scouter.md`
95
171
  > EMBODY [scouter] — Requires logged system error justification.
96
172
 
97
- **Actions**:
173
+ ---
174
+
175
+ ### Step 1.0: PRE-FLIGHT — Mode Detection
176
+
177
+ BEFORE any scanning, check the current state of `./documents/`:
178
+
179
+ ```
180
+ CHECK:
181
+ 1. Does ./documents/ directory exist? (Create if missing)
182
+ 2. Do knowledge FOLDERS exist? (knowledge-overview/, knowledge-architecture/, etc.)
183
+ 3. Do legacy flat files exist? (knowledge-overview.md, knowledge-architecture.md, etc.)
184
+ 4. Determine mode PER knowledge area:
185
+
186
+ | Knowledge Area | Folder Exists | Flat File Exists | Mode |
187
+ |--------------------------|---------------|------------------|-----------------------|
188
+ | knowledge-overview/ | Yes/No | Yes/No | CREATE/UPDATE/MIGRATE |
189
+ | knowledge-architecture/ | Yes/No | Yes/No | CREATE/UPDATE/MIGRATE |
190
+ | knowledge-domain/ | Yes/No | Yes/No | CREATE/UPDATE/MIGRATE |
191
+ | knowledge-source-base/ | Yes/No | Yes/No | CREATE/UPDATE/MIGRATE |
192
+ | knowledge-standards/ | Yes/No | Yes/No | CREATE/UPDATE/MIGRATE |
193
+
194
+ Mode rules:
195
+ Folder exists with sub-files -> UPDATE (check each sub-file for staleness)
196
+ Flat file exists (no folder) -> MIGRATE (convert to folder structure)
197
+ Nothing exists -> CREATE (generate from scratch)
198
+ ```
199
+
200
+ ### Step 1.1: Structure Scan
201
+
202
+ - List all top-level directories and files
203
+ - Recursively map directory tree (depth 3-4)
204
+ - Identify entry points: `main.*`, `index.*`, `app.*`, `server.*`, `package.json`, `Dockerfile`
205
+ - **Direct-read minimum** (must read CONTENT, not just filenames):
206
+ - `README*`, `CHANGELOG*`, `CONTRIBUTING*` (when present)
207
+ - Build/runtime manifests: `package.json`, `requirements.txt`, `go.mod`, `Cargo.toml`, etc.
208
+ - At least ONE entry-point file per runtime surface (web, API, worker, CLI)
209
+
210
+ ### Step 1.2: Tech Stack Detection
98
211
 
99
- 1. List all directories and files
100
- 2. Identify tech stack from package.json/config files
101
- 3. Map dependencies and relationships
102
- 4. Note patterns and conventions used
212
+ - Parse package manifests for dependencies
213
+ - Detect frameworks from imports/config: React, Next.js, Express, Django, FastAPI, Spring Boot, etc.
214
+ - Identify databases from: connection strings, ORM config, migration files
215
+ - Detect CI/CD from: `.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`
216
+ - Detect containerization: `Dockerfile`, `docker-compose.yml`
103
217
 
104
- **Exit Criteria:**
218
+ ### Step 1.3: Architecture Pattern Discovery
105
219
 
106
- - [ ] Project structure mapped
107
- - [ ] Tech stack identified
108
- - [ ] Key files located
220
+ Run targeted search passes (MINIMUM):
221
+ - Architecture: `controller|service|repository|use-case|domain|module|adapter|middleware|handler`
222
+ - API surface: `router|route|endpoint|graphql|openapi|swagger|trpc`
223
+ - Data model: `model|schema|entity|migration|prisma|typeorm|sequelize|mongoose|sql`
224
+ - Standards: `eslint|prettier|editorconfig|commitlint|husky|lint-staged|test`
225
+
226
+ Identify: MVC, MVVM, Clean Architecture, Hexagonal, Microservices, Monolith, etc.
227
+ Document: design patterns (Repository, Factory, Observer, Middleware, DI), naming conventions, test framework patterns, config patterns.
228
+
229
+ ### Step 1.4: Domain Intelligence
230
+
231
+ - Locate data models: ORM models, schemas, type definitions, interfaces
232
+ - Find API definitions: routes, controllers, GraphQL schemas, OpenAPI specs
233
+ - Identify business logic: services, use cases, domain modules
234
+ - Map entity relationships from foreign keys, references, imports
235
+
236
+ ### Step 1.5: Context-Window Optimization
237
+
238
+ > For large codebases (>500 files):
239
+ > - Run `bash skills/docs-core/scripts/scan-project.sh [project-root]` first
240
+ > - Read selectively: config -> entry points -> routes -> models -> tests
241
+ > - Use grep for pattern search instead of reading entire files
242
+ > - For monorepos: scan each package manifest separately
109
243
 
110
244
  ---
111
245
 
112
- ## 🎭 Phase 2: GENERATE ALL 5 DOCUMENTS
246
+ ### Phase 1 MANDATORY OUTPUT: Intelligence Report
113
247
 
114
- | Attribute | Value |
115
- | --------- | --------------------------------------------------------------------------------------------------------------- |
116
- | **Agent** | `docs-manager` |
117
- | **Goal** | Create all 5 documentation files in **English only** (headings, body, tables—no user-language content in files) |
248
+ > [!CAUTION]
249
+ > **Phase 2 CANNOT START without this output.** The docs-manager uses this report as its primary input. If this report is shallow, the documentation will be shallow.
250
+
251
+ ```markdown
252
+ ## Intelligence Report
253
+
254
+ ### Execution Plan
255
+ | Knowledge Area | Mode | Reason |
256
+ |-------------------------|---------|--------|
257
+ | knowledge-overview/ | CREATE/UPDATE/MIGRATE | {why} |
258
+ | knowledge-architecture/ | CREATE/UPDATE/MIGRATE | {why} |
259
+ | knowledge-domain/ | CREATE/UPDATE/MIGRATE | {why} |
260
+ | knowledge-source-base/ | CREATE/UPDATE/MIGRATE | {why} |
261
+ | knowledge-standards/ | CREATE/UPDATE/MIGRATE | {why} |
262
+
263
+ ### Project Scale Assessment
264
+ | Metric | Value |
265
+ |-------------------|-------|
266
+ | Total files | {N} |
267
+ | Total directories | {N} |
268
+ | Primary language | {lang} |
269
+ | Complexity | Small (<100 files) / Medium (100-500) / Large (500+) |
270
+ | Monorepo? | Yes/No |
271
+
272
+ ### Tech Stack Map
273
+ | Layer | Technology | Version | Evidence File |
274
+ |-------------|---------------|---------|---------------|
275
+ | Runtime | {e.g. Node.js}| {ver} | {package.json}|
276
+ | Framework | {e.g. Next.js}| {ver} | {package.json}|
277
+ | Database | {e.g. PostgreSQL}| {ver}| {docker-compose.yml}|
278
+ | ORM | {e.g. Prisma} | {ver} | {schema.prisma}|
279
+ | Testing | {e.g. Jest} | {ver} | {package.json}|
280
+ | CI/CD | {e.g. GitHub Actions}| - | {.github/workflows/}|
281
+ | Container | {e.g. Docker} | - | {Dockerfile} |
282
+
283
+ ### Architecture Signals
284
+ | Signal | Evidence | Pattern |
285
+ |--------|----------|---------|
286
+ | {e.g. src/controllers/} | {path} | MVC — controller layer |
287
+ | {e.g. src/services/} | {path} | Service layer pattern |
288
+ | {e.g. src/middleware/} | {path} | Middleware chain |
289
+
290
+ ### Domain Signals
291
+ | Entity/Model | Location | Type | Relationships |
292
+ |-------------|----------|------|---------------|
293
+ | {e.g. User} | {path} | ORM Model | -> Posts, -> Orders |
294
+ | {e.g. Post} | {path} | Schema | -> User, -> Comments |
295
+
296
+ ### API Surface
297
+ | Method | Path | Handler | Auth |
298
+ |--------|------|---------|------|
299
+ | GET | /api/users | {file:line} | {type} |
300
+ | POST | /api/auth | {file:line} | public |
301
+
302
+ ### Standards Signals
303
+ | Standard | Tool/Config | Evidence |
304
+ |----------|-------------|----------|
305
+ | Linting | {ESLint} | {.eslintrc} |
306
+ | Format | {Prettier} | {.prettierrc} |
307
+ | Commits | {conventional} | {commitlint.config} |
308
+ | Tests | {Jest} | {jest.config} |
309
+
310
+ ### Evidence Ledger (BLOCKING — Phase 2 uses this)
311
+ | Claim Area | Evidence Files (actual paths) | Confidence |
312
+ |----------------|-------------------------------|------------|
313
+ | Architecture | {path1}, {path2}, ... | High/Medium/Low |
314
+ | Domain/Data | {path1}, {path2}, ... | High/Medium/Low |
315
+ | Standards | {path1}, {path2}, ... | High/Medium/Low |
316
+ | Source Structure| {path1}, {path2}, ... | High/Medium/Low |
317
+ | Tech Stack | {path1}, {path2}, ... | High/Medium/Low |
318
+ ```
118
319
 
119
- ### TIERED EXECUTION
320
+ ### Anti-Shallow Guardrails
120
321
 
121
- **TIER 1 (MANDATORY when tool exists):**
322
+ - NEVER generate content from script output alone — must verify with direct file reads
323
+ - Each knowledge area must have at least 3 evidence files in the ledger
324
+ - If evidence is weak (Low confidence), explicitly state it — do NOT guess
325
+ - Unknowns go to `Known Gaps and Open Questions`, not speculative claims
326
+
327
+ ### Exit Criteria
328
+
329
+ - [ ] Pre-flight mode detection complete (CREATE/UPDATE/MIGRATE per folder)
330
+ - [ ] Project scale assessed
331
+ - [ ] Tech stack fully mapped with evidence
332
+ - [ ] Architecture patterns identified with file-level evidence
333
+ - [ ] Domain entities and API surface cataloged
334
+ - [ ] Standards/conventions documented with config file evidence
335
+ - [ ] Evidence Ledger complete — every claim area has >= 3 evidence files
336
+ - [ ] Intelligence Report fully emitted (Phase 2 depends on this)
337
+
338
+ ---
339
+
340
+ ## Phase 2: GENERATE KNOWLEDGE FOLDERS
341
+
342
+ | Attribute | Value |
343
+ |-----------|-------|
344
+ | **Agent** | `docs-manager` |
345
+ | **Goal** | Create all 5 knowledge folders with `00-index.md` + sub-files in **English only** |
346
+ | **Skill** | Load `skills/docs-core/SKILL.md` for generation protocol |
347
+ | **Templates** | Load from `skills/docs-core/references/template-{area}.md` per folder (read-only) |
348
+ | **Input** | Intelligence Report + Evidence Ledger from Phase 1 |
349
+
350
+ ### TIERED EXECUTION
122
351
 
352
+ **TIER 1 (MANDATORY when tool exists):**
123
353
  > Invoke runSubagent for `docs-manager`. Context: ISOLATED.
354
+ > **MUST PASS** the Phase 1 Intelligence Report as context.
124
355
 
125
356
  **TIER 2 (FALLBACK on system error only):**
126
-
127
357
  > Load `{AGENTS_PATH}/docs-manager.md`
128
358
  > EMBODY [docs-manager] — Requires logged system error justification.
129
359
 
130
- **Exit Criteria:**
360
+ ---
361
+
362
+ ### Step 2.0: Load Skill + Templates
363
+
364
+ ```
365
+ BEFORE writing any file:
366
+ 1. LOAD skills/docs-core/SKILL.md (generation protocol, quality rules)
367
+ 2. For each folder, LOAD the matching template:
368
+ - knowledge-overview/ -> references/template-overview.md
369
+ - knowledge-architecture/ -> references/template-architecture.md
370
+ - knowledge-domain/ -> references/template-domain.md
371
+ - knowledge-source-base/ -> references/template-source-base.md
372
+ - knowledge-standards/ -> references/template-standards.md
373
+ 3. Use templates as STRUCTURE GUIDES — fill with actual project data from Intelligence Report
374
+ 4. Do NOT copy template placeholders into output — replace ALL {placeholder} with real data
375
+ ```
376
+
377
+ ### Step 2.1: Thinking Protocol (MANDATORY — Run BEFORE Writing Each Sub-File)
378
+
379
+ ```
380
+ FOR EACH sub-file, THINK before writing:
381
+
382
+ 1. WHO reads this? -> New developer? BA/PM? AI agent? All three?
383
+ 2. WHAT must they understand from THIS file alone?
384
+ 3. WHAT evidence from Intelligence Report supports this file's content?
385
+ 4. Is EVERY claim I'm about to write backed by an actual file I read?
386
+ -> If not: either read the file now, or write "Not applicable to this project"
387
+ 5. Is anything speculative? -> Remove it or mark: "Assumption — needs verification"
388
+ 6. Would a new team member find this SUFFICIENT for day-one understanding?
389
+ 7. Am I writing REAL project data or just paraphrasing the template?
390
+ -> Template structure = good. Template placeholder text = FAILURE.
391
+
392
+ VERIFY before writing each file:
393
+ [ ] Every technical claim maps to an evidence file from the Ledger
394
+ [ ] No placeholder text: "TODO", "TBD", "fill in later", "{placeholder}"
395
+ [ ] All file paths referenced actually exist in the project
396
+ [ ] Mermaid diagrams (if used) are syntactically valid
397
+ [ ] Content is English only
398
+ ```
399
+
400
+ ### Step 2.2: Mode-Dependent Execution
401
+
402
+ **CREATE mode** (folder missing):
403
+ 1. Create folder
404
+ 2. Write `00-index.md` first (summary + TOC with all planned sub-files)
405
+ 3. Write sub-files sequentially: `01-*.md`, `02-*.md`, `03-*.md`, ...
406
+ 4. Verify `00-index.md` TOC links match actual sub-files
407
+
408
+ **UPDATE mode** (folder exists):
409
+ 1. Read ALL existing sub-files completely
410
+ 2. Compare against Intelligence Report findings
411
+ 3. For each sub-file, identify: Stale (update) | Missing info (append) | Accurate (preserve)
412
+ 4. NEVER delete accurate content — append new, revise stale, preserve valid
413
+ 5. Add changelog: `> Last updated: {date} — {summary}` at bottom of modified files
414
+ 6. If new sub-topics found, add new numbered sub-files and update `00-index.md` TOC
415
+
416
+ **MIGRATE mode** (flat file exists, no folder):
417
+ 1. Read legacy flat file completely — preserve ALL valid content
418
+ 2. Create folder with `00-index.md` + sub-files
419
+ 3. Distribute content from flat file into appropriate sub-files
420
+ 4. Add migration note to `00-index.md`: `> Migrated from flat file: {date}`
421
+ 5. Delete or archive legacy flat file after successful migration
422
+ 6. Verify all original content is preserved in new structure
131
423
 
132
- - [ ] `knowledge-overview.md` created
133
- - [ ] `knowledge-architecture.md` created
134
- - [ ] `knowledge-domain.md` created
135
- - [ ] `knowledge-source-base.md` created
136
- - [ ] `knowledge-standards.md` created
424
+ ### Step 2.3: Folder Generation Order + Content Requirements
425
+
426
+ > **Order matters** each folder builds on the previous:
427
+
428
+ ---
429
+
430
+ #### FOLDER 1: `knowledge-source-base/` — Foundation: WHERE things are
431
+
432
+ **Template**: `references/template-source-base.md`
433
+
434
+ | Sub-File | MUST Include | Evidence Source |
435
+ |----------|-------------|-----------------|
436
+ | `00-index.md` | Summary of project structure, sub-files TOC, **Read Order for New Members**, cross-refs, known gaps | Directory scan |
437
+ | `01-directory-structure.md` | Complete annotated directory tree (depth 3-4), purpose of each top-level dir, icon annotations | `ls`, directory scan |
438
+ | `02-entry-points.md` | Application entry files (main/index/app/server), boot sequence, build entry points (scripts), config entry points | Package manifest + entry point files |
439
+ | `03-key-modules.md` | Per-module breakdown: purpose, exports, dependencies, internal structure. Cover ALL major modules | Module source files |
440
+ | `04-configuration.md` | Config files inventory, env vars with descriptions and defaults, secrets management approach | `.env*`, config files, docker-compose |
441
+
442
+ ---
443
+
444
+ #### FOLDER 2: `knowledge-overview/` — Identity: WHAT and WHY
445
+
446
+ **Template**: `references/template-overview.md`
447
+
448
+ | Sub-File | MUST Include | Evidence Source |
449
+ |----------|-------------|-----------------|
450
+ | `00-index.md` | Project summary, sub-files TOC, quick facts table (name, version, type, language), cross-refs | README, package manifest |
451
+ | `01-project-identity.md` | Name, version, type, author, license, repo URL, purpose statement, problem/solution, key benefits, **First 60 Minutes onboarding checklist** | README, package.json, repo metadata |
452
+ | `02-tech-stack.md` | Categorized stack table: runtime, frontend, backend, database, ORM, testing, CI/CD, infra — each with version + evidence file | Tech Stack Map from Intelligence Report |
453
+ | `03-features.md` | Key features list with descriptions, metrics/stats if available, capability overview | README, source code analysis |
454
+ | `04-getting-started.md` | Prerequisites with versions, step-by-step installation, environment setup, first run commands, running tests, common issues/troubleshooting | README, package.json scripts, config files |
455
+
456
+ ---
457
+
458
+ #### FOLDER 3: `knowledge-architecture/` — Design: HOW things connect
459
+
460
+ **Template**: `references/template-architecture.md`
461
+
462
+ | Sub-File | MUST Include | Evidence Source |
463
+ |----------|-------------|-----------------|
464
+ | `00-index.md` | Architecture summary, sub-files TOC, high-level component diagram (Mermaid), cross-refs | Architecture Signals from Intelligence Report |
465
+ | `01-system-overview.md` | High-level architecture diagram (Mermaid), architecture style (MVC/Clean/etc.), layer boundaries, key design decisions table | Source structure + architecture signals |
466
+ | `02-components.md` | Per-component: name, responsibility, interfaces, dependencies, file locations. Cover ALL major components | Component source files |
467
+ | `03-data-flow.md` | Request lifecycle diagram (Mermaid), key data flows (user actions -> system responses), event flows if applicable | Route/controller files, middleware |
468
+ | `04-design-patterns.md` | Patterns used: name, where applied, rationale, code example reference. Cover ALL observed patterns | Architecture Signals from Intelligence Report |
469
+ | `05-decisions.md` | ADR table: decision, choice, alternatives considered, rationale, trade-offs. Architectural constraints | README, config files, code structure evidence |
470
+
471
+ ---
472
+
473
+ #### FOLDER 4: `knowledge-domain/` — Data: WHAT flows through
474
+
475
+ **Template**: `references/template-domain.md`
476
+
477
+ | Sub-File | MUST Include | Evidence Source |
478
+ |----------|-------------|-----------------|
479
+ | `00-index.md` | Domain summary, sub-files TOC, entity overview diagram (Mermaid ERD), bounded contexts, cross-refs | Domain Signals from Intelligence Report |
480
+ | `01-entities.md` | Per-entity: name, fields with types, constraints, relationships. ERD diagram. Cover ALL entities/models | ORM models, schemas, interfaces |
481
+ | `02-database-schema.md` | Tables/collections with columns and types, indexes, migrations history, seed data. If no DB: "Not applicable" with reason | Migration files, schema files, DB config |
482
+ | `03-api-contracts.md` | Per-endpoint: method, path, request/response schema, auth, errors. Authentication flow. Error response format | Route files, controllers, OpenAPI specs |
483
+ | `04-business-rules.md` | Validation rules with conditions and messages, business logic rules, state machines (Mermaid), constraints | Service files, validators, business logic |
484
+
485
+ ---
486
+
487
+ #### FOLDER 5: `knowledge-standards/` — Rules: HOW TO CODE correctly
488
+
489
+ **Template**: `references/template-standards.md`
490
+
491
+ | Sub-File | MUST Include | Evidence Source |
492
+ |----------|-------------|-----------------|
493
+ | `00-index.md` | Standards summary, sub-files TOC, quick reference of naming conventions, cross-refs | Config files + observed patterns |
494
+ | `01-code-style.md` | Formatting rules (tabs/spaces, line length, etc.), linting config summary, naming conventions table (files, vars, functions, classes, constants) — by evidence from actual config + code patterns | `.eslintrc`, `.prettierrc`, actual code patterns |
495
+ | `02-conventions.md` | File/directory organization patterns, import order conventions, export patterns, module structure conventions, comment standards | Observed code patterns, config files |
496
+ | `03-git-workflow.md` | Commit message format (with examples), branch naming convention, PR guidelines, merge strategy, CI/CD pipeline description | `.commitlintrc`, branch patterns, CI config |
497
+ | `04-testing-standards.md` | Test file organization, test naming conventions, coverage goals, test categories (unit/integration/e2e), test command reference | Test config, test files, CI pipeline |
498
+
499
+ ---
500
+
501
+ ### Step 2.4: Per-File Quality Gates
502
+
503
+ > **EVERY sub-file** must pass these gates before the agent moves to the next file:
504
+
505
+ ```
506
+ QUALITY GATE per sub-file:
507
+ [ ] Written in English only
508
+ [ ] Has project-specific content (not just template text)
509
+ [ ] Contains NO placeholders: {placeholder}, TODO, TBD, "fill in later"
510
+ [ ] Has ## Evidence Sources section listing actual files used
511
+ [ ] Every technical claim traces to a file from the Evidence Ledger
512
+ [ ] Would pass a "new team member" test — someone could act on this info
513
+ [ ] 00-index.md TOC matches actual sub-files (if this is an index file)
514
+ ```
515
+
516
+ > **If a sub-file cannot be meaningfully filled** (e.g., no database in the project → `02-database-schema.md`):
517
+ > Write: `Not applicable to this project — {reason with evidence}` rather than leaving empty or speculating.
518
+
519
+ ### Step 2.5: Sub-File Format
520
+
521
+ Every sub-file MUST follow this structure:
522
+
523
+ ```markdown
524
+ # {Project Name} — {Document Title}
525
+
526
+ > **Purpose**: {one-line purpose}
527
+ > **Parent**: [00-index.md](./00-index.md)
528
+ > **Last Updated**: {YYYY-MM-DD}
529
+ > **Generated By**: docs-core skill
530
+
531
+ ---
532
+
533
+ ## Table of Contents
534
+
535
+ - [Section 1](#section-1)
536
+ - [Section 2](#section-2)
537
+ ...
538
+
539
+ ---
540
+
541
+ {Content sections with real project data}
137
542
 
138
543
  ---
139
544
 
140
- ## VERIFICATION
545
+ ## Evidence Sources
141
546
 
142
- Before completion, verify ALL 5 files exist:
547
+ | File | Why it was used |
548
+ |------|-----------------|
549
+ | {actual/path/to/file} | {what evidence it provided} |
550
+ ```
551
+
552
+ ### Exit Criteria
553
+
554
+ - [ ] All 5 knowledge folders created with `00-index.md` + sub-files
555
+ - [ ] Every `00-index.md` has accurate TOC matching actual sub-files
556
+ - [ ] Cross-references between folders are correct and valid
557
+ - [ ] Every sub-file has `## Evidence Sources` with actual file paths
558
+ - [ ] No placeholder text in any file: {placeholder}, TODO, TBD
559
+ - [ ] All content is English only
560
+ - [ ] UPDATE mode: existing accurate content preserved, changelog entries added
561
+
562
+ ---
563
+
564
+ ## VERIFICATION
565
+
566
+ After all folders are generated, perform a final verification pass:
567
+
568
+ ### File Completeness Check
143
569
 
144
570
  ```
145
571
  ./documents/
146
- ├── ✅ knowledge-overview.md
147
- ├── knowledge-architecture.md
148
- ├── knowledge-domain.md
149
- ├── knowledge-source-base.md
150
- └── knowledge-standards.md
572
+ knowledge-overview/
573
+ [ ] 00-index.md — Has TOC, Quick Summary, cross-refs
574
+ [ ] 01-project-identity.md — Has First 60 Minutes checklist
575
+ [ ] 02-tech-stack.md — Has categorized stack table with versions
576
+ [ ] 03-features.md — Has feature descriptions (not just names)
577
+ [ ] 04-getting-started.md — Has step-by-step runnable instructions
578
+
579
+ knowledge-architecture/
580
+ [ ] 00-index.md — Has architecture diagram (Mermaid)
581
+ [ ] 01-system-overview.md — Has high-level diagram + architecture style
582
+ [ ] 02-components.md — Has per-component breakdown
583
+ [ ] 03-data-flow.md — Has request lifecycle diagram
584
+ [ ] 04-design-patterns.md — Has patterns with rationale
585
+ [ ] 05-decisions.md — Has ADR table
586
+
587
+ knowledge-domain/
588
+ [ ] 00-index.md — Has entity overview + ERD
589
+ [ ] 01-entities.md — Has per-entity fields and relationships
590
+ [ ] 02-database-schema.md — Has schema OR "Not applicable" with reason
591
+ [ ] 03-api-contracts.md — Has per-endpoint specs OR "Not applicable"
592
+ [ ] 04-business-rules.md — Has validation rules + business logic
593
+
594
+ knowledge-source-base/
595
+ [ ] 00-index.md — Has Read Order for New Members
596
+ [ ] 01-directory-structure.md — Has annotated directory tree
597
+ [ ] 02-entry-points.md — Has boot sequence
598
+ [ ] 03-key-modules.md — Has per-module breakdown
599
+ [ ] 04-configuration.md — Has env vars with descriptions
600
+
601
+ knowledge-standards/
602
+ [ ] 00-index.md — Has naming convention quick reference
603
+ [ ] 01-code-style.md — Has formatting + naming rules from config
604
+ [ ] 02-conventions.md — Has file organization patterns
605
+ [ ] 03-git-workflow.md — Has commit format + PR guidelines
606
+ [ ] 04-testing-standards.md — Has test structure + coverage goals
151
607
  ```
152
608
 
609
+ ### Content Quality Check
610
+
611
+ ```
612
+ FOR EACH knowledge folder:
613
+ [ ] 00-index.md TOC matches actual sub-files (no phantom links)
614
+ [ ] All cross-reference links point to existing files
615
+ [ ] No sub-file exceeds ~300 lines (split if needed)
616
+ [ ] No sub-file is < 20 lines of real content (merge if too thin)
617
+ [ ] Evidence Sources section present in every sub-file
618
+ [ ] No placeholder text in any file
619
+ [ ] Professional English tone throughout
620
+ [ ] Mermaid diagrams (if used) are syntactically valid
621
+ ```
622
+
623
+ > **Minimum total**: 5 folders x (1 index + 4-5 sub-files) = **26 files**
624
+ > **Large projects**: May have additional sub-files (30-40+ files total)
625
+
153
626
  ---
154
627
 
155
628
  ## COMPLETION
156
629
 
157
630
  Report status:
158
631
 
159
- 1. ✅ **Complete** — All 5 core docs created
160
- 2. **Incomplete** — List missing files
161
- 3. 📝 **Continue** → `/docs:business` for business docs
632
+ ```markdown
633
+ ## Docs-Core Complete
634
+
635
+ ### Deliverables
636
+ | # | Folder | Sub-Files | Mode | Status |
637
+ |---|--------|-----------|------|--------|
638
+ | 1 | knowledge-overview/ | 00-index + {N} | CREATE/UPDATE | Done |
639
+ | 2 | knowledge-architecture/ | 00-index + {N} | CREATE/UPDATE | Done |
640
+ | 3 | knowledge-domain/ | 00-index + {N} | CREATE/UPDATE | Done |
641
+ | 4 | knowledge-source-base/ | 00-index + {N} | CREATE/UPDATE | Done |
642
+ | 5 | knowledge-standards/ | 00-index + {N} | CREATE/UPDATE | Done |
643
+
644
+ **Total files**: {count}
645
+ **Evidence files used**: {count from ledger}
646
+
647
+ ### Quality Summary
648
+ - All content evidence-backed: Yes/No
649
+ - Placeholder-free: Yes/No
650
+ - Cross-references valid: Yes/No
651
+ - Onboarding-ready: Yes/No
652
+
653
+ ### Next Steps
654
+ - /docs:business — Generate business documentation
655
+ - Review generated docs for project-specific nuance
656
+ ```
657
+
658
+ 1. **Complete** — All 5 knowledge folders created with evidence-backed sub-files
659
+ 2. **Incomplete** — List missing folders/files with reason
660
+ 3. **Continue** -> `/docs:business` for business documentation