Skip to content

four-bytes/four-opencode-context-curator

Repository files navigation

@four-bytes/four-opencode-context-curator

Context curation before LLM requests — layered cacheable prefixes, token compaction, intelligent file selection.

npm license bun

Why?

opencode sends your entire project context to the LLM — wasting tokens on irrelevant files. Context Curator pre-filters files before each request: only changed blocks + surrounding context, prioritized by relevance. Dirac-inspired architecture saves significant tokens per session.

Quickstart

opencode plugin @four-bytes/four-opencode-context-curator -g

Restart opencode.

Architecture

4-layer cacheable prefix system with stability TTLs:

Layer Content Stability
Core Prefix Project structure, conventions High (TTL: session)
Repo Profile Git history, recent changes Medium (TTL: 5 min)
Task Slice Current task context Low (TTL: per-request)
Issue Slice Related issue context Low (TTL: per-request)

Compaction module reduces context when approaching token budget limits.

Configuration

No config file required — works out of the box. Token budget defaults to 8000 tokens. Behavior adjustable via opencode configuration.

Contributing

PRs welcome! See CONTRIBUTING.md.

bun install
bun run build
bun test

License

Apache-2.0 — see LICENSE


If this plugin saves you tokens, consider leaving a ⭐ on GitHub.

About

opencode plugin: pre-prompt context curator — sends only changed blocks + N context lines to reduce token cost

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors