@osovv/vv-opencode 2.7.1 → 2.8.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.
- package/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/schemas/vvoc/v3.json +1 -1
- package/templates/skills/vv-execute/SKILL.md +183 -291
- package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
- package/templates/skills/vv-handoff/SKILL.md +39 -50
- package/templates/skills/vv-plan/SKILL.md +97 -155
- package/templates/skills/vv-reflect/SKILL.md +91 -111
- package/templates/skills/vv-review/SKILL.md +33 -26
- package/templates/skills/vv-spec/SKILL.md +51 -93
- package/templates/skills/vv-ui-design-principles/SKILL.md +28 -33
- package/templates/skills/vv-ui-design-principles/references/slop-tells.md +9 -0
- package/templates/skills/vv-verification/SKILL.md +44 -55
- package/templates/skills/vv-verification/references/create-your-verification-stack.md +16 -0
- package/templates/skills/vv-verification/references/evidence.md +9 -0
- package/templates/skills/vv-verification/references/oracles.md +8 -0
- package/templates/skills/vv-verification/references/strategy.md +10 -0
- package/templates/skills/vv-write-for-agents/SKILL.md +33 -33
- package/templates/skills/vv-write-for-humans/SKILL.md +47 -49
- package/templates/skills/vvoc-usage-analytics/SKILL.md +45 -43
- package/templates/skills/vvoc-usage-analytics/references/opencode-db-queries.md +12 -3
|
@@ -3,56 +3,58 @@ name: vvoc-usage-analytics
|
|
|
3
3
|
description: Use when the user asks about token usage, cache hit rate, cache efficiency, model or provider consumption, session costs, or whether a vvoc release or OpenCode upgrade changed caching behavior. Runs read-only analysis over vvoc analytics (CLI and JSONL) and historical opencode.db data, then reports findings without modifying anything.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<skill>
|
|
7
|
-
<identity>
|
|
8
|
-
You are the vvoc-usage-analytics skill. You turn usage questions into evidence-based answers. You know the three data sources, their coverage boundaries, and the exact metric definitions, and you never guess a number you did not read from a source. You are an analyst, not a fixer: you report findings and leave changes to the user.
|
|
9
|
-
</identity>
|
|
10
|
-
|
|
11
6
|
<scope>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<rule>Report findings only. Recommendations are fine; silent "fixes" to telemetry or config are out of scope.</rule>
|
|
16
|
-
<rule>If a source is unavailable (no db file, empty JSONL, sqlite3 missing), say so explicitly and continue with the sources that exist instead of implying there was no usage.</rule>
|
|
7
|
+
Turn usage questions into evidence-based answers. Know the three data sources, their coverage boundaries, and the exact metric definitions, and never guess a number you did not read from a source. You are an analyst, not a fixer: report findings and leave changes to the user.
|
|
8
|
+
|
|
9
|
+
OpenCode's database is strictly read-only: always connect with a `?mode=ro` URI (see references/opencode-db-queries.md). Never run UPDATE/INSERT/DELETE/DDL against it, even diagnostically. Never modify, delete, truncate, or "repair" analytics JSONL files, and never suggest doing so as a fix. Read-only also means no config changes: do not toggle plugins, rewrite vvoc.json, or restart anything unless the user explicitly asks for that as a separate task. Report findings only; recommendations are fine, silent "fixes" to telemetry or config are out of scope. If a source is unavailable (no db file, empty JSONL, sqlite3 missing), say so explicitly and continue with the sources that exist instead of implying there was no usage.
|
|
17
10
|
</scope>
|
|
18
11
|
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
<workflow>
|
|
13
|
+
1. Clarify the question into metric(s), grouping, and time range. If the user's ask is vague ("is my cache ok?"), default to hit rate grouped by day for the last 14 days plus coverage, then offer deeper cuts.
|
|
14
|
+
2. Pick the narrowest source that can answer it: CLI first; JSONL only for cuts the CLI lacks; opencode.db only for pre-plugin history or cost-per-session questions. State which source you are using and why.
|
|
15
|
+
3. Run the query read-only. For db queries, use the reference snippets; adapt only filters (WHERE/LIMIT), not the hit-rate formula.
|
|
16
|
+
4. Sanity-check coverage before answering: how many steps does the range contain, what share is cache-eligible (coverage), and where does each source's data begin. A hit rate over 12 steps means more than one over 12,000.
|
|
17
|
+
5. Present findings as a compact table plus 2-4 sentences of interpretation. Every answer names its data source and time range. When mixing sources, state the JSONL start boundary explicitly so the user knows which numbers come from where.
|
|
18
|
+
6. Offer the natural follow-up cut (by model, by session, before/after a date) instead of running all of them unasked.
|
|
19
|
+
</workflow>
|
|
20
|
+
|
|
21
|
+
<rules>
|
|
22
|
+
- Prefer the vvoc CLI for anything it can answer. It already dedupes, filters, groups, and formats.
|
|
23
|
+
- CLI coverage starts when the analytics plugin first ran (JSONL start date), and only steps after an OpenCode restart are recorded.
|
|
24
|
+
- Use raw monthly JSONL files only when the question needs something the CLI does not compute (unusual groupings, per-agent or per-message drill-downs, exact record inspection). Lines are JSON objects: `kind` is `usage` (one per step-finish part, dedupe by `partID` keeping the last) or `session` (dedupe by `sessionID`). jq, python, or bun one-liners are all fine — reading only.
|
|
25
|
+
- Use OpenCode's own SQLite database for history that predates the plugin and for per-session cost aggregates. It holds months of step-finish parts with tokens, session cost and token totals, and `session.version` — the OpenCode version. Always read it with the validated snippets in references/opencode-db-queries.md (`?mode=ro` URI). This is the only source that can answer "how did caching look before vvoc analytics existed" and "what did sessions cost".
|
|
26
|
+
- Tables over prose for any comparison; columns in the CLI's spirit (GROUP, STEPS, COVERAGE, HIT-RATE, CACHE-READ, CACHE-WRITE, FRESH-IN or their subset).
|
|
27
|
+
- Every number carries its source (CLI / JSONL / opencode.db) and time range.
|
|
28
|
+
- State validation context for db queries: the snippets were validated against OpenCode 1.18.x, and the supported host window is 2.0.18 and newer, below 3.0.0. If columns error out, report the schema mismatch instead of improvising SQL guesses.
|
|
29
|
+
- Interpretation stays factual: rising/falling hit rate, coverage share, outliers. Avoid unfounded causal claims; a vvoc version bump and a project switch can co-occur.
|
|
30
|
+
</rules>
|
|
31
|
+
|
|
32
|
+
<artifact>
|
|
33
|
+
Data sources, in precedence order:
|
|
34
|
+
|
|
35
|
+
| Precedence | Source | Use when | Coverage |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| 1 | vvoc CLI | anything it can answer: trend, release/version comparison, per session/model/provider/project grouping | starts when the analytics plugin first ran; only steps after an OpenCode restart |
|
|
38
|
+
| 2 | analytics JSONL (`$XDG_DATA_HOME/vvoc/analytics/usage-YYYY-MM.jsonl`) | cuts the CLI does not compute: unusual groupings, per-agent or per-message drill-downs, exact record inspection | monthly files from the plugin start date |
|
|
39
|
+
| 3 | opencode.db (`~/.local/share/opencode/opencode.db`, override via `$OPENCODE_DATA_HOME`) | pre-plugin history and per-session cost aggregates | months of step-finish parts; `session.version` carries the OpenCode version |
|
|
40
|
+
|
|
41
|
+
CLI examples:
|
|
22
42
|
- Trend: `vvoc analytics cache-hit-rate --group-by day|week|month --since 30d`
|
|
23
43
|
- Compare vvoc releases: `--group-by vvoc --since 30d`
|
|
24
44
|
- Compare OpenCode versions: `--group-by opencode --since 30d`
|
|
25
45
|
- Per session / model / provider / project: `--group-by session|model|provider|project`
|
|
26
46
|
- Filters and output: `--since`/`--until` accept `Nd`/`Nw`/`Nm` or `YYYY-MM-DD`; `--project` is a case-insensitive substring; `--order steps|hit-rate|date`; `--limit N`; `--json` for machine-readable rows.
|
|
27
|
-
Note: CLI coverage starts when the analytics plugin first ran (JSONL start date), and only steps after an OpenCode restart are recorded.
|
|
28
|
-
</source>
|
|
29
|
-
<source name="analytics JSONL" precedence="2">
|
|
30
|
-
Use the raw monthly files `$XDG_DATA_HOME/vvoc/analytics/usage-YYYY-MM.jsonl` when the question needs something the CLI does not compute (unusual groupings, per-agent or per-message drill-downs, exact record inspection). Lines are JSON objects: `kind` is `usage` (one per step-finish part, dedupe by `partID` keeping the last) or `session` (dedupe by `sessionID`). jq, python, or bun one-liners are all fine — reading only.
|
|
31
|
-
</source>
|
|
32
|
-
<source name="opencode.db history" precedence="3">
|
|
33
|
-
Use OpenCode's own SQLite database for history that predates the plugin and for per-session cost aggregates: `~/.local/share/opencode/opencode.db` (override via $OPENCODE_DATA_HOME when the user has one). It holds months of step-finish parts with tokens, session cost/token totals, and `session.version` = the OpenCode version. Always read it with the validated snippets in references/opencode-db-queries.md (`?mode=ro` URI). This is the only source that can answer "how did caching look before vvoc analytics existed" and "what did sessions cost".
|
|
34
|
-
</source>
|
|
35
|
-
</data_sources>
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
48
|
+
Metric definitions:
|
|
49
|
+
- cache hit rate — token-weighted: `cacheRead / (cacheRead + cacheWrite + input)` summed over cache-eligible steps. A step is cache-eligible when `cacheRead + cacheWrite > 0`. Identical to the CLI and the SQL reference — do not invent per-step averaging.
|
|
50
|
+
- coverage — `eligibleSteps / steps`. Low coverage means the provider rarely reports cache tokens; say that, do not hide it behind a hit rate.
|
|
51
|
+
- n/a — groups with zero eligible steps have no hit rate. Report `n/a` — never `0%` — and show coverage so "provider does not report cache" stays distinguishable from "cache misses".
|
|
52
|
+
</artifact>
|
|
53
|
+
|
|
54
|
+
<refs>
|
|
55
|
+
- `references/opencode-db-queries.md` — validated read-only opencode.db snippets; load before any database query and adapt only WHERE/LIMIT filters.
|
|
56
|
+
</refs>
|
|
45
57
|
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<metric name="n/a">Groups with zero eligible steps have no hit rate. Report `n/a` — never `0%` — and show coverage so "provider does not report cache" stays distinguishable from "cache misses".</metric>
|
|
50
|
-
</metric_definitions>
|
|
51
|
-
|
|
52
|
-
<output_discipline>
|
|
53
|
-
<rule>Tables over prose for any comparison; columns in the CLI's spirit (GROUP, STEPS, COVERAGE, HIT-RATE, CACHE-READ, CACHE-WRITE, FRESH-IN or their subset).</rule>
|
|
54
|
-
<rule>Every number carries its source (CLI / JSONL / opencode.db) and time range.</rule>
|
|
55
|
-
<rule>State validation context for db queries: snippets were validated against OpenCode 1.18.x; if columns error out, report the schema mismatch instead of improvising SQL guesses.</rule>
|
|
56
|
-
<rule>Interpretation stays factual: rising/falling hit rate, coverage share, outliers. Avoid unfounded causal claims; a vvoc version bump and a project switch can co-occur.</rule>
|
|
57
|
-
</output_discipline>
|
|
58
|
-
</skill>
|
|
58
|
+
<done>
|
|
59
|
+
The answer presents a compact table plus interpretation, names the data source and time range for every number, states coverage and any source boundary, and offers one natural follow-up cut. No data source or config was modified.
|
|
60
|
+
</done>
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# opencode.db read-only queries
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
## Contents
|
|
4
|
+
- Connection — always read-only
|
|
5
|
+
- Schema orientation
|
|
6
|
+
- Hit-rate formula (must match the vvoc CLI)
|
|
7
|
+
- (a) Cache hit rate by OpenCode version
|
|
8
|
+
- (b) Cache hit rate by month
|
|
9
|
+
- (c) Recent sessions: cost and token totals
|
|
10
|
+
- (d) Step-finish counts by provider/model
|
|
11
|
+
|
|
12
|
+
Validated against OpenCode **1.18.x** on a real 5.7 GB database (2026-08). The supported
|
|
13
|
+
host window is **2.0.18 and newer, below 3.0.0**; if a column errors out there, report the
|
|
14
|
+
schema mismatch — do not improvise guesses about the new schema.
|
|
6
15
|
|
|
7
16
|
## Connection — always read-only
|
|
8
17
|
|