OpenCode কনফিগ শেয়ার: লেয়ার্ড এজেন্ট, পারমিশন এবং পূর্ণ উদাহরণ

canxin দ্বারা3 মিনিট পড়তে সময়


সূচিপত্র

  1. 1. মার্জ অর্ডার ও প্রাধান্য
  2. 2. টপ-লেভেল কনফিগ ফিল্ড
  3. 3. লেয়ার্ড এজেন্ট ডিজাইন
    1. 3.1 LocalReader
    2. 3.2 LocalScribe (ডিফল্ট)
    3. 3.3 OmniReader
    4. 3.4 OmniScribe
  4. 4. Provider ও model catalog কাঠামো
    1. 4.1 সাধারণ model JSON কাঠামো
    2. 4.2 model ফিল্ড রেফারেন্স
    3. 4.3 provider অনুযায়ী variants প্যাটার্ন
    4. 4.4 provider-লেভেল option ফিল্ড
  5. 5. প্লাগিন লোডিং
    1. 5.1 opencode-planpilot (npm)
    2. 5.2 opencode-workbench (npm)
  6. 6. পূর্ণ কনফিগ উদাহরণ

1. মার্জ অর্ডার ও প্রাধান্য

প্রাধান্য (নিম্ন -> উচ্চ):

  1. Remote .well-known/opencode
  2. Global ~/.config/opencode/opencode.json
  3. OPENCODE_CONFIG
  4. Project opencode.json
  5. .opencode directories
  6. OPENCODE_CONFIG_CONTENT

প্রস্তাবনা: টেকসই ডিফল্ট global-এ রাখুন; repo-নির্দিষ্ট নিয়ম সংশ্লিষ্ট repository-তে রাখুন।

2. টপ-লেভেল কনফিগ ফিল্ড

টপ-লেভেলের প্রধান ফিল্ডগুলো:

{
  "$schema": "https://opencode.ai/config.json",
  "default_agent": "LocalScribe",
  "model": "my_oai/gpt-5.3-codex",
  "small_model": "my_oai/gpt-5.3-codex",
  "autoupdate": false,
  "compaction": {
    "auto": true,
    "prune": true
  },
  "agent": { ... },
  "plugin": [ ... ],
  "provider": { ... }
}

ফিল্ড নোট:

3. লেয়ার্ড এজেন্ট ডিজাইন

বর্তমান permission মান অনুযায়ী বাস্তব সীমানা (একটি টেবিলে):

Agentreadeditexternal_directorybashউপসংহার
LocalReaderread.* = allow (যার মধ্যে *.env)askaskaskworkspace সরাসরি পড়তে পারে; workspace-এর বাইরে অ্যাক্সেসে নিশ্চিতকরণ দরকার
LocalScriberead.* = allow (যার মধ্যে *.env)* = allow, *../* = denyallow* = allow, ঝুঁকিপূর্ণ pattern askগ্লোবাল রিড অনুমতি; সাধারণত workspace-এ writable
OmniReaderread.* = allow (যার মধ্যে *.env)askallowaskগ্লোবাল রিড; লিখতে নিশ্চিতকরণ দরকার
OmniScribe* = allow (যার মধ্যে read)* = allowallow* = allow, ঝুঁকিপূর্ণ pattern askগ্লোবাল read/write

LocalScribe-কে “সাধারণত workspace writable” বলা হয় কারণ path traversal *../* = deny দিয়ে ব্লক করা। কঠোর workspace-only write চাইলে external_directory-কে ask বা deny করুন।

নিষ্ক্রিয় built-ins:

"agent": {
  "build": { "disable": true },
  "docs": { "disable": true },
  "plan": { "disable": true }
}

3.1 LocalReader

"LocalReader": {
  "description": "Read-first agent; asks for non-read actions",
  "mode": "all",
  "permission": {
    "*": "ask",
    "bash": "ask",
    "edit": "ask",
    "glob": "allow",
    "grep": "allow",
    "list": "allow",
    "read": {
      "*": "allow",
      "*.env": "allow",
      "*.env.*": "allow"
    },
    "plan_enter": "deny",
    "plan_exit": "deny",
    "todoread": "deny",
    "todowrite": "deny"
  }
}

3.2 LocalScribe (ডিফল্ট)

"LocalScribe": {
  "description": "Reads any path; writes only inside workspace",
  "mode": "all",
  "permission": {
    "*": "allow",
    "bash": {
      "*": "allow",
      "sudo *": "ask",
      "su *": "ask",
      "rm -rf *": "ask",
      "rm -fr *": "ask",
      "mkfs* *": "ask",
      "reboot *": "ask",
      "shutdown *": "ask",
      "dd *": "ask"
    },
    "edit": {
      "*": "allow",
      "*../*": "deny"
    },
    "external_directory": "allow",
    "plan_enter": "deny",
    "plan_exit": "deny",
    "todoread": "deny",
    "todowrite": "deny"
  }
}

3.3 OmniReader

"OmniReader": {
  "description": "Read-first agent for all paths; asks for non-read actions",
  "mode": "all",
  "permission": {
    "*": "ask",
    "external_directory": "allow",
    "read": {
      "*": "allow",
      "*.env": "allow",
      "*.env.*": "allow"
    },
    "bash": "ask",
    "edit": "ask"
  }
}

3.4 OmniScribe

"OmniScribe": {
  "description": "Dangerous full access read/write anywhere",
  "mode": "all",
  "permission": {
    "*": "allow",
    "bash": {
      "*": "allow",
      "sudo *": "ask",
      "rm -rf *": "ask",
      "mkfs* *": "ask"
    },
    "external_directory": "allow",
    "plan_enter": "deny",
    "plan_exit": "deny"
  }
}

4. Provider ও model catalog কাঠামো

তিনটি provider:

Provider কাঠামো:

  1. provider metadata: name, npm
  2. provider connection options: options.baseURL, options.apiKey, options.setCacheKey (সাধারণত OpenAI-compatible provider-এ ব্যবহৃত)
  3. models map: প্রতিটি model-এর জন্য একটি object

4.1 সাধারণ model JSON কাঠামো

"provider": {
  "my_oai": {
    "name": "my_oai",
    "npm": "@ai-sdk/openai",
    "options": {
      "apiKey": "{env:OAI_API_KEY}",
      "baseURL": "https://your-gateway.example/v1",
      "setCacheKey": true
    },
    "models": {
      "gpt-5.3-codex": {
        "name": "gpt-5.3-codex",
        "attachment": true,
        "limit": {
          "context": 400000,
          "output": 128000
        },
        "modalities": {
          "input": ["text", "image", "pdf"],
          "output": ["text"]
        },
        "options": {
          "store": false,
          "include": ["reasoning.encrypted_content"]
        },
        "variants": {
          "high": { "reasoningEffort": "high", "reasoningSummary": "auto", "textVerbosity": "medium" },
          "medium": { "reasoningEffort": "medium", "reasoningSummary": "auto", "textVerbosity": "medium" },
          "low": { "reasoningEffort": "low", "reasoningSummary": "auto", "textVerbosity": "medium" },
          "xhigh": { "reasoningEffort": "xhigh", "reasoningSummary": "auto", "textVerbosity": "medium" }
        }
      }
    }
  }
}

4.2 model ফিল্ড রেফারেন্স

FieldTypeঅর্থ
namestringপ্রদর্শন নাম
attachmentbooleanattachments সক্রিয় কি না
limit.contextnumberমোট context window
limit.outputnumberসর্বোচ্চ output tokens
modalities.inputstring[]input modalities, যেমন text/image/pdf
modalities.outputstring[]output modalities, সাধারণত text
options.storebooleanrequest storage toggle (বর্তমানে OAI-family মডেলে false)
options.includestring[]অতিরিক্ত returned fields (যেমন reasoning.encrypted_content)
variantsobjectper-model reasoning profiles

4.3 provider অনুযায়ী variants প্যাটার্ন

my_claude:

"variants": {
  "off": { "thinking": { "type": "disabled" } },
  "high": { "thinking": { "type": "enabled", "budgetTokens": 16000 } },
  "max": { "thinking": { "type": "enabled", "budgetTokens": 128000 } }
}

my_gemini:

"variants": {
  "off": { "thinkingConfig": { "thinkingBudget": 0 } },
  "high": { "thinkingConfig": { "includeThoughts": true, "thinkingBudget": 16000 } },
  "max": { "thinkingConfig": { "includeThoughts": true, "thinkingBudget": 24576 } }
}

my_oai:

"variants": {
  "low": { "reasoningEffort": "low", "reasoningSummary": "auto", "textVerbosity": "medium" },
  "medium": { "reasoningEffort": "medium", "reasoningSummary": "auto", "textVerbosity": "medium" },
  "high": { "reasoningEffort": "high", "reasoningSummary": "auto", "textVerbosity": "medium" },
  "minimal": { "reasoningEffort": "minimal", "reasoningSummary": "auto", "textVerbosity": "low" }
}

4.4 provider-লেভেল option ফিল্ড

সাধারণ provider.<id>.options ফিল্ড:

FieldTypeঅর্থ
apiKeystringprovider API key
baseURLstringprovider gateway URL
setCacheKeybooleanOpenAI-compatible provider-এর cache-key আচরণ

5. প্লাগিন লোডিং

Plugin কনফিগ:

"plugin": [
  "opencode-planpilot",
  "opencode-workbench"
]

5.1 opencode-planpilot (npm)

5.2 opencode-workbench (npm)

6. পূর্ণ কনফিগ উদাহরণ

নিচে production-ধরনের একটি ব্যবহারযোগ্য পূর্ণ উদাহরণ (JSONC):

{
  "$schema": "https://opencode.ai/config.json",
  "default_agent": "LocalScribe",
  "model": "my_oai/gpt-5.3-codex",
  "small_model": "my_oai/gpt-5.3-codex",
  "autoupdate": false,
  "compaction": {
    "auto": true,
    "prune": true
  },
  "plugin": [
    "opencode-planpilot",
    "opencode-workbench"
  ],
  "provider": {
    "my_oai": {
      "name": "my_oai",
      "npm": "@ai-sdk/openai",
      "options": {
        "apiKey": "{env:OAI_API_KEY}",
        "baseURL": "https://your-gateway.example/v1",
        "setCacheKey": true
      },
      "models": {
        "gpt-5.3-codex": {
          "name": "gpt-5.3-codex",
          "attachment": true,
          "limit": {
            "context": 400000,
            "output": 128000
          },
          "modalities": {
            "input": ["text", "image", "pdf"],
            "output": ["text"]
          },
          "options": {
            "store": false,
            "include": ["reasoning.encrypted_content"]
          },
          "variants": {
            "low": { "reasoningEffort": "low", "reasoningSummary": "auto", "textVerbosity": "medium" },
            "medium": { "reasoningEffort": "medium", "reasoningSummary": "auto", "textVerbosity": "medium" },
            "high": { "reasoningEffort": "high", "reasoningSummary": "auto", "textVerbosity": "medium" }
          }
        }
      }
    }
  }
}

এই সেটআপ ব্যক্তি ও টিম—দুই ক্ষেত্রেই ভালো কাজ করে: read/write সীমা স্পষ্ট থাকে, model আচরণ স্থির থাকে, এবং plugin-ভিত্তিক workflow সহজে সম্প্রসারণযোগ্য হয়।

মন্তব্য