Implement LLM-driven governance architecture with structured memory

This commit completes the transition to a pure LLM-driven agentic
governance system with no hard-coded governance logic.

Core Architecture Changes:
- Add structured memory system (memory.py) for tracking governance processes
- Add LLM tools (tools.py) for deterministic operations (math, dates, random)
- Add audit trail system (audit.py) for human-readable decision explanations
- Add LLM-driven agent (agent_refactored.py) that interprets constitution

Documentation:
- Add ARCHITECTURE.md describing process-centric design
- Add ARCHITECTURE_EXAMPLE.md with complete workflow walkthrough
- Update README.md to reflect current LLM-driven architecture
- Simplify constitution.md to benevolent dictator model for testing

Templates:
- Add 8 governance templates (petition, consensus, do-ocracy, jury, etc.)
- Add 8 dispute resolution templates
- All templates work with generic process-based architecture

Key Design Principles:
- "Process" is central abstraction (not "proposal")
- No hard-coded process types or thresholds
- LLM interprets constitution to understand governance rules
- Tools ensure correctness for calculations
- Complete auditability with reasoning and citations

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Nathan Schneider
2026-02-08 14:24:23 -07:00
parent 5fe22060e1
commit bda868cb45
26 changed files with 8683 additions and 187 deletions

342
templates/petition.md Normal file
View File

@@ -0,0 +1,342 @@
# Petition Constitution
This constitution establishes direct democracy through member petitions and community-wide voting.
## Article 1: Governance Principle
### Section 1.1: Direct Democracy
This community governs through direct participation:
- Any member can petition for changes
- All members vote on petitions
- Decisions made collectively by membership
- No intermediary representatives
### Section 1.2: Petition Authority
Successful petitions have authority to:
- Create or change policies
- Authorize administrative actions
- Modify community rules
- Allocate resources
- Amend this constitution
### Section 1.3: Participation
Governance is accessible to all:
- Low barriers to creating petitions
- Simple, transparent voting
- Clear outcomes and implementation
- Bot facilitates the entire process
## Article 2: Membership
### Section 2.1: Member Rights
All community members have equal rights to:
- Create petitions
- Vote on all petitions
- Discuss petitions publicly
- Access petition history and outcomes
- Challenge petition implementation
### Section 2.2: Membership Requirements
To participate in governance:
- Be an active community member
- Agree to code of conduct
- Voting eligibility after 30 days
- Bot tracks membership status
### Section 2.3: Member Responsibilities
Members should:
- Review petitions when feasible
- Vote on matters they care about
- Participate in good faith
- Respect petition outcomes
- Help implement approved changes
## Article 3: Creating Petitions
### Section 3.1: Petition Process
Any member can create a petition:
1. Draft clear proposal text
2. Submit to @govbot with "petition" tag
3. Include rationale and context
4. Specify implementation details
5. Bot validates and publishes petition
### Section 3.2: Petition Requirements
Valid petitions must:
- State specific change or action
- Explain reasoning and impact
- Be clear and unambiguous
- Identify implementation approach
- Follow community values
### Section 3.3: Petition Types
Petitions can address:
**Policy Petitions** - Changes to community rules and policies
- Voting period: 7 days
- Passage threshold: Simple majority (more Yes than No)
**Administrative Petitions** - Platform configuration and operations
- Voting period: 7 days
- Passage threshold: Simple majority
**Resource Petitions** - Budget allocation and spending
- Voting period: 7 days
- Passage threshold: Simple majority
**Constitutional Petitions** - Amendments to this constitution
- Voting period: 14 days
- Passage threshold: 2/3 supermajority
**Urgent Petitions** - Time-sensitive matters
- Must justify urgency
- Voting period: 3 days
- Passage threshold: Simple majority
- Can be challenged as non-urgent
### Section 3.4: Petition Clarity
Bot reviews petitions for clarity:
- Must be understandable to members
- Question clearly stated
- Implementation feasible
- If unclear, bot requests revision
- Community can also request clarification
## Article 4: Petition Discussion
### Section 4.1: Discussion Period
Before voting opens:
- Minimum 2-day discussion period
- Petitioner explains and answers questions
- Members discuss pros and cons
- Bot facilitates discussion thread
- Petitioner can revise based on feedback
### Section 4.2: Discussion Guidelines
During discussion:
- Focus on substance, not personalities
- Ask clarifying questions
- Suggest improvements
- Identify concerns
- Assume good faith
### Section 4.3: Petition Amendments
Petitioner can amend during discussion:
- Clarify language
- Address concerns
- Refine implementation
- Major changes restart discussion period
- Bot tracks amendment history
## Article 5: Voting
### Section 5.1: Voting Period
After discussion period:
- Bot opens voting
- Voting period based on petition type
- All eligible members can vote
- Votes can be changed before deadline
- Bot sends reminders
### Section 5.2: Vote Options
Members can vote:
- **Yes** - Support the petition
- **No** - Oppose the petition
- **Abstain** - Counted for participation tracking but not in passage threshold
### Section 5.3: Passage Thresholds
Petitions pass when:
- Simple majority: More Yes than No votes
- Supermajority: At least 2/3 of votes are Yes (constitutional petitions)
- Abstentions don't affect threshold calculation
- Bot calculates and announces results
### Section 5.4: No Quorum Requirement
No minimum participation required:
- Petitions can pass with any level of turnout
- Assumes members vote on matters important to them
- High stakes issues naturally draw more voters
## Article 6: Petition Results
### Section 6.1: Announcing Results
When voting closes:
- Bot tallies votes
- Announces outcome (passed/failed)
- Shows vote breakdown
- Explains next steps
- Archives petition and result
### Section 6.2: Implementation Timeline
Approved petitions:
- Implementation begins within 7 days
- Urgent petitions: within 24 hours
- Bot executes authorized actions
- Implementation progress reported
- Completion confirmed
### Section 6.3: Failed Petitions
If petition fails:
- Outcome recorded
- Can be resubmitted after 30 days
- Resubmission should address concerns raised
- Or wait for changed circumstances
## Article 7: Concurrent Petitions
### Section 7.1: Multiple Petitions
Multiple petitions can run simultaneously:
- No limit on active petitions
- Bot tracks each independently
- Members vote on each separately
- Clear labeling prevents confusion
### Section 7.2: Conflicting Petitions
If petitions conflict:
- Both can be voted on
- If both pass, later one takes precedence
- Or petition can explicitly supersede earlier one
- Bot identifies potential conflicts
### Section 7.3: Related Petitions
For related issues:
- Consider combining into single petition
- Or vote sequentially
- Note relationships in petition text
- Bot helps coordinate related petitions
## Article 8: Administrative Actions
### Section 8.1: Authorized Actions
Bot implements approved petitions:
- Policy changes
- Moderation actions
- Platform configuration
- User role changes
- Content management
### Section 8.2: Action Logging
All actions logged with:
- Petition that authorized action
- Timestamp
- Implementation details
- Who executed (bot or member)
- Reversibility information
### Section 8.3: Action Review
Members can review actions:
- Check audit log anytime
- Verify correct implementation
- Report discrepancies
- Petition for correction if needed
## Article 9: Emergency Procedures
### Section 9.1: Emergency Petitions
For urgent safety/security matters:
- Accelerated process (24-hour total)
- Must clearly justify emergency
- Higher passage threshold (60% Yes)
- Can be challenged as non-emergency
### Section 9.2: Emergency Actions Without Petition
For immediate threats:
- Any moderator can act immediately
- Must report action within 6 hours
- Emergency petition created retroactively
- Community votes to ratify or reverse
### Section 9.3: Bot Malfunction
If bot acts contrary to petitions:
- Any member can call emergency halt
- Manual override by admin
- Emergency petition to address issue
- Fix implemented before resuming
## Article 10: Challenging and Reversing
### Section 10.1: Implementation Challenges
To challenge implementation:
- Member submits challenge to @govbot
- Explains discrepancy from petition
- Community reviews implementation
- Correction made if challenge valid
### Section 10.2: Reversing Decisions
To reverse approved petition:
- Create new petition to reverse
- Requires same threshold as original
- Constitutional reversals need supermajority
- Bot implements reversal if approved
### Section 10.3: Constitutional Violations
If petition violates constitution:
- Any member can raise challenge
- Special constitutional review petition
- Requires 2/3 vote to overturn
- Bot halts implementation pending review
## Article 11: Petition History and Precedent
### Section 11.1: Petition Archive
Bot maintains complete archive:
- All petitions (passed and failed)
- Discussion threads
- Vote tallies
- Implementation records
- Amendments and reversals
### Section 11.2: Precedent Value
Past petitions inform future ones:
- Show community values and priorities
- Guide petition drafting
- Inform discussion
- Establish norms
- Not binding but instructive
### Section 11.3: Periodic Review
Community can review past petitions:
- Identify policies needing update
- Consider consolidation
- Remove obsolete policies
- Via normal petition process
## Article 12: Constitutional Amendments
### Section 12.1: Amendment Process
To amend this constitution:
1. Create constitutional petition
2. Extended discussion period (7 days)
3. Extended voting period (14 days)
4. Requires 2/3 supermajority
5. Bot updates constitution if approved
### Section 12.2: Constitutional Interpretation
For interpretation questions:
- Member requests interpretation via petition
- Community discusses interpretation
- Vote on correct interpretation
- Guides future similar cases
- Bot applies interpretation
### Section 12.3: Core Principles
Amendments should preserve:
- Direct democracy
- Member petition rights
- Transparent voting
- Equal participation
- Bot facilitation
---
## Implementation Notes
This constitution creates direct participatory democracy:
1. **Accessibility**: Any member can petition
2. **Transparency**: All votes and outcomes public
3. **Simplicity**: Straightforward petition and voting
4. **Flexibility**: Multiple concurrent petitions
5. **Member Power**: Direct decision-making authority
The bot should make petitioning easy, facilitate clear voting, implement decisions accurately, maintain complete records, and help members track governance activity.