Skip to content

OpenShell Agent-Driven Policy Management #1062

Description

@linear

Product Goal

OpenShell should provide an agent-driven policy management workflow that lets agents inspect current policy, draft narrow changes, and route them into a responsive reviewer inbox.

Roadmap context: #1038 is the public Policy Advisor roadmap card. This issue tracks the concrete MVP implementation for the agent-driven policy approval loop.

The core loop:

  1. Agent attempts an action outside the current sandbox policy.
  2. OpenShell denies the action with structured, agent-readable context.
  3. Agent reads the local policy advisor skill and proposes the narrowest policy change it needs.
  4. OpenShell stores the proposal as a draft policy chunk, not an immediate apply.
  5. OpenShell runs deterministic control-plane validation and, when configured, control-plane AI/reviewer-agent review over the pending chunk.
  6. A human reviewer or explicitly configured trusted reviewer path approves or rejects the chunk with optional guidance.
  7. The sandbox hot-reloads the updated policy.
  8. The agent wakes from /wait, observes the decision, and either retries or redrafts.

GitHub issues are the public development source of truth for this MVP. Earlier RFC/branch artifacts were planning notes and should not be treated as durable public references.

Locked MVP

  • Single-sandbox TUI/CLI review flow.
  • Structured L7 REST deny responses for agent-readable failures.
  • Sandbox-local policy.local HTTP API.
  • Agent-authored policy proposals stored as gateway draft chunks.
  • Proposal payloads reuse the existing PolicyMergeOperation / incremental policy update shape.
  • Static /etc/openshell/skills/policy_advisor.md documenting the policy.local workflow.
  • Proposal provenance, validation status, returned chunk IDs, and rejection guidance.
  • Gateway-side static/prover checks on agent-authored submit.
  • Minimal review primitives for combining intent, formal checks, AI review, and approval policy (feat(policy): add review substrate and reviewer-agent approval path #1434).
  • Control-plane AI/reviewer-agent review for submitted policy proposals (feat(policy): add review substrate and reviewer-agent approval path #1434), supporting advisory review and explicitly configured automatic approval/denial when approval policy permits it.
  • /wait endpoint so agents can sleep on one long-lived request instead of polling or burning tokens.
  • OCSF audit events for deny → propose → validate/review → approve/reject → reload → allow.

Non-Negotiable Trust Boundary

The proposing in-sandbox agent can submit policy proposals and read proposal outcomes. It cannot act as its own reviewer, directly approve or deny chunks, bypass the configured approval policy, or mutate live policy.

AI policy review belongs in the trusted OpenShell control-plane path, alongside gateway-side prover validation. A reviewer agent must evaluate structured proposal context from outside the proposing sandbox and record decisions through the same draft chunk approval/rejection paths as a human reviewer, with explicit provenance and audit events.

Automatic approval is in scope. The distinction is where the decision runs and under whose authority: small, well-scoped proposals may be approved at agent speed by configured control-plane review policy; broad, ambiguous, conflicting, or high-risk changes must remain human-required.

This is required MVP scope for a current, SOTA agent policy architecture: deterministic prover checks answer what can be mechanically verified; control-plane AI review provides contextual judgment over intent, suspicious broadening, and reviewer guidance. The UI must keep those signals distinct.

Simplicity Constraint

Keep the implementation small, inspectable, and easy to change while we learn. Prefer Sutton/Bitter-Lesson-friendly mechanisms: compute from the current policy, proposal, denials, and logs; give the reviewer concise context; store concise outcomes; iterate with replay fixtures.

Do not build a heavy evidence ontology, approval DSL, normalized review database, or service-specific intent taxonomy for the MVP. Reuse existing PolicyChunk/draft chunk fields, existing validation_result/rejection_reason style strings, and OCSF shorthand/log summaries where they are enough. Add new schema only when an experiment proves a value cannot be represented simply.

Review Primitive

The base primitive is broader than "AI approves policies":

A pending capability request is reviewed by small control-plane checks and reviewers that each return a concise verdict, and OpenShell applies a simple configured approval rule to decide approve, deny, or needs-human.

This lets us experiment with which actions can be automated through a combination of intent-based policy, formal methods, and AI review. The minimal shape should support:

  • proposal context assembled from existing chunk fields, proposed operations, current policy, denied-request evidence, and short audit/log snippets;
  • deterministic verdict text from schema/prover/scope checks;
  • reviewer verdicts with only stable fields: decision, short reason, optional guidance, and optional evidence references;
  • a small approval function or config, not a new policy language;
  • provenance in existing approval/rejection/audit paths;
  • replay fixtures for canned proposals so we can learn before adding structure.

Tactical Implementation Order

  1. feat(gateway): persist and validate agent policy proposal operations #1097 — gateway prover validation. Populate deterministic evidence first: pass/fail/unknown, findings, scope classification, and any L7/L4 safety notes available today.
  2. feat(policy): add review substrate and reviewer-agent approval path #1434 — minimal review primitives and control-plane AI reviewer. Use the existing ticket to avoid issue sprawl. Reuse existing chunks/logs, add the smallest reviewer verdict shape that supports advisory and automatic mode, and keep the approval logic readable code/config rather than a DSL.
  3. feat(policy): suggest L7 scoping for known REST hosts #1099 — L7 scoping suggestion. Land with feat(gateway): persist and validate agent policy proposal operations #1097 or feat(policy): add review substrate and reviewer-agent approval path #1434 depending on where validation-result composition ends up.
  4. feat(tui): render policy proposal inbox metadata #1098 — reviewer UX metadata. Render richer signals after they exist: prover result, AI reviewer recommendation, decision provenance, rejection guidance, and needs-human state. Keep single-sandbox MVP unless explicitly re-scoped.

Explicit Non-Goals For MVP

  • Multi-sandbox push inbox / WatchProposals.
  • Slack or web review adapters.
  • Supervisor UDS policy API.
  • In-process long-lived prover optimization.
  • MCP server/tool wrapper. MCP can wrap policy.local later, but is not load-bearing for MVP.
  • Heavy review/evidence ontology, approval DSL, service-specific intent taxonomy, or normalized review database.
  • Unconfigured auto-approval, sandbox self-approval, org ceilings, or force-L7 enterprise policy.

Development Issues

Follow-Up Themes

  • Agent-oriented policy modes and prover-backed safety levels.
  • Multi-sandbox approval inbox.
  • Pub/sub proposal updates.
  • Documentation and examples for manual, advisory AI, and automatic reviewer policy loops.

Cross-Track Notes

Activity

  1. changed the title [-]OpenShell Agent-Driven Policy Management (copy)[/-] [+]OpenShell Agent-Driven Policy Management[/+] on Apr 29, 2026
  2. self-assigned this
    on Apr 30, 2026
  3. zredlined commented on May 6, 2026

    @zredlined
    Collaborator

    Update from #1151 — the foundation slice is in review and covers the
    sandbox-local agent loop end-to-end. Posting the punch list against the
    1090–1099 tickets so this issue stays the roadmap ledger.

    Closeable on #1151 merge

    • feat(policy): add agent-readable L7 deny body #1090 — agent-readable L7 deny body. Delivered: structured 403 with
      layer, method, path, host, port, binary, rule_missing,
      next_steps fields, plus matching unit tests and architecture-doc update.
    • docs(agent): ship static sandbox policy advisor skill #1095 — static policy-advisor skill. Delivered: skill is bundled into
      the supervisor binary via include_str! and installed at
      /etc/openshell/skills/policy_advisor.md mode 0o444 on sandbox
      startup. The skill points at the live policy.local routes; renaming a
      route only requires updating the route constants in policy_local.rs.

    Supersede / re-scope

    Partial — follow-ups needed

    • feat(policy): expose sandbox-local policy.local API #1092 — sandbox-local policy.local API. Three of six planned routes
      are in: GET /v1/policy/current, GET /v1/denials, POST /v1/proposals. Still planned: GET /v1/logs (agent-friendly recent
      log tail), POST /v1/prove (run prover on a draft locally before
      submit), GET /v1/proposals/{id} (status check after submit). The
      proposal submit also doesn't return chunk IDs to the agent yet —
      blocked on feat(policy): return draft chunk ids from policy proposal submit #1094.

    • feat(observability): enable OCSF JSONL for agent deny inspection #1093 — OCSF JSONL for agent deny inspection. The consume path is
      in (/v1/denials reads recent denials), but the source switched: the
      endpoint now reads the always-on shorthand log
      (/var/log/openshell.YYYY-MM-DD.log) instead of the OCSF JSONL.
      Rationale: avoids changing ocsf_json_enabled default, agents read
      raw shorthand, schema evolution is a single-file change in
      openshell-ocsf. The DoD line that asked for "MVP profile enables
      OCSF JSONL by default" is no longer required by this consumer; the
      JSONL still exists for SIEM ingestion but stays opt-in. Re-scope or
      close as you see fit.

    Untouched in #1151 — next-PR slicing

    These are the next critical-path slice. Ordering matters because some
    depend on the proto fields:

    Likely PR slicing for the next chunk of work:

    1. feat(policy): proto fields for agent proposal metadata + chunk IDs
      — combines feat(policy): add proposal provenance, operations, and guidance fields to proto #1096 + feat(policy): return draft chunk ids from policy proposal submit #1094, smallest reviewable slice that unblocks
      the rest.
    2. feat(gateway): validate and persist agent-authored policy operations
      — covers feat(gateway): persist and validate agent policy proposal operations #1097 once proto is in.
    3. feat(tui): render agent policy proposal inbox metadata — covers
      feat(tui): render policy proposal inbox metadata #1098.
    4. feat(policy.local): prove route — covers feat(policy): suggest L7 scoping for known REST hosts #1099 (and rounds out
      feat(policy): expose sandbox-local policy.local API #1092).

    Out-of-scope reminders

    The MVP loop intentionally defers: multi-sandbox push inbox, Slack/web
    inbox adapters, supervisor UDS API, in-process prover optimization, org
    ceiling and trusted external auto-apply, per-binary auto-approve
    patterns. All still tracked under this umbrella.

  4. github-actions commented on Aug 30, 2026

    @github-actions

    This issue has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. Comment or remove the state:stale label to keep it open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Improvementarea:policyPolicy engine and policy lifecycle workstate:staleInactive item at risk of automatic closure.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions