Risk Dimensions

System Architecture

Barbarian Agent Agency · Infrastructure Overview · Updated 2026-07-25

Hardware

Local Server SERVER

  • All runtime workloads
  • Ubuntu in WSL2 · native systemd (de-dockered)
  • Cloudflare Tunnel (zero inbound exposure)
  • Dedicated on-premise infrastructure

Laptop — MRC_XPS_2025 LAPTOP

  • All code repos + development
  • Cloudflare Pages Deploy via Wrangler
  • Claude Code sessions
  • No Python, no Docker

Server Architecture: Four Layers

One machine, four layers. Layers 1 and 2 are the box and its rails. Layer 3 is deterministic logic: computed answers, same input, same output, checkable. Layer 4 is fuzzy: LLM-led judgment that scores, drafts and proposes, but never executes on its own. Every behavior in the system lives in exactly one of these layers, and knowing which one is how you reason about it.

Layer 1 · System

Windows Host mrc-office-by-shc

  • Private tailnet (Tailscale) · SSH/RDP landing (Windows cmd)
  • Hosts the WSL2 VM · Alfred's read-only mirrors (rd-memory-read, code-read)
  • Interim bridge: destination is bare-metal Ubuntu

Ubuntu in WSL2 RUNTIME OS

  • All runtime workloads · native systemd (de-dockered)
  • Rooted at /srv/barbarian/ (api · webhooks · config · n8n · rd-memory · backup)
  • Own tailnet node: reach Postgres / n8n / webhooks here
  • NAT'd behind the host · on-box code uses 127.0.0.1

Layer 2 · Tooling & Process (deterministic rails: schedule, transport, store)

n8n (~49 active workflows)

  • The scheduler: decides WHEN, never WHAT
  • Crons in ET · fires HTTP into the webhooks service
  • Scout / Analyst / Coach / Sovereign cadences
  • BAA Queue runners (notion_update · git_commit · email_draft)

Cloudflare Tunnel

  • data.riskdimensions.io · outbound-only
  • Zero inbound ports on the box
  • Fronts FastAPI for Scorecard, PA, seats
  • + Pages (20 projects, 10 custom domains), Workers, DNS

systemd services + timers

  • barbarian-api · barbarian-webhooks · barbarian-n8n
  • Memory drainer every 3 min · hourly pull timers (--ff-only)
  • Alfred context mirror · nightly last-mile check

Postgres 16 (native, main:5432)

  • Schemas: barbarian (113 tables + 16 views) · sovereign (15 + 14) · strategy
  • 5.1M+ price history rows (verified 2026-07-24)
  • Equities, fixed income, crypto, commodities, vol, FX
  • The store every layer reads; the audit trail

GitHub pull lane (riskdimensions org)

  • 11 repos · laptop authors, server pulls hourly
  • Code never originates on the server
  • Server tokens: read all, write rd-memory only
  • CF Pages deploys run from the laptop via Wrangler

Layer 3 · Python Code (deterministic logic: computed answers)

Flask webhooks :5000

  • Every n8n call lands here
  • One endpoint per scheduled agent job
  • Scout / Analyst / Coach / Sovereign registry

FastAPI :8000

  • Serves data.riskdimensions.io/api/*
  • Prices, returns, simulate, treasury
  • PCA loadings · cluster map · intel scalers

Python agents (python -m agents.x.y)

  • Fetchers: FMP, FRED, RSS, Treasury, IMF
  • Engines: PCA, k-means, outlier scan, reconcilers
  • Same input, same output, every time
  • If it is checkable, it lives in this layer

Layer 4 · Agentic Engagement (fuzzy: LLM-led judgment)

The boundary rule

LLM output is advisory, never auto-executed. Deterministic rails execute on schedule; fuzzy judgment scores, drafts and proposes; Mark approves anything outbound or destructive. No Level 4 autonomy.

Connectivity: Tailnet + Tunnel (LAN retired)

Local LAN LAN

  • DEAD for WSL services: NAT hides them from the LAN
  • A LAN ping proves nothing about the server
  • Tailnet is the only road in

Tailnet Mesh PRIMARY

  • Private WireGuard mesh — direct, no relay
  • Tailnet riskdimensions.io (100.x.x.x)
  • Laptop + server + phone
  • RDP / psql / SSH (keyless) / webhooks from anywhere
  • Sole remote path — router port-forwards removed 7/1

Public Tunnel CF TUNNEL

  • data.riskdimensions.io
  • Outbound-only from server
  • Fronts FastAPI for Scorecard, PA,
  • future RD Data API clients
  • Zero inbound ports

Products

The Scorecard ↗

Proprietary risk dashboard. React + Cloudflare Worker proxying FastAPI data.
global-scorecard.riskdimensions.io

Portfolio Analyzer ↗

Multi-asset tear sheets, BTC optimizer, correlation analysis.
portfolio.riskdimensions.io

Sovereign Fiscal Monitor ↗

US debt, deficit, maturity stack & the compounding divergence. Cloudflare Worker: 20-min exploding trial gate (PIN-gated) plus admin PIN + same-origin sovereign API proxy.
sovereign.riskdimensions.io

Company Fundamentals ↗

Single-name research view. Tabs: General / Detail / Comps / Scatter / Bar-Line / Valuing Bitcoin / Bitcoin Network / Stablecoins / Historical Coach, plus a multi-turn Coach dialogue. CF Worker on the Sovereign gate pattern: FMP proxy + Anthropic Coach + Coin Metrics community (BTC/ETH/stablecoin metrics). Valuing Bitcoin tab carries a Cross-Network Comps table (BTC vs ETH vs stablecoins).
fundamentals.riskdimensions.io

Kestrel FLAGSHIP · IN BUILD

The flagship product — a non-stationarity scanner. Same data, three lenses (over time / vs others / vs itself); Pulse / Rationale / Coach inherited from the Scorecard. Two buy lanes: direct + Kestrel for Firms (white-label; "Aviary" retired). Repo riskdimensions/Kestrel; app + landing pending a domain split before deploy.
kestrel.riskdimensions.io (provisioning)

Company Website ↗

Brand + marketing. Authored on the laptop, deployed via Wrangler (no git auto-deploy; verified 2026-07-25).
riskdimensions.io

Substack + NBP Podcast ↗

The Macro Case for Bitcoin. Co-hosted with Bill.
markrconnors.substack.com

Analyst Seats — Data Distribution (Hub & Spoke)

Read-only DB rail

  • db.riskdimensions.io (CF tunnel TCP → Postgres 5432)
  • Group role rd_readonly: SELECT on sovereign + barbarian allowlist
  • Per-seat login role + private seat_* scratch schema (write only there)
  • Tiers: Reader / Contributor (append-only) / Admin
  • Registry: barbarian.db_seats · mig 080

API-key rail

  • api.riskdimensions.io — curated REST
  • Bearer key per seat (barbarian.api_seats)
  • prices / returns / yields; rate-limited
  • First external seat live

Seat Portal ↗

  • rd-seat.pages.dev
  • Per-seat landing: the System, Your Access, How You Work
  • Watered-down architecture (student altitude)
  • Sandbox: rd-sandbox (Colab/Jupyter) + Excel ODBC
Hub & spoke: RD is the hub (canonical read-only data + rails); each seat is a spoke (own tools + isolated scratch). Read the hub → build in your workspace → review → promote into a product. Spec: docs/mentee_data_access_spec.md.

AI Agents — Barbarian Agent Agency (BAA)

Intelligence Pipeline — The Compounding Moat

The power is not in any single agent or piece of code. It is in the orchestration — and in Mark's ongoing engagement that compounds it over time.

The Three-Pass Intel Loop LIVE

INGEST (Scout)
47 RSS sources (5 buckets: macro 18 / crypto 9 / regulatory 8 / ai-builder 7 / credit 5) + FMP news every 4h.
Pass 1: deterministic taxonomy tags each item — sentiment, player lens, theme, notable flag.
SCORE (Coach via Haiku)
Pass 2: Haiku reads the canon + Mark's frameworks, scores each item 1–5, writes a Mark View editorial line at ≥4. Async, non-blocking.
SURFACE (Consumers)
Score ≥4 → Scorecard ticker + Monitor. Score ≥3 → daily brief. Score 5 → Substack seed + RIA flash.

The Alpha Layer — Event to Action to Framework Health LIVE

Scored news compounds into thesis evidence. Each story is distilled to a market-moving action, united across its arc, and tested against RD's canonical frameworks — support or challenge.

EVENT
a scored news story (the report)
ACT
a principal-action: time + player
ACTION
the arc identity binding its acts
THEME
a canonical framework: support / challenge
FRAMEWORK HEALTH
hardening / rot per lens

Tables: story_acts · actions · action_frameworks · frameworks (16 lenses)  ·  Agents: event_action_resolver · event_framework_mapper · framework_health_report

Framework Health  —  Is the world confirming or breaking our theses? Support/challenge per lens, hardening to rot, click-to-expand evidence  ·  121 supporting / 3 challenging (2026-07-24)

The Calibration Loop — Where Compounding Happens

PENDING Calibration email not yet wired — canon + scorer live, automated weekly report is next.

Weekly Review
Monday 7:30 AM
30 min
Canon Edit
Mark adjusts rubric,
voice notes, examples
Better Scoring
Haiku reads updated
canon on next run
Sharper Intel
Signal quality rises
with each session

The canon file is the intellectual moat. It encodes Mark's worldview — 40 years of market pattern recognition — in executable form. Every calibration session makes it more precise. This cannot be replicated without Mark's ongoing engagement. It is uniquely his.

Canon File LIVE

The scoring rubric. Prose, not code. Edits here change Coach's behavior on the next run — no deploy, no ticket. docs/coach_externalevents_curator_canon.md

Calibration Report PENDING

Planned: weekly email Mon 7:00 AM. 7-day aggregated view of Coach's scoring decisions vs. Mark's worldview. Surfaced / Buried / Logic Flags / Action items. Not yet wired.

Feed Monitor LIVE

Admin view at /news on the Scorecard. Full fmp_news table with score badges, Score≥4 filter, and Mark View on hover.

Intelligence Interfaces: How Each Surface Is Resourced

Every LLM-fronted surface, what model it runs, where its prompt lives, what data it reads, and what governs it. One substrate, many mouths: the interactive surfaces all read the same intel context, and the published takes feed back into it, so no surface can contradict another's published data.

The Shared Substrate: GET /api/intel/context LIVE

One context, ~18 blocks, assembled per request and injected into every interactive Coach mode: data freshness (read first), editorial order (TradFi, then Bitcoin, then digital assets; never the word "crypto"), Mark's hot takes, the published Quantimental Takes with their verbatim evidence, prioritized principals, the linkage cascade (move to cause), the full outlier table (every flagged symbol, all asset classes), macro releases with results, G-4 cross-read, mega-cap earnings, player info, the live fiscal backdrop, rolling differentials, featured indicators, sector breadth, the forward 7-day calendar, the news backdrop, and the framework coda.

Anything a card publishes is visible to the Coach asked about it, by construction. Rules registry: docs/coach_doctrine.md (G1-G10, V1-V8); executable governor: agents/coach/coach_render_policy.py.

Data Resources LIVE

A separately gated Equity audit: country/domicile active-name counts, positive-cap counts, and aggregate issuer market capitalization. It is Equity-only and aggregate-only; it does not expose individual securities or API credentials.

Open secured Data Resources → Access remains separate from API-seat authorization.

Surface Runs Model Prompt source Data inputs Governance
RD Intel Pulse (free) Scorecard worker, /api/coach scan Claude Sonnet Coach Canon + scan template (worker) scorecard summary + live RSS wire + full intel context editorial order + vocabulary via intel text
Rationale (subscriber) Scorecard worker, read Claude Sonnet Canon + read template + Substack research digest + full intel context same
Coach chat (client) Scorecard worker, ask Claude Sonnet Canon + ask template + user question, high-signal reads, forward calendar same
Quantimental Takes server take_generator, daily 19:00 ET Claude Haiku shared governor + task prompt + adversarial verify pass per-section outlier slice + framing + calendar catalysts (news gated off) FULL: governor + verify + structural (verbatim numbers, lead-order tier sort, major-token gate, lookback discipline)
Fundamentals Coach Fundamentals worker, /api/coach Claude Sonnet own prompt + server-side FMP tool loop live FMP + on-page data not yet governed, no intel context (known gap)
Coach Pass 2 (batch) server pass2_scorer, every 5 min Claude Haiku curator canon unscored news feeds every surface above; raw scores never shown to clients
Barbarian / Intel Brief server scout agents, daily none (deterministic) n/a scored tables n/a at generation

Intelligence Modules — The Admin Control Layer

Every judgment Mark has encoded — symbol weights, themes, player maps, couplet rules — is exposed here as a clickable tool, not a code file. Adjust a scaler, add a theme, re-route output: one click, no deploy. These tools compound the intel machine with every session.

BAA Operations Console  —  Master launcher for all admin tools  ·  docs/admin_index.html

Intel Configuration

Intel Engine Control Panel LIVE

Symbol weights, player→symbol map, couplet rules, weather regimes, investment themes, output routing. DB-backed Phase 2 — changes take effect on next scorer run (≤5 min).

Tables: barbarian.intel_scalers · 166+ rows · 6 scaler types

Hot Takes Viewer PENDING

Mark's active thesis + reference material from Notion. Feeds Coach Pass 2 context at score ≥4.

Tables: barbarian.hot_takes · Notion DB 111ba5a5...

Output Routing Panel PENDING

Score thresholds driving Scorecard / SM / NBP Podcast. Currently greyed in Intel Engine CP. Trigger: when Producer agent is live.

Tables: barbarian.intel_scalers (output_routing type)

Monitoring & Universe

Securities Master ↗ Scorecard

All tracked symbols — scorecard_active, scorecard_blocks routing, market cap, reference data. The universe definition.

Table: barbarian.securities  ·  Route: /securities

News Monitor ↗ Scorecard

Full fmp_news table — filter by score, tags, date, symbol. Coach Pass 2 output visible here. Events Calendar tab live (4/28).

Table: barbarian.fmp_news

Markets Calendar LIVE

G-10 eco releases + central bank meetings + earnings + IPO. Filter by region, event type, impact, ticker, sector. ~14k earnings rows tickered + sector-tagged via FMP profile (mig 020). Grouped by date with beat/miss surprise tracking. UI filter pending.

Tables: barbarian.macro_calendar · barbarian.fmp_symbol_meta (13.8k symbols, 2026-05-01)

COO Workflow Audit LIVE

n8n workflow inventory, cron schedule audit (UTC→ET), change log, golden snapshot status.

Tables: barbarian.workflow_snapshots · workflow_change_log

Coach Calibration Log PENDING

Weekly scoring drift view. Framework hallucination and voice drift detection. Trigger: after calibration loop is wired.

Table: barbarian.agent_integrity_log

Data Tables — Future Client-Facing Tabs

Live data sources powering the current admin monitors. Each will surface as a tab in a client-facing product.

News Feed LIVE

FMP + 47-source RSS ingested every 4h. Pass 2 scored (Haiku), tagged by sentiment / player lens / framework theme. Currently surfaced in News Monitor admin view.

Table: barbarian.fmp_news  ·  Admin: Scorecard /news ↗

Economic Calendar LIVE

Macro events, Fed meetings, Treasury auctions, earnings. Events tab live in Scorecard /news as of 4/28. Forward calendar for context-aware scoring.

Table: barbarian.macro_calendar  ·  Admin: Scorecard /news → Events tab ↗

Earnings / EPS LIVE

Earnings calendar from FMP `/api/v3/earning_calendar` — ~14k forward-14d rows with ticker + GICS sector (99.97% coverage). Sector enrichment via `barbarian.fmp_symbol_meta` (13.8k FMP equities profile-bulk, 2026-05-01). Feeds forward calendar context for Pass 2 scoring + sector-filterable client view (UI pending).

Tables: barbarian.macro_calendar (event_type='earnings')  ·  barbarian.fmp_symbol_meta  ·  Source: FMP profile-bulk + earning_calendar

Memory Architecture — Compound Intelligence

Master Memory (rd-memory)

Institutional knowledge base. CLAUDE.md, agent specs, frameworks, first principles, brand assets. Loaded into every AI session automatically. The permanent record of how RD thinks and operates.

Agentic Memory

Session-by-session learning. Feedback, preferences, project state, and validated decisions written to persistent memory files. Compounds across every Claude Code session — the system gets smarter with every interaction.

Organic Input

  • Mark's decisions + feedback
  • Session corrections + confirmations
  • Architecture changes + new specs
  • Coach synthesis + framework updates

External Input

  • Scout: FMP news + 47-source RSS (every 4h)
  • Clerk: email ingestion + classification
  • Analyst: FMP price feeds (daily)
  • Notion: CRM, todos, NBP intake

One Memory, Every Model: The Single-Sourced Core

The foundational structure of the Intelligence Engine. Institutional memory is written once and feeds both models and harnesses: the laptop CLIs (Claude, Codex, Gemini) and Alfred, the server-side agent harness, each run a frontier model booted from the same corpus. Three shared source files carry the operating context: agents_primer.md (how to work: hard rules, memory lane, digest format), agents_architecture.md (what you are working on: products, infra, endpoints) and agents_rights_*.md (rights, forked by surface autonomy, never by vendor). The memory cards in memory/*.md carry the compounding knowledge. Each model has its own entry file, but the entry file is only a loader: the content behind it is identical everywhere.

agents_primer + agents_architecture + agents_rights + memory/*.md  →  CLAUDE.md (@import, live)  ·  AGENTS.md / GEMINI.md (generated by context.ps1)  ·  Alfred read mirror (hourly)

Write Once

One corpus in rd-memory: memory cards (one file per fact, indexed by MEMORY.md), the primer, the architecture map, the rights files. No model holds a private fork of doctrine. Edits land in the source files only; the generated copies are never edited by hand.

Per-Model Loaders

Claude: CLAUDE.md pulls the shared files live via @import at every session start, so it can never go stale. Codex reads AGENTS.md, Gemini reads GEMINI.md: both generated snapshots, assembled from the same sources by context.ps1. Alfred reads an hourly read-only mirror on the server (alfred_context_mirror.sh).

Every Open CLI

Any Claude session with rd-memory as primary repo auto-loads the brief. Codex launches through start_codex.ps1, which fast-forwards its dedicated git worktree (branch codex-work), regenerates the brief and copies it in, so Codex never boots blind. However many sessions a model has open, they all read the same memory.

Drift Guards + Containment

Generated briefs carry a sha256 stamp of their sources; check_guard_liveness.ps1 turns RED when a snapshot drifts. Claude sessions are denied blind stages at the tool call (hooks); Codex, which has no per-command permission layer, is contained in its own worktree so a sweep can only collect its own work. Prevention where possible, containment where not.

Claude Memory Architecture  —  How memory loads across every Claude surface · two folders, auto vs on-demand, MCPs, Substack workflow  ·  docs/claude_memory_architecture.html
Counterparty Risk Governance  —  Two risk profiles · ALCO structure · Break Glass Vote · Counterparty rubric · Framework Ratings  ·  docs/counterparty_risk_architecture.html
Liveness Artifact: the laptop / running-system edge  ·  Three evidence levels (documented / observed / live-verified): the laptop authors and builds, but only a live query proves what is running. A server collector renders liveness/current.md (generated, timestamped, fails to UNKNOWN, never a stale snapshot) through the guarded intake queue  ·  docs/liveness_artifact_spec.md

Memory Compounding Loop

Cross-surface memory pipeline. Every CLI/Cowork/Chat session ends with close → Coach scores items 1–5 → SQL INSERT to barbarian.memory_intake_queue → the native drainer (barbarian-memory-drainer.timer, every 3 min; the n8n runner retired 2026-07-06) claims rows, routes by score and writes files to /srv/barbarian/rd-memory, then commits, rebases and pushes in one atomic pass (the /mnt/rd-memory symlink still resolves). Laptop git pull → all surfaces pick up new memory. Notion is no longer in the autonomous path; it stays only for human-decision queues (BAAEC, Clerk ambiguity).

Coach close  →  memory_intake_queue (Postgres)  →  native drainer (3 min)  →  /srv/barbarian/rd-memory  →  git push  →  laptop · Cowork · Chat

Surface load: CLI auto-loads CLAUDE.md + memory/*.md from disk  ·  Cowork loads CLAUDE.md via Global Instructions + /loadrd · /loadops · /loadvoice · /loadframeworks skills  ·  Chat uses Project Knowledge upload (RD Operations, New Barbarians). Manual refresh on Cowork + Chat when CLAUDE.md changes.

Spec: docs/cowork_to_cli_sync_spec.md (v3) · docs/cowork_session_closer.md (v2) · Migration: sql_backfill/019_memory_intake_queue.sql

Three-Location Sync

Laptop (C:\rd-memory)  →  GitHub (riskdimensions/rd-memory)  →  Server (/srv/barbarian/rd-memory) · auto-pull hourly (systemd timer)

Closed-loop, pull-only for code. Author on the laptop → push to GitHub → the server pulls. Both memory (rd-memory-pull.timer) and agent code (barbarian-agency-pull.timer, barbarian-api-pull.timer) auto-pull hourly (--ff-only, as user barbarian) — live since 2026-06-27. The only sanctioned server→GitHub write is rd-memory (memory intake loop). Never live-edit agent code on the server. SSH keyless replaced the retired SMB/robocopy path; the old LAN IP is dead for WSL services.

Exhibit — Data Map

Barbarian Schema — Entity Relationship Diagram

113 tables + 16 views (barbarian) · Clerk · Analyst · Scout · Mixed · Notion CRM layer · External sources · All data flows · ERD may lag schema additions