Skip to content

feat: content-specific extract-code + marker_mode + live examples - #7

Merged
OsherElhadad merged 4 commits into
mainfrom
feat/llm-components
Jul 13, 2026
Merged

OsherElhadad merged 4 commits into
mainfrom
feat/llm-components

Conversation

@OsherElhadad

Copy link
Copy Markdown
Collaborator

Summary

Builds on the merged LLM-components work (PR #6) with three things:

  1. marker_mode + cg_skeleton (reviewed for AuthBridge) — a per-offload reversibility knob
    (full|summary|off) so an in-process host (AuthBridge) can compact without the expand-stash,
    plus a cg_skeleton build tag that keeps the default build pure-Go (CGO_ENABLED=0). Reviewed
    against docs/HANDOVER-context-guru-marker-mode.md; all checklist items hold; added
    TestMarkerModeSummarySurvivesWire for the flagged ⟪cg⟫-over-the-wire risk.

  2. extract-code: content-specific deletion codegen (the main fix) — extract-code used to write
    blind generic filters because the prompt showed the model only a 1.5k-char sample (on a pytest
    log it reduced ~1.3%). Now the model sees the full output and writes code specific to it:

    • full content in the prompt (bounded ~32k chars; head+tail beyond),
    • regex helpers in the sandbox (re_sub/re_findall/re_split/re_match, RE2, pure-Go),
    • containment generalized to a character subsequence (deletion-only): it can trim
      words/sentences/parts within a line, but provably cannot fabricate, reorder, or reword —
      the "never corrupts data" guarantee holds.
    • opt-in rewrite: true drops containment for free rewrite (lossy, unverified; pair with a
      non-full marker_mode).
  3. Reproducible live examples — CG_LIVE-gated tests that drive the real model (skipped in CI).

Validation

  • CGO_ENABLED=0 go build/test/vet ./... green (pure-Go default); -tags cg_skeleton build + tests green.
  • Live model: pytest log 3487 → 157 tokens (~95%) with a content-specific filter (was 1.3%), JSON ~90%, both containment-verified.
  • Real SWE-bench (eval-containers, claude-sonnet-4-6):
    • sympy-20438 (reward 0): default deletion-only 67.7% content-token savings; rewrite:true+marker_mode:summary 64.5% — both reward-preserved.
    • sphinx-9320 & sympy-13647 (reward 1) stay reward 1 with the new codegen — no regression.

Osher-Elhadad added 4 commits July 13, 2026 12:03
…+ summarize

Split runStarlark into generate + execStarlark so an example can run the exact
Starlark source the model wrote (deterministic, no behavior change). Add CG_LIVE-
gated tests that drive the real incoming model on realistic tool output:
- extract-code on JSON search hits (22 recs/576 tok -> 2 recs/55 tok, ~90%,
  containment-validated) and on a raw-text pytest log (line-subsequence path).
- summarize compressing a mid-trajectory span into one grounded summary.
Skipped unless CG_LIVE=1 (+ CG_BASE/CG_TOKEN), so CI and normal test runs are
unaffected and no API calls are made.

Assisted-By: Claude <[email protected]>
Signed-off-by: Osher-Elhadad <[email protected]>
…on build

Reviewed + verified the marker_mode / cg_skeleton work for the AuthBridge
integration (see docs/HANDOVER-context-guru-marker-mode.md).

- marker_mode (full|summary|off) per offload component: full stashes + leaves a
  resolvable <<cg:HASH>> marker; summary leaves a non-resolvable ⟪cg⟫ sentinel, no
  stash; off leaves nothing. summary/off set Report.Irreversible so the pipeline's
  dropped-without-stash guard permits the deliberate lossy drop (it still reverts a
  full-mode component that forgets to stash).
- components/offload/marker.go centralizes the three modes (mark()); cmdfilter
  inlines them for its pre-commit never-worse check. expand.HasPlaceholder matches
  both marker kinds for cross-turn skip-detection.
- cg_skeleton build tag isolates skeleton + internal/treesitter so the DEFAULT
  build is pure-Go (CGO_ENABLED=0), as AuthBridge requires; opt in with -tags
  cg_skeleton (+cgo).
- Added TestMarkerModeSummarySurvivesWire (⟪cg⟫ survives the JSON wire round-trip
  through apply.Body — HANDOVER review item 5). Build/test/vet green for both the
  pure-Go default and the cg_skeleton opt-in.

Assisted-By: Claude <[email protected]>
Signed-off-by: Osher-Elhadad <[email protected]>
…=code

extract-code wrote blind generic filters because the prompt showed the model only
a 1500-char sample; on a raw-text pytest log it reduced ~1.3%. Now the model sees
the full output and writes code specific to it.

- Prompt shows the FULL tool output (bounded ~32k chars; head+tail beyond) so the
  model targets the actual noise. New deletion-only contract + examples.
- Regex helpers in the sandbox (re_sub/re_findall/re_split/re_match, RE2, pure-Go)
  so it can trim words/sentences/parts within lines, not just whole lines.
- Containment generalized to a character subsequence (isCharSubsequence): the
  result must be obtainable by DELETING characters — trims anything, provably
  cannot fabricate, reorder, or reword. Keeps the "never corrupts data" guarantee.
- Opt-in rewrite:true drops containment for free rewrite (lossy, unverified — pair
  with a non-full marker_mode); default false stays verified deletion-only.
- Split runStarlark into generate + execStarlark so examples run the exact source.
- Tests: char-subsequence accept/reject, regex builtins + fail-open, rewrite skips
  containment; live CG_LIVE examples (pytest 3487->157 tokens ~95%, JSON ~90%).
  Docs: components.md + RESULTS.md.

Assisted-By: Claude <[email protected]>
Signed-off-by: Osher-Elhadad <[email protected]>
The inbound marker_mode handover has been reviewed and acted on; the current
state is documented in docs/{components,RESULTS}.md, and a fresh outbound
handover for the AuthBridge track lives outside the repo.

Assisted-By: Claude <[email protected]>
Signed-off-by: Osher-Elhadad <[email protected]>
@OsherElhadad
OsherElhadad merged commit b624f2c into main Jul 13, 2026
3 checks passed
boazdavid added a commit that referenced this pull request Nov 3, 2026
The proxy path disagreed with 3 of accountant's shared cases, and the test
allowed it. AccountantFigure left every break with no ChangeID out of the net,
but a break an ended change leaves behind is part of the bill difference. It
also dropped an unpriced setting, so its break had no owner.

accountant now marks a break the client body has too (InBaseline). A break with
no ChangeID that is not InBaseline is counted as EndedBreakUSD, in DeltaUSD and
in no component. An unpriced op still owns its break.

TestProxyPathMatchesTheAccountantCases now allows no difference: all 66 cases
match. The accountant pin moves to accountant PR #7.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: DAVID BOAZ <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant