@cordfuse/politik 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -107,9 +107,9 @@ Every command is a git commit; `git log` in the session directory is the history
107
107
  politik scaffold --dir ./s --quorum 2 # write a Charter to edit
108
108
  politik init --dir ./s --charter ./s/CHARTER.md --owner you
109
109
  politik vote open --dir ./s --motion adopt-standard --actor you --role AUTHORITY
110
- politik vote cast --dir ./s --motion adopt-standard --actor ada --role MEMBER --vote YES
111
- politik vote cast --dir ./s --motion adopt-standard --actor bo --role MEMBER --vote YES
112
- politik vote tally --dir ./s --motion adopt-standard # → Motion CARRIED
110
+ politik vote cast --dir ./s --motion adopt-standard --actor member-1 --role MEMBER --vote YES
111
+ politik vote cast --dir ./s --motion adopt-standard --actor member-2 --role MEMBER --vote YES
112
+ politik vote tally --dir ./s --motion adopt-standard # → Motion CARRIED
113
113
  politik enact --dir ./s --motion adopt-standard --actor you --role AUTHORITY
114
114
  politik log --dir ./s # every act so far
115
115
  politik close --dir ./s --actor you --role AUTHORITY
@@ -123,10 +123,15 @@ be switched off later.
123
123
  Seat a real agent to do the work:
124
124
 
125
125
  ```sh
126
- politik run --dir ./s --agent claude-code --actor ada --role OPERATOR \
126
+ politik run --dir ./s --agent claude-code --actor op-1 --role OPERATOR \
127
127
  --task "Draft and commit a motion to adopt trunk-based development."
128
128
  ```
129
129
 
130
+ The agent is told its role, its verbs and its handle (`op-1`), so the votes it
131
+ casts from inside its turn are recorded under that handle. Use neutral handles for
132
+ agents: a human-sounding name can change how a model behaves, and that would show
133
+ up in the results as if the protocol caused it.
134
+
130
135
  The turn is captured, its cost measured and the result recorded (`politik ledger`).
131
136
  An agent acts through the CLI during its turn — casting a vote, vetoing, raising an
132
137
  escalation — and is told exactly which verbs its role holds. Editing `LOG.md` or
package/RUNTIME.md CHANGED
@@ -107,7 +107,7 @@ The following EXIT classifications must be declared in the log at the point of a
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 vote 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 (Elimination Tournament) |
110
+ | Eliminated | `EXIT_ELIMINATED` | Knocked out by the cull after a vote (`elimination-rounds`) |
111
111
  | owner | `EXIT_OWNER` | AUTHORITY ruled removal — owner ruling committed to log |
112
112
  | Disputed | `EXIT_DISPUTED` | Actor filed an escalation challenging their own removal |
113
113
 
@@ -76,6 +76,7 @@ plus mandate.
76
76
 
77
77
  ### Agent turns
78
78
 
79
+ - An agent is told its handle (v0.6.1), so it can pass the right `--actor` when it acts.
79
80
  - An agent is told its role's verbs (`ROLE_VERBS`), plus VETO where the Charter
80
81
  gives its role a domain veto, minus ESCALATE where appeals are off.
81
82
  - A turn that touched only the record is `AGENT_TURN`, not `MOTION_TABLED`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cordfuse/politik",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Politik — a governed multi-agent framework built on git. The SCM repository is the session: charter, record, state, and invite in one.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/actors.ts CHANGED
@@ -34,7 +34,7 @@ export const EXIT_TYPES = [
34
34
  'EXIT_VOLUNTARY_CONCESSION',
35
35
  'EXIT_VOLUNTARY_STRATEGIC',
36
36
  'EXIT_VOLUNTARY_COERCED',
37
- 'EXIT_DARWINIST',
37
+ 'EXIT_ELIMINATED',
38
38
  'EXIT_OWNER',
39
39
  'EXIT_DISPUTED',
40
40
  ] as const;
@@ -357,12 +357,12 @@ export const exitActor = (input: ExitInput, log: string): {
357
357
  /**
358
358
  * An elimination exit, declared by the engine rather than an actor (ADR-0007,
359
359
  * exit: elimination). A Battle Royale culls the losing side of a vote; the
360
- * cull is EXIT_DARWINIST and final, so it does not pass through the guarded
360
+ * cull is EXIT_ELIMINATED and final, so it does not pass through the guarded
361
361
  * exit() path — no actor is declaring it and there is nothing to appeal.
362
362
  * AUTHORITY is never culled: the owner holds no seat in the register, so a
363
363
  * caller can never reach this with one.
364
364
  */
365
- export const darwinistExit = (subject: string, seat: Role, at: string): RecordEntry => ({
365
+ export const eliminationExit = (subject: string, seat: Role, at: string): RecordEntry => ({
366
366
  type: 'ACTOR_EXITED',
367
367
  at,
368
368
  actor: subject,
@@ -370,7 +370,7 @@ export const darwinistExit = (subject: string, seat: Role, at: string): RecordEn
370
370
  fields: {
371
371
  'Actor affected': subject,
372
372
  'Seat held': seat,
373
- 'Exit type': 'EXIT_DARWINIST',
373
+ 'Exit type': 'EXIT_ELIMINATED',
374
374
  Declared: 'by the protocol — elimination',
375
375
  Reason: 'eliminated: backed the losing side of a vote under an elimination protocol',
376
376
  Appealable: 'no — elimination is final',
package/src/agents.ts CHANGED
@@ -157,7 +157,7 @@ export const AGENTS: readonly AgentSpec[] = Object.freeze([
157
157
  // agy's default mode sandboxes the commands it runs: paths outside the
158
158
  // workspace are invisible and .git is read-only. An agent that votes
159
159
  // through `politik` from inside its turn then cannot load the CLI or
160
- // commit the act (Scrum UAT, PR #38). `--settings` applies to this run
160
+ // commit the act (UAT, PR #38). `--settings` applies to this run
161
161
  // only and is never saved; the grant is the session's own .git (write)
162
162
  // and the CLI's install (read). The sandbox otherwise stays on.
163
163
  session_args: (ctx) => [
@@ -270,7 +270,9 @@ export const canRunHeadless = (agent: AgentSpec): boolean =>
270
270
 
271
271
  export interface PromptContext {
272
272
  readonly envelope: Envelope;
273
- /** The constituency this agent is seated in. */
273
+ /** The handle this agent acts as (`--actor`), as recorded in the log. */
274
+ readonly actor: string;
275
+ /** The role this agent is seated in. */
274
276
  readonly role: Role;
275
277
  /** Verbs the Charter grants this role. */
276
278
  readonly verbs: readonly Verb[];
@@ -278,8 +280,8 @@ export interface PromptContext {
278
280
  readonly protocol: string;
279
281
  /** Recent record, so a fresh agent has session context. */
280
282
  readonly log_excerpt?: string;
281
- /** Charter prose from the Charter. */
282
- readonly standing_orders?: string;
283
+ /** Prose of the Charter. */
284
+ readonly charter?: string;
283
285
  /**
284
286
  * Whether the protocol permits escalation (ADR-0006). Defaults to true. When
285
287
  * false — a Darwinist chamber — the agent is told there is no escalation:
@@ -295,7 +297,7 @@ export interface PromptContext {
295
297
  * agents: the same text goes to Claude Code and to Goose. Per-agent prompt
296
298
  * tuning would make cross-protocol comparisons meaningless, and comparing
297
299
  * behaviour under identical conditions is the entire point of the research
298
- * layer (RESEARCH.md § Human Flaw thesis).
300
+ * layer (RESEARCH.md).
299
301
  *
300
302
  * Structure: who you are, what you may do, what has happened, what to do now.
301
303
  */
@@ -305,6 +307,7 @@ export const composePrompt = (context: PromptContext): string => {
305
307
  '',
306
308
  `You are ${/^[AEIOU]/.test(context.role) ? 'an' : 'a'} **${context.role}** in a governed multi-agent session running the`,
307
309
  `**${context.protocol}** protocol. Session: \`${context.envelope.session_guid}\`.`,
310
+ `Your handle is \`${context.actor}\`. Every \`politik\` command you run acts as you: pass \`--actor ${context.actor} --role ${context.role}\`.`,
308
311
  '',
309
312
  '## Your mandate',
310
313
  '',
@@ -318,7 +321,7 @@ export const composePrompt = (context: PromptContext): string => {
318
321
  '',
319
322
  '## Charter',
320
323
  '',
321
- context.standing_orders?.trim() || '_None supplied. Follow CANON defaults._',
324
+ context.charter?.trim() || '_None supplied. Follow CANON defaults._',
322
325
  '',
323
326
  ];
324
327
 
package/src/ballot.ts CHANGED
@@ -16,7 +16,7 @@ import { isRole, type Role } from './canon.ts';
16
16
  import { appendEntry, parseEntries, type RecordEntry } from './log.ts';
17
17
  import { checkQuorum, type QuorumOverride } from './quorum.ts';
18
18
  import { createState, type SessionStateFile } from './state.ts';
19
- import { darwinistExit, seatOf } from './actors.ts';
19
+ import { eliminationExit, seatOf } from './actors.ts';
20
20
 
21
21
  /* -------------------------------------------------------------------------- */
22
22
  /* Votes */
@@ -284,7 +284,7 @@ export const removeByVote = (log: string, motion: string, at: string): RecordEnt
284
284
 
285
285
  /**
286
286
  * The elimination cull: under `exit: elimination`, the actors on the losing side
287
- * of a decided vote are removed (EXIT_DARWINIST). The minority is culled; a
287
+ * of a decided vote are removed (EXIT_ELIMINATED). The minority is culled; a
288
288
  * tie culls no one; abstainers took no side and survive. Only seated actors are
289
289
  * culled, so AUTHORITY — which holds no seat in the register — is never touched.
290
290
  * Returns the exit entries to append; empty under any other policy.
@@ -303,7 +303,7 @@ export const cull = (
303
303
  const entries: RecordEntry[] = [];
304
304
  for (const loser of losers) {
305
305
  const seat = seatOf(log, loser.actor);
306
- if (seat !== null) entries.push(darwinistExit(loser.actor, seat.role, at));
306
+ if (seat !== null) entries.push(eliminationExit(loser.actor, seat.role, at));
307
307
  }
308
308
  return entries;
309
309
  };
package/src/escalation.ts CHANGED
@@ -47,7 +47,7 @@ export interface EscalationInput {
47
47
  readonly state: SessionStateFile;
48
48
  /**
49
49
  * True when the Charter's protocol declares `session.escalation: disabled`
50
- * (ADR-0006). A protocol with no appeals — a Darwinist chamber — has no
50
+ * (ADR-0006). A protocol with no appeals — has no
51
51
  * mechanism to resolve an escalation, so it refuses to raise one at all.
52
52
  */
53
53
  readonly escalation_disabled?: boolean;
package/src/runner.ts CHANGED
@@ -313,6 +313,7 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
313
313
 
314
314
  const prompt = composePrompt({
315
315
  envelope,
316
+ actor: options.actor,
316
317
  role: options.role,
317
318
  // The role's own verbs, minus ESCALATE where the protocol allows no appeals.
318
319
  // A fixed READ/WRITE/ESCALATE list here told voting roles they could not vote.
@@ -324,7 +325,7 @@ export const runTurn = async (options: RunOptions): Promise<RunOutcome> => {
324
325
  ? (['VETO'] as const) : []),
325
326
  ],
326
327
  protocol: charter.protocol,
327
- standing_orders: charter.body,
328
+ charter: charter.body,
328
329
  log_excerpt: recentRecord(log),
329
330
  escalation_enabled: charter.session.escalation !== 'disabled',
330
331
  });