docs: add breakdown configuration guide#205
Conversation
There was a problem hiding this comment.
1 issue found across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…s and fix verify path
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/breakdown-configuration.md">
<violation number="1" location="docs/breakdown-configuration.md:157">
P2: Duplicate-entry cleanup command only modifies `~/.opencode/opencode.json` even though the troubleshooting guidance directs users to check both `~/.opencode/opencode.json` and `~/.opencode/tui.json` for duplicate plugin entries. If the duplicate is in `tui.json`, the fix will silently fail to resolve the issue.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| ```bash | ||
| # Targeted removal — removes just the magic-context entry from the plugin array, | ||
| # never deletes the entire file even if it contains other config. | ||
| if [ -f ~/.opencode/opencode.json ]; then |
There was a problem hiding this comment.
P2: Duplicate-entry cleanup command only modifies ~/.opencode/opencode.json even though the troubleshooting guidance directs users to check both ~/.opencode/opencode.json and ~/.opencode/tui.json for duplicate plugin entries. If the duplicate is in tui.json, the fix will silently fail to resolve the issue.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/breakdown-configuration.md, line 157:
<comment>Duplicate-entry cleanup command only modifies `~/.opencode/opencode.json` even though the troubleshooting guidance directs users to check both `~/.opencode/opencode.json` and `~/.opencode/tui.json` for duplicate plugin entries. If the duplicate is in `tui.json`, the fix will silently fail to resolve the issue.</comment>
<file context>
@@ -149,13 +149,14 @@ cat ~/.opencode/opencode.json 2>/dev/null
- echo "Removed (only plugin entry)"
+# Targeted removal — removes just the magic-context entry from the plugin array,
+# never deletes the entire file even if it contains other config.
+if [ -f ~/.opencode/opencode.json ]; then
+ jq 'if (.plugin | length) == 1 then del(.plugin) else (.plugin |= map(select(. != "@cortexkit/opencode-magic-context"))) end' ~/.opencode/opencode.json > /tmp/opencode_tmp.json && mv /tmp/opencode_tmp.json ~/.opencode/opencode.json
+ echo "Removed magic-context entry from plugin array"
</file context>
There was a problem hiding this comment.
2 issues found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/breakdown-configuration.md">
<violation number="1" location="docs/breakdown-configuration.md:157">
P2: Duplicate-entry cleanup command only modifies `~/.opencode/opencode.json` even though the troubleshooting guidance directs users to check both `~/.opencode/opencode.json` and `~/.opencode/tui.json` for duplicate plugin entries. If the duplicate is in `tui.json`, the fix will silently fail to resolve the issue.</violation>
<violation number="2" location="docs/breakdown-configuration.md:159">
P1: Troubleshooting script uses a predictable /tmp file, creating symlink attack and concurrent access risks</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| # never deletes the entire file even if it contains other config. | ||
| if [ -f ~/.opencode/opencode.json ]; then | ||
| # Always filter first, then del only if nothing remains. | ||
| jq '(.plugin |= map(select(. != "@cortexkit/opencode-magic-context"))) | if (.plugin | length) == 0 then del(.plugin) else . end' \\ |
There was a problem hiding this comment.
P1: Troubleshooting script uses a predictable /tmp file, creating symlink attack and concurrent access risks
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/breakdown-configuration.md, line 159:
<comment>Troubleshooting script uses a predictable /tmp file, creating symlink attack and concurrent access risks</comment>
<file context>
@@ -149,13 +149,16 @@ cat ~/.opencode/opencode.json 2>/dev/null
+# never deletes the entire file even if it contains other config.
+if [ -f ~/.opencode/opencode.json ]; then
+ # Always filter first, then del only if nothing remains.
+jq '(.plugin |= map(select(. != "@cortexkit/opencode-magic-context"))) | if (.plugin | length) == 0 then del(.plugin) else . end' \\
+ ~/.opencode/opencode.json > /tmp/opencode_tmp.json && mv /tmp/opencode_tmp.json ~/.opencode/opencode.json
+ echo "Removed magic-context entry from plugin array"
</file context>
Breakdown and configuration reference for Magic Context plugin installation, plugin schema, backend architecture, troubleshooting, and FAQ.
Covers:
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by cubic
Adds a breakdown and configuration guide for the Magic Context plugin to simplify install, setup, and troubleshooting. Clarifies canonical install paths and makes the duplicate-entry cleanup script safe and accurate.
~/.cache/opencode/packages/@cortexkit/(no@latest) to matchopencode plugininstalls.@cortexkit/opencode-magic-context, deletes thepluginkey only if empty, fixes bash line continuation (single\), and chains the success echo with&&aftermv(removed trailing&& :) so it only prints on success.opencode plugin @cortexkit/opencode-magic-context --globaland warns against manualnpm installto non-canonical~/.cache/opencode/node_modules/.Written for commit cc54df1. Summary will update on new commits.
Greptile Summary
This PR adds
docs/breakdown-configuration.md, a new reference guide for the Magic Context plugin covering installation, plugin schema, backend architecture, troubleshooting, and FAQ. It also resolves all four issues flagged in the previous review round (wholesale file deletion,@latestverify path, jq filter-then-check logic, and unconditional echo).~/.cache/opencode/packages/), and corrects the verify snippet to list the@cortexkit/directory without an@latestsuffix.jqpipeline that filters only the@cortexkit/opencode-magic-contextentry, deletes thepluginkey only when the filtered result is empty, and chainsechowith&&so it prints only on success.config.providers()vsmodels.json, and theopencode/small-pickleconsole warning.Confidence Score: 5/5
Safe to merge — adds a documentation-only file with no runtime code changes; all previously flagged correctness issues in the bash cleanup snippet have been resolved.
The only changed file is a new markdown guide. The previous round's concerns (file clobbering, wrong @latest path, incorrect jq length condition, unconditional echo) are all addressed in this revision. The two remaining notes are minor robustness suggestions in a copy-paste troubleshooting snippet and do not affect any runtime behavior.
No files require special attention — the cleanup snippet in the Duplicate Plugin Entries section has two small hardening opportunities flagged as suggestions.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant OC as OpenCode (main) participant MC as Magic Context (child) participant SDK as config.providers() SDK participant DB as SQLite (context.db) participant ONNX as ONNX Model OC->>MC: spawn child process MC->>DB: open context.db (SQLite) MC->>MC: warm apiCache from last-known-good file MC->>SDK: config.providers() SDK-->>MC: merged models (live + compiled-in + auth caps) MC->>MC: bound result to [20k, 3M] range MC->>ONNX: load all-MiniLM-L6-v2 MC-->>OC: RPC socket ready OC->>MC: context compaction request MC->>DB: read/write compacted history MC-->>OC: resolved context window%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant OC as OpenCode (main) participant MC as Magic Context (child) participant SDK as config.providers() SDK participant DB as SQLite (context.db) participant ONNX as ONNX Model OC->>MC: spawn child process MC->>DB: open context.db (SQLite) MC->>MC: warm apiCache from last-known-good file MC->>SDK: config.providers() SDK-->>MC: merged models (live + compiled-in + auth caps) MC->>MC: bound result to [20k, 3M] range MC->>ONNX: load all-MiniLM-L6-v2 MC-->>OC: RPC socket ready OC->>MC: context compaction request MC->>DB: read/write compacted history MC-->>OC: resolved context windowReviews (6): Last reviewed commit: "Fix: proper && chain for echo (remove st..." | Re-trigger Greptile