Session Context
ProfessionalUnderstand how NetStacks captures, stores, and surfaces operational knowledge from terminal sessions to enrich future connections with device history, notes, and contextual intelligence.
Overview
Session Context is an operational knowledge layer that enriches every terminal session with historical data, user-added notes, and contextual information about the device you are connecting to. When you open a session to a switch you troubleshot last week, NetStacks surfaces the commands you ran, the notes you left, and any issues flagged during previous connections.
What Session Context Provides
- Device history -- previous sessions, commands executed, configuration changes made, and timestamps
- Operational notes -- user-authored notes attached to a device or session (e.g., "Flapping port on Gi0/24 -- awaiting RMA")
- AI enrichment -- context is fed to the AI assistant so it can provide device-aware suggestions and reference prior troubleshooting steps
- Team visibility -- notes and context are shared across the team so everyone has situational awareness
Session context works alongside session recording. While recordings capture the full terminal output, context captures the semantic meaning -- what was done, why, and what to watch for next time.
How It Works
Context Capture
Context is captured from two sources: automatic extraction from terminal sessions and manual notes added by engineers.
- Automatic capture -- when a session ends, NetStacks extracts key data points: commands executed, configuration changes detected, errors encountered, and session duration. This data is stored against the device record.
- Manual notes -- engineers can add free-text notes to any device at any time. Notes support Markdown formatting and are timestamped with the author.
- AI integration -- when AI Chat or Command Suggestions are used during a session, the session context is included in the prompt context. This allows the AI to reference previous troubleshooting steps and provide continuity.
Context Storage
Context data is stored on the controller and associated with the device record. Each context entry includes a timestamp, the authoring user, the session ID (if applicable), and the context type (automatic or manual). Context entries are retained based on the configured retention policy.
Context Surfacing
When you connect to a device, NetStacks loads the recent context for that device and displays it in the Context panel. The AI assistant also receives this context automatically, enabling it to provide informed recommendations.
Step-by-Step Guide
Workflow 1: View Session Context for a Device
- Connect to a device via the terminal
- Open the Context panel from the terminal toolbar or press
Cmd/Ctrl+Shift+C - Review the timeline of previous sessions, notes, and configuration changes
- Click any entry to expand details including commands executed and session duration
Workflow 2: Add a Manual Note
- Open the Context panel while connected to a device
- Click Add Note at the top of the panel
- Enter your note using Markdown formatting (e.g., "Replaced SFP in slot 1/0/24. Monitor for CRC errors over next 48h.")
- Click Save -- the note is visible to all team members with access to this device
Workflow 3: Use Context with AI Chat
- Connect to a device that has existing context
- Open AI Chat -- the session context is automatically included in the AI prompt
- Ask questions like "What changes were made to this device last week?" and the AI will reference the context data
Leave notes after every maintenance window. Future engineers (or yourself) will thank you when they connect to the device and immediately see what was done and why.
Code Examples
Viewing Context via API
# Get session context for a device
GET /api/v1/devices/{device_id}/context
# Response
{
"device_id": "dev_abc123",
"hostname": "core-rtr-01.dc1",
"context_entries": [
{
"id": "ctx_001",
"type": "session",
"timestamp": "2025-12-15T14:30:00Z",
"user": "jsmith",
"session_id": "sess_xyz789",
"summary": "BGP troubleshooting -- neighbor 10.0.0.2 flapping",
"commands_executed": 12,
"duration_seconds": 847
},
{
"id": "ctx_002",
"type": "note",
"timestamp": "2025-12-15T15:00:00Z",
"user": "jsmith",
"content": "Root cause: MTU mismatch on pe-facing link. Set to 9216."
}
]
}Adding a Context Note
# Add a manual note to a device
POST /api/v1/devices/{device_id}/context
Content-Type: application/json
{
"type": "note",
"content": "Firmware upgrade scheduled for 2025-12-20 02:00 UTC. Current: 17.06.05, Target: 17.09.04a. Change ticket: CHG0012345."
}Context-Enriched AI Prompt
# When AI Chat is opened on a device with context,
# the following is automatically included in the system prompt:
Device: core-rtr-01.dc1 (Cisco IOS-XE 17.06.05)
Recent context:
- [2025-12-15] BGP troubleshooting: neighbor 10.0.0.2 flapping (resolved: MTU mismatch)
- [2025-12-15] Note: MTU set to 9216 on pe-facing link
- [2025-12-10] Config snapshot taken before OSPF area migration
- [2025-12-08] Note: Added to maintenance group "dc1-core"
# This context allows the AI to provide informed assistance:
User: "Is the BGP issue from last week resolved?"
AI: "Based on the session context, the BGP flapping with neighbor
10.0.0.2 was resolved on Dec 15 by correcting the MTU mismatch.
The pe-facing link MTU was set to 9216. Would you like me to
verify the current BGP neighbor state?"Q&A
- Q: What information is captured in session context?
- A: Session context captures the commands executed during a session, configuration changes detected, errors encountered, session duration, and the user who performed the session. Manual notes added by engineers are also stored as context entries.
- Q: How does session context improve AI suggestions?
- A: When you open AI Chat or use Command Suggestions, NetStacks includes recent session context in the AI prompt. This allows the AI to reference previous troubleshooting steps, configuration changes, and notes, providing continuity and device-aware assistance.
- Q: Can I add custom notes to a device's context?
- A: Yes. Open the Context panel while connected to a device and click Add Note. Notes support Markdown formatting and are timestamped with your username. All team members with device access can view the notes.
- Q: How long is session context retained?
- A: Context retention is configurable in Administration → System Settings. The default retention period is 90 days for automatic session context and unlimited for manual notes. Administrators can adjust these values based on storage requirements.
- Q: Is session context shared across users?
- A: Yes. Session context is stored on the controller and visible to all users with access to the device. This provides team-wide situational awareness -- everyone can see what has been done on a device and any notes left by colleagues.
- Q: How does session context differ from session recording?
- A: Session recording captures the full terminal output as a replayable video. Session context captures structured metadata -- commands, changes, notes, and summaries. Context is designed for quick reference and AI integration, while recordings are for detailed audit and replay.
Troubleshooting
Context Not Appearing for a Device
- Verify the device has previous sessions -- context is only generated after at least one terminal session
- Check the controller connection is active (context is stored on the controller)
- Ensure you have permission to view the device -- context visibility follows device access permissions
Stale Context Data
- Context entries are ordered by timestamp. If old entries appear first, check the sort order in the Context panel
- Use the retention settings in Administration to purge context older than a specified period
Context Storage Limits
- Large environments may accumulate significant context data. Monitor storage usage in Administration → System Settings
- Adjust the retention policy or increase storage allocation if context entries are being pruned prematurely
Related Features
- Session Recording -- capture full terminal output for replay and audit
- AI Chat -- context-aware AI assistance enriched by session history
- Command Suggestions -- AI-powered suggestions that leverage device context
- Adding Devices -- manage the devices that accumulate session context