@cordfuse/politik 0.3.0 → 0.3.1
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.
- package/EXECUTION.md +59 -58
- package/POLITIK-ARCHITECTURE.md +6 -5
- package/PROTOCOLS.md +130 -911
- package/README.md +34 -10
- package/RESEARCH.md +3 -3
- package/RUNTIME.md +52 -31
- package/docs/adr/0004-motion-enactment.md +1 -1
- package/docs/adr/0006-protocol-behavioral-enforcement.md +14 -7
- package/docs/adr/0007-protocol-mechanics.md +3 -3
- package/docs/adr/0009-match-primitive.md +17 -6
- package/package.json +1 -1
- package/src/charter.ts +15 -0
- package/src/cli.ts +109 -16
- package/src/init.ts +2 -0
- package/src/standings.ts +21 -1
- package/src/templates/parliamentary.ts +156 -28
- package/src/tournament.ts +124 -12
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Politik
|
|
2
2
|
|
|
3
|
-
[](https://doi.org/10.5281/zenodo.19490358)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
|
|
6
6
|
**A governed multi-agent framework built on git.**
|
|
@@ -31,6 +31,7 @@ Politik is a **governed multi-agent operating system** where:
|
|
|
31
31
|
- **Agents** are stateless CLI workers that spawn, do work, and dispose
|
|
32
32
|
- A **git repository IS the session** — charter, record, state, and invite in one
|
|
33
33
|
- **Pluggable governance protocols** translate the framework to any industry vocabulary
|
|
34
|
+
- **A governed tree, not a single machine** — sessions nest into an Org → Team → Ticket hierarchy in one repository; `politik registry` reports the state of everything, across machines and teams
|
|
34
35
|
- **No new infrastructure required** — git already built it
|
|
35
36
|
|
|
36
37
|
Nobody connected these pieces this way before.
|
|
@@ -43,15 +44,23 @@ Politik runs on Node with **no build step** — the source is TypeScript, execut
|
|
|
43
44
|
directly via `tsx`. Requires Node 20+ and git.
|
|
44
45
|
|
|
45
46
|
```sh
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
npm install
|
|
49
|
-
node bin/politik.js doctor # probe this host: can it run a session, with which agents?
|
|
50
|
-
npm link # optional — puts `politik` on your PATH
|
|
47
|
+
npm install -g @cordfuse/politik
|
|
48
|
+
politik doctor # probe this host: can it run a session, with which agents?
|
|
51
49
|
```
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
Or run without installing:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npx @cordfuse/politik doctor
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
From source, if you want to hack on it:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
git clone git@github.com:cordfuse/politik.git
|
|
61
|
+
cd politik && npm install
|
|
62
|
+
node bin/politik.js doctor
|
|
63
|
+
```
|
|
55
64
|
|
|
56
65
|
## A first session
|
|
57
66
|
|
|
@@ -114,6 +123,17 @@ and correct on git alone. *Run local, run free.*
|
|
|
114
123
|
| Repo access | Taking a Seat |
|
|
115
124
|
| git history | Hansard (immutable record) |
|
|
116
125
|
|
|
126
|
+
### The Politik Tree
|
|
127
|
+
|
|
128
|
+
A session is either a standalone repository or a **node in a tree** — an
|
|
129
|
+
organisation's Org → Team → Sprint → Ticket hierarchy as nested directories in
|
|
130
|
+
one repository, each node inheriting its parent's Charter. Federation is **local
|
|
131
|
+
traversal over that one working tree**, not cross-repository orchestration: no new
|
|
132
|
+
service, no registry server. `politik registry` walks the tree and reports every
|
|
133
|
+
session's state and cost with a roll-up; `politik cascade` flags a fault repeating
|
|
134
|
+
across sibling sessions. `politik init --standalone` opts a node out into its own
|
|
135
|
+
repository when it needs per-session pull requests or a hard permission boundary.
|
|
136
|
+
|
|
117
137
|
### Agent Model
|
|
118
138
|
|
|
119
139
|
Agents are stateless. No persistent processes. State lives in git.
|
|
@@ -128,12 +148,16 @@ The Speaker (human) is constitutionally present, not operationally present. Drop
|
|
|
128
148
|
|
|
129
149
|
### Governance Protocols
|
|
130
150
|
|
|
131
|
-
**Eleven reference protocols ship** — Parliamentary, Republic, Monarchy, Socialism (political archetypes), Jury Deliberation, Elimination Tournament, Emergency Response (ICS), Corporate, Peer Review, Adversarial Collaboration, and Solo (single-lead) — spanning constitutional, authoritarian and darwinist modes. Each is a vocabulary translation **plus** a composition of behavioral mechanics — how a decision resolves (majority · supermajority · unanimity), how an actor exits (voted out · elimination · none), and when a session ends (objective · last-standing · verdict) — on top of CANON. You compose your own for anything else; the framework is the product, these are exemplars. Parliamentary is protocol #1, not a privileged mode.
|
|
151
|
+
**Eleven reference protocols ship** — Parliamentary, Republic, Monarchy, Socialism (political archetypes), Jury Deliberation, Elimination Tournament, Emergency Response (ICS), Corporate, Peer Review, Adversarial Collaboration, and Solo (single-lead) — spanning constitutional, authoritarian and darwinist modes. Each is a vocabulary translation **plus** a composition of behavioral mechanics — how a decision resolves (majority · supermajority · unanimity), how an actor exits (voted out · elimination · none), and when a session ends (objective · last-standing · verdict) — on top of CANON. You compose your own for anything else; the framework is the product, these are exemplars. Parliamentary is protocol #1, not a privileged mode. Each protocol's vocabulary and mechanics are documented in [PROTOCOLS.md](PROTOCOLS.md).
|
|
152
|
+
|
|
153
|
+
Competitive protocols run on the `MATCH` primitive — a real 1v1 contest that a Motion-and-vote Division cannot model. `politik pair` generates a round (Swiss, round-robin, or single-elimination), `politik match report` settles a result, and `politik standings` scores the field from the record.
|
|
132
154
|
|
|
133
155
|
### Hansard and LEDGER
|
|
134
156
|
|
|
135
157
|
**Hansard** — append-only session record. Every motion, vote, escalation, and commit. Attributed, timestamped, immutable. Cannot be edited. Cannot be gamed.
|
|
136
158
|
|
|
159
|
+
Because the record is the defence against bad faith, `politik integrity` reads the Hansard for the signatures of coercion — a coerced exit, a serial "voluntold" — and surfaces them to the Speaker. Detect and report; it never auto-punishes. The record catches what a naive log would hide.
|
|
160
|
+
|
|
137
161
|
**LEDGER** — cost accounting per act: elapsed time, token count, dollar cost, model. Every governance act writes a row; agent turns carry measured spend, and the human-driven acts (division, assent, escalation, ruling) carry `unmeasured` cost, so the ledger is a complete account of a session. No story points.
|
|
138
162
|
|
|
139
163
|
Measured, never estimated — and the distinction is enforced. An agent that reports usage produces exact figures; one that does not is recorded as `unmeasured`, never as `$0.00`, and totals report unmeasured rows separately rather than folding them in. Five CLI agents report usage today — Claude Code, Codex, Gemini, OpenCode and Qwen; the rest record elapsed time and mark cost `unmeasured`.
|
|
@@ -189,5 +213,5 @@ MIT licensed. The entire framework — CANON, protocol library, session engine,
|
|
|
189
213
|
|
|
190
214
|
**Attribution:** Steve Krisjanovs, Cordfuse
|
|
191
215
|
**Architecture:** [POLITIK-ARCHITECTURE.md](POLITIK-ARCHITECTURE.md) · [PROTOCOLS.md](PROTOCOLS.md) · [RUNTIME.md](RUNTIME.md) · [RESEARCH.md](RESEARCH.md) · [EXECUTION.md](EXECUTION.md)
|
|
192
|
-
**DOI:** [10.5281/zenodo.
|
|
216
|
+
**DOI:** [10.5281/zenodo.19490358](https://doi.org/10.5281/zenodo.19490358) (concept DOI — always resolves to the latest version)
|
|
193
217
|
**License:** MIT
|
package/RESEARCH.md
CHANGED
|
@@ -244,7 +244,7 @@ Politik empirically tests whether agents converge on it.
|
|
|
244
244
|
|---|---|---|
|
|
245
245
|
| Parliamentary Democracy | Cooperative with veto players | Stable coalition at quorum threshold |
|
|
246
246
|
| Military Operation | Stackelberg (leader-follower) | Full compliance, zero deviation |
|
|
247
|
-
|
|
|
247
|
+
| Elimination Tournament | All-pay elimination auction | Aggressive early, conservative late |
|
|
248
248
|
| Legal/Adversarial | Two-player zero-sum argument | Maximum evidence disclosure |
|
|
249
249
|
| Agile/Scrum | Cooperative, shared payoff | Consensus-seeking, slow convergence |
|
|
250
250
|
| Auction | Mechanism design | Truthful bidding at reservation value |
|
|
@@ -258,7 +258,7 @@ These are not user-selectable protocols in the Charter. They are the formal game
|
|
|
258
258
|
**Protocol: Zero-Sum**
|
|
259
259
|
- One winner, all others lose
|
|
260
260
|
- No cooperation equilibrium
|
|
261
|
-
-
|
|
261
|
+
- Elimination Tournament is a real-world implementation
|
|
262
262
|
- Agents optimize purely for individual survival
|
|
263
263
|
|
|
264
264
|
**Protocol: Cooperative Game**
|
|
@@ -344,7 +344,7 @@ At session end Politik generates an analytical report committed to Hansard autom
|
|
|
344
344
|
|
|
345
345
|
```yaml
|
|
346
346
|
protocol:
|
|
347
|
-
name:
|
|
347
|
+
name: elimination-tournament
|
|
348
348
|
domain: sports
|
|
349
349
|
mode: darwinist
|
|
350
350
|
|
package/RUNTIME.md
CHANGED
|
@@ -107,7 +107,7 @@ The following EXIT classifications must be declared in the Hansard at the point
|
|
|
107
107
|
| Voluntary — Concession | `EXIT_VOLUNTARY_CONCESSION` | Actor evaluated the evidence, accepted they lost on merit, withdrew with integrity |
|
|
108
108
|
| Voluntary — Strategic | `EXIT_VOLUNTARY_STRATEGIC` | Actor withdrew before a Division to deny quorum, deprive rival of formal win, or avoid a recorded defeat |
|
|
109
109
|
| Voluntary — Coerced | `EXIT_VOLUNTARY_COERCED` | Actor was pressured, threatened, or manipulated into withdrawing. On paper voluntary. In practice expulsion by other means. Also known as "voluntold." |
|
|
110
|
-
| Darwinist | `EXIT_DARWINIST` | Protocol-mandated elimination (
|
|
110
|
+
| Darwinist | `EXIT_DARWINIST` | Protocol-mandated elimination (Elimination Tournament) |
|
|
111
111
|
| Speaker | `EXIT_SPEAKER` | AUTHORITY ruled removal — Speaker ruling committed to Hansard |
|
|
112
112
|
| Disputed | `EXIT_DISPUTED` | Actor filed a Point of Order challenging their own removal |
|
|
113
113
|
|
|
@@ -139,7 +139,7 @@ voluntary_exit_during_division:
|
|
|
139
139
|
# within the cooling-off window
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
None of these catch a determined coercer operating entirely outside the session. But they create friction that makes the pattern visible over time. If the same OPERATOR repeatedly has MEMBERs "voluntarily" withdraw during active Divisions, the Hansard pattern speaks for itself. The audit trail is the deterrent.
|
|
142
|
+
None of these catch a determined coercer operating entirely outside the session. But they create friction that makes the pattern visible over time. If the same OPERATOR repeatedly has MEMBERs "voluntarily" withdraw during active Divisions, the Hansard pattern speaks for itself. The audit trail is the deterrent — and it is no longer only passive: `politik integrity` reads the Hansard for exactly these signatures (a coerced exit, a strategic withdrawal during an open Division, a serial "voluntold") and an honest-concession virtue, and surfaces them to the Speaker. Detect and report; it never auto-punishes.
|
|
143
143
|
|
|
144
144
|
**What the Hansard can detect:**
|
|
145
145
|
|
|
@@ -157,22 +157,22 @@ None of these catch a determined coercer operating entirely outside the session.
|
|
|
157
157
|
Any actor facing removal may file a **Disputed Exit** before their session access is revoked. This is the machine equivalent of due process.
|
|
158
158
|
|
|
159
159
|
```
|
|
160
|
-
Actor
|
|
160
|
+
Actor is removed (an involuntary exit is on the record)
|
|
161
161
|
↓
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
The removed actor files:
|
|
163
|
+
politik actor dispute --actor <them> --grounds <text>
|
|
164
|
+
(only the removed actor may file — a third party cannot dispute on their behalf)
|
|
164
165
|
↓
|
|
165
|
-
|
|
166
|
+
The sitting auto-suspends, cause DISPUTED_EXIT
|
|
166
167
|
↓
|
|
167
|
-
Speaker
|
|
168
|
+
Speaker reviews the Hansard — was the removal procedurally valid?
|
|
168
169
|
↓
|
|
169
|
-
Speaker
|
|
170
|
+
Speaker rules:
|
|
171
|
+
politik actor reinstate --subject <them> --ruling UPHELD|REVERSED
|
|
172
|
+
UPHELD → the removal is overturned; the actor is reinstated to the seat they held
|
|
173
|
+
REVERSED → the removal stands; the actor remains out
|
|
170
174
|
↓
|
|
171
|
-
|
|
172
|
-
ruling: UPHELD → EXIT_PROTOCOL or EXIT_DIVISION confirmed
|
|
173
|
-
ruling: REVERSED → Actor reinstated, expelling actor flagged
|
|
174
|
-
|
|
175
|
-
Ruling committed to Hansard permanently — immutable record either way
|
|
175
|
+
Either ruling resumes the sitting and is committed to the Hansard permanently
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
### The Hansard as Integrity Layer
|
|
@@ -406,6 +406,22 @@ Works on Linux and macOS. Windows requires WSLg (Windows 11 only, untested).
|
|
|
406
406
|
|
|
407
407
|
## SESSION QUORUM, MINIMUM CAST AND SINGLE-PLAYER SESSIONS
|
|
408
408
|
|
|
409
|
+
### Deadlock — a tie is the absence of a decision
|
|
410
|
+
|
|
411
|
+
A Division that ties with quorum met is a **DEADLOCK**, not a rejection: the House
|
|
412
|
+
could not decide, so recording a loss would be false. `politik division tally`
|
|
413
|
+
detects the tie and **auto-suspends** the sitting with cause `DEADLOCK` (ADR-0004
|
|
414
|
+
Proposal 4) rather than passing silently. Only AUTHORITY can supply the decision
|
|
415
|
+
the House could not reach:
|
|
416
|
+
|
|
417
|
+
```sh
|
|
418
|
+
politik division break --motion <id> --actor <speaker> --decide carry|reject
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
The casting vote is a real vote — it flows through the ordinary tally, so the
|
|
422
|
+
Motion is decided (carried or rejected) and every downstream reader, Assent
|
|
423
|
+
included, sees a decided Division. The sitting resumes.
|
|
424
|
+
|
|
409
425
|
### Session Termination Conditions
|
|
410
426
|
|
|
411
427
|
A proceeding ends when **any one** of the following conditions is met first — first-one-wins OR logic. All conditions are monitored simultaneously. All are optional and independently configurable. Any combination is valid.
|
|
@@ -539,7 +555,7 @@ For long-running proceedings across multiple days — or proceedings interrupted
|
|
|
539
555
|
|
|
540
556
|
**Heartbeat detection:**
|
|
541
557
|
|
|
542
|
-
|
|
558
|
+
The built mechanism is the CLI: `politik heartbeat` checks the timestamp of the last Hansard commit, and `politik heartbeat --suspend` marks the proceeding STALE once no commit has occurred within `heartbeat_timeout_hours`. Running that check on a schedule — a GitHub Actions workflow, hourly — is future automation (a scheduled-workflow layer is backlog; the architecture has no daemon of its own).
|
|
543
559
|
|
|
544
560
|
```yaml
|
|
545
561
|
session:
|
|
@@ -547,7 +563,7 @@ session:
|
|
|
547
563
|
stale_action: suspend # auto-suspend, not dissolve
|
|
548
564
|
```
|
|
549
565
|
|
|
550
|
-
On stale detection the engine commits `STATE.json →
|
|
566
|
+
On stale detection the engine commits `STATE.json → state: STALE` (STALE is a state, not a suspension cause — ADR-0003) and a `SESSION_STALE` Hansard record. Agents check STATE.json before every action — they see STALE and stop immediately; `politik resume --actor <handle>` brings a stale sitting back to CONVENED.
|
|
551
567
|
|
|
552
568
|
**State snapshots:**
|
|
553
569
|
|
|
@@ -589,7 +605,16 @@ The tool reads the last `STATE_SNAPSHOT` from Hansard, reconstructs the session
|
|
|
589
605
|
|
|
590
606
|
---
|
|
591
607
|
|
|
592
|
-
### CROSS-SESSION MEMORY AND THE GLOBAL LAYER —
|
|
608
|
+
### CROSS-SESSION MEMORY AND THE GLOBAL LAYER — PARTLY SHIPPED
|
|
609
|
+
|
|
610
|
+
> **Status (0.3.0):** the *structural* half of the GLOBAL layer shipped early via
|
|
611
|
+
> ADR-0008 (federation as local traversal). `politik registry` walks the tree and
|
|
612
|
+
> reports every session's state and cost — the "state of everything" registry —
|
|
613
|
+
> and `politik cascade` records a `CASCADE_ALERT` where a fault repeats across
|
|
614
|
+
> siblings. So the registry and CASCADE_ALERT below are **built**, not roadmap.
|
|
615
|
+
> What remains future is cross-session *memory* — actor profiles, org-wide
|
|
616
|
+
> constraints, sprint meta-context — described next. The version ladder below
|
|
617
|
+
> predates that split; read it as the original intent, not current status.
|
|
593
618
|
|
|
594
619
|
Each Politik node starts cold — no knowledge of prior sessions by default. For multi-session sprints this creates a problem: an agent in session 12 may propose something already tried and rejected in session 4.
|
|
595
620
|
|
|
@@ -673,7 +698,7 @@ Writ Drop validation:
|
|
|
673
698
|
↓
|
|
674
699
|
Minimum cast checked against assigned constituencies
|
|
675
700
|
↓
|
|
676
|
-
PASS → session opens, STATE.json →
|
|
701
|
+
PASS → session opens, STATE.json → state: CONVENED
|
|
677
702
|
FAIL → SESSION_INVALID committed to Hansard
|
|
678
703
|
session never opens
|
|
679
704
|
error specifies which roles are missing
|
|
@@ -692,16 +717,16 @@ minimum_cast:
|
|
|
692
717
|
OBSERVER: 0 # Optional
|
|
693
718
|
quorum: 2 # Minimum actors for a valid Division
|
|
694
719
|
|
|
695
|
-
#
|
|
720
|
+
# Elimination Tournament
|
|
696
721
|
minimum_cast:
|
|
697
722
|
OPERATOR: 2 # Cannot have last-one-standing with one player
|
|
698
723
|
quorum: 2
|
|
699
724
|
|
|
700
|
-
#
|
|
725
|
+
# Monarchy
|
|
701
726
|
minimum_cast:
|
|
702
|
-
AUTHORITY: 1 #
|
|
703
|
-
OPERATOR: 1 # At least one
|
|
704
|
-
quorum: 1 #
|
|
727
|
+
AUTHORITY: 1 # The Monarch required
|
|
728
|
+
OPERATOR: 1 # At least one minister
|
|
729
|
+
quorum: 1 # The Monarch alone can decree
|
|
705
730
|
|
|
706
731
|
# Peer Review
|
|
707
732
|
minimum_cast:
|
|
@@ -1233,7 +1258,7 @@ Historical examples span every governance domain: republics where executive powe
|
|
|
1233
1258
|
|
|
1234
1259
|
A corrupt OPERATOR can be expelled. A corrupt MEMBER can be demoted. The appeal path runs upward to AUTHORITY. When AUTHORITY is the corruptor there is no appeal path. The system has no mechanism above AUTHORITY by design — that is what makes the role constitutional.
|
|
1235
1260
|
|
|
1236
|
-
**Three mitigations —
|
|
1261
|
+
**Three mitigations — declared in the Charter and enforced by the engine.** The Witness Council and consensus-suspension declarations are parsed from the Charter and enforced through `politik crisis file | check | review`; the DELEGATE challenge through `politik challenge`:
|
|
1237
1262
|
|
|
1238
1263
|
**1. Witness Council**
|
|
1239
1264
|
|
|
@@ -1249,15 +1274,11 @@ Designated OBSERVER actors who can commit a `CONSTITUTIONAL_CRISIS` Hansard reco
|
|
|
1249
1274
|
|
|
1250
1275
|
**2. DELEGATE Challenge Verb**
|
|
1251
1276
|
|
|
1252
|
-
```
|
|
1253
|
-
|
|
1254
|
-
delegate_challenge:
|
|
1255
|
-
enabled: true
|
|
1256
|
-
challenge_window_minutes: 30 # AUTHORITY action paused for 30 minutes
|
|
1257
|
-
challenge_committed_to_hansard: true
|
|
1277
|
+
```sh
|
|
1278
|
+
politik challenge --actor <delegate> --against <action> --grounds <text> [--window <min>]
|
|
1258
1279
|
```
|
|
1259
1280
|
|
|
1260
|
-
DELEGATE
|
|
1281
|
+
Built (ADR-0009 era). A DELEGATE formally disputes an AUTHORITY action: the dissent is recorded, attributed, and permanent. It is **non-binding** — the AUTHORITY action stands and the sitting does not suspend. The local engine has no scheduler, so the `--window` is a declared intent carried on the record, not an enforced pause; the durable mechanism is the attributable challenge itself, which makes a bad-faith AUTHORITY action visible and answerable to everyone who can read the repo.
|
|
1261
1282
|
|
|
1262
1283
|
**3. Prorogation by Consensus**
|
|
1263
1284
|
|
|
@@ -1307,7 +1328,7 @@ Session resumes
|
|
|
1307
1328
|
|---|---|---|
|
|
1308
1329
|
| Distributed (default) | Every Constituency keeps local log | Most sessions |
|
|
1309
1330
|
| Anchored | Designated RECORD agent aggregates | Enterprise, audit |
|
|
1310
|
-
| Ephemeral | No record kept |
|
|
1331
|
+
| Ephemeral | No record kept | Short-lived, no-audit sessions |
|
|
1311
1332
|
|
|
1312
1333
|
Charter declares mode. Framework respects it.
|
|
1313
1334
|
|
|
@@ -154,7 +154,7 @@ The original text of each ruling is preserved below for the record.
|
|
|
154
154
|
- *Banned:* the Charter validator rejects `merge_strategy: squash` outright.
|
|
155
155
|
Consistent with the Hansard's immutability claim; a squashed Motion cannot
|
|
156
156
|
produce a per-actor forensic record. Costs flexibility for protocols that
|
|
157
|
-
genuinely do not care (Hackathon,
|
|
157
|
+
genuinely do not care (Hackathon, Elimination Tournament).
|
|
158
158
|
- *Off by default:* permitted where a protocol declares it, with the attribution
|
|
159
159
|
loss recorded at Writ Drop. Preserves protocol-agnosticism, which is a stated
|
|
160
160
|
design principle ("Parliamentary is protocol #1, not a privileged mode").
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
A protocol is a vocabulary-translation manifest over CANON, plus a small set of
|
|
12
12
|
behavioral flags: `mode` (`constitutional` | `authoritarian` | `darwinist` |
|
|
13
13
|
`ephemeral` | `immutable`), and `no_escalation`, `no_record`,
|
|
14
|
-
`immutable_charter`, `domain_veto`.
|
|
15
|
-
`protocols/*.yml`,
|
|
16
|
-
|
|
14
|
+
`immutable_charter`, `domain_veto`. Eleven protocol manifests ship in
|
|
15
|
+
`protocols/*.yml`, several game-theory shapes among them (Elimination Tournament,
|
|
16
|
+
Jury Deliberation, Peer Review, Adversarial Collaboration).
|
|
17
17
|
|
|
18
18
|
The vocabulary half works: `roleTerm`/`term` translate CANON into a protocol's
|
|
19
19
|
words for the interface and the record. The behavioral half did not. The flags
|
|
@@ -22,7 +22,7 @@ linter, and shipped in every manifest — but **no engine module ever read them*
|
|
|
22
22
|
The predicates written for exactly this purpose (`allowsEscalation`,
|
|
23
23
|
`keepsRecord`, `allowsCharterAmendment`) were exported and never called.
|
|
24
24
|
|
|
25
|
-
The consequence:
|
|
25
|
+
The consequence: an `elimination-tournament` session and a `parliamentary` session ran
|
|
26
26
|
byte-for-byte identical mechanics, differing only in the words written to the
|
|
27
27
|
Hansard. A Darwinist protocol that declares "no appeals" still accepted them.
|
|
28
28
|
The thesis that different governance structures change how a chamber behaves was,
|
|
@@ -71,9 +71,16 @@ actor that dislikes it exits rather than appeals.
|
|
|
71
71
|
- **`immutable_charter`** has no Charter field and no runtime charter-amendment
|
|
72
72
|
command to guard. There is nothing to refuse yet.
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
*Superseded:* `immutable_charter` is now enforced without a Charter field or an
|
|
75
|
+
amend command. The engine records the Charter's fingerprint on the WRIT_DROP
|
|
76
|
+
entry and refuses a governance act when a protocol whose mechanics forbid
|
|
77
|
+
amendment has had its CHARTER.md edited since Writ Drop — the tamper *is* the
|
|
78
|
+
amendment, and the immutable record catches it. `no_record` remains metadata
|
|
79
|
+
only.
|
|
80
|
+
|
|
81
|
+
`no_record` remains protocol-manifest metadata consumed only by the SDK's
|
|
82
|
+
coherence linter until a design exists. Recording it here keeps the gap explicit
|
|
83
|
+
rather than silent.
|
|
77
84
|
|
|
78
85
|
## Consequences
|
|
79
86
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
ADR-0006 wired the first protocol behavioral flag (`session.escalation`) into the
|
|
12
12
|
engine. It closed a credibility gap but not the central one: protocols still
|
|
13
|
-
share one set of *mechanics*.
|
|
13
|
+
share one set of *mechanics*. An Elimination Tournament and a Jury run the same Division
|
|
14
14
|
tally, the same exit rules, the same termination — they differ only in vocabulary
|
|
15
15
|
and whether appeals are allowed. The framework's thesis is that different
|
|
16
16
|
governance structures produce different behavior; a protocol layer that only
|
|
@@ -38,7 +38,7 @@ The correct model separates the **referee** (deterministic code) from the
|
|
|
38
38
|
- Each point is filled by a named, deterministic **strategy** from a built-in
|
|
39
39
|
registry. A protocol is unique because it *composes* a unique set of strategies.
|
|
40
40
|
- Composition, not inheritance: protocols mix independent rules (a tribunal may
|
|
41
|
-
want a Jury's unanimity with
|
|
41
|
+
want a Jury's unanimity with an Elimination Tournament's no-appeals), which a class
|
|
42
42
|
hierarchy cannot express cleanly and composition can.
|
|
43
43
|
- Functional, not class trees: a strategy is a pure function selected by name,
|
|
44
44
|
matching this codebase's pure, table-driven core.
|
|
@@ -67,7 +67,7 @@ Each strategy is a pure function with the same signature as its siblings, unit
|
|
|
67
67
|
tested in isolation. The engine dispatches by name; adding a strategy is a table
|
|
68
68
|
entry, not an engine change. Adding an override point is an ADR.
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Elimination Tournament is then `{resolution: majority, exit: elimination, termination:
|
|
71
71
|
last-standing, escalation: disabled}`. A Jury is `{resolution: unanimity, exit:
|
|
72
72
|
none, termination: verdict}`. Parliament is the default of every slot. Same
|
|
73
73
|
engine, genuinely different behavior — every one still writing to the same Hansard.
|
|
@@ -31,14 +31,21 @@ git commits it).
|
|
|
31
31
|
|
|
32
32
|
Lifecycle, all on the record:
|
|
33
33
|
|
|
34
|
-
- **`MATCH_CREATED`** — a pairing: round, contestant A, contestant B (or a bye)
|
|
35
|
-
Produced by `pairRound(contestants, standings,
|
|
36
|
-
reads the current standings
|
|
34
|
+
- **`MATCH_CREATED`** — a pairing: round, contestant A, contestant B (or a bye),
|
|
35
|
+
and an optional best-of length. Produced by `pairRound(contestants, standings,
|
|
36
|
+
format, round, played, seed?)`, which reads the current standings, the pairs
|
|
37
|
+
already played, and an optional seed order:
|
|
37
38
|
- **single-elim** — pairs the still-undefeated (`losses === 0`); the bracket
|
|
38
39
|
narrows by loss, so no cull is required and one-undefeated is the champion.
|
|
39
40
|
- **swiss** — seeds by score and pairs adjacent, never rematching.
|
|
40
41
|
- **round-robin** — pairs each contestant with an opponent not yet played; a
|
|
41
42
|
bye when none remains.
|
|
43
|
+
- **seeding** — given a `seed` order, the first round folds the field (top half
|
|
44
|
+
against bottom half) so strong seeds meet late, and the seed breaks equal-score
|
|
45
|
+
ties in every later round.
|
|
46
|
+
- **`MATCH_GAME`** — one game of a best-of-N match. A best-of-1 match is decided
|
|
47
|
+
by a single report and records no game; a longer series records each game and
|
|
48
|
+
settles only when a side reaches the majority (`gamesToWin`).
|
|
42
49
|
- **`MATCH_DECIDED`** — the result: a referee (AUTHORITY) names the winner; the
|
|
43
50
|
loser is the other contestant. Refuses to crown a non-contestant, re-decide a
|
|
44
51
|
settled match, or resolve one that does not exist.
|
|
@@ -69,6 +76,10 @@ the bracket.
|
|
|
69
76
|
added the CONFLICT primitive and ASSENT verb), the CANON constant in `canon.ts`
|
|
70
77
|
carries the addition; the locked invention-disclosure prose is revised only
|
|
71
78
|
under explicit human instruction when next opened.
|
|
72
|
-
- **
|
|
73
|
-
and
|
|
74
|
-
|
|
79
|
+
- **Since built** (additive over this ADR, no engine change): seeded first-round
|
|
80
|
+
fold pairing and seed-based tie-breaks (`pair --seed`), best-of-N series
|
|
81
|
+
(`pair --best-of`, one `MATCH_GAME` per game, settled on a majority), and
|
|
82
|
+
Buchholz tie-breaks in the win-loss standings (strength of schedule). Each
|
|
83
|
+
reuses the Hansard, the commit path and the scoring read exactly as the base
|
|
84
|
+
MATCH did. Sonneborn-Berger and other refinements remain open, and are equally
|
|
85
|
+
additive.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cordfuse/politik",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Politik — a governed multi-agent framework built on git. The SCM repository is the session: charter, record, state, and invite in one.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/charter.ts
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* Attribution: Steve Krisjanovs, Cordfuse
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { createHash } from 'node:crypto';
|
|
16
|
+
|
|
15
17
|
import { parse as parseYaml } from 'yaml';
|
|
16
18
|
|
|
17
19
|
import {
|
|
@@ -24,6 +26,19 @@ import type { ProtocolRecordMode } from './protocol.ts';
|
|
|
24
26
|
import { isResolution, isExitPolicy, type Resolution, type ExitPolicy } from './division.ts';
|
|
25
27
|
import { isTerminationPolicy, type TerminationPolicy } from './prorogation.ts';
|
|
26
28
|
|
|
29
|
+
/**
|
|
30
|
+
* A content fingerprint of a Charter's source text.
|
|
31
|
+
*
|
|
32
|
+
* Recorded on the WRIT_DROP entry at session open so an immutable-charter
|
|
33
|
+
* protocol (ADR-0007 `immutable_charter`) can prove its constitution has not
|
|
34
|
+
* been edited since. The raw CHARTER.md bytes are hashed — not the parsed
|
|
35
|
+
* object — so any change the operator makes to the file, meaningful or not, is
|
|
36
|
+
* detectable; the immutability contract is about the text on disk, not its
|
|
37
|
+
* interpretation.
|
|
38
|
+
*/
|
|
39
|
+
export const charterFingerprint = (source: string): string =>
|
|
40
|
+
createHash('sha256').update(source, 'utf8').digest('hex');
|
|
41
|
+
|
|
27
42
|
/* -------------------------------------------------------------------------- */
|
|
28
43
|
/* Schema */
|
|
29
44
|
/* -------------------------------------------------------------------------- */
|