@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
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: fo-knowledge-distill
3
+ description: Distill raw knowledge logs (L0) into durable fix patterns (L1) and learned principles (L2), maintain confirmation counters, and migrate legacy sections — with operator approval on every mutation.
4
+ invocation: user
5
+ category: fo
6
+ concerns: document-only
7
+ dependsOn: ['my-preferences', 'grilling']
8
+ languagePolicy: ref(PREFERENCES.md)
9
+ bindings:
10
+ requires: []
11
+ optional: []
12
+ triggers: ["distill knowledge", "compact skill knowledge", "knowledge lifecycle", "promote fix patterns"]
13
+ ---
14
+
15
+ # Knowledge Distillation
16
+
17
+ 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.
18
+
19
+ This skill assists the operator in the knowledge distillation lifecycle: reading raw material (L0), proposing durable patterns (L1) and principles (L2), re-confirming existing entries, migrating legacy sections, and recommending compaction. Every mutation requires explicit operator approval.
20
+
21
+ ## When to invoke
22
+
23
+ - **After a productive session** — when the session generated raw Q&A pairs or debugging insights that could benefit future agents.
24
+ - **When `forge.skill.knowledge.compact --all-skills --dry-run` reports legacy sections** — this skill performs the actual migration with operator approval.
25
+ - **When a SKILL-21 budget warning appears** — distill to reduce active knowledge volume.
26
+ - **When the operator asks to "distill", "compact", or "maintain" skill knowledge.**
27
+
28
+ ## What this skill is NOT
29
+
30
+ - It is NOT `forge.skill.knowledge.compact` — that command handles mechanical archival (expiry, supersession, L0 retention, L2 staleness). This skill handles semantic work: grouping, promoting, and migrating.
31
+ - It is NOT `fo-session-retro` — that skill triages session discoveries and routes them. This skill works within a single skill's knowledge files.
32
+ - It is NOT `fo-extract-dna` — that skill extracts architectural invariants. This skill distills operational knowledge (fix patterns, learned principles).
33
+
34
+ ## Process
35
+
36
+ ### Step 1: Scope selection
37
+
38
+ Ask the operator which skill(s) to distill:
39
+
40
+ - Use `ask_user_question` to offer: (a) a specific skill by name, or (b) all skills with knowledge files.
41
+ - Parse the selected skill's knowledge files via the structured knowledge parser (in-process import of the forge `src/knowledge/` module or the `forge` package).
42
+ - Report what was found: file names, entry counts, legacy section counts, parse issues.
43
+
44
+ **Completion criteria:** operator has selected a scope and the skill has parsed all relevant knowledge files without errors.
45
+
46
+ ### Step 2: Read cold material
47
+
48
+ Read L0 (`qa-log.md`) and, if present, `qa-log.archive.md`. This is the sanctioned wholesale read of the cold layer (hot/warm/cold discipline).
49
+
50
+ - Also read L1 (`fix-patterns.md`) and L2 (`learned-principles.md`) to understand existing distilled knowledge.
51
+ - Report a summary: how many raw entries, how many existing patterns/principles, what themes recur.
52
+
53
+ **Completion criteria:** all knowledge files for the selected skill have been read and summarized.
54
+
55
+ ### Step 3: Propose distillations
56
+
57
+ Group recurring Q&A themes from L0. For each theme, propose either:
58
+
59
+ - An **L2 principle** (with `confirmations` seeded from observed recurrences) — for cross-cutting insights that apply broadly.
60
+ - An **L1 fix pattern** — for specific, reusable solutions to specific problems.
61
+
62
+ Present proposals as a table:
63
+
64
+ | # | Proposed entry | Layer | Source entries | Rationale |
65
+ | --- | -------------- | ----- | -------------- | --------- |
66
+
67
+ For each proposal, use `ask_user_question` to let the operator:
68
+
69
+ - **Confirm** — the entry is written as proposed.
70
+ - **Edit** — the operator provides corrections; the entry is written with edits.
71
+ - **Drop** — the proposal is discarded.
72
+
73
+ **Completion criteria:** every proposal has been confirmed, edited, or dropped by the operator.
74
+
75
+ ### Step 4: Re-confirmation pass
76
+
77
+ For existing L2 entries whose themes appear in the new material:
78
+
79
+ - Propose `confirmations + 1` and `lastConfirmedAt: today`.
80
+ - If the entry is `status: stale`, propose restoring to `status: active`.
81
+ - Present each re-confirmation individually via `ask_user_question`.
82
+
83
+ **Completion criteria:** every re-confirmation has been approved or declined by the operator.
84
+
85
+ ### Step 5: Legacy migration
86
+
87
+ For each legacy section (freeform prose that predates structured entries):
88
+
89
+ - Propose a structured entry: assign an ID, set metadata (layer, created, status), preserve the body verbatim.
90
+ - Use `ask_user_question` for each legacy section — the operator approves the proposed structured entry.
91
+
92
+ **Completion criteria:** every legacy section has been migrated or explicitly skipped by the operator.
93
+
94
+ ### Step 6: Write
95
+
96
+ Apply approved mutations via the knowledge serializer (`serializeKnowledgeFile`). Never string-splice markdown. Never touch entries that were not explicitly approved.
97
+
98
+ - Write files atomically (staging + rename) to prevent corruption on mid-run failure.
99
+ - Commit only the mutated knowledge files (fo-pipeline commit discipline).
100
+
101
+ **Completion criteria:** all approved mutations are written and committed.
102
+
103
+ ### Step 7: Recommend compact
104
+
105
+ If retention/expiry candidates remain after distillation:
106
+
107
+ - Recommend `forge.skill.knowledge.compact --skill <name>` to the operator.
108
+ - Offer to run it via `ask_user_question`.
109
+ - If the operator declines, note it in the session summary.
110
+
111
+ **Completion criteria:** the operator has been informed of compaction opportunities and has made a decision.
112
+
113
+ ### Step 8: Commit
114
+
115
+ Commit only the mutated knowledge files. Reference this skill and the knowledge lifecycle in the commit message. Do not stage unrelated changes.
116
+
117
+ **Completion criteria:** changes are committed with a descriptive message.
118
+
119
+ ## Knowledge file format
120
+
121
+ All knowledge files use the structured knowledge entry format:
122
+
123
+ ````markdown
124
+ <!-- knowledge-layer: L2 -->
125
+ # learned-principles.md
126
+
127
+ ### K-0001: Short title
128
+
129
+ ```knowledge-entry
130
+ id: K-0001
131
+ layer: L2
132
+ created: 2026-08-03
133
+ lastConfirmedAt: 2026-08-03
134
+ confirmations: 1
135
+ status: active
136
+ ````
137
+
138
+ Body text describing the principle.
139
+
140
+ ```
141
+
142
+ See `writing-great-skills` § Cumulative knowledge pattern for the three-layer reference pattern (L0 raw logs, L1 fix patterns, L2 learned principles), entry format, and mutation contract.
143
+
144
+ ## Constraints
145
+
146
+ - **Operator approval on every mutation.** Never write to a knowledge file without explicit approval for each entry.
147
+ - **Serializer only.** Always use `serializeKnowledgeFile` from the forge knowledge module. Never string-splice markdown.
148
+ - **No semantic logic in command handlers.** The `forge.skill.knowledge.compact` command handles mechanical archival only. Semantic grouping and promotion live in this skill.
149
+ - **No LLM logic in `src/knowledge/`.** Deterministic planning only; meaning work lives here.
150
+ - **Read archives too.** When distilling, read both live and archive files — archived material may still contain themes worth re-distilling.
151
+
152
+ ## Cross-skill promotion
153
+
154
+ When `forge.doctor` reports `knowledge-duplicate` warnings (cross-skill L2 entries with matching normalized titles), or when the operator identifies a promotion candidate, execute the promotion protocol:
155
+
156
+ ### Promotion protocol
157
+
158
+ 1. **Present the pair** — show both titles, bodies, confirmations, and the proposed merged shared entry (merged body, summed confirmations, `promotedFrom` provenance). The operator approves, edits, or rejects via grilling.
159
+ 2. **Write the shared entry** — append to `packages/forge/skills/shared/knowledge/learned-principles.md` with the next `K-NNNN` id, `status: active`, `created: today`, `lastConfirmedAt: today`, `confirmations` (sum of sources), and `promotedFrom: ["<skill>/K-NNNN", ...]`.
160
+ 3. **Rewrite local copies** — each skill-local entry keeps its heading and id but its metadata is rewritten: `promotedTo: shared/K-NNNN`, `status: superseded`; body replaced with one line: "Promoted to shared layer as shared/K-NNNN." The next compact run archives these pointer entries out of the hot file.
161
+ 4. **Cite, don't copy** — future distill runs in any skill reference the shared id (`shared/K-NNNN`) instead of re-creating the principle locally.
162
+ 5. **Commit** — shared file + all touched skill files in one commit.
163
+
164
+ ### Promotion constraints
165
+
166
+ - **Promotion requires operator approval inside grilling** — detection is deterministic, promotion is human. Never promote without explicit operator approval for each pair.
167
+ - **Never copy shared-layer content into skill-local files** — cite via `shared/K-NNNN`, do not duplicate.
168
+ - **Never promote project-specific knowledge from pack skills into the forge shared layer** — domain-neutrality is checked during grilling. If the principle is project-specific, it stays pack-local.
169
+ - **Portability gate** — grilling must include the question: "Is this principle genuinely cross-skill, or is it specific to one skill's domain?" Only genuinely cross-skill principles promote.
170
+ ```
@@ -64,7 +64,7 @@ Build the full path table for both Codex and Claude Code. Check which paths exis
64
64
 
65
65
  ### 2. Read knowledge files
66
66
 
67
- Read `fix-patterns.md` and `learned-principles.md` for accumulated filtering and import patterns from previous runs across all projects.
67
+ Read `fix-patterns.md` and `learned-principles.md` for accumulated filtering and import patterns from previous runs across all projects. Apply only entries with `status: active`; skip entries with `status: stale`, `superseded`, or `archived`.
68
68
 
69
69
  ### 3. Discover external memory and sessions
70
70
 
@@ -142,12 +142,15 @@ For each confirmed item, route the knowledge to the appropriate destination:
142
142
  | Project convention or rule | Nearest applicable `AGENTS.md` | Direct edit |
143
143
  | Architectural decision | `docs/adrs/` | Delegate to `fo-idea-create-adr` |
144
144
  | Cross-workspace invariant | `ref(forge.yaml bindings.paths.invariantsFile)` | Delegate to `fo-extract-dna` |
145
- | Session context | `docs/sessions/` | Create session file |
145
+ | Session context (structured record) | `docs/sessions/` | Create session file |
146
146
  | Operator preference | `.agents/operator-profile.md` | Direct edit |
147
- | Ephemeral context | Memory DB | `create_memory` tool |
147
+ | Ephemeral context (import-only) | `.agents/memory/daily/<today>.md` | Append to daily log |
148
+ | Ephemeral context (mirror) | Memory DB | `create_memory` tool (optional mirror) |
148
149
 
149
150
  Do not duplicate knowledge already present in the target. Read the target file before editing. Add knowledge in the most concise actionable form.
150
151
 
152
+ **Boundary between `docs/sessions/` and `.agents/memory/daily/`:** `docs/sessions/` holds structured imported session records (from external tools). `.agents/memory/daily/` holds agent-written Context bullets (append-only, git-ignored). Use `docs/sessions/` for imported external sessions; use `.agents/memory/daily/` for ephemeral context bullets that the agent writes during this session.
153
+
151
154
  ### 7. Update knowledge files
152
155
 
153
156
  After the run:
@@ -1,24 +1,58 @@
1
1
  <!-- L1: Baseline fix patterns for filtering, deduplication, and import decisions.
2
2
  Grown by AI per operator direction. Each pattern describes a recurring situation
3
3
  and the action to take. -->
4
+ <!-- knowledge-layer: L1 -->
5
+
4
6
  # Fix Patterns
5
7
 
6
- ## Pattern A: Skip non-project sessions
8
+ ### K-0001: Skip non-project sessions
9
+
10
+ ```knowledge-entry
11
+ id: K-0001
12
+ layer: L1
13
+ created: 2026-08-03
14
+ status: active
15
+ ```
7
16
 
8
17
  **Situation:** Codex session references a project path that does not match the current project root or git remote.
18
+
9
19
  **Action:** Skip. List in the "Filtered out" section of the report with reason "irrelevant — references different project".
10
20
 
11
- ## Pattern B: Skip duplicate knowledge
21
+ ### K-0002: Skip duplicate knowledge
22
+
23
+ ```knowledge-entry
24
+ id: K-0002
25
+ layer: L1
26
+ created: 2026-08-03
27
+ status: active
28
+ ```
12
29
 
13
30
  **Situation:** Memory or session content is already present in `AGENTS.md`, `docs/architecture-dna.md`, or existing `docs/sessions/` files.
31
+
14
32
  **Action:** Skip import. List in the "Filtered out" section with reason "duplicate — knowledge already in <location>".
15
33
 
16
- ## Pattern C: Import project convention
34
+ ### K-0003: Import project convention
35
+
36
+ ```knowledge-entry
37
+ id: K-0003
38
+ layer: L1
39
+ created: 2026-08-03
40
+ status: active
41
+ ```
17
42
 
18
43
  **Situation:** Memory or instruction contains a convention or rule directly applicable to the current project.
44
+
19
45
  **Action:** Route to the nearest applicable `AGENTS.md`. Read the file before editing. Add in concise actionable form.
20
46
 
21
- ## Pattern D: Redact sensitive information
47
+ ### K-0004: Redact sensitive information
48
+
49
+ ```knowledge-entry
50
+ id: K-0004
51
+ layer: L1
52
+ created: 2026-08-03
53
+ status: active
54
+ ```
22
55
 
23
56
  **Situation:** Memory or session content contains API keys, passwords, or PII.
57
+
24
58
  **Action:** Redact before importing. Replace with `<redacted>` placeholder. Never import raw secrets.
@@ -230,10 +230,10 @@ Derive the `<module-folder>` from the reviewed files: take the package path with
230
230
  Write the report to:
231
231
 
232
232
  ```txt
233
- docs/reviews/code/<module-folder>/review-<YYYY-MM-DD>-<HH>-<module-folder>.md
233
+ docs/reviews/code/<module-folder>/review-<YYYY-MM-DD>-<HH-mm>-<module-folder>.md
234
234
  ```
235
235
 
236
- For example: `docs/reviews/code/packages-growth/review-2026-07-10-19-packages-growth.md`.
236
+ For example: `docs/reviews/code/packages-growth/review-2026-07-10-19-30-packages-growth.md`.
237
237
 
238
238
  Create any missing parent directories. The file must begin with a YAML frontmatter block:
239
239
 
@@ -43,7 +43,7 @@ Each discovered insight is categorized into exactly one of six types. The catego
43
43
  | **Invariant** | A cross-workspace architectural rule that warrants DNA status | `ref(forge.yaml bindings.paths.invariantsFile)` | Delegate to `fo-extract-dna` |
44
44
  | **Pattern** | A reusable code pattern or abstraction worth porting to forge | `packages/forge/` | Delegate to `fo-harvest` |
45
45
  | **Operator** | A preference, communication style, or behavioral insight about the operator | `.agents/operator-profile.md` | Direct edit by this skill |
46
- | **Context** | Session-local knowledge with no durable home | Memory DB | `create_memory` tool |
46
+ | **Context** | Session-local knowledge with no durable home | `.agents/memory/daily/<today>.md` (default) or `MEMORY.md` (when durable); Memory DB optional mirror | Direct edit (daily log append) or curated edit (MEMORY.md); Memory DB via `create_memory` tool (optional mirror) |
47
47
 
48
48
  ### Category criteria
49
49
 
@@ -106,22 +106,26 @@ For each candidate, ask: "Would another agent working in this area benefit from
106
106
 
107
107
  ### 3. Categorize and present
108
108
 
109
+ **Language requirement (NON-NEGOTIABLE):** The triage table, the `ask_user_question` confirmation prompt, and all inline commentary MUST be written in `PREFERENCES.md` `aiLanguage`. The English template below is structural only — translate ALL headings, column names, labels, and prose to `aiLanguage` before presenting. Only identifiers (file paths, skill names, RFC/ADR ids) stay untranslated. Example: if `aiLanguage` is `ru`, the heading is «Сортировка инсайтов сессии», column headers are «№ | Инсайт | Категория | Назначение | Действие».
110
+
109
111
  Present each insight with a proposed category and routing:
110
112
 
111
113
  ```
112
- ## Session Insight Triage
114
+ ## <Triage heading in aiLanguage>
113
115
 
114
- | # | Insight | Category | Destination | Action |
116
+ | # | <Insight> | <Category> | <Destination> | <Action> |
115
117
  | --- | --- | --- | --- | --- |
116
118
  | 1 | hydrateFromArtifacts is mandatory when steps write state | Rule | packages/AGENTS.md | Direct edit |
117
119
  | 2 | Model registry chosen over hardcoded clients | Decision | docs/adrs/ | Delegate to fo-idea-create-adr |
118
120
  | 3 | Gogol ID must not equal phase ID | Invariant | ref(forge.yaml bindings.paths.invariantsFile) | Delegate to fo-extract-dna |
119
121
  | 4 | Batch AI calls for large-context models | Pattern | packages/forge/ | Delegate to fo-harvest |
120
122
  | 5 | Operator prefers concise responses without code blocks | Operator | .agents/operator-profile.md | Direct edit |
121
- | 6 | Current pipeline state for mission X | Context | memory DB | create_memory |
123
+ | 6 | Current pipeline state for mission X | Context | `.agents/memory/daily/` or `MEMORY.md` | Direct edit |
122
124
  ```
123
125
 
124
- Ask the operator to confirm, adjust categories, or drop items using `ask_user_question`. Do not proceed without explicit confirmation.
126
+ Ask the operator to confirm, adjust categories, or drop items using `ask_user_question` — the question text MUST be in `aiLanguage`. Do not proceed without explicit confirmation.
127
+
128
+ **Confirmation format (NON-NEGOTIABLE):** Use `allowMultiple: true` and present each insight as a separate option, with the option label matching the insight number from the triage table (e.g. option 1 = "1: <insight summary>"). This ensures the operator's response ("1, 2", "3", etc.) unambiguously refers to insight numbers, not to abstract option ordinals. Never use abstract options like "confirm all", "only rules", "only context" — these create a numbering mismatch between the table and the confirmation prompt.
125
129
 
126
130
  ### 4. Route each confirmed insight
127
131
 
@@ -133,7 +137,7 @@ For each rule insight:
133
137
  2. **Read** the target file before editing.
134
138
  3. **Add the rule** in a minimal, actionable form: "Always implement `hydrateFromArtifacts` when a step writes state fields. The engine skips `validateBeforeStart` and `run()` when artifacts are valid, so downstream steps receive empty state." Include a code reference if applicable.
135
139
  4. **Do not duplicate** rules already present in the target file. If the rule extends an existing section, append to it.
136
- 5. **Do not create `.agents/rules/*.md`** — `.agents/**` is reference/historical only per root AGENTS.md. Rules live in `AGENTS.md` files.
140
+ 5. **Do not create `.agents/rules/*.md`** — `.agents/**` is reference/historical only per root AGENTS.md, except `.agents/memory/` (active context store), `.agents/skills/` (synced by forge), and `.agents/operator-profile.md` (written by this skill). Rules live in `AGENTS.md` files.
137
141
 
138
142
  #### 4b. Decision → ADR
139
143
 
@@ -203,9 +207,15 @@ Cumulative knowledge about the operator. This file is gitignored by default to p
203
207
  - [YYYY-MM-DD] <insight>
204
208
  ```
205
209
 
206
- #### 4f. Context → memory
210
+ #### 4f. Context → memory layer
211
+
212
+ For each context insight, choose the destination with the operator:
213
+
214
+ 1. **Daily log (default)** — append to `.agents/memory/daily/<today>.md` (create if absent). This is the ephemeral warm store — git-ignored, append-only. Format: `- [HH:MM] <insight>`. Redact API keys, passwords, and PII before appending.
215
+ 2. **MEMORY.md (when durable)** — if the insight is useful across sessions (not just today), append to `.agents/memory/MEMORY.md` under the most relevant section (`## Current focus`, `## Decisions in flight`, or `## Environment notes`). This is the curated hot store — versioned, so keep it concise.
216
+ 3. **Memory DB (optional mirror)** — use the `create_memory` tool to save the insight with appropriate tags. This is an optional mirror of the file-based layer, not the primary store.
207
217
 
208
- Use the `create_memory` tool to save the insight with appropriate tags. Use a descriptive title and include enough context for the next agent to understand why it matters.
218
+ Both daily-log and MEMORY.md edits require operator confirmation. Files are the source of truth; Memory DB is a mirror.
209
219
 
210
220
  ### 5. Commit
211
221
 
@@ -232,7 +242,7 @@ If any operator insights were routed to `.agents/operator-profile.md`, offer the
232
242
 
233
243
  ### 7. Report
234
244
 
235
- Present a concise summary in `aiLanguage`. **Translate all labels, headings, and column names to `aiLanguage`** — the template below is structural only. Only identifiers (file paths, skill names, RFC/ADR ids) stay untranslated.
245
+ Present a concise summary in `aiLanguage`. **ALL labels, headings, column names, and prose MUST be translated to `aiLanguage`** — the template below is structural only. Only identifiers (file paths, skill names, RFC/ADR ids, commit hashes) stay untranslated. This is non-negotiable: an English summary when `aiLanguage` is `ru` is a violation of this skill's language contract.
236
246
 
237
247
  ```
238
248
  ## <Session Retro Summary in aiLanguage>
@@ -247,7 +257,7 @@ Present a concise summary in `aiLanguage`. **Translate all labels, headings, and
247
257
  | 3 | ... | Invariant | fo-extract-dna | RFC-XXXX drafted |
248
258
  | 4 | ... | Pattern | fo-harvest | ported to forge |
249
259
  | 5 | ... | Operator | .agents/operator-profile.md | committed |
250
- | 6 | ... | Context | memory DB | saved |
260
+ | 6 | ... | Context | `.agents/memory/` | saved |
251
261
 
252
262
  ### <Delegated skills invoked>: <count>
253
263
  ### <Direct edits>: <count>
@@ -266,7 +276,7 @@ Recommended session-end sequence: `fo-doc-audit` → `fo-session-retro` → `fo-
266
276
  ## Constraints
267
277
 
268
278
  - **Document-only.** This skill must not modify, create, or delete source code files. The only files it may directly edit are `AGENTS.md` files (for rule insights) and `.agents/operator-profile.md` (for operator insights, RFC-XXXX). All other routing is via delegation to skills that own their output.
269
- - **No `.agents/rules/` files.** Rules live in `AGENTS.md` files, which are loaded into every agent's system prompt. `.agents/**` is reference/historical only per root AGENTS.md.
279
+ - **No `.agents/rules/` files.** Rules live in `AGENTS.md` files, which are loaded into every agent's system prompt. `.agents/**` is reference/historical only per root AGENTS.md, except `.agents/memory/` (active context store), `.agents/skills/` (synced by forge), and `.agents/operator-profile.md` (written by this skill).
270
280
  - **Delegation, not duplication.** For ADR, DNA, and pattern insights, delegate to the appropriate skill. Do not create ADRs, RFCs, or forge packages directly.
271
281
  - **Operator confirmation is mandatory.** Do not route any insight without explicit confirmation of category and destination.
272
282
  - **Minimal edits.** Add rules in the most concise actionable form. Do not rewrite existing sections.
@@ -35,7 +35,7 @@ Enhance saved session transcripts with semantic annotations, summaries, and qual
35
35
 
36
36
  3. **Read the most recently saved session file** from `docs/sessions/`. If no session files exist, exit with "No session files to annotate."
37
37
 
38
- 4. **Read knowledge files** (`qa-log.md`, `learned-principles.md`, `fix-patterns.md`) for accumulated knowledge from previous sessions.
38
+ 4. **Read knowledge files** (`qa-log.md`, `learned-principles.md`, `fix-patterns.md`) for accumulated knowledge from previous sessions. Apply only entries with `status: active`; skip entries with `status: stale`, `superseded`, or `archived`.
39
39
 
40
40
  5. **Analyze the transcript semantically:**
41
41
  - Generate a 1-3 sentence `summary` of the session's purpose and outcome.
@@ -1,33 +1,57 @@
1
+ <!-- knowledge-layer: L1 -->
2
+
1
3
  # Fix Patterns
2
4
 
3
5
  Patterns of errors in auto-extracted metadata (by `session.save`) and their fixes (applied by `fo-session-save` skill). Each pattern helps the skill recognize and correct common extraction mistakes.
4
6
 
5
- ## Format
6
-
7
- Each entry: pattern name, symptom, root cause, fix.
8
-
9
- ---
10
-
11
- 1. **False-positive RFC-id in comments**
12
-
13
- - **Symptom:** `relatedRfcs` contains an RFC-id that doesn't exist.
14
- - **Root cause:** Regex `RFC-\d{4}` matches references in code comments, URLs, or quoted text that aren't actual related RFCs.
15
- - **Fix:** Verify each RFC-id exists in `docs/rfcs/` before keeping it in `relatedRfcs`. Remove non-existent ones.
16
-
17
- 2. **Commit hash matching version numbers**
18
-
19
- - **Symptom:** `commits` array contains strings like `1.0.0` or `12345678`.
20
- - **Root cause:** Regex `\b[0-9a-f]{7,40}\b` matches version strings and short numeric sequences.
21
- - **Fix:** Filter out strings that look like version numbers (contain dots) or are pure decimal numbers. Verify remaining hashes correspond to actual git commits.
22
-
23
- 3. **File paths from error messages**
24
-
25
- - **Symptom:** `files` array contains paths from error messages or stack traces that weren't actually edited.
26
- - **Root cause:** Regex matches any path starting with `packages/`, `docs/`, etc., including paths in error output.
27
- - **Fix:** Cross-reference with `commits` and actual git diff to identify files that were genuinely modified during the session.
28
-
29
- 4. **Missing session type**
30
-
31
- - **Symptom:** Auto-detected `types` is `["freeform"]` but the session clearly involved implementation or review.
32
- - **Root cause:** The type detection patterns didn't match the specific phrasing used in the session.
33
- - **Fix:** Semantically analyze the transcript and override `types` with the correct classification.
7
+ ### K-0001: False-positive RFC-id in comments
8
+
9
+ ```knowledge-entry
10
+ id: K-0001
11
+ layer: L1
12
+ created: 2026-08-03
13
+ status: active
14
+ ```
15
+
16
+ - **Symptom:** `relatedRfcs` contains an RFC-id that doesn't exist.
17
+ - **Root cause:** Regex `RFC-\d{4}` matches references in code comments, URLs, or quoted text that aren't actual related RFCs.
18
+ - **Fix:** Verify each RFC-id exists in `docs/rfcs/` before keeping it in `relatedRfcs`. Remove non-existent ones.
19
+
20
+ ### K-0002: Commit hash matching version numbers
21
+
22
+ ```knowledge-entry
23
+ id: K-0002
24
+ layer: L1
25
+ created: 2026-08-03
26
+ status: active
27
+ ```
28
+
29
+ - **Symptom:** `commits` array contains strings like `1.0.0` or `12345678`.
30
+ - **Root cause:** Regex `\b[0-9a-f]{7,40}\b` matches version strings and short numeric sequences.
31
+ - **Fix:** Filter out strings that look like version numbers (contain dots) or are pure decimal numbers. Verify remaining hashes correspond to actual git commits.
32
+
33
+ ### K-0003: File paths from error messages
34
+
35
+ ```knowledge-entry
36
+ id: K-0003
37
+ layer: L1
38
+ created: 2026-08-03
39
+ status: active
40
+ ```
41
+
42
+ - **Symptom:** `files` array contains paths from error messages or stack traces that weren't actually edited.
43
+ - **Root cause:** Regex matches any path starting with `packages/`, `docs/`, etc., including paths in error output.
44
+ - **Fix:** Cross-reference with `commits` and actual git diff to identify files that were genuinely modified during the session.
45
+
46
+ ### K-0004: Missing session type
47
+
48
+ ```knowledge-entry
49
+ id: K-0004
50
+ layer: L1
51
+ created: 2026-08-03
52
+ status: active
53
+ ```
54
+
55
+ - **Symptom:** Auto-detected `types` is `["freeform"]` but the session clearly involved implementation or review.
56
+ - **Root cause:** The type detection patterns didn't match the specific phrasing used in the session.
57
+ - **Fix:** Semantically analyze the transcript and override `types` with the correct classification.
@@ -1,19 +1,70 @@
1
+ <!-- knowledge-layer: L2 -->
2
+
1
3
  # Learned Principles
2
4
 
3
5
  Principles learned across sessions by the `fo-session-save` skill. These are accumulated observations about session transcript quality, metadata extraction accuracy, and annotation patterns.
4
6
 
5
- ## Format
7
+ ### K-0001: Always verify RFC-id exists before listing as related
8
+
9
+ ```knowledge-entry
10
+ id: K-0001
11
+ layer: L2
12
+ created: 2026-08-03
13
+ lastConfirmedAt: 2026-08-03
14
+ confirmations: 1
15
+ status: active
16
+ ```
17
+
18
+ The `session.save` command extracts RFC-ids via regex (`RFC-\d{4}`), which can match references in comments, URLs, or quoted text. Before confirming a `relatedRfcs` entry, check that the RFC file exists in `docs/rfcs/`.
19
+
20
+ ### K-0002: Commit hash regex matches version numbers — filter by context
21
+
22
+ ```knowledge-entry
23
+ id: K-0002
24
+ layer: L2
25
+ created: 2026-08-03
26
+ lastConfirmedAt: 2026-08-03
27
+ confirmations: 1
28
+ status: active
29
+ ```
30
+
31
+ The regex `\b[0-9a-f]{7,40}\b` can match version strings like `1.0.0`. The `session.save` handler filters pure numeric strings ≤ 8 chars, but the skill should also verify that extracted hashes correspond to actual git commits in the session's work.
32
+
33
+ ### K-0003: Session types are not mutually exclusive
34
+
35
+ ```knowledge-entry
36
+ id: K-0003
37
+ layer: L2
38
+ created: 2026-08-03
39
+ lastConfirmedAt: 2026-08-03
40
+ confirmations: 1
41
+ status: active
42
+ ```
6
43
 
7
- Each principle: a concise statement, optionally with a rationale.
44
+ A single session can involve grilling followed by implementation. The `types` array should reflect all major activities, not just the dominant one.
8
45
 
9
- ---
46
+ ### K-0004: The `## Transcript` section is deterministic output
10
47
 
11
- 1. **Always verify RFC-id exists before listing as related.** The `session.save` command extracts RFC-ids via regex (`RFC-\d{4}`), which can match references in comments, URLs, or quoted text. Before confirming a `relatedRfcs` entry, check that the RFC file exists in `docs/rfcs/`.
48
+ ```knowledge-entry
49
+ id: K-0004
50
+ layer: L2
51
+ created: 2026-08-03
52
+ lastConfirmedAt: 2026-08-03
53
+ confirmations: 1
54
+ status: active
55
+ ```
12
56
 
13
- 2. **Commit hash regex matches version numbers — filter by context.** The regex `\b[0-9a-f]{7,40}\b` can match version strings like `1.0.0`. The `session.save` handler filters pure numeric strings ≤ 8 chars, but the skill should also verify that extracted hashes correspond to actual git commits in the session's work.
57
+ Never modify it. Only add `## Session notes` and update frontmatter.
14
58
 
15
- 3. **Session types are not mutually exclusive.** A single session can involve grilling followed by implementation. The `types` array should reflect all major activities, not just the dominant one.
59
+ ### K-0005: Redact sensitive information before saving
16
60
 
17
- 4. **The `## Transcript` section is deterministic output.** Never modify it. Only add `## Session notes` and update frontmatter.
61
+ ```knowledge-entry
62
+ id: K-0005
63
+ layer: L2
64
+ created: 2026-08-03
65
+ lastConfirmedAt: 2026-08-03
66
+ confirmations: 1
67
+ status: active
68
+ ```
18
69
 
19
- 5. **Redact sensitive information before saving.** API keys, passwords, PII must be removed from the transcript. Same redaction pattern as `fo-handoff`.
70
+ API keys, passwords, PII must be removed from the transcript. Same redaction pattern as `fo-handoff`.
@@ -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')
@@ -339,7 +351,7 @@ The skill declares the following knowledge files in its `knowledge` frontmatter
339
351
 
340
352
  ### 14. Privacy
341
353
 
342
- `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:
343
355
 
344
356
  - `operator-profile.md` is in `.gitignore` (added by scaffold profiles).
345
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