Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# Substrate

An operating system for AI agents (S-185): a top-level orchestrator (an ordinary LLM harness given skills, MCP
servers and hooks) that maps, orchestrates and optimises a working system, on a kernel made of Postgres where
everything is an object. Its shape is `docs/framework.md`; what is built next is `docs/plan.md` ("Next, in order"),
the one plan; every default and its reason is in `DECISIONS.md` (append-only). Read the plan first.
The default distribution (S-209 to S-214): an agent harness (Claude Code first) configured to get things done with
two products, interactively. **Morphogen** is the kit (map, research, catalog, optimise, on Backstage files, no
database); **the Kernel** is Postgres made into a kernel, a layer above the kit that ingests its files; Substrate adds
its optional parts onto the kernel (the environment and gates, the channel, the MCP router, the assistant's view) and
the stack. Its shape is `docs/framework.md`; where each part goes is `docs/parts.md`; what is built next is
`docs/plan.md` ("The re-cut"), the one plan; every default and its reason is in `DECISIONS.md` (append-only). Read
the plan first.

This is the **fresh tree** (S-137). v1 is tagged `v1-final` and its plans are in `docs/archive/`: history, not
plans to work from. v1's databases are kept in the same Postgres volume (`workbench`, `gateway`) and dumped in
`.state/backups/`; what people stated there comes back as data imported into the new store.

The layers (S-185, `docs/framework.md`, `docs/repos.md`): **the Kernel** (Postgres made into a kernel), **Substrate**
(the orchestrator kit, the adapters, the reference stack), **Morphogen** (the optimiser, a Claude Code plugin),
**distributions** (folders in `distributions/` here for now), **MetaSoar** (the research). Every dependency is a
contract, never another project's code. Environments are OpenEnv environments (S-184). Name parts by their role and
models by their alias (`fast`, `slow`, `cloud`), never by model. **The table below is what is in the tree today.**
The old assistant (the companion, the voice head, the worker, blocks, the components judge, the ladder's code) was
removed on 2026-11-23 (S-194): the assistant starts again from scratch, not ported; git keeps the old parts.
The projects (S-209, S-212; `docs/framework.md`, `docs/repos.md`): **Morphogen** (the kit), **the Kernel**, **Substrate**
(the default distribution), **MetaSoar** (the research). A part of Substrate is a kernel module only when it needs the
kernel; otherwise it is an Agent Skill, an MCP server, a compose service or an outside service (S-213). Every
dependency is a contract, never another project's code. Name parts by their role and models by their alias (`fast`,
`slow`, `cloud`), never by model. **The table below is what is in the tree today, before the parts move**
(`docs/parts.md`). The old assistant was removed on 2026-11-23 (S-194); git keeps it.

| Part | Where | Role |
| --- | --- | --- |
Expand Down Expand Up @@ -54,7 +56,7 @@ removed on 2026-11-23 (S-194): the assistant starts again from scratch, not port
committed) may be recommended whatever their licence, with the licence named (S-188). Check before adding.
8. **Every change ends with `scripts/check.sh` passing**, and `scripts/test.sh` where tests exist, or with the
failure named and explained.
9. **Morphogen is the optimiser** (S-185; it was out of the build only so it could be iterated on quickly): use it
9. **Morphogen is the kit** (S-209: map, research, catalog, optimise; S-185 made it the optimiser): use it
through its contract (the cell file, its Claude Code plugin and MCP server), never by importing its code; change
it only by pull request in its own repository, like any upstream project (the `upstream` skill).

Expand Down
1 change: 1 addition & 0 deletions DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,4 @@ Status: **decided** (owner agreed), **adopted** (recommended and taken; confirm
| S-212 | **Substrate is the home of the kernel's optional modules and the default distribution; the kernel's core ships without them; agents and experiments build on the distribution** (2026-11-24; the owner: "the desktop UI and other things which could be Colonel modules but we would not bundle them with the core instead they would ship separately and that's where substrate could be the home of these things which are nice options to have but should not necessarily ship with the core and we'll just included in a default distribution and then we can build all our other agents or experiments on top of that distribution"). Amends S-211 (b) and (d): the parts S-211 sent into the kernel's repository stay here instead, written to the kernel's module contract (S-203) and shipped from this repository. (a) **The kernel's core** is what every kernel user needs and nothing more: knowledge, review, authentication, the module contract and the record. (b) **Substrate's modules**, optional, each a kernel module of its own: the live environment and its gates (its `propose` on the kernel's review lane), the channel into a harness, the MCP router, the desktop (the window manager, the launcher, framed apps) and the assistant's conversation. The desktop's window manager is in the kernel's shell today (the kernel's D-127): whether it moves out to a Substrate module is the kernel's decision, by its own pull request. (c) **The default distribution**, also here: the kernel's core, Substrate's modules, Morphogen's plugin, a harness configured to use them (Claude Code first), and the default stack (the model gateway, local models). (d) **Built on it:** our other agents and experiments (the assistant, MetaSoar's work, the games and embodied environments), each a distribution or a module on top of the default one. (e) **Order:** Morphogen's kit first; then Substrate's parts as kernel modules, in place; then the default distribution; then the test of the bet (S-211 c). `docs/kernel-moves.md` becomes `docs/parts.md`. | direction set |
| S-213 | **A part is a kernel module only when it needs the kernel; the desktop is built here, for use cases** (2026-11-24; the owner: "we're not thinking everything in substrate is going to be packaged as a knowledge kernel module it might be a skill or an mCP server or some default collection of external services"; "now we can build the desktop separately and for use cases rather than just the hypothetical that we would leave in Colonel and once it's solidified it could be made perfect for the core distribution of Colonel and only the substrate specific parts or other system parts layered on top"; "it might wind up being its own product too ... probably not where the money is"). Amends S-212 (b). (a) **The rule:** a part of Substrate is a kernel module only when it needs the kernel (its own role, its data in the kernel's database, the review lane); otherwise it is the standard type it already is: an Agent Skill, an MCP server, a compose service, or an external service in the default collection. So the environment and its gates are a kernel module; the channel and the router are MCP servers (the router a compose service whose registry is in the environment module); the gateway and local models are external services. (b) **The desktop** (a modular web UI that hosts anything, and that agents can drive) is built in this repository against real use cases, not left in the kernel as a hypothetical; once it settles it may go into the kernel's core distribution, leaving only Substrate's own parts layered on it here, or become a product of its own. It is not where the money is (S-210), so it is built only as far as the use cases need. | direction set |
| S-214 | **The desktop stays in the kernel; Substrate's own parts are installed onto its kernel instance** (2026-11-24; the owner: "maybe we should leave the 'desktop ui' where it is if its under the kernel repo, and we'll add substrate-specific parts in substrate's repo to be installed on its kernel instance. simpler, right?"). Supersedes S-213 (b); S-213 (a), the rule for what is a kernel module, stands. The desktop (the window manager, the launcher, framed apps) is the kernel's shell (`modules/ui`, the kernel's D-127) and stays in the kernel's repository; it grows there, by the kernel's pull requests, as use cases need. Substrate's own parts (the assistant's conversation view, the environment module, the channel and router as MCP servers) stay in this repository and are installed onto the kernel instance the default distribution runs, the way any module is. | direction set |
| S-215 | **The documentation follows the re-cut: a new `docs/framework.md`, the old one archived; the README, `CLAUDE.md`, `docs/repos.md` and the plan's intro rewritten** (2026-11-24; the owner: "Update all readmes and strategy documentation"). The shape S-209 to S-214 decided is now what the docs say: two products (Morphogen, the kit; the kernel) and the default distribution (Substrate), with MetaSoar the research. The S-185 framework (objects and traits, the orchestrator, slots, OpenEnv adopted fully) is kept whole as `docs/archive/framework-s185.md`; earlier rows that cite `docs/framework.md` sections mean that file. The other repositories' READMEs and strategy documents follow by their own pull requests (Morphogen #102, MetaSoar #11, a kernel docs PR). | done |
61 changes: 33 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@

> **Map, design and orchestrate software, agents and organisations. Optimise all the things!**

**An operating system for AI agents.** Today's agents live in a terminal where everything is a file. Here a working
system (a business, a codebase, a household, a game) lives in a **kernel** made of Postgres, where everything is an
object: state, actions behind permission gates (`free`, `propose` for your approval, `deny`), events anyone allowed
can subscribe to, and every change recorded. A **top-level orchestrator**, an ordinary LLM harness (Claude Code
first) given skills, MCP servers and hooks, keeps that system working: it **maps** it, **orchestrates** it through
sub-agents in shared environments (any harness, any model, or no model), and **optimises** it through an optimiser
whose judge it cannot edit, toward goals you set, asking before anything that matters. Harnesses join unmodified,
models come through one gateway, tools through MCP, and environments through [OpenEnv](https://huggingface.co/docs/openenv),
so a change can be rehearsed on a copy before it runs for real.

| Part | What it is |
| --- | --- |
| **[Knowledge Kernel](https://github.com/OpenReplicant/kernel)** | Postgres made into a kernel: knowledge with provenance, objects and gated actions, logins and row-level security, the record |
| **Substrate** (this repository) | the orchestrator kit (skills `map`, `catalog`, `research`, `orchestrate`, `optimize`; hooks; adapters for OpenEnv, the model endpoint and compose), the reference stack, and the documentation |
| **[Morphogen](https://github.com/OpenReplicant/Morphogen)** | the optimiser, a Claude Code plugin: cells, optimizers behind a judge they cannot edit, an evidence log |
| **Distributions** (`distributions/`, here for now) | what is built with it: a personal assistant (to be designed anew), the SMB Foundry, games |
| **[MetaSoar](https://github.com/OpenReplicant/MetaSoar)** | the research on cognitive architecture: System 1 distilled from experience (M-17) |

Every dependency between them is a contract, not another project's code: the shape, the slots and what each needs
are in [`docs/framework.md`](docs/framework.md); what is built next is [`docs/plan.md`](docs/plan.md).
**The default distribution:** an agent harness set up to get things done with two products, interactively. It
starts with Claude Code, for its Anthropic subscription. Substrate adds no core of its own. It is the configuration,
the optional parts installed onto the kernel, and the stack that runs them (S-211 to S-214).

**Where it stands (2026-11-23):** the stack below runs on one machine. The OpenEnv spike passed (S-192) and
Morphogen is installed as the optimiser, with Substrate's catalog as its map (S-193). The first assistant (a companion,
a voice head, a worker) was removed (S-194): the assistant starts again from scratch, on this shape.
| Project | What it is |
| --- | --- |
| **[Morphogen](https://github.com/OpenReplicant/Morphogen)** | **the kit:** map a system (interviews, design work, fact-finding), research and catalogue the options for each part, and optimise behind a judge the optimiser cannot edit. Files only, in Backstage's catalog format, on any harness; no database (S-209) |
| **[Knowledge Kernel](https://github.com/OpenReplicant/kernel)** | Postgres made into a kernel: knowledge with provenance, review, logins and row-level security, the record, a module contract, and a desktop in the browser. An optional layer above Morphogen: it ingests the same catalog files when indexing, search or graph traversal are wanted |
| **Substrate** (this repository) | the default distribution: the kernel's core, Substrate's optional parts installed onto it (the live environment and its gates, the channel into a harness, the MCP router, the assistant's view in the kernel's desktop), Morphogen's plugin, a configured harness, a model gateway and local models |
| **[MetaSoar](https://github.com/OpenReplicant/MetaSoar)** | the research: cognitive architecture, and System 1 skills (learned policies, observers and cases in an Agent Skill's folder, each judged as a Morphogen cell) |

A part of Substrate is a kernel module only when it needs the kernel: its own role, its data in the kernel's
database, the review lane. Otherwise it is the standard thing it already is: an Agent Skill, an MCP server, a
compose service or an outside service (S-213). Our agents and experiments are built on this distribution. Every
dependency is a contract (Backstage files, MCP, OpenEnv, Morphogen's cells, an OpenAI- or Anthropic-compatible
endpoint), never another project's code. The shape is [`docs/framework.md`](docs/framework.md); where each part
goes is [`docs/parts.md`](docs/parts.md); what is built next is [`docs/plan.md`](docs/plan.md).

**The bet:** an ordinary strong harness in a well-built environment is the agent we want. It holds where one
implementation project runs end to end on a demo small business without new core code: Morphogen maps the business
and picks an opportunity, the harness carries it out under the kernel's gates, a person approves what matters, and
Morphogen judges the result (S-211).

**Where it stands (2026-11-24):** the stack below runs on one machine, and a person has talked to the assistant in
the kernel's desktop (S-208). The re-cut is decided and the parts are not moved yet. The work goes to Morphogen
(the kit) and the kernel first.

## What runs

The reference stack. Everything is in containers under Podman compose, published on 127.0.0.1 only.
The stack as it is in the tree today, before the parts move (`docs/parts.md`). Everything is in containers under
Podman compose, published on 127.0.0.1 only.

| Part | Where | What it does |
| --- | --- | --- |
Expand Down Expand Up @@ -95,16 +98,18 @@ local models keep everything on this machine.

## Not built yet

`docs/plan.md`, "Next, in order": the repository in its shape; one database, the kernel's; the `orchestrate`,
`optimize` and `rtfm` skills and gate hooks; everything on top of the shape; the bootstrap instance; a new
assistant, designed from scratch; the SMB Foundry distribution.
`docs/plan.md`, "The re-cut": Morphogen as the kit (its pull request), Substrate's parts in their types, the
default distribution, and the test of the bet on a demo small business.

## Where to read more

- [`docs/plan.md`](docs/plan.md): the steps, and where each stands
- [`docs/framework.md`](docs/framework.md): the shape: layers, the orchestrator, objects, slots and contracts
- [`docs/framework.md`](docs/framework.md): the shape: the projects, the contracts between them, what Substrate adds
- [`docs/parts.md`](docs/parts.md): every part of this tree and where it goes
- [`docs/morphogen-kit.md`](docs/morphogen-kit.md): Morphogen as the kit, the proposal for its pull request
- [`docs/repos.md`](docs/repos.md): what each repository owns and depends on
- [`docs/research/`](docs/research/): the prior-art research behind the shape (2026-11-23)
- [`docs/archive/framework-s185.md`](docs/archive/framework-s185.md): the shape before the re-cut (objects, traits, the orchestrator, OpenEnv), history
- [`DECISIONS.md`](DECISIONS.md): every default, every measurement behind it, and why (append-only)
- `CLAUDE.md`: the parts and the rules for working on it

Expand Down
Loading