ap-policies

ap-policies is a skill for Claude Code, Codex from agentproto/ts. It costs 83 tokens per session (1,067 once invoked), scanned A, original, Apache-2.0.

A completion-check tool that attaches an automated test or review rule to an agent session or group of sessions.

In plain words
What is it for?
Use it to require tests or a reviewer decision, retry failed checks, combine results from several sessions, and commit approved changes.
Why use it?
It prevents a session from being treated as complete until an objective check passes, with optional commit handling afterward.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/agentproto/ts/ap-policies
Any agent
npx skills add agentproto/ts --skill ap-policies
Clone the repo
git clone --depth 1 https://github.com/agentproto/ts

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ap-policies

README.md
[![agentmods](https://agentmods.dev/badge/skills/agentproto/ts/ap-policies.svg)](https://agentmods.dev/skills/agentproto/ts/ap-policies)
Your own site
<a href="https://agentmods.dev/skills/agentproto/ts/ap-policies"><img src="https://agentmods.dev/badge/skills/agentproto/ts/ap-policies.svg" alt="Measured on agentmods" height="20"></a>
Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,067 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00083 $0.01067
Opus 5 $0.00042 $0.00534
Sonnet 5 $0.00017 $0.00213
Haiku 4.5 $0.00008 $0.00107

Measured yesterday against content hash 4f8f1d97b55c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

ap-policies scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/skill-pack-agentproto/src/skills/ap-policies/SKILL.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Completion Policies

When to use

Use ap-policies to gate a session (or fan-in group) at turn-end by an objective check — a shell command's exit code or a judge sub-agent's verdict — instead of trusting the agent's own "done" claim, and/or to auto-commit once that gate is green, pending an explicit human ack.

MCP tool: policy_attach

Attach a gate to one sessionId, or a sessionIds array for a fan-in group (the policy resolves once ALL sessions in the group reach turn-end). The gate is either a shell command (basename must be allowlisted, see ap-run-command) or a judge adapter + prompt. then decides what happens on pass: emit (just publish policy:passed) or commit (stage + commit specific paths, gated by requireHumanAck). onFail controls retries with a nudge prompt. next chains another policy as a DAG.

{
  "tool": "policy_attach",
  "args": {
    "sessionIds": ["sess_a1b2", "sess_c3d4"],
    "gate": { "command": { "name": "pnpm", "args": ["test:unit"] } },
    "then": "commit",
    "commit": {
      "paths": ["services/api-gateway/src/routes/webhook.ts"],
      "message": "fix: validate webhook signature before dispatch",
      "requireHumanAck": true
    },
    "onFail": { "nudge": "tests still red — fix the failing assertions", "maxRetries": 3 }
  }
}

Judge gate variant:

{
  "tool": "policy_attach",
  "args": {
    "sessionId": "sess_a1b2",
    "gate": {
      "judge": {
        "adapter": "claude-code",
        "prompt": "Does the diff add a test for the new webhook signature check? Answer pass/fail with one reason."
      }
    },
    "then": "emit"
  }
}

MCP tools: policy_status / policy_list

policy_status polls state (pending | passed | failed | awaiting_ack) plus awaitingQuestions — judge follow-ups blocking resolution. policy_list lists active/recent policies, optionally filtered by sessionId.

{ "tool": "policy_status", "args": { "policyId": "pol_9f21" } }
{ "tool": "policy_list", "args": { "sessionId": "sess_a1b2" } }

Read the full file on GitHub · 110 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 110 lines · 83 tokens per session scan A 4f8f1d97b55c

Subscribe to this mod's changes

ap-policies is a skill published in the GitHub repository agentproto/ts (5 stars, last pushed today), licensed Apache-2.0. It adds 83 tokens to every session and 1,067 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

diagnose-hard-problem

Disciplined diagnosis loop for hard problems, diagnosing bugs and regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test.

sammcj/agentic-coding · 37 tokens

strands-review

Local preview of the strands-agents/devtools /strands review agent. Body is the upstream Task Reviewer SOP verbatim — do not paraphrase. Use when the user types /strands-review, asks for a "strands review" of a PR, or wants to anticipate what the remote /strands review GitHub Action will flag. Findings are close but…

strands-agents/harness-sdk · 125 tokens

docs-reviewer

Review documentation drafts for voice consistency, structure, and terminology before PR submission. Use after completing a draft, when checking if docs are ready to ship, or automatically after docs-writer produces output. Also triggers on "review this draft", "check my docs", "is this ready to ship", "review before…

strands-agents/harness-sdk · 68 tokens

docs-writer

Draft or rewrite Strands Agents documentation pages. Use when writing new doc pages, rewriting pages that failed audit, drafting sections for existing pages, or writing blog posts and release notes about Strands. Also triggers on "write a doc", "draft a page", "rewrite the quickstart", "add a tutorial for X"…

strands-agents/harness-sdk · 74 tokens

pr-writer

Generates pull request titles and descriptions. Use when the user asks to create, open, write, draft, or generate a PR, pull request, or merge request description.

strands-agents/harness-sdk · 39 tokens

docs-audit

Assess a published or in-progress documentation page for quality, accuracy, and voice compliance. Use before rewriting a page, during periodic health checks, when community signals point to confusion, or when comparing against competitor docs. Also triggers on "audit this page", "assess the docs", "what's wrong with…

strands-agents/harness-sdk · 79 tokens