Skip to content

feat: add /health command for MemFS system memory token audit#1060

Open
kl2806 wants to merge 5 commits intomainfrom
feat-health-command
Open

feat: add /health command for MemFS system memory token audit#1060
kl2806 wants to merge 5 commits intomainfrom
feat-health-command

Conversation

@kl2806
Copy link
Contributor

@kl2806 kl2806 commented Feb 20, 2026

Summary

  • Adds a new /health command that scans system/ memory files and estimates their token footprint
  • Uses the 4 bytes/token approximation (same heuristic as Codex)
  • Automatically injects a <system-reminder> warning into the agent if system memory exceeds 25% of the context window, prompting it to trim

Test plan

  • Run /health with memfs enabled — should show per-file token table and total with color-coded percentage
  • Run /health with memfs disabled — should show a message to enable memfs first
  • With a large system/ directory (>25% of context window), verify the system reminder is injected and the agent responds to trim
  • Run with empty system/ dir — should show "No system/ memory files found"

👾 Generated with Letta Code

kl2806 and others added 5 commits February 20, 2026 10:54
👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>
Estimates token usage of system/ files (4 bytes/token heuristic from Codex)
and injects a <system-reminder> warning if usage exceeds 25% of the context window.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>
…call

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>
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