kiro2api: Instructions file for Claude Code

CLAUDE.md

kiro2api CLAUDE.md is an instructions file for Claude Code from caidaoli/kiro2api. It costs 1,249 tokens per session, scanned A, original, MIT.

Repository instructions for working on kiro2api, an AI API proxy server that connects Anthropic and OpenAI APIs with AWS CodeWhisperer. They cover the project, code exploration, editing rules, build commands, tests, and tools.

In plain words
What is it for?
Use them when building, testing, formatting, checking, or running the kiro2api Go project.
Why use it?
They give an agent the project's expected workflow and commands, including how to explore and edit the Go code safely.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is caidaoli/kiro2api's own configuration. It tells Claude Code how to work on kiro2api 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 kiro2api configures →

Reuse

Borrowing it

Nothing to install: this file belongs to caidaoli/kiro2api. 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/caidaoli/kiro2api/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/caidaoli/kiro2api

Made for: Claude Code.

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 kiro2api CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/caidaoli/kiro2api/claude-md/github.svg)](https://agentmods.dev/instructions/caidaoli/kiro2api/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/caidaoli/kiro2api/claude-md"><img src="https://agentmods.dev/badge/instructions/caidaoli/kiro2api/claude-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 kiro2api CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/caidaoli/kiro2api/claude-md"><img src="https://agentmods.dev/badge/instructions/caidaoli/kiro2api/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,249 This file is loaded in full into every session.
When invoked 1,249 The same file — it is already loaded in full.
Security scan A 1 finding. 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.01249 $0.01249
Opus 5.5 $0.00500 $0.00500
Sonnet 5.5 $0.00250 $0.00250
Haiku 4.5 $0.00125 $0.00125

Measured 2mo ago against content hash de47660854a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

kiro2api CLAUDE.md scanned grade A with 1 finding 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 2mo 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -X POST http://localhost:8080/v1/messages \
CLAUDE.md · 120 lines

How it starts

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

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

项目概述

高性能 AI API 代理服务器,桥接 Anthropic/OpenAI API 与 AWS CodeWhisperer。支持流式响应、工具调用、多账号池管理。

代码探索规范

⚠️ 强制要求:优先使用 Serena MCP 工具进行代码探索和编辑

  • 代码探索: 使用 mcp__serena__get_symbols_overview 获取文件概览,然后使用 mcp__serena__find_symbol 精确读取符号
  • 代码搜索: 使用 mcp__serena__search_for_pattern 进行模式搜索
  • 代码编辑: 使用 mcp__serena__replace_symbol_body、insert_after_symbol、insert_before_symbol 进行符号级编辑
  • 依赖分析: 使用 mcp__serena__find_referencing_symbols 查找引用关系

禁止: 直接使用 Read 工具读取整个 Go 源代码文件,除非是配置文件(.json、.yaml、.env)或文档文件(.md)。

开发命令

# 编译和运行
go build -o kiro2api main.go
./kiro2api

# 测试
go test ./...                          # 运行所有测试
go test ./parser -v                    # 单包测试(详细输出)
go test ./... -bench=. -benchmem       # 基准测试

# 代码质量
go vet ./...                           # 静态检查
go fmt ./...                           # 格式化
golangci-lint run                      # Linter

# 运行模式
GIN_MODE=debug LOG_LEVEL=debug ./kiro2api  # 开发模式
GIN_MODE=release ./kiro2api                # 生产模式

# 生产构建
go build -ldflags="-s -w" -o kiro2api main.go

技术栈

  • Go: 1.24.0
  • Web: gin-gonic/gin v1.11.0
  • JSON: bytedance/sonic v1.14.1

核心架构

请求流程:认证 → 请求分析 → 格式转换 → 流处理 → 响应转换

包职责:

  • server/ - HTTP 服务器、路由、处理器、中间件
  • converter/ - API 格式转换(Anthropic ↔ OpenAI ↔ CodeWhisperer)
  • parser/ - EventStream 解析、工具调用处理、会话管理
  • auth/ - Token 管理(顺序选择策略、并发控制、使用限制监控)
  • utils/ - 请求分析、Token 估算、HTTP 工具
  • types/ - 数据结构定义
  • logger/ - 结构化日志
  • config/ - 配置常量和模型映射

关键实现:

  • Token 管理:顺序选择策略,支持 Social/IdC 双认证
  • 流式优化:零延迟传输,直接内存分配(已移除对象池)
  • 智能超时:根据 MaxTokens、内容长度、工具使用动态调整
  • EventStream 解析:CompliantEventStreamParser(BigEndian 格式)

开发原则

内存管理:

  • 已移除 sync.Pool 对象池(KISS + YAGNI)
  • 直接使用 bytes.NewBuffer(nil)、strings.Builder、make([]byte, size)
  • 信任 Go 1.24 GC 和逃逸分析
  • 仅在 QPS > 1000 且对象 > 10KB 时考虑对象池

代码质量:

  • 遵循 KISS、YAGNI、DRY、SOLID 原则
  • 避免过度抽象和预先优化
  • 定期清理死代码和未使用功能
  • 所有包测试通过率 100%

Read the full file on GitHub · 120 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. 2mo ago First seen · 120 lines · 1,249 tokens per session scan A de47660854a7

Subscribe to this mod's changes

kiro2api CLAUDE.md is an instructions file published in the GitHub repository caidaoli/kiro2api (642 stars, last pushed 4mo ago), licensed MIT. It adds 1,249 tokens to every session, about $0.0050 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

kiro2api CLAUDE.md compared with instructions from other repositories

kiro2api CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
kiro2api CLAUDE.mdcaidaoli/kiro2apiInstructions file6424mo agoMITA1,249Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,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