You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phase: closed Last updated: 2026-09-01 by idd-close
Key Decisions
Public models are exactly gpt-4o and claude-sonnet-4-6; default order is GPT then Claude, with all-or-nothing TSV presentation.
GPT-4o uses a pinned pure-Swift BPE and SHA-256-verified bundled o200k_base; runtime network/download/cache/HOME writes are prohibited.
Every Claude request requires per-invocation --allow-network plus a non-empty ANTHROPIC_API_KEY after local preflight.
Production URLSession uses a data delegate and retains at most 65,537 package-owned response bytes; Foundation callback allocation is explicitly outside the enforceable boundary.
Public injected transport bytes/errors are independently bounded and redacted; cancellation and redirect keep typed outcomes through presentation.
Input admission uses one no-follow descriptor for fstat and capped UTF-8 read; maximum size is 1,000,000 bytes.
Scope Changes
Round 3 replaced the impossible network-buffering claim with the enforceable package-retention contract; this is a precision correction, not a privacy relaxation.
Added explicit service/CLI cancellation semantics and production redirect coverage.
Live Anthropic validation, additional models, cost prediction, stdin, streaming input, and configurable endpoints remain out of scope.
Summary
Add
macdoc convert --to tokens <file>that outputs exact token counts.Depends on #27 (CLI migration to
convert --topattern).CLI Interface
Output Format
Token Counting Methods
swift-tiktoken(offline BPE)/v1/messages/count_tokensAPIArchitecture
token-counter-swiftunderpackages/swift-tiktoken,Foundation(URLSession for Anthropic API)ANTHROPIC_API_KEYenv var for Claude countingReferences
macdoc convert --topattern (textutil-compatible) #27\n---\n\n## Current StatusPhase: closed
Last updated: 2026-09-01 by idd-close
Key Decisions
gpt-4oandclaude-sonnet-4-6; default order is GPT then Claude, with all-or-nothing TSV presentation.o200k_base; runtime network/download/cache/HOME writes are prohibited.--allow-networkplus a non-emptyANTHROPIC_API_KEYafter local preflight.fstatand capped UTF-8 read; maximum size is 1,000,000 bytes.Scope Changes
Blocking
Tasks
o200k_base; pass official reference vectors.Commits
b4d0731feat: add deterministic token counting route (feat: add token counting (OpenAI tiktoken + Claude API) #20)7ec40fffix: harden token counting boundaries (feat: add token counting (OpenAI tiktoken + Claude API) #20)f2a1fc2feat: enforce token transport boundaries (feat: add token counting (OpenAI tiktoken + Claude API) #20)b6c86e1feat: preserve token transport outcomes (feat: add token counting (OpenAI tiktoken + Claude API) #20)Pull Request