@warpgogol/forge 0.4.0 → 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 (137) hide show
  1. package/AGENTS.md +116 -4
  2. package/dist/os/adr/handlers/validate.d.ts.map +1 -1
  3. package/dist/os/adr/handlers/validate.js +31 -3
  4. package/dist/os/adr/handlers/validate.js.map +1 -1
  5. package/dist/os/core/core.module.d.ts.map +1 -1
  6. package/dist/os/core/core.module.js +76 -2
  7. package/dist/os/core/core.module.js.map +1 -1
  8. package/dist/os/core/handlers/knowledge-compact.d.ts +4 -0
  9. package/dist/os/core/handlers/knowledge-compact.d.ts.map +1 -0
  10. package/dist/os/core/handlers/knowledge-compact.js +198 -0
  11. package/dist/os/core/handlers/knowledge-compact.js.map +1 -0
  12. package/dist/os/rfc/handlers/lifecycle.d.ts.map +1 -1
  13. package/dist/os/rfc/handlers/lifecycle.js +3 -4
  14. package/dist/os/rfc/handlers/lifecycle.js.map +1 -1
  15. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  16. package/dist/os/rfc/handlers/validate-rules.js +41 -3
  17. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  18. package/dist/os/spec/spec-schema.d.ts +1 -1
  19. package/dist/src/config/forge-config.d.ts +67 -3
  20. package/dist/src/config/forge-config.d.ts.map +1 -1
  21. package/dist/src/config/forge-config.js +86 -2
  22. package/dist/src/config/forge-config.js.map +1 -1
  23. package/dist/src/index.d.ts +3 -1
  24. package/dist/src/index.d.ts.map +1 -1
  25. package/dist/src/index.js +6 -2
  26. package/dist/src/index.js.map +1 -1
  27. package/dist/src/knowledge/budgets.d.ts +38 -0
  28. package/dist/src/knowledge/budgets.d.ts.map +1 -0
  29. package/dist/src/knowledge/budgets.js +157 -0
  30. package/dist/src/knowledge/budgets.js.map +1 -0
  31. package/dist/src/knowledge/compact.d.ts +47 -0
  32. package/dist/src/knowledge/compact.d.ts.map +1 -0
  33. package/dist/src/knowledge/compact.js +322 -0
  34. package/dist/src/knowledge/compact.js.map +1 -0
  35. package/dist/src/knowledge/index.d.ts +7 -0
  36. package/dist/src/knowledge/index.d.ts.map +1 -0
  37. package/dist/src/knowledge/index.js +19 -0
  38. package/dist/src/knowledge/index.js.map +1 -0
  39. package/dist/src/knowledge/parse.d.ts +3 -0
  40. package/dist/src/knowledge/parse.d.ts.map +1 -0
  41. package/dist/src/knowledge/parse.js +205 -0
  42. package/dist/src/knowledge/parse.js.map +1 -0
  43. package/dist/src/knowledge/promote.d.ts +37 -0
  44. package/dist/src/knowledge/promote.d.ts.map +1 -0
  45. package/dist/src/knowledge/promote.js +120 -0
  46. package/dist/src/knowledge/promote.js.map +1 -0
  47. package/dist/src/knowledge/schema.d.ts +61 -0
  48. package/dist/src/knowledge/schema.d.ts.map +1 -0
  49. package/dist/src/knowledge/schema.js +64 -0
  50. package/dist/src/knowledge/schema.js.map +1 -0
  51. package/dist/src/knowledge/serialize.d.ts +3 -0
  52. package/dist/src/knowledge/serialize.d.ts.map +1 -0
  53. package/dist/src/knowledge/serialize.js +67 -0
  54. package/dist/src/knowledge/serialize.js.map +1 -0
  55. package/dist/src/onboarding/agents-generate.d.ts +15 -0
  56. package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
  57. package/dist/src/onboarding/agents-generate.js +118 -58
  58. package/dist/src/onboarding/agents-generate.js.map +1 -1
  59. package/dist/src/onboarding/create.d.ts.map +1 -1
  60. package/dist/src/onboarding/create.js +62 -3
  61. package/dist/src/onboarding/create.js.map +1 -1
  62. package/dist/src/onboarding/doctor.d.ts +13 -1
  63. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  64. package/dist/src/onboarding/doctor.js +527 -11
  65. package/dist/src/onboarding/doctor.js.map +1 -1
  66. package/dist/src/onboarding/init.d.ts +8 -1
  67. package/dist/src/onboarding/init.d.ts.map +1 -1
  68. package/dist/src/onboarding/init.js +33 -2
  69. package/dist/src/onboarding/init.js.map +1 -1
  70. package/dist/src/onboarding/memory-scaffold.d.ts +18 -0
  71. package/dist/src/onboarding/memory-scaffold.d.ts.map +1 -0
  72. package/dist/src/onboarding/memory-scaffold.js +151 -0
  73. package/dist/src/onboarding/memory-scaffold.js.map +1 -0
  74. package/dist/src/onboarding/nested-agents-generate.d.ts +6 -2
  75. package/dist/src/onboarding/nested-agents-generate.d.ts.map +1 -1
  76. package/dist/src/onboarding/nested-agents-generate.js +34 -9
  77. package/dist/src/onboarding/nested-agents-generate.js.map +1 -1
  78. package/dist/src/onboarding/nested-agents-templates.d.ts +23 -1
  79. package/dist/src/onboarding/nested-agents-templates.d.ts.map +1 -1
  80. package/dist/src/onboarding/nested-agents-templates.js +138 -8
  81. package/dist/src/onboarding/nested-agents-templates.js.map +1 -1
  82. package/dist/src/onboarding/profile-validate.d.ts +13 -0
  83. package/dist/src/onboarding/profile-validate.d.ts.map +1 -0
  84. package/dist/src/onboarding/profile-validate.js +109 -0
  85. package/dist/src/onboarding/profile-validate.js.map +1 -0
  86. package/dist/src/onboarding/upgrade.d.ts +5 -0
  87. package/dist/src/onboarding/upgrade.d.ts.map +1 -1
  88. package/dist/src/onboarding/upgrade.js +27 -1
  89. package/dist/src/onboarding/upgrade.js.map +1 -1
  90. package/dist/src/onboarding/workspace-discovery.d.ts +4 -3
  91. package/dist/src/onboarding/workspace-discovery.d.ts.map +1 -1
  92. package/dist/src/onboarding/workspace-discovery.js +51 -3
  93. package/dist/src/onboarding/workspace-discovery.js.map +1 -1
  94. package/dist/src/profiles/profile-schema.d.ts +116 -0
  95. package/dist/src/profiles/profile-schema.d.ts.map +1 -0
  96. package/dist/src/profiles/profile-schema.js +94 -0
  97. package/dist/src/profiles/profile-schema.js.map +1 -0
  98. package/dist/src/profiles/stack-profile.d.ts +41 -1
  99. package/dist/src/profiles/stack-profile.d.ts.map +1 -1
  100. package/dist/src/profiles/stack-profile.js +9 -0
  101. package/dist/src/profiles/stack-profile.js.map +1 -1
  102. package/dist/src/profiles/terminology-utils.d.ts +8 -0
  103. package/dist/src/profiles/terminology-utils.d.ts.map +1 -0
  104. package/dist/src/profiles/terminology-utils.js +31 -0
  105. package/dist/src/profiles/terminology-utils.js.map +1 -0
  106. package/dist/src/validators/skill-validate.d.ts +15 -0
  107. package/dist/src/validators/skill-validate.d.ts.map +1 -1
  108. package/dist/src/validators/skill-validate.js +204 -2
  109. package/dist/src/validators/skill-validate.js.map +1 -1
  110. package/package.json +11 -3
  111. package/profiles/astro-typescript-turborepo.yaml +87 -0
  112. package/profiles/editframe-html-templates/composition-agents.md +34 -0
  113. package/profiles/editframe-html-templates/composition.html +32 -0
  114. package/profiles/editframe-html.yaml +283 -0
  115. package/profiles/forge-shell.yaml +77 -0
  116. package/profiles/phaser-turborepo.yaml +87 -0
  117. package/skills/fo/fo-doc-audit/SKILL.md +6 -6
  118. package/skills/fo/fo-handoff/SKILL.md +2 -1
  119. package/skills/fo/fo-idea-implement/SKILL.md +44 -2
  120. package/skills/fo/fo-idea-plan/SKILL.md +1 -0
  121. package/skills/fo/fo-knowledge-distill/SKILL.md +170 -0
  122. package/skills/fo/fo-memory-sync/SKILL.md +6 -3
  123. package/skills/fo/fo-memory-sync/fix-patterns.md +38 -4
  124. package/skills/fo/fo-review/SKILL.md +2 -2
  125. package/skills/fo/fo-session-retro/SKILL.md +21 -11
  126. package/skills/fo/fo-session-save/SKILL.md +1 -1
  127. package/skills/fo/fo-session-save/fix-patterns.md +53 -29
  128. package/skills/fo/fo-session-save/learned-principles.md +59 -8
  129. package/skills/meta/forge-bootstrap/SKILL.md +16 -4
  130. package/skills/meta/forge-bootstrap/operator-profile-template.md +1 -0
  131. package/skills/meta/skill-create/SKILL.md +1 -1
  132. package/skills/shared/grilling/SKILL.md +1 -1
  133. package/skills/shared/grilling/learned-principles.md +14 -0
  134. package/skills/shared/grilling/qa-log.md +105 -6
  135. package/skills/shared/knowledge/learned-principles.md +5 -0
  136. package/skills/shared/windows-ai-tooling/SKILL.md +154 -1
  137. package/skills/shared/writing-great-skills/SKILL.md +74 -1
@@ -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
+ ```