@cubis/foundry 0.3.80 → 0.3.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubis/foundry",
3
- "version": "0.3.80",
3
+ "version": "0.3.81",
4
4
  "description": "Cubis Foundry CLI for workflow-first AI agent environments",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/core.ts CHANGED
@@ -13199,19 +13199,24 @@ function buildArchitecturePrompt({
13199
13199
  `4. Then read ${productPath}, ${architecturePath}, and ${techPath} in that order when they exist so you can preserve useful manual context and update existing managed sections cleanly.`,
13200
13200
  `5. Replace or update only the content between the existing managed markers in ${productPath}, ${architecturePath}, and ${techPath}. Do not append a second marker block.`,
13201
13201
  `6. In ${productPath}, write a concrete product foundation: product purpose, primary users/operators, main journeys, business capabilities, operational constraints, and what future contributors must preserve.`,
13202
- `7. In ${architecturePath}, write a lean but detailed architecture backbone in a pragmatic arc42/C4 style: system purpose and constraints, bounded contexts, major building blocks, dependency rules, data and integration boundaries, runtime flows, deployment/operability notes, testing/debugging strategy, and only the diagram levels that add real value.`,
13203
- `8. In ${techPath}, write the developer-facing technical map: stack, repo layout, key commands, entrypoints, data stores, external services, environment/config surfaces, MCP/tooling footprint, and change hotspots future agents should inspect before editing code.`,
13204
- "9. Every major claim should be grounded in repository evidence. Mention concrete repo paths in the docs when a structural claim would otherwise be ambiguous.",
13205
- "10. Avoid placeholder filler, generic checklists, and duplicated content across files. Each doc should have a clear job.",
13206
- "11. Do not create ROADMAP.md, ENGINEERING_RULES.md, or other extra docs unless the prompt explicitly asks for them.",
13202
+ `7. In ${architecturePath}, write a lean but detailed architecture backbone in a pragmatic arc42/C4 style: system purpose and constraints, explicit architecture classification, bounded contexts, major building blocks, dependency rules, data and integration boundaries, runtime flows, deployment/operability notes, testing/debugging strategy, and only the diagram levels that add real value.`,
13203
+ `8. ${architecturePath} must include a dedicated folder-structure guide that lists the important apps/packages/directories, what each owns, and how contributors should treat those boundaries when editing code.`,
13204
+ `9. In ${techPath}, write the developer-facing technical map: stack, repo layout, key commands, entrypoints, data stores, external services, environment/config surfaces, MCP/tooling footprint, and change hotspots future agents should inspect before editing code.`,
13205
+ `10. ${techPath} should complement ${architecturePath}; do not repeat the same structure prose unless it helps a developer act faster.`,
13206
+ `11. Use exact required headings in ${productPath}: \`## Product Scope\`, \`## Product Purpose\`, \`## Primary Users And Operators\`, \`## Main Journeys\`, \`## Business Capabilities That Matter\`, \`## Operational Constraints\`, \`## Preservation Rules For Future Contributors\`.`,
13207
+ `12. Use exact required headings in ${architecturePath}: \`## Architecture Type\`, \`## System Purpose\`, \`## Constraints And Architectural Drivers\`, \`## Repository Structure Guide\`, \`## Bounded Contexts\`, \`## Major Building Blocks\`, \`## Dependency Rules\`, \`## Data Boundaries\`, \`## Integration Boundaries\`, \`## Runtime Flows\`, \`## Deployment And Operability\`, \`## Testing And Debugging Strategy\`, \`## Architectural Guidance\`.`,
13208
+ `13. Use exact required headings in ${techPath}: \`## Stack Snapshot\`, \`## Repository Layout\`, \`## Entrypoints\`, \`## Key Commands\`, \`## Runtime Data Stores\`, \`## External Services And Integration Surfaces\`, \`## Environment And Config Surfaces\`, \`## Generated Artifacts To Respect\`, \`## Change Hotspots\`, \`## Practical Editing Notes\`.`,
13209
+ "14. Every major claim should be grounded in repository evidence. Mention concrete repo paths in the docs when a structural claim would otherwise be ambiguous.",
13210
+ "15. Avoid placeholder filler, generic checklists, and duplicated content across files. Each doc should have a clear job.",
13211
+ "16. Do not create ROADMAP.md, ENGINEERING_RULES.md, or other extra docs unless the prompt explicitly asks for them.",
13207
13212
  researchMode === "never"
13208
- ? "12. Stay repo-only. Do not use outside research."
13209
- : "12. Use repo evidence first. Use official docs when needed. Treat Reddit or community sources only as labeled secondary evidence.",
13213
+ ? "17. Stay repo-only. Do not use outside research."
13214
+ : "17. Use repo evidence first. Use official docs when needed. Treat Reddit or community sources only as labeled secondary evidence.",
13210
13215
  researchMode === "always"
13211
- ? `13. Include an external research evidence subsection in ${techPath} with clearly labeled primary and secondary evidence.`
13212
- : "13. Include external research notes only if they materially informed the architecture update.",
13213
- `14. If the project clearly follows Clean Architecture, feature-first modules, DDD, modular monolith, or another stable structure, make that explicit in ${architecturePath} with evidence from the repo.`,
13214
- `15. Ensure ${adrReadmePath} and ${adrTemplatePath} exist as ADR entrypoints, but keep them lean.`,
13216
+ ? `18. Include an external research evidence subsection in ${techPath} with clearly labeled primary and secondary evidence.`
13217
+ : "18. Include external research notes only if they materially informed the architecture update.",
13218
+ `19. If the project clearly follows Clean Architecture, feature-first modules, DDD, modular monolith, or another stable structure, make that explicit in ${architecturePath} with evidence from the repo.`,
13219
+ `20. Ensure ${adrReadmePath} and ${adrTemplatePath} exist as ADR entrypoints, but keep them lean.`,
13215
13220
  "",
13216
13221
  "Return one JSON object on the last line with this shape:",
13217
13222
  `{"files_written":["${productPath}","${architecturePath}","${techPath}","${adrReadmePath}","${adrTemplatePath}"],"research_used":false,"gaps":[],"next_actions":[]}`,
@@ -13476,6 +13481,85 @@ async function captureFileContents(filePaths) {
13476
13481
  return snapshot;
13477
13482
  }
13478
13483
 
13484
+ function collectTaggedBlocks(content, startPattern, endPattern) {
13485
+ const blocks = [];
13486
+ let cursor = 0;
13487
+ const startMatcher = new RegExp(
13488
+ startPattern.source,
13489
+ startPattern.flags.replace(/g/g, ""),
13490
+ );
13491
+ const endMatcher = new RegExp(
13492
+ endPattern.source,
13493
+ endPattern.flags.replace(/g/g, ""),
13494
+ );
13495
+ while (cursor < content.length) {
13496
+ const remaining = content.slice(cursor);
13497
+ const startMatch = remaining.match(startMatcher);
13498
+ if (!startMatch || startMatch.index == null) break;
13499
+ const startIndex = cursor + startMatch.index;
13500
+ const afterStart = content.slice(startIndex + startMatch[0].length);
13501
+ const endMatch = afterStart.match(endMatcher);
13502
+ if (!endMatch || endMatch.index == null) break;
13503
+ const endIndex =
13504
+ startIndex + startMatch[0].length + endMatch.index + endMatch[0].length;
13505
+ const block = content.slice(startIndex, endIndex);
13506
+ const inner = content
13507
+ .slice(startIndex + startMatch[0].length, endIndex - endMatch[0].length)
13508
+ .trim();
13509
+ blocks.push({
13510
+ startIndex,
13511
+ endIndex,
13512
+ block,
13513
+ score: inner.length,
13514
+ });
13515
+ cursor = endIndex;
13516
+ }
13517
+ return blocks;
13518
+ }
13519
+
13520
+ async function collapseDuplicateTaggedBlocks({
13521
+ targetPath,
13522
+ startPattern,
13523
+ endPattern,
13524
+ }) {
13525
+ if (!(await pathExists(targetPath))) return { changed: false };
13526
+
13527
+ const content = await readFile(targetPath, "utf8");
13528
+ const blocks = collectTaggedBlocks(content, startPattern, endPattern);
13529
+ if (blocks.length <= 1) return { changed: false };
13530
+
13531
+ const bestBlock = [...blocks].sort((a, b) => b.score - a.score)[0];
13532
+ const first = blocks[0];
13533
+ const last = blocks[blocks.length - 1];
13534
+ const normalized =
13535
+ content.slice(0, first.startIndex) +
13536
+ bestBlock.block +
13537
+ content.slice(last.endIndex);
13538
+
13539
+ if (normalized === content) return { changed: false };
13540
+
13541
+ await writeFile(targetPath, normalized, "utf8");
13542
+ return { changed: true };
13543
+ }
13544
+
13545
+ async function normalizeArchitectureBuildOutputs(scaffold) {
13546
+ await collapseDuplicateTaggedBlocks({
13547
+ targetPath: scaffold.productPath,
13548
+ startPattern: PRODUCT_FOUNDATION_BLOCK_START_RE,
13549
+ endPattern: PRODUCT_FOUNDATION_BLOCK_END_RE,
13550
+ });
13551
+ await collapseDuplicateTaggedBlocks({
13552
+ targetPath: scaffold.architectureDocPath,
13553
+ startPattern: ARCHITECTURE_DOC_BLOCK_START_RE,
13554
+ endPattern: ARCHITECTURE_DOC_BLOCK_END_RE,
13555
+ });
13556
+ await collapseDuplicateTaggedBlocks({
13557
+ targetPath: scaffold.techMdPath,
13558
+ startPattern: TECH_ARCHITECTURE_BLOCK_START_RE,
13559
+ endPattern: TECH_ARCHITECTURE_BLOCK_END_RE,
13560
+ });
13561
+ }
13562
+
13479
13563
  async function readArchitectureDriftStatus(workspaceRoot, snapshot) {
13480
13564
  const productPath = path.join(workspaceRoot, FOUNDATION_DOCS_DIR, "PRODUCT.md");
13481
13565
  const architecturePath = path.join(
@@ -13701,6 +13785,8 @@ async function runBuildArchitecture(options) {
13701
13785
  throw new Error(explainArchitectureBuildFailure(platform, execution));
13702
13786
  }
13703
13787
 
13788
+ await normalizeArchitectureBuildOutputs(scaffold);
13789
+
13704
13790
  const filesAfter = await captureFileContents(managedFilePaths);
13705
13791
  const changedFiles = managedFilePaths
13706
13792
  .filter((filePath) => filesBefore[filePath] !== filesAfter[filePath])
@@ -39,15 +39,18 @@ Use this when the task is to declare, refresh, or validate the project backbone
39
39
  2. Read concrete repo anchors before drafting: root README/manifests, main entrypoints, the primary app roots, existing `docs/specs/`, and representative source folders for each major surface.
40
40
  3. Read `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md` in that order if they exist.
41
41
  4. Update the managed foundation sections in `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md`.
42
- 5. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
43
- 6. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
44
- 7. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
42
+ 5. Make `docs/foundation/ARCHITECTURE.md` explicitly state the architecture type in use and include a folder-structure guide for the important apps/packages/directories.
43
+ 6. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
44
+ 7. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
45
+ 8. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
45
46
 
46
47
  ## Context notes
47
48
 
48
49
  - This workflow is route-fixed and skill-fixed: do not start with `route_resolve` or `skill_search`.
49
50
  - `docs/foundation/PRODUCT.md` captures intent, `docs/foundation/ARCHITECTURE.md` captures accepted structure, and `docs/foundation/TECH.md` is the developer-facing technical map. Keep them aligned but not redundant.
50
51
  - Favor a lean arc42/C4 style: clear scope, boundaries, building blocks, runtime flows, deployment/testing notes, and only diagrams that add real value.
52
+ - `docs/foundation/ARCHITECTURE.md` should guide future contributors, not just describe the system. Be explicit about architecture style and folder ownership.
53
+ - Prefer stable section headings over ad hoc prose so future refreshes stay clean and easy to diff.
51
54
  - Preserve manual content outside the managed foundation sections.
52
55
  - Mark non-applicable sections explicitly instead of silently omitting them.
53
56
 
@@ -39,15 +39,18 @@ Use this when the task is to declare, refresh, or validate the project backbone
39
39
  2. Read concrete repo anchors before drafting: root README/manifests, main entrypoints, the primary app roots, existing `docs/specs/`, and representative source folders for each major surface.
40
40
  3. Read `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md` in that order if they exist.
41
41
  4. Update the managed foundation sections in `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md`.
42
- 5. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
43
- 6. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
44
- 7. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
42
+ 5. Make `docs/foundation/ARCHITECTURE.md` explicitly state the architecture type in use and include a folder-structure guide for the important apps/packages/directories.
43
+ 6. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
44
+ 7. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
45
+ 8. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
45
46
 
46
47
  ## Context notes
47
48
 
48
49
  - This workflow is route-fixed and skill-fixed: do not start with `route_resolve` or `skill_search`.
49
50
  - `docs/foundation/PRODUCT.md` captures intent, `docs/foundation/ARCHITECTURE.md` captures accepted structure, and `docs/foundation/TECH.md` is the developer-facing technical map. Keep them aligned but not redundant.
50
51
  - Favor a lean arc42/C4 style: clear scope, boundaries, building blocks, runtime flows, deployment/testing notes, and only diagrams that add real value.
52
+ - `docs/foundation/ARCHITECTURE.md` should guide future contributors, not just describe the system. Be explicit about architecture style and folder ownership.
53
+ - Prefer stable section headings over ad hoc prose so future refreshes stay clean and easy to diff.
51
54
  - Preserve manual content outside the managed foundation sections.
52
55
  - Mark non-applicable sections explicitly instead of silently omitting them.
53
56
 
@@ -39,15 +39,18 @@ Use this when the task is to declare, refresh, or validate the project backbone
39
39
  2. Read concrete repo anchors before drafting: root README/manifests, main entrypoints, the primary app roots, existing `docs/specs/`, and representative source folders for each major surface.
40
40
  3. Read `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md` in that order if they exist.
41
41
  4. Update the managed foundation sections in `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md`.
42
- 5. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
43
- 6. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
44
- 7. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
42
+ 5. Make `docs/foundation/ARCHITECTURE.md` explicitly state the architecture type in use and include a folder-structure guide for the important apps/packages/directories.
43
+ 6. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
44
+ 7. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
45
+ 8. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
45
46
 
46
47
  ## Context notes
47
48
 
48
49
  - This workflow is route-fixed and skill-fixed: do not start with `route_resolve` or `skill_search`.
49
50
  - `docs/foundation/PRODUCT.md` captures intent, `docs/foundation/ARCHITECTURE.md` captures accepted structure, and `docs/foundation/TECH.md` is the developer-facing technical map. Keep them aligned but not redundant.
50
51
  - Favor a lean arc42/C4 style: clear scope, boundaries, building blocks, runtime flows, deployment/testing notes, and only diagrams that add real value.
52
+ - `docs/foundation/ARCHITECTURE.md` should guide future contributors, not just describe the system. Be explicit about architecture style and folder ownership.
53
+ - Prefer stable section headings over ad hoc prose so future refreshes stay clean and easy to diff.
51
54
  - Preserve manual content outside the managed foundation sections.
52
55
  - Mark non-applicable sections explicitly instead of silently omitting them.
53
56
 
@@ -39,15 +39,18 @@ Use this when the task is to declare, refresh, or validate the project backbone
39
39
  2. Read concrete repo anchors before drafting: root README/manifests, main entrypoints, the primary app roots, existing `docs/specs/`, and representative source folders for each major surface.
40
40
  3. Read `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md` in that order if they exist.
41
41
  4. Update the managed foundation sections in `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md`.
42
- 5. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
43
- 6. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
44
- 7. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
42
+ 5. Make `docs/foundation/ARCHITECTURE.md` explicitly state the architecture type in use and include a folder-structure guide for the important apps/packages/directories.
43
+ 6. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
44
+ 7. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
45
+ 8. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
45
46
 
46
47
  ## Context notes
47
48
 
48
49
  - This workflow is route-fixed and skill-fixed: do not start with `route_resolve` or `skill_search`.
49
50
  - `docs/foundation/PRODUCT.md` captures intent, `docs/foundation/ARCHITECTURE.md` captures accepted structure, and `docs/foundation/TECH.md` is the developer-facing technical map. Keep them aligned but not redundant.
50
51
  - Favor a lean arc42/C4 style: clear scope, boundaries, building blocks, runtime flows, deployment/testing notes, and only diagrams that add real value.
52
+ - `docs/foundation/ARCHITECTURE.md` should guide future contributors, not just describe the system. Be explicit about architecture style and folder ownership.
53
+ - Prefer stable section headings over ad hoc prose so future refreshes stay clean and easy to diff.
51
54
  - Preserve manual content outside the managed foundation sections.
52
55
  - Mark non-applicable sections explicitly instead of silently omitting them.
53
56
 
@@ -39,15 +39,18 @@ Use this when the task is to declare, refresh, or validate the project backbone
39
39
  2. Read concrete repo anchors before drafting: root README/manifests, main entrypoints, the primary app roots, existing `docs/specs/`, and representative source folders for each major surface.
40
40
  3. Read `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md` in that order if they exist.
41
41
  4. Update the managed foundation sections in `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md`.
42
- 5. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
43
- 6. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
44
- 7. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
42
+ 5. Make `docs/foundation/ARCHITECTURE.md` explicitly state the architecture type in use and include a folder-structure guide for the important apps/packages/directories.
43
+ 6. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
44
+ 7. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
45
+ 8. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
45
46
 
46
47
  ## Context notes
47
48
 
48
49
  - This workflow is route-fixed and skill-fixed: do not start with `route_resolve` or `skill_search`.
49
50
  - `docs/foundation/PRODUCT.md` captures intent, `docs/foundation/ARCHITECTURE.md` captures accepted structure, and `docs/foundation/TECH.md` is the developer-facing technical map. Keep them aligned but not redundant.
50
51
  - Favor a lean arc42/C4 style: clear scope, boundaries, building blocks, runtime flows, deployment/testing notes, and only diagrams that add real value.
52
+ - `docs/foundation/ARCHITECTURE.md` should guide future contributors, not just describe the system. Be explicit about architecture style and folder ownership.
53
+ - Prefer stable section headings over ad hoc prose so future refreshes stay clean and easy to diff.
51
54
  - Preserve manual content outside the managed foundation sections.
52
55
  - Mark non-applicable sections explicitly instead of silently omitting them.
53
56
 
@@ -39,15 +39,18 @@ Use this when the task is to declare, refresh, or validate the project backbone
39
39
  2. Read concrete repo anchors before drafting: root README/manifests, main entrypoints, the primary app roots, existing `docs/specs/`, and representative source folders for each major surface.
40
40
  3. Read `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md` in that order if they exist.
41
41
  4. Update the managed foundation sections in `docs/foundation/PRODUCT.md`, `docs/foundation/ARCHITECTURE.md`, and `docs/foundation/TECH.md`.
42
- 5. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
43
- 6. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
44
- 7. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
42
+ 5. Make `docs/foundation/ARCHITECTURE.md` explicitly state the architecture type in use and include a folder-structure guide for the important apps/packages/directories.
43
+ 6. Add or refresh Mermaid diagrams and flow narratives inside `docs/foundation/ARCHITECTURE.md` or `docs/foundation/TECH.md` when they clarify system behavior.
44
+ 7. Seed or refresh `docs/foundation/adr/README.md` and `docs/foundation/adr/0000-template.md`, and keep ADR linkage explicit when decisions should be durable.
45
+ 8. Record whether the update was driven by a broader spec and whether future implementation must follow newly declared structure or product constraints.
45
46
 
46
47
  ## Context notes
47
48
 
48
49
  - This workflow is route-fixed and skill-fixed: do not start with `route_resolve` or `skill_search`.
49
50
  - `docs/foundation/PRODUCT.md` captures intent, `docs/foundation/ARCHITECTURE.md` captures accepted structure, and `docs/foundation/TECH.md` is the developer-facing technical map. Keep them aligned but not redundant.
50
51
  - Favor a lean arc42/C4 style: clear scope, boundaries, building blocks, runtime flows, deployment/testing notes, and only diagrams that add real value.
52
+ - `docs/foundation/ARCHITECTURE.md` should guide future contributors, not just describe the system. Be explicit about architecture style and folder ownership.
53
+ - Prefer stable section headings over ad hoc prose so future refreshes stay clean and easy to diff.
51
54
  - Preserve manual content outside the managed foundation sections.
52
55
  - Mark non-applicable sections explicitly instead of silently omitting them.
53
56