
Security News
arXiv Is Rate Limiting Authors Following a Flood of AI Slop Submissions
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.
@serkanalgur/opencodev2-slim
Advanced tools
Smart context management plugin for OpenCode v2 - semantic compression, cost-aware pruning, adaptive thresholds
Smart context management plugin for OpenCode v2. Optimizes token usage through semantic compression, cost-aware pruning, and adaptive thresholds.
opencode plugin @serkanalgur/opencodev2-slim@latest --global
This installs the plugin globally. The TUI features (panel, slash commands) are automatically loaded when OpenCode starts.
If the CLI command doesn't work, add to your ~/.config/opencode/opencode.json:
{
"plugins": ["@serkanalgur/opencodev2-slim"]
}
After installation, these slash commands are available in the TUI:
/panel — Opens the rich TUI panel with context usage, stats, and help/compress — Shows instructions for using the compress toolThe panel provides a real-time overview of your context usage, including:
The enhanced compress tool supports multiple modes:
// Auto mode (default) - intelligently selects what to compress
compress({ focus: "old exploration" })
// Range mode - compress specific message range
compress({ focus: "completed tasks", mode: "range", start: 0, end: 50 })
// Topic mode - compress messages matching a topic
compress({ focus: "database work", mode: "topic", topic: "database" })
Create ~/.config/opencode/slim.jsonc:
{
"enabled": true,
"compress": {
"enabled": true,
"permission": "allow",
"maxContextLimit": "80%",
"minContextLimit": "40%",
"nudgeFrequency": 5,
"protectUserMessages": false,
"protectedTools": ["task", "skill", "todowrite", "todoread"]
},
"strategies": {
"deduplication": {
"enabled": true,
"protectedTools": []
},
"purgeErrors": {
"enabled": true,
"turns": 4,
"protectedTools": []
}
},
"adaptive": {
"enabled": true,
"learningRate": 0.1,
"minCompressionRatio": 0.3
},
"costAware": {
"enabled": true,
"cacheBoostFactor": 0.5
},
"persistence": {
"enabled": true,
"directory": "~/.config/opencode/slim"
}
}
Unlike simple text truncation, slim analyzes the semantic content of messages and groups related tool calls together. This preserves context while removing redundancy.
Slim considers the cost of tokens when deciding what to compress. It prioritizes compressing expensive operations (like large file reads) while preserving cheap but important context.
The plugin learns from your compression patterns and adjusts thresholds over time. If you tend to need more context, it will compress less aggressively. If you're efficient, it will compress more.
State is saved to disk, so compression history and learning persist across restarts.
| Command | Description |
|---|---|
/panel | Open the Slim TUI panel with context usage, stats, and help |
/compress | Show instructions for using the compress tool |
Note: Compression is performed by the AI assistant using the compress tool. The slash command provides guidance on usage.
/panel in the TUI not reflecting real context usage:
Session.Info.tokens + cost + model + context window) via context.client.session.get() and prints them (measured tokens, %, cost, model) at the bottom of the panel, matching what the panel tool reports.context.ui.router.current() instead of a non-existent context.router, so the panel targets the focused session rather than always the first one.context.data.session.message.sync() before reading the transcript so stats aren't computed from an empty/stale cache.ctx.model.default().data.limit.context instead of the hard-coded 200k./panel now reads live server measurements (Session.Info.tokens + cost) via ctx.session.get() and feeds them to buildPanelData, so the headline tokens/percent/cost match what OpenCode's UI reports.solid-js, @opentui/core, @opentui/solid to devDependencies.
The workflow runs npm ci --legacy-peer-deps, which skips peer deps, so loading
@opencode/plugin/tui failed with Cannot find package 'solid-js'./panel output showing User tokens: 0: user/system messages carry their text
on a top-level text field (not inside content), which deriveStats now captures.feat(panel-as-message): /panel and slim-panel now print the context stats as plain
text into the message stream via client.session.synthetic, instead of taking over
OpenCode's own panel UI (session.panel slot + ui.panel.open removed).keymap.provider is missing in the CLI plugin: register the keymap layer inside
an app slot render (where the keymap provider is available) instead of in setup().Cannot find package 'react' when the plugin is loaded from the global npm cache:
add a per-file /** @jsxImportSource @opentui/solid */ pragma to src/tui.tsx so JSX
always compiles against @opentui/solid/jsx-runtimetsconfig.json in the published package so loaders that read jsxImportSource from config pick it upcompaction hook so history actually shrinks (the context hook only affects the outgoing request)compress/panel tools with options.codemode so they appear in agent/codemode environmentstools always equalled zerosession.panel slot (slim-panel / /panel)Breaking Changes: Migrated to OpenCode v2 plugin API.
@opencode-ai/plugin to @opencode/pluginPlugin.define() pattern instead of server functionctx.tool.transform() with JSON Schema inputctx.session.hook()ctx.event.subscribe()MIT
FAQs
Smart context management plugin for OpenCode v2 - semantic compression, cost-aware pruning, adaptive thresholds
The npm package @serkanalgur/opencodev2-slim receives a total of 127 weekly downloads. As such, @serkanalgur/opencodev2-slim popularity was classified as not popular.
We found that @serkanalgur/opencodev2-slim demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.

Research
/Security News
A new GhostAction wave hits hundreds of GitHub repos, expanding CI/CD secret theft to cloud and AI credentials in source code and git history.

Research
/Security News
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.