Files
worldmonitor/todos/048-pending-p2-analysis-framework-store-not-in-settings-export.md
Elie Habib 110ab402c4 feat(intelligence): analytical framework selector for AI panels (#2380)
* feat(frameworks): add settings section and import modal

- Add Analysis Frameworks group to preferences-content.ts between Intelligence and Media sections
- Per-panel active framework display (read-only, 4 panels)
- Skill library list with built-in badge, Rename and Delete actions for imported frameworks
- Import modal with two tabs: From agentskills.io (fetch + preview) and Paste JSON
- All error cases handled inline: network, domain validation, missing instructions, invalid JSON, duplicate name, instructions too long, rate limit
- Add api/skills/fetch-agentskills.ts edge function (proxy to agentskills.io)
- Add analysis-framework-store.ts (loadFrameworkLibrary, saveImportedFramework, deleteImportedFramework, renameImportedFramework, getActiveFrameworkForPanel)
- Add fw-* CSS classes to main.css matching dark panel aesthetic

* feat(panels): wire analytical framework store into InsightsPanel, CountryDeepDive, DailyMarketBrief, DeductionPanel

- InsightsPanel: append active framework to geoContext in updateFromClient(); subscribe in constructor, unsubscribe in destroy()
- CountryIntelManager: pass framework as query param to fetchCountryIntelBrief(); subscribe to re-open brief on framework change; unsubscribe in destroy()
- DataLoaderManager: add dailyBriefGeneration counter for stale-result guard; pass frameworkAppend to buildDailyMarketBrief(); subscribe to framework changes to force refresh; unsubscribe in destroy()
- daily-market-brief service: add frameworkAppend? field to BuildDailyMarketBriefOptions; append to extendedContext before summarize call
- DeductionPanel: append active framework to geoContext in handleSubmit() before RPC call

* feat(frameworks): add FrameworkSelector UI component

- Create FrameworkSelector component with premium/locked states
- Premium: select dropdown with all framework options, change triggers setActiveFrameworkForPanel
- Locked: disabled select + PRO badge, click calls showGatedCta(FREE_TIER)
- InsightsPanel: adds asterisk note (client-generated analysis hint)
- Wire into InsightsPanel, DailyMarketBriefPanel, DeductionPanel (via this.header)
- Wire into CountryDeepDivePanel header right-side (no Panel base, panel=null)
- Add framework-selector CSS to main.css

* fix(frameworks): make new proto fields optional in generated types

* fix(frameworks): extract firstMsg to satisfy strict null checks in tsconfig.api.json

* fix(docs): add blank lines around lists/headings to pass markdownlint

* fix(frameworks): add required proto string fields to call sites after make generate

* chore(review): add code review todos 041-057 for PR #2380

7 review agents (TypeScript, Security, Architecture, Performance,
Simplicity, Agent-Native, Learnings) identified 17 findings across
5 P1, 8 P2, and 4 P3 categories.
2026-03-27 23:36:44 +04:00

2.4 KiB

status, priority, issue_id, tags, dependencies
status priority issue_id tags dependencies
pending p2 048
code-review
quality
analytical-frameworks
settings

Custom frameworks not included in settings export/import — user data lost on reset

Problem Statement

analysis-framework-store.ts uses its own localStorage keys (wm-analysis-frameworks for the library, wm-panel-frameworks for per-panel selections). The existing preferences/settings export/import flow does NOT include these keys. When a user exports their settings, migrates to a new device, or clicks "reset settings", all custom imported frameworks and their per-panel assignments are silently lost. This is particularly impactful since importing frameworks from agentskills.io URLs is a new user action.

Findings

  • src/services/analysis-framework-store.ts:6-7const LIBRARY_KEY = 'wm-analysis-frameworks'; const PANEL_KEY = 'wm-panel-frameworks';
  • src/services/preferences-content.ts — settings export/import handler does not include these two keys
  • Flagged by: architecture-strategist

Proposed Solutions

In preferences-content.ts (or wherever the settings export JSON is constructed), include LIBRARY_KEY and PANEL_KEY contents:

const exportData = {
  ...existingPreferences,
  'wm-analysis-frameworks': localStorage.getItem('wm-analysis-frameworks'),
  'wm-panel-frameworks': localStorage.getItem('wm-panel-frameworks'),
};

And on import, write them back. Pros: Complete settings portability | Effort: Small | Risk: Low

Option B: Expose export/import in the Analysis Frameworks section of settings

Add "Export frameworks" / "Import frameworks" buttons specifically in the Analysis Frameworks settings section, independent of the global settings export. Pros: Granular control | Cons: Duplication of effort; user expects global export to be complete | Effort: Small | Risk: Low

Technical Details

Acceptance Criteria

  • Settings export JSON includes wm-analysis-frameworks and wm-panel-frameworks
  • Settings import restores custom frameworks and per-panel assignments
  • Built-in frameworks are not duplicated on import (they're already in the store constant)

Work Log

  • 2026-03-27: Identified during PR #2380 review by architecture-strategist