Kocoro AGENTS.md

Kocoro AGENTS.md is an instructions file for Codex, OpenCode from Kocoro-lab/Kocoro. It costs 6,007 tokens per session, scanned A, original, MIT.

A project instruction file for Kocoro, a Go command-line program and runtime that runs Shannon AI agents locally and connects them to cloud services.

In plain words
What is it for?
It guides work on the Go command-line tool, its background service, desktop connection, terminal interface, integrations, schedules, and tool servers.
Why use it?
It collects the project’s working rules, file layout, testing expectations, and documentation requirements in one place. This helps agents make changes that fit the existing code and avoid unsafe behavior changes.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/kocoro-lab/kocoro/agents-md
Clone the repo
git clone --depth 1 https://github.com/Kocoro-lab/Kocoro

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 Kocoro AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/kocoro-lab/kocoro/agents-md.svg)](https://agentmods.dev/instructions/kocoro-lab/kocoro/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/kocoro-lab/kocoro/agents-md"><img src="https://agentmods.dev/badge/instructions/kocoro-lab/kocoro/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 6,007 This file is loaded in full into every session.
When invoked 6,007 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.06007 $0.06007
Opus 5 $0.03003 $0.03003
Sonnet 5 $0.01201 $0.01201
Haiku 4.5 $0.00601 $0.00601

Measured yesterday against content hash 1a734767dbc0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Kocoro 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 yesterday.

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 · 412 lines

How it starts

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

Kocoro Project Guide (AGENTS.md)

Condensed mirror of CLAUDE.md — rules + greppable symbols. If they disagree, CLAUDE.md and the code win.

Keep this file under 24 KB (CI asserts) — cut prose, not rules. Within 1 KB of the ceiling, adding bytes requires cutting at least as many from this file (CI asserts).

Kocoro is the Go CLI/runtime (shan) for Shannon agents. Production: daemon + Desktop + Cloud. Also TUI, one-shot CLI, MCP, schedules.

Layout: cmd/ (Cobra) + internal/<pkg>/; daemon/ drives agent/.

Working Rules

  • go.mod is the source of truth for the Go version.
  • Prefer existing repo patterns over new abstractions; keep changes tied to the task.
  • Verify API response bodies, not just status codes.
  • No parallel _enhanced variants — update existing code in place.
  • Risky behavior changes keep operator-visible flags, rollback paths, focused tests.
  • Test locally before pushing dependency or generated-code changes.
  • New const max[A-Z]\w+ = <small_int>: the comment MUST name (1) the workload, (2) the symptom when it binds, (3) the override path. Prefer viper.SetDefault(...) for liftable caps. Re-check small-int caps on model-family upgrades — 200K-era defaults bind silently at 1M.

Doc Co-Maintenance

Feature changes update README.md, CLAUDE.md, and this file.

The bundled kocoro skill is the AI-facing source of truth for the daemon HTTP API. Every mux.HandleFunc(...) in daemon/server.go the agent calls needs a matching skills/bundled/skills/kocoro/references/*.md entry in the SAME PR. Desktop-only transport endpoints stay out; their contract lives in docs/desktop-wire-fixtures/.

Tools

  • Required fields: every Run() MUST check each ToolInfo.Required field is non-zero right after json.Unmarshal and return agent.ValidationError(...), NOT a bare ToolResult{IsError: true} (Go can't tell missing from zero). The [validation error] prefix is load-bearing: LoopDetector.isValidationErrorSig force-stops on 3 consecutive.
  • Priority: local > MCP > gateway, deduped by name. MCP-vs-MCP collisions resolve to the alphabetically-first server (RebuildRegistryForHealth); the shadowed tool is logged, never registered.
  • Exposure (agent/exposure.go EffectiveToolExposure): explicit ToolExposure first, then source default — local Direct; MCP/gateway/ integration Deferred. ask_user_question is explicitly Direct. web_search / web_fetch / x_search are Direct only when ToolSource()==SourceGateway (tools/exposure.go ServerTool.ToolExposure); a same-named MCP or integration tool keeps its Deferred default so a third-party catalog cannot widen the base schema surface. GUI/process automation and calendar/schedule mutations are Deferred; calendar/schedule reads stay Direct.
  • tool_search uses deterministic BM25 (agent/toolsearch_index.go, toolSearchDefaultLimit 8) with exact select: lookup. The 16K Direct-schema budget is a regression diagnostic and MUST NEVER reclassify tools at runtime.
  • Skill allowed-tools is execution-time denial, NOT schema filtering — the tools array stays byte-stable for the prompt cache. agent.SkillExempt (think, tool_search, use_skill) is for pure infrastructure only; do NOT exempt side-effecting tools.
  • Concurrency: the dispatcher batches by IsConcurrencySafeCall, not IsReadOnlyCall; tools without a ConcurrencySafeChecker fall back to their IsReadOnlyCall value. BashTool implements it in tools/bash_concurrency.go, gated by agent.bash_concurrency_enabled (default true): only a strict read-only leading token AND no shell metacharacters (incl. \n / \r) is eligible; everything else stays in a size-1 serial batch.
  • tool_status running/completed carry tool_use_id (capability tool_use_id_events).
  • set_work_plan (daemon/work_plan.go): full-snapshot 2–8-step checklist, daemon non-ephemeral runs only. Runtime owns plan_id/revision/lifecycle/close_reason; closure comes from LastRunStatus, never a model claim, and bumps the revision. work_plan.updated fires only after the covering save. Not dup-exempt; SkillExempt; never journaled. Capability work_plan_v1.
  • Every RequiresApproval()==true tool needs a description (5-15 words, model-written). The daemon does NOT block on a missing one; UI clients MUST use description?.trim() || fallback, NOT nullish coalescing.
  • Integration requires_approval=true → normal approval flow (daemon.auto_approve bypasses); Always Allow persistence refused — DisallowsAlwaysAllowPersistence gates flag/broker/persist/runtime; stale always_allow_tools entries ignored. Config writes (incl. agent-sync pull) drop denied entries (dropRegistryDeniedAlwaysAllow, registry miss keeps); RefreshIntegrationTools + resetIntegrationToolsForPrincipal prune after rebuild (pruneDeniedAlwaysAllowGrants). Drop skips the LWW stamp; both prunes push on write. Absent=false; Cloud gates marked schemas on integration_requires_approval.
  • Trusted material_side_effect=false permits observational batching without the journal; absent is fail-closed. Stable request_id; material calls add Idempotency-Key. Only provider_unavailable/provider_rejected are known-no-effect. Preserve provider/model/unit/cost via ToolResult/EmitUsage. Exhausted call_in_progressoutcome_unknown: never resend under a new ID.
  • Outcome-unknown material results narrate as ordinary tool errors; the same-turn latch (agent/unknown_outcome_gate.go) blocks byte-identical tool+args repeats until the next user message.
  • SourceIntegration is identity-scoped. Key mutation invalidates generations before source clear, without the dispatch writer. Failed new-identity listing leaves it empty; same-identity refresh failure keeps it. ServerTool binds list credential/principal generation; stale clones fail pre-dispatch, caches can't revive them. Auth/integration/MCP-health/reload swaps share one lock. Auth rebuilds both overlays: credential-bound cloud/publish/image drop, calendar/non-auth tools survive. cloud_delegate, publish/list/retract, and generate/edit lease generation through all Run retries. Serialize auth across accounts/keys.
  • X publishing only via Cloud X tools (x_prepare_post removed). browser/computer_use/builtin Playwright block X composer/publish controls; Playwright omits browser_run_code/browser_evaluate; CDP: any X target blocks mutation; non-CDP: no claim; shell/custom MCP unguarded.

Read the full file on GitHub · 412 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. yesterday Changed · +1 lines · -12 tokens per session 1a734767dbc0
  2. 5d ago First seen · 411 lines · 6,019 tokens per session scan A 88b7ed3e068c

Subscribe to this mod's changes

Kocoro AGENTS.md is an instructions file published in the GitHub repository Kocoro-lab/Kocoro (406 stars, last pushed 2d ago), licensed MIT. It adds 6,007 tokens to every session, about $0.0300 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

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

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

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,182 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

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,733 tokens