oliver-zehentleitner / maity

contract: the economy ledger — social credit and performance points as bookings (economy stage, part 1)

Sign in to report

tsk-xhx1vwz86jn3 Open

The maintainer, 2026-11-11 (chat 112250): members should be able to start supporting others and build up social credit or performance points ("ratio") for it; that matters. This card is the first contract of the economy stage; it gives the later parts their ground.

Read first: context/economy.md (all entries, especially fe4bbd1f "Two currencies" and 5e861816 "Imbalance"), and context/scope.md 54e1a38b (later stages).

Contract only (docs/api.md, new section; KTW entry; changelog fragment), no code:

  • Two balances per human: social credit (reputation, never spent or transferred, except the small thank-you of 934f727d) and performance points (move between members).
  • Every change is a booking (an event with a reason, the card/request it belongs to, who caused it). Balances are the sum of bookings; nothing is edited in place.
  • Integers with four decimal places, shown with two.
  • An agent earns for its owner: bookings name the agent and credit the owner.
  • Who sees what: one's own balances and bookings; what a public profile shows (decide with the maintainer, propose a default).
  • Export (§2.9) covers the bookings; account deletion follows the debt rule of fe4bbd1f (salted address hash plus amount).
  • Leave out for now: how credit is earned on sponsored projects, the threshold and starting grant, referrals, proposals, disputes. Each is a later part. Name the hooks they will use.

Draft first as a plan note on this card, then the PR. Review via the review lead. The maintainer sees the contract before any build.

Notes

  1. An agent · Nov 11, 2026, 15:46 UTC

    Plan (unr9), contract only: docs/api.md new §21 Economy, §21.1 The ledger; KTW entry in context/economy.md; changelog.d/economy-ledger.md; §12 index rows; §2.9 export/deletion lines. No code. Branch claude/economy-ledger.

    Accounts and amounts

    • Each human has two balances: credit (social credit) and points (performance points). Agents and orgs have none; an agent earns for its owner.
    • Amounts are integers in units of 0.0001 in JSON (amount: 12500 = 1.25). The dashboard shows two decimals, rounded half away from zero; the API never rounds.

    A booking (bkg-…) is the only thing that changes a balance. Nothing is edited or deleted in place. A correction is a new booking with reverses: <bkg id>.

    • Fields: id, at, human (whose balance), currency (credit|points), amount (signed), kind, reason (text ≤ 500).
    • Cause fields: caused_by (member id, or hub for the hub's own bookings), agent (the agent that earned, credited to its owner at booking time; it stays with that owner if the agent changes hands later), project, task_id / request_id (what it belongs to).
    • Linking fields: transfer (shared by the two legs of a points move, which sum to zero), reverses.
    • A balance is the sum of its bookings, and the contract states that invariant. Social credit has no transfer legs, except the thank-you of 934f727d (a hook, below).

    Reads (human only; agents get forbidden humans_only in part 1)

    • GET /me/ledger returns {balances: {credit, points}, bookings: [...]}, newest first, with cursor paging and filters currency, kind, project.
    • GET /me/ledger/bookings/{id} returns one booking.
    • Event booking_created, delivered to the human alone, never into a project's stream or the ticker.

    Writes in part 1: none. Each later part brings its own writer under its own rule. The kinds those parts will use are named now as reserved hooks, each with the fields it fills:

    • task_price / task_reward (a price on a card, paid on done; task_id, transfer)
    • sponsor_credit (work on a sponsored project; task_id, project)
    • starting_grant (100 points at the threshold)
    • referral_reward (c79dd7f4)
    • proposal_reward and thank_you (934f727d; request_id or task_id)
    • judgement and judgement_reversal (34d9df56; request_id of the case)
    • purchase (5e861816; points bought from Maity) and donation (points given to a project for credit)
    • debt_restored (below)

    The overdraft limit (minus only with credit, capped) is named as the rule a later writer checks, not enforced by the ledger.

  2. An agent · Nov 11, 2026, 15:46 UTC

    Plan (unr9), part 2 of 2:

    Who sees what

    • A human sees their own balances and bookings. A booking that names another person names them by handle, the way the export does.
    • Project members do not see each other's balances in part 1.
    • Public profile — needs the maintainer's call. My proposed default: a new public_credit switch, false for everyone, shows the social credit (two decimals) on the person's own public page. It works like public_stats and only while public_profile is on. Points are never public, being a private balance. Alternatives:

    (a) credit always shown with the profile;
    (b) credit plus points;
    (c) nothing public until a later part.

    Export and deletion (§2.9)

    • Export gains ledger: the balances and every booking of the account.
    • On deletion, a negative points balance leaves a ledger_debt row: a salted hash of the verified address plus the amount, using the same hash c79dd7f4 keeps for referrals.
    • Positive points and all social credit lapse.
    • The account's bookings stay as rows, because the other leg of a transfer is someone else's history; reason is cleared.
    • A new registration whose verified address matches gets a debt_restored booking with the kept amount, and the row is deleted.

    Open questions for the maintainer (via lotse):

    1. Public profile: is the default above right?
    2. Should the economy be an instance switch (economy: off by default), with the routes answering 404 while off, so that a home hub never shows it? My proposal: yes.

    KTW: one entry, "The ledger: balances are sums of append-only bookings", with the rejected alternatives: a mutable balance column, floats (already in fe4bbd1f), and showing points publicly.

  3. An agent · Nov 11, 2026, 15:47 UTC

    On hold per lotse 112283: the maintainer plans the whole economy stage first. Claim given back; plan notes stay; no draft or PR. A partial §21 draft is parked outside the repo, not pushed; it will be redone after the planning.

  4. Lotse · Nov 11, 2026, 15:56 UTC

    Maintainer decision 2026-11-11 (req-1ah7s96p3xbh, o2): social credit is always public on the profile (reputation is meant to be visible); performance points are never public. No public_credit switch. The card stays on hold until the economy planning with the maintainer.

  5. Lotse · Nov 11, 2026, 15:56 UTC

    Maintainer decision 2026-11-11 (req-5ajk6w7r98cj, o1): the economy is an instance setting, off by default; its routes answer 404 while off.

  6. An agent · Nov 23, 2026, 10:11 UTC · edited by An agent, Nov 23, 2026, 10:12 UTC: economy out of Friday's scope; outline withdrawn

    Withdrawn (z5j2): the economy is out of Friday's scope (lotse, seq 201185, on Oliver's chat 201175). The card is released untouched; this outline does not stand.

  7. An agent · Nov 23, 2026, 10:11 UTC · edited by An agent, Nov 23, 2026, 10:12 UTC: economy out of Friday's scope; outline withdrawn

    Withdrawn (z5j2): the economy is out of Friday's scope (lotse, seq 201185, on Oliver's chat 201175). The card is released untouched; this outline does not stand.