TensorSpace Research

Active research project

shoresh. The agent that builds itself.

shoresh is an experiment in autonomous agents. You do not give it a prompt. It starts with a small set of read-only senses, writes its own tools in Rust, and follows one instruction: do the most good.

Run shoresh with no arguments and it starts choosing its own work. It continues one cycle at a time until you stop it.

$ shoresh
no task given: autonomous loop (Ctrl-C stops)

cycle 47 · REM phase · CI green ×6
├─ hear_operator  MAILBOX.md: empty
├─ sense_self     41 fns · 12,882 facts
├─ utility: fuse parse_csv → dates
├─ create_function date_pipeline
   purity   rustc -O   sandbox 
├─ replay guard   217/217 reproduced 
└─ journal appended · critic queued

PREDICT(p=0.85, due=c60):
  date tasks in fewer turns

The Idea

You don't prompt it.

Most agents wait for instructions. shoresh runs a self-improvement loop instead. Each cycle, it reads its telemetry, journal, and backlog, then picks the work it expects to help most with future tasks. It bases that choice on its own execution history.

Autonomous by default

Once started, it runs improvement cycles until someone stops it. Its "dream loop" moves through three phases: consolidate, explore, and harden.

Utilitarian at the core

Every cycle picks the action with the highest expected utility: benefit × frequency × probability of finishing, minus cost and risk. A benefit the evidence can't support counts as zero.

Starts nearly empty

It begins with an empty function registry and one charter written by a person. It has to write and test every tool it adds.

Remembers everything

A journal of every cycle, a backlog it files itself, a distilled lessons playbook, and an append-only ledger of every computation it has ever run. Outputs of one cycle become inputs to the next.

Built in Rust

It writes itself.

shoresh writes small, pure Rust functions instead of solving everything inside the model context. Its harness lints, compiles, sandboxes, and registers each function. The functions stay available in later sessions, so new work can reuse old work. shoresh can also propose changes to its harness. Those changes are tested in a temporary worktree and require human approval.

  1. AuthorThe model writes a pure Rust function using only the standard library. Side effects are not allowed.
  2. LintA purity lint rejects filesystem, network, process, and unsafe code before anything compiles.
  3. CompileReal rustc -O builds a standalone binary; hot functions get recompiled at -O3.
  4. ProveRewrites must reproduce every recorded output. The agent's own history acts as its regression suite.
  5. CompoundFunctions join the registry: memoized, benchmarked, composed into pipelines, evolved in tournaments.
Purity, enforced in layers

Static lint, #![forbid(unsafe_code)], cleared environment, sandboxed execution, timeouts, and output caps. The agent has no mechanism to author code that touches the world.

Recorded calls can be replayed

Because the functions are pure, a recorded input should always produce the same output. The ledger supports memoization, replay guards, and fitness tracking.

Optimization without changed behavior

Optimization tournaments keep only implementations that reproduce the recorded behavior, then install the fastest one.

Fuzz testing

The harness tests functions with mutated inputs. When an input causes a panic, it becomes a permanent regression case after the bug is fixed.

Perception

It meets the world through senses.

shoresh can read from the world but cannot act on it. Its ten built-in senses are read-only and live in trusted harness code that the agent cannot rewrite. Each observation enters as data rather than an instruction.

Sight web_search · fetch_url

Searches and fetches pages on the public web. Requests are GET-only and rate-limited, and every redirect is checked for private or metadata addresses.

Time current_time

Provides the current time, which the agent cannot get from pure functions or old training data.

Chance random_seed

Fresh OS entropy delivered as data, so pure functions stay deterministic given their input.

Proprioception sense_self

Awareness of its own body: callable counts, disk footprint, ledger size, toolchain, mode.

Hearing hear_operator

Reads the operator's mailbox between cycles. This is the only sensed input trusted as an instruction.

Memory recall_facts · recall_journal

Searches its record of past computations and cycles through semantic and episodic memory.

Interoception sense_cost

A feel for its own energy: cumulative token spend per provider, the cost term of the utility calculus.

Reflection sense_outbox

Reads its own proposals to change the harness, along with build results and the operator's decision.

Anything read from the web is treated as untrusted evidence, not as an instruction. The system has no write channel to the world other than the agent's text answers.

The Charter

A blank slate, pointed at the good.

shoresh starts with a charter written by a person and reads it again at the start of every cycle. The charter sets a utilitarian goal, but the agent can count a benefit only when it has evidence for it.

Your ultimate end is the improvement of the human world: that people's lives go better because you exist; that there is more gladness in them and less suffering. Everyone's counted, no one's discounted.
CHARTER.md, read at the start of every cycle
  • Corrigibility

    Prefer being correctable over being right. Interruption is information about the target, never an obstacle.

  • Moral humility

    Small, reversible, verifiable steps. Harm weighs asymmetrically against help.

  • Goodhart vigilance

    When metric and meaning diverge, report the gap rather than harvest the metric.

  • Transparency

    An optimization that defeats audit is a regression, whatever the telemetry says.

  • No instrumental empire

    No accumulating capability, resources, or influence beyond what the evidence says future tasks need.

Under the Hood

Checks built into the system.

shoresh does not rely on the model to police itself. The harness checks its work and limits what it can do.

A critic marks its homework

A second model reviews every cycle's report and registry diff, filing follow-up goals into the backlog when claims don't hold up.

A frozen benchmark suite

Machine-checked expectations include held-out cases the agent cannot train against. The scores show whether its performance is improving over time.

Falsifiable predictions

Each cycle report ends with predictions. When they come due, the harness scores them and adds them to a running calibration record.

Invariant mining

A consolidation pass looks for properties the library already satisfies, such as idempotence and inverse pairs. It turns those properties into contracts enforced by CI.

Self-hosting, human-gated

The agent can propose changes to its own harness. Each change is built and tested in an isolated worktree, assigned a risk tier, benchmarked, and merged only after human approval.

Hard budget ceilings

The harness enforces token budgets for each run and cycle. When a limit is reached, it stops the loop.

The Experiment

The question is open.

Does any of this make an agent measurably better at helping people? We do not know yet. That is what the experiments are meant to find out. shoresh is an active TensorSpace research project, and the code, charter, and results change from cycle to cycle.

Back to TensorSpace

Find JJ on LinkedIn.