This repository builds a local-first control layer for OpenCode.
The product goal is simple:
- help the user understand how they use OpenCode
- reduce context waste
- preserve continuity across long sessions and compaction
- stay free, local-first, and easy to extend
Generate a local HTML report from recent OpenCode sessions.
Deliverables:
insights-report.html.contextos/analysis/insights.json- repeated instruction candidates
- AGENTS patch suggestions
- friction pattern summaries
Surface context bloat signals and recommend specific next actions.
Deliverables:
.contextos/analysis/context-budget.json- a concise terminal summary
- suggestions like:
- move a repeated instruction into
AGENTS.md - split a workflow into a skill
- summarize a long result instead of carrying full output forward
- refresh the session guard before continuing
- move a repeated instruction into
Maintain a short durable note that survives compaction.
Files:
.contextos/guard/SESSION_GUARD.md.opencode/plugins/contextos-guard.js
- 复用高频指令:当同类用户指令在多个 session 出现时,沉淀为此文件中的显式规则,减少短期复述成本。
- 长结果摘要化:跨上下文接续前,将超长输出总结为结论与关键决策,不要继续沿用整段长文本。
- 会话接续前后:进入复杂子任务前先更新
.contextos/guard/SESSION_GUARD.md,避免 compaction 期间目标丢失。
Continue if you have next steps如何评价游戏《仁王3》,这一作有什么新的玩法和体验?根据agents.MD 构建本项目的智能体
Mirror recent session exports locally so the user can recover intent even if session UI loading is flaky.
Deliverables:
.contextos/rescue/*.json.contextos/rescue/index.md
- default to local files
- avoid external services
- prefer zero dependencies
- do not silently apply risky changes
- generate reviewable patches instead of magical hidden mutations
- keep report output stable and human-readable
- preserve backward compatibility of analysis JSON when possible
- use plain ESM JavaScript unless TypeScript is clearly worth it
- prefer small pure helper functions in
scripts/contextos-lib.mjs - avoid framework lock-in
- never assume one fixed OpenCode export JSON shape
- keep heuristics explicit and easy to tweak
When asked to continue building this project:
- read
README.md,docs/MVP.md,docs/ARCHITECTURE.md, anddocs/ROADMAP.md - choose the next unfinished high-leverage task
- make a small but real implementation
- update docs if the contract changed
- keep everything local-first
- cross-device sync
- SaaS backend
- account systems
- paid tiers
- trying to replace OpenCode itself