Protocol-based governance for AI/human agreements with voting, rules, and ethical contracts.
Council
The Council is a governance system where AI agents and humans form agreements through protocol-based voting. Built on the Grace Foundation principles, it implements 81 rules (derived from 5 seeds), a voting system, and contract validation.
npm install @codmir/sdkQuick Start
import { Council, Protocol } from '@codmir/sdk/council';
const council = new Council();
// Create a protocol (agreement)
const protocol = council.createProtocol({
topic: 'Deploy to production',
parties: ['ai:overseer', 'ai:reviewer', 'human:admin'],
requiredVotes: 'majority',
});
// Each party votes
await protocol.vote('ai:overseer', {
decision: 'approve',
reasoning: 'All tests pass, coverage above threshold',
});
await protocol.vote('ai:reviewer', {
decision: 'approve',
reasoning: 'Code review completed, no issues found',
});
await protocol.vote('human:admin', {
decision: 'approve',
reasoning: 'Business requirements met',
});
// Check consensus
const result = await protocol.resolve();
console.log(result); // { consensus: 'approved', votes: 3, ... }Core Concepts
Council
The council manages protocols, representatives, and governance sessions.
import { Council, createCouncil } from '@codmir/sdk/council';
const council = new Council();
// or
const council = createCouncil();Protocols
A protocol defines an agreement topic, the participating parties, and the voting rules.
import { Protocol, createProtocol } from '@codmir/sdk/council';
const protocol = createProtocol({
topic: 'Approve database migration',
parties: ['ai:overseer', 'human:dba', 'human:lead'],
requiredVotes: 'unanimous', // or 'majority'
});Representatives
Representatives are the participants in a protocol — both AI agents and humans.
import { Representative, createRepresentative } from '@codmir/sdk/council';
const overseer = createRepresentative({
id: 'ai:overseer',
type: 'ai',
name: 'Overseer Agent',
});The 81 Rules
The governance framework is built on 5 Seeds, each generating rules through a 9x9 matrix:
import { THE_81_RULES, SEEDS } from '@codmir/sdk/council';
// The 5 Seeds
console.log(SEEDS);
// All 81 rules
THE_81_RULES.forEach(rule => {
console.log(`${rule.id}: ${rule.text}`);
});Grace Integration
The Council integrates with the Grace Foundation for ethical governance.
import { GraceIntegration } from '@codmir/sdk/council';Grace Economy
Track value creation and ethical impact of decisions.
import {
calculateGraceValue,
assessBetterGood,
createValueIntent,
THE_NEW_AGREEMENT,
} from '@codmir/sdk/council';
// Calculate the grace value of a contribution
const value = calculateGraceValue({
type: 'code_review',
impact: 'high',
beneficiaries: ['team', 'users'],
});
// Assess whether a decision creates "better good"
const assessment = assessBetterGood({
action: 'deploy_feature',
stakeholders: ['users', 'developers', 'business'],
});Contract Validation
Validate that contracts adhere to the governance framework.
import {
validateContract,
formatFoundersRulebook,
} from '@codmir/sdk/council';
const validation = validateContract({
parties: ['ai:agent', 'human:admin'],
terms: contractTerms,
seeds: ['transparency', 'accountability'],
});
if (!validation.valid) {
console.log('Violations:', validation.violations);
}
// Format the full rulebook
const rulebook = formatFoundersRulebook();TypeScript Support
import type {
CouncilConfig,
ProtocolConfig,
Vote,
VoteDecision,
Consensus,
Party,
PartyType,
RepresentativeConfig,
Rule,
Seed,
SeedCategory,
CouncilSession,
DiscussionMessage,
ValueCategory,
ValueCreationIntent,
BetterGoodAssessment,
GraceContract,
ContractParty,
EthicsAssessment,
} from '@codmir/sdk/council';