diagnose

diagnose is a command for coding agents from cirwel/unitares. It costs 11 tokens per session (540 once invoked), scanned A, original, Apache-2.0.

A command that reports the current UNITARES governance state and diagnostics for an AI agent. It checks the agent's identity and continuity before retrieving its governance measurements.

In plain words
What is it for?
Use it to inspect identity status, session binding, lineage, session resolution, governance metrics, and—when relevant—the health of the surrounding system.
Why use it?
It helps distinguish a genuinely resumed session from a newly created identity, avoiding misleading results caused by treating an old session identifier as proof of ownership.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/cirwel/unitares/diagnose
Clone the repo
git clone --depth 1 https://github.com/cirwel/unitares

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for diagnose

README.md
[![agentmods](https://agentmods.dev/badge/commands/cirwel/unitares/diagnose.svg)](https://agentmods.dev/commands/cirwel/unitares/diagnose)
Your own site
<a href="https://agentmods.dev/commands/cirwel/unitares/diagnose"><img src="https://agentmods.dev/badge/commands/cirwel/unitares/diagnose.svg" alt="Measured on agentmods" height="20"></a>
Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 540 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00011 $0.00540
Opus 5 $0.00005 $0.00270
Sonnet 5 $0.00002 $0.00108
Haiku 4.5 $0.00001 $0.00054

Measured 5d ago against content hash 0d33f363e4ce, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

diagnose scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/diagnose.md · 58 lines

What it actually says

Start by checking the local workspace cache inventory.

Use the shared helper in this repo:

  • scripts/client/session_cache.py list

If the newest entry contains parent_agent_id, treat it as lineage context, not proof that this process should declare the same parent.

Do not verify by bare UUID resume. If you need to test ownership of a cached UUID, use an advanced proof-owned rebind only when a matching current in-process token is available. Do not use legacy cache files as token sources.

If no proof-owned UUID rebind is available, call identity() to inspect current binding. Use /governance-start to create a fresh process identity. Add parent_agent_id only for a real handoff from a finished predecessor.

Call identity() first when continuity or binding is unclear.

Then call get_governance_metrics for the current agent using the same continuity data.

Call health_check() only when system health, not agent state, may be part of the issue.

Display:

  • whether identity was proof-resumed, freshly created, or created with lineage
  • whether lineage was declared through parent_agent_id
  • identity_status
  • bound_identity
  • session_resolution_source
  • continuity_token_supported
  • identity_assurance
  • deprecation warnings
  • whether continuity looks strong or weak
  • E, I, S, V
  • coherence
  • risk score
  • verdict
  • summary or mode/basin if available
  • behavioral vs ODE authority when it is obvious in the response

If health_check() is used, also show:

  • overall system status
  • degraded checks
  • first operator action

Call list_process_bindings() (optionally with agent_uuid=<uuid>) to show live execution-context bindings for the agent. When concurrent_binding_detected is true, surface the bindings[] tuples — each row is {host_id, pid, pid_start_time, transport, tty, last_seen} — so the operator can see which contexts are siphoning the same UUID. See issue #123.

If the live identity differs from the cache inventory, refresh the local slotted cache with the latest uuid, identity fields, and schema_version: 2 using scripts/client/session_cache.py set session --slot <client_session_id-or-codex-session-id> --merge --stamp. Do not write continuity_token to the cache.

Do not dump raw JSON unless the user explicitly asks for it. Prefer a short interpreted summary.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 58 lines · 11 tokens per session scan A 0d33f363e4ce

Subscribe to this mod's changes

diagnose is a command published in the GitHub repository cirwel/unitares (4 stars, last pushed yesterday), licensed Apache-2.0. It adds 11 tokens to every session and 540 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.