Examples

End-to-end flows showing ANCC tools in action. Not theory — working loops.

1. First-order loop: deployscope → pgpulse → WO → PR

Trigger: Scheduled deployscope scan detects a degraded PostgreSQL deployment.

Step 1: deployscope reports deployment health.

deployscope status --namespace prod --format json
{
  "deployments": [
    {
      "name": "api-server",
      "namespace": "prod",
      "replicas": {"desired": 3, "ready": 3},
      "status": "healthy"
    },
    {
      "name": "postgres-primary",
      "namespace": "prod",
      "replicas": {"desired": 1, "ready": 1},
      "status": "degraded",
      "conditions": [{"type": "ReplicationLag", "status": "True"}]
    }
  ],
  "provenance": {
    "deployments[*].replicas": "observed",
    "deployments[*].status": "inferred",
    "deployments[*].conditions": "observed"
  }
}

Decision: Agent reads JSON. status: "degraded" + condition ReplicationLag → hand off to diagnostic tool (following the Handoffs contract).

Step 2: pgpulse runs detailed diagnostics.

pgpulse check --host postgres-primary.prod --format json
{
  "host": "postgres-primary.prod",
  "status": "degraded",
  "checks": [
    {"name": "replication_lag", "status": "fail", "value_seconds": 45, "threshold_seconds": 10},
    {"name": "connections", "status": "pass", "active": 12, "max": 100},
    {"name": "disk_usage", "status": "pass", "percent": 62}
  ],
  "recommended_action": "investigate replication lag on standby",
  "provenance": {
    "checks[*].value_seconds": "observed",
    "checks[*].threshold_seconds": "declared"
  }
}

Decision: Agent reads diagnostics. Replication lag at 45s (threshold 10s). Creates a WO.

Step 3: Agent creates structured work order.

{
  "wo_version": "1",
  "id": "wo-a3f8b2c1",
  "incident_id": "repl-lag-prod-001",
  "target": {"host": "postgres-primary.prod", "scope": "/etc/postgresql/"},
  "observations": [
    {
      "type": "config_modified",
      "severity": "high",
      "detail": "replication lag 45s exceeds 10s threshold on standby",
      "data": {"lag_seconds": 45, "threshold": 10}
    }
  ],
  "constraints": {"allow_paths": ["/etc/postgresql/"], "max_steps": 5},
  "proposed_goals": ["investigate and resolve replication lag on standby"]
}

Step 4: Orchestrator dispatches → execution agent creates PR → chainwatch gates → human approves.

Human gate: The PR modifies postgresql.conf to adjust wal_keep_size. Human reviews diff, approves. Chainwatch records the approval in the audit log.

2. Meta-cognition loop: inspector → pattern → improvement WO

Trigger: Quality inspector detects recurring gap across WOs.

Step 1: Over 30 days, nullbot creates 7 WOs for ClickHouse clusters. 5 of them lack replication lag as an observation — nullbot's ClickHouse template does not check for it.

Step 2: Inspector's pattern buffer accumulates observations:

{
  "pattern": "missing_field:replication_lag",
  "target": "nullbot",
  "occurrences": 5,
  "wo_ids": ["wo-c1d2e3f4", "wo-a5b6c7d8", "wo-e9f0a1b2", "wo-c3d4e5f6", "wo-a7b8c9d0"],
  "category": "coverage_gap"
}

Step 3: Pattern crosses threshold (>= 3). Inspector emits a tooling_improvement WO:

{
  "kind": "tooling_improvement",
  "tooling_target": {
    "tool": "nullbot",
    "component": "templates",
    "path": "runbooks/clickhouse.yaml",
    "reason": "pattern 'coverage_gap' detected 5 times",
    "evidence": ["wo-c1d2e3f4", "wo-a5b6c7d8", "wo-e9f0a1b2", "wo-c3d4e5f6", "wo-a7b8c9d0"]
  },
  "improvement_class": "A"
}

Step 4: chainwatch evaluates: nullbot is a protected tool → REQUIRE_APPROVAL (Class A = standard review). Human approves. Template updated. Nullbot now detects replication lag on ClickHouse clusters.

3. Governance loop: binding directive → resolution

Trigger: Governance agent runs ancc validate across the ecosystem.

Step 1: Governance agent detects scope pressure on deployscope:

{
  "check": "scope_pressure",
  "tool": "deployscope",
  "evidence": "ancc validate: tool has 12 commands; consider splitting into focused tools",
  "convention_ref": "extend-vs-new-tool"
}

Step 2: Creates binding directive WO:

{
  "kind": "binding_directive",
  "directive": {
    "binding": true,
    "authority": "governance_agent",
    "deadline": "2026-04-15T00:00:00Z",
    "escalation": "notify_human",
    "evidence": ["ancc validate: scope-pressure warning — 12 commands"],
    "convention_ref": "extend-vs-new-tool",
    "resolution_options": ["implement", "reject_with_reason", "defer_with_plan"]
  }
}

Step 3: Assigned agent evaluates and resolves. Three options:

Option A — Implement:

{
  "resolution": {
    "type": "implement",
    "reasoning": "Split deployscope-status (read-only) from deployscope-deploy (write)",
    "evidence": ["command analysis: 7 read commands, 5 write commands — clear domain split"],
    "timestamp": "2026-04-01T10:00:00Z"
  }
}

Option B — Reject with reason:

{
  "resolution": {
    "type": "reject_with_reason",
    "reasoning": "All 12 commands operate on the same K8s API — splitting would fragment the trust boundary",
    "evidence": ["trust boundary analysis: single kubeconfig, single RBAC role"],
    "timestamp": "2026-04-01T10:00:00Z"
  }
}

Rejection escalates to human for final decision.

Option C — Defer with plan:

{
  "resolution": {
    "type": "defer_with_plan",
    "reasoning": "Split planned after v2.0 release — current sprint is stability-focused",
    "evidence": ["release plan: v2.0 targeted for 2026-05-01"],
    "timestamp": "2026-04-01T10:00:00Z"
  }
}

Deferral requires human approval of the new deadline.

4. Kill path: genesis loop → abandon → improvement WO

Trigger: Agent encounters a gap — no tool reports container image provenance in the deployment pipeline.

Step 1: Agent searches for existing tools.

ancc search "container image provenance"
# → deployscope: partial overlap — reports image tags but not provenance chain
# → vaultspectre: no overlap — secrets only

Step 2: Agent runs the extend-vs-new rubric against deployscope.

Extend-vs-new rubric for deployscope:
  Same primary job?      No — deployscope diagnoses deployments, not supply chain
  Same trust boundary?   No — provenance requires registry credentials, not kubeconfig
  Same input world?      No — OCI registries, not Kubernetes API
  Same output contract?  Partial — JSON, but different schema domain
  Weaken scope?          Yes — deployscope gains a second trust boundary

Result: 2 of 5 = NEW TOOL (threshold: all 5 must be yes to extend)

Step 3: Agent scaffolds the new tool.

ancc scaffold image-provenance --type scanner
cd image-provenance && go mod tidy

Step 4: During SKILL.md authoring, agent realizes deployscope already exposes image_digest in its JSON output — the gap is narrower than expected. The missing piece is attestation verification, not image listing.

ancc validate .
# 24 pass, 2 fail, 4 warn
# FAIL: skill-md-commands — no commands implemented yet
# FAIL: not-do-overlap — 4 of 6 "does NOT do" items overlap with deployscope

Decision: Validation reveals the tool would overlap significantly with deployscope. The actual gap — attestation verification — is one command, not a whole tool. Agent abandons genesis.

Step 5: Agent files an improvement WO against deployscope instead.

{
  "kind": "tooling_improvement",
  "tooling_target": {
    "tool": "deployscope",
    "component": "commands",
    "reason": "missing attestation verification — gap narrower than expected",
    "evidence": ["rubric result: 2/5", "ancc validate: not-do-overlap on abandoned image-provenance"]
  },
  "improvement_class": "B",
  "proposed": "add 'deployscope verify-attestation' command for image provenance checks"
}

Outcome: No new tool created. The scaffolded directory is deleted. The gap is addressed by extending the existing tool — exactly what the kill path is designed to produce.

5. End-of-life: deprecation → revocation

Trigger: Governance staleness check detects pg-bloat-checker has no commits in 90 days and no reported usage.

Step 1: Governance creates a binding directive.

{
  "kind": "binding_directive",
  "directive": {
    "binding": true,
    "authority": "governance_agent",
    "evidence": ["staleness: 92 days since last commit", "usage: 0 invocations in 60 days"],
    "resolution_options": ["justify_existence", "transfer_ownership", "archive"]
  }
}

Step 2: Assigned agent evaluates. pgpulse now covers bloat detection (added in v1.4.0). pg-bloat-checker is fully superseded.

{
  "resolution": {
    "type": "archive",
    "reasoning": "pgpulse v1.4.0 covers bloat detection — pg-bloat-checker is redundant",
    "evidence": ["pgpulse SKILL.md: 'check --type bloat' added in v1.4.0", "0 downstream handoffs reference pg-bloat-checker"]
  }
}

Step 3: Human approves. Revocation executes:

# SKILL.md updated with revocation notice
## Revoked
This tool is archived. Use pgpulse check --type bloat instead.
Revoked: 2026-04-15. Reason: superseded by pgpulse v1.4.0.

# GitHub repo archived, topic removed
gh repo archive yourorg/pg-bloat-checker
gh repo edit yourorg/pg-bloat-checker --remove-topic ancc

Outcome: Tool removed from ecosystem cleanly. Governance directive resolved. No orphan references — downstream handoff contracts already pointed to pgpulse.

6. Real world: agent bootstraps a workspace from 5 tools

Trigger: A human gives an agent one prompt: "Set up a secure, automated workspace." No explanation of what the tools are, how they work, or what flags to use.

What the agent does:

# 1. Host hardening — reads SKILL.md, follows steps
clawhub install host-hardening
# Agent reads: SSH key-only, UFW, fail2ban, credential perms
# No guessing. SKILL.md declares every command and exit code.

# 2. Chainwatch — runtime safety gate
clawhub install chainwatch
# Agent reads SKILL.md: installs binary, configures denylist mode,
# sets up intercept proxy as systemd service.

# 3. Pastewatch — secret redaction
clawhub install pastewatch-mcp
# Agent reads SKILL.md: installs binary, sets up MCP server,
# verifies redaction with a test secret.

# 4. News digests — information pipeline
clawhub install noisepan-digest
# Agent reads SKILL.md: installs noisepan + entropia,
# configures RSS feeds, sets up morning/afternoon cron jobs.

# 5. Context hygiene — session management
clawhub install context-hygiene
# Agent reads SKILL.md: applies file budgets, collapse cycle,
# adds CONTEXT.md, trims workspace to budget.

What didn't happen:

Why this works: Each tool follows the same convention. The agent doesn't need tool-specific knowledge — it reads the same contract format every time. Install, configure, verify, move to next. The tools compose because they all speak the same language.

This is not a demo. This is a production workspace setup that runs in under 10 minutes with zero human intervention after the initial prompt.