Skip to content

feat: charter-scar — reference implementation of the scar invariant#1

Merged
hartsock merged 1 commit into
mainfrom
feat/charter-scar
Jun 14, 2026
Merged

feat: charter-scar — reference implementation of the scar invariant#1
hartsock merged 1 commit into
mainfrom
feat/charter-scar

Conversation

@hartsock

Copy link
Copy Markdown
Member

Summary

The first Charter invariant realized in code — and the one that was your original worry made into a mechanism: how an agent accumulates metabolized failure across time, i.e. wisdom it can persist.

ScarLog is append-only and hash-chained, straight from the doctrine:

  • record() is the only mutation — no edit, no delete (no Demiurgic forgetting).
  • a wound (Mistake/Refusal) with no lesson is an open wound; heal() closes it by appending a Healing that names it — the wound is never mutated.
  • each entry is content-addressed (b3-…) and links to its parent; verify_chain() recomputes ids + links so tampering is detectable (interlock with provenance).
  • Refusal is Scar-worthy — a declined action records as ScarKind::Refusal (the keystone writes into the memory).

Turns steward-charter into a Cargo workspace (doctrine + reference crates) and adds the governance now that there's code: .githooks/pre-push (fmt --check + clippy -D warnings + test) mirrored by .github/workflows/ci.yml + a justfile, cross-referenced for parity.

Verification

9 tests (8 unit + 1 doctest) green · clippy -D warnings clean · fmt clean · pre-push hook passed on push.

Next invariants

refusal (the dispatch dual, recorded into the scar) → novice (fresh-eyes quorum) → tether (operator gate). writ/provenance already live (agent-bridle / kyln) and adopt by citation.

risk: low (new crate, additive).

The first invariant realized in code, and the one that was the original worry
made into a mechanism: how an agent accumulates *metabolized failure* across time
— wisdom it can persist.

`ScarLog` is append-only and hash-chained:
- record() is the only mutation — no edit, no delete (no Demiurgic forgetting).
- a wound (Mistake/Refusal) with no lesson is an *open wound*; heal() closes it
  by APPENDING a Healing that names it — the wound is never mutated.
- each entry is content-addressed (b3-…) and links to its parent; verify_chain()
  recomputes the ids and the links, so tampering is detectable (interlock with
  the `provenance` invariant).
- Refusal is Scar-worthy: a declined action is recorded as ScarKind::Refusal
  (the keystone writes into the memory).

Turns steward-charter into a Cargo workspace (doctrine + reference crates) and
adds the governance the line requires now that there's code: .githooks/pre-push
(fmt --check + clippy -D warnings + test) mirrored by .github/workflows/ci.yml
and a justfile, cross-referenced for parity.

9 tests green (8 unit + 1 doctest), clippy -D warnings clean, fmt clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hartsock hartsock merged commit 1831deb into main Jun 14, 2026
1 check passed
@hartsock hartsock deleted the feat/charter-scar branch June 14, 2026 22:17
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.

1 participant