Octopus
Context Inspector
The Context Inspector is a debugging panel in the chat-app that shows the exact messages sent to the LLM for each conversation turn — including the system prompt, injected knowledge, message history, and token counts. Available in developer and administrator modes.
Accessing the Context Inspector
The Context Inspector is available to users with the OctopusDebug role. In the chat-app:
- Click the "..." menu on any agent response
- Select "Inspect Context" — or press Ctrl+Shift+I in the chat window
- The Context Inspector panel opens on the right side of the chat
Context Inspector API
// The context inspector data is returned alongside each agent response:
GET /api/octopus/sessions/{sessionId}/turns/{turnId}/context
Authorization: Bearer {adminToken}
// Response
{
"turnId": "...",
"messages": [
{
"role": "system",
"content": "You are Aria, the HR specialist...",
"section": "SystemPrompt",
"tokenCount": 1200
},
{
"role": "context",
"content": "[Retrieved Knowledge]\nSource: HR Policy 2025.pdf\n...",
"section": "SemanticMemory",
"tokenCount": 1450,
"sources": ["HR Policy 2025.pdf", "Leave Calculator Guide.pdf"]
},
{
"role": "user",
"content": "Can I take 5 days in June?",
"section": "CurrentMessage",
"tokenCount": 12
}
],
"totalTokens": 5420,
"budget": 150000,
"budgetUsedPercent": 3.6,
"pruningApplied": false,
"semanticMatchCount": 4,
"episodicMatchCount": 2,
"procedureMatched": null
}
Debugging Common Issues
| Symptom | Check in Context Inspector | Likely Fix |
|---|---|---|
| Agent ignores relevant knowledge | SemanticMemory section — are relevant chunks retrieved? | Lower MinScore, increase TopK, improve chunk quality |
| Agent forgets earlier turns | Message History section — how many turns are included? | Increase MaxWorkingMemoryTokens or switch to Summarize pruning |
| Agent uses wrong procedure | Procedure section — which procedure was matched? | Fix trigger pattern in Skill Library |
| Response truncated — hit token limit | totalTokens vs. budget — is budget near 100%? | Reduce SemanticTopK, knowledge tokens, or enable more aggressive pruning |
Production Access Control
The Context Inspector exposes the full system prompt — a sensitive document that defines agent behavior. Ensure the OctopusDebug role is granted only to trusted developers and administrators. Do not expose context inspection endpoints to end users.