reflex-skills 0.4.1 → 0.5.1
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/LICENSE +21 -0
- package/README.md +106 -13
- package/dist/reflex.js +3921 -721
- package/dist/tokenizers-CLBWC4RJ.js +3010 -0
- package/package.json +2 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 The Reflex contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ alias reflex="node $PWD/apps/cli/dist/reflex.js"
|
|
|
35
35
|
| Command | What it does |
|
|
36
36
|
| --- | --- |
|
|
37
37
|
| `doctor` | Node and SQLite check, detected history locations and file counts, install targets, agent CLIs |
|
|
38
|
-
| `scan --days <n>` | Ask per source, then read and store redacted workflow traces. `--source <claude-code\|codex\|cursor>` (repeatable), `--claude-dir`, `--codex-dir`, `--cursor-dir`, `--yes`, `--full` (re-read every file instead of reusing unchanged ones) |
|
|
38
|
+
| `scan --days <n>` | Ask per source, then read and store redacted workflow traces. `--source <claude-code\|codex\|cursor>` (repeatable), `--claude-dir`, `--codex-dir`, `--cursor-dir`, `--yes`, `--full` (re-read every file instead of reusing unchanged ones), `--embed-minutes <n>` (most time spent comparing new sessions by meaning; default 5, the rest continue next scan) |
|
|
39
39
|
| `sessions` | Sessions from the last scan, redacted |
|
|
40
40
|
| `suggest` | Detect repeated workflows and review them interactively (`--no-interactive`, `--all`) |
|
|
41
41
|
| `show <n\|name>` | A suggestion in detail: steps, support, uncertainty |
|
|
@@ -53,9 +53,12 @@ alias reflex="node $PWD/apps/cli/dist/reflex.js"
|
|
|
53
53
|
| `run <request>` | Start Claude Code or Codex on the model the router picks for this kind of task. `--dry-run` shows the pick and why, `--tool`, `--model`, `--yes`. Asks first unless autopilot is on |
|
|
54
54
|
| `route` | The router: picks per kind of task, settings, randomized trials and bench results. `autopilot on\|off`, `explore <percent>\|off [--protect <kind...>]` |
|
|
55
55
|
| `bench <task>` | Run one task on several Claude Code models, each in a fresh copy of the current repository, scored by `--check "<command>"`. `--models`, `--setup`, `--runs`, `--timeout`, `--keep`, `--yes` |
|
|
56
|
+
| `improve [skill]` | For skills you already have: lists them with the sessions that loaded each; with a name, compares the skill with those sessions and proposes an edit (asks before reading the skill and before changing it; keeps a backup). `--file`, `--yes` |
|
|
57
|
+
| `agents` | Sessions that launched agents (Cursor): how many, which kinds, and how many tool calls the agents made |
|
|
58
|
+
| `handbook` | How work is done in the current repository, learned from past sessions: test, build and lint commands that worked (and ones that kept failing), and corrections you repeated, with the situation they came up in and the sessions behind each. `show <id>`, `ask "<question>"`, `export` (Markdown for a teammate, no request text), `--project`, `--all`, `--json`. Read-only, so agents can call it |
|
|
56
59
|
| `stats` | Counts from local data |
|
|
57
60
|
| `reset` | Delete Reflex's own data (not installed skills or the model) |
|
|
58
|
-
| `model [status\|fetch\|remove]` | Optional local embedding model for matching requests by meaning
|
|
61
|
+
| `model [status\|fetch\|use\|remove]` | Optional local embedding model for matching requests by meaning. `fetch` downloads bge-m3 (multilingual, 587 MB); `fetch --light` the English-only all-MiniLM-L6-v2 (23 MB); `use <name>` switches between installed ones |
|
|
59
62
|
|
|
60
63
|
Prompts default to No. Without a terminal, nothing is read or written unless you pass `--yes`.
|
|
61
64
|
|
|
@@ -90,8 +93,12 @@ as inspect CI, install dependencies, patch, run tests, inspect the diff), normal
|
|
|
90
93
|
file categories and outcome. Copies, resumed sessions and quick retries count once. Traces are
|
|
91
94
|
compared on intent (0.40), action sequence (0.30), commands and tools (0.15), file categories
|
|
92
95
|
(0.10) and repository (0.05), then clustered. Intent compares the requests' words (stemmed terms,
|
|
93
|
-
phrases and a small concept lexicon)
|
|
94
|
-
|
|
96
|
+
phrases and a small concept lexicon) in any language: Japanese, Chinese and Thai are split into
|
|
97
|
+
words, Korean particles are stripped (배포를 → 배포), filler words are dropped (published lists plus
|
|
98
|
+
everyday fillers, `casual-stopwords.ts`) and words your own history uses across unrelated kinds of
|
|
99
|
+
work are quieted, more so as the history grows; with the optional model (`reflex model fetch`) it also compares
|
|
100
|
+
their meaning, so "make the login page load faster", "the sign-in screen is really slow" and
|
|
101
|
+
"로그인 화면이 너무 느려" match. A cluster becomes a suggestion only if it has at
|
|
95
102
|
least 3 independent sessions with consistent behavior; one-offs, read-and-answer sessions and
|
|
96
103
|
generic "read, edit, test" patterns are not suggested.
|
|
97
104
|
|
|
@@ -101,6 +108,72 @@ follow-up messages ("don't change the CI workflow") become constraints when the
|
|
|
101
108
|
appears in at least 2 sessions; only the words those sessions share are kept. No transcript excerpts.
|
|
102
109
|
Details: [docs/architecture.md](docs/architecture.md).
|
|
103
110
|
|
|
111
|
+
## Matching by meaning: which model
|
|
112
|
+
|
|
113
|
+
Matching by words always runs. A local embedding model adds matching by meaning; it is optional and
|
|
114
|
+
runs on your machine (WebAssembly, no native code, no network after the download).
|
|
115
|
+
|
|
116
|
+
| | `reflex model fetch` (default) | `reflex model fetch --light` |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| Model | bge-m3, int8 | all-MiniLM-L6-v2, int8 |
|
|
119
|
+
| Reads | 100+ languages, and requests that mix them | English (Latin script); other text is matched by words only |
|
|
120
|
+
| Download | 587 MB | 23 MB |
|
|
121
|
+
| Memory while embedding | about 2.8 GB | about 0.6 GB |
|
|
122
|
+
| Time per session, 1 / 4 threads | about 2.9 s / 0.8 s | about 0.09 s / 0.03 s |
|
|
123
|
+
|
|
124
|
+
Measured on Apple silicon with real-length requests; older CPUs can be up to about 3x slower. The
|
|
125
|
+
`Embedding benchmark` workflow (`.github/workflows/embedding-bench.yml`; on pull requests that change embedding or matching code, by hand, and weekly)
|
|
126
|
+
measures load time, time per request and peak memory for both models on Linux (x64 and ARM),
|
|
127
|
+
Windows and macOS (Intel and Apple silicon), and checks matching quality is the same everywhere;
|
|
128
|
+
locally: `REFLEX_PERF=bge-m3 REFLEX_TEST_MODELS=~/.reflex/models pnpm vitest run packages/analysis/test/eval/perf.test.ts`. On
|
|
129
|
+
English requests MiniLM matches at least as well as bge-m3, so English-only users lose nothing with
|
|
130
|
+
`--light`. Embedding uses up to 4 cores (`REFLEX_EMBED_THREADS` to change). Before downloading,
|
|
131
|
+
`model fetch` estimates the first scan's time from your stored sessions and recommends `--light`
|
|
132
|
+
on machines with under 8 GB of memory or fewer than 4 cores. Each scan spends at most
|
|
133
|
+
`--embed-minutes` (default 5) embedding, newest sessions first, and the next scan continues; a
|
|
134
|
+
machine without memory for the model skips it with a warning. Vectors are cached per model, so
|
|
135
|
+
`reflex model use <name>` switches without re-embedding what either model already did.
|
|
136
|
+
|
|
137
|
+
## Skills you already have
|
|
138
|
+
|
|
139
|
+
If most sessions of a repeated workflow already loaded skills you wrote, Reflex does not suggest a
|
|
140
|
+
new skill for it; `reflex scan` says which of your skills handle it instead. Only skills specific to
|
|
141
|
+
that workflow count (loaded at least twice as often there as in your other sessions), so general
|
|
142
|
+
guidance you load everywhere never hides a suggestion. Skill folders that are symlinks into a
|
|
143
|
+
skills repo are followed: Reflex reads and edits the real `SKILL.md`, so changes show up in that
|
|
144
|
+
repo's `git status`. `--dry-run` shows the review, the proposal and the check without writing.
|
|
145
|
+
|
|
146
|
+
`reflex improve <skill>` compares one of your skills with the sessions that loaded it (at least 2).
|
|
147
|
+
The rule is that a skill keeps producing the same thing; improving it means getting there faster
|
|
148
|
+
or cheaper.
|
|
149
|
+
|
|
150
|
+
- **What it never touches.** Your text is never edited: Reflex only appends a marked "Learned from
|
|
151
|
+
your sessions" section (replaced on the next run, never duplicated). Sections whose heading names
|
|
152
|
+
the output (`Output format`, `Response`, `Template`, `Report`, …) and anything between
|
|
153
|
+
`<!-- reflex:fixed:start -->` and `<!-- reflex:fixed:end -->` are treated as the output contract:
|
|
154
|
+
the appended section says to keep them exactly, and nothing proposed may write a summary or
|
|
155
|
+
correct the format.
|
|
156
|
+
- **Proposed by default: faster.** Commands that worked in those sessions for steps your skill
|
|
157
|
+
already names, so the agent doesn't work them out again.
|
|
158
|
+
- **Shown, not written: cheaper.** If a cheaper model was about as reliable on those sessions,
|
|
159
|
+
`reflex improve` says so; `reflex run` uses it. The skill file isn't changed for that.
|
|
160
|
+
- **Opt-in with `--behavior`: changes what the agent does.** Steps most sessions took that the
|
|
161
|
+
skill doesn't mention, and corrections you repeated. Steps the skill names that rarely happened
|
|
162
|
+
are reported; Reflex never removes a step.
|
|
163
|
+
- **Checked before it's applied.** `--verify "<a task this skill handles>"` runs that task with the
|
|
164
|
+
current and the proposed skill, each in a fresh copy of the current repository (non-persistent
|
|
165
|
+
Claude Code sessions on your account), and compares the shape of the two answers: headings,
|
|
166
|
+
tables, lists, labels, JSON keys. Values such as times and names may differ; the format may not.
|
|
167
|
+
If it changed, the edit is not applied (`--force` overrides). Answers are compared in memory and
|
|
168
|
+
never saved.
|
|
169
|
+
- **Recorded.** Every proposal is attached to the skill in Reflex's database: fingerprints before
|
|
170
|
+
and after, what was proposed, the check result, whether you applied it and where the backup is.
|
|
171
|
+
`reflex improve <skill> --history` lists them. Your file changes only if you confirm; the previous
|
|
172
|
+
version goes to `~/.reflex/backups`.
|
|
173
|
+
|
|
174
|
+
A session counts as using a skill when the agent called it (Claude Code's `Skill` tool) or read
|
|
175
|
+
its `SKILL.md`.
|
|
176
|
+
|
|
104
177
|
## Measuring a skill
|
|
105
178
|
|
|
106
179
|
Each suggestion shows what the workflow costs today: median tokens and tool calls per run. When you
|
|
@@ -156,8 +229,9 @@ Cursor isn't routed: it records no tokens to compare, and its editor takes no mo
|
|
|
156
229
|
|
|
157
230
|
- Transcripts are read locally and treated as data, never as instructions.
|
|
158
231
|
- Reflex makes no network connections; outgoing sockets are blocked in-process. The one exception is
|
|
159
|
-
`reflex model fetch`, which you run explicitly to download
|
|
160
|
-
files, verified by SHA-256). It reads no transcripts and uploads nothing;
|
|
232
|
+
`reflex model fetch`, which you run explicitly to download an optional embedding model (pinned
|
|
233
|
+
files, streamed to disk and verified by SHA-256). It reads no transcripts and uploads nothing;
|
|
234
|
+
scans stay offline.
|
|
161
235
|
- Secrets, emails, home paths and your user name are redacted before anything is stored or shown.
|
|
162
236
|
- Scans are incremental: a transcript that has not changed since the last scan is not opened again.
|
|
163
237
|
Redacted traces are kept after their transcript is deleted (by you, or by the agent's own cleanup),
|
|
@@ -176,8 +250,21 @@ Threat model and mitigations: [docs/security.md](docs/security.md).
|
|
|
176
250
|
| Codex | `$CODEX_HOME/sessions/YYYY/MM/DD/rollout-*.jsonl` | `~/.codex/skills/<name>/SKILL.md` | Parser follows the Codex protocol types and is tested on fixtures; not yet run against real rollouts or a live Codex session |
|
|
177
251
|
| Cursor | `~/.cursor/projects/*/agent-transcripts/*/*.jsonl` | `~/.cursor/skills/<name>/SKILL.md` | Parser tested on fixtures and on real agent transcripts. Cursor doesn't record tool results, so pass/fail outcomes aren't available for its sessions |
|
|
178
252
|
|
|
179
|
-
|
|
180
|
-
|
|
253
|
+
**Agents a session launched.** When a Cursor chat launches agents (its `Task` / `Subagent` tool),
|
|
254
|
+
Reflex records each one (kind, model, background or not, its short description) and reads the
|
|
255
|
+
agents' transcripts (`<chat>/subagents/*.jsonl`). Their commands, files and tool calls count toward
|
|
256
|
+
the chat's workflow; the message each agent was given is written by the parent agent, so it is
|
|
257
|
+
never treated as your request. `reflex agents` lists the chats that launched the most, and
|
|
258
|
+
`reflex sessions` notes the count. Claude Code's agents are not read yet.
|
|
259
|
+
|
|
260
|
+
**Conductor.** Conductor runs its own Claude Code and Codex, which save sessions to `~/.claude` and
|
|
261
|
+
`~/.codex` like any other session, so Reflex reads them with those sources. A session whose folder is
|
|
262
|
+
a Conductor workspace (`~/conductor/workspaces/<repo>/<workspace>`) counts toward `<repo>`, not
|
|
263
|
+
toward each workspace, and `reflex sessions` marks it "via Conductor". `reflex doctor` shows whether
|
|
264
|
+
the workspace folder exists. Cursor and OpenCode sessions run through Conductor are not read yet.
|
|
265
|
+
|
|
266
|
+
Override locations with `REFLEX_CLAUDE_DIR`, `REFLEX_CODEX_DIR`, `REFLEX_CURSOR_DIR`, `REFLEX_CONDUCTOR_DIR`,
|
|
267
|
+
`REFLEX_CLAUDE_SKILLS_DIR`, `REFLEX_CODEX_SKILLS_DIR`, `REFLEX_CURSOR_SKILLS_DIR` and `REFLEX_HOME`. `REFLEX_EMBED_THREADS` sets the embedding threads. `REFLEX_DEBUG=1` prints local counters (counts only).
|
|
181
268
|
|
|
182
269
|
## Walkthrough
|
|
183
270
|
|
|
@@ -201,11 +288,17 @@ by the tests; it is not part of the published CLI.
|
|
|
201
288
|
## Limitations
|
|
202
289
|
|
|
203
290
|
- Confidence is a ranking heuristic, not a probability.
|
|
204
|
-
- Without the model, intent matching uses stemmed TF-IDF plus a small built-in lexicon.
|
|
205
|
-
with no words in common
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
291
|
+
- Without the model, intent matching uses stemmed TF-IDF plus a small built-in lexicon (English).
|
|
292
|
+
Requests worded with no words in common, or asked in different languages, need
|
|
293
|
+
`reflex model fetch` to match.
|
|
294
|
+
- Embedding models do not know developer jargon as well as the lexicon ("GitHub Actions is red" vs.
|
|
295
|
+
"CI is failing"), so they are combined with word matching, never used alone. With the light
|
|
296
|
+
model, requests in other scripts (Korean, Japanese, ...) are matched by words only. Clusters
|
|
297
|
+
found only by meaning may get a generic name.
|
|
209
298
|
- Each source reads at most its 2,000 most recent files per scan.
|
|
210
299
|
- Sponsor integrations (Alike, Darwin) are not included: no public API documentation was available
|
|
211
300
|
to build against, and the product works without them.
|
|
301
|
+
|
|
302
|
+
## License
|
|
303
|
+
|
|
304
|
+
MIT. See [LICENSE](LICENSE).
|