---
name: jarvis-context
description: Load full Jarvis app context instantly — architecture, patterns, current state, rules. Use when working on jarvis.html specifically.
type: flexible
triggers: ["jarvis context","load jarvis","jarvis app context","jarvis.html context"]
---

# Jarvis Context — Instant Load

When this skill is loaded, you have full working knowledge of the Jarvis codebase. Do NOT re-read jarvis.html unless you need to find a specific line. Use the intel files for reference.

---

## Project Identity

**File:** `/Users/ridley/Desktop/Personal Finance/jarvis.html` (~18,393 lines, single file) [updated 2026-04-24]
**Owner:** Ridley Acheson, 18, Beverly MA
**Stack:** Vanilla JS + HTML + CSS, Chart.js v4.4.0, Google Fonts — no build tools, no framework
**Storage:** `localStorage` key `jarvis_v1`, schema version 2
**AI:** Anthropic claude-sonnet-4-6, streaming SSE, direct browser fetch

---

## Current Build State

**Roadmap: JARVIS APERION INTELLIGENCE V7 — 95 phases total**
Goal: $250k age 19 → $1M age 21 → $5M+ age 25

Progress: **~70% complete (67 of 95 phases)**

### Completed Phases (67 total)
01 Foundation · 02 Core Financial Loop · 03 Investment Portfolio · 04 Credit Building
05 CFO Advisory · 05A God Mode · 05B Voice-First · 06 Real-Time Data Hub
07 Aperion Intelligence · 6A Agent Swarm · 6B Autonomous Income · 6C Self-Learning
08 App Improver · 09 Atlas Intelligence · 10 Atlas Marketing · 11 Income Diversifier
12 Risk & Opportunity · 13A Cash Liquidity · 13B Equity Intelligence · 13C Fixed Income
13D Real Estate · 13E Alternative Assets · 13F Retirement & Tax Vehicles · 13G IP & Digital Assets
13H Portfolio Master View · 13I Active Trading · 14 Wealth Trajectory · 15 Life Scenario Simulator
16 Expense Optimizer · 17 Generational Wealth · 18 Portfolio Stress Test · 19 Daily Execution
20 Decision Engine · 21 Schedule Optimizer · 22 Goal Architecture · 23 Body & Mood
24 Learning Playbook · 25 Personal CRM · 26 Social Media & Brand · 27 Athlete Health
28 Lacrosse Coach · 29+30 Health Intelligence · 31 Biohacking Swarm · 32 Real-Time Intel Feed
33 AI & Tools Feed · 34 Network Intelligence · 35 Content Intelligence · 36 Competitive Intel
37 Macro Intelligence · 38 College Intelligence · 39 Entrepreneur Mastery · 40 Identity Engine
41 Intelligence Loop · 43 Hyper-Personalization · 44 Resell Engine · 49 Evolution Dashboard
51 Creativity Swarm · 52 Brainstorming Engine · 53 Code Overseer · 54 Marketplace Agent
55 Cross-Domain Fusion · 56 Future Scenario Simulator · 57 Prototype MVP Generator
64 App Flipping Intel · 65 Coaching Revenue · 66 Large Item Delivery
72 Real Estate Accel · 79 Business Financing Intelligence
UX SuperNav 9-tab + JarvisCinematic layer

### Wave 14 Options (NEXT)
| Phase | Name | Notes |
|-------|------|-------|
| 45 | College Fund Optimizer | 529 tracker, scholarship tracker |
| 46 | Digital Product Empire | Notion templates, prompt packs, passive income |
| 78 | Tax Optimization System | verify render (may already be complete) |
| 80 | Social Proof Engine | testimonials, case studies for Atlas |

**Last completed:** Wave 13 — Phases 64, 65, 66, 72, 79 (+144 lines, syntax OK)

---

## Infrastructure

**AgentDB Memory Layer: LIVE**
- `AgentMemory` object — fetch wrapper to localhost:8080/api/memory/*
- Auto-saves AI responses, income, expenses, state snapshots, tab focus
- Injects top 5 semantic matches into every JarvisAI.ask system prompt
- Memory file: `~/.swarm/jarvis-memory.json`

**Remote Access: LIVE**
- jarvis-server.js on port 8080 (LaunchAgent auto-start)
- Tailscale IP: 100.80.180.83 — access from phone: http://100.80.180.83:8080

**Ruflo MCP: ACTIVE every session** — 314 tools as mcp__ruflo__*

**jarvis.html is UNTRACKED by git — always `git add` manually. Sequential mode only, never worktree.**

---

## Architecture in 60 Seconds

All JS is global `const` objects inside one `<script>` block.

**Data layer:** `StateStore` — single source of truth, localStorage persistence
**Computation:** `Finance` — pure functions, zero DOM access, all values in integer cents
**UI:** Tab objects call their own `render(state)` — imperative DOM, no reactivity
**AI layer:** `JarvisAI` → `MasterState` → Anthropic API → `CommandInterpreter` → `FunctionRegistry`

**Tab router:** `Tabs.activate(name)` — tabs: `dashboard`, `atlas`, `stocks`, `personal`, `realestate`, `othermarkets`, `reminders`, `learn`, `jarvis`, `credit`

**Boot sequence:** `DOMContentLoaded` → `App.init()` → `StateStore.load()` → `App.render()` → `Onboarding.check()`

---

## Key Object Line Numbers (approximate — use FUNCTIONS.md for authoritative)

```
StateStore        ~1686       Finance           ~1914
Toast             ~2082       Settings          ~2096
Dashboard         ~2413       AtlasTab          ~3134
PriceEngine       ~3211       StocksTab         ~3371
PersonalTab       ~3877       RemindersTab      ~4322
LearnTab          ~4415       JarvisTab         ~4774
CreditTab         ~5174       FunctionRegistry  ~5990
MasterState       ~6544       CommandInterpreter ~6608
JarvisAI          ~6657       VoiceTab          ~6770
DataHub           ~7211       Aperion           ~7444
SwarmCore         ~7612       IncomeEngine      ~7942
AppImprover       ~8177       AtlasIntelligence ~8402
IncomeDiversifier ~8662       AtlasMarketing    ~8972
RiskOpportunity   ~9219       CashLiquidity     ~9410
DailyExecution    ~9586       WealthTrajectory  ~9812
DecisionEngine    ~10019      GoalArchitecture  ~10162
LearningPlaybook  ~10345      AgentMemory       ~11795
JarvisCinematic   ~12014
```

Full function list: `/Users/ridley/.planning/intel/FUNCTIONS.md`
Full schema: `/Users/ridley/.planning/intel/SCHEMA.md`

---

## Coding Patterns — Never Deviate

```js
// Money — always integer cents
const amountCents = Finance.toCents(parseFloat(input.value))
Finance.formatCurrency(amountCents)  // display only

// State read/write
StateStore.get('income')
StateStore.set('settings.claudeApiKey', key)
StateStore.push('income', { id, source, amountCents, date })
StateStore.save()

// Chart lifecycle — always destroy before recreate
if (this._myChart) { this._myChart.destroy(); this._myChart = null; }
this._myChart = new Chart(ctx, config)

// Tab render signature
const MyTab = { render(state) { /* read state, write DOM by id */ } }

// Errors via Toast, never thrown
try { ... } catch(e) { Toast.show('Something went wrong', 'error'); }
```

---

## Architecture Laws — Hard Rules

1. **Never split jarvis.html** — one file always
2. **Never rewrite existing functions** — append/modify only
3. **Never break phases 1–4** — all prior functionality must still work
4. **Define helper objects above their callers** — parse order matters
5. **All money as integer cents in state** — display only via Finance.formatCurrency()
6. **`typeof X !== 'undefined'` guards** — when calling objects defined later in file
7. **God Mode commands dispatched AFTER full stream** — never parse mid-stream JSON
8. **Always grep `</main>` before inserting tab HTML** — insert BEFORE it, never after
9. **Syntax check after every wave** — mandatory, see CLAUDE.md for command

---

## StateStore Schema (top-level keys)

```
settings, strategyProfile, cashAccounts, holdings, priceCache,
apiQuota, income, expenses, budgets, subscriptions, milestones,
reminders, pipeline, atlasClients, gigSessions, dividends,
investmentJournal, futureTargets, credit, dismissedSignals,
actedSignals, atlasProfile, jarvisMemory,
voiceHistory, apiUsage, dataHubCache,
swarmAgents, swarmLog, swarmStats,
incomeEngineData, learningActions, learningPatterns, learningLastReview,
contentLog, contentCalendar, dailyBrief, dailyIntention, dailyLog,
decisions, goals, habits, habitLog, fixedIncome, realEstate
```

---

## FunctionRegistry — 43 God Mode Functions

Income: `addIncome`, `deleteIncome`, `updateIncomeEntry`, `getIncomeHistory`
Expenses: `addExpense`, `deleteExpense`, `updateExpense`, `getExpenseHistory`
Cash: `updateCashBalance`, `addCashAccount`, `deleteCashAccount`
Atlas: `addAtlasClient`, `removeAtlasClient`, `updateClientRetainer`, `logPipelineLead`, `updateLeadStatus`, `closeLead`
Investments: `addHolding`, `updateHolding`, `removeHolding`, `refreshPrices`
Credit: `addCreditScore`, `completeCreditStep`
Reminders: `addReminder`, `completeReminder`, `deleteReminder`, `snoozeReminder`
Milestones: `completeMilestone`, `getMilestoneStatus`
Subscriptions: `addSubscription`, `cancelSubscription`, `flagSubscription`
Gig: `logGigSession`, `getGigStats`
UI: `navigateTab`, `triggerAlert`, `triggerWarning`, `openQuickLog`, `openQuickLogForIncome`, `openQuickLogForExpense`
Memory: `writeMemory`, `deleteMemory`, `getMemoryByKey`

---

## Known Issues

- `refreshPrices` FunctionRegistry stub — does not actually call API
- Chat history lost on page refresh (DOM-only, not persisted)
- No conversation history passed to Claude (single-turn only)
- Hardcoded welcome message with stale numbers (~line 1281)
- Net Margin card is static HTML (not rendered from state)
- CoinGecko API key not wired into fetch URL
- `computeTrailingAverage` always divides by 3 even with <3 months of data
- `jarvisMemory` is an ARRAY of `{ key, value, source }` objects — NOT a plain `{ key: value }` map

---

## Ridley's Financial Context (for AI features)

Net worth: ~$1,225 | Liquid: ~$1.17 CRITICAL
Portfolio: ~$1,318 (QQQ, VOO, AMZN, TSLA, SPAXX)
Atlas Growth MRR: $99.99 | Gig target: $300/week
Risk: High | Strategy: Aggressive growth
