bob-plugin-ollama-translator: Instructions file for Codex

AGENTS.md

bob-plugin-ollama-translator AGENTS.md is an instructions file for Codex, OpenCode from CaicoLeung/bob-plugin-ollama-translator. It costs 2,659 tokens per session, scanned A, original, MIT.

Repository guidance for a Bob macOS translation-app plugin that translates text and explains terms through AI services compatible with the OpenAI chat-completions format. It describes the plugin’s supported providers and code structure.

In plain words
What is it for?
Use it when adding or updating translation providers, changing streaming responses, working with Bob’s injected HTTP and option APIs, or preparing a plugin release.
Why use it?
It gives contributors the project rules and data flow needed to change the plugin safely. It also highlights Bob’s runtime limitations and the files that control providers and releases.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions CLAUDE.md.

This is CaicoLeung/bob-plugin-ollama-translator's own configuration. It tells Codex and OpenCode how to work on bob-plugin-ollama-translator itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything bob-plugin-ollama-translator configures →

Reuse

Borrowing it

Nothing to install: this file belongs to CaicoLeung/bob-plugin-ollama-translator. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/CaicoLeung/bob-plugin-ollama-translator/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/CaicoLeung/bob-plugin-ollama-translator

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bob-plugin-ollama-translator AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/caicoleung/bob-plugin-ollama-translator/agents-md/github.svg)](https://agentmods.dev/instructions/caicoleung/bob-plugin-ollama-translator/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/caicoleung/bob-plugin-ollama-translator/agents-md"><img src="https://agentmods.dev/badge/instructions/caicoleung/bob-plugin-ollama-translator/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bob-plugin-ollama-translator AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/caicoleung/bob-plugin-ollama-translator/agents-md"><img src="https://agentmods.dev/badge/instructions/caicoleung/bob-plugin-ollama-translator/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,659 This file is loaded in full into every session.
When invoked 2,659 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02659 $0.02659
Opus 5.5 $0.01064 $0.01064
Sonnet 5.5 $0.00532 $0.00532
Haiku 4.5 $0.00266 $0.00266

Measured 19d ago against content hash 6487496e1d38, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

bob-plugin-ollama-translator AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 19d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 115 lines

How it starts

The opening of the file, as written. The whole thing — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Repository Guidelines

Bob (macOS translation app) plugin exposing AI translation/interpretation over any OpenAI-compatible chat-completions endpoint. CLAUDE.md documents build commands and the provider-addition checklist — this file complements it; follow both.

Project Overview

  • Single-purpose Bob plugin (identifier bob-plugin-ollama-translator): word/text translation (translate pattern) and encyclopedia-style explanation (interpret pattern), streamed via SSE.
  • Supports 8 providers — ollama, deepseek, openai, grok, claude, gemini, zhipu, other — all through the OpenAI chat-completions shape (Claude included, via api.anthropic.com/v1/...).
  • Plugin version lives in public/info.json (manifest, currently ahead of package.json — release only bumps info.json).

Architecture & Data Flow

Runtime is Bob's injected JavaScriptCore globals — no Node APIs, no fetch. Two ambient globals: $option (declared locally in src/types.d.ts, ~25 keys) and $http (from @bob-translate/types).

Bob → src/main.ts (exports translate + supportLanguages)
    → src/translate.ts (orchestrator)
        ├─ src/service.ts    resolve provider/url/apikey/model from $option
        ├─ src/precheck.ts   ALL config validation (base URL/model/language) — before the cache
        ├─ src/cache.ts      in-memory Map, FIFO-evict at 100
        ├─ src/params.ts     build chat-completions body (stream:true)
        │    ├─ src/prompt.ts  system/user prompts, {var} templates
        │    └─ src/wordlookup.ts  word-lookup decision (predicate + qwen-mt exemption), detail tiers, dict prompts
        ├─ src/result.ts     frame streams/completions (finish suffixes, <think> handling)
        ├─ $http.streamRequest (Bob's HTTP, Bearer auth, SSE)
        └─ src/parser.ts     eventsource-parser → OpenAI chunks
             → query.onStream() per chunk → query.onCompletion() at finish

Key patterns an assistant must preserve:

  • Never throw across the Bob boundary. Every failure routes through handleGeneralError(query, error) (src/util.ts) → query.onCompletion({error}). ServiceError types: param, api, secretKey, unsupportedLanguage.
  • Callback-based, not await-based. translate() is async but awaits nothing; completion is fire-once via a completed flag guard.
  • Streaming only. $http.streamRequest + stream: true; no non-streaming path. finish_reason of stop or a known suffix completes; anything else keeps streaming. Invalid API keys are detected by regex on stream text (/Invalid token/i).
  • Results always carry thinkInfo: {content: "", splitThinkTag: true} so Bob strips <think> reasoning blocks. Word lookup (ADR-003) is the deliberate exception: thinkInfo appears only when the model produced reasoning, with splitThinkTag: false (tags already stripped in dict.ts). Delta-style reasoning (reasoning_content/reasoning on the chunk delta — DeepSeek R1, QwQ) is captured in translate.ts, streamed live via onStream frames on both paths, and re-wrapped as a <think> block at completion, so both render paths and the cache see one format. Capture is unconditional — the thinking menu is display-side (rendering hides reasoning when off), so cached entries replay thinking after re-enabling.
  • Provider registry is closed. Provider union + PROVIDERS + the keyed-literal tables (SERVICE_BASE_URLS, API_KEY_OPTIONS, MODEL_OPTIONS) in src/service.ts are the single source of truth; adding a provider means touching those plus public/info.json options and src/types.d.ts — follow the 5-step checklist in CLAUDE.md. ollama (keyless) and other (user URL) are intentionally asymmetric (Partial<Record<...>>).
  • Word lookup is decided once. src/wordlookup.ts owns the predicate (translate pattern + single English token), the qwen-mt exemption, the wordDetail tiers and the JSON dict prompts; params.ts calls lookupEnabled(query, model) once and passes the boolean down as a fact. Prompts, framing and the cache never re-derive it.
  • Qwen MT special case: model name matching /qwen-mt/ bypasses prompt.ts entirely — single user message + translation_options instead of prompts. Don't "fix" prompts assuming they always apply.
  • Config validation has one seam: preCheck(query, service) (src/precheck.ts) owns every config check and runs before the cache lookup — the cache never masks a broken config, and translate.ts keeps no guards of its own. Error precedence: base URL → custom model → target language.
  • Cache key uses query.from/query.to while the rest of the code uses detectFrom/detectTo — different fields, don't unify casually.
  • langMap (bob→api codes) is used only for validation in precheck.ts; outgoing prompts/target_lang get raw Bob codes.

Read the full file on GitHub · 115 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 19d ago Changed · +32 tokens per session 6487496e1d38
  2. 2mo ago First seen · 115 lines · 2,627 tokens per session scan A 264deb054087

Subscribe to this mod's changes

bob-plugin-ollama-translator AGENTS.md is an instructions file published in the GitHub repository CaicoLeung/bob-plugin-ollama-translator (28 stars, last pushed 19d ago), licensed MIT. It adds 2,659 tokens to every session, about $0.0106 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

bob-plugin-ollama-translator AGENTS.md compared with instructions from other repositories

bob-plugin-ollama-translator AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
bob-plugin-ollama-translator AGENTS.mdCaicoLeung/bob-plugin-ollama-translatorInstructions file2819d agoMITA2,659Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode