@warpgogol/forge 0.8.0 → 0.10.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 (55) hide show
  1. package/AGENTS.md +31 -2
  2. package/dist/bin/cli.js +0 -0
  3. package/dist/os/core/core.module.d.ts.map +1 -1
  4. package/dist/os/core/core.module.js +65 -0
  5. package/dist/os/core/core.module.js.map +1 -1
  6. package/dist/os/core/handlers/build.d.ts +16 -0
  7. package/dist/os/core/handlers/build.d.ts.map +1 -0
  8. package/dist/os/core/handlers/build.js +123 -0
  9. package/dist/os/core/handlers/build.js.map +1 -0
  10. package/dist/os/core/handlers/dev.d.ts +10 -0
  11. package/dist/os/core/handlers/dev.d.ts.map +1 -0
  12. package/dist/os/core/handlers/dev.js +102 -0
  13. package/dist/os/core/handlers/dev.js.map +1 -0
  14. package/dist/os/core/handlers/profile-resolve.d.ts +13 -0
  15. package/dist/os/core/handlers/profile-resolve.d.ts.map +1 -0
  16. package/dist/os/core/handlers/profile-resolve.js +65 -0
  17. package/dist/os/core/handlers/profile-resolve.js.map +1 -0
  18. package/dist/os/core/handlers/validate.d.ts +15 -0
  19. package/dist/os/core/handlers/validate.d.ts.map +1 -0
  20. package/dist/os/core/handlers/validate.js +120 -0
  21. package/dist/os/core/handlers/validate.js.map +1 -0
  22. package/dist/src/onboarding/doctor.d.ts +3 -0
  23. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  24. package/dist/src/onboarding/doctor.js +34 -4
  25. package/dist/src/onboarding/doctor.js.map +1 -1
  26. package/dist/src/onboarding/invariant-engine.d.ts +17 -0
  27. package/dist/src/onboarding/invariant-engine.d.ts.map +1 -0
  28. package/dist/src/onboarding/invariant-engine.js +173 -0
  29. package/dist/src/onboarding/invariant-engine.js.map +1 -0
  30. package/dist/src/profiles/profile-schema.d.ts +53 -0
  31. package/dist/src/profiles/profile-schema.d.ts.map +1 -1
  32. package/dist/src/profiles/profile-schema.js +19 -1
  33. package/dist/src/profiles/profile-schema.js.map +1 -1
  34. package/dist/src/profiles/stack-profile.d.ts +15 -0
  35. package/dist/src/profiles/stack-profile.d.ts.map +1 -1
  36. package/dist/src/profiles/stack-profile.js +3 -0
  37. package/dist/src/profiles/stack-profile.js.map +1 -1
  38. package/package.json +60 -161
  39. package/profiles/editframe-html.yaml +15 -0
  40. package/skills/_shared/fo-pipeline-conventions.md +65 -0
  41. package/skills/fo/fo-add-tests/SKILL.md +3 -1
  42. package/skills/fo/fo-doc-audit/SKILL.md +2 -0
  43. package/skills/fo/fo-fix/SKILL.md +5 -3
  44. package/skills/fo/fo-idea-audit/SKILL.md +2 -0
  45. package/skills/fo/fo-idea-create-adr/SKILL.md +2 -0
  46. package/skills/fo/fo-idea-create-rfc/SKILL.md +2 -0
  47. package/skills/fo/fo-idea-enhance/SKILL.md +3 -1
  48. package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +10 -0
  49. package/skills/fo/fo-idea-implement/SKILL.md +3 -1
  50. package/skills/fo/fo-idea-plan/SKILL.md +3 -1
  51. package/skills/fo/fo-idea-status/SKILL.md +2 -0
  52. package/skills/fo/fo-review/SKILL.md +4 -2
  53. package/skills/fo/fo-session-retro/SKILL.md +185 -1
  54. package/skills/meta/forge-bootstrap/SKILL.md +27 -4
  55. package/skills/shared/windows-ai-tooling/SKILL.md +3 -1
@@ -117,3 +117,68 @@ After completing implementation work, the operator may run a three-step session-
117
117
  3. **`fo-handoff`** — what does the next agent need? (continuity document)
118
118
 
119
119
  Most sessions need only `fo-doc-audit`. `fo-session-retro` is valuable after debugging sessions, exploratory work, or when non-obvious behaviors were discovered. `fo-handoff` is needed when work is incomplete and another agent will continue.
120
+
121
+ ## Context checkpoint between batch items
122
+
123
+ When the orchestrator skill processes multiple documents (>=2), perform a context checkpoint after completing one document and before starting the next:
124
+
125
+ 1. **Emit checkpoint block** — output a YAML-formatted block in conversation output with the following fields:
126
+ - `completed`: RFC/ADR id of the completed document
127
+ - `status`: final status (implemented, accepted, draft, failed)
128
+ - `commits`: list of commit SHAs produced for this document
129
+ - `lessons`: 1-3 short freeform sentences capturing key errors, root causes, patterns discovered, or validator quirks encountered during this document's pipeline run
130
+ - `dependencies`: cross-RFC dependency notes (e.g., "RFC-YYYY depends on RFC-XXXX for schema field Z") — empty if none
131
+ - `next`: id of the next document to process, or `null` if this was the last
132
+ 2. **Release context** — explicitly treat all detailed context from the completed document as no longer actionable: file contents, search results, edit operations, intermediate reasoning. Retain only the checkpoint block. Release means treat as no longer actionable for reasoning, not delete or undo.
133
+ 3. **Fresh start** — begin the next document with a fresh read phase: re-read the RFC file and all related documents (amends, supersedes, related RFCs, DNA invariants, AGENTS.md sections).
134
+
135
+ The checkpoint block doubles as a resume marker: when resuming an interrupted batch, scan conversation output for the last checkpoint block, extract completed ids and statuses, and continue with the next uncompleted item. If no checkpoint markers are found, fall back to the existing resume logic (git log, file inspection, frontmatter status).
136
+
137
+ **Only applies to batch processing (>=2 documents).** Single-document invocations do not need a checkpoint — the context is already fresh at the start.
138
+
139
+ ## Step-level context checkpoint during implementation
140
+
141
+ When the orchestrator skill implements a single RFC with >=5 plan steps, perform a step checkpoint after completing each plan step and committing:
142
+
143
+ 1. **Emit step-checkpoint block** — output a YAML-formatted block in conversation output with the following fields:
144
+ - `rfc`: RFC id being implemented
145
+ - `step`: plan step number (e.g., 3)
146
+ - `title`: plan step title
147
+ - `commit`: SHA of the commit produced by this step
148
+ - `decisions`: 1-3 short freeform sentences capturing key micro-decisions made during this step (e.g., "used flag instead of new command", "skipped validator X because it's in package Y, not in scope")
149
+ - `errors`: list of errors encountered and fixed during this step — empty if none
150
+ - `nextStep`: number of the next plan step, or `null` if this was the last
151
+ 2. **Release step context** — treat all detailed context from the completed step as no longer actionable: codebase search results, file reads, edit operations, validation output. Retain only the step-checkpoint block and the RFC's plan file.
152
+ 3. **Fresh start** — begin the next plan step with a fresh read of the plan file and the specific files the next step touches.
153
+
154
+ The step checkpoint doubles as a resume marker: when resuming an interrupted implementation, scan conversation output for the last step-checkpoint block, extract the completed step number, and resume from the next step.
155
+
156
+ **Only applies to plans with >=5 steps.** Small plans (4 or fewer steps) do not need step checkpoints — the context is manageable without them.
157
+
158
+ ## Progress beacon
159
+
160
+ The orchestrator skill emits a one-line progress beacon after completing each pipeline step (audit, enhance, plan, implement, review, fix) for each RFC. The beacon is informational only — it does not pause the pipeline, does not request operator input, and does not release context.
161
+
162
+ Format: `[beacon] RFC-XXXX | <step> ✓ | next: <next-step>`
163
+
164
+ For failed steps being fixed: `[beacon] RFC-XXXX | <step> ✗ (fixing...) | next: <next-step>`
165
+
166
+ The beacon text must use `aiLanguage` per the language policy.
167
+
168
+ ## Error checkpoint for pipeline step failures
169
+
170
+ When a pipeline step fails and cannot be auto-fixed within 2 attempts (per §Command execution timeout discipline), emit a structured error checkpoint block in conversation output:
171
+
172
+ 1. **Emit error checkpoint** — output a YAML block with: rfc, step, planStep (if within implement phase), error (command, exitCode, summary, attempts), partialState (filesModified, commits, rfcStatus), resumePoint.
173
+ 2. **Stop the pipeline** — do not continue to the next pipeline step. The error is not auto-fixable; continuing would compound the problem. This is an **explicit exception** to the orchestrator's "no pauses between pipeline steps" constraint. The "no pauses" directive assumes the pipeline can proceed; when an error is unfixable after 2 attempts, continuing is impossible and the exception is justified. The pause is for error reporting, not for optional operator input.
174
+ 3. **Report to operator** — present the error checkpoint in `aiLanguage` and ask the operator how to proceed: fix manually, skip the step, or abort the RFC.
175
+
176
+ The error checkpoint doubles as a resume marker: when resuming an interrupted session, scan for the last error checkpoint. If found, resume from the failed step using the partialState and resumePoint fields.
177
+
178
+ ## Batch plan preview
179
+
180
+ When the orchestrator skill processes multiple documents (>=2), emit a batch plan preview before starting the first document. The preview is a table showing: processing order, document id, type, complexity estimate, dependencies, and notes.
181
+
182
+ The preview is informational — it does not pause for operator approval unless the operator explicitly requests confirmation. The operator's invocation of the orchestrator is the instruction to proceed.
183
+
184
+ The preview text must use `aiLanguage` per the language policy.
@@ -83,8 +83,10 @@ Mock at **system boundaries** only — external APIs, databases, time, randomnes
83
83
 
84
84
  For the target package:
85
85
 
86
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
87
+
86
88
  ```sh
87
- pnpm --filter <package-name> test
89
+ rtk pnpm --filter <package-name> test
88
90
  ```
89
91
 
90
92
  If the tests fail (red):
@@ -124,6 +124,8 @@ If yes, update the **template** files in `packages/os/site-kernel-onboarding/src
124
124
 
125
125
  If yes, **do not edit the generated file directly**. Update the source registry or generator, then run the regeneration command:
126
126
 
127
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
128
+
127
129
  ```sh
128
130
  ref(forge.yaml bindings.commands.produce) --workspace=ecosystem.manifest.generate
129
131
  ref(forge.yaml bindings.commands.produce) --workspace=command.manifest.generate
@@ -95,7 +95,9 @@ Otherwise, determine which workspaces were touched by the fixes in step 2 and ru
95
95
 
96
96
  - **For each touched `apps/*` workspace:**
97
97
 
98
- ```sh
98
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
99
+
100
+ ```sh
99
101
  pnpm --filter <app-name> exec astro check
100
102
  ```
101
103
 
@@ -121,8 +123,8 @@ All scoped checks must pass. If any fails:
121
123
  Stage and commit the changes with a descriptive message.
122
124
 
123
125
  ```text
124
- git add ...
125
- git commit -m "fix(scope): ..."
126
+ rtk git add ...
127
+ rtk git commit -m "fix(scope): ..."
126
128
  ```
127
129
 
128
130
  Do not commit secrets, API keys, or unrelated changes.
@@ -53,6 +53,8 @@ Read the full RFC file at `docs/rfcs/rfc-XXXX-*.md` for the first RFC to process
53
53
 
54
54
  Run the mechanical floor first — it catches format, referential, and structural violations that don't need semantic judgment:
55
55
 
56
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
57
+
56
58
  ```sh
57
59
  ref(forge.yaml bindings.commands.validateRfc) --json
58
60
  ```
@@ -76,6 +76,8 @@ Address every concern the grilling raises by adjusting the metadata, scope, or c
76
76
 
77
77
  Run:
78
78
 
79
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
80
+
79
81
  ```sh
80
82
  ref(forge.yaml bindings.commands.validateAdr) --create --title="<title>" --scope=<scope> --related=<related-ids>
81
83
  ```
@@ -31,6 +31,8 @@ Create a complete, `rfc.validate`-ready RFC draft in `docs/rfcs/` using the full
31
31
 
32
32
  Confirm that the proposed change is not already covered by an accepted/implemented RFC. Before drafting, run:
33
33
 
34
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
35
+
34
36
  ```sh
35
37
  ref(forge.yaml bindings.commands.validateRfc) --status accepted --json
36
38
  ```
@@ -67,7 +67,9 @@ Read the RFC's `status` frontmatter:
67
67
  - **`draft`** — proceed with enhancement.
68
68
  - **`reviewing`** — transition to `draft` before enhancement. Set `status: draft`, update `updatedAt` to today's date, commit:
69
69
 
70
- ```txt
70
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
71
+
72
+ ```txt
71
73
  rfc: revert RFC-XXXX to draft for enhancement
72
74
 
73
75
  Transition RFC-XXXX from reviewing to draft before enhance.
@@ -54,6 +54,12 @@ Record the document id(s) and type(s) (RFC or ADR). If multiple documents were c
54
54
 
55
55
  For each document, run the full pipeline inline. The pipeline differs for RFCs and ADRs.
56
56
 
57
+ **Between batch items:** After completing one document's pipeline and before starting the next, perform a context checkpoint per `_shared/fo-pipeline-conventions.md` §Context checkpoint between batch items. Emit the checkpoint block, release completed-item context, and start the next item with a fresh read phase. This does not pause for operator input — the checkpoint is an agent-internal context management step, not a user interaction.
58
+
59
+ **Batch plan preview:** When processing >=2 documents, emit a batch plan preview per `_shared/fo-pipeline-conventions.md` §Batch plan preview before starting the first document.
60
+
61
+ **Progress beacon:** After completing each pipeline step, emit a one-line progress beacon per `_shared/fo-pipeline-conventions.md` §Progress beacon. The beacon is informational — it does not pause the pipeline.
62
+
57
63
  #### RFC pipeline
58
64
 
59
65
  Execute these steps **in order**, invoking each skill inline via the `skill` tool. Do not stop between steps. Do not ask the operator "shall I proceed?" between steps — the operator's invocation of this skill IS the instruction to proceed through the entire pipeline.
@@ -80,6 +86,10 @@ Invoke `fo-idea-implement` on the RFC. Pass the RFC id. Wait for it to complete.
80
86
 
81
87
  Do not invoke `fo-review` or `fo-fix` separately — they are built into `fo-idea-implement`.
82
88
 
89
+ **Step-level checkpoints:** When implementing an RFC with >=5 plan steps, perform a step checkpoint after each plan step per `_shared/fo-pipeline-conventions.md` §Step-level context checkpoint during implementation. Emit the step-checkpoint block, release completed-step context, and start the next step with a fresh plan read.
90
+
91
+ **Error checkpoint:** If a pipeline step fails after 2 auto-fix attempts, emit a structured error checkpoint per `_shared/fo-pipeline-conventions.md` §Error checkpoint for pipeline step failures. Stop the pipeline and report to the operator.
92
+
83
93
  **Fallback verification (MANDATORY).** After `fo-idea-implement` returns, verify that review and fix were actually executed:
84
94
 
85
95
  1. Check for a review report in `docs/reviews/code/` dated today or with a `diffRange` covering this session's commits.
@@ -73,7 +73,9 @@ Execute the plan's step sequence in order. For each step:
73
73
  2. **Validate** — run the step's validation command (lightweight only: `rfc.validate`, type checks, unit tests on touched files). Do **not** run heavy checks (`root build`, `build:check`, `astro:check`) during implementation — they run only after all steps are complete.
74
74
  3. **Commit** after each step or phase that produces a coherent, complete unit of work:
75
75
 
76
- ```txt
76
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
77
+
78
+ ```txt
77
79
  implement: RFC-XXXX step N — <step title>
78
80
 
79
81
  <one-line description of what was done in this step>.
@@ -64,7 +64,9 @@ If the RFC is `draft` or `reviewing` and has `enhancedAt` — the user's instruc
64
64
  3. Set `updatedAt` to today's date.
65
65
  4. Commit:
66
66
 
67
- ```txt
67
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
68
+
69
+ ```txt
68
70
  rfc: accept RFC-XXXX <short title>
69
71
 
70
72
  Transition RFC-XXXX to accepted status for planning.
@@ -36,6 +36,8 @@ Check the operator's input for:
36
36
 
37
37
  **Always** make a single call to `rfc.list --json` (no `--status` flag) and a single call to `adr.list --json`. Filter by status in memory from the returned `entries` array. Never make per-status calls.
38
38
 
39
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
40
+
39
41
  ```sh
40
42
  ref(forge.yaml bindings.commands.validateRfc) --list --json
41
43
  ref(forge.yaml bindings.commands.validateAdr) --list --json
@@ -51,14 +51,16 @@ Run the mechanical floor first — it catches type errors, lint violations, and
51
51
 
52
52
  For a single affected package:
53
53
 
54
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
55
+
54
56
  ```sh
55
- pnpm --filter <package-name> build:check
57
+ rtk pnpm --filter <package-name> build:check
56
58
  ```
57
59
 
58
60
  For an affected app:
59
61
 
60
62
  ```sh
61
- pnpm --filter <app-name> exec astro check
63
+ rtk pnpm --filter <app-name> exec astro check
62
64
  ```
63
65
 
64
66
  For cross-workspace changes, run the affected workspaces' checks individually rather than a full root build.
@@ -9,7 +9,7 @@ languagePolicy: ref(PREFERENCES.md)
9
9
  bindings:
10
10
  requires: []
11
11
  optional: [paths.invariantsFile]
12
- triggers: ["session retrospective", "capture insights from this session", "triage session discoveries"]
12
+ triggers: ["session retrospective", "capture insights from this session", "triage session discoveries", "Завершаем эту сессию", "Завершаем сессию", "Заканчиваем сессию", "Завершить сессию", "End session", "Wrap up", "Session end", "/session-end"]
13
13
  ---
14
14
 
15
15
  # Session Retro
@@ -25,6 +25,166 @@ Review the current session for discoveries that other agents would benefit from
25
25
  - **After exploring a new area** — when conventions or patterns were learned that are not yet documented.
26
26
  - **Inline by other skills** — `fo-doc-audit` or session-end workflows may delegate here for the "what did you learn?" step.
27
27
 
28
+ ### Session-end trigger phrases
29
+
30
+ When the operator says any of the following, invoke this skill via the `skill` tool BEFORE producing a closing summary:
31
+
32
+ - "Завершаем эту сессию"
33
+ - "Завершаем сессию"
34
+ - "Заканчиваем сессию"
35
+ - "Завершить сессию"
36
+ - "End session"
37
+ - "Wrap up"
38
+ - "Session end"
39
+ - "/session-end"
40
+
41
+ Do NOT produce a closing summary first — this skill IS the closing protocol. The skill's report is the session-end output. Do not add a separate "session complete" message.
42
+
43
+ ## Step 0: Save session transcript (NON-NEGOTIABLE when saveSessions is true)
44
+
45
+ This step ensures the session transcript is persisted to `docs/sessions/` before any retro work begins. Without it, the transcript is lost when the conversation closes.
46
+
47
+ ### 0a. Check preference
48
+
49
+ Read `PREFERENCES.md` at the repository root. If `saveSessions: false`, skip this step entirely and proceed to Step 1.
50
+
51
+ ### 0b. Construct raw ATIF file
52
+
53
+ The agent reconstructs the current session's conversation from its context window and writes it as a JSON-lines ATIF file to `docs/sessions/.raw/`. Each line is a JSON object with `role`, `timestamp`, and `content` fields.
54
+
55
+ **Format:**
56
+
57
+ ```
58
+ {"role":"user","timestamp":"2026-08-04T12:12:00+02:00","content":"<user message>"}
59
+ {"role":"assistant","timestamp":"2026-08-04T12:12:05+02:00","content":"<assistant response>"}
60
+ {"role":"user","timestamp":"2026-08-04T12:15:00+02:00","content":"<next user message>"}
61
+ ...
62
+ ```
63
+
64
+ **Instructions:**
65
+
66
+ 1. Create the directory `docs/sessions/.raw/` if it does not exist.
67
+ 2. Generate a timestamp-based filename: `<YYYY-MM-DD-HH-MM-SS>-session.atif` (use current time in the operator's timezone).
68
+ 3. Reconstruct the conversation from context — include every user message and assistant response you can recall from the current session, in chronological order. This is a best-effort reconstruction: the agent's context window is the source, not an external export tool.
69
+ 4. **Redact sensitive information** — remove API keys, passwords, PII, and secret values before writing. Replace with `<redacted>`.
70
+ 5. **Truncate very long tool outputs** — if a tool call produced thousands of lines of output, summarize it as `<tool output truncated, N lines>` in the content field. Keep the tool call name and key results.
71
+ 6. Write the file using `write_to_file` to `docs/sessions/.raw/<timestamp>-session.atif`.
72
+
73
+ ### 0c. Run session.save
74
+
75
+ Convert the raw file to structured markdown:
76
+
77
+ ```
78
+ ref(forge.yaml bindings.commands.sessionSave)
79
+ ```
80
+
81
+ This produces a file at `docs/sessions/<id>.md` with auto-extracted metadata (RFC-ids, commit hashes, file paths, commands, session types) and a `## Transcript` section.
82
+
83
+ ### 0d. Verify
84
+
85
+ Check that the output file was created in `docs/sessions/`. If `session.save` reported "No raw files to process", the raw file was not written correctly — retry 0b.
86
+
87
+ If the save succeeded, proceed to Step 1. The saved session file will be annotated later by `fo-session-save` if the operator requests it.
88
+
89
+ ## Pre-retro steps
90
+
91
+ Before gathering insights, perform these housekeeping steps:
92
+
93
+ ### Step 1: Clean up test temp directories
94
+
95
+ Remove leftover `tmp-*` and `tmp/` directories created by unit tests anywhere in the repo:
96
+
97
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
98
+
99
+ ```bash
100
+ rtk find . -type d -name 'tmp-*' -not -path './.git/*' -exec rm -rf {} + 2>/dev/null
101
+ rtk find . -type d -name 'tmp' -not -path './.git/*' -not -path './node_modules/*' -exec rm -rf {} + 2>/dev/null
102
+ ```
103
+
104
+ This is safe to auto-run.
105
+
106
+ ### Step 2: Archive terminal documents
107
+
108
+ Run the `docs.archive` umbrella command to move terminal RFCs, ADRs, plans, audits, sessions, and missions into their respective `archive/` subdirectories:
109
+
110
+ ```bash
111
+ rtk pnpm exec forge docs.archive
112
+ ```
113
+
114
+ The command is idempotent — re-running is safe. If files were moved, commit them in step 3 as part of the clean tree check (they are "our" changes).
115
+
116
+ ### Step 3: Clean tree check (NON-NEGOTIABLE)
117
+
118
+ Verify that this session has no uncommitted changes left in the working tree. Other agents may be working in parallel, so you MUST distinguish your changes from theirs.
119
+
120
+ **3a. Collect dirty files from all git repos in the workspace:**
121
+
122
+ ```bash
123
+ # Workspace root
124
+ rtk git status --porcelain
125
+ # All active mission workpieces (glob — safe even if no matches)
126
+ for d in missions/*/workpiece; do [ -d "$d/.git" ] && echo "=== $d ===" && rtk git -C "$d" status --porcelain; done
127
+ ```
128
+
129
+ **3b. Classify each dirty file as "ours" or "theirs":**
130
+
131
+ - A file is "ours" if EITHER:
132
+ - You directly modified it via `edit`, `write_to_file`, `multi_edit`, or `edit_notebook` tools.
133
+ - You indirectly modified it by running a command (`run_command`) that generates or updates it (e.g. codegen pipelines, build commands, etc.).
134
+ - A file is "theirs" if it appears dirty but you have no record of touching it in this session. This means another parallel agent modified it. Do NOT commit, stash, or revert these files.
135
+
136
+ **3c. Commit our changes:**
137
+
138
+ - If there are "our" dirty files in the workspace root: `git add <files>` and `git commit -m "<descriptive message>"`.
139
+ - If there are "our" dirty files in a workpiece: `git -C missions/<missionId>/workpiece add <files>` and `git -C missions/<missionId>/workpiece commit -m "<descriptive message>"`.
140
+ - Use descriptive commit messages that explain what the changes are, not just "session cleanup".
141
+
142
+ **3d. Report remaining dirty files:**
143
+
144
+ - If any dirty files remain after committing ours, report them to the operator: "The following files were modified by another agent and left untouched: <list>". Then proceed.
145
+ - If the tree is now clean (or was clean from the start), proceed silently.
146
+
147
+ ### Step 4: RFC implementation verification (NON-NEGOTIABLE)
148
+
149
+ If any RFC was worked on during this session (implementation, audit, enhance, plan, or fix work), verify that each such RFC is either stamped as `implemented` or has an explicit operator-acknowledged reason for remaining in a non-terminal status. This step prevents sessions from ending with silently unfinished RFCs — the agent must either complete the stamp or obtain explicit operator consent to leave the RFC as-is.
150
+
151
+ **4a. Identify RFCs touched in this session:**
152
+
153
+ Scan the session conversation and git log for RFC IDs that were the subject of implementation work:
154
+
155
+ ```bash
156
+ # Session commits that reference RFCs (adjust --since to session start)
157
+ rtk git log --oneline --since="today 00:00:00" --grep="RFC-" -i
158
+ ```
159
+
160
+ Also scan the conversation for any `RFC-XXXX` mentions where the agent performed implementation work (code changes, test creation, validator runs, stamp commands, plan/audit/enhance steps). Exclude RFCs that were only mentioned in passing (e.g. referenced as related context but not worked on).
161
+
162
+ **4b. Check each RFC's status:**
163
+
164
+ For each identified RFC, read the frontmatter `status` field from `docs/rfcs/rfc-XXXX-*.md` (or `docs/rfcs/archive/implemented/rfc-XXXX-*.md` if already archived by Step 2).
165
+
166
+ **4c. Classify and act:**
167
+
168
+ - **Status `implemented`** — the RFC is complete. No action needed.
169
+ - **Status `rejected` or `superseded`** — terminal status, no action needed.
170
+ - **Status `accepted` (or any other non-terminal status)** — the RFC was worked on but not stamped as `implemented`. This is the state this step targets. For each such RFC, present the status to the operator and ask via `ask_user_question` (in `aiLanguage`):
171
+
172
+ | Option | Description |
173
+ | --- | --- |
174
+ | Complete now | The agent proceeds to finish the remaining `fo-idea-implement` steps (3.6–3.8: check acceptance criteria with evidence, stamp implemented). This may require running validators, fixing errors, and committing the stamp. |
175
+ | Leave as-is | The operator explicitly acknowledges the RFC remains in its current non-terminal status with unchecked acceptance criteria. No further action is taken on the RFC. |
176
+
177
+ If the operator chooses "Complete now", execute `fo-idea-implement` steps 3.6–3.8 for that RFC before proceeding. If multiple RFCs are in this state, ask about each one (or present them as a batch with `allowMultiple: true`).
178
+
179
+ **4d. Report:**
180
+
181
+ Include the RFC status verification result in the session retro report (Step 7). List:
182
+
183
+ - RFCs verified as `implemented` (count).
184
+ - RFCs left in non-terminal status by explicit operator choice (list with RFC IDs and operator's acknowledgment).
185
+
186
+ If no RFCs were worked on in this session, skip this step silently.
187
+
28
188
  ## What this skill is NOT
29
189
 
30
190
  - It is not `fo-doc-audit` — that skill checks whether existing docs are in sync with code changes. This skill captures **new knowledge** that does not yet exist in any doc.
@@ -86,6 +246,28 @@ Each discovered insight is categorized into exactly one of six types. The catego
86
246
  - Not a rule for all agents — it is specific to this operator.
87
247
  - Examples: "prefers concise responses", "works best in morning sessions", "dislikes long explanations", "responds well to visual summaries".
88
248
 
249
+ ## Insight filtering guidance
250
+
251
+ When gathering session insights, not every observation deserves to be saved. Apply this filter before presenting the triage table:
252
+
253
+ **Save as insight** — the observation is:
254
+
255
+ - A convention or rule that other agents would benefit from following (Rule).
256
+ - An architectural choice with rationale worth preserving (Decision).
257
+ - A cross-workspace invariant that could warrant DNA status (Invariant).
258
+ - A reusable code pattern worth porting (Pattern).
259
+ - A preference or behavioral insight about the operator (Operator).
260
+ - Session-local context useful for the next agent picking up this work area (Context).
261
+
262
+ **Do NOT save** — the observation is:
263
+
264
+ - A one-off fact with no future impact (e.g. "RFC-0676 was skipped due to a duplicate"). These are historical events, not knowledge. They do not help future agents work better.
265
+ - A tool quirk already documented elsewhere (check `AGENTS.md` and existing memories first).
266
+ - A transient state that will be irrelevant by the next session (e.g. "file X was dirty at session end").
267
+ - A bug that was found and fixed in the same session with no broader lesson.
268
+
269
+ When in doubt, ask: "Would another agent working in this area make a different decision if they knew this?" If the answer is no, drop it.
270
+
89
271
  ## Process
90
272
 
91
273
  ### 1. Read preferences and shared conventions
@@ -104,6 +286,8 @@ Review the current session to identify discoveries. Use in priority order:
104
286
 
105
287
  For each candidate, ask: "Would another agent working in this area benefit from knowing this?" If no, drop it. If yes, proceed to categorization.
106
288
 
289
+ **No-insights shortcut:** If zero candidates survive filtering, skip Step 3 (Categorize and present) and Step 4 (Route) entirely. Do NOT ask the operator to confirm the absence of insights — proceed directly to Step 7 (Report) with a report that states "No insights found" in the insights section. This avoids a pointless confirmation round when the session produced no durable knowledge worth capturing.
290
+
107
291
  ### 3. Categorize and present
108
292
 
109
293
  **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 «№ | Инсайт | Категория | Назначение | Действие».
@@ -198,9 +198,11 @@ The transplant mode performs real code migration via a migration-adapter registr
198
198
 
199
199
  After git init (greenfield step 6.4) or after post-setup (transplant step 6.6), commit the synced Forge and pack skills to git:
200
200
 
201
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
202
+
201
203
  ```
202
- git add .agents/skills/
203
- git commit -m "chore: sync Forge skills"
204
+ rtk git add .agents/skills/
205
+ rtk git commit -m "chore: sync Forge skills"
204
206
  ```
205
207
 
206
208
  This ensures skills are tracked in version control from the start. The commit includes only `.agents/skills/` — no other files.
@@ -217,7 +219,11 @@ Run `rtk --version` silently. If the command succeeds and reports a version, RTK
217
219
 
218
220
  If `rtk --version` fails with "command not found" or returns a different tool, proceed to installation.
219
221
 
220
- #### 6.10.2. Install RTK (Linux/macOS)
222
+ #### 6.10.2. Install RTK (cross-platform)
223
+
224
+ Detect the platform: run `process.platform` (Node.js) or check `$env:OS` (PowerShell). On Linux/macOS, use the install script. On Windows, use Cargo or a prebuilt binary.
225
+
226
+ **Linux/macOS:**
221
227
 
222
228
  Install RTK from the official repository `github.com/rtk-ai/rtk` using the install script:
223
229
 
@@ -231,7 +237,24 @@ If the install script fails (e.g. no `curl`, network restriction), try the Cargo
231
237
  cargo install --git https://github.com/rtk-ai/rtk
232
238
  ```
233
239
 
234
- If both methods fail, log the error silently (in agent logs, not shown to the operator), note RTK as "not installed" in the welcoming report, and continue to the next step. The operator can install RTK manually later.
240
+ **Windows (PowerShell):**
241
+
242
+ Primary — install via Cargo (works if Rust is installed):
243
+
244
+ ```
245
+ cargo install --git https://github.com/rtk-ai/rtk
246
+ ```
247
+
248
+ Secondary — download the prebuilt binary via PowerShell:
249
+
250
+ ```powershell
251
+ New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.cargo\bin" | Out-Null
252
+ Invoke-WebRequest -Uri "https://github.com/rtk-ai/rtk/releases/latest/download/rtk-x86_64-pc-windows-msvc.exe" -OutFile "$env:USERPROFILE\.cargo\bin\rtk.exe"
253
+ ```
254
+
255
+ If the prebuilt binary URL is unavailable or the download fails, note RTK as "not installed" and continue.
256
+
257
+ If all methods fail on any platform, log the error silently (in agent logs, not shown to the operator), note RTK as "not installed" in the welcoming report, and continue to the next step. The operator can install RTK manually later.
235
258
 
236
259
  After installation, verify with `rtk --version` and `rtk gain` — confirm the command exists and `rtk gain` shows statistics (not "command not found").
237
260
 
@@ -94,8 +94,10 @@ wsl --install -d Ubuntu
94
94
 
95
95
  After the reboot, inside Ubuntu:
96
96
 
97
+ > Commands below assume RTK is installed. To check, run `rtk --version` (this is the detection command — it is not prefixed with `rtk` because it IS an `rtk` command). If `rtk --version` fails, RTK is not installed — run all commands without the `rtk` prefix.
98
+
97
99
  ```bash
98
- sudo apt update && sudo apt install -y build-essential git curl wget jq python3 python3-pip nodejs npm
100
+ rtk sudo apt update && rtk sudo apt install -y build-essential git curl wget jq python3 python3-pip nodejs npm
99
101
  ```
100
102
 
101
103
  Note: requires a reboot.