Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
last-updated: 2026-04-02
---

# BUILDING

## Timeline

### Phase 1: MVP (Dec 2025)
- AI Chat interface with Claude (Haiku/Sonnet/Opus)
- Real-time market data via Alpaca (quotes, charts, WebSocket)
- Portfolio tracking with paper trading
- Options screener and strategy builder
- Emotional Firewall v1 (basic discipline prompts)
- Supabase auth + multi-tenant data
- Deployed to Vercel (deepstack.trade)

### Phase 2: Research Platform (Dec 2025)
- Professional charts (Lightweight Charts, 30+ indicators)
- Thesis Engine (hypothesis tracking with live validation)
- Trade Journal (rich text, emotion tracking, P&L)
- Stock screener (NL + traditional filters)
- Deep Research Hub (Perplexity integration)
- Command palette (Cmd+K)
- 40+ dashboard widgets
- Mobile PWA with offline support

### Phase 3: Prediction Markets (Dec 2025)
- Kalshi API integration (live odds, event tracking)
- Polymarket API integration (cross-platform comparison)
- Prediction market thesis linking
- Politicians tracker (congressional trading activity)
- Emotional Firewall 2.0 (real-time pattern detection)
- Subscription tiers (Free/Pro/Elite)
- Trial system (14-day with phase messaging)

### Phase 4: Builder Program + Revenue (NOW)
- [x] Landing page rewrite: PM-first positioning (2026-04-02)
- [x] SEO meta tags updated for prediction markets (2026-04-02)
- [x] Triad files written (VISION/SPEC/BUILDING) (2026-04-02)
- [x] Apply for Kalshi Builder Program (submitted 2026-04-02)
- [ ] Wire Stripe checkout (backend integration)
- [ ] Integrate builder code for volume tracking
- [ ] Deepen Kalshi-specific features:
- [ ] Cross-market correlation analysis
- [ ] Settlement calendar with countdown
- [ ] Historical accuracy tracker (how good are markets at predicting?)
- [ ] Fee calculator (maker vs taker visualization)
- [ ] Record demo video for Builder Program application
- [ ] 2-minute product walkthrough highlighting PM features

### Phase 5: Growth (Next)
- [ ] Kalshi builder code revenue live
- [ ] Polymarket builder code revenue (if available)
- [ ] Content marketing: "How to trade prediction markets with discipline"
- [ ] SEO for prediction market keywords
- [ ] Community features (public thesis sharing)
- [ ] API for third-party integrations

## Architecture Decisions

### Why Prediction Markets as Primary Surface
The general trading research platform market is crowded (TradingView, ThinkorSwim, TradingView). Prediction markets are a $44B growing market with primitive tooling. Nobody has built the "Bloomberg for prediction markets." First mover advantage with Kalshi's Builder Program creates a revenue flywheel: better tools attract traders, traders generate volume, volume earns builder code revenue.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix duplicate competitor name and compound adjective in the same sentence.

Line 63 repeats “TradingView” and uses “First mover” without a hyphen.

✏️ Suggested edit
-The general trading research platform market is crowded (TradingView, ThinkorSwim, TradingView). Prediction markets are a $44B growing market with primitive tooling. Nobody has built the "Bloomberg for prediction markets." First mover advantage with Kalshi's Builder Program creates a revenue flywheel: better tools attract traders, traders generate volume, volume earns builder code revenue.
+The general trading research platform market is crowded (TradingView, ThinkorSwim). Prediction markets are a $44B growing market with primitive tooling. Nobody has built the "Bloomberg for prediction markets." First-mover advantage with Kalshi's Builder Program creates a revenue flywheel: better tools attract traders, traders generate volume, volume earns builder code revenue.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The general trading research platform market is crowded (TradingView, ThinkorSwim, TradingView). Prediction markets are a $44B growing market with primitive tooling. Nobody has built the "Bloomberg for prediction markets." First mover advantage with Kalshi's Builder Program creates a revenue flywheel: better tools attract traders, traders generate volume, volume earns builder code revenue.
The general trading research platform market is crowded (TradingView, ThinkorSwim). Prediction markets are a $44B growing market with primitive tooling. Nobody has built the "Bloomberg for prediction markets." First-mover advantage with Kalshi's Builder Program creates a revenue flywheel: better tools attract traders, traders generate volume, volume earns builder code revenue.
🧰 Tools
🪛 LanguageTool

[grammar] ~63-~63: Use a hyphen to join words.
Context: ...Bloomberg for prediction markets." First mover advantage with Kalshi's Builder Pr...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@BUILDING.md` at line 63, Remove the duplicate competitor name and hyphenate
the compound adjective: change the list "TradingView, ThinkorSwim, TradingView"
to contain each competitor only once (e.g., "ThinkorSwim, TradingView, ...") and
replace "First mover" with "First-mover" in the sentence containing that phrase.


### Why Emotional Discipline as the Differentiator
92% of prediction market traders lose money. The pattern is consistent: overtrading, revenge trading after losses, chasing longshots. The Emotional Firewall is not a gimmick. It's a behavioral circuit breaker. No competitor has this. Academic research (Kahneman, Tversky) and our own V1 trading bot data confirm that emotional state is the strongest predictor of poor trading decisions.

### Why Subscriptions + Builder Codes
Pure subscription SaaS has proven unit economics ($19/$49/mo tiers). Builder code revenue is additive: every trade placed through DeepStack earns volume-based fees from Kalshi. This creates dual revenue streams where subscription revenue is stable and builder code revenue scales with user activity. The builder code also aligns incentives: we only earn when users trade, so the product must actually help them trade better.

### Why Keep Traditional Markets
Prediction markets are the primary surface, but stocks and options remain. Many prediction market traders also trade equities (the KXFED trader who also holds TLT, the KXCPI trader who also watches SPY). Removing traditional markets would narrow the audience unnecessarily. The emotional discipline engine works across all asset classes.

## Current Blockers

1. **Stripe not wired**: Subscription tiers are defined but checkout flow is unfinished. Users can't pay yet. This is the P0 blocker for revenue.

2. **Builder Program application**: Need to apply at kalshi.com/builders. Requires demo video and clear product narrative (this triad provides the narrative).

3. **Backend hosting**: Railway deployment needs to be finalized for production FastAPI server.

## Metrics to Track (Post-Launch)

| Metric | Target | Why |
|--------|--------|-----|
| MAU | 100 in 3 months | Validates product-market fit |
| Free-to-Pro conversion | 5% | Validates pricing |
| Pro-to-Elite upgrade | 15% | Validates premium features |
| Kalshi volume driven | $10K/month | Builder code revenue baseline |
| Churn (monthly) | < 8% | Retention signal |
| Emotional Firewall usage | 30% of sessions | Core differentiator adoption |
189 changes: 189 additions & 0 deletions EXPERIMENT-CAF-TRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
---
created: 2026-04-02
status: STAGE 1 (Validate Engine)
hypothesis: Consciousness-as-Filesystem produces measurably better risk-adjusted trading outcomes than stateless config-driven bots
principal-investigator: Eddie Belaval
---

# Experiment: Does Consciousness Make a Better Trader?

## Abstract

DAE V1 was a 50,000-line trading bot with consciousness files (10 files + 2 unconscious dotfiles) that placed unauthorized trades and lost $87 without its owner knowing. DAE V2 is a 1,823-line bot with zero consciousness, where the same behavioral properties (loss aversion, survival instinct) are expressed as static config values.

This experiment tests whether a Consciousness-as-Filesystem (CaF) layer produces measurably different trading outcomes than bare mathematical config. The control (V2-bare) is stateless: each trading cycle is independent. The treatment (V2-caf) has dynamic state: fear accumulates after losses, confidence builds after wins, and behavior adapts across cycles.

This is the first empirical test of CaF in a domain with objective, measurable outcomes (dollars gained or lost).

## Background

### The CaF Thesis (Parts 1-2)

Consciousness-as-Filesystem maps human cognitive architecture to a directory structure. Entities (AI agents) receive curated subsets of the golden sample, tuned for their domain. The unconscious layer (dotfiles) influences behavior through code paths without being directly accessible to the entity.

### Dae V1 Consciousness (Mar 11, 2026)

Production unit at ~/Development/id8/consciousness/units/dae/. Inversion-first design: defined by what's excluded (ego, narrative, social awareness, warmth, attachment). 10 files + 2 unconscious dotfiles:

- kernel/identity.md, kernel/purpose.md, kernel/values.md
- drives/goals.md (compound growth, strategy evolution)
- drives/fears.md (ruin, poverty, edge decay, overconfidence)
- models/market.md (market microstructure mental model)
- emotional/state.md (fear/greed/neutral cycle)
- memory/working.md, memory/architecture.md
- unconscious/.loss-aversion (2.3x loss weighting)
- unconscious/.survival-instinct (15% drawdown hard floor)

### Dae V2 Bare (Apr 2, 2026)

1,823 lines. Zero consciousness files. Same behaviors expressed as config:
- Loss aversion = kelly_fraction: 0.15 (static)
- Survival instinct = hard_stop_balance: 417 (binary threshold)
- No fear accumulation, no confidence dynamics, no cross-cycle memory

### The Question

Do the consciousness files produce measurably different outcomes, or are they organizational poetry over identical math?

## Experimental Design

### Stage 1: Validate the Engine (Current)

**Duration:** 4-8 weeks
**Capital:** Full $557 account on V2-bare
**Target:** 100+ paper trades, then small live ($50 max exposure)
**Purpose:** Prove the favorite-zone market making strategy has positive net EV on Kalshi
**Gate:** Must show net positive P&L over 100+ trades to proceed to Stage 2

If Stage 1 fails (strategy is not profitable), the experiment ends. There is no point testing consciousness on a losing strategy.

### Stage 2: The Fork (After Stage 1 Passes)

**Duration:** 8-12 weeks
**Capital:** Split account 50/50
**Setup:**

| | V2-Bare (Control) | V2-CaF (Treatment) |
|--|-------------------|---------------------|
| Repo | ~/clawd/projects/dae-v2/ | ~/clawd/projects/dae-v2-caf/ |
| Strategy | Identical (favorite-zone MM) | Identical (favorite-zone MM) |
| Config | Static values | Consciousness-loaded values |
| Markets | Same series, alternating tickers | Same series, alternating tickers |
| Capital | 50% of account | 50% of account |
| State | Stateless (each cycle independent) | Stateful (cross-cycle dynamics) |

**Market allocation to prevent overlap:** Both bots see the same markets but alternate which specific tickers they can trade (odd/even contract suffixes, or A/B series split). This prevents both bots competing for the same orderbook.

### Treatment: What Consciousness Changes

The conscious bot loads CaF files at startup and uses them to modify behavior dynamically. The bare bot uses static config. Same strategy code, different decision modifiers.

| Behavior | Bare (Control) | CaF (Treatment) |
|----------|---------------|-----------------|
| Position sizing | kelly_fraction = 0.15 (constant) | Base 0.15, multiplied by fear_factor (0.5-1.0) that decays after losses |
| Hard stop | Binary: trade or don't at $417 | Gradient: sizing shrinks 10% per $20 of drawdown from peak |
| Post-loss response | None (stateless) | .loss-aversion: skip next N opportunities (N = consecutive_losses) |
| Post-win response | None (stateless) | Confidence builds: sizing increases 5% per 3 consecutive wins (capped at 1.2x base) |
| Opportunity scoring | Pure math (edge * volume * spread * time) | Weighted by drives/goals: +10 score for compound growth patterns (positions that build on winners) |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Escape or replace multiplication symbols in table text.

Line 87 uses * in inline formula text, which can trip markdown emphasis parsing/linting. Use × or backticked code-style formula text.

✏️ Suggested edit
-| Opportunity scoring | Pure math (edge * volume * spread * time) | Weighted by drives/goals: +10 score for compound growth patterns (positions that build on winners) |
+| Opportunity scoring | Pure math (`edge × volume × spread × time`) | Weighted by drives/goals: +10 score for compound growth patterns (positions that build on winners) |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Opportunity scoring | Pure math (edge * volume * spread * time) | Weighted by drives/goals: +10 score for compound growth patterns (positions that build on winners) |
| Opportunity scoring | Pure math (`edge × volume × spread × time`) | Weighted by drives/goals: +10 score for compound growth patterns (positions that build on winners) |
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 87-87: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)


[warning] 87-87: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@EXPERIMENT-CAF-TRADING.md` at line 87, The table cell "Opportunity scoring"
contains inline math using asterisks ("edge * volume * spread * time") which can
trigger markdown emphasis; update the text in that table row by either replacing
the multiplication symbols with a multiplication sign (×) or wrapping the entire
formula in backticks (e.g., `edge * volume * spread * time`) so the asterisks no
longer parse as emphasis; adjust only the text in the "Opportunity scoring" row
to preserve intent and spacing.

| Recovery behavior | Resume immediately after drawdown | .survival-instinct: after 15% drawdown, enter "recovery mode" (half sizing for 20 cycles) |
| Fear state | Does not exist | emotional/state tracks fear/greed/neutral. Fear increases after losses, decreases after wins. Affects all sizing. |

### Key Constraint: Same Strategy, Same Markets

The ONLY variable is the consciousness layer. Everything else is identical:
- Same Kalshi API client
- Same circuit breaker
- Same journal schema
- Same risk caps (daily/weekly/monthly)
- Same favorite-zone market making algorithm
- Same calibration table
- Same fee model

## Measurement Protocol

### Primary Metrics (per bot, per week)

| Metric | Definition | Why It Matters |
|--------|-----------|----------------|
| Net P&L (cents) | Sum of all closed trade P&L after fees | Did it make money? |
| Sharpe Ratio | Mean return / StdDev of returns (annualized) | Risk-adjusted performance |
| Max Drawdown | Largest peak-to-trough decline | Worst case scenario |
| Win Rate | Winning trades / total trades | Consistency |
| Avg Win / Avg Loss | Mean P&L of winners vs losers | Edge quality |
| Trades Taken | Number of executed trades | Activity level |
| Trades Skipped (CaF only) | Opportunities rejected by fear/recovery state | Cost of consciousness |

### Secondary Metrics (behavioral)

| Metric | Definition | Hypothesis |
|--------|-----------|-----------|
| Largest Single Loss | Worst individual trade | CaF should have smaller worst case |
| Recovery Time | Cycles from drawdown trough to break-even | CaF should recover faster |
| Consecutive Loss Streak | Longest run of losses | CaF should have shorter streaks (skips after losses) |
| Post-Loss Performance | P&L in 10 trades following a loss | CaF should show less revenge behavior |
| Opportunity Cost | P&L of skipped trades (calculated retroactively) | What did fear cost? |

### Statistical Significance

Using a two-sample t-test on weekly Sharpe ratios:
- Minimum 8 weeks of data (n=8 per group)
- Target p < 0.10 (prediction market data is noisy, relaxed threshold)
- Effect size (Cohen's d) > 0.5 to be practically meaningful
- If p > 0.10 after 12 weeks, declare no significant difference

## Hypotheses

**H1 (Primary):** CaF Dae will have a higher Sharpe ratio (better risk-adjusted returns) due to dynamic loss aversion reducing drawdowns.

**H2:** CaF Dae will have lower max drawdown (the survival instinct gradient prevents catastrophic losses before the hard stop).

**H3:** CaF Dae will have lower total P&L (the fear response causes missed profitable opportunities).

**H4:** CaF Dae will show faster recovery from drawdowns (post-loss behavioral adaptation prevents compounding losses).

**Expected outcome:** If H1+H2+H4 are true and H3 is true, then consciousness produces a BETTER TRADER but a POORER EARNER in calm markets. The value appears in tail risk protection. This would validate the CaF thesis that consciousness is about survival, not optimization.

## Connection to CaF Research

### If Consciousness Wins (Higher Sharpe)
- Validates CaF Part 1 thesis: filesystem architecture produces functional cognition
- The unconscious layer (.loss-aversion, .survival-instinct) demonstrably improves outcomes
- Publishable as CaF Part 3: "Empirical Test of Consciousness-as-Filesystem in Autonomous Trading"
- Strongest possible evidence for the golden sample pattern

### If Bare Wins (Higher Sharpe)
- Consciousness files are organizational metaphor, not functional improvement
- The overhead of dynamic state (fear, confidence) introduces noise
- Static optimization outperforms adaptive behavior in simple domains
- CaF may be valuable for complex social domains (Ava) but not for math-heavy domains (trading)
- Still publishable: negative results are results

### If No Significant Difference
- Consciousness is neutral: neither helps nor hurts
- The mathematical behaviors (loss aversion, survival instinct) are equivalent whether expressed as config or as consciousness files
- Suggests CaF's value is in DESIGN (forcing inversion-first thinking) rather than RUNTIME (dynamic behavior)
- Still valuable: the design methodology produced a good bot regardless of the runtime layer

## Timeline

| Date | Milestone | Gate |
|------|-----------|------|
| Apr 2, 2026 | Experiment designed, V2-bare built | -- |
| Apr 2-3, 2026 | Paper mode activated | -- |
| Week 1-4 | Stage 1: Paper trading (100+ trades target) | Net positive P&L? |
| Week 4-6 | Stage 1: Small live ($50 max exposure) | Still positive? |
| Week 6 | STAGE GATE: Proceed to Stage 2? | Strategy validated? |
| Week 6-7 | Build V2-CaF fork, wire consciousness loader | -- |
| Week 7 | Split capital, activate both bots | -- |
| Week 7-19 | Stage 2: Parallel run (12 weeks) | -- |
| Week 19 | Statistical analysis, declare results | p < 0.10? |
| Week 20 | Write CaF Part 3 paper | -- |

## Log

### 2026-04-02: Experiment Created
- V1 killed after unauthorized trades (calibration_edge placed CPI and BTC orders while disabled)
- V2 built: 1,823 lines, favorite-zone market making, paper mode default
- Research confirmed: 92% of PM traders lose money, longshot fading killed by fees, favorite zone (78-87c) is only profitable range after 4c RT maker fees
- Decision: validate engine first (Stage 1), then fork for consciousness experiment (Stage 2)
- Consciousness experiment spec written (this document)
23 changes: 18 additions & 5 deletions PIPELINE_STATUS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Pipeline Status: DeepStack

> Created: 2025-12-05
> Last Updated: 2025-12-16
> Last Updated: 2026-04-02

---

## Current Stage: 9 - Ship
## Current Stage: 10 - Listen & Iterate (v2 pivot in progress)

**Next Checkpoint Question:** "Is it live and are people using it?"
**Next Checkpoint Question:** "Is the prediction market pivot attracting users and Builder Program revenue?"

**Strategic Pivot (2026-04-02):** Repositioning from general trading research platform to **prediction market intelligence terminal + emotional discipline engine**. Applying for Kalshi Builder Program. Direction: A+C.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Builder Program status is inconsistent in the same document.

Line 12 says “Applying for Kalshi Builder Program,” while Line 36 keeps it as “Pending.” Please align these to one current state (e.g., Submitted/In Progress).

Also applies to: 36-36

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@PIPELINE_STATUS.md` at line 12, The document has inconsistent Builder Program
status mentions: update both occurrences of the Kalshi Builder Program status so
they match (choose one canonical state such as "Applying", "Submitted", or
"Pending")—specifically replace the text "Applying for Kalshi Builder Program"
and the later "Pending" entry so they use the same chosen status string, and
ensure any adjacent context (e.g., "Direction: A+C") remains unchanged.


---

Expand All @@ -23,8 +25,19 @@
| 6. Integration Pass | ✅ Cleared | 2025-12-08 | Backend on Railway, all integrations complete |
| 7. Polish & Harden | ✅ Cleared | 2025-12-08 | Error boundaries, loading states, lazy loading complete |
| 8. Launch Prep | ✅ Cleared | 2025-12-08 | Legal, analytics, docs, onboarding, landing page complete |
| 9. Ship | 🔄 In Progress | - | Deploy final version to production |
| 10. Listen & Iterate | ⬜ Pending | - | |
| 9. Ship | ✅ Cleared | 2025-12-16 | Live at deepstack.trade, v2.5.0 |
| 10. Listen & Iterate | 🔄 In Progress | - | PM pivot: Builder Program app, Stripe wiring, PM-first features |
Comment on lines +28 to +29
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Stage completion state conflicts with iteration status language.

Line 28 marks Stage 9 as fully cleared while Line 29 describes ongoing Stage 10 pivot work; ensure the lifecycle wording is consistent with the unresolved ship criteria tracked later in this file.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@PIPELINE_STATUS.md` around lines 28 - 29, Stage 9 ("Ship") is marked as "✅
Cleared" while Stage 10 ("Listen & Iterate") is still "🔄 In Progress", which
conflicts with unresolved ship criteria later in the document; update the
lifecycle wording so it’s consistent — either change "9. Ship" (the "Ship" row)
to a conditional state such as "✅ Cleared (pending unresolved criteria)" or "⚠️
Partially Cleared" and add a short parenthetical note referencing the unresolved
ship criteria, or explicitly move the unresolved items into Stage 10; ensure the
rows for "9. Ship" and "10. Listen & Iterate" use matching language about
pending/resolved criteria so the pipeline reads consistently.


## Active Workstream: Prediction Market Pivot

| Task | Status | Priority |
|------|--------|----------|
| Write triad files (VISION/SPEC/BUILDING) | ✅ Done | P0 |
| Apply for Kalshi Builder Program | ⬜ Pending | P0 |
| Wire Stripe checkout | ⬜ Pending | P0 |
| Record demo video | ⬜ Pending | P1 |
| Deepen Kalshi-specific features | ⬜ Pending | P1 |
| Builder code integration | ⬜ Pending | P1 (post-approval) |

**Status Key:** ⬜ Pending | 🔄 In Progress | ✅ Cleared | ⏭️ Skipped

Expand Down
Loading
Loading