detect_current
Return the current runtime identity by reading environment variables and session flag files, yielding the active agent session, its model, and a resume command.
Instructions
Return the current runtime identity (session + agent) from env/fs.
NOT a session-query — this reads the runtime environment (env vars +
per-session flag files), reusing the exact cascade behind the
ai-r detect-agent / ai-r detect-session CLI subcommands.
Args:
agent: Optional hint (accepted for symmetry with the CLI's
deprecated --agent flag); the cascade scans all agents.
Returns:
{"session_id", "agent", "model", "resume_command", "candidates": [...], "verified", "self"} where session_id /
agent describe the highest-priority candidate, model is
the current session's model — the LAST assistant model
recorded in its transcript (null when identity is incomplete
or the format records no model signal — never guessed) —
resume_command is the ready-to-run shell one-liner that
reopens the detected session in its agent's CLI (F2.2, text
only, never executed; null when no real command exists) —
and candidates is the full cascade for disambiguation.
Returns {"error": ..., "message": ...} on an unknown
agent hint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||