Skip to content

Commit 97d7726

Browse files
authored
Merge pull request #1281 from mnfst/chore/update-claude-md
chore: update CLAUDE.md to match current codebase
2 parents 000e4f3 + d8b6309 commit 97d7726

File tree

2 files changed

+17
-30
lines changed

2 files changed

+17
-30
lines changed

.changeset/common-roses-dream.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

CLAUDE.md

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Manifest Development Guidelines
22

3-
Last updated: 2026-03-15
3+
Last updated: 2026-03-26
44

55
## IMPORTANT: Local Mode First
66

@@ -75,13 +75,14 @@ packages/
7575
│ │ │ └── current-user.decorator.ts # @CurrentUser() param decorator
7676
│ │ ├── database/
7777
│ │ │ ├── database.module.ts # TypeORM PostgreSQL config
78-
│ │ │ ├── database-seeder.service.ts # Seeds model_pricing + demo data
78+
│ │ │ ├── database-seeder.service.ts # Seeds demo data (users, agents, security events)
7979
│ │ │ ├── local-bootstrap.service.ts # Seeds local mode (SQLite)
8080
│ │ │ ├── datasource.ts # CLI DataSource for migration commands
81-
│ │ │ ├── pricing-sync.service.ts # External pricing data sync
81+
│ │ │ ├── pricing-sync.service.ts # OpenRouter pricing data sync
8282
│ │ │ ├── ollama-sync.service.ts # Ollama model sync
83-
│ │ │ └── seed-models.ts # Model pricing seed data
84-
│ │ ├── entities/ # TypeORM entities (20 files)
83+
│ │ │ ├── quality-score.util.ts # Model quality scoring
84+
│ │ │ └── seed-messages.ts # Demo agent message seed data
85+
│ │ ├── entities/ # TypeORM entities (17 files)
8586
│ │ │ ├── tenant.entity.ts # Multi-tenant root
8687
│ │ │ ├── agent.entity.ts # Agent (belongs to tenant)
8788
│ │ │ ├── agent-api-key.entity.ts # OTLP ingest keys (mnfst_*)
@@ -202,7 +203,7 @@ Set `SEED_DATA=true` in `packages/backend/.env` to seed on startup (dev/test onl
202203
- **Agent**: `demo-agent` with OTLP key `dev-otlp-key-001`
203204
- **API key**: `dev-api-key-manifest-001`
204205
- **Security events**: 12 sample events for the security dashboard
205-
- **Model pricing**: 48 models seeded (Anthropic, OpenAI, Google, Meta, Mistral, DeepSeek, xAI, Alibaba/Qwen, etc.)
206+
- **Agent messages**: Sample telemetry messages for the demo agent
206207

207208
Seeding is idempotent — it checks for existing records before inserting.
208209

@@ -426,22 +427,7 @@ The registry exports derived maps used throughout the codebase:
426427
- `OPENROUTER_PREFIX_TO_PROVIDER` — OpenRouter vendor prefix → display name (e.g. `openai``OpenAI`)
427428
- `expandProviderNames()` — expands a set of names to include aliases
428429

429-
**Supported providers (12):**
430-
431-
| ID | Display Name | Aliases | OpenRouter Prefixes | Notes |
432-
|----|-------------|---------|-------------------|-------|
433-
| `anthropic` | Anthropic || `anthropic` | Supports subscription auth |
434-
| `openai` | OpenAI || `openai` | |
435-
| `gemini` | Google | `google` | `google` | Key-in-URL auth for model list |
436-
| `deepseek` | DeepSeek || `deepseek` | |
437-
| `mistral` | Mistral || `mistralai` | |
438-
| `moonshot` | Moonshot | `kimi` | `moonshotai` | |
439-
| `xai` | xAI || `xai`, `x-ai` | |
440-
| `minimax` | MiniMax || `minimax` | |
441-
| `qwen` | Alibaba | `alibaba` | `qwen`, `alibaba` | |
442-
| `zai` | Z.ai | `z.ai` | `z-ai`, `zhipuai` | |
443-
| `openrouter` | OpenRouter || `openrouter` | Public API, no key needed for model list |
444-
| `ollama` | Ollama ||| Local only, no key needed |
430+
**Do NOT duplicate the provider list here.** Read `PROVIDER_REGISTRY` in `common/constants/providers.ts` for the current list of supported providers, their IDs, aliases, and OpenRouter prefix mappings.
445431

446432
### Adding a New Provider
447433

@@ -452,42 +438,41 @@ The registry exports derived maps used throughout the codebase:
452438

453439
### Model Discovery
454440

455-
Each provider's model list is fetched from **that provider's own API first**. If the native API fails or returns no models (some providers like MiniMax don't have a `/models` endpoint), the system falls back to building a model list from the OpenRouter pricing cache + OpenRouter pricing cache for that provider.
441+
Each provider's model list is fetched from **that provider's own API first**. If the native API fails or returns no models (some providers like MiniMax don't have a `/models` endpoint), the system falls back to building a model list from the OpenRouter pricing cache for that provider.
456442

457443
```
458444
User connects provider (POST /routing/:agent/providers)
459445
→ ProviderModelFetcherService.fetch(providerId, apiKey)
460446
→ calls provider's /models endpoint (e.g. api.anthropic.com/v1/models)
461-
→ if 0 models returned: buildFallbackModels() from OpenRouter cache + manual pricing
447+
→ if 0 models returned: buildFallbackModels() from OpenRouter cache
462448
→ ModelDiscoveryService.enrichModel()
463449
→ looks up pricing from OpenRouter cache (PricingSyncService)
464-
→ falls back to OpenRouter pricing cache for niche providers
465450
→ computes quality score
466451
→ saves to user_providers.cached_models (JSONB column)
467452
→ recalculates tier assignments
468453
```
469454

470455
- `ProviderModelFetcherService` — config-driven fetcher with parsers for each provider API format (OpenAI-compatible, Anthropic, Gemini, OpenRouter, Ollama)
471-
- `ModelDiscoveryService` — orchestrator that decrypts keys, fetches, enriches with pricing, caches results. Falls back to OpenRouter + manual pricing when native API is unavailable.
456+
- `ModelDiscoveryService` — orchestrator that decrypts keys, fetches, enriches with pricing, caches results. Falls back to OpenRouter cache when native API is unavailable.
472457
- `cached_models` — per-provider, per-agent JSONB column on `user_providers` table
473458
- Discovery runs synchronously on provider connect (user sees models immediately)
474459
- "Refresh models" button triggers `POST /routing/:agent/refresh-models`
475460

476461
### Model Pricing
477462

478-
The `model_pricing` database table has been **dropped**. All pricing comes from a single source:
463+
All pricing comes from a single source:
479464

480465
- **OpenRouter API** (public, no key needed, fetched daily via cron + on startup) — provides pricing for all providers. Stored in-memory by `PricingSyncService`. No hardcoded pricing data anywhere.
481466

482-
`ModelPricingCacheService` merges both sources and attributes models to their real provider using OpenRouter vendor prefixes (via `OPENROUTER_PREFIX_TO_PROVIDER`). Unsupported community vendors stay under "OpenRouter".
467+
`ModelPricingCacheService` reads from the OpenRouter cache and attributes models to their real provider using OpenRouter vendor prefixes (via `OPENROUTER_PREFIX_TO_PROVIDER`). Unsupported community vendors stay under "OpenRouter".
483468

484-
**Priority order for model lists**: (1) Provider's native `/models` API, (2) OpenRouter cache filtered by vendor prefix, (3) Manual pricing reference. OpenRouter is the fallback, not the primary source. When a provider's native API works, its model list takes precedence.
469+
**Priority order for model lists**: (1) Provider's native `/models` API, (2) OpenRouter cache filtered by vendor prefix. OpenRouter is the fallback, not the primary source. When a provider's native API works, its model list takes precedence.
485470

486471
### Where Models Appear
487472

488473
| Page | Source | What's shown |
489474
|------|--------|-------------|
490-
| **Model Prices** | `ModelPricingCacheService.getAll()` | All models from OpenRouter + manual pricing, attributed to real providers |
475+
| **Model Prices** | `ModelPricingCacheService.getAll()` | All models from OpenRouter cache, attributed to real providers |
491476
| **Routing (available models)** | `ModelDiscoveryService.getModelsForAgent()` | Only models from user's connected providers (discovered via native API) |
492477
| **Routing (tier assignments)** | `TierAutoAssignService.recalculate()` | Auto-assigned from discovered models based on quality/price scoring |
493478
| **Messages / Overview** | Stored in `agent_messages.model` column | Raw model name from telemetry, display name resolved via `model-display.ts` cache |

0 commit comments

Comments
 (0)