CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

jbaruch/herdr-policy

Herdr team coordination policy for AI coding agents

Quality

93%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

workflow_upgrade.pyskills/herdr-foreman/foreman/

"""Keep an owner-format upgrade from stranding an unfinished admitted service.

The state owner calls this before persisting a delivery-format migration. No
authority is transferred, no grant is rewritten and no native history is read.
Completed workflows need no further executor; every other service retains its
admitted policy until it is drained or explicitly returned by that owner.
"""

from .errors import StateError


def delivery_migration_pending(payload):
    if not isinstance(payload, dict) or not isinstance(payload.get("recovery"), dict):
        return False
    tasks = payload["recovery"].get("tasks")
    if not isinstance(tasks, dict):
        return False
    for task in tasks.values():
        progress = task.get("progression") if isinstance(task, dict) else None
        delivery = progress.get("delivery") if isinstance(progress, dict) else None
        if (isinstance(progress, dict) and progress.get("schema_version") == 2
                and isinstance(delivery, dict) and type(delivery.get("schema_version")) is int
                and delivery["schema_version"] == 1):
            return True
    return False


def require_compatible_services(state, path):
    """Validated state only; refuse the whole-file format commit on a mismatch."""
    from .native_policy import executing_policy_root
    from .remote_owner import loaded_policy

    services = []
    for name, task in state["recovery"]["tasks"].items():
        grant, progress = task.get("authority"), task.get("progression")
        if grant is None or grant["mode"] != "service":
            continue
        if isinstance(progress, dict) and progress.get("phase") == "complete" and progress.get("pending") is None:
            continue
        services.append((name, grant["policy"]))
    if not services:
        return
    version, digest = loaded_policy(executing_policy_root())
    current = {"version": version, "digest": digest}
    blocked = [(name, admitted) for name, admitted in services if admitted != current]
    if blocked:
        name, admitted = blocked[0]
        raise StateError(
            "Preserve this owner file before upgrading its delivery format: unfinished task {!r} still needs its admitted policy {}. Restore that exact policy and drain or explicitly return its service under the original owner, then retry the upgrade. Do not edit the grant or downgrade migrated obligations.".format(name, admitted["version"]),
            {"path": str(path), "blocked_tasks": len(blocked), "task": name,
             "admitted_policy": admitted, "executing_policy": current})

skills

herdr-foreman

foreman

__init__.py

__main__.py

antigravity_native.py

assign.py

attention_view.py

attention.py

billing.py

bootstrap_recovery.py

brief_inputs.py

capabilities.py

chronology.py

churn.py

claude_native.py

cli.py

codex_goals.py

command_context.py

composer.py

composition.py

config.py

context_evidence.py

context_output.py

coordination_metrics.py

cost_report.py

delivery_collection.py

diagnostics.py

engagement.py

errors.py

foreman_queue.py

foreman_reset.py

github_context.py

herdr.py

historical.py

home.py

host_goals.py

launch.py

lifecycle.py

load_set.py

measure.py

measurement_capture.py

measurement_retry.py

members.py

memory.py

model_unavailability.py

native_permissions.py

native_policy.py

no_work_recovery.py

observer_projection.py

observer_role.py

oracle.py

parsers.py

partition.py

plan_explanation.py

planner.py

policy_paths.py

probe_recovery.py

probe.py

process_lease.py

progression_owner.py

progression_runtime.py

progression_service.py

provision.py

recovery.py

release_activation.py

release_checkout.py

release_flight.py

release_rebind.py

remote_owner.py

remote_service.py

renderable.py

report_contract.py

report_delivery.py

report_gates.py

reset_input_hook.py

restoration.py

retrospective_runtime.py

retrospective.py

role_clear.py

role_context.py

runnable.py

selection.py

session_start_hook.py

state.py

successors.py

supervision_gate.py

supervision_hook.py

supervision_runtime.py

supervision.py

task_evidence.py

tier_routing.py

tiers.py

triggers.py

workflow_adoption.py

workflow_artifacts.py

workflow_batch.py

workflow_capacity.py

workflow_contract.py

workflow_dispatch.py

workflow_native.py

workflow_planning.py

workflow_profiles.py

workflow_readiness.py

workflow_recovery.py

workflow_release.py

workflow_rename.py

workflow_review.py

workflow_service.py

workflow_upgrade.py

workflow_workspace.py

antigravity.example.json

bootstrap-repository.py

compose-briefs.sh

config.example.json

foreman-tier-check.py

foreman.sh

label-workspaces.sh

measurements.py

native-hook.sh

observer-view.py

policy-paths.py

prepare-briefs.py

provision-worktree.sh

prune-report-caches.py

resolve-gates.sh

resolve-policy-paths.sh

review-package.sh

roster.sh

round-preflight.sh

SKILL.md

start-judge-worker.sh

state-schema.md

sweep-worktrees.sh

verify-authority.sh

wait-report.sh

workflow-review.py

README.md

tile.json