Skip to content

About

Oneiro Cognitive Architecture — embodied machine cognition on consumer hardware. A cognitive fork of OpenClaw.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

231 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oneiro Cognitive Architecture (OCA)

An engine that wants things, prices risk against what they are worth, thinks in bounded strategies, feels in consequence of what it did, and measures itself against stated baselines.

This repository is the engine — not an assistant, not an app. The creed is in PHILOSOPHY.md. Its purpose, set out in SPEC.md, is to build something that beats the Chinese Room: cognition that is grounded in experience, that predicts and gets scored, that changes its mind for reasons, and whose emotions do work instead of decorating output. The spec is the vision. This README is what runs.

The chain

worth ──► hunger ──► risk ──► strategies ──► receipts ──► affect ──► (appetite, verification, strategy, style)
  1. Worth (motivation/worth.js) — a ledger of what things are worth: the engine's own capabilities, the person it serves, their data and attention, projects, outcomes. Only four things can move it: a declared constraint (never weighed), a declared prior (must be earned past), a rating by a person, or an observed outcome with evidence. Evidence sourced from the engine's own generated text is rejected at validation. Activity counts and model confidence have no way in.
  2. Hunger (motivation/hunger.js) — a want is for something; its value is the worth of its stakes, re-priced every time the engine chooses what to pursue. Pressure grows with elapsed time. Only an observed receipt satiates a want; plans, conclusions and model confidence never do.
  3. Risk (motivation/risk.js) — every action is appraised as expected worth gained against expected worth lost, bounded by how reversible it is. Irreversible → a person fires it. The two declared constraints are boundaries, not costs. Appetite — how much loss it accepts per unit of gain — is the first thing affect modulates. Each decision is journaled with its prediction and later its outcome, so the engine's self-knowledge is a calibration curve, not a self-report.
  4. Strategies (reasoning/strategies.js) — a want spends its budget on one bounded attempt at a time: inspect the evidence, commit to a falsifiable prediction the world will settle, simulate the next step so reality can score it, argue against the premise, or draft a deliverable a person will rate. A stall or failure rotates the strategy; a different strategy is a different attempt, not repetition.
  5. Receipts — observed progress on a want, a settled prediction, a rated artifact, a risk outcome. These are the only inputs to worth and the only satiation of hunger.
  6. Affect (emotion/engine.js) — phasic feeling comes only from what the engine did and observed (an unexpected success, a failure with stakes, harm, being held back, not knowing what something is worth). Tonic state is a projection of the journals, never an integrator of events — time alone changes nothing, so nothing can ratchet. Affect is consumed, never narrated: fear raises the confidence a conclusion must reach, frustration shortens the patience before a strategy change, curiosity buys appetite for finding things out (never for acting on the world), and the expression profile becomes style directives.

Everything a person needs to understand a want is one call away: GET /oca/trace/:id assembles the story from the journals — attempts, appraisals, commitments, settlements, receipts, worth signals, and affect at each step.

What the engine will not do

  • Credit itself for running, for switching apps, for generating text, for a plan, or for a self-modification.
  • Treat its own account of its feelings as an event.
  • Accept a prediction the world cannot evaluate.
  • Reach a person with unverified content, or write to their data without a way back — these are constraints, not weights, and the risk gate refuses them outright.
  • Open, read, or drive a web page through any browser but Aside (aside.js), the one a person authorized for automation — never the OS default, Safari, Chrome, Arc, Dia, a CDP session, or a headless browser; and never launch one of those apps. If Aside is missing, it has no browser. A test (tests/aside.test.mjs) fails the suite if another browser path appears.
  • Act on the world on its own while the master switch is off. Thinking is not acting: read-only steps that touch nothing proceed; anything with a reversibility cost is recorded as a proposal for a person.

The inbox: how a person teaches it

GET /oca/inbox is what the engine has for a person — deliverables it drafted for a want, notes it wrote that the gate held, the active wants, and what things are worth to it. Every action on it is one of the three signals that teach the engine anything: POST /oca/inbox/rate gives a verdict (useless, meh, useful, great) on a deliverable (a receipt on its want: useful or better is progress, less is a spent attempt and the strategy rotates) or a note (a rating on self:message), or a rating on an entity's worth; POST /oca/inbox/progress records what a person observed on a want, the only thing that satiates it; POST /oca/inbox/want hands it a new want. The Chinese Room Meter's creativity dimension is made of nothing but these verdicts. The Oneiro app's Judge page (phone and Mac) and the web app's Overview are both fronts for this.

Drafting a want. POST /oca/inbox/draft { clientRequestId, text } takes a loose request — "help me stay in touch with my brother" — and returns 202; GET /oca/inbox/draft/:id?wait=25 long-polls the row until the engine has drafted a want: a sharp description, a done-when that names a witness (motivation/done-when.js), stakes in the ledger's vocabulary (known, or proposed new from the entity graph), first evidence found only in grounded memory and labelled with its real source (every candidate passes the ledger's own validator before it is offered; the engine's narration is excluded by event type; screen captures contribute only what the OS observed), a priority, up to three questions that block an observable criterion, similar open wants (BGE cosine, word search as the flagged fallback) and a preview computed by the engine's own pricing, strategy and appraisal functions. Everything the model authored is tagged generated. Answers append a turn. POST /oca/inbox/want { draftId, … } confirms: evidence must be what the draft found (plus the person's own observations), a kept new stake is the person's rating, the draft id is the want's request id, and the person's edits are stored — never inferred into worth. POST /oca/inbox/draft/check-done-when judges a sentence's shape instantly, no model.

The engine's expectation for a step is its observed record on that strategy (risk.trackRecord), shrunk toward the capability's worth while the record is thin — so the metacognition dimension can move off the base rate. Predictions are about sensor metrics only, never the want's own progress. A draft in the engine's own work directory is thinking, not acting: it proceeds with the master switch off, because a person's verdict is where it meets the world.

The self-build phase

Friction the engine observes in its own operation becomes a want about itself (reasoning/self-build.js), priced like any other want. A person permits the phase (selfBuild in the controls); the engine enters it when a self-want has pressure and leaves when its self-wants are quiet, it keeps failing, or the day's build budget is spent. A build happens on a branch in a private worktree, with Codex when available and the local model otherwise: the suite must still pass with no test lost, the constitution (worth, risk, this gate, the philosophy, the migrations) is untouchable, and the branch is pushed for a person to merge — main moves only by a person's hand unless selfBuildAutoMerge is on.

What became of the branch is observed, never assumed. Each tick the engine checks whether the branch tip is an ancestor of origin/main; a merge is the receipt the want was waiting for, and the want parks for a quiet period of 24 hours. If the defect the want was made from stays out of the risk journal for that period, the want is sated; if it recurs, the want reopens and the engine may build again. A merged fix is never rebuilt on a guess.

Measured

npm run benchmark runs the isolated mechanism suite (every behavioral contract as a test) and the Chinese Room Meter, and writes evaluation/results/latest.json. Each dimension is measured against a stated baseline with its n, or says what evidence it still needs. The composite stays null until every dimension is measured. It also measures the orchestrator's work week over week from the runtime journals (evaluation/operations.js, GET /oca/operations): runs that went wrong, runs that produced something the engine confirmed, stops by the model provider counted apart, its own fixes and whether they held, and the person's verdicts. These are measurements, never rewards. The one place they act is the standing pursuit about itself, whose done-when is exactly this comparison: at each week's end the measured result is recorded on it as a receipt, capped so that pursuit never closes.

Last run: 2026-09-24. Mechanism suite: 304/304 passing.

dimension score n status
grounding 0.989 271 measured
prediction 0.000 4958 measured
transfer — — unmeasured
surprise — — insufficient evidence
creativity — — insufficient evidence
metacognition 0.094 379 measured
emotion 0.191 47 measured
counterfactual — — unmeasured
causal — — unmeasured

Evidence coverage 44%. Composite: none yet — it stays empty until every dimension is measured. Prediction: Brier 0.207 against 0.195 for always guessing each metric's base rate, over 4958 predictions (skill 0.000).

Operations, the orchestrator's work over the last 7 days against the 7 before, from the runtime journals:

last 7 days the 7 before
agent runs the engine answers for 41 0
went wrong (failed, or repeated a recent failure) 10 (24%) 0 (—)
stalled (turn budget or timeout) 3 0
productive (something the engine confirmed) 26 (63%) 0 (—)
stopped by the model provider (not counted) 13 0
its own fixes merged 7 0
verdicts from the person (useful or better) 2 (1) 0 (0)

Fixes merged at least a day ago: 7 of 7 holding, 0 recurred. Rates need 10 runs in a week to be compared. Self-improvement criterion: 7 of its own fixes merged; run comparison not measurable (41 and 0 runs; needs 10 in each week).

The block above is written by the benchmark itself, dated, so this README never shows more than the last run did. Prediction is the honest starting point: the engine's stated confidence is scored against always guessing each metric's base rate, and a skill of 0 means no better than that. Want-driven predictions are reported separately and have to beat it.

A blind-judge protocol (scripts/judge-pack.mjs, scripts/judge.mjs) renders a want's journal into a first-person account with the same local model that also, separately, reasons the want through with no engine; a judge scores both blind on a five-point rubric. Packs contain the person's own want text and are written outside the repository.

Running it

Requirements: Node 22+, PostgreSQL 16 with pgvector, an Ollama endpoint for local inference (this deployment runs it on a second machine over Tailscale), and a BGE-large embedding server on :7801 (ONEIRO_EMBED_URL). Optional: the Codex CLI for hard reasoning steps; the engine falls back to the local model when it is unavailable.

npm install
npm run migrate            # DATABASE_URL, default postgres://localhost/oneiro
npm run test:engine        # isolated tests; each clones the tables it needs into a private schema
npm start                  # the daemon: loop + HTTP API on :3333
npm run benchmark          # mechanism suite + scorecard → evaluation/results/latest.json

Live app: http://localhost:3333/ — one section per part of the chain (Overview, Wants, Self-build, Worth, Risk, Affect, Thinker, Chinese Room Meter), hash-routed, polling every 8 s. Overview leads with what needs a person: branches the engine built and wants you to merge, held decisions, wants awaiting evidence. It is also where a person feeds the engine: rate an entity, record an observed receipt on a want, permit the self-build phase, hand it a want about itself.

Useful endpoints: /oca/health, /oca/hunger, /oca/worth, /oca/risk, /oca/emotion, /oca/crm, /oca/trace/:id, POST /ponder (create a want), POST /ponder/:id/outcome (record observed progress), POST /oca/worth/rate (rate an entity).

Environment: ONEIRO_LOCAL_REASONER_URL, ONEIRO_LOCAL_REASONER_TRANSPORT=ollama, ONEIRO_OCA_THINKER_MODEL, OCA_STRATEGY_PROVIDER/OCA_STRATEGY_MODEL, OCA_ENABLE_AUTONOMOUS_ACTIONS (the master switch, off by default), ONEIRO_EMBED_ALLOW_HASH_FALLBACK (off: a blip in the embedder stores no vector rather than a wrong one).

Agents run in their own lane, separate from the thinker. The thinker and planner use the inference policy (OCA_CODEX_MODEL, default gpt-6-astra, at the controls' effort). Deployed agents use OCA_AGENT_MODEL and OCA_AGENT_THINKING (a gateway model such as openai/gpt-6-sol, and a thinking level such as xhigh). Pursuit work uses OCA_PURSUIT_MODEL and OCA_PURSUIT_EFFORT. The self-build Codex coder uses OCA_SELF_BUILD_MODEL, OCA_SELF_BUILD_EFFORT and OCA_SELF_BUILD_SANDBOX. Unset values keep the defaults, so changing an agent's model never changes how the thinker thinks.

Layout

motivation/    worth.js, worth-ledger.js, hunger.js, risk.js, risk-journal.js, interests.js
reasoning/     strategies.js, ponder-queue.js, ponder-service.js, loop.js (the evidence-bound reasoner), trace.js, self-build.js
emotion/       engine.js (affect v4)
hypothesis/    typed, falsifiable predictions and their evaluation against observed metrics
simulation/    forward simulation scored by later outcomes
metacognition/ calibration, stuck detection, bias tracking
memory/        episodic, semantic, consolidation candidates
evaluation/    chinese-room-meter.js, benchmark-harness.js, anti-decay.js, results/
cognitive-loop.js   the tick: sense, feel, run the pursuit queue, settle predictions, consolidate, remember
thinker-bridge.js   the ambient thinker; its actions go through the risk gate
tests/         the mechanism suite (node --test)
docs/          behavioral-integrity.md, evidence-loop.md, the archived v1.2 README

Retired, and why

The 2026-09-18/19 rebuild removed the parts of the earlier architecture that paid the engine for activity or acted outside the risk gate: the dream executor (self-build machinery that wrote files, installed packages, committed, pushed and posted on the strength of a generated dream), the design-model build loop and self-training pool, count-credited goals, autonomic self-modification, the ambient hypothesis generator, and the per-tick creative and simulation sections. Their capabilities survive as strategies or were dead by construction. Dreams remain as a read-only archive (/oca/dreams/state). History holds everything.

Status

Phases 1–6 of the rebuild are in: worth, hunger, risk, affect, the loop as spine, and measurement. Open: a held-out corpus for transfer, counterfactual and causal; more settled want-driven predictions than the meter's thresholds; artifacts rated by a person; and the surface that delivers three to five worthwhile outputs a day to the person's phone. The engine runs continuously; the journals accumulate.

License

MIT

About

Oneiro Cognitive Architecture — embodied machine cognition on consumer hardware. A cognitive fork of OpenClaw.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages