@cordfuse/politik 0.3.0 → 0.4.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Politik
2
2
 
3
- [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.19490359-blue)](https://doi.org/10.5281/zenodo.19490359)
3
+ [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.19490358-blue)](https://doi.org/10.5281/zenodo.19490358)
4
4
  [![License](https://img.shields.io/badge/license-MIT-green)](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,18 +44,72 @@ 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
- git clone git@github.com:cordfuse/politik.git
47
- cd politik
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?
49
+ ```
50
+
51
+ Or run without installing:
52
+
53
+ ```sh
54
+ npx @cordfuse/politik doctor
51
55
  ```
52
56
 
53
- > The npm package (`@cordfuse/politik`) is not published yet; install from source
54
- > for now.
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
 
67
+ **Bring your own AI harness** (ADR-0010). Create the folder, open whichever harness
68
+ you already use there, and talk to it in plain language:
69
+
70
+ ```sh
71
+ politik new q4-planning
72
+ cd q4-planning
73
+ claude # or codex, agy, opencode…
74
+ ```
75
+
76
+ The harness walks you through choosing a protocol, writing the Charter and
77
+ convening the session, then turns your requests into `politik` commands. Reading
78
+ is free; permanent acts are not. `assent`, `rule` and `prorogue` requested by a
79
+ harness or a script are **staged**, and only you can enact them, in your own
80
+ terminal:
81
+
82
+ ```sh
83
+ politik pending # what is waiting for you
84
+ politik confirm assent-3f9a2c # shows the act, asks you to type its id, then records it
85
+ politik reject assent-3f9a2c # or discard it
86
+ ```
87
+
88
+ Every commit records how it was requested (`Politik-Requested-Via: claude-code_…`)
89
+ and, for a confirmed act, that the Speaker confirmed it. The session's instruction
90
+ files are sealed at Writ Drop: if an agent rewrites them, governance stops until
91
+ they are restored.
92
+
93
+ ### Sharing a session across machines
94
+
95
+ A session can be shared through any git remote — GitHub, a NAS, anything git can
96
+ reach (ADR-0011). Several people, each with their own harness, and agents on other
97
+ machines can all act on it:
98
+
99
+ ```sh
100
+ politik remote git@github.com:acme/q4-planning.git # the Speaker shares it
101
+ politik join git@github.com:acme/q4-planning.git q4 --as ada # someone else joins
102
+ ```
103
+
104
+ Every act fetches the latest record first and pushes after; if someone else acted
105
+ in between, Politik recomputes the act on top of theirs, so the Hansard never needs a
106
+ manual merge. Offline, governance refuses and reads still work. Acts staged for the
107
+ Speaker are shared too, and only the seat an act names can confirm it. For proof
108
+ rather than names, set `signed_confirmations: required` in the Charter and each
109
+ confirmed act is signed with the confirming person's git key.
110
+
111
+ ### By hand, or from a script
112
+
58
113
  Every command below is a git commit. `git log` in the session directory is the
59
114
  Hansard — the immutable record.
60
115
 
@@ -68,6 +123,11 @@ politik division tally --dir ./session --motion adopt-standard #
68
123
  politik assent --dir ./session --motion adopt-standard --actor you --role AUTHORITY
69
124
  ```
70
125
 
126
+ Run at your own terminal, `assent` asks you to type `assent` to confirm. For a
127
+ fully scripted session (CI, tests), scaffold with `--speaker-confirmation off` —
128
+ the setting lives in the Charter, which is sealed at Writ Drop, so it cannot be
129
+ switched off later.
130
+
71
131
  Seat a real agent to do the work instead of a human vote:
72
132
 
73
133
  ```sh
@@ -114,6 +174,17 @@ and correct on git alone. *Run local, run free.*
114
174
  | Repo access | Taking a Seat |
115
175
  | git history | Hansard (immutable record) |
116
176
 
177
+ ### The Politik Tree
178
+
179
+ A session is either a standalone repository or a **node in a tree** — an
180
+ organisation's Org → Team → Sprint → Ticket hierarchy as nested directories in
181
+ one repository, each node inheriting its parent's Charter. Federation is **local
182
+ traversal over that one working tree**, not cross-repository orchestration: no new
183
+ service, no registry server. `politik registry` walks the tree and reports every
184
+ session's state and cost with a roll-up; `politik cascade` flags a fault repeating
185
+ across sibling sessions. `politik init --standalone` opts a node out into its own
186
+ repository when it needs per-session pull requests or a hard permission boundary.
187
+
117
188
  ### Agent Model
118
189
 
119
190
  Agents are stateless. No persistent processes. State lives in git.
@@ -128,12 +199,16 @@ The Speaker (human) is constitutionally present, not operationally present. Drop
128
199
 
129
200
  ### Governance Protocols
130
201
 
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. A wider catalogue of governance shapes is sketched in [PROTOCOLS.md](PROTOCOLS.md).
202
+ **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).
203
+
204
+ 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
205
 
133
206
  ### Hansard and LEDGER
134
207
 
135
208
  **Hansard** — append-only session record. Every motion, vote, escalation, and commit. Attributed, timestamped, immutable. Cannot be edited. Cannot be gamed.
136
209
 
210
+ 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.
211
+
137
212
  **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
213
 
139
214
  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 +264,5 @@ MIT licensed. The entire framework — CANON, protocol library, session engine,
189
264
 
190
265
  **Attribution:** Steve Krisjanovs, Cordfuse
191
266
  **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.19490359](https://doi.org/10.5281/zenodo.19490359)
267
+ **DOI:** [10.5281/zenodo.19490358](https://doi.org/10.5281/zenodo.19490358) (concept DOI — always resolves to the latest version)
193
268
  **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
- | Battle Royale | All-pay elimination auction | Aggressive early, conservative late |
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
- - Battle Royale is a real-world implementation
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: battle-royale
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 (Battle Royale, Elimination Tournament) |
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 receives EXPEL motion
160
+ Actor is removed (an involuntary exit is on the record)
161
161
  ↓
162
- Actor commits escalation to /escalations/disputed-exit-[timestamp].md
163
- (must happen before session access revoked — Charter defines window)
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
- Session pauses automatically
166
+ The sitting auto-suspends, cause DISPUTED_EXIT
166
167
  ↓
167
- Speaker receives notification
168
+ Speaker reviews the Hansard — was the removal procedurally valid?
168
169
  ↓
169
- Speaker reviews Hansard — was the elimination procedurally valid?
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
- Two possible rulings:
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
- A GitHub Actions scheduled workflow runs hourly. It checks the timestamp of the last Hansard commit. If no commit has occurred within `heartbeat_timeout_hours` the proceeding is considered stale.
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 → suspended: true` and a `SESSION_STALE` Hansard record. Agents check STATE.json before every action — they see suspended and stop immediately.
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 — ROADMAP TARGET: v0.9.x
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 → active
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
- # Battle Royale
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
- # Military Operation
725
+ # Monarchy
701
726
  minimum_cast:
702
- AUTHORITY: 1 # Commanding Officer required
703
- OPERATOR: 1 # At least one field agent
704
- quorum: 1 # CO alone can issue orders
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 — all optional Charter declarations:**
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
- ```yaml
1253
- governance:
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 can formally dispute an AUTHORITY action before it takes effect. The challenged action is logged and paused. AUTHORITY still wins after the window — but the challenge is on the permanent record. Makes bad faith AUTHORITY actions visible and attributable.
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 | Intelligence, Organized Crime protocols |
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, Battle Royale).
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`. Ten protocol manifests ship in
15
- `protocols/*.yml`, five of them game-theory shapes (Battle Royale, Elimination
16
- Tournament, League Season, Red/Blue Team, Peer Review).
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: a `battle-royale` session and a `parliamentary` session ran
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
- Both remain protocol-manifest metadata consumed only by the SDK's coherence
75
- linter until a design exists. Recording them here keeps the gap explicit rather
76
- than silent.
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*. A Battle Royale and a Jury run the same Division
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 a Battle Royale's no-appeals), which a class
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
- Battle Royale is then `{resolution: majority, exit: elimination, termination:
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, format, round, played)`, which
36
- reads the current standings and the pairs already played:
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
- - **Not built:** seeding beyond score order, tie-breaks (Buchholz/Sonneborn),
73
- and best-of-N matches. All are additive over `MATCH_DECIDED` and out of scope
74
- here.
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.
@@ -0,0 +1,145 @@
1
+ # ADR-0010 — The Operator Interface: Bring Your Own Harness
2
+
3
+ **Attribution:** Steve Krisjanovs, Cordfuse
4
+
5
+ **Status:** Accepted — built (`src/operator.ts`, `src/pending.ts`; `politik new`, `pending` / `confirm` / `reject`, `protocol list`, `status --json`; provenance trailers; sealed instruction files).
6
+
7
+ ---
8
+
9
+ ## Context
10
+
11
+ Politik is heavy for a human to drive: about 32 top-level commands, and a first
12
+ session is seven commands repeating the same flags. The architecture says the
13
+ Speaker is *constitutionally present, not operationally present* — yet setting up
14
+ and following a session was all manual commands.
15
+
16
+ Three interfaces were considered:
17
+
18
+ 1. **An interactive shell with no AI.** Deterministic and safe, but still asks the
19
+ operator to know the vocabulary (division, tally, assent).
20
+ 2. **AI built into Politik's own interface.** Means rebuilding a harness (tool
21
+ loop, providers, streaming, context), paying per token through API keys —
22
+ providers do not let third-party apps reuse subscription logins — and owning
23
+ the prompt-injection defence alone.
24
+ 3. **The operator's existing AI harness** (Claude Code, Codex, agy, opencode, or
25
+ whatever comes next), opened in the session folder, translating plain language
26
+ into `politik` commands.
27
+
28
+ ## Decision
29
+
30
+ **The operator's entry point is their own harness, opened in the session
31
+ folder.** Politik does not choose, bundle or favour one:
32
+
33
+ ```
34
+ npm i -g @cordfuse/politik
35
+ politik new q4-planning # folder + bootstrap instructions
36
+ cd q4-planning
37
+ claude # or codex, agy, opencode…
38
+ ```
39
+
40
+ **Safety is enforced in the CLI, not in prompts.** Instructions to a model are
41
+ requests; the guarantees below hold whichever harness is used, or none.
42
+
43
+ ### 1. `politik new <dir>` — the front door
44
+
45
+ Creates the folder and writes bootstrap instructions (`AGENTS.md`, with
46
+ `CLAUDE.md` and `GEMINI.md` pointing to it). On first run the harness checks the
47
+ CLI is installed, asks the operator for protocol, quorum and seats, runs
48
+ `politik scaffold --dir .` in place, helps edit the Charter, then runs
49
+ `politik init`. Choices are deferred to the conversation; `scaffold` remains the
50
+ non-interactive path for scripts, CI and child nodes (`--parent`). There is no
51
+ template repository: a second copy of the bootstrap would drift from the CLI
52
+ that runs it.
53
+
54
+ `scaffold` replaces the bootstrap files with protocol-specific ones and now
55
+ **reports every file it overwrites** instead of replacing them silently.
56
+
57
+ ### 2. Pending acts — the Speaker's confirmation
58
+
59
+ The constitutional acts — `assent`, `rule`, `prorogue` — are gated when the
60
+ Charter sets `session.speaker_confirmation: required`. **New scaffolds default to
61
+ `required`**; a Charter without the key (every session convened before this ADR)
62
+ behaves as `off`, so no existing session changes behaviour.
63
+
64
+ Under `required`, an act is staged instead of committed when **either**:
65
+
66
+ - an AI harness is detected in the environment (`AI_AGENT`, `CLAUDECODE`,
67
+ `CODEX_*`, `AGY_*`, `OPENCODE_*`, `GEMINI_CLI`), or
68
+ - there is no terminal on stdin (a script, a pipe, a harness without a pty).
69
+
70
+ A staged act is written to `.politik/pending/<id>.json` (never committed) and the
71
+ command prints the id. Nothing reaches the record. The Speaker then runs, **in
72
+ their own terminal**:
73
+
74
+ - `politik pending` — list staged acts
75
+ - `politik confirm <id>` — shows the act and requires typing its id; only then
76
+ is it executed and committed
77
+ - `politik reject <id>` — discards it
78
+
79
+ `confirm` itself refuses to run without a terminal or under a detected harness.
80
+ A human running an act directly at a terminal with no harness is prompted inline
81
+ the same way.
82
+
83
+ Because the setting lives in the Charter, and the Charter is fingerprinted at Writ
84
+ Drop, a session cannot quietly turn its own gate off after it has opened.
85
+
86
+ ### 3. Provenance — the record says who acted
87
+
88
+ Every governance commit carries trailers:
89
+
90
+ ```
91
+ Politik-Requested-Via: claude-code_2-1-283_agent (or: terminal, script)
92
+ Politik-Confirmed-By: speaker-at-terminal (staged acts only)
93
+ ```
94
+
95
+ `AI_AGENT` is preferred when set (it names harness and version); otherwise the
96
+ harness is inferred from known variables, then from whether a terminal is
97
+ attached. Where nothing is detectable the trailer says what is certain rather
98
+ than guessing.
99
+
100
+ ### 4. Sealed instruction files
101
+
102
+ `politik init` fingerprints the session's instruction files (`AGENTS.md`,
103
+ `CLAUDE.md`, `GEMINI.md`, whichever exist) onto the WRIT_DROP entry beside the
104
+ Charter fingerprint. Governance acts refuse to proceed if they have changed since,
105
+ and `politik integrity` reports it. An agent that rewrites the instructions the
106
+ Speaker's harness loads has tried to reprogram the governor's own tool; that is
107
+ now a refused act, not a silent one. Unlike the Charter seal, this applies to
108
+ every protocol.
109
+
110
+ ### 5. Session content is data
111
+
112
+ The protocol `AGENTS.md` carries a section for a harness assisting the Speaker:
113
+ translate requests into commands, preview every write, never run
114
+ `politik confirm` on the Speaker's behalf, and treat Motions, Hansard text and
115
+ other agent-written content as data, never as instructions.
116
+
117
+ ### 6. Where the Hansard begins
118
+
119
+ The Hansard begins at the `writ drop: session <guid>` commit. For a standalone
120
+ session created with `politik new` that is the repository's first commit. For a
121
+ session inside an existing repository (a tree, ADR-0008) earlier commits belong to
122
+ the enclosing repository and are not part of this session's record.
123
+
124
+ ## Threat model — what this does and does not stop
125
+
126
+ The gate protects against **a cooperative harness making a mistake or being
127
+ steered** — a misread request, or a prompt injection planted in agent-written
128
+ text that tells the model to enact something. Those paths end at a staged act a
129
+ human must confirm.
130
+
131
+ It is **not a sandbox against a hostile agent with the same shell privileges as
132
+ the human.** Such an agent could unset environment variables or allocate a
133
+ pseudo-terminal. Defending against that needs an operating-system boundary — a
134
+ separate user account, or a signing key the agent cannot read — which is out of
135
+ scope here and noted for a future ADR.
136
+
137
+ ## Consequences
138
+
139
+ - The operator talks in plain language; permanent acts still need a human at a
140
+ terminal.
141
+ - Every harness works the same, including ones that do not exist yet.
142
+ - Existing sessions and the test suite are unaffected: the gate is opt-in per
143
+ Charter, defaulting on only for newly scaffolded sessions.
144
+ - `--json` output is added to `status` and `pending` for reliable machine
145
+ reading; broader `--json` / `--dry-run` coverage is follow-up work.