Skip to content

Add verifiable organism foundry - #33

Merged
0thernet merged 19 commits into
mainfrom
feat/foundry
Sep 18, 2026
Merged

0thernet merged 19 commits into
mainfrom
feat/foundry

Conversation

@0thernet

Copy link
Copy Markdown
Member

Summary

  • add bounded train/validation selection with winner-only holdout evaluation
  • admit candidate manifests emitted by ordinary generator organisms and retain generator lineage
  • verify foundry digests, scores, promotion, claims, and every underlying run by offline replay
  • add CLI generation, inspection, verification, and verified promoted-bundle export
  • document the foundry contract and include static and generated end-to-end examples

Test plan

  • bun run check
  • run generated foundry example with scripted candidate generation
  • inspect and offline-verify the emitted foundry report
  • export the promoted organism as a verified bundle

Generated with Devin

0thernet and others added 2 commits September 17, 2026 18:28
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
morphogen Ready Ready Preview Sep 18, 2026 4:04am UTC

Request Review

Comment thread src/foundry.ts Outdated
Comment thread src/foundry.ts Outdated
@0thernet
0thernet enabled auto-merge (squash) September 17, 2026 23:00
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Manifests can name host-admitted tools as explicit cells or as
agent-requested capabilities during bounded turns. Each tool has a
typed signature, effect class, modeled cost, output bound, timeout,
and idempotency key; results and failures are digest-bound receipts
that replay without live IO and route through ordinary fail edges.

Generated organisms remain capability-limited: they can name admitted
tools but cannot supply implementations, credentials, or new authority.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
A bench runs one workload through several systems — each an admitted
organism plus a host-resolved executor list — so a lone cheap call, a
lone frontier call, and a decomposed organism with a guarded escalation
branch are the same kind of contender. Case results are replayable run
receipts; the report embeds the case list, per-model effect
attribution, and the non-dominated pareto set on quality versus tokens.

Verification recomputes digests, pass claims, aggregates, and the
pareto set, confirms each receipt ran the claimed manifest and args,
and replays every receipt offline.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread src/bench.ts Fixed
Prompted abstention proved unreliable in the live triage bench — cheap
models answer confidently instead of declaring "unsure". The ensemble
organism encodes uncertainty structurally instead: two decorrelated
cheap classifiers vote, assert.v1 compares, and only disagreement
fires the frontier cell through an on:fail edge.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The batch workload compares one call over a ticket list against an
each cell mapping items through focused organisms, including a
per-item disagreement ensemble. The bench command now loads
--modules so each/organism cells resolve sub-manifests.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…udy.

The CLI now accepts --tools <file> for run, verify, bench, and foundry
commands. A tool registry declares typed signatures plus either a
scripted:<data> or cmd:<shell> executor, so tool cells and agent-requested
tools can be supplied from a file without ambient authority in manifests.

Also strengthens the benchmark Pareto frontier with a third axis: total
effect calls, so scripted baselines report honest tradeoffs even when no
live tokens are measured.

Adds examples/invest/: a billing-dispute workload where the deciding
evidence lives behind a typed ledger lookup. The deterministic run and a
live Vercel AI Gateway run both show the tool-grounded Qwen organism
outperforming a lone Claude Opus call on accuracy while remaining on the
Pareto frontier.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
README.md:
- New 'Where it wins' section with structural wins and billing-dispute
  live numbers.
- Updated bench section with the three-axis Pareto and --tools.
- New 'Plug it into your agent or provider' quick-start for code, CLI,
  tools, and verification.

Docs:
- Add docs/when-morphogen-wins.md with the full case study, Pareto
  interpretation, and reproduction commands.
- Extend docs/executors.md with --tools CLI registries and a
  ToolRegistry example.

Site:
- Add a case-study section to the homepage.
- Update site/llms.txt with the win and integration quickstart.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…hmarks.

- `src/bench.ts` and `src/bench-verify.ts`:
  - optional `prices` map in bench config and report;
  - `usage.cost` per case, system, and attribution;
  - Pareto axis switches from tokens to cost when prices are provided;
  - `morphogen bench verify` recomputes cost from recorded tokens and prices.
- `cli.ts`:
  - parse `prices` from `morphogen.bench.config.v1`;
  - pass it to `runBenchmark`.
- `examples/invest/bench-invest-priced.config.json`:
  - live gateway benchmark with aicharts.io / AI//COST / OpenRouter prices.
- `docs/when-morphogen-wins.md`: updated case-study table with dollar Pareto.
- `docs/agent-loop-and-organism.md`: design note on layering organisms and agent loops.
- `README.md`, `site/index.html`, `site/llms.txt`: public surfaces lead with the
  dollar-denominated result.

Live result: Qwen 3.5 Flash + ledger tool is 6/6 for $0.00131; Claude Opus 5
without the tool is 4/6 for $0.02625. The organism is both more accurate and
~20x cheaper.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread src/bench.ts Outdated
…agent tools.

- `morphogen pack` a manifest into a digest-verified bundle.
- `morphogen tool-def` generates an OpenAI or Anthropic function tool
  definition from a manifest's declared interface.
- `morphogen call` unpacks a bundle, runs it with the requested executors,
  tools, and args, and returns compact `{ ok, outputs, receiptDigest,
  manifestDigest }` output for easy agent consumption.
- `docs/agent-tool.md` shows how to pack, register, and call an organism
  from an agent.
- README, `site/index.html`, and `site/llms.txt` lead with the agent-tool
  story.
- `portToJsonSchema` and `deriveInputs` helpers convert Morphogen port types
  to draft-07 JSON Schema.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- `morphogen call` now reads arguments from stdin when `--args -` is passed,
  making it a first-class stdio agent tool that can be piped.
- `docs/why-unique.md` argues why a Morphogen organism is a new primitive:
  a bounded, typed, content-addressed probabilistic program between
  deterministic programs and open-ended agents.
- README, `site/index.html`, and `site/llms.txt` now lead with the
  "new primitive" framing.
- `docs/agent-tool.md` updated with the stdin example.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- `docs/habitats.md` teases apart a long-term design: a Morphogen habitat is a
  shared `Store` + `FnRegistry` + `ToolRegistry` + `Executor` where organisms
  live as content-addressed values, reproduce through `spawn`, and evolve
  through foundry search and host admission.
- Emphasizes the safety invariants that make it possible: no code in manifests,
  host-owned registries, content-addressed everything, and bounded execution.
- README, `site/index.html`, and `site/llms.txt` surface the habitats concept.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- `examples/habitat.morphogen.json` is a parent organism that:
  - receives a `goal`;
  - an agent `designer` outputs a child manifest as JSON;
  - a `spawn` cell admits and runs the child under the parent's budgets;
  - `push.v1` appends the child digest to a durable `population` slot;
  - a `write` slot cell persists the new population.
- `examples/habitat.responses.json` and `examples/habitat.args.json` let it
  pass through `morphogen suite` and `morphogen verify`.
- `docs/habitats.md` now documents the runnable example.
- README links to the example.

This proves the core habitat loop without changing the runtime: an organism
can propose a child, but the host still owns admission, registries, and
execution bounds.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
A parent organism (`examples/habitat/live.morphogen.json`) now calls a live
model to design a child manifest, falls back to a safe default if the proposal
fails, and spawns the selected child. The host script
`examples/habitat/promote.ts` packs the fallback, runs the live habitat,
compares the spawned child digest to the fallback, and promotes a valid
non-fallback child to `promoted/<digest>.bundle.json`.

First live run with `alibaba/qwen3.7-flash` produced and promoted:
sha256:f73c4ef9f89a3c55595f773c5a86c89780cfaf202cf29284005e76a5ad7e751c

Also:
- Add `examples/habitat/fallback.morphogen.json` and `live.responses.json`.
- Add `promoted/` to `.gitignore`.
- Update `docs/habitats.md`, README, site, and `site/llms.txt` with the live
  steel thread.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Dynamic property assignments in `caseArgs`, `caseOutputs`,
`generateFoundryCandidates`, `attribute`, and `mergeAttribution` could write
to `Object.prototype` if a manifest or config used `__proto__` as a cell id,
port name, or output name. Use `Object.create(null)` for all map-like
objects so `__proto__` is an ordinary property, not a prototype chain
accessor.

This resolves the open CodeQL review threads on PR #33.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@0thernet
0thernet merged commit 795f5b2 into main Sep 18, 2026
6 checks passed
@0thernet
0thernet deleted the feat/foundry branch September 18, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants