---
title: Context Limit — OpenCode V2 Plugin by Jad Madi (@jadmadi)
description: >-
  Sets a per-model working context budget by lowering the model window, so
  compaction fires before quality drops.
href: /project/opencode-plugins/context-limit/
category: Models
version: 2026.9.0
builtUnder: 2.0.16
license: MIT
repo: 'https://github.com/jadmadi/opencode-context-limit'
author: Jad Madi
runtime: OpenCode V2
telemetry: 0% (Local First)
installCommand: 'opencode plugin add github:jadmadi/opencode-context-limit'
tags:
  - context
  - compaction
  - budget
  - models
---
# Context Limit — OpenCode V2 Plugin

Sets a per-model working context budget by lowering the model window, so compaction fires before quality drops.

- **Website**: https://jadmadi.net/project/opencode-plugins/context-limit/
- **Repository**: https://github.com/jadmadi/opencode-context-limit
- **Category**: Models
- **Version**: v2026.9.0 (CalVer)
- **Tested Runtime**: OpenCode v2.0.16
- **License**: MIT
- **Artifact**: `context-limit.ts`
- **Updated**: 2026-09-25
- **Author**: [@JadMadi](https://x.com/jadmadi)

## Quick Install

Install with a single command in OpenCode V2:

```bash
opencode plugin add github:jadmadi/opencode-context-limit
```

### Manual / Local Install

Copy context-limit.ts into ~/.config/opencode/plugins/ and restart the TUI.

## The Problem It Solves

A model's advertised window is larger than its useful working window, and one global compaction threshold is either too late for small models or too eager for large ones.

## What It Does

Sets a per-model working context budget by lowering the model window, so compaction fires before quality drops.

## Slash Commands

| Command | Description |
| :--- | :--- |
| `/context-limit` | Show or set a working context budget for a model or pattern. |

## Limitations & Safety Rules

It can only lower a model window, never raise it.

## Frequently Asked Questions (Agent Q&A)

### Q: What problem does Context Limit solve?
A model's advertised window is larger than its useful working window, and one global compaction threshold is either too late for small models or too eager for large ones.

### Q: How do I install and run Context Limit?
Run `opencode plugin add github:jadmadi/opencode-context-limit` in your terminal.

### Q: Does this plugin transmit telemetry or code externally?
No. It operates with 0% telemetry, local-first in ~/.config/opencode/plugins/.

## Links & Resources

- Dedicated Page: https://jadmadi.net/project/opencode-plugins/context-limit/
- All OpenCode Plugins: https://jadmadi.net/project/opencode-plugins/
- GitHub Repository: https://github.com/jadmadi/opencode-context-limit
- Changelog: https://github.com/jadmadi/opencode-context-limit/blob/main/CHANGELOG.md
- Author Profile: https://jadmadi.net/about/
