HK-hub/AgentSkills / ax-audit
ax-audit
VerifiedAudits agentic applications for architecture and trust: tool parity, tool granularity, context injection, completion signals, approval gates, confidence cues, escape hatches, intent handshakes, memory visibility, and adaptive canvases. Produces a ship-readiness verdict plus an AX Relationship Summary. Use when reviewing agentic feature PRs or asking "is this agent-native", "AX review", "critique this AI feature", "does this earn user trust", or "audit this for AX". For traditional frontend UX use ui-audit.
rules-arch/comm-no-completion-signal.md
View on GitHub---
title: Agent completion detected by heuristic instead of explicit signal
slug: comm-no-completion-signal
category: comm
defaultTier: release-blocker
surfaces: agent-tool-execution, agent-dashboard
agent-native-principle: Parity (agent-UI communication)
detection: code-auditable
related: comm-no-progress-visibility
---
## Agent completion detected by heuristic instead of explicit signal
Orchestrator detects "done" by counting idle iterations, checking output files, or waiting for a timeout. A thinking pause looks like completion; slow API calls trigger premature termination. Violates Parity: the UI must receive an explicit signal, not guess.
## What goes wrong
Agent researches a complex question. Makes 3 tool calls, then pauses 8 seconds composing a response. Orchestrator counts 2 idle iterations, hits `maxIdleIterations: 2`, terminates. User sees a truncated answer.
## Detection
**Surfaces:** agent-tool-execution, agent-dashboard
**Static signals:**
1. Find the orchestrator control loop that decides continue/stop.
2. Check for idle-counting, timeout-based completion, or file-existence as termination.
3. Flag any heuristic used as the primary completion signal.
**Concrete commands:**
```bash
rg '(consecutiveIdle|noToolCall|idleCount|maxIdle)' --type=ts src/
rg '(setTimeout|setInterval)' --type=ts -A 5 src/ | rg '(done|complete|finish|terminate)'
rg '(stop_reason|end_turn|shouldContinue)' --type=ts src/
```
**False-positive guards:**
- Skip files with `// ax-audit-ignore:comm-no-completion-signal`.
- Skip timeout logic alongside an explicit signal (both `stop_reason` AND `setTimeout`).
- Skip test files and fixtures.
## Fix
```tsx
// before: heuristic completion
let idle = 0;
while (idle < 3) {
const res = await llm.chat(messages);
if (!res.toolCalls.length) { idle++; continue; }
idle = 0;
await executeTools(res.toolCalls, messages);
}
// after: explicit signal via stop_reason or completion tool
while (true) {
const res = await llm.chat(messages);
if (res.stopReason === "end_turn") return { status: "complete", content: res.content };
for (const tc of res.toolCalls) {
if (tc.name === "task_complete") return { status: "complete", summary: tc.args.summary };
messages.push({ role: "tool", content: await executeTool(tc) });
}
}
```
## Default tier and overrides
**Defaults to:** `release-blocker`
| Surface | Tier |
|---|---|
| Agent tool execution | release-blocker |
| Agent dashboard | release-blocker |
| Agent chat | fix-this-sprint |
| Agent config | backlog |
## Examples
**Anti-pattern (fails):** `while (noToolCalls < 2)`: thinking pause triggers premature termination.
**Applied (passes):** `if (res.stopReason === "end_turn") return res.content`: explicit model signal.
## Suppression
```tsx
// ax-audit-ignore:comm-no-completion-signal, timeout is safety net, primary signal is stop_reason
const SAFETY_TIMEOUT = 120_000;
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |