maceip/primemeth

Mutating and Evaluating Trajectory Harnesses: a coding agent that remembers its failures, budgets its moves, compiles its own tools mid-session, and rewrites its own harness overnight. self-improving without the psychosis.

TypeScript

1

4,531 commits

updated Sep 16, 2026

See the code

README

PRIME METH

prime meth — the mutating evolutionary trajectory harness. a coding agent that runs qwen3.8-flash-next locally on apple silicon with the model's native multi-token prediction, wrapped in a harness that learns from its own trajectories and improves itself from execution traces.

the model: qwen3.8-flash-next

qwen3.8-flash-next is a multimodal moe and an early preview of the qwen4 architecture, now open-weight: 125b parameters + 51b n-gram embeddings, with just 6b activated per token. unmatched cost-efficiency.

what prime meth does with it:

  • native multi-token prediction (mtp): the model drafts ~4 tokens per step; drafted tokens are verified exactly, so output is token-for-token identical to one-at-a-time decoding — just faster. the runtime snapshots and restores the gated deltanet recurrent state when a draft is rejected, which ordinary kv-cache trimming cannot do. this is the piece other apple-silicon runtimes don't have.
  • large context, fast by design: qwen sparse attention is evaluated to 1m tokens and beats full attention past 512k (ruler 93.0 vs 90.1, tech report p8); kernel-level speedups reach 7.6x prefill and 4.9x decode at 1m context, with gains starting near 64k (p9). native context is 262,144 tokens; a one-line config switch applies the documented rope-scaling recipe for the 1m window.
  • a budget system that prices the model's cost curve: past 64k of context, long-context work gets cheaper on this architecture — and the harness's tool-call and token budgets schedule it that way.
  • on-device 4-bit mlx quantization that keeps the mtp tensors and vision tower — the parts stock converters drop, and the reason native mtp is possible here at all.
  • runs on a mac: one command pulls the weights, one command serves them behind an openai-compatible endpoint, one command benchmarks.

measured prefill and decode tokens/sec across the 4k → 1m context ladder, mtp on and off, land here as they are produced.

the harness: evolutionary additions to prime agent

built on a vendored prime agent workspace — an rlm-native terminal coding and research harness — with four research systems integrated behind one typescript extension and one python cli (the cli is called synth):

  • reasoningbank — "a memory mechanism for agents that learns from both successful and failed trajectories, with reasoning stored as memory content." lessons distilled from one session are retrieved into the next.
  • budget-aware tool-use (bats) — "budget tracker augments a react agent with continuous awareness of its remaining tool-call budget; bats adds budget-aware planning, self-verification, and re-planning on verification failure." budgets are visible in the transcript and enforced.
  • autosaddler — "automatically improves llm-agent harnesses by diagnosing execution traces, applying structured updates to prompts, tools, and middleware, and selecting changes that generalize." accepted changes land as durable commits behind a disjoint development gate.
  • a dynamic skill compiler — recurring workflows become skill packages that must pass a deterministic gate (lint, tests in an ephemeral venv, static safety checks) before promotion, with per-session caps, a kill switch, and an audit log.

the full loop runs end to end (scripts/synth-demo.sh): a lesson distilled from a failure is retrieved in the next session; budgets are visible and enforced; the verifier pivots a failing attempt; the optimizer lands a gated commit; a compiled skill is promoted and invoked.

setup: scripts/setup-offline.sh · docs: docs/synth/ · decisions journal: DECISIONS.md

meth

Contributors

(top 30 of 216)

badlogic

3,071 commits

kevinjosethomas

327 commits

snimu

107 commits

maceip/primemeth

Mutating and Evaluating Trajectory Harnesses: a coding agent that remembers its failures, budgets its moves, compiles its own tools mid-session, and rewrites its own harness overnight. self-improving without the psychosis.

TypeScript

1

4,531 commits

updated Sep 16, 2026

See the code

README

PRIME METH

prime meth — the mutating evolutionary trajectory harness. a coding agent that runs qwen3.8-flash-next locally on apple silicon with the model's native multi-token prediction, wrapped in a harness that learns from its own trajectories and improves itself from execution traces.

the model: qwen3.8-flash-next

qwen3.8-flash-next is a multimodal moe and an early preview of the qwen4 architecture, now open-weight: 125b parameters + 51b n-gram embeddings, with just 6b activated per token. unmatched cost-efficiency.

what prime meth does with it:

  • native multi-token prediction (mtp): the model drafts ~4 tokens per step; drafted tokens are verified exactly, so output is token-for-token identical to one-at-a-time decoding — just faster. the runtime snapshots and restores the gated deltanet recurrent state when a draft is rejected, which ordinary kv-cache trimming cannot do. this is the piece other apple-silicon runtimes don't have.
  • large context, fast by design: qwen sparse attention is evaluated to 1m tokens and beats full attention past 512k (ruler 93.0 vs 90.1, tech report p8); kernel-level speedups reach 7.6x prefill and 4.9x decode at 1m context, with gains starting near 64k (p9). native context is 262,144 tokens; a one-line config switch applies the documented rope-scaling recipe for the 1m window.
  • a budget system that prices the model's cost curve: past 64k of context, long-context work gets cheaper on this architecture — and the harness's tool-call and token budgets schedule it that way.
  • on-device 4-bit mlx quantization that keeps the mtp tensors and vision tower — the parts stock converters drop, and the reason native mtp is possible here at all.
  • runs on a mac: one command pulls the weights, one command serves them behind an openai-compatible endpoint, one command benchmarks.

measured prefill and decode tokens/sec across the 4k → 1m context ladder, mtp on and off, land here as they are produced.

the harness: evolutionary additions to prime agent

built on a vendored prime agent workspace — an rlm-native terminal coding and research harness — with four research systems integrated behind one typescript extension and one python cli (the cli is called synth):

  • reasoningbank — "a memory mechanism for agents that learns from both successful and failed trajectories, with reasoning stored as memory content." lessons distilled from one session are retrieved into the next.
  • budget-aware tool-use (bats) — "budget tracker augments a react agent with continuous awareness of its remaining tool-call budget; bats adds budget-aware planning, self-verification, and re-planning on verification failure." budgets are visible in the transcript and enforced.
  • autosaddler — "automatically improves llm-agent harnesses by diagnosing execution traces, applying structured updates to prompts, tools, and middleware, and selecting changes that generalize." accepted changes land as durable commits behind a disjoint development gate.
  • a dynamic skill compiler — recurring workflows become skill packages that must pass a deterministic gate (lint, tests in an ephemeral venv, static safety checks) before promotion, with per-session caps, a kill switch, and an audit log.

the full loop runs end to end (scripts/synth-demo.sh): a lesson distilled from a failure is retrieved in the next session; budgets are visible and enforced; the verifier pivots a failing attempt; the optimizer lands a gated commit; a compiled skill is promoted and invoked.

setup: scripts/setup-offline.sh · docs: docs/synth/ · decisions journal: DECISIONS.md

meth

Contributors

(top 30 of 216)

badlogic

3,071 commits

kevinjosethomas

327 commits

snimu

107 commits

Languages

TypeScript

90.0%

Python

7.2%

JavaScript

1.6%

Shell

1.0%