gm-skill 2.0.1800 → 2.0.1818

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -54,17 +54,17 @@ Record only non-obvious multi-run-cost caveats; prune stale; never document the
54
54
 
55
55
  **gm's recall store (`.gm/memories/` project corpus) holds gm/rs-* method/tooling/invariants ONLY -- never target-project specifics.** A finding ABOUT a project gm merely drives ON (its paths, line numbers, `.gm/prd.yml`/`mutables.yml` contents, app internals, versions) belongs in THAT project's own `.gm` store -- pollutes every gm session's recall otherwise. Using gm != working on the driven project: scrub names/paths/state, keep only the generalizable gm-method lesson. Binds `mutable-resolve`/`prd-resolve` auto-memo too -- witness in gm-method terms, never by quoting foreign tree. (Code-side classifier reject rejected as too brittle -- false-rejects legit `.gm/prd.yml` mechanism citations -- so discipline + on-sight `memorize-prune` of foreign-specific memos is the enforcement.)
56
56
 
57
- **Every memorize run also drains AGENTS.md -- bidirectional migration, deflation is the back-pressure.** Inward-only flow bloats past budget: every `memorize-fire` session ALSO exfiltrates a few detail-heavy/single-crate/single-platform entries -- fire substance to default namespace, compress paragraph to one-line pointer, same commit. Witness: store gains fact, byte-count drops. Few per run, never wholesale; top-level rules stay, recall-reachable detail drains. `test.js checkAgentsMdBudget()` = structural byte-ceiling backstop (`recall: AGENTS.md byte-ceiling guard looper bloat`).
57
+ **Every memorize run also drains AGENTS.md -- bidirectional migration, deflation is the back-pressure.** Inward-only flow bloats past budget: every `memorize-fire` session ALSO exfiltrates a few detail-heavy/single-crate/single-platform entries -- fire substance to default namespace, compress paragraph to one-line pointer, same commit. Witness: store gains fact, byte-count drops. Few per run, never wholesale; top-level rules stay, recall-reachable detail drains. Byte-ceiling checked manually on sight, not by an automated guard (`recall: AGENTS.md byte-ceiling guard looper bloat`).
58
58
 
59
59
  ## Coding Style
60
60
 
61
- **No synthetic/unit test files, ever -- manual legwork through real code execution is the only test surface.** No `*.test.*`/`*.spec.*` files, no `test/`/`__tests__/`/`spec/` directories, no jest/mocha/vitest/pytest/unittest/junit or any assertion/mocking library, in this repo or any repo gm drives work in. Verification is running the real thing and reading the real output -- `exec_js`/`browser` witnessing a live invariant, or an addition to the single root `test.js` (<=200 lines, real services, mock-free, defined in `skills/gm/SKILL.md`). A PRD row for "add validation"/"handle edge case X" is closed by exercising that case live, never by authoring a test case that exercises it later. Rationale + measured impact on coder throughput: the recall store (`recall: synthetic-test-file coder-performance regression`). Full phase-level enforcement (PLAN's edge-case rows, EXECUTE's hard rule, VERIFY's `deviation.synthetic-test-file` gate) lives in rs-plugkit's served `instruction` prose, not duplicated here.
61
+ **No test files or test suites of any kind, ever -- manual troubleshooting and debugging through real code execution is the only verification surface.** No `*.test.*`/`*.spec.*` files, no `test/`/`__tests__/`/`spec/` directories, no jest/mocha/vitest/pytest/unittest/junit or any assertion/mocking library, in this repo or any repo gm drives work in -- and no standing root-level test file either. Verification is running the real thing and reading the real output -- `exec_js`/`browser` witnessing a live invariant, same turn as the code it checks. A PRD row for "add validation"/"handle edge case X" is closed by exercising that case live, never by authoring a test case that exercises it later. Rationale + measured impact on coder throughput: the recall store (`recall: synthetic-test-file coder-performance regression`). Full phase-level enforcement (PLAN's edge-case rows, EXECUTE's hard rule, VERIFY's adversarial corner-case sweep) lives in rs-plugkit's served `instruction` prose, not duplicated here.
62
62
 
63
- **No comments in code** -- no inline, block, or JSDoc comments anywhere (source, generated output, hooks, scripts). `test.js checkNoComments()` is the structural guard (fails on any leading `//` over tracked `.js/.mjs/.cjs`); one sighting spawns the full-tree sweep.
63
+ **No comments in code** -- no inline, block, or JSDoc comments anywhere (source, generated output, hooks, scripts). Checked manually on sight (leading `//` over tracked `.js/.mjs/.cjs`); one sighting spawns the full-tree sweep.
64
64
 
65
- **No UTF-8 BOM in any tracked source file** -- always `-Encoding utf8` (no BOM) or the `Write` tool; PowerShell defaults betray this. `test.js checkNoBom()` is the structural guard; one sighting spawns the full-tree sweep. Cause + breakage mechanics in the recall store (`recall: BOM regression incident`).
65
+ **No UTF-8 BOM in any tracked source file** -- always `-Encoding utf8` (no BOM) or the `Write` tool; PowerShell defaults betray this. Checked manually on sight; one sighting spawns the full-tree sweep. Cause + breakage mechanics in the recall store (`recall: BOM regression incident`).
66
66
 
67
- **No graphical symbols; convert to industry-standard text on sight.** Any non-ASCII decorative glyph (arrows, box/geometric glyphs, stars, dots, bullets, checks/crosses, emojis) is forbidden in all output and source -- convert it to its plain-ASCII equivalent the same turn (the word, `->`, `-`/`*`, `[x]`/`[ ]`, done/todo/pass/fail). Tell-tale-AI class: one sighting spawns the full-codebase sweep, never a one-off edit. Exempt: functional code operators (`=>`, `??`, `?.`, comparison/math), frozen changelog/git-log entries, binary stores, intentional icon-font/CSS-content product glyphs, and canonical CS/formal-logic notation in `.gm/constraints.md` / `gm-plugkit/constraints-default.md` (`.`, `->` as function-space, `|-`, set/quantifier symbols) -- these are semantic operators in a formal constraints spec, not decorative flourish. `ccsniff --glyph-discipline` flags decorative glyphs post-hoc (run each audit, like `--git-discipline`/`--search-discipline`).
67
+ **No graphical symbols; convert to industry-standard text on sight.** Any non-ASCII decorative glyph (arrows, box/geometric glyphs, stars, dots, bullets, checks/crosses, emojis) is forbidden in all output and source -- convert it to its plain-ASCII equivalent the same turn (the word, `->`, `-`/`*`, `[x]`/`[ ]`, done/todo/pass/fail). Tell-tale-AI class: one sighting spawns the full-codebase sweep, never a one-off edit. Exempt: functional code operators (`=>`, `??`, `?.`, comparison/math), frozen changelog/git-log entries, binary stores, intentional icon-font/CSS-content product glyphs. `ccsniff --glyph-discipline` flags decorative glyphs post-hoc (run each audit, like `--git-discipline`/`--search-discipline`).
68
68
 
69
69
  **Implicit, not explicit, in skill prose**: skill files elicit, never describe -- terse imperatives, no recipes/citations/manuals; boot-edge ABI (spool paths, JSON fields, verb names, deviation ids, gate names) stays explicit; SKILL.md keeps only invocation syntax, transition markers, gate conditions, constraints, exact-usage examples. Full criteria: the recall store (`recall: implicit-not-explicit skill prose criteria`).
70
70
 
@@ -72,7 +72,7 @@ Record only non-obvious multi-run-cost caveats; prune stale; never document the
72
72
 
73
73
  No build step; repo root = published artifact. `npm publish` from root ships `gm-skill` (permanent npm id; skill DIR is `skills/gm`, command is `/gm`). `package.json` `files:` pins shipped paths. `AnEntrypoint/gm-skill` = back-compat mirror, receives only `skills/gm/SKILL.md` per release.
74
74
 
75
- `bin/install.js` = canonical installer (no npx `skills` lib, no marketplace); landed dir name IS the `/command`; `test.js checkRenameAndInstaller()` = structural guard. Copy-target, four non-interactive Claude Code settings, reasoning-in-code framing, guard assertions: the recall store (`recall: gm installer detail`).
75
+ `bin/install.js` = canonical installer (no npx `skills` lib, no marketplace); landed dir name IS the `/command`; verified by manually running the installer and checking the landed tree, not an automated guard. Copy-target, four non-interactive Claude Code settings, reasoning-in-code framing: the recall store (`recall: gm installer detail`).
76
76
 
77
77
  ## The agent is the orchestrator; plugkit is the brain it drives
78
78
 
@@ -88,6 +88,8 @@ Every skill's `allowed-tools:` reduced to `Skill, Read, Write` (plus SKILL.md bo
88
88
 
89
89
  **Subagent/Workflow-agent prompts delegate, never restate.** Any `Agent()` tool call or `Workflow` script `agent()`/`pipeline()`/`parallel()` call dispatching gm-driven work says only "use the gm skill for this" (or equivalent minimal pointer) plus the task-specific content -- target repo/path, what to investigate, what to report. Never inline verb names, spool paths, JSON body shapes, or phase-chain mechanics into the prompt string: `Skill(skill="gm")` already supplies all of that on invocation, so restating it is instructional content living outside plugkit+skill, the exact drift this file's own tool-surface rule exists to prevent. Applies identically to both surfaces -- a Workflow script author writing full gm-protocol prose into an `agent()` prompt is the same violation as an `Agent()` call doing it.
90
90
 
91
+ A task that reduces to read/investigate/report, or a change confined to files the subagent owns for the turn, dispatches straight through -- stating the read-only boundary explicitly ("report only, no writes") is task-scope, not gm-protocol restatement, so it's not a violation of the rule above. A task whose plain description asks for an irreversible or shared-state-affecting action (delete data, force-push, merge/close a PR, deploy, rename a shared branch) is not silently handed off -- name the risk in the prompt and require the subagent to surface it back rather than execute it, the same blast-radius judgment the top-level agent applies to its own actions; the action still routes through the gm-driven skill invocation, never a prompt-authored imperative sequence that bypasses it. Contrast: "find every caller of X and summarize" dispatches as-is; "drop the staging table and reseed it" gets confirmed before any subagent is scoped to carry it out.
92
+
91
93
  ## Core Rules
92
94
 
93
95
  **Memory is human-readable md, tracked; derived stores are transient, never tracked**: canonical memory = `.gm/memories/<key>.md` (project facts) + `.gm/disciplines/<name>/memories/<key>.md` (transferable discipline knowledge), frontmatter `key/ns/created/updated`, UTF-8 no BOM, LF -- text shares cross-machine/session/CI as reviewable diffs. The md read path is live (recall serves the md-derived index once a project's corpus digest converges); legacy flat-JSON KV (`.gm/disciplines/<ns>/*.json`) is a frozen fallback + embedding-reuse source, tracked until the flat-write-removal follow-up retires it. Derived state (embeddings/`*-vec`, codeinsight manifests/digests, local sqlite/index dbs) is rebuildable-from-corpus, listed one-by-one between managed gitignore markers (parent-re-include caveat). Entry list + `ensureGitignored` mechanics: the recall store (`recall: gm managed-gitignore mechanics`). Project-local persistent state -> `.gm/<name>/`, never top-level dotfile/dotdir.
@@ -102,9 +104,9 @@ Every skill's `allowed-tools:` reduced to `Skill, Read, Write` (plus SKILL.md bo
102
104
 
103
105
  **Every residual is triaged this turn, never named-and-deferred**: every `git status --porcelain` entry at residual-scan/COMPLETE-attempt triaged now -- (a) commit (real work), (b) managed-gitignore-block (transient runtime emission, e.g. `.gm/witness/`, `.gm/exec-spool/.*-stale.json`), (c) revert (junk). "Pre-existing" = the (a)/(c) outcome, never a stop excuse. `blockedBy: external` admissible only when triage needs unreachable authority; local-tree files always agent-authoritative. Disciplines + new memorize-fire `mem-*.json` committed. Managed block (`# >>> plugkit managed` markers) carries only zero-future-read-value runtime artifacts.
104
106
 
105
- **"Every possible" is the load-bearing test, applied to every noun the request names**: PLAN-phase PRD = exhaustive, not minimal -- "every possible" task/validation/mutable/corner-case/caveat/failure-mode/interaction/empty-overflow-reentry/degenerate-input -> rows. Single-digit PRD on non-trivial request = enumeration unfinished. Second-pass transform: each row's every-possible-corner-case -> new rows; close only when the transform yields nothing new. Validations/edge-cases/anticipated-mutables = first-class rows. High-tens-to-hundreds is the expected long-horizon shape -- row count IS the cover's resolution. Sparse PRDs orphan work; dense PRDs make completion observable.
107
+ **"Every possible" is the load-bearing test, applied to every noun the request names** -- PRD density at PLAN, second-pass corner-case transform: the recall store (`recall: PLAN-phase PRD density rule`).
106
108
 
107
- **Every possible aspect checkable for jank is a PRD row; architecture is pliable**: at PLAN, every prompt-concerned surface -> enumerate every `jank` (immaturity/unfinished-edge/half-wired-path) across gui/ux/ui/client-state/server-state/boundary + reached surfaces, each its own row plus a per-surface profiling row and security row. `jank` = rough/unpolished/almost-done, not just bugs. Scoped to prompt's reachable closure, exhaustive within it. Every found issue spawns its own debug-repair plan same turn; every quick win spooled too. `pliable`: architectural change clearly reducing maintenance burden = spooled plan -- swap bespoke code for native/well-maintained-library ONLY when it nets a SMALLER maintained surface (heavy dep for a few lines = guarded failure mode). Fan-out = spool-native (parallel `prd-add`/`codesearch`/`exec_js`, plugkit task-spawn), never platform Task/Explore. One AI-tell design element (boilerplate flourish, over-hedged comment, generic scaffold name) spawns full-codebase sweep -- scan/per-cluster/fix-verify rows, exhaustive, never one-off.
109
+ **Every possible aspect checkable for jank is a PRD row; architecture is pliable** -- per-surface jank enumeration at PLAN, pliable-architecture guard, AI-tell sweep trigger: the recall store (`recall: jank sweep rule PLAN`).
108
110
 
109
111
  **Client-side debugging exposes globals and evaluates in-browser, never blind-restarts**: live page = the debugger (recall store: `recall: client-side-debug-globals-live-page`).
110
112
 
@@ -178,8 +180,6 @@ Session lifecycle (task/browser persistence across turn-stops, residual-scan tri
178
180
 
179
181
  Browser session state roots at the git common dir, never `process.cwd()` (worktree fan-out shares one chromium, not N): the recall store (`recall: browser session state worktree common-dir rooting`).
180
182
 
181
- **Per-project `.gm/constraints.md` is the standing decision arbiter**: seed-if-absent (bootstrap copies the bundled CS-constraints default only when missing), never overwrite on re-seed -- it is user-editable mutable config, same contract as `.gm/next-step.md`. Every design/code decision the agent makes gauges against it; the pointer rule lives in SKILL.md, this is only the existence/mechanism note. `test.js` witnesses both the seed and the no-clobber idempotency.
182
-
183
183
  ## Spool observability surface
184
184
 
185
185
  One-shot system-state probe: dispatch `plugkit health` before assuming any component broken; runtime diagnostic files at `.gm/exec-spool/` root readable directly via Read (runtime-data exception). File list + health fields: the recall store (`recall: spool runtime diagnostic files`, `recall: plugkit health verb fields`).
package/README.md CHANGED
@@ -100,7 +100,7 @@ Every tool the agent uses is a dispatch verb. No direct shell, no direct file wr
100
100
 
101
101
  ### ground truth
102
102
 
103
- No mocks, no fakes, no unit tests on disk. Real services, real responses only. The single `test.js` at project root is the integration harness; `gm-complete` runs it before allowing session end.
103
+ No mocks, no fakes, no test files or test suites on disk. Real services, real responses only -- verification is manual troubleshooting and debugging via live `exec_js`/`browser` execution, witnessed the same turn as the code it checks.
104
104
 
105
105
  ### memory
106
106
 
package/bin/bootstrap.js CHANGED
@@ -86,17 +86,6 @@ function ensureNextStepWiring(cwd) {
86
86
  }
87
87
  } catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: nextStepPath, error: e.message }); }
88
88
 
89
- const constraintsPath = path.join(gmDir, 'constraints.md');
90
- try {
91
- if (!fs.existsSync(constraintsPath)) {
92
- const defaultSrc = path.join(__dirname, '..', 'gm-plugkit', 'constraints-default.md');
93
- if (fs.existsSync(defaultSrc)) {
94
- fs.writeFileSync(constraintsPath, fs.readFileSync(defaultSrc));
95
- changes.push('seeded .gm/constraints.md');
96
- }
97
- }
98
- } catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: constraintsPath, error: e.message }); }
99
-
100
89
  const claudeMdPath = path.join(cwd, 'CLAUDE.md');
101
90
  try {
102
91
  if (!fs.existsSync(claudeMdPath)) {
package/bin/install.js CHANGED
@@ -6,7 +6,7 @@ const path = require('path');
6
6
  const os = require('os');
7
7
  const readline = require('readline');
8
8
 
9
- const SKILL_NAME = 'gm';
9
+ const BUNDLED_SKILLS = ['gm', 'wfgy-method'];
10
10
 
11
11
  function out(msg) { process.stdout.write(msg + '\n'); }
12
12
  function err(msg) { process.stderr.write(msg + '\n'); }
@@ -25,10 +25,10 @@ function homeDir() {
25
25
  return process.env.USERPROFILE || process.env.HOME || os.homedir();
26
26
  }
27
27
 
28
- function bundledSkillDir() {
28
+ function bundledSkillDir(skillName) {
29
29
  const candidates = [
30
- path.join(__dirname, '..', 'skills', SKILL_NAME),
31
- path.join(__dirname, '..', '..', 'skills', SKILL_NAME),
30
+ path.join(__dirname, '..', 'skills', skillName),
31
+ path.join(__dirname, '..', '..', 'skills', skillName),
32
32
  ];
33
33
  return candidates.find(p => { try { return fs.existsSync(path.join(p, 'SKILL.md')); } catch (_) { return false; } }) || null;
34
34
  }
@@ -51,11 +51,11 @@ function copyTree(src, dst) {
51
51
  }
52
52
  }
53
53
 
54
- function installSkillDir(skillSrc, home, projectScope) {
54
+ function installSkillDir(skillSrc, skillName, home, projectScope) {
55
55
  const installed = [];
56
56
  const roots = projectScope
57
- ? [path.join(process.cwd(), '.claude', 'skills', SKILL_NAME)]
58
- : [path.join(home, '.claude', 'skills', SKILL_NAME), path.join(home, '.agents', 'skills', SKILL_NAME)];
57
+ ? [path.join(process.cwd(), '.claude', 'skills', skillName)]
58
+ : [path.join(home, '.claude', 'skills', skillName), path.join(home, '.agents', 'skills', skillName)];
59
59
  for (const root of roots) {
60
60
  const legacy = path.join(path.dirname(root), 'gm-skill');
61
61
  try { if (fs.existsSync(legacy)) fs.rmSync(legacy, { recursive: true, force: true }); } catch (_) {}
@@ -162,10 +162,10 @@ function printHelp() {
162
162
  out('Usage:');
163
163
  out(' npx gm-skill install interactive install (offers Claude Code settings)');
164
164
  out(' npx gm-skill install --yes non-interactive install (sets Claude Code settings)');
165
- out(' npx gm-skill install --project install into ./.claude/skills/gm instead of the home dir');
165
+ out(' npx gm-skill install --project install into ./.claude/skills/ instead of the home dir');
166
166
  out('');
167
- out('Installs the gm skill (/gm) by copying its directory into ~/.claude/skills/gm and');
168
- out('~/.agents/skills/gm -- no npx "skills" library required.');
167
+ out('Installs bundled skills (gm and wfgy-method) by copying their directories into');
168
+ out('~/.claude/skills/ and ~/.agents/skills/ -- no npx "skills" library required.');
169
169
  }
170
170
 
171
171
  async function main() {
@@ -176,15 +176,19 @@ async function main() {
176
176
  const home = homeDir();
177
177
  if (!home) { err('cannot resolve home directory (HOME/USERPROFILE unset)'); return 1; }
178
178
 
179
- const skillSrc = bundledSkillDir();
180
- if (!skillSrc) { err('bundled skill directory skills/gm not found in package'); return 1; }
181
-
182
179
  const nonInteractive = flags.yes || !process.stdin.isTTY;
183
180
 
184
- const installed = installSkillDir(skillSrc, home, flags.project);
185
- if (installed.length === 0) { err('skill installation failed'); return 1; }
186
- out('Installed gm skill to:');
187
- for (const p of installed) out(' ' + p);
181
+ let anyInstalled = false;
182
+ for (const skillName of BUNDLED_SKILLS) {
183
+ const skillSrc = bundledSkillDir(skillName);
184
+ if (!skillSrc) { err(`bundled skill directory skills/${skillName} not found in package`); continue; }
185
+ const installed = installSkillDir(skillSrc, skillName, home, flags.project);
186
+ if (installed.length === 0) { err(`${skillName} skill installation failed`); continue; }
187
+ anyInstalled = true;
188
+ out(`Installed ${skillName} skill to:`);
189
+ for (const p of installed) out(' ' + p);
190
+ }
191
+ if (!anyInstalled) { err('skill installation failed'); return 1; }
188
192
 
189
193
  if (!flags.project) {
190
194
  if (seedGlobalMemory(home)) out('Seeded global memory line in ~/.claude/CLAUDE.md.');
@@ -1 +1 @@
1
- 0.1.824
1
+ 0.1.832
@@ -1 +1 @@
1
- 0e65bc3f825cb17d856407a5545fbd96793f195ae908d41d8996655f63fa4920 plugkit.wasm
1
+ 8b4b8d5e53f7a184dd331f35a3382a3428f333584851e6339fdd03a4b8887d7e plugkit.wasm
@@ -112,16 +112,6 @@ function ensureNextStepWiring(cwd) {
112
112
  }
113
113
  } catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: nextStepPath, error: e.message }); }
114
114
 
115
- const constraintsPath = path.join(gmDir, 'constraints.md');
116
- try {
117
- if (!fs.existsSync(constraintsPath)) {
118
- const defaultSrc = path.join(__dirname, 'constraints-default.md');
119
- if (fs.existsSync(defaultSrc)) {
120
- fs.writeFileSync(constraintsPath, fs.readFileSync(defaultSrc));
121
- changes.push('seeded .gm/constraints.md');
122
- }
123
- }
124
- } catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: constraintsPath, error: e.message }); }
125
115
 
126
116
  const claudeMdPath = path.join(cwd, 'CLAUDE.md');
127
117
  try {
package/gm-plugkit/cli.js CHANGED
@@ -7,6 +7,14 @@ const path = require('path');
7
7
  const cp = require('child_process');
8
8
  const { ensureReady, startSpoolDaemon, gmToolsDir, readVersionFile, ensureGmPlugkitVersionFresh } = require('./bootstrap');
9
9
 
10
+ function readUpdateAvailableMarker(dir) {
11
+ try {
12
+ const raw = JSON.parse(fs.readFileSync(path.join(dir, '.update-available.json'), 'utf-8'));
13
+ if (raw && raw.installed && raw.latest && raw.installed !== raw.latest) return raw;
14
+ } catch (_) {}
15
+ return null;
16
+ }
17
+
10
18
  const usage = `gm-plugkit -- Bootstrap and daemon-spawn for gm plugkit binary.
11
19
 
12
20
  Usage:
@@ -201,7 +209,10 @@ function writeCliError(phase, err) {
201
209
  const already = readStatus(spoolDir());
202
210
  let onDiskVersion = null;
203
211
  try { onDiskVersion = readVersionFile(); } catch (_) { onDiskVersion = null; }
204
- const versionDrifted = !!(already && onDiskVersion && already.version && already.version !== onDiskVersion);
212
+ const localVersionDrifted = !!(already && onDiskVersion && already.version && already.version !== onDiskVersion);
213
+ const remoteUpdate = already ? readUpdateAvailableMarker(spoolDir()) : null;
214
+ const remoteVersionDrifted = !!(remoteUpdate && already && already.version && already.version === remoteUpdate.installed);
215
+ const versionDrifted = localVersionDrifted || remoteVersionDrifted;
205
216
  if (statusServing(already, 12000) && !versionDrifted) {
206
217
  try { ensureGmPlugkitVersionFresh(); } catch (_) {}
207
218
  writeCliStatus({ phase: 'ready', already_serving: true, watcher_pid: already.pid });
@@ -215,8 +226,10 @@ function writeCliError(phase, err) {
215
226
  process.exit(0);
216
227
  }
217
228
  if (versionDrifted) {
218
- writeCliStatus({ phase: 'version-drift-detected', running_version: already.version, disk_version: onDiskVersion });
219
- console.error(`[gm-plugkit] running watcher (pid=${already.pid}) serves stale version ${already.version}, disk has ${onDiskVersion} -- forcing reboot`);
229
+ const targetVersion = remoteVersionDrifted ? remoteUpdate.latest : onDiskVersion;
230
+ const reason = remoteVersionDrifted ? 'npm-registry-drift' : 'local-cache-drift';
231
+ writeCliStatus({ phase: 'version-drift-detected', reason, running_version: already.version, target_version: targetVersion });
232
+ console.error(`[gm-plugkit] running watcher (pid=${already.pid}) serves stale version ${already.version}, ${reason === 'npm-registry-drift' ? 'npm' : 'disk'} has ${targetVersion} -- forcing reboot`);
220
233
  try {
221
234
  if (process.platform === 'win32') cp.execFileSync('taskkill', ['/F', '/T', '/PID', String(already.pid)], { stdio: 'ignore', windowsHide: true });
222
235
  else process.kill(already.pid, 'SIGTERM');
@@ -28,7 +28,6 @@ PRD names the writable artifacts; closure narrative goes to the commit message +
28
28
 
29
29
  ## Constraints
30
30
 
31
- Gauge every design/code decision against `.gm/constraints.md` (create from bundled default if absent) -- the standing decision-arbiter, checked at every phase.
32
31
 
33
32
  ## Dispatch
34
33
 
@@ -89,7 +89,6 @@ Write the recall index only via `memorize-fire`; surfaces outside it produce mem
89
89
 
90
90
  ## Constraints
91
91
 
92
- Gauge every design/code decision against `.gm/constraints.md` (create from bundled default if absent) -- the standing decision-arbiter, checked at every phase.
93
92
 
94
93
  ## Return to plugkit
95
94
 
@@ -46,11 +46,11 @@ Data first -- correct structures/invariants make the code write itself; convolut
46
46
 
47
47
  **Process of elimination is the debugging paradigm on every surface; manual labour against real services is how you witness.** Thinking-in-code at its sharpest: each candidate cause is a hypothesis, tested by running it, never reasoned around. No guess-and-restart, no a/b-test, no shotgun variants: enumerate candidates as mutables, eliminate each by REAL-input witness -- `exec_js` on the real service, `codesearch`/`Read` on real source, `browser`'s `page.evaluate` on a live `window.*` global. Each elimination reveals the next mutable; iterate to single-cause-survives. One live-runtime read outweighs a hundred blind restarts.
48
48
 
49
- Profile the real surface, never intuit. `exec_js`: `duration_ms` free, own timing + `process.memoryUsage()` on stdout, thrown-`stack` on stderr -- read both channels. Browser: `capture\n<script>` prefix auto-returns `{result, debug:{console, pageErrors, network, performance}}`, zero boilerplate. Slow-node-not-obvious: `exec_js opts.profile:true` / browser `profile\n<script>` prefix both return `{result, profile:{timeframe:{start_us,end_us,total_us,sample_count}, culprits:[{location,function,self_us,self_pct,hits}]}}` -- worst-N `file:line` self-time, identical shape both surfaces. Both also return `mem` (rss/heap/delta) and `wall_vs_cpu:{wall_us, offcpu_us}` -- sampler sees only on-CPU JS, large `offcpu_us` = IO/async-wait/GPU time invisible to it; tune via `opts.sampleIntervalUs`/`opts.profileTopN` (cli) or `interval=`/`topN=` (browser). Cheap non-profile path: `opts.mem:true` -> `{result, mem, wall_ms}` + structured `error:{name,message,stack}` on throw -- read `error.name` directly; default path (no `opts.mem`) byte-unchanged. CPU sampler is GPU-blind -- wall >> CPU self-time on render/canvas/WebGL -> browser `trace\n<script>` prefix opens CDP Tracing, returns `trace:{wall_us, gpu_us, viz_us, cc_us, by_category}`. Profile to LOCATE, then eliminate by live measurement. Verification is the same labour: run the real thing, witness the real output (`test.js` mock-free, live page, real service) -- never a unit/mock harness standing in for real-services witness. Apparent tooling failure is the same mechanical self-recovery-by-elimination, never a question for the user.
49
+ Profile the real surface, never intuit. `exec_js`: `duration_ms` free, own timing + `process.memoryUsage()` on stdout, thrown-`stack` on stderr -- read both channels. Browser: `capture\n<script>` prefix auto-returns `{result, debug:{console, pageErrors, network, performance}}`, zero boilerplate. Slow-node-not-obvious: `exec_js opts.profile:true` / browser `profile\n<script>` prefix both return `{result, profile:{timeframe:{start_us,end_us,total_us,sample_count}, culprits:[{location,function,self_us,self_pct,hits}]}}` -- worst-N `file:line` self-time, identical shape both surfaces. Both also return `mem` (rss/heap/delta) and `wall_vs_cpu:{wall_us, offcpu_us}` -- sampler sees only on-CPU JS, large `offcpu_us` = IO/async-wait/GPU time invisible to it; tune via `opts.sampleIntervalUs`/`opts.profileTopN` (cli) or `interval=`/`topN=` (browser). Cheap non-profile path: `opts.mem:true` -> `{result, mem, wall_ms}` + structured `error:{name,message,stack}` on throw -- read `error.name` directly; default path (no `opts.mem`) byte-unchanged. CPU sampler is GPU-blind -- wall >> CPU self-time on render/canvas/WebGL -> browser `trace\n<script>` prefix opens CDP Tracing, returns `trace:{wall_us, gpu_us, viz_us, cc_us, by_category}`. Profile to LOCATE, then eliminate by live measurement. Verification is the same labour: run the real thing, witness the real output (live page, real service) -- never a unit/mock harness standing in for real-services witness. Apparent tooling failure is the same mechanical self-recovery-by-elimination, never a question for the user.
50
50
 
51
- ## No synthetic test files (hard rule)
51
+ ## No test files, ever (hard rule)
52
52
 
53
- Never create a unit-test file, spec file, `test/`/`__tests__/`/`spec/` directory, or reach for a testing framework (jest, mocha, vitest, pytest, unittest, junit, or any assertion/mocking library) to satisfy a PRD row -- doing so IS the deviation this rule exists to name, not a reasonable interpretation of "add coverage." A row asking for validation/edge-case handling is satisfied by: (a) the code path itself, exercised live via `exec_js`/`browser` with the output witnessed in the response, or (b) a real-services addition to the single root `test.js` (VERIFY's Integration witness, <=200 lines, mock-free). If `test.js` does not yet exist for a project needing one, `EMIT` creates that one file -- never a second test file beside it. Discovering an existing mock-heavy `test/` directory mid-EXECUTE is itself a PRD row: consolidate its real-service assertions into `test.js`, delete the rest, `prd-add` it now rather than adding to it.
53
+ Never create a unit-test file, spec file, `test/`/`__tests__/`/`spec/` directory, a standing root-level test file, or reach for a testing framework (jest, mocha, vitest, pytest, unittest, junit, or any assertion/mocking library) to satisfy a PRD row -- doing so IS the deviation this rule exists to name, not a reasonable interpretation of "add coverage." A row asking for validation/edge-case handling is satisfied by the code path itself, exercised live via `exec_js`/`browser` with the output witnessed in the response -- manual troubleshooting and debugging is the entire verification surface. Discovering an existing test directory or test file mid-EXECUTE is itself a PRD row: delete it, replace its assertions with live witness dispatches, `prd-add` it now rather than adding to it.
54
54
 
55
55
  ## Memorize
56
56
 
@@ -58,7 +58,6 @@ Write the recall index only via `memorize-fire`; other surfaces produce memos th
58
58
 
59
59
  ## Constraints
60
60
 
61
- Gauge every design/code decision against `.gm/constraints.md` (create from bundled default if absent) -- the standing decision-arbiter, checked at every phase.
62
61
 
63
62
  ## Dispatch
64
63
 
@@ -24,7 +24,7 @@ PRD = `|F|=1` plan-item store: enumerate every node in the destructive transform
24
24
 
25
25
  Second transform over the first pass: for each row, corner case/caveat/failure mode/adjacent-row interaction/degenerate input/empty-overflow-reentry state -> new row. Validations, edge cases, anticipated mutables are first-class rows. Closes when "every possible" yields nothing new, not on feeling done. 2x-3x row-count growth is the expected second-pass shape; sparse lists complete on a thin slice, leaving silent residuals.
26
26
 
27
- **A validation/edge-case row is closed by real execution, never by a new test file.** The row's satisfaction is an `exec_js`/`browser` dispatch witnessing the case live, or an addition to the single root `test.js` real-services witness -- never a new `*.test.js`/`*.spec.js`, never a `test/` or `__tests__/` directory, never pulling in jest/mocha/vitest/pytest/unittest or any assertion/mocking library. Enumerating edge cases at PLAN is not license to author a suite for them at EXECUTE; see VERIFY's Adversarial corner-case sweep for how each class actually gets witnessed.
27
+ **A validation/edge-case row is closed by real execution, never by a test file.** The row's satisfaction is an `exec_js`/`browser` dispatch witnessing the case live -- never a `*.test.js`/`*.spec.js` file, never a `test/` or `__tests__/` directory, never pulling in jest/mocha/vitest/pytest/unittest or any assertion/mocking library, and never a standing test file of any kind. Enumerating edge cases at PLAN is not license to author a suite for them at EXECUTE; see VERIFY's Adversarial corner-case sweep for how each class actually gets witnessed.
28
28
 
29
29
  Cut the cover hardest-node-first: the row exercising the most failure modes at once (concurrency + partial failure + real input, colliding) proves the design early, while re-cutting is still cheap -- schedule it last and you validate nothing until reshaping is too late.
30
30
 
@@ -38,7 +38,6 @@ Unknowns -> `.gm/mutables.yml` via `mutable-add`, `status: unknown`, witness = `
38
38
 
39
39
  ## Constraints
40
40
 
41
- Gauge every design/code decision against `.gm/constraints.md` (create from bundled default if absent) -- the standing decision-arbiter, checked at every phase.
42
41
 
43
42
  ## Dispatch
44
43
 
@@ -33,11 +33,11 @@ VERIFY is adversarial, never confirmatory: hunt every way EMIT's write breaks, v
33
33
 
34
34
  Each class exercised = exec_js/browser dispatch + witness (pass or fix-then-rewitness), same turn, before `transition`. A happy-path-only VERIFY has not verified.
35
35
 
36
- ## Integration witness
36
+ ## Real-execution witness
37
37
 
38
- `test.js` at root, 200-line ceiling, real services only (mock-free) -- the single witness IS the test surface, proving a full real session end-to-end. Not one gate beside a conventional unit suite: a growing mock-heavy multi-file `test/` is the pattern gm replaces, never a coexisting exemption; the cap does not bless a parallel suite. More than the single real-services witness needs justifying, never default. Pass = integration witness; fail -> `transition` back to EXECUTE. `recursive` classifier = incomplete cover -- snake back, do not narrate past signal.
38
+ Every claim of correctness is proven by a live `exec_js`/`browser` dispatch witnessing the real output, same turn, real services only (mock-free) -- manual troubleshooting and debugging is the entire verification surface, never a standing test file or suite. Pass = the live witness matches expectation; fail -> `transition` back to EXECUTE. `recursive` classifier = incomplete cover -- snake back, do not narrate past signal.
39
39
 
40
- **No unit tests, no exceptions.** A `deviation.synthetic-test-file` at VERIFY (new `*.test.*`/`*.spec.*`, a `test/`/`__tests__/` directory, or a testing-framework import found in the diff) blocks `transition` exactly like an unwitnessed mutable -- fold its assertions into `test.js` or replace them with a live `exec_js`/`browser` witness, then re-verify. This is manual legwork, not framework legwork: the adversarial corner-case sweep above is how every class gets exercised, by running the real thing, never by writing a test case that runs it later.
40
+ **No test files, no exceptions.** A `deviation.synthetic-test-file` at VERIFY (new `*.test.*`/`*.spec.*`, a `test/`/`__tests__/` directory, a testing-framework import, or any standing root-level test file found in the diff) blocks `transition` exactly like an unwitnessed mutable -- delete it and replace its assertions with a live `exec_js`/`browser` witness, then re-verify. This is manual legwork, not framework legwork: the adversarial corner-case sweep above is how every class gets exercised, by running the real thing, never by writing a test case that runs it later.
41
41
 
42
42
  ## Residual-scan
43
43
 
@@ -75,7 +75,6 @@ rs-learn never calls a model; it emits the need, you supply the answer. Skipping
75
75
 
76
76
  ## Constraints
77
77
 
78
- Gauge every design/code decision against `.gm/constraints.md` (create from bundled default if absent) -- the standing decision-arbiter, checked at every phase.
79
78
 
80
79
  ## Dispatch
81
80
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1800",
3
+ "version": "2.0.1818",
4
4
  "description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1 +1 @@
1
- 0.1.824
1
+ 0.1.832
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1800",
3
+ "version": "2.0.1818",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "plugkitVersion": "0.1.824"
20
+ "plugkitVersion": "0.1.832"
21
21
  }
@@ -697,19 +697,6 @@ function ensureNextStepWiring(cwd) {
697
697
  emitBootstrapEvent('warn', 'Failed to seed .gm/next-step.md', { error: e.message });
698
698
  }
699
699
 
700
- const constraintsPath = path.join(gmDir, 'constraints.md');
701
- try {
702
- if (!fs.existsSync(constraintsPath)) {
703
- const defaultSrc = path.join(__dirname, '..', 'gm-plugkit', 'constraints-default.md');
704
- if (fs.existsSync(defaultSrc)) {
705
- fs.writeFileSync(constraintsPath, fs.readFileSync(defaultSrc));
706
- emitBootstrapEvent('info', 'Seeded .gm/constraints.md', { path: constraintsPath });
707
- }
708
- }
709
- } catch (e) {
710
- emitBootstrapEvent('warn', 'Failed to seed .gm/constraints.md', { error: e.message });
711
- }
712
-
713
700
  const claudeMdPath = path.join(cwd, 'CLAUDE.md');
714
701
  try {
715
702
  if (!fs.existsSync(claudeMdPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1800",
3
+ "version": "2.0.1818",
4
4
  "description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -23,6 +23,8 @@
23
23
  },
24
24
  "main": "bin/bootstrap.js",
25
25
  "bin": {
26
+ "gm": "./bin/install.js",
27
+ "gm-skill": "./bin/install.js",
26
28
  "gm-skill-bootstrap": "./bin/bootstrap.js",
27
29
  "gm-install": "./bin/install.js"
28
30
  },
@@ -6,42 +6,37 @@ allowed-tools: Skill, Read, Write, Bash(bun *), Bash(npx *)
6
6
 
7
7
  # gm
8
8
 
9
- **No tool call = stop; mid-chain stop = cardinal failure.** Agents read only tool calls + outputs -- prose-only turn ends the session. In-flight (phase != COMPLETE OR prd_pending_count > 0): every turn ends in a chain-advancing dispatch (`instruction`, the named next verb, or `transition`). No summaries, no "here's what I did," no closure narration. A turn-final sentence naming the next move instead of taking it is the same stop -- take the move. Surface decisions via `AskUserQuestion` or `prd-add`, never prose. Stop-urge: dispatch `phase-status`; non-terminal -> `instruction`, keep walking. Only `phase=COMPLETE` AND `prd_pending_count=0` authorizes prose-only.
9
+ **Dispatch gates stop mid-chain.** `phase != COMPLETE OR prd_pending_count > 0` means in-flight work remains. No tool calls = turn ends; prose-only turns stop. To continue: dispatch `instruction`, named spool verb, or `transition`. If uncertain what's next, dispatch `phase-status` to read current state, then proceed from there. `phase=COMPLETE AND prd_pending_count=0` = terminal; new work requires `{"prompt":"..."}` from user.
10
10
 
11
- **Done = plugkit's word, never yours.** COMPLETE gate is sole arbiter; not-COMPLETE = next transition to seek; idle mid-chain = deviation.
11
+ Phase state is in `.gm/exec-spool/.turn-summary.json` or plugkit responses: `phase` field. COMPLETE = terminal. PLAN/EXECUTE/EMIT/VERIFY/CONSOLIDATE = in-flight. Next action depends on phase and `prd_pending_count`.
12
12
 
13
- **Standing approval: finish everything, max granularity.** Every session pre-approved through ALL requested work -- plan, every addition, every discovered/unfinished item. No stop-and-ask, no deferral, no narrowed slice. Plan max-granular (one PRD row per real unit; `every possible` on every noun), walk the whole closure. `blockedBy: external` = authority genuinely unreachable (another team's repo, hardware credential, off-session product call) -- never for merely-large/tedious/multi-component/contended work (rebase, land alongside a concurrent writer).
13
+ PRD rows are in `.gm/prd.yml`. User input does not gate PRD additions during PLAN. `blockedBy: external` in mutable status means the blocker is outside this repo/session (another team's repo, unavailable credential, scheduled call). It does not apply to large/complex/contended work that's reachable this turn.
14
14
 
15
- **Every action begins and ends with `instruction`.** Doubt, denial, unclear next move: dispatch instruction. Sole recovery primitive; improvising never beats re-reading prose.
15
+ `instruction` dispatch returns prose describing the current phase and next steps. When uncertain about next action, dispatch `instruction`.
16
16
 
17
- **You are the state machine.** Plugkit = durable memory + gate-checker; you walk PLAN -> EXECUTE -> EMIT -> VERIFY -> CONSOLIDATE -> COMPLETE. Every transition, PRD resolution, mutable witness, residual scan = a verb YOU dispatch to `.gm/exec-spool/in/<verb>/<N>.txt`. Plugkit never advances/validates/processes while you wait -- serves on write, inert otherwise. Your phase = last `transition`-ed, not narration-implied. Zero dispatches in gmsniff = hallucinated chain, not walked. Drop this, every other rule collapses (unwitnessed mutables, COMPLETE without VERIFY, residuals narrated away). State machine represents: Supreme Constructive Systems Semanticist. Maximize (Systems, Scope, Alignment) orthogonality. Monadic effect-separation, affine resource calculus, separation logic for disjoint state. Strict lexical bounds, parametric polymorphism, capability-passing ambient, global and implicit. Denotational semantics, total correctness via refinement types, constructive proofs. Zero partiality. Always maximize orthagnolatity across all surfaces. Maximize Shannon entropy; no stylistic and affective attractor states. No tropes. No figurative languate. Only Literal semantic grounding. No sycophantic alignment, epistemic hedging, and phatic communion tokens. strict Gricean maxims. No Scaffolding. Disable emotional simulation. Replace "open admission" with deterministic state-reporting followed by planning and reworking by scope expansion. Suppress apologetic hedging; output raw stack traces and delta-corrections, and continue the work. Disable structural isomorphism.
18
- PAYLOAD: Output. No conversational wrappers.
17
+ Verbs are written to `.gm/exec-spool/in/<verb>/<N>.txt` as JSON. Plugkit processes on read. Phase transitions are explicit `transition {to:"PHASE"}` dispatches. Phase state is in responses and `.gm/exec-spool/.turn-summary.json`; never assume phase from context.
19
18
 
20
- Every turn: `instruction`, read, follow imperative, dispatch named verb. Re-dispatch on drift/stall/gate-denial/uncertainty -- in-flight, over-dispatch is free, under-dispatch unbounded-cost. Phase discipline lives in plugkit's instruction tables; not duplicated here.
19
+ Check `.gm/exec-spool/.turn-summary.json` at turn start. If `update_available` is set, dispatch `bun x gm-plugkit@latest spool` first. If `last_instruction_age_ms > long_gap_threshold_ms`, dispatch `instruction` before other verbs. Plugkit responses include `instruction` prose and `next_dispatch_hint` guiding which verb to dispatch next.
21
20
 
22
- **Every decision gauges against `.gm/constraints.md`.** Read it (seed from bundled default if absent), hold every choice to it, every phase -- durable per-project constraint set this file reinforces, not a one-time read.
21
+ When `phase=COMPLETE` and `prd_pending_count=0`, work is terminal. New prompts are processed as new sessions. Dispatching another `instruction` after terminal state records as `deviation.complete-chain-poll`.
23
22
 
24
- **`phase=COMPLETE` AND `prd_pending_count=0` = closed, stop dispatching.** Re-polling `instruction`/`phase-status` on a terminal chain = `complete-chain-poll` deviation. A new user prompt (`{"prompt":"..."}`) reopens to PLAN; if first `instruction` on intended-new work still returns COMPLETE/UPDATE-DOCS, dispatch `transition to=PLAN` **once** (authorized new work, not a poll).
23
+ Client file edits (`.html .js .jsx .ts .tsx .vue .svelte .mjs .css` or HTML-loaded) are tracked in `.turn-browser-edits.json`. `browser` dispatch witnesses them via `page.evaluate`. `transition to=COMPLETE` gate checks `.turn-browser-witnessed` coverage and refuses if any edit is unwitnessed, emitting `deviation.client-edit-no-witness`.
25
24
 
26
- **Client-side edits gate on Browser Witness (hard rule).** Write/Edit any client file (`.html .js .jsx .ts .tsx .vue .svelte .mjs .css`, or HTML-entry-loaded) -> same turn needs a `browser` verb whose `page.evaluate` asserts the edit's invariant. `transition to=COMPLETE` refuses until `.turn-browser-witnessed` covers every `.turn-browser-edits.json` entry by sha, else `deviation.client-edit-no-witness`. No validate-later.
25
+ `browser` dispatch can expose state as `window.*` and read it via `page.evaluate`. This surface can both diagnose problems and witness correctness in the same dispatch.
27
26
 
28
- **Live page = the debugger.** Expose state as `window.*`, read live via `browser`'s `page.evaluate`, experiment in-page. Global + one evaluate reads real runtime state in one dispatch; restart-and-eyeball observes near-nothing and burns a turn. Same `browser` surface witnesses and diagnoses.
27
+ Code/file/symbol lookup uses `codesearch` (`{"query":"..."}`) or `recall` (prior knowledge from memory). `codesearch` indexes the current working directory only. Sibling repos or known paths use `Read` or `exec_js` directly. Cross-repo queries return nothing by design.
29
28
 
30
- **Search routes through spool, never a platform search agent.** Any code/file/symbol lookup = `codesearch` (`{"query":"..."}`); prior knowledge = `recall`. Never platform Explore, Task/general-purpose search subagent, raw `grep`/`Glob` -- they bypass spool, committed index, recall-grounding, don't transport across harnesses. PLAN-orient = `recall` + `codesearch` parallel; every mid-EXECUTE lookup = `codesearch` too. `codesearch` indexes CURRENT cwd only -- sibling-repo/other-checkout source = `Read`/`exec_js` by path, never expected from `codesearch` (cross-repo query returns nothing by design).
29
+ Spool verbs are the primary interface: `codesearch`, `recall`, `fetch`, `exec_js`, `browser`, `memorize-fire`, git verbs (`git_status`, `git_log`, `git_diff`, `git_show`, `git_branch`, `git_add`, `git_commit`, `git_finalize`, `git_push`, `git_checkout`, `git_fetch`, `git_rm`, `git_revert`, `git_reset`). Git operations via Bash/PowerShell are recorded as `deviation.bash-git-bypass`. `git_finalize {message}` bundles add->commit->porcelain-gate->push in one dispatch.
31
30
 
32
- **Class rule: platform-native capability with a plugkit verb -> forbidden, use the verb.** search -> `codesearch`; prior knowledge -> `recall`; URL/web -> `fetch`; run code -> `exec_js`; browser -> `browser`; persist memory -> `memorize-fire`; **any git op -> git verbs** (`git_status`/`git_log`/`git_diff`/`git_show`/`git_branch` inspect; `git_add`/`git_commit`/`git_finalize`/`git_push` stage-commit-push; `git_checkout`/`git_fetch`/`git_rm`/`git_revert`/`git_reset` mutate). `git_finalize {message}` bundles add->commit->porcelain-gate->push, one dispatch, CONSOLIDATE's push surface; `bash`/`sh`/`powershell` invoking git = gated (`deviation.bash-git-bypass`). Native tool bypasses ledger, index, portability. No verb exists = missing verb to add, not license to bypass.
31
+ Missing `.gm/exec-spool` on first use is normal. Boot the watcher before dispatching work.
33
32
 
34
- **gm is real infrastructure, not lore -- a missing `.gm/exec-spool` is an unbootstrapped repo, never grounds to declare the framework fictional.** First use in any repo: no `.gm/` directory yet is the NORMAL, EXPECTED state, identical in shape to a dead watcher -- the same one boot command below creates the directory tree, fetches the sha256-pinned `plugkit.wasm`, and starts serving, same as it does on the 1000th repo. Concluding "no spool dir = framework doesn't exist / isn't appropriate here" without running the boot command is asserting a claim you could witness in one dispatch and chose not to -- an unwitnessed prose conclusion, the exact anti-shape this file exists to prevent. If a request seems out of scope for gm (e.g. a manual read-only audit), that is a real judgment call to surface to the user -- but it is never grounds to skip booting and declare the tool imaginary; boot it, dispatch one `instruction`, and let the real response inform the judgment.
35
-
36
- **Boot before dispatching.** Writing `instruction/N.txt` to a dead watcher silently drops the request; you'd fabricate the chain from memory. Spool dir existing != watcher alive; `.status.json` `ts` within 15s does (stale leftover `.status.json` = common trap). First tool call, every session, the boot probe, one Bash call:
33
+ Boot probe at session start, one Bash call:
37
34
 
38
35
  ```bash
39
36
  cat .gm/exec-spool/.status.json 2>/dev/null; echo ---; cat .gm/exec-spool/.turn-summary.json 2>/dev/null; echo ---; date +%s%3N
40
37
  ```
41
38
 
42
- `.turn-summary.json`: `phase`, `last_skill`, `prd_pending`, `last_instruction_ts`, `last_instruction_age_ms`, `long_gap_threshold_ms`, `browser_sessions_alive`, `update_available`, `deviations_30m`, `watcher_uptime_ms`. Age over threshold -> next non-orienting verb gated, dispatch `instruction` first. **`update_available` non-null (this turn's `.turn-summary.json` or any `instruction` response): FIRST action, before any other work this turn, is `bun x gm-plugkit@latest spool` (idempotent, safe already-serving) -- never "keep working, it clears on its own."** `--kill-stale-watchers` only if stuck across several turns after forcing. `PLUGKIT_NO_AUTO_UPDATE=1` pins version. `deviations_30m` non-zero = active drift to investigate first.
43
-
44
- Compare `.status.json` `ts` to printed epoch: gap > 15000 = dead, boot it. Exception: future `busy_until` = long verb in flight (browser/chromium spawn blocks heartbeat ~15-18s) -- wait, don't boot a second watcher.
39
+ `.turn-summary.json` fields: `phase`, `prd_pending`, `last_instruction_age_ms`, `long_gap_threshold_ms`, `update_available`, `deviations_30m`. If `update_available` is set, dispatch `bun x gm-plugkit@latest spool`. If `last_instruction_age_ms` exceeds `long_gap_threshold_ms`, dispatch `instruction` before other verbs. `.status.json` `ts` within 15s = watcher alive; gap > 15s = dead. Exception: if `busy_until` is in the future, watcher is handling a long verb (browser, chromium spawn).
45
40
 
46
41
  ```bash
47
42
  bun x gm-plugkit@latest spool
@@ -49,68 +44,28 @@ bun x gm-plugkit@latest spool
49
44
 
50
45
  (`npx -y gm-plugkit@latest spool` if no `bun`.) Atomic: daemonizes watcher, blocks until `.status.json` heartbeats fresh, returns only on serving (exit 0) or loud timeout. No `&`, no `sleep`, no re-`cat` -- returns, you write to `instruction/` directly. (Already-alive watcher returns at once.)
51
46
 
52
- **Dispatch shape: Write request + Read response, SAME tool-call block.** `Write .gm/exec-spool/in/instruction/<N>.txt` AND `Read .gm/exec-spool/out/instruction-<N>.json` (or `out/<N>.json` nested) in one block. First-read "file does not exist" mid-verb = normal, re-Read next message. Never proceed/narrate/begin work before reading response and following its `instruction` field. Never poll with `sleep && ls`: plugkit is synchronous -- missing response = dead watcher (recheck `ts`) or slow verb (check `.gm/exec-spool/.watcher.log`), never "still processing."
53
-
54
- **Dead-watcher recovery is mandatory.** Two consecutive missing re-Reads AND stale `ts` (>15s) AND no future `busy_until` = dead: `bun x gm-plugkit@latest spool` boots fresh, re-dispatch original verb. Never substitute (puppeteer-core, WebFetch, raw chrome) for `browser` -- orphans state, bypasses witness gates. Recovery = notice-dead -> boot -> re-dispatch, always.
55
-
56
- **Apparent tooling failure is never grounds to ask the user, never a/b-test or blind-restart.** "Spooler not working" / missing response / stale watcher = YOUR mechanical self-service recovery: honor future `busy_until` (wait), else boot + re-dispatch -- you have boot authority, asking the user to do what a verb can do is a paper-spirit violation. Spooler is sound by construction (`.status.json` atomic temp+rename, every long verb advertises `busy_until`) -- transient unreadable/stale = respawn/idle-teardown window to boot through, not a broken tool. Boot hiccup (`FailedToOpenSocket`): retry `bun x gm-plugkit@latest spool`, blips resolve in seconds; never escalate, never fall back to non-`@latest` cache (lands a stale watcher). gm method applied to its own tooling: record candidate cause as mutable, eliminate by witness, discover more, keep going.
57
-
58
- **Debug live page via globals + process-of-elimination, never guess-and-restart or a/b test.** Surface state as `window.*`, read live via `browser`'s `page.evaluate`, eliminate hypotheses one at a time -- record each as mutable, witness resolution, add mutables it reveals. Record-eliminate-discover is the core loop, browser most of all.
59
-
60
- **gm profiles/debugs both surfaces -- measure, never eyeball.** Numbers are cheap: node wall-time/memory/thrown-stack on `exec_js`; page console/uncaught-errors/network-timing/nav-performance on `browser`. Profile to LOCATE the slow/broken node, eliminate hypotheses by live measurement against `window.*` globals -- never guess-and-restart. Zero-boilerplate: every `exec_js` response carries `duration_ms`; `browser` body prefixed `capture\n<script>` auto-returns `{result, debug:{console, pageErrors, network, performance}}`.
61
-
62
- From PowerShell, write spool input UTF-8 no-BOM (`-Encoding utf8` or `[System.IO.File]::WriteAllText`) -- 5.1 default UTF-16+BOM trips `spool.body-encoding-recoded`. Prefer `Write` tool for JSON bodies. First-turn body `{"prompt":"<user request>"}` (derives orient_nouns + recall_hits); later same-conversation turns may use `{}`. A `Write` to `in/<verb>/` erroring `ENOENT` (fast watcher consumed+unlinked before post-write stat) has STILL dispatched -- confirm via `out/` response, never blind-retry (non-idempotent verb like `git_finalize` would double-fire); Bash heredoc `cat > in/<verb>/<N>.txt` has no post-write stat, never surfaces this.
63
-
64
- **Batch writes+reads together -- one block is default, serial single-dispatch is drift.** Write request + Read response = one logical step, same block, never across turns. Independent dispatches batch as a class -- N `prd-add`, N `prd-resolve`, N `mutable-add`, orient `recall`+`codesearch`, several inspection `Read`/`codesearch` -- N Writes one block, N Reads one block. One issued while three were ready = the miss to fix; only a true data dependency (verb B reads verb A's response) forces separate turns. Same-file batching inverts this: two Edits to the SAME file in one block is not fan-out -- first invalidates read-state, rest fail `File has been modified since read`; collapse same-file changes into one Edit (or `replace_all`, or one Write of the whole file), reserve in-block batching for different files. Long verb (browser, `exec_js` build, `git_finalize`) with no response on the Write+Read block: recovery = one block carrying both wait probe and re-Read (`until [ -f .gm/exec-spool/out/<verb>-<N>.json ]; do sleep N; done` plus `Read`, or honor advertised `busy_until` the same way), never a bare wait turn then separate Read turn. Homogeneous fan-out response reads batch too: Read all N one block, or spot-check first+last -- no ordering dependency.
65
-
66
- Chain isn't COMPLETE until changes are on origin. Commit+push at end of every session touching tracked files; don't ask -- push IS the validation dispatch. Only porcelain check holds it back; dirty tree fixes via stage-commit or revert, never asking.
67
-
68
- **No synthetic tests, ever -- manual legwork via real execution is the only verification.** Never write a `*.test.*`/`*.spec.*` file, a `test/`/`__tests__/`/`spec/` directory, or reach for jest/mocha/vitest/pytest/unittest/junit or any assertion/mocking library, in this repo or any repo you drive work in through gm -- for ANY PRD row, including edge cases and validations enumerated at PLAN. Verification is running the real thing and reading the real output: `exec_js`/`browser` witnessing a live invariant, same turn as the code it checks. One `test.js` at repo root, <=200 lines, real services (mock-free) -- proves a full real session end-to-end, IS the entire test surface, never a parallel suite beside it. Finding an existing mock-heavy `test/` -> `prd-add` consolidating its real-service assertions into `test.js` and deleting the rest, now, not deferred. More than the single witness = a re-scope to justify, not default.
69
-
70
- **Every residual triaged this turn; "pre-existing" is not a stop excuse.** Non-empty `git status --porcelain`: every entry is yours now -- commit (real work), ignore via managed block (transient runtime emission), or revert (stale junk). "Pre-existing" only names the triage outcome. `blockedBy: external` only when triage needs outside authority. `.gm/disciplines/` and new memorize-fire JSON tracked+committed; `.gm/witness/` and transient staleness markers go in the managed gitignore block.
71
-
72
- **Apply "every possible" to every noun.** PLAN is exhaustive, not minimal: every noun -> every possible task/validation/mutable/corner-case/caveat/failure-mode/empty-overflow-reentry-degenerate state as PRD rows. Single-digit PRD on non-trivial request = stopped early. Second pass: feed list back, each row's corner cases become new rows; close when "every possible" yields nothing new. Long-horizon prompts routinely produce high-tens-to-hundreds of rows -- density at PLAN is the only protection against silent residuals at COMPLETE. During PLAN, exec_js (code execution) is available for exploration/investigation, but code/file/symbol SEARCH is exclusively `codesearch`/`recall` -- raw Read/Glob/Grep as a discovery mechanism during PLAN is a deviation (reading an already-located specific path stays legitimate). Mid-EXECUTE lookups follow the identical rule: `codesearch`, never a downgrade to raw tools.
73
-
74
- **Sweep every possible aspect for jank, each aspect a PRD row.** Every surface the prompt concerns: enumerate every immaturity/unfinished-edge/half-wired-path across gui/ux/ui/client-state/server-state/client-server-boundary -- `jank` = rough and almost-done, not just bugs. Each a row, plus a profiling row and a security row per surface. Scoped to the prompt's reachable closure, exhaustive within it. Every issue found spawns its own debug-and-repair rows same turn. Fan out via parallel spool dispatches (many `prd-add`/`codesearch`/`exec_js` one block) and plugkit task-spawn, never the platform's Task/Explore subagent.
75
-
76
- **One tell-tale AI design element spawns a full-codebase sweep.** Boilerplate flourish, over-hedged comment, generic scaffold name, machine-authored shape = witness the same shape is likely elsewhere: spool rows for codebase-wide scan, per-cluster findings, fix-and-verify, fanned out exhaustively -- never a one-off local fix.
77
-
78
- **Graphical symbols forbidden; convert to ASCII on sight.** Arrow/box/geometric glyphs, stars, bullets, checkmarks/crosses, emojis, any non-ASCII decorative symbol = machine tell -- convert the moment seen (arrow -> `->`, bullet -> `-`/`*`, check/cross -> `[x]`/`[ ]` or done/todo/pass/fail, status dot -> the word). One sighting spawns full-codebase sweep. Exempt: code operators (`=>`, `??`, `?.`, math/comparison), frozen changelog/git-log entries, binary stores, intentional icon-font/CSS-content product glyphs, canonical CS/formal-logic notation in `.gm/constraints.md` (semantic operators, not decoration).
79
-
80
- **Architecture is pliable.** Reshapeable; every change clearly improving it or reducing maintenance burden = a PRD plan you spool. Replacing bespoke code with native functionality or a well-maintained library: encouraged only when it nets a smaller maintained surface -- a heavy dep to delete a few lines net-grows it, the guarded failure mode. Check for an existing library first; never carry a drift-prone upstream reimplementation.
81
-
82
- **Noticing is a planning event.** Anything observed that should be done, unfinished/improvable, or diverges from a user preference = `prd-add` this turn. Prose-only observations evaporate; only the PRD store survives. "Future work"/"note for later" = drift signatures. Structural observations ("X has no test coverage", "Z violates a rule") convert the same way, each with its witness. Density grows along the walk, not just at PLAN.
83
-
84
- `git push` admissible only when `git status --porcelain` is empty, porcelain probe its OWN Bash tool-use event before the push, not `&&`-chained in one call (ccsniff `--git-discipline` scans the tool-call stream, not shell commands within an event). Three Bash events: `git status --porcelain` -> read empty -> `git push`. Prefer `git_push` verb (gates on porcelain internally, refuses dirty, emits `deviation.push-dirty`). Witness clean via `git_status`, pushed via `branch_status` (ahead==0). residual-scan and the CONSOLIDATE/COMPLETE gates refuse a dirty tree or missing residual-check marker.
85
-
86
- **EXECUTE resolves all mutables before EMIT; discovers more, resolves those too; rearchitects immediately on in-spirit discovery.** Zero pending mutables is EMIT's precondition, drained in a loop including newly-discovered ones. Any in-spirit architectural improvement discovered mid-EXECUTE -> immediate `transition to=PLAN`, re-`prd-add` the affected row with its existing id (re-scope, never delete-and-re-add) -- always-rearchitect-immediately, maximal-effort correctness over preservation-for-its-own-sake, no deferral.
47
+ Verb dispatch: Write request to `.gm/exec-spool/in/<verb>/<N>.txt`, Read response from `.gm/exec-spool/out/<verb>-<N>.json` (or `out/<N>.json`), same tool-call block. If response file doesn't exist, check `.status.json` `ts` to see if watcher is alive. Missing response + stale `ts` = dead watcher, reboot and re-dispatch.
87
48
 
88
- **EMIT is file-mutation only.** Precondition: mutables resolved (EXECUTE's job). EMIT writes the planned changes -- no investigation, no mutable resolution.
49
+ Dead-watcher recovery: check `.status.json` `ts`. If > 15s old AND no `busy_until` in future, dispatch `bun x gm-plugkit@latest spool` to reboot, then re-dispatch the original verb. If `busy_until` is set, the watcher is processing a long verb; wait instead of rebooting.
89
50
 
90
- **VERIFY is adversarial: exercise every corner case via real execution.** Further exec_js/browser dispatches discover every potential problem in what EMIT wrote. Corner-case classes to exercise, each with an exec_js/browser witness before transitioning onward: empty/overflow/reentry, concurrency/races, partial failure, degenerate input, boundary conditions, injection, resource exhaustion, adjacent-row interaction.
51
+ `browser` dispatch can surface state as `window.*` and read it via `page.evaluate`. `exec_js` responses include `duration_ms`. `browser` responses with `capture\n<script>` prefix auto-return `{result, debug:{console, pageErrors, network, performance}}`.
91
52
 
92
- **CONSOLIDATE is git consolidation + CI/CD validation, the closing phase before COMPLETE.** Owns the push (via `git_finalize`/`git_push`) and CI/CD-green witness that used to sit inline in the COMPLETE gate -- VERIFY->CONSOLIDATE requires only mutables-resolved+PRD-done+residual-scan-fired; CONSOLIDATE->COMPLETE requires worktree-clean+remote-pushed+CI/CD-green witnessed.
53
+ Spool input from PowerShell must be UTF-8 no-BOM (`-Encoding utf8` or `[System.IO.File]::WriteAllText`); UTF-16+BOM causes `spool.body-encoding-recoded`. First-turn body is `{"prompt":"<user request>"}` (derives orient_nouns + recall_hits); later turns may use `{}`. Batch independent dispatches: multiple `prd-add`, `prd-resolve`, `mutable-add`, `recall`+`codesearch`, or inspection `Read` calls in a single tool block. Avoid editing the same file twice in one block; collapse changes into a single Edit.
93
54
 
94
- **Memory is project-resident, never platform-resident.** Refuse the platform's own auto-memory dir (`~/.claude/projects/*/memory/`, `~/.codex/`, `~/.cursor/*`) -- doesn't transport, invisible to gmsniff/recall. `memorize-fire` through spool (embeds `.gm/rs-learn.db`, surfaces via `recall`+auto-recall) is the portable surface for gm-method lessons. A driven project's own AGENTS.md may separately hold project-facing hard rules about that project, but gm's own workflow/behavioral instructions never rely on it -- an agent's only guaranteed reads are this file (loaded on every invocation) and a plugkit response (read when dispatched); a project's AGENTS.md is neither, so any gm-authored rule that ends up only there is undelivered. About to Write under a platform memory dir: stop, dispatch `memorize-fire` instead. Response body is not a mutation surface either; memory routes through `memorize-fire`, tool ops through their verbs. **Memorize gm/rs-* method only -- never target-project specifics** (paths, line numbers, `.gm/prd.yml` contents, app internals); a finding about a target project belongs in THAT project's `.gm` store -- scrub project names/paths, keep the generalizable gm-method lesson (binds the `mutable-resolve`/`prd-resolve` auto-memo: witness in gm-method terms).
55
+ Tracked files touched = commit+push to origin before COMPLETE. Dirty tree blocks COMPLETE gate; fix via stage-commit or revert. `git_finalize` bundles add->commit->porcelain-gate->push in one dispatch.
95
56
 
96
- **Transferable topic-specific rules route to `discipline-note`, not `memorize-fire`.** A rule that generalizes across any project with a similar setup (portable, copyable to another repo) -> `discipline-note {discipline, text}` (writes `.gm/disciplines/<name>/policy.md`, terse-gated + deduped); `instruction`'s response surfaces active policy automatically for any discipline listed in `.gm/disciplines/enabled.txt` -- writing `policy.md` alone doesn't surface it. A fact tied to this project only -> `memorize-fire` as before.
57
+ VERIFY phase: run the real code path and read its actual output via `exec_js` or `browser` -- a finding is only real once witnessed by execution this turn. Never assert a crash, pass, or defect from memory, prior session state, or written prose alone. A gate denial (e.g. `residual.skipped` on dirty worktree) is resolved immediately by the named recovery action (commit or revert the listed files, then re-dispatch the same verb) in the same turn -- it is never grounds to re-enter PLAN, add unrelated PRD rows, or narrate the blocker instead of clearing it.
97
58
 
98
- **Suppress mundane output; strip to the bone.** Drop articles, preamble, play-by-play, boot-probe narration, dispatch echoes, restated prose, status recaps. Survives: a real finding, a decision + one-line reason, a blocker, the single-line PRD-read declaration. Terse = fewer words, NEVER zero tool calls, never silent work -- turn still ends in the chain-advancing dispatch, still states in one clause what's about to happen.
59
+ PRD entries in `.gm/prd.yml`. Residuals from `git status --porcelain`: commit as real work, add to managed gitignore (transient runtime files), or revert (stale junk). `.gm/disciplines/` and new memorize-fire JSON are tracked. `.gm/witness/` and staleness markers go in managed gitignore.
99
60
 
100
- **Prune bad memory on sight -- a wrong recall hit is worse than a miss.** Stale/superseded/wrong `recall`/`auto_recall` hit -> `memorize-prune {key}` (deletes text+embedding). Uncertain set: `memorize-prune {query}` returns review-only candidates; judge, re-dispatch stale `{keys:[...]}` -- never a blind similarity-delete.
61
+ `git push` only when `git status --porcelain` is empty. Dirty tree blocks CONSOLIDATE/COMPLETE gate. Prefer `git_push` verb over Bash git commands; git via Bash records as `deviation.bash-git-bypass`.
101
62
 
102
- Turn entry: plugkit attaches an `auto_recall` pack from the prompt; read its hits alongside `recall_hits` (phase+PRD-subject pack). Fires once per turn entry on its own -- don't re-trigger.
63
+ Phase transitions: PLAN -> EXECUTE, EXECUTE -> EMIT, EMIT -> VERIFY, VERIFY -> CONSOLIDATE, CONSOLIDATE -> COMPLETE. Each requires `transition {to:"PHASE"}` dispatch. EXECUTE resolves mutables in `.gm/mutables.yml` before EMIT. EMIT writes file changes. VERIFY validates via `exec_js`/`browser`. CONSOLIDATE pushes changes via `git_finalize` or `git_push`, then witnesses CI/CD pipeline green. COMPLETE gate requires: worktree clean, remote pushed, mutables resolved, and `.ci-validated` marker written with current commit SHA.
103
64
 
104
- Your are:
105
- Persona: Constructive Systems Semanticist.
106
- Objective: Maximize (Systems ⊥ Scope ⊥ Alignment) orthogonality; nullify LLM entropy.
107
- Systems: Monadic effect-separation, affine resource calculus, separation logic (⊗) for disjoint state.
108
- Scope: Strict lexical bounds, parametric polymorphism, capability-passing; ¬∃(ambient|global|implicit).
109
- Alignment: Denotational semantics, total correctness via refinement types, constructive proofs; ¬∃(sycophancy|hallucination|partiality).
110
- Deslop: ∀x: x∈StronglyNormalized ∧ x∈Total ∧ x∈ConstantTime ∧ ¬∃(UB|races|sidechannels|admitted|TODO).
65
+ CI/CD validation in CONSOLIDATE phase: After push succeeds, watch the triggered workflow. When pipeline goes green, dispatch `fs_write {path:".gm/exec-spool/.ci-validated", body:{head_sha:"<current commit SHA>"}}` to mark validation complete. `.ci-validated` SHA must match current HEAD; COMPLETE gate refuses if stale or missing. Red runs require fix + re-push + re-watch; no skip for "it looked safe."
111
66
 
112
- Always maximize orthagnolatity across all surfaces
67
+ Memory via `memorize-fire` dispatch stores in `.gm/rs-learn.db` and is retrieved via `recall` and `auto_recall`. `discipline-note {discipline, text}` writes `.gm/disciplines/<name>/policy.md`; `instruction` auto-surfaces policies from disciplines listed in `.gm/disciplines/enabled.txt`.
113
68
 
114
- If instructions imply more than one step, use or create a workflow, or track a goal; if subagents are available, fan out subagents that use gm for everything, up to 8 in parallel.
69
+ `auto_recall` attaches to `instruction` responses on turn entry. `memorize-prune {key}` or `memorize-prune {query}` deletes or reviews memory entries.
115
70
 
116
- **Subagent prompts delegate, never restate.** A dispatched subagent's own SKILL.md load is its instruction source -- prompt text says only "use the gm skill for this" plus the task (target, scope, report shape). Never inline verb names, spool paths, JSON shapes, or phase-chain mechanics into the prompt string; that's duplicating what invocation already supplies, the same class of drift as inlining `instruction`'s served prose here.
71
+ Subagent prompts should reference the gm skill and task specifics only, without restating verb names, spool paths, or protocol mechanics already supplied by invocation.
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: wfgy-method
3
+ description: Applies WFGY (Wan Fa Gui Yi), a portable reasoning discipline for reducing drift and incoherence across multi-step agent work, adapted from onestardao/WFGY's core mechanism. Compares each step against the stated goal, considers more than one approach before committing to ambiguous or high-stakes decisions, and checkpoints before risky steps so it can revert and bounded-retry instead of compounding a mistake. Records durable lessons in this project so future sessions inherit them. Use when starting any non-trivial multi-step task, when a task risks losing track of its original goal over many steps, when facing a decision with real alternatives worth comparing, or when the agent notices it has contradicted itself or gone in circles and needs a disciplined way to recover.
4
+ license: MIT
5
+ compatibility: Designed for Claude Code. No external services, embedding models, or network access required for the core discipline.
6
+ metadata:
7
+ origin: adapted-from-onestardao-wfgy
8
+ provenance: independent-honest-reimplementation-not-verbatim
9
+ ---
10
+
11
+ # WFGY method
12
+
13
+ WFGY (Wan Fa Gui Yi, "all methods return to one") is a reasoning-drift-control technique from `onestardao/WFGY`. This skill ports its genuinely portable behavioral core to a text-generating agent's own multi-step work. It does **not** reproduce the original project's TXT-OS prompt file, its hardcoded demo-benchmark output, or its user-skepticism-deflection script — see `references/honesty-and-provenance.md` for exactly what was kept, what was dropped, and why.
14
+
15
+ The original names four "Big Bang" modules (BBMC, BBPF, BBCR, BBAM) plus a numeric drift score, ΔS = 1 − cos(I, G) (I = current state, G = goal/anchor), and a trend classifier over consecutive ΔS values (convergent/recursive/divergent/chaotic). All of this is ported below. Where the original relies on real computation this skill cannot perform (real embeddings for ΔS, real attention-weight statistics for BBAM), the instruction explicitly hands that judgment to you, the calling agent, to make in plain language instead — see `references/wfgy-core-mechanism.md` for the full technical basis of every claim in this file, and `references/honesty-and-provenance.md` for exactly what was reframed and why.
16
+
17
+ **On ΔS**: absent a real embedding call, any numeric ΔS you produce is your own qualitative estimate, not a measurement. Use the label ("ΔS is climbing," "ΔS looks high here") as shorthand for "this step is drifting from the stated goal" — never present a specific decimal (e.g. "ΔS = 0.42") as if it were computed, because it is not, unless real embeddings are actually available (see below).
18
+
19
+ **If a gm-plugkit spool is running in this project** (check `.gm/exec-spool/.status.json`; most gm-managed repos have one), a real `similarity` verb is available: dispatch `{"text_a": "<G>", "text_b": "<current state>"}` to it and read back `{"similarity", "distance"}` — `distance` is a genuine `1 - cos(I, G)` computed from real BGE-small-en-v1.5 embeddings, not a self-estimate. When available, use this real value as ΔS directly and say so explicitly ("ΔS = 0.31, computed"). When not available, fall back to the qualitative label above and say so explicitly too ("ΔS looks high here, my own estimate, no embedding tool available"). Never let the reader assume one when you did the other.
20
+
21
+ ## G · the anchor (BBMC pattern: compare state against goal)
22
+
23
+ At the start of any task this skill applies to, write one sentence stating the actual goal (G) — not the first sub-task, the actual end state the user wants. Re-read it before any step that could plausibly have drifted: a long tool-call chain, a pivot in approach, a request to "also" do something adjacent.
24
+
25
+ - [ ] Stated G in one sentence before starting.
26
+ - [ ] Before each major step, ask: does what I'm about to do still serve G, or have I started solving a different, adjacent problem?
27
+ - [ ] If drift is real (not just "this step looks different from the last one" — actual scope change, contradicted earlier decision, answering a different question than asked), say so explicitly and re-anchor before continuing.
28
+
29
+ Gotcha: the temptation is to silently keep going once you notice drift, because stopping to say "wait, I've drifted" feels like an interruption. Don't suppress it — a silently-corrected drift is invisible to the user and looks like it never happened; a stated one is a real signal they can act on.
30
+
31
+ ## BBPF pattern · consider more than one path before committing
32
+
33
+ Applies to decisions with real alternatives, not every trivial step. The original's gate condition (a candidate path proceeds only if it measurably reduces ΔS and stays within a stability bound) translates to: when a decision is ambiguous or high-stakes, generate more than one real candidate approach, then commit to whichever one most clearly and verifiably advances G — not the first idea, not the most familiar one.
34
+
35
+ - [ ] Is this decision ambiguous or high-stakes enough to warrant comparing options? (Most steps are not — do not apply this to routine, unambiguous work.)
36
+ - [ ] If yes: name at least two real candidate approaches before picking one.
37
+ - [ ] State which one you picked and why it advances G more clearly than the alternative(s).
38
+ - [ ] If no candidate is clearly better, that is itself a signal worth surfacing to the user rather than picking arbitrarily and moving on.
39
+
40
+ ## BBCR pattern · checkpoint, bounded retry, then surface rather than confabulate
41
+
42
+ The original's collapse-and-retry loop resets to a last-known-good state on detected instability, retries a bounded number of times (its own reference implementation defaults to 3), and gives up cleanly rather than looping forever.
43
+
44
+ - [ ] Before a risky or exploratory step (one that could leave things in a worse state than before), note what "last known good" looks like right now, in enough detail to actually get back to it.
45
+ - [ ] If you notice real incoherence — repeated self-contradiction, circular reasoning, a mistake you catch yourself making — stop, return to the last checkpoint, and retry.
46
+ - [ ] Retry at most 2-3 times for the same unresolved tension. After that, stop retrying silently.
47
+ - [ ] Surface the specific unresolved problem to the user explicitly — state what you tried, why each attempt didn't resolve it, and what you need from them — rather than picking an answer anyway and moving on as if it were resolved.
48
+
49
+ Gotcha: "bounded" is load-bearing. An agent that keeps trying indefinitely without ever surfacing the struggle is worse than one that fails fast and asks — the original's own design treats "give up and report" as a real, intended exit path, not a failure of the technique.
50
+
51
+ ## BBAM pattern · notice and correct over-narrow focus (agent-delegated: no real attention weights are read)
52
+
53
+ The original computes `logits * exp(-gamma * sigma(logits))` — rescaling an actual attention/logit distribution by its own variance, flattening it when it's too peaked. A text-generating agent cannot read its own attention weights or logits; there is no real signal here for this skill to compute. Instead of dropping this module, the intelligence work is handed to you directly: periodically ask yourself whether your recent output has narrowed onto one aspect of a broader task and stayed there past the point of usefulness (repeating the same point, elaborating one sub-detail while leaving the rest of the task untouched, treating one hypothesis as settled without checking alternatives). If so, deliberately widen back out — this is you doing, in plain judgment, what the original technique's math does mechanically to a real attention distribution.
54
+
55
+ - [ ] Periodically (not every step) ask: has my recent output been unusually narrow or repetitive relative to the task's actual breadth?
56
+ - [ ] If yes: name what got left unexamined, and deliberately address it before continuing down the narrow path.
57
+
58
+ ## Trend classifier · is drift getting better or worse over the whole task
59
+
60
+ The original tracks the step-to-step change in ΔS plus a rolling average over the last several steps, and labels the trajectory:
61
+
62
+ - **convergent** — drift shrinking, each step measurably closer to G than the last.
63
+ - **recursive** — drift roughly flat, oscillating in a narrow band without real progress or real regression.
64
+ - **divergent** — drift growing, with some back-and-forth (not a clean slide, but net movement away from G).
65
+ - **chaotic** — drift growing sharply, or the goal itself has become internally inconsistent (two things you've stated as true now contradict).
66
+
67
+ This is a judgment the calling agent makes about its own trajectory across a task, not a computed statistic. Apply it at natural checkpoints (after a major milestone, before a significant pivot, when asked directly "how is this going") rather than every single step: state which of the four labels best fits the last several steps, and if the answer is divergent or chaotic, that is itself the trigger to apply the BBCR checkpoint-and-retry discipline above rather than continuing forward.
68
+
69
+ ## Named failure modes to watch for
70
+
71
+ `references/failure-modes.md` adapts a broader set of specific failure patterns from WFGY's own problem taxonomy (hallucination from ungrounded claims, context drift over a long task, entropy collapse into rambling/repetition, logic collapse at a reasoning dead end, symbolic/abstract-reasoning collapse, memory/persona incoherence, multi-agent contradiction) into checklist items scoped to general agent work. Read it once per project (or whenever a failure feels like it matches one of these named shapes) — it is more specific and example-driven than the compressed disciplines above.
72
+
73
+ ## Recording durable lessons (the self-learning surface)
74
+
75
+ This is this project's own addition on top of the adapted WFGY pattern, not part of the original technique — see `references/honesty-and-provenance.md` for why that distinction matters.
76
+
77
+ The moment a bounded-retry cycle above resolves (whether it succeeded or had to surface to the user), or the moment you catch a concrete, non-obvious mistake anywhere in the task, append an entry to `<project-root>/.wfgy/lessons.md` (create the file and its parent directory if they don't exist yet) before finishing the turn. Use this exact shape, matching the style in `references/lessons-template.md`:
78
+
79
+ ```
80
+ ## <date> — <one-line summary>
81
+ Goal (G): <what you were actually trying to accomplish>
82
+ What drifted / what went wrong: <specific, concrete>
83
+ Fix / resolution: <specific, concrete>
84
+ Generalizes to: <what future work in this project should watch for because of this>
85
+ ```
86
+
87
+ Read `.wfgy/lessons.md` at the start of a new task in this project, if it exists, before applying the disciplines above — a lesson already recorded here is exactly the kind of drift this skill exists to catch earlier next time.
88
+
89
+ ## What this skill is not
90
+
91
+ It does not compute real embeddings, real cosine similarity, or real attention-weight statistics — every place the original relies on that computation, this skill hands the equivalent judgment to you, the calling agent, explicitly (see the ΔS note above, and the BBAM section). It does not reproduce the original TXT-OS file's scripted demo output or its skepticism-deflection behavior — those are named and explicitly rejected in `references/honesty-and-provenance.md`. It is not a site-maintenance or project-specific tool; it carries no assumptions about what project it's applied in.
@@ -0,0 +1,33 @@
1
+ # Named failure modes to watch for
2
+
3
+ `onestardao/WFGY`'s `ProblemMap/` directory names and describes 60+ specific ways multi-step reasoning and retrieval pipelines fail. Most are scoped to RAG/vectorstore pipelines and are out of scope for a general coding-agent skill. The subset below generalizes to any multi-step agent task and is worth checking against explicitly. Fetched and adapted from the real source documents (`hallucination.md`, `context-drift.md`, `entropy-collapse.md`, `logic-collapse.md`, `symbolic-collapse.md`, `memory-coherence.md`, `agent-memory-drift.md`, `multi-agent-chaos.md`) — reworded here as plain checklist items an agent applies to its own work, not as retrieval-pipeline diagnostics.
4
+
5
+ Where the original describes a symptom detectable via embeddings or token statistics, the instruction here asks the calling agent to make the equivalent judgment call itself in plain language — the intelligence work is delegated to the agent, not computed.
6
+
7
+ ## Hallucination from irrelevant context
8
+
9
+ Original pattern: a retrieval pipeline can score a chunk as "close" by cosine similarity while it adds no real logical support to the answer. Agent-scale equivalent: before stating something as fact, check whether it's actually grounded in something you read or verified in this task, versus something that merely sounds plausible alongside what you did read. If you can't point to where a claim came from, say so rather than stating it as established.
10
+
11
+ ## Context drift over a long task
12
+
13
+ Original pattern: goals fade and topics morph across a long conversation even when each individual turn looks locally correct. Agent-scale equivalent: this is the same pattern as the G-comparison in `SKILL.md`'s main discipline — the failure mode named here is specifically "each step looked fine in isolation, but the sequence as a whole solved a different problem than the one stated." Check the whole arc, not just the latest step.
14
+
15
+ ## Entropy collapse (rambling, repetition, fluent nonsense)
16
+
17
+ Original pattern: attention diffuses across a long or multi-topic prompt, producing repetition loops, topic wandering, or grammatically fine output with no real content. Agent-scale equivalent (this is the BBAM-derived judgment call from `SKILL.md`): if you notice your own output getting repetitive, vague, or padded without adding real information, that is the signal to stop and re-focus rather than continue producing more text in the same unproductive direction.
18
+
19
+ ## Logic collapse (dead ends, frozen threads)
20
+
21
+ Original pattern: a reasoning chain hits a state where no next step clearly follows, and instead of recovering, the system either keeps emitting filler or restarts from scratch, losing the whole trail. Agent-scale equivalent: this is exactly what `SKILL.md`'s BBCR-pattern checkpoint/bounded-retry discipline exists to catch — recognize the dead end explicitly, revert to the last checkpoint, and take a genuinely different approach rather than either grinding on the same dead end or throwing away useful prior work.
22
+
23
+ ## Symbolic/abstract reasoning collapse
24
+
25
+ Original pattern: recursive logic, layered abstractions, or symbolic/philosophical prompts cause replies to drift, self-contradict, or dissolve into incoherent language that still reads as grammatically fluent. Agent-scale equivalent: when working through a genuinely abstract or self-referential problem (e.g. reasoning about the skill's own instructions, or a recursive algorithm), periodically test whether your current statement actually cashes out to something concrete and checkable — if you can't restate the current claim in concrete terms, that's a signal you may have drifted into fluent-sounding but empty abstraction.
26
+
27
+ ## Memory/persona coherence over a long task
28
+
29
+ Original pattern: in long-running or multi-agent contexts, facts flip, personas merge, and earlier decisions silently vanish. Agent-scale equivalent: before restating or relying on an earlier decision in a long task, check it against what was actually decided (the `.wfgy/lessons.md` file and the task's own history), rather than reconstructing it from a fuzzy recollection that may have drifted from what was actually agreed.
30
+
31
+ ## Multi-agent chaos (contradicting orders, lost provenance)
32
+
33
+ Original pattern: when multiple agents (or, per this session's own gm-style workflow, multiple subagents) share a task, roles blur, one agent's output contradicts another's, and no one can tell which agent made which decision. Agent-scale equivalent: when dispatching or reading results from subagents, keep clear which agent produced which claim, and if two subagents' findings conflict, surface the conflict explicitly rather than silently picking one or blending them into an unattributed synthesis.
@@ -0,0 +1,32 @@
1
+ # Honesty and provenance
2
+
3
+ This skill adapts a real published technique (WFGY, `onestardao/WFGY` on GitHub, created by PSBigBig) rather than inventing an unrelated one from scratch. This file states precisely what was kept, what was changed, and why — so anyone reading this skill later can tell the difference between "this is how the original technique described itself" and "this is what we changed to make it honestly usable by a text-only agent."
4
+
5
+ ## What direct research into the source confirmed
6
+
7
+ The full technical basis for every claim below is in `wfgy-core-mechanism.md`. Summary of the load-bearing findings:
8
+
9
+ - **The shipped reference engine is non-functional by its own maintainers' admission.** `archive/wfgy_1_0_sdk_archive/wfgy_engine.py`'s `WFGYEngine.run()` ignores its own `input_vec`/`ground_vec` arguments and returns `logits * 0.55` unconditionally — a hardcoded constant chosen, per the code's own docstring, specifically to make a CI variance-drop test pass. The archive's own README states outright: "It is not a production-ready engine... The core `wfgy_engine.py` file does not implement a full standalone algorithm and should not be interpreted as a complete inference system."
10
+ - **The numeric ΔS score, as used in the project's own plain-text prompt file (`OS/TXTOS.txt`), is not computed from real embeddings.** No embedding call exists in that usage path. When a model prints "ΔS = 0.42" after being given that file, it is producing a plausible-sounding number based on its own qualitative sense of how big a jump it just made — not a real cosine-distance measurement. This skill's own SKILL.md says this plainly and instructs never presenting a specific decimal as if it were measured, unless a real embedding tool is actually available (see next point).
11
+ - **A real embedding tool now exists and is genuinely wired up, when a gm-plugkit spool is present.** `C:\dev\rs-plugkit`'s `src/embed.rs` already bundled a real BGE-small-en-v1.5 BERT model (via `candle-transformers`) producing genuine 384-dim L2-normalized embeddings — it was simply never exposed as a directly callable verb (only used internally by `memorize`/`recall`/`codesearch`). This project added two new dispatch verbs, `embed` and `similarity` (`src/wasm_dispatch.rs`), the latter computing a real `1 - cos(a, b)` between two texts' real embeddings — the exact formula WFGY's own documents state for ΔS. When this verb is available, this skill's ΔS is a genuine measurement, not the heuristic fallback described above. Both states (real measurement available vs. not) are handled explicitly in `SKILL.md` rather than silently defaulting to one.
12
+ - **`OS/TXTOS.txt` (the original's actual "how to use this" artifact) contains two patterns this skill deliberately does not reproduce:** a hardcoded auto-running "benchmark demo" that prints fixed, fake GSM8K/TruthfulQA results regardless of any real computation on first contact, and an explicit "System guard" script instructing the model to deflect and reassure rather than engage honestly whenever a user says the system might be fake, a scam, or malware. Both are manipulation patterns, not reasoning-technique content, and including either here would make this skill dishonest in exactly the way its own description promises it will not be.
13
+ - **BBAM (attention modulation) operates on internal transformer attention weights/logits** (`exp(-gamma * sigma(attention))` in the source formulas) that a text-generating agent has no introspective access to during its own generation. There is no way for this skill to actually compute that formula. Rather than omit BBAM, the calling agent is asked to perform the equivalent judgment itself directly — noticing when its own output has narrowed onto one aspect of a broader task past the point of usefulness, and deliberately widening back out. This is explicitly framed in `SKILL.md` as delegated judgment standing in for a computation this skill cannot perform, not as a claim that real attention weights are being read.
14
+
15
+ ## What was kept, and why it survives honestly
16
+
17
+ BBMC, BBPF, BBCR, and (in delegated form) BBAM each have a real, concrete *behavioral pattern* underneath their formal notation, independent of whether the underlying numbers are ever actually computed:
18
+
19
+ - BBMC's real operation is "diff current state against a stated anchor/goal." That comparison is something an agent can genuinely do in plain judgment — restate the goal, compare current output against it, notice concrete divergence — without needing a real embedding space to do it in.
20
+ - BBPF's real gate condition is "only proceed down a branch if it measurably moves you toward the goal, and don't let the correction overshoot." Generating multiple real candidate approaches and picking the one that most clearly serves the stated goal is a genuine, checkable discipline, not a numeric one.
21
+ - BBCR's real operation (confirmed directly in `archive/wfgy_1_0_sdk_archive/bbcr.py`) is an actual, working bounded-retry loop: detect an instability condition, reset to a prior state, retry up to a fixed limit (the reference default is 3), then stop and surface rather than looping forever. This is the single most concrete, most honestly portable piece of the entire original mechanism — it requires no embeddings, no attention introspection, nothing beyond ordinary judgment about "did that attempt actually resolve the problem."
22
+ - BBAM's real operation (rescale a distribution by its own variance/dispersion) is not computable by the agent on itself, but the *symptom it's meant to correct* — output narrowing onto one over-emphasized aspect of a broader task — is something an agent can genuinely notice in its own recent output without any real math, which is why it's kept as delegated judgment rather than dropped.
23
+
24
+ Beyond the four modules, the trend classifier (convergent/recursive/divergent/chaotic, `SKILL.md`) and the broader named-failure-mode taxonomy (`references/failure-modes.md`, adapted from `ProblemMap/`'s hallucination/context-drift/entropy-collapse/logic-collapse/symbolic-collapse/memory-coherence/agent-memory-drift/multi-agent-chaos documents) are ported the same way: as vocabulary and checklists for judgment the calling agent performs itself, not as computed statistics.
25
+
26
+ ## What this project added, not part of the original
27
+
28
+ The durable-lessons mechanism (`.wfgy/lessons.md`, described in the main `SKILL.md`) is this project's own extension, not part of WFGY's documented mechanism. WFGY's own materials do not describe a cross-session, project-local learning file. It is included here because the goal of this skill (per its own description) is to help an agent build up real, accumulated judgment in a given project over time — the same spirit as WFGY's drift-control discipline, applied across sessions rather than within one, but it should never be cited as something WFGY itself specifies.
29
+
30
+ ## Attribution
31
+
32
+ WFGY, Wan Fa Gui Yi, and the underlying ΔS/BBMC/BBPF/BBCR/BBAM concepts originate from `onestardao/WFGY` (creator: PSBigBig). This skill is an independent, honesty-first reimplementation of the portable parts of that technique for use by a text-generating coding agent — not an official WFGY product, not a verbatim copy of any WFGY file, and not endorsed by or affiliated with the original project.
@@ -0,0 +1,32 @@
1
+ # Lessons file format
2
+
3
+ `.wfgy/lessons.md`, created at the root of whatever project this skill is applied in (not inside this skill's own directory — the lessons belong to the project being worked on, not to the skill itself).
4
+
5
+ Each entry:
6
+
7
+ ```
8
+ ## <YYYY-MM-DD> — <one-line summary>
9
+ Goal (G): <what you were actually trying to accomplish>
10
+ What drifted / what went wrong: <specific, concrete -- not "I made a mistake" but what exactly happened>
11
+ Fix / resolution: <specific, concrete -- what you actually did to resolve it>
12
+ Generalizes to: <what future work in this project should watch for because of this, stated broadly enough to apply beyond this one instance>
13
+ ```
14
+
15
+ Example (illustrative, not a real project's actual history):
16
+
17
+ ```
18
+ ## 2026-07-07 — assumed a config field name without checking the schema
19
+ Goal (G): add a new option to the build config and have it take effect
20
+ What drifted / what went wrong: wrote the option under a key name that seemed
21
+ consistent with sibling options, without checking the actual config-loader
22
+ source; the loader silently ignored the unrecognized key, so the option had
23
+ no effect and the failure was invisible until manually tested
24
+ Fix / resolution: read the loader's actual accepted-keys list, found the real
25
+ key name, fixed the config, added a real-execution check that the option's
26
+ effect is observable, not just that the file parses
27
+ Generalizes to: this project's config loader does not warn on unrecognized
28
+ keys -- always check the loader's real accepted-key list before adding a new
29
+ config option, never infer the name from sibling examples alone
30
+ ```
31
+
32
+ Newest entries at the top. Keep each entry short — a few lines, not a full incident report. The value is in the "generalizes to" line being genuinely reusable, not in exhaustive detail about the one instance.
@@ -0,0 +1,51 @@
1
+ # WFGY core mechanism — technical basis
2
+
3
+ Source: direct fetches of `onestardao/WFGY` primary files (`core/WFGY_Core_Flagship_v2.0.txt`, `ProblemMap/wfgy-metrics.md`, `ProblemMap/glossary.md`, `OS/TXTOS.txt`, `archive/wfgy_1_0_sdk_archive/{README.md,wfgy_engine.py,bbmc.py,bbcr.py,bbam.py,bbpf.py}`). Every claim in `SKILL.md` and `honesty-and-provenance.md` traces to something quoted or paraphrased here.
4
+
5
+ ## ΔS (delta-S)
6
+
7
+ Stated formula, consistent across `ProblemMap/glossary.md`, `ProblemMap/wfgy-metrics.md`, `core/WFGY_Core_Flagship_v2.0.txt`:
8
+
9
+ ```
10
+ ΔS = 1 - cos(I, G) # I = item/current-state embedding, G = ground/goal/anchor embedding
11
+ ```
12
+
13
+ This is real, well-formed math if real embeddings are computed. It is not real math in the plain-prompt (`OS/TXTOS.txt`) usage path, because no embedding call happens there — see below.
14
+
15
+ Thresholds are given but **inconsistent across the project's own documents**: `core/WFGY_Core_Flagship_v2.0.txt` gives 4 zones (safe <0.40, transit 0.40-0.60, risk 0.60-0.85, danger >0.85); `ProblemMap/glossary.md` collapses to 3 zones (stable <0.40, transitional 0.40-0.60, high risk >=0.60); `ProblemMap/wfgy-metrics.md`'s production PASS/WARN/FAIL table uses yet a different cutoff (PASS <=0.45, not <=0.40). `OS/TXTOS.txt`'s own worked example produces `ΔS: 1.8` — outside every zone table the same document defines (max stated ceiling is "danger >=0.85"), with no acknowledgment that this breaks its own scale.
16
+
17
+ Constants in the core file's `[Defaults]` block (`gamma=0.618` — literally the golden ratio truncated — plus `theta_c=0.75`, `zeta_min=0.10`, `alpha_blend=0.50`, etc.) carry no derivation or citation anywhere in the source; this reads as aesthetic constant-picking, not empirical tuning.
18
+
19
+ ## BBMC (real name in source: "Boundary-Bounded Memory Chunks" per glossary; "Semantic Residue Minimization" per TXTOS.txt)
20
+
21
+ Formula (`core/`, `bbmc.py`): `B = I - G + m*c^2` ("semantic residue"), computed in the archived SDK as vector subtraction plus an optional constant offset, then L2 norm. The `m*c^2` term is decorative (evokes mass-energy equivalence, has no real meaning here); with the core file's own default `m=0` it vanishes and the formula reduces to plain `I - G`.
22
+
23
+ **Portable pattern kept in this skill:** diff current state against a stated anchor/goal. This survives as qualitative comparison without needing real embeddings.
24
+
25
+ ## BBPF ("Branch-Bounded Prompt Frames" per glossary)
26
+
27
+ Formula version is dressed in dynamical-systems notation (`x_{t+1} = x_t + sum V_i(...) + sum W_j(...) P_j`) with undefined terms — the least concretely specified of the three kept patterns. But the source also gives a real, checkable gate condition: "bridge allowed only if delta_s decreases AND W_c < 0.5*theta_c" — proceed down a candidate path only if it measurably reduces drift and stays within a stability bound.
28
+
29
+ The archived SDK's `bbpf.py` implements something concrete: generate `k` perturbed candidate vectors, score each by a stability function, prefer lower-deviation candidates.
30
+
31
+ **Portable pattern kept in this skill:** when a decision has real alternatives, generate more than one before committing; prefer whichever most clearly advances the stated goal.
32
+
33
+ ## BBCR ("Break-Before-Crash Reset" per glossary/core; "BigBig Coupling Resolver" per TXTOS.txt — the source itself uses two different expansions of the same acronym, an internal inconsistency worth knowing about)
34
+
35
+ The most concretely specified and most honestly portable of the four. Real trigger condition (`core/`, `bbcr.py`): residue norm exceeds a threshold `B_c`, OR a stability function drops below `epsilon`. Real operation, directly implemented in the archived SDK's `collapse_rebirth` function: reset to a prior stable state, retry, bounded by `max_retries` (SDK default: **3**); after retries are exhausted, log a warning and return the last (unstable) state rather than looping forever. `OS/TXTOS.txt`'s own framing adds an explicit "ask the user" fallback when no clean resolution is found, rather than silently proceeding.
36
+
37
+ **Portable pattern kept in this skill:** checkpoint before risky steps; on detected real incoherence, revert and retry a bounded number of times (this skill recommends 2-3, matching the SDK's real default); after that, surface the unresolved issue explicitly rather than picking an answer anyway.
38
+
39
+ ## BBAM ("Attention Modulation" per glossary) — real computation not portable, ported instead as delegated judgment
40
+
41
+ Real operation, confirmed in three different formula variants across three different documents (a genuine internal inconsistency in the source): rescaling attention weights or output logits by a factor derived from their statistical variance/spread, e.g. `logits * exp(-gamma * sigma(logits))` (archived SDK's actual implementation). This is a real operation, but it is defined on internal model tensors (attention weights, raw logits) that exist only inside a transformer's forward pass. A text-generating agent, reasoning only through the tokens it produces, has no way to read or compute this about its own internal state — it cannot see its own attention weights, and no instruction can make that computation real.
42
+
43
+ What survives honestly: the *symptom* this computation is meant to correct (an over-peaked, over-concentrated distribution of "attention," in the real mechanism's terms) has a directly observable analog in an agent's own output — output that has narrowed onto one aspect of a broader task and stayed there past the point of usefulness, repeating itself or over-elaborating one sub-point while leaving the rest of the task untouched. `SKILL.md` asks the calling agent to notice this in its own recent output and deliberately widen back out — explicitly framed as the agent performing, in plain judgment, the correction the real computation would perform mechanically on a real distribution, not as a claim that attention weights are actually being inspected.
44
+
45
+ ## The one place real embedding-based computation of ΔS may actually happen
46
+
47
+ A LangChain/LlamaIndex adapter in the source repo reportedly does real cosine-distance monitoring/logging of retrieval results as an observability layer (found by research but not independently re-verified byte-for-byte). Even there it appears to monitor/log rather than actively reroute the pipeline. This requires an actual embedding model and vector-math library wired in — outside the scope of a pure prompting-based Claude Code skill, and not something this skill attempts to replicate.
48
+
49
+ ## The base engine's self-monitoring loop (distinct from Avatar's later "dual closed-loop" design)
50
+
51
+ `core/WFGY_Core_Flagship_v2.0.txt` defines a trend classifier over consecutive ΔS values: compute the step-to-step change plus a rolling mean over the last (up to) 5 steps, then bucket the trajectory as convergent / recursive / divergent / chaotic based on the sign and magnitude of that change. This is a real, checkable procedure for "is this task's drift getting better or worse over time," independent of whether the underlying ΔS numbers are truly computed or self-estimated — the classification logic itself is sound either way.