Cloud kimi-k2.5 executor for weak tiers + multi-strategy playbook retrieval

Two coupled changes from the 2026 agent-memory research + tool
asymmetry findings.

SCENARIO (weak-tier cloud substitute):
qwen2.5 collapsed to 0/14 across the basic/minimal tool_levels.
Replace with cloud kimi-k2.5 on Ollama Cloud — same family as k2.6
(pro-tier locked today, on J's upgrade path). Plumb cloud flag
through ACTIVE_EXECUTOR_CLOUD / ACTIVE_REVIEWER_CLOUD into
generateContinuable so executor/reviewer can route to cloud when
tool_level requires. think:false supported by Kimi family.

Tool level mapping (revised):
  full     — qwen3.5 local + qwen3 local + cloud gpt-oss:120b T3 + rescue
  local    — qwen3.5 local + qwen3 local + local gpt-oss:20b T3 + rescue
  basic    — kimi-k2.5 cloud + qwen3 local + local T3, no rescue
  minimal  — kimi-k2.5 cloud + qwen3 local, no T3, no rescue.
             Playbook inheritance alone on the decision path.

This is the honest version of J's "minimal tools still works via
inheritance" hypothesis — with the executor no longer broken at the
tokenizer level, we can actually measure whether playbook retrieval
substitutes for missing overseers.

PLAYBOOK_MEMORY (multi-strategy retrieval):
Zep / Mem0 research shows multi-strategy rerank (semantic + keyword +
graph + temporal) outperforms single-strategy cosine. Lakehouse now
has a two-tier:

  1. Exact (role, city, state) match: skip cosine, assign similarity=1.0,
     take up to top_k/2+1 slots. These are identity-class neighbors —
     the strongest possible signal.
  2. Cosine fallback within the same (city, state) but different role:
     fills remaining slots.

Exposed as compute_boost_for_filtered_with_role(target_geo, target_role).
Backwards-compatible: compute_boost_for_filtered forwards with role=None
so existing callers keep their current behavior.

Service.rs wires both: extract_target_geo and extract_target_role pull
from the executor's SQL filter. grab_eq_value is factored out of
extract_target_geo so both lookups share one parser. Diagnostic log
now prints target_role alongside target_geo for every hybrid_search:

  playbook_boost: boosts=88 sources=39 parsed=39 matched=5
    target_geo=Some(("Nashville", "TN")) target_role=Some("Welder")

Verified: Nashville Welder query returns 5/10 boosted workers in
top_k with clean role+geo provenance.

Research sources: atlan.com Agent Memory Frameworks 2026, Mem0 paper
(arxiv 2504.19413), Zep/Graphiti LongMemEval comparison, ossinsight
Agent Memory Race 2026.

kimi-k2.6 on current key returns 403 — pro-tier upgrade required.
kimi-k2.5 is the substitute today; swap to k2.6 by renaming one line
in applyToolLevel once the subscription lands.
This commit is contained in:
root
2026-04-20 23:20:07 -05:00
parent 5e89407939
commit ad0edbe29c
3 changed files with 133 additions and 58 deletions
+18 -4
View File
@@ -92,6 +92,8 @@ const RETRY_ON_FAIL = process.env.LH_RETRY_ON_FAIL !== "0";
// based on staffer.tool_level before calling anything else.
let ACTIVE_EXECUTOR = EXECUTOR_MODEL;
let ACTIVE_REVIEWER = REVIEWER_MODEL;
let ACTIVE_EXECUTOR_CLOUD = false;
let ACTIVE_REVIEWER_CLOUD = false;
let ACTIVE_T3_DISABLED = T3_DISABLED;
let ACTIVE_OVERVIEW_CLOUD = OVERVIEW_CLOUD;
let ACTIVE_RETRY_ON_FAIL = RETRY_ON_FAIL;
@@ -101,6 +103,8 @@ function applyToolLevel(level: Staffer["tool_level"] | undefined): void {
// don't leak.
ACTIVE_EXECUTOR = EXECUTOR_MODEL;
ACTIVE_REVIEWER = REVIEWER_MODEL;
ACTIVE_EXECUTOR_CLOUD = false;
ACTIVE_REVIEWER_CLOUD = false;
ACTIVE_T3_DISABLED = T3_DISABLED;
ACTIVE_OVERVIEW_CLOUD = OVERVIEW_CLOUD;
ACTIVE_RETRY_ON_FAIL = RETRY_ON_FAIL;
@@ -113,14 +117,22 @@ function applyToolLevel(level: Staffer["tool_level"] | undefined): void {
ACTIVE_OVERVIEW_CLOUD = false;
break;
case "basic":
ACTIVE_EXECUTOR = "qwen2.5:latest";
ACTIVE_REVIEWER = "qwen2.5:latest";
// qwen2.5 collapsed on this workload (0/14 fill). Replace with
// cloud kimi-k2.5 — same family as k2.6 (which requires a paid
// tier), strong at tool calling. kimi-k2.6 is targeted when the
// subscription upgrades.
ACTIVE_EXECUTOR = "kimi-k2.5";
ACTIVE_EXECUTOR_CLOUD = true;
ACTIVE_REVIEWER = "qwen3:latest"; // local reviewer stays cheap
ACTIVE_OVERVIEW_CLOUD = false;
ACTIVE_RETRY_ON_FAIL = false;
break;
case "minimal":
ACTIVE_EXECUTOR = "qwen2.5:latest";
ACTIVE_REVIEWER = "qwen2.5:latest";
// Same executor as basic but strip the overseer + rescue.
// Proves whether playbook inheritance alone carries the load.
ACTIVE_EXECUTOR = "kimi-k2.5";
ACTIVE_EXECUTOR_CLOUD = true;
ACTIVE_REVIEWER = "qwen3:latest";
ACTIVE_T3_DISABLED = true;
ACTIVE_OVERVIEW_CLOUD = false;
ACTIVE_RETRY_ON_FAIL = false;
@@ -514,6 +526,7 @@ async function runAgentFill(
shape: "json",
max_continuations: 3,
think: false,
cloud: ACTIVE_EXECUTOR_CLOUD,
on_continuation: (n, len) =>
append({ turn, role: "executor", model: ACTIVE_EXECUTOR, kind: "note",
content: { continuation: n, combined_chars: len } }),
@@ -577,6 +590,7 @@ async function runAgentFill(
shape: "json",
max_continuations: 3,
think: false,
cloud: ACTIVE_REVIEWER_CLOUD,
on_continuation: (n, len) =>
append({ turn, role: "reviewer", model: ACTIVE_REVIEWER, kind: "note",
content: { continuation: n, combined_chars: len } }),