Expand description
Observability surface: introspect AgentSec’s runtime state.
Four entry points, each surfaced as a CLI subcommand and an MCP tool by the umbrella crate:
| Entry | Role |
|---|---|
info | Crate version + resolved paths + env state with per-var provenance. |
status | Runtime activity overview (file counts, latest timestamps, Plain Mode). |
recent_activity | Tail of paste_log/ and web_log/ audit rows. |
doctor | Comprehensive health check (env / paths / hook wiring / MCP register). |
§§Env provenance
info reports four AgentSec-relevant env vars (AGENTSEC_HOME,
HOME, ANTHROPIC_API_KEY, AGENTSEC_LLM_MODEL) with the source
that produced the effective value:
Process— set in the process environment, not present in the loaded.envfile (or no.envwas loaded).DotenvFile { path, line }— defined in the.envfile at the given line;dotenvyloaded it without overriding an existing process-env value (so this is the effective source for vars that were unset before load).DotenvFileShadowed { path, line }— defined in the.envfile at the given line but the process env already had the var set; the process value wins (dotenvy is non-overriding by default).Default(value)— not set anywhere; AgentSec’s builtin default applies.Unset— not set anywhere and no default applies (i.e. an optional var likeANTHROPIC_API_KEYleft empty).
Secret values (ANTHROPIC_API_KEY) are always reported in redacted
form (sk-***<last-4>); the raw value never enters the report.
Structs§
- Audit
Tail - One audit-log row excerpt.
- Doctor
Check - One health check row.
- Doctor
Report - Health-check report: one row per check, each PASS / WARN / FAIL.
- EnvVar
Status - One env var’s effective state + provenance.
- Info
Report - Top-level info report.
- Paths
Info - Display-friendly path bundle.
- Recent
Activity Report - Tail of audit log files.
nof each kind (paste / web). - Status
Report - Runtime activity snapshot.
- Storage
Item - One row of the Storage section: where audit data physically lives.
Enums§
- Doctor
Status - Three-level check verdict.
- EnvSource
- Where the effective env value came from.
Constants§
- VERSION
- Crate version embedded at compile time.
Functions§
- doctor
- Run all health checks and return the aggregated report.
- format_
size - Format a byte count as a short human-readable string. Integer-only math (no f64) to avoid clippy precision-loss lint.
- info
- Build an
InfoReportfrom a resolvedConfigand the live process environment. - recent_
activity - Read the last
nfiles (by filename order, which is timestamped) ofpaste_log/andweb_log/and return their excerpts. - status
- Build a
StatusReportfrom the on-disk state atcfg.paths.