Portal Community

Accessing the Context Inspector

The Context Inspector is available to users with the OctopusDebug role. In the chat-app:

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

SymptomCheck in Context InspectorLikely Fix
Agent ignores relevant knowledgeSemanticMemory section — are relevant chunks retrieved?Lower MinScore, increase TopK, improve chunk quality
Agent forgets earlier turnsMessage History section — how many turns are included?Increase MaxWorkingMemoryTokens or switch to Summarize pruning
Agent uses wrong procedureProcedure section — which procedure was matched?Fix trigger pattern in Skill Library
Response truncated — hit token limittotalTokens 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.