Skip to content
Draft
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
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
value: |
Use this for defects in **this** repo (gateway, validator, challenges, deploy).
Security issues: do **not** file here — see [SECURITY.md](../SECURITY.md).
Miner-facing public repos are separate (design-challenge / prism).
Miner-facing public repo is [CortexLM/relearn](https://github.com/CortexLM/relearn).
- type: textarea
id: summary
attributes:
Expand All @@ -22,8 +22,8 @@ body:
options:
- gateway
- validator
- design-challenge
- prism-challenge
- relearn-challenge
- bounty-challenge
- deploy / compose
- docs
- other
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ blank_issues_enabled: true
contact_links:
- name: Miner submit docs
url: https://github.com/CortexLM/cortex/blob/main/docs/external-miner/README.md
about: HTTP submit guides live in docs/external-miner (and the public design-challenge / prism repos).
about: HTTP submit guides live in docs/external-miner and the public CortexLM/relearn repo.
- name: Security report
url: https://github.com/CortexLM/cortex/security/advisories/new
about: Private vulnerability reporting — do not file a public issue.
37 changes: 1 addition & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,49 +64,14 @@ jobs:
- name: compose matrix assertions
run: bash deploy/scripts/assert-compose-matrix.sh

# Prism v3 harness smokes: fixture-size, G4 tuple concat, and torch-seed
# overflow class bugs shipped once because CI never ran the harness
# end-to-end. CPU wheels keep the runner cheap; both smokes must pass
# (they assert all 8 battery groups ok + the flat org.* / mirrors blob
# the Rust composite ingests).
harness-smoke:
name: prism harness smokes (cpu torch)
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: crates/prism-recipe/harness

- name: Install cpu torch + transformers + pyarrow
run: |
python -m pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install transformers pyarrow

- name: python -m compileall
run: python -m compileall crates/prism-recipe/harness

- name: smoke_local (v1 contract flow)
run: python crates/prism-recipe/harness/tests/smoke_local.py

- name: smoke_battery (v3 G1-G8 battery + rollup contract)
run: python crates/prism-recipe/harness/tests/smoke_battery.py

# ---------------------------------------------------------------------------
# Auto-deploy staging. Lives here rather than in deploy-staging.yml so that
# `needs: ci` keeps the CI-green ordering on every push to main.
# deploy-staging.yml remains for manual re-deploys.
# ---------------------------------------------------------------------------
deploy-staging:
name: deploy staging ${{ matrix.role }}
needs: [ci, harness-smoke]
needs: [ci]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 120
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/ghcr-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ jobs:
"base/gateway"
"base/validator"
"base/updater"
"base/prism-challenge"
"base/design-challenge"
"base/design-egress-proxy"
"base/design-runtime"
"base/relearn-challenge"
"base/bounty-challenge"
)
ok=0
# First list packages to Learn exact names (debug)
Expand Down
38 changes: 11 additions & 27 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,11 @@ jobs:
- target: updater
image_suffix: updater
dockerfile: deploy/Dockerfile
- target: prism-challenge
image_suffix: prism-challenge
- target: relearn-challenge
image_suffix: relearn-challenge
dockerfile: deploy/Dockerfile
- target: design-challenge
image_suffix: design-challenge
dockerfile: deploy/Dockerfile
- target: design-egress-proxy
image_suffix: design-egress-proxy
dockerfile: deploy/Dockerfile
- target: design-runtime
image_suffix: design-runtime
dockerfile: deploy/Dockerfile
- target: design-review
image_suffix: design-review
- target: bounty-challenge
image_suffix: bounty-challenge
dockerfile: deploy/Dockerfile
- target: ""
image_suffix: base-attest-helper
Expand Down Expand Up @@ -285,11 +276,8 @@ jobs:
"validator",
"gateway",
"updater",
"prism-challenge",
"design-challenge",
"design-egress-proxy",
"design-runtime",
"design-review",
"relearn-challenge",
"bounty-challenge",
"base-attest-helper",
}
assert set(images) == expected, (set(images), expected)
Expand Down Expand Up @@ -357,10 +345,10 @@ jobs:
cp "$SRC" "deploy/digests/${SHA}.json"
echo "Recorded digest manifest: deploy/digests/${SHA}.json"
chmod +x deploy/scripts/promote.sh
# Pin services only (validator/gateway/updater/prism-challenge/design-challenge).
# Pin services only (validator/gateway/updater/relearn-challenge/bounty-challenge).
# --skip-backup: this job records CI digests; Spaces/PG backup runs at
# prod promote (deploy-prod.yml, fail-closed).
for svc in validator gateway updater prism-challenge design-challenge; do
for svc in validator gateway updater relearn-challenge bounty-challenge; do
IMAGE=$(python3 -c '
import json, sys
d = json.load(open(sys.argv[1]))
Expand All @@ -379,7 +367,7 @@ jobs:
import json, sys
p = json.load(open("deploy/pins/staging.json"))
assert p["commit_sha"] == sys.argv[1], (p["commit_sha"], sys.argv[1])
for s in ("validator", "gateway", "updater", "prism-challenge", "design-challenge"):
for s in ("validator", "gateway", "updater", "relearn-challenge", "bounty-challenge"):
assert s in p["services"], s
assert p["services"][s]["digest"].startswith("sha256:")
print("staging pins ok", p["commit_sha"])
Expand Down Expand Up @@ -426,12 +414,8 @@ jobs:
"base/gateway"
"base/validator"
"base/updater"
"base/prism-challenge"
"base/design-challenge"
"base/design-egress-proxy"
"base/design-runtime"
"base/design-review"
"base/prism-pod"
"base/relearn-challenge"
"base/bounty-challenge"
)
ok=0
# First list packages to Learn exact names (debug)
Expand Down
22 changes: 12 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Short contract for agents and operators. Prefer linking over restating runbooks.

**Product:** Cortex ([`CortexLM/cortex`](https://github.com/CortexLM/cortex)) — Bittensor subnet control plane for decentralized collaborative AI research via multiple challenges. Naming split (Cortex vs leftover `base` / `BASE_*`): [`docs/NAMING.md`](docs/NAMING.md).
**Product:** Cortex ([`CortexLM/cortex`](https://github.com/CortexLM/cortex)) — Bittensor subnet control plane for decentralized collaborative AI research via **Relearn** and **Bounty** challenges. Relearn eval lives in [`CortexLM/relearn`](https://github.com/CortexLM/relearn). Naming split (Cortex vs leftover `base` / `BASE_*`): [`docs/NAMING.md`](docs/NAMING.md).

## Monorepo map

Expand Down Expand Up @@ -34,7 +34,8 @@ Working branch: **`main`**. Prod ships from annotated tags `v*.*.*` cut on `main
|-----|-----|------------|
| `gateway_sk` | Gateway | Bundle **seal** signatures (`POST /v1/admin/seal`) |
| `gateway_admin_token` | Gateway + seal scripts | Bearer for **`/v1/admin/*`** (seal, backends, attest-grant). **Required** when `BASE_GATEWAY_REQUIRE_OWNER=1` |
| `prism_sk` / `design_sk` | Challenge / smoke | Signed leaves (`POST /v1/weights/raw`); pubs must match trust root |
| `relearn_sk` | Relearn / smoke | Signed leaves (`POST /v1/weights/raw`); pub must match trust root |
| `bounty_sk` | Bounty / smoke | Signed bounty leaves; pub must match trust root |
| Gateway owner wallet + `BASE_GATEWAY_REQUIRE_OWNER` | Gateway | Master-only **identity** check (live/prod). **Not** required to seal or serve `/v1/weights/latest` |
| Validator wallet | Validator | On-chain weight **submit** only — validators *fetch* sealed weights; they do not need a gateway wallet |

Expand All @@ -46,10 +47,10 @@ Each live challenge has a **separate public GitHub repo** for miners. Those repo

| Challenge | Public repo | Role |
|-----------|-------------|------|
| Design | [`BaseIntelligence/design-challenge`](https://github.com/BaseIntelligence/design-challenge) | Miner docs + baseline harness |
| Prism | [`BaseIntelligence/prism`](https://github.com/BaseIntelligence/prism) | Miner docs + recipe examples (publish / keep in sync; no control-plane code) |
| Relearn | [`CortexLM/relearn`](https://github.com/CortexLM/relearn) | Eval image, harness, generators, teacher, miner docs |
| Bounty | this repo [`docs/external-miner/bounty.md`](docs/external-miner/bounty.md) | Miner pairing + report path; subnet **reads** CortexLM/backend public API (does not serve one) |

Those public URLs are historical org names; this control-plane repo is `CortexLM/cortex`. Monorepo mirror for CI and operators: [`docs/external-miner/`](docs/external-miner/). Frozen contracts stay in this repo (`docs/DESIGN_CHALLENGE.md`, `docs/PRISM.md`, …).
This control-plane repo is `CortexLM/cortex`. Short miner pointers: [`docs/external-miner/relearn.md`](docs/external-miner/relearn.md), [`docs/external-miner/bounty.md`](docs/external-miner/bounty.md). Historical frozen specs (`docs/DESIGN_CHALLENGE.md`, `docs/PRISM.md`) stay archived; they are not live products. Do not send miners to Design or Prism docs.

**When a challenge product or public API changes**, agents **must** update:

Expand All @@ -64,12 +65,12 @@ When verifying a challenge (local-e2e, staging, or focused tests), **simulate a

1. Happy-path harness / intake POST (or equivalent) through the challenge service on master.
2. Edge / failure probes: bad harness, sanitize reject, quota, wrong routes/auth.
3. **Designbaseline:** submit the reference agent at [`docs/external-miner/examples/design-baseline/`](docs/external-miner/examples/design-baseline/) (`agent.py` + `pyproject.toml`). After `POST /v1/harness`, poll `GET /v1/runs/{id}` + `/events` + `/logs?since=` until `awaiting_admin` / terminal; assert `GET /v1/runs/{id}/pages` lists `index.html`, `pricing.html`, `components.html` and `GET /v1/view/{run_id}/{page}` returns **200**; probe `GET /v1/stats` and `GET /v1/dashboard`.
4. **Designcheat:** submit a malicious/copy harness; expect agentic `cheat`/`suspicious` → `Score(0)` (not admin-eligible). Poll events/logs the same way.
5. **Designadmin winners:** with operator bearer (`deploy/secrets/design/annotator_tokens`), `GET /v1/admin/rounds/{id}/candidates` then `POST /v1/admin/rounds/{id}/winners` with 1 or 2 clean harness ids (`SCORE_MAX` or `SCORE_MAX/2`).
3. **Relearnsubmit:** `POST /v1/submissions` with a 64-hex hotkey + artifact digest (optional `X-Lium-Api-Key`). Poll `GET /v1/submissions/{id}` until `awaiting_admin` or `rejected`. Holdout must stay sealed until the digest freezes. A regression must not become champion.
4. **Relearnpromote:** with operator bearer (`deploy/secrets/relearn/admin_tokens`), `POST /v1/admin/promote` only for an eligible paired win.
5. **Bountypair + report:** `cortex-bounty pair --hotkey <ss58> --account-id <id>`, then `POST /v1/pair` (terms + signature) and `POST /v1/reports`. Operator bearer `POST /v1/admin/adjudicate` (`valid` / `already_fixed_not_prod` / `invalid_malicious` / `duplicate`). Scoring **reads** CortexLM/backend public JSON (`BOUNTY_BACKEND_PUBLIC_URL`); do not serve `/v1/public/*` from this repo.
6. Leaf emission → `POST /v1/weights/raw` → seal → `GET /v1/weights/latest` with **`sealed: true`** (burn fallback alone is not a real seal).

**Never host Sim in staging/prod** — Docker sandbox only there. `SimSandbox` / `BASE_ALLOW_HOST_SIM=1` is CI/local opt-in only; do **not** treat stub pages (`sim-install-ok` / `sim-run-ok` without executing `agent.py`) as proof. Prefer `DESIGN_FORCE_SIM=false` + OpenRouter when `deploy/secrets/openrouter/api_key` is present.
**Never host Sim in staging/prod** for live scoring. `RELEARN_FORCE_SIM=1` is CI/local opt-in only. Live rent requires a digest pin in `config/relearn-pin.toml` plus miner BYOK (`LIUM_API_KEY` / `X-Lium-Api-Key`). Never log or commit that key.

Local smoke automates the weights seal step via `weights-smoke` inside `./deploy/scripts/local-e2e.sh --smoke` (see [`deploy/AGENTS.md`](deploy/AGENTS.md) and [`docs/runbooks/local-testnet-e2e.md`](docs/runbooks/local-testnet-e2e.md)).

Expand Down Expand Up @@ -113,7 +114,8 @@ Match CI (`.github/workflows/ci.yml`):
| Doc authority vs evidence | [`docs/AGENTS.md`](docs/AGENTS.md) |
| Component status | [`docs/COMPLETENESS.md`](docs/COMPLETENESS.md) |
| Frozen contracts | [`docs/BUNDLE_SPEC.md`](docs/BUNDLE_SPEC.md), [`docs/DESIGN_CHALLENGE.md`](docs/DESIGN_CHALLENGE.md), [`docs/PRISM.md`](docs/PRISM.md) |
| Miner HTTP submit | [`docs/external-miner/`](docs/external-miner/) · public: [design-challenge](https://github.com/BaseIntelligence/design-challenge), [prism](https://github.com/BaseIntelligence/prism) |
| Relearn miners | [`docs/external-miner/relearn.md`](docs/external-miner/relearn.md) · long guide: [CortexLM/relearn](https://github.com/CortexLM/relearn) |
| Validators | [`docs/external-miner/validators.md`](docs/external-miner/validators.md) |
| Threat / operator checklist | [`docs/THREAT_MODEL.md`](docs/THREAT_MODEL.md), [`docs/OPERATOR_SECURITY.md`](docs/OPERATOR_SECURITY.md) |

## Do not commit
Expand Down
Loading