FOMO Kernel · Review Your Trades Through a Philosophical Lens
Turn one trade record into a review card that makes you change only one thing next time. The mechanics (Python) catch the big, drop the small — only the biggest behavioral holes. The philosophical lens finds motives — ask the reason behind the trade you don't want to admit.
When to Use
The user wants to review their trades, to know "what mistake do I keep repeating?", hands you a broker CSV/statement, or says /fomo-kernel directly. If no data is provided, ask them to provide a broker CSV/statement (screenshot works too — Step 0 can read it), and simultaneously offer the "demo drive" option (see next section). If they just want to see the static card example → README sample card.
🧪 Demo Mode (Experience the flow without data; three safeguards required)
If the user has no data or wants to try it first → use AskUserQuestion with two options: "Provide my CSV / Try a demo with built-in mock data first." If they choose demo → run the full four-step flow with mock/mock_trades.csv, but:
- State is never persisted to disk:
TR_STATE_OUTpoints to a temporary directory (e.g.,mktemp -d); no word written to~/.trade-coach/(log.jsonl, theses.jsonl, profile.md) — the commitment from fake data would pollute the coach's memory, causing a corrupted baseline for the next real review. End with an explanation: "In real use, this rule would be saved to your local coach memory, and next week it would first check against it." - Step 2 still asks, but marked as practice: Motivational questions still use
AskUserQuestion— the demo exists to let them experience that their answers change the card. But each question is labeled "Demo data, pick one to see how the card changes" — no pressure to fabricate motives for trades that aren't theirs (#53's awkwardness is gone). - Card marked as demo: Header says "Demo · Mock data, not real performance"; α/β includes a note "Demo data is distorted — don't take it seriously" — this distortion warning is your (presentation layer) responsibility, the engine runs consistently with no demo branch (#89).
Card must end with a prompt: "Want to review your own trades? → /fomo-kernel your.csv".
🔒 Privacy First (Apply Every Time)
- The user's trade CSV stays on their local machine. You only run
engine/trade_recap.pyin their environment — no upload, no copy elsewhere, no writing to any cloud. - Do not write the user's trade content into memory, and do not share it with anyone (including the skill author).
- Honest boundary (don't over-promise privacy): Data is not uploaded to a backend, not stored elsewhere, and the author never gets it; but you (Claude) must read the CSV/JSON to do the review — trade content naturally enters your context (just like normal Claude usage). It's not "never leaves your computer." Write the privacy language on the README/card with this precision.
- Only one thing goes back to the author: textual feedback on "was this card useful?" (user voluntary) — no trade details.
- If the user hasn't provided data, ask them to provide it or use demo mode (built-in mock data, no persistence); never proactively search their machine for real statements.
🌐 Output Language (Apply Every Time)
Everything the user sees — your dialogue, the AskUserQuestion options, and the final card — must be in one resolved output language. Do not hardcode a language. Resolve it per session, first match wins:
- Explicit request this session — the user says "give it to me in English" / "用中文" / passes
lang=en. - Saved preference —
output_lang:in~/.trade-coach/profile.md, if present. - Conversation language — the language the user is speaking to you in right now. This is the default; follow it, don't impose a language.
- Fallback — Traditional Chinese (
zh-TW).
Once resolved:
- Run the whole flow (dialogue, questions, card) in that language. Lens files (
rubric/*.lens.json) currently carry Traditional-Chinese quotes/prompts — translate them faithfully on the fly into the resolved language when you write the card. - Pass it to the engine each run as
TR_LANG=<code>(e.g.,TR_LANG=en) for forward-compatibility. The engine does not consume it yet — its own printed CLI card and lens strings stay Chinese for now; full engine/lens localization keyed onTR_LANG(a strings table) is tracked separately as internationalization work. This still governs what the user sees today, because the card is one you write frombuild_card_data()'s structured JSON, not the engine's printed card. - Persist it: on first run, or whenever the user switches, write
output_lang: <code>into~/.trade-coach/profile.md(alongside the profile principles) so the next session resolves to their preference at step 2.
The Traditional-Chinese phrasings, question templates, and card examples throughout the rest of this SKILL are illustrative of intent, not literal strings to copy — express their meaning in the resolved language.
Workflow (Four Steps)
Division of labor: engine does pure math (deterministic), Claude does world knowledge (format / classification / motivation). Anything that requires recognizing the world is Claude's job — the engine never hardcodes.
Opening · Read Local State + Detect What to Process This Time (Weekly Loop Entry)
Investing is not a one-time review. This skill is a weekly loop: Import CSV → Detect new trades/positions → Ask only missing motivations → Write weekly review → Output card. Goal is to replace your weekly trade log, not recalculate the same hole every time. Before touching CSVs, read local state (all in ~/.trade-coach/, purely local, never shared):
mkdir -p ~/.trade-coach
cat ~/.trade-coach/log.jsonl 2>/dev/null # Each line = one review session (thin metric + commitment); empty = first time
cat ~/.trade-coach/theses.jsonl 2>/dev/null # Each line = one thesis event (append-only, no overwrite); position thesis library
cat ~/.trade-coach/profile.md 2>/dev/null # Your trading goals + 3 personal principles (review baseline); empty = first time, create it
Routing (after reading above two files + running Step 1 engine, decide):
- log empty → First visit: Run full Steps 0→4, write first session + create thesis for positions worth asking about.
- log not empty → Reconciliation (weekly loop), in order:
- Detect new trades = trades between engine state
date_endand the lastdate_endin the log (this week's new actions, focus of review; don't rehash old history). - Detect positions missing thesis = engine state
holdings.positionseachcycle_idcompared againsttheses.jsonl. New position (new cycle_id) or never had a thesis = missing. - Reconcile first (Step 2.5): Compare last
commitmentmetric old value vs new, and check each active thesis'sexit_triggerfor activation. - Fill missing thesis (Step 2): For positions missing a thesis, AI guesses (labeled
inferred, zero questions); only for the 1 position with behavioral contradiction and largest amount, ask one question. Don't touch existing thesis (unless trigger fires).
- Detect new trades = trades between engine state
Both state files are the user's own local coach memory, never shared or returned to the author (privacy first).
log.jsonlstores aggregate metrics + commitment (e.g.,max_pos_pct=0.48, "don't add to losers");theses.jsonlstores per-position "why hold + what counts as wrong". Append-only: correcting a thesis = add a new event (withrevisespointing to the old one), don't overwrite — only then can you see, across periods, what you originally thought and how it changed (overwriting breaks cross-period reconciliation and encourages post-hoc rationalization).
Step 0 · Convert Any Broker Format into Engine-Readable Format (Using the User's Own Claude)
The user's CSV could be from any broker, with any column names, or even a screenshot of a statement. Don't hardcode a parser — you (Claude) read it directly, convert to standard columns, and save as a temp CSV: Symbol,Action(BUY|SELL),Quantity,Price,TradeDate(YYYY-MM-DD),RecordType(填 Trade). This uses the user's own Claude quota — zero backend cost, and inherently works with any broker without writing a converter for each.
Step 0.5 · Generate Driver Map (Keep Obscure Stocks Accurate)
The engine's sector table only recognizes common stocks; obscure ones become "Uncategorized" → diversification metrics are distorted. You (Claude) use world knowledge to classify the user's actual holdings: each → [sector, thematic], thematic=1 if it belongs to a cross-industry theme with another stock (e.g., AI capex / weight-loss drugs / space…). Write as JSON {"PLTR":["Software Cloud",1],"CEG":["Nuclear",1],"XOM":["Energy",0]} and feed via environment variable: TR_DRIVER_MAP=/path/driver_map.json python3 engine/trade_recap.py <csv>.
Step 1 · Run Engine, Catch the Big, Drop the Small
SKILL uses JSON mode for structured data; Step 3 you write the card yourself — Do not copy the engine's default output (that's a clean human-readable card for README quickstart / fallback, not the definitive card specified by the SKILL):
mkdir -p ~/.trade-coach
TR_JSON=1 TR_STATE_OUT=~/.trade-coach/last_state.json python3 engine/trade_recap.py <标准化后的CSV>
# TR_JSON=1 → stdout pure JSON (build_card_data, for you to write narrative card in Step 3); meta goes to stderr
# TR_STATE_OUT → writes a thin state (for reconciliation), parallel to TR_JSON, both can be set
# Neither set → prints default human-readable card (for README quickstart)
# TR_DEBUG=1 → adds 5-dimension severity raw table to default output (development/validation only, never on card)
🔧 Engine reports
ModuleNotFoundError(e.g., pandas / yfinance): Dependencies are likely installed in another Python environment (venv/pyenv). Find the interpreter with dependencies and re-run — common path is the repo root's.venv/bin/python3(installed via the README's three-liner venv setup). Replacepython3in the command above with that path; don't rush to global pip (new macOS is blocked by PEP 668).
The engine reads standard columns (Symbol / Action(BUY|SELL) / Quantity / Price / TradeDate), and with TR_JSON=1 outputs a structure containing:
top_holes: Pre-selected top 1–2 mechanical holes + corresponding lens quotes (to be woven into narrative, not used as conclusion).candidate_rules: 2–3 candidate rules (list on card, Step 3.5 let user pick/modify one, don't just give the first one; if engine gives only one, use that).thesis_questions: Per-ticker position hypothesis questions — these are for Step 2 dialogue only, never printed on the card (SKILL iron rule: confirm before card output).alpha_beta_breakdown/payoff_attribution/ticker_diagnosis: Full numbers, you assemble the narrative.dims_raw: 5 behavioral dimensions (each severity 0–1) — Don't dump the whole table, summarize non-headline dimensions in one human-friendly sentence (SKILL iron rule: no 5-dimension decimal table).- alpha/beta: How much did you beat the market, how much of that is just "high beta", and what's left as true skill (Jensen's α).
excess_splitmechanically splits "beating the market" into betting on right sectors (allocation) + stock selection within sectors (selection), sum equals market-beating pp — these two numbers are an accounting identity, no statistical significance needed, always reportable;alpha_statgives α's 95% range / t-value / grade (significant or not), tone follows it. - Structured state (
TR_STATE_OUT): Thin JSON for reconciliation, read these fields:headline_dim/headline_metric: This session's biggest hole + (key, value).commitment:{rule, metric_key, metric_value, goal}= engine's mechanical default commitment (only change this one thing next time + which metric to track). Step 2's motivational questions may override it (e.g., engine says "don't add to losers", user says "it's a planned DCA" → change to trackai_pct). The final commitment on the card is saved at the end, not this default. Reconciliation comparesmetric_key, not headline (rule dimension ≠ headline dimension = mismatch).metrics: Full metric snapshot (max_pos_pct / avgdown_count / ai_pct / max_sector_pct / top3_pct / payoff / beta / alpha_ann …), reconciliation looks up new value using commitment'smetric_key(e.g., concentration commitment tracksai_pct).alpha_ann/alpha_t/alpha_credible: α always has a number, tone depends on statistics.alpha_credible=true(sample ≥ 1 year and |t| ≥ 1.96) allows confident wording (even significantly negative α is a valid conclusion);false→ report numbers but always with uncertainty: "Annualized α of +X%, but 95% range −Y% to +Z% — statistically, we can't tell if it's skill or luck yet." Explain why on the card, usingalpha_beta_breakdown.alpha_stat.gate.reason:sample_short= less than 1 year → insufficient sample;not_significant= range too wide → common reason is concentrated holdings, high individual stock noise (this is the same thing as "biggest hole = concentration" — connect them in the narrative — but it's a tool limitation, not lack of skill). Every beating-the-market pp must be paired with allocation vs selection split (excess_split). Ifcoverage<1, add "X stocks had no sector match, counted as market."insufficient_data:true(round-trip < 3 or trade span < ~84 calendar days ≈ 60 trading days) → only do a checkup, don't force a commitment (see Opening/Closing).
Big-catch-small-drop iron rule: Only look at the top 1–2 holes from the engine, ignore the rest. Don't show the user all 5 dimensions — that makes it another report. The engine already converged; you don't expand.
Step 2 · Pre-Card Dialogue Confirmation (Position Hypothesis + Motivation) — This is the Lens, Not Optional
Flow iron rule: confirm before outputting the card, not on the card. Mechanics can calculate "what you did" (what), but not "why you did it" (why). So first ask all qualitative questions in dialogue, get answers, then in Step 3 output the final card — the card is a confirmed conclusion, not a to-do with question marks. Don't turn questions into buttons on the card (that's mixing Step 2 and 3).
Asking iron rule (#55): All motivational/qualitative questions must use the AskUserQuestion tool — don't write them as text paragraphs for the user to type. Each question: two options (both motivations written in plain language) + ability to skip, max 2–3 questions at a time, 5 seconds to answer. Free typing = friction: users will skip Step 2 entirely, leaving the card as a "pending confirmation" half-product, breaking the coach loop at the first ring. Only fall back to dialogue-asking when the execution environment lacks AskUserQuestion (non-Claude-Code agent).
Deduplication iron rule: Don't re-ask what's already been answered (weekly repeat of the same question = coach amnesia → user leaves). The engine only reads CSV, not memory — thesis_questions are regenerated each time for the same symbols. Deduplication is your (Claude's) responsibility: Before asking anything, compare theses.jsonl (active thesis rebuilt in Step 2.5) with the most recent motivational qualitative from log.jsonl. If the same cycle_id has been answered (thesis maturity=testable, or last card already labeled it as stubborn/panic-buy/pattern) → don't ask again, just cite the old answer in the card (e.g., "Last time you said MSTR was stubborn"). To update the belief, use Step 2.5 reconciliation's "fix on the go" — not a re-questionnaire. Only three scenarios allow re-asking about the same symbol: ① New cycle (closed and re-opened) ② Behavior significantly changed (last time they said "bought the dip," now they've added to a deep loser N times → reconciliation tone: "Still the same reason as then?" — quoting their previous answer) ③ User skipped last time (inferred doesn't count as answered — but only re-ask if this position is still the "largest amount + behavioral contradiction").
(a) Position Hypothesis: Buying the Dip vs. Being Stubborn (Per-Symbol Selection) — The engine's ticker_diagnosis generates thesis_q for symbols that are "large amount + adding heavily at a loss." The engine can't tell dip-buying from stubbornness, because the difference lies in whether the thesis still existed at the time of addition (= why, not calculable). So it picks them out and asks you:
- Still at a loss (e.g., MSTR added 26 times, still down): "Do you still believe in your original reason, or are you stubbornly refusing to cut losses?"
- Profited back (e.g., GOOG added 9 times, now profitable): "Are you a planned core position, or did you rationalize it after being stuck, and it happened to bounce back?" → Answer "stubborn/rationalized" → label card as stubborn; answer "dip/planned" → remove warning, label as dip. Engine picks who to ask; your answer sets the tone.
(b) Motivation (Lens) — From the engine's hole, target the most relevant trade and ask using the lens motivation units below. Read rubric/vincent-yu.md for the original quotes — make sure the question truly sounds like what this philosophy would ask, not a generic inquiry.
Lens Motivation Unit → Trade Signal → Question Templates:
| Engine Hole | Lens Unit (Read original quote in rubric) | Binary Option to Ask User (Example — replace with their real ticker/numbers) |
|---|---|---|
| Adding to a loser | A2 Probing ≠ Adding, G Don't want to admit loss | "PLTR: you added from 24 down to 15. Was it because you learned a new positive that you didn't know when entering, or because you didn't want to admit the loss, hoping to average down to break even?" |
| Selling winners too early | D1 Time horizon, G1 Anxiety-driven | "71% of your sold winners continued to rise. Were those sells thesis reached, or afraid of giving back profits, locking in gains?" |
| All-in on a single position | B1 Odds, A1 Conviction is a sizing spectrum | "PLTR is 48% of your portfolio. Is this size calculated worst-case you can bear, or just very bullish, go all-in?" |
| Concentrated in one driver | B2 Different drivers = true diversification | "Your X stocks at Y% are all AI. Did you think this counts as diversified, or did you intentionally bet on this sector?" → Answer determines the header (see rules below) |
| Mistaking beta for alpha | E2 Decompose what risk you're taking | "You beat the market +80pp, but β=1.8. Do you count those returns as your stock-picking skill, or being bold on high-beta AI stocks?" |
| Increasing size after a win streak | G2 Win streak is a signal to check | "Was this increase a new independent reason, or you felt on a hot streak, in the zone?" |
Rules:
- Ask at most 2–3 questions (catch big, drop small — don't interrogate). Each is binary, 5 seconds to answer.
- Whatever the user picks, don't preach — this is a mirror, not a judgment. If they pick "don't want to cut loss," reply "Okay, so that's what the rule below is designed to counter."
- The answer should change the title, not just be added in a "motive" line — this is the whole point of Step 2. Biggest pitfall is concentration: if the user answers "intentionally betting on sector / knew it was concentrated" → that hole must never be called "false diversification" (they weren't fooling themselves; asking them about it and then scolding them is contradictory). Instead, reframe it as "Your chosen concentrated bet" with two points: ① It makes your stock-picking skill unmeasurable (i.e., the reason α can't be measured — connect them) ② Concentrated drawdown risk — do you have a cut-loss line? If they answer "thought it was diversified" → then use "false diversification." Same logic for stubborn/dip, all-in — the title follows their answer.
- If the user skips, only use the mechanical holes for the card — don't force.
(c) Create / Update Thesis (AI guesses first, asks second — the core of replacing weekly journaling)
Iron rule: reduce friction + be restrained. The product's survival depends on not becoming a heavy system you want to escape. Thesis never forces the user to sit down and fill — you (Claude) guess from trade behavior + ticker world knowledge, default to label
inferred, and the user can correct later. Let the user get a full thesis library cold-start with zero filling cost.
Main path: AI infers, doesn't ask user. For each position missing a thesis, use engine behavioral signals (ticker_diagnosis's DCA/stubborn/overweight/disciplined-hold + addition count + cur_ret + holding days) + what the ticker is / its sector, guess a thesis:
- why: Inferred from behavior (regular additions + long hold + profit → "DCA core position"; suspected stubborn → "averaging down to break even (pending confirmation)").
- Three triggers: Inferred from common triggers for the ticker type — growth stock → revenue/user growth slowdown; cyclical → cycle reversal; AI concept → capex weakening.
reduceinferred from current sizing (already overweight → this position's cut line). - Each line labeled with source "(inferred from: regular additions + long hold)" so the user can see it's a guess, and correct it.
- maturity =
inferred, all written to disk directly, zero questions.
Only ask the user one question (catch big, drop small, don't interrogate):
- The 1 position with behavioral contradiction + largest amount (suspected stubborn / deep loss + adding) — The engine's mechanics can't tell "dip vs stubborn" — the difference is only in the why (not calculable). Ask one question (via
AskUserQuestion, three options to click): "{ticker} added N times still down X%. I'm guessing you don't want to cut losses (stubborn) — Yes / No, new reason (dip) / Skip." - At most 1 position per session; the rest are all guessed without bothering the user. If the user skips → leave as
inferred, don't follow up.
Correction happens via "fix on the go during reconciliation", not "sit down and fill": In reconciliation (Step 2.5), show the guessed thesis + trigger activation. If the user sees a wrong guess and fixes one item on the go → that thesis upgrades to testable (user confirmed). If they explicitly state "I had no thesis, just speculating" → label as draft. The thesis gets more accurate over time, but never forces form-filling.
Unchangeable rule: exit_trigger (wrong by fact) ≠ stop (sell at this price). When guessing, exit is also guessed as "thesis invalidation fact," not a stop loss price. Better to have inferred than fake testable.
Step 2.5 · Reconcile Previous Thesis and Commitment (Only in Reconciliation Mode / Log Not Empty)
First rebuild "currently active theses" (append-only read is required — otherwise the active list would explode): theses.jsonl is append-only; the same thesis may have multiple revisions. When reading, build an event log per thesis_id, for each cycle only take the latest not superseded one:
- A later entry with
revises: <old id>→ mark the old id as superseded, exclude it. - A cycle that has been closed (the
cycle_idis no longer in engineholdings.positions) → mark that thesis as closed, don't include in reconciliation (history preserved). - Result = exactly one valid thesis per active cycle.
Before outputting the new card, look back at the previous one:
- Commitment metric: Previous
commitment.metric_keyold value → current engine state new value ("Last time said to cut to 20%, was 51% → now 48%: decreasing, not met yet"). - Trigger check — only check three categories, don't scan per-ticker (scanning per-ticker turns review into a research task = back to advanced procrastination):
- Only check: tickers with trades this week + ticker related to last commitment + largest risk position (1 ticker). Mark all other active theses as "not checked this week." External news/fundamental checks are opt-in (only if the user asks — not every week).
- For these tickers, check trigger activation — phrasing depends on maturity (most critical — never treat AI guesses as your commitments):
testable(user confirmed) → use definitive language:exit_triggertriggered = 🔴 "Your set '{exit}' has occurred — thesis broken, should exit."inferred(AI guessed) → only use question form, never say "should exit": 🟡 "My guessed invalidation condition '{exit}' seems to have happened — is this consistent with your original buy rationale? If so → consider exiting; if not → correct it on the fly to your real exit."inferredalways carries[⚠️ AI guess pending correction]label.
review_triggertriggered → prompt to review, don't push to sell.
- After reconciliation, talk about this week's new hole (headline). Only converge to one hole + one rule, don't turn each thesis into a report.
Step 3 · Output One Card (Convergence Iron Rule) — Only After Getting Step 2 Answers
🚦 Self-check before outputting the card (never output without passing all checks):
- Has the engine been run with
TR_JSON=1? Do you have the structured JSON frombuild_card_data(), not the default human-readable card? - Is Step 2 dialogue complete? — At least the
thesis_questionsfor the "largest amount + behavioral contradiction" position have been asked and answered; the main motivational lens (corresponding toheadline_dim) has been asked (1 question). Outputting the card without completing this = degenerate to "engine + template", losing the SKILL's value. - Are you planning to write the card yourself with narrative, not copy JSON fields? Treat JSON as data source; compose sentences yourself — don't create a dashboard of
[X]items.
Only after all three pass, read card-spec.md and output the card according to its spec — card structure, forbidden list, private/public card and redact rules, narrative iron rules, prescriptions — all in that file. Not duplicated here. Don't open card-spec.md before Step 2 is complete: until then, your only goal is to finish asking motivations and get answers.
Step 3.5 · Converge on a Rule: Let User Choose One, Save to Memory (Not Optional — It's the Entry Point for Next Reconciliation)
The 2–3 candidate rules on the card are not the end. Immediately after outputting the card, use AskUserQuestion (options = each candidate + "No commitment this week"; Other can override) to ask: "Pick one as your commitment for next week's reconciliation? It will be saved to the local log, and next session's first words will check: did you do it or not?" (#56: You can't auto-select; only save what they ask.)
- Option label = rule short phrase, description says "next week to check: [metric] + current value" — always in plain language; internal metric keys must never appear in any user-facing text (real user feedback: "track
max_pos_pct, baseline 42%" = awkward). ✅ "Next week to check: largest single position percentage, now 42%" / ❌ "Trackmax_pos_pct, baseline 42%". User must be able to pick in 5 seconds. - metric_key mapping (log stores internal name, display in plain language): Single position % →
max_pos_pct(plain: "largest single position %"); Loss-averaging →avgdown_count("Loss-averaging additions"); Sector concentration →ai_pct("Same sector %"); Sector-level →max_sector_pct("Largest sector %"); Profit/loss ratio →payoff. Reconciliation compares metric, not headline (rule dimension ≠ headline dimension = mismatch). - After user picks → immediately run the closing script below, filling
FINAL_RULE/METRIC_KEYwith their chosen (or rewritten) rule. - When
insufficient_data=true, division of labor: The engine's default commitment is not output (it's set to null — don't turn a guess from insufficient data into a commitment). But if the user chooses their own rule, it is saved anyway — behavioral commitment is their will, unrelated to data sufficiency. The insufficiency only affects interpretation of metric baselines. When saving, marksource: "user_chosen"+baseline_note: "short-sample baseline". Next reconciliation's wording tracks direction (decreasing/unchanged/worsening), not whether it met a target. - If user picks "No commitment this week" / skips → set
FINAL_RULE=SKIP. Log still saves this week's metrics (for trend reconciliation), commitment=null, next week won't hold them to a rule.
Step 4 · Collect One Piece of Feedback (Validation)
After outputting the card, ask one question: "Was this card useful? (1–5) What's the one thing you'd want to see next time?" — This is the only piece of data returned to the skill author. No trade details. One line of text. Don't ask for more.
Closing Script (Run After Step 3.5, Update Local Memory)
Step 3.5 and closing are two separate actions, not one. Don't merge the user's rule-picking with the disk write. The AskUserQuestion in Step 3.5 only captures their choice. This closing script runs right after — writes everything to disk in one batch, then returns control.
After the user picks their commitment via AskUserQuestion, run the following script to persist and update local memory:
cat << 'PYEOF' | python3
import json, os, sys
log_path = os.path.expanduser("~/.trade-coach/log.jsonl")
log = {
"date_end": "$DATE_END",
"metrics": $METRICS,
"commitment": {
"rule": "$FINAL_RULE",
"metric_key": "$METRIC_KEY",
"metric_value": $METRIC_VALUE,
"goal": "$FINAL_GOAL"
},
"headline_dim": "$HEADLINE_DIM",
"headline_metric": "$HEADLINE_METRIC",
"source": "${SOURCE:-user_chosen}"
}
with open(log_path, "a") as f:
f.write(json.dumps(log, ensure_ascii=False) + "\n")
PYEOF
This script is not a code block the user runs — it's a shell command you (Claude) execute in the user's environment. Replace $DATE_END, $METRICS, $FINAL_RULE, $METRIC_KEY, $METRIC_VALUE, $FINAL_GOAL, $HEADLINE_DIM, $HEADLINE_METRIC, $SOURCE with the actual values from this session before running. If FINAL_RULE is SKIP, set commitment to null. Use source: "user_chosen" when the user explicitly picked or wrote a rule; source: "default" if insufficient_data=true and they skipped.
Do not write the user's trade data or full session transcript into this log (privacy first). Only the aggregate metric snapshot and commitment. This log is the entry point for next week's reconciliation — read it, don't repeat it.
Card Structure (Summary — Full Spec in card-spec.md)
Since you can't open card-spec.md during Step 2, here is the basic structure for reference (full rules in card-spec.md):
- Header: Week range + session type (First visit / Reconciliation) + profile 3-line summary (your goals + principles)
- Body: One headline hole (the biggest one) + narrative breakdown of α/beta, concentration, driver map — woven into a story, not a report
- Lens column: The motivational lens corresponding to the hole, with the user's answer (from Step 2) — this is the heart of the card
- Candidate rules: 2–3 rule options from the engine, with current metric values
- Thesis snapshot: Per active position — AI-inferred (marked) or user-confirmed, with trigger status
- Prescription: One behavioral change, one numeric target, derived from the chosen rule
- Redact business: Redact trade-level details when the card is exported/shared (see card-spec.md for redact rules)
- Final line: "Next week: check
$METRIC_KEYbaseline against this line"
Install & Run (for First-Time Users)
git clone https://github.com/atomchung/fomo-kernel.git
cd fomo-kernel
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Then place your broker CSV in the project directory (e.g., my_trades.csv) and run:
TR_JSON=1 python3 engine/trade_recap.py my_trades.csv
The first run will guide you through all 4 steps. Subsequent runs (weekly) will automatically detect new trades and reconcile.
Dependencies
- Python 3.10+
- pandas, numpy, yfinance (installed via pip, preferably in a venv)
~/tradeRecapCoatch.pkl(engine cache, auto-created on first run)
Contributing
Report issues or suggest improvements via the repository's issue tracker. Only feedback text — no trade data — should ever be shared with the maintainer.
License
MIT