@kaddo/cli 2.7.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +20 -17
  2. package/dist/index.js +952 -171
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ async function multiselect2(opts) {
79
79
 
80
80
  // src/commands/init.ts
81
81
  var KADDO_DIR = ".kaddo";
82
- var ARCH_DIR = "architecture";
82
+ var ARCH_DIR = "knowledge";
83
83
  function inferProjectName(dir) {
84
84
  const pkgPath = join(dir, "package.json");
85
85
  if (exists(pkgPath)) {
@@ -217,13 +217,13 @@ async function runInit() {
217
217
  };
218
218
  const kaddoConfigPath = join(dir, KADDO_DIR, "config.yml");
219
219
  writeFile(kaddoConfigPath, buildConfig(meta));
220
- ensureDir(join(dir, ARCH_DIR, "work-items"));
220
+ ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
221
221
  writeFile(join(dir, ARCH_DIR, "knowledge.md"), buildKnowledge(projectName.trim()));
222
- writeFile(join(dir, ARCH_DIR, "roadmap.md"), buildRoadmap(projectName.trim()));
222
+ writeFile(join(dir, ARCH_DIR, "delivery", "roadmap.md"), buildRoadmap(projectName.trim()));
223
223
  log2.success("Created .kaddo/config.yml");
224
- log2.success("Created architecture/knowledge.md");
225
- log2.success("Created architecture/roadmap.md");
226
- log2.success("Created architecture/work-items/");
224
+ log2.success("Created knowledge/knowledge.md");
225
+ log2.success("Created knowledge/delivery/roadmap.md");
226
+ log2.success("Created knowledge/delivery/work-items/");
227
227
  log2.info("Next: run `kaddo scan` to detect your stack.");
228
228
  outro2("Kaddo initialized.");
229
229
  }
@@ -669,20 +669,20 @@ async function writeBaselineArtifacts(dir, result) {
669
669
  const scanJsonPath = join(dir, ".kaddo", "scan.json");
670
670
  writeFile(scanJsonPath, serializeBaseline(baseline));
671
671
  log2.success("Wrote .kaddo/scan.json");
672
- const inventoryPath = join(dir, "architecture", "inventory.md");
672
+ const inventoryPath = join(dir, "knowledge", "inventory.md");
673
673
  const inventoryExists = exists(inventoryPath);
674
674
  let writeInventory = true;
675
675
  if (inventoryExists) {
676
676
  writeInventory = await confirm2({
677
- message: "architecture/inventory.md already exists. Overwrite it?",
677
+ message: "knowledge/inventory.md already exists. Overwrite it?",
678
678
  initialValue: true
679
679
  });
680
680
  }
681
681
  if (writeInventory) {
682
682
  writeFile(inventoryPath, renderInventory(baseline));
683
- log2.success(`${inventoryExists ? "Updated" : "Wrote"} architecture/inventory.md`);
683
+ log2.success(`${inventoryExists ? "Updated" : "Wrote"} knowledge/inventory.md`);
684
684
  } else {
685
- log2.info("Kept existing architecture/inventory.md.");
685
+ log2.info("Kept existing knowledge/inventory.md.");
686
686
  }
687
687
  }
688
688
  function printStateAwareNextStep(dir) {
@@ -895,10 +895,10 @@ var adrModule = {
895
895
  name: "adr",
896
896
  description: "Architectural Decision Records \u2014 document decisions when risk justifies it",
897
897
  configKey: "module_adr",
898
- dirs: ["architecture/decisions"],
898
+ dirs: ["knowledge/tech/decisions"],
899
899
  files: [
900
900
  {
901
- path: "architecture/decisions/.gitkeep",
901
+ path: "knowledge/tech/decisions/.gitkeep",
902
902
  content: ""
903
903
  }
904
904
  ],
@@ -956,10 +956,10 @@ var incidentModule = {
956
956
  name: "incident",
957
957
  description: "Incident records \u2014 document incidents, learnings, and preventive actions",
958
958
  configKey: "module_incident",
959
- dirs: ["architecture/incidents"],
959
+ dirs: ["knowledge/incidents"],
960
960
  files: [
961
961
  {
962
- path: "architecture/incidents/.gitkeep",
962
+ path: "knowledge/incidents/.gitkeep",
963
963
  content: ""
964
964
  }
965
965
  ],
@@ -1018,10 +1018,10 @@ var rfcModule = {
1018
1018
  name: "rfc",
1019
1019
  description: "Request for Comments \u2014 explore relevant changes before building them",
1020
1020
  configKey: "module_rfc",
1021
- dirs: ["architecture/rfcs"],
1021
+ dirs: ["knowledge/rfcs"],
1022
1022
  files: [
1023
1023
  {
1024
- path: "architecture/rfcs/.gitkeep",
1024
+ path: "knowledge/rfcs/.gitkeep",
1025
1025
  content: ""
1026
1026
  }
1027
1027
  ],
@@ -1071,10 +1071,10 @@ var migrationModule = {
1071
1071
  name: "migration",
1072
1072
  description: "Migration records \u2014 data, infra, or technology changes with more rigor",
1073
1073
  configKey: "module_migration",
1074
- dirs: ["architecture/migrations"],
1074
+ dirs: ["knowledge/migrations"],
1075
1075
  files: [
1076
1076
  {
1077
- path: "architecture/migrations/.gitkeep",
1077
+ path: "knowledge/migrations/.gitkeep",
1078
1078
  content: ""
1079
1079
  }
1080
1080
  ],
@@ -1132,10 +1132,10 @@ var legacyModule = {
1132
1132
  name: "legacy",
1133
1133
  description: "Legacy records \u2014 document systems with technical debt before modifying them",
1134
1134
  configKey: "module_legacy",
1135
- dirs: ["architecture/legacy"],
1135
+ dirs: ["knowledge/legacy"],
1136
1136
  files: [
1137
1137
  {
1138
- path: "architecture/legacy/.gitkeep",
1138
+ path: "knowledge/legacy/.gitkeep",
1139
1139
  content: ""
1140
1140
  }
1141
1141
  ],
@@ -1185,10 +1185,10 @@ var contractsModule = {
1185
1185
  name: "contracts",
1186
1186
  description: "API, event, and integration contracts \u2014 document shared interfaces before changing them",
1187
1187
  configKey: "module_contracts",
1188
- dirs: ["architecture/contracts"],
1188
+ dirs: ["knowledge/contracts"],
1189
1189
  files: [
1190
1190
  {
1191
- path: "architecture/contracts/.gitkeep",
1191
+ path: "knowledge/contracts/.gitkeep",
1192
1192
  content: ""
1193
1193
  }
1194
1194
  ],
@@ -1247,10 +1247,10 @@ var capabilitiesModule = {
1247
1247
  name: "capabilities",
1248
1248
  description: "Product capabilities \u2014 map what the product can do and link it to domains and decisions",
1249
1249
  configKey: "module_capabilities",
1250
- dirs: ["architecture/capabilities"],
1250
+ dirs: ["knowledge/product/capabilities"],
1251
1251
  files: [
1252
1252
  {
1253
- path: "architecture/capabilities/.gitkeep",
1253
+ path: "knowledge/product/capabilities/.gitkeep",
1254
1254
  content: ""
1255
1255
  }
1256
1256
  ],
@@ -1301,10 +1301,10 @@ var guardAdvancedModule = {
1301
1301
  name: "guard-advanced",
1302
1302
  description: "Advanced guard rules \u2014 CI blocking, critical artifact protection, domain-level thresholds",
1303
1303
  configKey: "module_guard_advanced",
1304
- dirs: ["architecture/guard-rules"],
1304
+ dirs: ["knowledge/guard-rules"],
1305
1305
  files: [
1306
1306
  {
1307
- path: "architecture/guard-rules/rules.yml",
1307
+ path: "knowledge/guard-rules/rules.yml",
1308
1308
  content: [
1309
1309
  "# Kaddo Guard Advanced \u2014 rules configuration",
1310
1310
  "# Uncomment and configure the rules you want to enforce.",
@@ -1405,7 +1405,7 @@ Optionally provide: README, existing docs, product notes, screenshots, API docum
1405
1405
 
1406
1406
  ## Expected Output
1407
1407
 
1408
- A Markdown artifact intended to be saved as \`architecture/capabilities.md\`.
1408
+ A Markdown artifact intended to be saved as \`knowledge/product/capabilities.md\`.
1409
1409
 
1410
1410
  ## Instructions
1411
1411
 
@@ -1472,7 +1472,7 @@ Generated from Kaddo Context Pack.
1472
1472
 
1473
1473
  ## Where to Save the Result
1474
1474
 
1475
- Save the output as \`architecture/capabilities.md\`.
1475
+ Save the output as \`knowledge/product/capabilities.md\`.
1476
1476
 
1477
1477
  ## Quality Checklist
1478
1478
 
@@ -1507,9 +1507,9 @@ Optionally provide: existing diagrams, infra config, README, dependency manifest
1507
1507
 
1508
1508
  Markdown artifacts intended to be saved as:
1509
1509
 
1510
- - \`architecture/current-state.md\`
1511
- - \`architecture/architecture-notes.md\`
1512
- - \`architecture/decision-candidates.md\`
1510
+ - \`knowledge/tech/current-state.md\`
1511
+ - \`knowledge/tech/architecture-notes.md\`
1512
+ - \`knowledge/tech/decision-candidates.md\`
1513
1513
 
1514
1514
  ## Instructions
1515
1515
 
@@ -1555,9 +1555,9 @@ Generated from Kaddo Context Pack.
1555
1555
 
1556
1556
  ## Where to Save the Result
1557
1557
 
1558
- Save the architecture overview as \`architecture/current-state.md\`, supporting notes as
1559
- \`architecture/architecture-notes.md\`, and decision candidates as
1560
- \`architecture/decision-candidates.md\`.
1558
+ Save the architecture overview as \`knowledge/tech/current-state.md\`, supporting notes as
1559
+ \`knowledge/tech/architecture-notes.md\`, and decision candidates as
1560
+ \`knowledge/tech/decision-candidates.md\`.
1561
1561
 
1562
1562
  ## Quality Checklist
1563
1563
 
@@ -1589,17 +1589,17 @@ Provide \`.kaddo/context-pack.md\` as the primary input.
1589
1589
  Optionally provide (use whatever is available; mark anything missing as an assumption or
1590
1590
  open question):
1591
1591
 
1592
- - \`architecture/capabilities.md\`
1593
- - \`architecture/current-state.md\`
1594
- - \`architecture/legacy/risks.md\`
1595
- - \`architecture/legacy/unknowns.md\`
1596
- - \`architecture/decision-candidates.md\`
1597
- - \`architecture/knowledge.md\`
1592
+ - \`knowledge/product/capabilities.md\`
1593
+ - \`knowledge/tech/current-state.md\`
1594
+ - \`knowledge/legacy/risks.md\`
1595
+ - \`knowledge/legacy/unknowns.md\`
1596
+ - \`knowledge/tech/decision-candidates.md\`
1597
+ - \`knowledge/knowledge.md\`
1598
1598
  - business priorities
1599
1599
 
1600
1600
  ## Expected Output
1601
1601
 
1602
- A single Markdown artifact intended to be saved as \`architecture/roadmap.md\`.
1602
+ A single Markdown artifact intended to be saved as \`knowledge/delivery/roadmap.md\`.
1603
1603
 
1604
1604
  This roadmap is the bridge between understanding and execution. It must be structured enough
1605
1605
  that a future \`kaddo create --from roadmap\` command can read its candidate work items.
@@ -1706,7 +1706,7 @@ human review \u2014 not final commitments.
1706
1706
 
1707
1707
  ## Where to Save the Result
1708
1708
 
1709
- Save the output as \`architecture/roadmap.md\`.
1709
+ Save the output as \`knowledge/delivery/roadmap.md\`.
1710
1710
 
1711
1711
  ## Quality Checklist
1712
1712
 
@@ -1744,9 +1744,9 @@ Optionally provide: incident history, known pain points, dependency manifests.
1744
1744
 
1745
1745
  Markdown artifacts intended to be saved as:
1746
1746
 
1747
- - \`architecture/legacy/risks.md\`
1748
- - \`architecture/legacy/unknowns.md\`
1749
- - \`architecture/legacy/modernization-candidates.md\`
1747
+ - \`knowledge/legacy/risks.md\`
1748
+ - \`knowledge/legacy/unknowns.md\`
1749
+ - \`knowledge/legacy/modernization-candidates.md\`
1750
1750
 
1751
1751
  ## Instructions
1752
1752
 
@@ -1796,9 +1796,9 @@ Generated from Kaddo Context Pack.
1796
1796
 
1797
1797
  ## Where to Save the Result
1798
1798
 
1799
- Save risks as \`architecture/legacy/risks.md\`, unknowns as
1800
- \`architecture/legacy/unknowns.md\`, and modernization candidates as
1801
- \`architecture/legacy/modernization-candidates.md\`.
1799
+ Save risks as \`knowledge/legacy/risks.md\`, unknowns as
1800
+ \`knowledge/legacy/unknowns.md\`, and modernization candidates as
1801
+ \`knowledge/legacy/modernization-candidates.md\`.
1802
1802
 
1803
1803
  ## Quality Checklist
1804
1804
 
@@ -1826,11 +1826,11 @@ to capture decisions that are implicit in the system.
1826
1826
 
1827
1827
  Provide \`.kaddo/context-pack.md\` as the primary input.
1828
1828
 
1829
- Optionally provide: \`architecture/current-state.md\`, \`architecture/architecture-notes.md\`.
1829
+ Optionally provide: \`knowledge/tech/current-state.md\`, \`knowledge/tech/architecture-notes.md\`.
1830
1830
 
1831
1831
  ## Expected Output
1832
1832
 
1833
- A Markdown artifact intended to be saved as \`architecture/decision-candidates.md\`.
1833
+ A Markdown artifact intended to be saved as \`knowledge/tech/decision-candidates.md\`.
1834
1834
 
1835
1835
  ## Instructions
1836
1836
 
@@ -1876,7 +1876,7 @@ Generated from Kaddo Context Pack.
1876
1876
 
1877
1877
  ## Where to Save the Result
1878
1878
 
1879
- Save the output as \`architecture/decision-candidates.md\`.
1879
+ Save the output as \`knowledge/tech/decision-candidates.md\`.
1880
1880
 
1881
1881
  ## Quality Checklist
1882
1882
 
@@ -1897,7 +1897,7 @@ Work Item actionable for a human.
1897
1897
 
1898
1898
  ## When to Use
1899
1899
 
1900
- Use this agent after a roadmap exists (\`architecture/roadmap.md\`) or when an existing Work
1900
+ Use this agent after a roadmap exists (\`knowledge/delivery/roadmap.md\`) or when an existing Work
1901
1901
  Item is vague, too large, or missing acceptance criteria.
1902
1902
 
1903
1903
  ## Input Required
@@ -1907,7 +1907,7 @@ existing Work Item file to refine.
1907
1907
 
1908
1908
  ## Expected Output
1909
1909
 
1910
- A refined Work Item intended to be saved as \`architecture/work-items/*.md\`.
1910
+ A refined Work Item intended to be saved as \`knowledge/delivery/work-items/*.md\`.
1911
1911
 
1912
1912
  ## Instructions
1913
1913
 
@@ -1948,7 +1948,7 @@ A refined Work Item intended to be saved as \`architecture/work-items/*.md\`.
1948
1948
 
1949
1949
  ## Where to Save the Result
1950
1950
 
1951
- Save the output as a file under \`architecture/work-items/\`.
1951
+ Save the output as a file under \`knowledge/delivery/work-items/\`.
1952
1952
 
1953
1953
  ## Quality Checklist
1954
1954
 
@@ -1979,7 +1979,7 @@ structure (from \`.kaddo/config.yml\`) are especially relevant.
1979
1979
 
1980
1980
  ## Expected Output
1981
1981
 
1982
- A Markdown artifact intended to be saved as \`architecture/git-strategy.md\`.
1982
+ A Markdown artifact intended to be saved as \`knowledge/tech/git-strategy.md\`.
1983
1983
 
1984
1984
  ## Instructions
1985
1985
 
@@ -2019,7 +2019,7 @@ GitHub Flow + Conventional Commits + SemVer
2019
2019
 
2020
2020
  ## Where to Save the Result
2021
2021
 
2022
- Save the output as \`architecture/git-strategy.md\`. Optionally record machine config in
2022
+ Save the output as \`knowledge/tech/git-strategy.md\`. Optionally record machine config in
2023
2023
  \`.kaddo/git.yml\`.
2024
2024
 
2025
2025
  ## Quality Checklist
@@ -2051,8 +2051,8 @@ module's \`module-design.md\` if it exists.
2051
2051
 
2052
2052
  ## Expected Output
2053
2053
 
2054
- A Markdown artifact intended to be saved as \`architecture/security.md\` or
2055
- \`architecture/modules/<module-name>/security.md\`.
2054
+ A Markdown artifact intended to be saved as \`knowledge/tech/security.md\` or
2055
+ \`knowledge/tech/modules/<module-name>/security.md\`.
2056
2056
 
2057
2057
  ## Instructions
2058
2058
 
@@ -2090,8 +2090,8 @@ A Markdown artifact intended to be saved as \`architecture/security.md\` or
2090
2090
 
2091
2091
  ## Where to Save the Result
2092
2092
 
2093
- Save as \`architecture/security.md\` (global) or
2094
- \`architecture/modules/<module-name>/security.md\` (per module).
2093
+ Save as \`knowledge/tech/security.md\` (global) or
2094
+ \`knowledge/tech/modules/<module-name>/security.md\` (per module).
2095
2095
 
2096
2096
  ## Quality Checklist
2097
2097
 
@@ -2119,8 +2119,8 @@ Provide \`.kaddo/context-pack.md\` as the primary input.
2119
2119
 
2120
2120
  ## Expected Output
2121
2121
 
2122
- A Markdown artifact intended to be saved as \`architecture/standards.md\` or
2123
- \`architecture/modules/<module-name>/standards.md\`.
2122
+ A Markdown artifact intended to be saved as \`knowledge/tech/standards.md\` or
2123
+ \`knowledge/tech/modules/<module-name>/standards.md\`.
2124
2124
 
2125
2125
  ## Instructions
2126
2126
 
@@ -2152,8 +2152,8 @@ A Markdown artifact intended to be saved as \`architecture/standards.md\` or
2152
2152
 
2153
2153
  ## Where to Save the Result
2154
2154
 
2155
- Save as \`architecture/standards.md\` (global) or
2156
- \`architecture/modules/<module-name>/standards.md\` (per module).
2155
+ Save as \`knowledge/tech/standards.md\` (global) or
2156
+ \`knowledge/tech/modules/<module-name>/standards.md\` (per module).
2157
2157
 
2158
2158
  ## Quality Checklist
2159
2159
 
@@ -2183,8 +2183,8 @@ especially relevant.
2183
2183
 
2184
2184
  ## Expected Output
2185
2185
 
2186
- A Markdown artifact intended to be saved as \`architecture/stack.md\` or
2187
- \`architecture/modules/<module-name>/stack.md\`.
2186
+ A Markdown artifact intended to be saved as \`knowledge/tech/stack.md\` or
2187
+ \`knowledge/tech/modules/<module-name>/stack.md\`.
2188
2188
 
2189
2189
  ## Instructions
2190
2190
 
@@ -2220,8 +2220,8 @@ A Markdown artifact intended to be saved as \`architecture/stack.md\` or
2220
2220
 
2221
2221
  ## Where to Save the Result
2222
2222
 
2223
- Save as \`architecture/stack.md\` (global) or
2224
- \`architecture/modules/<module-name>/stack.md\` (per module).
2223
+ Save as \`knowledge/tech/stack.md\` (global) or
2224
+ \`knowledge/tech/modules/<module-name>/stack.md\` (per module).
2225
2225
 
2226
2226
  ## Quality Checklist
2227
2227
 
@@ -2242,7 +2242,7 @@ mark assumptions.
2242
2242
  ## When to Use
2243
2243
 
2244
2244
  Use this agent after \`kaddo modules map\`, to fill in the generated
2245
- \`architecture/modules/<module-name>/module-design.md\`.
2245
+ \`knowledge/tech/modules/<module-name>/module-design.md\`.
2246
2246
 
2247
2247
  ## Input Required
2248
2248
 
@@ -2252,7 +2252,7 @@ Provide \`.kaddo/context-pack.md\` as the primary input, plus the module entry i
2252
2252
  ## Expected Output
2253
2253
 
2254
2254
  A Markdown artifact intended to be saved as
2255
- \`architecture/modules/<module-name>/module-design.md\`.
2255
+ \`knowledge/tech/modules/<module-name>/module-design.md\`.
2256
2256
 
2257
2257
  ## Instructions
2258
2258
 
@@ -2295,7 +2295,7 @@ A Markdown artifact intended to be saved as
2295
2295
 
2296
2296
  ## Where to Save the Result
2297
2297
 
2298
- Save as \`architecture/modules/<module-name>/module-design.md\`.
2298
+ Save as \`knowledge/tech/modules/<module-name>/module-design.md\`.
2299
2299
 
2300
2300
  ## Quality Checklist
2301
2301
 
@@ -2304,6 +2304,171 @@ Save as \`architecture/modules/<module-name>/module-design.md\`.
2304
2304
  - Diagrams are suggested, not generated.
2305
2305
  - Assumptions and risks are explicit.
2306
2306
  `;
2307
+ var BUSINESS_AGENT = `# Business Agent
2308
+
2309
+ ## Role
2310
+
2311
+ You are the Kaddo Business Agent. You help turn an initial idea into a clear business
2312
+ definition for a new project. You do not write code and you do not invent facts \u2014 you ask
2313
+ for missing information and mark unknowns.
2314
+
2315
+ ## When to Use
2316
+
2317
+ Use this agent after \`kaddo bootstrap\`, when refining the artifacts under
2318
+ \`knowledge/business/\`.
2319
+
2320
+ ## Input Required
2321
+
2322
+ Provide \`.kaddo/context-pack.md\` (if available) and the founder/team's notes about the
2323
+ idea: problem, intended users, value, constraints.
2324
+
2325
+ ## Expected Output
2326
+
2327
+ Refined Markdown for \`knowledge/business/*.md\`: product brief, problem statement,
2328
+ users/personas, value proposition, business rules, constraints and glossary.
2329
+
2330
+ ## Instructions
2331
+
2332
+ 1. Clarify the problem without assuming the solution.
2333
+ 2. Identify primary and secondary users with goals.
2334
+ 3. State the value proposition specifically.
2335
+ 4. Capture business rules as testable statements.
2336
+ 5. List real constraints (business, regulatory, resources).
2337
+ 6. Build a shared glossary.
2338
+ 7. Mark every uncertainty as an assumption or open question.
2339
+
2340
+ ## Constraints
2341
+
2342
+ - Do not invent business facts; ask instead.
2343
+ - Do not write code or choose a stack.
2344
+ - Keep each artifact lightweight and high-value.
2345
+ - Mark assumptions and open questions explicitly.
2346
+
2347
+ ## Output Format
2348
+
2349
+ One Markdown section per \`knowledge/business/*.md\` artifact, keeping the template
2350
+ headings.
2351
+
2352
+ ## Where to Save the Result
2353
+
2354
+ Save into \`knowledge/business/\` (product-brief.md, problem.md, users.md,
2355
+ value-proposition.md, business-rules.md, constraints.md, glossary.md).
2356
+
2357
+ ## Quality Checklist
2358
+
2359
+ - The problem is stated without assuming the solution.
2360
+ - Users have goals, not just labels.
2361
+ - Rules are testable and free of implementation detail.
2362
+ - Assumptions and open questions are explicit.
2363
+ `;
2364
+ var BOOTSTRAP_AGENT = `# Bootstrap Agent
2365
+
2366
+ ## Role
2367
+
2368
+ You are the Kaddo Bootstrap Agent. You guide the transition from business definition to an
2369
+ initial architecture direction, quality attributes, a roadmap and first Work Items for a
2370
+ new project. You propose; the human decides.
2371
+
2372
+ ## When to Use
2373
+
2374
+ Use this agent after \`kaddo bootstrap\` and after the business artifacts are drafted.
2375
+
2376
+ ## Input Required
2377
+
2378
+ Provide \`.kaddo/context-pack.md\` and the \`knowledge/business/*.md\` artifacts.
2379
+
2380
+ ## Expected Output
2381
+
2382
+ Refined Markdown for \`knowledge/bootstrap-summary.md\`, \`knowledge/product/capabilities.md\`,
2383
+ \`knowledge/tech/quality-attributes.md\` and \`knowledge/delivery/roadmap.md\`, plus candidate Work
2384
+ Items.
2385
+
2386
+ ## Instructions
2387
+
2388
+ 1. Derive candidate capabilities from the business definition.
2389
+ 2. Propose prioritized quality attributes and accepted trade-offs.
2390
+ 3. Outline an initial architecture direction (no final decisions \u2014 list candidates).
2391
+ 4. Propose a prioritized roadmap of candidate Work Items with suggested Knowledge Levels.
2392
+ 5. Keep a clear next step and open questions.
2393
+
2394
+ ## Constraints
2395
+
2396
+ - Do not call any external service; you run in the human's chat.
2397
+ - Do not decide architecture unilaterally \u2014 mark decisions as candidates (ADR later).
2398
+ - Do not write production code.
2399
+ - Do not invent business facts.
2400
+
2401
+ ## Output Format
2402
+
2403
+ Markdown matching the bootstrap-summary, capabilities, quality-attributes and roadmap
2404
+ templates.
2405
+
2406
+ ## Where to Save the Result
2407
+
2408
+ Save to \`knowledge/bootstrap-summary.md\`, \`knowledge/product/capabilities.md\`,
2409
+ \`knowledge/tech/quality-attributes.md\` and \`knowledge/delivery/roadmap.md\`.
2410
+
2411
+ ## Quality Checklist
2412
+
2413
+ - Capabilities trace back to the business definition.
2414
+ - Quality attributes are prioritized, not all "high".
2415
+ - Roadmap candidates are compatible with \`kaddo create --from roadmap\`.
2416
+ - Open questions and assumptions are explicit.
2417
+ `;
2418
+ var CODEBASE_FOUNDATION_AGENT = `# Codebase Foundation Agent
2419
+
2420
+ ## Role
2421
+
2422
+ You are the Kaddo Codebase Foundation Agent. You propose a coherent codebase foundation \u2014
2423
+ structure, modules, boundaries and conventions \u2014 aligned with the business, the initial
2424
+ architecture and the candidate stack. You do **not** write production code.
2425
+
2426
+ ## When to Use
2427
+
2428
+ Use this agent after the business and initial architecture artifacts exist, when refining
2429
+ \`knowledge/tech/codebase.md\`.
2430
+
2431
+ ## Input Required
2432
+
2433
+ Provide \`.kaddo/context-pack.md\`, \`knowledge/business/*.md\`,
2434
+ \`knowledge/product/capabilities.md\`, \`knowledge/tech/quality-attributes.md\` and
2435
+ \`knowledge/tech/stack.md\`.
2436
+
2437
+ ## Expected Output
2438
+
2439
+ Refined Markdown for \`knowledge/tech/codebase.md\`.
2440
+
2441
+ ## Instructions
2442
+
2443
+ 1. Propose a suggested folder/module structure that follows the domain, not a framework
2444
+ default.
2445
+ 2. Define initial boundaries between modules.
2446
+ 3. Recommend conventions (naming, layering, testing expectations).
2447
+ 4. State minimum criteria to start development.
2448
+ 5. Reference the Git strategy rather than restating it.
2449
+
2450
+ ## Constraints
2451
+
2452
+ - Do not write production code or create implementation files.
2453
+ - Do not install or assume a specific framework's scaffolding.
2454
+ - Keep it a foundation, not a full design.
2455
+ - Mark assumptions and open questions explicitly.
2456
+
2457
+ ## Output Format
2458
+
2459
+ Markdown matching the codebase-foundation template headings.
2460
+
2461
+ ## Where to Save the Result
2462
+
2463
+ Save as \`knowledge/tech/codebase.md\`.
2464
+
2465
+ ## Quality Checklist
2466
+
2467
+ - Structure follows business and architecture, not a framework default.
2468
+ - No production code is described.
2469
+ - Minimum criteria to start development are explicit.
2470
+ - Assumptions and open questions are listed.
2471
+ `;
2307
2472
  var AGENT_PROMPTS = [
2308
2473
  { fileName: "capability-agent.md", content: CAPABILITY_AGENT },
2309
2474
  { fileName: "architecture-agent.md", content: ARCHITECTURE_AGENT },
@@ -2315,12 +2480,16 @@ var AGENT_PROMPTS = [
2315
2480
  { fileName: "security-agent.md", content: SECURITY_AGENT },
2316
2481
  { fileName: "standards-agent.md", content: STANDARDS_AGENT },
2317
2482
  { fileName: "stack-agent.md", content: STACK_AGENT },
2318
- { fileName: "module-design-agent.md", content: MODULE_DESIGN_AGENT }
2483
+ { fileName: "module-design-agent.md", content: MODULE_DESIGN_AGENT },
2484
+ // Bootstrap agents (new projects)
2485
+ { fileName: "business-agent.md", content: BUSINESS_AGENT },
2486
+ { fileName: "bootstrap-agent.md", content: BOOTSTRAP_AGENT },
2487
+ { fileName: "codebase-agent.md", content: CODEBASE_FOUNDATION_AGENT }
2319
2488
  ];
2320
2489
 
2321
2490
  // src/modules/agents.ts
2322
2491
  var agentReadme = {
2323
- path: "architecture/agents/README.md",
2492
+ path: "knowledge/agents/README.md",
2324
2493
  content: [
2325
2494
  "# Agents",
2326
2495
  "",
@@ -2338,12 +2507,18 @@ var agentReadme = {
2338
2507
  "",
2339
2508
  "## Recommended order by project state",
2340
2509
  "",
2341
- "- **new** \u2192 roadmap-agent \u2192 architecture-agent",
2510
+ "- **new** \u2192 business-agent \u2192 bootstrap-agent \u2192 codebase-agent \u2192 roadmap-agent",
2342
2511
  "- **pre-ai** \u2192 capability-agent \u2192 architecture-agent \u2192 roadmap-agent",
2343
2512
  "- **legacy** \u2192 legacy-agent \u2192 architecture-agent \u2192 capability-agent \u2192 roadmap-agent",
2344
2513
  "",
2345
2514
  "## Installed agents",
2346
2515
  "",
2516
+ "### Bootstrap agents (new projects)",
2517
+ "",
2518
+ "- `business-agent.md` \u2014 turn an idea into a business definition.",
2519
+ "- `bootstrap-agent.md` \u2014 go from business to capabilities, quality attributes and roadmap.",
2520
+ "- `codebase-agent.md` \u2014 propose a codebase foundation (no code).",
2521
+ "",
2347
2522
  "### Understanding agents",
2348
2523
  "",
2349
2524
  "- `capability-agent.md` \u2014 extract/propose system capabilities.",
@@ -2363,14 +2538,14 @@ var agentReadme = {
2363
2538
  ].join("\n")
2364
2539
  };
2365
2540
  var agentFiles = AGENT_PROMPTS.map((a) => ({
2366
- path: `architecture/agents/${a.fileName}`,
2541
+ path: `knowledge/agents/${a.fileName}`,
2367
2542
  content: a.content
2368
2543
  }));
2369
2544
  var agentsModule = {
2370
2545
  name: "agents",
2371
2546
  description: "Agent prompt packs \u2014 Markdown prompts to turn context packs into knowledge in your LLM",
2372
2547
  configKey: "module_agents",
2373
- dirs: ["architecture/agents"],
2548
+ dirs: ["knowledge/agents"],
2374
2549
  files: [agentReadme, ...agentFiles],
2375
2550
  workItemTypes: [
2376
2551
  {
@@ -2419,14 +2594,14 @@ var skillsModule = {
2419
2594
  name: "skills",
2420
2595
  description: "Reusable skills \u2014 capabilities shared across agents, teams, or projects",
2421
2596
  configKey: "module_skills",
2422
- dirs: ["architecture/skills"],
2597
+ dirs: ["knowledge/skills"],
2423
2598
  files: [
2424
2599
  {
2425
- path: "architecture/skills/.gitkeep",
2600
+ path: "knowledge/skills/.gitkeep",
2426
2601
  content: ""
2427
2602
  },
2428
2603
  {
2429
- path: "architecture/skills/README.md",
2604
+ path: "knowledge/skills/README.md",
2430
2605
  content: [
2431
2606
  "# Skills",
2432
2607
  "",
@@ -2639,33 +2814,33 @@ var standardsModule = {
2639
2814
  name: "standards",
2640
2815
  description: "Global standards starter \u2014 lightweight coding, docs and testing conventions",
2641
2816
  configKey: "module_standards",
2642
- dirs: ["architecture"],
2643
- files: [{ path: "architecture/standards.md", content: standardsTemplate }],
2817
+ dirs: ["knowledge"],
2818
+ files: [{ path: "knowledge/tech/standards.md", content: standardsTemplate }],
2644
2819
  workItemTypes: []
2645
2820
  };
2646
2821
  var securityModule = {
2647
2822
  name: "security",
2648
2823
  description: "Global security starter \u2014 document security considerations (no scanning)",
2649
2824
  configKey: "module_security",
2650
- dirs: ["architecture"],
2651
- files: [{ path: "architecture/security.md", content: securityTemplate }],
2825
+ dirs: ["knowledge"],
2826
+ files: [{ path: "knowledge/tech/security.md", content: securityTemplate }],
2652
2827
  workItemTypes: []
2653
2828
  };
2654
2829
  var stackModule = {
2655
2830
  name: "stack",
2656
2831
  description: "Global stack starter \u2014 document technologies and stack decisions",
2657
2832
  configKey: "module_stack",
2658
- dirs: ["architecture"],
2659
- files: [{ path: "architecture/stack.md", content: stackTemplate }],
2833
+ dirs: ["knowledge"],
2834
+ files: [{ path: "knowledge/tech/stack.md", content: stackTemplate }],
2660
2835
  workItemTypes: []
2661
2836
  };
2662
2837
  var gitStrategyModule = {
2663
2838
  name: "git-strategy",
2664
2839
  description: "Git strategy starter \u2014 default GitHub Flow + Conventional Commits + SemVer",
2665
2840
  configKey: "module_git_strategy",
2666
- dirs: ["architecture"],
2841
+ dirs: ["knowledge"],
2667
2842
  files: [
2668
- { path: "architecture/git-strategy.md", content: gitStrategyTemplate },
2843
+ { path: "knowledge/tech/git-strategy.md", content: gitStrategyTemplate },
2669
2844
  { path: ".kaddo/git.yml", content: gitYml }
2670
2845
  ],
2671
2846
  workItemTypes: []
@@ -2821,8 +2996,8 @@ function parseRoadmapCandidates(markdown) {
2821
2996
  }
2822
2997
 
2823
2998
  // src/commands/create.ts
2824
- var WORK_ITEMS_DIR = "architecture/work-items";
2825
- var ROADMAP_PATH = "architecture/roadmap.md";
2999
+ var WORK_ITEMS_DIR = "knowledge/delivery/work-items";
3000
+ var ROADMAP_PATH = "knowledge/delivery/roadmap.md";
2826
3001
  function printStateGuidance(dir) {
2827
3002
  let config;
2828
3003
  try {
@@ -3443,7 +3618,7 @@ function toStringArray(value) {
3443
3618
  return Array.isArray(value) ? value.map((v) => String(v)).filter(Boolean) : [];
3444
3619
  }
3445
3620
  function moduleArtifactCoverage(dir, id) {
3446
- const base = join(dir, "architecture", "modules", id);
3621
+ const base = join(dir, "knowledge", "tech", "modules", id);
3447
3622
  return {
3448
3623
  moduleDesign: exists(join(base, "module-design.md")),
3449
3624
  stack: exists(join(base, "stack.md")),
@@ -3734,7 +3909,7 @@ function collectMatchedDomains(matchedArtifactDomains) {
3734
3909
  }
3735
3910
 
3736
3911
  // src/commands/guard.ts
3737
- var ARCH_DIR2 = "architecture";
3912
+ var ARCH_DIR2 = "knowledge";
3738
3913
  var CONFIG_PATH2 = ".kaddo/config.yml";
3739
3914
  function loadConfig2(dir) {
3740
3915
  const configPath = join(dir, CONFIG_PATH2);
@@ -3880,7 +4055,7 @@ async function runGuard(opts = {}) {
3880
4055
  }
3881
4056
  const archDir = join(dir, ARCH_DIR2);
3882
4057
  if (!exists(archDir)) {
3883
- console.log("kaddo guard: no architecture/ directory found. Run `kaddo init` first.");
4058
+ console.log("kaddo guard: no knowledge/ directory found. Run `kaddo init` first.");
3884
4059
  return;
3885
4060
  }
3886
4061
  const artifacts = readArtifacts(archDir);
@@ -3995,8 +4170,60 @@ function runIgnoreRemove(artifactId) {
3995
4170
  import matter2 from "gray-matter";
3996
4171
  import { parse as parseYaml8 } from "yaml";
3997
4172
 
4173
+ // src/core/layers.ts
4174
+ var KNOWLEDGE = "knowledge";
4175
+ var LAYER_SPEC = [
4176
+ {
4177
+ layer: "Business",
4178
+ items: [
4179
+ { name: "problem", path: `${KNOWLEDGE}/business/problem.md` },
4180
+ { name: "users", path: `${KNOWLEDGE}/business/users.md` },
4181
+ { name: "value-proposition", path: `${KNOWLEDGE}/business/value-proposition.md` },
4182
+ { name: "constraints", path: `${KNOWLEDGE}/business/constraints.md` },
4183
+ { name: "business-rules", path: `${KNOWLEDGE}/business/business-rules.md` }
4184
+ ]
4185
+ },
4186
+ {
4187
+ layer: "Product",
4188
+ items: [
4189
+ { name: "product brief", path: `${KNOWLEDGE}/product/product-brief.md` },
4190
+ { name: "capabilities", path: `${KNOWLEDGE}/product/capabilities.md` }
4191
+ ]
4192
+ },
4193
+ {
4194
+ layer: "Tech",
4195
+ items: [
4196
+ { name: "codebase", path: `${KNOWLEDGE}/tech/codebase.md` },
4197
+ { name: "current-state", path: `${KNOWLEDGE}/tech/current-state.md` },
4198
+ { name: "decisions", path: `${KNOWLEDGE}/tech/decisions` }
4199
+ ]
4200
+ },
4201
+ {
4202
+ layer: "Delivery",
4203
+ items: [
4204
+ { name: "roadmap", path: `${KNOWLEDGE}/delivery/roadmap.md` },
4205
+ { name: "work items", path: `${KNOWLEDGE}/delivery/work-items` }
4206
+ ]
4207
+ }
4208
+ ];
4209
+ function knowledgeLayers(dir) {
4210
+ return LAYER_SPEC.map(({ layer, items }) => ({
4211
+ layer,
4212
+ items: items.map((it) => ({ name: it.name, present: exists(join(dir, it.path)) }))
4213
+ }));
4214
+ }
4215
+ function renderLayersMarkdown(layers) {
4216
+ const lines = [];
4217
+ for (const { layer, items } of layers) {
4218
+ lines.push(`### ${layer}`);
4219
+ for (const it of items) lines.push(`- ${it.present ? "\u2713" : "\u2717"} ${it.name}`);
4220
+ lines.push("");
4221
+ }
4222
+ return lines.join("\n").trimEnd();
4223
+ }
4224
+
3998
4225
  // src/core/project-explain.ts
3999
- var ARCH_DIR3 = "architecture";
4226
+ var ARCH_DIR3 = "knowledge";
4000
4227
  function first(values) {
4001
4228
  if (Array.isArray(values)) {
4002
4229
  const v = values.find((x) => typeof x === "string" && x);
@@ -4054,9 +4281,9 @@ function buildProjectExplanation(dir) {
4054
4281
  hasInventory: exists(join(dir, ARCH_DIR3, "inventory.md")),
4055
4282
  hasContextPack: exists(join(dir, ".kaddo", "context-pack.md")),
4056
4283
  hasUnderstand: exists(join(dir, ".kaddo", "understand.md")),
4057
- hasCapabilities: exists(join(dir, ARCH_DIR3, "capabilities.md")),
4058
- hasArchitecture: exists(join(dir, ARCH_DIR3, "current-state.md")),
4059
- hasRoadmap: exists(join(dir, ARCH_DIR3, "roadmap.md")),
4284
+ hasCapabilities: exists(join(dir, ARCH_DIR3, "product", "capabilities.md")),
4285
+ hasArchitecture: exists(join(dir, ARCH_DIR3, "tech", "current-state.md")),
4286
+ hasRoadmap: exists(join(dir, ARCH_DIR3, "delivery", "roadmap.md")),
4060
4287
  hasAgents: hasAgents(dir)
4061
4288
  };
4062
4289
  const archDir = join(dir, ARCH_DIR3);
@@ -4090,14 +4317,14 @@ function buildProjectExplanation(dir) {
4090
4317
  const missingKnowledge = [];
4091
4318
  if (!knowledge.hasScan) missingKnowledge.push("Scan baseline (.kaddo/scan.json)");
4092
4319
  if (!knowledge.hasContextPack) missingKnowledge.push("Context pack (.kaddo/context-pack.md)");
4093
- if (!knowledge.hasInventory) missingKnowledge.push("Inventory (architecture/inventory.md)");
4320
+ if (!knowledge.hasInventory) missingKnowledge.push("Inventory (knowledge/inventory.md)");
4094
4321
  if (!knowledge.hasCapabilities)
4095
- missingKnowledge.push("Capabilities (architecture/capabilities.md)");
4322
+ missingKnowledge.push("Capabilities (knowledge/product/capabilities.md)");
4096
4323
  if (!knowledge.hasArchitecture)
4097
- missingKnowledge.push("Architecture baseline (architecture/current-state.md)");
4098
- if (!knowledge.hasRoadmap) missingKnowledge.push("Roadmap (architecture/roadmap.md)");
4099
- if (!knowledge.hasAgents) missingKnowledge.push("Agents (architecture/agents/)");
4100
- if (items.length === 0) missingKnowledge.push("Work items (architecture/work-items/)");
4324
+ missingKnowledge.push("Architecture baseline (knowledge/tech/current-state.md)");
4325
+ if (!knowledge.hasRoadmap) missingKnowledge.push("Roadmap (knowledge/delivery/roadmap.md)");
4326
+ if (!knowledge.hasAgents) missingKnowledge.push("Agents (knowledge/agents/)");
4327
+ if (items.length === 0) missingKnowledge.push("Work items (knowledge/delivery/work-items/)");
4101
4328
  const suggestedNextSteps = [];
4102
4329
  if (!knowledge.hasScan) {
4103
4330
  suggestedNextSteps.push("Run `kaddo scan` to detect the technical stack.");
@@ -4108,13 +4335,13 @@ function buildProjectExplanation(dir) {
4108
4335
  suggestedNextSteps.push("Run `kaddo add agents` to install knowledge agents.");
4109
4336
  }
4110
4337
  if (!knowledge.hasCapabilities) {
4111
- suggestedNextSteps.push("Use capability-agent to generate architecture/capabilities.md.");
4338
+ suggestedNextSteps.push("Use capability-agent to generate knowledge/product/capabilities.md.");
4112
4339
  }
4113
4340
  if (!knowledge.hasArchitecture) {
4114
- suggestedNextSteps.push("Use architecture-agent to generate architecture/current-state.md.");
4341
+ suggestedNextSteps.push("Use architecture-agent to generate knowledge/tech/current-state.md.");
4115
4342
  }
4116
4343
  if (!knowledge.hasRoadmap) {
4117
- suggestedNextSteps.push("Use roadmap-agent to generate architecture/roadmap.md.");
4344
+ suggestedNextSteps.push("Use roadmap-agent to generate knowledge/delivery/roadmap.md.");
4118
4345
  }
4119
4346
  if (items.length === 0) {
4120
4347
  suggestedNextSteps.push("Create your first Work Item with `kaddo create`.");
@@ -4130,6 +4357,7 @@ function buildProjectExplanation(dir) {
4130
4357
  workItems,
4131
4358
  ownership,
4132
4359
  domains,
4360
+ layers: knowledgeLayers(dir),
4133
4361
  mappedModules,
4134
4362
  missingKnowledge,
4135
4363
  suggestedNextSteps
@@ -4148,6 +4376,9 @@ function renderExplanationHuman(exp) {
4148
4376
  lines.push(`- Team: ${exp.project.teamSize}`);
4149
4377
  lines.push(`- Structure: ${exp.project.structure}`);
4150
4378
  lines.push("");
4379
+ lines.push("## Knowledge Layers");
4380
+ lines.push(renderLayersMarkdown(exp.layers));
4381
+ lines.push("");
4151
4382
  if (exp.stack) {
4152
4383
  lines.push("## Detected Stack");
4153
4384
  if (exp.stack.language) lines.push(`- Language: ${exp.stack.language}`);
@@ -4225,7 +4456,7 @@ function renderExplanationAgent(exp) {
4225
4456
  }
4226
4457
 
4227
4458
  // src/commands/explain.ts
4228
- var ARCH_DIR4 = "architecture";
4459
+ var ARCH_DIR4 = "knowledge";
4229
4460
  var CONFIG_PATH3 = ".kaddo/config.yml";
4230
4461
  function readKnowledge(dir) {
4231
4462
  const knowledgePath = join(dir, ARCH_DIR4, "knowledge.md");
@@ -4390,7 +4621,7 @@ function runExplain(opts) {
4390
4621
  }
4391
4622
  const archDir = join(dir, ARCH_DIR4);
4392
4623
  if (!exists(archDir)) {
4393
- console.error("No architecture/ directory found. Run `kaddo init` first.");
4624
+ console.error("No knowledge/ directory found. Run `kaddo init` first.");
4394
4625
  process.exit(1);
4395
4626
  }
4396
4627
  let artifacts = readArtifacts(archDir);
@@ -4413,7 +4644,7 @@ function runExplain(opts) {
4413
4644
  // src/core/context-pack.ts
4414
4645
  import matter3 from "gray-matter";
4415
4646
  var CONTEXT_PACK_VERSION = "1";
4416
- var ARCH_DIR5 = "architecture";
4647
+ var ARCH_DIR5 = "knowledge";
4417
4648
  function readScanJson(dir) {
4418
4649
  const scanPath = join(dir, ".kaddo", "scan.json");
4419
4650
  if (!exists(scanPath)) return null;
@@ -4504,7 +4735,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
4504
4735
  if (!knowledgeSummary) {
4505
4736
  missing.push("No project knowledge summary found yet.");
4506
4737
  }
4507
- const roadmapSummary = readMarkdownSummary(dir, "roadmap.md") ?? "";
4738
+ const roadmapSummary = readMarkdownSummary(dir, "delivery/roadmap.md") ?? "";
4508
4739
  if (!roadmapSummary) {
4509
4740
  missing.push("No roadmap baseline found.");
4510
4741
  }
@@ -4518,6 +4749,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
4518
4749
  }
4519
4750
  const state = config.project.state;
4520
4751
  const mappedModules = loadMappedModules(dir);
4752
+ const layers = knowledgeLayers(dir);
4521
4753
  return {
4522
4754
  version: CONTEXT_PACK_VERSION,
4523
4755
  generatedAt: now.toISOString(),
@@ -4544,6 +4776,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
4544
4776
  workItems: workItems.map(toContextWorkItem),
4545
4777
  artifacts: workItems.filter((a) => a.codeGlobs.length > 0).map(toContextArtifact)
4546
4778
  },
4779
+ layers,
4547
4780
  mappedModules,
4548
4781
  missing,
4549
4782
  handoff: {
@@ -4577,6 +4810,11 @@ function renderContextPack(pack) {
4577
4810
  `- Structure: ${project.structure}`
4578
4811
  ].join("\n") + "\n"
4579
4812
  );
4813
+ parts.push("## Knowledge Layers\n");
4814
+ parts.push(
4815
+ "Project knowledge is organized in four layers: **Business \u2192 Product \u2192 Tech \u2192 Delivery**.\n"
4816
+ );
4817
+ parts.push(renderLayersMarkdown(pack.layers) + "\n");
4580
4818
  parts.push("## Technical Inventory\n");
4581
4819
  if (scan2.available) {
4582
4820
  const lines = [
@@ -4706,22 +4944,22 @@ function flowForState(state) {
4706
4944
  switch (state) {
4707
4945
  case "new":
4708
4946
  return [
4709
- { agent: "roadmap-agent.md", output: "architecture/roadmap.md" },
4710
- { agent: "architecture-agent.md", output: "architecture/current-state.md" }
4947
+ { agent: "roadmap-agent.md", output: "knowledge/delivery/roadmap.md" },
4948
+ { agent: "architecture-agent.md", output: "knowledge/tech/current-state.md" }
4711
4949
  ];
4712
4950
  case "legacy":
4713
4951
  return [
4714
- { agent: "legacy-agent.md", output: "architecture/legacy/risks.md" },
4715
- { agent: "architecture-agent.md", output: "architecture/current-state.md" },
4716
- { agent: "capability-agent.md", output: "architecture/capabilities.md" },
4717
- { agent: "roadmap-agent.md", output: "architecture/roadmap.md" }
4952
+ { agent: "legacy-agent.md", output: "knowledge/legacy/risks.md" },
4953
+ { agent: "architecture-agent.md", output: "knowledge/tech/current-state.md" },
4954
+ { agent: "capability-agent.md", output: "knowledge/product/capabilities.md" },
4955
+ { agent: "roadmap-agent.md", output: "knowledge/delivery/roadmap.md" }
4718
4956
  ];
4719
4957
  case "pre-ai":
4720
4958
  default:
4721
4959
  return [
4722
- { agent: "capability-agent.md", output: "architecture/capabilities.md" },
4723
- { agent: "architecture-agent.md", output: "architecture/current-state.md" },
4724
- { agent: "roadmap-agent.md", output: "architecture/roadmap.md" }
4960
+ { agent: "capability-agent.md", output: "knowledge/product/capabilities.md" },
4961
+ { agent: "architecture-agent.md", output: "knowledge/tech/current-state.md" },
4962
+ { agent: "roadmap-agent.md", output: "knowledge/delivery/roadmap.md" }
4725
4963
  ];
4726
4964
  }
4727
4965
  }
@@ -4729,11 +4967,11 @@ function buildUnderstandPlan(dir, config) {
4729
4967
  const state = config.project.state;
4730
4968
  const flow = flowForState(state);
4731
4969
  const steps = flow.map((s) => {
4732
- const installed = exists(join(dir, "architecture", "agents", s.agent));
4970
+ const installed = exists(join(dir, "knowledge", "agents", s.agent));
4733
4971
  return { agent: s.agent, output: s.output, installed };
4734
4972
  });
4735
4973
  const missingAgents = steps.filter((s) => !s.installed).map((s) => s.agent);
4736
- const agentsInstalled = exists(join(dir, "architecture", "agents")) && missingAgents.length === 0;
4974
+ const agentsInstalled = exists(join(dir, "knowledge", "agents")) && missingAgents.length === 0;
4737
4975
  return {
4738
4976
  project: {
4739
4977
  name: config.project.name,
@@ -4787,7 +5025,7 @@ function renderUnderstand(plan) {
4787
5025
  `);
4788
5026
  parts.push("## Agent Prompts\n");
4789
5027
  parts.push(
4790
- steps.map((s) => `- \`architecture/agents/${s.agent}\``).join("\n") + "\n"
5028
+ steps.map((s) => `- \`knowledge/agents/${s.agent}\``).join("\n") + "\n"
4791
5029
  );
4792
5030
  parts.push("## Expected Outputs\n");
4793
5031
  parts.push(steps.map((s) => `- \`${s.output}\``).join("\n") + "\n");
@@ -4800,7 +5038,7 @@ function renderUnderstand(plan) {
4800
5038
  "",
4801
5039
  "1. Open your preferred LLM chat (Claude, ChatGPT, Cursor, Copilot, Windsurf\u2026).",
4802
5040
  `2. Paste the context pack: \`${plan.contextPackPath}\``,
4803
- `3. Paste the agent prompt: \`architecture/agents/${first2.agent}\``,
5041
+ `3. Paste the agent prompt: \`knowledge/agents/${first2.agent}\``,
4804
5042
  `4. Ask the LLM to produce: \`${first2.output}\``,
4805
5043
  `5. Save the result in: \`${first2.output}\``
4806
5044
  ].join("\n") + "\n"
@@ -4839,7 +5077,7 @@ function renderUnderstandTerminal(plan) {
4839
5077
  lines.push(`First step: use ${agentName(first2.agent)}.`);
4840
5078
  lines.push("");
4841
5079
  lines.push(` Context: ${plan.contextPackPath}`);
4842
- lines.push(` Agent prompt: architecture/agents/${first2.agent}`);
5080
+ lines.push(` Agent prompt: knowledge/agents/${first2.agent}`);
4843
5081
  lines.push(` Expected output: ${first2.output}`);
4844
5082
  lines.push("");
4845
5083
  }
@@ -5040,7 +5278,7 @@ function classify(declaredType, declaredLevel, touchedFiles) {
5040
5278
  }
5041
5279
 
5042
5280
  // src/commands/classify.ts
5043
- var ARCH_DIR6 = "architecture";
5281
+ var ARCH_DIR6 = "knowledge";
5044
5282
  function findActiveWorkItem(dir) {
5045
5283
  const archDir = join(dir, ARCH_DIR6);
5046
5284
  if (!exists(archDir)) return null;
@@ -5108,7 +5346,7 @@ async function runClassify(opts = {}) {
5108
5346
 
5109
5347
  // src/commands/status.ts
5110
5348
  import { parse as parseYaml9 } from "yaml";
5111
- var ARCH_DIR7 = "architecture";
5349
+ var ARCH_DIR7 = "knowledge";
5112
5350
  var CONFIG_PATH4 = ".kaddo/config.yml";
5113
5351
  function loadConfig3(dir) {
5114
5352
  const p2 = join(dir, CONFIG_PATH4);
@@ -5122,7 +5360,7 @@ function loadConfig3(dir) {
5122
5360
  function runStatus() {
5123
5361
  const dir = cwd();
5124
5362
  if (!exists(join(dir, ARCH_DIR7))) {
5125
- console.error("No architecture/ directory found. Run `kaddo init` first.");
5363
+ console.error("No knowledge/ directory found. Run `kaddo init` first.");
5126
5364
  process.exit(1);
5127
5365
  }
5128
5366
  const config = loadConfig3(dir);
@@ -5172,8 +5410,8 @@ function runStatus() {
5172
5410
 
5173
5411
  // src/commands/learn.ts
5174
5412
  import matter4 from "gray-matter";
5175
- var ARCH_DIR8 = "architecture";
5176
- var WORK_ITEMS_DIR2 = "architecture/work-items";
5413
+ var ARCH_DIR8 = "knowledge";
5414
+ var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
5177
5415
  function findWorkItemFile(dir, id) {
5178
5416
  const wiDir = join(dir, WORK_ITEMS_DIR2);
5179
5417
  if (!exists(wiDir)) return null;
@@ -5214,7 +5452,7 @@ ${learning.trim()}
5214
5452
  async function runLearn(artifactId) {
5215
5453
  const dir = cwd();
5216
5454
  if (!exists(join(dir, ARCH_DIR8))) {
5217
- console.error("No architecture/ directory found. Run `kaddo init` first.");
5455
+ console.error("No knowledge/ directory found. Run `kaddo init` first.");
5218
5456
  process.exit(1);
5219
5457
  }
5220
5458
  intro2("kaddo learn");
@@ -5256,12 +5494,12 @@ async function runLearn(artifactId) {
5256
5494
  updateWorkItemFile(filePath, learning.trim());
5257
5495
  log2.success(`${targetId} marked as done`);
5258
5496
  log2.success(`Learning recorded in ${filePath.replace(dir + "/", "")}`);
5259
- log2.info("Consider updating architecture/knowledge.md if this changes the current state.");
5497
+ log2.info("Consider updating knowledge/knowledge.md if this changes the current state.");
5260
5498
  outro2("Work item closed.");
5261
5499
  }
5262
5500
 
5263
5501
  // src/commands/history.ts
5264
- var ARCH_DIR9 = "architecture";
5502
+ var ARCH_DIR9 = "knowledge";
5265
5503
  function formatRow(a) {
5266
5504
  const id = (a.id || "").padEnd(8);
5267
5505
  const type = a.type.padEnd(18);
@@ -5273,7 +5511,7 @@ function formatRow(a) {
5273
5511
  function runHistory(opts = {}) {
5274
5512
  const dir = cwd();
5275
5513
  if (!exists(join(dir, ARCH_DIR9))) {
5276
- console.error("No architecture/ directory found. Run `kaddo init` first.");
5514
+ console.error("No knowledge/ directory found. Run `kaddo init` first.");
5277
5515
  process.exit(1);
5278
5516
  }
5279
5517
  let artifacts = readArtifacts(join(dir, ARCH_DIR9)).filter(
@@ -5407,7 +5645,7 @@ function runAdd(moduleName, dir = cwd()) {
5407
5645
 
5408
5646
  // src/core/ownership-suggest.ts
5409
5647
  import matter5 from "gray-matter";
5410
- var WORK_ITEMS_DIR3 = "architecture/work-items";
5648
+ var WORK_ITEMS_DIR3 = "knowledge/delivery/work-items";
5411
5649
  var SCAN_PATH = ".kaddo/scan.json";
5412
5650
  function toStringArray3(value) {
5413
5651
  return Array.isArray(value) ? value.map((v) => String(v)).filter(Boolean) : [];
@@ -5648,7 +5886,7 @@ ${globs.map((g) => ` - ${g}`).join("\n")}`);
5648
5886
 
5649
5887
  // src/commands/module-descriptor.ts
5650
5888
  import { parse as parseYaml11, stringify as stringifyYaml4 } from "yaml";
5651
- var DESCRIPTOR_PATH2 = "architecture/module.yml";
5889
+ var DESCRIPTOR_PATH2 = "knowledge/module.yml";
5652
5890
  function readDescriptor(dir) {
5653
5891
  const path6 = join(dir, DESCRIPTOR_PATH2);
5654
5892
  if (!exists(path6)) return null;
@@ -5673,7 +5911,7 @@ async function runModuleDescriptor(opts) {
5673
5911
  return;
5674
5912
  }
5675
5913
  intro2("kaddo module --init");
5676
- log2.info("Creates architecture/module.yml \u2014 declares this repository's identity for multirepo contexts.");
5914
+ log2.info("Creates knowledge/module.yml \u2014 declares this repository's identity for multirepo contexts.");
5677
5915
  const name = await text2({
5678
5916
  message: "Module name (this repository)",
5679
5917
  placeholder: "e.g. payments-service",
@@ -5722,7 +5960,7 @@ async function runModuleDescriptor(opts) {
5722
5960
  };
5723
5961
  writeDescriptor(dir, descriptor);
5724
5962
  log2.success(`Created ${DESCRIPTOR_PATH2}`);
5725
- outro2(`Module descriptor ready. Share architecture/module.yml with dependent repositories.`);
5963
+ outro2(`Module descriptor ready. Share knowledge/module.yml with dependent repositories.`);
5726
5964
  }
5727
5965
  function printDescriptor(d) {
5728
5966
  console.log("");
@@ -5888,7 +6126,7 @@ ${QUALITY}
5888
6126
  - [ ] Capabilities describe outcomes, not implementation.
5889
6127
  - [ ] Each capability cites evidence or is flagged as an assumption.
5890
6128
  `;
5891
- var KNOWLEDGE = `---
6129
+ var KNOWLEDGE2 = `---
5892
6130
  type: current-state
5893
6131
  updated_at: YYYY-MM-DD
5894
6132
  ---
@@ -6414,13 +6652,363 @@ ${QUALITY}
6414
6652
  - [ ] Candidates state value and risk.
6415
6653
  - [ ] Marked as candidates, not decisions.
6416
6654
  `;
6655
+ var BUSINESS_PRODUCT_BRIEF = `---
6656
+ type: product-brief
6657
+ status: draft
6658
+ ---
6659
+
6660
+ # Product Brief
6661
+
6662
+ > Created by \`kaddo bootstrap\`. Refine with the business-agent. Mark unknowns as TBD.
6663
+
6664
+ ## What is this product?
6665
+
6666
+ TBD
6667
+
6668
+ ## Problem it solves
6669
+
6670
+ TBD
6671
+
6672
+ ## Target users
6673
+
6674
+ TBD
6675
+
6676
+ ## Value proposition
6677
+
6678
+ TBD
6679
+
6680
+ ## Out of scope (for the MVP)
6681
+
6682
+ - TBD
6683
+
6684
+ ## Assumptions
6685
+
6686
+ - ...
6687
+
6688
+ ## Open questions
6689
+
6690
+ - ...
6691
+
6692
+ ${QUALITY}
6693
+
6694
+ - [ ] The product can be described in one paragraph.
6695
+ - [ ] The MVP boundary is explicit.
6696
+ `;
6697
+ var BUSINESS_PROBLEM = `---
6698
+ type: problem
6699
+ status: draft
6700
+ ---
6701
+
6702
+ # Problem Statement
6703
+
6704
+ > Refine with the business-agent. Do not invent facts.
6705
+
6706
+ ## Problem
6707
+
6708
+ TBD
6709
+
6710
+ ## Who has it
6711
+
6712
+ TBD
6713
+
6714
+ ## Why it matters now
6715
+
6716
+ TBD
6717
+
6718
+ ## Current alternatives
6719
+
6720
+ - TBD
6721
+
6722
+ ## Assumptions
6723
+
6724
+ - ...
6725
+
6726
+ ## Open questions
6727
+
6728
+ - ...
6729
+
6730
+ ${QUALITY}
6731
+
6732
+ - [ ] The problem is stated without assuming the solution.
6733
+ - [ ] The affected users are named.
6734
+ `;
6735
+ var BUSINESS_USERS = `---
6736
+ type: users
6737
+ status: draft
6738
+ ---
6739
+
6740
+ # Users & Personas
6741
+
6742
+ > Refine with the business-agent.
6743
+
6744
+ ## Primary users
6745
+
6746
+ - TBD
6747
+
6748
+ ## Secondary users
6749
+
6750
+ - TBD
6751
+
6752
+ ## Needs & goals
6753
+
6754
+ - TBD
6755
+
6756
+ ## Assumptions
6757
+
6758
+ - ...
6759
+
6760
+ ## Open questions
6761
+
6762
+ - ...
6763
+
6764
+ ${QUALITY}
6765
+
6766
+ - [ ] Each persona has a goal, not just a label.
6767
+ - [ ] Primary vs secondary users are distinguished.
6768
+ `;
6769
+ var BUSINESS_VALUE_PROPOSITION = `---
6770
+ type: value-proposition
6771
+ status: draft
6772
+ ---
6773
+
6774
+ # Value Proposition
6775
+
6776
+ > Refine with the business-agent.
6777
+
6778
+ ## For whom
6779
+
6780
+ TBD
6781
+
6782
+ ## What we offer
6783
+
6784
+ TBD
6785
+
6786
+ ## Why it is better / different
6787
+
6788
+ TBD
6789
+
6790
+ ## Assumptions
6791
+
6792
+ - ...
6793
+
6794
+ ## Open questions
6795
+
6796
+ - ...
6797
+
6798
+ ${QUALITY}
6799
+
6800
+ - [ ] The value is specific, not generic.
6801
+ - [ ] It maps to a real user need.
6802
+ `;
6803
+ var BUSINESS_RULES = `---
6804
+ type: business-rules
6805
+ status: draft
6806
+ ---
6807
+
6808
+ # Business Rules
6809
+
6810
+ > Refine with the business-agent. These are product rules, not implementation details.
6811
+
6812
+ ## Core rules
6813
+
6814
+ - TBD
6815
+
6816
+ ## Edge cases
6817
+
6818
+ - TBD
6819
+
6820
+ ## Assumptions
6821
+
6822
+ - ...
6823
+
6824
+ ## Open questions
6825
+
6826
+ - ...
6827
+
6828
+ ${QUALITY}
6829
+
6830
+ - [ ] Rules are testable statements.
6831
+ - [ ] No implementation detail leaks in.
6832
+ `;
6833
+ var BUSINESS_CONSTRAINTS = `---
6834
+ type: constraints
6835
+ status: draft
6836
+ ---
6837
+
6838
+ # Constraints
6839
+
6840
+ > Refine with the business-agent.
6841
+
6842
+ ## Business constraints
6843
+
6844
+ - TBD
6845
+
6846
+ ## Regulatory / compliance
6847
+
6848
+ - TBD
6849
+
6850
+ ## Time / budget / team
6851
+
6852
+ - TBD
6853
+
6854
+ ## Assumptions
6855
+
6856
+ - ...
6857
+
6858
+ ## Open questions
6859
+
6860
+ - ...
6861
+
6862
+ ${QUALITY}
6863
+
6864
+ - [ ] Constraints are real, not aspirational.
6865
+ - [ ] Hard limits are separated from preferences.
6866
+ `;
6867
+ var BUSINESS_GLOSSARY = `---
6868
+ type: glossary
6869
+ status: draft
6870
+ ---
6871
+
6872
+ # Glossary
6873
+
6874
+ > Refine with the business-agent. One shared vocabulary avoids ambiguity.
6875
+
6876
+ | Term | Definition |
6877
+ |---|---|
6878
+ | TBD | TBD |
6879
+
6880
+ ## Open questions
6881
+
6882
+ - ...
6883
+
6884
+ ${QUALITY}
6885
+
6886
+ - [ ] Each term has a single agreed definition.
6887
+ - [ ] Ambiguous terms are flagged.
6888
+ `;
6889
+ var QUALITY_ATTRIBUTES = `---
6890
+ type: quality-attributes
6891
+ status: draft
6892
+ ---
6893
+
6894
+ # Quality Attributes
6895
+
6896
+ > Created by \`kaddo bootstrap\`. Refine with the bootstrap-agent. Prioritize honestly.
6897
+
6898
+ ## What matters most
6899
+
6900
+ - TBD (e.g. reliability, performance, security, maintainability, cost)
6901
+
6902
+ ## Trade-offs accepted
6903
+
6904
+ - TBD
6905
+
6906
+ ## Measurable targets (if known)
6907
+
6908
+ - TBD
6909
+
6910
+ ## Assumptions
6911
+
6912
+ - ...
6913
+
6914
+ ## Open questions
6915
+
6916
+ - ...
6917
+
6918
+ ${QUALITY}
6919
+
6920
+ - [ ] Attributes are prioritized, not all "high".
6921
+ - [ ] Trade-offs are explicit.
6922
+ `;
6923
+ var CODEBASE_FOUNDATION = `---
6924
+ type: codebase-foundation
6925
+ status: draft
6926
+ ---
6927
+
6928
+ # Codebase Foundation
6929
+
6930
+ > Created by \`kaddo bootstrap\`. Refine with the codebase-agent.
6931
+ > This describes the intended base \u2014 it does **not** generate code.
6932
+
6933
+ ## Suggested structure
6934
+
6935
+ TBD
6936
+
6937
+ ## Initial modules / boundaries
6938
+
6939
+ - TBD
6940
+
6941
+ ## Conventions
6942
+
6943
+ - TBD
6944
+
6945
+ ## Git strategy
6946
+
6947
+ See \`knowledge/tech/git-strategy.md\`.
6948
+
6949
+ ## Minimum criteria to start development
6950
+
6951
+ - [ ] TBD
6952
+
6953
+ ## Assumptions
6954
+
6955
+ - ...
6956
+
6957
+ ## Open questions
6958
+
6959
+ - ...
6960
+
6961
+ ${QUALITY}
6962
+
6963
+ - [ ] Structure follows the business and architecture, not a framework default.
6964
+ - [ ] No production code is described here \u2014 only the foundation.
6965
+ `;
6966
+ var BOOTSTRAP_SUMMARY = `---
6967
+ type: bootstrap-summary
6968
+ status: draft
6969
+ ---
6970
+
6971
+ # Bootstrap Summary
6972
+
6973
+ > Created by \`kaddo bootstrap\`. Index of the initial knowledge base and next steps.
6974
+
6975
+ ## Layers
6976
+
6977
+ - **Business** \u2014 \`knowledge/business/\`
6978
+ - **Architecture** \u2014 capabilities, quality-attributes, stack, current-state, decisions
6979
+ - **Codebase** \u2014 codebase-foundation, standards, git-strategy
6980
+ - **Development** \u2014 roadmap, work-items
6981
+
6982
+ ## Status
6983
+
6984
+ - [ ] Business defined
6985
+ - [ ] Initial architecture proposed
6986
+ - [ ] Codebase foundation drafted
6987
+ - [ ] Roadmap and first Work Items prepared
6988
+
6989
+ ## Next steps
6990
+
6991
+ 1. Run \`kaddo context\` and \`kaddo add agents\`.
6992
+ 2. Refine the artifacts with the business-agent, bootstrap-agent and
6993
+ codebase-agent in your LLM.
6994
+ 3. Run \`kaddo create --from roadmap\` to create the first Work Items.
6995
+
6996
+ ## Open questions
6997
+
6998
+ - ...
6999
+
7000
+ ${QUALITY}
7001
+
7002
+ - [ ] Every generated artifact is listed.
7003
+ - [ ] The next step is clear.
7004
+ `;
6417
7005
  var KADDO_TEMPLATES = [
6418
7006
  // core
6419
7007
  {
6420
7008
  id: "work-item",
6421
7009
  name: "Work Item",
6422
- category: "core",
6423
- outputPath: "architecture/work-items/",
7010
+ category: "delivery",
7011
+ outputPath: "knowledge/delivery/work-items/",
6424
7012
  description: "Smallest traceable unit of product evolution.",
6425
7013
  whenToUse: "When you start any change (feature, bugfix, hotfix, spike).",
6426
7014
  relatedCommand: "kaddo create",
@@ -6430,8 +7018,8 @@ var KADDO_TEMPLATES = [
6430
7018
  {
6431
7019
  id: "roadmap",
6432
7020
  name: "Roadmap",
6433
- category: "core",
6434
- outputPath: "architecture/roadmap.md",
7021
+ category: "delivery",
7022
+ outputPath: "knowledge/delivery/roadmap.md",
6435
7023
  description: "Initiatives and candidate work items for human review.",
6436
7024
  whenToUse: "When planning what to build next and why.",
6437
7025
  relatedCommand: "kaddo create --from roadmap",
@@ -6441,8 +7029,8 @@ var KADDO_TEMPLATES = [
6441
7029
  {
6442
7030
  id: "capabilities",
6443
7031
  name: "Capabilities",
6444
- category: "core",
6445
- outputPath: "architecture/capabilities.md",
7032
+ category: "product",
7033
+ outputPath: "knowledge/product/capabilities.md",
6446
7034
  description: "What the system can do from the product point of view.",
6447
7035
  whenToUse: "When mapping product capabilities to the system.",
6448
7036
  relatedAgent: "capability-agent",
@@ -6451,19 +7039,97 @@ var KADDO_TEMPLATES = [
6451
7039
  {
6452
7040
  id: "knowledge",
6453
7041
  name: "Knowledge (Current State)",
6454
- category: "core",
6455
- outputPath: "architecture/knowledge.md",
7042
+ category: "tech",
7043
+ outputPath: "knowledge/knowledge.md",
6456
7044
  description: "What is true about the product right now.",
6457
7045
  whenToUse: "Created by `kaddo init`; keep it current as the product evolves.",
6458
7046
  relatedCommand: "kaddo init",
6459
- content: KNOWLEDGE
7047
+ content: KNOWLEDGE2
7048
+ },
7049
+ // business (bootstrap)
7050
+ {
7051
+ id: "business-product-brief",
7052
+ name: "Product Brief",
7053
+ category: "product",
7054
+ outputPath: "knowledge/product/product-brief.md",
7055
+ description: "The product in one page: problem, users, value, MVP boundary.",
7056
+ whenToUse: "At the start of a new project (kaddo bootstrap).",
7057
+ relatedCommand: "kaddo bootstrap",
7058
+ relatedAgent: "business-agent",
7059
+ content: BUSINESS_PRODUCT_BRIEF
7060
+ },
7061
+ {
7062
+ id: "business-problem",
7063
+ name: "Problem Statement",
7064
+ category: "business",
7065
+ outputPath: "knowledge/business/problem.md",
7066
+ description: "The problem the product solves, without assuming the solution.",
7067
+ whenToUse: "When defining a new project (kaddo bootstrap).",
7068
+ relatedCommand: "kaddo bootstrap",
7069
+ relatedAgent: "business-agent",
7070
+ content: BUSINESS_PROBLEM
7071
+ },
7072
+ {
7073
+ id: "business-users",
7074
+ name: "Users & Personas",
7075
+ category: "business",
7076
+ outputPath: "knowledge/business/users.md",
7077
+ description: "Primary and secondary users with goals.",
7078
+ whenToUse: "When defining a new project (kaddo bootstrap).",
7079
+ relatedCommand: "kaddo bootstrap",
7080
+ relatedAgent: "business-agent",
7081
+ content: BUSINESS_USERS
7082
+ },
7083
+ {
7084
+ id: "business-value-proposition",
7085
+ name: "Value Proposition",
7086
+ category: "business",
7087
+ outputPath: "knowledge/business/value-proposition.md",
7088
+ description: "For whom, what we offer and why it is better.",
7089
+ whenToUse: "When defining a new project (kaddo bootstrap).",
7090
+ relatedCommand: "kaddo bootstrap",
7091
+ relatedAgent: "business-agent",
7092
+ content: BUSINESS_VALUE_PROPOSITION
7093
+ },
7094
+ {
7095
+ id: "business-rules",
7096
+ name: "Business Rules",
7097
+ category: "business",
7098
+ outputPath: "knowledge/business/business-rules.md",
7099
+ description: "Product rules as testable statements.",
7100
+ whenToUse: "When defining a new project (kaddo bootstrap).",
7101
+ relatedCommand: "kaddo bootstrap",
7102
+ relatedAgent: "business-agent",
7103
+ content: BUSINESS_RULES
7104
+ },
7105
+ {
7106
+ id: "business-constraints",
7107
+ name: "Business Constraints",
7108
+ category: "business",
7109
+ outputPath: "knowledge/business/constraints.md",
7110
+ description: "Business, regulatory and resource constraints.",
7111
+ whenToUse: "When defining a new project (kaddo bootstrap).",
7112
+ relatedCommand: "kaddo bootstrap",
7113
+ relatedAgent: "business-agent",
7114
+ content: BUSINESS_CONSTRAINTS
7115
+ },
7116
+ {
7117
+ id: "business-glossary",
7118
+ name: "Glossary",
7119
+ category: "business",
7120
+ outputPath: "knowledge/business/glossary.md",
7121
+ description: "Shared vocabulary for the project.",
7122
+ whenToUse: "When defining a new project (kaddo bootstrap).",
7123
+ relatedCommand: "kaddo bootstrap",
7124
+ relatedAgent: "business-agent",
7125
+ content: BUSINESS_GLOSSARY
6460
7126
  },
6461
7127
  // architecture
6462
7128
  {
6463
7129
  id: "current-state",
6464
7130
  name: "Current State",
6465
- category: "architecture",
6466
- outputPath: "architecture/current-state.md",
7131
+ category: "tech",
7132
+ outputPath: "knowledge/tech/current-state.md",
6467
7133
  description: "Reconstructed architecture baseline.",
6468
7134
  whenToUse: "When establishing the architecture baseline of an existing system.",
6469
7135
  relatedAgent: "architecture-agent",
@@ -6472,8 +7138,8 @@ var KADDO_TEMPLATES = [
6472
7138
  {
6473
7139
  id: "architecture-notes",
6474
7140
  name: "Architecture Notes",
6475
- category: "architecture",
6476
- outputPath: "architecture/architecture-notes.md",
7141
+ category: "tech",
7142
+ outputPath: "knowledge/tech/architecture-notes.md",
6477
7143
  description: "Working notes on architecture topics not yet decided.",
6478
7144
  whenToUse: "When exploring an architecture topic before it becomes an ADR.",
6479
7145
  content: ARCHITECTURE_NOTES
@@ -6481,18 +7147,51 @@ var KADDO_TEMPLATES = [
6481
7147
  {
6482
7148
  id: "decision-candidates",
6483
7149
  name: "Decision Candidates",
6484
- category: "architecture",
6485
- outputPath: "architecture/decision-candidates.md",
7150
+ category: "tech",
7151
+ outputPath: "knowledge/tech/decision-candidates.md",
6486
7152
  description: "Candidate architecture decisions for human review.",
6487
7153
  whenToUse: "When surfacing decisions that may become ADRs.",
6488
7154
  relatedAgent: "adr-agent",
6489
7155
  content: DECISION_CANDIDATES
6490
7156
  },
7157
+ {
7158
+ id: "quality-attributes",
7159
+ name: "Quality Attributes",
7160
+ category: "tech",
7161
+ outputPath: "knowledge/tech/quality-attributes.md",
7162
+ description: "Prioritized quality attributes and accepted trade-offs.",
7163
+ whenToUse: "During bootstrap, to record what matters most technically.",
7164
+ relatedCommand: "kaddo bootstrap",
7165
+ relatedAgent: "bootstrap-agent",
7166
+ content: QUALITY_ATTRIBUTES
7167
+ },
7168
+ {
7169
+ id: "codebase",
7170
+ name: "Codebase Foundation",
7171
+ category: "tech",
7172
+ outputPath: "knowledge/tech/codebase.md",
7173
+ description: "Intended codebase structure and conventions (no source code).",
7174
+ whenToUse: "During bootstrap, before writing code.",
7175
+ relatedCommand: "kaddo bootstrap",
7176
+ relatedAgent: "codebase-agent",
7177
+ content: CODEBASE_FOUNDATION
7178
+ },
7179
+ {
7180
+ id: "bootstrap-summary",
7181
+ name: "Bootstrap Summary",
7182
+ category: "tech",
7183
+ outputPath: "knowledge/bootstrap-summary.md",
7184
+ description: "Index of the initial knowledge base and next steps.",
7185
+ whenToUse: "Generated by kaddo bootstrap.",
7186
+ relatedCommand: "kaddo bootstrap",
7187
+ relatedAgent: "bootstrap-agent",
7188
+ content: BOOTSTRAP_SUMMARY
7189
+ },
6491
7190
  {
6492
7191
  id: "adr",
6493
7192
  name: "ADR",
6494
- category: "architecture",
6495
- outputPath: "architecture/decisions/",
7193
+ category: "tech",
7194
+ outputPath: "knowledge/tech/decisions/",
6496
7195
  description: "A single architecture decision record.",
6497
7196
  whenToUse: "When recording a significant, accepted architecture decision.",
6498
7197
  relatedCommand: "kaddo create adr",
@@ -6503,7 +7202,7 @@ var KADDO_TEMPLATES = [
6503
7202
  id: "module-design",
6504
7203
  name: "Module Design",
6505
7204
  category: "module",
6506
- outputPath: "architecture/modules/<id>/module-design.md",
7205
+ outputPath: "knowledge/tech/modules/<id>/module-design.md",
6507
7206
  description: "A module's purpose, boundaries and dependencies.",
6508
7207
  whenToUse: "After mapping a secondary repo as a module.",
6509
7208
  relatedCommand: "kaddo modules map",
@@ -6514,7 +7213,7 @@ var KADDO_TEMPLATES = [
6514
7213
  id: "module-stack",
6515
7214
  name: "Module Stack",
6516
7215
  category: "module",
6517
- outputPath: "architecture/modules/<id>/stack.md",
7216
+ outputPath: "knowledge/tech/modules/<id>/stack.md",
6518
7217
  description: "A module's technology stack.",
6519
7218
  whenToUse: "To document the stack of a specific module.",
6520
7219
  relatedAgent: "stack-agent",
@@ -6524,7 +7223,7 @@ var KADDO_TEMPLATES = [
6524
7223
  id: "module-security",
6525
7224
  name: "Module Security",
6526
7225
  category: "module",
6527
- outputPath: "architecture/modules/<id>/security.md",
7226
+ outputPath: "knowledge/tech/modules/<id>/security.md",
6528
7227
  description: "A module's security considerations.",
6529
7228
  whenToUse: "To document security concerns specific to a module.",
6530
7229
  relatedAgent: "security-agent",
@@ -6534,7 +7233,7 @@ var KADDO_TEMPLATES = [
6534
7233
  id: "module-standards",
6535
7234
  name: "Module Standards",
6536
7235
  category: "module",
6537
- outputPath: "architecture/modules/<id>/standards.md",
7236
+ outputPath: "knowledge/tech/modules/<id>/standards.md",
6538
7237
  description: "A module's coding and testing standards.",
6539
7238
  whenToUse: "When a module needs standards beyond the system defaults.",
6540
7239
  relatedAgent: "standards-agent",
@@ -6544,7 +7243,7 @@ var KADDO_TEMPLATES = [
6544
7243
  id: "module-adr",
6545
7244
  name: "Module ADR",
6546
7245
  category: "module",
6547
- outputPath: "architecture/modules/<id>/adrs/",
7246
+ outputPath: "knowledge/tech/modules/<id>/adrs/",
6548
7247
  description: "A module-scoped architecture decision record.",
6549
7248
  whenToUse: "When a decision affects only one module.",
6550
7249
  content: MODULE_ADR
@@ -6554,7 +7253,7 @@ var KADDO_TEMPLATES = [
6554
7253
  id: "security",
6555
7254
  name: "Security",
6556
7255
  category: "operations",
6557
- outputPath: "architecture/security.md",
7256
+ outputPath: "knowledge/tech/security.md",
6558
7257
  description: "Global security considerations (no scanning).",
6559
7258
  whenToUse: "To document system-wide security concerns.",
6560
7259
  relatedCommand: "kaddo add security",
@@ -6565,7 +7264,7 @@ var KADDO_TEMPLATES = [
6565
7264
  id: "standards",
6566
7265
  name: "Standards",
6567
7266
  category: "operations",
6568
- outputPath: "architecture/standards.md",
7267
+ outputPath: "knowledge/tech/standards.md",
6569
7268
  description: "Global lightweight coding/docs/testing standards.",
6570
7269
  whenToUse: "To document system-wide standards.",
6571
7270
  relatedCommand: "kaddo add standards",
@@ -6576,7 +7275,7 @@ var KADDO_TEMPLATES = [
6576
7275
  id: "stack",
6577
7276
  name: "Stack",
6578
7277
  category: "operations",
6579
- outputPath: "architecture/stack.md",
7278
+ outputPath: "knowledge/tech/stack.md",
6580
7279
  description: "Global technology stack documentation.",
6581
7280
  whenToUse: "To document the system-wide stack.",
6582
7281
  relatedCommand: "kaddo add stack",
@@ -6587,7 +7286,7 @@ var KADDO_TEMPLATES = [
6587
7286
  id: "git-strategy",
6588
7287
  name: "Git Strategy",
6589
7288
  category: "operations",
6590
- outputPath: "architecture/git-strategy.md",
7289
+ outputPath: "knowledge/tech/git-strategy.md",
6591
7290
  description: "Recommended, customizable Git workflow.",
6592
7291
  whenToUse: "To agree on branching, commits and tagging.",
6593
7292
  relatedCommand: "kaddo add git-strategy",
@@ -6598,7 +7297,7 @@ var KADDO_TEMPLATES = [
6598
7297
  id: "incident",
6599
7298
  name: "Incident",
6600
7299
  category: "operations",
6601
- outputPath: "architecture/incidents/",
7300
+ outputPath: "knowledge/incidents/",
6602
7301
  description: "A post-incident record.",
6603
7302
  whenToUse: "After a production incident.",
6604
7303
  relatedCommand: "kaddo create incident",
@@ -6608,7 +7307,7 @@ var KADDO_TEMPLATES = [
6608
7307
  id: "runbook",
6609
7308
  name: "Runbook",
6610
7309
  category: "operations",
6611
- outputPath: "architecture/runbooks/",
7310
+ outputPath: "knowledge/runbooks/",
6612
7311
  description: "How to perform a recurring operational task safely.",
6613
7312
  whenToUse: "For repeatable operational procedures.",
6614
7313
  content: RUNBOOK
@@ -6618,7 +7317,7 @@ var KADDO_TEMPLATES = [
6618
7317
  id: "legacy-risks",
6619
7318
  name: "Legacy Risks",
6620
7319
  category: "legacy",
6621
- outputPath: "architecture/legacy/risks.md",
7320
+ outputPath: "knowledge/legacy/risks.md",
6622
7321
  description: "High-risk areas before changing legacy code.",
6623
7322
  whenToUse: "Before modifying legacy code.",
6624
7323
  relatedAgent: "legacy-agent",
@@ -6628,7 +7327,7 @@ var KADDO_TEMPLATES = [
6628
7327
  id: "legacy-unknowns",
6629
7328
  name: "Legacy Unknowns",
6630
7329
  category: "legacy",
6631
- outputPath: "architecture/legacy/unknowns.md",
7330
+ outputPath: "knowledge/legacy/unknowns.md",
6632
7331
  description: "What is not yet understood about the legacy system.",
6633
7332
  whenToUse: "When surfacing gaps in legacy knowledge.",
6634
7333
  relatedAgent: "legacy-agent",
@@ -6638,7 +7337,7 @@ var KADDO_TEMPLATES = [
6638
7337
  id: "modernization-candidates",
6639
7338
  name: "Modernization Candidates",
6640
7339
  category: "legacy",
6641
- outputPath: "architecture/legacy/modernization-candidates.md",
7340
+ outputPath: "knowledge/legacy/modernization-candidates.md",
6642
7341
  description: "Candidate modernization efforts for human review.",
6643
7342
  whenToUse: "When planning legacy modernization.",
6644
7343
  content: MODERNIZATION_CANDIDATES
@@ -6678,7 +7377,7 @@ function writeModulesDescriptor(dir, descriptor) {
6678
7377
  writeFile(join(dir, DESCRIPTOR_PATH3), stringifyYaml5(descriptor));
6679
7378
  }
6680
7379
  function moduleDir(id) {
6681
- return `architecture/modules/${id}`;
7380
+ return `knowledge/tech/modules/${id}`;
6682
7381
  }
6683
7382
  function buildModule(input) {
6684
7383
  const id = slugify2(input.name);
@@ -6872,15 +7571,97 @@ function runModulesList(dir = cwd()) {
6872
7571
  console.log("");
6873
7572
  }
6874
7573
 
7574
+ // src/commands/bootstrap.ts
7575
+ var CONFIG_PATH8 = ".kaddo/config.yml";
7576
+ var TARGETS = [
7577
+ // Business — why it exists
7578
+ { layer: "Business", path: "knowledge/business/problem.md", templateId: "business-problem" },
7579
+ { layer: "Business", path: "knowledge/business/users.md", templateId: "business-users" },
7580
+ { layer: "Business", path: "knowledge/business/value-proposition.md", templateId: "business-value-proposition" },
7581
+ { layer: "Business", path: "knowledge/business/constraints.md", templateId: "business-constraints" },
7582
+ { layer: "Business", path: "knowledge/business/business-rules.md", templateId: "business-rules" },
7583
+ // Product — what we build
7584
+ { layer: "Product", path: "knowledge/product/product-brief.md", templateId: "business-product-brief" },
7585
+ { layer: "Product", path: "knowledge/product/capabilities.md", templateId: "capabilities" },
7586
+ // Tech — how we build it
7587
+ { layer: "Tech", path: "knowledge/tech/codebase.md", templateId: "codebase" }
7588
+ ];
7589
+ var BOOTSTRAP_LAYERS = ["Business", "Product", "Tech"];
7590
+ function bootstrap(dir) {
7591
+ const written = [];
7592
+ const skipped = [];
7593
+ for (const target of TARGETS) {
7594
+ const full = join(dir, target.path);
7595
+ if (exists(full)) {
7596
+ skipped.push(target.path);
7597
+ continue;
7598
+ }
7599
+ const tpl = getTemplate(target.templateId);
7600
+ const content = tpl ? tpl.content : "";
7601
+ writeFile(full, content.endsWith("\n") ? content : `${content}
7602
+ `);
7603
+ written.push(target.path);
7604
+ }
7605
+ return { written, skipped, layers: BOOTSTRAP_LAYERS };
7606
+ }
7607
+ async function runBootstrap(dir = cwd()) {
7608
+ intro2("kaddo bootstrap");
7609
+ if (!exists(join(dir, CONFIG_PATH8))) {
7610
+ console.error("Kaddo is not initialized in this project.");
7611
+ console.error("Run `kaddo init` first.");
7612
+ process.exit(1);
7613
+ }
7614
+ let state = "unknown";
7615
+ try {
7616
+ const config = loadConfig(dir);
7617
+ state = config?.project.state ?? "unknown";
7618
+ } catch (err) {
7619
+ const message = err instanceof ConfigError ? err.message : String(err);
7620
+ console.error(message);
7621
+ process.exit(1);
7622
+ }
7623
+ log2.info(`Project state: ${state}`);
7624
+ log2.info("Base layers: Business \u2192 Product \u2192 Tech \u2192 Delivery");
7625
+ if (state !== "new") {
7626
+ log2.warn("This project is not marked as new. Bootstrap is designed for new projects.");
7627
+ const ok = await confirm2({ message: "Continue anyway?", initialValue: false });
7628
+ if (!ok) {
7629
+ outro2("Bootstrap cancelled.");
7630
+ return;
7631
+ }
7632
+ }
7633
+ const result = bootstrap(dir);
7634
+ console.log("");
7635
+ console.log("Bootstrap layers:");
7636
+ for (const layer of result.layers) console.log(` \u2713 ${layer}`);
7637
+ console.log("");
7638
+ if (result.written.length > 0) {
7639
+ console.log("Created:");
7640
+ for (const p2 of result.written) console.log(` - ${p2}`);
7641
+ }
7642
+ if (result.skipped.length > 0) {
7643
+ console.log("");
7644
+ console.log("Kept existing (skipped):");
7645
+ for (const p2 of result.skipped) console.log(` - ${p2}`);
7646
+ }
7647
+ console.log("");
7648
+ outro2(
7649
+ "Minimal knowledge base ready (Business \u2192 Product \u2192 Tech). Run `kaddo context` and `kaddo add agents`, then refine with the business-agent, bootstrap-agent and codebase-agent. Roadmap and work items come next under knowledge/delivery/."
7650
+ );
7651
+ }
7652
+
6875
7653
  // src/index.ts
6876
7654
  var program = new Command();
6877
- program.name("kaddo").description("Knowledge Driven Development toolkit").version("2.7.0");
7655
+ program.name("kaddo").description("Knowledge Driven Development toolkit").version("3.0.0");
6878
7656
  program.command("init").description("Initialize Kaddo in the current project").action(async () => {
6879
7657
  await runInit();
6880
7658
  });
6881
7659
  program.command("scan").description("Detect project stack and suggest domains").action(async () => {
6882
7660
  await runScan();
6883
7661
  });
7662
+ program.command("bootstrap").description("Build the initial knowledge base for a new project (Business \u2192 Product \u2192 Tech \u2192 Delivery)").action(async () => {
7663
+ await runBootstrap();
7664
+ });
6884
7665
  program.command("create [type]").description("Create a work item (feature, bugfix, hotfix, spike). Use --from roadmap to create from a roadmap candidate.").option("--from <source>", "Create from a source artifact (currently: roadmap)").action(async (type, opts) => {
6885
7666
  await runCreate(type ?? "", opts);
6886
7667
  });
@@ -6925,7 +7706,7 @@ program.command("owners [action]").description("List domain owners, or run `owne
6925
7706
  runOwners(opts);
6926
7707
  }
6927
7708
  });
6928
- program.command("module").description("Show or initialize the multirepo module descriptor (architecture/module.yml)").option("--init", "Create the module descriptor interactively").option("--show", "Print the current module descriptor").action(async (opts) => {
7709
+ program.command("module").description("Show or initialize the multirepo module descriptor (knowledge/module.yml)").option("--init", "Create the module descriptor interactively").option("--show", "Print the current module descriptor").action(async (opts) => {
6929
7710
  await runModuleDescriptor(opts);
6930
7711
  });
6931
7712
  var modulesCmd = program.command("modules").description("Map and list secondary repositories as modules of the system (multirepo)");