Skip to content

feat: L2 event manifest sidecar (FUSION_CODE_L2_MANIFEST=1) - #462

Merged
dahai80 merged 1 commit into
mainfrom
feat/l2-event-manifest
Dec 2, 2026
Merged

dahai80 merged 1 commit into
mainfrom
feat/l2-event-manifest

Conversation

@dahai80

@dahai80 dahai80 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Per-session <session>.events.jsonl sidecar: one bounded record per tool_use / tool_result / assistant text block, schema_version 1
  • Written from the single transcript enqueue choke point (sessionStorage.enqueueWrite) — covers every message path without touching the 12 tool_result emit sites
  • Default off (FUSION_CODE_L2_MANIFEST=1), fire-and-forget, fail-open: the transcript write path is byte-identical when the flag is unset
  • Design ref: Folio (arXiv 2611.16627) L1/L2/L3 layering — the transcript is L3; this is the L2 runtime view for programmatic context folding and StopLoss-style monitors (fusion-code#449), shared-shape candidate with fusion-memory's three-tier scheduling

Validation

  • 3 new unit tests (5x repeat: stable), full suite 1912 tests 0 fail, typecheck + lint + docs validator ERROR 0

🤖 Generated with Claude Code

Folio-style L2 layer (papers-scan 2026-12-02 §4): per-session
<session>.events.jsonl with one bounded record per tool_use /
tool_result / assistant text block, written from the single transcript
enqueue choke point. Programmatic context folding and StopLoss-style
monitors can consume this without parsing multi-GB session files.

- Default off, fail-open, fire-and-forget: never blocks or fails the
  transcript write path
- 200-char digests only — no full bodies, no new PII surface
- 3 unit tests (enabled path, disabled path, default-off)

Co-Authored-By: Claude Code <[email protected]>
@dahai80
dahai80 merged commit a110c2f into main Dec 2, 2026
1 check passed
dahai80 added a commit that referenced this pull request Dec 2, 2026
stoploss_lib now prefers a Folio-style L2 manifest
(fusion-code-events.jsonl, #462) over stream-json when both exist:
_is_l2_manifest detects the record shape, l2_to_events adapts bounded
digests into pseudo stream events (digest-based repeat_identical
fingerprints), resolve_feature_source picks the source. The external
adapter copies the run's newest matching L2 sidecar from
~/.fusion-code/projects into logs_dir so the dataset builder sees it.

Validated on the S1 trial fix-git__CzCsxVs: L2-derived and
stream-derived features agree on all six values (turns=11,
no_edit_streak=11, seconds_per_turn=88.87); stream-json stays as
fallback for pre-#462 runs.

Refs #449

Co-authored-by: Claude Code <[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