feat(intake): surface context_loaders.entities core_claim (v0.4.2)#5
Conversation
Activate the previously-inert context_loaders.entities wire. _format_intake_context rendered files but never entities — so KG entities a lens declared never reached the agent's working context. Resolve each workspace-relative entity path, parse its core_claim frontmatter, and emit a one-liner under a new "Knowledge-graph constraints to honor" block. This is the load half of the persona substrate (workspace spec 2026-05-28-persona-substrate-architecture.html, Phase 2 / BRO-1242): persona constraint entities now ride every turn regardless of agent discipline. - _entity_core_claim() helper; never raises (missing/malformed -> bare-path fallback) - _format_intake_context(selection, workspace=None); backward-compatible - 3 new tests; full suite 41 passing - CHANGELOG [0.4.2], lens-schema + README docs Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 19 minutes and 49 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Activates the previously-inert
context_loaders.entitieswire._format_intake_context()renderedcontext_loaders.filesbut nevercontext_loaders.entities— so KG entities a lens declared never reached the agent's working context. The field was validated (REQUIRED_CONTEXT_KEYS) and templated since v0.2.0 but never surfaced.This is the load half of the persona substrate (workspace spec
docs/specs/2026-05-28-persona-substrate-architecture.html, Phase 2 / BRO-1242): persona constraint entities now ride every turn, regardless of agent discipline. Closes the drift failure mode (agent suggesting AWS when the user is Railway-first, etc.).What changed
_confined_entity_path()— resolves a workspace-relative entity path, confined to the workspace (rejects absolute paths,../, and symlink escape viaresolve()+is_relative_to())._entity_core_claim(path)— reads the entity'score_claim, collapsed to a single length-capped line. Never raises (oversized files skipped, non-mapping frontmatter rejected, any error → bare path)._safe_inline()— sanitizes displayed provenance (strips control chars, newlines, brackets; collapses whitespace; caps length) so a crafted entry can't break the[...]wrapper or inject a standalone line.entities: [](byte-identical to v0.4.1); the real hook always passesworkspace.Hybrid load path (spec §6)
The compact
core_claimindex rides every turn;kgloads full entity bodies on demand for depth.Test plan
python3 -m pytest tests/test_role_x.py→ 47 passing (38 prior + 9 new).../+ absolute path confinement, newline + bracket + control-char sanitization.research/entities/persona/set.P20 cross-review (codex / GPT-5, Strata A)
Cross-vendor adversarial review across 3 rounds: 6/10 FAIL → 6/10 FAIL → 7/10 (≥7 threshold met). Every concrete finding resolved:
AttributeError(broke the never-fail invariant); multiline-claim / oversize output corruption; path-read confinement. Fixed.#anchordedup. Fixed (helper split +_safe_inline+ skip-escapes + cleaned-path dedup).Notes
roles/_meta.mdentities:with the persona constraint entities + updates the spec doc. This engine PR is a no-op until then — safe to merge independently.Path.is_relative_to), matching.github/workflows/test.yml.🤖 Generated with Claude Code