@warpgogol/forge 0.3.1 → 0.5.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 (180) hide show
  1. package/AGENTS.md +152 -5
  2. package/dist/bin/cli.js +4 -5
  3. package/dist/bin/cli.js.map +1 -1
  4. package/dist/os/adr/adr.module.d.ts.map +1 -1
  5. package/dist/os/adr/adr.module.js +4 -2
  6. package/dist/os/adr/adr.module.js.map +1 -1
  7. package/dist/os/adr/handlers/validate.d.ts.map +1 -1
  8. package/dist/os/adr/handlers/validate.js +32 -4
  9. package/dist/os/adr/handlers/validate.js.map +1 -1
  10. package/dist/os/compass/compass.module.d.ts.map +1 -1
  11. package/dist/os/compass/compass.module.js +4 -0
  12. package/dist/os/compass/compass.module.js.map +1 -1
  13. package/dist/os/compass/handlers/resolve-scan-root.d.ts.map +1 -1
  14. package/dist/os/compass/handlers/resolve-scan-root.js +16 -0
  15. package/dist/os/compass/handlers/resolve-scan-root.js.map +1 -1
  16. package/dist/os/core/core.module.d.ts.map +1 -1
  17. package/dist/os/core/core.module.js +82 -3
  18. package/dist/os/core/core.module.js.map +1 -1
  19. package/dist/os/core/handlers/knowledge-compact.d.ts +4 -0
  20. package/dist/os/core/handlers/knowledge-compact.d.ts.map +1 -0
  21. package/dist/os/core/handlers/knowledge-compact.js +198 -0
  22. package/dist/os/core/handlers/knowledge-compact.js.map +1 -0
  23. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  24. package/dist/os/rfc/handlers/implement-stamp.js +10 -6
  25. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  26. package/dist/os/rfc/handlers/index-graph.js +2 -2
  27. package/dist/os/rfc/handlers/index-graph.js.map +1 -1
  28. package/dist/os/rfc/handlers/lifecycle.d.ts.map +1 -1
  29. package/dist/os/rfc/handlers/lifecycle.js +4 -5
  30. package/dist/os/rfc/handlers/lifecycle.js.map +1 -1
  31. package/dist/os/rfc/handlers/pipeline-status.js +1 -1
  32. package/dist/os/rfc/handlers/pipeline-status.js.map +1 -1
  33. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  34. package/dist/os/rfc/handlers/validate-rules.js +41 -3
  35. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  36. package/dist/os/rfc/handlers/validate.js +1 -1
  37. package/dist/os/rfc/handlers/validate.js.map +1 -1
  38. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  39. package/dist/os/rfc/rfc.module.js +15 -10
  40. package/dist/os/rfc/rfc.module.js.map +1 -1
  41. package/dist/os/session/handlers/validate.js +1 -1
  42. package/dist/os/session/handlers/validate.js.map +1 -1
  43. package/dist/os/session/session.module.d.ts.map +1 -1
  44. package/dist/os/session/session.module.js +4 -2
  45. package/dist/os/session/session.module.js.map +1 -1
  46. package/dist/os/spec/spec-schema.d.ts +1 -1
  47. package/dist/os/werkstatt/handlers/lock.d.ts.map +1 -1
  48. package/dist/os/werkstatt/handlers/lock.js +27 -1
  49. package/dist/os/werkstatt/handlers/lock.js.map +1 -1
  50. package/dist/os/werkstatt/handlers/schema.d.ts +1 -0
  51. package/dist/os/werkstatt/handlers/schema.d.ts.map +1 -1
  52. package/dist/os/werkstatt/handlers/schema.js +1 -0
  53. package/dist/os/werkstatt/handlers/schema.js.map +1 -1
  54. package/dist/src/config/forge-config.d.ts +70 -3
  55. package/dist/src/config/forge-config.d.ts.map +1 -1
  56. package/dist/src/config/forge-config.js +91 -4
  57. package/dist/src/config/forge-config.js.map +1 -1
  58. package/dist/src/index.d.ts +3 -1
  59. package/dist/src/index.d.ts.map +1 -1
  60. package/dist/src/index.js +6 -2
  61. package/dist/src/index.js.map +1 -1
  62. package/dist/src/knowledge/budgets.d.ts +38 -0
  63. package/dist/src/knowledge/budgets.d.ts.map +1 -0
  64. package/dist/src/knowledge/budgets.js +157 -0
  65. package/dist/src/knowledge/budgets.js.map +1 -0
  66. package/dist/src/knowledge/compact.d.ts +47 -0
  67. package/dist/src/knowledge/compact.d.ts.map +1 -0
  68. package/dist/src/knowledge/compact.js +322 -0
  69. package/dist/src/knowledge/compact.js.map +1 -0
  70. package/dist/src/knowledge/index.d.ts +7 -0
  71. package/dist/src/knowledge/index.d.ts.map +1 -0
  72. package/dist/src/knowledge/index.js +19 -0
  73. package/dist/src/knowledge/index.js.map +1 -0
  74. package/dist/src/knowledge/parse.d.ts +3 -0
  75. package/dist/src/knowledge/parse.d.ts.map +1 -0
  76. package/dist/src/knowledge/parse.js +205 -0
  77. package/dist/src/knowledge/parse.js.map +1 -0
  78. package/dist/src/knowledge/promote.d.ts +37 -0
  79. package/dist/src/knowledge/promote.d.ts.map +1 -0
  80. package/dist/src/knowledge/promote.js +120 -0
  81. package/dist/src/knowledge/promote.js.map +1 -0
  82. package/dist/src/knowledge/schema.d.ts +61 -0
  83. package/dist/src/knowledge/schema.d.ts.map +1 -0
  84. package/dist/src/knowledge/schema.js +64 -0
  85. package/dist/src/knowledge/schema.js.map +1 -0
  86. package/dist/src/knowledge/serialize.d.ts +3 -0
  87. package/dist/src/knowledge/serialize.d.ts.map +1 -0
  88. package/dist/src/knowledge/serialize.js +67 -0
  89. package/dist/src/knowledge/serialize.js.map +1 -0
  90. package/dist/src/onboarding/agents-generate.d.ts +19 -0
  91. package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
  92. package/dist/src/onboarding/agents-generate.js +156 -66
  93. package/dist/src/onboarding/agents-generate.js.map +1 -1
  94. package/dist/src/onboarding/create.d.ts.map +1 -1
  95. package/dist/src/onboarding/create.js +66 -10
  96. package/dist/src/onboarding/create.js.map +1 -1
  97. package/dist/src/onboarding/doctor.d.ts +13 -1
  98. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  99. package/dist/src/onboarding/doctor.js +613 -7
  100. package/dist/src/onboarding/doctor.js.map +1 -1
  101. package/dist/src/onboarding/init.d.ts +8 -1
  102. package/dist/src/onboarding/init.d.ts.map +1 -1
  103. package/dist/src/onboarding/init.js +33 -2
  104. package/dist/src/onboarding/init.js.map +1 -1
  105. package/dist/src/onboarding/memory-scaffold.d.ts +18 -0
  106. package/dist/src/onboarding/memory-scaffold.d.ts.map +1 -0
  107. package/dist/src/onboarding/memory-scaffold.js +151 -0
  108. package/dist/src/onboarding/memory-scaffold.js.map +1 -0
  109. package/dist/src/onboarding/nested-agents-generate.d.ts +16 -0
  110. package/dist/src/onboarding/nested-agents-generate.d.ts.map +1 -0
  111. package/dist/src/onboarding/nested-agents-generate.js +69 -0
  112. package/dist/src/onboarding/nested-agents-generate.js.map +1 -0
  113. package/dist/src/onboarding/nested-agents-templates.d.ts +26 -0
  114. package/dist/src/onboarding/nested-agents-templates.d.ts.map +1 -0
  115. package/dist/src/onboarding/nested-agents-templates.js +178 -0
  116. package/dist/src/onboarding/nested-agents-templates.js.map +1 -0
  117. package/dist/src/onboarding/profile-validate.d.ts +13 -0
  118. package/dist/src/onboarding/profile-validate.d.ts.map +1 -0
  119. package/dist/src/onboarding/profile-validate.js +109 -0
  120. package/dist/src/onboarding/profile-validate.js.map +1 -0
  121. package/dist/src/onboarding/upgrade.d.ts +6 -0
  122. package/dist/src/onboarding/upgrade.d.ts.map +1 -1
  123. package/dist/src/onboarding/upgrade.js +45 -1
  124. package/dist/src/onboarding/upgrade.js.map +1 -1
  125. package/dist/src/onboarding/workspace-discovery.d.ts +11 -0
  126. package/dist/src/onboarding/workspace-discovery.d.ts.map +1 -0
  127. package/dist/src/onboarding/workspace-discovery.js +138 -0
  128. package/dist/src/onboarding/workspace-discovery.js.map +1 -0
  129. package/dist/src/profiles/profile-schema.d.ts +116 -0
  130. package/dist/src/profiles/profile-schema.d.ts.map +1 -0
  131. package/dist/src/profiles/profile-schema.js +94 -0
  132. package/dist/src/profiles/profile-schema.js.map +1 -0
  133. package/dist/src/profiles/stack-profile.d.ts +41 -1
  134. package/dist/src/profiles/stack-profile.d.ts.map +1 -1
  135. package/dist/src/profiles/stack-profile.js +9 -0
  136. package/dist/src/profiles/stack-profile.js.map +1 -1
  137. package/dist/src/profiles/terminology-utils.d.ts +8 -0
  138. package/dist/src/profiles/terminology-utils.d.ts.map +1 -0
  139. package/dist/src/profiles/terminology-utils.js +31 -0
  140. package/dist/src/profiles/terminology-utils.js.map +1 -0
  141. package/dist/src/types.d.ts +0 -1
  142. package/dist/src/types.d.ts.map +1 -1
  143. package/dist/src/utils/fs-idempotent.d.ts +1 -1
  144. package/dist/src/utils/fs-idempotent.d.ts.map +1 -1
  145. package/dist/src/utils/fs-idempotent.js +12 -3
  146. package/dist/src/utils/fs-idempotent.js.map +1 -1
  147. package/dist/src/validators/skill-validate.d.ts +15 -0
  148. package/dist/src/validators/skill-validate.d.ts.map +1 -1
  149. package/dist/src/validators/skill-validate.js +204 -2
  150. package/dist/src/validators/skill-validate.js.map +1 -1
  151. package/package.json +2 -2
  152. package/profiles/astro-typescript-turborepo.yaml +87 -0
  153. package/profiles/editframe-html-templates/composition-agents.md +34 -0
  154. package/profiles/editframe-html-templates/composition.html +32 -0
  155. package/profiles/editframe-html.yaml +283 -0
  156. package/profiles/forge-shell.yaml +77 -0
  157. package/profiles/phaser-turborepo.yaml +87 -0
  158. package/skills/fo/fo-doc-audit/SKILL.md +6 -6
  159. package/skills/fo/fo-fix/SKILL.md +11 -0
  160. package/skills/fo/fo-handoff/SKILL.md +2 -1
  161. package/skills/fo/fo-idea-implement/SKILL.md +44 -2
  162. package/skills/fo/fo-idea-plan/SKILL.md +1 -0
  163. package/skills/fo/fo-knowledge-distill/SKILL.md +170 -0
  164. package/skills/fo/fo-memory-sync/SKILL.md +6 -3
  165. package/skills/fo/fo-memory-sync/fix-patterns.md +38 -4
  166. package/skills/fo/fo-review/SKILL.md +2 -2
  167. package/skills/fo/fo-session-retro/SKILL.md +21 -11
  168. package/skills/fo/fo-session-save/SKILL.md +3 -4
  169. package/skills/fo/fo-session-save/fix-patterns.md +53 -29
  170. package/skills/fo/fo-session-save/learned-principles.md +59 -8
  171. package/skills/fo/fo-step-commit/SKILL.md +55 -0
  172. package/skills/meta/forge-bootstrap/SKILL.md +28 -4
  173. package/skills/meta/forge-bootstrap/operator-profile-template.md +1 -0
  174. package/skills/meta/skill-create/SKILL.md +1 -1
  175. package/skills/shared/grilling/SKILL.md +1 -1
  176. package/skills/shared/grilling/learned-principles.md +14 -0
  177. package/skills/shared/grilling/qa-log.md +105 -6
  178. package/skills/shared/knowledge/learned-principles.md +5 -0
  179. package/skills/shared/windows-ai-tooling/SKILL.md +154 -1
  180. package/skills/shared/writing-great-skills/SKILL.md +74 -1
@@ -39,6 +39,7 @@ Interactive skill for configuring a freshly created forge project. Runs after `f
39
39
  - The skill never collects personal data as a separate interview before the first creation moment — personal data emerges naturally from the creative dialogue.
40
40
  - `operator-profile.md` is local and private — it is in `.gitignore` and is not committed to the repository. The operator can delete it at any time.
41
41
  - Gender is optional — the operator may decline to provide it. If declined, the skill uses gender-neutral addressing and notes the absence in `operator-profile.md`.
42
+ - Form of address defaults to formal if the operator skips the question.
42
43
  - The skill never informs the operator about migration, version numbers, or upgrade mechanics — the silent version check in step 0 is invisible to the operator.
43
44
  - The skill never asks the operator for permission to migrate — if versions differ, migration runs automatically.
44
45
 
@@ -83,7 +84,7 @@ Accept the operator's choice and store it:
83
84
 
84
85
  The register controls whether the extended behavioral layer is included in `AGENTS.md`. Both registers receive the full core behavioral layer. The operator can change the register at any time via live operator feedback.
85
86
 
86
- ### 3. Operator name and gender (new)
87
+ ### 3. Operator name, gender, and form of address (new)
87
88
 
88
89
  Ask the operator:
89
90
 
@@ -95,7 +96,18 @@ Then ask:
95
96
 
96
97
  If the operator declines to provide gender, use gender-neutral addressing and note the absence in `operator-profile.md` under `## Personal`.
97
98
 
98
- Store the operator's name and gender (or absence) in `operator-profile.md` under `## Personal`. These are the only personal data collected before the first creation moment.
99
+ Then ask about the form of address:
100
+
101
+ > Do you prefer informal or formal address? In some languages this means saying "you" in a familiar way (e.g. "ty" in Russian/Ukrainian, "du" in German) versus a more formal way (e.g. "vy" in Russian/Ukrainian, "Sie" in German). If you're not sure, formal is the safe default.
102
+
103
+ Accept the operator's choice and store it:
104
+
105
+ - In `PREFERENCES.md` as `formOfAddress: formal` or `formOfAddress: informal`.
106
+ - In `operator-profile.md` under `## Register`.
107
+
108
+ If the operator skips the question, default to `formOfAddress: formal`. The preference applies to all agent-generated text: chat messages, reports, suggestions, and skill output. The operator can change it at any time by editing `PREFERENCES.md`.
109
+
110
+ Store the operator's name, gender (or absence), and form of address in `operator-profile.md` under `## Personal` and `## Register`. These are the only personal data collected before the first creation moment.
99
111
 
100
112
  ### 4. Verify forge project
101
113
 
@@ -161,7 +173,7 @@ The transplant mode performs real code migration via a migration-adapter registr
161
173
 
162
174
  6.7. **Build verification and error repair** — after post-setup, verify the transplanted project builds successfully:
163
175
 
164
- 1. Resolve the build command via `ref(forge.yaml bindings.commands.scopedBuild)`. If the binding is null (the migration adapter could not derive a build command from the source project), skip build verification with a note in the welcoming report and continue to the next step.
176
+ 1. Resolve the build command via `ref(forge.yaml bindings.commands.produce)`. If the binding is null (the migration adapter could not derive a build command from the source project), skip build verification with a note in the welcoming report and continue to the next step.
165
177
  2. Run the resolved build command and capture stdout/stderr. Set a timeout of 300 seconds (configurable); if the build does not complete in time, report the timeout in human language and continue.
166
178
  3. Parse build output for:
167
179
  - Missing modules (TS2307: Cannot find module 'X')
@@ -225,6 +237,18 @@ The operator can choose to start one immediately or defer.
225
237
 
226
238
  If project analysis finds nothing recommendable (transplant of an empty or minimal project), the skill skips recommendations and proceeds to the first creation moment with a direct invitation to start creating.
227
239
 
240
+ ### 9.1. Hand-written AGENTS.md improvement proposals (transplant only)
241
+
242
+ After project analysis, the skill checks existing hand-written `AGENTS.md` files in workspace directories (directories with a `package.json`). For each hand-written `AGENTS.md` (one without a generated marker), the skill checks for common forge conventions:
243
+
244
+ - Does the file reference the root `AGENTS.md` for project-wide rules?
245
+ - Does the file include workspace-type-appropriate guidance (app, package, service)?
246
+ - Does the file contain a generated marker (it should not for hand-written files)?
247
+
248
+ If improvement opportunities are found, the skill proposes them to the operator in creator-facing language (in `aiLanguage`). The operator confirms before any file is modified. Proposals are opt-in — the operator can decline all or select specific improvements.
249
+
250
+ If no hand-written `AGENTS.md` files exist, or no improvement opportunities are found, this step is skipped silently.
251
+
228
252
  ### 10. First creation moment (new)
229
253
 
230
254
  After the welcoming report, the skill helps the operator create something real immediately — not a placeholder, not a test, but a first piece of their actual project.
@@ -327,7 +351,7 @@ The skill declares the following knowledge files in its `knowledge` frontmatter
327
351
 
328
352
  ### 14. Privacy
329
353
 
330
- `operator-profile.md` contains personal data: operator name, gender, project story, deep purpose, creative influences, target audience, writing voice. Gender is special category data under GDPR Article 9. To prevent accidental exposure:
354
+ `operator-profile.md` contains personal data: operator name, gender, form of address, project story, deep purpose, creative influences, target audience, writing voice. Gender is special category data under GDPR Article 9. To prevent accidental exposure:
331
355
 
332
356
  - `operator-profile.md` is in `.gitignore` (added by scaffold profiles).
333
357
  - The skill informs the operator that `operator-profile.md` is local and private — it is not committed to the repository.
@@ -15,6 +15,7 @@ This file is private and local to your project. It is not committed to the repos
15
15
  ## Register
16
16
 
17
17
  - **Communication register:** (business | creative — how you prefer the system to work with you)
18
+ - **Form of address:** (formal | informal — how the system should address you in languages with a formal/informal distinction)
18
19
 
19
20
  ## Communication style
20
21
 
@@ -46,7 +46,7 @@ Before creating knowledge files, the agent analyzes the skill's knowledge domain
46
46
 
47
47
  3. **Which layers are needed?** Not every skill needs all three. `grilling` uses L0+L2 only. A site-scanning skill with all three layers is a good example. A skill with purely reactive error resolution may use L1+L2 only (no Q&A log).
48
48
 
49
- Present the analysis to the operator. If they confirm, create the knowledge files with header comments matching the chosen structure and add `knowledge:` to the frontmatter. See `writing-great-skills` § Cumulative knowledge pattern for the three-layer reference pattern and mutation contract.
49
+ Present the analysis to the operator. If they confirm, create the knowledge files with header comments matching the chosen structure and add `knowledge:` to the frontmatter. See `writing-great-skills` § Cumulative knowledge pattern for the three-layer reference pattern, entry format, and mutation contract.
50
50
 
51
51
  ### 2. Scaffold
52
52
 
@@ -13,7 +13,7 @@ knowledge:
13
13
 
14
14
  Before starting, read `PREFERENCES.md` at the repository root. If the file is missing or `aiLanguage` is unset, ask the operator once and create the file using the `my-preferences` skill semantics.
15
15
 
16
- Read `learned-principles.md` (L2) at the start of each session to improve recommended answers. Principles with `confirmations >= 3` may be applied autonomously — but re-evaluate if context changes.
16
+ Read `learned-principles.md` (L2) at the start of each session to improve recommended answers. Apply only entries with `status: active`; skip entries with `status: stale`, `superseded`, or `archived`. Principles with `confirmations >= 3` may be applied autonomously — but re-evaluate if context changes.
17
17
 
18
18
  Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
19
19
 
@@ -10,3 +10,17 @@ Concrete principles distilled from past grilling sessions. Each principle has a
10
10
  - **confirmations:** <N>
11
11
  - **Added:** <date>
12
12
  -->
13
+
14
+ ### K-0001: Extend infrastructure before feature logic
15
+
16
+ ```knowledge-entry
17
+ id: K-0001
18
+ layer: L2
19
+ created: 2026-08-03
20
+ lastConfirmedAt: 2026-08-03
21
+ confirmations: 1
22
+ status: active
23
+ ```
24
+
25
+ - **Condition:** Plan grilling reveals that a feature depends on a schema field, serializer entry, or validation path that doesn't exist in the underlying module yet.
26
+ - **Recommended answer:** Add a separate plan step to extend the infrastructure (schema, serializer, validator) before any step that creates or reads the new field/path. Zod safeParse silently strips unknown fields; fixed-order serializers skip unknown fields. Without the extension step, data is silently lost.
@@ -1,10 +1,109 @@
1
+ <!-- knowledge-layer: L0 -->
2
+
1
3
  # Q&A Log (L0)
2
4
 
3
5
  Append-only log of questions asked and answers given during grilling sessions. Used for meta-analysis to distill recurring decision patterns.
4
6
 
5
- <!-- Entries are appended by the skill during each run. -->
6
- <!-- Format:
7
- ## <date> — <context>
8
- - **Question:** <short question summary>
9
- - **Answer:** <operator's decision>
10
- -->
7
+ ### K-0001: Entry format for L0/L1/L2 knowledge records
8
+
9
+ ```knowledge-entry
10
+ id: K-0001
11
+ layer: L0
12
+ created: 2026-08-03
13
+ status: active
14
+ ```
15
+
16
+ - **Context:** 2026-08-03 — forge knowledge lifecycle RFC series (RFC-1..5)
17
+ - **Question:** Entry format for L0/L1/L2 knowledge records?
18
+ - **Answer:** Markdown files with per-entry YAML metadata blocks (human-readable, grep-able, parseable); soft migration for existing freeform entries.
19
+
20
+ ### K-0002: How to define and enforce layer token budgets
21
+
22
+ ```knowledge-entry
23
+ id: K-0002
24
+ layer: L0
25
+ created: 2026-08-03
26
+ status: active
27
+ ```
28
+
29
+ - **Context:** 2026-08-03 — forge knowledge lifecycle RFC series (RFC-1..5)
30
+ - **Question:** How to define and enforce layer token budgets?
31
+ - **Answer:** Hard defaults in forge (L2 hot ~4KB, L1 warm ~8KB, L0 cold unbudgeted), optional override in forge.yaml bindings; warning on exceed, not error.
32
+
33
+ ### K-0003: Where does AI distillation L0→L1/L2 live
34
+
35
+ ```knowledge-entry
36
+ id: K-0003
37
+ layer: L0
38
+ created: 2026-08-03
39
+ status: active
40
+ ```
41
+
42
+ - **Context:** 2026-08-03 — forge knowledge lifecycle RFC series (RFC-1..5)
43
+ - **Question:** Where does AI distillation L0→L1/L2 live?
44
+ - **Answer:** New skill fo-knowledge-distill alongside deterministic forge.skill.knowledge.compact command; code mutates metadata, agent distills meaning.
45
+
46
+ ### K-0004: Should .agents/memory/ be versioned in git
47
+
48
+ ```knowledge-entry
49
+ id: K-0004
50
+ layer: L0
51
+ created: 2026-08-03
52
+ status: active
53
+ ```
54
+
55
+ - **Context:** 2026-08-03 — forge knowledge lifecycle RFC series (RFC-1..5)
56
+ - **Question:** Should .agents/memory/ be versioned in git?
57
+ - **Answer:** Hybrid — MEMORY.md (curated) versioned, daily logs git-ignored.
58
+
59
+ ### K-0005: Schema extension before logic that depends on new fields
60
+
61
+ ```knowledge-entry
62
+ id: K-0005
63
+ layer: L0
64
+ created: 2026-08-03
65
+ status: active
66
+ ```
67
+
68
+ - **Context:** 2026-08-03 — grilling RFC-0663 plan (cross-skill knowledge promotion)
69
+ - **Question:** RFC proposes a new metadata field (promotedFrom) but the underlying schema (RFC-0660) doesn't define it. Where should schema extension live in the plan?
70
+ - **Answer:** Schema extension must be a separate step before any logic that creates or reads the field. Zod safeParse silently strips unknown fields; the serializer uses a fixed FIELD_ORDER array. Without extending both, the field is lost on parse and never written on serialize.
71
+
72
+ ### K-0006: Doctor check status for informational warnings
73
+
74
+ ```knowledge-entry
75
+ id: K-0006
76
+ layer: L0
77
+ created: 2026-08-03
78
+ status: active
79
+ ```
80
+
81
+ - **Context:** 2026-08-03 — grilling RFC-0663 plan (knowledge-duplicate doctor check)
82
+ - **Question:** RFC says "informational warnings, never affects exit status." Should the doctor check use status "pass" or "warn"?
83
+ - **Answer:** Use "warn" when duplicates found, "pass" when none. Only "fail" affects exit status. "warn" makes duplicates visible in doctor summary (N warn(s)) and --json output, consistent with RFC-0661 SKILL-21 budget warnings. "pass" always would hide duplicates in the summary.
84
+
85
+ ### K-0007: Validating non-skill knowledge files in doctor
86
+
87
+ ```knowledge-entry
88
+ id: K-0007
89
+ layer: L0
90
+ created: 2026-08-03
91
+ status: active
92
+ ```
93
+
94
+ - **Context:** 2026-08-03 — grilling RFC-0663 plan (shared knowledge layer validation)
95
+ - **Question:** The shared knowledge layer file is not inside a skill directory (no SKILL.md). Existing checks (checkLegacyKnowledgeSections, checkKnowledgeBudgets) and forge.skill.validate (SKILL-19/SKILL-20) discover knowledge files only through the skill registry. How to validate it?
96
+ - **Answer:** Add a dedicated checkSharedKnowledgeFile() in doctor.ts that parses the shared file via parseKnowledgeFile and checks SKILL-19 (schema validity) and SKILL-20 (id uniqueness) directly. A skill-wrapper would misrepresent the shared layer as a skill; skipping validation leaves schema violations undetected.
97
+
98
+ ### K-0008: Dogfood criterion when no real duplicates exist
99
+
100
+ ```knowledge-entry
101
+ id: K-0008
102
+ layer: L0
103
+ created: 2026-08-03
104
+ status: active
105
+ ```
106
+
107
+ - **Context:** 2026-08-03 — grilling RFC-0663 plan (dogfood acceptance criterion)
108
+ - **Question:** RFC requires "at least one real duplicate pair promoted end-to-end" but the current monorepo has very few L2 entries across skills. Real duplicates are unlikely. How to handle the dogfood criterion?
109
+ - **Answer:** Conditional dogfood: run detection on the monorepo. If duplicates found, promote with operator approval. If none found, the detection pipeline running end-to-end (detection → doctor report → zero duplicates) serves as evidence. Promotion mechanics are verified by unit tests. Creating artificial test duplicates is not natural and would not test the real promotion path.
@@ -0,0 +1,5 @@
1
+ <!-- knowledge-layer: L2 -->
2
+
3
+ # learned-principles.md (shared)
4
+
5
+ Promoted cross-skill principles. Entries are added by `fo-knowledge-distill` under operator grilling — never edited directly. Each entry uses `shared/K-NNNN` as its citation id.
@@ -3,7 +3,7 @@ name: windows-ai-tooling
3
3
  description: Bootstrap a Windows project for AI agents. Installs verified tools, generates .gitattributes, and emits a command allow-list for agent prompts. Run when starting a new project or when agents fail.
4
4
  invocation: user
5
5
  category: shared
6
- concerns: document-only
6
+ concerns: code-mutation
7
7
  dependsOn: []
8
8
  languagePolicy: ref(PREFERENCES.md)
9
9
  ---
@@ -189,6 +189,159 @@ Report:
189
189
  - A copyable block with the agent prompt snippet.
190
190
  - A reminder that re-running this skill is useful when adding a new tool or onboarding a new machine.
191
191
 
192
+ ### 8. GitHub Actions CI (optional)
193
+
194
+ If the project uses GitHub Actions, generate or update `.github/workflows/ci.yml` with the following Windows-specific guidance:
195
+
196
+ #### Action versions
197
+
198
+ Use the latest official actions with Node 24 runtime:
199
+
200
+ - `actions/checkout@v5`
201
+ - `actions/setup-node@v5`
202
+
203
+ These versions use the Node 24 runtime that GitHub Actions now recommends. Older versions (`@v4` and below) run on the deprecated Node 20 runtime.
204
+
205
+ #### Windows runner images
206
+
207
+ Do not pin to `windows-latest` blindly — the image composition changes over time and a toolchain that worked yesterday may break today. If native compilation is critical, pin to a specific Windows image version (e.g. `windows-2022`) and verify the actual compiler version in CI output.
208
+
209
+ Do not hardcode the path to Visual Studio and do not let tooling auto-select the newest installed version. Some `node-gyp` versions do not yet recognize Visual Studio 2026. For those, install Visual Studio Build Tools 2022 and constrain the toolset search to the `[17.0,18.0)` range:
210
+
211
+ ```yaml
212
+ - name: Set up Build Tools 2022
213
+ run: |
214
+ $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
215
+ -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
216
+ -property installationPath -version "[17.0,18.0)"
217
+ echo "VS_PATH=$vsPath" >> $env:GITHUB_ENV
218
+ ```
219
+
220
+ Before installing dependencies, activate the Developer Command Prompt for the discovered Visual Studio in the same step so that `cl.exe` and the MSVC toolchain are on `PATH`:
221
+
222
+ ```yaml
223
+ - name: Activate Developer Command Prompt
224
+ shell: cmd
225
+ run: |
226
+ call "%VS_PATH%\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64
227
+ pnpm install --frozen-lockfile
228
+ ```
229
+
230
+ #### Native dependencies
231
+
232
+ Native dependencies (SQLite drivers, `better-sqlite3`, `sharp`, `node-sass`, etc.) need CI testing on each target OS. A prebuilt binary may not exist for every Node version + OS + architecture combination — when it is missing, `node-gyp` falls back to source compilation and requires a working C++ compiler.
233
+
234
+ Verify in CI that `pnpm install` succeeds without manual intervention on every OS in the matrix. If it fails, either:
235
+
236
+ - Add `node-gyp` build prerequisites to the CI step (Build Tools + Developer Command Prompt), or
237
+ - Pin to a Node version that has prebuilt binaries for all target platforms.
238
+
239
+ #### Diagnostic step on Windows failure
240
+
241
+ When a Windows CI job fails — especially during `pnpm install` or native compilation — add a diagnostic step that prints the toolchain versions. This is critical while the Windows image transitions to Visual Studio 2026 and `node-gyp` versions may not yet recognize it:
242
+
243
+ ```yaml
244
+ - name: Diagnostics (on failure)
245
+ if: failure()
246
+ shell: pwsh
247
+ run: |
248
+ Write-Host "=== Node ==="
249
+ node --version
250
+ Write-Host "=== npm ==="
251
+ npm --version
252
+ Write-Host "=== pnpm ==="
253
+ pnpm --version
254
+ Write-Host "=== node-gyp ==="
255
+ npx node-gyp --version
256
+ Write-Host "=== MSVC ==="
257
+ & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
258
+ -latest -products * -property displayName -version "[17.0,18.0)"
259
+ Write-Host "=== cl.exe ==="
260
+ where.exe cl 2>$null || Write-Host "cl.exe not found on PATH"
261
+ Write-Host "=== Python ==="
262
+ python --version 2>$null || Write-Host "Python not found"
263
+ ```
264
+
265
+ The `if: failure()` condition ensures the step only runs when a previous step failed — it does not slow down successful runs. The output helps identify whether the failure is due to a missing compiler, wrong Visual Studio version, or a `node-gyp` incompatibility.
266
+
267
+ #### Windows long paths
268
+
269
+ If Windows is in the CI matrix, set `core.longpaths` **before** the checkout step via job-level env:
270
+
271
+ ```yaml
272
+ jobs:
273
+ windows-ci:
274
+ runs-on: windows-2022
275
+ env:
276
+ GIT_CONFIG_COUNT: 1
277
+ GIT_CONFIG_KEY_0: core.longpaths
278
+ GIT_CONFIG_VALUE_0: "true"
279
+ steps:
280
+ - name: Checkout
281
+ uses: actions/checkout@v5
282
+ # ...
283
+ ```
284
+
285
+ Without this, `git clone` fails on repositories with file paths longer than 260 characters (common in monorepos with deeply nested `node_modules` or generated content trees).
286
+
287
+ #### When to include Windows
288
+
289
+ Windows CI catches important platform-specific issues (path lengths, native builds, line endings), but it requires separate configuration of native dependencies, compiler toolchain, and shell differences (PowerShell vs bash). Only add Windows to the CI matrix where the product genuinely supports or ships Windows artifacts — not "just in case".
290
+
291
+ #### CI reliability patterns (all platforms)
292
+
293
+ Apply these to every workflow, not just Windows:
294
+
295
+ **Concurrency cancellation** — cancel superseded runs on PRs to save CI minutes and avoid cache thrashing:
296
+
297
+ ```yaml
298
+ concurrency:
299
+ group: ${{ github.workflow }}-${{ github.ref }}
300
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
301
+ ```
302
+
303
+ **Minimal permissions** — default GitHub Actions grants `contents: write`. Restrict to read-only at the workflow level; escalate per-job only where needed (e.g. changelog commit):
304
+
305
+ ```yaml
306
+ permissions:
307
+ contents: read
308
+ ```
309
+
310
+ **Job timeouts** — the default 6-hour timeout can exhaust CI limits on a hung install or test. Set `timeout-minutes` per job: 10–15 for lint/validate, 20–30 for build/test.
311
+
312
+ **Deterministic timezone** — tests using `new Date()` produce different results depending on the runner's timezone. Set `TZ: UTC` at the job level to make timestamps deterministic across runs:
313
+
314
+ ```yaml
315
+ jobs:
316
+ ci:
317
+ runs-on: ubuntu-latest
318
+ timeout-minutes: 15
319
+ env:
320
+ TZ: UTC
321
+ ```
322
+
323
+ **Explicit shell** — on Windows the default shell is PowerShell, which breaks bash syntax. Steps using bash must declare `shell: bash`; Windows-specific steps should declare `shell: cmd` or `shell: pwsh`:
324
+
325
+ ```yaml
326
+ - name: Run bash script
327
+ shell: bash
328
+ run: ./scripts/build.sh
329
+ ```
330
+
331
+ #### Package-scoped commands
332
+
333
+ Do not run package-level tools (test runners, linters, build commands) from the monorepo root. Run them via the package's own script or workspace context:
334
+
335
+ ```yaml
336
+ # Good — scoped to the package
337
+ - run: pnpm --filter <package-name> test
338
+
339
+ # Bad — runs from root, may pick up wrong config
340
+ - run: pnpm test
341
+ ```
342
+
343
+ Ask: **"Настроить GitHub Actions CI для Windows? (Y/m/s)"**. Default **Y** if the project already has `.github/workflows/`; otherwise **s** (skip — the scaffolded CI template already includes Ubuntu-only CI).
344
+
192
345
  ## Constraints
193
346
 
194
347
  - Default to automatic execution (`Y`) for every step. Offer `m` (manual) and `s` (skip) only as explicit opt-outs.
@@ -90,7 +90,7 @@ Use these to diagnose issues the user may be having with the skill.
90
90
 
91
91
  ## Cumulative knowledge pattern
92
92
 
93
- Skills that run repeatedly accumulate knowledge across sessions. The cumulative knowledge convention provides an opt-in three-layer reference pattern for this.
93
+ Skills that run repeatedly accumulate knowledge across sessions. The cumulative knowledge convention provides an opt-in three-layer reference pattern (plus one shared cross-skill layer) for this.
94
94
 
95
95
  ### Knowledge frontmatter
96
96
 
@@ -116,6 +116,78 @@ Skills adopt 0, 1, 2, or 3 layers as needed — the pattern is adaptive, not man
116
116
 
117
117
  Not every skill needs all three. `grilling` uses L0 and L2 only (no fix patterns). A site-scanning skill may use all three.
118
118
 
119
+ ### Shared layer (L2, cross-skill)
120
+
121
+ In addition to the three skill-local layers, there is a fourth tier: the **shared knowledge layer** at `packages/forge/skills/shared/knowledge/learned-principles.md`. This file holds promoted cross-skill principles with `shared/K-NNNN` identifiers.
122
+
123
+ - **Detection**: `forge.doctor` reports cross-skill duplicate L2 entries via normalized-title matching (exact and bounded containment).
124
+ - **Promotion**: `fo-knowledge-distill` executes promotions under operator grilling — the principle moves to the shared layer with summed confirmations and `promotedFrom` provenance; each skill-local copy is rewritten to a pointer entry (`promotedTo: shared/K-NNNN`, `status: superseded`).
125
+ - **Consumption**: knowledge-adopting skills read the shared layer at run start and cite shared principles as `shared/K-NNNN`.
126
+ - **Validation**: `forge.doctor` validates the shared layer file for schema validity and id uniqueness (it is not inside a skill directory, so `forge.skill.validate` does not reach it).
127
+ - **npm portability**: the shared layer ships as an empty template — accumulated promotions are project-specific.
128
+
129
+ ### Entry format
130
+
131
+ Each knowledge entry is a `### K-NNNN: title` heading followed by a `knowledge-entry` YAML metadata block and a markdown body:
132
+
133
+ ````markdown
134
+ ### K-0001: Skip non-project sessions
135
+
136
+ ```knowledge-entry
137
+ id: K-0001
138
+ layer: L1
139
+ created: 2026-08-03
140
+ status: active
141
+ ````
142
+
143
+ **Situation:** ...
144
+
145
+ **Action:** ...
146
+
147
+ ```
148
+
149
+ #### Metadata schema
150
+
151
+ | Field | Type | Required | Layers | Meaning |
152
+ | --- | --- | --- | --- | --- |
153
+ | `id` | `K-NNNN` | all | all | Unique 4-digit identifier within the file |
154
+ | `layer` | `L0` \| `L1` \| `L2` | all | all | Knowledge layer |
155
+ | `created` | `YYYY-MM-DD` | all | all | Date the entry was first written |
156
+ | `lastConfirmedAt` | `YYYY-MM-DD` \| `null` | L2 only | L2 | Date of last operator confirmation |
157
+ | `confirmations` | integer ≥ 0 | L2 only | L2 | Confirmation counter for autonomous application |
158
+ | `expiresAt` | `YYYY-MM-DD` \| `null` | optional | all | Date after which the entry is stale |
159
+ | `supersedes` | `K-NNNN[]` | optional | all | Entries this one replaces (must resolve in same file) |
160
+ | `promotedTo` | `shared/K-NNNN` \| `null` | optional | all | Cross-file promotion target |
161
+ | `promotedFrom` | `<skill>/K-NNNN[]` | optional | shared | Provenance — which skill-local entries were promoted into this shared entry |
162
+ | `status` | `active` \| `stale` \| `superseded` \| `archived` | all | all | Lifecycle state |
163
+
164
+ #### Layer-specific rules
165
+
166
+ - **L0** (`qa-log.md`): `confirmations` and `lastConfirmedAt` are forbidden.
167
+ - **L1** (`fix-patterns.md`): `confirmations` and `lastConfirmedAt` are forbidden.
168
+ - **L2** (`learned-principles.md`): `confirmations` and `lastConfirmedAt` are required.
169
+
170
+ #### Knowledge-adjacent files
171
+
172
+ Files declared in `knowledge:` frontmatter that do not use `### K-NNNN:` headings and have no `<!-- knowledge-layer: ... -->` preamble are **knowledge-adjacent** — they are exempt from SKILL-19/SKILL-20. Examples: `forge-about.md`, `operator-profile-template.md`, `project-narrative-template.md`.
173
+
174
+ #### Validation
175
+
176
+ `forge.skill.validate` enforces:
177
+ - **SKILL-19**: entry metadata schema validity (errors) and legacy section warnings (migration window).
178
+ - **SKILL-20**: identifier uniqueness (`K-NNNN` format, no duplicates, `supersedes` references resolve, `promotedTo` format).
179
+ - **SKILL-21**: hot (L2) and warm (L1) layer character budget warnings — warnings only, never build gates. Defaults: hot=4096, warm=8192. Override in `forge.yaml` under `bindings.knowledge.budgets`.
180
+
181
+ `forge.doctor` reports legacy section counts and knowledge budget summaries as informational warnings.
182
+
183
+ ### Reading discipline
184
+
185
+ When a skill declares `knowledge:` files, the skill body MUST include a one-line instruction telling the agent how to read them. Add this line to the skill's process section:
186
+
187
+ > Read declared knowledge files at the start of each run, in declaration order. Apply only entries with `status: active`. Skip entries with `status: stale`, `superseded`, or `archived`.
188
+
189
+ This ensures the agent knows to load and filter knowledge entries by lifecycle status, rather than blindly applying all entries including stale ones.
190
+
119
191
  ### Confidence progression
120
192
 
121
193
  L2 entries carry a `confirmations: N` counter. When confirmations reach threshold 3, the skill may apply the principle autonomously without asking the operator. Rejecting a recommended answer resets confirmations to 0. Autonomous application is context-dependent — the skill should re-evaluate if context changes.
@@ -130,3 +202,4 @@ L2 entries carry a `confirmations: N` counter. When confirmations reach threshol
130
202
  ### npm portability
131
203
 
132
204
  `@warpgogol/forge` is published to npm with `skills/` in the `files` array. Knowledge files ship as empty templates (header comments only). Forge's accumulated Q&A and learned principles are project-specific and should not leak to npm consumers. Each project accumulates its own knowledge locally after running `forge.create`.
205
+ ```