Switch to LLM-driven agent with zero hard-coded governance logic
Replace old rule-based agent with pure LLM interpretation system. Agent Changes: - Rename agent.py → agent_legacy.py (preserve old hard-coded agent) - Rename agent_refactored.py → agent.py (make LLM agent primary) - Agent now interprets constitution to understand authority and processes - No hard-coded checks for specific users, roles, or governance models - Fully generic: works with any constitutional design Constitution Interpreter: - Updated interpret_proposal() to detect authority structures from text - LLM determines who has decision-making power from constitution - No assumptions about voting, proposals, or specific governance models Mastodon Formatting: - Improved line break handling for bullet points and paragraphs - Better plain-text formatting for Mastodon posts Primitives: - Added support for admin_approval threshold type Architecture: - Bot now uses pure LLM interpretation instead of scripted logic - Each instance can develop implementation guidelines separately - Guidelines not included in main codebase (instance-specific) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -679,15 +679,30 @@ class MastodonAdapter(PlatformAdapter):
|
||||
text = re.sub(r'_([^_]+)_', r'\1', text) # _italic_ -> italic
|
||||
text = re.sub(r'`([^`]+)`', r'\1', text) # `code` -> code
|
||||
|
||||
# Remove headers but keep the text
|
||||
text = re.sub(r'^#{1,6}\s+', '', text, flags=re.MULTILINE)
|
||||
# Remove headers but keep the text with extra spacing
|
||||
text = re.sub(r'^#{1,6}\s+(.+)$', r'\1\n', text, flags=re.MULTILINE)
|
||||
|
||||
# Convert Markdown lists to simple text with bullets
|
||||
# Ensure each bullet point is on its own line
|
||||
text = re.sub(r'^\s*[-*+]\s+', '• ', text, flags=re.MULTILINE)
|
||||
|
||||
# Remove link formatting but keep URLs: [text](url) -> text (url)
|
||||
text = re.sub(r'\[([^\]]+)\]\(([^\)]+)\)', r'\1 (\2)', text)
|
||||
|
||||
# Ensure proper paragraph spacing for Mastodon
|
||||
# Replace single newlines within paragraphs, but preserve double newlines
|
||||
# First, protect double (or more) newlines
|
||||
text = re.sub(r'\n\n+', '<<<PARAGRAPH>>>', text)
|
||||
# Then ensure bullet points and other single newlines are preserved
|
||||
# (Mastodon respects single newlines in plain text)
|
||||
# Restore paragraph breaks
|
||||
text = text.replace('<<<PARAGRAPH>>>', '\n\n')
|
||||
|
||||
# Clean up any extra whitespace but preserve intentional line breaks
|
||||
text = re.sub(r' +', ' ', text) # Multiple spaces -> single space
|
||||
text = re.sub(r'\n ', '\n', text) # Remove spaces after newlines
|
||||
text = re.sub(r' \n', '\n', text) # Remove spaces before newlines
|
||||
|
||||
return text
|
||||
|
||||
def _map_visibility(self, visibility: MessageVisibility) -> str:
|
||||
|
||||
Reference in New Issue
Block a user