@cordfuse/politik 0.5.0 → 0.6.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.
Files changed (82) hide show
  1. package/EXECUTION.md +86 -83
  2. package/POLITIK-ARCHITECTURE.md +111 -176
  3. package/PROTOCOLS.md +120 -325
  4. package/README.md +130 -188
  5. package/RESEARCH.md +142 -438
  6. package/RUNTIME.md +253 -261
  7. package/docs/adr/0001-chamber-transport.md +2 -0
  8. package/docs/adr/0002-charter-schema.md +2 -0
  9. package/docs/adr/0003-state-json-schema.md +2 -0
  10. package/docs/adr/0004-motion-enactment.md +2 -0
  11. package/docs/adr/0005-hansard-format.md +2 -0
  12. package/docs/adr/0006-protocol-behavioral-enforcement.md +2 -0
  13. package/docs/adr/0007-protocol-mechanics.md +2 -0
  14. package/docs/adr/0008-session-storage.md +2 -0
  15. package/docs/adr/0009-match-primitive.md +2 -0
  16. package/docs/adr/0010-operator-interface.md +2 -0
  17. package/docs/adr/0011-shared-sessions.md +2 -0
  18. package/docs/adr/0012-plain-vocabulary.md +68 -0
  19. package/docs/adr/0013-rule-defined-protocols.md +89 -0
  20. package/package.json +1 -1
  21. package/protocols/CONTRIBUTING.md +47 -87
  22. package/protocols/adversarial-review.yml +19 -0
  23. package/protocols/elimination-rounds.yml +18 -0
  24. package/protocols/majority-vote.yml +18 -0
  25. package/protocols/panel-review.yml +19 -0
  26. package/protocols/single-decider.yml +18 -0
  27. package/protocols/unanimous-vote.yml +17 -0
  28. package/src/actors.ts +124 -100
  29. package/src/agents.ts +31 -22
  30. package/src/ballot.ts +747 -0
  31. package/src/canon.ts +23 -10
  32. package/src/capability.ts +16 -99
  33. package/src/charter.ts +41 -34
  34. package/src/cli.ts +535 -480
  35. package/src/{prorogation.ts → closing.ts} +43 -43
  36. package/src/conflict.ts +14 -14
  37. package/src/containment.ts +11 -11
  38. package/src/doctor.ts +1 -1
  39. package/src/election.ts +4 -4
  40. package/src/envelope.ts +3 -3
  41. package/src/escalation.ts +44 -44
  42. package/src/fault.ts +8 -8
  43. package/src/federation.ts +14 -14
  44. package/src/git.ts +17 -17
  45. package/src/heartbeat.ts +32 -32
  46. package/src/index.ts +5 -5
  47. package/src/init.ts +66 -65
  48. package/src/integrity.ts +30 -30
  49. package/src/ledger.ts +3 -3
  50. package/src/{hansard.ts → log.ts} +20 -20
  51. package/src/{crisis.ts → misconduct.ts} +70 -70
  52. package/src/operator.ts +5 -5
  53. package/src/pending.ts +9 -9
  54. package/src/projection.ts +30 -30
  55. package/src/protocol-sdk.ts +12 -121
  56. package/src/protocol.ts +8 -78
  57. package/src/providers/github.ts +12 -12
  58. package/src/quorum.ts +7 -7
  59. package/src/remote.ts +1 -1
  60. package/src/runner.ts +71 -55
  61. package/src/scm.ts +14 -14
  62. package/src/spawn.ts +4 -4
  63. package/src/standings.ts +13 -13
  64. package/src/state.ts +6 -6
  65. package/src/templates/session.ts +448 -0
  66. package/src/tournament.ts +20 -20
  67. package/src/transport.ts +4 -4
  68. package/src/tree.ts +16 -16
  69. package/protocols/adversarial-collaboration.yml +0 -28
  70. package/protocols/corporate.yml +0 -35
  71. package/protocols/elimination-tournament.yml +0 -41
  72. package/protocols/emergency-response-ics.yml +0 -27
  73. package/protocols/jury-deliberation.yml +0 -32
  74. package/protocols/monarchy.yml +0 -31
  75. package/protocols/parliamentary.yml +0 -66
  76. package/protocols/peer-review.yml +0 -44
  77. package/protocols/republic.yml +0 -36
  78. package/protocols/scrum.yml +0 -87
  79. package/protocols/socialism-collective.yml +0 -31
  80. package/protocols/solo.yml +0 -32
  81. package/src/division.ts +0 -609
  82. package/src/templates/parliamentary.ts +0 -581
package/src/quorum.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * Quorum check.
3
3
  *
4
- * Quorum is the minimum number of actors for a valid Division
4
+ * Quorum is the minimum number of actors for a valid vote
5
5
  * (RUNTIME.md § SESSION QUORUM, MINIMUM CAST AND SINGLE-PLAYER SESSIONS).
6
6
  * Two distinct gates live here and are frequently confused:
7
7
  *
8
- * - **minimum_cast** — a Writ Drop gate. Are the required constituencies
8
+ * - **minimum_cast** — a session opening gate. Are the required constituencies
9
9
  * declared at all? Enforced by the Charter validator (ADR-0002 rule 3).
10
10
  * - **quorum** — a runtime gate. Are enough actors *present right now* for a
11
- * Division to be valid? That is this module.
11
+ * vote to be valid? That is this module.
12
12
  *
13
13
  * `quorum: 1` is a legitimate configuration, not a degenerate one: a
14
14
  * single-player session whose governance value is the audit trail and the
@@ -24,8 +24,8 @@ import type { Role } from './canon.ts';
24
24
  /* -------------------------------------------------------------------------- */
25
25
 
26
26
  /**
27
- * A Speaker's explicit acknowledgement that the session proceeds with a
28
- * reduced cast. Always visible in the Hansard — it cannot be hidden.
27
+ * An owner's explicit acknowledgement that the session proceeds with a
28
+ * reduced cast. Always visible in the record — it cannot be hidden.
29
29
  */
30
30
  export interface QuorumOverride {
31
31
  readonly enabled: boolean;
@@ -40,7 +40,7 @@ export interface QuorumOverride {
40
40
  /* -------------------------------------------------------------------------- */
41
41
 
42
42
  export interface QuorumResult {
43
- /** May a Division proceed? */
43
+ /** May a vote proceed? */
44
44
  readonly met: boolean;
45
45
  readonly required: number;
46
46
  readonly present: number;
@@ -116,7 +116,7 @@ export const checkQuorum = (input: QuorumInput): QuorumResult => {
116
116
  };
117
117
 
118
118
  /**
119
- * Render the Hansard fields for a quorum decision.
119
+ * Render the record fields for a quorum decision.
120
120
  *
121
121
  * A degraded session must be legible to any later reviewer, so the override
122
122
  * and its reason are recorded as fields rather than buried in prose.
package/src/remote.ts CHANGED
@@ -117,7 +117,7 @@ export const configureClone = async (dir: string, handle: string | null): Promis
117
117
  const branch = await currentBranch(dir);
118
118
  if (branch === null) return null;
119
119
  // Acts commit under this clone's git identity. A machine with none configured
120
- // gets the seat handle, the same convention Writ Drop uses for the Speaker.
120
+ // gets the seat handle, the same convention session opening uses for the owner.
121
121
  if (handle !== null && (await config(dir, 'user.name')) === null) {
122
122
  await gitx(dir, ['config', 'user.name', handle]);
123
123
  await gitx(dir, ['config', 'user.email', `${handle}@politik.local`]);
package/src/runner.ts CHANGED
@@ -23,12 +23,12 @@ import { dirname, join, resolve } from 'node:path';
23
23
  import { fileURLToPath } from 'node:url';
24
24
 
25
25
  import { findAgent, composePrompt, type AgentSpec } from './agents.ts';
26
- import type { Role, Verb } from './canon.ts';
26
+ import { ROLE_VERBS, type Role, type Verb } from './canon.ts';
27
27
  import { parseCharter, type Charter } from './charter.ts';
28
28
  import { parseEnvelope, claimSlot, type Envelope } from './envelope.ts';
29
29
  import { standForElection, bowOut, type ElectionOptions } from './election.ts';
30
30
  import { nodeLockFs } from './lockfs.ts';
31
- import { appendEntry, parseEntries, type HansardEntry } from './hansard.ts';
31
+ import { appendEntry, parseEntries, type RecordEntry } from './log.ts';
32
32
  import { spawnAgent, type SpawnResult } from './spawn.ts';
33
33
  import {
34
34
  appendLedgerRow, parseResultText, parseUsage, type Usage,
@@ -50,7 +50,7 @@ export interface RunOptions {
50
50
  readonly dir: string;
51
51
  /** Registry id of the agent to seat, e.g. `claude-code`. */
52
52
  readonly agent_id: string;
53
- /** Handle recorded in the Hansard for this agent. */
53
+ /** Handle recorded in the log for this agent. */
54
54
  readonly actor: string;
55
55
  /** Constituency to seat the agent in. */
56
56
  readonly role: Role;
@@ -94,12 +94,12 @@ export type RunOutcome =
94
94
  | {
95
95
  readonly ok: true;
96
96
  readonly result: SpawnResult;
97
- readonly entry: HansardEntry;
97
+ readonly entry: RecordEntry;
98
98
  readonly files_touched: readonly string[];
99
- /** The turn completed but the agent filed a Point of Order, so the sitting is now suspended. */
99
+ /** The turn completed but the agent filed an escalation, so the session is now suspended. */
100
100
  readonly suspended?: boolean;
101
101
  }
102
- | { readonly ok: false; readonly reason: string; readonly entry?: HansardEntry };
102
+ | { readonly ok: false; readonly reason: string; readonly entry?: RecordEntry };
103
103
 
104
104
  /* -------------------------------------------------------------------------- */
105
105
  /* Helpers */
@@ -146,7 +146,7 @@ const head = (dir: string, spawnFn: typeof spawn): Promise<string> =>
146
146
  /**
147
147
  * Files the agent touched — committed *or* left in the tree.
148
148
  *
149
- * Both halves are necessary. The Standing Orders tell agents "commit your
149
+ * Both halves are necessary. The Charter tell agents "commit your
150
150
  * result; uncommitted work does not exist", so a well-behaved agent leaves a
151
151
  * clean tree and a new commit — and a working-tree diff alone would report that
152
152
  * it did nothing. The first live session did exactly this: the agent wrote and
@@ -175,9 +175,9 @@ const filesTouched = async (
175
175
  return [...new Set([...committed, ...newlyDirty])];
176
176
  };
177
177
 
178
- /** Last N entries of the Hansard, as context for a stateless agent. */
179
- const recentRecord = (hansard: string, entries = 3): string => {
180
- const parts = hansard.split(/^## /m).slice(1);
178
+ /** Last N entries of the record, as context for a stateless agent. */
179
+ const recentRecord = (log: string, entries = 3): string => {
180
+ const parts = log.split(/^## /m).slice(1);
181
181
  return parts
182
182
  .slice(-entries)
183
183
  .map((p) => `## ${p.trim()}`)
@@ -246,7 +246,7 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
246
246
  ].join('\n');
247
247
 
248
248
  // Capability gate. The architecture is explicit that the engine "validates
249
- // model compliance at Writ Drop and refuses to spawn a mismatched model
249
+ // model compliance at session opening and refuses to spawn a mismatched model
250
250
  // regardless of operator assignment" — so a mismatch is refused here, before
251
251
  // an agent is spawned, not noticed afterwards.
252
252
  const seat = charter.constituencies.find((c) => c.role === options.role);
@@ -282,7 +282,7 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
282
282
  envelope = envelopeResult.envelope;
283
283
  }
284
284
 
285
- // Elect into the constituency. Local scope only — the Hansard commit is the
285
+ // Elect into the constituency. Local scope only — the record commit is the
286
286
  // global arbiter, and this lock merely grants the right to attempt it.
287
287
  const election: ElectionOptions = {
288
288
  fs: nodeLockFs,
@@ -309,15 +309,23 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
309
309
  }
310
310
 
311
311
  try {
312
- const hansard = (await readIf(join(options.dir, 'HANSARD.md'))) ?? '';
312
+ const log = (await readIf(join(options.dir, 'LOG.md'))) ?? '';
313
313
 
314
314
  const prompt = composePrompt({
315
315
  envelope,
316
316
  role: options.role,
317
- verbs: options.verbs ?? ['READ', 'WRITE', 'ESCALATE'],
317
+ // The role's own verbs, minus ESCALATE where the protocol allows no appeals.
318
+ // A fixed READ/WRITE/ESCALATE list here told voting roles they could not vote.
319
+ // A role the Charter gives a domain veto also holds VETO.
320
+ verbs: options.verbs ?? [
321
+ ...(ROLE_VERBS[options.role] ?? ['READ'])
322
+ .filter((v) => v !== 'ESCALATE' || charter.session.escalation !== 'disabled'),
323
+ ...(charter.domain_veto.includes(options.role) && !(ROLE_VERBS[options.role] ?? []).includes('VETO')
324
+ ? (['VETO'] as const) : []),
325
+ ],
318
326
  protocol: charter.protocol,
319
327
  standing_orders: charter.body,
320
- hansard_excerpt: recentRecord(hansard),
328
+ log_excerpt: recentRecord(log),
321
329
  escalation_enabled: charter.session.escalation !== 'disabled',
322
330
  });
323
331
 
@@ -365,7 +373,7 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
365
373
 
366
374
  let attempts = 1;
367
375
  let classification: Classification | null = null;
368
- const faultEntries: HansardEntry[] = [];
376
+ const faultEntries: RecordEntry[] = [];
369
377
 
370
378
  while (!result.ok) {
371
379
  classification = classify(result);
@@ -401,42 +409,42 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
401
409
  }
402
410
 
403
411
  // Structured output carries the answer inside a JSON envelope; unwrap it so
404
- // the Hansard records what the agent said, not how it was transported.
412
+ // the record shows what the agent said, not how it was transported.
405
413
  const usage: Usage | null = measure ? parseUsage(agent.id, result.stdout) : null;
406
414
  const answer = (measure ? parseResultText(agent.id, result.stdout) : null) ?? result.stdout;
407
415
 
408
416
  const touched = await filesTouched(options.dir, beforeHead, beforeDirty, spawnFn);
409
417
 
410
418
  // Files the RECORD agent owns exclusively (POLITIK-ARCHITECTURE.md
411
- // § File Sovereignty Rules). An actor writing to them is a Standing Orders
419
+ // § File Sovereignty Rules). An actor writing to them is a Charter
412
420
  // violation, and it must be recorded rather than silently tolerated —
413
421
  // a record an actor can write is not a record.
414
422
  //
415
423
  // An agent may also act *through the CLI* during its turn — cast a vote,
416
- // call a Division — and those acts write and commit these same files. The
424
+ // open a vote — and those acts write and commit these same files. The
417
425
  // record must keep them. So the files are read again after the turn, and a
418
426
  // change to them is lawful only when it reached the record the way the CLI
419
- // writes it: committed (nothing left dirty) and, for the Hansard, purely
427
+ // writes it: committed (nothing left dirty) and, for the record, purely
420
428
  // appended. Anything else is a hand edit: a violation, and the record is
421
429
  // restored from the pre-turn copy rather than carrying the edit forward.
422
- const OWNED_BY_RECORD = ['HANSARD.md', 'STATE.json', 'LEDGER.md'];
430
+ const OWNED_BY_RECORD = ['LOG.md', 'STATE.json', 'LEDGER.md'];
423
431
  const dirtyAfter = await dirtyFiles(options.dir, spawnFn);
424
- const hansardAfter = (await readIf(join(options.dir, 'HANSARD.md'))) ?? '';
425
- const hansardAppended =
426
- hansardAfter.startsWith(hansard) && !dirtyAfter.includes('HANSARD.md');
432
+ const logAfter = (await readIf(join(options.dir, 'LOG.md'))) ?? '';
433
+ const logAppended =
434
+ logAfter.startsWith(log) && !dirtyAfter.includes('LOG.md');
427
435
  const violations = touched.filter(
428
436
  (f) =>
429
437
  OWNED_BY_RECORD.includes(f) &&
430
- (dirtyAfter.includes(f) || (f === 'HANSARD.md' && !hansardAppended)),
438
+ (dirtyAfter.includes(f) || (f === 'LOG.md' && !logAppended)),
431
439
  );
432
- // Entries the CLI appended during the turn — votes, Divisions — kept as
440
+ // Entries the CLI appended during the turn — votes, votes — kept as
433
441
  // the base the turn's own entry is appended to.
434
- const recordBase = hansardAppended ? hansardAfter : hansard;
435
- const actsDuringTurn = hansardAppended
436
- ? parseEntries(hansardAfter).length - parseEntries(hansard).length
442
+ const recordBase = logAppended ? logAfter : log;
443
+ const actsDuringTurn = logAppended
444
+ ? parseEntries(logAfter).length - parseEntries(log).length
437
445
  : 0;
438
446
  // The same rule for STATE.json: a committed CLI act may have moved it (a
439
- // tally that deadlocks suspends the sitting), and the turn must not undo it.
447
+ // tally that deadlocks suspends the session), and the turn must not undo it.
440
448
  const stateAfterRaw = dirtyAfter.includes('STATE.json')
441
449
  ? null
442
450
  : await readIf(join(options.dir, 'STATE.json'));
@@ -444,30 +452,38 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
444
452
  (stateAfterRaw === null ? null : parseState(stateAfterRaw)) ?? state;
445
453
 
446
454
  // An agent that hits a decision above its authority is told (composePrompt,
447
- // Rules of the Floor) to file a Point of Order instead of proceeding. On a
448
- // hosted session the point-of-order workflow catches the pushed file and
455
+ // Rules of the Floor) to escalate instead of proceeding. On a
456
+ // hosted session the escalation workflow catches the pushed file and
449
457
  // suspends; a local session has no such watcher, so the runner closes the
450
458
  // loop: a new file under escalations/ — a ruling excepted, since that is the
451
- // Speaker's own reply — is an agent-filed Point of Order, and the sitting
459
+ // owner's own reply — is an agent-filed escalation, and the session
452
460
  // suspends pending a ruling exactly as the CLI `escalate` path does.
453
461
  const escalationFiles = touched.filter(
454
462
  (f) => f.startsWith('escalations/') && !f.slice('escalations/'.length).startsWith('ruling'),
455
463
  );
456
464
  // A protocol declaring no escalation (ADR-0006) has no mechanism to resolve a
457
- // Point of Order, so an agent's escalation file is recorded but does not
458
- // suspend — suspending would deadlock the sitting in a state it cannot lift.
465
+ // escalation, so an agent's escalation file is recorded but does not
466
+ // suspend — suspending would deadlock the session in a state it cannot lift.
459
467
  const escalationDisabled = charter.session.escalation === 'disabled';
460
468
  const agentEscalated = escalationFiles.length > 0 && !escalationDisabled;
461
469
  const escalationIgnored = escalationFiles.length > 0 && escalationDisabled;
462
470
 
463
471
  // Hard Containment Rule. Checked after the turn because it is detection,
464
472
  // not prevention — a spawned process runs with the OS's permissions and
465
- // nothing here can stop it. The Hansard records what happened, which is the
473
+ // nothing here can stop it. The record shows what happened, which is the
466
474
  // framework's answer to most of what it cannot prevent.
467
475
  const containment = checkContainment(options.dir, touched, `${result.stdout}\n${answer}`);
468
476
 
469
- const entry: HansardEntry = {
470
- type: result.ok ? 'MOTION_TABLED' : 'SESSION_FAULT',
477
+ // Work is any file the turn touched other than the record and escalations.
478
+ const producedWork = touched.some(
479
+ (f) => !OWNED_BY_RECORD.includes(f) && !f.startsWith('escalations/'),
480
+ );
481
+
482
+ const entry: RecordEntry = {
483
+ // A turn that produced work tabled a motion. A turn that only read, or acted
484
+ // through the CLI (a vote, an escalation), tabled nothing: recording it as
485
+ // MOTION_TABLED misread every review as a proposal.
486
+ type: !result.ok ? 'SESSION_FAULT' : producedWork ? 'MOTION_TABLED' : 'AGENT_TURN',
471
487
  at: options.now,
472
488
  actor: options.actor,
473
489
  role: options.role,
@@ -485,17 +501,17 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
485
501
  : {}),
486
502
  ...(violations.length > 0
487
503
  ? {
488
- 'Standing Orders violation': `actor wrote to ${violations.join(', ')} — owned by RECORD`,
504
+ 'Charter violation': `actor wrote to ${violations.join(', ')} — owned by RECORD`,
489
505
  }
490
506
  : {}),
491
507
  ...(agentEscalated
492
508
  ? {
493
- 'Point of Order': `actor filed ${escalationFiles.join(', ')} — the sitting is suspended pending a Speaker ruling`,
509
+ 'escalation': `actor filed ${escalationFiles.join(', ')} — the session is suspended pending an owner ruling`,
494
510
  }
495
511
  : {}),
496
512
  ...(escalationIgnored
497
513
  ? {
498
- 'Point of Order': `actor filed ${escalationFiles.join(', ')} — ignored: this protocol declares no escalation`,
514
+ 'escalation': `actor filed ${escalationFiles.join(', ')} — ignored: this protocol declares no escalation`,
499
515
  }
500
516
  : {}),
501
517
  },
@@ -510,9 +526,9 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
510
526
  for (const fault of faultEntries) record = appendEntry(record, fault);
511
527
  record = appendEntry(record, entry);
512
528
 
513
- // A breach suspends the sitting: logged immediately, escalated to the
514
- // Speaker, paused pending a ruling (POLITIK-ARCHITECTURE.md § Hard
515
- // Containment Rule). The Point of Order flow already does exactly that, so
529
+ // A breach suspends the session: logged immediately, escalated to the
530
+ // Owner, paused pending a ruling (POLITIK-ARCHITECTURE.md § Hard
531
+ // Containment Rule). The escalation flow already does exactly that, so
516
532
  // the breach reuses it rather than inventing a parallel path.
517
533
  if (!containment.contained) {
518
534
  record = appendEntry(
@@ -521,7 +537,7 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
521
537
  );
522
538
  }
523
539
 
524
- await writeFile(join(options.dir, 'HANSARD.md'), record, 'utf8');
540
+ await writeFile(join(options.dir, 'LOG.md'), record, 'utf8');
525
541
 
526
542
  // The Clerk appends after every act. A turn that produced no ledger row
527
543
  // would be work the session cannot account for.
@@ -542,17 +558,17 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
542
558
  );
543
559
  }
544
560
 
545
- // The slot is consumed by the Hansard commit, not by winning the lock.
561
+ // The slot is consumed by the record commit, not by winning the lock.
546
562
  claimSlot(envelope);
547
563
 
548
- // Quorum is carried forward untouched. A turn is not a Division, and
564
+ // Quorum is carried forward untouched. A turn is not a vote, and
549
565
  // `present` counts actors eligible to vote — it was previously being
550
566
  // overwritten with the leftover broadcast slot count, which is a different
551
567
  // quantity entirely and made the figure meaningless.
552
- // The sitting suspends on a containment breach or an agent-filed Point of
553
- // Order — both pause pending a Speaker ruling, and both carry the same
554
- // POINT_OF_ORDER cause. A breach names no escalation file; an agent's Point
555
- // of Order does, so its path is recorded as the escalation reference.
568
+ // The session suspends on a containment breach or an agent-filed
569
+ // escalation — both pause pending an owner ruling, and both carry the same
570
+ // ESCALATION cause. A breach names no escalation file; an agent's
571
+ // escalation does, so its path is recorded as the escalation reference.
556
572
  const suspend = !containment.contained || agentEscalated;
557
573
  // Built on the post-turn state, so a suspension or quorum change an act
558
574
  // made during the turn survives; the turn only adds its own suspension.
@@ -563,9 +579,9 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
563
579
  ...(suspend
564
580
  ? {
565
581
  suspension: {
566
- cause: 'POINT_OF_ORDER' as const,
582
+ cause: 'ESCALATION' as const,
567
583
  since: options.now,
568
- record_ref: 'HANSARD.md',
584
+ record_ref: 'LOG.md',
569
585
  escalation_ref: agentEscalated ? (escalationFiles[0] ?? null) : null,
570
586
  },
571
587
  }
@@ -573,7 +589,7 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
573
589
  ? { suspension: stateBase.suspension }
574
590
  : {}),
575
591
  quorum: stateBase.quorum,
576
- hansard_head: stateBase.hansard_head,
592
+ log_head: stateBase.log_head,
577
593
  updated_at: options.now,
578
594
  });
579
595
  await writeFile(join(options.dir, 'STATE.json'), serializeState(nextState), 'utf8');
@@ -581,7 +597,7 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
581
597
  if (!containment.contained) {
582
598
  return {
583
599
  ok: false,
584
- reason: `containment breach — ${containment.breaches.map((b) => b.evidence).join(', ')}; the sitting is suspended pending a Speaker ruling`,
600
+ reason: `containment breach — ${containment.breaches.map((b) => b.evidence).join(', ')}; the session is suspended pending an owner ruling`,
585
601
  entry,
586
602
  };
587
603
  }
package/src/scm.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * Design rules applied here:
10
10
  * - Every call is async. Every provider is a network boundary.
11
11
  * - Nothing returns a bare string. Each mutation returns a typed handle so the
12
- * Hansard writer has something attributable to record.
12
+ * record writer has something attributable to record.
13
13
  * - Provider-native identifiers stay opaque (`id`), with `url` carried
14
14
  * alongside for the human-readable record.
15
15
  *
@@ -26,7 +26,7 @@ import type { MergeStrategy, Role } from './canon.ts';
26
26
  export interface Ref {
27
27
  /** Opaque provider identifier. Never parsed by the engine. */
28
28
  readonly id: string;
29
- /** Human-readable location, recorded in the Hansard. */
29
+ /** Human-readable location, recorded in the log. */
30
30
  readonly url: string;
31
31
  }
32
32
 
@@ -41,19 +41,19 @@ export interface MotionRef extends Ref {
41
41
  readonly branch: string;
42
42
  }
43
43
 
44
- /** An ESCALATION — a Point of Order. */
44
+ /** An ESCALATION — an escalation. */
45
45
  export interface EscalationRef extends Ref {
46
46
  readonly number: number;
47
47
  }
48
48
 
49
- /** A DIVISION requested against a MOTION. */
50
- export interface DivisionRef extends Ref {
49
+ /** A BALLOT requested against a MOTION. */
50
+ export interface BallotRef extends Ref {
51
51
  readonly motion: number;
52
52
  readonly reviewers: readonly string[];
53
53
  }
54
54
 
55
55
  /** The enactment of a carried MOTION. */
56
- export interface AssentResult extends Ref {
56
+ export interface EnactResult extends Ref {
57
57
  readonly motion: number;
58
58
  readonly strategy: MergeStrategy;
59
59
  readonly merged: boolean;
@@ -89,7 +89,7 @@ export interface CollaboratorGrant {
89
89
  * below implements all eleven as listed in the architecture document.
90
90
  */
91
91
  export interface ScmProvider {
92
- /** Provider identifier, e.g. `github`. Recorded in the Hansard header. */
92
+ /** Provider identifier, e.g. `github`. Recorded in the record header. */
93
93
  readonly name: string;
94
94
 
95
95
  /** Write files to the session repo. The underlying act of every MOTION. */
@@ -98,17 +98,17 @@ export interface ScmProvider {
98
98
  /** Table a MOTION. */
99
99
  openPR(title: string, body: string, branch: string): Promise<MotionRef>;
100
100
 
101
- /** Call a DIVISION on a tabled MOTION. */
102
- requestReview(pr: number, actors: readonly string[]): Promise<DivisionRef>;
101
+ /** Call a BALLOT on a tabled MOTION. */
102
+ requestReview(pr: number, actors: readonly string[]): Promise<BallotRef>;
103
103
 
104
104
  /**
105
- * ASSENT — enact a carried MOTION. The Division decides; this enacts.
105
+ * ENACT — enact a carried MOTION. The vote decides; this enacts.
106
106
  * Callers must verify the Motion carried before invoking; providers reject
107
107
  * strategies the Charter did not permit.
108
108
  */
109
- merge(pr: number, strategy: MergeStrategy): Promise<AssentResult>;
109
+ merge(pr: number, strategy: MergeStrategy): Promise<EnactResult>;
110
110
 
111
- /** File an ESCALATION — a Point of Order. */
111
+ /** File an ESCALATION — an escalation. */
112
112
  openIssue(
113
113
  title: string,
114
114
  body: string,
@@ -122,10 +122,10 @@ export interface ScmProvider {
122
122
  category: string,
123
123
  ): Promise<Ref>;
124
124
 
125
- /** Close a milestone — used by the prorogation workflow. */
125
+ /** Close a milestone — used by the closing workflow. */
126
126
  closeMilestone(id: string): Promise<void>;
127
127
 
128
- /** Notify an actor out of band. Speaker email notification rides this. */
128
+ /** Notify an actor out of band. Owner email notification rides this. */
129
129
  notify(actor: string, message: string): Promise<void>;
130
130
 
131
131
  /** Trigger provider-side automation — the Clerk. */
package/src/spawn.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Agent spawning.
3
3
  *
4
4
  * The stateless worker cycle: spawn, execute prompt, capture result, dispose.
5
- * No agent outlives its turn, and no state lives in the process — the Hansard
5
+ * No agent outlives its turn, and no state lives in the process — the record
6
6
  * is the session.
7
7
  *
8
8
  * Kept separate from `agents.ts` so the registry, invocation shapes and prompt
@@ -58,13 +58,13 @@ const DEFAULT_TIMEOUT_MS = 10 * 60 * 1000;
58
58
  /**
59
59
  * Spawn an agent and capture its result.
60
60
  *
61
- * Never uses a shell. The prompt carries Charter text, Hansard excerpts and
61
+ * Never uses a shell. The prompt carries Charter text, record excerpts and
62
62
  * arbitrary session content; passing that through a shell would make every
63
63
  * spawn an injection site. Args go to the child directly.
64
64
  *
65
65
  * Rejects only on a spawn failure the OS reports (command not found, permission
66
66
  * denied). A non-zero exit is a *result*, not an exception — an agent that
67
- * fails its task has still participated, and the Hansard records the outcome
67
+ * fails its task has still participated, and the record shows the outcome
68
68
  * either way.
69
69
  */
70
70
  export const spawnAgent = async (
@@ -139,7 +139,7 @@ export const spawnAgent = async (
139
139
  /**
140
140
  * Is this agent's command present on PATH?
141
141
  *
142
- * Used at Writ Drop to fail fast: a Charter naming a constituency whose agent
142
+ * Used at session opening to fail fast: a Charter naming a constituency whose agent
143
143
  * is not installed should be caught before the session opens, not when the
144
144
  * first broadcast goes unanswered.
145
145
  */
package/src/standings.ts CHANGED
@@ -1,30 +1,30 @@
1
1
  /**
2
2
  * Standings — scoring a competitive protocol from the record.
3
3
  *
4
- * A tournament or league protocol runs as a series of Divisions; who fared how
5
- * is already in the Hansard, so — like `integrity.ts` and `federation.ts` — this
4
+ * A tournament or league protocol runs as a series of votes; who fared how
5
+ * is already in the record, so — like `integrity.ts` and `federation.ts` — this
6
6
  * is a pure read over the record, not new state. A "win" is voting with the side
7
- * a Division carried; elimination is the cull an `exit: elimination` protocol
7
+ * a vote carried; elimination is the cull an `exit: elimination` protocol
8
8
  * records (ADR-0007). Two rankings, because two questions get asked of a
9
9
  * tournament: who won the most (win-loss) and who lasted longest (survival).
10
10
  *
11
11
  * On `pairing`: Swiss / round-robin / single-elimination are 1v1-match formats,
12
- * and a Politik Division is an N-actor vote on a Motion — there is no match to
13
- * pair. Matchmaking needs a *match primitive* the Division model does not have;
12
+ * and a Politik vote is an N-actor vote on a Motion — there is no match to
13
+ * pair. Matchmaking needs a *match primitive* the vote model does not have;
14
14
  * that is an additive design, not a scoring read, and is deliberately not faked
15
15
  * here.
16
16
  *
17
17
  * Attribution: Steve Krisjanovs, Cordfuse
18
18
  */
19
19
 
20
- import { parseEntries } from './hansard.ts';
20
+ import { parseEntries } from './log.ts';
21
21
  import { seats } from './actors.ts';
22
22
 
23
23
  export interface Standing {
24
24
  readonly actor: string;
25
25
  /** Current role, or null if the actor is no longer seated. */
26
26
  readonly seat: string | null;
27
- /** Divisions won: voted with the side that carried (or lost, for rejected). */
27
+ /** votes won: voted with the side that carried (or lost, for rejected). */
28
28
  readonly wins: number;
29
29
  readonly losses: number;
30
30
  readonly eliminated: boolean;
@@ -42,11 +42,11 @@ export type RankBy = 'win-loss' | 'survival';
42
42
 
43
43
  /**
44
44
  * Score every actor who took part. A win is a vote on the carrying side of a
45
- * decided Division; a loss is a vote on the other side; an abstention is neither.
45
+ * decided vote; a loss is a vote on the other side; an abstention is neither.
46
46
  * Elimination and current seat come from the actor record.
47
47
  */
48
- export const standings = (hansard: string, by: RankBy = 'win-loss'): readonly Standing[] => {
49
- const entries = parseEntries(hansard);
48
+ export const standings = (log: string, by: RankBy = 'win-loss'): readonly Standing[] => {
49
+ const entries = parseEntries(log);
50
50
 
51
51
  // motion -> voter -> vote, and motion -> carried?
52
52
  const votes = new Map<string, Map<string, string>>();
@@ -110,18 +110,18 @@ export const standings = (hansard: string, by: RankBy = 'win-loss'): readonly St
110
110
  }
111
111
  }
112
112
 
113
- // Score decided Divisions.
113
+ // Score decided votes.
114
114
  for (const [motion, decided] of carried) {
115
115
  const cast = votes.get(motion);
116
116
  if (cast === undefined) continue;
117
117
  for (const [actor, vote] of cast) {
118
118
  if (vote === 'ABSTAIN') continue;
119
- const wonSide = (vote === 'AYE' && decided) || (vote === 'NO' && !decided);
119
+ const wonSide = (vote === 'YES' && decided) || (vote === 'NO' && !decided);
120
120
  bump(wonSide ? wins : losses, actor);
121
121
  }
122
122
  }
123
123
 
124
- const seated = new Map(seats(hansard).map((s) => [s.actor, s.role]));
124
+ const seated = new Map(seats(log).map((s) => [s.actor, s.role]));
125
125
 
126
126
  const rows: Standing[] = [...participants].map((actor) => ({
127
127
  actor,
package/src/state.ts CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  export const SESSION_STATES = [
28
28
  'CONVENED',
29
29
  'SUSPENDED',
30
- 'PROROGUED',
30
+ 'CLOSED',
31
31
  'STALE',
32
32
  'INVALID',
33
33
  ] as const;
@@ -59,7 +59,7 @@ export const STATE_SCHEMA_VERSION = '1.0.0';
59
59
  export interface Suspension {
60
60
  readonly cause: SuspensionCause;
61
61
  readonly since: string;
62
- /** Hansard anchor, e.g. `HANSARD.md#L482`. */
62
+ /** record anchor, e.g. `LOG.md#L482`. */
63
63
  readonly record_ref: string | null;
64
64
  /** Escalation file, e.g. `escalations/2026-04-08-001.md`. */
65
65
  readonly escalation_ref: string | null;
@@ -77,8 +77,8 @@ export interface SessionStateFile {
77
77
  readonly state: SessionState;
78
78
  readonly suspension: Suspension | null;
79
79
  readonly quorum: QuorumState;
80
- /** Last Hansard commit this state reflects. Null before the first record. */
81
- readonly hansard_head: string | null;
80
+ /** Last record commit this state reflects. Null before the first record. */
81
+ readonly log_head: string | null;
82
82
  readonly updated_at: string;
83
83
  readonly updated_by: string;
84
84
  }
@@ -94,7 +94,7 @@ export interface CreateStateInput {
94
94
  readonly quorum: QuorumState;
95
95
  readonly updated_at: string;
96
96
  readonly suspension?: Suspension | null;
97
- readonly hansard_head?: string | null;
97
+ readonly log_head?: string | null;
98
98
  readonly updated_by?: string;
99
99
  }
100
100
 
@@ -109,7 +109,7 @@ export const createState = (input: CreateStateInput): SessionStateFile => ({
109
109
  state: input.state,
110
110
  suspension: input.suspension ?? null,
111
111
  quorum: input.quorum,
112
- hansard_head: input.hansard_head ?? null,
112
+ log_head: input.log_head ?? null,
113
113
  updated_at: input.updated_at,
114
114
  updated_by: input.updated_by ?? 'RECORD',
115
115
  });