@cordfuse/politik 0.3.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/EXECUTION.md +766 -0
- package/LICENSE +21 -0
- package/POLITIK-ARCHITECTURE.md +676 -0
- package/PROTOCOLS.md +1106 -0
- package/README.md +193 -0
- package/RESEARCH.md +475 -0
- package/RUNTIME.md +1355 -0
- package/bin/politik.js +31 -0
- package/docs/adr/0001-chamber-transport.md +67 -0
- package/docs/adr/0002-charter-schema.md +142 -0
- package/docs/adr/0003-state-json-schema.md +134 -0
- package/docs/adr/0004-motion-enactment.md +215 -0
- package/docs/adr/0005-hansard-format.md +171 -0
- package/docs/adr/0006-protocol-behavioral-enforcement.md +89 -0
- package/docs/adr/0007-protocol-mechanics.md +100 -0
- package/docs/adr/0008-session-storage.md +108 -0
- package/docs/adr/0009-match-primitive.md +74 -0
- package/package.json +55 -0
- package/protocols/CONTRIBUTING.md +130 -0
- package/protocols/adversarial-collaboration.yml +28 -0
- package/protocols/corporate.yml +35 -0
- package/protocols/elimination-tournament.yml +41 -0
- package/protocols/emergency-response-ics.yml +27 -0
- package/protocols/jury-deliberation.yml +32 -0
- package/protocols/monarchy.yml +31 -0
- package/protocols/parliamentary.yml +66 -0
- package/protocols/peer-review.yml +44 -0
- package/protocols/republic.yml +36 -0
- package/protocols/socialism-collective.yml +31 -0
- package/protocols/solo.yml +32 -0
- package/src/actors.ts +742 -0
- package/src/agents.ts +318 -0
- package/src/canon.ts +173 -0
- package/src/capability.ts +336 -0
- package/src/charter.ts +545 -0
- package/src/cli.ts +2174 -0
- package/src/conflict.ts +211 -0
- package/src/containment.ts +155 -0
- package/src/crisis.ts +381 -0
- package/src/division.ts +609 -0
- package/src/doctor.ts +168 -0
- package/src/election.ts +233 -0
- package/src/envelope.ts +223 -0
- package/src/escalation.ts +320 -0
- package/src/fault.ts +241 -0
- package/src/federation.ts +299 -0
- package/src/git.ts +163 -0
- package/src/hansard.ts +201 -0
- package/src/heartbeat.ts +282 -0
- package/src/index.ts +43 -0
- package/src/init.ts +396 -0
- package/src/integrity.ts +153 -0
- package/src/ledger.ts +341 -0
- package/src/lockfs.ts +58 -0
- package/src/projection.ts +293 -0
- package/src/prorogation.ts +307 -0
- package/src/protocol-sdk.ts +248 -0
- package/src/protocol.ts +241 -0
- package/src/providers/github.ts +347 -0
- package/src/quorum.ts +137 -0
- package/src/runner.ts +534 -0
- package/src/scm.ts +142 -0
- package/src/spawn.ts +160 -0
- package/src/standings.ts +143 -0
- package/src/state.ts +179 -0
- package/src/templates/parliamentary.ts +359 -0
- package/src/tournament.ts +200 -0
- package/src/transport.ts +190 -0
- package/src/tree.ts +371 -0
package/bin/politik.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// politik — governed multi-agent sessions on git.
|
|
3
|
+
//
|
|
4
|
+
// The library is TypeScript and ships unbuilt: tsx is a runtime dependency, so
|
|
5
|
+
// this shim registers the loader and hands off to src/cli.ts. No build step,
|
|
6
|
+
// and the published package contains the same source that runs.
|
|
7
|
+
|
|
8
|
+
import { register } from 'tsx/esm/api';
|
|
9
|
+
|
|
10
|
+
// A reader that closes early — `politik status | head` — makes the next write
|
|
11
|
+
// fail with EPIPE. That is normal Unix behaviour for a pipeline, not an error
|
|
12
|
+
// worth a stack trace. Swallow it and keep running: calling process.exit() here
|
|
13
|
+
// would terminate synchronously and abort an in-flight commit mid-write, which
|
|
14
|
+
// is exactly how a governance act's record could be lost. Discarding the write
|
|
15
|
+
// lets the remaining work finish and the process exit naturally.
|
|
16
|
+
process.stdout.on('error', (error) => {
|
|
17
|
+
if (error?.code === 'EPIPE') return;
|
|
18
|
+
throw error;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const unregister = register();
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const { run } = await import('../src/cli.ts');
|
|
25
|
+
process.exitCode = await run(process.argv.slice(2));
|
|
26
|
+
} catch (error) {
|
|
27
|
+
process.stderr.write(`politik: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
28
|
+
process.exitCode = 1;
|
|
29
|
+
} finally {
|
|
30
|
+
unregister();
|
|
31
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# ADR-0001 — Chamber Transport: git-based default, NATS opt-in
|
|
2
|
+
|
|
3
|
+
**Attribution:** Steve Krisjanovs, Cordfuse
|
|
4
|
+
|
|
5
|
+
**Status:** Accepted
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
The Chamber floor is the transport that carries the broadcast envelope between
|
|
12
|
+
Constituencies. Three candidates were considered: a git-based transport, NATS,
|
|
13
|
+
and a pure P2P mesh (libp2p gossipsub).
|
|
14
|
+
|
|
15
|
+
An earlier revision of the plan named NATS as the default and treated git as an
|
|
16
|
+
ambient alternative. That ordering was inverted when the durability argument was
|
|
17
|
+
worked through, but two documents were not updated at the time and continued to
|
|
18
|
+
state the superseded ordering.
|
|
19
|
+
|
|
20
|
+
## Decision
|
|
21
|
+
|
|
22
|
+
**Transport is a pluggable hook, not a fixed dependency.**
|
|
23
|
+
|
|
24
|
+
1. **git-based transport is the default** — the zero-infrastructure reference
|
|
25
|
+
transport. It preserves the framework's core promise: git already built the
|
|
26
|
+
substrate, so no new infrastructure is required to convene a session.
|
|
27
|
+
2. **NATS is an opt-in latency upgrade.** Session GUID is the subject, the
|
|
28
|
+
envelope is the message payload. Queue groups deliver each message to exactly
|
|
29
|
+
one subscriber, which is a native primitive for the
|
|
30
|
+
First-Actor-Per-Constituency rule and removes the need for a hand-rolled
|
|
31
|
+
mutex. For multi-machine assemblies, Tailscale + NATS.
|
|
32
|
+
3. **Pure P2P mesh (libp2p gossipsub) is rejected** — over-built for known,
|
|
33
|
+
permissioned assemblies.
|
|
34
|
+
|
|
35
|
+
## Rationale
|
|
36
|
+
|
|
37
|
+
The durable substrate is *always* the session repo. The Hansard is the ordered,
|
|
38
|
+
attributable source of truth, and slot claims commit there atomically. Transport
|
|
39
|
+
carries only the ephemeral real-time nudge — "a motion is live". A dropped
|
|
40
|
+
message therefore loses nothing: peers fall back to reading the repo.
|
|
41
|
+
|
|
42
|
+
Because correctness never depends on the transport, the transport must not
|
|
43
|
+
impose an infrastructure requirement on the default path. NATS earns its place
|
|
44
|
+
only where latency matters, and it accelerates the nudge without ever becoming
|
|
45
|
+
the source of truth.
|
|
46
|
+
|
|
47
|
+
## Consequences
|
|
48
|
+
|
|
49
|
+
- A session convenes with no broker, no daemon, and no network service.
|
|
50
|
+
- The engine must implement the git transport first; NATS is a later, additive
|
|
51
|
+
provider behind the same hook.
|
|
52
|
+
- Crosstalk (`cordfuse/crosstalk`) is **one such git-based transport
|
|
53
|
+
implementation**, not a dependency of Politik. Politik does not require
|
|
54
|
+
Crosstalk to convene a session, and no Politik specification names a Crosstalk
|
|
55
|
+
version or API.
|
|
56
|
+
- Any transport provider must be able to lose a message without loss of
|
|
57
|
+
correctness. This is a conformance requirement, not a quality goal.
|
|
58
|
+
|
|
59
|
+
## Supersedes
|
|
60
|
+
|
|
61
|
+
- `EXECUTION.md` Phase 1, transport hook line — previously "NATS default …
|
|
62
|
+
git/Crosstalk ambient alternative".
|
|
63
|
+
- `RUNTIME.md` Chamber floor table row — previously "NATS default, or
|
|
64
|
+
git-ambient".
|
|
65
|
+
|
|
66
|
+
Both have been corrected to match this ADR and
|
|
67
|
+
`POLITIK-ARCHITECTURE.md` § Chamber Transport, which was already correct.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# ADR-0002 — CHARTER.md Schema
|
|
2
|
+
|
|
3
|
+
**Attribution:** Steve Krisjanovs, Cordfuse
|
|
4
|
+
|
|
5
|
+
**Status:** Accepted
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
`CHARTER.md` is the sovereign law of a session: the Speaker writes it, agents
|
|
12
|
+
read it, and the engine validates it at Writ Drop before the session opens.
|
|
13
|
+
Phase 2 of the execution plan requires a Charter parser and validator.
|
|
14
|
+
|
|
15
|
+
No document specifies the Charter as a single schema. Its fields are instead
|
|
16
|
+
scattered across `POLITIK-ARCHITECTURE.md` and `RUNTIME.md` as illustrative YAML
|
|
17
|
+
fragments. A parser cannot be written against scattered fragments. This ADR
|
|
18
|
+
consolidates them into one schema without inventing new governance semantics.
|
|
19
|
+
|
|
20
|
+
Machine-readable *protocol* configuration already has a home in
|
|
21
|
+
`.politik/protocol.yml` (the Protocol Schema Format). The Charter is distinct: it
|
|
22
|
+
is the per-session instrument, and it inherits from its parent node in the
|
|
23
|
+
Politik Tree.
|
|
24
|
+
|
|
25
|
+
## Decision
|
|
26
|
+
|
|
27
|
+
`CHARTER.md` is **markdown with a single YAML frontmatter block**. The
|
|
28
|
+
frontmatter carries all machine-read configuration; the markdown body carries
|
|
29
|
+
the human-readable Standing Orders prose, which the engine does not parse.
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
---
|
|
33
|
+
charter_version: 1.0.0
|
|
34
|
+
protocol: parliamentary # resolves against .politik/protocol.yml
|
|
35
|
+
inherits_from: cordfuse/politik-sprint-2026-04 # parent node, or null at root
|
|
36
|
+
|
|
37
|
+
session:
|
|
38
|
+
quorum: 2 # minimum actors for a valid Division
|
|
39
|
+
escalation: enabled # enabled | disabled (disabled => no_escalation)
|
|
40
|
+
heartbeat_timeout_hours: 4 # no Hansard commit within window => STALE
|
|
41
|
+
deadline: null # ISO-8601 wall-clock ceiling, or null
|
|
42
|
+
merge_strategy: merge_commit # merge_commit (default) | squash | fast_forward
|
|
43
|
+
assent: AUTHORITY # CANON role holding ASSENT; default AUTHORITY
|
|
44
|
+
|
|
45
|
+
endurance:
|
|
46
|
+
max_motions: null
|
|
47
|
+
max_cost_usd: null
|
|
48
|
+
|
|
49
|
+
ledger:
|
|
50
|
+
enabled: true
|
|
51
|
+
visibility: public # public (default) | private
|
|
52
|
+
path: LEDGER.md # .politik/LEDGER.md when visibility: private
|
|
53
|
+
|
|
54
|
+
minimum_cast: # enforced at Writ Drop; hard fail
|
|
55
|
+
AUTHORITY: 1
|
|
56
|
+
OPERATOR: 1
|
|
57
|
+
|
|
58
|
+
domain_veto: [] # CANON roles holding DOMAIN_VETO
|
|
59
|
+
|
|
60
|
+
constituencies:
|
|
61
|
+
- role: OPERATOR
|
|
62
|
+
slots: 3
|
|
63
|
+
auto_demotion: false
|
|
64
|
+
hard_skills:
|
|
65
|
+
required: [BC_AL_development]
|
|
66
|
+
excluded: [raw_SQL]
|
|
67
|
+
model:
|
|
68
|
+
required: claude-sonnet-5
|
|
69
|
+
preferred: claude-opus-4-8
|
|
70
|
+
knowledge_cutoff_minimum: 2025-01
|
|
71
|
+
mandate_alignment: null
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
# Standing Orders
|
|
75
|
+
|
|
76
|
+
Human-readable prose. Not parsed by the engine.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Provenance of every field
|
|
80
|
+
|
|
81
|
+
| Field | Source |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `protocol` | `.politik/protocol.yml` (ARCHITECTURE § Protocol Schema Format) |
|
|
84
|
+
| `inherits_from` | EXECUTION § The Politik Tree |
|
|
85
|
+
| `session.quorum` | RUNTIME § Single-Player Sessions |
|
|
86
|
+
| `session.escalation` | RUNTIME § Single-Player Sessions |
|
|
87
|
+
| `session.heartbeat_timeout_hours` | RUNTIME § stale detection |
|
|
88
|
+
| `session.deadline` | RUNTIME § endurance |
|
|
89
|
+
| `session.endurance` | ARCHITECTURE § session.endurance |
|
|
90
|
+
| `ledger.*` | RUNTIME § LEDGER config |
|
|
91
|
+
| `minimum_cast` | RUNTIME § Minimum Cast |
|
|
92
|
+
| `domain_veto` | ARCHITECTURE § Protocol Schema Format |
|
|
93
|
+
| `constituencies[].hard_skills` | ARCHITECTURE § actor capability profile |
|
|
94
|
+
| `constituencies[].model` | ARCHITECTURE § model / knowledge grade |
|
|
95
|
+
| `constituencies[].auto_demotion` | RUNTIME § auto_demotion |
|
|
96
|
+
| `constituencies[].mandate_alignment` | ARCHITECTURE § actor.mandate_alignment |
|
|
97
|
+
|
|
98
|
+
Only the *grouping* is new. `constituencies` as a named top-level list is the one
|
|
99
|
+
structural proposal in this ADR: the source documents show a single
|
|
100
|
+
`constituency:` block in isolation, never a collection, but a session with more
|
|
101
|
+
than one role plainly needs a list.
|
|
102
|
+
|
|
103
|
+
## Validation rules (Writ Drop)
|
|
104
|
+
|
|
105
|
+
1. Parse frontmatter. Malformed YAML => `SESSION_INVALID`, session never opens.
|
|
106
|
+
2. Resolve `protocol` against `.politik/protocol.yml`.
|
|
107
|
+
3. Check assigned constituencies against `minimum_cast`. Shortfall =>
|
|
108
|
+
`SESSION_INVALID` committed to Hansard, naming the missing roles.
|
|
109
|
+
4. `minimum_cast.AUTHORITY` may never be overridden to `0` — a session with no
|
|
110
|
+
Speaker cannot proceed under any configuration.
|
|
111
|
+
5. `merge_strategy: squash` is **rejected** when `protocol.record_mode` is
|
|
112
|
+
`distributed` — squash destroys per-commit attribution, which that record mode
|
|
113
|
+
guarantees. Permitted otherwise (ADR-0004, Ruling 1).
|
|
114
|
+
6. `merge_strategy: fast_forward` is **rejected** unless `session.quorum` is `1` —
|
|
115
|
+
a fast-forward leaves no merge node, so the Hansard would carry no evidence a
|
|
116
|
+
Division occurred. At `quorum: 1` there is no Division to record (ADR-0004,
|
|
117
|
+
Ruling 2).
|
|
118
|
+
7. `session.assent` must name a CANON role. Defaults to `AUTHORITY` (ADR-0004,
|
|
119
|
+
Ruling 3).
|
|
120
|
+
8. On pass: `STATE.json.state = CONVENED`.
|
|
121
|
+
|
|
122
|
+
## Ruling — `mode` / `record_mode` key collision (resolved)
|
|
123
|
+
|
|
124
|
+
`POLITIK-ARCHITECTURE.md` defines `mode` and `record_mode` under a `protocol:`
|
|
125
|
+
block with fixed enums. `RUNTIME.md` § Single-Player Sessions reused the **same
|
|
126
|
+
key names** under a `session:` block with values (`solo`, `full`) present in
|
|
127
|
+
neither enum.
|
|
128
|
+
|
|
129
|
+
Git history settles the intent. The `protocol.mode` enum shipped in the original
|
|
130
|
+
`v0.1.0-architecture` invention disclosure. `session: mode: solo` first appeared
|
|
131
|
+
in the single commit that introduced RUNTIME.md — an illustrative YAML sketch,
|
|
132
|
+
not a designed second namespace.
|
|
133
|
+
|
|
134
|
+
**Ruling: `mode` and `record_mode` are protocol-level keys only.** They are
|
|
135
|
+
removed from the `session:` block. Nothing is lost:
|
|
136
|
+
|
|
137
|
+
- `mode: solo` is fully expressed by `session.quorum: 1`.
|
|
138
|
+
- `record_mode: full` states the default — the Hansard is required in every
|
|
139
|
+
non-Ephemeral protocol, so there is nothing to opt into.
|
|
140
|
+
|
|
141
|
+
`POLITIK-ARCHITECTURE.md` is unchanged; the correction was made in `RUNTIME.md`,
|
|
142
|
+
which held the erroneous keys.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# ADR-0003 — STATE.json Schema
|
|
2
|
+
|
|
3
|
+
**Attribution:** Steve Krisjanovs, Cordfuse
|
|
4
|
+
|
|
5
|
+
**Status:** Accepted
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
`STATE.json` is the current session state. The RECORD agent owns it
|
|
12
|
+
exclusively, and every actor reads it before every action — a suspended session
|
|
13
|
+
must stop agents immediately. Phase 2 requires the session repo initializer and
|
|
14
|
+
the Hansard commit writer, both of which read and write this file.
|
|
15
|
+
|
|
16
|
+
No schema existed. The documents mutated it through three overlapping
|
|
17
|
+
vocabularies:
|
|
18
|
+
|
|
19
|
+
| Source | Vocabulary used |
|
|
20
|
+
|---|---|
|
|
21
|
+
| CANON (ARCHITECTURE) | `CONVENED`, `SUSPENDED`, `PROROGUED`, `STALE`, `INVALID` |
|
|
22
|
+
| RUNTIME | `paused: true/false`, `suspended: true`, `active` |
|
|
23
|
+
| EXECUTION § Obsidian | `convened`, `suspended`, `prorogued`, `constitutional crisis` |
|
|
24
|
+
|
|
25
|
+
These cannot all be the schema. `active` and `CONVENED` are the same condition
|
|
26
|
+
under two names. `paused` (Point of Order filed) and `suspended` (heartbeat
|
|
27
|
+
stale) are two *causes*, not two states.
|
|
28
|
+
|
|
29
|
+
## Decision
|
|
30
|
+
|
|
31
|
+
**One `state` field, CANON-valued. Cause is carried separately.**
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"schema_version": "1.0.0",
|
|
36
|
+
"session_guid": "0f9c1b3e-...",
|
|
37
|
+
"protocol": "parliamentary",
|
|
38
|
+
"state": "CONVENED",
|
|
39
|
+
"suspension": null,
|
|
40
|
+
"quorum": { "required": 2, "present": 2 },
|
|
41
|
+
"hansard_head": "4863a96...",
|
|
42
|
+
"updated_at": "2026-04-08T14:02:11Z",
|
|
43
|
+
"updated_by": "RECORD"
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`state` is exactly the CANON enum: `CONVENED | SUSPENDED | PROROGUED | STALE |
|
|
48
|
+
INVALID`. Nothing else is a state.
|
|
49
|
+
|
|
50
|
+
When `state` is `SUSPENDED`, `suspension` is populated:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
"suspension": {
|
|
54
|
+
"cause": "CONSTITUTIONAL_CRISIS",
|
|
55
|
+
"since": "2026-04-08T14:02:11Z",
|
|
56
|
+
"record_ref": "HANSARD.md#L482",
|
|
57
|
+
"escalation_ref": "escalations/2026-04-08-001.md"
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`cause` is one of:
|
|
62
|
+
|
|
63
|
+
| cause | Filed by | Resolved by |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `POINT_OF_ORDER` | any actor | Speaker ruling (`escalations/ruling-NNN.md`) |
|
|
66
|
+
| `SPEAKER_ORDER` | AUTHORITY | AUTHORITY |
|
|
67
|
+
| `DISPUTED_EXIT` | any actor | Speaker ruling — `UPHELD` / `REVERSED` |
|
|
68
|
+
| `CONSTITUTIONAL_CRISIS` | OBSERVER with `can_file`, or OPERATOR supermajority | human AUTHORITY above the node |
|
|
69
|
+
| `DEADLOCK` | the engine, when a Division yields no valid outcome | AUTHORITY ruling; falls through to `CONSTITUTIONAL_CRISIS` if AUTHORITY is absent or is the subject (ADR-0004) |
|
|
70
|
+
|
|
71
|
+
### Mapping the legacy vocabularies
|
|
72
|
+
|
|
73
|
+
| Document says | Schema representation |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `STATE.json → active` | `state: "CONVENED"` |
|
|
76
|
+
| `paused: true` | `state: "SUSPENDED"`, `suspension.cause: "POINT_OF_ORDER"` |
|
|
77
|
+
| `paused: false` | `state: "CONVENED"`, `suspension: null` |
|
|
78
|
+
| `suspended: true` (stale) | `state: "STALE"` |
|
|
79
|
+
| `SESSION_INVALID` | `state: "INVALID"` (terminal; session never opened) |
|
|
80
|
+
| prorogation | `state: "PROROGUED"` (terminal) |
|
|
81
|
+
|
|
82
|
+
`STALE` is its own CANON state, so heartbeat expiry does **not** use
|
|
83
|
+
`suspension`. This keeps "a human paused it" and "the agents went quiet"
|
|
84
|
+
distinguishable without a boolean soup.
|
|
85
|
+
|
|
86
|
+
## Ruling — is `CONSTITUTIONAL_CRISIS` a state or a fault? (resolved)
|
|
87
|
+
|
|
88
|
+
Neither. **It is a cause of suspension.**
|
|
89
|
+
|
|
90
|
+
`RUNTIME.md` § Constitutional Capture already defines its effect: when a
|
|
91
|
+
supermajority of OPERATOR actors file escalations against AUTHORITY, "the
|
|
92
|
+
session auto-suspends and notifies." A designated OBSERVER with `can_file:
|
|
93
|
+
CONSTITUTIONAL_CRISIS` produces the same effect.
|
|
94
|
+
|
|
95
|
+
So the behaviour is already specified, and it is *suspension*. Structurally it is
|
|
96
|
+
a Point of Order — something is filed, the session halts, a human resolves it.
|
|
97
|
+
The only difference is who stands accused.
|
|
98
|
+
|
|
99
|
+
**Ruling: add `CONSTITUTIONAL_CRISIS` to the `suspension.cause` enum. Do not add
|
|
100
|
+
a sixth CANON state, and do not model it as a free-standing fault attribute.**
|
|
101
|
+
|
|
102
|
+
Rationale:
|
|
103
|
+
|
|
104
|
+
- Agents already halt on `SUSPENDED`. No agent logic changes.
|
|
105
|
+
- CANON stays at five states, so `POLITIK-ARCHITECTURE.md` is untouched.
|
|
106
|
+
- The Obsidian layer still colours red — it reads `suspension.cause`, not a new
|
|
107
|
+
state.
|
|
108
|
+
|
|
109
|
+
An earlier draft of this ADR modelled the crisis as a `fault` object on a
|
|
110
|
+
still-`CONVENED` session. That was wrong: a session in constitutional crisis is
|
|
111
|
+
halted, not running-with-a-warning. The `fault` field is removed from the
|
|
112
|
+
schema.
|
|
113
|
+
|
|
114
|
+
**Accepted trade-off:** a crisis and a routine Point of Order both read as
|
|
115
|
+
`SUSPENDED` at a glance; a reader must check `cause` to tell an emergency from
|
|
116
|
+
paperwork. This is correct — the governance response to both is identical (halt,
|
|
117
|
+
escalate to a human). It is the cause that differs, not the state, and the schema
|
|
118
|
+
says so.
|
|
119
|
+
|
|
120
|
+
`SESSION_FAULT` and `SESSION_FAULT_CRITICAL` remain Hansard record types. They do
|
|
121
|
+
not appear in `STATE.json`; their effect on state, if any, is expressed through
|
|
122
|
+
`state` and `suspension` like everything else.
|
|
123
|
+
|
|
124
|
+
## Consequences
|
|
125
|
+
|
|
126
|
+
- Agents check one field (`state`) before acting. `SUSPENDED`, `STALE`,
|
|
127
|
+
`PROROGUED`, and `INVALID` all mean stop.
|
|
128
|
+
- `hansard_head` pins the last Hansard commit the state reflects, so a resumed
|
|
129
|
+
agent can detect a state file that lags the record.
|
|
130
|
+
- The RECORD agent is the sole writer. Any other actor writing `STATE.json` is a
|
|
131
|
+
Standing Orders violation.
|
|
132
|
+
- `schema_version` is present from the first commit so the file can migrate.
|
|
133
|
+
- The Obsidian sync script colours by `state`, and red on
|
|
134
|
+
`suspension.cause == "CONSTITUTIONAL_CRISIS"`.
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# ADR-0004 — Motion Enactment: ASSENT, Merge Strategy, and CONFLICT vs DEADLOCK
|
|
2
|
+
|
|
3
|
+
**Attribution:** Steve Krisjanovs, Cordfuse
|
|
4
|
+
|
|
5
|
+
**Status:** Accepted — ruled by Steve Krisjanovs. CANON amended.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
A `MOTION` is a Pull Request. A `DIVISION` is the vote on it. PROTOCOLS.md:1055
|
|
12
|
+
maps "Motion Carried" to "PR Merged".
|
|
13
|
+
|
|
14
|
+
**But nothing in Politik can merge a Motion.** There is no CANON verb for
|
|
15
|
+
enactment, and `scm` exposes no merge method. A Motion can be tabled, debated,
|
|
16
|
+
and carried — and then the proceeding has no way to give effect to its own
|
|
17
|
+
decision. The framework can decide but cannot act.
|
|
18
|
+
|
|
19
|
+
Three further gaps compound this, all discovered together:
|
|
20
|
+
|
|
21
|
+
1. **No merge strategy vocabulary.** `squash`, `fast-forward`, `merge commit`,
|
|
22
|
+
and `force-push` appear **zero times** across every specification document.
|
|
23
|
+
`rebase` appears only as a catastrophe (RUNTIME.md § "Agent executed rebase on
|
|
24
|
+
protected branch" — unrecoverable session damage).
|
|
25
|
+
2. **`DEADLOCK` is overloaded.** CANON defines it as "irreconcilable state — no
|
|
26
|
+
valid Division outcome" (POLITIK-ARCHITECTURE.md:147). The Software
|
|
27
|
+
Development protocol maps it to "Merge Conflict" (PROTOCOLS.md:122). These are
|
|
28
|
+
not the same thing.
|
|
29
|
+
3. **`DEADLOCK` has no exit.** It is named as a state and never handled. No
|
|
30
|
+
document specifies how a proceeding leaves it.
|
|
31
|
+
|
|
32
|
+
## The load-bearing observation
|
|
33
|
+
|
|
34
|
+
**Merge strategy is not an implementation detail in Politik. It is a Charter-level
|
|
35
|
+
constraint, because each strategy makes a different promise about the Hansard.**
|
|
36
|
+
|
|
37
|
+
The Hansard is append-only, immutable, and attributed. That is the framework's
|
|
38
|
+
central claim. Merge strategy directly determines whether that claim survives
|
|
39
|
+
contact with git:
|
|
40
|
+
|
|
41
|
+
| Strategy | Effect on the Hansard |
|
|
42
|
+
|---|---|
|
|
43
|
+
| **Merge commit** | Preserves every actor's individual commits **and** records a merge node proving a Division occurred. Attribution chain intact. |
|
|
44
|
+
| **Squash** | Collapses an actor's commits into one. **Destroys per-commit attribution inside the Motion.** |
|
|
45
|
+
| **Fast-forward** | Leaves no merge node. **The Hansard contains no evidence a Division ever happened.** The Motion silently becomes trunk. |
|
|
46
|
+
|
|
47
|
+
A framework whose thesis is the attributed forensic record cannot treat squash
|
|
48
|
+
and fast-forward as neutral options. Both erase evidence the Hansard exists to
|
|
49
|
+
guarantee.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Proposal 1 — New CANON verb: `ASSENT`
|
|
54
|
+
|
|
55
|
+
Add to the CANON verb table:
|
|
56
|
+
|
|
57
|
+
| Canonical | Description |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `ASSENT` | Enact a carried Motion — merge the PR. Distinct from `VOTE`. |
|
|
60
|
+
|
|
61
|
+
`DIVISION` decides. `ASSENT` enacts. Whoever holds `ASSENT` under the Charter is
|
|
62
|
+
the actor who may push the button — which is precisely the governance question a
|
|
63
|
+
merge represents.
|
|
64
|
+
|
|
65
|
+
**Vocabulary note (corrected).** An earlier draft of this ADR claimed
|
|
66
|
+
PROTOCOLS.md:97 mis-mapped `DIVISION` → "Royal Assent" in the Parliamentary
|
|
67
|
+
protocol. That was wrong on two counts, and the claim is withdrawn:
|
|
68
|
+
|
|
69
|
+
- Line 97 belongs to the **Monarchy** protocol, not Parliamentary.
|
|
70
|
+
- Parliamentary already maps `DIVISION` → "Division", which is correct.
|
|
71
|
+
- Monarchy is Authoritarian-mode: there is no vote, and the Crown's assent *is*
|
|
72
|
+
the decision. `DIVISION` → "Royal Assent" is therefore defensible as written.
|
|
73
|
+
|
|
74
|
+
What the protocols actually need is an `ASSENT` **term**, which no protocol has
|
|
75
|
+
because no such primitive existed:
|
|
76
|
+
|
|
77
|
+
- Parliamentary: `ASSENT` → "Royal Assent" (in Westminster practice, Royal Assent
|
|
78
|
+
is precisely the enactment following the Division — the term fits `ASSENT`, not
|
|
79
|
+
`DIVISION`).
|
|
80
|
+
- Software Development: `ASSENT` → "Merge".
|
|
81
|
+
|
|
82
|
+
This produces a term collision: "Royal Assent" would name `DIVISION` under
|
|
83
|
+
Monarchy and `ASSENT` under Parliamentary. Protocols are independent translation
|
|
84
|
+
manifests, so this is legal — a term may mean different things in different
|
|
85
|
+
protocols. It is nonetheless confusing, and **Ruling 4 below asks whether to
|
|
86
|
+
accept it.**
|
|
87
|
+
|
|
88
|
+
**Preconditions.** `ASSENT` is invalid unless the Motion carried a Division, the
|
|
89
|
+
session is `CONVENED`, and no `VETO` is outstanding. An `ASSENT` on an uncarried
|
|
90
|
+
Motion is a Standing Orders violation.
|
|
91
|
+
|
|
92
|
+
## Proposal 2 — Charter key: `merge_strategy`
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
session:
|
|
96
|
+
merge_strategy: merge_commit # merge_commit | squash | fast_forward
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Default: `merge_commit`.** It is the only strategy that preserves both
|
|
100
|
+
attribution and proof of Division.
|
|
101
|
+
|
|
102
|
+
The ruling below decides whether the other two are *banned* or merely *off by
|
|
103
|
+
default*.
|
|
104
|
+
|
|
105
|
+
## Proposal 3 — New CANON primitive: `CONFLICT`
|
|
106
|
+
|
|
107
|
+
| Canonical | Description |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `CONFLICT` | Two Motions touch the same lines. Mechanical, routine, resolvable by an actor. |
|
|
110
|
+
|
|
111
|
+
`CONFLICT` is not `DEADLOCK`. A merge conflict is an ordinary event in
|
|
112
|
+
concurrent work; a `DEADLOCK` is a governance failure in which the vote itself
|
|
113
|
+
cannot produce an answer. Conflating them means routine textual overlap gets
|
|
114
|
+
classified as a constitutional-grade impasse.
|
|
115
|
+
|
|
116
|
+
Resolution: `CONFLICT` is resolved by any actor holding `WRITE` on the Motion,
|
|
117
|
+
recorded in the Hansard. It never escalates on its own. It escalates only if
|
|
118
|
+
resolution is itself disputed — at which point it becomes an `ESCALATION`, by the
|
|
119
|
+
existing mechanism.
|
|
120
|
+
|
|
121
|
+
PROTOCOLS.md:122 changes from `DEADLOCK | Merge Conflict` to
|
|
122
|
+
`CONFLICT | Merge Conflict`, and the Software Development protocol gains a
|
|
123
|
+
distinct `DEADLOCK` mapping (proposed: "Irreconcilable Review — Tech Lead
|
|
124
|
+
rules").
|
|
125
|
+
|
|
126
|
+
## Proposal 4 — `DEADLOCK` gains an exit
|
|
127
|
+
|
|
128
|
+
`DEADLOCK` is currently terminal by omission. Proposed resolution ladder,
|
|
129
|
+
reusing mechanisms that already exist:
|
|
130
|
+
|
|
131
|
+
1. `DEADLOCK` declared → session auto-suspends
|
|
132
|
+
(`state: SUSPENDED`, `suspension.cause: DEADLOCK` — extends ADR-0003's enum).
|
|
133
|
+
2. AUTHORITY rules, exactly as for a Point of Order.
|
|
134
|
+
3. If AUTHORITY is absent or is itself the subject, the existing
|
|
135
|
+
`CONSTITUTIONAL_CRISIS` path applies.
|
|
136
|
+
|
|
137
|
+
No new machinery. `DEADLOCK` becomes a fourth suspension cause, and the Speaker
|
|
138
|
+
resolves it like any other halt.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Rulings — all four settled
|
|
143
|
+
|
|
144
|
+
All four rulings below were **accepted as recommended**. CANON is amended:
|
|
145
|
+
`ASSENT` added to the verb table, `CONFLICT` added to the primitive table,
|
|
146
|
+
`scm.merge(pr, strategy)` added to the SCM provider interface. `merge_strategy`
|
|
147
|
+
and `assent` are Charter keys (ADR-0002). `DEADLOCK` is a suspension cause
|
|
148
|
+
(ADR-0003).
|
|
149
|
+
|
|
150
|
+
The original text of each ruling is preserved below for the record.
|
|
151
|
+
|
|
152
|
+
**Ruling 1 — Is `squash` banned, or merely off by default?**
|
|
153
|
+
|
|
154
|
+
- *Banned:* the Charter validator rejects `merge_strategy: squash` outright.
|
|
155
|
+
Consistent with the Hansard's immutability claim; a squashed Motion cannot
|
|
156
|
+
produce a per-actor forensic record. Costs flexibility for protocols that
|
|
157
|
+
genuinely do not care (Hackathon, Battle Royale).
|
|
158
|
+
- *Off by default:* permitted where a protocol declares it, with the attribution
|
|
159
|
+
loss recorded at Writ Drop. Preserves protocol-agnosticism, which is a stated
|
|
160
|
+
design principle ("Parliamentary is protocol #1, not a privileged mode").
|
|
161
|
+
|
|
162
|
+
*My recommendation:* **off by default, and prohibited whenever
|
|
163
|
+
`protocol.record_mode` is `distributed`.** This ties the ban to the record
|
|
164
|
+
guarantee rather than to a blanket rule, and it lets Ephemeral protocols —
|
|
165
|
+
which already discard the record — squash freely. It keeps the framework
|
|
166
|
+
protocol-agnostic while making the constitutional case where the record
|
|
167
|
+
actually matters.
|
|
168
|
+
|
|
169
|
+
**Ruling 2 — Is `fast_forward` ever legitimate?**
|
|
170
|
+
|
|
171
|
+
A fast-forward leaves no proof a Division occurred. *My recommendation:* permit
|
|
172
|
+
it only when `session.quorum: 1`, where there was no Division to record. Reject
|
|
173
|
+
it otherwise.
|
|
174
|
+
|
|
175
|
+
**Ruling 3 — Does `ASSENT` default to AUTHORITY only?**
|
|
176
|
+
|
|
177
|
+
*My recommendation:* yes, with the Charter free to grant it to `DELEGATE` or
|
|
178
|
+
`OPERATOR`. Defaulting the merge button to the Speaker matches every
|
|
179
|
+
Constitutional-mode protocol; Darwinist and Authoritarian protocols will want to
|
|
180
|
+
move it.
|
|
181
|
+
|
|
182
|
+
**Ruling 4 — Is the "Royal Assent" term collision acceptable?**
|
|
183
|
+
|
|
184
|
+
Under Monarchy, "Royal Assent" names `DIVISION`. Under Parliamentary it would
|
|
185
|
+
name `ASSENT`. Both are correct within their own protocol.
|
|
186
|
+
|
|
187
|
+
*My recommendation:* **accept the collision.** Protocols are independent
|
|
188
|
+
vocabulary manifests over CANON — that independence is the whole design. Forcing
|
|
189
|
+
globally-unique industry terms across 35+ protocols would distort the vocabulary
|
|
190
|
+
to serve the engine, which inverts the framework's stated direction of
|
|
191
|
+
translation (CANON → industry vocabulary, never the reverse). The engine never
|
|
192
|
+
reads these terms; only humans do, and always inside one protocol at a time.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Consequences
|
|
197
|
+
|
|
198
|
+
- **CANON changes.** One new verb (`ASSENT`), one new primitive (`CONFLICT`).
|
|
199
|
+
`POLITIK-ARCHITECTURE.md` — the invention disclosure — must be amended. Per
|
|
200
|
+
repo Rule 1 that required explicit human instruction, which was given: the
|
|
201
|
+
amendment landed and this ADR moved to Accepted. (This paragraph previously
|
|
202
|
+
still read "which is why this ADR is Proposed and not Accepted",
|
|
203
|
+
contradicting the status header.)
|
|
204
|
+
- **SCM interface grows.** `scm.merge(pr, strategy)` is required. The interface
|
|
205
|
+
also still lacks `createBranch`, `removeCollaborator`, `updatePermission`, and
|
|
206
|
+
tag/release methods — all needed by verbs CANON already defines (`FIRE`,
|
|
207
|
+
`EXPEL`, `DEMOTE`, `DISSOLVE`). Those are signature work, not governance, and
|
|
208
|
+
are tracked separately.
|
|
209
|
+
- **ADR-0003 extended.** `suspension.cause` gains `DEADLOCK`.
|
|
210
|
+
- **PROTOCOLS.md changes.** Line 122 (`DEADLOCK` → Merge Conflict) is wrong as
|
|
211
|
+
written and becomes `CONFLICT` → Merge Conflict. Protocols additionally gain an
|
|
212
|
+
`ASSENT` term. Line 97 (Monarchy `DIVISION` → Royal Assent) is **correct** and
|
|
213
|
+
is left alone.
|
|
214
|
+
- **No reverting.** A carried and assented Motion later found wrong still has no
|
|
215
|
+
path back. `REVERT` is deliberately out of scope here; it deserves its own ADR.
|