refactor(preamble): G1 renders graft INDEX only — workers fetch on demand (closes #71 PR3)#73
Merged
Merged
Conversation
This was referenced May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final PR (3 of 3) closing #71. Depends on:
Summary
G1's preamble loader no longer inlines graft bodies. Each grafted-context becomes a single index line:
- `graft_id` · source · `path` — abstract(first 120 chars of content). Worker fetches full bodies on demand via thegrafted_context_fetch(graft_id)MCP tool added in PR2.Loader explicitly teaches the worker the idiom in the preamble itself:
Per-turn cost reduction
Old caps removed:
_PER_GRAFT_CONTENT_CHARS=2048and_MAX_GRAFTS_RENDERED=8are deleted (no longer meaningful — content isn't in the preamble at all). New cap:_ABSTRACT_CHARS=120per graft._MAX_TOTAL_PREAMBLE_CHARS=32768remains as a safety net.What stays inlined
Test plan
tests/plugins/devagentic-vertical-preamble/test_preamble.pycover: no-user_id gate, default-profile gate, empty-rollup gate, NEW: index-not-full-body assertion (poly-explorer-scale fixture with 7KB content body verifies full body NOT inlined, only abstract), NEW: 70-graft all-indexed assertion, NEW: abstract-truncated-to-120-chars assertion, load-once gate, fetch exception, resolve_user_id exception, client env override, client empty-user_id guard.test_grafted_context_fetch.pyfrom PR2,test_client.pyfrom G4): no regression.Polynomial-explorer end-to-end after deploy
grafted_context_fetch("doc-graft-...")— one or two at a time.Empty-content failure (the symptom that surfaced #71) should resolve organically — model no longer overwhelmed by tools+preamble+grafts. PR #69's synthetic recovery remains as a safety net for any residual failures.
Notes
verticalContext).- `<id>` · <source> · `<path>` — <abstract>. Workers can grep the preamble for source/path keywords to find candidate grafts.