How m-newhauser/gliner25-compaction works
GLiNER2.5 Local Context prunes completed coding-agent tool interactions locally, retaining exact evidence rather than generating summaries or transmitting transcripts to an external model. Claude Code invokes pruning during native compaction, while OpenCode offers explicit /gliner-prune actions against provider-bound context. Both paths lead to transcript normalization, model-based retention analysis, safety validation, and evidence-preserving rendering. The OpenCode bridge and sidecar wiring is represented from sampled source; the README documents both harnesses, but Pi is explicitly planned and not implemented.
Main entry points: worker.py Worker entry · compact.py Retention and rendering · server.ts Plugin server · analyzer.py GLiNER analyzer
Components 19
Agent harnesses
- Compaction hook
integrations/claude-code/hooks/gliner25-pruning.ts - Compaction hook
hooks/gliner25-compaction.ts
OpenCode integration
- Prune command
integrations/opencode/src/tui.ts - Plugin server
integrations/opencode/src/server.ts - Local bridge
integrations/opencode/src/bridge.ts - Transcript adapter
integrations/opencode/src/opencode/adapter.ts - Sidecar client
integrations/opencode/src/sidecar-client.ts - Wire protocol
integrations/opencode/src/protocol.ts
Pruning engine
- Sidecar service
src/gliner25_context_compaction/sidecar.py - Worker entry
src/gliner25_context_compaction/worker.py - Transcript codec
src/gliner25_context_compaction/claude.py - Interaction collection
src/gliner25_context_compaction/transcript.py - Retention and rendering
src/gliner25_context_compaction/compact.py - Result validation
src/gliner25_context_compaction/validation.py
Local inference
- GLiNER analyzer
src/gliner25_context_compaction/analyzer.py - Label schema
src/gliner25_context_compaction/schema.py
Other components
- Claude Code
- OpenCode user
- GLiNER2.5 checkpoint
Connections 19
- Claude Code → Compaction hook: compacts via
- Claude Code → Compaction hook: compacts via
- Compaction hook → Worker entry: runs worker
- Compaction hook → Worker entry: runs worker
- OpenCode user → Prune command: selects command
- Prune command → Local bridge: sends request
- Plugin server → Local bridge: starts handler
- Plugin server → Transcript adapter: normalizes transcript
- Plugin server → Sidecar client: requests analysis
- Sidecar client → Sidecar service: spawns and exchanges
- Sidecar service → Worker entry: dispatches request
- Worker entry → Transcript codec: converts messages
- Worker entry → Retention and rendering: compacts transcript
- Worker entry → Result validation: validates result
- Transcript codec → Retention and rendering: supplies messages
- Retention and rendering → Interaction collection: collects interactions
- Retention and rendering → GLiNER analyzer: analyzes interactions
- GLiNER analyzer → Label schema: uses labels
- GLiNER analyzer → GLiNER2.5 checkpoint: runs local inference