The AI layer
How AI analyses are generated, historized, and versioned.
The AI layer
portfolIQ enriches each asset with AI-generated analyses. These are factual descriptions — not financial recommendations. Every analysis is stored with full auditability: model ID, prompt version, cost, and timestamp.
What the AI layer produces
Three analysis types are generated per asset:
| Type | Description | Example output |
|---|---|---|
token_classification | Protocol category and characteristics | "Layer-1 proof-of-work network. Primary use case: store of value and settlement layer." |
fundamental_summary | Prose summary of market position and on-chain fundamentals | "Bitcoin holds the largest market cap in crypto with a 30-day average volume of..." |
sentiment_score | Aggregated sentiment from the last 48h of news coverage | {"score": 0.62, "label": "positive", "source_count": 14} |
These are descriptions of observable facts. They are not buy/sell signals, price targets, or investment recommendations.
Model routing
Two Anthropic models are used, selected by complexity and cost:
| Model | Usage share | When used |
|---|---|---|
| Claude Haiku 4.5 | 85% | Standard analyses — classification, sentiment |
| Claude Sonnet 4.6 | 15% | Complex analyses — fundamental summaries, first run on a new asset |
The routing logic is deterministic: Haiku for fast, repetitive analyses; Sonnet when the context is rich or the asset is new. This keeps API costs within the project budget (~80–115€/month).
Prompt versioning
Every analysis is linked to a specific prompt template version:
- Prompts are stored in
prompts/registry.ymland version-controlled in git. - The
prompt_versionfield (e.g.,fundamental_summary_v1.2) is returned in every API response. - When a prompt changes, old analyses remain in the database with their original version tag — the history is never overwritten.
This means you can track how the interpretation of an asset has evolved over time, and which prompt generated which output.
AMF guardrails
13 prescriptive patterns are banned from all AI outputs. Analyses are validated before storage:
Banned patterns include: "buy", "sell", "invest", "target price", "should buy/sell", "will rise/fall", "overvalued", "undervalued" (in prescriptive form), "recommended", "guaranteed return".
If an analysis triggers one of these patterns, it is automatically rejected and a regeneration is triggered. The rejection rate is logged (approximately 11 analyses per 78 rejected in Sprint 6 before prompt refinement).
Historization
Every analysis stored in sat_asset_ai_analysis includes:
| Field | Description |
|---|---|
model | Anthropic model ID (e.g., claude-haiku-4-5) |
prompt_version | Template version used to generate this analysis |
cost_usd_micros | API cost in micro-USD (for budget tracking) |
cache_hit | Whether Anthropic's prompt cache was hit |
generated_at | UTC timestamp of generation |
The table is append-only — analyses are never updated in place. You can query the full history for an asset across all prompt versions.
Not financial advice. Not a fatwa. AI-generated analyses are factual descriptions based on observable market data. portfolIQ is not a registered investment advisor. Methodology disclosed.