agentic-system-audit
Skill219 starsChanged 15 days agoApache-2.0View on GitHub
Audit an agentic software system end to end for contradictions, gaps, inconsistent contracts, capability mismatches, instruction conflicts, ambiguous results, stale documentation, unsafe lifecycle behavior, redundant guidance, missing enforcement, test blind spots, and architectural drift. Use primarily for Pi Herdsman and comparable agent/tool systems with prompts, tools, subagents, lifecycle state, dynamic results, configuration, documentation, and multiple instruction layers.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docker/AGENTS.mdAGENTS.md
- simplification-auditSkill
- testingSkill
- agentsSkill
- agent-definitionsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
47 rules. About 0 are common, 44 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈44
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Prefer deletion, consolidation, one canonical owner, and the smallest durable correction.
- Distinctive: line 45
If no suitable Agent exists, investigate and synthesize locally using permitted read-only capabilities.
- Very specific: line 48
Start with the current list_agents roster when available.
- Distinctive: line 111
Not every step applies to every finding.
- Distinctive: line 117
Do not infer semantic equivalence from similar field names.
- Distinctive: line 121
Do not confuse representability with reachability.
- Distinctive: line 125
If the harmful state cannot occur on the claimed path, dismiss or narrow the candidate.
- Distinctive: line 135
Never assume renderer-visible metadata is model-visible.
- Distinctive: line 139
If a material conclusion depends on upstream behavior, resolve it for the repository's supported version range.
- Distinctive: line 150
Do not substitute latest behavior for the supported range.
- Distinctive: line 154
When claiming a test gap or proposing a regression:
- Distinctive: line 162
Do not count assertion volume as coverage.
- Distinctive: line 166
Every material candidate becomes exactly one of:
- Distinctive: line 174
Do not use it for an answerable question that was not investigated.
- Distinctive: line 306
Check package files, discovery, README links, AGENTS/maintainer guidance, validation scripts, dead compatibility/configuration, and removed …
- Distinctive: line 314
Use external research when:
- Distinctive: line 332
If web capability is unavailable:
- Distinctive: line 336
use other authoritative read-only evidence.
- Distinctive: line 339
Do not add dependencies or require optional web tooling to run the audit.
- Distinctive: line 454
Create another label only when none fits.
- Distinctive: line 463
Do not inflate severity because a finding is interesting.
- Distinctive: line 482
Do not report architectural preference as a defect.
- Distinctive: line 486
Use these to find candidates.
- Distinctive: line 489
Can the recipient act on this?: Check only what that consumer actually receives.
- Distinctive: line 496
What was deleted but still has a shadow?: Search docs, tests, package files, comments, compatibility branches, fields, examples.
- Distinctive: line 497
Would this test fail for the old bug?: Prefer one discriminating regression over many weak assertions.
- Distinctive: line 499
Is the same fact sent twice?: Check model/human identity, paths, model, state, warnings, next-action text.
- Distinctive: line 504
Start from entry points and contract surfaces.
- Distinctive: line 505
Search ownership before opening large files.
- Distinctive: line 507
Keep delegated investigators inside their lenses.
- Distinctive: line 510
Verify candidate findings, not every inspected line.
- Very specific: line 511
Do not spawn agents merely to confirm No findings.
- Distinctive: line 512
Use an independent second pass only for an uncertain P0/P1 or disputed architecture.
- Distinctive: line 513
Do not assign implementation work during diagnosis.
- Distinctive: line 514
Stop when the contract matrix is covered and new searches produce no materially new issue class.
- Distinctive: line 562
Do not bury findings in prose.
- Distinctive: line 635
Never put answerable material uncertainty here.
- Distinctive: line 646
every applicable contract chain has scoped coverage and honest limitations.
- Very specific: line 654
only genuinely unresolved claims are Unverified risk.
- Distinctive: line 655
no answerable material question was deferred to follow-up.
- Distinctive: line 659
If a check fails, reconcile the affected finding before finalizing.
- Distinctive: line 665
Do not automatically fix findings.
- Distinctive: line 667
If implementation is requested later:
- Distinctive: line 669
use the audit report as canonical scope.
- Distinctive: line 670
use the smallest capable execution Agent, or work locally when permitted.
- Distinctive: line 671
keep unrelated cleanup out unless it simplifies the same proven root cause.
- Distinctive: line 673
run focused and repository validation appropriate to the change.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agentic System Audit
Audit the whole agentic contract, not isolated files.
Find where code, prompts, tools, state, results, docs, tests, configuration, packaging, or runtime capabilities disagree or leave the next safe action ambiguous.
Prefer deletion, consolidation, one canonical owner, and the smallest durable correction.
This is a read-only audit. Do not modify the repository.
Scope and execution boundary
Establish the actual audited snapshot before investigating: exact commit SHA for committed source; base SHA and included staged, unstaged, or untracked changes (with an exact diff or snapshot reference) for a working tree; base and head SHAs for a PR. Attribute CI, tests, and prior reviews to the revisions they actually cover. Record relevant supported upstream versions.
During scoping, identify relevant active ADR decisions and follow their supersession chains. Runtime and supported external contracts establish actual behavior; active decisions constrain architectural recommendations, while superseded decisions explain history rather than current semantics. Revalidate applicable decisions when closing material findings.
Permission to inspect source does not authorize executing it. Run a targeted smoke only when execution is authorized and a disposable environment is verified isolated from the audited checkout and live user resources, including configuration, credentials, and processes. Otherwise use read-only evidence and report any material unresolved uncertainty.
Apply Herdsman-specific checks only where the target has equivalent capabilities or lifecycle concepts; otherwise mark those checks not applicable.
Operating model
Own the audit and final verdict. Delegate bounded, independent evidence work when a suitable read-only Agent is available and delegation is useful. Select Agent definitions by their effective capabilities, never by a bundled name. Respect available tools, definition allowlists, ownership, and execution depth. If no suitable Agent exists, investigate and synthesize locally using permitted read-only capabilities; report any material capability gap.
Start with the current list_agents roster when available. Refresh it if
configuration changes. A configured child allowance does not guarantee that
the child is available or that the current controller can delegate.
Coverage lenses
Cover three concerns, delegating independent lenses when useful:
- A — runtime: producers, validation, state, identity, lifecycle, and reachability;
- B — instructions: instruction ownership and effective capabilities;
- C — consumers: model/UI projections, docs, tests, and package glue.
External/API research is conditional on the research trigger and actual available tools. One capable Agent may cover multiple lenses; three Agents are not required. Avoid redundant analysis between the audit owner and delegated work.
Delegated audit contract
Pass each investigator the relevant lens, canonical evidence, and the following rules; do not assume it receives this skill automatically:
Audit the assigned area as part of one agentic system. Remain strictly read-only.
Before reporting any P0-P2 finding:
- identify the semantic source and relevant producers;
- prove the disputed state/value is reachable on a production path when behavior is at issue;
- trace it through every consumer boundary relevant to the claim;
- resolve material upstream/runtime assumptions for the repository's supported versions using primary evidence when available;
- verify that a claimed regression check would fail for the old behavior.
Do not report representable-but-unreachable states as defects. Do not treat differently named fields as equivalent without tracing semantics. Do not leave an answerable material uncertainty as follow-up.
If required evidence genuinely cannot be established, report a bounded
Unverified risk, not a definitive finding.Compare root/parent/child, definition/session/fork, model/UI, success/failure/recovery, configured/effective capability, and static/dynamic guidance.
Return candidate findings with exact evidence and the smallest durable correction.
The audit owner independently verifies and reconciles material candidates, de-duplicates findings, and returns one report using the required output contract. Pass supplied canonical diffs, snapshots, specs, or source artifacts to investigators instead of making them rediscover the same material.
Material finding closure
Each lens returns candidate evidence. The audit owner closes candidates before severity is assigned, rechecking applicable active ADR constraints for architectural findings and corrections.
Trace every boundary used by the claim. For result/state findings, prefer:
semantic source
→ producer
→ validation/normalization
→ runtime/durable state
→ structured/public projection
→ model consumer
→ human/API consumer
→ docs/testsNot every step applies to every finding.
Provenance
Find where the disputed fact originates and how it changes.
Do not infer semantic equivalence from similar field names. Trace producers and scope first.
Reachability
Do not confuse representability with reachability.
A type, schema, fixture, or doc proves a value can be described. A behavioral finding requires a production path that can actually produce the material state/value.
If the harmful state cannot occur on the claimed path, dismiss or narrow the candidate.
Consumer contract
Establish what the actual consumer receives.
For model-visible claims, determine whether the model gets content, details, both, or another transformation.
For human claims, distinguish compact TUI, expanded TUI, plain/RPC/JSON, and logs/files.
Never assume renderer-visible metadata is model-visible.
External contract
If a material conclusion depends on upstream behavior, resolve it for the repository's supported version range.
Prefer:
supported-version primary source/API/type contract
→ supported-version official docs
→ installed dependency source
→ authorized isolated runtime smoke only if still unresolvedDo not substitute latest behavior for the supported range. Do not require a smoke test when source plus local integration already establishes the behavior.
Test discrimination
When claiming a test gap or proposing a regression:
Would this test fail for the old bug and pass for the corrected behavior?
For lifecycle/recovery bugs, pair the harmful case with its nearest legitimate opposite when that distinction matters, such as a stale working parent versus a parent correctly waiting on unresolved child work.
Do not count assertion volume as coverage.
Closure outcomes
Every material candidate becomes exactly one of:
- Verified finding: evidence establishes defect and consequence.
- Dismissed/narrowed: intentional, unreachable, semantically different, or immaterial.
Unverified risk: evidence genuinely cannot be established with available read-only capabilities.
An Unverified risk must state known evidence, missing evidence, version/runtime scope, why it matters, and one exact resolver.
Do not use it for an answerable question that was not investigated.
Lens A: runtime contracts and reachability
Own:
Can this state/value actually happen, where is it produced, and what runtime contract governs it?
Prove this liveness invariant for unresolved directly-owned assignments:
Every unresolved directly-owned assignment must either remain capable of making progress without its owner, or have a reliable reconciliation path that brings the exact owner back when action is required.
Trace:
schema/input
→ validation
→ effective configuration
→ execution
→ runtime/durable state
→ public result
→ next legal actionCheck:
- schema vs runtime acceptance/rejection;
- defaults, normalization, mutually exclusive fields;
- validation before mutation;
- sibling-path validation consistency;
- logical label, definition, Pi session, owner, request, ask, run, workspace, tab, pane, Herdr identity;
- stale/replacement identity binding;
- public state vs actual action eligibility;
working,blocked,settling,unknown, steerability, staleness, pending ask/result, child gating, cleanup convergence;- unresolved-work liveness across owner idle/busy state, failed attention delivery, reminder recurrence, episode termination, and restart;
- parent/child distinctions where a working parent may itself be stale while a legitimately waiting parent projects blocked;
- fresh delegation, continuation, fork, replacement, completion, parent-child completion, ask/reply, close, rollback, restart/recovery;
- source identity, request correlation, result paths, truncation, cleanup warnings, primary/cleanup errors, rollback/retry state.
Return exact production paths, reachability evidence, and candidate mismatches. Do not decide architecture from local evidence alone.
Lens B: instruction and capability stack
Own:
Who owns this rule, and is it truthful for the effective execution context?
Map:
system/base prompt
tool description
controller scope
shared agent prompt
role body
body @file
skills
dynamic success/error guidance
human docsFor each normative rule, find its intended single owner.
Flag:
- zero owner: instruction gap;
- multiple authoritative owners:
DUPLICATE_AUTHORITY; - conflicting owners:
CONTRADICTION; - wrong owner:
AUTHORITY_LEAK.
Compare:
definition
→ override composition
→ effective tools/skills/extensions/context
→ launch args
→ actual role/depth
→ model instructions
→ presentationFind:
GHOST_CAPABILITY;HIDDEN_CAPABILITY;- root/parent/leaf capability mismatches;
- metadata advertising removed capabilities;
- infrastructure accidentally removable by normal policy;
- user-configurable policy treated as mandatory infrastructure;
- impossible or underspecified instructions;
- global policy embedded in role prompts;
- API mechanics redundantly taught by prompts/skills.
Return exact instruction text, owner, effective runtime evidence, and candidate conflicts.
Lens C: presentation, docs, tests, and repository glue
Own:
Where does runtime truth go, what does each consumer actually see, and do docs/tests describe that contract?
Model-visible presentation
Inspect list, assignment/steer/reply/close acknowledgements, completion delivery, errors, and truncation.
Ask:
Using only what the model actually receives, can it identify the source, understand the state, and choose the next legal action?
Flag missing correlation, hidden material details, ambiguous terminology, duplicated IDs, static policy repeated on every result, or missing dynamic next-action evidence.
For opacity candidates, trace projection semantics, not just field names.
Human presentation
Compare status widget, definitions view, completion renderer, warnings, compact/expanded views, and any plain/API surface.
Find hidden failures, duplicated data, display identity reused as machine identity, or UI claims stronger than runtime evidence.
Documentation
Find shipped-but-undocumented behavior, documented-but-unshipped behavior, duplicate canonical owners, stale terminology, rejected examples, and implementation details presented as public contracts.
Tests
Find public contracts without discriminating regressions, tests that pass for correct and broken behavior, mocks that cannot detect claimed integration failures, missing sibling invariants, and stale fixtures.
Repository/package glue
Check package files, discovery, README links, AGENTS/maintainer guidance, validation scripts, dead compatibility/configuration, and removed concepts that still ship or remain referenced.
Return projection chains, consumer visibility, docs/tests evidence, and candidate mismatches.
Research trigger
Research is conditional. Once triggered, verification is required when capability exists.
Use external research when:
a candidate likely to affect a P0-P2 finding, verdict, or remediation
depends on external API/runtime behaviorResearch input should contain only:
exact disputed assumption
supported version range
preferred primary source/repository
required direct answerRequire primary/official evidence, exact version relevance, and only material findings.
If web capability is unavailable:
- inspect installed/local upstream source;
- inspect pinned/supported dependency source where reachable;
- use other authoritative read-only evidence;
- otherwise return
Unverified risk.
Do not add dependencies or require optional web tooling to run the audit.
Cross-surface contract matrix
Cover each applicable chain.
Input
schema ↔ description ↔ validation ↔ errors ↔ docs ↔ testsCapability
definition ↔ override ↔ effective config ↔ launch ↔ role/depth ↔ tools/prompts ↔ presentationInstruction
controller ↔ shared prompt ↔ role body ↔ skills ↔ dynamic resultsIdentity
label ↔ definition ↔ session ↔ request ↔ owner ↔ Herdr identity ↔ result/error/UIState
runtime evidence ↔ public state ↔ steerability ↔ eligibility ↔ displayed state ↔ next actionCompletion
completion ↔ durable result ↔ result file ↔ owner message ↔ model content ↔ human rendering ↔ cleanupConfiguration
syntax ↔ parsing ↔ merge ↔ validation ↔ effective metadata ↔ runtime ↔ persistence/UI ↔ docsRecovery
failure ↔ retained evidence ↔ autonomous progress/attention owner ↔ wake/delivery ↔ recurrence/termination ↔ structured error ↔ model/human guidance ↔ retry boundaryDistribution
repository ↔ package manifest ↔ installed files ↔ discovery ↔ maintainer guidanceMandatory boundary comparisons
Check where applicable:
Controller depth
root | direct agent/parent | nested child/leaf | unmanaged sessionAgent generation
fresh | exact-session continuation | forkVisibility
model content | structured details | compact TUI | expanded TUI | plain/RPC/JSON | logs/filesOutcome
success | blocked | failure | rollback failure | close | cleanup pending | overflow | restart recoveryConfiguration
bundled | partial override | standalone global | empty fields | false | [] | invalidDefect taxonomy
Use consistently:
CONTRADICTION: authoritative surfaces prescribe incompatible behavior.GAP: required knowledge/behavior has no appropriate owner or result.GHOST_CAPABILITY: instructions/metadata claim unavailable capability.HIDDEN_CAPABILITY: required capability exists without enough safe guidance.DUPLICATE_AUTHORITY: one normative rule has multiple authoritative owners.AUTHORITY_LEAK: policy is owned by a layer that should not control it.CONTEXT_MISMATCH: rule is correct in one context and wrong in another.IDENTITY_AMBIGUITY: identity loses exact or single semantic meaning.STATE_AMBIGUITY: displayed/instructed state does not map cleanly to legal actions.RESULT_OPACITY: receiver lacks material source, state, correlation, outcome, or next-action evidence.FAIL_OPEN: missing/ambiguous evidence causes unsafe continuation.DRIFT: code, tests, docs, metadata, examples, or prompts describe different generations.TEST_BLIND_SPOT: material public contract lacks a discriminating regression.TOKEN_WASTE: repeated model context adds no decision value.DEAD_COMPLEXITY: compatibility/abstraction/state/configuration has no justified current use.UX_AMBIGUITY: human presentation obscures correct system behavior.
Create another label only when none fits.
Severity
- P0: unsafe/destructive behavior, wrong-target control, trust-boundary violation, data loss, or durable corruption.
- P1: materially wrong action, stuck lifecycle, broken delegation/control, or misunderstanding of an authoritative result.
- P2: meaningful confusion, drift risk, redundant authority, weak diagnostics, avoidable context cost, or recurring maintainer mistakes.
- P3: small cleanup, naming, presentation, or maintainability issue with little behavioral risk.
Do not inflate severity because a finding is interesting.
Evidence standard
A material cross-surface finding needs:
A: semantic behavior/claim + exact source
B: conflicting/missing behavior/claim + exact source
Connection: why A and B are the same contract crossing a boundary
Reachability: production path when behavior is at issue
Consequence: what can actually go wrong
Minimal correction: narrowest root ownerAn investigator's conclusion is evidence, not authority.
The audit owner independently verifies every P0/P1, every P2 affecting architecture/verdict/external assumptions, and any disputed conclusion.
Do not report architectural preference as a defect.
Audit heuristics
Use these to find candidates. They do not replace closure.
- Who owns this sentence? One normative rule should normally have one authoritative owner.
- Can the recipient act on this? Check only what that consumer actually receives.
- Can the agent do what it is told? Compare prompts to effective capability at every depth.
- Does runtime enforce the important part? Safety, ownership, identity, validation, and data-loss boundaries should not rely only on prompts.
- Does code know something the model does not? Inspect
details, hidden metadata, cleanup evidence, capability inference, state subconditions, correlation IDs. - Does the model know something code does not enforce? Separate strategy from invariants such as exact ownership, read-only, no overlap, or one-shot rules.
- What changes at continuation? Generation-time facts described as dynamically refreshed are suspect.
- What changes at root/child depth? Global policy projected differently by depth is suspect.
- What was deleted but still has a shadow? Search docs, tests, package files, comments, compatibility branches, fields, examples.
- Would this test fail for the old bug? Prefer one discriminating regression over many weak assertions.
- Can unresolved work disappear from attention forever? Prove either autonomous progress remains possible or reconciliation eventually wakes the exact responsible owner. Check hierarchy boundaries, owner idle/busy state, failed delivery, recurring versus one-shot attention, restart behavior, and episode termination.
- Is the same fact sent twice? Check model/human identity, paths, model, state, warnings, next-action text.
- Is this field mismatch semantic drift? Find all producers, scope, reachability, and consumers first.
Efficiency rules
- Start from entry points and contract surfaces.
- Search ownership before opening large files.
- Trace callers and producers before declaring a bug.
- Keep delegated investigators inside their lenses.
- Pass canonical artifacts instead of rediscovering them.
- Research only external assumptions that can change a material conclusion.
- Verify candidate findings, not every inspected line.
- Do not spawn agents merely to confirm
No findings. - Use an independent second pass only for an uncertain P0/P1 or disputed architecture.
- Do not assign implementation work during diagnosis.
- Stop when the contract matrix is covered and new searches produce no materially new issue class.
Optimize for useful evidence per agent, not agent count.
Required output
1. Verdict
Issue a verdict only after completing the required investigation for the
declared scope. Skipped available evidence means the audit is incomplete:
continue investigating; do not issue a verdict or reclassify the omission
as an Unverified risk.
For a completed audit, apply the first matching rule:
FAIL: at least one verified P0/P1 defect.PASS WITH FINDINGS: no verified P0/P1, but verified P2/P3 findings or material evidence genuinely unavailable after investigation.PASS: no findings or material unresolved risks within the completed scope.
State unavailable evidence and its potential consequence explicitly:
PASS WITH FINDINGS does not establish the absence of unverified
higher-severity defects. A scoped PASS does not imply whole-system verification.
2. Executive summary
At most five bullets.
3. Findings
Order by severity, then confidence.
[P1][CONTEXT_MISMATCH] Short title
Evidence:
- path:line ...
- path:line ...
Why it matters:
...
Minimal durable fix:
...
Confidence: highDo not bury findings in prose.
4. Instruction ownership map
Summarize meaningful ownership gaps/collisions across:
tool schema
tool description
controller scope
shared agent prompt
role body
skill
dynamic success guidance
dynamic error guidance
human docs5. Contract coverage
For:
input
capability
instruction
identity
state
completion
configuration
recovery
distributionreport:
status: verified | finding | not applicable | not verified
scope: what was actually tracedExample:
recovery | verified | startup rollback, retained cleanup evidence, retry markers
completion | finding | compact cleanup-warning projectionverified applies only to the stated scope. Use not verified for required evidence genuinely unavailable after investigation, not skipped available evidence. State exclusions from a bounded scope explicitly; do not claim whole-system PASS from partial verification.
6. Remediation order
Give the shortest dependency-aware sequence.
Prefer:
fix root contract once
→ delete duplicate authority
→ add/update one discriminating regression
→ update canonical docs7. Unverified risks
Include only genuinely unresolved material claims after the closure workflow. State known evidence, missing evidence, version/runtime scope, consequence, and exact resolver.
Omit when empty.
8. Non-blocking follow-up
Include only useful work not required to validate a material finding, such as a separate implementation task or non-material integration smoke.
Never put answerable material uncertainty here.
Omit when empty.
Finalization
Return the synthesized report without repeating completed review work.
Before returning, verify:
- the audited source snapshot and relevant active ADR constraints are established;
- every applicable contract chain has scoped coverage and honest limitations;
- effective capabilities, authority, identity, liveness, and legal next actions were assessed where applicable;
- P0/P1 findings have exact evidence;
- material P2 findings have closed evidence;
- result/state findings trace producer, reachability, and consumer semantics;
- material external assumptions were resolved for supported versions when possible;
- duplicate lens candidates were consolidated;
- fixes target root owners, not symptoms;
- only genuinely unresolved claims are
Unverified risk; - no answerable material question was deferred to follow-up;
- implementation remains separate from diagnosis;
- a verdict is issued only for completed investigation and follows the rules above.
If a check fails, reconcile the affected finding before finalizing.
Otherwise stop.
After the audit
Do not automatically fix findings.
If implementation is requested later:
- use the audit report as canonical scope;
- use the smallest capable execution Agent, or work locally when permitted;
- keep unrelated cleanup out unless it simplifies the same proven root cause;
- independently review the final diff against the audit findings;
- run focused and repository validation appropriate to the change.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

