Files
johannesandClaude Sonnet 5.5 a94632ea3d chore: delete code comments, add ratchet lint and ADRs
Classify every comment as tautology, stale, excuse or decision record.
Tautology/stale/excuse comments are deleted (excuses filed as issues
#196-#236), decisions moved to docs/adr/0001-0034.

- scripts/lint-comments.sh + .comment-baseline: per-file comment count
  may only go down; wired into tests/all.sh
- .claude/skills/delete-comment: repeatable audit workflow
- cargo fmt applied to touched crates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 13:37:32 +01:00

76 lines
6.6 KiB
Markdown

# Audit: hx-ai, hx-mcp, hx-tools comments
Counts are comment blocks (contiguous runs). Kept: 0 (no SAFETY/shebang/directive comments found).
| file | tautology | stale | excuse | decision | kept |
|---|---|---|---|---|---|
| hx-ai/src/anthropic.rs | 13 | 0 | 1 | 5 | 0 |
| hx-ai/src/auth.rs | 18 | 0 | 0 | 3 | 0 |
| hx-ai/src/claude_cli.rs | 15 | 0 | 6 | 3 | 0 |
| hx-ai/src/codex.rs | 5 | 0 | 1 | 4 | 0 |
| hx-ai/src/lib.rs | 16 | 0 | 0 | 2 | 0 |
| hx-ai/src/models.rs | 16 | 1 | 0 | 1 | 0 |
| hx-ai/src/openai_compat.rs | 12 | 0 | 1 | 4 | 0 |
| hx-mcp/src/client.rs | 8 | 0 | 1 | 0 | 0 |
| hx-mcp/src/config.rs | 12 | 0 | 0 | 0 | 0 |
| hx-mcp/src/lib.rs | 25 | 0 | 0 | 3 | 0 |
| hx-mcp/src/oauth.rs | 13 | 0 | 1 | 0 | 0 |
| hx-mcp/src/serve.rs | 5 | 0 | 0 | 0 | 0 |
| hx-mcp/src/tests.rs | 14 | 0 | 0 | 0 | 0 |
| hx-tools/src/codemode.rs | 24 | 0 | 0 | 7 | 0 |
| hx-tools/src/lib.rs | 9 | 2 | 0 | 1 | 0 |
| hx-tools/src/skill.rs | 1 | 0 | 0 | 0 | 0 |
| hx-tools/src/web.rs | 12 | 0 | 1 | 1 | 0 |
| total | 218 | 3 | 12 | 34 | 0 |
Stale: hx-ai/src/models.rs:1 (said cache a day; code is 1h), hx-tools/src/lib.rs:1 (listed only read/write/edit/bash), hx-tools/src/lib.rs:36 (duplicated doc line).
## Excuses and decisions (original line numbers)
- decision: hx-ai/src/anthropic.rs:13 - OAuth tokens are only accepted with Claude Code tool-name casing.
- decision: hx-ai/src/anthropic.rs:64 - Anthropic accepts `[a-zA-Z0-9_-]` in tool ids; Codex ids look like `call|item`.
- decision: hx-ai/src/anthropic.rs:77 - Thinking written by another provider (no signature, or a Codex reasoning item) is invalid here.
- decision: hx-ai/src/anthropic.rs:129 - Rolling breakpoints (tools+system are covered by the system one): the last message, and the
- excuse: hx-ai/src/anthropic.rs:161 - ponytail: fixed token budgets; newer models may prefer adaptive thinking, add when needed
- decision: hx-ai/src/anthropic.rs:170 - the budget counts against max_tokens, which must leave room for the reply
- decision: hx-ai/src/auth.rs:216 - Anthropic wants JSON, OpenAI wants form encoding.
- decision: hx-ai/src/auth.rs:318 - Detached std thread: tokio's stdin would block runtime shutdown until a line arrives.
- decision: hx-ai/src/auth.rs:404 - Claude uses the verifier as state (matches Claude Code); Codex uses a random state.
- decision: hx-ai/src/claude_cli.rs:3 - Anthropic bills OAuth traffic from third-party apps as "extra usage"; the official binary keeps
- excuse: hx-ai/src/claude_cli.rs:5 - stream. ponytail: one `claude` process per hx turn, continued with `--resume`; add a long-lived
- decision: hx-ai/src/claude_cli.rs:28 - hx plan mode is on: claude runs with `--permission-mode plan`, else its `ExitPlanMode` is rejected.
- excuse: hx-ai/src/claude_cli.rs:29 - ponytail: process-wide flag; make it per-provider if two claude providers ever run at once.
- excuse: hx-ai/src/claude_cli.rs:148 - `rate_limit_event` -> window. claude reports `utilization` (0..1) when known, else only a
- decision: hx-ai/src/claude_cli.rs:190 - print mode defaults to display "omitted" (empty thinking text) on new models
- excuse: hx-ai/src/claude_cli.rs:191 - ponytail: hidden flag; an older claude that rejects it needs a version probe
- excuse: hx-ai/src/claude_cli.rs:208 - ponytail: unverified against a real claude (not installed on the dev box)
- excuse: hx-ai/src/claude_cli.rs:348 - ponytail: billing/stats see the last request only; split Done if exact sums matter
- decision: hx-ai/src/codex.rs:34 - Tool-call ids are stored as `call_id|item_id` so both survive a round trip.
- decision: hx-ai/src/codex.rs:68 - encrypted reasoning item is replayed verbatim (store=false)
- decision: hx-ai/src/codex.rs:109 - Off has no Codex equivalent (see Effort::levels); send the lowest level instead
- decision: hx-ai/src/codex.rs:295 - The server hides models whose `minimal_client_version` exceeds ours, so claim a high one
- excuse: hx-ai/src/codex.rs:296 - (override: `HX_CODEX_CLIENT_VERSION`). ponytail: we only list ids; the server still gates use.
- decision: hx-ai/src/lib.rs:157 - Start level per provider: Claude thinks only when asked (token cost), Codex always reasons.
- decision: hx-ai/src/lib.rs:247 - Incremental stream events. Providers must emit `Done` last with the full assembled message.
- decision: hx-ai/src/models.rs:188 - custom endpoints are cheap to ask and their config changes by hand: never serve the cache first
- decision: hx-ai/src/openai_compat.rs:80 - tool results first: they must directly follow the assistant's tool_calls
- decision: hx-ai/src/openai_compat.rs:106 - plain string: widest server support
- excuse: hx-ai/src/openai_compat.rs:254 - ponytail: unparseable arguments are passed on as {"_invalid_arguments": raw} so the
- decision: hx-ai/src/openai_compat.rs:345 - not every server knows reasoning_effort: retry once without it
- decision: hx-ai/src/openai_compat.rs:357 - servers that close without [DONE] still get their Done
- excuse: hx-mcp/src/client.rs:3 - ponytail: hand-rolled instead of `rmcp` (~1 dep tree less); covers initialize, tools, resources, pro
- decision: hx-mcp/src/lib.rs:3 - Lazy by default: the system prompt gets a one-line-per-tool index; the model fetches a schema with
- decision: hx-mcp/src/lib.rs:24 - Servers whose full tool schemas cost at most this many tokens are registered eagerly: below this the
- decision: hx-mcp/src/lib.rs:92 - startup listing must not stall a server for the full tool-call timeout
- excuse: hx-mcp/src/oauth.rs:5 - ponytail: public clients only via DCR or a configured `clientId`; no client_credentials/device flow,
- decision: hx-tools/src/codemode.rs:2 - inside a QuickJS sandbox; only the script's output reaches the model (pi's codemode, minus
- decision: hx-tools/src/codemode.rs:204 - MCP tools first so builtins cannot push them out of the listing budget
- decision: hx-tools/src/codemode.rs:289 - The wait for a free worker counts toward the timeout.
- decision: hx-tools/src/codemode.rs:324 - QuickJS values are !Send: run the script on its own thread with a local runtime.
- decision: hx-tools/src/codemode.rs:522 - The interrupt handler only fires while JS runs; also bound time spent awaiting tools.
- decision: hx-tools/src/codemode.rs:529 - Stop as soon as the script settles: unawaited tool calls are dropped (cancelled), not waited for.
- decision: hx-tools/src/codemode.rs:619 - Store writes count only for a script that succeeded.
- decision: hx-tools/src/lib.rs:401 - own process group so timeouts kill children too
- excuse: hx-tools/src/web.rs:92 - ponytail: resolve-then-connect leaves a DNS-rebinding gap; pin the resolved IP via
- decision: hx-tools/src/web.rs:120 - GET with manual redirects (each hop checked) and a body cap.