Ir al contenido

rai session

Esta página aún no está disponible en tu idioma.

Manage working sessions. Sessions track developer activity, enable context loading for AI agents, and capture incremental decisions via the journal.

Start a new working session. Increments the session counter and sets active session state. Checks for orphaned sessions and warns if found.

With --context, outputs a token-optimized context bundle (~150 tokens) from the developer profile, session state, and knowledge graph.

FlagShortDescription
--name-nYour name (required for first-time setup)
--project-pProject path to associate with this session
--agentAgent type (e.g., claude-code, cursor). Default: unknown
--contextOutput a context bundle for AI consumption
Terminal window
# First-time setup
rai session start --name "Alice" --project .
# Start session with context bundle
rai session start --project . --context
# Simple start
rai session start

End the current working session. With --summary or --state-file, performs a full structured close — records session, patterns, corrections, and updates state. All writes are atomic.

FlagShortDescription
--summary-sSession summary
--type-tSession type (feature, research, maintenance, etc.)
--patternPattern description to record
--correctionCoaching correction observed
--correction-lessonLesson from the correction
--state-fileYAML file with full structured session output
--sessionSession ID to close (e.g., SES-177). Falls back to RAI_SESSION_ID env var
--project-pProject path
Terminal window
# Simple close
rai session close
# Close with summary
rai session close --summary "Implemented auth module" --type feature
# Close with pattern learned
rai session close --summary "Refactored tests" --type maintenance \
--pattern "Use fixtures for database setup"

Load task-relevant context priming sections. Use after rai session start --context to load detailed priming for a specific work type.

Available sections: governance, behavioral, coaching, deadlines, progress.

FlagShortDescription
--sections-sComma-separated section names to load (required)
--project-pProject path (required)
Terminal window
# Feature work: governance + behavioral patterns
rai session context -s governance,behavioral -p .
# Near a deadline: check urgency
rai session context -s deadlines,progress -p .

Add a journal entry to the current session. Entries capture decisions, insights, and completed tasks incrementally.

ArgumentDescription
CONTENTContent to persist (required)
FlagShortDescription
--type-tEntry type: decision, insight, task_done, note. Default: note
--tagsComma-separated tags (e.g., arch,spike)
--project-pProject path
Terminal window
# Record a decision
rai session journal add "Use JSONL for journal" --type decision
# Record completed task
rai session journal add "T1 complete" --type task_done
# Record an insight with tags
rai session journal add "Compaction loses rationale" --type insight --tags "compaction,memory"

Show journal entries for the current session.

FlagShortDescription
--last-nShow only the last N entries
--compactOutput compact format for context injection
--project-pProject path
Terminal window
# Show all entries
rai session journal show
# Show last 5 entries
rai session journal show --last 5
# Compact format for post-compaction restore
rai session journal show --compact

See also: rai session start, rai signal emit-session