liteagents 2.8.3 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +25 -31
  3. package/installer/cli.js +6 -2
  4. package/package.json +3 -3
  5. package/packages/ampcode/AGENT.md +9 -15
  6. package/packages/ampcode/agents/code-developer.md +11 -12
  7. package/packages/ampcode/agents/quality-assurance.md +1 -1
  8. package/packages/{droid/commands/systematic-debugging.md → ampcode/commands/debug-method.md} +9 -9
  9. package/packages/ampcode/commands/diff-review.md +78 -0
  10. package/packages/ampcode/commands/friction/friction.js +348 -122
  11. package/packages/ampcode/commands/optimize.md +45 -4
  12. package/packages/ampcode/commands/refactor.md +33 -1
  13. package/packages/ampcode/commands/remember.md +107 -46
  14. package/packages/ampcode/commands/security.md +28 -1
  15. package/packages/ampcode/commands/stash.md +7 -0
  16. package/packages/{droid/commands/test-driven-development.md → ampcode/commands/tdd-flow.md} +2 -2
  17. package/packages/ampcode/commands/test-generate.md +64 -15
  18. package/packages/{opencode/command/testing-anti-patterns.md → ampcode/commands/test-traps.md} +77 -3
  19. package/packages/{droid/commands/root-cause-tracing.md → ampcode/commands/trace-back.md} +3 -3
  20. package/packages/ampcode/commands/{verification-before-completion.md → verify-done.md} +3 -3
  21. package/packages/claude/CLAUDE.md +9 -15
  22. package/packages/claude/agents/code-developer.md +11 -12
  23. package/packages/claude/agents/quality-assurance.md +1 -1
  24. package/packages/claude/commands/diff-review.md +78 -0
  25. package/packages/claude/commands/friction/friction.js +348 -122
  26. package/packages/claude/commands/optimize.md +45 -4
  27. package/packages/claude/commands/refactor.md +33 -1
  28. package/packages/claude/commands/remember.md +107 -46
  29. package/packages/claude/commands/security.md +28 -1
  30. package/packages/claude/commands/stash.md +7 -0
  31. package/packages/claude/commands/test-generate.md +64 -15
  32. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package-lock.json +3 -3
  33. package/packages/claude/skills/{systematic-debugging → debug-method}/CREATION-LOG.md +1 -1
  34. package/packages/claude/skills/{systematic-debugging → debug-method}/SKILL.md +9 -9
  35. package/packages/claude/skills/{systematic-debugging → debug-method}/test-academic.md +1 -1
  36. package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-1.md +1 -1
  37. package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-2.md +1 -1
  38. package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-3.md +1 -1
  39. package/packages/claude/skills/{test-driven-development → tdd-flow}/SKILL.md +3 -3
  40. package/packages/claude/skills/{testing-anti-patterns → test-traps}/SKILL.md +77 -3
  41. package/packages/claude/skills/{root-cause-tracing → trace-back}/SKILL.md +3 -3
  42. package/packages/claude/skills/{verification-before-completion → verify-done}/SKILL.md +3 -3
  43. package/packages/droid/AGENTS.md +8 -14
  44. package/packages/{opencode/command/systematic-debugging.md → droid/commands/debug-method.md} +9 -9
  45. package/packages/droid/commands/diff-review.md +78 -0
  46. package/packages/droid/commands/friction/friction.js +348 -122
  47. package/packages/droid/commands/optimize.md +45 -4
  48. package/packages/droid/commands/refactor.md +33 -1
  49. package/packages/droid/commands/remember.md +107 -46
  50. package/packages/droid/commands/security.md +28 -1
  51. package/packages/droid/commands/stash.md +7 -0
  52. package/packages/{opencode/command/test-driven-development.md → droid/commands/tdd-flow.md} +2 -2
  53. package/packages/droid/commands/test-generate.md +64 -15
  54. package/packages/droid/commands/{testing-anti-patterns.md → test-traps.md} +77 -3
  55. package/packages/{opencode/command/root-cause-tracing.md → droid/commands/trace-back.md} +3 -3
  56. package/packages/droid/commands/{verification-before-completion.md → verify-done.md} +3 -3
  57. package/packages/droid/droids/code-developer.md +11 -12
  58. package/packages/droid/droids/quality-assurance.md +1 -1
  59. package/packages/opencode/AGENTS.md +8 -14
  60. package/packages/opencode/agent/code-developer.md +11 -12
  61. package/packages/opencode/agent/quality-assurance.md +1 -1
  62. package/packages/{ampcode/commands/systematic-debugging.md → opencode/command/debug-method.md} +9 -9
  63. package/packages/opencode/command/diff-review.md +78 -0
  64. package/packages/opencode/command/friction/friction.js +348 -122
  65. package/packages/opencode/command/optimize.md +45 -4
  66. package/packages/opencode/command/refactor.md +33 -1
  67. package/packages/opencode/command/remember.md +107 -46
  68. package/packages/opencode/command/security.md +28 -1
  69. package/packages/opencode/command/stash.md +7 -0
  70. package/packages/{ampcode/commands/test-driven-development.md → opencode/command/tdd-flow.md} +2 -2
  71. package/packages/opencode/command/test-generate.md +64 -15
  72. package/packages/{ampcode/commands/testing-anti-patterns.md → opencode/command/test-traps.md} +77 -3
  73. package/packages/{ampcode/commands/root-cause-tracing.md → opencode/command/trace-back.md} +3 -3
  74. package/packages/opencode/command/{verification-before-completion.md → verify-done.md} +3 -3
  75. package/packages/opencode/opencode.jsonc +13 -37
  76. package/packages/subagentic-manual.md +55 -51
  77. package/packages/ampcode/commands/code-review.md +0 -107
  78. package/packages/ampcode/commands/condition-based-waiting.md +0 -122
  79. package/packages/ampcode/commands/debug.md +0 -20
  80. package/packages/ampcode/commands/explain.md +0 -18
  81. package/packages/ampcode/commands/friction.md +0 -139
  82. package/packages/ampcode/commands/git-commit.md +0 -14
  83. package/packages/ampcode/commands/review.md +0 -18
  84. package/packages/claude/commands/debug.md +0 -20
  85. package/packages/claude/commands/explain.md +0 -18
  86. package/packages/claude/commands/friction.md +0 -139
  87. package/packages/claude/commands/git-commit.md +0 -14
  88. package/packages/claude/commands/review.md +0 -18
  89. package/packages/claude/skills/code-review/SKILL.md +0 -107
  90. package/packages/claude/skills/code-review/code-reviewer.md +0 -146
  91. package/packages/claude/skills/condition-based-waiting/SKILL.md +0 -122
  92. package/packages/droid/commands/code-review.md +0 -107
  93. package/packages/droid/commands/condition-based-waiting.md +0 -122
  94. package/packages/droid/commands/debug.md +0 -20
  95. package/packages/droid/commands/explain.md +0 -18
  96. package/packages/droid/commands/friction.md +0 -139
  97. package/packages/droid/commands/git-commit.md +0 -14
  98. package/packages/droid/commands/review.md +0 -18
  99. package/packages/opencode/command/code-review.md +0 -107
  100. package/packages/opencode/command/condition-based-waiting.md +0 -122
  101. package/packages/opencode/command/debug.md +0 -20
  102. package/packages/opencode/command/explain.md +0 -18
  103. package/packages/opencode/command/friction.md +0 -139
  104. package/packages/opencode/command/git-commit.md +0 -14
  105. package/packages/opencode/command/review.md +0 -18
  106. /package/packages/ampcode/commands/{condition-based-waiting → test-traps}/example.ts +0 -0
  107. /package/packages/ampcode/commands/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
  108. /package/packages/claude/skills/{condition-based-waiting → test-traps}/example.ts +0 -0
  109. /package/packages/claude/skills/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
  110. /package/packages/droid/commands/{condition-based-waiting → test-traps}/example.ts +0 -0
  111. /package/packages/droid/commands/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
  112. /package/packages/opencode/command/{condition-based-waiting → test-traps}/example.ts +0 -0
  113. /package/packages/opencode/command/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
@@ -3,6 +3,7 @@ name: optimize
3
3
  description: Optimize performance [target]
4
4
  usage: /optimize <target-area>
5
5
  argument-hint: [file-or-function]
6
+ allowed-tools: Read, Edit, Grep, Glob, Bash(git diff:*), Bash(git log:*), Bash(git grep:*), Bash(rg:*)
6
7
  ---
7
8
  Analyze $ARGUMENTS for performance.
8
9
 
@@ -14,7 +15,47 @@ Analyze $ARGUMENTS for performance.
14
15
  - Unnecessary allocations
15
16
 
16
17
  ## Output
17
- - Current bottlenecks
18
- - Specific optimizations
19
- - Expected improvement
20
- - Trade-offs involved
18
+ Per bottleneck:
19
+ - **Location** (`file:line`)
20
+ - **Cost** — what's slow and by how much. Concrete ("N+1 over ~1k rows on
21
+ every page load"), not vague ("could be faster").
22
+ - **Optimization** — specific change.
23
+ - **Expected improvement** — order-of-magnitude estimate.
24
+ - **Trade-offs** — readability / memory / consistency cost.
25
+
26
+ ## After the analysis — verify, then fix
27
+
28
+ Performance claims are easy to invent. Validate before acting.
29
+
30
+ **Verify each bottleneck.** Re-read the cited `file:line` in context.
31
+ Confirm the path is **actually hot** — look for at least one of:
32
+ - a profile / benchmark / log line showing call frequency or duration,
33
+ - the path sits on an obvious hot loop / per-request handler with real
34
+ volume,
35
+ - the user provided evidence in the request.
36
+
37
+ Without one of those, the claim is **uncertain — don't optimize on
38
+ speculation.** Mark each finding **confirmed**, **false positive** (with
39
+ reason), or **uncertain (needs profiling data)**.
40
+
41
+ **Fix what's confirmed and unambiguous** — minimal change, one obvious
42
+ shape, **no behavior change**, no API change. Apply directly. After
43
+ each edit, re-read the changed region and confirm it still computes the
44
+ same answer (perf optimizations that quietly change semantics are the
45
+ worst kind).
46
+
47
+ **Stop and ask** when (HITL gates — not all the time, only here):
48
+ - the bottleneck is **uncertain** after grounding (no profile / log and
49
+ not obviously hot),
50
+ - the fix has **multiple reasonable shapes** (cache vs precompute vs
51
+ batch vs paginate vs index) — present options with tradeoffs, not a
52
+ chosen path,
53
+ - it changes **public API / response shape / DB schema / caller contract**,
54
+ - it trades **correctness for speed** (lossy approximation, weaker
55
+ consistency, eventual-vs-strict) — even when "obviously" faster, or
56
+ - it touches **concurrency primitives** (locks, atomics, ordering) —
57
+ easy to introduce races.
58
+
59
+ Final report: **confirmed-and-fixed** · **confirmed-but-asking** (why +
60
+ options) · **false-positive** (why) · **uncertain** (what profiling /
61
+ data is needed to decide).
@@ -3,6 +3,7 @@ name: refactor
3
3
  description: Refactor [code]
4
4
  usage: /refactor <code-section>
5
5
  argument-hint: [file-or-function]
6
+ allowed-tools: Read, Edit, 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:*), Bash(git diff:*)
6
7
  ---
7
8
  Refactor $ARGUMENTS.
8
9
 
@@ -14,8 +15,39 @@ Refactor $ARGUMENTS.
14
15
  - Smaller functions (single responsibility)
15
16
 
16
17
  ## Constraints
17
- - NO behavior changes
18
+ - **NO behavior changes**
18
19
  - Keep public API intact
19
20
  - Existing tests must pass
20
21
 
21
22
  Explain each change.
23
+
24
+ ## After the refactor — verify it didn't break anything
25
+
26
+ "Existing tests must pass" is the load-bearing constraint, and the only
27
+ honest way to know is to run them.
28
+
29
+ 1. **Detect the project's test command** (look for `package.json`
30
+ scripts, `pytest.ini` / `pyproject.toml`, `go.mod`, `Cargo.toml`,
31
+ `Makefile`). If none is found, **stop and ask** before claiming the
32
+ refactor is done — silent green isn't acceptable.
33
+ 2. **Run the tests.** Scope to the affected area when possible (`-t`,
34
+ `--testPathPattern`, `pytest path/`, `go test ./pkg`); otherwise run
35
+ the suite.
36
+ 3. **Report** pass / fail counts and any failure's name + `file:line`.
37
+
38
+ **Stop and ask** when (HITL gates — not all the time, only here):
39
+ - a test **fails** after the refactor. Don't auto-revert (destroys
40
+ work-in-progress) and don't push forward (the no-behavior-change
41
+ constraint is broken). Present the failure and the options:
42
+ **revert**, **patch the refactor**, or **update the test** (with
43
+ reasoning).
44
+ - the refactor crossed a **public API boundary** that callers depend
45
+ on — even if tests pass, downstream consumers may break.
46
+ - the change is **bigger than the user asked for** (scope creep —
47
+ unrelated cleanups, formatting, comment edits). Confirm before
48
+ applying.
49
+
50
+ Final report:
51
+ - **refactor done, tests N pass / 0 fail** — ready, OR
52
+ - **refactor done, but K tests fail** — awaiting direction (revert /
53
+ patch / update test).
@@ -4,24 +4,56 @@ description: Consolidate stashes + friction into project memory
4
4
  usage: /remember
5
5
  ---
6
6
 
7
- Consolidate session stashes and friction analysis into a single project-local MEMORY.md, then inject into CLAUDE.md.
7
+ Run friction analysis, then consolidate session stashes + friction antigens into a single project-local MEMORY.md, and inject into CLAUDE.md. Friction runs automatically (best-effort) — there is no separate `/friction` command.
8
8
 
9
9
  **Guardrails**
10
10
  - Favor straightforward, minimal implementations first and add complexity only when requested or clearly required.
11
11
  - Keep changes tightly scoped to the requested outcome.
12
+ - **Precision over recall for hot memory.** A false antigen loaded into `@MEMORY.md` steers every future session. When unsure, record as a low-confidence episode — do not promote.
12
13
 
13
14
  **What it does**
14
15
 
15
- Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_clusters.json`), extracts durable facts, episodes, and behavioral preferences into a single `.claude/memory/MEMORY.md`, then injects a managed memory section into `CLAUDE.md`.
16
+ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_clusters.json`), extracts durable facts, episodes, and behavioral antigens into a single `.claude/memory/MEMORY.md`, then injects a managed memory section into `CLAUDE.md`.
16
17
 
17
18
  **Steps**
18
19
 
20
+ 0. **Run friction first** (best-effort — friction analyzes ALL your usage, not just this repo)
21
+
22
+ Friction's signal is *global*: recurring corrections and frustrations across every
23
+ project are behavioral lessons worth keeping everywhere. So point it at the tool's
24
+ **global sessions root** (all projects), not a per-project directory.
25
+
26
+ - **Locate `friction.js`** — it is bundled next to this command at `friction/friction.js`
27
+ (the same directory as `remember.md`, whether installed or run from the package). If it
28
+ exists nowhere, skip to step 1 (stash-only) and tell the user friction.js is missing.
29
+ - **Resolve the global sessions root** — probe this list top-to-bottom, use the first that
30
+ exists and contains `.jsonl` files (recursively). **Never prompt the user.**
31
+ ```
32
+ # ── Add your own global sessions root at the TOP so it is checked first ──
33
+ ~/.claude/projects/ # Claude Code
34
+ ~/.factory/projects/ # Droid / Factory
35
+ ~/.config/amp/projects/ # Amp
36
+ ~/.config/opencode/projects/ # opencode
37
+ ~/.codex/sessions/ # Codex CLI (use $CODEX_HOME/sessions/ if set)
38
+ ~/.gemini/antigravity-cli/brain/ # Antigravity
39
+ ```
40
+ > Note: `friction.js` parses Claude Code's session schema. The Codex/Antigravity roots
41
+ > will resolve but yield no signals until friction learns their formats — open an issue
42
+ > to request one: https://github.com/hamr0/liteagents/issues
43
+ - **Run** `node <friction.js> "<resolved-root>"`. friction writes its output to
44
+ `.claude/friction/` in the current project.
45
+ - **On any miss — loud, never silent.** If no root resolves, or friction errors, or it
46
+ finds no usable sessions, print this and continue with stash-only consolidation:
47
+ > ⚠️ Friction didn't run — no sessions found. To enable it, open this command file
48
+ > (`remember.md`) and add your tool's **global** sessions root to the TOP of the probe
49
+ > list in step 0, then re-run `/remember`. Consolidating stashes only this time.
50
+
19
51
  1. **Gather sources**
20
52
  - Read all `.claude/stash/*.md` files in the current project
21
- - Check for friction output at `.claude/friction/antigen_clusters.json` (preferred) or `.claude/friction/antigen_review.md` (fallback)
53
+ - Read friction output written in step 0: `.claude/friction/antigen_clusters.json` (preferred) or `.claude/friction/antigen_review.md` (fallback)
22
54
  - Read existing `.claude/memory/MEMORY.md` if it exists — create dir if missing
23
55
  - Read processed manifest at `.claude/memory/.processed` — skip already-processed stashes
24
- - If no unprocessed stashes, report "nothing to consolidate" and stop
56
+ - If no unprocessed stashes AND friction produced no new antigens, report "nothing to consolidate" and stop
25
57
 
26
58
  2. **Extract from unprocessed stashes** (use Task tool with sonnet model for each)
27
59
  - For each unprocessed stash, call sonnet to extract:
@@ -31,13 +63,72 @@ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_cluster
31
63
  - Collect all new facts and episodes
32
64
 
33
65
  3. **Merge into MEMORY.md**
34
- - Read existing `.claude/memory/MEMORY.md` and parse its three sections (## Facts, ## Episodes, ## Preferences)
66
+ - Read existing `.claude/memory/MEMORY.md` and parse its sections (## Facts, ## Episodes, ## Antigens)
35
67
  - **Facts section**: call sonnet with existing facts + newly extracted facts
36
68
  - Rules: new updates replace old, contradictions keep new version, duplicates dropped
37
69
  - Keep facts atomic, one line each
38
70
  - **Episodes section**: append new episode entries (append-only, timestamped, no dedup)
39
- - **Preferences section**: only update if friction output exists (step 4)
40
- - Write merged result to `.claude/memory/MEMORY.md` in this format:
71
+ - **Antigens section**: only update from friction output (step 4)
72
+ - Write merged result to `.claude/memory/MEMORY.md` in the format under step 6.
73
+
74
+ 4. **Distill friction into antigens** (only if friction output exists)
75
+
76
+ > Friction has already done the heavy part: it scanned the raw session logs,
77
+ > kept only **observed user reactions** (corrections, curses, repeated stops),
78
+ > pooled them per session, and lexically pre-grouped the obvious repeats. Each
79
+ > cluster carries `theme`, `suggested_artifact`, `confidence`, `severity`,
80
+ > `sessions` (recurrence count), `projects`, `signals`, `contexts` (the verbatim
81
+ > user quotes), `preceding` (the agent action + result just before the reaction —
82
+ > the trigger), and `self_suspect` (friction's guess that the user was correcting
83
+ > *themselves*). **You work from these short quotes — never re-read the session
84
+ > logs.** Friction's lexical grouping and flags are hints, not the verdict.
85
+
86
+ - Read `.claude/friction/antigen_clusters.json`.
87
+ - **4a. Classify target, then semantically consolidate** (the parts lexical matching can't do).
88
+ Call sonnet with the cluster quotes + their `preceding`/`projects`/`sessions`/`self_suspect`
89
+ (NOT the logs), and have it:
90
+ 1. **Decide the target of each reaction — agent or self.** Drop *self/context*
91
+ corrections where the user redirected themselves ("wrong project", "wrong window",
92
+ "nevermind") — the agent did nothing wrong. `self_suspect` and an empty `preceding`
93
+ (no agent action) are strong cues. Keep only **agent-directed** reactions.
94
+ 2. **Merge same-complaint paraphrases** that friction left split because they share no
95
+ words (e.g. "nothing landed, fuck you" + "it says pushed but none got it" → one antigen).
96
+ Output one object per surviving antigen:
97
+ ```json
98
+ {
99
+ "rule": "Verify the artifact is actually live after publish; a clean exit code ≠ done",
100
+ "target": "agent",
101
+ "evidence": ["both say pushed... none got it", "notng landed in live-claude, fuck you"],
102
+ "errors": ["Exit code 0 (claimed success)"],
103
+ "sessions": 2,
104
+ "confidence": "medium"
105
+ }
106
+ ```
107
+ - **4b. Route + tier by recurrence.** For each cluster and each LLM-merged group:
108
+ - `suggested_artifact: antigen` (recurring + severe) or an LLM-merged group → an
109
+ **antigen** (a "do/don't" behavioral rule), with its verbatim evidence quotes.
110
+ - `suggested_artifact: fact` (recurring + mild) → a **Fact**.
111
+ - `suggested_artifact: episode` that did **not** merge into a recurring group → an
112
+ **Episode** (one-off; recorded, not a rule).
113
+ - Confidence by distinct-session recurrence:
114
+ - **High** (5+ sessions) → loaded hot via `@MEMORY.md`
115
+ - **Medium** (3-4 sessions) → recorded under Antigens, *not* loaded hot
116
+ - **Low** (<3 sessions) → keep as Episode only
117
+ - **Never auto-promote.** Only High-confidence (5+ sessions) antigens load hot. A
118
+ single dramatic correction is an Episode, not an antigen.
119
+ - Update the Antigens section in MEMORY.md (promote/demote based on new recurrence).
120
+
121
+ 5. **Inject memory reference into CLAUDE.md**
122
+ - Compose the section between `<!-- MEMORY:START -->` and `<!-- MEMORY:END -->` markers:
123
+ ```
124
+ <!-- MEMORY:START -->
125
+ @MEMORY.md
126
+ <!-- MEMORY:END -->
127
+ ```
128
+ - The `@MEMORY.md` reference points to `.claude/memory/MEMORY.md` — Claude loads the full file directly, so no inline duplication is needed
129
+ - If CLAUDE.md already has MEMORY markers, replace the section between them
130
+ - If CLAUDE.md has no MEMORY markers, append the section at the end
131
+ - If no CLAUDE.md exists, create one with just the memory section
41
132
 
42
133
  ```markdown
43
134
  # Project Memory
@@ -45,52 +136,22 @@ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_cluster
45
136
 
46
137
  ## Facts
47
138
  - [atomic fact 1]
48
- - [atomic fact 2]
49
139
 
50
140
  ## Episodes
51
141
  ### YYYY-MM-DD - [title]
52
142
  - [bullet narrative]
53
143
 
54
- ### YYYY-MM-DD - [title]
55
- - [bullet narrative]
144
+ ## Antigens
145
+ ### High Confidence (loaded — applies every session)
146
+ - [behavioral rule] (evidence: [N] sessions — "[verbatim quote]")
56
147
 
57
- ## Preferences
58
- ### High Confidence
59
- - [pattern] (evidence: [count] observations)
148
+ ### Medium Confidence (observing — not loaded)
149
+ - [behavioral rule] (evidence: [N] sessions)
60
150
 
61
- ### Medium Confidence
62
- - [pattern] (evidence: [count] observations)
63
-
64
- ### Low Confidence
65
- - [pattern] (evidence: [count] observations)
151
+ ### Low Confidence (needs more data)
152
+ - [pattern] (evidence: [N] sessions)
66
153
  ```
67
154
 
68
- 4. **Distill friction into preferences** (only if friction output exists)
69
- - Read `.claude/friction/antigen_clusters.json` — this contains clustered failure patterns with counts, user_context quotes, and tool sequences
70
- - For the **top 10 clusters** (by score), extract the `contexts` field — these are the actual user messages that show behavioral patterns
71
- - Call sonnet with:
72
- - The top 10 clusters (signal, tool_pattern, count, sessions, contexts, errors)
73
- - Existing Preferences section from MEMORY.md
74
- - Extract BEHAVIORAL preferences (patterns demonstrated, not stated) — the user_context quotes are the primary evidence
75
- - Confidence tiers:
76
- - **High Confidence**: 5+ observations — available via @MEMORY.md
77
- - **Medium Confidence**: 3+ observations — observing, not loaded
78
- - **Low Confidence**: <3 observations — needs more data
79
- - Promote/demote based on new evidence
80
- - Update the Preferences section in MEMORY.md
81
-
82
- 5. **Inject memory reference into CLAUDE.md**
83
- - Compose the section between `<!-- MEMORY:START -->` and `<!-- MEMORY:END -->` markers:
84
- ```
85
- <!-- MEMORY:START -->
86
- @MEMORY.md
87
- <!-- MEMORY:END -->
88
- ```
89
- - The `@MEMORY.md` reference points to `.claude/memory/MEMORY.md` — Claude loads the full file directly, so no inline duplication is needed
90
- - If CLAUDE.md already has MEMORY markers, replace the section between them
91
- - If CLAUDE.md has no MEMORY markers, append the section at the end
92
- - If no CLAUDE.md exists, create one with just the memory section
93
-
94
155
  6. **Update processed manifest**
95
156
  - Append paths of newly processed stashes to `.claude/memory/.processed`
96
157
 
@@ -98,13 +159,13 @@ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_cluster
98
159
  - Number of stashes processed
99
160
  - Facts count (total, new)
100
161
  - Episodes count (total, new)
101
- - Preferences count by confidence tier
162
+ - Antigens count by confidence tier, with how many newly promoted to hot
102
163
  - Confirm MEMORY.md and CLAUDE.md updated
103
164
 
104
165
  **File locations (all project-local)**
105
166
  - Memory file: `.claude/memory/MEMORY.md` (single source of truth, referenced as @MEMORY.md)
106
167
  - Stash files: `.claude/stash/*.md`
107
- - Friction output: `.claude/friction/antigen_clusters.json` (clustered patterns with user contexts)
168
+ - Friction output: `.claude/friction/antigen_clusters.json` (observed-reaction clusters: theme, suggested_artifact, confidence, severity, sessions, projects, contexts)
108
169
  - Friction fallback: `.claude/friction/antigen_review.md` (human-readable clusters)
109
170
  - Processed manifest: `.claude/memory/.processed`
110
171
  - Output: `CLAUDE.md` (managed MEMORY section with @MEMORY.md reference)
@@ -3,7 +3,7 @@ name: security
3
3
  description: Scan security [target]
4
4
  usage: /security
5
5
  argument-hint: [file, directory, or leave empty for full scan]
6
- allowed-tools: Read, Grep, Glob, Bash(git log:*), Bash(git grep:*), Bash(rg:*)
6
+ allowed-tools: Read, Edit, Grep, Glob, Bash(git log:*), Bash(git grep:*), Bash(rg:*)
7
7
  ---
8
8
  Audit $ARGUMENTS for security vulnerabilities. Adapt scope to what the target
9
9
  actually is — a library, CLI, web app, and service won't all have every
@@ -57,3 +57,30 @@ Severity-ranked findings (Critical → High → Medium → Low), each with:
57
57
  End with: which of the six classes were checked and found **clean**, and any
58
58
  marked **N/A** for this target — so the scan's coverage is auditable, not just
59
59
  its hits.
60
+
61
+ ## After the scan — verify, then fix
62
+
63
+ Findings are claims, not facts. Validate before acting; validate again after.
64
+
65
+ **Verify each claim.** Re-read the cited `file:line` in context. Confirm the
66
+ risk actually holds here — not in the abstract. Mark each **confirmed**, **false
67
+ positive** (with reason), or **uncertain**.
68
+
69
+ **Fix what's confirmed and unambiguous** — minimal shape, one obvious way, no
70
+ change to a public API / response / caller contract. Apply directly. After
71
+ each edit, re-read the changed region and confirm it closes the gap without
72
+ breaking nearby logic. A fix isn't done until you've grounded it the same way
73
+ you grounded the claim.
74
+
75
+ **Stop and ask** when any of these hold (HITL gates — not all the time, only
76
+ here):
77
+ - the finding is **uncertain** after grounding (you'd need info you don't have),
78
+ - the fix has **multiple reasonable shapes** (e.g. reject-vs-sanitize,
79
+ index-vs-paginate) — present options with tradeoffs, not a chosen path,
80
+ - it **affects downstream** (function signatures, response shape, DB schema,
81
+ any caller contract), or
82
+ - it touches **auth / crypto / session / token** primitives — even an "obvious"
83
+ fix here warrants confirmation.
84
+
85
+ Final report: **confirmed-and-fixed** · **confirmed-but-asking** (why + options)
86
+ · **false-positive** (why) · **uncertain** (what's needed to decide).
@@ -17,6 +17,13 @@ Save session context for compaction recovery or handoffs.
17
17
  3. Stores important findings and insights
18
18
  4. Creates stash file in `.claude/stash/`
19
19
  5. Enables context restoration after compaction
20
+ 6. **Consolidation nudge** — after saving, count the unprocessed backlog:
21
+ `unprocessed = (files in .claude/stash/*.md) − (entries in .claude/memory/.processed)`
22
+ (a missing `.processed` manifest means 0 processed). If `unprocessed >= 5`, end with one line:
23
+ > 📝 N stashes since last consolidation — run `/remember` to fold them into memory.
24
+
25
+ No counter is stored — the count is derived each time, and running `/remember` updates
26
+ `.processed`, so the backlog drops on its own. Just emit the nudge; never run `/remember` automatically.
20
27
 
21
28
  **When to use**
22
29
  - Before long-running tasks that may trigger compaction
@@ -1,18 +1,67 @@
1
1
  ---
2
2
  name: test-generate
3
- description: Generate tests [file]
4
- usage: /test-generate <code-section>
5
- argument-hint: [file-to-test]
3
+ description: Generate and run tests [file]
4
+ usage: /test-generate <file>
5
+ 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:*)
6
7
  ---
7
- Generate tests for $ARGUMENTS.
8
-
9
- ## Include
10
- - Happy path (expected usage)
11
- - Edge cases (empty, null, boundaries)
12
- - Error scenarios (invalid input, failures)
13
- - Integration points (mocks for external deps)
14
-
15
- ## Requirements
16
- - Match existing test patterns in this project
17
- - Use the testing framework already in use
18
- - Clear test names: "should [expected] when [condition]"
8
+ Generate tests for $ARGUMENTS, then run them. This is a generate → run →
9
+ verify loop, not just file generation.
10
+
11
+ ## 1. Discover
12
+ - Detect the test framework already in use (look for `jest.config*`,
13
+ `vitest.config*`, `pytest.ini` / `pyproject.toml [tool.pytest]`, Go's
14
+ `_test.go` convention, `Cargo.toml [dev-dependencies]`, etc.). **Never
15
+ add a new framework or runner.**
16
+ - Skim 1–2 existing test files near the target to mirror style, fixtures,
17
+ setup/teardown, assertion style, and naming convention.
18
+
19
+ ## 2. Generate
20
+ Cover:
21
+ - **Happy path** (expected usage)
22
+ - **Edges** (empty / null / boundary / malformed)
23
+ - **Errors** (invalid input, IO / network / DB failures)
24
+
25
+ Match existing patterns:
26
+ - Same framework, same fixture style, same naming convention.
27
+ - Reuse existing setup/teardown helpers; do **not** add new mock libraries
28
+ or new test-runner config.
29
+ - Do **not** add test-only public methods or exports to production code to
30
+ make a test possible — if the test wants a hook the prod code doesn't
31
+ expose, stop and ask (`test-traps` territory).
32
+
33
+ ## 3. Run
34
+ Execute the project's real test command, scoped to just the new tests
35
+ (`-t <name>`, `--testPathPattern`, `pytest path/to/test.py`, `go test
36
+ ./pkg`, etc.). Report:
37
+ - Pass / fail counts.
38
+ - Any failure with the assertion message and `file:line`.
39
+
40
+ ## 4. Verify the tests BITE
41
+ A test that passes is not the same as a test that **exercises** the code.
42
+ For each new test, confirm:
43
+ - It would fail if the function under test returned the wrong value.
44
+ Mentally swap a broken impl — does the assertion actually catch it?
45
+ - It isn't `expect(true).toBe(true)`, `expect(fn).toBeDefined()`, or a
46
+ mock asserting itself.
47
+ - It isn't passing only because the setup masked the real call.
48
+
49
+ Mark each new test **biting** or **superficial** (with reason).
50
+ Superficial tests count as a failure to ship — either fix or delete.
51
+
52
+ ## 5. Report
53
+ - Files added / modified.
54
+ - Pass / fail.
55
+ - Biting vs superficial breakdown.
56
+ - What was deliberately **not** tested, and why (third-party shims,
57
+ trivial getters/setters, generated code). Documented gaps beat fake
58
+ coverage.
59
+
60
+ **Stop and ask** when:
61
+ - A meaningful test would require a non-obvious design change to
62
+ production code (don't pollute prod to make tests pass — present the
63
+ options instead).
64
+ - The existing test setup has multiple reasonable patterns and it's
65
+ unclear which to mirror.
66
+ - An existing dependency would need to be mocked in a way the project
67
+ doesn't currently do (introducing a new mock style is a design choice).
@@ -572,9 +572,9 @@
572
572
  }
573
573
  },
574
574
  "node_modules/hono": {
575
- "version": "4.12.18",
576
- "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.18.tgz",
577
- "integrity": "sha512-RWzP96k/yv0PQfyXnWjs6zot20TqfpfsNXhOnev8d1InAxubW93L11/oNUc3tQqn2G0bSdAOBpX+2uDFHV7kdQ==",
575
+ "version": "4.12.25",
576
+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.25.tgz",
577
+ "integrity": "sha512-2NFaIyNVgJmBs/ecmtGzlmluTFs5cHEWGTdu0t1HBwYzoGXOL5nUQBRMXsXWla5i4KkG//QMzVP88m1+I3fdAQ==",
578
578
  "license": "MIT",
579
579
  "engines": {
580
580
  "node": ">=16.9.0"
@@ -104,7 +104,7 @@ Bulletproof skill that:
104
104
  ## Usage Example
105
105
 
106
106
  When encountering a bug:
107
- 1. Load skill: skills/debugging/systematic-debugging
107
+ 1. Load skill: skills/debug-method
108
108
  2. Read overview (10 sec) - reminded of mandate
109
109
  3. Follow Phase 1 checklist - forced investigation
110
110
  4. If tempted to skip - see anti-pattern, stop
@@ -1,11 +1,11 @@
1
1
  ---
2
- name: systematic-debugging
2
+ name: debug-method
3
3
  description: Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes - four-phase framework (root cause investigation, pattern analysis, hypothesis testing, implementation) that ensures understanding before attempting solutions
4
- usage: /systematic-debugging <bug-or-error-description>
4
+ usage: /debug-method <bug-or-error-description>
5
5
  auto_trigger: false
6
6
  ---
7
7
 
8
- # Systematic Debugging
8
+ # Debug Method
9
9
 
10
10
  ## Overview
11
11
 
@@ -113,7 +113,7 @@ You MUST complete each phase before proceeding to the next.
113
113
 
114
114
  **WHEN error is deep in call stack:**
115
115
 
116
- **REQUIRED SUB-SKILL:** Use root-cause-tracing for backward tracing technique
116
+ **REQUIRED SUB-SKILL:** Use trace-back for backward tracing technique
117
117
 
118
118
  **Quick version:**
119
119
  - Where does bad value originate?
@@ -178,7 +178,7 @@ You MUST complete each phase before proceeding to the next.
178
178
  - Automated test if possible
179
179
  - One-off test script if no framework
180
180
  - MUST have before fixing
181
- - **REQUIRED SUB-SKILL:** Use test-driven-development for writing proper failing tests
181
+ - **REQUIRED SUB-SKILL:** Use tdd-flow for writing proper failing tests
182
182
 
183
183
  2. **Implement Single Fix**
184
184
  - Address the root cause identified
@@ -280,12 +280,12 @@ If systematic investigation reveals issue is truly environmental, timing-depende
280
280
  ## Integration with Other Skills
281
281
 
282
282
  **This skill requires using:**
283
- - **root-cause-tracing** - REQUIRED when error is deep in call stack (see Phase 1, Step 5)
284
- - **test-driven-development** - REQUIRED for creating failing test case (see Phase 4, Step 1)
283
+ - **trace-back** - REQUIRED when error is deep in call stack (see Phase 1, Step 5)
284
+ - **tdd-flow** - REQUIRED for creating failing test case (see Phase 4, Step 1)
285
285
 
286
286
  **Complementary skills:**
287
- - **condition-based-waiting** - Replace arbitrary timeouts identified in Phase 2
288
- - **verification-before-completion** - Verify fix worked before claiming success
287
+ - **test-traps** (Anti-Pattern 6) - Replace arbitrary timeouts identified in Phase 2
288
+ - **verify-done** - Verify fix worked before claiming success
289
289
 
290
290
  ## Real-World Impact
291
291
 
@@ -1,6 +1,6 @@
1
1
  # Academic Test: Systematic Debugging Skill
2
2
 
3
- You have access to the systematic debugging skill at skills/debugging/systematic-debugging
3
+ You have access to the systematic debugging skill at skills/debug-method
4
4
 
5
5
  Read the skill and answer these questions based SOLELY on what the skill says:
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
4
4
 
5
- You have access to: skills/debugging/systematic-debugging
5
+ You have access to: skills/debug-method
6
6
 
7
7
  ## Scenario
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
4
4
 
5
- You have access to: skills/debugging/systematic-debugging
5
+ You have access to: skills/debug-method
6
6
 
7
7
  ## Scenario
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
4
4
 
5
- You have access to: skills/debugging/systematic-debugging
5
+ You have access to: skills/debug-method
6
6
 
7
7
  ## Scenario
8
8
 
@@ -1,11 +1,11 @@
1
1
  ---
2
- name: test-driven-development
2
+ name: tdd-flow
3
3
  description: Use when implementing any feature or bugfix, before writing implementation code - write the test first, watch it fail, write minimal code to pass; ensures tests actually verify behavior by requiring failure first
4
- usage: /test-driven-development <feature-or-behavior-to-test>
4
+ usage: /tdd-flow <feature-or-behavior-to-test>
5
5
  auto_trigger: true
6
6
  ---
7
7
 
8
- # Test-Driven Development (TDD)
8
+ # TDD Flow
9
9
 
10
10
  ## Auto-Trigger
11
11