Skip to content

Backend data for v0.2: usage, context cost, health, MCP status, moved/removed, risk flags - #5

Merged
sanchezrobertodev merged 3 commits into
masterfrom
feature/backend-data
Nov 1, 2026
Merged

sanchezrobertodev merged 3 commits into
masterfrom
feature/backend-data

Conversation

@sanchezrobertodev

Copy link
Copy Markdown
Owner

Stacked on #4 (which is stacked on #3). Merge those first; GitHub will then retarget this to master.

M2 of the v0.2 plan: the data the new screens need. The UI for most of it lands in M3/M4. The new statuses show up already.

What's in it

  • Mod tag. A plugin whose hooks/hooks.json has modules is marked as a mod. On this machine that's always-skill.

  • Context cost (cost.rs). Estimated tokens per item: name + description of each listed skill, command and agent, at chars/4. MCP tool schemas and hook output aren't counted. This machine totals about 53k tokens with everything enabled.

  • Usage (usage.rs). Uses per item over the last 30 days, plus the last-used time, counted from ~/.claude/projects/**/*.jsonl.

    • What counts: assistant Skill / Agent tool calls, mcp__plugin_* calls, and typed slash commands.
    • Request snapshots (api-request-shape) and wireToolInputs are ignored, so nothing is counted twice.
    • Incremental: per-file offsets and counts are cached in the app data folder.
    • Measured on 1,007 real transcripts, debug build: first run 72 s, next run 0.1 s, cache 211 KB.
    • The module has no network code.
  • Skill health (health.rs). Flags:

    • missing or invalid front matter;
    • missing description, or one over 1,024 characters;
    • duplicate names within a session.

    The scanner adds two more:

    • link-missing: a locked skill with no ~/.claude/skills link. These used to be hidden; find-skills here is one.
    • link-replaced: a real folder that differs from ~/.agents/skills.
  • MCP status (mcp.rs, mcp_status command).

    • Parses claude mcp list into Connected / Needs sign-in / Failed / Not configured / Pending / Unknown, grouped by plugin or claude.ai.
    • Only hosts and program names reach the UI. A test checks that paths, queries and arguments don't leak.
  • Moved / Removed upstream. New statuses with Item.upstream:

  • What's new for skills CLI skills. It now finds the installed commit by matching skillFolderHash against the folder's tree at each recent commit (up to 30), instead of using the install date.

  • Risk flags (updates/risk.rs). Flags hooks, MCP servers, scripts and allowed-tools changes, returned in the changelog as risks.

    • Marketplace plugins: compares the local marketplace copy with the install folder.
    • GitHub-pinned plugins and skills: uses the GitHub compare API.
    • null when a check isn't possible, for example when GitHub truncates the file list at 300.
  • item_readme returns SKILL.md or README.md, at most 200 KB, without front matter. last_runs returns the last job's output per item, persisted in last-runs.json.

  • types.ts, api.ts and the dev mock mirror all of the above. The mock adds a moved and a removed skill, usage data, MCP fixtures and risk samples.

Checks

  • make check passes: tsc, fmt, clippy -D warnings, 56 tests. New tests cover:
    • mcp parsing on real output, and the no-leak check;
    • usage line attribution, incremental reads and day math;
    • health rules;
    • risk classification, on paths, contents and temp folders;
    • cost;
    • locating moved and removed skills;
    • the reinstall arguments.
  • Ran the real-machine smoke test and regenerated the (gitignored) dev snapshot.
  • The browser preview renders the new statuses.

Not checked

  • A renamed-repo redirect against live GitHub. The redirect detection isn't exercised in tests.
  • The usage timing in a release build.
  • Risk flags against a real pending plugin update in the app. They're unit-tested only.

🤖 Generated with Claude Code

…/removed, risk flags

- Mod tag: plugins whose hooks/hooks.json loads UI modules.
- Context cost: a rough token estimate per item from the skill, command and
  agent listings Claude Code always sends.
- Usage: counts skill, command, agent and plugin MCP uses from the local
  transcripts, reading only what was appended since the last run. No network.
- Skill health: front matter, description, duplicate names, and skills CLI
  links that are missing (now listed instead of hidden) or replaced.
- MCP status: parses `claude mcp list`, keeping only hosts and program names.
- Skills that moved or were deleted upstream get their own status, with the
  new location or the deleting commit, and a Reinstall action.
- What's new for skills CLI skills starts from the commit matching the
  installed folder hash instead of the install date.
- Update risk flags (hooks, MCP servers, scripts, allowed tools) in the
  changelog, from the local marketplace copy or the GitHub compare API.
- README/SKILL.md preview and the last run's output per item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T20:19:52.291437Z 481b906 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 481b906704

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/src/usage.rs Outdated
Comment on lines +128 to +130
by_item: items
.iter()
.map(|i| (i.id.clone(), credit(i, &totals, today)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve project scope when attributing usage to items

When two configured projects contain skills with the same name, this credits both items with the combined usage from every project's transcripts. scan/skills.rs::project_skill gives these skills distinct IDs and records their project in meta["Project"], but the index merges all files into name-only totals before calling credit, which never checks that project metadata. Consequently, an unused project skill receives another project's usage count and last-used timestamp. Retain project identity during aggregation and filter counts to the item's applicable sessions.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 678647b: a project skill now only counts sessions from its project's transcript folder in ~/.claude/projects (the project path with every non-alphanumeric character turned into -, plus folders inside the project). Test: project_skills_count_only_their_projects_sessions.

Comment thread src-tauri/src/updates/changelog.rs Outdated
Comment on lines +523 to +524
let pair = (raw_file(repo, base, &full).await, raw_file(repo, head, &full).await);
out.insert(rel.clone(), pair);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Distinguish failed risk-content fetches from absent files

If the compare API succeeds but the raw-file requests fail, raw_file returns None for each failed request and this stores those failures as though the files did not exist. For an update that changes only allowed-tools in SKILL.md or inline hooks/MCP configuration in plugin.json, failed before-and-after fetches therefore produce Some([]) risks rather than an unavailable assessment. The changelog is also cached without being marked retryable. Propagate fetch failures separately from genuine missing files so an incomplete check returns unknown risk status and can be retried.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 678647b: raw_file now returns Ok(None) only for a 404 and Err for a failed request or another status. A failed fetch leaves risks as None and marks the changelog retryable, for both the plugin compare path and skill_risks.

sanchezrobertodev and others added 2 commits October 31, 2026 19:52
- Usage: a project skill only counts sessions in its project's transcript
  folder, so two projects with a same-named skill no longer share counts.
- Risk flags: a raw file that couldn't be fetched is no longer read as a
  missing file. The risks stay unknown and the changelog is refetched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sanchezrobertodev
sanchezrobertodev changed the base branch from feature/redesign to master November 1, 2026 01:49
@sanchezrobertodev
sanchezrobertodev merged commit 5c557ed into master Nov 1, 2026
4 checks passed
@sanchezrobertodev
sanchezrobertodev deleted the feature/backend-data branch November 17, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant