Skip to content

Commit 1c0ee82

Browse files
committed
Defused the non-breaking hyphen minefield
1 parent 8bc83ac commit 1c0ee82

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Required keys:
7575
- `who` (your name, AGENT)
7676
- `what` (did you do?)
7777
- `where` (files, etc)
78-
- `when` (timestamp RFC 3339 the helper writes this for you)
78+
- `when` (timestamp RFC 3339 - the helper writes this for you)
7979
- `why` (and if you leave this out, may God have mercy on your stack trace)
8080
- `how` (discuss your work)
8181
- `protip` (leave some wisdom for the next AGENT who reads this file)

docs/SPEC.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# `libgitledger`
22

3-
> A *GitNative* Ledger Library (C, `libgit2`): Spec + Project Plan with Step‑By‑Step Tasks & Tests
3+
> A *Git-Native* Ledger Library (C, `libgit2`): Spec + Project Plan with Step-By-Step Tasks & Tests
44
5-
This is the unification of two proven systems: **Shiplog**’s fieldtested deployment ledger and **gitmind**’s hexagonal, binarysafe engine, distilled into a reusable C library with a stable ABI and highperformance indexing. It uses Git itself as the database, leans on `libgit2`, and bakes in policy + trust. In short: batteries included, footguns removed.
5+
This is the unification of two proven systems: **Shiplog**’s field-tested deployment ledger and **git-mind**’s hexagonal, binary-safe engine, distilled into a reusable C library with a stable ABI and high-performance indexing. It uses Git itself as the database, leans on `libgit2`, and bakes in policy + trust. In short: batteries included, foot-guns removed.
66

77
---
88

@@ -19,33 +19,33 @@ This is the unification of two proven systems: **Shiplog**’s field‑tested de
1919

2020
- **Git backend**: `libgit2` (not shelling out) — keeps things fast, safe, and embeddable.
2121
- **Architecture**: strict Hexagonal (ports & adapters).
22-
- **Governance**: Policy‑as‑Code + MultiSignature Trust are firstclass in the library (not appspecific).
22+
- **Governance**: Policy-as-Code + Multi-Signature Trust are first-class in the library (not app-specific).
2323
- **Query performance**: Roaring bitmap cache, rebuildable.
2424

25-
These choices align with my previous work, the `gitmind`/`shiplog` lineage.
25+
These choices align with my previous work, the `git-mind`/`shiplog` lineage.
2626

2727
---
2828

2929
## I. Overview
3030

31-
`libgitledger` is a portable, embeddable C library for appendonly ledgers inside a Git repository. Each ledger is a linear history of Git commits on dedicated refs; entries are optionally signed, policychecked, and indexed for instant queries. It enables both humanreadable (`shiplog` style) and binarysafe (`gitmind` style) payloads via a pluggable encoder. 
31+
`libgitledger` is a portable, embeddable C library for append-only ledgers inside a Git repository. Each ledger is a linear history of Git commits on dedicated refs; entries are optionally signed, policy-checked, and indexed for instant queries. It enables both human-readable (`shiplog` style) and binary-safe (`git-mind` style) payloads via a pluggable encoder. 
3232

33-
**Why this exists**: I’ve built the pattern twice already. `shiplog` (battletested CLI & policy/trust) and `gitmind` (rigorous hexagonal architecture + roaring bitmap cache). `libgitledger` fuses them into one stable core library with bindings for Go/JS/Python.
33+
**Why this exists**: I’ve built the pattern twice already. `shiplog` (battle-tested CLI & policy/trust) and `git-mind` (rigorous hexagonal architecture + roaring bitmap cache). `libgitledger` fuses them into one stable core library with bindings for Go/JS/Python.
3434

3535
---
3636

37-
## II. Goals & NonGoals
37+
## II. Goals & Non-Goals
3838

3939
### Goals
4040

41-
- Gitnative persistence (objects + refs are the DB).
42-
- Appendonly (fastforward only), immutability by default.
43-
- Libraryfirst: stable C ABI, no global state; embeddable; safe for bindings.
44-
- Pluggable encoder/indexer so shiplog and gitmind both fit naturally. 
45-
- Policy as Code and MultiSignature Trust (chain or attestation) builtin. 
46-
- Highperformance queries using roaring bitmap cache, fully rebuildable. 
41+
- Git-native persistence (objects + refs are the DB).
42+
- Append-only (fast-forward only), immutability by default.
43+
- Library-first: stable C ABI, no global state; embeddable; safe for bindings.
44+
- Pluggable encoder/indexer so shiplog and git-mind both fit naturally. 
45+
- Policy as Code and Multi-Signature Trust (chain or attestation) built-in. 
46+
- High-performance queries using roaring bitmap cache, fully rebuildable. 
4747

48-
### NonGoals
48+
### Non-Goals
4949

5050
- Not a full “ledger server”. No background daemons; it’s a library.
5151
- Not a replacement for Git’s transport/auth or repo mgmt.
@@ -55,8 +55,8 @@ These choices align with my previous work, the `git‑mind`/`shiplog` lineage.
5555

5656
## III. Core Principles
5757

58-
- **GitNative**: object store + refs as the database; ref updates = writes.
59-
- **AppendOnly**: fastforward updates; rejects history rewrites.
58+
- **Git-Native**: object store + refs as the database; ref updates = writes.
59+
- **Append-Only**: fast-forward updates; rejects history rewrites.
6060
- **Hexagonal Architecture**: domain core is pure C; all I/O behind ports; libgit2 only in adapters. 
6161
- **Pluggable Everything**: allocators, loggers, encoders, indexers. 
6262
- **Secure & Auditable**: signing, policy enforcement, trust thresholds. 
@@ -68,18 +68,18 @@ These choices align with my previous work, the `git‑mind`/`shiplog` lineage.
6868

6969
**Ref map (per ledger `L`)**:
7070

71-
- **Journal (appendonly commits)**: `refs/gitledger/journal/<L>`
71+
- **Journal (append-only commits)**: `refs/gitledger/journal/<L>`
7272
- **Cache (roaring bitmaps)**: `refs/gitledger/cache/<L>`
7373
- **Policy doc**: `refs/gitledger/policy/<L>`
7474
- **Trust doc**: `refs/gitledger/trust/<L>`
7575
- **Entry notes**: `refs/gitledger/notes/<L>`
76-
- **Tagentry associations (notes on tag objects)**: `refs/gitledger/tag_notes`
76+
- **Tag-entry associations (notes on tag objects)**: `refs/gitledger/tag_notes`
7777

78-
This structure blends `shiplog`’s policy/trust refs and `gitmind`’s journal/cache separation.
78+
This structure blends `shiplog`’s policy/trust refs and `git-mind`’s journal/cache separation.
7979

8080
**Entry** = a Git commit on the ledger ref.
8181

82-
- Payload lives in the commit message (encoderdefined; can be humanreadable with JSON trailers like `shiplog` or base64CBOR like `gitmind`).
82+
- Payload lives in the commit message (encoder-defined; can be human-readable with JSON trailers like `shiplog` or base64-CBOR like `git-mind`).
8383
- **Notes**: arbitrary blobs (`stdout`/`stderr`, artifacts) via Git notes on the entry commit. (Shiplog’s `run` semantics made general.) 
8484
- **Signatures**: commit signatures or detached attestations, enforced by policy/trust. 
8585

@@ -477,9 +477,9 @@ Pure C types & logic
477477
#### Adapters
478478

479479
- `libgit2` adapter implements `git_repo_port`.
480-
- `stdio` logger; `null` metrics; POSIX `tempfs`, etc.
480+
- `stdio` logger; `null` metrics; POSIX `temp-fs`, etc.
481481

482-
This mirrors `gitmind`’s pattern exactly, making unit tests trivial and adapters swappable. 
482+
This mirrors `git-mind`’s pattern exactly, making unit tests trivial and adapters swappable. 
483483

484484
### 5.2 Memory & Logging
485485

@@ -655,15 +655,15 @@ void gitledger_error_free(gitledger_error_t *err);
655655
656656
**Notes:**
657657
658-
- Encoders return bytes; we do not force UTF8. Git will store the bytes; use textual encodings (e.g., JSON + trailers; base64CBOR) when needed. (Matches `shiplog`/`gitmind` styles.)
658+
- Encoders return bytes; we do not force UTF-8. Git will store the bytes; use textual encodings (e.g., JSON + trailers; base64-CBOR) when needed. (Matches `shiplog`/`git-mind` styles.)
659659
- Policy/Trust are JSON; the library enforces them during `append()` and on `verify_ledger_integrity()`. (Shiplog precedent.) 
660660
- Tag association uses notes on tag objects under `refs/gitledger/tag_notes`. 
661661
662662
---
663663
664-
## VII. Policy & Trust (builtin)
664+
## VII. Policy & Trust (built-in)
665665
666-
### Policy as Code (perledger)
666+
### Policy as Code (per-ledger)
667667
668668
`policy.json` under `refs/gitledger/policy/<L>` with keys like:
669669
@@ -675,12 +675,12 @@ void gitledger_error_free(gitledger_error_t *err);
675675
676676
Enforced at append and verify time. Mirrors `shiplog`’s model, generalized for any ledger. 
677677
678-
### MultiSignature Trust
678+
### Multi-Signature Trust
679679
680680
`trust.json` under `refs/gitledger/trust/<L>` including:
681681
682682
- `maintainers: [{id, email, key_fingerprint}]`
683-
- `threshold: N` (N‑of‑M approvals for trust changes)
683+
- `threshold: N` (N-of-M approvals for trust changes)
684684
- `signature_mode: "chain" | "attestation"`
685685
- `allowed_signers: [...]`
686686
@@ -689,7 +689,7 @@ Library verifies signatures of entries against current trust + policy; updates t
689689
### Signatures
690690
691691
- **Chain** = signed commit.
692-
- **Attestation** = detached SSH/GPG signature note costored and linked.
692+
- **Attestation** = detached SSH/GPG signature note co-stored and linked.
693693
694694
Verification uses `libgit2` extraction + pluggable verification backend (GPGME/SSH sig adapter), defaulting to “present + fingerprint match” until crypto adapter is configured.
695695
@@ -705,16 +705,16 @@ Indexer callback parses payload format and emits “terms” (`key:value`).
705705
706706
Library builds roaring bitmaps: one bitmap per term; entry IDs are ordinal positions in the ledger chain.
707707
708-
Queries are boolean set ops over bitmaps (`AND`/`OR`/`NOT`). Cache is rebuildable from journal. This mirrors gitmind’s fast query path. 
708+
Queries are boolean set ops over bitmaps (`AND`/`OR`/`NOT`). Cache is rebuildable from journal. This mirrors git-mind’s fast query path. 
709709
710710
Query API accepts a term array with leading operator shorthands (`+` for **MUST**, `-` for **MUST_NOT**). Result is an iterator of matching entry OIDs.
711711
712712
---
713713
714714
## IX. Concurrency, Atomicity, & Integrity
715715
716-
- **Append is optimistic**: we read `HEAD_oid`, create a commit object, then try to fastforward `refs/gitledger/journal/<L>` from `HEAD_oid` → `new_oid`. If the ref moved, return `GL_ERR_CONFLICT` so the caller retries after reloading latest.
717-
- **Integrity audit**: linear parent chain check, ref integrity, optional BLAKE3 checksums on ref tips. (You flagged this as “selfaudit hooks.”) 
716+
- **Append is optimistic**: we read `HEAD_oid`, create a commit object, then try to fast-forward `refs/gitledger/journal/<L>` from `HEAD_oid` → `new_oid`. If the ref moved, return `GL_ERR_CONFLICT` so the caller retries after reloading latest.
717+
- **Integrity audit**: linear parent chain check, ref integrity, optional BLAKE3 checksums on ref tips. (You flagged this as “self-audit hooks.”) 
718718
719719
---
720720
@@ -733,16 +733,16 @@ libgitledger/
733733
└─ cli/ # 'git-ledger' demo tool
734734
```
735735

736-
This is aligned to the hexagonal structure used in [gitmind](https://github.com/neuroglyph/git-mind).
736+
This is aligned to the hexagonal structure used in [git-mind](https://github.com/neuroglyph/git-mind).
737737

738738
---
739739

740740
## XI. Security Considerations
741741

742742
- No shell `exec` in core; signing/verification uses pluggable crypto adapters.
743743
- Key material never stored by lib; only fingerprints/IDs in trust docs.
744-
- Policy defaultdeny if document missing (configurable).
745-
- Replay protection via appendonly + trust verification; serverside hooks recommended (`prereceive`) — pattern borrowed from `shiplog`. 
744+
- Policy default-deny if document missing (configurable).
745+
- Replay protection via append-only + trust verification; server-side hooks recommended (`pre-receive`) — pattern borrowed from `shiplog`. 
746746

747747
---
748748

@@ -751,7 +751,7 @@ This is aligned to the hexagonal structure used in [git‑mind](https://github.c
751751
- Stable C ABI (opaque handles; no inline structs in public headers).
752752
- No global state; all config on a context or ledger handle.
753753
- Bindings can map errors to idiomatic exceptions/results (Go, JS, Python).
754-
- Threading: ledger handles are not threadsafe; concurrent reads via separate handles; concurrent appends require higherlevel retry.
754+
- Threading: ledger handles are not thread-safe; concurrent reads via separate handles; concurrent appends require higher-level retry.
755755

756756
---
757757

0 commit comments

Comments
 (0)