Long Running Sessions Integration
Monitor long-running AI sessions in real-time — track progress, events, and status across Claude Code and other tools.
Long-running sessions enable Neatlogs to monitor and track the progress of AI-powered sessions in real-time. When you dispatch tasks to Claude Code or other code-fixing tools, Neatlogs monitors the session lifecycle, captures key events (PR creation, errors, completion), and provides full observability into what's happening.
Claude Code Session Monitoring
When you use Claude Code via Neatlogs, every session is monitored and tracked. You get real-time visibility into:
- Session Status — Track whether the session is running, completed, failed, or cancelled
- PR & Branch Info — See which PR was created and on which branch
- Duration & Timing — Measure how long the session took from start to finish
- Error Tracking — Capture and display any errors that occurred during the session
- Event Stream — Access the full sequence of session events for debugging
Setting Up Claude Code Session Monitoring
Step 1: Create a Claude Code Routine
- Visit claude.ai/code/routines
- Create a new routine and link it to your GitHub account
- Anthropic will provide:
- A routine URL
- A one-shot bearer token
- Your Anthropic API key (if you don't have one)
Step 2: Connect to Neatlogs
- Go to Settings → Integrations → Claude Code
- Select "Routines" auth method
- Paste:
- Anthropic API key
- Routine URL
- Routine bearer token
- Save
Once connected, Neatlogs can dispatch tasks to Claude Code and monitor the resulting sessions.
View Your Claude Code Sessions
Sessions are tracked and stored in Neatlogs. You can:
- View session status in the Task Details after dispatching
- See real-time updates as the session progresses
- Access the PR link once it's created
- Monitor session duration and completion time
- Review any errors in the error message field
Each session includes:
- Status: running, finished, error, or cancelled
- PR URL: Direct link to the pull request
- Branch: The branch where changes were made
- Duration: Elapsed time from start to finish
- Created/Finished times: Exact timestamps
- Events: Full event log from Claude Code
Monitor Session Progress in Real-Time
Neatlogs continuously polls Claude Code's session API to:
- Capture session state changes
- Track when PRs are opened
- Record session completion or errors
- Measure total duration
The full event stream is available for analysis — no data is lost. You can see:
- Session started
- Tool calls made
- PR opened
- Branch name
- Session completed or failed
- Any error messages
This gives you complete visibility into what Claude Code was doing.
Session Data Captured
| Data | Description |
|---|---|
| Session ID | Unique identifier from Claude Code |
| Status | running, finished, error, cancelled |
| PR URL | Link to the created pull request |
| Branch | Git branch where changes were made |
| Duration (ms) | Time from session start to completion |
| Created At | Session start timestamp (ISO 8601) |
| Finished At | Session end timestamp (ISO 8601) |
| Error Message | Details if the session failed |
| Events | Full stream of session events |
Session Lifecycle Events
Neatlogs tracks these key events during a Claude Code session:
Standard Session Events:
session_started— Session began executionpr_opened— Pull request was createdsession_completed— Session finished successfullysession_failed— Session encountered an errorsession_cancelled— Session was manually stopped
Each event includes timing information (created_at) and relevant metadata (PR URL, branch name, error message).
Error Tracking:
If a session fails, Neatlogs captures:
- The error message from Claude Code
- The timestamp when the error occurred
- Session status set to
error
Common errors:
- GitHub authentication failures
- Repository access issues
- Branch conflicts
- API rate limits
Check the error message field in the session details for troubleshooting.
Completion States:
Sessions can end in four states:
- finished — Session completed successfully (PR created, changes made)
- error — Session failed (error message included)
- cancelled — Session was manually stopped
- running — Session is still in progress (if monitoring was interrupted)
The finishedAt timestamp marks when the session ended.
Accessing Session Data
Sessions are stored in Neatlogs and accessible via:
- Task Details Page — View session status when you dispatch
- Session History — See all past sessions for a task
- API — Query session data programmatically
- Analytics — Track session success rates and duration trends
