LIGHTLIGHT (thelight) is an evidence-driven quantitative research system with a bounded Alpaca PAPER execution runtime. Its purpose is to make strategy research, decision state, broker execution, and recovery inspectable and reproducible. It is not a profitability claim and it has no live-money execution path.
Deterministic quantitative signals should remain independently reproducible. Typed model outputs may assist regime classification or strategy gating, while deterministic code retains decision, risk, sizing, and execution authority.
market data
-> deterministic features
-> candidate strategy
-> optional typed classification
-> deterministic policy
-> deterministic risk
-> PAPER execution
-> durable evidence
-> independent evaluation
The model does not calculate indicators, position sizing, P&L, or broker authority, and it does not receive free-form BUY/SELL control.
The repository now contains both a research plane and a PAPER execution plane.
| Runtime | Market data | Strategy | Authority |
|---|---|---|---|
| SPY / 15Min | Alpaca IEX via the bounded market path | ema_trend / Arm C |
PAPER dispatch capable |
| SPY / 1Min | Alpaca IEX via the bounded market path | ema_rsi_v1 |
PAPER dispatch capable |
| QQQ / 1Min | bounded equity runtime | ema_rsi_v1 |
read-only durable evidence |
| IWM / 1Min | bounded equity runtime | ema_rsi_v1 |
read-only durable evidence |
| AAPL / 1Min | bounded equity runtime | ema_rsi_v1 |
read-only durable evidence |
| MSFT / 1Min | bounded equity runtime | ema_rsi_v1 |
read-only durable evidence |
| BTC/USD / 1Min observations | continuous Alpaca crypto WebSocket | market evidence only | READ_ONLY_DURABLE; broker authority NONE |
Only SPY currently has broker dispatch authority. Multi-equity and BTC capability boundaries are intentionally narrower than their market-data/evidence capabilities.
The September 22, 2026 SPY PAPER session exercised the live path through closed bars, deterministic decisions, fenced dispatch, Alpaca PAPER fills, broker reconciliation, trade updates, position observations, and durable Postgres evidence. That run is evidence that the execution harness operates end-to-end; it is not evidence that the current strategy has positive expectancy.
- PAPER only. No live-money Alpaca domain is supported.
- Broker account, position, open orders, and broker order state are authoritative for execution truth.
- Dispatch is single-owner across processes through a Postgres lease and monotonic fencing token.
UNKNOWNandSUBMISSION_ATTEMPTEDrecovery fail closed; uncertainty never authorizes a retry.- Alpaca
trade_updatesare retained as durable evidence and correlated to deterministic client-order identities. - Terminal intent projection is monotonic: a confirmed fill cannot be regressed by a delayed nonterminal broker observation.
- Market-data gaps invalidate continuity and must be recovered and verified before dispatch resumes.
- Vercel serves the web boundary only; it never owns the long-lived PAPER worker.
- Non-SPY runtimes do not receive broker authority merely because they can persist market evidence.
Use Node.js 22 and the checked-in lockfile.
npm ci
cp .env.example .env
npm run devKeep credentials in the untracked .env. A durable DATABASE_URL is required for PAPER dispatch authority.
npm run typecheck
npm run lint
npm run test:lightlight
npm run buildThe ownership integration suite uses a real configured database and makes no Alpaca order request:
npm run test:alpaca-worker-ownershipnpm run btc:worker -- start
npm run btc:observe -- --once
npm run btc:observeThe worker requires durable DATABASE_URL and ALPACA_API_KEY_ID /
ALPACA_API_SECRET_KEY; native Node environment loading reads an optional .env
without overriding host variables. Apply existing migrations before first start.
Run on an always-on host; stop gracefully with SIGINT (Ctrl+C) or SIGTERM.
The observer only needs DATABASE_URL and opens a read-only database session.
BTC has zero broker authority and zero order submission. It persists completed
BTC/USD minute bars, worker runs, a fenced lease and an owned checkpoint. Reconnect
is bounded inside the source; restart uses a new run and preserves prior evidence.
The observer reports lease, subscription, bar/checkpoint freshness, reconnect and
halt evidence. A three-minute bar-age threshold is operational only, active 24/7.
Exact historical BTC recovery repairs missing closed minutes using fully paginated
Alpaca US crypto bars, with REST_BACKFILL provenance and fenced writes. Startup
verification is bounded to 24 hours; failures halt with visible GAP_DETECTED
continuity. npm run btc:historical-smoke manually verifies three completed
minutes without database or broker mutation.
See BTC operation and soak procedure.
Next BTC milestone: PAPER execution after an observation soak, not strategy optimization.
Default SPY worker:
npm run alpaca:worker -- startThe 1-minute EMA/RSI arm can be selected explicitly:
npm run alpaca:worker -- start --arm ema_rsi_v1 --symbol SPYRead-only durable observer:
npm run alpaca:observe -- --arm ema_rsi_v1 --symbol SPY --verboseThe observer requires DATABASE_URL only. It does not acquire dispatch ownership or use Alpaca credentials.
Read-only smoke paths:
npm run alpaca:worker:smoke -- --observe-only
npm run alpaca:crypto-smokeSee docs/ALPACA_PAPER_WORKER.md for authority, recovery, and operator semantics.
- Make durable
worker_runslifecycle state faithfully trackSTARTING -> RECONCILING -> READYand terminal states. - Package PAPER sessions as immutable experiment manifests that reference existing durable evidence.
- Make offline replay reproduce live decision and execution timing before comparing PAPER and historical results.
- Improve operator telemetry so no-position-change reconciliation is not visually confused with a broker cancellation.
- Complete repository/main-branch consolidation and remove merged stale branches.
- Only then resume strategy iteration, starting with prospectively defined turnover-suppression experiments.
- Regular-hours eligibility uses a weekday/time heuristic rather than a full exchange calendar.
ema_rsi_v1thresholds are uncalibrated research heuristics; the September 22 run showed substantial short-horizon churn.- PAPER execution timing observed live must still be encoded exactly in the evaluator/replay contract.
- Formal immutable
ExperimentRunpackaging is not yet implemented. - Multi-symbol PAPER authority does not exist; portfolio-level exposure and arbitration controls are intentionally deferred.
- The bounded equity relay contract requires explicit subscription-union behavior before multi-symbol live evidence collection is considered complete.
- BTC/USD is read-only durable infrastructure, not a PAPER execution runtime.
- The repository still contains inherited app-builder/Grok substrate that requires a dependency-aware cleanup rather than blind deletion.
- Project status — current implementation, proven boundaries, known gaps, and branch state.
- Architecture — research/execution boundaries and causal invariants.
- Evidence contract — decision/execution provenance and immutability.
- Experiment contract — reproducibility and controlled-comparison rules.
- Alpaca PAPER worker — dispatch authority, reconciliation, persistence, and operator controls.
- BTC PAPER runtime — B0-B3 foundation, continuous read-only operation, soak procedure and deferred execution scope.
- Relay capability — bounded single-upstream equity subscription contract.
- Execution model — causal fills, accounting, and unknown execution state.
- Roadmap — current milestones and sequencing.
npm run research:paper-session -- --strategy ema_rsi_v1 --symbol SPY --date 2026-09-23
exports and analyzes existing durable evidence using DATABASE_URL only. Offline
fixtures require no database or broker access. ema_rsi_v2 is a frozen research
candidate, not a registered PAPER worker arm; V1 and execution authority are unchanged.
See reproduction and evidence limits,
prospective specification, and
development results.