Skip to content

Pivot to a deterministic policy engine; ship engine v0 (v0.2.0)#43

Merged
hyperpolymath merged 4 commits into
mainfrom
claude/project-scope-discussion-1dvjn8
Jul 3, 2026
Merged

Pivot to a deterministic policy engine; ship engine v0 (v0.2.0)#43
hyperpolymath merged 4 commits into
mainfrom
claude/project-scope-discussion-1dvjn8

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What & why

This repo described itself as "the official governance automation engine for the Palimpsest-MPL ecosystem" — an OCaml policy engine (PLASMA) enforcing a custom license (PMPL), plus an embedded union-contract validator. Investigation found the OCaml engine was 0% built (the README and EXPLAINME.adoc cited .ml source files that were never written), the workspace did not compile (init/migrate embedded a nonexistent license file), 2 parser tests failed on PMPL/PPMPL identifier drift, and the Justfile targeted OCaml tooling the repo doesn't use. The real assets were ~3,300 LOC of working Rust.

Per discussion, this PR pivots the project to what it can actually be: a deterministic, typed policy engine for the agentic era — "does what it is told, absolutely precisely." It's the policy-definition + compliance-evaluation member of a planned trio with somethings-fishy (forensic bot-damage investigation) and did-you-actually-do-that (agent claim verification). The Palimpsest license becomes a separate future project.

Engine v0 (new plasma-engine crate)

  • Typed policy AST — subjects, resources, composable conditions, deontic modalities (obligation/prohibition/permission), overlays — transposed from docs/policy-ast-v0.1.adoc to Rust
  • Versioned TOML/JSON schema loading with load-time rejection of reserved constructs, so evaluate is total (any policy that loads, evaluates)
  • Deterministic fact collection (files, SPDX headers, Cargo version, git HEAD) as the only impure boundary
  • Pure evaluator implementing the deontic matrix; BTree ordering → byte-identical output for identical inputs
  • Human, JSON, and SARIF 2.1.0 renderers with a stable plasma/<rule-id> namespace for sibling tooling
  • Bundled repo-hygiene policy; the repo checks itself in CI (tests/check_selftest.rs)
  • Normative spec + Catala-readiness guarantees in docs/engine-v0-design.adoc

CLI

  • New: plasma check / facts / policy validate
  • audit rewired onto plasma-parser (real SPDX parsing, .plasma.toml zones) via a new scan_repo; init/migrate/badge genericized to any SPDX license (MPL-2.0 default)
  • Binary renamed palimpsest-plasmaplasma

Truth + green

  • Workspace compiles; 66 tests pass; cargo fmt and clippy -D warnings clean; plasma audit . reports 100%; plasma check . self-passes with 0 violations, deterministically
  • Licensing unified: code MPL-2.0, docs CC-BY-SA-4.0; SPDX headers swept (PMPL/PPMPL survive only as identifiers the parser recognises)
  • Docs rewritten to describe what exists (README, EXPLAINME, TOPOLOGY, ROADMAP, architecture, cli-design, 0-AI-MANIFEST); metadata corrected (codemeta.json/CITATION.cff had described an unrelated boilerplate project)
  • Justfile rewritten from dune/opam to cargo; Elixir site render helpers restored; guix.scm fixed
  • Removed: union-policy-parser (~90% non-compiling scaffolding; preserved in git history), corrupted LICENSE-PMPL-2.0.txt, MVP release tarballs, badge pack, stale signature files, PALIMPSEST-COVENANT.md, docs/mvp-v1.adoc

Verification

cargo build --workspace && cargo test --workspace   # 66 tests
cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings
cargo run -- check . --format json | python3 -m json.tool   # deterministic, 0 violations
cargo run -- audit .                                        # 100%, exit 0

The Elixir site is verified by CI (nimble-site.yml) — mix isn't available in this environment.

Out of scope (roadmap)

Action planner / plasma fix, git hooks, and the GitHub Action integration surface are documented in ROADMAP.adoc (v0.3–v0.4), not implemented here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq


Generated by Claude Code

claude added 3 commits July 3, 2026 01:23
palimpsest-plasma is now a deterministic, typed policy engine for the
agentic era, not a PMPL governance toolkit. Write machine-readable deontic
policies and evaluate repositories against them with reproducible results.

Engine v0 (new plasma-engine crate):
- Typed policy AST (subjects, resources, composable conditions, deontic
  modalities, overlays) transposed from docs/policy-ast-v0.1.adoc to Rust
- Versioned TOML/JSON schema loading with load-time rejection of reserved
  constructs, so evaluation is total
- Deterministic fact collection (files, SPDX headers, Cargo version, git
  HEAD) as the sole impure boundary
- Pure evaluator implementing the deontic matrix; BTree ordering gives
  byte-identical output for identical inputs
- Human, JSON, and SARIF 2.1.0 renderers with a stable plasma/<rule-id>
  namespace for sibling tooling
- Bundled repo-hygiene policy; the repo checks itself in CI

CLI:
- New: plasma check / facts / policy validate
- audit rewired onto plasma-parser (real SPDX parsing, .plasma.toml zones)
  via a new scan_repo; init/migrate/badge genericized to any SPDX license
- binary renamed palimpsest-plasma -> plasma

Truth + green:
- Build fixed (init/migrate embedded a nonexistent license file); SPDX
  catalog PMPL/PPMPL drift fixed (2 tests); 66 tests pass; clippy clean
- Licensing unified: code MPL-2.0, docs CC-BY-SA-4.0; SPDX headers swept
- Docs rewritten to describe what exists (the OCaml engine was never
  built); added docs/engine-v0-design.adoc as the normative spec
- Justfile rewritten from OCaml (dune/opam) to cargo; site render helpers
  restored; guix.scm fixed; codemeta/CITATION corrected
- Removed union-policy-parser (preserved in history), corrupted PMPL
  license text, MVP tarballs, badge pack, stale signature files

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
- site: NimblePublisher evaluates the pre-`---` front-matter block as
  Elixir, so the content files' HTML-comment SPDX header broke the build
  ("unexpected ( after alias Copyright"). Use `#` Elixir comments instead.
- secret-scanner: remove the redundant, unpinned `trufflehog@main` inline
  job (the SHA-pinned secret-scanner-reusable already covers it), fixing
  the governance workflow security linter.
- codeql: analyze `rust` instead of `javascript-typescript` — the repo has
  no JS/TS, which caused a CodeQL configuration error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
NimblePublisher's `as: :pages` option populates the `@pages` module
attribute with the parsed Page structs; there is no generated `pages/0`
function. build/0 referenced the nonexistent function.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

The deploy job's permissions block overrode the workflow-level grant and
dropped id-token: write, which actions/deploy-pages needs for OIDC —
causing "Unable to get ACTIONS_ID_TOKEN_REQUEST_URL". It also ran on pull
requests, which would publish unmerged content to the live Pages site.

- gate deploy to push on the default branch (skipped on PRs)
- restore id-token: write on the deploy job
- target the github-pages environment as deploy-pages v5 expects

On PRs the site is now build-verified only; deploy runs on merge to main.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
@hyperpolymath
hyperpolymath marked this pull request as ready for review July 3, 2026 01:36
@hyperpolymath
hyperpolymath merged commit f280b6f into main Jul 3, 2026
21 checks passed
@hyperpolymath
hyperpolymath deleted the claude/project-scope-discussion-1dvjn8 branch July 3, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants