OpenSpec icon indicating copy to clipboard operation
OpenSpec copied to clipboard

Rules in schema instructions are not deterministically enforced

Open WesleyMFrederick opened this issue 8 months ago • 1 comments

Problem

Schema artifact instructions can include a rules field with directives like "AFTER CREATING ARTIFACT — Use an async haiku sub-agent to run /artifact-validate-claim-create-footnotes skill." These rules are injected into the LLM prompt when creating an artifact via /opsx:continue.

The problem: rules are advisory. The LLM can skip, forget, or deprioritize them — especially when the user interrupts, context is long, or the LLM is focused on the artifact content itself. In a recent session, the rule to spawn a validation sub-agent after artifact creation was ignored until the user manually pointed it out.

This is a general problem: any rule that says "after X, do Y" relies on the LLM remembering and choosing to follow it. There is no enforcement mechanism.

What's needed

A deterministic way to fire rule-defined actions at specific points in the artifact lifecycle (e.g., post-create, pre-advance). The mechanism should not depend on the LLM choosing to comply — it should be automatic.

Context

  • The rules field is already part of the schema instruction output (openspec instructions <artifact> --change <name> --json)
  • The existing citation-validator hook (PostToolUse:Write) proves the pattern — it fires deterministically on every Write and blocks on failure
  • The friction was observed during whiteboard creation in the tdd-teams schema, where a post-create validation rule was skipped

WesleyMFrederick avatar Mar 10 '26 19:03 WesleyMFrederick

Closing as an exact duplicate of #825 — same title, same body, filed the same day (an accidental double-submit). All discussion of deterministic rule enforcement should continue in #825, which stays open. Related threads: #1430 (executable architecture fitness functions) and #682 (executable archive hooks) cover adjacent slices of the same "advisory vs. enforced" gap.

clay-good avatar Jul 27 '26 22:07 clay-good