liteagents 2.24.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/CHANGELOG.md +206 -0
  2. package/README.md +120 -160
  3. package/installer/cli.js +40 -5
  4. package/installer/installation-engine.js +8 -0
  5. package/package.json +4 -3
  6. package/packages/ampcode/AGENT.md +11 -20
  7. package/packages/ampcode/agents/code-developer.md +11 -17
  8. package/packages/ampcode/agents/orchestrator.md +3 -3
  9. package/packages/ampcode/agents/quality-assurance.md +3 -1
  10. package/packages/ampcode/{commands/brainstorming.md → skills/brainstorming/SKILL.md} +2 -3
  11. package/packages/ampcode/{commands/branch-review.md → skills/branch-review/SKILL.md} +13 -13
  12. package/packages/{claude/commands/docs-builder.md → ampcode/skills/docs-builder/SKILL.md} +1 -1
  13. package/packages/ampcode/{commands/live-canvas.md → skills/live-canvas/SKILL.md} +8 -4
  14. package/packages/ampcode/{commands/refactor.md → skills/refactor/SKILL.md} +57 -9
  15. package/packages/ampcode/{commands/release.md → skills/release/SKILL.md} +4 -4
  16. package/packages/{claude/commands → ampcode/skills}/remember/AGENT_RULES.md +44 -84
  17. package/packages/ampcode/{commands/remember.md → skills/remember/SKILL.md} +86 -13
  18. package/packages/ampcode/{commands → skills}/remember/friction.cjs +0 -0
  19. package/packages/ampcode/skills/remember/stub-check.cjs +206 -0
  20. package/packages/ampcode/skills/remember/sync-rules.cjs +178 -0
  21. package/packages/ampcode/skills/remember/version-check.cjs +214 -0
  22. package/packages/ampcode/skills/root-cause/SKILL.md +220 -0
  23. package/packages/ampcode/{commands/trace-back → skills/root-cause}/find-polluter.sh +0 -0
  24. package/packages/{claude/commands/security.md → ampcode/skills/security/SKILL.md} +1 -1
  25. package/packages/{claude/commands/ship.md → ampcode/skills/ship/SKILL.md} +1 -1
  26. package/packages/ampcode/skills/skill-creator/LICENSE.txt +202 -0
  27. package/packages/ampcode/{commands/skill-creator.md → skills/skill-creator/SKILL.md} +1 -2
  28. package/packages/ampcode/{commands → skills}/skill-creator/scripts/init_skill.py +0 -0
  29. package/packages/ampcode/{commands → skills}/skill-creator/scripts/package_skill.py +0 -0
  30. package/packages/ampcode/{commands → skills}/skill-creator/scripts/quick_validate.py +0 -0
  31. package/packages/ampcode/{commands/stash.md → skills/stash/SKILL.md} +2 -1
  32. package/packages/{claude/commands/test-generate.md → ampcode/skills/test-generate/SKILL.md} +2 -2
  33. package/packages/ampcode/variants.json +2 -2
  34. package/packages/claude/CLAUDE.md +11 -19
  35. package/packages/claude/agents/code-developer.md +11 -17
  36. package/packages/claude/agents/orchestrator.md +4 -5
  37. package/packages/claude/agents/quality-assurance.md +3 -1
  38. package/packages/claude/skills/brainstorming/SKILL.md +1 -2
  39. package/packages/claude/{commands/branch-review.md → skills/branch-review/SKILL.md} +1 -1
  40. package/packages/{ampcode/commands/docs-builder.md → claude/skills/docs-builder/SKILL.md} +7 -7
  41. package/packages/claude/skills/live-canvas/SKILL.md +5 -1
  42. package/packages/claude/{commands/refactor.md → skills/refactor/SKILL.md} +53 -5
  43. package/packages/claude/{commands/release.md → skills/release/SKILL.md} +1 -1
  44. package/packages/{ampcode/commands → claude/skills}/remember/AGENT_RULES.md +38 -78
  45. package/packages/claude/{commands/remember.md → skills/remember/SKILL.md} +86 -13
  46. package/packages/claude/{commands → skills}/remember/friction.cjs +0 -0
  47. package/packages/claude/skills/remember/stub-check.cjs +206 -0
  48. package/packages/claude/skills/remember/sync-rules.cjs +178 -0
  49. package/packages/claude/skills/remember/version-check.cjs +214 -0
  50. package/packages/claude/skills/root-cause/SKILL.md +220 -0
  51. package/packages/{ampcode/commands/security.md → claude/skills/security/SKILL.md} +2 -2
  52. package/packages/{ampcode/commands/ship.md → claude/skills/ship/SKILL.md} +2 -2
  53. package/packages/claude/skills/skill-creator/SKILL.md +1 -2
  54. package/packages/claude/{commands/stash.md → skills/stash/SKILL.md} +2 -1
  55. package/packages/{ampcode/commands/test-generate.md → claude/skills/test-generate/SKILL.md} +3 -3
  56. package/packages/claude/variants.json +1 -2
  57. package/packages/droid/AGENTS.md +10 -16
  58. package/packages/droid/commands/brainstorming.md +1 -4
  59. package/packages/droid/commands/branch-review.md +11 -14
  60. package/packages/droid/commands/docs-builder.md +0 -3
  61. package/packages/droid/commands/live-canvas.md +7 -5
  62. package/packages/droid/commands/refactor.md +55 -10
  63. package/packages/droid/commands/release.md +2 -5
  64. package/packages/droid/commands/remember/AGENT_RULES.md +38 -78
  65. package/packages/droid/commands/remember/stub-check.cjs +206 -0
  66. package/packages/droid/commands/remember/sync-rules.cjs +178 -0
  67. package/packages/droid/commands/remember/version-check.cjs +214 -0
  68. package/packages/droid/commands/remember.md +84 -14
  69. package/packages/droid/commands/root-cause.md +218 -0
  70. package/packages/droid/commands/security.md +0 -3
  71. package/packages/droid/commands/ship.md +0 -3
  72. package/packages/droid/commands/skill-creator/LICENSE.txt +202 -0
  73. package/packages/droid/commands/skill-creator.md +0 -4
  74. package/packages/droid/commands/stash.md +0 -2
  75. package/packages/droid/commands/test-generate.md +1 -4
  76. package/packages/droid/droids/1-create-prd.md +6 -2
  77. package/packages/droid/droids/2-generate-tasks.md +1 -2
  78. package/packages/droid/droids/3-process-task-list.md +1 -2
  79. package/packages/droid/droids/code-developer.md +12 -19
  80. package/packages/droid/droids/feature-planner.md +1 -2
  81. package/packages/droid/droids/market-researcher.md +1 -2
  82. package/packages/droid/droids/orchestrator.md +3 -4
  83. package/packages/droid/droids/quality-assurance.md +4 -3
  84. package/packages/droid/droids/system-architect.md +1 -2
  85. package/packages/droid/droids/ui-designer.md +1 -2
  86. package/packages/opencode/AGENTS.md +10 -16
  87. package/packages/opencode/agent/code-developer.md +11 -17
  88. package/packages/opencode/agent/orchestrator.md +2 -2
  89. package/packages/opencode/agent/quality-assurance.md +3 -1
  90. package/packages/opencode/command/brainstorming.md +1 -4
  91. package/packages/opencode/command/branch-review.md +11 -15
  92. package/packages/opencode/command/docs-builder.md +0 -4
  93. package/packages/opencode/command/live-canvas.md +7 -5
  94. package/packages/opencode/command/refactor.md +55 -11
  95. package/packages/opencode/command/release.md +2 -5
  96. package/packages/opencode/command/remember/AGENT_RULES.md +38 -78
  97. package/packages/opencode/command/remember/stub-check.cjs +206 -0
  98. package/packages/opencode/command/remember/sync-rules.cjs +178 -0
  99. package/packages/opencode/command/remember/version-check.cjs +214 -0
  100. package/packages/opencode/command/remember.md +84 -14
  101. package/packages/opencode/command/root-cause.md +218 -0
  102. package/packages/opencode/command/security.md +0 -4
  103. package/packages/opencode/command/ship.md +0 -3
  104. package/packages/opencode/command/skill-creator/LICENSE.txt +202 -0
  105. package/packages/opencode/command/skill-creator.md +0 -4
  106. package/packages/opencode/command/stash.md +0 -3
  107. package/packages/opencode/command/test-generate.md +1 -5
  108. package/packages/opencode/opencode.jsonc +4 -34
  109. package/packages/subagentic-manual.md +147 -314
  110. package/packages/ampcode/agents/context-builder.md +0 -144
  111. package/packages/ampcode/commands/debug-method.md +0 -297
  112. package/packages/ampcode/commands/live-canvas/README.md +0 -264
  113. package/packages/ampcode/commands/optimize.md +0 -61
  114. package/packages/ampcode/commands/tdd-flow.md +0 -390
  115. package/packages/ampcode/commands/test-traps/example.ts +0 -158
  116. package/packages/ampcode/commands/test-traps.md +0 -378
  117. package/packages/ampcode/commands/trace-back.md +0 -176
  118. package/packages/ampcode/commands/verify-done.md +0 -152
  119. package/packages/claude/agents/context-builder.md +0 -145
  120. package/packages/claude/commands/optimize.md +0 -61
  121. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md +0 -89
  122. package/packages/claude/skills/debug-method/CREATION-LOG.md +0 -119
  123. package/packages/claude/skills/debug-method/SKILL.md +0 -296
  124. package/packages/claude/skills/debug-method/test-academic.md +0 -14
  125. package/packages/claude/skills/debug-method/test-pressure-1.md +0 -58
  126. package/packages/claude/skills/debug-method/test-pressure-2.md +0 -68
  127. package/packages/claude/skills/debug-method/test-pressure-3.md +0 -69
  128. package/packages/claude/skills/live-canvas/README.md +0 -269
  129. package/packages/claude/skills/tdd-flow/SKILL.md +0 -392
  130. package/packages/claude/skills/test-traps/SKILL.md +0 -378
  131. package/packages/claude/skills/test-traps/example.ts +0 -158
  132. package/packages/claude/skills/trace-back/SKILL.md +0 -176
  133. package/packages/claude/skills/verify-done/SKILL.md +0 -152
  134. package/packages/droid/commands/debug-method.md +0 -297
  135. package/packages/droid/commands/live-canvas/README.md +0 -264
  136. package/packages/droid/commands/optimize.md +0 -61
  137. package/packages/droid/commands/tdd-flow.md +0 -390
  138. package/packages/droid/commands/test-traps/example.ts +0 -158
  139. package/packages/droid/commands/test-traps.md +0 -378
  140. package/packages/droid/commands/trace-back.md +0 -176
  141. package/packages/droid/commands/verify-done.md +0 -152
  142. package/packages/droid/droids/context-builder.md +0 -144
  143. package/packages/opencode/agent/context-builder.md +0 -148
  144. package/packages/opencode/command/debug-method.md +0 -297
  145. package/packages/opencode/command/live-canvas/README.md +0 -264
  146. package/packages/opencode/command/optimize.md +0 -61
  147. package/packages/opencode/command/tdd-flow.md +0 -390
  148. package/packages/opencode/command/test-traps/example.ts +0 -158
  149. package/packages/opencode/command/test-traps.md +0 -378
  150. package/packages/opencode/command/trace-back.md +0 -176
  151. package/packages/opencode/command/verify-done.md +0 -152
  152. /package/packages/ampcode/{commands → skills}/docs-builder/docs-builder.cjs +0 -0
  153. /package/packages/ampcode/{commands → skills}/live-canvas/DESIGN_PRINCIPLES.md +0 -0
  154. /package/packages/ampcode/{commands → skills}/live-canvas/dev/post-variants.html +0 -0
  155. /package/packages/ampcode/{commands → skills}/live-canvas/templates/lab-banner.html +0 -0
  156. /package/packages/ampcode/{commands → skills}/live-canvas/templates/overlay-vanilla.js +0 -0
  157. /package/packages/claude/{commands → skills}/docs-builder/docs-builder.cjs +0 -0
  158. /package/packages/claude/skills/{trace-back → root-cause}/find-polluter.sh +0 -0
  159. /package/packages/droid/commands/{trace-back → root-cause}/find-polluter.sh +0 -0
  160. /package/packages/opencode/command/{trace-back → root-cause}/find-polluter.sh +0 -0
@@ -1,7 +1,5 @@
1
1
  ---
2
- name: remember
3
2
  description: Consolidate stashes + friction into project memory
4
- usage: /remember
5
3
  ---
6
4
 
7
5
  Run friction analysis, then consolidate session stashes + friction antigens into a single project-local MEMORY.md, and inject into AGENTS.md. Friction runs automatically (best-effort) — there is no separate `/friction` command. A docs reconcile check runs at the end, detect-only.
@@ -38,10 +36,31 @@ Reads all raw material (`.factory/stash/*.md` + `.factory/remember/friction/anti
38
36
  - **Locate `friction.cjs`** — it is bundled next to this command at `remember/friction.cjs`
39
37
  (the same directory as `remember.md`, whether installed or run from the package). If it
40
38
  exists nowhere, skip to step 1 (stash-only) and tell the user friction.cjs is missing.
39
+ - **Check for a newer liteagents** (best-effort, one line, never blocking) — bundled
40
+ beside `friction.cjs` as `remember/version-check.cjs`. Call it by its **absolute
41
+ path**, exactly as step 7 calls `docs-builder.cjs`: the cwd here is the target repo,
42
+ not this package, so a cwd-relative path fails everywhere except the liteagents repo
43
+ itself.
44
+ ```bash
45
+ node ~/.factory/commands/remember/version-check.cjs
46
+ ```
47
+ **If that path does not exist, use the directory you just resolved for
48
+ `friction.cjs`** — the two ship side by side, so that directory is correct for a
49
+ non-default install and when running from a checkout, where the path above would
50
+ point at the installed copy instead of the one under test.
51
+ It prints one advice line if the installed version is behind the registry, and prints
52
+ nothing otherwise. It exits 0 on every path, caches the registry answer for 24h, and
53
+ is bounded to ~2s, so it cannot stall this run. If it prints a line, relay it verbatim
54
+ in your final report; never act on it and never run the install yourself.
55
+ - **If the script is missing from both locations, say so** — one line, same rule as step
56
+ 7's "applicable but could not run". A failed *check* (offline, registry down, timeout)
57
+ stays silent by design: it is a once-a-day nudge, not a result anyone is waiting on. A
58
+ missing *script* means the install is incomplete, which is worth a word.
41
59
  - **Resolve the global sessions root** — probe this list top-to-bottom, use the first that
42
60
  exists and contains `.jsonl` files directly, or one level down in per-project
43
61
  subdirectories (friction.cjs scans exactly those two levels, not a deep recursive walk).
44
62
  **Never prompt the user.**
63
+ <!-- mirror:literal:start — every tool's real path, identical in all four kits -->
45
64
  ```
46
65
  # ── Add your own global sessions root at the TOP so it is checked first ──
47
66
  ~/.claude/projects/ # Claude Code
@@ -51,6 +70,7 @@ Reads all raw material (`.factory/stash/*.md` + `.factory/remember/friction/anti
51
70
  ~/.codex/sessions/ # Codex CLI (use $CODEX_HOME/sessions/ if set)
52
71
  ~/.gemini/antigravity-cli/brain/ # Antigravity
53
72
  ```
73
+ <!-- mirror:literal:end -->
54
74
  > Note: `friction.cjs` parses Claude Code's session schema. The Codex/Antigravity roots
55
75
  > will resolve but yield no signals until friction learns their formats — open an issue
56
76
  > to request one: https://github.com/hamr0/liteagents/issues
@@ -72,11 +92,26 @@ Reads all raw material (`.factory/stash/*.md` + `.factory/remember/friction/anti
72
92
  fresh output). **Move only those pipeline files** — anything else in `.factory/memory/`
73
93
  (e.g. user-owned rule files) stays where it is. Remove the old dirs only if empty, update the managed MEMORY section in AGENTS.md to
74
94
  the new reference (step 5), and tell the user exactly what moved.
75
- - **Bootstrap `AGENT_RULES.md` (one-time, silent-if-present).** If
76
- `.factory/remember/AGENT_RULES.md` does not exist, copy it from the bundled template next
77
- to this command (`remember/AGENT_RULES.md`, same directory as `friction.cjs`). If it
78
- already exists, leave it untouched — never overwrite, even if the bundled template
79
- changes in a later version; it becomes user-owned the moment it lands in the project.
95
+ - **Sync `AGENT_RULES.md` from the installed template** — run the bundled script, which
96
+ does the whole decision itself. Call it by **absolute path**, for the same reason as
97
+ `version-check.cjs` in step 0: the cwd is the target repo, not this package.
98
+ ```bash
99
+ node ~/.factory/commands/remember/sync-rules.cjs
100
+ ```
101
+ It compares `.factory/remember/AGENT_RULES.md` against the template shipped beside it
102
+ and takes one of three actions: **absent** — copies it in; **identical** — does
103
+ nothing at all, no write and no output; **differs** — moves the old body to
104
+ `AGENT_RULES.md.bak` and copies the new one in, reporting both. Relay whatever it
105
+ prints in the step-8 report; it is silent when nothing changed.
106
+
107
+ **This replaced a bootstrap-once rule that never refreshed**, which left a measured 35
108
+ repos many releases behind. The rules doc is a shipped standards document, so it is
109
+ kept current rather than frozen on first write — nothing is destroyed, because a
110
+ differing body is always preserved in the backup first.
111
+
112
+ The comparison is a byte compare done *by the script*, never by you: a model-performed
113
+ copy can re-wrap a line or drop a trailing newline, and the file would then differ
114
+ forever, backing up on every single run.
80
115
  - Read all `.factory/stash/*.md` files in the current project
81
116
  - Read friction output written in step 0: `.factory/remember/friction/antigen_clusters.json` (preferred) or `.factory/remember/friction/antigen_review.md` (fallback). On the fallback path, step 4c does NO counting — merge quotes into
82
117
  matching entries only; never change `sessions`, `last_seen`, or `recurred_while_hot` (the
@@ -88,7 +123,11 @@ Reads all raw material (`.factory/stash/*.md` + `.factory/remember/friction/anti
88
123
  length-gate debt on `.factory/remember/MEMORY.md`. Steps 4-5 (friction → ledger count →
89
124
  Antigens render) are stash-independent and still run whenever friction produced output
90
125
  (see step 4's own guard). If there is also no friction
91
- output, report "nothing to consolidate" and stop after step 1.
126
+ output, report "nothing to consolidate" and stop after step 1 — **but run
127
+ step 5's `stub-check.cjs` before you stop.** The stub shape does not depend on
128
+ there being anything to consolidate, and skipping it on quiet runs is exactly
129
+ how a repo with nothing to remember stays broken forever. `sync-rules.cjs`
130
+ already ran above, for the same reason.
92
131
 
93
132
  2. **Extract from unprocessed stashes** (up to 5 stashes per agent, as few agents as possible — see Guardrails)
94
133
  - Each agent reads its batch of stashes together and calls the mid-tier model (see Guardrails) to extract:
@@ -387,11 +426,32 @@ Reads all raw material (`.factory/stash/*.md` + `.factory/remember/friction/anti
387
426
  Users trim this section deliberately (a pointer-only variant is common), and rewriting
388
427
  it silently re-adds text they removed, on every single run, forever. Observed in the
389
428
  field: a run restored the inline rules into a AGENTS.md whose owner had cut them, and
390
- the edit had to be reverted by hand. This matches how `AGENT_RULES.md` itself is
391
- handled bootstrapped once, never overwritten after.
429
+ the edit had to be reverted by hand. Note this no longer matches how `AGENT_RULES.md`
430
+ itself is handled: `sync-rules.cjs` refreshes that file every run, because it is a
431
+ shipped standards document with a backup behind it. This section is prose the user
432
+ owns, with nothing behind it — so it stays bootstrap-once.
392
433
  - If an existing pair is present but its **path pointer** is missing or wrong, that is
393
434
  load-bearing: **report it and stop**, do not silently rewrite the section around it.
394
435
 
436
+ - **Then assert the stub SHAPE mechanically** — run the bundled script by **absolute
437
+ path**, for the same reason as steps 0 and 1:
438
+ ```bash
439
+ node ~/.factory/commands/remember/stub-check.cjs
440
+ ```
441
+ It edits only *inside* the marker pairs, and only the mechanism: a MEMORY include that
442
+ is not `@.factory/remember/MEMORY.md` is repaired, and an `@`-include of
443
+ `AGENT_RULES.md` is demoted to a plain pointer. Prose inside the blocks is user-owned
444
+ and is never touched, which is why the bootstrap-once rule above still holds. It will
445
+ **not** repoint a MEMORY include at a file that does not exist — an un-migrated
446
+ `.factory/memory/` repo has a live MEMORY.md at the old path, and breaking a working
447
+ include to satisfy a naming convention is worse than reporting it. Silent when the
448
+ shape is already current; relay whatever it prints in the step-8 report.
449
+
450
+ Measured 2026-09-03: 21 of 37 local repos still carried the pre-v2.19 `@`-include of
451
+ `AGENT_RULES.md`, hot-loading ~300 lines into every session. A shape rule checked by
452
+ asking you to look is a rule that drifts back; this one is a byte-level assertion done
453
+ by the script, never by you.
454
+
395
455
  ```markdown
396
456
  # Project Memory
397
457
  > Auto-generated by /remember. Do not edit manually.
@@ -452,8 +512,10 @@ Reads all raw material (`.factory/stash/*.md` + `.factory/remember/friction/anti
452
512
  `index-flat` script `/docs-builder` already uses, never a model call. Wrapped so any
453
513
  failure here can never block the memory write that already happened in steps 3-6.
454
514
 
455
- - **Locate `docs-builder.cjs`** — bundled next to this command at
456
- `docs-builder/docs-builder.cjs` (same convention as `remember/friction.cjs`). Call it by
515
+ - **Locate `docs-builder.cjs`** — it ships in the `docs-builder/` directory
516
+ that sits beside this one (under `skills/` on Claude Code and Amp, under
517
+ `commands/` on Droid and opencode), exactly as `friction.cjs` ships beside
518
+ this file. Call it by
457
519
  its **absolute path** in the command below — the cwd here is the target repo, not this
458
520
  package, so a cwd-relative path fails everywhere except the liteagents repo itself.
459
521
  - **Not applicable, stay silent:** if the project has no `docs/` directory, skip without
@@ -535,7 +597,14 @@ Reads all raw material (`.factory/stash/*.md` + `.factory/remember/friction/anti
535
597
  ledger: ag-003 "don't commit per change" RECURRED while hot (2/2) → rephrased, attempt 2
536
598
  ledger: ag-002 "literal scoped ask" ESCALATED → Fact; 2 phrasings failed. Hook or accept?
537
599
  ```
538
- - If AGENT_RULES.md was bootstrapped this run, say so (one line)
600
+ - Relay verbatim whatever `version-check.cjs` (step 0), `sync-rules.cjs` (step 1), and
601
+ `stub-check.cjs` (step 5) printed. Never re-word or summarize them: they are the
602
+ record of a file that was written or a version gap, and a paraphrase of "your body
603
+ was backed up to AGENT_RULES.md.bak" can lose the filename the user needs.
604
+ - Each is silent when nothing changed, so silence is the normal case and there is
605
+ nothing to invent — never report an action that produced no output.
606
+ - Never a silent write: if any of the three wrote or moved a file and you did not
607
+ relay its line, that is a defect.
539
608
  - If step 7 ran the auto re-index, say so and name the regenerated files
540
609
  (`docs/index.md`, plus `docs/log.md` if touched) so they are staged with this run
541
610
  - Confirm MEMORY.md and AGENTS.md updated
@@ -543,7 +612,8 @@ Reads all raw material (`.factory/stash/*.md` + `.factory/remember/friction/anti
543
612
  **File locations (all project-local — two dirs: `/stash` owns `.factory/stash/`, `/remember` owns `.factory/remember/`)**
544
613
  - Stash files: `.factory/stash/*.md`
545
614
  - Memory file: `.factory/remember/MEMORY.md` (single source of truth, referenced as `@.factory/remember/MEMORY.md`)
546
- - Rules template: `.factory/remember/AGENT_RULES.md` (bootstrapped once from the bundled package template on first `/remember` run, never overwritten again user-owned after that; referenced by a plain path pointer, not `@`-referenced — see step 5)
615
+ - Rules template: `.factory/remember/AGENT_RULES.md` (refreshed from the bundled package template every `/remember` run by `sync-rules.cjs`; a differing body is backed up first, not silently overwritten — referenced by a plain path pointer, not `@`-referenced — see step 5)
616
+ - Rules backup: `.factory/remember/AGENT_RULES.md.bak` (written by `sync-rules.cjs` only when the existing body differs from the template; a single file, overwritten each time it fires — not timestamped)
547
617
  - Antigen ledger: `.factory/remember/ledger.json` (per-rule evidence trail: class, status, attempts/rejected-buffer, recurrence-while-hot)
548
618
  - Consolidation report: `.factory/remember/report.md` (latest step-8 report, overwritten each run)
549
619
  - Processed manifest: `.factory/remember/.processed`
@@ -0,0 +1,218 @@
1
+ ---
2
+ description: Use when any test fails, bug appears, or behaviour surprises you, before proposing a fix - find the cause and prove it, by reading real evidence, tracing bad values back to their origin, comparing against a working case, and testing one hypothesis at a time
3
+ ---
4
+
5
+ # Root Cause
6
+
7
+ **Find the cause before you change any code.**
8
+
9
+ ## The Law
10
+
11
+ ```
12
+ NO FIX WITHOUT A CAUSE YOU CAN POINT AT
13
+ ```
14
+
15
+ A fix at the place the error *appeared* is a symptom fix. It is a failure even when
16
+ the symptom goes away, because the real cause is still there and will surface
17
+ somewhere else, later, with less context.
18
+
19
+ You cannot propose a fix until Phase 1 is done.
20
+
21
+ ## When to Use
22
+
23
+ Any technical issue: a failing test, a production bug, unexpected behaviour, a
24
+ performance problem, a broken build, an integration that will not talk.
25
+
26
+ **Especially when it feels like overkill:**
27
+ - Under time pressure — emergencies are exactly when guessing is most tempting and most expensive
28
+ - "Just one quick fix" looks obvious
29
+ - You have already tried a fix and it did not work
30
+ - You do not fully understand the issue
31
+
32
+ Simple bugs have root causes too, and finding one takes minutes. Guess-and-check
33
+ takes hours and leaves damage behind.
34
+
35
+ ---
36
+
37
+ ## Phase 1 — Gather Evidence
38
+
39
+ Do all of this **before** forming any opinion about the fix.
40
+
41
+ ### 1. Read the error completely
42
+
43
+ Do not skim past it. Read the whole message, the whole stack trace, every warning
44
+ above it. Note line numbers, file paths, error codes. The answer is often written
45
+ there in full.
46
+
47
+ ### 2. Reproduce it consistently
48
+
49
+ Can you trigger it on demand? What are the exact steps? Does it happen every time?
50
+
51
+ If it is not reproducible, gather more data. Do not start guessing — an
52
+ intermittent bug you cannot trigger is a bug you cannot prove you fixed.
53
+
54
+ ### 3. Check what changed
55
+
56
+ Recent commits, the working diff, new dependencies, config edits, environment
57
+ differences between the place it works and the place it does not.
58
+
59
+ Be careful here: the most recent change is the most *available* suspect, not the
60
+ most likely one. Recency is a lead to test, never a conclusion.
61
+
62
+ ### 4. Instrument the boundaries (multi-component systems)
63
+
64
+ When the path crosses components — CI → build → sign, API → service → database,
65
+ workflow → script → tool — do not reason about where it breaks. Measure it.
66
+
67
+ For each boundary, log what goes **in** and what comes **out**, and confirm
68
+ configuration and environment actually propagated across it.
69
+
70
+ ```bash
71
+ echo "=== layer 1: is the secret present in the workflow? ==="
72
+ echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
73
+
74
+ echo "=== layer 2: did it survive into the build script? ==="
75
+ env | grep IDENTITY || echo "IDENTITY not in environment"
76
+
77
+ echo "=== layer 3: what does the tool actually see? ==="
78
+ security find-identity -v
79
+ ```
80
+
81
+ Run it **once** to find which boundary fails, then investigate only that
82
+ component. This turns "somewhere in the pipeline" into a named layer.
83
+
84
+ ### 5. Trace the bad value back to where it was born
85
+
86
+ When the error surfaces deep in the call stack, the place it exploded is almost
87
+ never the place it went wrong. Walk backwards.
88
+
89
+ **The chain:**
90
+
91
+ 1. **Observe the symptom** — `git init` ran in the source directory
92
+ 2. **Find the immediate cause** — the code that directly did it:
93
+ `execFileAsync('git', ['init'], { cwd: projectDir })`
94
+ 3. **Ask what called this, and with what value** — `projectDir` was `''`, and an
95
+ empty `cwd` silently resolves to the process's own directory
96
+ 4. **Keep going up** — who passed the empty string? and who gave it to *them*?
97
+ 5. **Stop at the origin** — the point where a correct value first became wrong
98
+
99
+ Fix it **there**. Then, if the value is dangerous, validate it at each layer on
100
+ the way down as well, so the same mistake cannot recur through a different path.
101
+
102
+ **When you cannot trace it by reading, instrument it:**
103
+
104
+ ```typescript
105
+ async function gitInit(directory: string) {
106
+ console.error('DEBUG git init:', {
107
+ directory,
108
+ cwd: process.cwd(),
109
+ stack: new Error().stack,
110
+ });
111
+ await execFileAsync('git', ['init'], { cwd: directory });
112
+ }
113
+ ```
114
+
115
+ - Capture the **stack**, not just the value — it names the caller you are looking for
116
+ - Log **before** the dangerous operation, not in its failure handler
117
+ - Include surrounding context: the directory, the working directory, relevant environment
118
+ - In tests, write to standard error directly; a project logger may be suppressed
119
+
120
+ **When something pollutes a test run but you cannot tell which test:** bisect.
121
+ Run the tests one at a time and stop at the first one that leaves the mess behind.
122
+ `find-polluter.sh` in this skill's directory does exactly that.
123
+
124
+ ---
125
+
126
+ ## Phase 2 — Compare Against Something That Works
127
+
128
+ You are looking for a difference, and the fastest way to see one is a side-by-side.
129
+
130
+ - **Find a working example** — similar code in the same codebase that behaves correctly
131
+ - **Read the reference completely** if you are following a pattern. Every line. Skimming a
132
+ reference and adapting "the idea" is how half-understood patterns ship
133
+ - **List every difference**, however small. Do not filter by "that can't matter" — that
134
+ judgement is exactly what you do not have yet
135
+ - **Check the dependencies**: what config, what environment, what other components does
136
+ the working one have that the broken one does not?
137
+
138
+ ---
139
+
140
+ ## Phase 3 — One Hypothesis, One Variable
141
+
142
+ - **State it in writing:** "I think X is the cause, because Y." Specific, not vague.
143
+ - **Test it with the smallest possible change.** One variable. A controlled test that
144
+ isolates your suspect beats a plausible story about the most recent commit.
145
+ - **Read the result honestly.** Confirmed → Phase 4. Not confirmed → form a *new*
146
+ hypothesis. Never stack a second fix on top of an unconfirmed first one.
147
+ - **Say when you do not know.** "I don't understand why X happens" is a real state and a
148
+ useful thing to report. Pretending to know produces confident wrong fixes.
149
+
150
+ ---
151
+
152
+ ## Phase 4 — Fix at the Source
153
+
154
+ ### 1. Write the failing test first
155
+
156
+ The simplest reproduction you can manage — an automated test if there is a suite, a
157
+ throwaway script if there is not.
158
+
159
+ **Run it against the unfixed code and watch it fail, for the reason you expect.** A
160
+ test written after the fix, or one that passes both before and after, proves nothing.
161
+ This is the step that converts your hypothesis into evidence.
162
+
163
+ ### 2. Make one change
164
+
165
+ Fix the cause you identified. One change. No "while I'm here" improvements, no bundled
166
+ refactoring — those make it impossible to tell what actually worked.
167
+
168
+ ### 3. Verify
169
+
170
+ Does the new test pass? Does the rest of the suite still pass? Is the original symptom
171
+ actually gone — checked, not assumed?
172
+
173
+ ### 4. If the fix did not work, stop and count
174
+
175
+ Under three attempts: return to Phase 1 with what you just learned. The failed attempt
176
+ is evidence.
177
+
178
+ **Three or more failed fixes means you have the wrong model of the problem.** Do not
179
+ attempt a fourth. The pattern to watch for: each fix uncovers a new problem somewhere
180
+ else, or each one needs "just a bit of refactoring" to land.
181
+
182
+ That is an architecture question, not a hypothesis question. Stop and raise it.
183
+
184
+ ---
185
+
186
+ ## Red Flags — Stop and Return to Phase 1
187
+
188
+ - "Quick fix now, investigate later"
189
+ - "Just try changing X and see"
190
+ - Several changes at once, then run the tests
191
+ - "Skip the test, I'll check it by hand"
192
+ - "It's probably X" — probably is not a cause
193
+ - "I don't fully understand this, but this might work"
194
+ - Listing fixes before tracing where the bad value came from
195
+ - "One more attempt" when two have already failed
196
+ - Each fix revealing a new problem somewhere else
197
+
198
+ ## Quick Reference
199
+
200
+ | Phase | You do | Done when |
201
+ |---|---|---|
202
+ | **1. Evidence** | Read the error, reproduce, check changes, instrument boundaries, trace the value back | You can say what happened and where it started |
203
+ | **2. Compare** | Find a working case, read it fully, list every difference | You know what is different |
204
+ | **3. Hypothesis** | State one cause, test one variable | Confirmed, or you have a new hypothesis |
205
+ | **4. Fix** | Failing test first, one change, verify | The test that failed now passes, and nothing else broke |
206
+
207
+ ## When There Really Is No Root Cause
208
+
209
+ It happens — a genuine race, an upstream bug, a hardware fault. But roughly nineteen
210
+ times in twenty, "no root cause" means the investigation stopped early.
211
+
212
+ Before you conclude it: can you reproduce it? Did you instrument every boundary? Did
213
+ you trace the value to its origin, or only to the last function you recognised?
214
+
215
+ ## Related
216
+
217
+ - **AGENT_RULES.md → Testing Standards** — what makes the Phase 4 test a real one
218
+ - **`/test-generate`** — build out the suite once the cause is fixed
@@ -1,9 +1,6 @@
1
1
  ---
2
- name: security
3
2
  description: Security audit — recurring six, injection, auth, trust boundaries
4
- usage: /security
5
3
  argument-hint: [file, directory, or leave empty for full scan]
6
- allowed-tools: Read, Grep, Glob, Bash(git log *), Bash(git grep *), Bash(rg *)
7
4
  ---
8
5
  Audit $ARGUMENTS for security vulnerabilities. **Reports, never edits** — it
9
6
  verifies every claim, then hands the findings to whoever asked.
@@ -1,8 +1,5 @@
1
1
  ---
2
- name: ship
3
2
  description: Mechanical pre-deploy gate — tests, build, tree state
4
- usage: /ship
5
- allowed-tools: Read, Grep, Glob, Bash(git *), Bash(npm *), Bash(pnpm *), Bash(yarn *), Bash(pytest *), Bash(python *), Bash(go *), Bash(cargo *), Bash(make *)
6
3
  ---
7
4
  Mechanical pre-deploy / pre-merge gate. Every item here is answerable by
8
5
  **running a command** and reading its exit code — no code judgment. Code
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -1,9 +1,5 @@
1
1
  ---
2
- name: skill-creator
3
2
  description: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
4
- usage: /skill-creator <skill-type> <skill-description>
5
- auto_trigger: false
6
- license: Complete terms in LICENSE.txt
7
3
  ---
8
4
 
9
5
  # Skill Creator
@@ -1,7 +1,5 @@
1
1
  ---
2
- name: stash
3
2
  description: Stash session context [name]
4
- usage: /stash ["optional-name"]
5
3
  argument-hint: [optional stash name]
6
4
  ---
7
5
 
@@ -1,9 +1,6 @@
1
1
  ---
2
- name: test-generate
3
2
  description: Generate and run tests [file]
4
- usage: /test-generate <file>
5
3
  argument-hint: [file or symbol to test]
6
- allowed-tools: Read, Edit, Write, Grep, Glob, Bash(npm test *), Bash(npx jest *), Bash(npx vitest *), Bash(pnpm test *), Bash(yarn test *), Bash(pytest *), Bash(python *), Bash(go test *), Bash(cargo test *), Bash(make test *)
7
4
  ---
8
5
  Generate tests for $ARGUMENTS, then run them. This is a generate → run →
9
6
  verify loop, not just file generation.
@@ -28,7 +25,7 @@ Match existing patterns:
28
25
  or new test-runner config.
29
26
  - Do **not** add test-only public methods or exports to production code to
30
27
  make a test possible — if the test wants a hook the prod code doesn't
31
- expose, stop and ask (`test-traps` territory).
28
+ expose, stop and ask.
32
29
 
33
30
  ## 3. Run
34
31
  Execute the project's real test command, scoped to just the new tests