Tamper-evident BAC contribution attribution ledger
Project description
๐งญ Bensz Auto Contribution
Tamper-evident contribution attribution for human-AI software collaboration
โจ Introduction
Bensz Auto Contribution, or BAC, is a contribution attribution and audit system designed for AI coding tools. Its core artifact is a .bac file: a project-bound, append-only, tamper-evident record of what came from humans, what came from AI, what came from tools, and what evidence was observed during development.
BAC does not claim that a file can never be modified. Instead, it makes changes detectable through structured events, canonical JSON, hash chaining, local checkpoints, project context binding, and future-ready signature and timestamp fields.
๐ Core Highlight: BAC gives AI coding sessions a durable audit trail. It helps teams explain AI usage, review collaboration boundaries, verify generated work, and reconstruct development history without mixing human intent, AI generation, tool output, and file evidence into one vague blob.
Key Features
- ๐งโ๐ป Human-AI Attribution: Explicitly separates
human,ai,tool, andsystemsources. - ๐งพ Append-Only Event Model: Records contribution history as ordered events instead of overwriting prior state.
- ๐ Hash-Chain Verification: Detects modified, inserted, deleted, duplicated, or reordered events.
- ๐ฆ Single-File
.bacContainer: Stores a ZIP-based v2 ledger withmanifest.jsonand canonical JSON event files. - ๐ก๏ธ Tamper-Evident Security Boundary: Describes integrity guarantees honestly without overstating immutability.
- ๐ง AI Tool Ready: Designed for Codex CLI, Claude Code, and other agentic coding environments.
- ๐ Evidence-Aware Records: Captures file hashes, git diff summaries, command text, exit codes, test results, and checkpoints.
- ๐งผ Sensitive Data Redaction: Avoids storing secrets, private prompts, or unrelated user data by default.
โญ If this project helps you, please give it a Star!
Building reliable attribution for AI-assisted work takes careful design, testing, and threat modeling. Your Star helps more builders discover BAC.
๐ Quick Start
Prerequisites
- Python 3.10+
- No runtime third-party dependencies
Installation
python -m pip install bensz-auto-contribution
# source or development install
python -m pip install -e .
Basic Usage
Create a single-file .bac container and write the genesis event:
bac init
Record a human requirement:
bac record \
--event-type human_instruction \
--source-type human \
--summary "Add BAC verification workflow"
Record AI generation or implementation intent:
bac record \
--event-type ai_generation \
--source-type ai \
--summary "Implemented hash-chain verifier"
Record a tool result:
bac record \
--event-type test_result \
--source-type tool \
--summary "Unit tests passed" \
--command-text "python -m unittest discover -s tests -v" \
--exit-code 0
Record a local checkpoint to reduce tail-truncation risk:
bac record \
--event-type checkpoint \
--source-type system \
--summary "Local checkpoint"
Verify integrity:
bac verify
Inspect the contribution timeline:
bac inspect
All commands support --root for the target project root and --bac-file for a custom .bac path. init, record, verify, and inspect also support --json for machine-readable output.
๐งฉ Where BAC Fits
BAC is a process record and audit aid, not a final judge of contribution ownership.
In AI-assisted research, writing, and software projects, BAC can record human requirements, constraints, reviews, hand-written edits, final approvals, AI drafts, refactoring proposals, generated code, command outputs, tests, citation checks, build logs, file snapshots, and diff summaries.
These records can support AI usage disclosure, internal review, compliance notes, and dispute reconstruction. They do not automatically determine academic authorship, legal ownership, or final responsibility. Those decisions still require project policy, institutional rules, journal guidelines, and human judgment.
๐ฆ .bac Format
The default file is project.bac. Externally, it is one file. Internally, it is a ZIP container with at least:
manifest.json
events/000000000001.json
events/000000000002.json
manifest.json records the container version, event format, project binding information, genesis event hash, and storage conventions. Each file under events/ is one canonical JSON event. Event filenames are continuous and start at 000000000001.json.
A BAC event includes:
format: currentlybac.event.v2event_type: examples includegenesis,human_instruction,ai_generation,tool_command,file_change,test_result, andcheckpointsource_type: one ofhuman,ai,tool, orsystemtrust_level: one ofdeclared,observed,signed,verified, oranchoredproject: root path, project binding hash, git remote, commit, branch, and dirty statepayload: summary, command data, file snapshots, or event-specific contentevidence: diff summaries, file hashes, command results, or other verifiable evidenceredactions: fields removed or masked for safetyprev_event_hashandevent_hash: the verifiable hash chain
The verifier checks whether the file is a valid ZIP container, whether internal paths are duplicated, whether event numbering is continuous, whether the manifest matches the genesis event, and whether the hash chain can be recomputed.
For a field-by-field walkthrough, see BAC Tutorial.
๐ก๏ธ Security Model
BAC is tamper-evident, not tamper-proof.
It can detect common integrity problems such as edited event content, missing events, reordered events, duplicated internal ZIP paths, broken event numbering, mismatched genesis metadata, invalid hash links, and checkpoint inconsistencies.
Without an external anchor, a purely local hash chain cannot fully prevent tail truncation. BAC therefore supports local checkpoints today and keeps room for future Ed25519 signatures, git notes, release artifacts, trusted timestamps, or external transparency logs.
๐งช Development
Run the test suite:
python -m pytest -q
python -m unittest discover -s tests -v
Current coverage includes canonicalization, v2 container structure, hash-chain recomputation, tamper detection, duplicate internal path detection, checkpoint verification, sensitive data redaction, and CLI end-to-end flows.
Build and check PyPI distributions locally:
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
Releases are published to PyPI through GitHub Actions and PyPI Trusted Publishing. See PyPI Release.
๐๏ธ Project Structure
bensz-auto-contribution/
โโโ AGENTS.md
โโโ CHANGELOG.md
โโโ CLAUDE.md
โโโ LICENSE
โโโ README.md
โโโ README.zh-CN.md
โโโ docs
โ โโโ bac-tutorial.md
โ โโโ pypi-release.md
โ โโโ plans
โโโ pyproject.toml
โโโ src
โ โโโ bac
โ โโโ adapters
โ โโโ core
โ โโโ report
โ โโโ service
โ โโโ storage
โโโ tests
๐ค AI-Assisted Development
This repository includes project instructions for AI coding tools:
AGENTS.mdfor OpenAI Codex CLICLAUDE.mdfor Claude Code
When changing contribution attribution logic, keep the security boundary precise: BAC provides verifiable, tamper-evident records. It should not be described as impossible to modify.
๐ค Contributing
Issues and pull requests are welcome around the .bac file format, threat model, AI tool integration, verification logic, signing and timestamping, and developer experience.
๐ License
MIT License
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 bensz_auto_contribution-1.1.2.tar.gz.
File metadata
- Download URL: bensz_auto_contribution-1.1.2.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4421b9c3e0edb1b1be4f4149c11fa0bb0b98663232089c4e74978d2cb9170ea3
|
|
| MD5 |
d755ced355ceb8cd9afbfdc04ff16a1b
|
|
| BLAKE2b-256 |
657a4376ba41a383fa69863d1134d8b967702eba1441cb0d0f3bad9d807fac03
|
File details
Details for the file bensz_auto_contribution-1.1.2-py3-none-any.whl.
File metadata
- Download URL: bensz_auto_contribution-1.1.2-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9d98077c223d5b56b586944a49645f99f65fd2f095f640c665ba3a2a4794bc0
|
|
| MD5 |
1623d5e08c3ee5db14e07777936a684e
|
|
| BLAKE2b-256 |
595d11364a4c87b3eb8900d4a0ebd1d1a1b782bef1ad4b66019b056736999234
|