Skip to content

refactor: apply conventions across prompt assembly and the model catalogue - #247

Merged
hakula139 merged 3 commits into
mainfrom
refactor/prompt-model-conventions
Oct 16, 2026
Merged

hakula139 merged 3 commits into
mainfrom
refactor/prompt-model-conventions

Conversation

@hakula139

@hakula139 hakula139 commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Prompt assembly repeats section formatting and relies on a trailing blank line in the optional instruction section. Give each section one renderer and join sections explicitly, preserving the bytes sent to the model.

  • Prompt assembly: share instruction, date, and model renderers between initial context and reminders. Pin complete output with exact assertions, consolidate redundant tests, and check that loaded project rules stay out of the system prompt.
  • Instruction files: rename the internal file type to InstructionFile, compare the complete ordered document, and clarify discovery test names.
  • Environment: use the shared date-format convention, simplify the shell path lookup, and check the detected OS name and release exactly.
  • Model and CLI tests: consolidate internal imports, remove the model-id getter test, share the binary command fixture, and require the storage error to identify the failing path.

Not applied

  • Instruction-file blocks already use formatdoc! and join with the header using "\n\n".
  • Keep the pricing signature unchanged because TokenUsage belongs to the higher agent layer.

Left for a follow-up

  • Internal import grouping in client/anthropic.rs and client/anthropic/betas.rs is outside this change.

Test plan

  • The four exact initial-context and reminder assertions passed before extracting the renderers.
  • cargo fmt --all --check, cargo build, and cargo clippy --all-targets -- -D warnings.
  • cargo test: 2,649 unit tests and 4 CLI tests passed with no snapshot changes.
  • cargo llvm-cov --show-missing-lines: 99.11% line coverage overall, with no uncovered changed lines.
  • pnpm format, pnpm lint, and pnpm spellcheck.
  • Pre-commit hooks on each commit.
  • Codecov confirms all modified and coverable lines are covered by tests.
  • All CI checks passed, including Windows and both Nix package builds.

@hakula139 hakula139 added this to the v0.1.0 milestone Oct 16, 2026
@hakula139 hakula139 added refactor Restructured code that preserves behavior (refactor) area: agent Touches the agent turn loop, compaction, or agent events labels Oct 16, 2026
@hakula139 hakula139 self-assigned this Oct 16, 2026
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hakula139
hakula139 force-pushed the refactor/prompt-model-conventions branch from b83634c to 84b58f5 Compare October 16, 2026 07:24
@hakula139
hakula139 merged commit c23c6ae into main Oct 16, 2026
11 checks passed
@hakula139
hakula139 deleted the refactor/prompt-model-conventions branch October 16, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agent Touches the agent turn loop, compaction, or agent events refactor Restructured code that preserves behavior (refactor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant