Constraint Guided Plan Validator logo

Constraint Guided Plan Validator

Community
AnthonyAlcaraz
constraint-guided-plan-validator

Validate a generated plan against extracted domain constraints AND the agent's capability model before execution (Ch5 Constraint-guided planning, Example 5-14, plus the DevOps hypothesis-formation capability filter). Scores the plan 0..1, returns structured per-step feedback so a planning node can refine when the score falls below threshold, and filters steps the agent is not authorized to perform (e.g. a step needing write access when the agent holds read-only monitoring). Forbidden-action and capability violations are HARD — a plan the agent cannot legally execute does not pass regardless of score. Use in regulated or capability-bounded environments where plans must respect business rules and operational authority before any action runs. NOT for free-form creative tasks with no constraints, NOT for validating execution results after the fact (this gates the plan, not the outcome), NOT as the constraint extractor itself (it consumes extracted constraints).

Overview

PublisherAnthonyAlcaraz
Repositoryagentic-graph-rag-skills
Skill nameconstraint-guided-plan-validator
Stars
29
Forks
9
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by AnthonyAlcaraz on GitHub. Read the source before you install it.

Installation

Install the Constraint Guided Plan Validator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/reasoning-planning/constraint-guided-plan-validator
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/reasoning-planning/constraint-guided-plan-validator .claude/skills/constraint-guided-plan-validator
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Constraint Guided Plan Validator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Constraint Guided Plan Validator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Constraint Guided Plan Validator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Constraint-Guided Plan Validator

Overview

In regulated environments a planning node must ensure plans respect domain constraints and business rules before committing to execution (Example 5-14): extract the constraints from the request, generate the plan, validate, and if validation fails, refine with the validator's feedback. The chapter pairs this with two further gates:

  • Capability-model filter (DevOps hypothesis-formation node): the agent's operational boundaries are queryable data specifying which actions it may perform and at what privilege. "A hypothesis requiring direct database access gets filtered if the agent only has read-only monitoring permissions." This prevents proposing investigations it cannot execute.
  • Ontological grounding: domain/range validation rejects operations that are syntactically valid but semantically nonsensical before they corrupt the decision.

This skill validates a plan against extracted constraints and a capability model, returning a 0..1 conformance score plus structured per-step feedback. Below threshold (0.8) the plan should be refined and re-validated. Forbidden-action and capability violations are hard: any single one forces passed=False no matter the score — a plan the agent cannot legally execute is not "mostly fine."

In the DevOps latency investigation (account 123456789012), the agent holds read-only monitoring permissions. A remediation plan whose step proposes modify_db (write privilege) fails the capability gate and is sent back to the planner; a plan that proposes only query_metrics and read_logs (read) with the required record_incident step, within the 30-day emergency regulatory deadline, passes.

When to Use

  • Regulated / capability-bounded environments (insurance, healthcare, finance, privileged DevOps)
  • A planning node must gate plans against business rules and operational authority before any action runs
  • You want a refine-on-low-score loop driven by structured feedback

Phrases: "validate the plan against constraints", "capability model", "is the agent authorized", "constraint-guided planning", "plan conformance score", "refine plan with feedback".

When NOT to Use

  • Free-form creative tasks with no domain constraints
  • Validating execution results after the fact (this gates the plan, not the outcome)
  • You have no constraints or capability model to check against (then there is nothing to validate)

Process

StepInputActionOutputVerification
1constraint spec dictlib.extract_constraints(spec)list of Constraintmax_steps / deadline / forbidden / required parsed
2plan rowslib.steps_from_dicts(rows)list of PlanStepeach step carries action + privilege
3plan + capabilitylib.filter_executable_steps(plan, cap)list of capability Violationsa write step under read-only capability is flagged
4plan + constraints + capabilitylib.verify(...)ValidationResult(score, violations, passed)score in [0,1]; hard violations force passed=False; .feedback lists per-violation messages

Rationalizations

Agent rationalizationDocumented rebuttal
"Validate the result, not the plan — faster."The chapter validates before execution so the agent "won't attempt searches outside specified date ranges, exceed computational budgets, or violate domain rules." A bad plan caught post-execution has already taken the unsafe action.
"Score is 0.85, ship it."A high score does not override a hard violation. A forbidden action or an unauthorized step makes the plan illegal to run; passed is False regardless of score. Treat hard violations as blocking, not as score deductions.
"The agent can probably do that step anyway."The capability model is the authority, not the agent's optimism. A step needing write access when the agent holds read-only is filtered — proposing investigations it cannot execute is a named failure mode.
"Refining wastes a turn — just run the plan."Refine-on-low-score is the whole pattern (Example 5-14): the validator's feedback turns an invalid plan into a valid one before execution, which is far cheaper than a failed or non-compliant action.

Red Flags

  • Every plan scores 1.0. No constraints were extracted or the capability model is empty — the gate is inert.
  • Hard violations present but passed=True. A bug — capability / forbidden-action violations must force passed=False.
  • Capability model allows every action at admin. The operational-authority boundary is not actually bounded; the filter cannot protect against over-privileged steps.

Non-Negotiable Verification

  1. Run the benchmark battery. python cli.py benchmark must report:
    • a conforming plan passes with score 1.0
    • too-many-steps drops the score below threshold
    • a missing required action is flagged
    • a forbidden action is a hard violation (passed=False)
    • a write step under read-only capability is a hard violation
    • a deadline-exceeding step is flagged per-step
    • score stays within [0,1] and .feedback enumerates violations
  2. Verify CLI help. Exits 0 and prints the SKILL.md description.

Security Posture

  • Prompt injection. Plans are typically LLM-generated from untrusted requests - exactly why they are validated. Plan steps and constraint specs are parsed as data, never executed; a malicious step name can at most fail validation. The constraint spec and capability model must come from the trusted policy source, not from the same LLM that wrote the plan.
  • Data exfiltration. No network calls, no file writes. Plans and constraints may describe privileged operations; they stay in-process and surface only in the stdout feedback the caller owns.
  • Privilege escalation. This gate exists to block it: a write step under a read-only capability is a hard violation. Keep it that way - passed=False on hard violations must never be softened into a score deduction, and the gate composes with (never replaces) boundary-side IAM enforcement.

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien) Ch5 — Reasoning & Planning: "Constraint-guided planning" (Example 5-14, ConstraintAwarePlanningNode), the capability-model filter from "Integrating the Knowledge Graph for Grounded Hypotheses," and the domain/range checks from "Ontological Grounding: Keeping Your Agent in Reality."

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Constraint Guided Plan Validator AI skill do?

Validate a generated plan against extracted domain constraints AND the agent's capability model before execution (Ch5 Constraint-guided planning, Example 5-14, plus the DevOps hypothesis-formation capability filter). Scores the plan 0..1, returns structured per-step feedback so a planning node can refine when the score falls below threshold, and filters steps the agent is not authorized to perform (e.g. a step needing write access when the agent holds read-only monitoring). Forbidden-action and capability violations are HARD — a plan the agent cannot legally execute does not pass regardless...

Why use Constraint Guided Plan Validator on TypingMind?

Because you install it once and use it with any model. Constraint Guided Plan Validator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Constraint Guided Plan Validator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/reasoning-planning/constraint-guided-plan-validator. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Constraint Guided Plan Validator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Constraint Guided Plan Validator?

As many as you like. As long as a model supports skills, you can use Constraint Guided Plan Validator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Constraint Guided Plan Validator AI skill free?

Yes. It is published on GitHub by AnthonyAlcaraz under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇