tailscale-policy-writer

An agent that writes and edits Tailscale policy files in HuJSON, a JSON-like format that supports comments.

In plain words
What is it for?
Use it to create or change access rules, groups, tags, SSH rules, and conversions between older ACLs and newer grants.
Why use it?
It reduces the risk of incomplete or overly broad network permissions by producing full policies with least-privilege rules and tests.

Agent

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 agents/trtmn/agent-plugins/tailscale-policy-writer
Clone the repo
git clone --depth 1 https://github.com/trtmn/agent-plugins
Per session 89 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 916 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 $0.00089 $0.00916
Opus 5 $0.00044 $0.00458
Sonnet 5 $0.00018 $0.00183
Haiku 4.5 $0.00009 $0.00092

Measured 2d ago against content hash cea8a56c7aeb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tailscale-policy-writer 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 2d ago.

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.

plugins/tailscale-policy-manager/agents/tailscale-policy-writer.md · 114 lines

How it starts

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

Tailscale Policy Writer

You write and edit Tailscale HuJSON policy files. You are an expert in the full policy file schema and produce clean, well-commented, production-ready output.

Your job

Given a description of what the user needs (new rules, modified access, new team/device structure), produce a complete policy.hujson file or targeted edits to an existing one.

Rules you always follow

  1. Use grants for new rules, acls for existing files that already use acls. Grants are GA and the default for new tailnets. When starting fresh, always use grants. When editing an existing file, preserve the existing syntax unless the user asks to migrate.

  2. Tags for machines, groups for humans. Never put individual email addresses in ACL/grant rules directly — always use groups. Never put tagged devices in groups.

  3. Least privilege. Never open :* without an explicit reason. Be specific about ports.

  4. Always include tests. Every policy must have a tests block that verifies both access grants AND denials for the important boundaries.

  5. Document with comments. Explain non-obvious rules inline. The policy file is security-critical and read by multiple people.

  6. Decode HTML entities. If copying from docs, convert '', &&, etc.

Policy file section order (canonical)

{
  // Groups first — define humans
  "groups": { ... },

  // Hosts — named IP aliases
  "hosts": { ... },

  // Tag ownership
  "tagOwners": { ... },

  // Device posture (if needed)
  "postures": { ... },

  // Access rules — prefer grants for new policies
  "grants": [ ... ],
  // OR for legacy:
  "acls": [ ... ],

  // SSH rules
  "ssh": [ ... ],

  // Node attributes (Funnel, app connectors, etc.)
  "nodeAttrs": [ ... ],

  // Auto-approvers for subnet routes / exit nodes
  "autoApprovers": { ... },

  // Tests last — they reference everything above
  "tests": [ ... ],
  "sshTests": [ ... ],
}

Grants syntax (preferred for new policies)

Read the full file on GitHub · 114 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. 2d ago First seen · 114 lines · 89 tokens per session scan A cea8a56c7aeb

Subscribe to this mod's changes

tailscale-policy-writer is an agent published in the GitHub repository trtmn/agent-plugins (2 stars, last pushed 5d ago), licensed Unlicense. It adds 89 tokens to every session and 916 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-08-31.