regolo-ai/brick-SR1
حول
brick is a smart AI Models router, based on complexity & capabilities extraction from the query to the models via proprietary spatial embedding algorythm
الذكاء الاصطناعي وتعلّم الآلةالنمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- ٠
- خلال 15 يومًا
- ٠
- خلال شهر
- +٣
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلBrick
Brick routes a query to a model using a local six-dimensional SystemOne capability vector. It provides OpenAI Chat Completions, Anthropic Messages, and native Responses gateways, with streaming, authentication, tools, and multimodal transport.
The routing flow is:
query → SystemOne sigmoid vector → linear knob → Euclidean distance → model
SystemOne inference uses PyTorch and Hugging Face Transformers, following the model's reference implementation. It runs in FP32 on CPU or BF16 on CUDA, uses FlashAttention 2 when available on CUDA, and otherwise uses SDPA. A persistent local Python worker keeps the model loaded. The Go gateway embeds the worker source and communicates with it over pipes.
Routing
The pinned checkpoint is regolo/brick-sysone-V1, revision
9263a397a366ee22921214ddeebab1f5e4e8facd. It is public and Apache-2.0
licensed. Its output order is:
instruction_followingcodingmath_reasoningworld_knowledgeplanning_agenticcreative_synthesis
Each output is an independent sigmoid value in [0, 1]. The vector is neither
rounded nor normalized to sum to one. The tokenizer respects the checkpoint's
8192-token context limit.
The profile knob defaults to 0 and accepts values from -1 to +1:
scaled_query[i] = clamp(query[i] × (1 + 0.5 × knob), 0, 1)
delta[i] = scaled_query[i] - model.skill_vector[i]
penalty[i] = delta[i]² × (delta[i] < 0 ? over_capacity_weight : 1)
distance(model) = sqrt(sum(penalty))
Over-capacity mismatch (a model stronger than the query needs) is discounted by
skill_router.over_capacity_weight, default 0.25; set it to 1.0 to restore
the fully symmetric distance. Under-capacity mismatch is never discounted.
The closest eligible model wins. Exact ties preserve the configured model order. Model vectors are unchanged by the knob. If a profile declares a different capability order, the router explicitly reorders its vectors into checkpoint order. Active-pool and modality filters restrict the eligible models. Invalid vectors, an empty candidate intersection, and inference failures return explicit errors.
Request effort overrides the profile knob across all three protocols:
| Request effort | Knob |
|---|---|
low |
-1 |
medium |
-0.5 |
high |
0 |
xhigh |
+0.5 |
max |
+1 |
An absent effort uses the profile knob. The X-Brick-Knob request header sets
the routing knob directly with a number in [-1, 1] and takes precedence over
any effort; it is never forwarded upstream. Provider-supported reasoning controls
are forwarded, with only required provider adaptations, and the client's explicit
effort is preserved; the knob only fills a request that carries no effort. Brick
does not infer reasoning effort. Explicit model selections and configured fixed
models bypass inference.
Install and run locally
The installer prepares a managed Python environment under
~/.brick/runtime/<version>/venv with pinned torch==2.11.0 and
transformers==5.20.2, choosing CUDA wheels that the detected driver can load
and CPU wheels otherwise. Python 3 is required. Set BRICK_SYSTEMONE_PYTHON to
use your own interpreter instead, BRICK_CUDA=0 to force CPU wheels, or
BRICK_SKIP_PYTHON_INSTALL=1 to reuse an interpreter that already imports torch
and transformers. See the runtime requirements
and local lifecycle and installation for the pinned
stack and driver selection rules.
The installer downloads
the public checkpoint assets anonymously, verifies SHA-256 checksums, and checks
real inference. HF_TOKEN is used only when present, for Hub rate limits. For an
offline installation, set BRICK_MODEL_ASSETS to a directory containing the
pinned assets. The runtime also verifies local assets against the pinned
manifest. Hub credentials are not written into completion markers or runtime
environment snapshots. Weights stay outside the source repository.
brick profile create work
brick profile edit work
brick start work
brick status work
brick logs work
brick stop work
Codex in one command
Install Codex, authenticate the subscription once, then start the managed profile:
npm install -g @regoloai/brick
codex login
brick start codex
brick start codex creates the codex profile when missing, verifies the
SystemOne checkpoint installed by npm install, starts the local router, and
wires the official Codex client to it. The default pool is gpt-6.1-terra and
gpt-6-luna; no Regolo API key is required. Open Codex, select brick, and
turns are routed across the pool.
Skill vectors are not bundled with the package. Profile creation and every
start download skill_vectors.csv from the Hugging Face dataset
regolo/brick-skill-tables, validate it, and cache it under $BRICK_HOME/cache
(~/.brick/cache by default). Set BRICK_SKILLS_OFFLINE=1 to use the cached
table without network access. The vectors written into a starter template are
only a schema-valid fallback for a first run with neither network nor cache.
A failed or invalid download keeps the vectors already in the profile, and a
model missing from the published table keeps its last known vector instead of
being dropped from the pool.
Existing Codex profiles keep their pool. brick start codex --reset-pool
switches one to the default gpt-6.1-terra/gpt-6-luna pool without touching
providers or credentials.
The profile editor configures providers, the model pool, capability vectors, provider-supported thinking modes, and the routing knob. Claude and Codex profiles connect their official harnesses through the existing native transports.
brick route "Write a parser" --json runs local routing only. It returns the
original vector, scaled vector, knob, candidate distances, selected model, and
latency. Add --effort xhigh to inspect an effort override, or --knob 0.5 to
exercise the explicit knob header (the header wins when both are given).
brick generate and
brick chat perform generation through the chosen provider.
See local lifecycle and installation for package installation, restart, update, rollback, and profile storage details.
Configuration and migration
Profiles use config_version: 2. The routing block contains:
config_version: 2
skill_router:
enabled: true
knob: 0
systemone:
local_path: /external/path/to/verified/systemone-assets
capabilities: [instruction_following, coding, math_reasoning, world_knowledge, planning_agentic, creative_synthesis]
models:
- model: small
skill_vector: [0.5, 0.4, 0.4, 0.6, 0.3, 0.5]
- model: large
skill_vector: [0.9, 0.9, 0.9, 0.9, 0.9, 0.9]
active_models: [small, large]
keywords:
- name: force_coder
keywords: ["write a parser", "refactor this module"]
model: large
operator: OR # OR (default) or AND
case_sensitive: false
Provider endpoints, credentials, and model_config entries complete the profile;
see the examples and default templates.
The CLI supplies the installed checkpoint directory via --model-dir.
skill_router.keywords forces a model when the last user message contains a
keyword; rules evaluate in file order and the first match wins. Matching uses
Unicode word boundaries and never reads the system prompt, earlier turns,
assistant output, or tool results. An explicit model, --fixed-model, or a
disabled router bypasses keyword rules.
Legacy profiles migrate with exact configuration and environment backups, followed
by atomic replacement. Migration preserves providers, generation credentials,
model priority, active-model order, capability order, and vector values. The old
numeric routing preference becomes skill_router.knob; keyword_rules with
mode: override become skill_router.keywords, while mode: bias (including an
omitted mode) stops the migration because it cannot become a strict override.
Obsolete fields are removed. Incompatible vectors stop migration before any files
are written. Repeating migration performs no second write. Run
brick migrate <profile> --dry-run to preview the result.
Observability and protocol behavior
/v1/routing/test: local routing diagnostics, without generation./api/v1/diag/systemone: local engine, checkpoint identity, device, and readiness./api/v1/stats: durable calls, models, token usage, and routing/provider/overall latencies./api/v1/economics: token-based cost accounting using configured pricing./health: runtime identity and routing readiness./metrics: request counters and local SystemOne inference latency.
Provider-native Responses compaction is transported unchanged. The gateway does not perform local conversation compaction or keep conversation routing state. Native Anthropic requests retain tools, streaming, cache controls, and supported context-management operations. Model capability declarations determine whether Responses requests can use a selected backend.
Development and historical research
make install
export BRICK_SYSTEMONE_PYTHON="$(pwd)/.venv/bin/python"
make test
make lint
python3 scripts/build_runtime.py
The build produces a Go runtime bundle and its Python requirements. It does not bundle weights or a Candle library. Real CPU stack verification can be run using:
.venv/bin/python scripts/test_systemone_stack.py /external/path/to/systemone-assets
.venv/bin/python scripts/test_native_labels.py /path/to/brick-runtime /external/path/to/systemone-assets
These checks use the local checkpoint and make no generation-provider calls. Historical training, evaluation, and paper workflows remain available. Their older calibrated-router results describe the historical implementation, not the current SystemOne router.
Contribution and publication rules are defined in AGENTS.md. This repository is licensed under Apache-2.0; see NOTICE and third-party notices.
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…