Refactor: Clean up obsolete files and organize codebase structure

This commit removes deprecated modules and reorganizes code into logical directories:

Deleted files (superseded by newer systems):
- claude_code_server.py (replaced by agent-sdk direct integration)
- heartbeat.py (superseded by scheduled_tasks.py)
- pulse_brain.py (unused in production)
- config/pulse_brain_config.py (obsolete config)

Created directory structure:
- examples/ (7 example files: example_*.py, demo_*.py)
- tests/ (5 test files: test_*.py)

Updated imports:
- agent.py: Removed heartbeat module and all enable_heartbeat logic
- bot_runner.py: Removed heartbeat parameter from Agent initialization
- llm_interface.py: Updated deprecated claude_code_server message

Preserved essential files:
- hooks.py (for future use)
- adapters/skill_integration.py (for future use)
- All Google integration tools (Gmail, Calendar, Contacts)
- GLM provider code (backward compatibility)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 09:57:39 -07:00
parent f018800d94
commit a8665d8c72
26 changed files with 1068 additions and 1067 deletions

View File

@@ -0,0 +1,85 @@
"""
Example: Pulse & Brain with ONLY YOUR chosen checks.
By default, pulse_brain.py includes example checks.
This shows how to start with a CLEAN SLATE and only add what YOU want.
"""
import time
from pathlib import Path
from agent import Agent
from pulse_brain import BrainTask, CheckType, PulseCheck, PulseBrain
def check_my_file() -> dict:
"""Check if the important data file exists."""
file = Path("important_data.json")
return {
"status": "ok" if file.exists() else "error",
"message": f"File exists: {file.exists()}",
}
def main() -> None:
agent = Agent(provider="claude", enable_heartbeat=False)
# Create Pulse & Brain with NO automatic checks
pb = PulseBrain(agent, pulse_interval=60)
# Remove all default checks (start clean)
pb.pulse_checks = []
pb.brain_tasks = []
print(
"Starting with ZERO checks. "
"You have complete control.\n"
)
# Add ONLY the checks you want
pb.pulse_checks.append(
PulseCheck(
"my-file", check_my_file,
interval_seconds=300,
),
)
pb.brain_tasks.append(
BrainTask(
name="file-recovery",
check_type=CheckType.CONDITIONAL,
prompt_template=(
"The file important_data.json is missing. "
"What should I do to recover it?"
),
condition_func=lambda data: (
data.get("status") == "error"
),
),
)
print("Added 1 pulse check: my-file")
print("Added 1 brain task: file-recovery")
print("\nThe agent will ONLY:")
print(
" 1. Check if important_data.json exists "
"(every 5 min, zero cost)"
)
print(
" 2. Ask for recovery help IF it's missing "
"(costs tokens)"
)
print("\nNothing else. You have complete control.\n")
pb.start()
try:
print("Running... Press Ctrl+C to stop\n")
while True:
time.sleep(1)
except KeyboardInterrupt:
pb.stop()
if __name__ == "__main__":
main()