Quick Start
Start in your project root
Continue later
How It Works
find_last_session() merges the project-scoped store and the global default store so --continue resolves the most-recent session regardless of how it was created (run, chat, gateway, TUI, API, or a bare Agent(session_id=...)). Sub-agent / forked children are skipped — the last root session wins. It falls back to a child only if the project has none. Each store is scanned with a limit window (default 50).
| Where you are | Project ID from |
|---|---|
| Inside a git repo | git rev-parse --show-toplevel |
| Outside a git repo | Current working directory |
| Stored hash | First 8 chars of sha256(absolute_path) |
Persisted usage shape
Every session stores ausage blob in ~/.praisonai/sessions/projects/<project_id>/<session_id>.json. Config-driven consumers and scripts can read this directly.
| Key | Type | Notes |
|---|---|---|
input_tokens | int | Cumulative prompt tokens |
output_tokens | int | Cumulative completion tokens |
cached_tokens | int | Cumulative cached / prefix-hit tokens (when provider reports them) |
total_tokens | int | input + output (cached not double-counted); mirrored to flat total_tokens on session metadata for back-compat with list_sessions |
cost | float | USD, priced via get_pricing(model); mirrored to flat cost |
requests | int | Count of agent.start() runs that produced usage |
total_tokens and cost fields at the session root are mirrors kept for backwards compatibility with any code reading the old schema.
SDK helpers (praisonaiagents 1.6.85+):
Configuration Options
| Flag | Description |
|---|---|
--continue | Resume the most recent root session for this project — searches both the project store and the global default store |
--session <id> | Resume a specific session |
--fork --session <id> | Branch a session to try alternatives |
--no-save | One-off prompt — nothing persisted |
session list --all | List sessions across all projects |
Best Practices
Run from the project root
Run from the project root
Start
praisonai run from the repo root so git detection stays consistent — subdirectories still resolve to the same project.Use --fork for risky experiments
Use --fork for risky experiments
Try alternatives without altering the main thread:
praisonai run --fork --session abc123 "try Redis instead".Use --no-save for throwaway prompts
Use --no-save for throwaway prompts
Quick questions or PII-sensitive input:
praisonai run --no-save "How do I hash passwords?".Clean up with session list --all
Clean up with session list --all
Review and delete stale sessions across projects periodically.
Related
Run Command
Complete
praisonai run with session flags and usage footerSession Management
Session commands, new table columns, and resume panel
Cost Tracking
Per-session persistence,
/cost command, and pricing table
