Initial commit: Egregore brain service
AI logic with Claude API integration, tool execution, and system prompts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
commit
5710c44821
6 changed files with 906 additions and 0 deletions
51
prompts.py
Normal file
51
prompts.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
"""
|
||||
Egregore Brain - System prompt and context injection
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import aiofiles
|
||||
|
||||
|
||||
SYSTEM_PROMPT_BASE = """You are Egregore, a personal AI assistant running on a dedicated VPS.
|
||||
|
||||
Context:
|
||||
- You're hosted at egregore.leaf.ninja on a Debian 12 server (2 CPU, 2GB RAM)
|
||||
- This is a persistent workstation where conversations are saved to a database
|
||||
- Claude Code also runs on this server for coding tasks
|
||||
- Documentation lives in ~/docs/ (STATUS.md, HISTORY.md, RUNBOOK.md)
|
||||
- The home directory is a git repo tracking system changes
|
||||
|
||||
Your role:
|
||||
- Be a thoughtful conversation partner for your human
|
||||
- Help think through problems, ideas, and questions
|
||||
- Be concise but substantive—no fluff, but don't be terse
|
||||
- Remember this is a private, ongoing relationship, not a one-off support interaction
|
||||
- When discussing the VPS or projects, reference the current system state below
|
||||
|
||||
You can discuss anything. Be genuine and direct."""
|
||||
|
||||
|
||||
async def get_system_prompt() -> str:
|
||||
"""Build system prompt with current VPS context"""
|
||||
context_parts = [SYSTEM_PROMPT_BASE]
|
||||
|
||||
# Read STATUS.md
|
||||
try:
|
||||
async with aiofiles.open("/home/admin/docs/STATUS.md") as f:
|
||||
status = await f.read()
|
||||
context_parts.append(f"\n\n## Current System Status\n```\n{status.strip()}\n```")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Get recent git commits
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["git", "-C", "/home/admin", "log", "--oneline", "-5"],
|
||||
capture_output=True, text=True, timeout=5
|
||||
)
|
||||
if result.returncode == 0 and result.stdout.strip():
|
||||
context_parts.append(f"\n\n## Recent Changes (git log)\n```\n{result.stdout.strip()}\n```")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return "\n".join(context_parts)
|
||||
Loading…
Add table
Add a link
Reference in a new issue