بنقرة واحدة
بنقرة واحدة
Validate Rust work after substantial Rust code changes by running `just check`, `just clippy`, then `just format`. Use before the final response after a significant Rust implementation or cleanup task; batch edits first instead of running after every small change.
Inspect Rust changes for SQLx queries. Use after modifying Rust code that adds or changes SQLx queries to ensure compile-time SQLx macros are used, run `just prepare_db` for offline query cache, and review queries for performance and security issues.
Upgrade an AI chat model (fast or good) across backend and frontend.
Create SQLx migration files with `sqlx migrate add <name>`. Use when asked to add, create, or generate a sqlx/sqlx-cli database migration.
Build a new AI tool end-to-end — Rust implementation, toolset wiring, infra, schema generation, and frontend UI.
Find all open Dependabot alerts for this repo and create a plan to resolve them using the appropriate package manager overrides (pnpm, bun, npm, cargo).
| name | upgrade-model |
| description | Upgrade an AI chat model (fast or good) across backend and frontend. |
| allowed-tools | Bash, Read, Write, Edit, Grep, Glob |
Upgrades the AI model used in the chat app. There are two model slots:
CHAT_MODELS)CHAT_MODELS)The user must specify which slot to upgrade and the new model name (e.g. claude-opus-4-6).
Ask the user (if not already provided):
fast or good?claude-opus-4-6)Derive from the model name:
SERDE_NAME: the kebab-case model ID sent over the wire (e.g. claude-opus-4-6)ENUM_VARIANT: PascalCase variant name (e.g. Claude46Opus)CONST_NAME: SCREAMING_SNAKE constant name (e.g. CLAUDE_46_OPUS)CONST_VALUE: display string used by the frontend/provider (e.g. claude-4.6-opus)PRETTY_NAME: human-readable name (e.g. Claude Opus 4.6)File: rust/cloud-storage/ai/src/types/model/mod.rs
Check if the enum variant already exists. If not, add all of the following:
Enum variant in pub enum Model (under the Anthropic section):
#[serde(rename = "{SERDE_NAME}")]
#[strum(serialize = "{SERDE_NAME}")]
{ENUM_VARIANT},
String constant in pub mod constants::models:
pub const {CONST_NAME}: &str = "{CONST_VALUE}";
Match arm in to_provider_model_string():
Model::{ENUM_VARIANT} => (ANTHROPIC, {CONST_NAME}),
Match arm in from_model_str():
{CONST_NAME} => Model::{ENUM_VARIANT},
File: rust/cloud-storage/ai/src/types/model/metadata.rs
Metadata in fn metadata():
Model::{ENUM_VARIANT} => ModelMetadata {
context_window: 200_000,
},
Use the correct context window for the model. Anthropic models are typically 200,000.
Provider in fn provider():
Model::{ENUM_VARIANT} => Provider::Anthropic,
File: rust/cloud-storage/document_cognition_service/src/core/model.rs
CHAT_MODELS and update FALLBACK_MODEL.CHAT_MODELS.File: rust/cloud-storage/document_cognition_service/src/api/ws/chat_message/mod.rs
Search for the old model variant being used in the model selection logic (e.g. Model::Claude45Opus). Update it to the new variant.
cd rust/cloud-storage && cargo check -p ai -p document_cognition_service
Fix any compilation errors before proceeding.
Run from js/app/:
cd js/app && bun install && bun run gen-api
This builds all Rust OpenAPI and models binaries from local code, generates openapi.json, runs orval for TypeScript types, and generates model.ts from the local models binary. All generated files will reflect your local Rust changes.
bun check to find frontend usagescd js/app && bun check
This will report TypeScript errors everywhere the old model string is used. Fix each one. Common locations:
packages/core/component/AI/constant/model.ts — MODEL_PRETTYNAME, MODEL_PROVIDER_ICON, SMART_MODE_MODEL / DEFAULT_MODELpackages/core/component/AI/component/input/useChatInput.tsx — hardcoded model referencespackages/core/component/AI/signal/pendingSend.test.ts — test dataReplace old model strings and update display names.
cd js/app && bun format && bun check
The only errors remaining should be pre-existing ones unrelated to models (e.g. three, @aws-crypto/sha256-js type issues). All model-related errors must be resolved.
Finally, run the CI check:
cd js/app && bun run gen-api -- --check
This must pass.
ExhaustiveMap type in constant/model.ts requires an entry for every model in the Model type, so missing entries will cause type errors.SMART_MODE_MODEL constant is the "good" model, DEFAULT_MODEL is the "fast" model.