Files
tatlock/src/core/startup.py
T
jpmschweitzerandClaude Opus 4.5 7426dd1ac3 feat: add Phase F.2 - The Biographer (memory agent)
Add The Biographer household member for user memory management:

Memory Service (direct access layer):
- src/core/memory_service.py for fast, LLM-free lookups
- Profile, preference, and fact management
- Session context with Redis caching
- Steward integration via prefetch_context()

The Biographer Agent:
- src/agents/biographer/ package with PydanticAI agent
- Discreet chronicler personality for privacy
- Tools: recall_semantic, list_memories, store_insight,
  update_profile, update_preference, forget_memory
- Registered with Household Registry on startup

Steward Integration:
- Memory context pre-fetch during analysis
- Profile/preferences included in Butler note
- Keyword-based context determination

Also includes:
- delegate_to_biographer() wrapper
- 34 new tests (capability + memory service)
- Version bump to 1.2.0

Documentation cleanup:
- Removed obsolete PHASE2_COMPLETE.md, PHASE2_PLAN.md
- Removed docs/library-desk-requirements.md
- Moved ORCHESTRATION_SCENARIOS.md to project root

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 19:20:18 +01:00

90 lines
2.5 KiB
Python

"""
Application startup module.
Handles initialization of household registry and other startup tasks.
This module should be called during application startup to register
all household members.
"""
from src.agents.biographer import register_biographer
from src.agents.librarian import register_librarian
from src.agents.tatlock_core import TATLOCK_CORE_CAPABILITY, tatlock_core_tools
from src.core.household_registry import get_household_registry
from src.core.logging_config import get_logger
logger = get_logger(__name__)
def register_household_members():
"""
Register all household members with the registry.
This function should be called during application startup to make
household capabilities available to the Steward.
Currently registers:
- tatlock_core: Butler's core tools (calculator, datetime, web search)
- librarian: Research and knowledge management (Phase 3)
- biographer: User memory and context management (Phase F)
"""
registry = get_household_registry()
logger.info("household_registration_starting")
# Register Tatlock's core tools
registry.register(
name="tatlock_core",
capability=TATLOCK_CORE_CAPABILITY,
tools=tatlock_core_tools,
agent=None, # No expert agent for core tools
)
logger.info(
"household_member_registered",
name="tatlock_core",
tool_count=len(tatlock_core_tools),
)
# Register The Librarian (Phase 3)
try:
register_librarian()
except Exception as e:
# Don't fail startup if Librarian registration fails
logger.warning(
"librarian_registration_failed",
error=str(e),
)
# Register The Biographer (Phase F)
try:
register_biographer()
except Exception as e:
# Don't fail startup if Biographer registration fails
logger.warning(
"biographer_registration_failed",
error=str(e),
)
logger.info(
"household_registration_complete",
total_members=len(registry),
)
def initialize_application():
"""
Initialize the application.
Performs all startup tasks:
1. Register household members
2. (Future) Initialize connections
3. (Future) Load configuration
This should be called once during application startup.
"""
logger.info("application_initialization_starting")
# Register household members
register_household_members()
logger.info("application_initialization_complete")