Skip to content

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

Open
AwenJackson wants to merge 3 commits into
zai-org:mainfrom
AwenJackson:add-zcode-context
Open

AwenJackson wants to merge 3 commits 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.

@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.

@panda920

Copy link
Copy Markdown
Collaborator

❌ Internal validation failed:

FAIL: 1 problem(s)
  - marketplace.json plugins[54] (zcode-context): plugin.json version '0.2.1' does not match marketplace version '0.2.0'

Please fix it and push again; the check re-runs automatically.

🤖 Copy this prompt into Claude Code / Codex to fix it
You are updating my pull request #191 to github.com/zai-org/zcode-plugins (the ZCode plugin marketplace).
The maintainers' automated intake reported: `python scripts/validate.py` failed

Validator output:
FAIL: 1 problem(s)
  - marketplace.json plugins[54] (zcode-context): plugin.json version '0.2.1' does not match marketplace version '0.2.0'

Fix it in this repository:
- New external plugins belong under external_plugins/<my-plugin>/; keep existing plugins in their current directory;
  never modify .github/, scripts/, tests/, .gitignore, .gitattributes or AGENTS.md.
- Follow CONTRIBUTING.md and AGENTS.md: the manifest lives at <plugin-directory>/.zcode-plugin/plugin.json,
  its name/version must match marketplace.json, names are kebab-case, keep the required i18n fields.
- Fetch the latest main of zai-org/zcode-plugins and rebase onto it; if marketplace.json conflicts,
  keep every existing entry and re-add mine.
- Run `python scripts/validate.py` until it passes, then force-push my PR branch.

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