Skip to content

Complete LexShield OSS v0.1 — full feature build - #5

Merged
mosesman831 merged 12 commits into
mainfrom
cursor/lexshield-v01-full-cc14
Jul 11, 2026
Merged

Complete LexShield OSS v0.1 — full feature build#5
mosesman831 merged 12 commits into
mainfrom
cursor/lexshield-v01-full-cc14

Conversation

@mosesman831

Copy link
Copy Markdown
Contributor

Summary

Full OSS v0.1 build — all features from SPEC §9 implemented (no SaaS).

Engine (Python)

  • Policy engine + expressions + deterministic + LLM classifier (OpenAI-compatible)
  • Severity merge pipeline, fingerprint cache
  • Shield: @guard / guard_sync, challenges, traces (redacted NDJSON + stdout), execute_upstream
  • FastAPI local API: evaluate, execute/proxy, policy reload, traces, challenges, Bearer auth

CLI

  • init, check, run, evaluate, traces, challenge, packs, version, completion
  • Pack validation script for CI

TypeScript (@latticeag/lexshield)

  • Full parity: Shield, pipeline, LLM, challenges, traces, LocalApiClient

Content

  • 25 golden fixtures (Py/TS identical verdicts)
  • 3 runnable examples (block exfil, challenge delete, TS evaluate)
  • Filled docs + README quickstart
  • .github/workflows/ci.yml

Tests

Suite Count
Python pytest 98
TypeScript vitest 47
Golden scenarios 25

Explicitly out (per SPEC)

  • LexShield Cloud / SaaS
  • Framework adapters (contrib later)
  • Telemetry
Open in Web Open in Cursor 

cursoragent and others added 12 commits July 11, 2026 12:48
Remove Cloud/SaaS from MVP scope, replace M6 with docs/polish,
simplify GTM to OSS launch, and add an explicit build-readiness go.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Add SPEC §9 feature freeze: exact engine/SDK/CLI/API behaviors,
three demos, expression/redaction contracts, full policy pack YAML,
24-intent catalog, and Appendix D acceptance checklist.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Add JSON schemas, policy packs from SPEC Appendix A, golden fixtures,
examples, docs skeletons, CI workflow example, and contrib placeholder.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Add packages/engine-ts with ESM build (tsup), vitest, zod schemas for
Policy/ToolCallRequest/Verdict/Trace, YAML policy loader stubs, policy
engine and classifier pipeline stubs, SPEC §9.6 redaction, Shield SDK
surface, and basic tests.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Parallel scaffold of the full monorepo per SPEC v0.1:

- Root: MIT LICENSE, uv workspace, pnpm workspaces, README
- packages/engine-py: Pydantic models, policy/classifier/server stubs, redaction
- packages/cli: Typer CLI (init, check, run, evaluate, traces, challenge, packs)
- packages/engine-ts: @latticeag/lexshield with zod types and Shield stubs
- schemas/, packs/, fixtures/golden/, examples/, docs/, CI example

All Python (10) and TypeScript (10) tests pass; `uv run lexshield version` works.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Add expression parser/evaluator, full policy engine matching (tags,
expressions, priority/tie-break, unclassified fallback), deterministic
classifier parity with rules.yaml loading, golden and policy-engine tests.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
OSS-first implementation kickoff:

- SPEC v0.5: add §9B detailed implementation spec (module map, algorithms,
  golden matrix, CLI/API contracts, dev workflow)
- Python: real PolicyEngine, rule matching, safe expressions, compiled policies
- 10 golden fixtures + pytest harness (deterministic-only)
- CLI check/evaluate wired to Shield; trace writes on evaluate
- TypeScript golden confidence aligned with Python (0.5 unclassified)
- change-window pack priority fix for allow-infra-with-ticket

Tests: 35 Python + 26 TypeScript (10 golden scenarios parity)

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
- init: copy pack rules.yaml (follow symlinks), embed challenge-delete in baseline
- check: strict fails on warnings, taxonomy intent ref warnings
- evaluate: stdin ToolCallRequest, --caller JSON, --environment/--env, --tags
- traces: resolve path from config or --trace-file, pretty-print list/show
- challenge: wire ChallengeStore with config path resolution, print id/status
- main: add completion stub
- tests: evaluate, challenge, packs apply, and smoke flows

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Implement challenge creation on CHALLENGE verdicts in Shield.evaluate using
matched rule challenge config. Add NDJSON trace format with redacted arguments
and classifications, update_outcome patching, and StdoutTraceSink.

guard_sync uses asyncio.run with optional await_challenge polling. from_config
loads all sinks, challenge store path, proxy upstreams, and fail_on_classifier_error.
Add execute_upstream for httpx forwarding when ALLOW.

Move challenge ID creation from PolicyEngine to Shield. Add test_shield.py
covering guard, guard_sync, challenge creation, and record_outcome.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Implement taxonomy severity map, LLM classifier stub, classifier pipeline
with severity merge and caching, full Shield SDK (session context, guardSync,
trace sink, challenge store), LocalApiClient, and expanded test coverage.
All 25 golden fixtures pass.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
- Add runnable Python/TS examples with bundled policy configs
- Fill docs (policy, intents, SDKs, security, CLI) with real content
- Update README with verified deterministic quickstart
- Replace example workflow with ci.yml (pytest, pnpm test/golden, pack check)
- Add lexshield-check-packs CLI entry point for validating all packs

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Parallel implementation of remaining v0.1 OSS features:

- LLM classifier (OpenAI-compatible, mocked tests) + severity merge pipeline
- Shield: challenges, guard_sync, record_outcome, execute_upstream, trace redaction
- FastAPI: execute/proxy, auth token, policy reload, trace/challenge APIs
- CLI: init packs+rules, evaluate stdin, traces, challenge, run with config
- 25 golden fixtures (Py/TS parity)
- TypeScript: full Shield, pipeline, LLM, challenges, traces, LocalApiClient
- Examples, filled docs, CI workflow (pytest + vitest + pack check)

Tests: 98 Python, 47 TypeScript (25 golden scenarios)

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
@mosesman831
mosesman831 marked this pull request as ready for review July 11, 2026 13:43
Copilot AI review requested due to automatic review settings July 11, 2026 13:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mosesman831
mosesman831 merged commit 8b89e1e into main Jul 11, 2026
1 of 3 checks passed
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