Local-first guardrail for unsupported AI repository assumptions before commit.
Project description
SourcePack
SourcePack blocks AI-generated code changes that rely on fake repo facts.
It checks proposed diffs against locally verifiable evidence such as tracked files, dependency manifests, scripts, commands, protected paths, trusted baseline artifacts, policy, and recorded execution evidence.
A simple example: an AI assistant adds FastAPI code to a repository that does not declare FastAPI. SourcePack detects the unsupported dependency and blocks the change before it becomes a review problem.
SourcePack is a local-first public-alpha guardrail. It does not prove code correctness, security, runtime success, semantic validity, dependency safety, external API truth, or user intent.
Try the demo
python -m pip install sourcepack
sourcepack demo
The demo creates a small local repository, applies an unsupported FastAPI change, and runs SourcePack against it.
Expected decisive output:
RED LIGHT: commit blocked
unsupported_dependency: sourcepack/server.py imports fastapi, but fastapi is not declared.
Verdict: FAIL
RED LIGHTis the human stop signal.Verdict: FAILis the formal judgment.unsupported_dependencyis the machine-readable reason code.
What SourcePack checks
SourcePack focuses on repository assumptions that can be tested locally:
- AI coding agents can edit files that do not exist.
- They can import undeclared dependencies.
- They can reference missing scripts or unsupported commands.
- They can reshape project structure based on prompt assumptions.
- SourcePack catches those locally verifiable failures before commit or in CI.
- unsupported project ecosystems
- unsafe or protected paths
- malformed or binary diffs
- stale, missing, or corrupt trusted baselines
- policy violations in the proposed change
- bounded local execution evidence
Its judgment is deliberately narrow:
This proposed change relies on a repository fact that the local evidence does not support.
SourcePack does not reject code merely because AI produced it.
First five minutes
python -m pip install sourcepack
sourcepack demo
sourcepack init . --auto
sourcepack ui .
sourcepack init . --auto creates or refreshes local SourcePack state only after you decide the current repository state should be trusted. Do not use initialization to bless a failed AI patch. Then launch SourcePack Workbench, click Run Review, inspect findings and evidence, copy the deterministic remediation prompt, let an external coding agent edit the repository, and click Run Review Again.
What SourcePack catches
| Case | Formal result | Reason code |
|---|---|---|
| Missing or fake file edits | FAIL | missing_file |
| New or deleted file review | WARN | new_file, deleted_file |
| Undeclared imports or dependencies | FAIL | unsupported_dependency |
| Same-patch dependency additions | WARN | declared_dependency |
| Unsupported commands | FAIL | unsupported_command |
| Unsupported ecosystems | WARN | unsupported_ecosystem |
Protected .sourcepack/ edits |
FAIL | protected_artifact |
.git/ path edits |
FAIL | git_path_modification |
| Unsafe paths | FAIL | unsafe_path, path_escape |
| Binary or malformed diffs | WARN or FAIL by path and condition | binary_diff, malformed_diff |
| Missing, stale, or corrupt baseline | FAIL or WARN by state and mode | baseline_missing, baseline_stale, baseline_corrupt |
| Workflow automation changes | WARN or FAIL by mode and policy | workflow_change |
See docs/reason-codes.md for exact behavior and remediation guidance.
How the trust model works
SourcePack keeps reviewed repository evidence separate from AI guidance.
- Baseline: reviewed local enforcement state
- Prompt context: advisory material for an AI assistant
- Diff: the actual proposed repository change
- Judgment: the result of checking that change against trusted evidence and policy
Prompt context never becomes trust.
SourcePack refuses to create a trusted baseline from a dirty Git working tree unless --force is explicitly supplied. In CI, committed .sourcepack/baseline/ state must be consumed as-is. CI must never create, refresh, repair, or silently bless trusted baseline state.
See docs/baseline-lifecycle.md.
Reports, Workbench, CI, and evidence
A normal local run writes HTML, JSON, and Markdown reports under .sourcepack/reports/. The canonical SourcePack report path is .sourcepack/reports/latest.json. Use sourcepack report path to print the current report path and sourcepack report open to open the rendered report.
sourcepack ui .
sourcepack diff .
sourcepack report path
sourcepack report open
SourcePack Workbench can run a bounded local review using the same sourcepack.judgment.judge_repo_change() path used by sourcepack diff ., then write the canonical report artifacts under .sourcepack/reports/. It cannot run arbitrary commands, edit code, invoke Codex, or silently trust a baseline. CLI review commands remain available for automation, CI, and advanced use.
Minimal CI usage:
- uses: actions/checkout@v4
- run: python -m pip install sourcepack
- run: sourcepack diff . --ci --json
SourcePack also supports replay, evidence bundles, local execution evidence, repository policy, finding identities, overrides, decision ledgers, fleet summaries, and committed-range inspection.
See the documentation index for exact commands and deeper workflows.
Built with GPT-5.6 and Codex
SourcePack was developed through an inspectable AI-directed workflow:
- product behavior and constraints were defined through GPT-5.6
- GPT-5.6 converted those decisions into bounded implementation prompts, reviews, and correction prompts
- Codex implemented repository changes and tests
- the resulting pull requests were reviewed and merged through GitHub
The public repository history preserves both sides of that workflow, including a GPT-5.6-directed README change, Codex implementation PRs, and the trust-boundary failure that helped shape the current dirty-baseline guard.
See BUILD_WEEK.md for the dated evidence trail and judge path.
What SourcePack is not
SourcePack is not a general AI code reviewer. It does not decide whether code is elegant, scalable, secure, production-ready, architecturally sound, or aligned with business intent.
It does not replace tests, type checkers, linters, security scanners, dependency review, runtime validation, or human review.
Use SourcePack when the disputed claim can be checked against local repository evidence.
Status
SourcePack is in the v1.10 public-alpha series.
Core judgment behavior, packaging, reports, demos, policy resolution, replay, local execution evidence, CI behavior, evidence bundles, and the local Workbench are implemented. Public-alpha work continues around compatibility, packaging, integration coverage, and UX polish.
sourcepack doctor --strict checks local production-readiness prerequisites and packaged assets. Hosted GitHub Actions remain the source of truth for hosted checks.
What SourcePack does not claim
- does not prove code correctness
- does not prove security
- does not prove runtime success
- does not prove semantic validity
- does not prove external API truth
- does not prove dependency safety
- does not prove user intent
Public proof links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sourcepack-1.10.0a3.tar.gz.
File metadata
- Download URL: sourcepack-1.10.0a3.tar.gz
- Upload date:
- Size: 278.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2966086468369ff4ca7be8d1a29feca7e806dfd117aa6f0ce6c0c71f161908f6
|
|
| MD5 |
f7384ffd74e4bdff87e85120a749c699
|
|
| BLAKE2b-256 |
72f7806426346f63abcc746b6cd8cff2f95c7466d367bc64c9282d435a8347d6
|
File details
Details for the file sourcepack-1.10.0a3-py3-none-any.whl.
File metadata
- Download URL: sourcepack-1.10.0a3-py3-none-any.whl
- Upload date:
- Size: 178.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c447011715bab3bbc169f392a7afe06528f4dc3c4d3d28d112ad76b349ca46b
|
|
| MD5 |
ccaaaf5070fe5ac5e87143edd0c65c04
|
|
| BLAKE2b-256 |
4f7b1d0ba71dd11689740e4ea7ef1268246fe8f5b5343c8c40c11567265783b1
|