bensz-auto-contribution 1.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bensz_auto_contribution-1.1.2/LICENSE +21 -0
- bensz_auto_contribution-1.1.2/PKG-INFO +259 -0
- bensz_auto_contribution-1.1.2/README.md +232 -0
- bensz_auto_contribution-1.1.2/pyproject.toml +46 -0
- bensz_auto_contribution-1.1.2/setup.cfg +4 -0
- bensz_auto_contribution-1.1.2/src/bac/__init__.py +3 -0
- bensz_auto_contribution-1.1.2/src/bac/__main__.py +5 -0
- bensz_auto_contribution-1.1.2/src/bac/adapters/cli.py +181 -0
- bensz_auto_contribution-1.1.2/src/bac/core/canonicalize.py +29 -0
- bensz_auto_contribution-1.1.2/src/bac/core/container.py +47 -0
- bensz_auto_contribution-1.1.2/src/bac/core/hash_chain.py +36 -0
- bensz_auto_contribution-1.1.2/src/bac/core/schema.py +135 -0
- bensz_auto_contribution-1.1.2/src/bac/core/verify.py +229 -0
- bensz_auto_contribution-1.1.2/src/bac/report/inspect.py +20 -0
- bensz_auto_contribution-1.1.2/src/bac/service/event_builder.py +147 -0
- bensz_auto_contribution-1.1.2/src/bac/service/evidence.py +84 -0
- bensz_auto_contribution-1.1.2/src/bac/service/redaction.py +52 -0
- bensz_auto_contribution-1.1.2/src/bac/storage/bac_file.py +84 -0
- bensz_auto_contribution-1.1.2/src/bensz_auto_contribution.egg-info/PKG-INFO +259 -0
- bensz_auto_contribution-1.1.2/src/bensz_auto_contribution.egg-info/SOURCES.txt +22 -0
- bensz_auto_contribution-1.1.2/src/bensz_auto_contribution.egg-info/dependency_links.txt +1 -0
- bensz_auto_contribution-1.1.2/src/bensz_auto_contribution.egg-info/entry_points.txt +2 -0
- bensz_auto_contribution-1.1.2/src/bensz_auto_contribution.egg-info/top_level.txt +1 -0
- bensz_auto_contribution-1.1.2/tests/test_bac_core.py +279 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bensz auto contribution contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bensz-auto-contribution
|
|
3
|
+
Version: 1.1.2
|
|
4
|
+
Summary: Tamper-evident BAC contribution attribution ledger
|
|
5
|
+
Author: bensz auto contribution
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/huangwb8/bensz-auto-contribution
|
|
8
|
+
Project-URL: Documentation, https://github.com/huangwb8/bensz-auto-contribution#readme
|
|
9
|
+
Project-URL: Source, https://github.com/huangwb8/bensz-auto-contribution
|
|
10
|
+
Project-URL: Issues, https://github.com/huangwb8/bensz-auto-contribution/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/huangwb8/bensz-auto-contribution/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: ai,audit,attribution,contribution,tamper-evident
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Version Control
|
|
22
|
+
Classifier: Topic :: System :: Archiving
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
<div align="center">
|
|
29
|
+
|
|
30
|
+
# π§ Bensz Auto Contribution
|
|
31
|
+
|
|
32
|
+
**Tamper-evident contribution attribution for human-AI software collaboration**
|
|
33
|
+
|
|
34
|
+
[](https://github.com/huangwb8/bensz-auto-contribution/tags)
|
|
35
|
+
[](https://www.python.org/)
|
|
36
|
+
[](docs/bac-tutorial.md)
|
|
37
|
+
[](LICENSE)
|
|
38
|
+
|
|
39
|
+
[English](README.md) | [δΈζ](README.zh-CN.md)
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## β¨ Introduction
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
**π 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.
|
|
52
|
+
|
|
53
|
+
### Key Features
|
|
54
|
+
|
|
55
|
+
- π§βπ» **Human-AI Attribution**: Explicitly separates `human`, `ai`, `tool`, and `system` sources.
|
|
56
|
+
- π§Ύ **Append-Only Event Model**: Records contribution history as ordered events instead of overwriting prior state.
|
|
57
|
+
- π **Hash-Chain Verification**: Detects modified, inserted, deleted, duplicated, or reordered events.
|
|
58
|
+
- π¦ **Single-File `.bac` Container**: Stores a ZIP-based v2 ledger with `manifest.json` and canonical JSON event files.
|
|
59
|
+
- π‘οΈ **Tamper-Evident Security Boundary**: Describes integrity guarantees honestly without overstating immutability.
|
|
60
|
+
- π§ **AI Tool Ready**: Designed for Codex CLI, Claude Code, and other agentic coding environments.
|
|
61
|
+
- π **Evidence-Aware Records**: Captures file hashes, git diff summaries, command text, exit codes, test results, and checkpoints.
|
|
62
|
+
- π§Ό **Sensitive Data Redaction**: Avoids storing secrets, private prompts, or unrelated user data by default.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
<div align="center">
|
|
67
|
+
|
|
68
|
+
### β If this project helps you, please give it a Star!
|
|
69
|
+
|
|
70
|
+
Building reliable attribution for AI-assisted work takes careful design, testing, and threat modeling. Your Star helps more builders discover BAC.
|
|
71
|
+
|
|
72
|
+
[](https://star-history.com/#huangwb8/bensz-auto-contribution&Date)
|
|
73
|
+
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## π Quick Start
|
|
79
|
+
|
|
80
|
+
### Prerequisites
|
|
81
|
+
|
|
82
|
+
- Python 3.10+
|
|
83
|
+
- No runtime third-party dependencies
|
|
84
|
+
|
|
85
|
+
### Installation
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
python -m pip install bensz-auto-contribution
|
|
89
|
+
|
|
90
|
+
# source or development install
|
|
91
|
+
python -m pip install -e .
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Basic Usage
|
|
95
|
+
|
|
96
|
+
Create a single-file `.bac` container and write the genesis event:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
bac init
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Record a human requirement:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
bac record \
|
|
106
|
+
--event-type human_instruction \
|
|
107
|
+
--source-type human \
|
|
108
|
+
--summary "Add BAC verification workflow"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Record AI generation or implementation intent:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
bac record \
|
|
115
|
+
--event-type ai_generation \
|
|
116
|
+
--source-type ai \
|
|
117
|
+
--summary "Implemented hash-chain verifier"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Record a tool result:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
bac record \
|
|
124
|
+
--event-type test_result \
|
|
125
|
+
--source-type tool \
|
|
126
|
+
--summary "Unit tests passed" \
|
|
127
|
+
--command-text "python -m unittest discover -s tests -v" \
|
|
128
|
+
--exit-code 0
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Record a local checkpoint to reduce tail-truncation risk:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
bac record \
|
|
135
|
+
--event-type checkpoint \
|
|
136
|
+
--source-type system \
|
|
137
|
+
--summary "Local checkpoint"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Verify integrity:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
bac verify
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Inspect the contribution timeline:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
bac inspect
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
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.
|
|
153
|
+
|
|
154
|
+
## π§© Where BAC Fits
|
|
155
|
+
|
|
156
|
+
BAC is a process record and audit aid, not a final judge of contribution ownership.
|
|
157
|
+
|
|
158
|
+
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.
|
|
159
|
+
|
|
160
|
+
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.
|
|
161
|
+
|
|
162
|
+
## π¦ `.bac` Format
|
|
163
|
+
|
|
164
|
+
The default file is `project.bac`. Externally, it is one file. Internally, it is a ZIP container with at least:
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
manifest.json
|
|
168
|
+
events/000000000001.json
|
|
169
|
+
events/000000000002.json
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`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`.
|
|
173
|
+
|
|
174
|
+
A BAC event includes:
|
|
175
|
+
|
|
176
|
+
- `format`: currently `bac.event.v2`
|
|
177
|
+
- `event_type`: examples include `genesis`, `human_instruction`, `ai_generation`, `tool_command`, `file_change`, `test_result`, and `checkpoint`
|
|
178
|
+
- `source_type`: one of `human`, `ai`, `tool`, or `system`
|
|
179
|
+
- `trust_level`: one of `declared`, `observed`, `signed`, `verified`, or `anchored`
|
|
180
|
+
- `project`: root path, project binding hash, git remote, commit, branch, and dirty state
|
|
181
|
+
- `payload`: summary, command data, file snapshots, or event-specific content
|
|
182
|
+
- `evidence`: diff summaries, file hashes, command results, or other verifiable evidence
|
|
183
|
+
- `redactions`: fields removed or masked for safety
|
|
184
|
+
- `prev_event_hash` and `event_hash`: the verifiable hash chain
|
|
185
|
+
|
|
186
|
+
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.
|
|
187
|
+
|
|
188
|
+
For a field-by-field walkthrough, see [BAC Tutorial](docs/bac-tutorial.md).
|
|
189
|
+
|
|
190
|
+
## π‘οΈ Security Model
|
|
191
|
+
|
|
192
|
+
BAC is **tamper-evident**, not tamper-proof.
|
|
193
|
+
|
|
194
|
+
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.
|
|
195
|
+
|
|
196
|
+
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.
|
|
197
|
+
|
|
198
|
+
## π§ͺ Development
|
|
199
|
+
|
|
200
|
+
Run the test suite:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python -m pytest -q
|
|
204
|
+
python -m unittest discover -s tests -v
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
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.
|
|
208
|
+
|
|
209
|
+
Build and check PyPI distributions locally:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
python -m pip install --upgrade build twine
|
|
213
|
+
python -m build
|
|
214
|
+
python -m twine check dist/*
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Releases are published to PyPI through GitHub Actions and PyPI Trusted Publishing. See [PyPI Release](docs/pypi-release.md).
|
|
218
|
+
|
|
219
|
+
## ποΈ Project Structure
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
bensz-auto-contribution/
|
|
223
|
+
βββ AGENTS.md
|
|
224
|
+
βββ CHANGELOG.md
|
|
225
|
+
βββ CLAUDE.md
|
|
226
|
+
βββ LICENSE
|
|
227
|
+
βββ README.md
|
|
228
|
+
βββ README.zh-CN.md
|
|
229
|
+
βββ docs
|
|
230
|
+
β βββ bac-tutorial.md
|
|
231
|
+
β βββ pypi-release.md
|
|
232
|
+
β βββ plans
|
|
233
|
+
βββ pyproject.toml
|
|
234
|
+
βββ src
|
|
235
|
+
β βββ bac
|
|
236
|
+
β βββ adapters
|
|
237
|
+
β βββ core
|
|
238
|
+
β βββ report
|
|
239
|
+
β βββ service
|
|
240
|
+
β βββ storage
|
|
241
|
+
βββ tests
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## π€ AI-Assisted Development
|
|
245
|
+
|
|
246
|
+
This repository includes project instructions for AI coding tools:
|
|
247
|
+
|
|
248
|
+
- `AGENTS.md` for OpenAI Codex CLI
|
|
249
|
+
- `CLAUDE.md` for Claude Code
|
|
250
|
+
|
|
251
|
+
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.
|
|
252
|
+
|
|
253
|
+
## π€ Contributing
|
|
254
|
+
|
|
255
|
+
Issues and pull requests are welcome around the `.bac` file format, threat model, AI tool integration, verification logic, signing and timestamping, and developer experience.
|
|
256
|
+
|
|
257
|
+
## π License
|
|
258
|
+
|
|
259
|
+
MIT License
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# π§ Bensz Auto Contribution
|
|
4
|
+
|
|
5
|
+
**Tamper-evident contribution attribution for human-AI software collaboration**
|
|
6
|
+
|
|
7
|
+
[](https://github.com/huangwb8/bensz-auto-contribution/tags)
|
|
8
|
+
[](https://www.python.org/)
|
|
9
|
+
[](docs/bac-tutorial.md)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
[English](README.md) | [δΈζ](README.zh-CN.md)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## β¨ Introduction
|
|
19
|
+
|
|
20
|
+
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.
|
|
21
|
+
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
**π 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.
|
|
25
|
+
|
|
26
|
+
### Key Features
|
|
27
|
+
|
|
28
|
+
- π§βπ» **Human-AI Attribution**: Explicitly separates `human`, `ai`, `tool`, and `system` sources.
|
|
29
|
+
- π§Ύ **Append-Only Event Model**: Records contribution history as ordered events instead of overwriting prior state.
|
|
30
|
+
- π **Hash-Chain Verification**: Detects modified, inserted, deleted, duplicated, or reordered events.
|
|
31
|
+
- π¦ **Single-File `.bac` Container**: Stores a ZIP-based v2 ledger with `manifest.json` and canonical JSON event files.
|
|
32
|
+
- π‘οΈ **Tamper-Evident Security Boundary**: Describes integrity guarantees honestly without overstating immutability.
|
|
33
|
+
- π§ **AI Tool Ready**: Designed for Codex CLI, Claude Code, and other agentic coding environments.
|
|
34
|
+
- π **Evidence-Aware Records**: Captures file hashes, git diff summaries, command text, exit codes, test results, and checkpoints.
|
|
35
|
+
- π§Ό **Sensitive Data Redaction**: Avoids storing secrets, private prompts, or unrelated user data by default.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
<div align="center">
|
|
40
|
+
|
|
41
|
+
### β If this project helps you, please give it a Star!
|
|
42
|
+
|
|
43
|
+
Building reliable attribution for AI-assisted work takes careful design, testing, and threat modeling. Your Star helps more builders discover BAC.
|
|
44
|
+
|
|
45
|
+
[](https://star-history.com/#huangwb8/bensz-auto-contribution&Date)
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## π Quick Start
|
|
52
|
+
|
|
53
|
+
### Prerequisites
|
|
54
|
+
|
|
55
|
+
- Python 3.10+
|
|
56
|
+
- No runtime third-party dependencies
|
|
57
|
+
|
|
58
|
+
### Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python -m pip install bensz-auto-contribution
|
|
62
|
+
|
|
63
|
+
# source or development install
|
|
64
|
+
python -m pip install -e .
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Basic Usage
|
|
68
|
+
|
|
69
|
+
Create a single-file `.bac` container and write the genesis event:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bac init
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Record a human requirement:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
bac record \
|
|
79
|
+
--event-type human_instruction \
|
|
80
|
+
--source-type human \
|
|
81
|
+
--summary "Add BAC verification workflow"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Record AI generation or implementation intent:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
bac record \
|
|
88
|
+
--event-type ai_generation \
|
|
89
|
+
--source-type ai \
|
|
90
|
+
--summary "Implemented hash-chain verifier"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Record a tool result:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
bac record \
|
|
97
|
+
--event-type test_result \
|
|
98
|
+
--source-type tool \
|
|
99
|
+
--summary "Unit tests passed" \
|
|
100
|
+
--command-text "python -m unittest discover -s tests -v" \
|
|
101
|
+
--exit-code 0
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Record a local checkpoint to reduce tail-truncation risk:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
bac record \
|
|
108
|
+
--event-type checkpoint \
|
|
109
|
+
--source-type system \
|
|
110
|
+
--summary "Local checkpoint"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Verify integrity:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
bac verify
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Inspect the contribution timeline:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
bac inspect
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
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.
|
|
126
|
+
|
|
127
|
+
## π§© Where BAC Fits
|
|
128
|
+
|
|
129
|
+
BAC is a process record and audit aid, not a final judge of contribution ownership.
|
|
130
|
+
|
|
131
|
+
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.
|
|
132
|
+
|
|
133
|
+
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.
|
|
134
|
+
|
|
135
|
+
## π¦ `.bac` Format
|
|
136
|
+
|
|
137
|
+
The default file is `project.bac`. Externally, it is one file. Internally, it is a ZIP container with at least:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
manifest.json
|
|
141
|
+
events/000000000001.json
|
|
142
|
+
events/000000000002.json
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`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`.
|
|
146
|
+
|
|
147
|
+
A BAC event includes:
|
|
148
|
+
|
|
149
|
+
- `format`: currently `bac.event.v2`
|
|
150
|
+
- `event_type`: examples include `genesis`, `human_instruction`, `ai_generation`, `tool_command`, `file_change`, `test_result`, and `checkpoint`
|
|
151
|
+
- `source_type`: one of `human`, `ai`, `tool`, or `system`
|
|
152
|
+
- `trust_level`: one of `declared`, `observed`, `signed`, `verified`, or `anchored`
|
|
153
|
+
- `project`: root path, project binding hash, git remote, commit, branch, and dirty state
|
|
154
|
+
- `payload`: summary, command data, file snapshots, or event-specific content
|
|
155
|
+
- `evidence`: diff summaries, file hashes, command results, or other verifiable evidence
|
|
156
|
+
- `redactions`: fields removed or masked for safety
|
|
157
|
+
- `prev_event_hash` and `event_hash`: the verifiable hash chain
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
For a field-by-field walkthrough, see [BAC Tutorial](docs/bac-tutorial.md).
|
|
162
|
+
|
|
163
|
+
## π‘οΈ Security Model
|
|
164
|
+
|
|
165
|
+
BAC is **tamper-evident**, not tamper-proof.
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
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.
|
|
170
|
+
|
|
171
|
+
## π§ͺ Development
|
|
172
|
+
|
|
173
|
+
Run the test suite:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
python -m pytest -q
|
|
177
|
+
python -m unittest discover -s tests -v
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
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.
|
|
181
|
+
|
|
182
|
+
Build and check PyPI distributions locally:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
python -m pip install --upgrade build twine
|
|
186
|
+
python -m build
|
|
187
|
+
python -m twine check dist/*
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Releases are published to PyPI through GitHub Actions and PyPI Trusted Publishing. See [PyPI Release](docs/pypi-release.md).
|
|
191
|
+
|
|
192
|
+
## ποΈ Project Structure
|
|
193
|
+
|
|
194
|
+
```text
|
|
195
|
+
bensz-auto-contribution/
|
|
196
|
+
βββ AGENTS.md
|
|
197
|
+
βββ CHANGELOG.md
|
|
198
|
+
βββ CLAUDE.md
|
|
199
|
+
βββ LICENSE
|
|
200
|
+
βββ README.md
|
|
201
|
+
βββ README.zh-CN.md
|
|
202
|
+
βββ docs
|
|
203
|
+
β βββ bac-tutorial.md
|
|
204
|
+
β βββ pypi-release.md
|
|
205
|
+
β βββ plans
|
|
206
|
+
βββ pyproject.toml
|
|
207
|
+
βββ src
|
|
208
|
+
β βββ bac
|
|
209
|
+
β βββ adapters
|
|
210
|
+
β βββ core
|
|
211
|
+
β βββ report
|
|
212
|
+
β βββ service
|
|
213
|
+
β βββ storage
|
|
214
|
+
βββ tests
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## π€ AI-Assisted Development
|
|
218
|
+
|
|
219
|
+
This repository includes project instructions for AI coding tools:
|
|
220
|
+
|
|
221
|
+
- `AGENTS.md` for OpenAI Codex CLI
|
|
222
|
+
- `CLAUDE.md` for Claude Code
|
|
223
|
+
|
|
224
|
+
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.
|
|
225
|
+
|
|
226
|
+
## π€ Contributing
|
|
227
|
+
|
|
228
|
+
Issues and pull requests are welcome around the `.bac` file format, threat model, AI tool integration, verification logic, signing and timestamping, and developer experience.
|
|
229
|
+
|
|
230
|
+
## π License
|
|
231
|
+
|
|
232
|
+
MIT License
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "bensz-auto-contribution"
|
|
7
|
+
version = "1.1.2"
|
|
8
|
+
description = "Tamper-evident BAC contribution attribution ledger"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "bensz auto contribution"}
|
|
15
|
+
]
|
|
16
|
+
keywords = ["ai", "audit", "attribution", "contribution", "tamper-evident"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Software Development :: Version Control",
|
|
27
|
+
"Topic :: System :: Archiving"
|
|
28
|
+
]
|
|
29
|
+
dependencies = []
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
bac = "bac.adapters.cli:main"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/huangwb8/bensz-auto-contribution"
|
|
36
|
+
Documentation = "https://github.com/huangwb8/bensz-auto-contribution#readme"
|
|
37
|
+
Source = "https://github.com/huangwb8/bensz-auto-contribution"
|
|
38
|
+
Issues = "https://github.com/huangwb8/bensz-auto-contribution/issues"
|
|
39
|
+
Changelog = "https://github.com/huangwb8/bensz-auto-contribution/blob/main/CHANGELOG.md"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
where = ["src"]
|
|
43
|
+
|
|
44
|
+
[tool.pytest.ini_options]
|
|
45
|
+
pythonpath = ["src"]
|
|
46
|
+
testpaths = ["tests"]
|