Remove Context Utilization State - slash commands rely on sanitized terminal output

This commit is contained in:
Levi Neely 2026-02-15 21:27:52 +01:00
parent 24f88f5957
commit e7145ae663
1 changed files with 0 additions and 45 deletions

View File

@ -361,48 +361,3 @@ Flag in session creation: `echo 'new claude /project ephemeral' | 9p write agent
Daemon marks session as ephemeral. When backend exits cleanly (not crash), transition to `stopped` or `exited` instead of auto-restart. Optionally auto-cleanup after N seconds.
## Context Utilization State
Daemon polls backend for context usage and exposes it via `agent/{session}/usage`.
### Backend-Specific Queries
**Kiro CLI**: Send `/context show` as prompt, parse response for token usage (e.g., "17426/200000 (8.7%)")
**Claude/Others**: Write "N/A" or "-" (no context query support)
### Polling Strategy
Daemon or monitor process:
- Every 1-2 minutes, check `agent/{session}/backend`
- If Kiro: send `/context show`, parse output, write to `usage`
- If unsupported: write "-" to `usage`
Avoids interrupting user prompts. Cache last known value between polls.
### 9P Filesystem
Add to each session:
```
agent/<id>/usage # "17426/200000 (8.7%)" or "N/A"
```
### UI Integration
- **Assist**: display usage in session list, color-code by threshold
- **anvillm/anvilweb**: add usage column
- **Color scheme**: green (<50%), yellow (50-80%), red (>80%)
### Automatic Actions
When usage exceeds threshold:
- Warn user at 80%
- Suggest restart or conversation compaction at 90%
- Optionally auto-restart (preserves session ID, fresh context)
### Conversation Compaction
High usage workflow:
1. Summarize conversation history (via bot or separate summarizer)
2. Restart session with summary as initial context
3. Usage drops, session continues with same ID