diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..30e7a1c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,138 @@ +# Psyche agent guide + +This is the repository entrypoint for coding agents and human contributors. Keep it short and route detailed work to the canonical documents below. + +## Mission + +Psyche is the canonical orchestration protocol for OpenCoven. Preserve identity, authority, correlation, durability, and recovery across runtimes and surfaces. + +Psyche Build is the first planned reference client; it is not the protocol owner. Coven, Threads, and Familiar Contract retain their own canonical domains. + +## Start here + +1. Read `README.md`. +2. Read `docs/ROADMAP.md` and confirm the work has an owning issue. +3. Read `docs/PROTOCOL-OWNERSHIP.md` before changing a cross-repository boundary. +4. Read the scoped architecture/testing documents relevant to the change. +5. Run `./scripts/agent-bootstrap`. +6. Run `./scripts/agent-check fast` before editing and after each bounded slice. +7. Run `./scripts/agent-check full` before requesting review. + +## Canonical documents + +- Architecture and dependency direction: `docs/ARCHITECTURE.md` +- Protocol/schema inventory: `docs/SCHEMAS.md` +- Deterministic evidence model: `docs/TESTING.md` +- Current G2 evidence: `docs/G2-EVIDENCE.md` +- CLI boundary: `docs/CLI.md` +- Configuration: `docs/CONFIGURATION.md` +- Program roadmap: `docs/ROADMAP.md` +- Cross-repository ownership: `docs/PROTOCOL-OWNERSHIP.md` +- Contribution and review contract: `CONTRIBUTING.md` +- Security reporting and protected data: `SECURITY.md` +- Machine-readable repository contract: `agent/manifest.yaml` + +## Ownership by path + +| Path | Canonical responsibility | +|---|---| +| `crates/psyche-core/**` | IDs, records, validation, canonicalization, digests, errors | +| `crates/psyche-store/**` | durable storage, transitions, migrations, quarantine, retention | +| `crates/psyche-coven/**` | typed Coven adapter; never replaces core decisions | +| `crates/psyche-surfaces/**` | bounded surface ports | +| `crates/psyche-runtime/**` | runtime composition and shutdown | +| `crates/psyche-cli/**` | process/CLI boundary | +| `crates/psyche-test-support/**` | reusable conformance evidence, not production authority | +| `packages/psyche-npm/**` | npm wrapper and packed distribution | +| `.github/**`, `scripts/**` | CI, evidence, release, and verification controls | + +## Risk classes + +- **R0:** prose and examples with no contract claim. +- **R1:** pure implementation that cannot mutate durable state or authority. +- **R2:** local mutable state, migrations, or recovery helpers. +- **R3:** network, credentials, external systems, or user data. +- **R4:** canonical identity, authorization, persistence, dispatch, receipts, cancellation, recovery, evidence, and release. + +Psyche is an R4 repository. Any R2–R4 change needs explicit failure, rollback, and retained-evidence criteria. Do not widen authority to simplify a test. + +## Invariants + +Never: + +- derive durable identity from a tracker, process, tmux pane, path, transport, UI component, or provider session; +- treat successful decoding or dispatch as authorized completion; +- replace an unknown or ambiguous result with success; +- redispatch an indeterminate effect without the canonical reconciliation/fence rule; +- mutate append-only records or rewrite history to “repair” state; +- accept unknown major versions, enums, kinds, or widened capabilities silently; +- hand-edit generated fixtures or evidence where a canonical generator exists; +- weaken negative, crash, restart, quarantine, or structured-denial tests; +- expose secrets or unrestricted user/project content in evidence. + +## Change workflow + +1. Claim one issue and one bounded outcome. +2. Record current behavior and the invariant being preserved. +3. Add or identify focused positive and negative tests. +4. Implement the smallest compatible slice. +5. Run the fast gate. +6. Run the relevant conformance, migration, property, or crash tests. +7. Run the full gate. +8. Inspect `git diff --check` and ensure generated outputs are canonical. +9. Open a focused PR with exact commands/results, risk, migration, rollback, affected consumers, and remaining proof gaps. +10. Do not close the outcome until durable evidence is linked. + +## Protected surfaces + +Treat these as requiring focused owner review: + +- canonical ID prefixes and record schemas; +- canonical JSON and digest construction; +- structured error/denial vocabulary; +- migrations and persisted compatibility; +- adoption, dispatch, fencing, cancellation, receipts, and recovery; +- quarantine and retention; +- runtime shutdown/checkpoint ordering; +- conformance fixtures and evidence checker allowlists; +- CI, supply-chain, secret, and release controls. + +## Generated and evidence files + +Do not edit generated artifacts manually. Use the documented generator or update the generator and artifact in the same PR. + +`docs/G2-EVIDENCE.md` is retained evidence tied to immutable commits and runs. It is not a mutable status dashboard. New evidence must identify source SHA, command, result, and immutable artifact/run. + +## Verification + +```sh +./scripts/agent-check fast +./scripts/agent-check full +``` + +The full local script intentionally does not replace GitHub's cross-platform, cargo-deny, or full-history secret jobs. A local pass is necessary, not sufficient. + +## Cross-repository changes + +Before changing a public contract: + +- update the producer/consumer ownership map; +- identify every affected OpenCoven repository; +- define version negotiation and rollback; +- update immutable compatibility pins/canaries; +- preserve old reads until migration evidence permits removal; +- do not make Psyche Build, Cave, Coven, or Threads a hidden source of canonical truth. + +## Completion evidence + +A completion comment or PR must include: + +- objective and non-goals; +- files intentionally changed; +- risk class and protected surfaces touched; +- exact tests and results; +- compatibility and consumer impact; +- migration and rollback; +- generated artifact provenance; +- unresolved uncertainty or unavailable platform evidence; +- exact commit SHA. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d407941 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,93 @@ +# Contributing to Psyche + +Psyche is a protocol and durable-state repository. Contributions are welcome, but compatibility and failure behavior matter as much as the happy path. + +## Before starting + +1. Read `README.md`, `AGENTS.md`, and `docs/ROADMAP.md`. +2. Find or open one owning issue with outcome, acceptance criteria, dependencies, non-goals, and evidence requirements. +3. For cross-repository work, read `docs/PROTOCOL-OWNERSHIP.md`. +4. Classify the change using the risk classes in `AGENTS.md`. + +Do not begin an R3/R4 contract change from an unreviewed implementation assumption. + +## Setup + +```sh +git clone https://github.com/OpenCoven/psyche.git +cd psyche +./scripts/agent-bootstrap +./scripts/agent-check fast +``` + +The pinned Rust version is declared in `rust-toolchain.toml`. Use the locked Cargo dependency graph. + +## Development loop + +Keep each pull request focused on one contract or capability boundary. + +```sh +./scripts/agent-check fast +# make a bounded change +./scripts/agent-check fast +# run the directly affected conformance/migration/fault tests +./scripts/agent-check full +``` + +Add behavior-level tests before changing canonical records, transitions, persistence, dispatch, or recovery. + +## Pull request contract + +A pull request should include: + +- the owning issue; +- objective and non-goals; +- current behavior and invariant; +- risk class; +- public records, schemas, migrations, or consumers affected; +- exact commands and results; +- negative, crash, restart, ambiguity, and downgrade coverage where relevant; +- generated artifacts and generator command; +- migration and rollback; +- security/privacy impact; +- remaining proof gaps; +- exact final head SHA. + +A merged source diff is not enough to close a runtime or compatibility outcome. Link retained evidence. + +## Compatibility + +Do not: + +- change a stable record or ID without versioning; +- accept unknown versions/enums by guessing; +- silently widen capabilities; +- reuse process/UI/provider identifiers as protocol IDs; +- remove compatibility reads before migration evidence exists; +- convert ambiguous or indeterminate effects into success; +- modify golden bytes without an explicit compatibility decision. + +Cross-repository changes must identify producers, consumers, release order, immutable canary pins, and rollback. + +## Generated files + +Use canonical generators. Never hand-edit generated schemas, fixtures, packed artifacts, or evidence summaries to make a check pass. + +After generation: + +```sh +git diff --check +git status --short +``` + +Review every generated change. + +## Security and protected data + +Follow `SECURITY.md`. Public issues, PRs, fixtures, and evidence must not contain secrets, credentials, private keys, raw prompts, unrestricted terminal output, private repository contents, full environment dumps, infrastructure details, or unnecessary personal paths. + +## Review + +R2–R4 changes require review from the owner of the affected surface. Resolve every current review finding and rerun required checks on the exact final head. + +Keep changes reversible until compatibility and runtime evidence is complete. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5f5ad1f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 OpenCoven contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..21c8626 --- /dev/null +++ b/README.md @@ -0,0 +1,114 @@ +# Psyche + +Psyche is OpenCoven's canonical orchestration protocol and reference implementation for durable, identity-preserving agent work. + +It defines how tasks, graphs, lanes, execution attempts, delegations, deliveries, approvals, receipts, cancellation, recovery, and terminal outcomes are represented and verified without coupling those identities to a UI, tracker, process, transport, or persistence provider. + +> **Status:** pre-1.0 protocol foundation. The current repository has passed the documented G2 contract-foundation evidence. Consumer-ready protocol v1 artifacts and the first Psyche Build compatibility canary are tracked on the active roadmap. Do not infer support beyond retained evidence. + +## Canonical ownership + +Psyche owns: + +- orchestration identity and correlation; +- task, graph, lane, attempt, delegation, and delivery contracts; +- canonical serialization, digests, structured denials, and compatibility behavior; +- capability/lease, approval, receipt, cancellation, recovery, and terminal-state semantics; +- adapter conformance requirements. + +Psyche does not own: + +- familiar or person-binding identity (`OpenCoven/familiar-contract`); +- protected-surface authorization decisions (`OpenCoven/coven-threads`); +- daemon session, persistence, or runtime authority (`OpenCoven/coven`); +- product UI, tmux panes, worktrees, branches, provider sessions, or tracker state; +- the Psyche Build product (`OpenCoven/psyche-build`). + +See [Protocol ownership](docs/PROTOCOL-OWNERSHIP.md) for the proposed cross-repository boundary and [the roadmap](docs/ROADMAP.md) for graduation gates. + +## Repository map + +| Path | Responsibility | +|---|---| +| `crates/psyche-core` | Canonical contracts, IDs, validation, digests, schemas, and errors | +| `crates/psyche-store` | Durable records, append-only transitions, migrations, quarantine, and retention | +| `crates/psyche-coven` | Typed Coven adapter boundary | +| `crates/psyche-surfaces` | Bounded surface ports | +| `crates/psyche-runtime` | Runtime composition and lifecycle | +| `crates/psyche-cli` | CLI and daemon process boundary | +| `crates/psyche-config` | Configuration loading and validation | +| `crates/psyche-test-support` | Reusable adapter conformance, property, fault, and restart evidence | +| `packages/psyche-npm` | Dependency-free npm distribution wrapper | +| `docs` | Architecture, schemas, testing, evidence, ownership, and roadmap | +| `scripts` | Evidence and repository verification tools | + +The dependency direction and crate ownership are documented in [Architecture](docs/ARCHITECTURE.md). + +## Requirements + +- Rust **1.88.0**, pinned by `rust-toolchain.toml` +- Cargo with the locked dependency graph +- Python 3 for evidence verification +- Node.js 20+ and npm for the distribution wrapper checks +- Git +- A POSIX shell for the repository helper scripts + +The GitHub workflow remains the source of truth for the full Linux, macOS, Windows, supply-chain, secret, and npm matrix. + +## Quick start + +```sh +./scripts/agent-bootstrap +./scripts/agent-check fast +``` + +Run the complete local gate before requesting review: + +```sh +./scripts/agent-check full +``` + +Direct Cargo entrypoints remain available: + +```sh +cargo test --workspace --locked +cargo test -p psyche-test-support --test conformance +cargo run -p psyche-cli -- --help +``` + +See [CLI](docs/CLI.md), [Configuration](docs/CONFIGURATION.md), and [Testing](docs/TESTING.md). + +## Change policy + +Psyche is an R4 repository: small mistakes can fork identity, widen authority, lose durable evidence, or make an ambiguous effect appear complete. + +Changes to canonical IDs, record shapes, digests, migrations, dispatch, persistence, cancellation, recovery, compatibility, or release evidence require: + +1. an owning roadmap issue; +2. explicit positive and negative acceptance criteria; +3. migration and rollback analysis; +4. focused contract tests before implementation; +5. exact-head CI evidence; +6. affected-consumer and compatibility-canary review. + +Read [AGENTS.md](AGENTS.md) before making changes and [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request. + +## Roadmap + +The active 90-day program is tracked in: + +- [Roadmap document](docs/ROADMAP.md) +- [Roadmap control issue](https://github.com/OpenCoven/psyche/issues/9) +- [Repository and agent-readiness foundation](https://github.com/OpenCoven/psyche/issues/10) +- [Protocol v1 publication](https://github.com/OpenCoven/psyche/issues/11) +- [Cross-repository ownership](https://github.com/OpenCoven/psyche/issues/12) +- [Psyche Build reference-client canary](https://github.com/OpenCoven/psyche/issues/13) +- [Security, release, support, and governance](https://github.com/OpenCoven/psyche/issues/14) + +## Security + +Do not post credentials, private keys, raw prompts, unrestricted terminal output, private repository contents, environment dumps, or sensitive paths in public issues or retained evidence. Follow [SECURITY.md](SECURITY.md). + +## License + +MIT. See [LICENSE](LICENSE). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..0ea0fe3 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,61 @@ +# Security policy + +Psyche defines identity, authority, persistence, execution, receipt, cancellation, and recovery contracts. Security reports are treated as protocol-impacting until triage proves otherwise. + +## Supported versions + +Psyche is currently pre-1.0. Only the current `main` contract foundation and explicitly identified release artifacts receive active security fixes. No unreleased consumer profile should be inferred to be supported. + +Supported versions and future maintenance windows will be listed here when the first protocol release candidate is published. + +## Reporting a vulnerability + +Use GitHub's **private vulnerability reporting** for this repository when available. + +If the private reporting control is unavailable, contact `@BunsDev` through GitHub to request a private channel. Do not include vulnerability details in a public issue, discussion, pull request, commit message, or CI log. + +For an urgent public routing request, open an issue containing only: + +- that a private security contact is needed; +- the affected repository and broad surface; +- a safe way for a maintainer to contact you. + +Do not include reproduction steps or protected data publicly. + +## Include privately + +- affected version, commit, or artifact digest; +- affected identity/authority/persistence boundary; +- minimal reproduction; +- expected and observed behavior; +- whether exploitation crosses a trust, project, subject, device, or runtime boundary; +- data-loss, duplicate-effect, authority-widening, or recovery impact; +- suggested mitigation, if known. + +## Never post publicly + +- tokens, passwords, private keys, certificates, signing material, or credentials; +- raw prompts or unrestricted terminal output; +- private repository contents; +- full environment-variable dumps; +- private service URLs or infrastructure details; +- unnecessary full filesystem paths or personal data; +- exploit code before coordinated disclosure. + +## Security-sensitive surfaces + +Changes to these areas require focused review and exact-head evidence: + +- canonical IDs, records, enums, serialization, and digests; +- structured denials and version negotiation; +- durable store, migrations, quarantine, retention, and crash recovery; +- capability, adoption, dispatch, fencing, approval, receipt, cancellation, and recovery; +- Coven and surface adapters; +- evidence allowlists and verification scripts; +- CI, dependencies, secret scanning, packaging, release, and provenance. + +## Response and disclosure + +Maintainers will acknowledge a private report, assess severity and affected versions, coordinate a fix and downstream canaries, and agree on disclosure timing. Timelines depend on impact and the number of affected consumers; uncertainty will be stated rather than hidden. + +Do not publish before the fix, migration/rollback guidance, and affected-consumer plan are ready unless active exploitation or user safety requires a different coordinated response. diff --git a/agent/manifest.yaml b/agent/manifest.yaml new file mode 100644 index 0000000..19de5f0 --- /dev/null +++ b/agent/manifest.yaml @@ -0,0 +1,100 @@ +schema_version: opencoven.agent-repo/v1 + +repository: + name: OpenCoven/psyche + role: canonical-orchestration-protocol + lifecycle: active + roadmap: docs/ROADMAP.md + canonical_for: + - orchestration.identity + - orchestration.task-graph + - orchestration.lanes-attempts-delegation-delivery + - orchestration.leases-approvals-receipts + - orchestration.cancellation-recovery-terminal-state + - orchestration.canonicalization-and-conformance + explicitly_not_canonical_for: + - familiar.person-binding + - threads.authorization-policy + - coven.daemon-session-persistence + - product.ui + - product.tmux-worktree-provider-state + - tracker.github-beads-state + +risk: + class: R4 + network_policy: bootstrap-and-explicit-adapters-only + secrets_policy: forbidden-in-repository-fixtures-logs-and-evidence + protected_paths: + - crates/psyche-core/** + - crates/psyche-store/** + - crates/psyche-coven/** + - crates/psyche-test-support/** + - scripts/g2-test-manifest.json + - scripts/check-g2-evidence.py + - docs/G2-EVIDENCE.md + - .github/workflows/** + - Cargo.lock + - deny.toml + generated_paths: [] + external_side_effects: + - package-publication + - release-publication + - downstream-contract-migration + +agent: + entrypoint: AGENTS.md + bootstrap: ./scripts/agent-bootstrap + verify: + fast: ./scripts/agent-check fast + full: ./scripts/agent-check full + required_completion_evidence: + - owning-issue + - exact-head-sha + - exact-commands-and-results + - risk-and-protected-paths + - compatibility-and-consumer-impact + - migration-and-rollback + - generated-artifact-provenance + - remaining-proof-gaps + +contracts: + produces: + - id: psyche.contract-foundation.g2 + status: implemented-and-attested + evidence: docs/G2-EVIDENCE.md + - id: psyche.protocol.v1 + status: planned + owner: https://github.com/OpenCoven/psyche/issues/11 + consumes: + - id: coven.typed-adapter-boundary + status: implemented + path: crates/psyche-coven + - id: familiar.person-binding + status: ownership-decision-pending + owner: https://github.com/OpenCoven/psyche/issues/12 + - id: threads.authorization-decision + status: ownership-decision-pending + owner: https://github.com/OpenCoven/psyche/issues/12 + reference_consumers: + - id: psyche-build + status: planned + owner: https://github.com/OpenCoven/psyche/issues/13 + +toolchains: + rust: 1.88.0 + node_minimum: "20" + python_minimum: "3" + lockfiles: + - Cargo.lock + +ci: + source_of_truth: .github/workflows/ci.yml + claimed_platforms: + - linux + - macos + - windows + additional_gates: + - dependency-audit + - full-history-secret-scan + - npm-node-20-and-22 + - g2-evidence-relationships diff --git a/docs/PROTOCOL-OWNERSHIP.md b/docs/PROTOCOL-OWNERSHIP.md new file mode 100644 index 0000000..950867f --- /dev/null +++ b/docs/PROTOCOL-OWNERSHIP.md @@ -0,0 +1,118 @@ +# OpenCoven protocol ownership + +**Status:** proposed baseline pending [OpenCoven/psyche#12](https://github.com/OpenCoven/psyche/issues/12) +**Last reconciled:** 2026-08-26 + +This document prevents implementation order from becoming accidental canonical ownership. + +## Principle + +A durable identity or consequential transition has exactly one canonical owner. Products and adapters may cache, project, or reference protocol state, but must not create a second source of truth. + +Transport location, process identity, filesystem paths, tmux panes, worktrees, branches, provider sessions, Beads, GitHub issues, and UI selections are implementation references—not protocol identity or authority. + +## Proposed ownership matrix + +| Domain | Canonical owner | Consumer relationship | +|---|---|---| +| Familiar identity and person binding | `OpenCoven/familiar-contract` | Psyche references stable familiar/person bindings | +| Protected-surface authorization decision | `OpenCoven/coven-threads` | Psyche carries and enforces the decision/constraints; it does not redefine policy | +| Orchestration task/graph/lane/attempt/delegation/delivery | `OpenCoven/psyche` | Products and runtimes implement versioned adapters | +| Lease, approval, receipt, cancellation, recovery, terminal outcome | `OpenCoven/psyche` | Adapters preserve exact correlation and fail-closed behavior | +| Daemon session, persistence, and runtime authority | `OpenCoven/coven` | Psyche references canonical daemon/runtime resources through typed boundaries | +| Runtime capability descriptors | `OpenCoven/coven-runtimes` | Psyche negotiates a pinned supported capability profile | +| Coding cockpit and local product behavior | `OpenCoven/psyche-build` | First Psyche reference client; panes/worktrees remain product-local | +| Human oversight and approval UI | `OpenCoven/coven-cave` | Renders/requests protocol state; does not infer completion | +| Public constrained client API | `OpenCoven/sdk` | Consumes an approved read/mutation profile | +| Read-only memory access | `OpenCoven/coven-memory` | Cannot become memory mutation authority | +| Documentation and compatibility ledger | `OpenCoven/coven-docs` | Generated from canonical artifacts; not a contract owner | + +## Psyche ownership + +Psyche canonically owns: + +- orchestration record kinds and identifier namespaces; +- task graph and execution correlation; +- lane, attempt, delegation, and delivery semantics; +- capability/lease lifecycle; +- approval lifecycle; +- action and receipt lifecycle; +- cancellation acknowledgement and unresolved outcomes; +- ambiguity reconciliation, idempotency, and fencing; +- artifact/evidence correlation; +- recovery and terminal-state vocabulary; +- canonical serialization, digest, version, and structured-denial behavior; +- adapter conformance profiles. + +Psyche does not own product layout, terminal rendering, worktree mechanics, provider launch details, daemon storage internals, authorization policy, or familiar identity. + +## Dependency direction + +The intended release dependency is acyclic: + +```text +familiar-contract ─┐ +coven-threads ─────┼─> psyche protocol profile +coven-runtimes ────┤ │ +coven ─────────────┘ ├─> psyche-build reference adapter + ├─> coven-cave oversight adapter + ├─> sdk constrained client + └─> coven-memory read-only client +``` + +A consumer may depend on a released Psyche profile. Psyche must not depend on a product repository's implementation to define the profile. + +## Psyche Build mapping rule + +Psyche Build may retain: + +- pane IDs; +- tmux session/pane IDs; +- worktree paths; +- branches and commits; +- provider session IDs; +- UI selection/focus state; +- Beads and GitHub planning references. + +Each may reference a Psyche ID. None may replace the Psyche ID, prove authority, or prove completion. + +Migration must introduce protocol IDs alongside local IDs, maintain reversible compatibility reads, and remove duplicate local semantics only after pinned canaries prove equivalence. + +## Contract-change policy + +A stable contract change must include: + +1. canonical owner and affected record/transition; +2. old/new version behavior; +3. positive and denial vectors; +4. unknown-major/enum behavior; +5. migration, downgrade, and rollback; +6. producer and consumer inventory; +7. immutable artifact/profile pin; +8. exact-head downstream canary results; +9. release order; +10. removal/deprecation window. + +Do not merge a change that creates circular release ownership or requires a consumer's unreleased implementation to define the producer contract. + +## Authority and evidence + +- A decoded request is not necessarily authorized. +- A dispatched request is not necessarily complete. +- UI/process activity is not a terminal state. +- An ambiguous effect remains unknown or recovery-required until canonical reconciliation proves otherwise. +- Retained evidence identifies source/artifact digest, exact command/action, correlation IDs, result, and unavailable proof gaps. +- Evidence must be bounded and exclude protected user/project content. + +## Open decisions + +The owning issue must approve: + +- exact integration of Familiar and Threads identifiers/decisions; +- first stable Psyche consumer profile; +- Coven and runtime version-negotiation boundary; +- Cave/iOS approval and reconnect flow; +- SDK mutation profiles; +- release-order and emergency compatibility policy. + +Until approved, this document is a proposed boundary and must not be cited as shipped protocol support. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md new file mode 100644 index 0000000..42df563 --- /dev/null +++ b/docs/ROADMAP.md @@ -0,0 +1,148 @@ +# Psyche roadmap + +**Status:** active program +**Last reconciled:** 2026-08-26 +**Roadmap control:** [OpenCoven/psyche#9](https://github.com/OpenCoven/psyche/issues/9) +**Owner:** [@BunsDev](https://github.com/BunsDev) + +Psyche is graduating from a strong G2 contract foundation into OpenCoven's consumer-ready canonical orchestration protocol. + +The roadmap is gate-driven. Target dates coordinate work; they never replace compatibility, security, recovery, or retained-evidence requirements. + +## Baseline + +Implemented and evidenced today: + +- canonical records, IDs, validation, serialization, digests, and structured denials; +- append-only durable storage, migrations, quarantine, retention, and crash recovery; +- typed Coven and bounded surface ports; +- runtime and CLI composition; +- deterministic property, conformance, migration, crash, restart, and evidence checks; +- Linux, macOS, Windows, dependency-audit, secret, and npm CI surfaces. + +The current foundation is not yet a consumer-ready protocol release. Stable schemas, immutable profile artifacts, downstream pins, compatibility policy, reference-client canaries, support windows, and release governance remain explicit work. + +## Program outcomes + +| Issue | Outcome | Priority | Phase | +|---|---|---:|---:| +| [#10](https://github.com/OpenCoven/psyche/issues/10) | Repository and agent-readiness foundation | P0 | 0 | +| [#11](https://github.com/OpenCoven/psyche/issues/11) | Protocol v1 schemas, golden vectors, and conformance runner | P0 | 1 | +| [#12](https://github.com/OpenCoven/psyche/issues/12) | Cross-repository ownership and compatibility | P0 | 0–1 | +| [#13](https://github.com/OpenCoven/psyche/issues/13) | Psyche Build reference-client conformance | P1 | 2 | +| [#14](https://github.com/OpenCoven/psyche/issues/14) | Security, release, support, and governance readiness | P1 | 0 and 4 | + +## Phase 0 — control and agent readiness + +**Target:** Aug 26–Sep 8, 2026 +**Owners:** #10, #12, and the minimum security floor in #14 + +Deliver: + +- root README, agent guide, contribution/security/license surfaces; +- machine-readable repository role and risk manifest; +- one bootstrap and fast/full verification interface; +- active roadmap and ownership map; +- protected/generated path policy; +- initial cross-repository decision record; +- minimum security reporting and ownership controls. + +**Exit gate:** a clean checkout can be understood and verified without private maintainer context, and no canonical ownership remains implicit. + +## Phase 1 — protocol v1 publication + +**Target:** Sep 9–Sep 29, 2026 +**Owners:** #11 and #12 + +Deliver: + +- public record/schema inventory with stability classification; +- versioned machine-readable schemas; +- byte-exact canonical JSON and digest vectors; +- positive, denial, ambiguity, restart, downgrade, and unknown-version fixtures; +- standalone bounded conformance runner; +- compatibility, migration, downgrade, deprecation, and rollback policy; +- immutable, checksummed consumer profile artifacts. + +**Exit gate:** a downstream repository can pin one immutable artifact set and run conformance without copying internal Rust types or checking out Psyche source. + +## Phase 2 — Psyche Build reference client + +**Target:** Sep 30–Oct 20, 2026 +**Owners:** #13 and [OpenCoven/psyche-build#253](https://github.com/OpenCoven/psyche-build/issues/253) + +Deliver: + +- approved mapping of Psyche Build state to Psyche contracts; +- immutable profile pin and digest verification; +- positive and negative compatibility canaries; +- protocol-owned IDs introduced alongside product-local IDs; +- reversible adapter/persistence migrations; +- desktop restart/resume reference flow. + +**Exit gate:** Psyche Build passes the pinned profile without making panes, worktrees, tmux, providers, Beads, GitHub, transports, or UI selections protocol identity. + +## Phase 3 — lifecycle completion + +**Target:** Oct 21–Nov 10, 2026 + +Deliver executable lifecycle semantics for: + +- capability/lease issuance, expiry, revocation, and renewal; +- approval request, resolution, invalidation, and audit correlation; +- action/receipt pending, accepted, executing, succeeded, failed, unknown, and recovery-required states; +- cancellation acknowledgement and unresolved outcomes; +- retry/idempotency, ambiguity reconciliation, and fencing; +- artifact/evidence correlation and retention; +- cross-surface disconnect/restart/resume. + +**Exit gate:** consequential work has one durable identity and terminal/recovery path across restarts and adapters; no surface infers truth from activity alone. + +## Phase 4 — release candidate and governance + +**Target:** Nov 11–Nov 24, 2026 +**Owner:** #14 + +Deliver: + +- protected owners and enforced required checks; +- release/version/support policy; +- packed clean-install verification; +- checksums, SBOM, provenance, and signed immutable metadata; +- downstream compatibility matrix and canary evidence; +- migration, downgrade, rollback, deprecation, and emergency procedures; +- one end-to-end OpenCoven reference flow. + +**Exit gate:** the release candidate is reproducible, supportable, reversible, and consumable by a pinned downstream client. + +## Critical path + +1. #10 makes the repository operable. +2. #12 settles boundaries while #10 lands. +3. #11 publishes stable consumer artifacts after #10/#12. +4. #13 pins those artifacts in Psyche Build. +5. lifecycle completion builds on the proven profile. +6. #14 rehearses and publishes the release candidate. + +Minimum security work may run in parallel. Psyche Build mapping may begin before protocol publication, but no floating or invented profile may be treated as canonical. + +## Metrics + +| Metric | Target | +|---|---:| +| Active repo has root agent entrypoint and manifest | 100% | +| Clean-clone bootstrap success on claimed platforms | 100% | +| Stable records with schema and canonical vector | 100% | +| Stable transitions with positive and denial vectors | 100% | +| Unknown/widened inputs that fail closed | 100% | +| Required consumer canaries pinned immutably | 100% | +| Consequential effects with durable receipt/recovery state | 100% | +| Contract releases with migration and rollback guidance | 100% | +| Ambiguous canonical ownerships | 0 | +| Stable identities derived from implementation-local IDs | 0 | + +## Tracking and closure + +GitHub issues own public outcomes and acceptance gates. Pull requests own reviewable slices. Immutable artifacts and retained test/runtime evidence own completion claims. + +A child issue closes only when its evidence is linked. The roadmap issue closes only after a successor release/maintenance mechanism is explicit. diff --git a/scripts/agent-bootstrap b/scripts/agent-bootstrap new file mode 100755 index 0000000..1d1e191 --- /dev/null +++ b/scripts/agent-bootstrap @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$repo_root" + +required_commands=(cargo rustc git python3 node npm) +missing=() +for command_name in "${required_commands[@]}"; do + if ! command -v "$command_name" >/dev/null 2>&1; then + missing+=("$command_name") + fi +done + +if ((${#missing[@]} > 0)); then + printf 'Missing required commands: %s\n' "${missing[*]}" >&2 + exit 1 +fi + +rust_version="$(rustc --version | awk '{print $2}')" +if [[ "$rust_version" != "1.88.0" ]]; then + printf 'Psyche requires rustc 1.88.0; found %s. Install/use the pinned rust-toolchain.toml toolchain.\n' "$rust_version" >&2 + exit 1 +fi + +node_major="$(node -p 'Number(process.versions.node.split(".")[0])')" +if [[ ! "$node_major" =~ ^[0-9]+$ ]] || ((node_major < 20)); then + printf 'Psyche requires Node.js 20 or newer; found %s.\n' "$(node --version)" >&2 + exit 1 +fi + +if [[ "${PSYCHE_BOOTSTRAP_OFFLINE:-0}" == "1" ]]; then + cargo fetch --locked --offline +else + cargo fetch --locked +fi + +cargo metadata --locked --no-deps --format-version 1 >/dev/null +npm --prefix packages/psyche-npm test >/dev/null + +printf 'Psyche bootstrap complete.\n' +printf ' rustc: %s\n' "$(rustc --version)" +printf ' cargo: %s\n' "$(cargo --version)" +printf ' node: %s\n' "$(node --version)" +printf ' npm: %s\n' "$(npm --version)" +printf 'Run ./scripts/agent-check fast before editing.\n' diff --git a/scripts/agent-check b/scripts/agent-check new file mode 100755 index 0000000..a9e9f80 --- /dev/null +++ b/scripts/agent-check @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$repo_root" + +mode="${1:-fast}" + +run_common() { + cargo fmt --all -- --check + git diff --check +} + +run_fast() { + run_common + cargo check --workspace --locked + cargo test -p psyche-core --locked + cargo test -p psyche-store --test migrations --locked +} + +run_full() { + run_common + cargo clippy --workspace --all-targets -- -D warnings + cargo test --workspace --locked + + PROPTEST_CASES=2048 \ + PROPTEST_RNG_SEED=00000000000000000000000000000000 \ + cargo test -p psyche-test-support --test state_machine + + cargo test -p psyche-test-support --test conformance + cargo test -p psyche-store --test migrations + cargo test -p psyche-store --features test-fault-injection --test crash + cargo clippy -p psyche-store --all-targets --features test-fault-injection -- -D warnings + + python3 scripts/check-g2-evidence-test.py + npm --prefix packages/psyche-npm test + npm pack ./packages/psyche-npm --dry-run >/dev/null + + git diff --check + git diff --exit-code +} + +case "$mode" in + fast) + run_fast + ;; + full) + run_full + ;; + *) + printf 'Usage: %s [fast|full]\n' "$0" >&2 + exit 2 + ;; +esac + +printf 'Psyche agent check (%s) passed.\n' "$mode" +printf 'GitHub CI remains authoritative for the cross-platform, dependency-audit, secret, and evidence-relationship matrix.\n'