/session:init
Initialize or verify the session management system. This command sets up the session tracking infrastructure.
Quick Start
/agileflow:session:initWhat It Does
- Creates
.agileflow/sessions/directory if missing - Initializes
registry.jsonwith schema - Registers the current directory as a session
- Creates a lock file with current process ID
- Displays session status
Example Output
First Time Setup
✓ Session initialized
Session ID: 1
Path: /home/user/myproject
Branch: main
No other active sessions detected.
Already Initialized
✓ Session already active
Session ID: 1
Path: /home/user/myproject
Branch: main
Other Sessions Active
✓ Session initialized
Session ID: 1 (current)
Path: /home/user/myproject
Branch: main
⚠️ 2 other session(s) active in this repo.
Run /agileflow:session:status to see all sessions.
Run /agileflow:session:new to create isolated workspace.
When Is It Called?
Automatic (Recommended)
The SessionStart hook calls this automatically when Claude Code starts:
// .claude/settings.json
{
"hooks": {
"SessionStart": {
"command": "node scripts/agileflow-welcome.js"
}
}
}The welcome script registers the session and displays status.
Manual
Run manually to:
- Verify session system is working
- Re-register after system issues
- Debug session problems
/agileflow:session:initFiles Created
Registry File
.agileflow/sessions/registry.json:
{
"schema_version": "1.0.0",
"next_id": 2,
"project_name": "myproject",
"sessions": {
"1": {
"path": "/home/user/myproject",
"branch": "main",
"created": "2025-12-26T10:00:00Z",
"is_main": true
}
}
}Lock File
.agileflow/sessions/1.lock:
pid=12345
started=1703588400
Troubleshooting
Session Not Detecting
# Check if registry exists
ls .agileflow/sessions/
# Re-initialize
/agileflow:session:initStale Lock Warning
If you see stale locks, the init command cleans them up:
✓ Session initialized
Cleaned 1 stale session(s)
Permission Issues
Ensure you have write access to .agileflow/:
ls -la .agileflow/
# Should show your user as ownerIntegration with Welcome Script
The AgileFlow welcome script includes session detection:
╭──────────────────────┬────────────────────────────────────╮
│ agileflow v2.53.0 main (cc45511) │
├──────────────────────┼────────────────────────────────────┤
│ Sessions │ ✓ Session 1 (only) │
╰──────────────────────┴────────────────────────────────────╯
Or with conflicts:
│ Sessions │ ⚠️ 2 other active │
⚠️ Other Claude session(s) active in this repo.
Related Commands
/session:status- View all sessions/session:new- Create parallel session/session:end- End current session
On This Page
/session:initQuick StartWhat It DoesExample OutputFirst Time SetupAlready InitializedOther Sessions ActiveWhen Is It Called?Automatic (Recommended)ManualFiles CreatedRegistry FileLock FileTroubleshootingSession Not DetectingStale Lock WarningPermission IssuesIntegration with Welcome ScriptRelated Commands