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

native_permissions.pyskills/herdr-foreman/foreman/

"""Verify the operator's effective Codex full-access coordination profile.

No config writes or turn starts. Resume the already bound, materialized thread
without overrides to read its effective settings; first-turn admission instead
uses the authenticated native hook's permission_mode. Hook trust is separate.
"""

from pathlib import Path

from .codex_goals import AppServer, GoalError, control_socket
from .errors import UsageError


def refusal(reason):
    return UsageError(
        "The foreman's effective native permissions are not verified ({}). Preserve the current session and work. "
        "Restore the operator-approved noninteractive full-access profile through the native CLI before preparing "
        "a maintenance handoff; this check changes no permission and grants no broader task authority.".format(reason),
        {"reason": reason, "phase": "native_permission_preflight"})


def source(session, cwd, *, connect=None, discover=None):
    """Read this bound Codex thread's actual approvals, sandbox and write scope."""
    if not isinstance(session, dict) or session.get("kind") != "id" or not isinstance(session.get("value"), str) or not session["value"]:
        raise refusal("native_permission_session_unproved")
    if not isinstance(cwd, str) or not Path(cwd).is_absolute():
        raise refusal("native_permission_workspace_unproved")
    try:
        expected = Path(cwd).resolve(strict=True)
        with (connect or AppServer)((discover or control_socket)()) as host:
            live = host.call("thread/read", {"threadId": session["value"]}).get("thread", {})
            if live.get("id") != session["value"] or live.get("status", {}).get("type") not in ("active", "idle"):
                raise refusal("native_permission_source_not_loaded")
            value = host.call("thread/resume", {"threadId": session["value"], "excludeTurns": True})
        actual_cwd = value.get("cwd")
        if (value.get("thread", {}).get("id") != session["value"]
                or not isinstance(actual_cwd, str) or not Path(actual_cwd).is_absolute()
                or Path(actual_cwd).resolve(strict=True) != expected):
            raise refusal("native_permission_workspace_changed")
        if value.get("approvalPolicy") != "never" or value.get("sandbox") != {"type": "dangerFullAccess"}:
            raise refusal("native_permission_profile_interactive_or_restricted")
    except GoalError:
        raise refusal("native_permission_host_unavailable") from None
    except (OSError, RuntimeError, TypeError, ValueError, AttributeError):
        raise refusal("native_permission_evidence_unavailable") from None
    return {"approval_policy": "never", "sandbox": "danger-full-access", "write_roots": "unrestricted",
            "cwd": str(expected), "source": "bound_native_thread_without_overrides"}


def incoming(payload):
    """A startup argv is not proof of the first turn's effective mode."""
    return payload.get("permission_mode") == "bypassPermissions"

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