AgentSkillsCN

context-size

估算在处理 Evoloop 故事时将发送至 AI 代理的总提示大小——若接近模型上下文限制,系统会发出警告

SKILL.md
--- frontmatter
name: context-size
description: Estimate the total prompt size that will be sent to an AI agent when processing an Evoloop story — warns if approaching model context limits
argument-hint: "<US-XXX>"
allowed-tools:
  - Read
  - Glob
  - Bash(wc *)
  - Bash(jq *)

Context Size Analyzer

Input

Story ID from $ARGUMENTS. If empty → print usage. If missing → list stories.

Calculation

Read story JSON for stage, then measure all files build_prompt() would assemble:

ComponentFileNotes
Agent promptagents/{agent}.mdbuild→builder.md, review→reviewer-test.md, deploy→deploy.md
Story JSONprd/<ID>.json
Story trackerprd/<ID>.md
Runbook.plan/runbook.md
Traceability.plan/traceability.md
Handoff notes.log/run-<run-id>/handoff-notes.mdMay not exist
Context filesFrom story's context.files arrayIf present

Size each with wc -c.

Model Limits

Model~Tokens~Bytes
Claude (Opus/Sonnet)200K~800KB
Gemini 1.5 Pro1M~4MB
Codex (GPT-5)200K~800KB

(1 token ≈ 4 bytes rough estimate)

Output

code
=== Context Size: <ID> (stage: <stage>) ===
Agent: <agent>.md

| Component | File | Bytes | KB | % |
...
| TOTAL | | | | 100% |

Model Limits: Claude X/800KB | Gemini X/4000KB | Codex X/800KB

Warn if >50% of any model limit. Missing files → "NOT FOUND", 0 bytes. >500KB → prominent warning.