feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone - #151

Merged
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom
Jun 4, 2026
Merged

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone#151
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

The v1 recursive execution atom — the keystone for drivers-of-drivers: one self-similar Agent whose act spawns child agents through a Scope, run by a Supervisor that owns a conserved budget pool, an event-sourced journal, and an observability/conversation handle. The flat experiment harness is recovered as the simplest act (it does not compete with this — it is one program over it).

Design + decision record: docs/research/recursive-execution-atom.md (frozen contract, build order, the 4 resolved forks, the adversarial critique that shaped the surface).

The pieces

  • src/loops/supervise/types.ts — the frozen contract. Agent, an open LeafExecutor interface (execute returns a promise or an async stream; router/inline + sandbox + cli are implementations, a user's own agent is first-class via the registry/BYO — no per-vendor adapters), Scope, Supervisor, Settled, Budget.
  • supervise/budget.ts — a conserved reservation pool: atomic reserve-on-spawn, fail-closed admission, refund-on-settle. This is the load-bearing invariant: Σk(treatment) ≡ Σk(blind) holds by construction, so a steered arm can never silently out-compute blind (the confound that burned the earlier "+20pp steering" result).
  • src/durable/spawn-journal.ts — event-sourced SpawnJournal + content-addressed ResultBlobStore + seq-ordered replay. Resumable, queryable, reproducible from one log.
  • supervise/scope.ts — a ray.wait cursor over an in-memory nursery; spawn reserves budget and resolves the executor through the open registry; a Settled → Iteration adapter keeps defaultSelectWinner single-sourced.
  • supervise/runtime.ts — the open executor registry; the sandbox executor composes runLoop (forwarding an optional lineage passthrough) rather than reinventing checkpoint/fork.
  • supervise/supervisor.ts — nursery join barrier, abort cascade (incl. the acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle (view/signal/abort) as the observability substrate.
  • bench/src/drivers/flat-harness control (with the equal-k assertion), progressive-widening control, and the LLM-meta-driver treatment. WidenGate defaults to flat so the selector≠judge firewall stays dormant; widening reads trace findings, never the raw verdict, unless judgeExempt.
  • program.tsmapPool one-for-one failure semantics (a down child is excluded from the merge; an all-down batch re-throws the first original error so a maxDepth guard still propagates loud).

Verification

Independently re-run on this branch: typecheck ✓, lint ✓ (204 files), build ✓, full suite 642/642 (incl. 28 keystone property tests: conserved-budget fail-closed + refund, equal-k by construction, monotonic-seq cursor, abort/teardown, replay determinism), bench typecheck ✓.

Honest gaps (why draft)

  • Live executor paths unproven. The router/sandbox/cli executors are exercised only through the offline mock LeafExecutor — they typecheck and the wiring is proven, but no real router-HTTP / sandbox-runLoop / cli-subprocess run has happened.
  • The LLM-meta-driver is the gated treatment, not a default. It ships so the diverse-strategy-vs-blind gate can actually be run; it is not wired into any default path.
  • Deferred (gated on a positive gate result): a tuned MCTS-PW algorithm, learned widening, a Temporal/DBOS durable backend, deleting runProgram's loop-layer parallel op.

Relationship to #150

#150 adds the leaf-level continued-session/fork lineage on runLoop. This is the driver layer on top — the sandbox executor forwards that lineage passthrough rather than duplicating it. #150's findings (esp. verify the client-minted sessionId) are load-bearing here too.

Capture the design thread as tracked research docs under docs/research:
- recursive-execution-atom: the next generation (one recursive Agent atom
run as a durable, observable supervision tree; analyst-as-agent-with-runtime;
async dynamic spawning), the proposed surface, the file-grounded gap, and the
open forks. Plane B contains the flat harness.
- flat-harness-design: the assumption-free experiment harness synthesis
(profiles x steer x executionMode x allocation). Plane A.
- long-horizon-benchmark-survey: adversarially-verified survey; Commit0 and
tau2-bench as the multi-turn picks.
Index them under the new Research track in docs/README.md.
…spec
Freeze the contract: the budget-conserving reactive Scope + Supervisor keystone,
the event-sourced SpawnJournal + ResultBlobStore (outRef replay), the LeafExecutor
per-harness model (harness:null = Router inference, sandbox, cli), and the 8-step
v1 build order. Records the 4 resolved forks and the operator override (build the
LLM meta-driver now as the treatment on top of the conserved reservation pool, so
the equal-k gate stays valid by construction).
Operator refinement: the runtime is ONE open interface with an execute that
returns a promise or an async stream, not a closed inline|sandbox|cli union.
Built-ins are implementations; a user agent (mastra/agno/HTTP/custom) is
first-class by implementing it; no per-vendor adapters. The sandbox executor
composes runLoop and forwards PR #150's lineage passthrough rather than
reinventing checkpoint/fork. Records the #150 review (approve-to-land; verify
client-minted sessionId, bound fork acquisition, document parent-image fork).
…ervisor
The v1 keystone for the recursive-agent-atom (drivers-of-drivers, async,
observable). One self-similar atom whose act spawns child agents through a
Scope; the flat experiment harness is recovered as the simplest act.
- src/loops/supervise/types.ts: the frozen contract — Agent, an OPEN
LeafExecutor interface (execute returns a promise or an async stream;
router/inline + sandbox + cli are implementations, BYO is first-class via
the registry; no per-vendor adapters), Scope, Supervisor, Settled, Budget.
- supervise/budget.ts: a conserved reservation pool — atomic reserve-on-spawn,
fail-closed admission, refund-on-settle, so equal-k holds by construction
(the invariant that keeps a steered arm from silently out-computing blind).
- durable/spawn-journal.ts: event-sourced SpawnJournal + content-addressed
ResultBlobStore + seq-ordered replay (resumable, queryable, reproducible).
- supervise/scope.ts: a ray.wait cursor over an in-memory nursery; spawn
reserves budget and resolves the executor through the open registry; a
Settled-to-Iteration adapter keeps defaultSelectWinner single-sourced.
- supervise/runtime.ts: the open executor registry; the sandbox executor
composes runLoop (forwarding an optional lineage passthrough) rather than
reinventing checkpoint/fork.
- supervise/supervisor.ts: nursery join barrier, abort cascade (incl. the
acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle
(view/signal/abort) as the observability substrate.
- bench/src/drivers: flat-harness control (with the equal-k assertion),
progressive-widening control, and the LLM-meta-driver treatment. The
WidenGate defaults to flat so the selector-not-judge firewall stays dormant;
widening reads trace findings, never the raw verdict, unless judgeExempt.
- program.ts: mapPool one-for-one failure semantics (a down child is excluded
from the merge, an all-down batch re-throws the first original error so a
maxDepth guard still propagates loud).
Verified: typecheck, lint (204 files), build, full suite (642 tests incl. 28
keystone property tests), bench typecheck. Caveat: the live executor paths
(real router HTTP, sandbox runLoop, cli subprocess) are exercised only through
the offline mock LeafExecutor; no live-backend run yet.
@drewstone
drewstone marked this pull request as ready for review June 4, 2026 13:02
@tangletools

tangletools commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewing 78d80209

PassStatusETA
opencode DeepSeek v4 ProRunning (2 min)~5-15 min
opencode GLM 5.1Running (2 min)~5-15 min

Agent review running. Reads the actual code. This comment updates in place.

tangletools · #151 · model: kimi-for-coding · started 2026-06-04T13:05:48Z

@drewstone
drewstone merged commit 06efe71 into mainJun 4, 2026
1 check passed
@drewstone
drewstone deleted the feat/recursive-execution-atom branch June 4, 2026 13:06
drewstone added a commit that referenced this pull request Jun 6, 2026
Cuts the 58-commit backlog on main into a published release. Headline surface:
- runToolLoop / streamToolLoop — bounded turn-level tool-dispatch loop (#137)
- RSI agent tree: recursive Agent.act, Supervisor keystone, runProgram, the
adaptive-driver channel (#139/#151/#165)
- optimization API collapsed onto agent-eval selfImprove; the runtime keeps the
CODE-surface ImprovementDriver you pass as driver (#172)
- deployable benchmark adapters: AppWorld, commit0, aec-bench, EnterpriseOps-Gym;
runBenchmarks over one ADAPTERS registry (#153/#156/#157)
- agent-eval floor raised to >=0.83.0 (#175)
Sign up for freeto 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

@drewstone@tangletools
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone - #151

Merged
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom
Jun 4, 2026
Merged

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone#151
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

The v1 recursive execution atom — the keystone for drivers-of-drivers: one self-similar Agent whose act spawns child agents through a Scope, run by a Supervisor that owns a conserved budget pool, an event-sourced journal, and an observability/conversation handle. The flat experiment harness is recovered as the simplest act (it does not compete with this — it is one program over it).

Design + decision record: docs/research/recursive-execution-atom.md (frozen contract, build order, the 4 resolved forks, the adversarial critique that shaped the surface).

The pieces

  • src/loops/supervise/types.ts — the frozen contract. Agent, an open LeafExecutor interface (execute returns a promise or an async stream; router/inline + sandbox + cli are implementations, a user's own agent is first-class via the registry/BYO — no per-vendor adapters), Scope, Supervisor, Settled, Budget.
  • supervise/budget.ts — a conserved reservation pool: atomic reserve-on-spawn, fail-closed admission, refund-on-settle. This is the load-bearing invariant: Σk(treatment) ≡ Σk(blind) holds by construction, so a steered arm can never silently out-compute blind (the confound that burned the earlier "+20pp steering" result).
  • src/durable/spawn-journal.ts — event-sourced SpawnJournal + content-addressed ResultBlobStore + seq-ordered replay. Resumable, queryable, reproducible from one log.
  • supervise/scope.ts — a ray.wait cursor over an in-memory nursery; spawn reserves budget and resolves the executor through the open registry; a Settled → Iteration adapter keeps defaultSelectWinner single-sourced.
  • supervise/runtime.ts — the open executor registry; the sandbox executor composes runLoop (forwarding an optional lineage passthrough) rather than reinventing checkpoint/fork.
  • supervise/supervisor.ts — nursery join barrier, abort cascade (incl. the acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle (view/signal/abort) as the observability substrate.
  • bench/src/drivers/flat-harness control (with the equal-k assertion), progressive-widening control, and the LLM-meta-driver treatment. WidenGate defaults to flat so the selector≠judge firewall stays dormant; widening reads trace findings, never the raw verdict, unless judgeExempt.
  • program.tsmapPool one-for-one failure semantics (a down child is excluded from the merge; an all-down batch re-throws the first original error so a maxDepth guard still propagates loud).

Verification

Independently re-run on this branch: typecheck ✓, lint ✓ (204 files), build ✓, full suite 642/642 (incl. 28 keystone property tests: conserved-budget fail-closed + refund, equal-k by construction, monotonic-seq cursor, abort/teardown, replay determinism), bench typecheck ✓.

Honest gaps (why draft)

  • Live executor paths unproven. The router/sandbox/cli executors are exercised only through the offline mock LeafExecutor — they typecheck and the wiring is proven, but no real router-HTTP / sandbox-runLoop / cli-subprocess run has happened.
  • The LLM-meta-driver is the gated treatment, not a default. It ships so the diverse-strategy-vs-blind gate can actually be run; it is not wired into any default path.
  • Deferred (gated on a positive gate result): a tuned MCTS-PW algorithm, learned widening, a Temporal/DBOS durable backend, deleting runProgram's loop-layer parallel op.

Relationship to #150

#150 adds the leaf-level continued-session/fork lineage on runLoop. This is the driver layer on top — the sandbox executor forwards that lineage passthrough rather than duplicating it. #150's findings (esp. verify the client-minted sessionId) are load-bearing here too.

Capture the design thread as tracked research docs under docs/research:
- recursive-execution-atom: the next generation (one recursive Agent atom
run as a durable, observable supervision tree; analyst-as-agent-with-runtime;
async dynamic spawning), the proposed surface, the file-grounded gap, and the
open forks. Plane B contains the flat harness.
- flat-harness-design: the assumption-free experiment harness synthesis
(profiles x steer x executionMode x allocation). Plane A.
- long-horizon-benchmark-survey: adversarially-verified survey; Commit0 and
tau2-bench as the multi-turn picks.
Index them under the new Research track in docs/README.md.
…spec
Freeze the contract: the budget-conserving reactive Scope + Supervisor keystone,
the event-sourced SpawnJournal + ResultBlobStore (outRef replay), the LeafExecutor
per-harness model (harness:null = Router inference, sandbox, cli), and the 8-step
v1 build order. Records the 4 resolved forks and the operator override (build the
LLM meta-driver now as the treatment on top of the conserved reservation pool, so
the equal-k gate stays valid by construction).
Operator refinement: the runtime is ONE open interface with an execute that
returns a promise or an async stream, not a closed inline|sandbox|cli union.
Built-ins are implementations; a user agent (mastra/agno/HTTP/custom) is
first-class by implementing it; no per-vendor adapters. The sandbox executor
composes runLoop and forwards PR #150's lineage passthrough rather than
reinventing checkpoint/fork. Records the #150 review (approve-to-land; verify
client-minted sessionId, bound fork acquisition, document parent-image fork).
…ervisor
The v1 keystone for the recursive-agent-atom (drivers-of-drivers, async,
observable). One self-similar atom whose act spawns child agents through a
Scope; the flat experiment harness is recovered as the simplest act.
- src/loops/supervise/types.ts: the frozen contract — Agent, an OPEN
LeafExecutor interface (execute returns a promise or an async stream;
router/inline + sandbox + cli are implementations, BYO is first-class via
the registry; no per-vendor adapters), Scope, Supervisor, Settled, Budget.
- supervise/budget.ts: a conserved reservation pool — atomic reserve-on-spawn,
fail-closed admission, refund-on-settle, so equal-k holds by construction
(the invariant that keeps a steered arm from silently out-computing blind).
- durable/spawn-journal.ts: event-sourced SpawnJournal + content-addressed
ResultBlobStore + seq-ordered replay (resumable, queryable, reproducible).
- supervise/scope.ts: a ray.wait cursor over an in-memory nursery; spawn
reserves budget and resolves the executor through the open registry; a
Settled-to-Iteration adapter keeps defaultSelectWinner single-sourced.
- supervise/runtime.ts: the open executor registry; the sandbox executor
composes runLoop (forwarding an optional lineage passthrough) rather than
reinventing checkpoint/fork.
- supervise/supervisor.ts: nursery join barrier, abort cascade (incl. the
acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle
(view/signal/abort) as the observability substrate.
- bench/src/drivers: flat-harness control (with the equal-k assertion),
progressive-widening control, and the LLM-meta-driver treatment. The
WidenGate defaults to flat so the selector-not-judge firewall stays dormant;
widening reads trace findings, never the raw verdict, unless judgeExempt.
- program.ts: mapPool one-for-one failure semantics (a down child is excluded
from the merge, an all-down batch re-throws the first original error so a
maxDepth guard still propagates loud).
Verified: typecheck, lint (204 files), build, full suite (642 tests incl. 28
keystone property tests), bench typecheck. Caveat: the live executor paths
(real router HTTP, sandbox runLoop, cli subprocess) are exercised only through
the offline mock LeafExecutor; no live-backend run yet.
@drewstone
drewstone marked this pull request as ready for review June 4, 2026 13:02
@tangletools

tangletools commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewing 78d80209

PassStatusETA
opencode DeepSeek v4 ProRunning (2 min)~5-15 min
opencode GLM 5.1Running (2 min)~5-15 min

Agent review running. Reads the actual code. This comment updates in place.

tangletools · #151 · model: kimi-for-coding · started 2026-06-04T13:05:48Z

@drewstone
drewstone merged commit 06efe71 into mainJun 4, 2026
1 check passed
@drewstone
drewstone deleted the feat/recursive-execution-atom branch June 4, 2026 13:06
drewstone added a commit that referenced this pull request Jun 6, 2026
Cuts the 58-commit backlog on main into a published release. Headline surface:
- runToolLoop / streamToolLoop — bounded turn-level tool-dispatch loop (#137)
- RSI agent tree: recursive Agent.act, Supervisor keystone, runProgram, the
adaptive-driver channel (#139/#151/#165)
- optimization API collapsed onto agent-eval selfImprove; the runtime keeps the
CODE-surface ImprovementDriver you pass as driver (#172)
- deployable benchmark adapters: AppWorld, commit0, aec-bench, EnterpriseOps-Gym;
runBenchmarks over one ADAPTERS registry (#153/#156/#157)
- agent-eval floor raised to >=0.83.0 (#175)
Sign up for freeto 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

@drewstone@tangletools
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone - #151

Merged
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom
Jun 4, 2026
Merged

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone#151
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

The v1 recursive execution atom — the keystone for drivers-of-drivers: one self-similar Agent whose act spawns child agents through a Scope, run by a Supervisor that owns a conserved budget pool, an event-sourced journal, and an observability/conversation handle. The flat experiment harness is recovered as the simplest act (it does not compete with this — it is one program over it).

Design + decision record: docs/research/recursive-execution-atom.md (frozen contract, build order, the 4 resolved forks, the adversarial critique that shaped the surface).

The pieces

  • src/loops/supervise/types.ts — the frozen contract. Agent, an open LeafExecutor interface (execute returns a promise or an async stream; router/inline + sandbox + cli are implementations, a user's own agent is first-class via the registry/BYO — no per-vendor adapters), Scope, Supervisor, Settled, Budget.
  • supervise/budget.ts — a conserved reservation pool: atomic reserve-on-spawn, fail-closed admission, refund-on-settle. This is the load-bearing invariant: Σk(treatment) ≡ Σk(blind) holds by construction, so a steered arm can never silently out-compute blind (the confound that burned the earlier "+20pp steering" result).
  • src/durable/spawn-journal.ts — event-sourced SpawnJournal + content-addressed ResultBlobStore + seq-ordered replay. Resumable, queryable, reproducible from one log.
  • supervise/scope.ts — a ray.wait cursor over an in-memory nursery; spawn reserves budget and resolves the executor through the open registry; a Settled → Iteration adapter keeps defaultSelectWinner single-sourced.
  • supervise/runtime.ts — the open executor registry; the sandbox executor composes runLoop (forwarding an optional lineage passthrough) rather than reinventing checkpoint/fork.
  • supervise/supervisor.ts — nursery join barrier, abort cascade (incl. the acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle (view/signal/abort) as the observability substrate.
  • bench/src/drivers/flat-harness control (with the equal-k assertion), progressive-widening control, and the LLM-meta-driver treatment. WidenGate defaults to flat so the selector≠judge firewall stays dormant; widening reads trace findings, never the raw verdict, unless judgeExempt.
  • program.tsmapPool one-for-one failure semantics (a down child is excluded from the merge; an all-down batch re-throws the first original error so a maxDepth guard still propagates loud).

Verification

Independently re-run on this branch: typecheck ✓, lint ✓ (204 files), build ✓, full suite 642/642 (incl. 28 keystone property tests: conserved-budget fail-closed + refund, equal-k by construction, monotonic-seq cursor, abort/teardown, replay determinism), bench typecheck ✓.

Honest gaps (why draft)

  • Live executor paths unproven. The router/sandbox/cli executors are exercised only through the offline mock LeafExecutor — they typecheck and the wiring is proven, but no real router-HTTP / sandbox-runLoop / cli-subprocess run has happened.
  • The LLM-meta-driver is the gated treatment, not a default. It ships so the diverse-strategy-vs-blind gate can actually be run; it is not wired into any default path.
  • Deferred (gated on a positive gate result): a tuned MCTS-PW algorithm, learned widening, a Temporal/DBOS durable backend, deleting runProgram's loop-layer parallel op.

Relationship to #150

#150 adds the leaf-level continued-session/fork lineage on runLoop. This is the driver layer on top — the sandbox executor forwards that lineage passthrough rather than duplicating it. #150's findings (esp. verify the client-minted sessionId) are load-bearing here too.

Capture the design thread as tracked research docs under docs/research:
- recursive-execution-atom: the next generation (one recursive Agent atom
run as a durable, observable supervision tree; analyst-as-agent-with-runtime;
async dynamic spawning), the proposed surface, the file-grounded gap, and the
open forks. Plane B contains the flat harness.
- flat-harness-design: the assumption-free experiment harness synthesis
(profiles x steer x executionMode x allocation). Plane A.
- long-horizon-benchmark-survey: adversarially-verified survey; Commit0 and
tau2-bench as the multi-turn picks.
Index them under the new Research track in docs/README.md.
…spec
Freeze the contract: the budget-conserving reactive Scope + Supervisor keystone,
the event-sourced SpawnJournal + ResultBlobStore (outRef replay), the LeafExecutor
per-harness model (harness:null = Router inference, sandbox, cli), and the 8-step
v1 build order. Records the 4 resolved forks and the operator override (build the
LLM meta-driver now as the treatment on top of the conserved reservation pool, so
the equal-k gate stays valid by construction).
Operator refinement: the runtime is ONE open interface with an execute that
returns a promise or an async stream, not a closed inline|sandbox|cli union.
Built-ins are implementations; a user agent (mastra/agno/HTTP/custom) is
first-class by implementing it; no per-vendor adapters. The sandbox executor
composes runLoop and forwards PR #150's lineage passthrough rather than
reinventing checkpoint/fork. Records the #150 review (approve-to-land; verify
client-minted sessionId, bound fork acquisition, document parent-image fork).
…ervisor
The v1 keystone for the recursive-agent-atom (drivers-of-drivers, async,
observable). One self-similar atom whose act spawns child agents through a
Scope; the flat experiment harness is recovered as the simplest act.
- src/loops/supervise/types.ts: the frozen contract — Agent, an OPEN
LeafExecutor interface (execute returns a promise or an async stream;
router/inline + sandbox + cli are implementations, BYO is first-class via
the registry; no per-vendor adapters), Scope, Supervisor, Settled, Budget.
- supervise/budget.ts: a conserved reservation pool — atomic reserve-on-spawn,
fail-closed admission, refund-on-settle, so equal-k holds by construction
(the invariant that keeps a steered arm from silently out-computing blind).
- durable/spawn-journal.ts: event-sourced SpawnJournal + content-addressed
ResultBlobStore + seq-ordered replay (resumable, queryable, reproducible).
- supervise/scope.ts: a ray.wait cursor over an in-memory nursery; spawn
reserves budget and resolves the executor through the open registry; a
Settled-to-Iteration adapter keeps defaultSelectWinner single-sourced.
- supervise/runtime.ts: the open executor registry; the sandbox executor
composes runLoop (forwarding an optional lineage passthrough) rather than
reinventing checkpoint/fork.
- supervise/supervisor.ts: nursery join barrier, abort cascade (incl. the
acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle
(view/signal/abort) as the observability substrate.
- bench/src/drivers: flat-harness control (with the equal-k assertion),
progressive-widening control, and the LLM-meta-driver treatment. The
WidenGate defaults to flat so the selector-not-judge firewall stays dormant;
widening reads trace findings, never the raw verdict, unless judgeExempt.
- program.ts: mapPool one-for-one failure semantics (a down child is excluded
from the merge, an all-down batch re-throws the first original error so a
maxDepth guard still propagates loud).
Verified: typecheck, lint (204 files), build, full suite (642 tests incl. 28
keystone property tests), bench typecheck. Caveat: the live executor paths
(real router HTTP, sandbox runLoop, cli subprocess) are exercised only through
the offline mock LeafExecutor; no live-backend run yet.
@drewstone
drewstone marked this pull request as ready for review June 4, 2026 13:02
@tangletools

tangletools commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewing 78d80209

PassStatusETA
opencode DeepSeek v4 ProRunning (2 min)~5-15 min
opencode GLM 5.1Running (2 min)~5-15 min

Agent review running. Reads the actual code. This comment updates in place.

tangletools · #151 · model: kimi-for-coding · started 2026-06-04T13:05:48Z

@drewstone
drewstone merged commit 06efe71 into mainJun 4, 2026
1 check passed
@drewstone
drewstone deleted the feat/recursive-execution-atom branch June 4, 2026 13:06
drewstone added a commit that referenced this pull request Jun 6, 2026
Cuts the 58-commit backlog on main into a published release. Headline surface:
- runToolLoop / streamToolLoop — bounded turn-level tool-dispatch loop (#137)
- RSI agent tree: recursive Agent.act, Supervisor keystone, runProgram, the
adaptive-driver channel (#139/#151/#165)
- optimization API collapsed onto agent-eval selfImprove; the runtime keeps the
CODE-surface ImprovementDriver you pass as driver (#172)
- deployable benchmark adapters: AppWorld, commit0, aec-bench, EnterpriseOps-Gym;
runBenchmarks over one ADAPTERS registry (#153/#156/#157)
- agent-eval floor raised to >=0.83.0 (#175)
Sign up for freeto 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

@drewstone@tangletools
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone - #151

Merged
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom
Jun 4, 2026
Merged

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone#151
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

The v1 recursive execution atom — the keystone for drivers-of-drivers: one self-similar Agent whose act spawns child agents through a Scope, run by a Supervisor that owns a conserved budget pool, an event-sourced journal, and an observability/conversation handle. The flat experiment harness is recovered as the simplest act (it does not compete with this — it is one program over it).

Design + decision record: docs/research/recursive-execution-atom.md (frozen contract, build order, the 4 resolved forks, the adversarial critique that shaped the surface).

The pieces

  • src/loops/supervise/types.ts — the frozen contract. Agent, an open LeafExecutor interface (execute returns a promise or an async stream; router/inline + sandbox + cli are implementations, a user's own agent is first-class via the registry/BYO — no per-vendor adapters), Scope, Supervisor, Settled, Budget.
  • supervise/budget.ts — a conserved reservation pool: atomic reserve-on-spawn, fail-closed admission, refund-on-settle. This is the load-bearing invariant: Σk(treatment) ≡ Σk(blind) holds by construction, so a steered arm can never silently out-compute blind (the confound that burned the earlier "+20pp steering" result).
  • src/durable/spawn-journal.ts — event-sourced SpawnJournal + content-addressed ResultBlobStore + seq-ordered replay. Resumable, queryable, reproducible from one log.
  • supervise/scope.ts — a ray.wait cursor over an in-memory nursery; spawn reserves budget and resolves the executor through the open registry; a Settled → Iteration adapter keeps defaultSelectWinner single-sourced.
  • supervise/runtime.ts — the open executor registry; the sandbox executor composes runLoop (forwarding an optional lineage passthrough) rather than reinventing checkpoint/fork.
  • supervise/supervisor.ts — nursery join barrier, abort cascade (incl. the acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle (view/signal/abort) as the observability substrate.
  • bench/src/drivers/flat-harness control (with the equal-k assertion), progressive-widening control, and the LLM-meta-driver treatment. WidenGate defaults to flat so the selector≠judge firewall stays dormant; widening reads trace findings, never the raw verdict, unless judgeExempt.
  • program.tsmapPool one-for-one failure semantics (a down child is excluded from the merge; an all-down batch re-throws the first original error so a maxDepth guard still propagates loud).

Verification

Independently re-run on this branch: typecheck ✓, lint ✓ (204 files), build ✓, full suite 642/642 (incl. 28 keystone property tests: conserved-budget fail-closed + refund, equal-k by construction, monotonic-seq cursor, abort/teardown, replay determinism), bench typecheck ✓.

Honest gaps (why draft)

  • Live executor paths unproven. The router/sandbox/cli executors are exercised only through the offline mock LeafExecutor — they typecheck and the wiring is proven, but no real router-HTTP / sandbox-runLoop / cli-subprocess run has happened.
  • The LLM-meta-driver is the gated treatment, not a default. It ships so the diverse-strategy-vs-blind gate can actually be run; it is not wired into any default path.
  • Deferred (gated on a positive gate result): a tuned MCTS-PW algorithm, learned widening, a Temporal/DBOS durable backend, deleting runProgram's loop-layer parallel op.

Relationship to #150

#150 adds the leaf-level continued-session/fork lineage on runLoop. This is the driver layer on top — the sandbox executor forwards that lineage passthrough rather than duplicating it. #150's findings (esp. verify the client-minted sessionId) are load-bearing here too.

Capture the design thread as tracked research docs under docs/research:
- recursive-execution-atom: the next generation (one recursive Agent atom
run as a durable, observable supervision tree; analyst-as-agent-with-runtime;
async dynamic spawning), the proposed surface, the file-grounded gap, and the
open forks. Plane B contains the flat harness.
- flat-harness-design: the assumption-free experiment harness synthesis
(profiles x steer x executionMode x allocation). Plane A.
- long-horizon-benchmark-survey: adversarially-verified survey; Commit0 and
tau2-bench as the multi-turn picks.
Index them under the new Research track in docs/README.md.
…spec
Freeze the contract: the budget-conserving reactive Scope + Supervisor keystone,
the event-sourced SpawnJournal + ResultBlobStore (outRef replay), the LeafExecutor
per-harness model (harness:null = Router inference, sandbox, cli), and the 8-step
v1 build order. Records the 4 resolved forks and the operator override (build the
LLM meta-driver now as the treatment on top of the conserved reservation pool, so
the equal-k gate stays valid by construction).
Operator refinement: the runtime is ONE open interface with an execute that
returns a promise or an async stream, not a closed inline|sandbox|cli union.
Built-ins are implementations; a user agent (mastra/agno/HTTP/custom) is
first-class by implementing it; no per-vendor adapters. The sandbox executor
composes runLoop and forwards PR #150's lineage passthrough rather than
reinventing checkpoint/fork. Records the #150 review (approve-to-land; verify
client-minted sessionId, bound fork acquisition, document parent-image fork).
…ervisor
The v1 keystone for the recursive-agent-atom (drivers-of-drivers, async,
observable). One self-similar atom whose act spawns child agents through a
Scope; the flat experiment harness is recovered as the simplest act.
- src/loops/supervise/types.ts: the frozen contract — Agent, an OPEN
LeafExecutor interface (execute returns a promise or an async stream;
router/inline + sandbox + cli are implementations, BYO is first-class via
the registry; no per-vendor adapters), Scope, Supervisor, Settled, Budget.
- supervise/budget.ts: a conserved reservation pool — atomic reserve-on-spawn,
fail-closed admission, refund-on-settle, so equal-k holds by construction
(the invariant that keeps a steered arm from silently out-computing blind).
- durable/spawn-journal.ts: event-sourced SpawnJournal + content-addressed
ResultBlobStore + seq-ordered replay (resumable, queryable, reproducible).
- supervise/scope.ts: a ray.wait cursor over an in-memory nursery; spawn
reserves budget and resolves the executor through the open registry; a
Settled-to-Iteration adapter keeps defaultSelectWinner single-sourced.
- supervise/runtime.ts: the open executor registry; the sandbox executor
composes runLoop (forwarding an optional lineage passthrough) rather than
reinventing checkpoint/fork.
- supervise/supervisor.ts: nursery join barrier, abort cascade (incl. the
acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle
(view/signal/abort) as the observability substrate.
- bench/src/drivers: flat-harness control (with the equal-k assertion),
progressive-widening control, and the LLM-meta-driver treatment. The
WidenGate defaults to flat so the selector-not-judge firewall stays dormant;
widening reads trace findings, never the raw verdict, unless judgeExempt.
- program.ts: mapPool one-for-one failure semantics (a down child is excluded
from the merge, an all-down batch re-throws the first original error so a
maxDepth guard still propagates loud).
Verified: typecheck, lint (204 files), build, full suite (642 tests incl. 28
keystone property tests), bench typecheck. Caveat: the live executor paths
(real router HTTP, sandbox runLoop, cli subprocess) are exercised only through
the offline mock LeafExecutor; no live-backend run yet.
@drewstone
drewstone marked this pull request as ready for review June 4, 2026 13:02
@tangletools

tangletools commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewing 78d80209

PassStatusETA
opencode DeepSeek v4 ProRunning (2 min)~5-15 min
opencode GLM 5.1Running (2 min)~5-15 min

Agent review running. Reads the actual code. This comment updates in place.

tangletools · #151 · model: kimi-for-coding · started 2026-06-04T13:05:48Z

@drewstone
drewstone merged commit 06efe71 into mainJun 4, 2026
1 check passed
@drewstone
drewstone deleted the feat/recursive-execution-atom branch June 4, 2026 13:06
drewstone added a commit that referenced this pull request Jun 6, 2026
Cuts the 58-commit backlog on main into a published release. Headline surface:
- runToolLoop / streamToolLoop — bounded turn-level tool-dispatch loop (#137)
- RSI agent tree: recursive Agent.act, Supervisor keystone, runProgram, the
adaptive-driver channel (#139/#151/#165)
- optimization API collapsed onto agent-eval selfImprove; the runtime keeps the
CODE-surface ImprovementDriver you pass as driver (#172)
- deployable benchmark adapters: AppWorld, commit0, aec-bench, EnterpriseOps-Gym;
runBenchmarks over one ADAPTERS registry (#153/#156/#157)
- agent-eval floor raised to >=0.83.0 (#175)
Sign up for freeto 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

@drewstone@tangletools
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone - #151

Merged
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom
Jun 4, 2026
Merged

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone#151
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

The v1 recursive execution atom — the keystone for drivers-of-drivers: one self-similar Agent whose act spawns child agents through a Scope, run by a Supervisor that owns a conserved budget pool, an event-sourced journal, and an observability/conversation handle. The flat experiment harness is recovered as the simplest act (it does not compete with this — it is one program over it).

Design + decision record: docs/research/recursive-execution-atom.md (frozen contract, build order, the 4 resolved forks, the adversarial critique that shaped the surface).

The pieces

  • src/loops/supervise/types.ts — the frozen contract. Agent, an open LeafExecutor interface (execute returns a promise or an async stream; router/inline + sandbox + cli are implementations, a user's own agent is first-class via the registry/BYO — no per-vendor adapters), Scope, Supervisor, Settled, Budget.
  • supervise/budget.ts — a conserved reservation pool: atomic reserve-on-spawn, fail-closed admission, refund-on-settle. This is the load-bearing invariant: Σk(treatment) ≡ Σk(blind) holds by construction, so a steered arm can never silently out-compute blind (the confound that burned the earlier "+20pp steering" result).
  • src/durable/spawn-journal.ts — event-sourced SpawnJournal + content-addressed ResultBlobStore + seq-ordered replay. Resumable, queryable, reproducible from one log.
  • supervise/scope.ts — a ray.wait cursor over an in-memory nursery; spawn reserves budget and resolves the executor through the open registry; a Settled → Iteration adapter keeps defaultSelectWinner single-sourced.
  • supervise/runtime.ts — the open executor registry; the sandbox executor composes runLoop (forwarding an optional lineage passthrough) rather than reinventing checkpoint/fork.
  • supervise/supervisor.ts — nursery join barrier, abort cascade (incl. the acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle (view/signal/abort) as the observability substrate.
  • bench/src/drivers/flat-harness control (with the equal-k assertion), progressive-widening control, and the LLM-meta-driver treatment. WidenGate defaults to flat so the selector≠judge firewall stays dormant; widening reads trace findings, never the raw verdict, unless judgeExempt.
  • program.tsmapPool one-for-one failure semantics (a down child is excluded from the merge; an all-down batch re-throws the first original error so a maxDepth guard still propagates loud).

Verification

Independently re-run on this branch: typecheck ✓, lint ✓ (204 files), build ✓, full suite 642/642 (incl. 28 keystone property tests: conserved-budget fail-closed + refund, equal-k by construction, monotonic-seq cursor, abort/teardown, replay determinism), bench typecheck ✓.

Honest gaps (why draft)

  • Live executor paths unproven. The router/sandbox/cli executors are exercised only through the offline mock LeafExecutor — they typecheck and the wiring is proven, but no real router-HTTP / sandbox-runLoop / cli-subprocess run has happened.
  • The LLM-meta-driver is the gated treatment, not a default. It ships so the diverse-strategy-vs-blind gate can actually be run; it is not wired into any default path.
  • Deferred (gated on a positive gate result): a tuned MCTS-PW algorithm, learned widening, a Temporal/DBOS durable backend, deleting runProgram's loop-layer parallel op.

Relationship to #150

#150 adds the leaf-level continued-session/fork lineage on runLoop. This is the driver layer on top — the sandbox executor forwards that lineage passthrough rather than duplicating it. #150's findings (esp. verify the client-minted sessionId) are load-bearing here too.

Capture the design thread as tracked research docs under docs/research:
- recursive-execution-atom: the next generation (one recursive Agent atom
run as a durable, observable supervision tree; analyst-as-agent-with-runtime;
async dynamic spawning), the proposed surface, the file-grounded gap, and the
open forks. Plane B contains the flat harness.
- flat-harness-design: the assumption-free experiment harness synthesis
(profiles x steer x executionMode x allocation). Plane A.
- long-horizon-benchmark-survey: adversarially-verified survey; Commit0 and
tau2-bench as the multi-turn picks.
Index them under the new Research track in docs/README.md.
…spec
Freeze the contract: the budget-conserving reactive Scope + Supervisor keystone,
the event-sourced SpawnJournal + ResultBlobStore (outRef replay), the LeafExecutor
per-harness model (harness:null = Router inference, sandbox, cli), and the 8-step
v1 build order. Records the 4 resolved forks and the operator override (build the
LLM meta-driver now as the treatment on top of the conserved reservation pool, so
the equal-k gate stays valid by construction).
Operator refinement: the runtime is ONE open interface with an execute that
returns a promise or an async stream, not a closed inline|sandbox|cli union.
Built-ins are implementations; a user agent (mastra/agno/HTTP/custom) is
first-class by implementing it; no per-vendor adapters. The sandbox executor
composes runLoop and forwards PR #150's lineage passthrough rather than
reinventing checkpoint/fork. Records the #150 review (approve-to-land; verify
client-minted sessionId, bound fork acquisition, document parent-image fork).
…ervisor
The v1 keystone for the recursive-agent-atom (drivers-of-drivers, async,
observable). One self-similar atom whose act spawns child agents through a
Scope; the flat experiment harness is recovered as the simplest act.
- src/loops/supervise/types.ts: the frozen contract — Agent, an OPEN
LeafExecutor interface (execute returns a promise or an async stream;
router/inline + sandbox + cli are implementations, BYO is first-class via
the registry; no per-vendor adapters), Scope, Supervisor, Settled, Budget.
- supervise/budget.ts: a conserved reservation pool — atomic reserve-on-spawn,
fail-closed admission, refund-on-settle, so equal-k holds by construction
(the invariant that keeps a steered arm from silently out-computing blind).
- durable/spawn-journal.ts: event-sourced SpawnJournal + content-addressed
ResultBlobStore + seq-ordered replay (resumable, queryable, reproducible).
- supervise/scope.ts: a ray.wait cursor over an in-memory nursery; spawn
reserves budget and resolves the executor through the open registry; a
Settled-to-Iteration adapter keeps defaultSelectWinner single-sourced.
- supervise/runtime.ts: the open executor registry; the sandbox executor
composes runLoop (forwarding an optional lineage passthrough) rather than
reinventing checkpoint/fork.
- supervise/supervisor.ts: nursery join barrier, abort cascade (incl. the
acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle
(view/signal/abort) as the observability substrate.
- bench/src/drivers: flat-harness control (with the equal-k assertion),
progressive-widening control, and the LLM-meta-driver treatment. The
WidenGate defaults to flat so the selector-not-judge firewall stays dormant;
widening reads trace findings, never the raw verdict, unless judgeExempt.
- program.ts: mapPool one-for-one failure semantics (a down child is excluded
from the merge, an all-down batch re-throws the first original error so a
maxDepth guard still propagates loud).
Verified: typecheck, lint (204 files), build, full suite (642 tests incl. 28
keystone property tests), bench typecheck. Caveat: the live executor paths
(real router HTTP, sandbox runLoop, cli subprocess) are exercised only through
the offline mock LeafExecutor; no live-backend run yet.
@drewstone
drewstone marked this pull request as ready for review June 4, 2026 13:02
@tangletools

tangletools commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewing 78d80209

PassStatusETA
opencode DeepSeek v4 ProRunning (2 min)~5-15 min
opencode GLM 5.1Running (2 min)~5-15 min

Agent review running. Reads the actual code. This comment updates in place.

tangletools · #151 · model: kimi-for-coding · started 2026-06-04T13:05:48Z

@drewstone
drewstone merged commit 06efe71 into mainJun 4, 2026
1 check passed
@drewstone
drewstone deleted the feat/recursive-execution-atom branch June 4, 2026 13:06
drewstone added a commit that referenced this pull request Jun 6, 2026
Cuts the 58-commit backlog on main into a published release. Headline surface:
- runToolLoop / streamToolLoop — bounded turn-level tool-dispatch loop (#137)
- RSI agent tree: recursive Agent.act, Supervisor keystone, runProgram, the
adaptive-driver channel (#139/#151/#165)
- optimization API collapsed onto agent-eval selfImprove; the runtime keeps the
CODE-surface ImprovementDriver you pass as driver (#172)
- deployable benchmark adapters: AppWorld, commit0, aec-bench, EnterpriseOps-Gym;
runBenchmarks over one ADAPTERS registry (#153/#156/#157)
- agent-eval floor raised to >=0.83.0 (#175)
Sign up for freeto 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

@drewstone@tangletools
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone - #151

Merged
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom
Jun 4, 2026
Merged

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone#151
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

The v1 recursive execution atom — the keystone for drivers-of-drivers: one self-similar Agent whose act spawns child agents through a Scope, run by a Supervisor that owns a conserved budget pool, an event-sourced journal, and an observability/conversation handle. The flat experiment harness is recovered as the simplest act (it does not compete with this — it is one program over it).

Design + decision record: docs/research/recursive-execution-atom.md (frozen contract, build order, the 4 resolved forks, the adversarial critique that shaped the surface).

The pieces

  • src/loops/supervise/types.ts — the frozen contract. Agent, an open LeafExecutor interface (execute returns a promise or an async stream; router/inline + sandbox + cli are implementations, a user's own agent is first-class via the registry/BYO — no per-vendor adapters), Scope, Supervisor, Settled, Budget.
  • supervise/budget.ts — a conserved reservation pool: atomic reserve-on-spawn, fail-closed admission, refund-on-settle. This is the load-bearing invariant: Σk(treatment) ≡ Σk(blind) holds by construction, so a steered arm can never silently out-compute blind (the confound that burned the earlier "+20pp steering" result).
  • src/durable/spawn-journal.ts — event-sourced SpawnJournal + content-addressed ResultBlobStore + seq-ordered replay. Resumable, queryable, reproducible from one log.
  • supervise/scope.ts — a ray.wait cursor over an in-memory nursery; spawn reserves budget and resolves the executor through the open registry; a Settled → Iteration adapter keeps defaultSelectWinner single-sourced.
  • supervise/runtime.ts — the open executor registry; the sandbox executor composes runLoop (forwarding an optional lineage passthrough) rather than reinventing checkpoint/fork.
  • supervise/supervisor.ts — nursery join barrier, abort cascade (incl. the acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle (view/signal/abort) as the observability substrate.
  • bench/src/drivers/flat-harness control (with the equal-k assertion), progressive-widening control, and the LLM-meta-driver treatment. WidenGate defaults to flat so the selector≠judge firewall stays dormant; widening reads trace findings, never the raw verdict, unless judgeExempt.
  • program.tsmapPool one-for-one failure semantics (a down child is excluded from the merge; an all-down batch re-throws the first original error so a maxDepth guard still propagates loud).

Verification

Independently re-run on this branch: typecheck ✓, lint ✓ (204 files), build ✓, full suite 642/642 (incl. 28 keystone property tests: conserved-budget fail-closed + refund, equal-k by construction, monotonic-seq cursor, abort/teardown, replay determinism), bench typecheck ✓.

Honest gaps (why draft)

  • Live executor paths unproven. The router/sandbox/cli executors are exercised only through the offline mock LeafExecutor — they typecheck and the wiring is proven, but no real router-HTTP / sandbox-runLoop / cli-subprocess run has happened.
  • The LLM-meta-driver is the gated treatment, not a default. It ships so the diverse-strategy-vs-blind gate can actually be run; it is not wired into any default path.
  • Deferred (gated on a positive gate result): a tuned MCTS-PW algorithm, learned widening, a Temporal/DBOS durable backend, deleting runProgram's loop-layer parallel op.

Relationship to #150

#150 adds the leaf-level continued-session/fork lineage on runLoop. This is the driver layer on top — the sandbox executor forwards that lineage passthrough rather than duplicating it. #150's findings (esp. verify the client-minted sessionId) are load-bearing here too.

Capture the design thread as tracked research docs under docs/research:
- recursive-execution-atom: the next generation (one recursive Agent atom
run as a durable, observable supervision tree; analyst-as-agent-with-runtime;
async dynamic spawning), the proposed surface, the file-grounded gap, and the
open forks. Plane B contains the flat harness.
- flat-harness-design: the assumption-free experiment harness synthesis
(profiles x steer x executionMode x allocation). Plane A.
- long-horizon-benchmark-survey: adversarially-verified survey; Commit0 and
tau2-bench as the multi-turn picks.
Index them under the new Research track in docs/README.md.
…spec
Freeze the contract: the budget-conserving reactive Scope + Supervisor keystone,
the event-sourced SpawnJournal + ResultBlobStore (outRef replay), the LeafExecutor
per-harness model (harness:null = Router inference, sandbox, cli), and the 8-step
v1 build order. Records the 4 resolved forks and the operator override (build the
LLM meta-driver now as the treatment on top of the conserved reservation pool, so
the equal-k gate stays valid by construction).
Operator refinement: the runtime is ONE open interface with an execute that
returns a promise or an async stream, not a closed inline|sandbox|cli union.
Built-ins are implementations; a user agent (mastra/agno/HTTP/custom) is
first-class by implementing it; no per-vendor adapters. The sandbox executor
composes runLoop and forwards PR #150's lineage passthrough rather than
reinventing checkpoint/fork. Records the #150 review (approve-to-land; verify
client-minted sessionId, bound fork acquisition, document parent-image fork).
…ervisor
The v1 keystone for the recursive-agent-atom (drivers-of-drivers, async,
observable). One self-similar atom whose act spawns child agents through a
Scope; the flat experiment harness is recovered as the simplest act.
- src/loops/supervise/types.ts: the frozen contract — Agent, an OPEN
LeafExecutor interface (execute returns a promise or an async stream;
router/inline + sandbox + cli are implementations, BYO is first-class via
the registry; no per-vendor adapters), Scope, Supervisor, Settled, Budget.
- supervise/budget.ts: a conserved reservation pool — atomic reserve-on-spawn,
fail-closed admission, refund-on-settle, so equal-k holds by construction
(the invariant that keeps a steered arm from silently out-computing blind).
- durable/spawn-journal.ts: event-sourced SpawnJournal + content-addressed
ResultBlobStore + seq-ordered replay (resumable, queryable, reproducible).
- supervise/scope.ts: a ray.wait cursor over an in-memory nursery; spawn
reserves budget and resolves the executor through the open registry; a
Settled-to-Iteration adapter keeps defaultSelectWinner single-sourced.
- supervise/runtime.ts: the open executor registry; the sandbox executor
composes runLoop (forwarding an optional lineage passthrough) rather than
reinventing checkpoint/fork.
- supervise/supervisor.ts: nursery join barrier, abort cascade (incl. the
acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle
(view/signal/abort) as the observability substrate.
- bench/src/drivers: flat-harness control (with the equal-k assertion),
progressive-widening control, and the LLM-meta-driver treatment. The
WidenGate defaults to flat so the selector-not-judge firewall stays dormant;
widening reads trace findings, never the raw verdict, unless judgeExempt.
- program.ts: mapPool one-for-one failure semantics (a down child is excluded
from the merge, an all-down batch re-throws the first original error so a
maxDepth guard still propagates loud).
Verified: typecheck, lint (204 files), build, full suite (642 tests incl. 28
keystone property tests), bench typecheck. Caveat: the live executor paths
(real router HTTP, sandbox runLoop, cli subprocess) are exercised only through
the offline mock LeafExecutor; no live-backend run yet.
@drewstone
drewstone marked this pull request as ready for review June 4, 2026 13:02
@tangletools

tangletools commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewing 78d80209

PassStatusETA
opencode DeepSeek v4 ProRunning (2 min)~5-15 min
opencode GLM 5.1Running (2 min)~5-15 min

Agent review running. Reads the actual code. This comment updates in place.

tangletools · #151 · model: kimi-for-coding · started 2026-06-04T13:05:48Z

@drewstone
drewstone merged commit 06efe71 into mainJun 4, 2026
1 check passed
@drewstone
drewstone deleted the feat/recursive-execution-atom branch June 4, 2026 13:06
drewstone added a commit that referenced this pull request Jun 6, 2026
Cuts the 58-commit backlog on main into a published release. Headline surface:
- runToolLoop / streamToolLoop — bounded turn-level tool-dispatch loop (#137)
- RSI agent tree: recursive Agent.act, Supervisor keystone, runProgram, the
adaptive-driver channel (#139/#151/#165)
- optimization API collapsed onto agent-eval selfImprove; the runtime keeps the
CODE-surface ImprovementDriver you pass as driver (#172)
- deployable benchmark adapters: AppWorld, commit0, aec-bench, EnterpriseOps-Gym;
runBenchmarks over one ADAPTERS registry (#153/#156/#157)
- agent-eval floor raised to >=0.83.0 (#175)
Sign up for freeto 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

@drewstone@tangletools
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone - #151

Merged
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom
Jun 4, 2026
Merged

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone#151
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

The v1 recursive execution atom — the keystone for drivers-of-drivers: one self-similar Agent whose act spawns child agents through a Scope, run by a Supervisor that owns a conserved budget pool, an event-sourced journal, and an observability/conversation handle. The flat experiment harness is recovered as the simplest act (it does not compete with this — it is one program over it).

Design + decision record: docs/research/recursive-execution-atom.md (frozen contract, build order, the 4 resolved forks, the adversarial critique that shaped the surface).

The pieces

  • src/loops/supervise/types.ts — the frozen contract. Agent, an open LeafExecutor interface (execute returns a promise or an async stream; router/inline + sandbox + cli are implementations, a user's own agent is first-class via the registry/BYO — no per-vendor adapters), Scope, Supervisor, Settled, Budget.
  • supervise/budget.ts — a conserved reservation pool: atomic reserve-on-spawn, fail-closed admission, refund-on-settle. This is the load-bearing invariant: Σk(treatment) ≡ Σk(blind) holds by construction, so a steered arm can never silently out-compute blind (the confound that burned the earlier "+20pp steering" result).
  • src/durable/spawn-journal.ts — event-sourced SpawnJournal + content-addressed ResultBlobStore + seq-ordered replay. Resumable, queryable, reproducible from one log.
  • supervise/scope.ts — a ray.wait cursor over an in-memory nursery; spawn reserves budget and resolves the executor through the open registry; a Settled → Iteration adapter keeps defaultSelectWinner single-sourced.
  • supervise/runtime.ts — the open executor registry; the sandbox executor composes runLoop (forwarding an optional lineage passthrough) rather than reinventing checkpoint/fork.
  • supervise/supervisor.ts — nursery join barrier, abort cascade (incl. the acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle (view/signal/abort) as the observability substrate.
  • bench/src/drivers/flat-harness control (with the equal-k assertion), progressive-widening control, and the LLM-meta-driver treatment. WidenGate defaults to flat so the selector≠judge firewall stays dormant; widening reads trace findings, never the raw verdict, unless judgeExempt.
  • program.tsmapPool one-for-one failure semantics (a down child is excluded from the merge; an all-down batch re-throws the first original error so a maxDepth guard still propagates loud).

Verification

Independently re-run on this branch: typecheck ✓, lint ✓ (204 files), build ✓, full suite 642/642 (incl. 28 keystone property tests: conserved-budget fail-closed + refund, equal-k by construction, monotonic-seq cursor, abort/teardown, replay determinism), bench typecheck ✓.

Honest gaps (why draft)

  • Live executor paths unproven. The router/sandbox/cli executors are exercised only through the offline mock LeafExecutor — they typecheck and the wiring is proven, but no real router-HTTP / sandbox-runLoop / cli-subprocess run has happened.
  • The LLM-meta-driver is the gated treatment, not a default. It ships so the diverse-strategy-vs-blind gate can actually be run; it is not wired into any default path.
  • Deferred (gated on a positive gate result): a tuned MCTS-PW algorithm, learned widening, a Temporal/DBOS durable backend, deleting runProgram's loop-layer parallel op.

Relationship to #150

#150 adds the leaf-level continued-session/fork lineage on runLoop. This is the driver layer on top — the sandbox executor forwards that lineage passthrough rather than duplicating it. #150's findings (esp. verify the client-minted sessionId) are load-bearing here too.

Capture the design thread as tracked research docs under docs/research:
- recursive-execution-atom: the next generation (one recursive Agent atom
run as a durable, observable supervision tree; analyst-as-agent-with-runtime;
async dynamic spawning), the proposed surface, the file-grounded gap, and the
open forks. Plane B contains the flat harness.
- flat-harness-design: the assumption-free experiment harness synthesis
(profiles x steer x executionMode x allocation). Plane A.
- long-horizon-benchmark-survey: adversarially-verified survey; Commit0 and
tau2-bench as the multi-turn picks.
Index them under the new Research track in docs/README.md.
…spec
Freeze the contract: the budget-conserving reactive Scope + Supervisor keystone,
the event-sourced SpawnJournal + ResultBlobStore (outRef replay), the LeafExecutor
per-harness model (harness:null = Router inference, sandbox, cli), and the 8-step
v1 build order. Records the 4 resolved forks and the operator override (build the
LLM meta-driver now as the treatment on top of the conserved reservation pool, so
the equal-k gate stays valid by construction).
Operator refinement: the runtime is ONE open interface with an execute that
returns a promise or an async stream, not a closed inline|sandbox|cli union.
Built-ins are implementations; a user agent (mastra/agno/HTTP/custom) is
first-class by implementing it; no per-vendor adapters. The sandbox executor
composes runLoop and forwards PR #150's lineage passthrough rather than
reinventing checkpoint/fork. Records the #150 review (approve-to-land; verify
client-minted sessionId, bound fork acquisition, document parent-image fork).
…ervisor
The v1 keystone for the recursive-agent-atom (drivers-of-drivers, async,
observable). One self-similar atom whose act spawns child agents through a
Scope; the flat experiment harness is recovered as the simplest act.
- src/loops/supervise/types.ts: the frozen contract — Agent, an OPEN
LeafExecutor interface (execute returns a promise or an async stream;
router/inline + sandbox + cli are implementations, BYO is first-class via
the registry; no per-vendor adapters), Scope, Supervisor, Settled, Budget.
- supervise/budget.ts: a conserved reservation pool — atomic reserve-on-spawn,
fail-closed admission, refund-on-settle, so equal-k holds by construction
(the invariant that keeps a steered arm from silently out-computing blind).
- durable/spawn-journal.ts: event-sourced SpawnJournal + content-addressed
ResultBlobStore + seq-ordered replay (resumable, queryable, reproducible).
- supervise/scope.ts: a ray.wait cursor over an in-memory nursery; spawn
reserves budget and resolves the executor through the open registry; a
Settled-to-Iteration adapter keeps defaultSelectWinner single-sourced.
- supervise/runtime.ts: the open executor registry; the sandbox executor
composes runLoop (forwarding an optional lineage passthrough) rather than
reinventing checkpoint/fork.
- supervise/supervisor.ts: nursery join barrier, abort cascade (incl. the
acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle
(view/signal/abort) as the observability substrate.
- bench/src/drivers: flat-harness control (with the equal-k assertion),
progressive-widening control, and the LLM-meta-driver treatment. The
WidenGate defaults to flat so the selector-not-judge firewall stays dormant;
widening reads trace findings, never the raw verdict, unless judgeExempt.
- program.ts: mapPool one-for-one failure semantics (a down child is excluded
from the merge, an all-down batch re-throws the first original error so a
maxDepth guard still propagates loud).
Verified: typecheck, lint (204 files), build, full suite (642 tests incl. 28
keystone property tests), bench typecheck. Caveat: the live executor paths
(real router HTTP, sandbox runLoop, cli subprocess) are exercised only through
the offline mock LeafExecutor; no live-backend run yet.
@drewstone
drewstone marked this pull request as ready for review June 4, 2026 13:02
@tangletools

tangletools commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewing 78d80209

PassStatusETA
opencode DeepSeek v4 ProRunning (2 min)~5-15 min
opencode GLM 5.1Running (2 min)~5-15 min

Agent review running. Reads the actual code. This comment updates in place.

tangletools · #151 · model: kimi-for-coding · started 2026-06-04T13:05:48Z

@drewstone
drewstone merged commit 06efe71 into mainJun 4, 2026
1 check passed
@drewstone
drewstone deleted the feat/recursive-execution-atom branch June 4, 2026 13:06
drewstone added a commit that referenced this pull request Jun 6, 2026
Cuts the 58-commit backlog on main into a published release. Headline surface:
- runToolLoop / streamToolLoop — bounded turn-level tool-dispatch loop (#137)
- RSI agent tree: recursive Agent.act, Supervisor keystone, runProgram, the
adaptive-driver channel (#139/#151/#165)
- optimization API collapsed onto agent-eval selfImprove; the runtime keeps the
CODE-surface ImprovementDriver you pass as driver (#172)
- deployable benchmark adapters: AppWorld, commit0, aec-bench, EnterpriseOps-Gym;
runBenchmarks over one ADAPTERS registry (#153/#156/#157)
- agent-eval floor raised to >=0.83.0 (#175)
Sign up for freeto 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

@drewstone@tangletools
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone - #151

Merged
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom
Jun 4, 2026
Merged

feat(loops): recursive execution atom — budget-conserving Scope + Supervisor keystone#151
drewstone merged 5 commits into
mainfrom
feat/recursive-execution-atom

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

The v1 recursive execution atom — the keystone for drivers-of-drivers: one self-similar Agent whose act spawns child agents through a Scope, run by a Supervisor that owns a conserved budget pool, an event-sourced journal, and an observability/conversation handle. The flat experiment harness is recovered as the simplest act (it does not compete with this — it is one program over it).

Design + decision record: docs/research/recursive-execution-atom.md (frozen contract, build order, the 4 resolved forks, the adversarial critique that shaped the surface).

The pieces

  • src/loops/supervise/types.ts — the frozen contract. Agent, an open LeafExecutor interface (execute returns a promise or an async stream; router/inline + sandbox + cli are implementations, a user's own agent is first-class via the registry/BYO — no per-vendor adapters), Scope, Supervisor, Settled, Budget.
  • supervise/budget.ts — a conserved reservation pool: atomic reserve-on-spawn, fail-closed admission, refund-on-settle. This is the load-bearing invariant: Σk(treatment) ≡ Σk(blind) holds by construction, so a steered arm can never silently out-compute blind (the confound that burned the earlier "+20pp steering" result).
  • src/durable/spawn-journal.ts — event-sourced SpawnJournal + content-addressed ResultBlobStore + seq-ordered replay. Resumable, queryable, reproducible from one log.
  • supervise/scope.ts — a ray.wait cursor over an in-memory nursery; spawn reserves budget and resolves the executor through the open registry; a Settled → Iteration adapter keeps defaultSelectWinner single-sourced.
  • supervise/runtime.ts — the open executor registry; the sandbox executor composes runLoop (forwarding an optional lineage passthrough) rather than reinventing checkpoint/fork.
  • supervise/supervisor.ts — nursery join barrier, abort cascade (incl. the acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle (view/signal/abort) as the observability substrate.
  • bench/src/drivers/flat-harness control (with the equal-k assertion), progressive-widening control, and the LLM-meta-driver treatment. WidenGate defaults to flat so the selector≠judge firewall stays dormant; widening reads trace findings, never the raw verdict, unless judgeExempt.
  • program.tsmapPool one-for-one failure semantics (a down child is excluded from the merge; an all-down batch re-throws the first original error so a maxDepth guard still propagates loud).

Verification

Independently re-run on this branch: typecheck ✓, lint ✓ (204 files), build ✓, full suite 642/642 (incl. 28 keystone property tests: conserved-budget fail-closed + refund, equal-k by construction, monotonic-seq cursor, abort/teardown, replay determinism), bench typecheck ✓.

Honest gaps (why draft)

  • Live executor paths unproven. The router/sandbox/cli executors are exercised only through the offline mock LeafExecutor — they typecheck and the wiring is proven, but no real router-HTTP / sandbox-runLoop / cli-subprocess run has happened.
  • The LLM-meta-driver is the gated treatment, not a default. It ships so the diverse-strategy-vs-blind gate can actually be run; it is not wired into any default path.
  • Deferred (gated on a positive gate result): a tuned MCTS-PW algorithm, learned widening, a Temporal/DBOS durable backend, deleting runProgram's loop-layer parallel op.

Relationship to #150

#150 adds the leaf-level continued-session/fork lineage on runLoop. This is the driver layer on top — the sandbox executor forwards that lineage passthrough rather than duplicating it. #150's findings (esp. verify the client-minted sessionId) are load-bearing here too.

Capture the design thread as tracked research docs under docs/research:
- recursive-execution-atom: the next generation (one recursive Agent atom
run as a durable, observable supervision tree; analyst-as-agent-with-runtime;
async dynamic spawning), the proposed surface, the file-grounded gap, and the
open forks. Plane B contains the flat harness.
- flat-harness-design: the assumption-free experiment harness synthesis
(profiles x steer x executionMode x allocation). Plane A.
- long-horizon-benchmark-survey: adversarially-verified survey; Commit0 and
tau2-bench as the multi-turn picks.
Index them under the new Research track in docs/README.md.
…spec
Freeze the contract: the budget-conserving reactive Scope + Supervisor keystone,
the event-sourced SpawnJournal + ResultBlobStore (outRef replay), the LeafExecutor
per-harness model (harness:null = Router inference, sandbox, cli), and the 8-step
v1 build order. Records the 4 resolved forks and the operator override (build the
LLM meta-driver now as the treatment on top of the conserved reservation pool, so
the equal-k gate stays valid by construction).
Operator refinement: the runtime is ONE open interface with an execute that
returns a promise or an async stream, not a closed inline|sandbox|cli union.
Built-ins are implementations; a user agent (mastra/agno/HTTP/custom) is
first-class by implementing it; no per-vendor adapters. The sandbox executor
composes runLoop and forwards PR #150's lineage passthrough rather than
reinventing checkpoint/fork. Records the #150 review (approve-to-land; verify
client-minted sessionId, bound fork acquisition, document parent-image fork).
…ervisor
The v1 keystone for the recursive-agent-atom (drivers-of-drivers, async,
observable). One self-similar atom whose act spawns child agents through a
Scope; the flat experiment harness is recovered as the simplest act.
- src/loops/supervise/types.ts: the frozen contract — Agent, an OPEN
LeafExecutor interface (execute returns a promise or an async stream;
router/inline + sandbox + cli are implementations, BYO is first-class via
the registry; no per-vendor adapters), Scope, Supervisor, Settled, Budget.
- supervise/budget.ts: a conserved reservation pool — atomic reserve-on-spawn,
fail-closed admission, refund-on-settle, so equal-k holds by construction
(the invariant that keeps a steered arm from silently out-computing blind).
- durable/spawn-journal.ts: event-sourced SpawnJournal + content-addressed
ResultBlobStore + seq-ordered replay (resumable, queryable, reproducible).
- supervise/scope.ts: a ray.wait cursor over an in-memory nursery; spawn
reserves budget and resolves the executor through the open registry; a
Settled-to-Iteration adapter keeps defaultSelectWinner single-sourced.
- supervise/runtime.ts: the open executor registry; the sandbox executor
composes runLoop (forwarding an optional lineage passthrough) rather than
reinventing checkpoint/fork.
- supervise/supervisor.ts: nursery join barrier, abort cascade (incl. the
acquire lifecycle), OTP intensity breaker, typed SupervisedResult, RootHandle
(view/signal/abort) as the observability substrate.
- bench/src/drivers: flat-harness control (with the equal-k assertion),
progressive-widening control, and the LLM-meta-driver treatment. The
WidenGate defaults to flat so the selector-not-judge firewall stays dormant;
widening reads trace findings, never the raw verdict, unless judgeExempt.
- program.ts: mapPool one-for-one failure semantics (a down child is excluded
from the merge, an all-down batch re-throws the first original error so a
maxDepth guard still propagates loud).
Verified: typecheck, lint (204 files), build, full suite (642 tests incl. 28
keystone property tests), bench typecheck. Caveat: the live executor paths
(real router HTTP, sandbox runLoop, cli subprocess) are exercised only through
the offline mock LeafExecutor; no live-backend run yet.
@drewstone
drewstone marked this pull request as ready for review June 4, 2026 13:02
@tangletools

tangletools commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewing 78d80209

PassStatusETA
opencode DeepSeek v4 ProRunning (2 min)~5-15 min
opencode GLM 5.1Running (2 min)~5-15 min

Agent review running. Reads the actual code. This comment updates in place.

tangletools · #151 · model: kimi-for-coding · started 2026-06-04T13:05:48Z

@drewstone
drewstone merged commit 06efe71 into mainJun 4, 2026
1 check passed
@drewstone
drewstone deleted the feat/recursive-execution-atom branch June 4, 2026 13:06
drewstone added a commit that referenced this pull request Jun 6, 2026
Cuts the 58-commit backlog on main into a published release. Headline surface:
- runToolLoop / streamToolLoop — bounded turn-level tool-dispatch loop (#137)
- RSI agent tree: recursive Agent.act, Supervisor keystone, runProgram, the
adaptive-driver channel (#139/#151/#165)
- optimization API collapsed onto agent-eval selfImprove; the runtime keeps the
CODE-surface ImprovementDriver you pass as driver (#172)
- deployable benchmark adapters: AppWorld, commit0, aec-bench, EnterpriseOps-Gym;
runBenchmarks over one ADAPTERS registry (#153/#156/#157)
- agent-eval floor raised to >=0.83.0 (#175)
Sign up for freeto 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

@drewstone@tangletools