superwiki 0.1.2 → 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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +63 -25
- package/commands/stats.md +5 -0
- package/package.json +1 -1
- package/skills/sw-config/SKILL.md +19 -8
- package/skills/sw-config/assets/reviewer.md +41 -0
- package/skills/sw-config/scripts/config.mjs +6 -1
- package/skills/sw-implement/SKILL.md +49 -23
- package/skills/sw-init/assets/sw.mjs +398 -16
- package/skills/sw-init/assets/templates/task.md +5 -1
- package/skills/sw-init/assets/viewer.html +2 -0
- package/skills/sw-init/scripts/init.mjs +178 -99
- package/skills/sw-migrate/SKILL.md +36 -25
- package/skills/sw-migrate/scripts/migrate.mjs +422 -180
- package/skills/sw-stats/SKILL.md +50 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sw-stats
|
|
3
|
+
description: Use when the user asks what the current agent session has cost or used (tokens, context size, steps, tool calls, time, per subagent), wants a session summary or statistics, or invokes sw-stats or sw:stats.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# sw-stats
|
|
7
|
+
|
|
8
|
+
Shows what this session has cost so far: one row for the main session and one for each subagent it started. A script reads the record your tool keeps of the session; you read nothing yourself and write no file.
|
|
9
|
+
|
|
10
|
+
Run from the project root:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node docs/.sw/sw.mjs stats
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
It reports the session it runs in. For another session of this project, add `--session <id or its first characters>`; to look only at one tool's sessions, `--tool claude|codex|copilot`.
|
|
17
|
+
|
|
18
|
+
## Answer
|
|
19
|
+
|
|
20
|
+
1. **Show the table as printed**, in a code block. Do not round, reorder or translate it.
|
|
21
|
+
2. **Add at most three observations**, in the user's language, each one a number from the table and what it means. Pick the ones that apply:
|
|
22
|
+
|
|
23
|
+
| In the table | Say |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| one agent's `sent` is most of the total | which agent, and its share. That is where the session's cost is |
|
|
26
|
+
| an agent's `peak` is several times its `first` | its context grew during the work; `steps` times a large context is what makes `sent` large |
|
|
27
|
+
| `first` is large for `main` | the session starts heavy before it reads anything: rules files, plugins and tool definitions. The tool's own context command shows what fills it |
|
|
28
|
+
| `cached` is well below the others for one agent | much of what it sent was not served from the cache, which costs more per token. Long pauses do that |
|
|
29
|
+
| `main` has many `steps` or a `peak` far above its `first` | work is running in the main session that a subagent could do in a clean context |
|
|
30
|
+
|
|
31
|
+
3. Nothing else: no advice the table does not support, and no price. The table counts tokens; what a token costs depends on the user's plan.
|
|
32
|
+
|
|
33
|
+
## Columns
|
|
34
|
+
|
|
35
|
+
So that you can answer a question about them:
|
|
36
|
+
|
|
37
|
+
- `steps`: model requests. `tools`: tool calls. `min`: minutes between the agent's first and last record.
|
|
38
|
+
- `first`, `peak`: tokens sent with the first request and with the largest one.
|
|
39
|
+
- `sent`: tokens sent, summed over every step. A step re-sends the whole context, so this is far larger than `peak`.
|
|
40
|
+
- `cached`: the share of `sent` that was read from the cache.
|
|
41
|
+
- `output`: tokens the model wrote.
|
|
42
|
+
- `-`: the tool's record does not hold that number.
|
|
43
|
+
|
|
44
|
+
## If it fails
|
|
45
|
+
|
|
46
|
+
| Output | Do |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `unknown command stats` | the project's `docs/.sw/sw.mjs` is older than this skill; offer to run sw-init, which updates it |
|
|
49
|
+
| `no agent session record found` | say so, and name the tool's own command instead: `/cost` or `/context` (Claude Code), `/status` (Codex), `/usage` (Copilot CLI). A session started in a subfolder of the project is recorded under that folder and is not found |
|
|
50
|
+
| a note that Copilot has not written token counts yet | pass the note on; steps and tool calls are still valid |
|