Sidian Labs

POLICY.md

You write the boundaries. Agents read them.

A Markdown file that tells AI agents what they must not do.

Working Specification

How POLICY.md works

Readable by a person, understood by a model, enforced by a runtime.

  1. 01 write

    Rules in YAML frontmatter, reasons in Markdown.

  2. 02 load

    manager.load() finds POLICY.md files in the working directory.

  3. 03 inject

    buildPoliciesContext() puts the policies in the system prompt.

  4. 04 evaluate

    The engine returns allow, deny or require_approval per action.

Three words decide.

When policies combine, the most severe decision wins.

deny

The agent must not do it.

require_approval

The agent must ask first.

allow

The agent may do it.

YAML for the runtime. Markdown for people.

SKILL.md teaches abilities; POLICY.md declares boundaries.

POLICY.mdFrom the docs, abridged
---
name: project-guardrails
scope: project
rules:
  - capability: file.write
    action: deny
    condition:
      field: { path: 'payload.path', op: 'includes', value: '.env' }
    reason: Never write .env or secret files

  - capability: package.install
    action: require_approval
    reason: New dependencies need approval

  - capability: npm.test
    action: allow
---

## Forbidden
- Never commit `.env` files or any file containing secrets

12 operators

eqneqgtgteltlteincludesinnotInexistsnotExistswildcard

4 scopes

projectskillagentdepartment

Ask the file before you act.

Not on npm yet. Run the CLI from a clone.

Sample output
$ node bin/policy.js check POLICY.md file.write --payload='{"path":".env"}'
deny  rule file.write

$ node bin/policy.js check POLICY.md package.install
require_approval  rule package.install

$ node bin/policy.js check POLICY.md npm.test
allow  rule npm.test

7 commands

validatecheckreadinitinstallsynclist

Use it where your agents run.

From the README. The CLI runs from a clone until the package is published.

import { createPolicyManager, buildPoliciesContext } from '@sidianlabs/policy';

const manager = createPolicyManager();
manager.load(); // searches working dir for POLICY.md files

// Inject into an agent system prompt
const prompt = buildPoliciesContext(manager);

// Enforce at runtime
const engine = manager.createAuthorizationEngine();
const decision = engine.evaluate(intent);
// decision.action === 'deny'

Works with SKILL.md · AGENTS.md · OpenAI Codex · .claude/skills · .devin/skills · .opencode/skills

Write it down once.

Forbid agents from writing .env or secret files

Require approval before adding new dependencies

Distribute reusable guardrails across teams and repos

Inject policy context into agent system prompts

It does not enforce itself.

Working Specification

21

engine tests pass; no benchmark suite yet.

Does not enforce itself: a host runtime must call the engine.

Fails open: no matching rule means allow.

Codex adapter keeps only command.run and network.* rules.

Working draft (v0.2.0); not yet published to npm.

Part of one research program.

Declare, authorize, enforce and prove: three layers of one design for boundary control. They are not yet integrated at runtime.

Questions

How is it different from SKILL.md?

SKILL.md describes an ability an agent can use. POLICY.md describes a boundary it must respect.

Where does the file go?

At the repo root for project-wide rules, in .policies/<name>/ for named policies, or next to a SKILL.md to bound that skill.

What happens when no rule matches?

The engine allows the action. It fails open, so write explicit deny rules where you need fail-closed behaviour.

How do several policies combine?

The composite engine returns the most severe decision: deny, then require_approval, then allow.

Are installed policies verified?

No. install owner/repo does no signature or trust check, so anyone with write access to the file can change it.

Can I install it from npm?

Not yet. The package is unpublished; clone the repo and build it.

Write down what your agents must not do.

$ git clone https://github.com/SidianLabs/POLICY.md
$ cd POLICY.md && npm install && npm run build