selftune 0.1.0 → 0.1.4
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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +62 -5
- package/bin/selftune.cjs +3 -1
- package/cli/selftune/constants.ts +0 -6
- package/cli/selftune/dashboard.ts +176 -0
- package/cli/selftune/evolution/evolve.ts +31 -20
- package/cli/selftune/evolution/propose-description.ts +2 -3
- package/cli/selftune/evolution/rollback.ts +1 -1
- package/cli/selftune/evolution/validate-proposal.ts +3 -4
- package/cli/selftune/grading/grade-session.ts +18 -62
- package/cli/selftune/index.ts +21 -0
- package/cli/selftune/ingestors/codex-rollout.ts +1 -1
- package/cli/selftune/ingestors/opencode-ingest.ts +2 -2
- package/cli/selftune/init.ts +25 -36
- package/cli/selftune/last.ts +138 -0
- package/cli/selftune/observability.ts +1 -1
- package/cli/selftune/status.ts +318 -0
- package/cli/selftune/types.ts +1 -1
- package/cli/selftune/utils/llm-call.ts +8 -57
- package/dashboard/index.html +1119 -0
- package/package.json +32 -3
- package/skill/SKILL.md +19 -14
- package/skill/Workflows/Doctor.md +2 -9
- package/skill/Workflows/Evals.md +8 -17
- package/skill/Workflows/Evolve.md +5 -11
- package/skill/Workflows/Grade.md +5 -10
- package/skill/Workflows/Ingest.md +16 -34
- package/skill/Workflows/Initialize.md +32 -34
- package/skill/Workflows/Rollback.md +3 -10
- package/skill/Workflows/Watch.md +2 -9
package/package.json
CHANGED
|
@@ -1,16 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "selftune",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Skill observability and continuous improvement CLI for agent platforms",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"author": "Daniel Petro",
|
|
7
6
|
"license": "MIT",
|
|
7
|
+
"author": "Daniel Petro",
|
|
8
|
+
"homepage": "https://github.com/WellDunDun/selftune#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/WellDunDun/selftune.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/WellDunDun/selftune/issues"
|
|
15
|
+
},
|
|
16
|
+
"funding": {
|
|
17
|
+
"type": "github",
|
|
18
|
+
"url": "https://github.com/sponsors/WellDunDun"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"selftune",
|
|
22
|
+
"skill",
|
|
23
|
+
"observability",
|
|
24
|
+
"claude-code",
|
|
25
|
+
"codex",
|
|
26
|
+
"opencode",
|
|
27
|
+
"eval",
|
|
28
|
+
"grading",
|
|
29
|
+
"evolution",
|
|
30
|
+
"cli",
|
|
31
|
+
"agent",
|
|
32
|
+
"telemetry",
|
|
33
|
+
"bun",
|
|
34
|
+
"typescript"
|
|
35
|
+
],
|
|
8
36
|
"bin": {
|
|
9
37
|
"selftune": "bin/selftune.cjs"
|
|
10
38
|
},
|
|
11
39
|
"files": [
|
|
12
40
|
"bin/",
|
|
13
41
|
"cli/selftune/",
|
|
42
|
+
"dashboard/",
|
|
14
43
|
"skill/",
|
|
15
44
|
"README.md",
|
|
16
45
|
"CHANGELOG.md"
|
|
@@ -23,7 +52,7 @@
|
|
|
23
52
|
"check": "bun run lint && bun run lint:arch && bun test"
|
|
24
53
|
},
|
|
25
54
|
"devDependencies": {
|
|
26
|
-
"@biomejs/biome": "^
|
|
55
|
+
"@biomejs/biome": "^2.4.4",
|
|
27
56
|
"@types/bun": "^1.1.0"
|
|
28
57
|
}
|
|
29
58
|
}
|
package/skill/SKILL.md
CHANGED
|
@@ -3,7 +3,8 @@ name: selftune
|
|
|
3
3
|
description: >
|
|
4
4
|
Skill observability and continuous improvement. Use when the user wants to:
|
|
5
5
|
grade a session, generate evals, check undertriggering, evolve a skill
|
|
6
|
-
description, rollback an evolution, monitor post-deploy performance,
|
|
6
|
+
description, rollback an evolution, monitor post-deploy performance, check
|
|
7
|
+
skill health status, view last session insight, open the dashboard, run
|
|
7
8
|
health checks, or ingest sessions from Codex/OpenCode.
|
|
8
9
|
---
|
|
9
10
|
|
|
@@ -15,34 +16,31 @@ and evolve skill descriptions toward the language real users actually use.
|
|
|
15
16
|
## Bootstrap
|
|
16
17
|
|
|
17
18
|
If `~/.selftune/config.json` does not exist, read `Workflows/Initialize.md`
|
|
18
|
-
first.
|
|
19
|
+
first. The CLI must be installed (`selftune` on PATH) before other commands
|
|
20
|
+
will work. Do not proceed with other commands until initialization is complete.
|
|
19
21
|
|
|
20
22
|
## Command Execution Policy
|
|
21
23
|
|
|
22
|
-
Build every CLI invocation from the config:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
CLI_PATH=$(cat ~/.selftune/config.json | jq -r .cli_path)
|
|
26
|
-
bun run $CLI_PATH <command> [options]
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Fallback (if config is missing or stale):
|
|
30
24
|
```bash
|
|
31
|
-
|
|
25
|
+
selftune <command> [options]
|
|
32
26
|
```
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
Most commands output deterministic JSON. Parse JSON output for machine-readable commands.
|
|
29
|
+
`selftune dashboard` is an exception: it generates an HTML artifact and may print
|
|
30
|
+
informational progress lines.
|
|
36
31
|
|
|
37
32
|
## Quick Reference
|
|
38
33
|
|
|
39
34
|
```bash
|
|
40
|
-
selftune grade --skill <name> [--expectations "..."] [--
|
|
35
|
+
selftune grade --skill <name> [--expectations "..."] [--agent <name>]
|
|
41
36
|
selftune evals --skill <name> [--list-skills] [--stats] [--max N]
|
|
42
37
|
selftune evolve --skill <name> --skill-path <path> [--dry-run]
|
|
43
38
|
selftune rollback --skill <name> --skill-path <path> [--proposal-id <id>]
|
|
44
39
|
selftune watch --skill <name> --skill-path <path> [--auto-rollback]
|
|
40
|
+
selftune status
|
|
41
|
+
selftune last
|
|
45
42
|
selftune doctor
|
|
43
|
+
selftune dashboard [--export] [--out FILE]
|
|
46
44
|
selftune ingest-codex
|
|
47
45
|
selftune ingest-opencode
|
|
48
46
|
selftune wrap-codex -- <codex args>
|
|
@@ -60,6 +58,9 @@ selftune wrap-codex -- <codex args>
|
|
|
60
58
|
| doctor, health, hooks, broken, diagnose | Doctor | Workflows/Doctor.md |
|
|
61
59
|
| ingest, import, codex logs, opencode, wrap codex | Ingest | Workflows/Ingest.md |
|
|
62
60
|
| init, setup, bootstrap, first time | Initialize | Workflows/Initialize.md |
|
|
61
|
+
| status, health summary, skill health, pass rates, how are skills | Status | *(direct command — no workflow file)* |
|
|
62
|
+
| last, last session, recent session, what happened | Last | *(direct command — no workflow file)* |
|
|
63
|
+
| dashboard, visual, open dashboard, skill grid | Dashboard | *(direct command — no workflow file)* |
|
|
63
64
|
|
|
64
65
|
## The Feedback Loop
|
|
65
66
|
|
|
@@ -106,6 +107,10 @@ Observe --> Detect --> Diagnose --> Propose --> Validate --> Deploy --> Watch
|
|
|
106
107
|
- "Check selftune health"
|
|
107
108
|
- "Ingest my codex logs"
|
|
108
109
|
- "Show me skill stats"
|
|
110
|
+
- "How are my skills performing?"
|
|
111
|
+
- "What happened in my last session?"
|
|
112
|
+
- "Open the selftune dashboard"
|
|
113
|
+
- "Show skill health status"
|
|
109
114
|
|
|
110
115
|
## Negative Examples
|
|
111
116
|
|
|
@@ -6,13 +6,7 @@ Reports pass/fail status for each check with actionable guidance.
|
|
|
6
6
|
## Default Command
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
|
|
10
|
-
bun run $CLI_PATH doctor
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Fallback:
|
|
14
|
-
```bash
|
|
15
|
-
bun run <repo-path>/cli/selftune/index.ts doctor
|
|
9
|
+
selftune doctor
|
|
16
10
|
```
|
|
17
11
|
|
|
18
12
|
## Options
|
|
@@ -103,8 +97,7 @@ Doctor validates these areas:
|
|
|
103
97
|
### 1. Run Doctor
|
|
104
98
|
|
|
105
99
|
```bash
|
|
106
|
-
|
|
107
|
-
bun run $CLI_PATH doctor
|
|
100
|
+
selftune doctor
|
|
108
101
|
```
|
|
109
102
|
|
|
110
103
|
### 2. Check Results
|
package/skill/Workflows/Evals.md
CHANGED
|
@@ -7,13 +7,7 @@ its invocation type.
|
|
|
7
7
|
## Default Command
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
bun run $CLI_PATH evals --skill <name> [options]
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Fallback:
|
|
15
|
-
```bash
|
|
16
|
-
bun run <repo-path>/cli/selftune/index.ts evals --skill <name> [options]
|
|
10
|
+
selftune evals --skill <name> [options]
|
|
17
11
|
```
|
|
18
12
|
|
|
19
13
|
## Options
|
|
@@ -104,8 +98,7 @@ bun run <repo-path>/cli/selftune/index.ts evals --skill <name> [options]
|
|
|
104
98
|
Discover which skills have telemetry data and how many queries each has.
|
|
105
99
|
|
|
106
100
|
```bash
|
|
107
|
-
|
|
108
|
-
bun run $CLI_PATH evals --list-skills
|
|
101
|
+
selftune evals --list-skills
|
|
109
102
|
```
|
|
110
103
|
|
|
111
104
|
Use this first to identify which skills have enough data for eval generation.
|
|
@@ -117,8 +110,7 @@ Cross-reference `skill_usage_log.jsonl` (positive triggers) against
|
|
|
117
110
|
an eval set annotated with invocation types.
|
|
118
111
|
|
|
119
112
|
```bash
|
|
120
|
-
|
|
121
|
-
bun run $CLI_PATH evals --skill pptx --max 50 --out evals-pptx.json
|
|
113
|
+
selftune evals --skill pptx --max 50 --out evals-pptx.json
|
|
122
114
|
```
|
|
123
115
|
|
|
124
116
|
The command:
|
|
@@ -135,15 +127,14 @@ View aggregate telemetry for a skill: average turns, tool call breakdown,
|
|
|
135
127
|
error rates, and common bash command patterns.
|
|
136
128
|
|
|
137
129
|
```bash
|
|
138
|
-
|
|
139
|
-
bun run $CLI_PATH evals --skill pptx --stats
|
|
130
|
+
selftune evals --skill pptx --stats
|
|
140
131
|
```
|
|
141
132
|
|
|
142
133
|
## Steps
|
|
143
134
|
|
|
144
135
|
### 1. List Available Skills
|
|
145
136
|
|
|
146
|
-
Run
|
|
137
|
+
Run `selftune evals --list-skills` to see what skills have telemetry data. If the target
|
|
147
138
|
skill has zero or very few queries, more sessions are needed before
|
|
148
139
|
eval generation is useful.
|
|
149
140
|
|
|
@@ -179,15 +170,15 @@ beyond trigger coverage.
|
|
|
179
170
|
## Common Patterns
|
|
180
171
|
|
|
181
172
|
**"What skills are undertriggering?"**
|
|
182
|
-
> Run
|
|
173
|
+
> Run `selftune evals --list-skills`, then for each skill with significant query counts,
|
|
183
174
|
> generate evals and check for missed implicit/contextual queries.
|
|
184
175
|
|
|
185
176
|
**"Generate evals for pptx"**
|
|
186
|
-
> Run `evals --skill pptx`. Review the invocation type distribution.
|
|
177
|
+
> Run `selftune evals --skill pptx`. Review the invocation type distribution.
|
|
187
178
|
> Feed the output to `evolve` if coverage gaps exist.
|
|
188
179
|
|
|
189
180
|
**"Show me skill stats"**
|
|
190
|
-
> Run `evals --skill <name> --stats` for aggregate telemetry.
|
|
181
|
+
> Run `selftune evals --skill <name> --stats` for aggregate telemetry.
|
|
191
182
|
|
|
192
183
|
**"I want reproducible evals"**
|
|
193
184
|
> Use `--seed <n>` to fix the random sampling of negative examples.
|
|
@@ -7,13 +7,7 @@ natural-language queries without breaking existing triggers.
|
|
|
7
7
|
## Default Command
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
bun run $CLI_PATH evolve --skill <name> --skill-path <path> [options]
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Fallback:
|
|
15
|
-
```bash
|
|
16
|
-
bun run <repo-path>/cli/selftune/index.ts evolve --skill <name> --skill-path <path> [options]
|
|
10
|
+
selftune evolve --skill <name> --skill-path <path> [options]
|
|
17
11
|
```
|
|
18
12
|
|
|
19
13
|
## Options
|
|
@@ -23,8 +17,7 @@ bun run <repo-path>/cli/selftune/index.ts evolve --skill <name> --skill-path <pa
|
|
|
23
17
|
| `--skill <name>` | Skill name | Required |
|
|
24
18
|
| `--skill-path <path>` | Path to the skill's SKILL.md | Required |
|
|
25
19
|
| `--eval-set <path>` | Pre-built eval set JSON | Auto-generated from logs |
|
|
26
|
-
| `--
|
|
27
|
-
| `--agent <name>` | Agent CLI binary to use | Auto-detected |
|
|
20
|
+
| `--agent <name>` | Agent CLI to use (claude, codex, opencode) | Auto-detected |
|
|
28
21
|
| `--dry-run` | Propose and validate without deploying | Off |
|
|
29
22
|
| `--confidence <n>` | Minimum confidence threshold (0-1) | 0.7 |
|
|
30
23
|
| `--max-iterations <n>` | Maximum retry iterations | 3 |
|
|
@@ -155,5 +148,6 @@ The evolution loop stops when any of these conditions is met (priority order):
|
|
|
155
148
|
> Lower `--confidence` slightly or increase `--max-iterations`.
|
|
156
149
|
> Also check if the eval set has contradictory expectations.
|
|
157
150
|
|
|
158
|
-
**"
|
|
159
|
-
>
|
|
151
|
+
**"Which agent is being used?"**
|
|
152
|
+
> The evolve command auto-detects your installed agent CLI.
|
|
153
|
+
> Use `--agent <name>` to override (claude, codex, opencode).
|
package/skill/Workflows/Grade.md
CHANGED
|
@@ -6,13 +6,7 @@ with a 3-tier evaluation covering trigger, process, and quality.
|
|
|
6
6
|
## Default Command
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
|
|
10
|
-
bun run $CLI_PATH grade --skill <name> [options]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Fallback:
|
|
14
|
-
```bash
|
|
15
|
-
bun run <repo-path>/cli/selftune/index.ts grade --skill <name> [options]
|
|
9
|
+
selftune grade --skill <name> [options]
|
|
16
10
|
```
|
|
17
11
|
|
|
18
12
|
## Options
|
|
@@ -23,7 +17,7 @@ bun run <repo-path>/cli/selftune/index.ts grade --skill <name> [options]
|
|
|
23
17
|
| `--expectations "..."` | Explicit expectations (semicolon-separated) | Auto-derived |
|
|
24
18
|
| `--evals-json <path>` | Pre-built eval set JSON file | None |
|
|
25
19
|
| `--eval-id <n>` | Specific eval ID to grade from the eval set | None |
|
|
26
|
-
| `--
|
|
20
|
+
| `--agent <name>` | Agent CLI to use (claude, codex, opencode) | Auto-detected |
|
|
27
21
|
|
|
28
22
|
## Output Format
|
|
29
23
|
|
|
@@ -153,5 +147,6 @@ Keep the summary concise. The full details are in `grading.json`.
|
|
|
153
147
|
> Pass `--evals-json path/to/evals.json` and optionally `--eval-id N`
|
|
154
148
|
> to grade a specific eval scenario.
|
|
155
149
|
|
|
156
|
-
**"
|
|
157
|
-
>
|
|
150
|
+
**"Which agent is being used?"**
|
|
151
|
+
> The grader auto-detects your installed agent CLI (claude, codex, opencode).
|
|
152
|
+
> Use `--agent <name>` to override the auto-detected agent.
|
|
@@ -21,13 +21,7 @@ Batch ingest Codex rollout logs into the shared JSONL schema.
|
|
|
21
21
|
### Default Command
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
|
|
25
|
-
bun run $CLI_PATH ingest-codex
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Fallback:
|
|
29
|
-
```bash
|
|
30
|
-
bun run <repo-path>/cli/selftune/index.ts ingest-codex
|
|
24
|
+
selftune ingest-codex
|
|
31
25
|
```
|
|
32
26
|
|
|
33
27
|
### Options
|
|
@@ -48,9 +42,9 @@ Writes to:
|
|
|
48
42
|
### Steps
|
|
49
43
|
|
|
50
44
|
1. Verify `$CODEX_HOME/sessions/` directory exists and contains session files
|
|
51
|
-
2. Run `ingest-codex`
|
|
45
|
+
2. Run `selftune ingest-codex`
|
|
52
46
|
3. Verify entries were written by checking log file line counts
|
|
53
|
-
4. Run `doctor` to confirm logs are healthy
|
|
47
|
+
4. Run `selftune doctor` to confirm logs are healthy
|
|
54
48
|
|
|
55
49
|
---
|
|
56
50
|
|
|
@@ -61,13 +55,7 @@ Ingest OpenCode sessions from the SQLite database.
|
|
|
61
55
|
### Default Command
|
|
62
56
|
|
|
63
57
|
```bash
|
|
64
|
-
|
|
65
|
-
bun run $CLI_PATH ingest-opencode
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Fallback:
|
|
69
|
-
```bash
|
|
70
|
-
bun run <repo-path>/cli/selftune/index.ts ingest-opencode
|
|
58
|
+
selftune ingest-opencode
|
|
71
59
|
```
|
|
72
60
|
|
|
73
61
|
### Options
|
|
@@ -90,9 +78,9 @@ Writes to:
|
|
|
90
78
|
### Steps
|
|
91
79
|
|
|
92
80
|
1. Verify the OpenCode database exists at the expected path
|
|
93
|
-
2. Run `ingest-opencode`
|
|
81
|
+
2. Run `selftune ingest-opencode`
|
|
94
82
|
3. Verify entries were written by checking log file line counts
|
|
95
|
-
4. Run `doctor` to confirm logs are healthy
|
|
83
|
+
4. Run `selftune doctor` to confirm logs are healthy
|
|
96
84
|
|
|
97
85
|
---
|
|
98
86
|
|
|
@@ -104,13 +92,7 @@ that tees the JSONL stream while passing through to Codex.
|
|
|
104
92
|
### Default Command
|
|
105
93
|
|
|
106
94
|
```bash
|
|
107
|
-
|
|
108
|
-
bun run $CLI_PATH wrap-codex -- <your codex args>
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Fallback:
|
|
112
|
-
```bash
|
|
113
|
-
bun run <repo-path>/cli/selftune/index.ts wrap-codex -- <your codex args>
|
|
95
|
+
selftune wrap-codex -- <your codex args>
|
|
114
96
|
```
|
|
115
97
|
|
|
116
98
|
### Usage
|
|
@@ -118,7 +100,7 @@ bun run <repo-path>/cli/selftune/index.ts wrap-codex -- <your codex args>
|
|
|
118
100
|
Everything after `--` is passed directly to `codex exec`:
|
|
119
101
|
|
|
120
102
|
```bash
|
|
121
|
-
|
|
103
|
+
selftune wrap-codex -- --model o3 "Fix the failing tests"
|
|
122
104
|
```
|
|
123
105
|
|
|
124
106
|
### Output
|
|
@@ -135,25 +117,25 @@ stream for telemetry; it does not modify Codex behavior.
|
|
|
135
117
|
1. Build the wrap-codex command with the desired Codex arguments
|
|
136
118
|
2. Run the command (replaces `codex exec` in your workflow)
|
|
137
119
|
3. Session telemetry is captured automatically
|
|
138
|
-
4. Verify with `doctor` after first use
|
|
120
|
+
4. Verify with `selftune doctor` after first use
|
|
139
121
|
|
|
140
122
|
---
|
|
141
123
|
|
|
142
124
|
## Common Patterns
|
|
143
125
|
|
|
144
126
|
**"Ingest codex logs"**
|
|
145
|
-
> Run `ingest-codex`. No options needed. Reads from `$CODEX_HOME/sessions/`.
|
|
127
|
+
> Run `selftune ingest-codex`. No options needed. Reads from `$CODEX_HOME/sessions/`.
|
|
146
128
|
|
|
147
129
|
**"Import opencode sessions"**
|
|
148
|
-
> Run `ingest-opencode`. Reads from the SQLite database automatically.
|
|
130
|
+
> Run `selftune ingest-opencode`. Reads from the SQLite database automatically.
|
|
149
131
|
|
|
150
132
|
**"Run codex through selftune"**
|
|
151
|
-
> Use `wrap-codex -- <codex args>` instead of `codex exec <args>` directly.
|
|
133
|
+
> Use `selftune wrap-codex -- <codex args>` instead of `codex exec <args>` directly.
|
|
152
134
|
|
|
153
135
|
**"Batch ingest vs real-time"**
|
|
154
|
-
> Use `ingest-codex` or `ingest-opencode` for historical sessions.
|
|
155
|
-
> Use `wrap-codex` for ongoing sessions. Both produce the same log format.
|
|
136
|
+
> Use `selftune ingest-codex` or `selftune ingest-opencode` for historical sessions.
|
|
137
|
+
> Use `selftune wrap-codex` for ongoing sessions. Both produce the same log format.
|
|
156
138
|
|
|
157
139
|
**"How do I know it worked?"**
|
|
158
|
-
> Run `doctor` after ingestion. Check that log files exist and are parseable.
|
|
159
|
-
> Run `evals --list-skills` to see if the ingested sessions appear.
|
|
140
|
+
> Run `selftune doctor` after ingestion. Check that log files exist and are parseable.
|
|
141
|
+
> Run `selftune evals --list-skills` to see if the ingested sessions appear.
|
|
@@ -6,19 +6,12 @@ Bootstrap selftune for first-time use or after changing environments.
|
|
|
6
6
|
|
|
7
7
|
- First time using selftune in a new environment
|
|
8
8
|
- After switching agent platforms (Claude Code, Codex, OpenCode)
|
|
9
|
-
- After reinstalling or moving the selftune repository
|
|
10
9
|
- When `~/.selftune/config.json` does not exist
|
|
11
10
|
|
|
12
11
|
## Default Command
|
|
13
12
|
|
|
14
13
|
```bash
|
|
15
|
-
|
|
16
|
-
bun run $CLI_PATH init [--agent <type>] [--cli-path <path>] [--llm-mode agent|api]
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Fallback (if config does not exist yet):
|
|
20
|
-
```bash
|
|
21
|
-
bun run <repo-path>/cli/selftune/index.ts init [options]
|
|
14
|
+
selftune init [--agent <type>] [--cli-path <path>] [--force]
|
|
22
15
|
```
|
|
23
16
|
|
|
24
17
|
## Options
|
|
@@ -26,8 +19,8 @@ bun run <repo-path>/cli/selftune/index.ts init [options]
|
|
|
26
19
|
| Flag | Description | Default |
|
|
27
20
|
|------|-------------|---------|
|
|
28
21
|
| `--agent <type>` | Agent platform: `claude`, `codex`, `opencode` | Auto-detected |
|
|
29
|
-
| `--cli-path <path>` |
|
|
30
|
-
| `--
|
|
22
|
+
| `--cli-path <path>` | Override auto-detected CLI entry-point path | Auto-detected |
|
|
23
|
+
| `--force` | Reinitialize even if config already exists | Off |
|
|
31
24
|
|
|
32
25
|
## Output Format
|
|
33
26
|
|
|
@@ -57,7 +50,19 @@ Creates `~/.selftune/config.json`:
|
|
|
57
50
|
|
|
58
51
|
## Steps
|
|
59
52
|
|
|
60
|
-
### 1. Check
|
|
53
|
+
### 1. Check if CLI is installed
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
which selftune
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If `selftune` is not on PATH, install it:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g selftune
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 2. Check Existing Config
|
|
61
66
|
|
|
62
67
|
```bash
|
|
63
68
|
cat ~/.selftune/config.json 2>/dev/null
|
|
@@ -66,18 +71,17 @@ cat ~/.selftune/config.json 2>/dev/null
|
|
|
66
71
|
If the file exists and is valid JSON, selftune is already initialized.
|
|
67
72
|
Skip to Step 5 (verify with doctor) unless the user wants to reinitialize.
|
|
68
73
|
|
|
69
|
-
###
|
|
74
|
+
### 3. Run Init
|
|
70
75
|
|
|
71
76
|
```bash
|
|
72
|
-
|
|
77
|
+
selftune init
|
|
73
78
|
```
|
|
74
79
|
|
|
75
|
-
|
|
80
|
+
### 4. Install Hooks (Claude Code)
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
into `~/.claude/settings.json`. Three hooks are required:
|
|
82
|
+
If `init` reports hooks are not installed, merge the entries from
|
|
83
|
+
`skill/settings_snippet.json` into `~/.claude/settings.json`. Three hooks
|
|
84
|
+
are required:
|
|
81
85
|
|
|
82
86
|
| Hook | Script | Purpose |
|
|
83
87
|
|------|--------|---------|
|
|
@@ -85,23 +89,21 @@ into `~/.claude/settings.json`. Three hooks are required:
|
|
|
85
89
|
| `PostToolUse` (Read) | `hooks/skill-eval.ts` | Track skill triggers |
|
|
86
90
|
| `Stop` | `hooks/session-stop.ts` | Capture session telemetry |
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
### 4. Platform-Specific Setup
|
|
92
|
+
Derive the hook script paths from the `cli_path` field in `~/.selftune/config.json`.
|
|
93
|
+
The hooks directory is at `dirname(cli_path)/hooks/`.
|
|
91
94
|
|
|
92
95
|
**Codex agents:**
|
|
93
96
|
- Use `wrap-codex` for real-time telemetry capture (see `Workflows/Ingest.md`)
|
|
94
|
-
- Or batch-ingest existing sessions with `ingest-codex`
|
|
97
|
+
- Or batch-ingest existing sessions with `selftune ingest-codex`
|
|
95
98
|
|
|
96
99
|
**OpenCode agents:**
|
|
97
|
-
- Use `ingest-opencode` to import sessions from the SQLite database
|
|
100
|
+
- Use `selftune ingest-opencode` to import sessions from the SQLite database
|
|
98
101
|
- See `Workflows/Ingest.md` for details
|
|
99
102
|
|
|
100
103
|
### 5. Verify with Doctor
|
|
101
104
|
|
|
102
105
|
```bash
|
|
103
|
-
|
|
104
|
-
bun run $CLI_PATH doctor
|
|
106
|
+
selftune doctor
|
|
105
107
|
```
|
|
106
108
|
|
|
107
109
|
Parse the JSON output. All checks should pass. If any fail, address the
|
|
@@ -109,17 +111,13 @@ reported issues before proceeding.
|
|
|
109
111
|
|
|
110
112
|
## Common Patterns
|
|
111
113
|
|
|
112
|
-
**"
|
|
113
|
-
>
|
|
114
|
-
>
|
|
115
|
-
|
|
116
|
-
**"I moved the repo to a new directory"**
|
|
117
|
-
> Re-run init with the updated `--cli-path`. The config will be overwritten.
|
|
114
|
+
**"Initialize selftune"**
|
|
115
|
+
> Install the CLI (`npm install -g selftune`), run `selftune init`,
|
|
116
|
+
> install hooks, and verify with `selftune doctor`.
|
|
118
117
|
|
|
119
118
|
**"Hooks aren't capturing data"**
|
|
120
|
-
> Run `doctor` to check hook installation. Verify paths in
|
|
119
|
+
> Run `selftune doctor` to check hook installation. Verify paths in
|
|
121
120
|
> `~/.claude/settings.json` point to actual files.
|
|
122
121
|
|
|
123
122
|
**"Config exists but seems stale"**
|
|
124
|
-
>
|
|
125
|
-
> `--cli-path` to update the path.
|
|
123
|
+
> Run `selftune init --force` to reinitialize.
|
|
@@ -6,13 +6,7 @@ Records the rollback in the evolution audit log for traceability.
|
|
|
6
6
|
## Default Command
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
|
|
10
|
-
bun run $CLI_PATH rollback --skill <name> --skill-path <path> [options]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Fallback:
|
|
14
|
-
```bash
|
|
15
|
-
bun run <repo-path>/cli/selftune/index.ts rollback --skill <name> --skill-path <path> [options]
|
|
9
|
+
selftune rollback --skill <name> --skill-path <path> [options]
|
|
16
10
|
```
|
|
17
11
|
|
|
18
12
|
## Options
|
|
@@ -91,14 +85,13 @@ If `--proposal-id` is specified, use that instead.
|
|
|
91
85
|
### 2. Run Rollback
|
|
92
86
|
|
|
93
87
|
```bash
|
|
94
|
-
|
|
95
|
-
bun run $CLI_PATH rollback --skill pptx --skill-path /path/to/SKILL.md
|
|
88
|
+
selftune rollback --skill pptx --skill-path /path/to/SKILL.md
|
|
96
89
|
```
|
|
97
90
|
|
|
98
91
|
Or to rollback a specific proposal:
|
|
99
92
|
|
|
100
93
|
```bash
|
|
101
|
-
|
|
94
|
+
selftune rollback --skill pptx --skill-path /path/to/SKILL.md --proposal-id evolve-pptx-1709125200000
|
|
102
95
|
```
|
|
103
96
|
|
|
104
97
|
### 3. Verify Restoration
|
package/skill/Workflows/Watch.md
CHANGED
|
@@ -6,13 +6,7 @@ pass rates against a baseline within a sliding window of recent sessions.
|
|
|
6
6
|
## Default Command
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
|
|
10
|
-
bun run $CLI_PATH watch --skill <name> --skill-path <path> [options]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Fallback:
|
|
14
|
-
```bash
|
|
15
|
-
bun run <repo-path>/cli/selftune/index.ts watch --skill <name> --skill-path <path> [options]
|
|
9
|
+
selftune watch --skill <name> --skill-path <path> [options]
|
|
16
10
|
```
|
|
17
11
|
|
|
18
12
|
## Options
|
|
@@ -74,8 +68,7 @@ bun run <repo-path>/cli/selftune/index.ts watch --skill <name> --skill-path <pat
|
|
|
74
68
|
### 1. Run Watch
|
|
75
69
|
|
|
76
70
|
```bash
|
|
77
|
-
|
|
78
|
-
bun run $CLI_PATH watch --skill pptx --skill-path /path/to/SKILL.md
|
|
71
|
+
selftune watch --skill pptx --skill-path /path/to/SKILL.md
|
|
79
72
|
```
|
|
80
73
|
|
|
81
74
|
### 2. Check Regression Status
|