Extract cross-surface enforcement plane (decision/profiles/audit) into pkg + thin endpoint adapter #114

Closed
opened 2026-06-08 00:03:42 +00:00 by coilysiren · 1 comment
Owner

Extract the cross-surface enforcement plane into pkg + a thin endpoint adapter

Spun out of the speakeasy-ward proving slice and the
reorg discussion in cli-guard issue 113.

Finding

The ward slice exposed cli-guard's decision + audit over a tiny HTTP
endpoint and let a generated TypeScript client enforce policy by calling it -
zero enforcement reimplemented in the generated language. Two things fell out:

  1. An HTTP caller in a different repo imported exactly decision,
    profiles, and audit and nothing else from today's CLI-flavored tree.
    Those packages gate the HTTP front in code right now, with no
    passthrough/verb/lockdown dependency. They are cross-surface, not CLI.

  2. Nothing about the endpoint is HTTP-specific. The same enforcement core can
    be reached three ways:

    • CLI passthrough - in-process call, no endpoint.
    • HTTP - generated or hand-written client calls it via a request hook.
    • MCP - a proxy calls it before dispatching a tool.

Proposal

  • Move decision, profiles, profile, audit (plus policy, scope) into
    pkg as the shared enforcement plane. lockdown stays CLI (it renders a
    shell deny-list, surface-specific).
  • Define a small pkg-level enforcement API (decide + audit) that each surface
    adapts. The HTTP endpoint server is a thin adapter over that API, not a member
    of the HTTP bucket.
  • Reference implementation already exists: speakeasy-ward/server/main.go is the
    endpoint adapter in ~250 lines over audit + decision + profiles. It can
    migrate in as the canonical adapter once the pkg boundary lands.

Sequencing

This depends on the bucketing in
cli-guard issue 113
being agreed first. It is the concrete "what goes in pkg and why" answer for
the cross-surface packages that issue flagged as open questions.

## Extract the cross-surface enforcement plane into `pkg` + a thin endpoint adapter Spun out of the [speakeasy-ward proving slice](https://forgejo.coilysiren.me/coilyco-proving-ground/speakeasy-ward) and the reorg discussion in [cli-guard issue 113](https://forgejo.coilysiren.me/coilyco-flight-deck/cli-guard/issues/113). ### Finding The ward slice exposed cli-guard's `decision` + `audit` over a tiny HTTP endpoint and let a generated TypeScript client enforce policy by calling it - zero enforcement reimplemented in the generated language. Two things fell out: 1. An HTTP caller **in a different repo** imported exactly `decision`, `profiles`, and `audit` and nothing else from today's CLI-flavored tree. Those packages gate the HTTP front in code right now, with no `passthrough`/`verb`/`lockdown` dependency. They are cross-surface, not CLI. 2. Nothing about the endpoint is HTTP-specific. The same enforcement core can be reached three ways: - **CLI passthrough** - in-process call, no endpoint. - **HTTP** - generated or hand-written client calls it via a request hook. - **MCP** - a proxy calls it before dispatching a tool. ### Proposal - Move `decision`, `profiles`, `profile`, `audit` (plus `policy`, `scope`) into `pkg` as the shared **enforcement plane**. `lockdown` stays CLI (it renders a shell deny-list, surface-specific). - Define a small `pkg`-level enforcement API (decide + audit) that each surface adapts. The HTTP endpoint server is a thin adapter over that API, not a member of the HTTP bucket. - Reference implementation already exists: `speakeasy-ward/server/main.go` is the endpoint adapter in ~250 lines over `audit` + `decision` + `profiles`. It can migrate in as the canonical adapter once the `pkg` boundary lands. ### Sequencing This depends on the bucketing in [cli-guard issue 113](https://forgejo.coilysiren.me/coilyco-flight-deck/cli-guard/issues/113) being agreed first. It is the concrete "what goes in `pkg` and why" answer for the cross-surface packages that issue flagged as open questions.
Author
Owner

Backlog burndown 2026-06-17: closing low-priority (P3/P4) to bring the open count to a manageable level. Nothing lost — reopen if this resurfaces. Batch tag: burndown-2026-06.

Backlog burndown 2026-06-17: closing low-priority (P3/P4) to bring the open count to a manageable level. Nothing lost — reopen if this resurfaces. Batch tag: `burndown-2026-06`.
coilysiren 2026-06-17 08:23:19 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/cli-guard#114
No description provided.