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,627 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,627 This file is loaded in full into every session.
When invoked 2,627 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.02627 $0.02627
Opus 5 $0.01314 $0.01314
Sonnet 5 $0.00525 $0.00525
Haiku 4.5 $0.00263 $0.00263

Measured 9d ago against content hash 264deb054087, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 9d 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. 9d 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 (27 stars, last pushed 23d ago), licensed MIT. It adds 2,627 tokens to every session, about $0.0131 per session on Opus 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

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens