@tangle-network/agent-runtime 0.79.2 → 0.79.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +50 -327
  2. package/dist/agent.js +5 -5
  3. package/dist/analyst-loop.js +2 -2
  4. package/dist/{chunk-TSDKBFZP.js → chunk-44CX5JU6.js} +414 -113
  5. package/dist/chunk-44CX5JU6.js.map +1 -0
  6. package/dist/{chunk-T2HVQVB4.js → chunk-4J6RBI3K.js} +15 -1
  7. package/dist/chunk-4J6RBI3K.js.map +1 -0
  8. package/dist/{chunk-75V2XXYJ.js → chunk-AHZ3YBL6.js} +524 -12
  9. package/dist/chunk-AHZ3YBL6.js.map +1 -0
  10. package/dist/{chunk-IODKUOBA.js → chunk-C2FZ6GR6.js} +2 -2
  11. package/dist/{chunk-Z3RRRPRB.js → chunk-H7IBHAFT.js} +23 -14
  12. package/dist/chunk-H7IBHAFT.js.map +1 -0
  13. package/dist/{chunk-VMNEQHJR.js → chunk-IPEQ3ERC.js} +17 -2
  14. package/dist/chunk-IPEQ3ERC.js.map +1 -0
  15. package/dist/{chunk-PBE35ULD.js → chunk-NXZEVWKP.js} +2 -2
  16. package/dist/{chunk-SONQUREI.js → chunk-RUJZK6VH.js} +2 -2
  17. package/dist/{chunk-2DS6T46I.js → chunk-U6AP535M.js} +4 -4
  18. package/dist/{coordination-BoEPhGas.d.ts → coordination-BFVtgRax.d.ts} +30 -4
  19. package/dist/environment-provider.d.ts +1 -1
  20. package/dist/environment-provider.js +1 -1
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +8 -8
  23. package/dist/intelligence.d.ts +30 -2
  24. package/dist/intelligence.js +33 -23
  25. package/dist/intelligence.js.map +1 -1
  26. package/dist/{loop-runner-bin-DCr5OMe5.d.ts → loop-runner-bin-CTVja8e0.d.ts} +2 -2
  27. package/dist/loop-runner-bin.d.ts +4 -4
  28. package/dist/loop-runner-bin.js +7 -7
  29. package/dist/loops.d.ts +283 -13
  30. package/dist/loops.js +26 -6
  31. package/dist/mcp/bin.js +5 -5
  32. package/dist/mcp/index.d.ts +6 -6
  33. package/dist/mcp/index.js +7 -7
  34. package/dist/{router-client-CMAWGv1h.d.ts → router-client-Ak2IGuXq.d.ts} +33 -1
  35. package/dist/{types-C1sozrte.d.ts → types-DYW0tloU.d.ts} +2 -2
  36. package/dist/{worktree-fanout-CtQrRDME.d.ts → worktree-fanout-DaUDwCA_.d.ts} +5 -74
  37. package/dist/{worktree-CpptK3oF.d.ts → worktree-harness-Dt6s_m3z.d.ts} +74 -2
  38. package/package.json +1 -1
  39. package/skills/build-with-agent-runtime/SKILL.md +53 -23
  40. package/dist/chunk-75V2XXYJ.js.map +0 -1
  41. package/dist/chunk-T2HVQVB4.js.map +0 -1
  42. package/dist/chunk-TSDKBFZP.js.map +0 -1
  43. package/dist/chunk-VMNEQHJR.js.map +0 -1
  44. package/dist/chunk-Z3RRRPRB.js.map +0 -1
  45. /package/dist/{chunk-IODKUOBA.js.map → chunk-C2FZ6GR6.js.map} +0 -0
  46. /package/dist/{chunk-PBE35ULD.js.map → chunk-NXZEVWKP.js.map} +0 -0
  47. /package/dist/{chunk-SONQUREI.js.map → chunk-RUJZK6VH.js.map} +0 -0
  48. /package/dist/{chunk-2DS6T46I.js.map → chunk-U6AP535M.js.map} +0 -0
@@ -23,6 +23,38 @@ type ToolLoopChat = (messages: ReadonlyArray<Msg>, tools: ReadonlyArray<ToolSpec
23
23
  * into a conserved pool (the supervisor brain). `runBrainLoop` itself ignores it. */
24
24
  costUsd?: number;
25
25
  }>;
26
+ /** Self-compaction — bound the loop's OWN context window the way a fresh-respawn (dumb-Ralph) loop
27
+ * does, but in place. A stateless chat API re-sends the WHOLE running conversation every turn, so an
28
+ * agent that accumulates dozens of turns of tool results re-bills its entire transcript on every
29
+ * inference — the context-overflow-one-level-up that the conserved budget pool cannot fix. With
30
+ * compaction set, once the conversation exceeds `thresholdTokens` the accumulated middle (every prior
31
+ * assistant turn + tool result) is distilled into ONE compact progress note and the conversation is
32
+ * reset to `[...head, digest]`: the preserved head (system + the original task) survives, the stale
33
+ * turn-by-turn history does not. The model keeps deciding; it stops re-billing the whole transcript.
34
+ * Fires at a CLEAN turn boundary (after a turn's tool results are folded in, before the next
35
+ * inference) so it never orphans an assistant `tool_calls` from its `tool` replies. */
36
+ interface ToolLoopCompaction {
37
+ /** Compact once the estimated token count of the conversation exceeds this. */
38
+ readonly thresholdTokens: number;
39
+ /** Distill the conversation into a compact progress note that REPLACES the middle. Receives the
40
+ * full conversation (so it can summarize everything done so far); returns the digest string. */
41
+ readonly distill: (messages: ReadonlyArray<Msg>) => Promise<string> | string;
42
+ /** Leading messages preserved verbatim (system + the original task). Default 2. */
43
+ readonly preserveHead?: number;
44
+ /** Token estimator over the conversation. Default ≈ chars/4 (incl. tool-call arguments). */
45
+ readonly estimateTokens?: (messages: ReadonlyArray<Msg>) => number;
46
+ /** Notified each time a compaction fires — for observability/metering. */
47
+ readonly onCompact?: (info: {
48
+ turn: number;
49
+ beforeTokens: number;
50
+ afterTokens: number;
51
+ }) => void;
52
+ }
53
+ /** Public supervisor-facing compaction config: same knobs as the primitive, but `distill` is optional
54
+ * because the supervisor has a default digest that combines a brain note with live worker state. */
55
+ type ToolLoopCompactionOptions = Omit<ToolLoopCompaction, 'distill'> & {
56
+ readonly distill?: ToolLoopCompaction['distill'];
57
+ };
26
58
 
27
59
  /**
28
60
  * The one router chat client: direct OpenAI-compatible completions through the
@@ -161,4 +193,4 @@ declare function routerBrain(cfg: RouterConfig, opts?: {
161
193
  temperature?: number;
162
194
  }): ToolLoopChat;
163
195
 
164
- export { type RouterConfig as R, type ToolSpec as T, type ToolLoopChat as a, type RouterChatResult as b, type RouterChatToolsResult as c, type RouterToolCall as d, type RouterToolLoopResult as e, routerChatWithTools as f, routerChatWithUsage as g, routerToolLoop as h, routerBrain as r };
196
+ export { type RouterConfig as R, type ToolSpec as T, type ToolLoopChat as a, type ToolLoopCompactionOptions as b, type RouterChatResult as c, type RouterChatToolsResult as d, type RouterToolCall as e, type RouterToolLoopResult as f, type ToolLoopCompaction as g, routerChatWithTools as h, routerChatWithUsage as i, routerToolLoop as j, routerBrain as r };
@@ -129,8 +129,8 @@ type UsageEvent = {
129
129
  } | {
130
130
  kind: 'iteration';
131
131
  };
132
- /** The runtime tag of a `Executor` impl. Open by intent `string` so a BYO executor
133
- * names its own runtime; the built-ins use these literals. */
132
+ /** The runtime tag of a `Executor` impl. Open by intent: custom runtimes use their own string name.
133
+ * External executors can register additional runtime strings without widening this type. */
134
134
  type Runtime = 'router' | 'inline' | 'sandbox' | 'cli' | (string & {});
135
135
  /**
136
136
  * `AgentProfile` does NOT carry a `harness`/backend field — `harness` lives on the
@@ -1,9 +1,9 @@
1
1
  import { AgentProfile } from '@tangle-network/agent-interface';
2
2
  import { AnalystFinding, DefaultVerdict } from '@tangle-network/agent-eval';
3
- import { A as AgentSpec, b as ExecutorRegistry, B as Budget, c as Agent, S as SpawnJournal, d as ResultBlobStore, e as RootHandle, f as SupervisedResult, N as NodeId, g as Settled, h as Spend, i as Scope, a as Executor } from './types-C1sozrte.js';
3
+ import { A as AgentSpec, b as ExecutorRegistry, B as Budget, c as Agent, S as SpawnJournal, d as ResultBlobStore, e as RootHandle, f as SupervisedResult, N as NodeId, g as Settled, h as Spend, i as Scope, a as Executor } from './types-DYW0tloU.js';
4
4
  import { R as RuntimeHooks, I as Iteration } from './types-BF-MEsQB.js';
5
5
  import { BackendType } from '@tangle-network/sandbox';
6
- import { G as GitRunner, d as DeliverableSpec } from './worktree-CpptK3oF.js';
6
+ import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './worktree-harness-Dt6s_m3z.js';
7
7
  import { L as LocalHarness, r as runLocalHarness } from './local-harness-DU7yV6mG.js';
8
8
 
9
9
  /**
@@ -785,77 +785,6 @@ interface CoderCheckConstraints {
785
785
  forbiddenPaths?: string[];
786
786
  }
787
787
 
788
- /**
789
- * @experimental
790
- *
791
- * The ONE worktree-harness execution core. The physical act — run a supervisor-authored
792
- * `AgentProfile` on a local coding-harness CLI (claude / codex / opencode) against a fresh git
793
- * worktree off `repoRoot`, capture the diff, derive the test/typecheck PASS signals, then clean
794
- * up — lives here ONCE. Two executors adapt it to two ports without re-implementing it:
795
- * - `createWorktreeCliExecutor` — the `Scope`/`Supervisor` leaf `Executor`.
796
- * - `createInProcessExecutor` — the `runLoop` `SandboxClient` / coder-delegate path.
797
- *
798
- * §1.5 by construction: the authored `profile.prompt.systemPrompt` + `profile.model.default`
799
- * reach the harness through `harnessInvocation` HERE, so neither port can drop them — the exact
800
- * bug that existed while the in-process path called `runLocalHarness` with only the task prompt.
801
- *
802
- * Lifecycle: `createWorktree` → `harnessInvocation` + `runLocalHarness` → `captureWorktreeDiff`
803
- * (BEFORE checks, so the patch is the harness's output, not polluted by files a test run writes)
804
- * → the configured test/typecheck commands in the live worktree → return the result + a `cleanup`
805
- * the caller invokes at its own teardown point. A throw cleans up before propagating, so a failed
806
- * run never leaks a worktree.
807
- */
808
-
809
- /** Outcome of one verification command run in the worktree (test or typecheck). */
810
- interface WorktreeCommandResult {
811
- /** The shell command line that was run. */
812
- command: string;
813
- /** Did the command exit 0? The PASS signal a deliverable gate / coder output reads. */
814
- passed: boolean;
815
- /** OS exit code, or `null` when killed before exit. */
816
- exitCode: number | null;
817
- /** Combined stdout+stderr (capped) — surfaced in traces for diagnosis. */
818
- output: string;
819
- }
820
- /** The canonical result of one worktree-harness run, projected by each port to its own shape. */
821
- interface WorktreeHarnessResult {
822
- /** The branch the worktree was cut on (`delegate/<runId>`). */
823
- branch: string;
824
- /** `git diff` of the worktree against its base — the unified patch the harness produced. */
825
- patch: string;
826
- /** Shortstat-derived change counts. */
827
- stats: {
828
- filesChanged: number;
829
- insertions: number;
830
- deletions: number;
831
- };
832
- /** The harness subprocess outcome. */
833
- harness: {
834
- name: LocalHarness;
835
- exitCode: number | null;
836
- timedOut: boolean;
837
- killedBySignal: NodeJS.Signals | null;
838
- durationMs: number;
839
- stdout: string;
840
- stderr: string;
841
- };
842
- /** Verification signals derived in the live worktree (present only when commands were given). */
843
- checks?: {
844
- tests?: WorktreeCommandResult;
845
- typecheck?: WorktreeCommandResult;
846
- };
847
- }
848
- /** The single shell-command-in-worktree runner seam (replaces the per-executor copies). */
849
- type WorktreeCheckRunner = (opts: {
850
- command: string;
851
- cwd: string;
852
- timeoutMs: number;
853
- signal?: AbortSignal;
854
- }) => Promise<{
855
- exitCode: number | null;
856
- output: string;
857
- }>;
858
-
859
788
  /**
860
789
  * @experimental
861
790
  *
@@ -907,6 +836,8 @@ interface WorktreeCliExecutorOptions {
907
836
  typecheckCmd?: string;
908
837
  /** Wall-clock cap per verification command (ms). Default = `harnessTimeoutMs` or 5 min. */
909
838
  checkTimeoutMs?: number;
839
+ /** Cap on each check's captured output. Default 16k. */
840
+ checkOutputCap?: number;
910
841
  /** Test seam — inject a git runner so unit tests drive the worktree helpers without git. */
911
842
  runGit?: GitRunner;
912
843
  /** Test seam — inject the harness runner so unit tests script a `LocalHarnessResult`. */
@@ -1038,4 +969,4 @@ interface WorktreeFanoutOptions extends PatchDeliverableOptions {
1038
969
  */
1039
970
  declare function worktreeFanout<Task>(options: WorktreeFanoutOptions): CombinatorShape<Task, WorktreePatchArtifact>;
1040
971
 
1041
- export { type Widen as $, type AuthoredHarness as A, type Panel as B, type CorpusRecord as C, type DefinePersonaInput as D, type EqualKArm as E, type FanoutOptions as F, type PanelJudge as G, type PanelVerdict as H, type PatchDeliverableOptions as I, type PersonaContext as J, type PersonaExecutors as K, type LoopUntilSpec as L, type Pipeline as M, type RenderCorpusToInstructions as N, type Outcome as O, type PanelSpec as P, type RunPersonified as Q, type RenderCorpusToInstructionsOptions as R, type ScopeAnalyzeInput as S, type TrajectoryReportOptions as T, type ShapeBudget as U, type VerifySpec as V, type WinnerStrategy as W, type ShapeContext as X, type TrajectoryNode as Y, type TrajectoryReportFn as Z, type Verify as _, type WorktreeFanoutOptions as a, type WidenDecision as a0, type WidenLineage as a1, type WorktreeCliExecutorOptions as a2, type WorktreeCommandResult as a3, createWorktreeCliExecutor as a4, patchDelivered as a5, worktreeFanout as a6, type WorktreePatchArtifact as b, type Corpus as c, type AssertTraceDerivedFindings as d, type SteerContext as e, type ScopeAnalyst as f, type CombinatorShape as g, type ScopeWidenGate as h, type PipelineStage as i, type FanoutWinnerSelector as j, type WidenSpec as k, type CorpusFilter as l, type Persona as m, type RunPersonifiedOptions as n, type ShapeRegistry as o, type LoopShape as p, type EqualKOnCostOptions as q, type EqualKVerdict as r, type TrajectoryReport as s, type DefinePersona as t, type EqualKOnCost as u, type Fanout as v, type FanoutSynthesis as w, type FlatWidenGate as x, type LoopUntil as y, type LoopUntilState as z };
972
+ export { type Widen as $, type AuthoredHarness as A, type Panel as B, type CorpusRecord as C, type DefinePersonaInput as D, type EqualKArm as E, type FanoutOptions as F, type PanelJudge as G, type PanelVerdict as H, type PatchDeliverableOptions as I, type PersonaContext as J, type PersonaExecutors as K, type LoopUntilSpec as L, type Pipeline as M, type RenderCorpusToInstructions as N, type Outcome as O, type PanelSpec as P, type RunPersonified as Q, type RenderCorpusToInstructionsOptions as R, type ScopeAnalyzeInput as S, type TrajectoryReportOptions as T, type ShapeBudget as U, type VerifySpec as V, type WinnerStrategy as W, type ShapeContext as X, type TrajectoryNode as Y, type TrajectoryReportFn as Z, type Verify as _, type WorktreeFanoutOptions as a, type WidenDecision as a0, type WidenLineage as a1, type WorktreeCliExecutorOptions as a2, createWorktreeCliExecutor as a3, patchDelivered as a4, worktreeFanout as a5, type WorktreePatchArtifact as b, type Corpus as c, type AssertTraceDerivedFindings as d, type SteerContext as e, type ScopeAnalyst as f, type CombinatorShape as g, type ScopeWidenGate as h, type PipelineStage as i, type FanoutWinnerSelector as j, type WidenSpec as k, type CorpusFilter as l, type Persona as m, type RunPersonifiedOptions as n, type ShapeRegistry as o, type LoopShape as p, type EqualKOnCostOptions as q, type EqualKVerdict as r, type TrajectoryReport as s, type DefinePersona as t, type EqualKOnCost as u, type Fanout as v, type FanoutSynthesis as w, type FlatWidenGate as x, type LoopUntil as y, type LoopUntilState as z };
@@ -1,4 +1,5 @@
1
- import { a as Executor } from './types-C1sozrte.js';
1
+ import { a as Executor } from './types-DYW0tloU.js';
2
+ import { L as LocalHarness } from './local-harness-DU7yV6mG.js';
2
3
 
3
4
  /**
4
5
  * @experimental
@@ -122,4 +123,75 @@ declare function captureWorktreeDiff(options: DiffOptions): Promise<DiffResult>;
122
123
  /** @experimental */
123
124
  declare function removeWorktree(options: RemoveWorktreeOptions): Promise<void>;
124
125
 
125
- export { type CreateWorktreeOptions as C, type DiffOptions as D, type GitRunner as G, type RemoveWorktreeOptions as R, type WorktreeHandle as W, type DiffResult as a, createWorktree as b, captureWorktreeDiff as c, type DeliverableSpec as d, gateOnDeliverable as g, removeWorktree as r };
126
+ /**
127
+ * @experimental
128
+ *
129
+ * The ONE worktree-harness execution core. The physical act — run a supervisor-authored
130
+ * `AgentProfile` on a local coding-harness CLI (claude / codex / opencode) against a fresh git
131
+ * worktree off `repoRoot`, capture the diff, derive the test/typecheck PASS signals, then clean
132
+ * up — lives here ONCE. Two executors adapt it to two ports without re-implementing it:
133
+ * - `createWorktreeCliExecutor` — the `Scope`/`Supervisor` leaf `Executor`.
134
+ * - `createInProcessExecutor` — the `runLoop` `SandboxClient` / coder-delegate path.
135
+ *
136
+ * §1.5 by construction: the authored `profile.prompt.systemPrompt` + `profile.model.default`
137
+ * reach the harness through `harnessInvocation` HERE, so neither port can drop them — the exact
138
+ * bug that existed while the in-process path called `runLocalHarness` with only the task prompt.
139
+ *
140
+ * Lifecycle: `createWorktree` → `harnessInvocation` + `runLocalHarness` → `captureWorktreeDiff`
141
+ * (BEFORE checks, so the patch is the harness's output, not polluted by files a test run writes)
142
+ * → the configured test/typecheck commands in the live worktree → return the result + a `cleanup`
143
+ * the caller invokes at its own teardown point. A throw cleans up before propagating, so a failed
144
+ * run never leaks a worktree.
145
+ */
146
+
147
+ /** Outcome of one verification command run in the worktree (test or typecheck). */
148
+ interface WorktreeCommandResult {
149
+ /** The shell command line that was run. */
150
+ command: string;
151
+ /** Did the command exit 0? The PASS signal a deliverable gate / coder output reads. */
152
+ passed: boolean;
153
+ /** OS exit code, or `null` when killed before exit. */
154
+ exitCode: number | null;
155
+ /** Combined stdout+stderr (capped) — surfaced in traces for diagnosis. */
156
+ output: string;
157
+ }
158
+ /** The canonical result of one worktree-harness run, projected by each port to its own shape. */
159
+ interface WorktreeHarnessResult {
160
+ /** The branch the worktree was cut on (`delegate/<runId>`). */
161
+ branch: string;
162
+ /** `git diff` of the worktree against its base — the unified patch the harness produced. */
163
+ patch: string;
164
+ /** Shortstat-derived change counts. */
165
+ stats: {
166
+ filesChanged: number;
167
+ insertions: number;
168
+ deletions: number;
169
+ };
170
+ /** The harness subprocess outcome. */
171
+ harness: {
172
+ name: LocalHarness | 'bridge';
173
+ exitCode: number | null;
174
+ timedOut: boolean;
175
+ killedBySignal: NodeJS.Signals | null;
176
+ durationMs: number;
177
+ stdout: string;
178
+ stderr: string;
179
+ };
180
+ /** Verification signals derived in the live worktree (present only when commands were given). */
181
+ checks?: {
182
+ tests?: WorktreeCommandResult;
183
+ typecheck?: WorktreeCommandResult;
184
+ };
185
+ }
186
+ /** The single shell-command-in-worktree runner seam (replaces the per-executor copies). */
187
+ type WorktreeCheckRunner = (opts: {
188
+ command: string;
189
+ cwd: string;
190
+ timeoutMs: number;
191
+ signal?: AbortSignal;
192
+ }) => Promise<{
193
+ exitCode: number | null;
194
+ output: string;
195
+ }>;
196
+
197
+ export { type CreateWorktreeOptions as C, type DeliverableSpec as D, type GitRunner as G, type RemoveWorktreeOptions as R, type WorktreeHarnessResult as W, type WorktreeCheckRunner as a, type DiffOptions as b, type DiffResult as c, type WorktreeHandle as d, captureWorktreeDiff as e, createWorktree as f, type WorktreeCommandResult as g, gateOnDeliverable as h, removeWorktree as r };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-runtime",
3
- "version": "0.79.2",
3
+ "version": "0.79.4",
4
4
  "description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
5
5
  "homepage": "https://github.com/tangle-network/agent-runtime#readme",
6
6
  "repository": {
@@ -21,8 +21,8 @@ capture-integrity, or eval/prod parity).
21
21
 
22
22
  ## Load order — point at source, never freeze snippets
23
23
 
24
- This skill carries **no API snippets**. The barrel MOVES (`./loops` is a
25
- back-compat alias of `./runtime`), the agent-eval pin drifts, and signatures get
24
+ This skill carries **no API snippets**. The barrel MOVES (`./loops` is the
25
+ runtime barrel), the agent-eval pin drifts, and signatures get
26
26
  corrected in place. Freezing a snippet here guarantees rot. Instead, read, in
27
27
  order, and re-verify against source:
28
28
 
@@ -32,9 +32,8 @@ order, and re-verify against source:
32
32
  two-substrate map. Every signature there was read from source.
33
33
  2. **`grep` the export barrel** — `grep -nE 'export (function|const|type)' src/runtime/index.ts`
34
34
  (and `src/agent/index.ts`, `src/improvement/index.ts`, `src/mcp/index.ts`,
35
- `src/intelligence/index.ts`) for the live names + subpaths. `./loops` and
36
- `./runtime` resolve to the SAME barrel (`package.json` maps both to
37
- `src/runtime/index.ts`).
35
+ `src/intelligence/index.ts`) for the live names + subpaths. `./loops` is the
36
+ runtime barrel (`package.json` maps it to `src/runtime/index.ts`).
38
37
  3. **`bench/HARNESS.md`** — the experiment-harness map: commands, the
39
38
  `rollout → corpus → selector → CI → gate` flow, and the `ADAPTERS` registry
40
39
  (a harness-local export, `bench/src/adapters.ts`, not a package export).
@@ -54,36 +53,48 @@ profile and letting the substrate materialize it into harness shapes —
54
53
  self-verification, iteration, and audit are profile levers (hooks/skills/
55
54
  subagents), never glue code.
56
55
 
57
- `AgentProfile` is now owned by `@tangle-network/agent-interface` (the `/runtime`
58
- barrel still re-exports the sandbox alias for back-compat), which also owns
56
+ `AgentProfile` is owned by `@tangle-network/agent-interface` (the `/loops`
57
+ barrel re-exports the sandbox alias as a one-stop import), which also owns
59
58
  `HarnessType` + `ReasoningEffort` and a capability layer
60
59
  (`harnessSupportsModel` / `reasoningEffortsFor`) — so harness/model/reasoning
61
60
  compatibility is a queryable contract, not an assumption.
62
61
 
62
+ Harness is a RUN-layer coordinate, not part of the portable genome: it rides on
63
+ agent-runtime's `AgentSpec { profile, harness }`. To sweep it as an eval axis,
64
+ don't hand-declare a harness list — expand one base profile across
65
+ `CODING_HARNESSES` with `expandProfileAxes` (agent-eval), run with
66
+ `runProfileMatrix`, and pivot results by the stamped `AgentProfileCell`
67
+ (`groupRunsByAgentProfileCell`); incompatible `(harness, model)` pairs drop via
68
+ `harnessSupportsModel`.
69
+
63
70
  | Altitude — I want to… | Use | Source |
64
71
  |---|---|---|
65
- | **Define a genome** (who the agent is + what it can do, ONE surface) | `AgentProfile` (runnable) / `AgentSurfaces` (the editable-coordinate map) — `/runtime`, `/agent` | canonical-api §3.2 |
66
- | **Define the personified-run record** (model+prompt+tools+role+seams) | `definePersona(input)` — `/runtime` | canonical-api §3.1 |
67
- | **Run a genome driver⟷worker, end-to-end** | `runPersonified({ persona, shape, task, budget })` — `/runtime` | canonical-api §3.1 |
68
- | **Loop a worker over one evolving artifact, K rounds, stop-when-good** | `loopUntil(seed, spec)` as the `shape` — `/runtime` | canonical-api §3.1 |
69
- | **Best-of-N / parallel-research at equal compute** | `fanout(items, opts)` — `/runtime` | canonical-api §3.1 |
70
- | **Produce-then-gate / multi-judge quorum / fixed chain** | `verify` / `panel` / `pipeline` — `/runtime` | canonical-api §3.1 |
72
+ | **Define a genome** (who the agent is + what it can do, ONE surface) | `AgentProfile` (runnable) / `AgentSurfaces` (the editable-coordinate map) — `/loops`, `/agent` | canonical-api §3.2 |
73
+ | **Define the personified-run record** (model+prompt+tools+role+seams) | `definePersona(input)` — `/loops` | canonical-api §3.1 |
74
+ | **Run a genome driver⟷worker, end-to-end** | `runPersonified({ persona, shape, task, budget })` — `/loops` | canonical-api §3.1 |
75
+ | **Loop a worker over one evolving artifact, K rounds, stop-when-good** | `loopUntil(seed, spec)` as the `shape` — `/loops` | canonical-api §3.1 |
76
+ | **Best-of-N / parallel-research at equal compute** | `fanout(items, opts)` — `/loops` | canonical-api §3.1 |
77
+ | **Produce-then-gate / multi-judge quorum / fixed chain** | `verify` / `panel` / `pipeline` — `/loops` | canonical-api §3.1 |
71
78
  | **Run depth-vs-breadth (or a custom strategy) over a stateful tool domain** | `runAgentic({ surface, task, mode\|strategy, budget })` — `/loops` | canonical-api §3.3 |
72
79
  | **Author a new topology/strategy compactly** | `defineStrategy(name, body)` w/ `ctx.shot()`+`ctx.critique()` — `/loops` | canonical-api §3.3 |
73
80
  | **Add a stateful tool-using domain** | implement `AgenticSurface` (5 hooks) — `/loops` | canonical-api §3.3 |
81
+ | **Drive a team of agents over a graded `AgenticSurface` task** (workers settle on its check, driver self-improves from the failing tests) | `superviseSurface(profile, task, { surface, worker })` — `/loops` | canonical-api §2 |
74
82
  | **Benchmark: compare strategies + significance + Pareto on a domain** | `runBenchmark({ environment, tasks, worker, strategies })` — `/loops` | canonical-api §3.3 |
83
+ | **Benchmark report: multi-profile × multi-axis leaderboard** (ranked board + score matrix + SVG/HTML charts, any `RunRecord[]`) | `leaderboard(records)` + `renderLeaderboardMarkdown` / `renderLeaderboardSvg` / `renderLeaderboardHtml` — `/loops` | canonical-api §2 |
84
+ | **Meter one `openSandboxRun` cell's token/cost usage** | `sumSandboxUsage(events)` — `/loops` | canonical-api §2 |
85
+ | **Sweep harness × model as an eval axis** (turn one base profile into the full harness × model set) | `expandProfileAxes({ base, harnesses, models })` over `CODING_HARNESSES` → `runProfileMatrix(...)`, pivot with `groupRunsByAgentProfileCell` — `agent-eval` root — NOT a hand-declared `HARNESSES` list | agent-eval root (verify vs source) |
75
86
  | **Benchmark: add/run an external benchmark from the harness** | `ADAPTERS`/`resolveAdapter(key)` + a bench gate (`*-gate.mts`) over `openSandboxRun` + `sandboxAgentRun` (`bench/src/sandbox-run.ts`) | canonical-api §3.3 |
76
- | **Spawn N coding agents on isolated git worktrees, keep the one whose patch passes checks** | `worktreeFanout` + `createWorktreeCliExecutor` + `gateOnDeliverable(DeliverableSpec)` over a raw `WorktreePatchArtifact`, winner via `selectValidWinner` — `/runtime` — NOT a hand-rolled spawn-loop / "coder" role | canonical-api §3.1 / §5 |
77
- | **Sandbox coding rollout** (fresh box/round, or persistent+resume) | `runLoop(options)` / `openSandboxRun(client, opts, deliverable)` — `/runtime` | canonical-api §3.1 |
78
- | **Optimize a CODE surface** in a gated loop | `improvementDriver({ worktree, generator })` — `/improvement` | canonical-api §3.4 |
87
+ | **Spawn N coding agents on isolated git worktrees, keep the one whose patch passes checks** | `worktreeFanout` + `createWorktreeCliExecutor` + `gateOnDeliverable(DeliverableSpec)` over a raw `WorktreePatchArtifact`, winner via `selectValidWinner` — `/loops` — NOT a hand-rolled spawn-loop / "coder" role | canonical-api §3.1 / §5 |
88
+ | **Sandbox coding rollout** (fresh box/round, or persistent+resume) | `runLoop(options)` / `openSandboxRun(client, opts, deliverable)` — `/loops` | canonical-api §3.1 |
89
+ | **Optimize a CODE surface** in a gated loop | `improvementDriver({ worktree, generator })` — root `.` | canonical-api §3.4 |
79
90
  | **Optimize a PROMPT/config surface** (one call) | `selfImprove({ agent, scenarios, judge, baselineSurface })` — `agent-eval/contract` | canonical-api §3.4 |
80
91
  | **Gate: ship/hold a candidate** (campaign ctx) | `defaultProductionGate` / `heldOutGate` / `composeGate` — `agent-eval/contract` | canonical-api §3.4 |
81
- | **Gate: ship/hold from a `BenchmarkReport`** (per-task cells) | `promotionGate({ report, incumbent, candidate })` — `/runtime` | canonical-api §3.4 |
82
- | **Run the full multi-generation flywheel + certify** | `runStrategyEvolution(config)` — `/runtime` | canonical-api §3.4 |
83
- | **Compose the prod sandbox profile** (eval/prod parity) | `composeProductionAgentProfile(base, opts)` — `/mcp` | canonical-api §3.2 |
84
- | **Observe a run** (cost/time waterfall, live tree, OTLP) | `createWaterfallCollector` / `createOtelExporter` via `composeRuntimeHooks(...)` — root; `createTopologyView` / `renderTopologyTree` — `/topology` | canonical-api §3.5 |
92
+ | **Gate: ship/hold from a `BenchmarkReport`** (per-task cells) | `promotionGate({ report, incumbent, candidate })` — `/loops` | canonical-api §3.4 |
93
+ | **Run the full multi-generation flywheel + certify** | `runStrategyEvolution(config)` — `/loops` | canonical-api §3.4 |
94
+ | **Observe a run** (cost/time waterfall, OTLP) | `createWaterfallCollector()` — `/loops`; `createOtelExporter` attached via `composeRuntimeHooks(...)` — root `.` | canonical-api §2 |
85
95
  | **State any A/B claim** | `pairedLift` (bench) over `pairedBootstrap`/`heldoutSignificance` (substrate) | canonical-api §3.5 |
86
- | **Observe/ship with billing-boundary** | `withTangleIntelligence(agent, { project, effort })` — `/intelligence` | canonical-api §7 (now live on main — verify) |
96
+ | **Observe/ship with billing-boundary** | `withTangleIntelligence(agent, { project, effort })` — `/intelligence` | canonical-api §2 |
97
+ | **Pull the certified profile from the Intelligence plane** (pull-by-default delivery: fold the gate-certified prompt onto the base surface) | `pullCertified` / `withCertifiedDelivery` / `composeCertifiedPrompt` — `/intelligence` | `src/intelligence/delivery.ts` |
87
98
 
88
99
  ## Do-NOT-reinvent — the traps this skill exists to stop
89
100
 
@@ -112,6 +123,12 @@ holds the load-bearing invariant the parallel breaks:
112
123
  sum of spans IS the billed run cost; a parallel tally drifts).
113
124
  - your own bootstrap loop / PRNG per gate **≈** `pairedLift` / `promotionGate`
114
125
  (seeded, identical run-to-run; never report a point lift without `low/high/pairs`).
126
+ - a per-product `HARNESSES` / `HarnessBackend` list + a metadata-harness reader
127
+ **≈** `CODING_HARNESSES` + `expandProfileAxes` (the one canonical harness list;
128
+ incompatible `(harness, model)` pairs drop via `harnessSupportsModel`) and the
129
+ `AgentProfileCell` stamped by `runProfileMatrix`, pivoted via
130
+ `groupRunsByAgentProfileCell` — never bake the harness into the model id so the
131
+ same model can run under multiple harnesses.
115
132
 
116
133
  ## End-to-end recipe
117
134
 
@@ -146,8 +163,21 @@ One line wraps any agent with trace + billing boundary:
146
163
  off|eco|standard|thorough|max` (`'off'` is the provable passthrough floor —
147
164
  intelligence spend clamped to 0). It builds on `createOtelExporter` +
148
165
  `loopEventToOtelSpan` — don't hand-roll a trace-wrapper or effort/tier config.
149
- Verify the live subpath against `src/intelligence/index.ts` (canonical-api §7's
150
- "branch-only" note is stale — it landed on main).
166
+ Verify the live subpath against `src/intelligence/index.ts`.
167
+
168
+ Two operational facts every consumer must know:
169
+
170
+ - **Export is a silent no-op without an endpoint.** The export leg only ships
171
+ when `INTELLIGENCE_OTLP_ENDPOINT` (or `OTEL_EXPORTER_OTLP_ENDPOINT`) is set —
172
+ e.g. `https://intelligence.tangle.tools/v1/otlp`; absent, spans are dropped
173
+ best-effort with no error. The client's `doctor().exportConfigured` is the
174
+ check that export will actually ship.
175
+ - **Delivery pulls the certified profile from the plane.** `pullCertified` /
176
+ `withCertifiedDelivery` hit
177
+ `GET {TANGLE_INTELLIGENCE_URL|https://intelligence.tangle.tools}/v1/profiles/:target/composed`
178
+ with `Bearer TANGLE_API_KEY`; `withCertifiedDelivery` folds the certified
179
+ prompt onto the base surface, refreshes at most every 5 minutes, and is
180
+ fail-closed — a failed pull runs the agent on its base surface.
151
181
 
152
182
  ## Final check
153
183