Repo docs

Per-repo documentation — each repo's docs/ and README, ingested and associated with the repo. Rendered through the <<<RepoDocs>>> tag.

← code__big-jazz-2nd__big-jazz docs · packages/git_surface/README.md

git-surface — agent-ergonomic git wrapper, evolved

A real meta-evolutionary tournament that evolves an MCP-style git-surface wrapper toward minimal-friction, token-efficient, self-correcting tools for LLM agents.

Files

- gen1.py — the seed: three tools (surface / atomic-read / blame) + the first real tournament (naive vs evolved) scored on deterministic fitness. python3 gen1.py. - evolve_step.pyone generation per invocation (a stateless ratchet): mutate the baseline (epoch-gated vectors) → evaluate the population on deterministic fitness + a live qwen friction judge → elitist k-tournament select → persist. Bounded at gen 1000. - run/state.json — current generation + baseline genome. - run/generations.jsonl — append-only log, one line per generation (the real fitness curve). - run/cron.log — stdout of the scheduled runs.

The scheduled run (live)

Installed on system crontab, every 5 minutes:

*/5 * * * * PATH=/opt/homebrew/bin:/usr/bin:/bin /opt/homebrew/bin/python3 \
  .../git_surface/evolve_step.py >> .../git_surface/run/cron.log 2>&1 # git-surface-evolve

Kill switch: crontab -l | grep -v git-surface-evolve | crontab -

The qwen friction judge

Real, local, free: qwen/qwen3-coder-30b via LM Studio's OpenAI server at http://localhost:1234/v1 (started with lms server start). Each generation asks qwen to rate how low-friction a genome's tool responses are (0..1). If LM Studio's server stops, the friction term degrades to a neutral 0.5 (friction_src=qwen_unavailable) and evolution continues on deterministic fitness — the cron never dies. Re-enable real scores with lms server start.

Epoch schedule (per the roadmap)

- 1–150 structural — surface/read/error correctness. Converges fast to fitness ≈ 2.34 (structured surface + ranged read + fuzzy self-heal), then holds (elitism = no regression). - 151–450 ergonomic — unlocks serialize (compact) + token_min heuristics. - 451–750 adversarial / 751–1000 convergence — all vectors active. (Note: at the 5-min cadence, the ergonomic epoch unlocks ~gen 151 ≈ 12h in. To see gains sooner, shrink the epoch bounds in epoch_axes() or lower the cron interval floor.)

Watch it

tail -f run/generations.jsonl        # live fitness curve
python3 -c "import json;[print(json.loads(l)['gen'],json.loads(l)['fitness']) for l in open('run/generations.jsonl')]"

Telemetry: component git-surface-evolve in ~/code/forge/telemetry.db.

Update — red-teamed + condensed (authorized)

- Fitness hardened (score_responses, v2). redteam.py proved the original substring correctness was gameable: a cheater emitting only the magic words scored 1.977 vs the honest 1.932 by farming the token-thrift term. v2 requires the read to contain the actual file lines verbatim + the surface to reflect real git state → cheater collapses to 1.477, honest holds 1.932 (defended by 0.455). Run python3 redteam.py to re-verify. - Intervals condensed. Cron cadence */5* * * * * (1 min); epoch bounds condensed to 20 / 60 / 120 (env GS_EP_STRUCT|ERGO|ADV), so all four epochs are traversed in ~2h. The run was reset under v2 (old data archived as run/generations_v1_gameable.jsonl). - Finding. On the Level-1 fixture the ergonomic epoch's token-min/serialize genes are neutral — the honest optimum is already ~85 tokens, below the fitness resolution. Real ergonomic gains need a larger fixture (the roadmap's Level-2 monorepo). Next: scale the fixture, and/or enrich the genome (more axes) so 1000 generations has somewhere to go.

Update 2 — enriched (v3, autonomous)

- Genome enriched: 5 axes / ≤3 alleles = 108 genomes, and alleles unlock by epoch (structural exposes basics; ergonomic+ unlocks summary surface, ranged_hdr, compact, cap_ctx, ranked errors). - Fixture level grows with the epoch: L1 clean (structural) → L2 big-file + many-changed (ergonomic+), so the optimum shifts at gen 21 and evolution re-adapts — real dynamics instead of a 3-generation plateau. Verified: fitness 1.903 → 1.960, surface → summary. - Fitness normalised to correctness + efficiency (+0.5·friction), multi-scenario (small read / big read / missing / surface). Still ground-truth — redteam.py re-confirms the cheater is defeated (honest 1.552 vs cheater 1.346). - Open: qwen friction is slightly noisy → memoize per-genome (elitism can wobble ±0.05); L3 chaos + L4 history-churn fixtures are the next levels; genome can grow (paging/blame/stream).