Skip to content

fix: Save/versioning broken + export disconnected from agent directory #139

@VictorGjn

Description

@VictorGjn

Problem

Multiple save/versioning/export issues compound into a broken persistence story:

1. Export no longer routes to Agent Directory

The Agent Directory format (agentDirectory.ts — 609 lines generating agent.yaml + SOUL.md + INSTRUCTIONS.md + TOOLS.md + KNOWLEDGE.md + MEMORY.md) is disconnected from the main Export flow. SaveAgentModal.tsx (575 lines) offers download targets (Claude Code, Amp, Codex, etc.) but doesn't save to the agent library (~/.modular-studio/agents/).

User creates an agent through the wizard but has no clear path to persist it to the library AND export it.

2. Save flow unclear

The save flow has multiple entry points (SaveAgentModal, AgentActionBar, keyboard shortcut) but the relationship between:

  • agentStore.ts (server-side, ~/.modular-studio/agents/{id}/latest.json)
  • consoleStore.collectFullState() (client-side state snapshot)
  • agentDirectory.ts (human-readable directory format)

is not clear. Save sometimes works, sometimes silently fails (audit: .catch(() => {}) on save errors — P0-6).

3. Version history disconnected

Versions are stored in ~/.modular-studio/agents/{id}/versions/ but the UI version picker may not reflect actual persisted versions.

Success criteria

  • Save button persists to agent library (agentStore.ts) AND shows success/error toast
  • Export offers: (a) download file, (b) save to library, (c) both
  • Agent Directory format is the primary export format for the library
  • Version history is accurate and matches persisted snapshots
  • Loading an agent from the library restores full state

Implementation

  1. Wire SaveAgentModal to call agentStore.saveAgent() as the PRIMARY action (not just download)
  2. Add "Save to Library" as a distinct action from "Export/Download"
  3. Replace .catch(() => {}) with toast notification on save failure
  4. Add confirmation dialog before restoreVersion()
  5. E2E test: Save → Back to Library → Load → verify all state restored

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Critical — blocks user experiencebugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions