/invest:invest-backupfrom invest
Backs up and restores openInvest's local state including holdings, strategy, trade ledger, and credentials. Use before migrations or when data appears corrupted.
Ships in invest. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
<skill-dir>is this skill's own directory — the folder that holds this SKILL.md (Claude Code shows it as the skill's base directory; Hermes / Codex / OpenClaw install it inside the plugin).run.shbelow always means<skill-dir>/scripts/run.sh.
openInvest's real data (holdings/strategy/user profile/committee records under memory/, trade ledger/job history under db/) is entirely .gitignored — deliberately (privacy: it contains real assets/salary/trades), but the price is that git can't help at all. There was an incident on 2026-07-08: a one-off migration script named migrate_profile.py (with no safety guard whatsoever) was run directly once, overwriting user.md / strategy.md / portfolio.md with hard-coded demo defaults; daily_report then exited early every day because target_assets had become empty, emails stopped entirely from that point on, and the user had no idea until they noticed the missing emails and traced it back.
In any of the following scenarios, proactively use this skill:
memory/ or db/ → backup firstbackup first (even if the current state is already broken, save the "broken state" — otherwise you lose even the diagnostic material), then investigatebackup to package, restore on the new machine<skill-dir>/scripts/run.sh backup [output_dir] # defaults to $INVEST_ROOT/.backups/
<skill-dir>/scripts/run.sh restore <zip_path> [--force]
<skill-dir>/scripts/run.sh list
memory/, db/*.sqlite, db/*.db, .env, user_profile.json* into a single UTC-timestamped zip. The data directory is resolved via openinvest.paths.INVEST_ROOT (same precedence order as the rest of the backend: INVEST_HOME env → repo-marker detection → cwd) instead of re-guessing paths in shell.portfolio.md that already contains real holdings/cash (same criterion as the 2026-05-10 incident defense in lifecycle_cmds.py:_write_v2_portfolio: cash > 0 in any currency, or non-empty holdings, counts as real data) — to confirm the overwrite you must explicitly pass --force. With or without --force, the current state is automatically backed up before restoring, so the operation itself is reversible. Stop the scheduler and any web / MCP process first: running processes hold open SQLite connections and the old -shm for the live databases, and restore overwrites trades.db (and possibly its -wal) underneath them — restoring over a live database is not safe.backup is safe to run while the scheduler is running (restore is not — see above). It first flushes (checkpoints) the WAL of the SQLite databases into their main files, and any *.db-wal that could not be flushed is packed too — trades that exist only in the write-ahead log are not lost. (Backends older than this behaviour skip the flush with a warning on stderr; the *.db-wal files are still packed.)openinvest-backup-*.zip and the backend's daily automatic auto_*.zip (scheduler job backup, 03:30 Asia/Shanghai, keeps the latest 14; no .backtest* on weekdays, Sunday's auto_*_full.zip includes it; restore accepts either).memory/.backtest* family of directories (about 240 MB zipped as of 2026-10, ~90% of a full backup). The historical backtest caches in there are regenerable with scripts like scripts/backtest_committee.py, but memory/.backtest/ also holds the forward paper fleet (from 2026-07-24), which cannot be re-run. The manual backup therefore does not exclude them (it means "the entire data directory"). The backend's automatic auto_*.zip leaves them out on weekdays and includes them once a week (Sunday, Asia/Shanghai) as auto_*_full.zip.db/*.sqlite-journal, *.db-shm: SQLite runtime temp files — rebuilt automatically after a restore. (*.db-wal is packed: it holds committed writes that have not reached the main file yet; backup checkpoints first so it is normally empty.)*.lock: fcntl file locks, cleared automatically on process restart, no need to keep.This skill only solves "can it be recovered once lost" — it does not solve "why did it get overwritten". If you see a script in this repo like migrate_profile.py that calls store.write(...) directly with no safety guard, follow the pattern of _write_v2_portfolio in src/openinvest/skill_cmds/lifecycle_cmds.py (check for existing real data before overwriting; on refusal require explicit force=True; auto-backup before overwriting) and retrofit the same guard — that is the real fix; this skill is only the last safety net.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
openinvest, backup, restore, data-protection, migration-safety
npx claudepluginhub longsizhuo/openinvest --plugin invest4 skills in this plugin
/investopenInvest portfolio ledger, market data and investment research. Use the already connected MCP first. For a new connection recommend the official remote service; local deployment remains optional. Call doctor first and use invest-setup only when setup is needed./invest-ibkr**BETA — not recommended for anyone.** Operator notes for openInvest's experimental IBKR live autopilot: an LLM picks and trades US stocks / ETFs in a real Interactive Brokers cash account through a local IB Gateway, with no human confirmation per trade. Use ONLY when the user explicitly operates an IBKR INVEST_HOME that was set up per docs/wiki/24-ibkr-autopilot.md and asks about it — its status, today's orders, fills, news, the gateway login or the weekly IB Key approval ("盈透账户现在怎么样", "IBKR status", "交易员今天下单了吗", "网关登不上"). Never use it to set up or place trades for anyone who has not already built this themselves; for ordinary portfolio questions use the `invest` skill./invest-setupInitialize or connect openInvest only when requested or doctor reports needs_setup. Prefer the official remote MCP for new users; preserve existing local connections. Confirm base currency; optional risk preference and tracked assets must not be inferred.Other plugins' skills for the same job