diff --git a/.claude/settings.json b/.claude/settings.json index de70aba..736bb2f 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -4,7 +4,7 @@ "source": { "source": "github", "repo": "OpenReplicant/Morphogen", - "ref": "9769a0b5781d3f576ede95a90e1f7599caf05c24" + "ref": "63648cad9ad35968e96128ec3d98f29560651fac" } } }, diff --git a/.claude/skills/catalog/SKILL.md b/.claude/skills/catalog/SKILL.md deleted file mode 100644 index da40a76..0000000 --- a/.claude/skills/catalog/SKILL.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: catalog -description: Find alternatives for a role a part plays - search the catalogs (package registries, vendors, parts lists, directories) for candidates that provide the interfaces the role requires, write them into the store (the Knowledge Kernel) with evidence, and set up how they will be measured against the whole's goals. Use when the owner asks what else could do a part's job, whether something better exists, or what to replace a part with; after the map skill has named the role. For Substrate's own components, the research skill wraps this one. ---- - -# Catalog: what else could fill a role - -Works on a role the map skill named (S-139), through the kernel's MCP tools in the `substrate` profile (`mcp__kernel__*`; the map skill says what differs from the old store's tools). A candidate is an -item that *provides interface* what the role *requires interface*; `alternatives` lists every one that does, -and which fills the role now. - -## 1. Read the role - -`read` the role and `alternatives` for it. If it requires no interface, that comes first (the map skill, step -3): without one, everything and nothing is an alternative. Read the whole's goals (*has goal*): they say which -candidates are worth measuring. - -## 2. Search more than one catalog - -A catalog is an item made with `instance_of: catalog` (search for it first): PyPI, npm, crates.io, a container -registry, GitHub, deps.dev, a vendor's range, a standards body's list, a directory of services or people. Search -by need and topic, not by the name you expect; what you remember is a lead, not evidence. For software: -`gh api -X GET search/repositories -f q="topic:TOPIC" -f sort=stars`, deps.dev for a package's versions and -licence, `podman search --list-tags REGISTRY/NAME` for images. - -## 3. Write each candidate with what its source says - -For each: `create_item`; `say` *catalog id* (`catalog-id`) qualified by *catalog* (`in-catalog`); *described at -URL* (`described-at-url`); and *provides interface* only where a source says so, with that source's words as -`evidence`. A candidate that might provide an interface but no source says so: leave the statement out and note -what would settle it. Rule out early on hard limits (the house rules: licence, a release at least two weeks -old) and say which, with the source quoted. - -## 4. Measure, then judge - -`alternatives` again: those that fit. Measuring is a trial on the same cases for each candidate and for what -fills the role now, against real data where there is some: a script that prints one line per candidate and -case, its output kept as the source. Each result is a *measurement* (`measurement`) on the candidate, -qualified by *goal* (`for-goal`) and *point in time* (`point-in-time`), with the output as evidence; a quantity keeps its -amount only, so the unit goes in the goal's metric. - -Whether a candidate is better is a judge's verdict, not yours: *verdict* (`verdict`: `verdict-better`, -`verdict-worse`, `verdict-same`) qualified by *for role*, *against* and *goal*, cited to the judge. Until a judge -is in the build (Morphogen is out while the owner refactors it), tell the owner the measurements and let them -decide; say what you would pick and why. - -## 5. Report - -The candidates that fit, the ones ruled out and why, the measurements, and what you recommend. A change to the -whole (a part replaced) is the owner's: once they decide, `say` the new *has part* with its role, and -`deprecate` your own old statement (its claim id) with the reason (a person's is theirs to deprecate). diff --git a/.claude/skills/map/SKILL.md b/.claude/skills/map/SKILL.md deleted file mode 100644 index 2ba2a6c..0000000 --- a/.claude/skills/map/SKILL.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -name: map -description: Take a thing apart into its parts, the roles each part plays and the interfaces that make parts interchangeable, and write it into the store (the Knowledge Kernel) with evidence - any thing, software or not (a codebase, this machine, a bicycle, a team, a process). Use when the owner asks what something is made of, how its parts work together, what could be swapped or changed, or before cataloging alternatives for a part (the catalog skill). ---- - -# Map: what a thing is made of, and what makes its parts interchangeable - -A map is claims in the store (S-139), which is the Knowledge Kernel (S-153, S-154), through its MCP server's -`substrate` profile (`mcp__kernel__*`: `search`, `read`, `expand`, `locate`, `path`, `alternatives`, `create_item`, -`say`, `deprecate`; `scripts/kernel.sh login NAME` puts the server in `.mcp.json`): a **whole** *has part* a -**part**, qualified by *object has role* the **role** the part plays there; a role *requires interface* the -**interfaces** anything filling it must provide; a part *provides interface* them. Everything you write is your -claim: it enters at normal rank and cites you, and the owner can prefer or deprecate it. - -What differs from the store's own tools (D-105): a write is a change set the kernel's validator applies, so -`say` and `create_item` may wait a few seconds, and answer that the change set is still pending (say so, and -`read` again before you build on it). A new item's id is a long Q number (`Q1763700000123456`), and a statement -is named by its claim id or `#handle` (shown after each line you read), not a uuid. Properties go by key -(`has-part`), Wikidata P number or IRI. Quantities keep the amount only: put the unit in the metric's words. -Every line you read ends with the claims it rests on and their belief: cite them when you tell the owner what is -true. - -## 1. Find the whole, and the question - -`search` before `create_item`, always: `create_item` also answers with similar items already there. Ask what the -map is for (what might change, what should get better) if it is not said: it decides how deep to go. Map to that -depth and stop; a part nobody would change needs no parts of its own. - -## 2. Parts and roles - -For each part: find or make it, then `say` *has part* (`has-part`) on the whole with the qualifier -*object has role* (`object-has-role`). The role is what the part does there, named so another part could do it -("drivetrain", "the store's embedding model", "bookkeeping"), an item made with `instance_of: role`. One part can -play several roles; say each. - -## 3. Interfaces: what makes parts interchangeable - -On each role, `say` *requires interface* (`requires-interface`); on each part, *provides interface* -(`provides-interface`). An interface is what crosses the boundary, named exactly enough to check: an API and its -version, a protocol, a file format, a socket size, a skill set, a schedule. Make each with `instance_of: -interface`. Two parts are alternatives when both provide everything the role requires (`alternatives` lists -them), so an interface named loosely ("an API") makes everything look interchangeable. - -## 4. Evidence - -Every `say` carries `evidence`: the source (`file:path`, an `https://` URL), where in it (`L10-20`, `p3`) and the -quoted text. Read the thing itself (code, config, a running process, a manual) rather than describing it from -memory; what you cannot cite, leave out or ask about. What a person tells you is theirs: quote them with the -conversation as the source, and say so in `note`. - -The quote is the source's text at that locator: copy it from the file (print the lines, don't retype them), and -quote one locator the same way every time you cite it. A different quote at the same locator reads as the source -having changed: it supersedes the earlier span and flags every statement that cited it. Prefer stable places (a -schema line, a decision row) to long lines that change often. The kernel does not -yet flag a statement whose cited file span changed, and `locate` shows no span hash: that is the span-change watcher, -a later item of plan step 3d (`scripts/check.sh` no longer counts moved lines, as it did on the old `store` package -until S-156). - -## 5. Goals - -If the owner says what better means, put it on the whole: *has goal* (`has-goal`) a goal (`instance_of: goal`) -with *metric* (how it is measured, in words a judge could apply) and *target* (a quantity). Measurements and -verdicts come later, from trials and a judge (the catalog skill). - -## 6. Check - -`read` the whole's page; `path` from the whole to an interface; `alternatives` for a role (a role named where an -interface belongs shows up as nothing providing it); `violations` for what breaks a property's constraints (single value, format, -one of, value type), reported by the kernel's constraint checker and never blocking a write. Tell the owner what is mapped, what was left out and why, what -you are unsure of, and where to see it: the UI draws the map at `http://127.0.0.1:8100/#/map/`, and shows an -interface a role requires but its filler lacks as missing. If you got something wrong, `deprecate` your own -statement (its claim id) with the reason, and say the right one. diff --git a/.claude/skills/research/SKILL.md b/.claude/skills/research/SKILL.md deleted file mode 100644 index 6bef8f9..0000000 --- a/.claude/skills/research/SKILL.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -name: research -description: Choose a component, library, service, model or vocabulary for Substrate itself from the catalogs instead of from memory - name the role on Substrate's map, find candidates with the catalog skill, test the shortlist against the need, and record the pick in the store and DECISIONS.md. Use when a step or the owner needs something picked ("which X should we use", "find a library for", "is there something that does"), or before adding any part, package or image. ---- - -# Research: Substrate's own choices, from catalogs, not memory - -The catalog skill applied to Substrate (S-139), with the house rules on top. What you remember about a tool is -a lead, not evidence: every fact that decides the choice comes from a registry's answer or a trial you ran. - -## 1. The role and the need, first - -Find the role on Substrate's map in the store (the kernel's tools, `mcp__kernel__*`: `search` for Substrate, `read` it; the map skill if the part of -it you need is not mapped yet). Write the need before looking at candidates, so candidates are tested against -it rather than the need bent to fit a favourite: the interfaces the role requires (`requires-interface`) and, as -a goal on Substrate (`has-goal`) with a metric and target, whatever is measured. The house rules are always part -of the need: a permissive or LGPL licence in the default stack, a release at least two weeks old, pinned -exactly, one container under Podman for a service, nothing installed on the host. - -## 2. Candidates - -The catalog skill, steps 2 and 3: at least three, from more than one catalog, each with its catalog id, URL and -the interfaces its sources say it provides. Licence, versions and dates come from the registry's answer -(deps.dev, GitHub's API, the LICENSE file when GitHub says NOASSERTION), quoted as evidence, never written from -memory. Rule out on the house rules early and say which. - -## 3. Test the shortlist - -A trial script under `scripts/trials//` runs every shortlisted candidate on the same cases, against real -data where there is some, and prints one result line per candidate and case (output in `.state/trials//`). -Pin every image, jar and package in it; fetch with checksums. Test each need, not what is easy to measure. Each -result goes in as a measurement (the catalog skill, step 4), the output file as its evidence. - -When two or more meet the need and the question is which is better, that is a judge's question (Morphogen, -when it is back in the build); until then the measurements and your recommendation go to the owner. - -## 4. Record the pick - -- In the store: the pick *has part* on Substrate with its role, when a step puts it in; rejected candidates - keep their statements, and a `note` on what would make one the pick. -- In `DECISIONS.md`, a new row when the pick becomes a default: what was pinned, where it was read, the - candidates and why the others lost. diff --git a/CLAUDE.md b/CLAUDE.md index c3a27d7..db0befe 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,7 +41,7 @@ dependency is a contract, never another project's code. Name parts by their role pin exact versions; prefer releases at least two weeks old; record what you pinned and where you read it, in `DECISIONS.md` when it is a default. 2. **Core first, open always.** Add a part, code or a view when a plan step's check needs it, and say which. -3. **Choose from catalogs, not memory**: the `research` skill, for any component, library, service or model. +3. **Choose from catalogs, not memory**: Morphogen's `research` skill (`morphogen:research`, from its plugin; S-216), for any component, library, service or model. 4. **Secrets live in `.env`** (gitignored, mode 600), read through `env_value` and the `sec_*` verbs (`scripts/lib.sh`). Never print one into a committed file, a log, a commit message or chat. `.env.example` lists every setting, empty; `deploy/secrets.txt` says how each secret is made. diff --git a/DECISIONS.md b/DECISIONS.md index a11d743..d9eed67 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -223,3 +223,4 @@ Status: **decided** (owner agreed), **adopted** (recommended and taken; confirm | 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 | +| S-216 | **Substrate on the kit: its rules in the catalog, Morphogen's plugin repinned, its own `map`, `catalog` and `research` skills removed** (2026-11-25; after Morphogen #102 and #103 merged; the owner: "what's next?"; plan "The re-cut" steps 1 and 2). (a) `morphogen.yaml` is gone (Morphogen #103 reads every rule from the catalog): a root `catalog-info.yaml` is a Location naming `catalog/catalog-info.yaml`, and the settings it held (`sandbox: podman`, the sandbox image) are on the System entity under `spec.morphogen`. Morphogen at `63648ca` reads all of Substrate's catalog with no errors (`structure check`: 17 interfaces untested, 6 unused, warnings only), and its `status` says the next step is this catalog on `main`. (b) **The plugin is pinned to `63648ca`** (`.claude/settings.json`, and `repos.yaml`'s `checked`), Morphogen's `main` after #103. (c) **Substrate uses Morphogen's skills like any user:** `.claude/skills/{map,catalog,research}` are removed; rule 3 names `morphogen:research`. Picks are still recorded in `DECISIONS.md` (rule 1). `setup` and `upstream` stay. (d) The operator's `morphogen.local.yaml` still names the retired cell `voice-route`; it is uncommitted and the operator's to tidy. | done | diff --git a/README.md b/README.md index 9cf1e65..8561b21 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Podman compose, published on 127.0.0.1 only. | The channel | `environment/channel.py` | Pushes an environment's signals into a live Claude Code session; a signal not acknowledged comes back | | The gateway | `gateway` (Bifrost), `scripts/gateway.py` | Every model call goes through it under its caller's key and is logged there, not by the caller. Keys decide which providers a caller may reach; a meter counts a judged run's calls (S-193) | | The local models | services `llm` and `llm-fast` (llama.cpp) | Two of your own GGUFs (S-169): a slow capable one on the CPU (`slow`; Inkling 2 Mini here) and a small fast one on the GPU (`fast`; LFM3 1.7B here) | -| The optimiser | Morphogen's Claude Code plugin, `morphogen.yaml` | Cells from Substrate's catalog (`catalog/`); a change is judged on cases it cannot read, its model calls counted at the gateway (S-193) | +| The optimiser | Morphogen's Claude Code plugin; its rules in the catalog (`catalog-info.yaml` at the root, S-216) | Cells from Substrate's catalog (`catalog/`); a change is judged on cases it cannot read, its model calls counted at the gateway (S-193) | | The UI | `ui/`, service `ui`, http://127.0.0.1:8100 | The store's pages and maps as diagrams, read-only | Who may do what is enforced by Postgres logins, not by convention: a process that runs a model can publish and diff --git a/catalog-info.yaml b/catalog-info.yaml new file mode 100644 index 0000000..3bee5ea --- /dev/null +++ b/catalog-info.yaml @@ -0,0 +1,10 @@ +# The project's catalog root for Morphogen and Backstage (S-216): Morphogen reads its rules from catalog-info.yaml at +# the repository root (Morphogen #103); this Location points at the catalog in catalog/, whose own root names every +# entity file. Morphogen's settings for this project are on the System entity (catalog/system-substrate.yaml). +apiVersion: backstage.io/v1alpha1 +kind: Location +metadata: + name: substrate +spec: + targets: + - ./catalog/catalog-info.yaml diff --git a/catalog/catalog-info.yaml b/catalog/catalog-info.yaml index 0798b81..1dbf4bf 100644 --- a/catalog/catalog-info.yaml +++ b/catalog/catalog-info.yaml @@ -1,5 +1,5 @@ # The catalog's root (S-193): a Backstage Location naming every entity file, so a reader such as Backstage or Morphogen -# (morphogen.yaml's backstage:) finds them all; scripts/catalog.py check fails when a file is missing from it. +# (through the root catalog-info.yaml, S-216) finds them all; scripts/catalog.py check fails when a file is missing from it. apiVersion: backstage.io/v1alpha1 kind: Location metadata: diff --git a/catalog/system-substrate.yaml b/catalog/system-substrate.yaml index ff808f5..5ffb1dc 100644 --- a/catalog/system-substrate.yaml +++ b/catalog/system-substrate.yaml @@ -6,3 +6,7 @@ metadata: description: 'Substrate: an environment put on a system, run, watched and changed; its own parts as catalog entries (S-174).' spec: owner: owner + # Morphogen's settings for judged runs here (S-193, moved from morphogen.yaml by S-216): runs in Podman, in this image. + morphogen: + sandbox: podman + sandbox_image: docker.io/library/python:3.13.17-slim-bookworm diff --git a/docs/plan.md b/docs/plan.md index 31caaed..6ec04b4 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -22,12 +22,12 @@ the harness the user chooses, with no database (S-209, the proposal `docs/morpho its files when indexing and traversal are wanted; Substrate is what runs on both. These steps come before the product cut and "Next, in order", which are now Substrate's running system, built after them. -1. **The kit, in Morphogen, by pull request:** the `map`, `catalog` and `research` skills moved there and rewritten +1. **Built 2026-11-25 (Morphogen #102, #103): the skills, the format, cells in the catalog; not yet run: its done-when, a made-up firm mapped with no kernel.** **The kit, in Morphogen, by pull request:** the `map`, `catalog` and `research` skills moved there and rewritten for files, Morphogen's and Substrate's `map` merged into one, the catalog entry's format (interfaces, adjustable parameters, licence, docs link) in its `schemas/`, its README saying what it is now. Done when the plugin, with no kernel running, maps a made-up firm from its documents and an interview into entity files, catalogues the options for one role, and drafts cells for one opportunity. -2. **Substrate uses the plugin like any user:** its three skills removed from `.claude/skills/`. Done when +2. **Built 2026-11-25 (S-216): the plugin repinned, the three skills removed, Morphogen reads Substrate's catalog with no errors; `scripts/check.sh` waits on the stack being up.** **Substrate uses the plugin like any user:** its three skills removed from `.claude/skills/`. Done when `scripts/check.sh` passes and mapping Substrate itself works through the plugin. 3. **The engagement, on a demo SMB:** from the firm's material to a report of optimisation opportunities, each written up as an implementation project (what changes, the target and its measure, the options catalogued, the diff --git a/morphogen.yaml b/morphogen.yaml deleted file mode 100644 index 2b7fda5..0000000 --- a/morphogen.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# Morphogen's map of Substrate (plan step 2, S-193): the cells come from the catalog's Backstage entities (catalog/, -# written by the map skill); this file adds what the catalog does not hold, below its grain. Morphogen is the judge: -# a candidate may change only what its cell's `change` names; everything else here, the catalog, the workloads, the -# scorers and the tests are the base's. Held-out answers, the gateway and its meter are the operator's, in the -# uncommitted morphogen.local.yaml. -backstage: catalog/catalog-info.yaml -sandbox: podman -sandbox_image: docker.io/library/python:3.13.17-slim-bookworm -# The first cell, voice-route (S-193), measured the old voice head and went with it (S-194); its verdict stays in the -# evidence log. The next cell is one on a part that stays. diff --git a/repos.yaml b/repos.yaml index e5d86f6..7fea49c 100644 --- a/repos.yaml +++ b/repos.yaml @@ -7,7 +7,7 @@ morphogen: url: https://github.com/OpenReplicant/Morphogen branch: main - checked: 9769a0b5781d3f576ede95a90e1f7599caf05c24 # 2026-11-23 main after #101; the same commit the plugin is pinned to (.claude/settings.json, S-193) + checked: 63648cad9ad35968e96128ec3d98f29560651fac # 2026-11-25 main after #103 (the kit: cells in the catalog, morphogen.yaml gone); the plugin's pin (.claude/settings.json, S-216) # The Knowledge Kernel, Substrate's store (S-153, S-154): its image is built from this clone (scripts/build.sh kernel) and # the tests of the store on the kernel run in it; its published image (ghcr.io/openreplicant/kernel:main) is pulled (S-167). kernel: