Skip to content

chore - add codex resource context injection - #195

Merged
dpuglielli merged 2 commits into
mainfrom
chore/mantra-codex-resource-context
Oct 9, 2026
Merged

dpuglielli merged 2 commits into
mainfrom
chore/mantra-codex-resource-context

Conversation

@dpuglielli

Copy link
Copy Markdown
Collaborator

MANTRA_RESOURCES=inject now adds resource observations to Codex model context. The former display value is removed without an alias. Explicitly configured hooks inject startup guidance and fresh observations on UserPromptSubmit/PostToolUse; other events collect passively. PreToolUse stays passive to avoid two observation blocks per tool call. Mantra is bumped to 0.10.0.

The separate harness commit adds --codex-version (default remains 0.147.0) and opt-in --codex-trust-hooks, with tests for version selection, isolation and canonical workspace trust. Documentation warns that trusted repository hooks run outside Codex’s sandbox and records observed token-count lag.

Validation

  • Full npm test: 724 tests across 24 suites passed; Mantra 77 and scripts 104 passed.
  • Repository metadata validator, Claude 2.1.226 strict marketplace/Mantra validators, isolated Codex 0.147.0 plugin installation and diff checks passed.
  • Live Codex 0.161.0 probe quoted injected resource text before and after one shell command. Three turns in one session verified catch-up: turn 1 was unknown; turn 2 quoted input=30972/output=392/cached=27520; turn 3 quoted input=64738/output=1158/cached=55296/reasoning=22. Every category matched the preceding-turn snapshot and latest preceding rollout usage. Refreshed post-tool lines retained those totals because the next usage row followed the hook. Claude lag reflects the operator’s existing observation; no new Claude live probe was run.

Contract and limits

The context output shape and event support were verified against the official hooks docs and Codex 0.161.0 schema. Hook trust and outside-sandbox execution were checked against the versioned configuration loader and command runner.

This remains an opt-in pilot: injected text has an input cost, no behavioral benefit has been established, and transcript-derived counts can lag or become unknown. Live verification is specific to Codex 0.161.0 on macOS. Historical research/review records remain unchanged.

@dpuglielli
dpuglielli merged commit 0d39212 into main Oct 9, 2026
2 checks passed
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