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-savingsMAKA_CONTEXT_STALE_TOOL_RESULT_PRUNE — in scope for token-savingsMAKA_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_COMPACTMAKA_CONTEXT_SEMANTIC_COMPACT
Mechanisms toggleable via Harbor profile env but not arm-local contextEnv (because runtime-policy-ab-run only whitelists MAKA_CONTEXT_*):
Mechanisms not toggleable via Harbor env at all:
- Synthesis cache —
ContextBudgetPolicy.synthesisCache has no Harbor switch. Desktop uses it, but headless lacks loadSynthesisCache / writeSynthesisCache callbacks and artifact lifecycle wiring. - History search —
RuntimeEventHistorySearchPolicy 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:
| Mechanism | Current Harbor support | In scope for token-savings benchmark? | Notes |
|---|
| Active tool-result prune | MAKA_CONTEXT_ACTIVE_TOOL_RESULT_PRUNE | yes | Already validated in PR #340 |
| Stale tool-result prune | MAKA_CONTEXT_STALE_TOOL_RESULT_PRUNE | yes | Same logic as active, but for prior turns |
| Archive retrieval (post-prune hydration) | MAKA_CONTEXT_ARCHIVE_RETRIEVAL | yes | Runtime-side hydration only; model cannot actively retrieve. Depends on MAKA_CONTEXT_TOOL_RESULT_ARCHIVE_DIR |
| Economy-task prompt policy | MAKA_ECONOMY_TASK_MODE | maybe | Profile-env toggleable, not arm-local contextEnv; may need framework extension |
| Tool availability / schema economy | no Harbor env | needs design | Headless always uses economy mode; needs explicit switch |
| Synthesis cache | desktop env exists, Harbor wiring missing | needs separate slice | Needs loadSynthesisCache / writeSynthesisCache callbacks + artifact lifecycle, not just env parsing |
| History search | desktop env exists, Harbor wiring missing | needs design | Gates archive_retrieval history_search_gated mode; adds retrieved-history tokens |
| Active full compact / semantic compact | MAKA_CONTEXT_ACTIVE_FULL_COMPACT, MAKA_CONTEXT_SEMANTIC_COMPACT | no | Capacity mechanisms; toggleable today but out of scope for first token-savings slice |
| History compact | desktop env only, not in Harbor env keys | no | Desktop-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
Background
PR #340 (
feat(headless): validate active-prune 2048) established A/B testing foractive tool pruneon Terminal Bench and reported:This showed the in-repo
runtime-policy-ab-runframework 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-savingsMAKA_CONTEXT_STALE_TOOL_RESULT_PRUNE— in scope for token-savingsMAKA_CONTEXT_ARCHIVE_RETRIEVAL— in scope for token-savings (post-prune hydration)Mechanisms toggleable via Harbor arm-local
contextEnvbut out of scope for first token-savings slice (capacity mechanisms):MAKA_CONTEXT_ACTIVE_FULL_COMPACTMAKA_CONTEXT_SEMANTIC_COMPACTMechanisms toggleable via Harbor profile env but not arm-local
contextEnv(becauseruntime-policy-ab-runonly whitelistsMAKA_CONTEXT_*):MAKA_ECONOMY_TASK_MODEMechanisms not toggleable via Harbor env at all:
ContextBudgetPolicy.synthesisCachehas no Harbor switch. Desktop uses it, but headless lacksloadSynthesisCache/writeSynthesisCachecallbacks and artifact lifecycle wiring.RuntimeEventHistorySearchPolicyis desktop-only; not inHARBOR_CELL_CONTEXT_ENV_KEYS.buildIsolatedHeadlessToolAvailability(). There is noMAKA_CONTEXT_TOOL_AVAILABILITYor 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:
MAKA_CONTEXT_ACTIVE_TOOL_RESULT_PRUNEMAKA_CONTEXT_STALE_TOOL_RESULT_PRUNEMAKA_CONTEXT_ARCHIVE_RETRIEVALMAKA_CONTEXT_TOOL_RESULT_ARCHIVE_DIRMAKA_ECONOMY_TASK_MODEcontextEnv; may need framework extensionloadSynthesisCache/writeSynthesisCachecallbacks + artifact lifecycle, not just env parsingarchive_retrievalhistory_search_gated mode; adds retrieved-history tokensMAKA_CONTEXT_ACTIVE_FULL_COMPACT,MAKA_CONTEXT_SEMANTIC_COMPACTPhase 2: Expose or verify toggles
For mechanisms already wired (active prune, stale prune, archive retrieval), verify they work through
runtime-policy-ab-runand produce diagnostics.For
economy task mode, decide whetherruntime-policy-ab-runneeds a broader arm-local env allowlist beyondMAKA_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:
maka-cell-output.jsonPhase 4: Living doc (after first verified result)
Once we have at least one new mechanism validated, create
docs/economic-mechanisms-benchmark.mdwith:What this issue does NOT cover
Related
feat(headless): validate active-prune 2048(active tool prune A/B baseline)runtime-policy-ab-run.tsinfrastructureterminal-bench-sample-runs.jsonprofile definitions