Skip to content

About

A workflow where one AI writes the code and another one checks it, before you ever see it.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

OMEGA-LOOP

Version 1.5.0 · Changelog · Specification · MIT

One AI writes the code. A different, isolated one tries to break it. The right model is chosen for each job, and you approve the plan first.

OMEGA-LOOP turns Claude Code into a multi-model engineering team. Your selected Claude model coordinates; Sonnet, Opus, Fable, a local Qwen, OpenAI Codex, Amazon Ergo and Google Antigravity CLI are called in when they are the right choice, and any of them can be switched off. You need only Claude Code: the rest is detected automatically and used when present.

flowchart TD
    A([You describe what you want]) --> B[Plan<br/>you approve it]
    B --> C[Build<br/>small, targeted edits]
    C --> D{How risky, urgent<br/>and large is each part?}
    D -- "low risk, can wait" --> Q["Local Qwen<br/>no API tokens"]
    D -- "ordinary logic" --> S["Sonnet<br/>fast"]
    D -- "security, subtle code" --> O["Opus<br/>very strong"]
    D -- "a miss is very expensive" --> F["Fable<br/>strongest"]
    D -. "cheap second opinion" .-> E["Ergo<br/>Amazon"]
    D -. "second opinion" .-> X["Codex or Antigravity<br/>another vendor"]
    Q --> V{Every part<br/>approved?}
    S --> V
    O --> V
    F --> V
    E -.-> V
    X -.-> V
    V -- "No: fix and review again" --> C
    V -- Yes --> T[Build and tests]
    T --> Z([Commit, following<br/>your project's rules])
Loading

Why you would want it

Ask an AI to change code and it usually writes it, tells you "done, it works", and you find the problems later. It is grading its own homework.

In the runs we measured, 42 of 105 recorded review verdicts (40%) sent the change back for more work (details).

Killer feature What it gives you
The writer never reviews itself The reviewer is a separate session that never sees the conversation that produced the change. Its job is to find flaws.
The model adapts to the severity A rename and an authentication change do not deserve the same reviewer. The coordinator weighs risk, urgency, size, token budget and the state of your local model.
Split by risk, pay by risk A mixed change can be divided, so only the dangerous part goes to an expensive model.
Your local model earns its keep Qwen in LM Studio or Ollama takes low-risk reviews and read-only side tasks without using API tokens, within limits read live from the server.
A failed reviewer does not stop the review Out of tokens, error or unusable answer: the next provider in the order takes over. If nobody gives a valid verdict, the result is rejected, never approved by mistake.
Approval is tied to the exact change The log records the hash of the reviewed diff. Any later edit voids the approval.
Work survives interruptions State, plan and decisions stay in .omega/, so the work can resume, even with Codex in place of Claude.
No routing to configure Providers are detected at every session and every run. Start Qwen or install Codex later and it is picked up.
You decide who is allowed /omega-providers disable ergo switches a model off on this machine until you switch it back on.

Quick start

git clone https://github.com/priore/omega-loop.git
cd omega-loop
./install.sh

Open a new Claude Code chat in your project and type:

/omega-loop add an "Export to PDF" button to the reports page

You need: Claude Code (the VS Code extension is fine too), macOS or Linux (on Windows use WSL), Python 3, and a project under git. Qwen, Codex, Ergo and Antigravity are optional.

What the installer does
  • Copies the files into ~/.claude/ (Claude Code's folder, yours alone), including the /omega-providers command.
  • Adds a small startup hook so OMEGA-LOOP is ready in every new chat.
  • Removes the fixed 1.1.0 routing (opusplan, Haiku subagents) if present: routing is now resolved at runtime.
  • Tells git to ignore .omega/ in all your projects, so the work log never ends up in your commits.

It is safe to re-run to update. Before changing Claude Code's settings it saves a copy (settings.json.omega.bak).

Which models do you have?

Your setup Coordinator Reviewers available Read-only side tasks
Claude only The Claude model you selected Sonnet, Opus, Fable (as your plan allows) Sonnet (Haiku if Sonnet coordinates)
+ local Qwen Same The above, plus Qwen for low-risk parts Qwen when it fits, otherwise as above
+ Codex Same Claude models, plus a different vendor's opinion As Claude only
Claude + Qwen + Codex Same All of them Qwen when it fits, otherwise as Claude only
+ Ergo or Antigravity Same The above, plus Amazon or Google as extra vendors Unchanged

The coordinator normally writes the code too. Every review starts in a fresh session with no memory of the build.

Supported today: Claude models, Codex through its CLI, local models whose name contains "qwen" in LM Studio (port 1234) or Ollama (port 11434), Amazon Ergo directly on Bedrock, and Gemini models through the Antigravity CLI (agy). Other providers are not integrated.

Keys and sign-in for each model

Only Claude is required. Set up the others when you want them; each is picked up at the next session.

Claude (required).

  1. Run claude in a terminal (or open the Claude Code extension) and sign in with your Claude subscription (Pro, Max, Team) or an Anthropic Console account.
  2. To switch account later, type /login in Claude Code.
  3. Alternative: create an API key at console.anthropic.com → API Keys and export it as ANTHROPIC_API_KEY.

Local Qwen (no key, free).

  1. Install LM Studio or Ollama.
  2. Download a model whose name contains "qwen" (in LM Studio from the search tab; in Ollama with ollama pull <qwen model>).
  3. Start the server: in LM Studio, Developer → Start Server (port 1234); Ollama serves on port 11434 by itself.

Codex (OpenAI).

  1. Install the Codex CLI (npm install -g @openai/codex).
  2. Run codex login and sign in with your ChatGPT account (Plus, Pro, Team), or use an OpenAI API key from platform.openai.com → API keys as the Codex documentation describes.

Amazon Ergo (Bedrock API key).

  1. In the AWS console, open Amazon Bedrock → API keys and generate a key (AWS guide). Choose an expiry; copy the key, it is shown only once.
  2. The key's identity needs bedrock:InvokeModel on the Ergo inference profiles (global.amazon.ergo-1.0 or us.amazon.ergo-1.0). If the console asks you to enable access to Ergo, do it first.
  3. Add export AWS_BEARER_TOKEN_BEDROCK=<your key> to your shell profile (for example ~/.zshrc) and open a new terminal.
  4. Optional: OMEGA_ERGO_REGION (default us-west-2), OMEGA_ERGO_MODEL (default global.amazon.ergo-1.0).

Nothing else to install: OMEGA-LOOP calls Bedrock directly, and the key is passed only to the Ergo call.

Google Antigravity (Google account).

  1. Install the Antigravity CLI (agy).
  2. Run agy once interactively and sign in with your Google account. The login cannot be checked in advance, so an expired one shows up as a failed review (the next provider takes over).
  3. Optional: choose the model with OMEGA_AGY_MODEL (agy models lists them).

Google has not said whether calling agy --print from other tools is allowed under its terms: check before relying on it.

VS Code on macOS: apps opened from the Dock do not read ~/.zshrc. Start VS Code from a terminal (code .) so Claude Code sees variables such as AWS_BEARER_TOKEN_BEDROCK.

Ergo and Antigravity run only when the coordinator names them in the order, never by default.

Adaptive model routing

Two kinds of work are routed in two different ways.

Reviews: judgment inside hard limits

For each part of a change, the coordinator picks the cheapest reviewer that is safe enough and fast enough right now, without asking you. It weighs five factors:

Factor Question Effect
Risk What does a missed flaw cost? Authentication, cryptography, TLS, certificates, signatures, untrusted input, concurrency, data loss and migrations are high risk
Urgency Is someone waiting for the verdict? Waiting favors a fast remote model; idle time makes Qwen free
Size Does the whole prompt fit Qwen's live budget? If not, split it or go remote; never truncate it
Tokens How much budget is left? When tight, more low-risk work goes to Qwen and Opus/Fable are kept for high risk
Qwen's state Loaded, idle, reliable in this session? If not, go remote

Typical outcomes. This is guidance, not a fixed table:

Severity Example Typical reviewer
Low, nothing waiting Small, self-contained, low-impact edit Qwen
Low, but blocking Same edit, with you waiting Sonnet
Ordinary Business logic, or a part too big for Qwen Sonnet
High Security, subtle or hard-to-get-right code Opus
Critical Large security-critical design, a disputed or repeatedly rejected verdict, the gate before an irreversible release Fable
Low or ordinary, cheap extra check Another vendor at a low price; very large parts Ergo (never for high risk)
Second opinion A risky part where another vendor's view helps Codex or Antigravity

Around that judgment, the scripts enforce limits on Qwen:

flowchart TD
    A["Coordinator judgment for each part"] -- "Qwen first" --> C{All Qwen<br/>limits met?}
    A -- "Sonnet, Opus,<br/>Fable or Codex" --> R[Chosen remote reviewer]
    C -- Yes --> G[Qwen reviews]
    C -- No --> N[Next provider in the order]
    G -- "Failed: Qwen blocked<br/>this session" --> N
    R -- Failed --> N
    G -- "Valid verdict" --> V[Verdict and diff hash<br/>written to the log]
    R -- "Valid verdict" --> V
    N -- "Valid verdict" --> V
    N -- "No provider left" --> X([REJECTED])
Loading

Qwen reviews a part only if all of these hold: the part was declared low risk, Qwen is not blocked in this session, its loaded context is known, the prompt is within budget, and Qwen is free.

  • Budget: one third of the context actually loaded, at about 3.5 bytes per token. A 78,336-token context gives 91,392 bytes for the whole prompt. An unknown context means Qwen is skipped.
  • One Qwen job at a time on the machine, across all sessions. A busy Qwen is skipped, not queued.
  • Timeout: 900 seconds by default. After a failure Qwen is out for the session (4 hours if there is no session id); being skipped or busy does not block it.
  • Sized on your machine: Qwen reviews are logged with context, size, time and outcome, so later parts can be sized from measured speed.
  • Default order when none is chosen: codex qwen claude with Codex, otherwise qwen claude codex. Qwen still needs the low-risk declaration. Ergo and Antigravity run only when named.

Limits on the other new reviewers:

  • Ergo reviews only parts declared low or ordinary risk: in public tests it scores below Sonnet and is weak on long, intricate work.
  • Antigravity is an agent that can edit files and is known to hang sometimes. It runs from an empty folder, is stopped after 900 seconds, and its answer is thrown away if the repository changed while it ran (files, commits, branches, git settings and hooks, and .omega/; other git-ignored folders, such as build output, are not checked; a check that fails or takes over 5 minutes counts as a change). Stopping the review also stops it. Limits: a child process that detaches itself from Antigravity's process group is not stopped, and Antigravity runs with your rights, so it can change files outside the repository without being noticed.

Side tasks: a simple rule

Searches, summaries and other read-only tasks go to Qwen if the prompt fits its budget, otherwise to Sonnet, or to Haiku if Sonnet is already the coordinator. If Qwen is busy, blocked or fails, the remote model takes over.

Manual overrides

You normally never need these.

Variable Effect
OMEGA_AUDIT_ORDER Provider order, for example "claude codex"
OMEGA_AUDIT_MODEL sonnet, opus or fable for the Claude reviewer
OMEGA_AUDIT_RISK=low Declares a part low risk: required for Qwen to review it
OMEGA_AUDIT_RISK=normal Declares a part ordinary: with low, required for Ergo
OMEGA_DISABLED Providers switched off for this run only, for example "ergo antigravity"
AWS_BEARER_TOKEN_BEDROCK, OMEGA_ERGO_REGION, OMEGA_ERGO_MODEL, OMEGA_ERGO_TIMEOUT Bedrock API key for Ergo, region (default us-west-2), model (default global.amazon.ergo-1.0), time cap in seconds (default 900)
OMEGA_AGY_MODEL, OMEGA_AGY_TIMEOUT Antigravity model and time cap in seconds (default 900)
OMEGA_QWEN_TIMEOUT Seconds allowed for a Qwen run (default 900)
OMEGA_QWEN_MAX_BYTES Replaces the prompt budget when the context is known
OMEGA_QWEN_RETRY=1 Lifts the session block, once the cause is fixed

Full rule: omega/audit-routing.md.

Switching models off and on

In any Claude Code chat:

/omega-providers list
/omega-providers disable ergo antigravity
/omega-providers enable ergo

Names: codex, qwen, claude, ergo, antigravity. The same from a terminal: ~/.claude/omega/providers.sh disable codex.

  • The choice applies to every session on this machine, from the next review or side task, and stays until you change it. Updates keep it.
  • It lives in ~/.claude/omega/providers.json ({"disabled": ["antigravity"]}), which you can also edit by hand. An unreadable file switches nothing off, with a warning.
  • For one run only, set OMEGA_DISABLED, for example OMEGA_DISABLED="qwen" ~/.claude/omega/audit.sh 1.
  • A switched-off reviewer is skipped and the next one in the order takes over; this is logged. With Codex off, the loop runs Claude-only. With Qwen off, side tasks go to Sonnet or Haiku. Switching claude off affects reviews only: side tasks still use Claude.

How the loop works

flowchart TD
    B[1. Plan] --> C{You approve?}
    C -- "No, change it" --> B
    C -- Yes --> D[2. Write, then automatic<br/>checks by file type]
    D --> G{3. Independent<br/>review: approved?}
    G -- "No, under<br/>5 rounds" --> D
    G -- "No, 5 rounds used" --> I([Stop and ask you])
    G -- Yes --> K{4. Build and tests green,<br/>same diff as approved?}
    K -- No --> D
    K -- Yes --> L([5. Commit and summary])
Loading
  1. Plan. It touches nothing until you approve.
  2. Write. Small, targeted changes.
  3. Review. If problems are found, they are fixed and reviewed again (at most 5 rounds, then it stops and asks you).
  4. Verify. The build and tests named in the plan must pass, and the diff must be the one that was approved.
  5. Commit, following your project's rules.

When a model runs out of tokens

flowchart TD
    A{Who stopped?} -- "Codex" --> B[Claude takes over<br/>its role immediately]
    A -- "Claude, during<br/>a review" --> C[Next provider in the<br/>order, such as Codex]
    A -- "Claude, the<br/>coordinator" --> D["You run codex_takeover.sh"]
    D --> E[Codex resumes from .omega/<br/>and does not review its own work]
    A -- "Qwen, during<br/>a review" --> F[Next provider in the order;<br/>Qwen blocked this session]
Loading

Performance

Measured

Reviews from 28 to 30 November 2026, on one machine and a few private projects. This is what happened there, not a benchmark or a promise.

How often the reviewer sent work back (105 recorded verdicts, Sonnet and Opus):

%%{init: {"themeVariables": {"pie1": "#2563eb", "pie2": "#c2410c", "pieOpacity": "1", "pieSectionTextColor": "#ffffff"}}}%%
pie showData
    title Review verdicts (measured)
    "Approved" : 63
    "Rejected, back to work" : 42
Loading

A rejection is not always a real bug, and one change can be rejected more than once.

Median review time, by size of the prompt (plan + changes):

%%{init: {"themeVariables": {"xyChart": {"plotColorPalette": "#2563eb", "backgroundColor": "transparent"}}, "xyChart": {"width": 480, "height": 380}}}%%
xychart-beta
    title "Median seconds per review (measured)"
    x-axis ["Sonnet S", "Opus S", "Sonnet M", "Opus M", "Sonnet L", "Opus L"]
    y-axis "Seconds" 0 --> 100
    bar [8, 30, 31, 79.5, 42, 94.5]
Loading
Prompt size Sonnet (runs) Opus (runs)
S: under 20 KB 8 s (12) 30 s (4)
M: 20 to 60 KB 31 s (37) 79.5 s (36)
L: over 60 KB 42 s (19) 94.5 s (14)
Reviewer Runs Median 90th percentile
Sonnet 68 31 s 62 s
Opus 54 79.5 s 162 s

All 122 timed runs are counted; 17 Sonnet runs have no recorded verdict. Parts are not assigned at random, so this does not compare review quality. There are no representative timings for Qwen, Fable or Codex yet.

Expected

These charts are estimates. Example: a change split into 10 parts of equal size, 6 low risk, 3 ordinary and 1 high risk, each reviewed once.

Review cost, where one Sonnet review = 1:

%%{init: {"themeVariables": {"xyChart": {"plotColorPalette": "#2563eb", "backgroundColor": "transparent"}}, "xyChart": {"width": 480, "height": 380}}}%%
xychart-beta
    title "Relative review cost, 10 parts (estimate)"
    x-axis ["All Fable", "All Opus", "Routed, no Qwen", "Routed + Qwen"]
    y-axis "Sonnet reviews" 0 --> 40
    bar [40, 20, 11, 5]
Loading
All Fable All Opus Routed, no Qwen Routed + Qwen
40 20 11 5

Routed without Qwen: 9 Sonnet + 1 Opus. With Qwen: 6 Qwen + 3 Sonnet + 1 Opus. In this example routing costs 45% less than all Opus, or 75% less with Qwen. Weights are Anthropic API list prices as of November 2026 (Sonnet 1, Opus 2, Fable 4, for both input and output) with the same tokens per review; Qwen counts as 0 API cost. Subscription limits work differently. If Qwen fails or is skipped, its parts fall back to a paid model.

Review time, remote models only, using the measured 20 to 60 KB medians:

%%{init: {"themeVariables": {"xyChart": {"plotColorPalette": "#2563eb", "backgroundColor": "transparent"}}, "xyChart": {"width": 480, "height": 380}}}%%
xychart-beta
    title "Review minutes, 10 parts (estimate)"
    x-axis ["All Opus", "Routed", "Parallel"]
    y-axis "Minutes" 0 --> 15
    bar [13.3, 6.0, 1.3]
Loading
All Opus, in sequence Routed, in sequence Routed, in parallel
13.3 min 6.0 min 1.3 min

The parallel figure is the best case: independent parts, separate working folders and no rate limits. Reviewing everything with Opus in parallel would take about as long, but cost more. Qwen is left out: it is much slower and is meant for work nobody is waiting for.

Tokens used by repeated reviews:

%%{init: {"themeVariables": {"xyChart": {"plotColorPalette": "#2563eb", "backgroundColor": "transparent"}}, "xyChart": {"width": 480, "height": 380}}}%%
xychart-beta
    title "Cumulative review input (estimate)"
    x-axis "Review rounds" [1, 2, 3, 4, 5]
    y-axis "Thousand tokens" 0 --> 70
    bar [13, 27, 40, 53, 66]
Loading
Round 1 Round 2 Round 3 Round 4 Round 5
13k 27k 40k 53k 66k

Based on the median measured prompt (46.5 KB, about 13,300 tokens at 3.5 bytes per token), constant in every round. Excludes output, reasoning and the tool's own system prompt. This is the price of reviewing one part; the round limit keeps it bounded.

Reviews run outside the main chat, which gets back only a short verdict. Side tasks likewise return only their answer, so the files they read do not fill your conversation.

How to use it

It starts on its own

Every new chat is told to use OMEGA-LOOP for non-trivial changes to a project. Questions, code explanations and one-line fixes stay fast and skip the plan. Chats that were already open when you installed don't see it.

Starting it manually

To be sure the loop runs, type /omega-loop followed by what you want:

/omega-loop fix the VAT calculation when the discount exceeds 20%
/omega-loop move the login logic into a separate file without changing behavior
/omega-loop add email validation to the sign-up form

Then:

  1. Read the plan. Reply yes, or say what to change.
  2. Wait: it writes, gets reviewed, verifies.
  3. It tells you what it did. The full summary is in .omega/SUMMARY.md, and the routing choices are in .omega/ledger/DECISIONS.log.

If Claude runs out of tokens mid-task

From the terminal, in the project folder (Codex required):

~/.claude/omega/codex_takeover.sh

Codex reads the log in .omega/ and continues from where you left off. It does not commit without your confirmation.

Automatic code checks (what it is tuned for)

Before the reviewer runs, small checks verify simple rules based on file type. OMEGA-LOOP is currently tuned for the following languages; any other file type is simply skipped (the independent review still applies to everything).

  • Swift (.swift): enforces modern Swift style.
    • Error: DispatchQueue.main is forbidden; use @MainActor and native async/await.
    • Error: ObservableObject is forbidden; use the @Observable macro.
    • Warning: closures that use self. without [weak self] (possible retain cycle).
    • Trade-off: the rules are strict and may flag legitimate code in projects that still use ObservableObject.
  • OpenSCAD (.scad): enforces robust, fast 3D models.
    • Error: difference() must be followed by a block (difference() { main(); subtractions(); }).
    • Error: subtractions need height padding (e.g. h + 0.2) to prevent ghosting.
    • Error: minkowski() is forbidden because of performance; use chamfered/filleted primitives.
  • C# (.cs, .csx): enforces async best practices. Requires dotnet-script; if it is missing the check is skipped with a notice.
    • Error: Task.Run around I/O-bound work (streams, HttpClient); use native async APIs.
    • Tip: consider ReadOnlySpan<char> instead of string.Substring to avoid allocations.
  • AngularJS (.js, .html): opt-in per project (see below).
    • Error: $scope usage; use components with controllerAs: '$ctrl'.
    • Error: ng-repeat without track by.
    • Error: $on( listeners without cleanup in $onDestroy.

The AngularJS check is off by default, to avoid false alarms on other JavaScript projects. To turn it on for a project, copy omega/projects.example.json to ~/.claude/omega/projects.json and put your project's path in it:

{ "~/work/my-angularjs-project": { "ng": true } }

This file stays on your computer, outside the project. You can also enable it for a single run with OMEGA_NG=1.

Security and privacy

  • Everything OMEGA-LOOP writes in your projects lives in .omega/, ignored by git.
  • Nothing is sent to services you don't already use: work goes to Claude, Codex, Ergo, Antigravity or your local Qwen, the tools you installed and set up. A Claude review sends the plan and the changes to Anthropic. A Codex review sends them to OpenAI, and Codex may also read the repository. An Ergo review sends them to Amazon Bedrock, an Antigravity review to Google. A local Qwen review stays on your machine. Switch off any provider you do not want with /omega-providers disable <name>.
  • The reviewer has read-only access (no tools for Claude, Qwen and Ergo, read-only sandbox for Codex; Antigravity runs from an empty folder and its answer is discarded if the repository changes).
  • Your Bedrock key (AWS_BEARER_TOKEN_BEDROCK) is never written to disk and is sent only to Amazon Bedrock, when Ergo reviews (redirects are not followed).
  • Antigravity runs with your user's rights: the empty folder is not a sandbox, and changes it makes outside the repository are not detected.
  • If no reviewer responds, the outcome is rejected, never approved by mistake.
  • Don't put passwords or keys in the plan or in requests: they end up in the .omega/ log.

Uninstall

./uninstall.sh

Removes the files in ~/.claude/ (including /omega-providers and your provider switches) and the startup hook. The .omega/ folders in your projects stay (you can delete them by hand).

FAQ

Does it cost extra? OMEGA-LOOP is free, but every Claude or Codex review uses your tokens, so a task consumes more than a request with no review. Routing limits that overhead, and a local Qwen can take part of it without API tokens.

Does it work without Codex? Yes. The reviewer is a separate Claude session or, for low-risk parts, a local Qwen.

Can I use it on a project without git? A git repository is required: the check works on the differences between before and after.

Is the reviewer really independent? It is always a fresh session that has not seen the conversation. With Codex, Qwen, Ergo or Antigravity it is also a different model family; a Claude reviewer may share some blind spots with a Claude writer.

Can I use Gemini or another model? Gemini, through the Antigravity CLI; Amazon Ergo with a Bedrock API key. Others not today. See Which models do you have?.

Where are the technical details? In docs/SPEC.md: states, files, verdict format, failover.

Contributing

Issues and pull requests are welcome. Keep examples neutral: no personal absolute paths, names, emails or keys.

Support Development

If this project has been useful to you, consider a small donation. Every contribution helps fund new features and keep the project active.

Scan the code below with your wallet, or copy the address. Alternatively you can donate via PayPal.

Donate with BTC (Bitcoin)
BTC QR code
BTC Address (SegWit) : bc1q6mxjea7xfjprl70k80jt8gyqxjvp5j6pa9yzxs

This address can only accept BTC (Bitcoin). To avoid losing assets, do NOT send other currencies to this address.

License

MIT

About

A workflow where one AI writes the code and another one checks it, before you ever see it.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages