Skip to content

v0.19.9#151

Merged
runkids merged 18 commits into
mainfrom
feat/context-budget-warning
May 11, 2026
Merged

v0.19.9#151
runkids merged 18 commits into
mainfrom
feat/context-budget-warning

Conversation

@runkids
Copy link
Copy Markdown
Owner

@runkids runkids commented May 11, 2026

  • Context cost summary after syncskillshare sync now displays a one-line token cost summary showing always-loaded and on-demand context usage per target. Targets with identical token counts are grouped on a single line. Refs: feat: surface always-loaded token cost during sync + configurable context budget warning #150
    ✔ Synced 47 skill(s) to 4 target(s) in 312ms
      Context: ~12.4K always-loaded · ~58.2K on-demand (claude, cursor, codex, opencode)
    
  • Configurable budget warnings — set token budget thresholds in config.yaml. When sync or analyze detects a target exceeding the budget, a warning shows the top 3 offenders by token count
    context_budget:
      warn_always_loaded_tokens: 10000   # default; 0 = disabled
      warn_on_demand_tokens: 100000      # default; 0 = disabled
    Defaults to 10K always-loaded / 100K on-demand. Set to 0 to disable
  • --quiet / -q flag for sync — suppresses the token summary and budget warnings. JSON output (--json) always includes context_cost regardless of --quiet
  • Context cost in Web UI — the Sync page now displays token cost groups and budget violation warnings after each sync

ref: #150

runkids added 17 commits May 11, 2026 14:00
Add --quiet/-q flag to suppress token summary and budget warnings.
Both global and project sync paths call buildAnalyzeEntries after
SyncSummary to display context cost and budget violations.
Always included in --json mode regardless of --quiet flag.
Contains grouped token counts and budget violation warnings.
Reuses checkBudget from sync_budget.go. No top-offender list
since analyze already shows the full per-skill breakdown.
DiscoverSourceSkillsWithStats did not set collectContext=true, so
DescChars/BodyChars were always 0 when sync called buildAnalyzeEntries.
Add DiscoverSourceSkillsWithStatsAndContext that enables both ignore
stats and context collection in a single walk, and use it in sync.go
and sync_project.go.
Self-contained token estimation (chars/4) since buildAnalyzeEntries
is in main package. Returns grouped counts and budget violations.
- Define budgetTypeAlwaysLoaded/budgetTypeOnDemand constants
- Add showDetails param to printBudgetWarning; analyze reuses it
- Hoist buildAnalyzeEntries call to avoid duplicate computation
- Remove WHAT-comments that restate function names
Both global and project schemas now recognize context_budget,
resolving the 'Unknown field' warning in the Config page.
The assistant panel already shows field documentation via JSON schema.
A static reference card is redundant and breaks the page's interaction
pattern of cursor-driven contextual help.
Context budget warnings (issue #150), --quiet flag, Web UI context
cost display, and HTTP protocol install fix.
…xample

Also documents context_budget config block in configuration reference
with field types, defaults, and cross-link to sync docs.
All 11 locales: en, zh-TW, zh-CN, ja, ko, de, es, fr, pt-BR, id, fa.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces token budget management and context cost summaries for the sync and analyze commands. Key features include a one-line token cost summary after syncing, configurable budget thresholds in config.yaml with associated warnings for offenders, a new --quiet flag to suppress these messages, and integration of these costs into the Web UI. Review feedback highlights significant logic duplication between the CLI and server components regarding context cost calculation, which should be refactored into a shared package. Additionally, the checkBudget function is noted for only reporting the single worst offender rather than all targets exceeding the budget, and a large block in ConfigPage.tsx was flagged for inconsistent indentation.

Comment thread internal/server/handler_sync.go
Comment thread ui/src/pages/ConfigPage.tsx Outdated
Comment thread cmd/skillshare/sync_budget.go Outdated
Copy link
Copy Markdown

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

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: 719a6800ed

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread cmd/skillshare/sync.go Outdated
}
}
return syncOutputJSON(results, dryRun, start, projIgnoreStats, err)
return syncOutputJSON(results, dryRun, start, projIgnoreStats, err, nil)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include context_cost in project JSON sync responses

Project-mode sync always passes nil for the context-cost payload here, so skillshare sync -p --json omits context_cost even though this release’s contract says JSON output should include it (with --quiet only affecting text output). This creates inconsistent behavior between global and project sync and can break consumers that rely on the new field.

Useful? React with 👍 / 👎.

Comment thread internal/server/handler_sync.go Outdated
- Project mode JSON sync now includes context_cost (was nil)
- Server handler respects symlink mode (skips include/exclude filters)
- checkBudget reports all targets exceeding threshold (not just worst)
- Budget warnings include target name in CLI and UI output
- ConfigPage indentation restored to original 2-space style
@runkids runkids merged commit 9a7271c into main May 11, 2026
14 of 15 checks passed
@runkids runkids deleted the feat/context-budget-warning branch May 11, 2026 13:34
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