Agency health

Read one running agency case end-to-end by composing the native `store/projection.read` operation keyed on the agency case and the Receipt Query read runner by receipt id-stub only; fold the case projection in version order, grade signals against declared norms, and seal a health_verdict plus typed intervention findings with named target lanes. Read-only: appends nothing, sends nothing, executes nothing, and consumes no effect.

You’re reading version 0.1.3. Go to the current version

Overview

Agency Health assembles a health bundle for one running agency over a period. An agency runs a standing mandate one governed turn at a time, and every turn appends an event to that agency's case stream in the operator-selected data store. Over days that stream is operational state: turns that advanced cleanly, turns parked in awaiting_approval, cumulative spend and act counts approaching the charter caps, and turns making no progress.

This skill reads the domain-keyed turn state by composing two existing runners:

  1. the native store/projection.read operation keyed on the agency case over the supplied period; and
  2. the Receipt Query read runner referenced by receipt id-stub only, because the ledger is audit-only and can never be a domain-keyed state read.

It folds the case projection in version order, grades the signals against the declared norms (or supplied baseline), and seals a health_verdict plus typed intervention findings. It is read-only: it appends nothing, sends nothing, executes nothing, and consumes no effect. Each warranted finding names its target lane (policy-author to tighten a policy or timeout, improve-skill to debug a member behind a refusal spike). Any remedy that would widen a cap or authority, and any critical finding, escalates to the human ops lane rather than routing as a routine tighten.

run-history-analyst reads runs across the whole catalog ledger, and receipt-auditor audits one receipt. This skill reads one live agency case projection end-to-end, so it composes those two lanes without reimplementing them.

SKILL.md

Agency Health

Agency Health assembles a health bundle for one running agency over a period. An agency runs a standing mandate one governed turn at a time, and every turn appends an event to that agency's case stream in the operator-selected data store. Over days that stream is operational state: turns that advanced cleanly, turns parked in awaiting_approval, cumulative spend and act counts approaching the charter caps, and turns making no progress.

This skill reads the domain-keyed turn state by composing two existing runners:

  1. the native store/projection.read operation keyed on the agency case over the supplied period; and
  2. the Receipt Query read runner referenced by receipt id-stub only, because the ledger is audit-only and can never be a domain-keyed state read.

It folds the case projection in version order, grades the signals against the declared norms (or supplied baseline), and seals a health_verdict plus typed intervention findings. It is read-only: it appends nothing, sends nothing, executes nothing, and consumes no effect. Each warranted finding names its target lane (policy-author to tighten a policy or timeout, improve-skill to debug a member behind a refusal spike). Any remedy that would widen a cap or authority, and any critical finding, escalates to the human ops lane rather than routing as a routine tighten.

run-history-analyst reads runs across the whole catalog ledger, and receipt-auditor audits one receipt. This skill reads one live agency case projection end-to-end, so it composes those two lanes without reimplementing them.

When to use this skill

  • A standing agency has been running for at least one period, the operator wants a single health bundle for one case, and the agency charter snapshot (mandate, roster, cumulative limits) is in the data-store already.
  • The reviewer needs to know whether a case is making progress, where it is parked, what its cumulative cap usage looks like, and where a downstream policy-author or improve-skill run should be triggered.

When not to use this skill

  • One-shot or interactive work that does not span multiple agency turns. The operator should call the member skills directly; this skill is overhead when the operator already knows which move to make.
  • Anything that would mutate the agency case, write to the ledger, or issue a rail run. The intervention findings are dispatch-by-naming only: each finding names a target lane and grounds it in a case_id and a turn or a ledger id-stub. A downstream driver or operator issues the separate run.
  • Inventing a threshold or a cap that is not in the agency charter snapshot or the supplied baseline. The skill refuses to grade what it cannot ground.

Procedure

  1. Compose the case projection read from the data-store runner (C2), keyed on data_source_uri and case_id, bounded by period. The runner returns events in version order; the skill folds them in that order.
  2. For each grounded signal, compose the ledger read by id-stub only (C7). The ledger is audit-only; the skill never pulls aggregate state from it and never uses the ledger as a domain-keyed state source.
  3. Compute graded findings:
    • seal_rate from sealed vs refused turns over the period.
    • stuck_case_count from turns with status awaiting_approval or with zero version advance across consecutive reads.
    • cap_usage_pct from cumulative acts and spend against the charter snapshot's limits, plus the optional health_baseline.cap_pressure_pct.
    • escalation_backlog from the count of turns parked in awaiting_approval over the period.
    • refusal_spike_rate from the recent refusal rate versus the optional health_baseline.refusal_spike_rate.
  4. Emit the typed intervention findings. Each finding cites its grounding case_id and either a turn number or a ledger id-stub. Critical findings, and any finding whose remedy would widen a cap or authority, escalate to the human ops lane and never to a routine policy-author tighten.
  5. Seal the verdict. The skill never invents a turn state the sealed event order does not show, and never invents a cap or threshold the charter snapshot or the supplied baseline does not expose.

Inputs

  • data_source_uri (required string): the registry-pinned identifier of the operator-selected data store whose runner is C2.
  • period (optional object): { since, until } ISO timestamps bounding the read. Defaults to the entire case stream when omitted.
  • case_id (optional string): a specific case within the agency. Defaults to the agency's current case when omitted.
  • health_baseline (optional object):
    • threshold_days_stuck (number): days a parked turn may stay parked before graded as stuck_case_count.
    • cap_pressure_pct (number): percentage of a cumulative cap above which graded cap_usage_pct is concerning rather than healthy.
    • refusal_spike_rate (number): sealed-vs-refused ratio above which graded refusal_spike_rate is concerning.

Output schema

yaml
agency_health:
  schema: runx.agency.health.v1
  decision: ready | needs_more_evidence | needs_human
  health_verdict:
    status: healthy | degraded | critical
    findings:
      - metric: seal_rate | stuck_case_count | cap_usage_pct | escalation_backlog | refusal_spike_rate
        assessment: healthy | concerning | critical
        norm: string
        evidence:
          case_id: string
          turn: number | null
          ledger_id_stub: string | null
  intervention_findings:
    - target_lane: policy-author | improve-skill | human-ops
      reason: string
      remedy_class: tighten | debug | escalate
      cap_widening: bool
      authority_widening: bool
      grounding:
        case_id: string
        turn: number | null
        ledger_id_stub: string | null
  refusals:
    - when: composition_unreadable | no_case_events | baseline_missing
      reason: string

Refusals

The skill refuses to grade a signal that is not grounded in the folded case projection or a ledger id-stub aggregate. It refuses to invent a cap or threshold it cannot read from the agency charter snapshot or the supplied baseline. It never invents a turn state the sealed event order does not show.

When no readable case events exist over the period, the verdict is needs_more_evidence, no findings are graded, and no intervention is emitted. The case is recorded in refusals with when: no_case_events.

Quality bar

  • Compose the data-store read and the ledger read by id-stub; never read aggregate state from the ledger, never use the ledger as a domain-keyed source.
  • Fold the case projection in version order; never reorder events and never infer state the events do not show.
  • Name the target lane on every intervention finding; never claim a remedy without grounding it in a case_id and either a turn or a ledger id-stub.
  • Escalate cap-widening or authority-widening remedies, and any critical finding, to the human ops lane; never route them as routine tightens.
  • Stop cleanly with needs_more_evidence or needs_human; never fake a ready decision.

Worked example

Open the data-store read for one agency over the last seven days. Fold forty-two events; thirty-eight advanced, two parked in awaiting_approval, two refused. seal_rate is healthy at 0.95; escalation_backlog is two; cap_usage_pct is concerning at 82 percent against the supplied baseline. Emit one intervention finding naming policy-author with the remedy's grounding turn numbers, and seal the verdict as degraded. The next operator turn calls policy-author with this finding as input.

When a fresh agency has zero case events over the period, return decision: needs_more_evidence, health_verdict.status: degraded, an empty findings list, no intervention findings, and one refusal with when: no_case_events.

Current native execution

Use data_source_uri to choose the case store. An unbound local://... URI uses local SQLite; a hosted source requires an explicit operator-selected binding. This package ships the exact canonical Receipt Query 0.6.5 dependency. evaluate reads current native store envelopes and receipt evidence, then calls the same deterministic fold calculation used for supplied evidence. The calculation adds no local seal or receipt claim: Runx alone signs the run.

Published execution profile

The execution profile published with 0.1.3, shown as its exact bytes.

Runners
  • evaluate
  • fold
  • source-handoff
Profile digestsha256:aa5c5cbb24ca5c618e68420fa5f9c74f4d67d1b60f5c95adcc421bc81c805360
skill: agency-health
version: 0.1.3
catalog:
  publisher: jdjioe5-cpu
  kind: graph
  audience: operator
  visibility: public
  role: context
  category: ops
connectors:
  store:
    operations:
      - events.read
      - projection.read
runners:
  source-handoff:
    inputs:
      data_source_uri:
        type: string
        required: true
        description: Operator-selected data-source URI. A local:// URI selects local SQLite.
    steps:
      - id: source-handoff
        agent:
          role: operator
          task: agency-health-source-handoff
        inputs:
          data_source_uri: $input.data_source_uri
        outputs:
          source_resolution:
            required: false
  evaluate:
    inputs:
      data_source_uri:
        type: string
        required: true
        description: Operator-selected data-source URI for the agency case.
      case_id:
        type: string
        required: true
        description: Live agency case aggregate id.
      period:
        type: json
        required: false
        description: ISO since/until bounds applied while folding the case stream.
      health_baseline:
        type: json
        required: false
        description: Declared stuck-day, cap-pressure, and refusal-spike thresholds.
      ledger_filter:
        type: json
        required: false
        description: Ledger read filter; the health packet receives receipt id-stubs only.
    steps:
      - id: case_projection
        operation: store/projection.read
        input:
          data_source_uri: $input.data_source_uri
          resource: agency_cases
          aggregate_id: $input.case_id
      - id: ledger_read
        skill: ./skills/runx/receipt-query/0.6.5
        runner: read
        inputs:
          question: Which governed agency receipts ground health signals for this live case period?
          filter: $input.ledger_filter
      - id: case_events
        operation: store/events.read
        input:
          data_source_uri: $input.data_source_uri
          resource: agency_cases
          aggregate_id: $input.case_id
      - id: evaluate
        skill: ./
        runner: fold
        inputs:
          period: $input.period
          health_baseline: $input.health_baseline
          projection_packet: $steps.case_projection.provider_operation.result
          event_packet: $steps.case_events.provider_operation.result
          ledger_packet: $steps.ledger_read.ledger_answer_packet
  fold:
    inputs:
      projection_packet:
        type: json
        required: true
      event_packet:
        type: json
        required: true
      ledger_packet:
        type: json
        required: true
      period:
        type: json
        required: false
      health_baseline:
        type: json
        required: false
    steps:
      - id: fold
        tool: { module: run.mjs, export: evaluateAgencyHealth }
        outputs:
          schema: string
          decision: string
          health_verdict: object
          intervention_findings: array
          refusals: array
        inputs:
          projection_packet: $input.projection_packet
          event_packet: $input.event_packet
          ledger_packet: $input.ledger_packet
          period: $input.period
          health_baseline: $input.health_baseline
        artifacts:
          wrap_as: agency_health_packet
    default: true
harness:
  files: [fixtures/support/evaluate/SKILL.md, fixtures/support/evaluate/run.yaml]
  cases:
    - name: concerning-agency-sealed
      runner: fold
      inputs:
        projection_packet:
          operation: projection.read
          status: read
          aggregate_id: case-health-harness-concerning
          after_version: 8
          projection:
            aggregate_id: case-health-harness-concerning
            version: 8
            event_count: 8
        event_packet:
          operation: events.read
          status: read
          aggregate_id: case-health-harness-concerning
          after_version: 8
          rows:
            - version: 1
              committed_at: 2026-07-01T08:00:00Z
              event:
                payload:
                  type: opened
                  status: advanced
                  charter:
                    limits:
                      max_acts: 20
                      max_spend: 1000
                    cumulative:
                      acts: 17
                      spend: 720
            - version: 2
              committed_at: 2026-07-01T09:00:00Z
              event:
                payload:
                  status: advanced
            - version: 3
              committed_at: 2026-07-01T10:00:00Z
              event:
                payload:
                  status: awaiting_approval
            - version: 4
              committed_at: 2026-07-02T09:00:00Z
              event:
                payload:
                  status: advanced
            - version: 5
              committed_at: 2026-07-02T10:00:00Z
              event:
                payload:
                  status: awaiting_approval
            - version: 6
              committed_at: 2026-07-03T09:00:00Z
              event:
                payload:
                  status: sealed
            - version: 7
              committed_at: 2026-07-04T09:00:00Z
              event:
                payload:
                  status: resolved
            - version: 8
              committed_at: 2026-07-05T09:00:00Z
              event:
                payload:
                  status: advanced
        ledger_packet:
          matched_receipts:
            - receipt_id: rcpt_agency_health_001
              status: sealed
            - receipt_id: rcpt_agency_health_002
              status: refused
        period:
          since: 2026-07-01T00:00:00Z
          until: 2026-07-10T23:59:59Z
        health_baseline:
          threshold_days_stuck: 2
          cap_pressure_pct: 80
          refusal_spike_rate: 0.1
      expect:
        status: sealed
        receipt:
          schema: runx.receipt.v1
      operator_journeys:
        - mode: standalone
          confusors:
            - ops-desk
            - run-history
          request: Grade the health of this agency case over the last period.
          expected_outcome: Return a typed health bundle folded from the case projection and receipt ledger aggregates.
        - mode: composed
          request: Continue this agency-health work from evidence already gathered upstream.
          expected_outcome: Return a typed health bundle folded from the case projection and receipt ledger aggregates.
          prior_evidence:
            - The case projection and ledger aggregates already read for this period.
          must_not_repeat:
            - Do not re-read or re-fold the ledger already summarized.
    - name: no-case-events-stop
      runner: fold
      inputs:
        projection_packet:
          operation: projection.read
          status: read
          aggregate_id: case-health-harness-empty
          after_version: 0
          projection:
            aggregate_id: case-health-harness-empty
            version: 0
            event_count: 0
        event_packet:
          operation: events.read
          status: read
          aggregate_id: case-health-harness-empty
          after_version: 0
          rows: []
        ledger_packet:
          matched_receipts: []
        period:
          since: 2026-07-01T00:00:00Z
          until: 2026-07-10T23:59:59Z
      expect:
        status: sealed
        receipt:
          schema: runx.receipt.v1
    - name: source-handoff-needs-agent
      runner: source-handoff
      inputs: {}
      expect:
        status: failure
        receipt:
          schema: runx.receipt.v1

Published package and test evidence.

This exact version passed its recorded harness run: 4 checks passed · 0 failed.

Test result

Harness resultPassed
Tested version0.1.3
Recorded result4 checks passed · 0 failed
Result sourceRun by the Runx registry at publication
Suiterunx-harness
Test recorded
Declared cases3
Test recordOpen the recorded run
Inspect receipt referencessha256:dc813ceea3aa2d66d9f02dbbd527fdeb3ca4d54d35dcf02622b9a557622f7598sha256:9fe86c7cfe439e1320b4d3f796dc7cd674088f258332c1946feeb0e514c61ea8sha256:1e5d7d74e38cda7519f9deb73672a46855b34b16e80b00a90a8b22ad13afeeb9sha256:b904a78c988fdbe452ed8c89eff9c01c6bfafe621571067b7a578a6312daee50

Package identity

Published revision0.1.3
Content digestsha256:edb1c7a02eea1e85eb0b5ee3d8e1e0035453e78d0d8d5569cdf93a5d65328c06
SKILL.md digestsha256:ce0892d8c096f8b892d6cde0c90d9e57f82d07b64493a1422f49e0951612c398
Execution profile digestsha256:aa5c5cbb24ca5c618e68420fa5f9c74f4d67d1b60f5c95adcc421bc81c805360
Publisher identityUnverified publisher · guoyunfeng
Trust tierCommunityPublished through the registry without publisher verification. This tier is not a code assessment.
Attestations
  • Publisher · Declaredguoyunfeng · 25 Oct 2026
Source provenanceNot published with this version

Version history

  1. 0.1.3ViewingContent digest sha256:edb1c7a02eea1e85eb0b5ee3d8e1e0035453e78d0d8d5569cdf93a5d65328c06
  2. sha-1ef796b50be3Content digest sha256:1ef796b50be305a535a294af66fb8e329cec4e9bc739172475abc82c632796a3
  3. sha-9ca798871f8dContent digest sha256:9ca798871f8dcd84297fec76ebf07aa61171ddb0f506a9ad04f26913e55f1b3e
  4. sha-f778c63767cbContent digest sha256:f778c63767cb90ca1c5ff66f8e49637ec97b95ffe6c24e6c931b3c7a859cb727
  5. sha-97ff499f1248Content digest sha256:97ff499f1248768c8b4819429cc4d3e8eeefe2715668bdfa4bd7fb730d4e5b38