Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions docs/ai-guardrails/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,32 @@ Bootstrap the first thin-distribution slice that keeps OpenCode upstream-friendl
1. Freeze architecture decisions in ADRs.
2. Land the thin-distribution bootstrap as the first issue-sized slice.
3. Keep scenario coverage in the same change set as runtime behavior.
4. Stack later issues for plugin policy, safe workflows, provider lanes, and replay coverage on top of this base.
4. Establish the MVP floor explicitly before broadening into later maturity work.
5. Stack later issues for plugin policy, safe workflows, provider lanes, replay coverage, and authoritative release gates on top of this base.

## MVP readiness split

The remaining work is intentionally split into two stages:

- `now required before MVP claim`: `#5`, `#6`, `#7`, and `#13`
- `later, after MVP floor`: `#14` and `#12`

The detailed rationale lives in `docs/ai-guardrails/mvp-readiness.md`. Future sessions should start there before expanding issue scope.

## Tracking

- Epic: [#1](https://github.com/Cor-Incorporated/opencode/issues/1)
- Current issue: [#4](https://github.com/Cor-Incorporated/opencode/issues/4)
- MVP readiness epic: [#16](https://github.com/Cor-Incorporated/opencode/issues/16)
- Current issue: [#15](https://github.com/Cor-Incorporated/opencode/issues/15)
- Future slices remain separate issues so implementation can stay one issue per pull request.

Issue `#2` is the merged bootstrap base.

Issue `#4` is complete only when:
Issue `#15` is complete only when:

- the plugin brief is committed and linked from the issue pack
- repo docs explain the plugin MVP in terms of the same canon
- scenario coverage proves the plugin loads and exercises the intended hooks
- the repo has a written MVP readiness register
- missing local issue briefs for the open workstreams are committed
- GitHub issue structure matches the same `now` versus `later` split
- future implementation work can point back to this source canon instead of relying on memory

## Session rule
Expand All @@ -159,6 +170,7 @@ When continuing this work in future sessions:

- ADRs: `docs/ai-guardrails/adr/`
- Issue briefs: `docs/ai-guardrails/issues/`
- MVP readiness: `docs/ai-guardrails/mvp-readiness.md`
- Migration inventory: `docs/ai-guardrails/migration/`
- Scenario tests: `packages/opencode/test/scenario/`
- Thin distribution package: `packages/guardrails/`
Expand Down
36 changes: 36 additions & 0 deletions docs/ai-guardrails/issues/004-safe-agents-and-commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Issue 004: Safe Agents And Workflow Commands

## Problem

Raw built-in agents are too permissive for an internal product. The repo needs a safer default operating model for implementation, review, and release workflows.

This issue is part of the MVP floor. It should not absorb later CI or broader migration scope.

## Deliverables

- hardened default primary agent
- review-oriented subagent
- slash commands for `/implement`, `/review`, `/ship`, and `/handoff`
- explicit permission policy for dangerous shell patterns and write operations

## Acceptance

- default agent is not an unrestricted build clone
- review workflow can run without edit access
- release workflow cannot bypass explicit gates
- the scope stays limited to local runtime workflow safety, not later CI/release authority

## Dependencies

- `003-guardrail-plugin-mvp.md`
- `docs/ai-guardrails/mvp-readiness.md`
- `docs/ai-guardrails/migration/claude-code-skills-inventory.md`

## Sources

- `claude-code-skills` epic `#130`
- `claude-code-skills` README
- Anthropic `The Complete Guide to Building Skills for Claude`
- https://opencode.ai/docs/agents
- https://opencode.ai/docs/commands
- https://opencode.ai/docs/config
35 changes: 35 additions & 0 deletions docs/ai-guardrails/issues/005-provider-admission-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Issue 005: Provider Admission Policy

## Problem

The internal distribution needs a stable provider strategy that does not tie product decisions to one transient model name.

This issue is part of the MVP floor because the product needs a concrete answer for confidential-code routing before it can honestly be described as an MVP.

## Deliverables

- lane policy for `zai`, `openai`, and `openrouter`
- provider allowlist and denylist defaults
- evaluation checklist for OpenRouter-backed candidates
- confidential-repo restrictions for preview, free, or data-collecting models

## Acceptance

- provider defaults are expressed in config, not only in prose
- evaluation lane is separate from standard defaults
- policy references official routing and data controls, not assumptions

## Dependencies

- `docs/ai-guardrails/adr/002-provider-admission-lanes.md`
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/ai-guardrails/adr/002-provider-admission-lanes.md is listed as a dependency, but there is no 002-* ADR in docs/ai-guardrails/adr/ (only 001, 003, 004). This makes the issue brief’s dependency list non-actionable. Either add the missing ADR 002 (recommended if lanes are a key architectural decision) or update this dependency to point at the correct existing ADR(s).

Suggested change
- `docs/ai-guardrails/adr/002-provider-admission-lanes.md`
- relevant existing ADRs in `docs/ai-guardrails/adr/`

Copilot uses AI. Check for mistakes.
- `docs/ai-guardrails/mvp-readiness.md`

## Sources

- `claude-code-skills` epic `#130`
- `claude-code-skills` README
- Anthropic `The Complete Guide to Building Skills for Claude`
- OpenRouter provider routing docs
- OpenAI pricing and model docs
- Z.AI pricing docs
- https://opencode.ai/docs/config
34 changes: 34 additions & 0 deletions docs/ai-guardrails/issues/006-scenario-and-replay-harness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Issue 006: Scenario And Replay Harness

## Problem

Guardrails are only credible if config precedence, plugin behavior, and migration compatibility are exercised automatically.

This issue is part of the MVP floor because the philosophy from epic `#130` treats runtime proof as a requirement, not a follow-up.

## Deliverables

- scenario tests for guarded workflow commands
- scenario tests for provider admission behavior
- scenario tests for plugin state and carry-over that matter to MVP claims
- follow-up replay strategy for release-gate and provider-admission scenarios

## Acceptance

- scenario suite runs under `packages/opencode`
- the tests are stable on local development machines and CI
- future guardrail issues can link to specific scenario or replay coverage

## Dependencies

- `003-guardrail-plugin-mvp.md`
- `004-safe-agents-and-commands.md`
- `005-provider-admission-policy.md`
- `docs/ai-guardrails/mvp-readiness.md`

## Sources

- `claude-code-skills` epic `#130`
- `claude-code-skills` README
- Anthropic `The Complete Guide to Building Skills for Claude`
- `packages/opencode/test/scenario/guardrails.test.ts`
39 changes: 39 additions & 0 deletions docs/ai-guardrails/issues/007-plugin-hardening-wave-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Issue 007: Plugin Hardening Wave 2

## Problem

The plugin MVP in `003-guardrail-plugin-mvp.md` proves the extension surface, but it does not yet cover enough of the highest-value hook migration set to support an MVP claim by itself.

## Deliverables

- expand plugin policy to cover high-priority fast-feedback hooks from the migration inventory
- add crash-safe state/logging expectations where needed for local runtime continuity
- document which plugin behaviors are part of the MVP floor versus later operational hardening

## Candidate scope

- `post-lint-format`
- `block-version-downgrade`
- `context-budget-*`
- `mark-factcheck-done`
- `reset-factcheck`
- targeted review or fact-check runtime state where feasible without broad core patches

## Acceptance

- the plugin covers the highest-value remaining fast-feedback policies needed for MVP
- behavior is scenario-tested or otherwise runtime-verified
- scope remains thin-distribution-first and upstream-friendly

## Dependencies

- `003-guardrail-plugin-mvp.md`
- `006-scenario-and-replay-harness.md`
- `docs/ai-guardrails/mvp-readiness.md`
- `docs/ai-guardrails/migration/claude-code-skills-inventory.md`

## Sources

- `claude-code-skills` epic `#130`
- `claude-code-skills` README
- Anthropic `The Complete Guide to Building Skills for Claude`
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Issue 008: Authoritative CI And Release Gates

## Problem

The local client can guide safe behavior, but merge, release, and post-merge authority must not depend on local agent goodwill alone.

This issue is intentionally outside the MVP floor. It should stay separated from `004-safe-agents-and-commands.md` so the MVP scope does not expand indefinitely.

## Deliverables

- CI or provider-enforced review freshness gates
- release and post-merge verification policy
- documented split between local preflight checks and authoritative server-side gates

## Acceptance

- the repo documents which gates are local-only versus authoritative
- release-sensitive operations are enforced outside the local client
- the work remains separate from the local-runtime MVP floor

## Dependencies

- `004-safe-agents-and-commands.md`
- `006-scenario-and-replay-harness.md`
- `docs/ai-guardrails/mvp-readiness.md`

## Sources

- `claude-code-skills` epic `#130`
- `claude-code-skills` README
- Anthropic `The Complete Guide to Building Skills for Claude`
30 changes: 30 additions & 0 deletions docs/ai-guardrails/issues/009-broader-claude-asset-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Issue 009: Broader Claude Asset Migration

## Problem

The MVP floor does not require full migration of every Claude-owned asset, but the longer-term product still needs a principled path for additional skills, commands, and packaging decisions.

This issue is intentionally after the MVP floor.

## Deliverables

- next-wave migration candidates beyond the MVP floor
- ownership rules for moving assets from `.claude` into `.opencode`
- packaging and maintenance rules for org-owned assets after the MVP ships

## Acceptance

- the repo distinguishes MVP-critical migration from later migration work
- future asset moves can point to an explicit issue and ownership rule instead of ad hoc decisions

## Dependencies

- `002-claude-asset-inventory-and-import.md`
- `docs/ai-guardrails/mvp-readiness.md`
- `docs/ai-guardrails/migration/claude-code-skills-inventory.md`

## Sources

- `claude-code-skills` epic `#130`
- `claude-code-skills` README
- Anthropic `The Complete Guide to Building Skills for Claude`
8 changes: 8 additions & 0 deletions docs/ai-guardrails/issues/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ These issue briefs are intentionally written as implementation slices that can b
4. `004-safe-agents-and-commands.md`
5. `005-provider-admission-policy.md`
6. `006-scenario-and-replay-harness.md`
7. `007-plugin-hardening-wave-2.md`
8. `008-authoritative-ci-and-release-gates.md`
9. `009-broader-claude-asset-migration.md`

## MVP split

- `004` to `007` define the MVP floor
- `008` and `009` are later maturity work and should not silently expand the MVP scope

## Working rule

Expand Down
13 changes: 8 additions & 5 deletions docs/ai-guardrails/migration/claude-code-skills-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,14 @@ Bucket definitions:

## Immediate Implications For This Repo

- `Issue 001` should stay thin: wrapper, managed config, packaged profile.
- `Issue 002` is complete only when this inventory remains current and scenario coverage for `.claude/skills` stays green.
- `Issue 003` should focus on plugin rewrites that preserve fast feedback and system-level verifiability.
- `Issue 004` should turn command-bucket items into explicit safe workflows like `/implement`, `/review`, `/ship`, and `/handoff`.
- `Issue 005` should keep provider policy declarative and independent from one transient model brand.
- `001-bootstrap-thin-distribution` should stay thin: wrapper, managed config, packaged profile.
- `002-claude-asset-inventory-and-import` is complete only when this inventory remains current and scenario coverage for `.claude/skills` stays green.
- `003-guardrail-plugin-mvp` proved the runtime hook surface but not the full MVP floor.
- `004-safe-agents-and-commands` should turn command-bucket items into explicit safe workflows like `/implement`, `/review`, `/ship`, and `/handoff`.
- `005-provider-admission-policy` should keep provider policy declarative and independent from one transient model brand.
- `006-scenario-and-replay-harness` should prove the MVP floor in runtime scenarios, not just code review.
- `007-plugin-hardening-wave-2` should carry the next high-value plugin migrations that still block an MVP claim.
- `008-authoritative-ci-and-release-gates` and `009-broader-claude-asset-migration` are later maturity work and should not silently expand the MVP floor.

## What Success Looks Like

Expand Down
Loading