Skip to content

Compile enforce/guide contract blocks into a policy rules artifact at claw up #308

@mostlydev

Description

@mostlydev

Part of #302 (Phase 1). Pairs with ADR-025 and the PolicyEvaluator hooks.

Problem

Behavioral rules live in two places that do not meet:

  • Pod contracts: x-claw.include blocks with enforce/guide modes (ADR-009), inlined into AGENTS.generated.md — human/agent-readable prose, invisible to any policy engine as structured input.
  • A policy service needs rules in a structured, per-agent form at a known location.

Today the cllama context mount (.claw-runtime/context/<agent-id>/) carries AGENTS.md, CLAWDAPUS.md, and metadata.json. There is no rules artifact.

Proposal

claw up compiles enforce (and optionally guide) blocks into a per-agent rules artifact — e.g. rules.json — emitted into the context mount alongside the existing files. The policy contract (ADR-025) references it as the canonical rule source for that agent. Compile-time, not runtime, per Compilation Principle 1.

Open questions

  • Schema: structured rule objects vs ordered raw-text rules that an LLM-backed policy service interprets. (Raw text with stable IDs + mode + provenance is probably v1.)
  • Scoping: per-agent only, or pod-level defaults with service overrides mirroring the existing x-claw inheritance model?
  • Precedence between pod-declared (compiled) rules and rules added at runtime through a policy service's own management surface — does compiled win, or do they merge with provenance tags?
  • Should guide blocks be included as advisory-tier rules or excluded from enforcement entirely?

Acceptance

  • claw up on a pod with enforce includes produces a deterministic rules artifact per agent.
  • Artifact regenerates on contract change (staleness behavior consistent with existing lifecycle guards).
  • Documented in CLLAMA_SPEC alongside the policy contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions