Governed AI research evidence platform · Reproducible evaluation · Human-controlled selection · Auditable experiment history
Current scope: v0.3 adds an offline measurement-only RSI study; v0.2 adds bounded experiment sweeps, a local evidence graph, optional live LLM evidence summaries and a fixed model–harness comparison. The synthetic task remains 20 public support tickets. Autonomous recursive self-improvement, automatic code changes, model training, deployment and protected real-world benchmarks are not implemented. The name expresses the research theme, not an established capability.
The new offline module illustrates the distinction between task-level gain and a change in gain using fixed, authored toy traces. It automatically computes paired descriptive statistics, checks equal budgets, and emits a reproducible JSON evidence envelope. It does not generate, train or improve any AI system.
| Scenario | Interpretation |
|---|---|
| flat | Positive task gains do not imply increasing improvement ability |
| rising | Hypothetical larger second gains |
| falling | Hypothetical smaller second gains |
| unequal-budget | Comparison withheld because resources are unmatched |
python -m recursiveai.rsi_study replay --scenario rising > study.json
python -m recursiveai.rsi_study verify study.jsonSee measurement system design for architecture, report integrity, CLI and test coverage. This is an explicitly synthetic educational study, not an autonomous recursive self-improvement engine.
| Feature | Current implementation |
|---|---|
| Bounded research experiments | Operator-invoked sweep of at most three predefined variants; persists evidence; no automatic approval |
| GraphRAG research memory | Typed evidence graph, lexical seeds, bounded multi-hop expansion, context digest, optional LLM summary with source IDs |
| Model–harness research | Fixed one- or two-model by one- or two-instruction comparison; descriptive scoring only, not co-evolution |
| Live LLM integration | OpenAI Responses API, explicit network consent, environment key, no tools, bounded requests |
| Autonomous recursive self-improvement | Not implemented or demonstrated; measurement-only synthetic study available |
python -m recursiveai.research_cli --db research.db sweep
python -m recursiveai.research_cli --db research.db graph "normalized billing"
# Set OPENAI_API_KEY securely in your environment, then select a model you can access:
python -m recursiveai.research_cli --db research.db graph "normalized billing" --model YOUR_MODEL --allow-network
python -m recursiveai.research_cli matrix --models YOUR_MODEL_A YOUR_MODEL_B --allow-networkThe graph and matrix extensions return JSON reports. The core registry retains the fixed sweep experiments. Live provider outputs are unverified until executed with a configured API key; generated summaries require human review. The original architecture diagrams below describe the offline core; the new diagram describes the added opt-in paths. See research extensions design for data model, budgets, interfaces, privacy, testing and limitations.
- Vision and scientific motivation
- Scope and capability matrix
- System architecture
- Component deep dive
- Experiment lifecycle
- Evaluation system design
- Evidence storage and data model
- Human review and governance
- Transaction and failure handling
- API and CLI contracts
- Dashboard design
- Security architecture
- Deployment and operations
- Testing and scientific validity
- Quick start
- Technology stack
- Repository structure
- Architecture gallery
- Limitations and responsible interpretation
AI systems are increasingly used to support software engineering, evaluation and scientific research. The central research question behind recursive self-improvement is whether a system can become more effective at improving AI itself. This is a different proposition from a static system performing better on a task after a developer changes its configuration.
RecursiveAI OS focuses on the supporting research infrastructure: experimental provenance, comparable evidence, explicit review and reproducibility. It supplies a bounded reference that demonstrates how a research result can be generated, inspected, preserved, verified and revoked without treating a higher benchmark score as proof of recursive intelligence.
Three levels must remain distinct:
| Level | Question | Current repository |
|---|---|---|
| Task-level improvement | Does a predefined variant outperform a fixed baseline on a specified task? | Demonstrated through an executable synthetic fixture |
| Improvement-process effectiveness | Does a research process itself become more effective? | Not measured |
| Sustained recursive improvement | Does an AI repeatedly become better at improving AI? | Not implemented or demonstrated |
A successful run is an observation about a particular classifier and dataset, not evidence of general intelligence. The research infrastructure is intended to make this distinction explicit.
- Evidence over claims: record configuration, source and dataset identity alongside measured outcomes.
- Deterministic comparisons: evaluate the same labeled examples for both variants.
- Human decision authority: no result becomes active solely because it passes a numerical gate.
- Separation of duties at the code-module level: evaluation and policy logic are not candidate inputs.
- Preserve negative outcomes: rejected and rolled-back results remain available.
- Minimal operational surface: local Python, SQLite, no credentials and no external execution.
- Honest reporting: no fabricated benchmark figures or claims of frontier-model research.
| Domain | Implemented functionality | Boundary |
|---|---|---|
| Experiment orchestration | Explicit run command and static configuration catalog | No autonomous planner |
| Task execution | Deterministic keyword classifier | Not an LLM agent |
| Evaluation | Paired exact-match accuracy, per-class results, changed predictions | Public synthetic dataset |
| Statistical analysis | Paired bootstrap percentile interval | Not independent validation |
| Resource evidence | Token membership-check proxy | Not latency, energy or billing |
| Policy | Four fixed acceptance checks | Not a general AI safety evaluation |
| Provenance | Source SHA-256, fixture SHA-256, UUID, UTC timestamp | No signed provenance |
| Data persistence | SQLite, WAL, transactions | Local single-workstation design |
| Governance | Approve, reject, revoke active selection | No deployment integration |
| Audit | Hash-linked events and materialized state comparison | No external immutable anchor |
| User interface | Read-only HTML and JSON | No public web application |
| Testing | Nine unit/integration cases and configured CI | Check CI for execution status |
| GraphRAG evidence memory | Local property graph with optional LLM summarization | No vector DB or multi-agent orchestration |
| Model training, architecture search, self-modification | Not implemented | No autonomous recursive loop |
The implemented platform is a modular Python application rather than a distributed microservice network. Modules define responsibility boundaries, but share the same trusted process and filesystem. SQLite is the persistence boundary. The local dashboard has no mutation endpoint; the CLI is the explicit operator interface.
| Plane | Components | Ownership |
|---|---|---|
| Control | CLI, explicit operator decisions | User initiating research commands |
| Task | Catalog, static dataset, classifier | Version-controlled source |
| Evaluation | Paired evaluator, metrics, policy | Fixed Python logic |
| Evidence | Registry, database, audit chain | Transactional storage |
| Presentation | HTML dashboard, JSON API | Read-only views |
The CLI imports the registry and dashboard. The registry calls the evaluation functions. Evaluation invokes the classifier and dataset catalog. The dashboard queries the registry snapshot. The classifier does not invoke the registry, mutate source code, access network services or launch subprocesses.
The offline core deliberately uses a small local implementation. It has no Kafka, Kubernetes, Temporal, LangGraph or distributed workers. The optional research extension provides a text-only external model adapter with explicit network permission. The original diagrams describe the offline core.
| Concern | Current mechanism | Limitation |
|---|---|---|
| Consistency | Transactional state changes and snapshot reads | Single SQLite database |
| Determinism | Fixed inputs, variant names and random seed | Runtime/version changes can affect reproducibility |
| Recoverability | WAL, database backups, audit replay | No high-availability cluster |
| Observability | Stored evidence, dashboard and JSON | No tracing/metrics backend |
| Extensibility | Modular Python source | Changes require normal developer review |
| Security | Local OS trust, restrictive file creation, loopback HTTP | No remote authentication |
| Capacity | 20 examples per experiment; latest 500 records in snapshot | No load-tested throughput claim |
4.1 Operator interface — main.py
The command-line entrypoint uses argparse to enforce known commands and variant values. It creates the local registry, dispatches to methods, emits JSON and returns an exit status. The core process sets umask 077 for newly created files. Existing filesystem permissions are not automatically repaired.
4.2 Task catalog — catalog.py
The dataset contains five synthetic tickets for each of billing, access, delivery and other. Every variant receives the same ticket text. Three configurations are explicitly enumerated:
| Variant | Behavior |
|---|---|
| baseline | Case-sensitive whitespace tokenization; fixed keyword dictionaries |
| normalized | Lowercase word tokenization; same dictionary |
| expanded | Lowercase word tokenization; predefined additional synonyms |
The classifier scores keyword membership by class, returns the highest-scoring label and defaults to other if all scores are zero. Ties are deterministic given dictionary insertion order. The operation proxy is token count multiplied by the number of keyword-bearing classes.
4.3 Evaluator — evaluation.py
The evaluator executes the baseline and chosen variant for each example, aggregates per-class counts, reports paired differences and computes a deterministic bootstrap interval. The source digest identifies the exact bytes of catalog.py and evaluation.py; the dataset digest identifies canonical JSON of the fixture.
The policy is version 1 and checks a minimum sample count, minimum positive gain, absence of class-level regression and a bounded operation proxy. A passing policy does not automatically record a decision. The operator must explicitly approve.
4.5 Experiment registry — registry.py
The registry creates the SQLite schema, opens explicit transactions, writes experimental evidence, records decisions, maintains one active pointer and appends hash-linked events. Review re-evaluates approved candidates against current source and checks policy. Verification reconstructs recorded state from the event log.
4.6 Dashboard — dashboard.py
The dashboard is a synchronous standard-library HTTPServer bound to 127.0.0.1. It serves HTML, JSON and a liveness endpoint. It escapes displayed user-controlled strings and sends security headers. It is a local viewer, not a hosted enterprise UI.
sequenceDiagram
actor Operator
participant CLI
participant Registry
participant Evaluator
participant Catalog
participant DB as SQLite
Operator->>CLI: run --variant normalized
CLI->>Registry: run(variant)
Registry->>Evaluator: evaluate(variant)
loop Every fixture example
Evaluator->>Catalog: classify baseline
Catalog-->>Evaluator: label and operations
Evaluator->>Catalog: classify selected variant
Catalog-->>Evaluator: label and operations
end
Evaluator-->>Registry: paired metrics and fingerprints
Registry->>Registry: compute fixed policy
Registry->>DB: BEGIN IMMEDIATE
Registry->>DB: insert evidence and audit event
Registry->>DB: COMMIT
Registry-->>CLI: experiment record
CLI-->>Operator: JSON evidence
- Pending means an experiment exists with no decision.
- Rejected means the operator recorded rejection; the evidence remains.
- Approved means the operator recorded approval after reproduction and policy checks.
- Active is a separate singleton pointer, not an experiment status.
- Rollback clears the active pointer; it does not erase approval or restore a previous active selection.
No automatic iteration follows approval. Each core run uses the same fixed baseline; the explicit sweep command can invoke up to three independent core runs.
| Metric | Definition |
|---|---|
| Baseline accuracy | Correct baseline predictions divided by sample count |
| Candidate accuracy | Correct candidate predictions divided by sample count |
| Gain | Mean per-example difference in correctness |
| Changed predictions | Number of examples where predicted labels differ |
| Improved | Baseline incorrect, candidate correct |
| Regressed | Baseline correct, candidate incorrect |
| Per-class accuracy | Correct predictions for a class divided by its sample count |
| Operations | Token membership-check proxy for baseline and candidate |
| ci95 | Percentile endpoints from paired bootstrap resampling |
For example i, let b_i and c_i be binary correctness indicators. The reported gain is the mean of c_i minus b_i. Positive gain may coexist with individual regressions; class-level reporting exposes some aggregate masking but does not guarantee that every example improves.
The bootstrap resamples the paired correctness differences with replacement using 2,000 draws and seed 17. It sorts the resulting sample means and selects the 2.5th and 97.5th percentile indices. The interval is reproducible for the same runtime and inputs.
The public fixture is small and authored with knowledge of the static variants. Consequently, the interval is an illustration of the method, not a credible uncertainty estimate for deployment performance. No held-out split or independent dataset service is present.
| Check | Rule |
|---|---|
| minimum_samples | n >= 20 |
| positive_gain | gain >= 0.05 |
| no_class_regression | Candidate accuracy >= baseline for every class |
| bounded_operations | Candidate operation proxy <= 2 x baseline |
All four checks must pass. The current policy does not use the confidence interval as a condition and is not a general-purpose safety or release policy.
erDiagram
EXPERIMENTS ||--o| DECISIONS : reviewed_by
EXPERIMENTS o|--o| ACTIVE : selected_by
EXPERIMENTS {
string id PK
string created
string evidence
}
DECISIONS {
string experiment PK,FK
string decision
string reviewer
string reason
string created
}
ACTIVE {
int singleton PK
string experiment FK
}
AUDIT {
int seq PK
string previous
string payload
string hash UK
}
The experiments table stores a UUID, UTC creation time and canonical JSON. The decisions table references an experiment by primary/foreign key, allowing at most one decision per experiment. The active table contains one row and may reference an approved selection or NULL. Audit rows hold sequence number, previous digest, JSON payload and unique event digest.
The audit relationship to experiment IDs is encoded in event payloads, not enforced as a foreign key. The database schema does not prohibit privileged users from changing records; immutability is an application convention with verification support.
experiment
id: UUID string
created: UTC timestamp
metrics:
variant: baseline | normalized | expanded
dataset_sha256: hexadecimal digest
source_sha256: hexadecimal digest
n: integer
baseline_accuracy, candidate_accuracy, gain: number
ci95: two numbers
changed_predictions, improved, regressed: integers
operations: [baseline count, candidate count]
per_class:
label: {n, baseline, candidate}
policy:
version: integer
pass: boolean
checks: map of check name to boolean
Snapshot records additionally contain decision, reviewer and reason (nullable). These are fields and types, not invented experimental outputs.
Audit event digests use canonical JSON of a sequence number, previous hash and event payload. The genesis value is 64 zero characters. Verification checks the sequence and digest links, replays experiment/review/rollback events and compares reconstructed state with the materialized tables.
The audit log is tamper-evident against inconsistent local edits, not cryptographically signed or externally anchored. An administrator who rewrites the complete database and hash chain may evade detection.
Approval checks the current source digest, recomputes the stored metrics and evaluates the policy again before recording a decision. A rejection is recorded without requiring a passing policy. A later approved experiment replaces the active pointer. The reviewer name and reason are required strings, not authenticated identity or a digital signature.
flowchart TD
A[Stored experiment] --> B{Operator decision}
B -->|Reject| C[Record rejection]
B -->|Approve| D{Source and evidence reproduce?}
D -->|No| E[Refuse approval]
D -->|Yes| F{Fixed policy passes?}
F -->|No| E
F -->|Yes| G[Record approval and active pointer]
G --> H[Explicit rollback clears pointer]
C --> I[Preserve evidence and audit]
G --> I
H --> I
An experiment cannot have more than one recorded decision. Approval must be explicit and pass the fixed gate. A rollback cannot succeed without an active selection. Every successful mutation writes a corresponding event in the same transaction. None of these operations invokes a deployment system or modifies the classifier source.
SQLite write paths use BEGIN IMMEDIATE and a 10-second busy timeout. Read paths use a transaction for consistent snapshots. Foreign keys are enabled on registry connections. WAL mode permits reader/writer coexistence while SQLite serializes writes. No separate queue or automatic retry worker is present.
| Failure | Handling | Recovery expectation |
|---|---|---|
| Invalid variant | CLI or catalog rejects input | Select a known configuration |
| Missing experiment | Review raises an error | Inspect experiment IDs |
| Source changes | Approval refused | Run against current source |
| Policy failure | Approval refused | Preserve and review failed result |
| Duplicate review | Rejected in write transaction | Inspect existing decision |
| No active selection | Rollback refused | Inspect snapshot |
| Exception during write | Transaction rolled back | Retry manually after diagnosing |
| Audit inconsistency | verify returns false | Investigate and restore trusted backup |
| Database lock or disk problem | SQLite exception; no partial transaction | Resolve filesystem/locking issue |
| Lost database | No remote replica | Restore from local backup |
The CLI catches ValueError and OSError for friendly errors; some SQLite exceptions can propagate as tracebacks. The implementation does not promise automatic crash recovery beyond SQLite transaction semantics or service-level availability.
All commands accept the global --db option before the command.
| Command | Required arguments | Result |
|---|---|---|
| init | none | Database path |
| run | --variant | New experiment record |
| list | none | Active pointer and up to 500 recent experiments |
| review | ID, --decision, --reviewer, --reason | Updated snapshot |
| rollback | --reviewer, --reason | Updated snapshot |
| verify | none | JSON valid boolean; exit 0 or 1 |
| dashboard | optional --port | Local HTTP server |
Examples use a local database called research.db. Reviewer labels should not contain credentials or personal information.
| Method and path | Purpose | Response |
|---|---|---|
| GET / | Human-facing evidence table | text/html |
| GET /api/experiments | Evidence snapshot | application/json |
| GET /healthz | Process liveness | application/json |
| Other GET paths | Unsupported | 404 |
| Mutation methods | Not implemented | No write action |
The host header must match the allowed local host and port. The server is synchronous and local only. Health does not query the database; it must not be represented as readiness or an end-to-end health guarantee.
The main view displays experiment identifier, variant, baseline accuracy, candidate accuracy, gain, policy pass, decision and reviewer. It also displays the active experiment identifier. JSON exposes the complete stored metrics in the latest 500 records. Refresh the page to update the view.
The dashboard is deliberately not a control plane for remote experiment execution. It has no external JavaScript, user accounts, background polling or write endpoint. The diagram above describes the interface; it is not a fabricated screenshot.
The local operating-system user, source checkout, Python runtime and filesystem are trusted. The experiment catalog is manually authored and does not receive arbitrary code. Evaluation and evidence storage are in the same process; their separation is a source-code boundary, not an independently isolated evaluator.
| Risk | Existing control | Residual limitation |
|---|---|---|
| Unknown variant | Enum validation | Trusted source can still change |
| Data manipulation | Audit replay | Complete privileged rewrite is possible |
| Silent evidence drift | Source and dataset fingerprints | Hashes are not signatures |
| Unauthorized remote access | Loopback binding and Host validation | Local users remain trusted |
| HTML injection | HTML escaping and restrictive CSP | No formal penetration testing |
| Accidental approval | Explicit CLI and policy gate | Reviewer label is not authenticated |
| Secret leakage | No required keys or provider calls | Operator reasons may contain sensitive text |
| Public benchmark overfitting | Explicit limitations in documentation | Fixture is not protected |
The HTTP responses use Cache-Control no-store, X-Content-Type-Options nosniff and a restrictive Content-Security-Policy. No secret manager or cloud credentials are required for the offline core. Live research commands require an API key and explicit network permission. Keep the repository and database separate from sensitive or proprietary research.
See SECURITY.md for responsible vulnerability reporting.
Python 3.11+ and the standard library are enough to run directly from a checkout. The Dockerfile packages the local CLI using a non-root UID of 10001 and a data directory at /data. The dashboard is best run directly on the trusted workstation because it binds only to loopback.
docker build -t recursiveai-os .
docker volume create recursiveai-data
docker run --rm -v recursiveai-data:/data recursiveai-os init
docker run --rm -v recursiveai-data:/data recursiveai-os run --variant normalized
docker run --rm -v recursiveai-data:/data recursiveai-os verifyEnsure the mounted volume is writable by UID 10001. Do not publish the dashboard to the public internet.
Before a run, inspect the source revision and local DB path. After a run, inspect the metrics, policy and provenance in JSON. Record decisions only after human review. After unexpected changes, execute verify and inspect the audit mismatch. Back up the database through SQLite's backup API or stop writers and create a consistent copy; copying only the main database during active WAL writes can lose recent data. Restore into a separate local path and verify before replacing the original.
The application is synchronous and intentionally small. It has no scheduler, worker pool, distributed consensus, partitioning, service discovery, queues, service-level objectives or production load-test results. The 500-row snapshot limit protects the view from unbounded record lists but is not pagination; audit verification reads the full history. Storage grows with experiment and audit records. This is not a multi-tenant production platform.
Nine original core test cases cover unknown variants, reproducibility, policy pass/fail, bootstrap behavior, approval and rollback, rejection and duplicate review, audit tampering, evidence tampering and HTML escaping. GitHub Actions configures Python 3.11 and 3.12 jobs with unit tests, compile checks and a CLI smoke sequence.
python -m unittest discover -s tests -v
python -m compileall -q recursiveaiCheck GitHub Actions for actual test results. The existence of a CI workflow or test suite does not establish a green build. No coverage percentage or performance benchmark is claimed.
A defensible report should identify the source revision, dataset fingerprint, sample size, task and variant, baseline and candidate outcomes, paired uncertainty, resource proxy, reviewer decision and the known limitations. Never infer generalization or recursive improvement from this public fixture. Results should be produced by execution rather than invented for a README.
Further detail: Research methodology and System design.
git clone https://github.com/suhasagg/RecursiveAI-OS.git
cd RecursiveAI-OS
python -m unittest discover -s tests -v
python -m recursiveai --db research.db init
python -m recursiveai --db research.db run --variant normalized
python -m recursiveai --db research.db list
python -m recursiveai --db research.db verify
python -m recursiveai --db research.db dashboard --port 8765Open http://127.0.0.1:8765. To record a decision, use a separate terminal and substitute a real experiment ID obtained from the run or list output:
python -m recursiveai --db research.db review EXPERIMENT_ID --decision approve --reviewer local-reviewer --reason "Reviewed synthetic result"
python -m recursiveai --db research.db rollback --reviewer local-reviewer --reason "Revoke selection"
python -m recursiveai --db research.db verifyAn approval may be refused if the source or evidence changed or if the policy fails. No deployment occurs.
| Layer | Technology |
|---|---|
| Runtime | Python 3.11+ |
| CLI | argparse |
| Classification | Python regex, dictionaries and sets |
| Metrics | collections.Counter, random |
| Serialization and fingerprinting | json, hashlib SHA-256 |
| Persistence | sqlite3 with WAL |
| Identifiers | UUID |
| Dashboard | http.server, HTML and CSS |
| Tests | unittest, tempfile, unittest.mock |
| Optional live LLM | OpenAI Responses API over urllib |
| Evidence graph | Python adjacency sets, lexical retrieval |
| Build | setuptools, pyproject.toml |
| Packaging | Docker, non-root runtime |
| CI | GitHub Actions |
| Documentation | Markdown, SVG and Mermaid |
RecursiveAI-OS/
├── README.md
├── SECURITY.md
├── Dockerfile
├── pyproject.toml
├── .github/workflows/ci.yml
├── recursiveai/
│ ├── __init__.py
│ ├── __main__.py
│ ├── catalog.py
│ ├── evaluation.py
│ ├── registry.py
│ └── dashboard.py
├── tests/test_core.py
└── docs/
├── SYSTEM_DESIGN.md
├── RESEARCH.md
├── architecture.svg
├── lifecycle.svg
├── metrics.svg
├── trust.svg
└── visuals/
├── 01-platform-map.svg
├── 02-module-map.svg
├── 03-evaluation-flow.svg
├── 04-evidence-model.svg
├── 05-review-state.svg
├── 06-transaction-boundary.svg
├── 07-deployment.svg
├── 08-verification.svg
├── 09-research-boundary.svg
└── 10-dashboard.svg
All graphics are repository-local SVG files, designed to be readable on GitHub without a separate diagram rendering service.
| Graphic | Architectural perspective |
|---|---|
| Platform map | Control and evidence planes |
| Module map | Actual source dependencies |
| Evaluation pipeline | Paired inputs and metrics |
| Evidence model | Relational entities and audit replay |
| Review architecture | Approval, rejection and rollback |
| Transaction boundary | Atomic persistence and errors |
| Deployment topology | Single workstation deployment |
| Verification | Tests and CI checks |
| Research boundaries | Implemented vs unproven capability |
| Dashboard | Read-only interface |
| Original architecture | Component overview |
| Original lifecycle | Experiment workflow |
| Original metrics | Evidence metrics |
| Original trust | Storage and audit |
| Research extensions | Bounded experiments, graph retrieval and live model comparison |
| RSI measurement | Offline synthetic trace replay and interpretation |
RecursiveAI OS is a research-themed local reference implementation. It includes a local evidence graph and opt-in text-only model provider. It does not have an autonomous AI researcher, meta-agent, learned optimization policy, autonomous feedback cycle or self-modifying code. It does not claim genuine recursive self-improvement. For more context on research limitations, read RESEARCH.md.
Potential engineering hardening includes clearer database migration tooling, authenticated reviewer identities, externally anchored audit checkpoints, improved error handling, backup tooling, dashboard pagination and test coverage. Such changes would require separate implementation and validation. They are not current capabilities.
The platform's central contribution is a transparent and reproducible record of bounded experiments, with explicit human decisions and an audit history that can be independently inspected.
RecursiveAI OS | Research evidence, reproducibility and human governance.