Skip to content

Commit 9ff59e7

Browse files
committed
Remove v1 policy format support
Remove all legacy v1 policy format (.deepwork.policy.yml) support: - Remove evaluate_policies.py hook module - Remove PolicyV1 class and parse_policy_file from policy_parser.py - Remove v1 schema (POLICY_SCHEMA_V1) from policy_schema.py - Remove v1 test fixtures and test_evaluate_policies.py - Update test fixtures to use v2 frontmatter markdown format - Update documentation to remove v1 references - Fix policy_stop_hook.sh to handle exit code 2 (block) correctly Only v2 frontmatter markdown format (.deepwork/policies/*.md) is now supported.
1 parent 78ddb04 commit 9ff59e7

23 files changed

Lines changed: 896 additions & 1468 deletions

File tree

.claude/commands/deepwork_policy.define.md

Lines changed: 241 additions & 141 deletions
Large diffs are not rendered by default.
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
name: deepwork_policy
2-
version: "0.2.0"
2+
version: "0.3.0"
33
summary: "Policy enforcement for AI agent sessions"
44
description: |
55
Manages policies that automatically trigger when certain files change during an AI agent session.
66
Policies help ensure that code changes follow team guidelines, documentation is updated,
77
and architectural decisions are respected.
88
9-
Policies are defined in a `.deepwork.policy.yml` file at the root of your project. Each policy
10-
specifies:
11-
- Trigger patterns: Glob patterns for files that, when changed, should trigger the policy
12-
- Safety patterns: Glob patterns for files that, if also changed, mean the policy doesn't need to fire
13-
- Instructions: What the agent should do when the policy triggers
9+
Policies are defined as individual markdown files in `.deepwork/policies/` with YAML frontmatter.
10+
This format supports:
11+
- Detection modes: trigger/safety (default), set (bidirectional), pair (directional)
12+
- Action types: prompt (show instructions), command (run idempotent commands)
13+
- Variable pattern matching for file correspondence (e.g., `src/{path}.py` ↔ `tests/{path}_test.py`)
1414
1515
Example use cases:
16+
- Enforce source/test pairing with set patterns
17+
- Run formatters automatically when files change
1618
- Update installation docs when configuration files change
1719
- Require security review when authentication code is modified
1820
- Ensure API documentation stays in sync with API code
19-
- Remind developers to update changelogs
2021
2122
changelog:
2223
- version: "0.1.0"
2324
changes: "Initial version"
2425
- version: "0.2.0"
2526
changes: "Standardized on 'ask structured questions' phrasing for user input"
27+
- version: "0.3.0"
28+
changes: "Updated for policy system v2 with detection modes, action types, and variable patterns"
2629

2730
steps:
2831
- id: define
2932
name: "Define Policy"
30-
description: "Create or update policy entries in .deepwork.policy.yml"
33+
description: "Create or update policies in .deepwork/policies/"
3134
instructions_file: steps/define.md
3235
inputs:
3336
- name: policy_purpose
3437
description: "What guideline or constraint should this policy enforce?"
3538
outputs:
36-
- .deepwork.policy.yml
39+
- .deepwork/policies/*.md
3740
dependencies: []

0 commit comments

Comments
 (0)