Skip to content

Add community plugin: zcode-context (context insight dashboard / 上下文洞察) - #191

Open
AwenJackson wants to merge 1 commit into
zai-org:mainfrom
AwenJackson:add-zcode-context
Open

AwenJackson wants to merge 1 commit into
zai-org:mainfrom
AwenJackson:add-zcode-context

Conversation

@AwenJackson

Copy link
Copy Markdown

Summary

Adds zcode-context (v0.2.0) — a context-usage insight dashboard plugin for ZCode, inspired by dsh-context for DeepSeek Harness.

What it does

  • Overview tab: 6 KPI cards (sessions / tokens / cost estimate / cache hit rate / tool calls / active time), 7-day token+cost chart, 8-week activity heatmap, tool/command/project rankings — ranking rows are clickable to filter session cards
  • Sessions tab: sort by tokens / recent / context usage, workspace filter, title search, mini context-pressure donut per card
  • Context tab (per session): context composition bar with hatched compaction reserve, collapsible context browser (system-prompt snapshot preview, tool-name list), trend chart (total/delta × step/turn) with hover tooltips and pinned request detail, event log with type filter pills and expandable rows, file activity with read/write/edit filters + path search, cost composition donut
  • Formation tab: agent tree with parent-chain highlight on hover, click a child node to open the sub-session detail
  • Global floating tooltips with data semantics on every chart; disk cache + background refresh + startup prefetch for instant opens

How it works / Security notes (self-check)

  • Data comes only from the local ZCode SQLite DB (~/.zcode/cli/db/db.sqlite) and ~/.zcode/cli/agents/<id>/, opened read-only; no network requests, nothing reported
  • The sidebar entry + dashboard are injected via an app.asar patch performed by a SessionStart hook (with integrity validation, automatic backup, and /remove-panel + scripts/unpatch.mjs to cleanly revert). The loader runs query scripts with the embedded Electron Node runtime (ELECTRON_RUN_AS_NODE=1), so no system node is required
  • Source of truth: https://github.com/AwenJackson/zcode-context (Apache-2.0, dsh-context design credited in README)

Checklist

  • Selected plugin type: 普通插件 (normal plugin) — plugin name: zcode-context
  • Registered in marketplace.json with category developer-tools and bilingual (EN/zh-CN) descriptions that are semantically identical
  • Added external_plugins/zcode-context/ with .zcode-plugin/plugin.json manifest
  • README with install/uninstall/troubleshooting docs
  • Apache-2.0 LICENSE
  • python3 scripts/validate.py / build_dist.py — skipped: this is a hook/asar-injection plugin without a UI-plugins package (no ui-plugins/ source to build); happy to run them if the pipeline requires it

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

This branch has not been deployed

No deployments
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.

2 participants