|
1 | | -# QRAE-RD V0 |
| 1 | +# QRAE QuantOS |
2 | 2 |
|
3 | | -**QRAE-RD** = **Quant Research Agent Engine — Research Director Architecture**. |
| 3 | +QRAE is a local-first, human-gated quantitative research operating system. The repository now contains a real deterministic kernel slice alongside the older staging dashboard. |
4 | 4 |
|
5 | | -Current implementation tag: **V0.9.0 / official V0 full-cycle staging candidate**. |
| 5 | +## Current truth |
6 | 6 |
|
7 | | -This repository is the official V0 scaffold for the CUHK QTS autonomous, human-gated, agent-orchestrated quantitative research pipeline. |
| 7 | +Implemented and tested: |
8 | 8 |
|
9 | | -## Resume here first |
| 9 | +- strict, hash-bound research work orders; |
| 10 | +- point-in-time CSV price contracts and data-quality quarantine; |
| 11 | +- a delayed-fill lagged-momentum baseline with registered entry/liquidation costs and chronological train/validation/test splits; |
| 12 | +- immutable run bundles, atomic latest pointers, and tamper-evident state logs; |
| 13 | +- metric/accounting recomputation, evidence ceilings, claim ledgers, decision records, compact reports, and knowledge records; |
| 14 | +- an optional local Codex broker with fixed tasks, an isolated read-only permission profile, bounded output, no state-promotion authority, and deterministic no-Codex fallback; |
| 15 | +- legacy read-only Vercel dashboard/API views; deployment content may lag this branch and is not execution evidence. |
10 | 16 |
|
11 | | -Future AIs and engineers should begin with: |
| 17 | +Not yet implemented: production market adapters, remote storage/batch adapters, walk-forward and nested model selection, event-driven replay, portfolio/risk engines, ML challengers, a complete Obsidian brain, allocator-grade report generation, authenticated web review, or any paper/live execution system. |
12 | 18 |
|
13 | | -- [`AI_RESUME.md`](AI_RESUME.md) — canonical project handoff containing the user’s requirements, ideas, architecture decisions, safety rules, deployment state, trial outcomes, unresolved gaps, and exact next actions. |
| 19 | +The committed dashboard artifacts and legacy synthetic tournament are demonstrations, not evidence that those missing systems ran. |
14 | 20 |
|
15 | | -The system is designed around one rule: |
| 21 | +## Local quick start |
16 | 22 |
|
17 | 23 | ```text |
18 | | -Scripts search and verify. |
19 | | -Cheap/free AI drafts and implements routine tasks. |
20 | | -Strong AI acts as Research Director only for survivors. |
21 | | -Human approves only important decisions. |
| 24 | +python -m pip install -e ".[full]" |
| 25 | +python -m pytest -q |
| 26 | +python -m qrae.cli run --work-order examples/price_baseline/work_order.json --workspace . --output-root .quantos |
22 | 27 | ``` |
23 | 28 |
|
24 | | -## What this repo contains |
25 | | - |
26 | | -- RD-Agent-style specification/synthesis/implementation/validation/analysis loop. |
27 | | -- Multi-asset opportunity tournament: Polymarket, crypto, ETFs, bonds, equities, macro. |
28 | | -- Deterministic quant truth engine: data validation, backtests, walk-forward, risk, scores. |
29 | | -- RD-Agent-compatible score vector: IC, ICIR, Rank IC, Rank ICIR, ARR, IR, MDD, Calmar. |
30 | | -- QRAE extended score vector: OOS Sharpe, WFE, Sortino, Omega, VaR/CVaR, turnover, data quality, overfit penalty. |
31 | | -- Human-gated Research Director packet flow for ChatGPT Plus/Pro or Gemini CLI, plus a deterministic V0 Research Director surrogate so the no-API pipeline can run end-to-end. |
32 | | -- Vercel/GitHub-ready static dashboard, serverless APIs, cron contracts, notification hooks, MCP placeholders. |
33 | | -- Allocator-style report template and CUHK QTS paper plan. |
34 | | - |
35 | | -## V0 operating mode |
36 | | - |
37 | | -V0 is intentionally **no-paid-API-first**: |
| 29 | +The command prints the immutable run directory. Verify it independently: |
38 | 30 |
|
39 | 31 | ```text |
40 | | -Vercel/GitHub run automation. |
41 | | -The deterministic Research Director surrogate can run automatically for V0 end-to-end validation. |
42 | | -ChatGPT Plus is still the preferred high-quality reviewer for top packets when human review is desired. |
43 | | -Gemini CLI can be used locally for low-cost implementation tasks. |
44 | | -API automation can be added later through the Research Director adapter. |
| 32 | +python -m qrae.cli verify --run-dir .quantos/runs/<run-id> |
45 | 33 | ``` |
46 | 34 |
|
47 | | -No live trading is enabled in V0. |
48 | | - |
49 | | -## Quick start |
50 | | - |
51 | | -```bash |
52 | | -python -m venv .venv |
53 | | -source .venv/bin/activate |
54 | | -pip install -e ".[full]" |
55 | | -pytest -q |
56 | | -python scripts/qrae_readiness.py --env dev |
57 | | -python scripts/qrae_run_cycle.py --cycle-id local_cycle |
58 | | -python scripts/qrae_run_full_v0.py --cycle-id local_full_cycle |
59 | | -python scripts/qrae_smoke.py --pytest |
60 | | -python scripts/run_demo.py |
61 | | -python scripts/qrae_task_pack.py --example |
62 | | -npm ci |
63 | | -npm run typecheck |
64 | | -npm run build |
65 | | -``` |
| 35 | +The bundled dataset is synthetic and its work order is capped at `E0`. It proves mechanics and artifact integrity only. |
66 | 36 |
|
67 | | -The deterministic cycle creates ranked idea cards, a latest digest, and a Research Director packet. |
| 37 | +## Local Codex review |
68 | 38 |
|
69 | | -## V0 dev/prod posture |
| 39 | +Codex is optional and never owns metrics or state transitions. Prepare a fixed review task from a verified run: |
70 | 40 |
|
71 | | -Use the included readiness checker before promotion: |
| 41 | +```text |
| 42 | +python -m qrae.cli codex-prepare --run-dir .quantos/runs/<run-id> --task-id critic-001 --task-kind ADVERSARIAL_CRITIC |
| 43 | +``` |
72 | 44 |
|
73 | | -```bash |
74 | | -python scripts/qrae_readiness.py --env dev |
75 | | -python scripts/qrae_readiness.py --env staging |
76 | | -python scripts/qrae_readiness.py --env prod |
| 45 | +Without an explicit enable flag, execution records a safe `DEFERRED_NO_CODEX` result: |
| 46 | + |
| 47 | +```text |
| 48 | +python -m qrae.cli codex-run --work-order .quantos/codex-work-orders/<run-id>/critic-001.json --workspace .quantos |
77 | 49 | ``` |
78 | 50 |
|
79 | | -`dev` is expected to pass without external services. `staging` is designed to pass without external paid services for V0 preview validation. `prod` intentionally requires database/artifact/notification configuration before it passes. Live trading and automated LLM execution remain disabled in V0. |
| 51 | +To invoke the locally authenticated Codex CLI, repeat with `--enable-codex`. The broker uses a fixed `codex exec` argument vector, hash-checked stdin evidence, an isolated read-only permission profile, disabled action tools/integrations, ignored user config/rules, a strict output schema, streaming time/output bounds, a sanitized environment, and an immutable outbox. It starts no listener and receives no trading or cloud-write credentials. |
80 | 52 |
|
81 | | -## Recommended GitHub/Vercel setup |
| 53 | +## Architecture posture |
82 | 54 |
|
83 | | -1. Push this repository as the initial commit. |
84 | | -2. Import the repo into Vercel. |
85 | | -3. Use `Other` framework preset, `npm ci`, `npm run build`, output `public`. |
86 | | -4. Add `QRAE_ENVIRONMENT=staging` and `QRAE_DISABLE_AUTOMATED_LLM=true`. |
87 | | -5. Add Postgres/Neon, Blob/S3/R2, and Resend later for production. |
88 | | -6. Connect GitHub to ChatGPT for repo reading. |
89 | | -7. Add QRAE MCP connector later for dashboard/artifact access inside ChatGPT. |
| 55 | +- Canonical research state, private alpha, artifacts, and decisions are local. |
| 56 | +- Optional online services may later fetch, store, or batch-process bounded data through hash-verified adapters. |
| 57 | +- Vercel is a deferred sanitized review surface, not the scheduler, database, quant engine, or authority. |
| 58 | +- Research code has no live-order path. Paper, shadow, and live execution require a separate approved OMS/risk/reconciliation system. |
| 59 | +- Data and deterministic artifacts own facts; validators own hard gates; humans own publication, exceptional risk, and capital. |
90 | 60 |
|
91 | | -## Human workflow |
| 61 | +## Repository map |
92 | 62 |
|
93 | 63 | ```text |
94 | | -1. Configure research universes and schedules. |
95 | | -2. Let daily/weekly workflows generate ideas, backtests, WFO, risk, scores. |
96 | | -3. Receive Gmail notification only when candidates survive. |
97 | | -4. Copy Research Director packet into ChatGPT Plus/Pro. |
98 | | -5. Paste the decision back into QRAE. |
99 | | -6. System queues deepen/revise/reject/report action. |
| 64 | +src/qrae/ deterministic contracts, kernel, state, artifacts, baseline, Codex broker |
| 65 | +tests/ positive and negative deterministic tests |
| 66 | +examples/price_baseline/ synthetic E0 work order and price fixture |
| 67 | +scripts/qrae_run_cycle.py compatibility wrapper for the local kernel |
| 68 | +api/ and public/ legacy read-only Vercel review surface |
| 69 | +configs/ legacy runtime, quality, and traceability configuration |
| 70 | +research_base/latest/ committed legacy demonstration artifacts |
100 | 71 | ``` |
101 | 72 |
|
102 | | -## Docs |
| 73 | +## Documentation |
103 | 74 |
|
104 | | -- [`AI_RESUME.md`](AI_RESUME.md) |
| 75 | +- [`docs/LOCAL_KERNEL.md`](docs/LOCAL_KERNEL.md) |
105 | 76 | - [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) |
106 | | -- [`docs/RESEARCH_METHODOLOGY.md`](docs/RESEARCH_METHODOLOGY.md) |
107 | 77 | - [`docs/QUALITY_GATES.md`](docs/QUALITY_GATES.md) |
108 | 78 | - [`docs/REQUIREMENTS_TRACEABILITY.md`](docs/REQUIREMENTS_TRACEABILITY.md) |
109 | | -- [`docs/CUHK_QTS_PAPER_PLAN.md`](docs/CUHK_QTS_PAPER_PLAN.md) |
110 | | -- [`AGENTS.md`](AGENTS.md) |
111 | | -- [`PROJECT_CONTEXT.md`](PROJECT_CONTEXT.md) |
| 79 | +- [`AI_RESUME.md`](AI_RESUME.md) — historical handoff; verify claims against files and tests. |
112 | 80 |
|
113 | 81 | ## Safety status |
114 | 82 |
|
115 | 83 | ```yaml |
| 84 | +local_canonical_state: true |
116 | 85 | live_trading: false |
117 | | -automated_paid_llm: false |
118 | | -source_of_truth: deterministic_artifacts |
| 86 | +public_codex_endpoint: false |
| 87 | +codex_state_promotion: false |
119 | 88 | human_capital_gate_required: true |
120 | 89 | ``` |
0 commit comments