Skip to content

feat(benchmark): extend economic mechanism A/B testing beyond PR #340 active tool prune #481

Description

@Astro-Han

Background

PR #340 (feat(headless): validate active-prune 2048) established A/B testing for active tool prune on Terminal Bench and reported:

  • Token: -41.7%
  • Cost: -31.6%
  • Performance: +2.48pp

This showed the in-repo runtime-policy-ab-run framework can isolate a single mechanism's economic effect.

Goal

Extend that methodology to the remaining economic mechanisms, starting with an inventory of what is toggleable today and what needs wiring.

Current gaps / questions

1. Mechanism inventory is unclear

We need a single reference table that lists every cost-relevant mechanism, its current Harbor env support, and whether it is in scope for the first token-savings benchmark.

2. Some mechanisms are not toggleable for A/B

Mechanisms confirmed toggleable via Harbor arm-local contextEnv (MAKA_CONTEXT_*):

  • MAKA_CONTEXT_ACTIVE_TOOL_RESULT_PRUNE — in scope for token-savings
  • MAKA_CONTEXT_STALE_TOOL_RESULT_PRUNE — in scope for token-savings
  • MAKA_CONTEXT_ARCHIVE_RETRIEVAL — in scope for token-savings (post-prune hydration)

Mechanisms toggleable via Harbor arm-local contextEnv but out of scope for first token-savings slice (capacity mechanisms):

  • MAKA_CONTEXT_ACTIVE_FULL_COMPACT
  • MAKA_CONTEXT_SEMANTIC_COMPACT

Mechanisms toggleable via Harbor profile env but not arm-local contextEnv (because runtime-policy-ab-run only whitelists MAKA_CONTEXT_*):

  • MAKA_ECONOMY_TASK_MODE

Mechanisms not toggleable via Harbor env at all:

  • Synthesis cacheContextBudgetPolicy.synthesisCache has no Harbor switch. Desktop uses it, but headless lacks loadSynthesisCache / writeSynthesisCache callbacks and artifact lifecycle wiring.
  • History searchRuntimeEventHistorySearchPolicy is desktop-only; not in HARBOR_CELL_CONTEXT_ENV_KEYS.
  • Tool availability — Headless currently always uses economy mode via buildIsolatedHeadlessToolAvailability(). There is no MAKA_CONTEXT_TOOL_AVAILABILITY or similar env override.

3. No living benchmark doc

Results are scattered (Twitter threads, private runs). There is no in-repo reference showing mechanism X on dataset Y saves Z% tokens at cost W% with pass rate change V.

Proposed scope — first slice

Phase 1: Mechanism inventory + toggle feasibility

Create a reference table in this issue (or a linked doc) covering:

MechanismCurrent Harbor supportIn scope for token-savings benchmark?Notes
Active tool-result pruneMAKA_CONTEXT_ACTIVE_TOOL_RESULT_PRUNEyesAlready validated in PR #340
Stale tool-result pruneMAKA_CONTEXT_STALE_TOOL_RESULT_PRUNEyesSame logic as active, but for prior turns
Archive retrieval (post-prune hydration)MAKA_CONTEXT_ARCHIVE_RETRIEVALyesRuntime-side hydration only; model cannot actively retrieve. Depends on MAKA_CONTEXT_TOOL_RESULT_ARCHIVE_DIR
Economy-task prompt policyMAKA_ECONOMY_TASK_MODEmaybeProfile-env toggleable, not arm-local contextEnv; may need framework extension
Tool availability / schema economyno Harbor envneeds designHeadless always uses economy mode; needs explicit switch
Synthesis cachedesktop env exists, Harbor wiring missingneeds separate sliceNeeds loadSynthesisCache / writeSynthesisCache callbacks + artifact lifecycle, not just env parsing
History searchdesktop env exists, Harbor wiring missingneeds designGates archive_retrieval history_search_gated mode; adds retrieved-history tokens
Active full compact / semantic compactMAKA_CONTEXT_ACTIVE_FULL_COMPACT, MAKA_CONTEXT_SEMANTIC_COMPACTnoCapacity mechanisms; toggleable today but out of scope for first token-savings slice
History compactdesktop env only, not in Harbor env keysnoDesktop-only, like synthesis cache

Phase 2: Expose or verify toggles

For mechanisms already wired (active prune, stale prune, archive retrieval), verify they work through runtime-policy-ab-run and produce diagnostics.

For economy task mode, decide whether runtime-policy-ab-run needs a broader arm-local env allowlist beyond MAKA_CONTEXT_*.

For synthesis cache and tool availability, scope the engineering work in follow-up comments or child issues before env parsing.

Phase 3: Run a smoke benchmark

Before any 30-task or 121-task run, do a single-task smoke run that proves:

  • the mechanism activated (visible in diagnostics or output artifacts)
  • the baseline and arm configs are actually different
  • metrics are extractable from maka-cell-output.json

Phase 4: Living doc (after first verified result)

Once we have at least one new mechanism validated, create docs/economic-mechanisms-benchmark.md with:

  • test date, sample size, model, arm env
  • baseline vs arm metrics table (input tokens, cache read/miss, output tokens, cost, pass rate, steps)
  • interpretation and raw data link

What this issue does NOT cover

  • Changing mechanism behavior (measurement only)
  • Renaming existing env vars
  • Testing capacity mechanisms (active full compact, semantic compact, history compact) for token savings
  • 121-task full matrix or leave-one-out (those come after Phase 1 inventory is settled)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions