74 lines
2.3 KiB
Python
74 lines
2.3 KiB
Python
"""Scribe Mode - Generates the post-stream markdown ledger."""
|
|
|
|
import logging
|
|
from datetime import datetime
|
|
from app.llm.client import LLMClient
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class ScribeMode:
|
|
"""
|
|
Scribe - The chronicler of the stream's story.
|
|
|
|
Purpose:
|
|
- Compiles session data into a markdown ledger
|
|
- Generates blog post seeds
|
|
- Identifies clip candidates
|
|
- Exports final summary document
|
|
|
|
Policy:
|
|
- Activates at end of stream
|
|
- Reads data from Librarian, Warden, and repository
|
|
- Creates structured markdown output
|
|
- Organizes clips and blog topics
|
|
- Ready for post-processing or publishing
|
|
"""
|
|
|
|
def __init__(self, llm_client: LLMClient):
|
|
"""Initialize Scribe mode."""
|
|
self.llm_client = llm_client
|
|
self.ledger_entries: list[str] = []
|
|
|
|
async def add_entry(self, section: str, content: str) -> None:
|
|
"""Add an entry to the ledger."""
|
|
self.ledger_entries.append(f"## {section}\n{content}")
|
|
logger.debug(f"Scribe recorded ledger entry: {section}")
|
|
|
|
async def compile_ledger(
|
|
self,
|
|
theme: str,
|
|
discussion_points: list[str],
|
|
agent_actions: list[str],
|
|
clip_candidates: list[str],
|
|
blog_seeds: list[str],
|
|
) -> str:
|
|
"""Compile all data into a markdown ledger."""
|
|
date = datetime.utcnow().strftime("%Y-%m-%d")
|
|
|
|
ledger = f"# Sanctum Ledger — {date}\n\n"
|
|
ledger += f"## Stream Theme\n{theme}\n\n"
|
|
ledger += f"## Notable Discussion\n"
|
|
for point in discussion_points:
|
|
ledger += f"- {point}\n"
|
|
ledger += "\n"
|
|
ledger += f"## Agent Actions\n"
|
|
for action in agent_actions:
|
|
ledger += f"- {action}\n"
|
|
ledger += "\n"
|
|
ledger += f"## Clip Candidates\n"
|
|
for clip in clip_candidates:
|
|
ledger += f"- {clip}\n"
|
|
ledger += "\n"
|
|
ledger += f"## Blog Seeds\n"
|
|
for seed in blog_seeds:
|
|
ledger += f"- {seed}\n"
|
|
|
|
logger.info("Scribe compiled stream ledger")
|
|
return ledger
|
|
|
|
async def export_ledger(self, filename: str, content: str) -> None:
|
|
"""Export ledger to file."""
|
|
# Actual export handled by MarkdownExporter
|
|
logger.info(f"Scribe prepared ledger for export: {filename}")
|