Skip to content

chore - add automatic resource-aware reflection - #196

Merged
dpuglielli merged 1 commit into
mainfrom
chore/mantra-resource-reflection
Oct 9, 2026
Merged

dpuglielli merged 1 commit into
mainfrom
chore/mantra-resource-reflection

Conversation

@dpuglielli

Copy link
Copy Markdown
Collaborator

Summary

Mantra previously required resource environment variables and separately configured hooks. It now registers resource observations automatically on Claude Code and Codex, and reminds the model to reconsider the requested outcome, progress and uncertainty when choosing to continue, change approach or finish.

Startup/clear previews later reflection. Prompts, resume and compaction deliver self-contained guidance; tool completion adds reflection about every five minutes. Prompts/session starts reset the cadence, subagent receipts are excluded, and Stop remains passive. Immutable claims prevent duplicate reminders under concurrent completion; cadence-storage failures preserve resource context. Mantra is bumped to 0.11.0.

Repository CI and probes use the installed Codex and report its actual version, without a package-version selector. Documentation and archived synthetic evidence describe the final behavior and its limits.

Test Plan

  • npm test: 650 tests in 25 suites, including 89 Mantra tests and deterministic concurrency/fault regressions.
  • npm run validate:plugins, strict Claude marketplace/Mantra validation, installed Codex isolated installation, and git diff --check: passed.
  • Live Claude and Codex delivery checks passed before the cadence repair; the repaired cadence has deterministic process/fault-injection coverage. Gus reviewed the always-on implementation; Trey independently reproduced the lock race and approved its repair.

Limitations

No demonstrated judgment improvement, causal resource savings or minimum model/effort. The paired clarification case remained unresolved in both arms; the final cadence has delivery evidence rather than a new behavioral comparison. Five minutes is provisional, not a task deadline or stopping quota.

Token observations are cumulative, partial and potentially delayed; transcripts over 2 MiB yield unknown token values. Pre/post collection measured about 95–110 ms per tool locally, and per-tool observation text accumulates in history. Periodic claims require hard-link support, and a crash after publication can omit one reminder. See docs/reviews/mantra-resource-reflection.md and mantra/context/resources.md for evidence and the current contract.

Register resource observations on both hosts and add five-minute tool-completion
reflection with immutable concurrent claims. Preserve measurement coverage and
lag, document costs and evidence limits, and use the installed Codex in tooling.
@dpuglielli
dpuglielli merged commit 008133c 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